@xoxno/sdk-js 1.0.214 → 1.0.215

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.esm.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see index.esm.js.LICENSE.txt */
2
- "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as t,Address as e,BASE_FEE as r,Contract as o,ScInt as n,TransactionBuilder as i,scValToNative as u,xdr as s}from"@stellar/stellar-sdk";var a={526(t,e){e.byteLength=function(t){var e=s(t),r=e[0],o=e[1];return 3*(r+o)/4-o},e.toByteArray=function(t){var e,r,i=s(t),u=i[0],a=i[1],p=new n(function(t,e,r){return 3*(e+r)/4-r}(0,u,a)),l=0,c=a>0?u-4:u;for(r=0;r<c;r+=4)e=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],p[l++]=e>>16&255,p[l++]=e>>8&255,p[l++]=255&e;return 2===a&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,p[l++]=255&e),1===a&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,p[l++]=e>>8&255,p[l++]=255&e),p},e.fromByteArray=function(t){for(var e,o=t.length,n=o%3,i=[],u=16383,s=0,p=o-n;s<p;s+=u)i.push(a(t,s,s+u>p?p:s+u));return 1===n?(e=t[o-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===n&&(e=(t[o-2]<<8)+t[o-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),i.join("")};for(var r=[],o=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)r[u]=i[u],o[i.charCodeAt(u)]=u;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function a(t,e,o){for(var n,i,u=[],s=e;s<o;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),u.push(r[(i=n)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return u.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},287(t,e,r){const o=r(526),n=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=a,e.IS=50;const u=2147483647;function s(t){if(t>u)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return p(t,e,r)}function p(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let o=s(r);const n=o.write(t,e);return n!==r&&(o=o.slice(0,n)),o}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return f(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return f(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return f(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const o=t.valueOf&&t.valueOf();if(null!=o&&o!==t)return a.from(o,e,r);const n=function(t){if(a.isBuffer(t)){const e=0|h(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||Z(t.length)?s(0):d(t):"Buffer"===t.type&&Array.isArray(t.data)?d(t.data):void 0}(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return l(t),s(t<0?0:0|h(t))}function d(t){const e=t.length<0?0:0|h(t.length),r=s(e);for(let o=0;o<e;o+=1)r[o]=255&t[o];return r}function f(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let o;return o=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(o,a.prototype),o}function h(t){if(t>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return 0|t}function y(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===r)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return o?-1:j(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){let o=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return _(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return E(this,e,r);case"base64":return q(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),o=!0}}function m(t,e,r){const o=t[e];t[e]=t[r],t[r]=o}function b(t,e,r,o,n){if(0===t.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:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=a.from(e,o)),a.isBuffer(e))return 0===e.length?-1:w(t,e,r,o,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,o,n);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,o,n){let i,u=1,s=t.length,a=e.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(t.length<2||e.length<2)return-1;u=2,s/=2,a/=2,r/=2}function p(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}if(n){let o=-1;for(i=r;i<s;i++)if(p(t,i)===p(e,-1===o?0:i-o)){if(-1===o&&(o=i),i-o+1===a)return o*u}else-1!==o&&(i-=i-o),o=-1}else for(r+a>s&&(r=s-a),i=r;i>=0;i--){let r=!0;for(let o=0;o<a;o++)if(p(t,i+o)!==p(e,o)){r=!1;break}if(r)return i}return-1}function S(t,e,r,o){r=Number(r)||0;const n=t.length-r;o?(o=Number(o))>n&&(o=n):o=n;const i=e.length;let u;for(o>i/2&&(o=i/2),u=0;u<o;++u){const o=parseInt(e.substr(2*u,2),16);if(Z(o))return u;t[r+u]=o}return u}function v(t,e,r,o){return X(j(e,t.length-r),t,r,o)}function x(t,e,r,o){return X(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,o)}function T(t,e,r,o){return X(H(e),t,r,o)}function A(t,e,r,o){return X(function(t,e){let r,o,n;const i=[];for(let u=0;u<t.length&&!((e-=2)<0);++u)r=t.charCodeAt(u),o=r>>8,n=r%256,i.push(n),i.push(o);return i}(e,t.length-r),t,r,o)}function q(t,e,r){return 0===e&&r===t.length?o.fromByteArray(t):o.fromByteArray(t.slice(e,r))}function _(t,e,r){r=Math.min(t.length,r);const o=[];let n=e;for(;n<r;){const e=t[n];let i=null,u=e>239?4:e>223?3:e>191?2:1;if(n+u<=r){let r,o,s,a;switch(u){case 1:e<128&&(i=e);break;case 2:r=t[n+1],128==(192&r)&&(a=(31&e)<<6|63&r,a>127&&(i=a));break;case 3:r=t[n+1],o=t[n+2],128==(192&r)&&128==(192&o)&&(a=(15&e)<<12|(63&r)<<6|63&o,a>2047&&(a<55296||a>57343)&&(i=a));break;case 4:r=t[n+1],o=t[n+2],s=t[n+3],128==(192&r)&&128==(192&o)&&128==(192&s)&&(a=(15&e)<<18|(63&r)<<12|(63&o)<<6|63&s,a>65535&&a<1114112&&(i=a))}}null===i?(i=65533,u=1):i>65535&&(i-=65536,o.push(i>>>10&1023|55296),i=56320|1023&i),o.push(i),n+=u}return function(t){const e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);let r="",o=0;for(;o<e;)r+=String.fromCharCode.apply(String,t.slice(o,o+=k));return r}(o)}a.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),a.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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,r){return p(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return function(t,e,r){return l(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},a.allocUnsafe=function(t){return c(t)},a.allocUnsafeSlow=function(t){return c(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(Y(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,o=e.length;for(let n=0,i=Math.min(r,o);n<i;++n)if(t[n]!==e[n]){r=t[n],o=e[n];break}return r<o?-1:o<r?1:0},a.isEncoding=function(t){switch(String(t).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}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const o=a.allocUnsafe(e);let n=0;for(r=0;r<t.length;++r){let e=t[r];if(Y(e,Uint8Array))n+e.length>o.length?(a.isBuffer(e)||(e=a.from(e)),e.copy(o,n)):Uint8Array.prototype.set.call(o,e,n);else{if(!a.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(o,n)}n+=e.length}return o},a.byteLength=y,a.prototype._isBuffer=!0,a.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},a.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},a.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},a.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?_(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){let t="";const r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(t,e,r,o,n){if(Y(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===o&&(o=0),void 0===n&&(n=this.length),e<0||r>t.length||o<0||n>this.length)throw new RangeError("out of range index");if(o>=n&&e>=r)return 0;if(o>=n)return-1;if(e>=r)return 1;if(this===t)return 0;let i=(n>>>=0)-(o>>>=0),u=(r>>>=0)-(e>>>=0);const s=Math.min(i,u),p=this.slice(o,n),l=t.slice(e,r);for(let t=0;t<s;++t)if(p[t]!==l[t]){i=p[t],u=l[t];break}return i<u?-1:u<i?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},a.prototype.write=function(t,e,r,o){if(void 0===e)o="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)o=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===o&&(o="utf8")):(o=r,r=void 0)}const n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let i=!1;for(;;)switch(o){case"hex":return S(this,t,e,r);case"utf8":case"utf-8":return v(this,t,e,r);case"ascii":case"latin1":case"binary":return x(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function I(t,e,r){let o="";r=Math.min(t.length,r);for(let n=e;n<r;++n)o+=String.fromCharCode(127&t[n]);return o}function E(t,e,r){let o="";r=Math.min(t.length,r);for(let n=e;n<r;++n)o+=String.fromCharCode(t[n]);return o}function P(t,e,r){const o=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>o)&&(r=o);let n="";for(let o=e;o<r;++o)n+=K[t[o]];return n}function R(t,e,r){const o=t.slice(e,r);let n="";for(let t=0;t<o.length-1;t+=2)n+=String.fromCharCode(o[t]+256*o[t+1]);return n}function O(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,o,n,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<i)throw new RangeError('"value" argument is out of bounds');if(r+o>t.length)throw new RangeError("Index out of range")}function B(t,e,r,o,n){F(e,o,n,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i;let u=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=u,u>>=8,t[r++]=u,u>>=8,t[r++]=u,u>>=8,t[r++]=u,r}function U(t,e,r,o,n){F(e,o,n,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i>>=8,t[r+6]=i,i>>=8,t[r+5]=i,i>>=8,t[r+4]=i;let u=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=u,u>>=8,t[r+2]=u,u>>=8,t[r+1]=u,u>>=8,t[r]=u,r+8}function C(t,e,r,o,n,i){if(r+o>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function $(t,e,r,o,i){return e=+e,r>>>=0,i||C(t,0,r,4),n.write(t,e,r,o,23,4),r+4}function N(t,e,r,o,i){return e=+e,r>>>=0,i||C(t,0,r,8),n.write(t,e,r,o,52,8),r+8}a.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const o=this.subarray(t,e);return Object.setPrototypeOf(o,a.prototype),o},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let o=this[t],n=1,i=0;for(;++i<e&&(n*=256);)o+=this[t+i]*n;return o},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let o=this[t+--e],n=1;for(;e>0&&(n*=256);)o+=this[t+--e]*n;return o},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readBigUInt64LE=J((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const o=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,n=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(o)+(BigInt(n)<<BigInt(32))})),a.prototype.readBigUInt64BE=J((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const o=e*2**24+65536*this[++t]+256*this[++t]+this[++t],n=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(o)<<BigInt(32))+BigInt(n)})),a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let o=this[t],n=1,i=0;for(;++i<e&&(n*=256);)o+=this[t+i]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*e)),o},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let o=e,n=1,i=this[t+--o];for(;o>0&&(n*=256);)i+=this[t+--o]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readBigInt64LE=J((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const o=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(o)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),a.prototype.readBigInt64BE=J((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const o=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(o)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),a.prototype.readFloatLE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,o){t=+t,e>>>=0,r>>>=0,o||M(this,t,e,r,Math.pow(2,8*r)-1,0);let n=1,i=0;for(this[e]=255&t;++i<r&&(n*=256);)this[e+i]=t/n&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,o){t=+t,e>>>=0,r>>>=0,o||M(this,t,e,r,Math.pow(2,8*r)-1,0);let n=r-1,i=1;for(this[e+n]=255&t;--n>=0&&(i*=256);)this[e+n]=t/i&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigUInt64LE=J((function(t,e=0){return B(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeBigUInt64BE=J((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeIntLE=function(t,e,r,o){if(t=+t,e>>>=0,!o){const o=Math.pow(2,8*r-1);M(this,t,e,r,o-1,-o)}let n=0,i=1,u=0;for(this[e]=255&t;++n<r&&(i*=256);)t<0&&0===u&&0!==this[e+n-1]&&(u=1),this[e+n]=(t/i|0)-u&255;return e+r},a.prototype.writeIntBE=function(t,e,r,o){if(t=+t,e>>>=0,!o){const o=Math.pow(2,8*r-1);M(this,t,e,r,o-1,-o)}let n=r-1,i=1,u=0;for(this[e+n]=255&t;--n>=0&&(i*=256);)t<0&&0===u&&0!==this[e+n+1]&&(u=1),this[e+n]=(t/i|0)-u&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigInt64LE=J((function(t,e=0){return B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeBigInt64BE=J((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeFloatLE=function(t,e,r){return $(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return $(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,o){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),o||0===o||(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o<r&&(o=r),o===r)return 0;if(0===t.length||0===this.length)return 0;if(e<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),t.length-e<o-r&&(o=t.length-e+r);const n=o-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,o):Uint8Array.prototype.set.call(t,this.subarray(r,o),e),n},a.prototype.fill=function(t,e,r,o){if("string"==typeof t){if("string"==typeof e?(o=e,e=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&&!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===t.length){const e=t.charCodeAt(0);("utf8"===o&&e<128||"latin1"===o)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let n;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(n=e;n<r;++n)this[n]=t;else{const i=a.isBuffer(t)?t:a.from(t,o),u=i.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(n=0;n<r-e;++n)this[n+e]=i[n%u]}return this};const L={};function D(t,e,r){L[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function W(t){let e="",r=t.length;const o="-"===t[0]?1:0;for(;r>=o+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function F(t,e,r,o,n,i){if(t>r||t<e){const o="bigint"==typeof e?"n":"";let n;throw n=i>3?0===e||e===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}`:`>= ${e}${o} and <= ${r}${o}`,new L.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,r){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||G(e,t.length-(r+1))}(o,n,i)}function z(t,e){if("number"!=typeof t)throw new L.ERR_INVALID_ARG_TYPE(e,"number",t)}function G(t,e,r){if(Math.floor(t)!==t)throw z(t,r),new L.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new L.ERR_BUFFER_OUT_OF_BOUNDS;throw new L.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(t,e,r){let o=`The value of "${t}" 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 ${e}. Received ${n}`,o}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function j(t,e){let r;e=e||1/0;const o=t.length;let n=null;const i=[];for(let u=0;u<o;++u){if(r=t.charCodeAt(u),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(u+1===o){(e-=3)>-1&&i.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&i.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=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((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function H(t){return o.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,r,o){let n;for(n=0;n<o&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const K=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const o=16*r;for(let n=0;n<16;++n)e[o+n]=t[r]+t[n]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},251(t,e){e.read=function(t,e,r,o,n){var i,u,s=8*n-o-1,a=(1<<s)-1,p=a>>1,l=-7,c=r?n-1:0,d=r?-1:1,f=t[e+c];for(c+=d,i=f&(1<<-l)-1,f>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=d,l-=8);for(u=i&(1<<-l)-1,i>>=-l,l+=o;l>0;u=256*u+t[e+c],c+=d,l-=8);if(0===i)i=1-p;else{if(i===a)return u?NaN:1/0*(f?-1:1);u+=Math.pow(2,o),i-=p}return(f?-1:1)*u*Math.pow(2,i-o)},e.write=function(t,e,r,o,n,i){var u,s,a,p=8*i-n-1,l=(1<<p)-1,c=l>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=o?0:i-1,h=o?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=l):(u=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-u))<1&&(u--,a*=2),(e+=u+c>=1?d/a:d*Math.pow(2,1-c))*a>=2&&(u++,a/=2),u+c>=l?(s=0,u=l):u+c>=1?(s=(e*a-1)*Math.pow(2,n),u+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,n),u=0));n>=8;t[r+f]=255&s,f+=h,s/=256,n-=8);for(u=u<<n|s,p+=n;p>0;t[r+f]=255&u,f+=h,u/=256,p-=8);t[r+f-h]|=128*y}},34(a,p,l){l.d(p,{G_M:()=>De,fAY:()=>uo,a_O:()=>c,A$9:()=>h,gRW:()=>ao,VZJ:()=>Io,N0v:()=>be,B_D:()=>Ne,qLM:()=>Ae,eX8:()=>_e,zaA:()=>wo,xDR:()=>j,jR0:()=>H,P2l:()=>Po,W68:()=>$e,sec:()=>Ue,ZPB:()=>Cr,yrp:()=>bo,spi:()=>tt,Iu1:()=>Dr,yuB:()=>Lr,$96:()=>Er,zwJ:()=>Rr,h_A:()=>Or,e_X:()=>Mr,TkG:()=>Ir,BAg:()=>Pr,u9S:()=>Fr,biU:()=>Wr,gc5:()=>Nr,ayx:()=>$r,SXg:()=>ye,UFY:()=>po,Y5o:()=>J,mEH:()=>et,xGW:()=>de,s9Q:()=>rt,OL0:()=>fe,k6p:()=>or,djE:()=>er,kDJ:()=>cr,Yfw:()=>pr,AI1:()=>Ur,O2U:()=>Sr,c5J:()=>vr,N8y:()=>tr,qUh:()=>fr,RZj:()=>yr,nio:()=>nr,hFg:()=>xr,Qkp:()=>Tr,GwL:()=>qr,$Kr:()=>br,ujH:()=>ir,Odj:()=>rr,X7c:()=>dr,Ubz:()=>_r,Dx4:()=>lr,OAr:()=>Je,$Uh:()=>Ke,obN:()=>ar,$lZ:()=>Qe,Kaw:()=>sr,Wbk:()=>Ze,kwV:()=>ur,qAI:()=>Ye,VSx:()=>wr,HPG:()=>kr,xQk:()=>zr,YQw:()=>Ar,QY:()=>mr,osR:()=>hr,Kob:()=>gr,IJt:()=>Be,nw5:()=>Z,PrA:()=>it,ZEf:()=>K,X0W:()=>qe,evz:()=>ge,P8C:()=>ke,aVn:()=>xe,p2b:()=>ve,sVY:()=>Ee,XDq:()=>Oe,Jsu:()=>Pe,W5:()=>Ie,Dyw:()=>Te,_i2:()=>Se,FZg:()=>Re,wGh:()=>we,Nix:()=>G,v_o:()=>V,qDU:()=>nt,qRb:()=>ot,QJY:()=>me,bmW:()=>he,n_N:()=>Le,v87:()=>Me,qMI:()=>ce,gHX:()=>Ce,O3p:()=>X,Gzh:()=>Y,prJ:()=>F,Fmy:()=>so,OBV:()=>Q,Ft:()=>pe,MB4:()=>Jt,Dnk:()=>le,pqp:()=>Qt,Q3w:()=>te,Jh3:()=>ee,wfs:()=>mo,UmN:()=>lo,xO7:()=>St,R11:()=>Gt,LwT:()=>yo,mMz:()=>gt,iES:()=>kt,zpK:()=>Tt,N3x:()=>xt,bNp:()=>ct,T3v:()=>Nt,KQV:()=>Zt,S9l:()=>jt,rER:()=>f,XNg:()=>lt,VeU:()=>Wt,T_r:()=>Mt,m4Y:()=>$t,XIn:()=>mt,Lt0:()=>It,wsx:()=>qt,KKL:()=>dt,yl$:()=>at,kqD:()=>pt,dEm:()=>Ct,bu4:()=>Ft,ftY:()=>Ut,Ht0:()=>Yt,$uf:()=>Bt,wqt:()=>Xt,CHU:()=>go,Wc$:()=>Vt,Y5D:()=>yt,KGs:()=>Pt,nWw:()=>At,jFb:()=>ht,Pvd:()=>Dt,S2b:()=>bt,uSb:()=>Et,N9t:()=>_t,bNM:()=>ft,PvK:()=>Lt,O5u:()=>Rt,NYX:()=>Ot,FCB:()=>Ht,h_O:()=>wt,zu2:()=>zt,Xix:()=>vt,LAw:()=>xo,E6J:()=>So,Dsj:()=>vo,XVZ:()=>Oo,CUR:()=>fo,VxL:()=>_o,DLQ:()=>qo,ONb:()=>jr,HhT:()=>Kt,PF2:()=>d,oVm:()=>co,g57:()=>Ao,LaM:()=>Gr,Vuj:()=>ko});const c={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",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",aggregatorRouter:"CDNTWMWW2WGYTKIZTJYNGNVQQZI4KTC5BQRZ3275KESRX5T4O3AYECL5",governance:"CDS33JDOYH3F3FL4QUQ6DV4WKHML2AKHF4LADTZ57FRUAEBTE7NMY5FQ",priceAggregator:"CAALOOTIDXCX7D7FMQIBSSAJLPKOM3GMXS4UUSTDIG42JCRRJHOPUHOP",positionNftContract:"CDVN5JU675MEDPVRPCYC45AHFC275UH57WEU5OTFE4WFGZBNN7HTLPSY"}},d=c;function f(t){return c["testnet"===t?"stellarTestnet":"stellarMainnet"]}const h={mainnet:c.stellarMainnet.passphrase,testnet:c.stellarTestnet.passphrase};var y=l(287);const g=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],m={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},b=1e6,w=t=>new e(t).toScVal(),S=t=>new n(t).toI128(),v=t=>s.ScVal.scvU32(t),x=t=>{if("number"==typeof t&&!Number.isSafeInteger(t))throw new Error("Stellar builder: u64 numbers must be safe integers; pass a decimal string for larger values");return new n("string"==typeof t?t:t.toString()).toU64()},T=t=>s.ScVal.scvBool(t),A=t=>s.ScVal.scvString(t),q=t=>s.ScVal.scvSymbol(t),_=()=>s.ScVal.scvVoid(),k=t=>s.ScVal.scvVec(t),I=(t,e=32)=>{const r=t.startsWith("0x")?t.slice(2):t,o=y.hp.from(r,"hex");if(o.length!==e)throw new Error(`Stellar builder: expected a ${e}-byte BytesN (got ${o.length} bytes from "${t}")`);return s.ScVal.scvBytes(o)},E=(t,e)=>null==t?_():e(t),P=(t,e)=>B({asset:w(e),hub_id:v(t)}),R=(t,e,r)=>s.ScVal.scvVec([P(t,e),S(r)]),O=t=>s.ScVal.scvVec(t.map((t=>R(t.hubId,t.asset,t.amount)))),M=t=>{if("Transfer"===t)return k([q("Transfer")]);if(t&&"object"==typeof t&&"Credit"in t){const e=t.Credit;if("number"==typeof e&&!Number.isInteger(e))throw new Error(`Stellar builder: SeizeMode Credit account id must be an integer u64, got ${e}`);return k([q("Credit"),x(e)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(t)}`)},B=t=>{const e=Object.keys(t).sort().map((e=>new s.ScMapEntry({key:q(e),val:t[e]})));return s.ScVal.scvMap(e)};class U{assets=[];amounts=[];ops=[];weights=[];constructor(t){this.amounts.push(t)}asset(t){const e=this.assets.indexOf(t);if(-1!==e)return e;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(t),this.assets.length-1}amount(t){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(t),this.amounts.length-1}weight(t){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(t)||t<=0||t>b)throw new Error(`Stellar builder: split weight ${t} outside 1..=1000000`);return this.weights.push(t),this.weights.length-1}emit(t,e,r,o,n){this.ops.push([t,e,r,o,n])}emitPath(t,e){t.hops.forEach(((r,o)=>{if(r.tokenIn===r.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=t.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(m[r.venue],0===o?e:1,this.asset(r.pool),this.asset(r.tokenIn),this.asset(r.tokenOut))}))}lowerPaths(t){const e=t.filter((t=>t.hops.length>0)),r=Array.from({length:e.length},(()=>!1));for(let t=0;t<e.length;t+=1){if(r[t])continue;const o=e[t].hops[0]?.tokenIn,n=[];for(let r=t;r<e.length;r+=1)e[r].hops[0]?.tokenIn===o&&n.push(r);const i=n.reduce(((t,r)=>t+e[r].splitPpm),0);if(i>b)throw new Error(`Stellar builder: split weights for one token sum to ${i}, above 1000000`);const u=i===b;let s=b;n.forEach(((t,o)=>{r[t]=!0;const i=e[t];let a;if(o+1===n.length&&u)a=0;else{if(0===s)throw new Error("Stellar builder: split weights exhaust the group before its last path");const t=Math.floor(i.splitPpm*b/s);s-=Math.min(i.splitPpm,s),a=128+this.weight(t)}this.emitPath(i,a)}))}}toBytes(t,e,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,t,e,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,this.ops.length,this.weights.length];for(const t of this.ops)o.push(...t);for(const t of this.weights)o.push(t>>>16&255,t>>>8&255,255&t);return y.hp.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const C=t=>{const e=new U(t.totalMinOut),r=e.asset(t.tokenIn),o=e.asset(t.tokenOut);if(r===o)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(t.burnPool){const o=e.asset(t.burnPool),n=e.amountList.length;for(const r of t.burnMinAmounts??[])e.amount(r);e.emit(5,0,o,r,n)}if(e.lowerPaths(t.paths),t.mintPool){const r=t.preSwapAmount;if(r&&BigInt(r)>0n){const o=t.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,[u,s]=t.preSwapFromA?[n,i]:[i,n];e.emit(m.Aquarius,2+e.amount(r),e.asset(t.mintPool),e.asset(u),e.asset(s))}e.emit(6,0,e.asset(t.mintPool),o,e.amount(t.mintMinShares??"1"))}const n=Number(t.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${t.referralId} does not fit the wire’s u32`);return B({amounts:s.ScVal.scvVec(e.amountList.map((t=>S(t)))),assets:s.ScVal.scvVec(e.assetList.map((t=>w(t)))),ops:s.ScVal.scvBytes(e.toBytes(r,o,n))})},$=t=>{const e=y.hp.from(t);if(0===e.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return s.ScVal.scvBytes(e)},N=()=>s.ScVal.scvBytes(y.hp.alloc(0)),L=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((r=t).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 y.hp.from(t,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(e))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=y.hp.from(e,"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},D=t=>{if("string"==typeof t)return $(L(t));if(t instanceof Uint8Array)return 0===t.length?N():$(t);if(t&&"object"==typeof t)return"routeXdr"in(r=t)&&"string"==typeof r.routeXdr?$(L(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?$(L(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?$(L(t.bytes)):0===t.bytes.length?N():$(t.bytes):(e=(t=>{if(!t||"object"!=typeof t)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const e=t;if(!Array.isArray(e.paths)||0===e.paths.length&&!e.burnPool&&!e.mintPool)throw new Error("Stellar builder: `steps.paths` needs a strategy path or a liquidity burn/mint operation");if("string"!=typeof e.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof e.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof e.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const r=new Map;for(const[t,o]of e.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[${t}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[e,r]of o.hops.entries())if(!r||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!g.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${t}].hops[${e}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const e=o.hops[0];r.set(e.tokenIn,(r.get(e.tokenIn)??0)+o.splitPpm)}for(const[t,o]of r){if(o>b)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} sums to ${o}, above 1000000`);if(!e.mintPool&&o!==b)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} must sum to 1000000, got ${o}`)}return e})(t),s.ScVal.scvBytes(y.hp.from(C(e).toXDR("base64"),"base64")));var e,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},W=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,r=y.hp.from(e,"hex");return s.ScVal.scvBytes(r)})(t);if(t instanceof Uint8Array)return s.ScVal.scvBytes(y.hp.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function F(e,n,u){if(!e.controllerAddress)throw new Error("Stellar lending controllerAddress is required");const s=new o(e.controllerAddress),a=new t(e.caller,e.sourceSequence);return{xdr:new i(a,{fee:e.fee??r,networkPassphrase:h[e.network]}).addOperation(s.call(n,...u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function z(t){if(!Number.isInteger(t)||t<1||t>4294967295)throw new Error("Stellar builder: spokeId must be an integer from 1 to 4294967295");return v(t)}function G(t,e){const r=e.accountNonce??0;return F(t,"supply",[w(t.caller),x(r),z(e.spokeId),O([...e.assets])])}function V(t,e){return G(t,{accountNonce:e.accountNonce,spokeId:e.spokeId,assets:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function j(t,e){return F(t,"borrow",[w(t.caller),x(e.accountNonce),O([...e.borrows]),E(e.to,w)])}function H(t,e){return j(t,{accountNonce:e.accountNonce,borrows:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function X(t,e){return F(t,"withdraw",[w(t.caller),x(e.accountNonce),O([...e.withdrawals]),E(e.to,w)])}function Y(t,e){return X(t,{accountNonce:e.accountNonce,withdrawals:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function Z(t,e){return F(t,"repay",[w(t.caller),x(e.accountNonce),O([...e.payments])])}function K(t,e){return Z(t,{accountNonce:e.accountNonce,payments:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function J(t,e){return F(t,"liquidate",[w(t.caller),x(e.accountNonce),O([...e.debtPayments]),M(e.seizeMode??"Transfer")])}function Q(t){const e=u(s.ScVal.fromXDR(t,"base64"));if("bigint"==typeof e||"number"==typeof e)return e.toString();throw new Error("Stellar builder: liquidate return value must be a u64, got "+typeof e)}function tt(t,e){return F(t,"flash_loan",[w(t.caller),P(e.hubId,e.asset),S(e.amount),w(e.receiver),W(e.data)])}function et(t,e){return F(t,"migrate_from_blend",[w(t.caller),x(e.accountId),z(e.spokeId),v(e.hubId),w(e.blendPool),k(e.collateralTokens.map(w)),k(e.supplyTokens.map(w)),(r=e.debtCaps.map((t=>({token:t.token,amount:t.cap}))),s.ScVal.scvVec(r.map((t=>{return e=t.token,r=t.amount,s.ScVal.scvVec([w(e),S(r)]);var e,r}))))]);var r}function rt(t,e){const r=e.accountNonce??0;return F(t,"multiply",[w(t.caller),x(r),z(e.spokeId),P(e.collateral.hubId,e.collateral.asset),S(e.debtToFlashLoan),P(e.debt.hubId,e.debt.asset),v(e.mode),D(e.steps),E(e.initialPayment,(t=>R(t.hubId,t.asset,t.amount))),E(e.convertSwap,D)])}function ot(t,e){return F(t,"swap_debt",[w(t.caller),x(e.accountNonce),P(e.existingDebt.hubId,e.existingDebt.asset),S(e.newDebtAmount),P(e.newDebt.hubId,e.newDebt.asset),D(e.steps)])}function nt(t,e){return F(t,"swap_collateral",[w(t.caller),x(e.accountNonce),P(e.current.hubId,e.current.asset),S(e.fromAmount),P(e.newCollateral.hubId,e.newCollateral.asset),D(e.steps)])}function it(t,e){return F(t,"repay_debt_with_collateral",[w(t.caller),x(e.accountNonce),P(e.collateral.hubId,e.collateral.asset),S(e.collateralAmount),P(e.debt.hubId,e.debt.asset),D(e.steps),T(e.closePosition)])}const ut="/stellar-lending",st=encodeURIComponent,at=(t,e)=>t.fetchWithTimeout(`${ut}/context`,e),pt=(t,e)=>t.fetchWithTimeout(`${ut}/live-state`,e),lt=(t,e)=>t.fetchWithTimeout(`${ut}/markets/detailed`,e),ct=(t,e)=>t.fetchWithTimeout(`${ut}/assets`,e),dt=(t,e)=>t.fetchWithTimeout(`${ut}/hubs`,e),ft=(t,e)=>t.fetchWithTimeout(`${ut}/spokes`,e),ht=(t,e={},r)=>t.fetchWithTimeout(`${ut}/reserves`,{...r,params:{...e}}),yt=(t,e,r,o,n)=>t.fetchWithTimeout(`${ut}/reserves/${e}/${r}/${st(o)}`,n),gt=(t,e,r)=>t.fetchWithTimeout(`${ut}/assets/${st(e)}`,r),mt=(t,e,r)=>t.fetchWithTimeout(`${ut}/hubs/${e}`,r),bt=(t,e,r)=>t.fetchWithTimeout(`${ut}/spokes/${e}`,r),wt=(t,e,r)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/positions`,r),St=(t,e,r)=>t.fetchWithTimeout(`${ut}/accounts/${st(e)}/positions`,r),vt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/assets/${st(r)}/balance`,o),xt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/assets/${st(e)}/page`,{...o,params:{...r}}),Tt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/assets/${st(e)}/markets`,{...o,params:{side:r}}),At=(t,e,r,o,n,i)=>t.fetchWithTimeout(`${ut}/reserves/${e}/${r}/${st(o)}/holders`,{...i,params:{side:n}}),qt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/hubs/${e}/holders`,{...o,params:{side:r}}),_t=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/spokes/${e}/holders`,{...o,params:{side:r}}),kt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/assets/${st(e)}/graph`,{...o,params:{...r}}),It=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/hubs/${e}/graph`,{...o,params:{...r}}),Et=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/spokes/${e}/graph`,{...o,params:{...r}}),Pt=(t,e,r,o,n,i)=>t.fetchWithTimeout(`${ut}/reserves/${e}/${r}/${st(o)}/graph`,{...i,params:{...n}}),Rt=(t,e,r={},o)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/activity`,{...o,params:{...r}}),Ot=(t,e,r={},o)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/activity/page`,{...o,params:{...r}}),Mt=(t,e={},r)=>t.fetchWithTimeout(`${ut}/governance/proposals`,{...r,params:{...e}}),Bt=(t,e={},r)=>t.fetchWithTimeout(`${ut}/positions`,{...r,params:{...e}}),Ut=(t,e={},r)=>t.fetchWithTimeout(`${ut}/participants`,{...r,params:{...e}}),Ct=(t,e={},r)=>t.fetchWithTimeout(`${ut}/liquidations/leaderboard`,{...r,params:{...e}}),$t=(t,e={},r)=>t.fetchWithTimeout(`${ut}/distribution`,{...r,params:{...e}}),Nt=(t,e={},r)=>t.fetchWithTimeout(`${ut}/campaign/leaderboard`,{...r,params:{...e}}),Lt=(t,e,r)=>t.fetchWithTimeout(`${ut}/stats/history`,{...r,params:{...e}}),Dt=(t,e,r)=>t.fetchWithTimeout(`${ut}/revenue`,{...r,params:{...e}}),Wt=(t,e,r)=>t.fetchWithTimeout(`${ut}/revenue/fees`,{...r,params:{...e}}),Ft=(t,e,r)=>t.fetchWithTimeout(`${ut}/liquidations`,{...r,params:{...e}}),zt=(t,e,r)=>t.fetchWithTimeout(`${ut}/volume`,{...r,params:{...e}}),Gt=(t,e,r)=>t.fetchWithTimeout(`${ut}/active-users`,{...r,params:{...e}}),Vt=(t,e,r)=>t.fetchWithTimeout(`${ut}/rate-spread`,{...r,params:{...e}}),jt=(t,e,r)=>t.fetchWithTimeout(`${ut}/defillama`,{...r,params:{...e}}),Ht=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/history`,{...o,params:{...r}}),Xt=(t,e,r)=>t.fetchWithTimeout(`${ut}/pnl`,{...r,params:{accountId:e}}),Yt=(t,e,r)=>t.fetchWithTimeout(`${ut}/pnl/scope`,{...r,params:{scope:e}}),Zt=(t,e,r)=>t.fetchWithTimeout(`${ut}/campaign/me`,{...r,params:{owner:e}}),Kt=t=>({context:e=>at(t,e),liveState:e=>pt(t,e),marketsDetailed:e=>lt(t,e),assets:e=>ct(t,e),hubs:e=>dt(t,e),spokes:e=>ft(t,e),reserves:(e={},r)=>void 0!==r||"hubId"in e||"spokeId"in e||"asset"in e?ht(t,e,r):ht(t,{},e),reserve:(e,r,o,n)=>yt(t,e,r,o,n),asset:(e,r)=>gt(t,e,r),hub:(e,r)=>mt(t,e,r),spoke:(e,r)=>bt(t,e,r),userPositions:(e,r)=>wt(t,e,r),accountPositions:(e,r)=>St(t,e,r),walletBalance:(e,r,o)=>vt(t,e,r,o),assetPage:(e,r,o)=>xt(t,e,r,o),assetMarkets:(e,r,o)=>Tt(t,e,r,o),reserveHolders:(e,r,o,n,i)=>At(t,e,r,o,n,i),hubHolders:(e,r,o)=>qt(t,e,r,o),spokeHolders:(e,r,o)=>_t(t,e,r,o),assetGraph:(e,r,o)=>kt(t,e,r,o),hubGraph:(e,r,o)=>It(t,e,r,o),spokeGraph:(e,r,o)=>Et(t,e,r,o),reserveGraph:(e,r,o,n,i)=>Pt(t,e,r,o,n,i),userActivity:(e,r={},o)=>Rt(t,e,r,o),userActivityPage:(e,r={},o)=>Ot(t,e,r,o),governanceProposals:(e={},r)=>Mt(t,e,r),positionsLeaderboard:(e={},r)=>Bt(t,e,r),participants:(e={},r)=>Ut(t,e,r),liquidationsLeaderboard:(e={},r)=>Ct(t,e,r),distribution:(e={},r)=>$t(t,e,r),campaignLeaderboard:(e={},r)=>Nt(t,e,r),statsHistory:(e,r)=>Lt(t,e,r),revenue:(e,r)=>Dt(t,e,r),feeRevenue:(e,r)=>Wt(t,e,r),liquidations:(e,r)=>Ft(t,e,r),volume:(e,r)=>zt(t,e,r),activeUsers:(e,r)=>Gt(t,e,r),rateSpread:(e,r)=>Vt(t,e,r),defillama:(e,r)=>jt(t,e,r),userHistory:(e,r,o)=>Ht(t,e,r,o),positionsPnl:(e,r)=>Xt(t,e,r),pnlByScope:(e,r)=>Yt(t,e,r),campaignMe:(e,r)=>Zt(t,e,r)}),Jt=t=>B({base_borrow_rate:S(t.baseBorrowRateRay),max_borrow_rate:S(t.maxBorrowRateRay),max_utilization:S(t.maxUtilizationRay),mid_utilization:S(t.midUtilizationRay),optimal_utilization:S(t.optimalUtilizationRay),reserve_factor:v(t.reserveFactorBps),slope1:S(t.slope1Ray),slope2:S(t.slope2Ray),slope3:S(t.slope3Ray)}),Qt=t=>B({asset_decimals:v(t.assetDecimals),asset_id:w(t.assetId),base_borrow_rate:S(t.baseBorrowRateRay),flashloan_fee:v(t.flashloanFeeBps),is_flashloanable:T(t.isFlashloanable),max_borrow_rate:S(t.maxBorrowRateRay),max_utilization:S(t.maxUtilizationRay),mid_utilization:S(t.midUtilizationRay),optimal_utilization:S(t.optimalUtilizationRay),reserve_factor:v(t.reserveFactorBps),slope1:S(t.slope1Ray),slope2:S(t.slope2Ray),slope3:S(t.slope3Ray)}),te=t=>B({max_borrow_positions:v(t.maxBorrowPositions),max_supply_positions:v(t.maxSupplyPositions)}),ee=t=>{if("Token"in t&&t.Token)return k([q("Token"),w(t.Token)]);if("Ref"in t&&t.Ref)return k([q("Ref"),q(t.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(t)}`)},re=t=>{if("Stellar"in t)return k([q("Stellar"),w(t.Stellar)]);if("Symbol"in t)return k([q("Symbol"),q(t.Symbol)]);if("String"in t)return k([q("String"),A(t.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(t)}`)},oe=t=>{if("Spot"===t)return k([q("Spot")]);if(t&&"object"==typeof t&&"Twap"in t)return k([q("Twap"),v(Number(t.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(t)}`)},ne=t=>{if("Reflector"===t||"RedStone"===t||"Xoxno"===t)return k([q(t)]);throw new Error(`Stellar builder: unknown ProviderKind "${t}"`)},ie=t=>{if("Market"===t||"Fundamental"===t)return k([q(t)]);throw new Error(`Stellar builder: unknown FeedNature "${t}"`)},ue=t=>{if("Reflector"in t){const e=t.Reflector;return k([q("Reflector"),B({asset:re(e.asset),contract:w(e.contract),read_mode:oe(e.readMode)})])}if("MultiFeed"in t){const e=t.MultiFeed;return k([q("MultiFeed"),B({contract:w(e.contract),feed_id:A(e.feedId),kind:ne(e.kind),nature:ie(e.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(t)}`)},se=t=>{const e=t;return B({decimals:v(e.decimals),max_stale_seconds:x(e.maxStaleSeconds),provider:ue(e.provider)})},ae=t=>{if("RequireDisjoint"===t)return k([q("RequireDisjoint")]);if(t&&"object"==typeof t&&"AllowShared"in t){const e=t.AllowShared;return k([q("AllowShared"),k(e.map((t=>B({contract:w(t.contract),kind:ne(t.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(t)}`)},pe=t=>{const e=t,r=e.sources??[];let o,n;if("number"==typeof e.toleranceBps)o=1e4+e.toleranceBps,n=Math.max(1,Math.floor(1e8/o));else{const t=e.tolerance??{};o=Number(t.upperRatioBps),n=Number(t.lowerRatioBps)}return B({asset_decimals:v(Number(e.assetDecimals)),independence:ae(e.independence),max_price_stale_seconds:x(Number(e.maxPriceStaleSeconds)),max_sanity_price_wad:S(String(e.maxSanityPriceWad)),min_sanity_price_wad:S(String(e.minSanityPriceWad)),sources:k(r.map((t=>(t=>{if("Feed"in t)return k([q("Feed"),se(t.Feed)]);if("Scaled"in t){const e=t.Scaled;return k([q("Scaled"),B({factor:se(e.factor),max_factor_wad:S(e.maxFactorWad),min_factor_wad:S(e.minFactorWad),quote:ee(e.quote)})])}if("LpShare"in t){const e=t.LpShare;return k([q("LpShare"),B({key_a:ee(e.keyA),key_b:ee(e.keyB),kind:k([q(e.kind||"ConstantProduct")]),pool:w(e.pool),reserve_a_decimals:v(e.reserveADecimals),reserve_b_decimals:v(e.reserveBDecimals),share_decimals:v(e.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(t)}`)})(t)))),tolerance:B({lower_ratio_bps:v(n),upper_ratio_bps:v(o)})})},le=pe;function ce(t,e){return F(t,"upgrade",[I(e.wasmHash)])}function de(t,e){return F(t,"migrate",[v(e.newVersion)])}function fe(t){return F(t,"pause",[])}function he(t){return F(t,"unpause",[])}function ye(t,e){return F(t,"grant_role",[w(e.account),q(e.role)])}function ge(t,e){return F(t,"revoke_role",[w(e.account),q(e.role)])}function me(t,e){return F(t,"transfer_ownership",[w(e.newOwner),v(e.liveUntilLedger)])}function be(t){return F(t,"accept_ownership",[])}function we(t,e){return F(t,"set_swap_aggregator",[w(e.aggregator)])}function Se(t,e){return F(t,"set_price_aggregator",[w(e.aggregator)])}const ve=we;function xe(t,e){return F(t,"set_accumulator",[w(e.accumulator)])}function Te(t,e){return F(t,"set_position_limits",[te(e)])}function Ae(t,e){return F(t,"approve_blend_pool",[w(e.pool)])}function qe(t,e){return F(t,"revoke_blend_pool",[w(e.pool)])}const _e=Ae,ke=qe;function Ie(t,e){return F(t,"set_oracle",[ee(e.key),pe(e.oracle)])}const Ee=Ie;function Pe(t,e){const r=e.toleranceBps,o=e.upperRatioBps??1e4+r,n=e.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return F(t,"set_tolerance",[ee(e.key),B({lower_ratio_bps:v(n),upper_ratio_bps:v(o)})])}function Re(t,e){return F(t,"set_spoke_asset_flags",[v(e.spokeId),P(e.hubId,e.asset),T(e.paused),T(e.frozen),T(e.noSeize)])}function Oe(t,e){return F(t,"set_oracle_sanity_bounds",[w(e.asset),S(e.minPriceWad),S(e.maxPriceWad)])}function Me(t,e){return F(t,"update_indexes",[w(t.caller),k(e.assets.map((t=>P(t.hubId,t.asset))))])}function Be(t,e){return F(t,"renew_account",[w(t.caller),x(e.accountNonce)])}function Ue(t,e){return F(t,"create_liquidity_pool",[v(e.hubId),w(e.asset),Qt(e.params)])}function Ce(t,e){return F(t,"upgrade_liquidity_pool_params",[P(e.hubId,e.asset),Jt(e.params)])}function $e(t,e){return F(t,"claim_revenue",[w(t.caller),k(e.assets.map((t=>P(t.hubId,t.asset))))])}function Ne(t,e){return F(t,"add_rewards",[w(t.caller),O(e.rewards)])}function Le(t,e){return F(t,"update_account_threshold",[w(t.caller),T(e.hasRisks),k(e.accountNonces.map((t=>x(t))))])}const De="00".repeat(32),We=t=>{if("string"==typeof t)return I(t);const e=y.hp.from(t);if(32!==e.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${e.length} bytes)`);return s.ScVal.scvBytes(e)},Fe=(t,...e)=>k([q(t),...e]),ze=t=>B({new_owner:w(t.newOwner),live_until_ledger:v(t.liveUntilLedger)}),Ge=t=>B({asset:w(t.asset),bonus:v(t.bonus),borrow_cap:S(t.borrowCap),can_borrow:T(t.canBorrow),can_collateral:T(t.canCollateral),frozen:T(t.frozen),hub_id:v(t.hubId),paused:T(t.paused),liquidation_fees:v(t.liquidationFees),ltv:v(t.ltv),no_seize:T(t.noSeize),spoke_id:v(t.spokeId),supply_cap:S(t.supplyCap),threshold:v(t.threshold)}),Ve=t=>B({account:w(t.account),role:q(t.role)});function je(e,n,u){if(!e.governanceAddress)throw new Error("Stellar governanceAddress is required");const s=new o(e.governanceAddress),a=new t(e.caller,e.sourceSequence);return{xdr:new i(a,{fee:e.fee??r,networkPassphrase:h[e.network]}).addOperation(s.call(n,...u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const He=(t,e,r)=>je(t,"propose",[w(t.caller),e,We(r)]),Xe=(t,e,r)=>je(t,"execute_self",[_(),e,We(r)]);function Ye(t,e,r){return He(t,Fe("SetSwapAggregator",w(e.aggregator)),r)}function Ze(t,e,r){return He(t,Fe("SetPriceAggregator",w(e.aggregator)),r)}const Ke=Ye;function Je(t,e,r){return He(t,Fe("SetAccumulator",w(e.accumulator)),r)}function Qe(t,e,r){return He(t,Fe("SetPositionLimits",te(e)),r)}function tr(t,e){return He(t,Fe("CreateHub"),e)}function er(t,e){return He(t,Fe("AddSpoke"),e)}function rr(t,e,r){return He(t,Fe("RemoveSpoke",v(e.spokeId)),r)}function or(t,e,r){return He(t,Fe("AddAssetToSpoke",Ge(e)),r)}function nr(t,e,r){return He(t,Fe("EditAssetInSpoke",Ge(e)),r)}function ir(t,e,r){return He(t,Fe("RemoveAssetFromSpoke",B({hub_asset:P((o=e).hubId,o.asset),spoke_id:v(o.spokeId)})),r);var o}function ur(t,e,r){return He(t,Fe("SetSpokeLiquidationCurve",B({hf_for_max_bonus_wad:S((o=e).hfForMaxBonusWad),liquidation_bonus_factor_bps:v(o.liquidationBonusFactorBps),spoke_id:v(o.spokeId),target_hf_wad:S(o.targetHfWad)})),r);var o}function sr(t,e,r){return He(t,Fe("SetPositionManager",w(e.manager),T(e.isActive)),r)}function ar(t,e,r){return He(t,Fe("SetMinBorrowCollateralUsd",S(e.floorWad)),r)}function pr(t,e,r){return He(t,Fe("ApproveToken",w(e.token)),r)}function lr(t,e,r){return He(t,Fe("RevokeToken",w(e.token)),r)}function cr(t,e,r){return He(t,Fe("ApproveBlendPool",w(e.pool)),r)}function dr(t,e,r){return He(t,Fe("RevokeBlendPool",w(e.pool)),r)}function fr(t,e,r){return He(t,Fe("CreateLiquidityPool",B({asset:w((o=e).asset),hub_id:v(o.hubId),params:Qt(o.params)})),r);var o}function hr(t,e,r){return He(t,Fe("UpgradeLiquidityPoolParams",B({hub_asset:P((o=e).hubId,o.asset),params:Jt(o.params)})),r);var o}function yr(t,e,r){return He(t,Fe("DeployPool",I(e.wasmHash)),r)}function gr(t,e,r){return He(t,Fe("UpgradePool",I(e.wasmHash)),r)}function mr(t,e,r){return He(t,Fe("UpgradeController",I(e.wasmHash)),r)}function br(t,e,r){return He(t,Fe("MigrateController",v(e.newVersion)),r)}function wr(t,e,r){return He(t,Fe("TransferCtrlOwnership",ze(e)),r)}function Sr(t,e,r){return He(t,Fe("ConfigureAssetOracle",B({key:ee((o=e).key),oracle:pe(o.oracle)})),r);var o}const vr=Sr;function xr(t,e,r){return He(t,Fe("EditOracleTolerance",B({key:ee((o=e).key),tolerance:v(o.tolerance)})),r);var o}function Tr(t,e,r){return He(t,Fe("UpgradeGov",I(e.wasmHash)),r)}function Ar(t,e,r){return He(t,Fe("UpdateGovDelay",v(e.newDelay)),r)}function qr(t,e,r){return He(t,Fe("GrantGovRole",Ve(e)),r)}function _r(t,e,r){return He(t,Fe("RevokeGovRole",Ve(e)),r)}function kr(t,e,r){return He(t,Fe("TransferGovOwnership",ze(e)),r)}function Ir(t,e){const r=k(e.argsXdr.map((t=>s.ScVal.fromXDR(t,"base64")))),o=We(e.predecessor??De);return je(t,"execute",[_(),w(e.target),q(e.functionName),r,o,We(e.salt)])}function Er(t,e,r){return Xe(t,Fe("UpgradeGov",I(e.wasmHash)),r)}function Pr(t,e,r){return Xe(t,Fe("UpdateGovDelay",v(e.newDelay)),r)}function Rr(t,e,r){return Xe(t,Fe("GrantGovRole",Ve(e)),r)}function Or(t,e,r){return Xe(t,Fe("RevokeGovRole",Ve(e)),r)}function Mr(t,e,r){return Xe(t,Fe("TransferGovOwnership",ze(e)),r)}const Br=t=>k(t.map(w));function Ur(t,e,r){return je(t,"propose_canceller_reset",[Br(e.newCancellers),We(r)])}function Cr(t,e,r){return je(t,"execute_canceller_reset",[E(e.executor,w),Br(e.newCancellers),We(r)])}function $r(t,e){return je(t,"set_spoke_asset_flags",[w(t.caller),v(e.spokeId),P(e.hubId,e.asset),T(e.paused),T(e.frozen),T(e.noSeize)])}function Nr(t,e){return je(t,"set_oracle_sanity_bounds",[w(t.caller),w(e.asset),S(e.minPriceWad),S(e.maxPriceWad)])}function Lr(t){return je(t,"create_hub",[w(t.caller)])}function Dr(t){return je(t,"add_spoke",[w(t.caller)])}function Wr(t,e){return je(t,"revoke_role_immediate",[w(e.account),q(e.role)])}function Fr(t){return je(t,"pause",[w(t.caller)])}function zr(t,e){return He(t,Fe("Unpause"),e)}const Gr=t=>t.toXDR("base64"),Vr=t=>s.ScVal.fromXDR(t,"base64"),jr=t=>t.map((t=>String(u(Vr(t))))).join(":"),Hr=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),Xr=t=>Number(t),Yr=t=>String(t),Zr=t=>t instanceof Uint8Array?y.hp.from(t).toString("hex"):y.hp.isBuffer(t)?t.toString("hex"):String(t),Kr=["None","Multiply","Long","Short"],Jr=["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"],Qr=t=>Array.isArray(t)?t:[],to=(t,e)=>{const r="Borrow"===e;return{action:(o=t[0],Jr[Xr(o)]??Hr(o)),positionType:e,hubId:Xr(t[1]),asset:Yr(t[2]),scaledAmountRay:Hr(t[3]),indexRay:Hr(t[4]),amount:Hr(t[5]),liquidationThresholdBps:r?void 0:Xr(t[6]),liquidationBonusBps:r?void 0:Xr(t[7]),loanToValueBps:r?void 0:Xr(t[8]),liquidationFeesBps:r?void 0:Xr(t[9])};var o},eo=t=>{return{owner:Yr(t[0]),spokeId:Xr(t[1]),mode:(e=t[2],Kr[Xr(e)]??"None")};var e},ro=t=>Array.isArray(t)?t[1]:void 0,oo=t=>{const e=(r=t,Array.isArray(r)?Yr(r[0]):Yr(r));var r;if("Token"===e)return{Token:Yr(ro(t))};if("Ref"===e)return{Ref:Yr(ro(t))};if(t&&"object"==typeof t&&!Array.isArray(t)){const e=t;if(void 0!==e.Token)return{Token:Yr(e.Token)};if(void 0!==e.Ref)return{Ref:Yr(e.Ref)}}return{Token:Yr(t)}},no=t=>{const e=t.tolerance??{};return{assetDecimals:Xr(t.asset_decimals),maxPriceStaleSeconds:Xr(t.max_price_stale_seconds),sources:Qr(t.sources).map((t=>t)),tolerance:{upperRatio:Xr(e.upper_ratio_bps),lowerRatio:Xr(e.lower_ratio_bps)},independence:t.independence,minSanityPriceWad:Hr(t.min_sanity_price_wad),maxSanityPriceWad:Hr(t.max_sanity_price_wad)}},io={"market:create":t=>({topic:"market:create",data:{hubId:Xr(t.hub_id),baseAsset:Yr(t.base_asset),maxBorrowRate:Hr(t.max_borrow_rate),baseBorrowRate:Hr(t.base_borrow_rate),slope1:Hr(t.slope1),slope2:Hr(t.slope2),slope3:Hr(t.slope3),midUtilization:Hr(t.mid_utilization),optimalUtilization:Hr(t.optimal_utilization),maxUtilization:Hr(t.max_utilization),reserveFactor:Xr(t.reserve_factor),marketAddress:Yr(t.market_address)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:Yr(t.asset),maxBorrowRateRay:Hr(t.max_borrow_rate),baseBorrowRateRay:Hr(t.base_borrow_rate),slope1Ray:Hr(t.slope1),slope2Ray:Hr(t.slope2),slope3Ray:Hr(t.slope3),midUtilizationRay:Hr(t.mid_utilization),optimalUtilizationRay:Hr(t.optimal_utilization),maxUtilizationRay:Hr(t.max_utilization),reserveFactorBps:Xr(t.reserve_factor)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:Qr(t).map((t=>{return e=Qr(t),{hubId:Xr(e[0]),asset:Yr(e[1]),timestamp:Xr(e[2]),supplyIndexRay:Hr(e[3]),borrowIndexRay:Hr(e[4]),cash:Hr(e[5]),suppliedRay:Hr(e[6]),borrowedRay:Hr(e[7]),revenueRay:Hr(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:Qr(t).map((t=>{const e=t;return{hubId:Xr(e.hub_id),asset:Yr(e.asset),params:(r=e.params,{maxBorrowRateRay:Hr(r.max_borrow_rate),baseBorrowRateRay:Hr(r.base_borrow_rate),slope1Ray:Hr(r.slope1),slope2Ray:Hr(r.slope2),slope3Ray:Hr(r.slope3),midUtilizationRay:Hr(r.mid_utilization),optimalUtilizationRay:Hr(r.optimal_utilization),maxUtilizationRay:Hr(r.max_utilization),reserveFactorBps:Xr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Xr(r.flashloan_fee),assetId:Yr(r.asset_id),assetDecimals:Xr(r.asset_decimals)})};var r}))}}),"position:batch_update":t=>{const e=Qr(t);return{topic:"position:batch_update",data:{accountId:Hr(e[0]),accountAttributes:eo(Qr(e[1])),updates:[...Qr(e[2]).map((t=>to(Qr(t),"Deposit"))),...Qr(e[3]).map((t=>to(Qr(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{hubId:Xr(t.hub_id),asset:Yr(t.asset),receiver:Yr(t.receiver),caller:Yr(t.caller),amount:Hr(t.amount),fee:Hr(t.fee)}}),"config:asset_oracle":t=>({topic:"config:asset_oracle",data:{key:oo(t.key),oracle:no(t.oracle)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:Yr(t.asset),oracle:no(t.config??t.oracle)}}),"position:liquidation":t=>({topic:"position:liquidation",data:{liquidator:Yr(t.liquidator),accountId:Hr(t.account_id),repaidUsdWad:Hr(t.repaid_usd_wad),bonusBps:Hr(t.bonus_bps)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Hr(t.account_id),totalBorrowUsdWad:Hr(t.total_borrow_usd_wad),totalCollateralUsdWad:Hr(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Yr(t.token),amount:Hr(t.amount),usdValueWad:Hr(t.usd_value_wad),accountId:Hr(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{hubId:Xr(t.hub_id),asset:Yr(t.asset),amount:Hr(t.amount),fee:Hr(t.fee),amountSent:Hr(t.amount_sent)}}),"config:approve_blend_pool":t=>({topic:"config:approve_blend_pool",data:{pool:Yr(t.pool??t.blend_pool??t.token),approved:Boolean(t.approved??t.is_approved??!0)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:Zr(t.wasm_hash??t.pool),approved:Boolean(t.approved)}}),"config:swap_aggregator":t=>({topic:"config:swap_aggregator",data:{aggregator:Yr(t.aggregator??t.swap_aggregator)}}),"config:price_aggregator":t=>({topic:"config:price_aggregator",data:{aggregator:Yr(t.aggregator??t.price_aggregator)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:Yr(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:Yr(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:Zr(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:Xr(t.max_supply_positions),maxBorrowPositions:Xr(t.max_borrow_positions)}}),"config:min_borrow_collateral":t=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Hr(t.min_borrow_collateral_usd_wad??t.floor_wad??t.value)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:Yr(t.asset)}}),"config:spoke":t=>{const e=t.spoke;return{topic:"config:spoke",data:{spokeId:Xr(e.spoke_id),isDeprecated:Boolean(e.is_deprecated),liquidationTargetHfWad:Hr(e.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Hr(e.hf_for_max_bonus_wad),liquidationBonusFactorBps:Xr(e.liquidation_bonus_factor_bps)}}}},uo=Object.freeze(Object.keys(io));function so(t,e){const r=jr(t),o=io[r];return o?o(u(Vr(e))):null}const ao=1e4;function po(t,e){return`${t}-${BigInt(e).toString(10)}`}function lo(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function co(t,e=0){return t*ao+e}function fo(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const ho=(t,e,r)=>{const o=new URL(e,t.endsWith("/")?t:`${t}/`);if(r)for(const[t,e]of Object.entries(r))void 0!==e&&o.searchParams.set(t,String(e));return o.toString()};async function yo(t,e){if(!e.baseUrl)throw new Error("Stellar quote baseUrl is required");if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=ho(e.baseUrl,"api/v1/quote",{from:t.from,to:t.to,amountIn:t.amountIn,amountOut:t.amountOut,maxHops:t.maxHops,maxSplits:t.maxSplits,slippage:t.slippage,includePaths:t.includePaths,sender:t.sender,router:t.router,referralId:t.referralId,platform:t.platform,fresh:t.fresh}),o=await fetch(r,e.fetchOptions);if(!o.ok){const t=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${t}`)}return await o.json()}async function go(t){if(!t.baseUrl)throw new Error("Stellar quote baseUrl is required");const e=ho(t.baseUrl,"api/v1/tokens"),r=await fetch(e,t.fetchOptions);if(!r.ok){const t=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${e} — ${t}`)}return await r.json()}const mo=t=>C(t).toXDR("base64");function bo(e,n){if(!e.routerAddress)throw new Error("Stellar aggregator routerAddress is required");const u=new o(e.routerAddress),s=new t(e.caller,e.sourceSequence),a=D(((t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t)(n,e.referralId));return{xdr:new i(s,{fee:e.fee??r,networkPassphrase:h[e.network]}).addOperation(u.call("execute_strategy",w(e.caller),S(e.totalIn),a)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function wo(t,e){return bo(t,e)}function So(t,e={}){if("string"!=typeof t.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:t.paths?t.paths.map((t=>({hops:t.swaps.map(To),splitPpm:t.splitPpm}))):[{hops:t.hops.map(To),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function vo(t,e={}){const r=t;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:So(t,e)}const xo=So,To=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function Ao(t,e){const r=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${r}`)}async function qo(t,e,r){const o=i.fromXDR(e,r?.network?h[r.network]:"");try{return(await t.prepareTransaction(o)).toXDR()}catch(t){if(r?.invokedContractId)throw Ao(r.invokedContractId,t);throw t}}async function _o(t,e,r){return qo(t,e.xdr,r)}function ko(t){if(t<=0||t>4)throw new Error(`Invalid PositionMode ${t} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return t-1}function Io(t,e){return new Uint8Array(0)}const Eo=t=>{const e=t.startsWith("0x")?t.slice(2):t;if(e.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return y.hp.from(e,"hex")};function Po(e){const r=new t(e.caller,e.sourceSequence),n=new o(e.forwarderAddress).call("mint_and_forward",s.ScVal.scvBytes(Eo(e.message)),s.ScVal.scvBytes(Eo(e.attestation)));return{xdr:new i(r,{fee:e.fee??"10000000",networkPassphrase:h[e.network]}).addOperation(n).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Ro={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."},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 Oo(t){const e=t.match(/Error\(Contract,\s*#(\d+)\)/);if(!e)return null;const r=Number(e[1]),o=Ro[r];return o?{code:r,...o}:null}}},p={};function l(t){var e=p[t];if(void 0!==e)return e.exports;var r=p[t]={exports:{}};return a[t](r,r.exports,l),r.exports}l.d=(t,e)=>{for(var r in e)l.o(e,r)&&!l.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const c="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",d="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",f="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var h;!function(t){t.MAINNET="1",t.DEVNET="D"}(h||(h={}));class y{apiUrl;chain;init;config;constructor(t){if(!t?.apiUrl?.trim())throw new Error("XOXNOClient: apiUrl is required");const{chain:e=h.MAINNET,apiUrl:r,...o}=t;this.apiUrl=r.trim().replace(/\/$/,""),this.chain=e,this.init=o,this.config=e==h.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:c,DR_SC:d,KG_SC:f,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:c,DR_SC:d,KG_SC:f,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(t,{params:e,...r}={})=>{const{next:o,cache:n,debug:i,...u}=this.init,{next:s,cache:a,debug:p,headers:l,method:c="GET",...d}=r,f=l?.Authorization,h="Bearer undefined"===f?void 0:f,y="GET"!==c&&"HEAD"!==c&&"PUT"!==c,g={...l,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",...y?{"Content-Type":"application/json"}:{},...h?{Authorization:h}:{}},m=Object.entries(e??{}).filter((([,t])=>void 0!==t)).flatMap((([t,e])=>Array.isArray(e)?e.filter((t=>void 0!==t)).map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),b=`${this.apiUrl}${t}${m.length?`?${m}`:""}`,{revalidate:w,...S}=o??{},{revalidate:v,...x}=s??{},T="GET"!==c||h?void 0:v??w,A="GET"!==c||h||T?void 0:a??n,q={...u,...d,method:c,...Object.keys(g).length?{headers:g}:{},cache:A,next:{...S,...x,revalidate:T}};(p??i)&&console.debug("SDK fetch: ",b,q);const _=await fetch(b,q).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${b}: ${t.message}`),{cause:t});throw t})),k=await _.text();if(!_.ok){let t;try{t=JSON.parse(k)}catch{t={message:k}}const e=[b,_.status,_.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(k)}catch{return k}}}const g=t=>{const e=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(t)),r=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t),o=/^C[A-Z2-7]{55}$/.test(t);return e||r||o},m=t=>{const e=/^0x[a-fA-F0-9]{1,64}$/.test(t),r=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t),o=/^C[A-Z2-7]{55}-\d+$/.test(t);return e||r||o};class b extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class w extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const S=t=>!!t&&(t.startsWith("erd1")&&62===t.length||/^0x[a-fA-F0-9]{40,64}$/.test(t)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(t)||/^[GC][A-Z2-7]{55}$/.test(t)),v={"/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:{}}},x=["PATCH","POST","DELETE","PUT"];var T=l(34);const A=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()));function q(t,e,r,o){const{input:n,output:i,...u}=e,s=async(e={})=>{const n={...r,...e},i=t.replace(/:([a-zA-Z_]+)/g,((t,e)=>`${n[e]}`)),u=[...t.matchAll(/:([a-zA-Z_]+)/g)].map((t=>t[1])),s=Object.fromEntries(Object.entries(n).filter((([t])=>!u.includes(t)))),a=/:address[^A-Z]/.test(t)||"address"in s,p=/:collection[^A-Z]/.test(t)||"collection"in s;if(a){const t=n.address;if(!S(t))throw new w(t)}if(p){const t=n.collection;if(Array.isArray(t)?t.some((t=>!g(t))):!g(t))throw new b(t)}const l=Object.fromEntries(Object.entries(s).map((([t,e])=>[t,e instanceof FormData?e:"filter"===t||"body"===t?JSON.stringify(e):Array.isArray(e)?e.join(","):e]))),{body:c,auth:d,method:f,headers:h,cache:y,next:m,debug:v,signal:x,credentials:T,mode:A,redirect:q,referrer:_,referrerPolicy:k,integrity:I,keepalive:E,priority:P,window:R,continuationToken:O,...M}=l,B=d?`Bearer ${d}`:void 0;t.startsWith("/stellar-lending/")&&void 0!==O&&(M.continuationToken=O);const U={...h,...B?{Authorization:B}:{},...O&&!t.startsWith("/stellar-lending/")?{"X-Continuation-Token":String(O)}:{}},C={...m,tags:[...m?.tags??[],i]};return o.fetchWithTimeout(i,{method:f,params:M,body:c,headers:U,cache:y,debug:v,...Object.fromEntries(Object.entries({signal:x,credentials:T,mode:A,redirect:q,referrer:_,referrerPolicy:k,integrity:I,keepalive:E,priority:P,window:R}).filter((([,t])=>void 0!==t))),...C?{next:C}:{}})},a=(t={})=>s(t);for(const t of Object.keys(u))x.includes(t)&&(a[t]=e=>s({...e,method:e.method??t.toUpperCase()}));return a}function _(t){const e=function(){const t={static:{},params:{},leaves:[]};for(const[e,r]of Object.entries(v)){const o=e.split("/").filter(Boolean);let n=t;for(const t of o)if(t.startsWith(":")){const e=A(t.slice(1));n=n.params[e]||={static:{},params:{},leaves:[]}}else{const e=A(t);n=n.static[e]||={static:{},params:{},leaves:[]}}n.leaves.push({rawPath:e,def:r})}return t}(),r=(e,o)=>{const n=e.leaves.length,i=Object.keys(e.static).length,u=Object.keys(e.params).length;let s;if(1===n&&i+u>0){const{rawPath:r,def:n}=e.leaves[0];s=q(r,n,o,t)}else{s={};for(const{rawPath:r,def:n}of e.leaves)s[A(r.split("/").pop().replace(/^:/,""))]=q(r,n,o,t)}for(const[t,n]of Object.entries(e.static)){const e=r(n,o);let i=e;if(e&&"object"==typeof e&&t in e&&"function"==typeof e[t]){const r=e[t],o=Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)));1===r.length||(Object.assign(r,o),i=r)}void 0===s[t]?s[t]=i:"function"==typeof s[t]?Object.assign(s[t],i):"function"==typeof i?(Object.assign(i,s[t]),s[t]=i):Object.assign(s[t],i)}for(const[t,n]of Object.entries(e.params)){const e=e=>{const i=r(n,{...o,[t]:e});if(i&&"object"==typeof i&&1===Object.keys(i).length&&t in i&&"function"==typeof i[t]){const e=i[t],r=(...t)=>e(...t);return Object.assign(r,e)}return i};if(s[t]){const r=s[t];s[t]=t=>({...r(t),...e(t)})}else s[t]=e}return s};return r(e,{})}export{h as Chain,y as XOXNOClient,_ as buildSdk,g as isValidCollectionTicker,m as isValidNftIdentifier};export const STELLAR_GOVERNANCE_ZERO_PREDECESSOR=T.G_M;export const STELLAR_LENDING_TOPICS=T.fAY;export const STELLAR_NETWORKS=T.a_O;export const STELLAR_NETWORK_PASSPHRASE=T.A$9;export const SYNTHETIC_EVENT_ORDER_STRIDE=T.gRW;export const buildSameTokenRepaySwapSteps=T.VZJ;export const buildStellarAcceptOwnershipTx=T.N0v;export const buildStellarAddRewardsTx=T.B_D;export const buildStellarApproveBlendPoolTx=T.qLM;export const buildStellarApproveTokenTx=T.eX8;export const buildStellarBatchSwapTx=T.zaA;export const buildStellarBorrowBatchTx=T.xDR;export const buildStellarBorrowTx=T.jR0;export const buildStellarCctpForwardTx=T.P2l;export const buildStellarClaimRevenueTx=T.W68;export const buildStellarCreateLiquidityPoolTx=T.sec;export const buildStellarExecuteCancellerResetTx=T.ZPB;export const buildStellarExecuteStrategyTx=T.yrp;export const buildStellarFlashLoanTx=T.spi;export const buildStellarGovernanceAddSpokeImmediateTx=T.Iu1;export const buildStellarGovernanceCreateHubImmediateTx=T.yuB;export const buildStellarGovernanceExecuteGovernanceUpgradeTx=T.$96;export const buildStellarGovernanceExecuteGrantGovernanceRoleTx=T.zwJ;export const buildStellarGovernanceExecuteRevokeGovernanceRoleTx=T.h_A;export const buildStellarGovernanceExecuteTransferGovOwnTx=T.e_X;export const buildStellarGovernanceExecuteTx=T.TkG;export const buildStellarGovernanceExecuteUpdateDelayTx=T.BAg;export const buildStellarGovernancePauseTx=T.u9S;export const buildStellarGovernanceRevokeRoleImmediateTx=T.biU;export const buildStellarGovernanceSetOracleSanityBoundsImmediateTx=T.gc5;export const buildStellarGovernanceSetSpokeAssetFlagsImmediateTx=T.ayx;export const buildStellarGrantRoleTx=T.SXg;export const buildStellarLendingIdentifier=T.UFY;export const buildStellarLiquidateTx=T.Y5o;export const buildStellarMigrateFromBlendTx=T.mEH;export const buildStellarMigrateTx=T.xGW;export const buildStellarMultiplyTx=T.s9Q;export const buildStellarPauseTx=T.OL0;export const buildStellarProposeAddAssetToSpokeTx=T.k6p;export const buildStellarProposeAddSpokeTx=T.djE;export const buildStellarProposeApproveBlendPoolTx=T.kDJ;export const buildStellarProposeApproveTokenTx=T.Yfw;export const buildStellarProposeCancellerResetTx=T.AI1;export const buildStellarProposeConfigureAssetOracleTx=T.O2U;export const buildStellarProposeConfigureMarketOracleTx=T.c5J;export const buildStellarProposeCreateHubTx=T.N8y;export const buildStellarProposeCreateLiquidityPoolTx=T.qUh;export const buildStellarProposeDeployPoolTx=T.RZj;export const buildStellarProposeEditAssetInSpokeTx=T.nio;export const buildStellarProposeEditOracleToleranceTx=T.hFg;export const buildStellarProposeGovernanceUpgradeTx=T.Qkp;export const buildStellarProposeGrantGovernanceRoleTx=T.GwL;export const buildStellarProposeMigrateControllerTx=T.$Kr;export const buildStellarProposeRemoveAssetFromSpokeTx=T.ujH;export const buildStellarProposeRemoveSpokeTx=T.Odj;export const buildStellarProposeRevokeBlendPoolTx=T.X7c;export const buildStellarProposeRevokeGovernanceRoleTx=T.Ubz;export const buildStellarProposeRevokeTokenTx=T.Dx4;export const buildStellarProposeSetAccumulatorTx=T.OAr;export const buildStellarProposeSetAggregatorTx=T.$Uh;export const buildStellarProposeSetMinBorrowCollatTx=T.obN;export const buildStellarProposeSetPositionLimitsTx=T.$lZ;export const buildStellarProposeSetPositionManagerTx=T.Kaw;export const buildStellarProposeSetPriceAggregatorTx=T.Wbk;export const buildStellarProposeSetSpokeLiquidationCurveTx=T.kwV;export const buildStellarProposeSetSwapAggregatorTx=T.qAI;export const buildStellarProposeTransferCtrlOwnershipTx=T.VSx;export const buildStellarProposeTransferGovOwnTx=T.HPG;export const buildStellarProposeUnpauseTx=T.xQk;export const buildStellarProposeUpdateDelayTx=T.YQw;export const buildStellarProposeUpgradeControllerTx=T.QY;export const buildStellarProposeUpgradePoolParamsTx=T.osR;export const buildStellarProposeUpgradePoolTx=T.Kob;export const buildStellarRenewAccountTx=T.IJt;export const buildStellarRepayBatchTx=T.nw5;export const buildStellarRepayDebtWithCollateralTx=T.PrA;export const buildStellarRepayTx=T.ZEf;export const buildStellarRevokeBlendPoolTx=T.X0W;export const buildStellarRevokeRoleTx=T.evz;export const buildStellarRevokeTokenTx=T.P8C;export const buildStellarSetAccumulatorTx=T.aVn;export const buildStellarSetAggregatorTx=T.p2b;export const buildStellarSetMarketOracleConfigTx=T.sVY;export const buildStellarSetOracleSanityBoundsTx=T.XDq;export const buildStellarSetOracleToleranceTx=T.Jsu;export const buildStellarSetOracleTx=T.W5;export const buildStellarSetPositionLimitsTx=T.Dyw;export const buildStellarSetPriceAggregatorTx=T._i2;export const buildStellarSetSpokeAssetFlagsTx=T.FZg;export const buildStellarSetSwapAggregatorTx=T.wGh;export const buildStellarSupplyBatchTx=T.Nix;export const buildStellarSupplyTx=T.v_o;export const buildStellarSwapCollateralTx=T.qDU;export const buildStellarSwapDebtTx=T.qRb;export const buildStellarTransferOwnershipTx=T.QJY;export const buildStellarUnpauseTx=T.bmW;export const buildStellarUpdateAccountThresholdTx=T.n_N;export const buildStellarUpdateIndexesTx=T.v87;export const buildStellarUpgradeControllerTx=T.qMI;export const buildStellarUpgradeLiquidityPoolParamsTx=T.gHX;export const buildStellarWithdrawBatchTx=T.O3p;export const buildStellarWithdrawTx=T.Gzh;export const buildTx=T.prJ;export const decodeStellarLendingEvent=T.Fmy;export const decodeStellarLiquidateReturn=T.OBV;export const encodeAssetOracle=T.Ft;export const encodeInterestRateModel=T.MB4;export const encodeMarketOracleConfigInput=T.Dnk;export const encodeMarketParamsRaw=T.pqp;export const encodePositionLimits=T.Q3w;export const encodePriceKey=T.Jh3;export const encodeStrategyPayloadToRouteXdr=T.wfs;export const extractEventOrder=T.UmN;export const getStellarAccountPositions=T.xO7;export const getStellarActiveUsersSeries=T.R11;export const getStellarAggregatorQuote=T.LwT;export const getStellarAsset=T.mMz;export const getStellarAssetGraph=T.iES;export const getStellarAssetMarkets=T.zpK;export const getStellarAssetPage=T.N3x;export const getStellarAssets=T.bNp;export const getStellarCampaignLeaderboard=T.T3v;export const getStellarCampaignMe=T.KQV;export const getStellarDefiLlamaDimensions=T.S9l;export const getStellarDeployment=T.rER;export const getStellarDetailedMarkets=T.XNg;export const getStellarFeeRevenueSeries=T.VeU;export const getStellarGovernanceProposals=T.T_r;export const getStellarHolderDistribution=T.m4Y;export const getStellarHub=T.XIn;export const getStellarHubGraph=T.Lt0;export const getStellarHubHolders=T.wsx;export const getStellarHubs=T.KKL;export const getStellarLendingContext=T.yl$;export const getStellarLendingLiveState=T.kqD;export const getStellarLiquidationsLeaderboard=T.dEm;export const getStellarLiquidationsSeries=T.bu4;export const getStellarParticipantCounts=T.ftY;export const getStellarPnlByScope=T.Ht0;export const getStellarPositionsLeaderboard=T.$uf;export const getStellarPositionsPnl=T.wqt;export const getStellarQuoteTokens=T.CHU;export const getStellarRateSpreadSeries=T.Wc$;export const getStellarReserve=T.Y5D;export const getStellarReserveGraph=T.KGs;export const getStellarReserveHolders=T.nWw;export const getStellarReserves=T.jFb;export const getStellarRevenueSeries=T.Pvd;export const getStellarSpoke=T.S2b;export const getStellarSpokeGraph=T.uSb;export const getStellarSpokeHolders=T.N9t;export const getStellarSpokes=T.bNM;export const getStellarStatsHistory=T.PvK;export const getStellarUserActivity=T.O5u;export const getStellarUserActivityPage=T.NYX;export const getStellarUserHistory=T.FCB;export const getStellarUserPositions=T.h_O;export const getStellarVolumeSeries=T.zu2;export const getStellarWalletBalance=T.Xix;export const mapQuoteResponseToAggregatorSwap=T.LAw;export const mapQuoteResponseToStrategyPayload=T.E6J;export const mapQuoteResponseToStrategySwap=T.Dsj;export const mapSorobanError=T.XVZ;export const mapStellarPositionActivityType=T.CUR;export const prepareStellarBuiltTx=T.VxL;export const prepareStellarTxXdr=T.DLQ;export const stellarLendingDispatchKey=T.ONb;export const stellarLendingRead=T.HhT;export const stellarNetworks=T.PF2;export const syntheticEventOrder=T.oVm;export const tagStellarInvokedContractError=T.g57;export const toBase64Xdr=T.LaM;export const toStellarPositionMode=T.Vuj;
2
+ "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as t,Address as e,BASE_FEE as r,Contract as o,ScInt as n,TransactionBuilder as i,scValToNative as u,xdr as s}from"@stellar/stellar-sdk";var a={526(t,e){e.byteLength=function(t){var e=s(t),r=e[0],o=e[1];return 3*(r+o)/4-o},e.toByteArray=function(t){var e,r,i=s(t),u=i[0],a=i[1],p=new n(function(t,e,r){return 3*(e+r)/4-r}(0,u,a)),l=0,c=a>0?u-4:u;for(r=0;r<c;r+=4)e=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],p[l++]=e>>16&255,p[l++]=e>>8&255,p[l++]=255&e;return 2===a&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,p[l++]=255&e),1===a&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,p[l++]=e>>8&255,p[l++]=255&e),p},e.fromByteArray=function(t){for(var e,o=t.length,n=o%3,i=[],u=16383,s=0,p=o-n;s<p;s+=u)i.push(a(t,s,s+u>p?p:s+u));return 1===n?(e=t[o-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===n&&(e=(t[o-2]<<8)+t[o-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),i.join("")};for(var r=[],o=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)r[u]=i[u],o[i.charCodeAt(u)]=u;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function a(t,e,o){for(var n,i,u=[],s=e;s<o;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),u.push(r[(i=n)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return u.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},287(t,e,r){const o=r(526),n=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=a,e.IS=50;const u=2147483647;function s(t){if(t>u)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return p(t,e,r)}function p(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let o=s(r);const n=o.write(t,e);return n!==r&&(o=o.slice(0,n)),o}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return f(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return f(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return f(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const o=t.valueOf&&t.valueOf();if(null!=o&&o!==t)return a.from(o,e,r);const n=function(t){if(a.isBuffer(t)){const e=0|h(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||Z(t.length)?s(0):d(t):"Buffer"===t.type&&Array.isArray(t.data)?d(t.data):void 0}(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return l(t),s(t<0?0:0|h(t))}function d(t){const e=t.length<0?0:0|h(t.length),r=s(e);for(let o=0;o<e;o+=1)r[o]=255&t[o];return r}function f(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let o;return o=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(o,a.prototype),o}function h(t){if(t>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return 0|t}function y(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===r)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return o?-1:j(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){let o=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return _(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return E(this,e,r);case"base64":return q(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),o=!0}}function m(t,e,r){const o=t[e];t[e]=t[r],t[r]=o}function b(t,e,r,o,n){if(0===t.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:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=a.from(e,o)),a.isBuffer(e))return 0===e.length?-1:w(t,e,r,o,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,o,n);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,o,n){let i,u=1,s=t.length,a=e.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(t.length<2||e.length<2)return-1;u=2,s/=2,a/=2,r/=2}function p(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}if(n){let o=-1;for(i=r;i<s;i++)if(p(t,i)===p(e,-1===o?0:i-o)){if(-1===o&&(o=i),i-o+1===a)return o*u}else-1!==o&&(i-=i-o),o=-1}else for(r+a>s&&(r=s-a),i=r;i>=0;i--){let r=!0;for(let o=0;o<a;o++)if(p(t,i+o)!==p(e,o)){r=!1;break}if(r)return i}return-1}function S(t,e,r,o){r=Number(r)||0;const n=t.length-r;o?(o=Number(o))>n&&(o=n):o=n;const i=e.length;let u;for(o>i/2&&(o=i/2),u=0;u<o;++u){const o=parseInt(e.substr(2*u,2),16);if(Z(o))return u;t[r+u]=o}return u}function v(t,e,r,o){return X(j(e,t.length-r),t,r,o)}function x(t,e,r,o){return X(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,o)}function T(t,e,r,o){return X(H(e),t,r,o)}function A(t,e,r,o){return X(function(t,e){let r,o,n;const i=[];for(let u=0;u<t.length&&!((e-=2)<0);++u)r=t.charCodeAt(u),o=r>>8,n=r%256,i.push(n),i.push(o);return i}(e,t.length-r),t,r,o)}function q(t,e,r){return 0===e&&r===t.length?o.fromByteArray(t):o.fromByteArray(t.slice(e,r))}function _(t,e,r){r=Math.min(t.length,r);const o=[];let n=e;for(;n<r;){const e=t[n];let i=null,u=e>239?4:e>223?3:e>191?2:1;if(n+u<=r){let r,o,s,a;switch(u){case 1:e<128&&(i=e);break;case 2:r=t[n+1],128==(192&r)&&(a=(31&e)<<6|63&r,a>127&&(i=a));break;case 3:r=t[n+1],o=t[n+2],128==(192&r)&&128==(192&o)&&(a=(15&e)<<12|(63&r)<<6|63&o,a>2047&&(a<55296||a>57343)&&(i=a));break;case 4:r=t[n+1],o=t[n+2],s=t[n+3],128==(192&r)&&128==(192&o)&&128==(192&s)&&(a=(15&e)<<18|(63&r)<<12|(63&o)<<6|63&s,a>65535&&a<1114112&&(i=a))}}null===i?(i=65533,u=1):i>65535&&(i-=65536,o.push(i>>>10&1023|55296),i=56320|1023&i),o.push(i),n+=u}return function(t){const e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);let r="",o=0;for(;o<e;)r+=String.fromCharCode.apply(String,t.slice(o,o+=k));return r}(o)}a.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),a.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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,r){return p(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return function(t,e,r){return l(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},a.allocUnsafe=function(t){return c(t)},a.allocUnsafeSlow=function(t){return c(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(Y(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,o=e.length;for(let n=0,i=Math.min(r,o);n<i;++n)if(t[n]!==e[n]){r=t[n],o=e[n];break}return r<o?-1:o<r?1:0},a.isEncoding=function(t){switch(String(t).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}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const o=a.allocUnsafe(e);let n=0;for(r=0;r<t.length;++r){let e=t[r];if(Y(e,Uint8Array))n+e.length>o.length?(a.isBuffer(e)||(e=a.from(e)),e.copy(o,n)):Uint8Array.prototype.set.call(o,e,n);else{if(!a.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(o,n)}n+=e.length}return o},a.byteLength=y,a.prototype._isBuffer=!0,a.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},a.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},a.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},a.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?_(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){let t="";const r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(t,e,r,o,n){if(Y(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===o&&(o=0),void 0===n&&(n=this.length),e<0||r>t.length||o<0||n>this.length)throw new RangeError("out of range index");if(o>=n&&e>=r)return 0;if(o>=n)return-1;if(e>=r)return 1;if(this===t)return 0;let i=(n>>>=0)-(o>>>=0),u=(r>>>=0)-(e>>>=0);const s=Math.min(i,u),p=this.slice(o,n),l=t.slice(e,r);for(let t=0;t<s;++t)if(p[t]!==l[t]){i=p[t],u=l[t];break}return i<u?-1:u<i?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},a.prototype.write=function(t,e,r,o){if(void 0===e)o="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)o=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===o&&(o="utf8")):(o=r,r=void 0)}const n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let i=!1;for(;;)switch(o){case"hex":return S(this,t,e,r);case"utf8":case"utf-8":return v(this,t,e,r);case"ascii":case"latin1":case"binary":return x(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function I(t,e,r){let o="";r=Math.min(t.length,r);for(let n=e;n<r;++n)o+=String.fromCharCode(127&t[n]);return o}function E(t,e,r){let o="";r=Math.min(t.length,r);for(let n=e;n<r;++n)o+=String.fromCharCode(t[n]);return o}function P(t,e,r){const o=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>o)&&(r=o);let n="";for(let o=e;o<r;++o)n+=K[t[o]];return n}function R(t,e,r){const o=t.slice(e,r);let n="";for(let t=0;t<o.length-1;t+=2)n+=String.fromCharCode(o[t]+256*o[t+1]);return n}function O(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,o,n,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<i)throw new RangeError('"value" argument is out of bounds');if(r+o>t.length)throw new RangeError("Index out of range")}function B(t,e,r,o,n){F(e,o,n,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i;let u=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=u,u>>=8,t[r++]=u,u>>=8,t[r++]=u,u>>=8,t[r++]=u,r}function U(t,e,r,o,n){F(e,o,n,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i>>=8,t[r+6]=i,i>>=8,t[r+5]=i,i>>=8,t[r+4]=i;let u=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=u,u>>=8,t[r+2]=u,u>>=8,t[r+1]=u,u>>=8,t[r]=u,r+8}function C(t,e,r,o,n,i){if(r+o>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function $(t,e,r,o,i){return e=+e,r>>>=0,i||C(t,0,r,4),n.write(t,e,r,o,23,4),r+4}function N(t,e,r,o,i){return e=+e,r>>>=0,i||C(t,0,r,8),n.write(t,e,r,o,52,8),r+8}a.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const o=this.subarray(t,e);return Object.setPrototypeOf(o,a.prototype),o},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let o=this[t],n=1,i=0;for(;++i<e&&(n*=256);)o+=this[t+i]*n;return o},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let o=this[t+--e],n=1;for(;e>0&&(n*=256);)o+=this[t+--e]*n;return o},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readBigUInt64LE=J((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const o=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,n=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(o)+(BigInt(n)<<BigInt(32))})),a.prototype.readBigUInt64BE=J((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const o=e*2**24+65536*this[++t]+256*this[++t]+this[++t],n=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(o)<<BigInt(32))+BigInt(n)})),a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let o=this[t],n=1,i=0;for(;++i<e&&(n*=256);)o+=this[t+i]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*e)),o},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let o=e,n=1,i=this[t+--o];for(;o>0&&(n*=256);)i+=this[t+--o]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readBigInt64LE=J((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const o=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(o)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),a.prototype.readBigInt64BE=J((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const o=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(o)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),a.prototype.readFloatLE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,o){t=+t,e>>>=0,r>>>=0,o||M(this,t,e,r,Math.pow(2,8*r)-1,0);let n=1,i=0;for(this[e]=255&t;++i<r&&(n*=256);)this[e+i]=t/n&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,o){t=+t,e>>>=0,r>>>=0,o||M(this,t,e,r,Math.pow(2,8*r)-1,0);let n=r-1,i=1;for(this[e+n]=255&t;--n>=0&&(i*=256);)this[e+n]=t/i&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigUInt64LE=J((function(t,e=0){return B(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeBigUInt64BE=J((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeIntLE=function(t,e,r,o){if(t=+t,e>>>=0,!o){const o=Math.pow(2,8*r-1);M(this,t,e,r,o-1,-o)}let n=0,i=1,u=0;for(this[e]=255&t;++n<r&&(i*=256);)t<0&&0===u&&0!==this[e+n-1]&&(u=1),this[e+n]=(t/i|0)-u&255;return e+r},a.prototype.writeIntBE=function(t,e,r,o){if(t=+t,e>>>=0,!o){const o=Math.pow(2,8*r-1);M(this,t,e,r,o-1,-o)}let n=r-1,i=1,u=0;for(this[e+n]=255&t;--n>=0&&(i*=256);)t<0&&0===u&&0!==this[e+n+1]&&(u=1),this[e+n]=(t/i|0)-u&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigInt64LE=J((function(t,e=0){return B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeBigInt64BE=J((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeFloatLE=function(t,e,r){return $(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return $(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,o){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),o||0===o||(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o<r&&(o=r),o===r)return 0;if(0===t.length||0===this.length)return 0;if(e<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),t.length-e<o-r&&(o=t.length-e+r);const n=o-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,o):Uint8Array.prototype.set.call(t,this.subarray(r,o),e),n},a.prototype.fill=function(t,e,r,o){if("string"==typeof t){if("string"==typeof e?(o=e,e=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&&!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===t.length){const e=t.charCodeAt(0);("utf8"===o&&e<128||"latin1"===o)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let n;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(n=e;n<r;++n)this[n]=t;else{const i=a.isBuffer(t)?t:a.from(t,o),u=i.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(n=0;n<r-e;++n)this[n+e]=i[n%u]}return this};const L={};function D(t,e,r){L[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function W(t){let e="",r=t.length;const o="-"===t[0]?1:0;for(;r>=o+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function F(t,e,r,o,n,i){if(t>r||t<e){const o="bigint"==typeof e?"n":"";let n;throw n=i>3?0===e||e===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}`:`>= ${e}${o} and <= ${r}${o}`,new L.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,r){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||G(e,t.length-(r+1))}(o,n,i)}function z(t,e){if("number"!=typeof t)throw new L.ERR_INVALID_ARG_TYPE(e,"number",t)}function G(t,e,r){if(Math.floor(t)!==t)throw z(t,r),new L.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new L.ERR_BUFFER_OUT_OF_BOUNDS;throw new L.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(t,e,r){let o=`The value of "${t}" 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 ${e}. Received ${n}`,o}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function j(t,e){let r;e=e||1/0;const o=t.length;let n=null;const i=[];for(let u=0;u<o;++u){if(r=t.charCodeAt(u),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(u+1===o){(e-=3)>-1&&i.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&i.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=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((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function H(t){return o.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,r,o){let n;for(n=0;n<o&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const K=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const o=16*r;for(let n=0;n<16;++n)e[o+n]=t[r]+t[n]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},251(t,e){e.read=function(t,e,r,o,n){var i,u,s=8*n-o-1,a=(1<<s)-1,p=a>>1,l=-7,c=r?n-1:0,d=r?-1:1,f=t[e+c];for(c+=d,i=f&(1<<-l)-1,f>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=d,l-=8);for(u=i&(1<<-l)-1,i>>=-l,l+=o;l>0;u=256*u+t[e+c],c+=d,l-=8);if(0===i)i=1-p;else{if(i===a)return u?NaN:1/0*(f?-1:1);u+=Math.pow(2,o),i-=p}return(f?-1:1)*u*Math.pow(2,i-o)},e.write=function(t,e,r,o,n,i){var u,s,a,p=8*i-n-1,l=(1<<p)-1,c=l>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=o?0:i-1,h=o?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=l):(u=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-u))<1&&(u--,a*=2),(e+=u+c>=1?d/a:d*Math.pow(2,1-c))*a>=2&&(u++,a/=2),u+c>=l?(s=0,u=l):u+c>=1?(s=(e*a-1)*Math.pow(2,n),u+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,n),u=0));n>=8;t[r+f]=255&s,f+=h,s/=256,n-=8);for(u=u<<n|s,p+=n;p>0;t[r+f]=255&u,f+=h,u/=256,p-=8);t[r+f-h]|=128*y}},34(a,p,l){l.d(p,{G_M:()=>De,fAY:()=>uo,a_O:()=>c,A$9:()=>h,gRW:()=>ao,VZJ:()=>Io,N0v:()=>be,B_D:()=>Ne,qLM:()=>Ae,eX8:()=>_e,zaA:()=>wo,xDR:()=>j,jR0:()=>H,P2l:()=>Po,W68:()=>$e,sec:()=>Ue,ZPB:()=>Cr,yrp:()=>bo,spi:()=>tt,Iu1:()=>Dr,yuB:()=>Lr,$96:()=>Er,zwJ:()=>Rr,h_A:()=>Or,e_X:()=>Mr,TkG:()=>Ir,BAg:()=>Pr,u9S:()=>Fr,biU:()=>Wr,gc5:()=>Nr,ayx:()=>$r,SXg:()=>ye,UFY:()=>po,Y5o:()=>J,mEH:()=>et,xGW:()=>de,s9Q:()=>rt,OL0:()=>fe,k6p:()=>or,djE:()=>er,kDJ:()=>cr,Yfw:()=>pr,AI1:()=>Ur,O2U:()=>Sr,c5J:()=>vr,N8y:()=>tr,qUh:()=>fr,RZj:()=>yr,nio:()=>nr,hFg:()=>xr,Qkp:()=>Tr,GwL:()=>qr,$Kr:()=>br,ujH:()=>ir,Odj:()=>rr,X7c:()=>dr,Ubz:()=>_r,Dx4:()=>lr,OAr:()=>Je,$Uh:()=>Ke,obN:()=>ar,$lZ:()=>Qe,Kaw:()=>sr,Wbk:()=>Ze,kwV:()=>ur,qAI:()=>Ye,VSx:()=>wr,HPG:()=>kr,xQk:()=>zr,YQw:()=>Ar,QY:()=>mr,osR:()=>hr,Kob:()=>gr,IJt:()=>Be,nw5:()=>Z,PrA:()=>it,ZEf:()=>K,X0W:()=>qe,evz:()=>ge,P8C:()=>ke,aVn:()=>xe,p2b:()=>ve,sVY:()=>Ee,XDq:()=>Oe,Jsu:()=>Pe,W5:()=>Ie,Dyw:()=>Te,_i2:()=>Se,FZg:()=>Re,wGh:()=>we,Nix:()=>G,v_o:()=>V,qDU:()=>nt,qRb:()=>ot,QJY:()=>me,bmW:()=>he,n_N:()=>Le,v87:()=>Me,qMI:()=>ce,gHX:()=>Ce,O3p:()=>X,Gzh:()=>Y,prJ:()=>F,Fmy:()=>so,OBV:()=>Q,Ft:()=>pe,MB4:()=>Jt,Dnk:()=>le,pqp:()=>Qt,Q3w:()=>te,Jh3:()=>ee,wfs:()=>mo,UmN:()=>lo,xO7:()=>St,R11:()=>Gt,LwT:()=>yo,mMz:()=>gt,iES:()=>kt,zpK:()=>Tt,N3x:()=>xt,bNp:()=>ct,T3v:()=>Nt,KQV:()=>Zt,S9l:()=>jt,rER:()=>f,XNg:()=>lt,VeU:()=>Wt,T_r:()=>Mt,m4Y:()=>$t,XIn:()=>mt,Lt0:()=>It,wsx:()=>qt,KKL:()=>dt,yl$:()=>at,kqD:()=>pt,dEm:()=>Ct,bu4:()=>Ft,ftY:()=>Ut,Ht0:()=>Yt,$uf:()=>Bt,wqt:()=>Xt,CHU:()=>go,Wc$:()=>Vt,Y5D:()=>yt,KGs:()=>Pt,nWw:()=>At,jFb:()=>ht,Pvd:()=>Dt,S2b:()=>bt,uSb:()=>Et,N9t:()=>_t,bNM:()=>ft,PvK:()=>Lt,O5u:()=>Rt,NYX:()=>Ot,FCB:()=>Ht,h_O:()=>wt,zu2:()=>zt,Xix:()=>vt,LAw:()=>xo,E6J:()=>So,Dsj:()=>vo,XVZ:()=>Oo,CUR:()=>fo,VxL:()=>_o,DLQ:()=>qo,ONb:()=>jr,HhT:()=>Kt,PF2:()=>d,oVm:()=>co,g57:()=>Ao,LaM:()=>Gr,Vuj:()=>ko});const c={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",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",aggregatorRouter:"CDNTWMWW2WGYTKIZTJYNGNVQQZI4KTC5BQRZ3275KESRX5T4O3AYECL5",governance:"CDS33JDOYH3F3FL4QUQ6DV4WKHML2AKHF4LADTZ57FRUAEBTE7NMY5FQ",priceAggregator:"CAALOOTIDXCX7D7FMQIBSSAJLPKOM3GMXS4UUSTDIG42JCRRJHOPUHOP",positionNftContract:"CDVN5JU675MEDPVRPCYC45AHFC275UH57WEU5OTFE4WFGZBNN7HTLPSY"}},d=c;function f(t){return c["testnet"===t?"stellarTestnet":"stellarMainnet"]}const h={mainnet:c.stellarMainnet.passphrase,testnet:c.stellarTestnet.passphrase};var y=l(287);const g=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],m={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},b=1e6,w=t=>new e(t).toScVal(),S=t=>new n(t).toI128(),v=t=>s.ScVal.scvU32(t),x=t=>{if("number"==typeof t&&!Number.isSafeInteger(t))throw new Error("Stellar builder: u64 numbers must be safe integers; pass a decimal string for larger values");return new n("string"==typeof t?t:t.toString()).toU64()},T=t=>s.ScVal.scvBool(t),A=t=>s.ScVal.scvString(t),q=t=>s.ScVal.scvSymbol(t),_=()=>s.ScVal.scvVoid(),k=t=>s.ScVal.scvVec(t),I=(t,e=32)=>{const r=t.startsWith("0x")?t.slice(2):t,o=y.hp.from(r,"hex");if(o.length!==e)throw new Error(`Stellar builder: expected a ${e}-byte BytesN (got ${o.length} bytes from "${t}")`);return s.ScVal.scvBytes(o)},E=(t,e)=>null==t?_():e(t),P=(t,e)=>B({asset:w(e),hub_id:v(t)}),R=(t,e,r)=>s.ScVal.scvVec([P(t,e),S(r)]),O=t=>s.ScVal.scvVec(t.map((t=>R(t.hubId,t.asset,t.amount)))),M=t=>{if("Transfer"===t)return k([q("Transfer")]);if(t&&"object"==typeof t&&"Credit"in t){const e=t.Credit;if("number"==typeof e&&!Number.isInteger(e))throw new Error(`Stellar builder: SeizeMode Credit account id must be an integer u64, got ${e}`);return k([q("Credit"),x(e)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(t)}`)},B=t=>{const e=Object.keys(t).sort().map((e=>new s.ScMapEntry({key:q(e),val:t[e]})));return s.ScVal.scvMap(e)};class U{assets=[];amounts=[];ops=[];weights=[];constructor(t){this.amounts.push(t)}asset(t){const e=this.assets.indexOf(t);if(-1!==e)return e;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(t),this.assets.length-1}amount(t){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(t),this.amounts.length-1}weight(t){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(t)||t<=0||t>b)throw new Error(`Stellar builder: split weight ${t} outside 1..=1000000`);return this.weights.push(t),this.weights.length-1}emit(t,e,r,o,n){this.ops.push([t,e,r,o,n])}emitPath(t,e){t.hops.forEach(((r,o)=>{if(r.tokenIn===r.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=t.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(m[r.venue],0===o?e:1,this.asset(r.pool),this.asset(r.tokenIn),this.asset(r.tokenOut))}))}lowerPaths(t){const e=t.filter((t=>t.hops.length>0)),r=Array.from({length:e.length},(()=>!1));for(let t=0;t<e.length;t+=1){if(r[t])continue;const o=e[t].hops[0]?.tokenIn,n=[];for(let r=t;r<e.length;r+=1)e[r].hops[0]?.tokenIn===o&&n.push(r);const i=n.reduce(((t,r)=>t+e[r].splitPpm),0);if(i>b)throw new Error(`Stellar builder: split weights for one token sum to ${i}, above 1000000`);const u=i===b;let s=b;n.forEach(((t,o)=>{r[t]=!0;const i=e[t];let a;if(o+1===n.length&&u)a=0;else{if(0===s)throw new Error("Stellar builder: split weights exhaust the group before its last path");const t=Math.floor(i.splitPpm*b/s);s-=Math.min(i.splitPpm,s),a=128+this.weight(t)}this.emitPath(i,a)}))}}toBytes(t,e,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,t,e,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,this.ops.length,this.weights.length];for(const t of this.ops)o.push(...t);for(const t of this.weights)o.push(t>>>16&255,t>>>8&255,255&t);return y.hp.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const C=t=>{const e=new U(t.totalMinOut),r=e.asset(t.tokenIn),o=e.asset(t.tokenOut);if(r===o)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(t.burnPool){const o=e.asset(t.burnPool),n=e.amountList.length;for(const r of t.burnMinAmounts??[])e.amount(r);e.emit(5,0,o,r,n)}if(e.lowerPaths(t.paths),t.mintPool){const r=t.preSwapAmount;if(r&&BigInt(r)>0n){const o=t.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,[u,s]=t.preSwapFromA?[n,i]:[i,n];e.emit(m.Aquarius,2+e.amount(r),e.asset(t.mintPool),e.asset(u),e.asset(s))}e.emit(6,0,e.asset(t.mintPool),o,e.amount(t.mintMinShares??"1"))}const n=Number(t.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${t.referralId} does not fit the wire’s u32`);return B({amounts:s.ScVal.scvVec(e.amountList.map((t=>S(t)))),assets:s.ScVal.scvVec(e.assetList.map((t=>w(t)))),ops:s.ScVal.scvBytes(e.toBytes(r,o,n))})},$=t=>{const e=y.hp.from(t);if(0===e.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return s.ScVal.scvBytes(e)},N=()=>s.ScVal.scvBytes(y.hp.alloc(0)),L=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((r=t).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 y.hp.from(t,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(e))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=y.hp.from(e,"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},D=t=>{if("string"==typeof t)return $(L(t));if(t instanceof Uint8Array)return 0===t.length?N():$(t);if(t&&"object"==typeof t)return"routeXdr"in(r=t)&&"string"==typeof r.routeXdr?$(L(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?$(L(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?$(L(t.bytes)):0===t.bytes.length?N():$(t.bytes):(e=(t=>{if(!t||"object"!=typeof t)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const e=t;if(!Array.isArray(e.paths)||0===e.paths.length&&!e.burnPool&&!e.mintPool)throw new Error("Stellar builder: `steps.paths` needs a strategy path or a liquidity burn/mint operation");if("string"!=typeof e.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof e.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof e.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const r=new Map;for(const[t,o]of e.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[${t}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[e,r]of o.hops.entries())if(!r||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!g.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${t}].hops[${e}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const e=o.hops[0];r.set(e.tokenIn,(r.get(e.tokenIn)??0)+o.splitPpm)}for(const[t,o]of r){if(o>b)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} sums to ${o}, above 1000000`);if(!e.mintPool&&o!==b)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} must sum to 1000000, got ${o}`)}return e})(t),s.ScVal.scvBytes(y.hp.from(C(e).toXDR("base64"),"base64")));var e,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},W=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,r=y.hp.from(e,"hex");return s.ScVal.scvBytes(r)})(t);if(t instanceof Uint8Array)return s.ScVal.scvBytes(y.hp.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function F(e,n,u){if(!e.controllerAddress)throw new Error("Stellar lending controllerAddress is required");const s=new o(e.controllerAddress),a=new t(e.caller,e.sourceSequence);return{xdr:new i(a,{fee:e.fee??r,networkPassphrase:h[e.network]}).addOperation(s.call(n,...u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function z(t){if(!Number.isInteger(t)||t<1||t>4294967295)throw new Error("Stellar builder: spokeId must be an integer from 1 to 4294967295");return v(t)}function G(t,e){const r=e.accountNonce??0;return F(t,"supply",[w(t.caller),x(r),z(e.spokeId),O([...e.assets])])}function V(t,e){return G(t,{accountNonce:e.accountNonce,spokeId:e.spokeId,assets:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function j(t,e){return F(t,"borrow",[w(t.caller),x(e.accountNonce),O([...e.borrows]),E(e.to,w)])}function H(t,e){return j(t,{accountNonce:e.accountNonce,borrows:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function X(t,e){return F(t,"withdraw",[w(t.caller),x(e.accountNonce),O([...e.withdrawals]),E(e.to,w)])}function Y(t,e){return X(t,{accountNonce:e.accountNonce,withdrawals:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function Z(t,e){return F(t,"repay",[w(t.caller),x(e.accountNonce),O([...e.payments])])}function K(t,e){return Z(t,{accountNonce:e.accountNonce,payments:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function J(t,e){return F(t,"liquidate",[w(t.caller),x(e.accountNonce),O([...e.debtPayments]),M(e.seizeMode??"Transfer")])}function Q(t){const e=u(s.ScVal.fromXDR(t,"base64"));if("bigint"==typeof e||"number"==typeof e)return e.toString();throw new Error("Stellar builder: liquidate return value must be a u64, got "+typeof e)}function tt(t,e){return F(t,"flash_loan",[w(t.caller),P(e.hubId,e.asset),S(e.amount),w(e.receiver),W(e.data)])}function et(t,e){return F(t,"migrate_from_blend",[w(t.caller),x(e.accountId),z(e.spokeId),v(e.hubId),w(e.blendPool),k(e.collateralTokens.map(w)),k(e.supplyTokens.map(w)),(r=e.debtCaps.map((t=>({token:t.token,amount:t.cap}))),s.ScVal.scvVec(r.map((t=>{return e=t.token,r=t.amount,s.ScVal.scvVec([w(e),S(r)]);var e,r}))))]);var r}function rt(t,e){const r=e.accountNonce??0;return F(t,"multiply",[w(t.caller),x(r),z(e.spokeId),P(e.collateral.hubId,e.collateral.asset),S(e.debtToFlashLoan),P(e.debt.hubId,e.debt.asset),v(e.mode),D(e.steps),E(e.initialPayment,(t=>R(t.hubId,t.asset,t.amount))),E(e.convertSwap,D)])}function ot(t,e){return F(t,"swap_debt",[w(t.caller),x(e.accountNonce),P(e.existingDebt.hubId,e.existingDebt.asset),S(e.newDebtAmount),P(e.newDebt.hubId,e.newDebt.asset),D(e.steps)])}function nt(t,e){return F(t,"swap_collateral",[w(t.caller),x(e.accountNonce),P(e.current.hubId,e.current.asset),S(e.fromAmount),P(e.newCollateral.hubId,e.newCollateral.asset),D(e.steps)])}function it(t,e){return F(t,"repay_debt_with_collateral",[w(t.caller),x(e.accountNonce),P(e.collateral.hubId,e.collateral.asset),S(e.collateralAmount),P(e.debt.hubId,e.debt.asset),D(e.steps),T(e.closePosition)])}const ut="/stellar-lending",st=encodeURIComponent,at=(t,e)=>t.fetchWithTimeout(`${ut}/context`,e),pt=(t,e)=>t.fetchWithTimeout(`${ut}/live-state`,e),lt=(t,e)=>t.fetchWithTimeout(`${ut}/markets/detailed`,e),ct=(t,e)=>t.fetchWithTimeout(`${ut}/assets`,e),dt=(t,e)=>t.fetchWithTimeout(`${ut}/hubs`,e),ft=(t,e)=>t.fetchWithTimeout(`${ut}/spokes`,e),ht=(t,e={},r)=>t.fetchWithTimeout(`${ut}/reserves`,{...r,params:{...e}}),yt=(t,e,r,o,n)=>t.fetchWithTimeout(`${ut}/reserves/${e}/${r}/${st(o)}`,n),gt=(t,e,r)=>t.fetchWithTimeout(`${ut}/assets/${st(e)}`,r),mt=(t,e,r)=>t.fetchWithTimeout(`${ut}/hubs/${e}`,r),bt=(t,e,r)=>t.fetchWithTimeout(`${ut}/spokes/${e}`,r),wt=(t,e,r)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/positions`,r),St=(t,e,r)=>t.fetchWithTimeout(`${ut}/accounts/${st(e)}/positions`,r),vt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/assets/${st(r)}/balance`,o),xt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/assets/${st(e)}/page`,{...o,params:{...r}}),Tt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/assets/${st(e)}/markets`,{...o,params:{side:r}}),At=(t,e,r,o,n,i)=>t.fetchWithTimeout(`${ut}/reserves/${e}/${r}/${st(o)}/holders`,{...i,params:{side:n}}),qt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/hubs/${e}/holders`,{...o,params:{side:r}}),_t=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/spokes/${e}/holders`,{...o,params:{side:r}}),kt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/assets/${st(e)}/graph`,{...o,params:{...r}}),It=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/hubs/${e}/graph`,{...o,params:{...r}}),Et=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/spokes/${e}/graph`,{...o,params:{...r}}),Pt=(t,e,r,o,n,i)=>t.fetchWithTimeout(`${ut}/reserves/${e}/${r}/${st(o)}/graph`,{...i,params:{...n}}),Rt=(t,e,r={},o)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/activity`,{...o,params:{...r}}),Ot=(t,e,r={},o)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/activity/page`,{...o,params:{...r}}),Mt=(t,e={},r)=>t.fetchWithTimeout(`${ut}/governance/proposals`,{...r,params:{...e}}),Bt=(t,e={},r)=>t.fetchWithTimeout(`${ut}/positions`,{...r,params:{...e}}),Ut=(t,e={},r)=>t.fetchWithTimeout(`${ut}/participants`,{...r,params:{...e}}),Ct=(t,e={},r)=>t.fetchWithTimeout(`${ut}/liquidations/leaderboard`,{...r,params:{...e}}),$t=(t,e={},r)=>t.fetchWithTimeout(`${ut}/distribution`,{...r,params:{...e}}),Nt=(t,e={},r)=>t.fetchWithTimeout(`${ut}/campaign/leaderboard`,{...r,params:{...e}}),Lt=(t,e,r)=>t.fetchWithTimeout(`${ut}/stats/history`,{...r,params:{...e}}),Dt=(t,e,r)=>t.fetchWithTimeout(`${ut}/revenue`,{...r,params:{...e}}),Wt=(t,e,r)=>t.fetchWithTimeout(`${ut}/revenue/fees`,{...r,params:{...e}}),Ft=(t,e,r)=>t.fetchWithTimeout(`${ut}/liquidations`,{...r,params:{...e}}),zt=(t,e,r)=>t.fetchWithTimeout(`${ut}/volume`,{...r,params:{...e}}),Gt=(t,e,r)=>t.fetchWithTimeout(`${ut}/active-users`,{...r,params:{...e}}),Vt=(t,e,r)=>t.fetchWithTimeout(`${ut}/rate-spread`,{...r,params:{...e}}),jt=(t,e,r)=>t.fetchWithTimeout(`${ut}/defillama`,{...r,params:{...e}}),Ht=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/history`,{...o,params:{...r}}),Xt=(t,e,r)=>t.fetchWithTimeout(`${ut}/pnl`,{...r,params:{accountId:e}}),Yt=(t,e,r)=>t.fetchWithTimeout(`${ut}/pnl/scope`,{...r,params:{scope:e}}),Zt=(t,e,r)=>t.fetchWithTimeout(`${ut}/campaign/me`,{...r,params:{owner:e}}),Kt=t=>({context:e=>at(t,e),liveState:e=>pt(t,e),marketsDetailed:e=>lt(t,e),assets:e=>ct(t,e),hubs:e=>dt(t,e),spokes:e=>ft(t,e),reserves:(e={},r)=>void 0!==r||"hubId"in e||"spokeId"in e||"asset"in e?ht(t,e,r):ht(t,{},e),reserve:(e,r,o,n)=>yt(t,e,r,o,n),asset:(e,r)=>gt(t,e,r),hub:(e,r)=>mt(t,e,r),spoke:(e,r)=>bt(t,e,r),userPositions:(e,r)=>wt(t,e,r),accountPositions:(e,r)=>St(t,e,r),walletBalance:(e,r,o)=>vt(t,e,r,o),assetPage:(e,r,o)=>xt(t,e,r,o),assetMarkets:(e,r,o)=>Tt(t,e,r,o),reserveHolders:(e,r,o,n,i)=>At(t,e,r,o,n,i),hubHolders:(e,r,o)=>qt(t,e,r,o),spokeHolders:(e,r,o)=>_t(t,e,r,o),assetGraph:(e,r,o)=>kt(t,e,r,o),hubGraph:(e,r,o)=>It(t,e,r,o),spokeGraph:(e,r,o)=>Et(t,e,r,o),reserveGraph:(e,r,o,n,i)=>Pt(t,e,r,o,n,i),userActivity:(e,r={},o)=>Rt(t,e,r,o),userActivityPage:(e,r={},o)=>Ot(t,e,r,o),governanceProposals:(e={},r)=>Mt(t,e,r),positionsLeaderboard:(e={},r)=>Bt(t,e,r),participants:(e={},r)=>Ut(t,e,r),liquidationsLeaderboard:(e={},r)=>Ct(t,e,r),distribution:(e={},r)=>$t(t,e,r),campaignLeaderboard:(e={},r)=>Nt(t,e,r),statsHistory:(e,r)=>Lt(t,e,r),revenue:(e,r)=>Dt(t,e,r),feeRevenue:(e,r)=>Wt(t,e,r),liquidations:(e,r)=>Ft(t,e,r),volume:(e,r)=>zt(t,e,r),activeUsers:(e,r)=>Gt(t,e,r),rateSpread:(e,r)=>Vt(t,e,r),defillama:(e,r)=>jt(t,e,r),userHistory:(e,r,o)=>Ht(t,e,r,o),positionsPnl:(e,r)=>Xt(t,e,r),pnlByScope:(e,r)=>Yt(t,e,r),campaignMe:(e,r)=>Zt(t,e,r)}),Jt=t=>B({base_borrow_rate:S(t.baseBorrowRateRay),max_borrow_rate:S(t.maxBorrowRateRay),max_utilization:S(t.maxUtilizationRay),mid_utilization:S(t.midUtilizationRay),optimal_utilization:S(t.optimalUtilizationRay),reserve_factor:v(t.reserveFactorBps),slope1:S(t.slope1Ray),slope2:S(t.slope2Ray),slope3:S(t.slope3Ray)}),Qt=t=>B({asset_decimals:v(t.assetDecimals),asset_id:w(t.assetId),base_borrow_rate:S(t.baseBorrowRateRay),flashloan_fee:v(t.flashloanFeeBps),is_flashloanable:T(t.isFlashloanable),max_borrow_rate:S(t.maxBorrowRateRay),max_utilization:S(t.maxUtilizationRay),mid_utilization:S(t.midUtilizationRay),optimal_utilization:S(t.optimalUtilizationRay),reserve_factor:v(t.reserveFactorBps),slope1:S(t.slope1Ray),slope2:S(t.slope2Ray),slope3:S(t.slope3Ray)}),te=t=>B({max_borrow_positions:v(t.maxBorrowPositions),max_supply_positions:v(t.maxSupplyPositions)}),ee=t=>{if("Token"in t&&t.Token)return k([q("Token"),w(t.Token)]);if("Ref"in t&&t.Ref)return k([q("Ref"),q(t.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(t)}`)},re=t=>{if("Stellar"in t)return k([q("Stellar"),w(t.Stellar)]);if("Symbol"in t)return k([q("Symbol"),q(t.Symbol)]);if("String"in t)return k([q("String"),A(t.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(t)}`)},oe=t=>{if("Spot"===t)return k([q("Spot")]);if(t&&"object"==typeof t&&"Twap"in t)return k([q("Twap"),v(Number(t.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(t)}`)},ne=t=>{if("Reflector"===t||"RedStone"===t||"Xoxno"===t)return k([q(t)]);throw new Error(`Stellar builder: unknown ProviderKind "${t}"`)},ie=t=>{if("Market"===t||"Fundamental"===t)return k([q(t)]);throw new Error(`Stellar builder: unknown FeedNature "${t}"`)},ue=t=>{if("Reflector"in t){const e=t.Reflector;return k([q("Reflector"),B({asset:re(e.asset),contract:w(e.contract),read_mode:oe(e.readMode)})])}if("MultiFeed"in t){const e=t.MultiFeed;return k([q("MultiFeed"),B({contract:w(e.contract),feed_id:A(e.feedId),kind:ne(e.kind),nature:ie(e.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(t)}`)},se=t=>{const e=t;return B({decimals:v(e.decimals),max_stale_seconds:x(e.maxStaleSeconds),provider:ue(e.provider)})},ae=t=>{if("RequireDisjoint"===t)return k([q("RequireDisjoint")]);if(t&&"object"==typeof t&&"AllowShared"in t){const e=t.AllowShared;return k([q("AllowShared"),k(e.map((t=>B({contract:w(t.contract),kind:ne(t.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(t)}`)},pe=t=>{const e=t,r=e.sources??[];let o,n;if("number"==typeof e.toleranceBps)o=1e4+e.toleranceBps,n=Math.max(1,Math.floor(1e8/o));else{const t=e.tolerance??{};o=Number(t.upperRatioBps),n=Number(t.lowerRatioBps)}return B({asset_decimals:v(Number(e.assetDecimals)),independence:ae(e.independence),max_price_stale_seconds:x(Number(e.maxPriceStaleSeconds)),max_sanity_price_wad:S(String(e.maxSanityPriceWad)),min_sanity_price_wad:S(String(e.minSanityPriceWad)),sources:k(r.map((t=>(t=>{if("Feed"in t)return k([q("Feed"),se(t.Feed)]);if("Scaled"in t){const e=t.Scaled;return k([q("Scaled"),B({factor:se(e.factor),max_factor_wad:S(e.maxFactorWad),min_factor_wad:S(e.minFactorWad),quote:ee(e.quote)})])}if("LpShare"in t){const e=t.LpShare;return k([q("LpShare"),B({key_a:ee(e.keyA),key_b:ee(e.keyB),kind:k([q(e.kind||"ConstantProduct")]),pool:w(e.pool),reserve_a_decimals:v(e.reserveADecimals),reserve_b_decimals:v(e.reserveBDecimals),share_decimals:v(e.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(t)}`)})(t)))),tolerance:B({lower_ratio_bps:v(n),upper_ratio_bps:v(o)})})},le=pe;function ce(t,e){return F(t,"upgrade",[I(e.wasmHash)])}function de(t,e){return F(t,"migrate",[v(e.newVersion)])}function fe(t){return F(t,"pause",[])}function he(t){return F(t,"unpause",[])}function ye(t,e){return F(t,"grant_role",[w(e.account),q(e.role)])}function ge(t,e){return F(t,"revoke_role",[w(e.account),q(e.role)])}function me(t,e){return F(t,"transfer_ownership",[w(e.newOwner),v(e.liveUntilLedger)])}function be(t){return F(t,"accept_ownership",[])}function we(t,e){return F(t,"set_swap_aggregator",[w(e.aggregator)])}function Se(t,e){return F(t,"set_price_aggregator",[w(e.aggregator)])}const ve=we;function xe(t,e){return F(t,"set_accumulator",[w(e.accumulator)])}function Te(t,e){return F(t,"set_position_limits",[te(e)])}function Ae(t,e){return F(t,"approve_blend_pool",[w(e.pool)])}function qe(t,e){return F(t,"revoke_blend_pool",[w(e.pool)])}const _e=Ae,ke=qe;function Ie(t,e){return F(t,"set_oracle",[ee(e.key),pe(e.oracle)])}const Ee=Ie;function Pe(t,e){const r=e.toleranceBps,o=e.upperRatioBps??1e4+r,n=e.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return F(t,"set_tolerance",[ee(e.key),B({lower_ratio_bps:v(n),upper_ratio_bps:v(o)})])}function Re(t,e){return F(t,"set_spoke_asset_flags",[v(e.spokeId),P(e.hubId,e.asset),T(e.paused),T(e.frozen),T(e.noSeize)])}function Oe(t,e){return F(t,"set_oracle_sanity_bounds",[w(e.asset),S(e.minPriceWad),S(e.maxPriceWad)])}function Me(t,e){return F(t,"update_indexes",[w(t.caller),k(e.assets.map((t=>P(t.hubId,t.asset))))])}function Be(t,e){return F(t,"renew_account",[w(t.caller),x(e.accountNonce)])}function Ue(t,e){return F(t,"create_liquidity_pool",[v(e.hubId),w(e.asset),Qt(e.params)])}function Ce(t,e){return F(t,"upgrade_liquidity_pool_params",[P(e.hubId,e.asset),Jt(e.params)])}function $e(t,e){return F(t,"claim_revenue",[w(t.caller),k(e.assets.map((t=>P(t.hubId,t.asset))))])}function Ne(t,e){return F(t,"add_rewards",[w(t.caller),O(e.rewards)])}function Le(t,e){return F(t,"update_account_threshold",[w(t.caller),T(e.hasRisks),k(e.accountNonces.map((t=>x(t))))])}const De="00".repeat(32),We=t=>{if("string"==typeof t)return I(t);const e=y.hp.from(t);if(32!==e.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${e.length} bytes)`);return s.ScVal.scvBytes(e)},Fe=(t,...e)=>k([q(t),...e]),ze=t=>B({new_owner:w(t.newOwner),live_until_ledger:v(t.liveUntilLedger)}),Ge=t=>B({asset:w(t.asset),bonus:v(t.bonus),borrow_cap:S(t.borrowCap),can_borrow:T(t.canBorrow),can_collateral:T(t.canCollateral),frozen:T(t.frozen),hub_id:v(t.hubId),paused:T(t.paused),liquidation_fees:v(t.liquidationFees),ltv:v(t.ltv),no_seize:T(t.noSeize),spoke_id:v(t.spokeId),supply_cap:S(t.supplyCap),threshold:v(t.threshold)}),Ve=t=>B({account:w(t.account),role:q(t.role)});function je(e,n,u){if(!e.governanceAddress)throw new Error("Stellar governanceAddress is required");const s=new o(e.governanceAddress),a=new t(e.caller,e.sourceSequence);return{xdr:new i(a,{fee:e.fee??r,networkPassphrase:h[e.network]}).addOperation(s.call(n,...u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const He=(t,e,r)=>je(t,"propose",[w(t.caller),e,We(r)]),Xe=(t,e,r)=>je(t,"execute_self",[_(),e,We(r)]);function Ye(t,e,r){return He(t,Fe("SetSwapAggregator",w(e.aggregator)),r)}function Ze(t,e,r){return He(t,Fe("SetPriceAggregator",w(e.aggregator)),r)}const Ke=Ye;function Je(t,e,r){return He(t,Fe("SetAccumulator",w(e.accumulator)),r)}function Qe(t,e,r){return He(t,Fe("SetPositionLimits",te(e)),r)}function tr(t,e){return He(t,Fe("CreateHub"),e)}function er(t,e){return He(t,Fe("AddSpoke"),e)}function rr(t,e,r){return He(t,Fe("RemoveSpoke",v(e.spokeId)),r)}function or(t,e,r){return He(t,Fe("AddAssetToSpoke",Ge(e)),r)}function nr(t,e,r){return He(t,Fe("EditAssetInSpoke",Ge(e)),r)}function ir(t,e,r){return He(t,Fe("RemoveAssetFromSpoke",B({hub_asset:P((o=e).hubId,o.asset),spoke_id:v(o.spokeId)})),r);var o}function ur(t,e,r){return He(t,Fe("SetSpokeLiquidationCurve",B({hf_for_max_bonus_wad:S((o=e).hfForMaxBonusWad),liquidation_bonus_factor_bps:v(o.liquidationBonusFactorBps),spoke_id:v(o.spokeId),target_hf_wad:S(o.targetHfWad)})),r);var o}function sr(t,e,r){return He(t,Fe("SetPositionManager",w(e.manager),T(e.isActive)),r)}function ar(t,e,r){return He(t,Fe("SetMinBorrowCollateralUsd",S(e.floorWad)),r)}function pr(t,e,r){return He(t,Fe("ApproveToken",w(e.token)),r)}function lr(t,e,r){return He(t,Fe("RevokeToken",w(e.token)),r)}function cr(t,e,r){return He(t,Fe("ApproveBlendPool",w(e.pool)),r)}function dr(t,e,r){return He(t,Fe("RevokeBlendPool",w(e.pool)),r)}function fr(t,e,r){return He(t,Fe("CreateLiquidityPool",B({asset:w((o=e).asset),hub_id:v(o.hubId),params:Qt(o.params)})),r);var o}function hr(t,e,r){return He(t,Fe("UpgradeLiquidityPoolParams",B({hub_asset:P((o=e).hubId,o.asset),params:Jt(o.params)})),r);var o}function yr(t,e,r){return He(t,Fe("DeployPool",I(e.wasmHash)),r)}function gr(t,e,r){return He(t,Fe("UpgradePool",I(e.wasmHash)),r)}function mr(t,e,r){return He(t,Fe("UpgradeController",I(e.wasmHash)),r)}function br(t,e,r){return He(t,Fe("MigrateController",v(e.newVersion)),r)}function wr(t,e,r){return He(t,Fe("TransferCtrlOwnership",ze(e)),r)}function Sr(t,e,r){return He(t,Fe("ConfigureAssetOracle",B({key:ee((o=e).key),oracle:pe(o.oracle)})),r);var o}const vr=Sr;function xr(t,e,r){return He(t,Fe("EditOracleTolerance",B({key:ee((o=e).key),tolerance:v(o.tolerance)})),r);var o}function Tr(t,e,r){return He(t,Fe("UpgradeGov",I(e.wasmHash)),r)}function Ar(t,e,r){return He(t,Fe("UpdateGovDelay",v(e.newDelay)),r)}function qr(t,e,r){return He(t,Fe("GrantGovRole",Ve(e)),r)}function _r(t,e,r){return He(t,Fe("RevokeGovRole",Ve(e)),r)}function kr(t,e,r){return He(t,Fe("TransferGovOwnership",ze(e)),r)}function Ir(t,e){const r=k(e.argsXdr.map((t=>s.ScVal.fromXDR(t,"base64")))),o=We(e.predecessor??De);return je(t,"execute",[_(),w(e.target),q(e.functionName),r,o,We(e.salt)])}function Er(t,e,r){return Xe(t,Fe("UpgradeGov",I(e.wasmHash)),r)}function Pr(t,e,r){return Xe(t,Fe("UpdateGovDelay",v(e.newDelay)),r)}function Rr(t,e,r){return Xe(t,Fe("GrantGovRole",Ve(e)),r)}function Or(t,e,r){return Xe(t,Fe("RevokeGovRole",Ve(e)),r)}function Mr(t,e,r){return Xe(t,Fe("TransferGovOwnership",ze(e)),r)}const Br=t=>k(t.map(w));function Ur(t,e,r){return je(t,"propose_canceller_reset",[Br(e.newCancellers),We(r)])}function Cr(t,e,r){return je(t,"execute_canceller_reset",[E(e.executor,w),Br(e.newCancellers),We(r)])}function $r(t,e){return je(t,"set_spoke_asset_flags",[w(t.caller),v(e.spokeId),P(e.hubId,e.asset),T(e.paused),T(e.frozen),T(e.noSeize)])}function Nr(t,e){return je(t,"set_oracle_sanity_bounds",[w(t.caller),w(e.asset),S(e.minPriceWad),S(e.maxPriceWad)])}function Lr(t){return je(t,"create_hub",[w(t.caller)])}function Dr(t){return je(t,"add_spoke",[w(t.caller)])}function Wr(t,e){return je(t,"revoke_role_immediate",[w(e.account),q(e.role)])}function Fr(t){return je(t,"pause",[w(t.caller)])}function zr(t,e){return He(t,Fe("Unpause"),e)}const Gr=t=>t.toXDR("base64"),Vr=t=>s.ScVal.fromXDR(t,"base64"),jr=t=>t.map((t=>String(u(Vr(t))))).join(":"),Hr=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),Xr=t=>Number(t),Yr=t=>String(t),Zr=t=>t instanceof Uint8Array?y.hp.from(t).toString("hex"):y.hp.isBuffer(t)?t.toString("hex"):String(t),Kr=["None","Multiply","Long","Short"],Jr=["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"],Qr=t=>Array.isArray(t)?t:[],to=(t,e)=>{const r="Borrow"===e;return{action:(o=t[0],Jr[Xr(o)]??Hr(o)),positionType:e,hubId:Xr(t[1]),asset:Yr(t[2]),scaledAmountRay:Hr(t[3]),indexRay:Hr(t[4]),amount:Hr(t[5]),liquidationThresholdBps:r?void 0:Xr(t[6]),liquidationBonusBps:r?void 0:Xr(t[7]),loanToValueBps:r?void 0:Xr(t[8]),liquidationFeesBps:r?void 0:Xr(t[9])};var o},eo=t=>{return{owner:Yr(t[0]),spokeId:Xr(t[1]),mode:(e=t[2],Kr[Xr(e)]??"None")};var e},ro=t=>Array.isArray(t)?t[1]:void 0,oo=t=>{const e=(r=t,Array.isArray(r)?Yr(r[0]):Yr(r));var r;if("Token"===e)return{Token:Yr(ro(t))};if("Ref"===e)return{Ref:Yr(ro(t))};if(t&&"object"==typeof t&&!Array.isArray(t)){const e=t;if(void 0!==e.Token)return{Token:Yr(e.Token)};if(void 0!==e.Ref)return{Ref:Yr(e.Ref)}}return{Token:Yr(t)}},no=t=>{const e=t.tolerance??{};return{assetDecimals:Xr(t.asset_decimals),maxPriceStaleSeconds:Xr(t.max_price_stale_seconds),sources:Qr(t.sources).map((t=>t)),tolerance:{upperRatio:Xr(e.upper_ratio_bps),lowerRatio:Xr(e.lower_ratio_bps)},independence:t.independence,minSanityPriceWad:Hr(t.min_sanity_price_wad),maxSanityPriceWad:Hr(t.max_sanity_price_wad)}},io={"market:create":t=>({topic:"market:create",data:{hubId:Xr(t.hub_id),baseAsset:Yr(t.base_asset),maxBorrowRate:Hr(t.max_borrow_rate),baseBorrowRate:Hr(t.base_borrow_rate),slope1:Hr(t.slope1),slope2:Hr(t.slope2),slope3:Hr(t.slope3),midUtilization:Hr(t.mid_utilization),optimalUtilization:Hr(t.optimal_utilization),maxUtilization:Hr(t.max_utilization),reserveFactor:Xr(t.reserve_factor),marketAddress:Yr(t.market_address)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:Yr(t.asset),maxBorrowRateRay:Hr(t.max_borrow_rate),baseBorrowRateRay:Hr(t.base_borrow_rate),slope1Ray:Hr(t.slope1),slope2Ray:Hr(t.slope2),slope3Ray:Hr(t.slope3),midUtilizationRay:Hr(t.mid_utilization),optimalUtilizationRay:Hr(t.optimal_utilization),maxUtilizationRay:Hr(t.max_utilization),reserveFactorBps:Xr(t.reserve_factor)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:Qr(t).map((t=>{return e=Qr(t),{hubId:Xr(e[0]),asset:Yr(e[1]),timestamp:Xr(e[2]),supplyIndexRay:Hr(e[3]),borrowIndexRay:Hr(e[4]),cash:Hr(e[5]),suppliedRay:Hr(e[6]),borrowedRay:Hr(e[7]),revenueRay:Hr(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:Qr(t).map((t=>{const e=t;return{hubId:Xr(e.hub_id),asset:Yr(e.asset),params:(r=e.params,{maxBorrowRateRay:Hr(r.max_borrow_rate),baseBorrowRateRay:Hr(r.base_borrow_rate),slope1Ray:Hr(r.slope1),slope2Ray:Hr(r.slope2),slope3Ray:Hr(r.slope3),midUtilizationRay:Hr(r.mid_utilization),optimalUtilizationRay:Hr(r.optimal_utilization),maxUtilizationRay:Hr(r.max_utilization),reserveFactorBps:Xr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Xr(r.flashloan_fee),assetId:Yr(r.asset_id),assetDecimals:Xr(r.asset_decimals)})};var r}))}}),"position:batch_update":t=>{const e=Qr(t);return{topic:"position:batch_update",data:{accountId:Hr(e[0]),accountAttributes:eo(Qr(e[1])),updates:[...Qr(e[2]).map((t=>to(Qr(t),"Deposit"))),...Qr(e[3]).map((t=>to(Qr(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{hubId:Xr(t.hub_id),asset:Yr(t.asset),receiver:Yr(t.receiver),caller:Yr(t.caller),amount:Hr(t.amount),fee:Hr(t.fee)}}),"config:asset_oracle":t=>({topic:"config:asset_oracle",data:{key:oo(t.key),oracle:no(t.oracle)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:Yr(t.asset),oracle:no(t.config??t.oracle)}}),"position:liquidation":t=>({topic:"position:liquidation",data:{liquidator:Yr(t.liquidator),accountId:Hr(t.account_id),repaidUsdWad:Hr(t.repaid_usd_wad),bonusBps:Hr(t.bonus_bps)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Hr(t.account_id),totalBorrowUsdWad:Hr(t.total_borrow_usd_wad),totalCollateralUsdWad:Hr(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Yr(t.token),amount:Hr(t.amount),usdValueWad:Hr(t.usd_value_wad),accountId:Hr(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{hubId:Xr(t.hub_id),asset:Yr(t.asset),amount:Hr(t.amount),fee:Hr(t.fee),amountSent:Hr(t.amount_sent)}}),"config:approve_blend_pool":t=>({topic:"config:approve_blend_pool",data:{pool:Yr(t.pool??t.blend_pool??t.token),approved:Boolean(t.approved??t.is_approved??!0)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:Zr(t.wasm_hash??t.pool),approved:Boolean(t.approved)}}),"config:swap_aggregator":t=>({topic:"config:swap_aggregator",data:{aggregator:Yr(t.aggregator??t.swap_aggregator)}}),"config:price_aggregator":t=>({topic:"config:price_aggregator",data:{aggregator:Yr(t.aggregator??t.price_aggregator)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:Yr(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:Yr(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:Zr(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:Xr(t.max_supply_positions),maxBorrowPositions:Xr(t.max_borrow_positions)}}),"config:min_borrow_collateral":t=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Hr(t.min_borrow_collateral_usd_wad??t.floor_wad??t.value)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:Yr(t.asset)}}),"config:spoke":t=>{const e=t.spoke;return{topic:"config:spoke",data:{spokeId:Xr(e.spoke_id),isDeprecated:Boolean(e.is_deprecated),liquidationTargetHfWad:Hr(e.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Hr(e.hf_for_max_bonus_wad),liquidationBonusFactorBps:Xr(e.liquidation_bonus_factor_bps)}}}},uo=Object.freeze(Object.keys(io));function so(t,e){const r=jr(t),o=io[r];return o?o(u(Vr(e))):null}const ao=1e4;function po(t,e){return`${t}-${BigInt(e).toString(10)}`}function lo(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function co(t,e=0){return t*ao+e}function fo(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const ho=(t,e,r)=>{const o=new URL(e,t.endsWith("/")?t:`${t}/`);if(r)for(const[t,e]of Object.entries(r))void 0!==e&&o.searchParams.set(t,String(e));return o.toString()};async function yo(t,e){if(!e.baseUrl)throw new Error("Stellar quote baseUrl is required");if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=ho(e.baseUrl,"api/v1/quote",{from:t.from,to:t.to,amountIn:t.amountIn,amountOut:t.amountOut,maxHops:t.maxHops,maxSplits:t.maxSplits,slippage:t.slippage,includePaths:t.includePaths,sender:t.sender,router:t.router,referralId:t.referralId,platform:t.platform,fresh:t.fresh}),o=await fetch(r,e.fetchOptions);if(!o.ok){const t=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${t}`)}return await o.json()}async function go(t){if(!t.baseUrl)throw new Error("Stellar quote baseUrl is required");const e=ho(t.baseUrl,"api/v1/tokens"),r=await fetch(e,t.fetchOptions);if(!r.ok){const t=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${e} — ${t}`)}return await r.json()}const mo=t=>C(t).toXDR("base64");function bo(e,n){if(!e.routerAddress)throw new Error("Stellar aggregator routerAddress is required");const u=new o(e.routerAddress),s=new t(e.caller,e.sourceSequence),a=D(((t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t)(n,e.referralId));return{xdr:new i(s,{fee:e.fee??r,networkPassphrase:h[e.network]}).addOperation(u.call("execute_strategy",w(e.caller),S(e.totalIn),a)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function wo(t,e){return bo(t,e)}function So(t,e={}){if("string"!=typeof t.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:t.paths?t.paths.map((t=>({hops:t.swaps.map(To),splitPpm:t.splitPpm}))):[{hops:t.hops.map(To),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function vo(t,e={}){const r=t;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:So(t,e)}const xo=So,To=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function Ao(t,e){const r=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${r}`)}async function qo(t,e,r){const o=i.fromXDR(e,r?.network?h[r.network]:"");try{return(await t.prepareTransaction(o)).toXDR()}catch(t){if(r?.invokedContractId)throw Ao(r.invokedContractId,t);throw t}}async function _o(t,e,r){return qo(t,e.xdr,r)}function ko(t){if(t<=0||t>4)throw new Error(`Invalid PositionMode ${t} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return t-1}function Io(t,e){return new Uint8Array(0)}const Eo=t=>{const e=t.startsWith("0x")?t.slice(2):t;if(e.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return y.hp.from(e,"hex")};function Po(e){const r=new t(e.caller,e.sourceSequence),n=new o(e.forwarderAddress).call("mint_and_forward",s.ScVal.scvBytes(Eo(e.message)),s.ScVal.scvBytes(Eo(e.attestation)));return{xdr:new i(r,{fee:e.fee??"10000000",networkPassphrase:h[e.network]}).addOperation(n).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Ro={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."},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 Oo(t){const e=t.match(/Error\(Contract,\s*#(\d+)\)/);if(!e)return null;const r=Number(e[1]),o=Ro[r];return o?{code:r,...o}:null}}},p={};function l(t){var e=p[t];if(void 0!==e)return e.exports;var r=p[t]={exports:{}};return a[t](r,r.exports,l),r.exports}l.d=(t,e)=>{for(var r in e)l.o(e,r)&&!l.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const c="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",d="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",f="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e",h=3e4;var y;!function(t){t.MAINNET="1",t.DEVNET="D"}(y||(y={}));class g{apiUrl;chain;init;config;constructor(t){if(!t?.apiUrl?.trim())throw new Error("XOXNOClient: apiUrl is required");const{chain:e=y.MAINNET,apiUrl:r,...o}=t;this.apiUrl=r.trim().replace(/\/$/,""),this.chain=e,this.init=o,this.config=e==y.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:c,DR_SC:d,KG_SC:f,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:c,DR_SC:d,KG_SC:f,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(t,{params:e,...r}={})=>{const{next:o,cache:n,debug:i,timeout:u,...s}=this.init,{next:a,cache:p,debug:l,timeout:c,headers:d,method:f="GET",...h}=r,y=d?.Authorization,g="Bearer undefined"===y?void 0:y,m="GET"!==f&&"HEAD"!==f&&"PUT"!==f,b={...d,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",...m?{"Content-Type":"application/json"}:{},...g?{Authorization:g}:{}},w=Object.entries(e??{}).filter((([,t])=>void 0!==t)).flatMap((([t,e])=>Array.isArray(e)?e.filter((t=>void 0!==t)).map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),S=`${this.apiUrl}${t}${w.length?`?${w}`:""}`,{revalidate:v,...x}=o??{},{revalidate:T,...A}=a??{},q="GET"!==f||g?void 0:T??v,_="GET"!==f||g||q?void 0:p??n,k=h.body,I=c??u??(null==k?3e4:0),E=I>0?AbortSignal.timeout(I):void 0,P=h.signal??s.signal,R=E&&P?AbortSignal.any([P,E]):E??P,O={...s,...h,method:f,...Object.keys(b).length?{headers:b}:{},...R?{signal:R}:{},cache:_,next:{...x,...A,revalidate:q}};(l??i)&&console.debug("SDK fetch: ",S,O);const M=await fetch(S,O).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${S}: ${t.message}`),{cause:t});throw t})),B=await M.text();if(!M.ok){let t;try{t=JSON.parse(B)}catch{t={message:B}}const e=[S,M.status,M.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(B)}catch{return B}}}const m=t=>{const e=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(t)),r=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t),o=/^C[A-Z2-7]{55}$/.test(t);return e||r||o},b=t=>{const e=/^0x[a-fA-F0-9]{1,64}$/.test(t),r=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t),o=/^C[A-Z2-7]{55}-\d+$/.test(t);return e||r||o};class w extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class S extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const v=t=>!!t&&(t.startsWith("erd1")&&62===t.length||/^0x[a-fA-F0-9]{40,64}$/.test(t)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(t)||/^[GC][A-Z2-7]{55}$/.test(t)),x={"/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:{}}},T=["PATCH","POST","DELETE","PUT"];var A=l(34);const q=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()));function _(t,e,r,o){const{input:n,output:i,...u}=e,s=async(e={})=>{const n={...r,...e},i=t.replace(/:([a-zA-Z_]+)/g,((t,e)=>`${n[e]}`)),u=[...t.matchAll(/:([a-zA-Z_]+)/g)].map((t=>t[1])),s=Object.fromEntries(Object.entries(n).filter((([t])=>!u.includes(t)))),a=/:address[^A-Z]/.test(t)||"address"in s,p=/:collection[^A-Z]/.test(t)||"collection"in s;if(a){const t=n.address;if(!v(t))throw new S(t)}if(p){const t=n.collection;if(Array.isArray(t)?t.some((t=>!m(t))):!m(t))throw new w(t)}const l=Object.fromEntries(Object.entries(s).map((([t,e])=>[t,e instanceof FormData?e:"filter"===t||"body"===t?JSON.stringify(e):Array.isArray(e)?e.join(","):e]))),{body:c,auth:d,method:f,headers:h,cache:y,next:g,debug:b,signal:x,credentials:T,mode:A,redirect:q,referrer:_,referrerPolicy:k,integrity:I,keepalive:E,priority:P,window:R,continuationToken:O,...M}=l,B=d?`Bearer ${d}`:void 0;t.startsWith("/stellar-lending/")&&void 0!==O&&(M.continuationToken=O);const U={...h,...B?{Authorization:B}:{},...O&&!t.startsWith("/stellar-lending/")?{"X-Continuation-Token":String(O)}:{}},C={...g,tags:[...g?.tags??[],i]};return o.fetchWithTimeout(i,{method:f,params:M,body:c,headers:U,cache:y,debug:b,...Object.fromEntries(Object.entries({signal:x,credentials:T,mode:A,redirect:q,referrer:_,referrerPolicy:k,integrity:I,keepalive:E,priority:P,window:R}).filter((([,t])=>void 0!==t))),...C?{next:C}:{}})},a=(t={})=>s(t);for(const t of Object.keys(u))T.includes(t)&&(a[t]=e=>s({...e,method:e.method??t.toUpperCase()}));return a}function k(t){const e=function(){const t={static:{},params:{},leaves:[]};for(const[e,r]of Object.entries(x)){const o=e.split("/").filter(Boolean);let n=t;for(const t of o)if(t.startsWith(":")){const e=q(t.slice(1));n=n.params[e]||={static:{},params:{},leaves:[]}}else{const e=q(t);n=n.static[e]||={static:{},params:{},leaves:[]}}n.leaves.push({rawPath:e,def:r})}return t}(),r=(e,o)=>{const n=e.leaves.length,i=Object.keys(e.static).length,u=Object.keys(e.params).length;let s;if(1===n&&i+u>0){const{rawPath:r,def:n}=e.leaves[0];s=_(r,n,o,t)}else{s={};for(const{rawPath:r,def:n}of e.leaves)s[q(r.split("/").pop().replace(/^:/,""))]=_(r,n,o,t)}for(const[t,n]of Object.entries(e.static)){const e=r(n,o);let i=e;if(e&&"object"==typeof e&&t in e&&"function"==typeof e[t]){const r=e[t],o=Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)));1===r.length||(Object.assign(r,o),i=r)}void 0===s[t]?s[t]=i:"function"==typeof s[t]?Object.assign(s[t],i):"function"==typeof i?(Object.assign(i,s[t]),s[t]=i):Object.assign(s[t],i)}for(const[t,n]of Object.entries(e.params)){const e=e=>{const i=r(n,{...o,[t]:e});if(i&&"object"==typeof i&&1===Object.keys(i).length&&t in i&&"function"==typeof i[t]){const e=i[t],r=(...t)=>e(...t);return Object.assign(r,e)}return i};if(s[t]){const r=s[t];s[t]=t=>({...r(t),...e(t)})}else s[t]=e}return s};return r(e,{})}export{y as Chain,h as DEFAULT_REQUEST_TIMEOUT_MS,g as XOXNOClient,k as buildSdk,m as isValidCollectionTicker,b as isValidNftIdentifier};export const STELLAR_GOVERNANCE_ZERO_PREDECESSOR=A.G_M;export const STELLAR_LENDING_TOPICS=A.fAY;export const STELLAR_NETWORKS=A.a_O;export const STELLAR_NETWORK_PASSPHRASE=A.A$9;export const SYNTHETIC_EVENT_ORDER_STRIDE=A.gRW;export const buildSameTokenRepaySwapSteps=A.VZJ;export const buildStellarAcceptOwnershipTx=A.N0v;export const buildStellarAddRewardsTx=A.B_D;export const buildStellarApproveBlendPoolTx=A.qLM;export const buildStellarApproveTokenTx=A.eX8;export const buildStellarBatchSwapTx=A.zaA;export const buildStellarBorrowBatchTx=A.xDR;export const buildStellarBorrowTx=A.jR0;export const buildStellarCctpForwardTx=A.P2l;export const buildStellarClaimRevenueTx=A.W68;export const buildStellarCreateLiquidityPoolTx=A.sec;export const buildStellarExecuteCancellerResetTx=A.ZPB;export const buildStellarExecuteStrategyTx=A.yrp;export const buildStellarFlashLoanTx=A.spi;export const buildStellarGovernanceAddSpokeImmediateTx=A.Iu1;export const buildStellarGovernanceCreateHubImmediateTx=A.yuB;export const buildStellarGovernanceExecuteGovernanceUpgradeTx=A.$96;export const buildStellarGovernanceExecuteGrantGovernanceRoleTx=A.zwJ;export const buildStellarGovernanceExecuteRevokeGovernanceRoleTx=A.h_A;export const buildStellarGovernanceExecuteTransferGovOwnTx=A.e_X;export const buildStellarGovernanceExecuteTx=A.TkG;export const buildStellarGovernanceExecuteUpdateDelayTx=A.BAg;export const buildStellarGovernancePauseTx=A.u9S;export const buildStellarGovernanceRevokeRoleImmediateTx=A.biU;export const buildStellarGovernanceSetOracleSanityBoundsImmediateTx=A.gc5;export const buildStellarGovernanceSetSpokeAssetFlagsImmediateTx=A.ayx;export const buildStellarGrantRoleTx=A.SXg;export const buildStellarLendingIdentifier=A.UFY;export const buildStellarLiquidateTx=A.Y5o;export const buildStellarMigrateFromBlendTx=A.mEH;export const buildStellarMigrateTx=A.xGW;export const buildStellarMultiplyTx=A.s9Q;export const buildStellarPauseTx=A.OL0;export const buildStellarProposeAddAssetToSpokeTx=A.k6p;export const buildStellarProposeAddSpokeTx=A.djE;export const buildStellarProposeApproveBlendPoolTx=A.kDJ;export const buildStellarProposeApproveTokenTx=A.Yfw;export const buildStellarProposeCancellerResetTx=A.AI1;export const buildStellarProposeConfigureAssetOracleTx=A.O2U;export const buildStellarProposeConfigureMarketOracleTx=A.c5J;export const buildStellarProposeCreateHubTx=A.N8y;export const buildStellarProposeCreateLiquidityPoolTx=A.qUh;export const buildStellarProposeDeployPoolTx=A.RZj;export const buildStellarProposeEditAssetInSpokeTx=A.nio;export const buildStellarProposeEditOracleToleranceTx=A.hFg;export const buildStellarProposeGovernanceUpgradeTx=A.Qkp;export const buildStellarProposeGrantGovernanceRoleTx=A.GwL;export const buildStellarProposeMigrateControllerTx=A.$Kr;export const buildStellarProposeRemoveAssetFromSpokeTx=A.ujH;export const buildStellarProposeRemoveSpokeTx=A.Odj;export const buildStellarProposeRevokeBlendPoolTx=A.X7c;export const buildStellarProposeRevokeGovernanceRoleTx=A.Ubz;export const buildStellarProposeRevokeTokenTx=A.Dx4;export const buildStellarProposeSetAccumulatorTx=A.OAr;export const buildStellarProposeSetAggregatorTx=A.$Uh;export const buildStellarProposeSetMinBorrowCollatTx=A.obN;export const buildStellarProposeSetPositionLimitsTx=A.$lZ;export const buildStellarProposeSetPositionManagerTx=A.Kaw;export const buildStellarProposeSetPriceAggregatorTx=A.Wbk;export const buildStellarProposeSetSpokeLiquidationCurveTx=A.kwV;export const buildStellarProposeSetSwapAggregatorTx=A.qAI;export const buildStellarProposeTransferCtrlOwnershipTx=A.VSx;export const buildStellarProposeTransferGovOwnTx=A.HPG;export const buildStellarProposeUnpauseTx=A.xQk;export const buildStellarProposeUpdateDelayTx=A.YQw;export const buildStellarProposeUpgradeControllerTx=A.QY;export const buildStellarProposeUpgradePoolParamsTx=A.osR;export const buildStellarProposeUpgradePoolTx=A.Kob;export const buildStellarRenewAccountTx=A.IJt;export const buildStellarRepayBatchTx=A.nw5;export const buildStellarRepayDebtWithCollateralTx=A.PrA;export const buildStellarRepayTx=A.ZEf;export const buildStellarRevokeBlendPoolTx=A.X0W;export const buildStellarRevokeRoleTx=A.evz;export const buildStellarRevokeTokenTx=A.P8C;export const buildStellarSetAccumulatorTx=A.aVn;export const buildStellarSetAggregatorTx=A.p2b;export const buildStellarSetMarketOracleConfigTx=A.sVY;export const buildStellarSetOracleSanityBoundsTx=A.XDq;export const buildStellarSetOracleToleranceTx=A.Jsu;export const buildStellarSetOracleTx=A.W5;export const buildStellarSetPositionLimitsTx=A.Dyw;export const buildStellarSetPriceAggregatorTx=A._i2;export const buildStellarSetSpokeAssetFlagsTx=A.FZg;export const buildStellarSetSwapAggregatorTx=A.wGh;export const buildStellarSupplyBatchTx=A.Nix;export const buildStellarSupplyTx=A.v_o;export const buildStellarSwapCollateralTx=A.qDU;export const buildStellarSwapDebtTx=A.qRb;export const buildStellarTransferOwnershipTx=A.QJY;export const buildStellarUnpauseTx=A.bmW;export const buildStellarUpdateAccountThresholdTx=A.n_N;export const buildStellarUpdateIndexesTx=A.v87;export const buildStellarUpgradeControllerTx=A.qMI;export const buildStellarUpgradeLiquidityPoolParamsTx=A.gHX;export const buildStellarWithdrawBatchTx=A.O3p;export const buildStellarWithdrawTx=A.Gzh;export const buildTx=A.prJ;export const decodeStellarLendingEvent=A.Fmy;export const decodeStellarLiquidateReturn=A.OBV;export const encodeAssetOracle=A.Ft;export const encodeInterestRateModel=A.MB4;export const encodeMarketOracleConfigInput=A.Dnk;export const encodeMarketParamsRaw=A.pqp;export const encodePositionLimits=A.Q3w;export const encodePriceKey=A.Jh3;export const encodeStrategyPayloadToRouteXdr=A.wfs;export const extractEventOrder=A.UmN;export const getStellarAccountPositions=A.xO7;export const getStellarActiveUsersSeries=A.R11;export const getStellarAggregatorQuote=A.LwT;export const getStellarAsset=A.mMz;export const getStellarAssetGraph=A.iES;export const getStellarAssetMarkets=A.zpK;export const getStellarAssetPage=A.N3x;export const getStellarAssets=A.bNp;export const getStellarCampaignLeaderboard=A.T3v;export const getStellarCampaignMe=A.KQV;export const getStellarDefiLlamaDimensions=A.S9l;export const getStellarDeployment=A.rER;export const getStellarDetailedMarkets=A.XNg;export const getStellarFeeRevenueSeries=A.VeU;export const getStellarGovernanceProposals=A.T_r;export const getStellarHolderDistribution=A.m4Y;export const getStellarHub=A.XIn;export const getStellarHubGraph=A.Lt0;export const getStellarHubHolders=A.wsx;export const getStellarHubs=A.KKL;export const getStellarLendingContext=A.yl$;export const getStellarLendingLiveState=A.kqD;export const getStellarLiquidationsLeaderboard=A.dEm;export const getStellarLiquidationsSeries=A.bu4;export const getStellarParticipantCounts=A.ftY;export const getStellarPnlByScope=A.Ht0;export const getStellarPositionsLeaderboard=A.$uf;export const getStellarPositionsPnl=A.wqt;export const getStellarQuoteTokens=A.CHU;export const getStellarRateSpreadSeries=A.Wc$;export const getStellarReserve=A.Y5D;export const getStellarReserveGraph=A.KGs;export const getStellarReserveHolders=A.nWw;export const getStellarReserves=A.jFb;export const getStellarRevenueSeries=A.Pvd;export const getStellarSpoke=A.S2b;export const getStellarSpokeGraph=A.uSb;export const getStellarSpokeHolders=A.N9t;export const getStellarSpokes=A.bNM;export const getStellarStatsHistory=A.PvK;export const getStellarUserActivity=A.O5u;export const getStellarUserActivityPage=A.NYX;export const getStellarUserHistory=A.FCB;export const getStellarUserPositions=A.h_O;export const getStellarVolumeSeries=A.zu2;export const getStellarWalletBalance=A.Xix;export const mapQuoteResponseToAggregatorSwap=A.LAw;export const mapQuoteResponseToStrategyPayload=A.E6J;export const mapQuoteResponseToStrategySwap=A.Dsj;export const mapSorobanError=A.XVZ;export const mapStellarPositionActivityType=A.CUR;export const prepareStellarBuiltTx=A.VxL;export const prepareStellarTxXdr=A.DLQ;export const stellarLendingDispatchKey=A.ONb;export const stellarLendingRead=A.HhT;export const stellarNetworks=A.PF2;export const syntheticEventOrder=A.oVm;export const tagStellarInvokedContractError=A.g57;export const toBase64Xdr=A.LaM;export const toStellarPositionMode=A.Vuj;