@multiversx/sdk-dapp-swap
Version:
A library to hold the main logic for swapping between tokens on the MultiversX blockchain
10 lines (9 loc) • 27.9 kB
JavaScript
"use strict";var br=Object.create;var P=Object.defineProperty;var Dr=Object.getOwnPropertyDescriptor;var _r=Object.getOwnPropertyNames;var Nr=Object.getPrototypeOf,zr=Object.prototype.hasOwnProperty;var Pr=(e,r)=>()=>(e&&(r=e(e=0)),r);var H=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Hr=(e,r)=>{for(var t in r)P(e,t,{get:r[t],enumerable:!0})},hr=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of _r(r))!zr.call(e,n)&&n!==t&&P(e,n,{get:()=>r[n],enumerable:!(i=Dr(r,n))||i.enumerable});return e};var V=(e,r,t)=>(t=e!=null?br(Nr(e)):{},hr(r||!e||!e.__esModule?P(t,"default",{value:e,enumerable:!0}):t,e)),Wr=e=>hr(P({},"__esModule",{value:!0}),e);var K=(e,r,t)=>new Promise((i,n)=>{var o=h=>{try{f(t.next(h))}catch(l){n(l)}},u=h=>{try{f(t.throw(h))}catch(l){n(l)}},f=h=>h.done?i(h.value):Promise.resolve(h.value).then(o,u);f((t=t.apply(e,r)).next())});var pr=H(W=>{"use strict";w();W.byteLength=Gr;W.toByteArray=$r;W.fromByteArray=Or;var A=[],g=[],Qr=typeof Uint8Array!="undefined"?Uint8Array:Array,Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(R=0,fr=Z.length;R<fr;++R)A[R]=Z[R],g[Z.charCodeAt(R)]=R;var R,fr;g["-".charCodeAt(0)]=62;g["_".charCodeAt(0)]=63;function cr(e){var r=e.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=r);var i=t===r?0:4-t%4;return[t,i]}function Gr(e){var r=cr(e),t=r[0],i=r[1];return(t+i)*3/4-i}function Yr(e,r,t){return(r+t)*3/4-t}function $r(e){var r,t=cr(e),i=t[0],n=t[1],o=new Qr(Yr(e,i,n)),u=0,f=n>0?i-4:i,h;for(h=0;h<f;h+=4)r=g[e.charCodeAt(h)]<<18|g[e.charCodeAt(h+1)]<<12|g[e.charCodeAt(h+2)]<<6|g[e.charCodeAt(h+3)],o[u++]=r>>16&255,o[u++]=r>>8&255,o[u++]=r&255;return n===2&&(r=g[e.charCodeAt(h)]<<2|g[e.charCodeAt(h+1)]>>4,o[u++]=r&255),n===1&&(r=g[e.charCodeAt(h)]<<10|g[e.charCodeAt(h+1)]<<4|g[e.charCodeAt(h+2)]>>2,o[u++]=r>>8&255,o[u++]=r&255),o}function Xr(e){return A[e>>18&63]+A[e>>12&63]+A[e>>6&63]+A[e&63]}function Jr(e,r,t){for(var i,n=[],o=r;o<t;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),n.push(Xr(i));return n.join("")}function Or(e){for(var r,t=e.length,i=t%3,n=[],o=16383,u=0,f=t-i;u<f;u+=o)n.push(Jr(e,u,u+o>f?f:u+o));return i===1?(r=e[t-1],n.push(A[r>>2]+A[r<<4&63]+"==")):i===2&&(r=(e[t-2]<<8)+e[t-1],n.push(A[r>>10]+A[r>>4&63]+A[r<<2&63]+"=")),n.join("")}});var lr=H(j=>{w();j.read=function(e,r,t,i,n){var o,u,f=n*8-i-1,h=(1<<f)-1,l=h>>1,p=-7,c=t?n-1:0,E=t?-1:1,x=e[r+c];for(c+=E,o=x&(1<<-p)-1,x>>=-p,p+=f;p>0;o=o*256+e[r+c],c+=E,p-=8);for(u=o&(1<<-p)-1,o>>=-p,p+=i;p>0;u=u*256+e[r+c],c+=E,p-=8);if(o===0)o=1-l;else{if(o===h)return u?NaN:(x?-1:1)*(1/0);u=u+Math.pow(2,i),o=o-l}return(x?-1:1)*u*Math.pow(2,o-i)};j.write=function(e,r,t,i,n,o){var u,f,h,l=o*8-n-1,p=(1<<l)-1,c=p>>1,E=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=i?0:o-1,T=i?1:-1,F=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,u=p):(u=Math.floor(Math.log(r)/Math.LN2),r*(h=Math.pow(2,-u))<1&&(u--,h*=2),u+c>=1?r+=E/h:r+=E*Math.pow(2,1-c),r*h>=2&&(u++,h/=2),u+c>=p?(f=0,u=p):u+c>=1?(f=(r*h-1)*Math.pow(2,n),u=u+c):(f=r*Math.pow(2,c-1)*Math.pow(2,n),u=0));n>=8;e[t+x]=f&255,x+=T,f/=256,n-=8);for(u=u<<n|f,l+=n;l>0;e[t+x]=u&255,x+=T,u/=256,l-=8);e[t+x-T]|=F*128}});var Tr=H(_=>{"use strict";w();var q=pr(),D=lr(),sr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;_.Buffer=a;_.SlowBuffer=rt;_.INSPECT_MAX_BYTES=50;var Q=2147483647;_.kMaxLength=Q;a.TYPED_ARRAY_SUPPORT=Vr();!a.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&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.");function Vr(){try{var e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch(t){return!1}}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}});function C(e){if(e>Q)throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=new Uint8Array(e);return Object.setPrototypeOf(r,a.prototype),r}function a(e,r,t){if(typeof e=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return ir(e)}return xr(e,r,t)}a.poolSize=8192;function xr(e,r,t){if(typeof e=="string")return Zr(e,r);if(ArrayBuffer.isView(e))return jr(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(v(e,ArrayBuffer)||e&&v(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(v(e,SharedArrayBuffer)||e&&v(e.buffer,SharedArrayBuffer)))return tr(e,r,t);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return a.from(i,r,t);var n=qr(e);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return a.from(e[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}a.from=function(e,r,t){return xr(e,r,t)};Object.setPrototypeOf(a.prototype,Uint8Array.prototype);Object.setPrototypeOf(a,Uint8Array);function mr(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function Kr(e,r,t){return mr(e),e<=0?C(e):r!==void 0?typeof t=="string"?C(e).fill(r,t):C(e).fill(r):C(e)}a.alloc=function(e,r,t){return Kr(e,r,t)};function ir(e){return mr(e),C(e<0?0:nr(e)|0)}a.allocUnsafe=function(e){return ir(e)};a.allocUnsafeSlow=function(e){return ir(e)};function Zr(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var t=Er(e,r)|0,i=C(t),n=i.write(e,r);return n!==t&&(i=i.slice(0,n)),i}function rr(e){for(var r=e.length<0?0:nr(e.length)|0,t=C(r),i=0;i<r;i+=1)t[i]=e[i]&255;return t}function jr(e){if(v(e,Uint8Array)){var r=new Uint8Array(e);return tr(r.buffer,r.byteOffset,r.byteLength)}return rr(e)}function tr(e,r,t){if(r<0||e.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<r+(t||0))throw new RangeError('"length" is outside of buffer bounds');var i;return r===void 0&&t===void 0?i=new Uint8Array(e):t===void 0?i=new Uint8Array(e,r):i=new Uint8Array(e,r,t),Object.setPrototypeOf(i,a.prototype),i}function qr(e){if(a.isBuffer(e)){var r=nr(e.length)|0,t=C(r);return t.length===0||e.copy(t,0,0,r),t}if(e.length!==void 0)return typeof e.length!="number"||or(e.length)?C(0):rr(e);if(e.type==="Buffer"&&Array.isArray(e.data))return rr(e.data)}function nr(e){if(e>=Q)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return e|0}function rt(e){return+e!=e&&(e=0),a.alloc(+e)}a.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==a.prototype};a.compare=function(r,t){if(v(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),v(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(r)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;for(var i=r.length,n=t.length,o=0,u=Math.min(i,n);o<u;++o)if(r[o]!==t[o]){i=r[o],n=t[o];break}return i<n?-1:n<i?1:0};a.isEncoding=function(r){switch(String(r).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(r,t){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return a.alloc(0);var i;if(t===void 0)for(t=0,i=0;i<r.length;++i)t+=r[i].length;var n=a.allocUnsafe(t),o=0;for(i=0;i<r.length;++i){var u=r[i];if(v(u,Uint8Array))o+u.length>n.length?a.from(u).copy(n,o):Uint8Array.prototype.set.call(n,u,o);else if(a.isBuffer(u))u.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=u.length}return n};function Er(e,r){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||v(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var t=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return er(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return dr(e).length;default:if(n)return i?-1:er(e).length;r=(""+r).toLowerCase(),n=!0}}a.byteLength=Er;function tt(e,r,t){var i=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(e||(e="utf8");;)switch(e){case"hex":return pt(this,r,t);case"utf8":case"utf-8":return Fr(this,r,t);case"ascii":return ft(this,r,t);case"latin1":case"binary":return ct(this,r,t);case"base64":return at(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lt(this,r,t);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}a.prototype._isBuffer=!0;function M(e,r,t){var i=e[r];e[r]=e[t],e[t]=i}a.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<r;t+=2)M(this,t,t+1);return this};a.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<r;t+=4)M(this,t,t+3),M(this,t+1,t+2);return this};a.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<r;t+=8)M(this,t,t+7),M(this,t+1,t+6),M(this,t+2,t+5),M(this,t+3,t+4);return this};a.prototype.toString=function(){var r=this.length;return r===0?"":arguments.length===0?Fr(this,0,r):tt.apply(this,arguments)};a.prototype.toLocaleString=a.prototype.toString;a.prototype.equals=function(r){if(!a.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:a.compare(this,r)===0};a.prototype.inspect=function(){var r="",t=_.INSPECT_MAX_BYTES;return r=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(r+=" ... "),"<Buffer "+r+">"};sr&&(a.prototype[sr]=a.prototype.inspect);a.prototype.compare=function(r,t,i,n,o){if(v(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),!a.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(t===void 0&&(t=0),i===void 0&&(i=r?r.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),t<0||i>r.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,o>>>=0,this===r)return 0;for(var u=o-n,f=i-t,h=Math.min(u,f),l=this.slice(n,o),p=r.slice(t,i),c=0;c<h;++c)if(l[c]!==p[c]){u=l[c],f=p[c];break}return u<f?-1:f<u?1:0};function gr(e,r,t,i,n){if(e.length===0)return-1;if(typeof t=="string"?(i=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,or(t)&&(t=n?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(n)return-1;t=e.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof r=="string"&&(r=a.from(r,i)),a.isBuffer(r))return r.length===0?-1:wr(e,r,t,i,n);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):wr(e,[r],t,i,n);throw new TypeError("val must be string, number or Buffer")}function wr(e,r,t,i,n){var o=1,u=e.length,f=r.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||r.length<2)return-1;o=2,u/=2,f/=2,t/=2}function h(x,T){return o===1?x[T]:x.readUInt16BE(T*o)}var l;if(n){var p=-1;for(l=t;l<u;l++)if(h(e,l)===h(r,p===-1?0:l-p)){if(p===-1&&(p=l),l-p+1===f)return p*o}else p!==-1&&(l-=l-p),p=-1}else for(t+f>u&&(t=u-f),l=t;l>=0;l--){for(var c=!0,E=0;E<f;E++)if(h(e,l+E)!==h(r,E)){c=!1;break}if(c)return l}return-1}a.prototype.includes=function(r,t,i){return this.indexOf(r,t,i)!==-1};a.prototype.indexOf=function(r,t,i){return gr(this,r,t,i,!0)};a.prototype.lastIndexOf=function(r,t,i){return gr(this,r,t,i,!1)};function et(e,r,t,i){t=Number(t)||0;var n=e.length-t;i?(i=Number(i),i>n&&(i=n)):i=n;var o=r.length;i>o/2&&(i=o/2);for(var u=0;u<i;++u){var f=parseInt(r.substr(u*2,2),16);if(or(f))return u;e[t+u]=f}return u}function it(e,r,t,i){return G(er(r,e.length-t),e,t,i)}function nt(e,r,t,i){return G(yt(r),e,t,i)}function ot(e,r,t,i){return G(dr(r),e,t,i)}function ut(e,r,t,i){return G(xt(r,e.length-t),e,t,i)}a.prototype.write=function(r,t,i,n){if(t===void 0)n="utf8",i=this.length,t=0;else if(i===void 0&&typeof t=="string")n=t,i=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-t;if((i===void 0||i>o)&&(i=o),r.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var u=!1;;)switch(n){case"hex":return et(this,r,t,i);case"utf8":case"utf-8":return it(this,r,t,i);case"ascii":case"latin1":case"binary":return nt(this,r,t,i);case"base64":return ot(this,r,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ut(this,r,t,i);default:if(u)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),u=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function at(e,r,t){return r===0&&t===e.length?q.fromByteArray(e):q.fromByteArray(e.slice(r,t))}function Fr(e,r,t){t=Math.min(e.length,t);for(var i=[],n=r;n<t;){var o=e[n],u=null,f=o>239?4:o>223?3:o>191?2:1;if(n+f<=t){var h,l,p,c;switch(f){case 1:o<128&&(u=o);break;case 2:h=e[n+1],(h&192)===128&&(c=(o&31)<<6|h&63,c>127&&(u=c));break;case 3:h=e[n+1],l=e[n+2],(h&192)===128&&(l&192)===128&&(c=(o&15)<<12|(h&63)<<6|l&63,c>2047&&(c<55296||c>57343)&&(u=c));break;case 4:h=e[n+1],l=e[n+2],p=e[n+3],(h&192)===128&&(l&192)===128&&(p&192)===128&&(c=(o&15)<<18|(h&63)<<12|(l&63)<<6|p&63,c>65535&&c<1114112&&(u=c))}}u===null?(u=65533,f=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|u&1023),i.push(u),n+=f}return ht(i)}var yr=4096;function ht(e){var r=e.length;if(r<=yr)return String.fromCharCode.apply(String,e);for(var t="",i=0;i<r;)t+=String.fromCharCode.apply(String,e.slice(i,i+=yr));return t}function ft(e,r,t){var i="";t=Math.min(e.length,t);for(var n=r;n<t;++n)i+=String.fromCharCode(e[n]&127);return i}function ct(e,r,t){var i="";t=Math.min(e.length,t);for(var n=r;n<t;++n)i+=String.fromCharCode(e[n]);return i}function pt(e,r,t){var i=e.length;(!r||r<0)&&(r=0),(!t||t<0||t>i)&&(t=i);for(var n="",o=r;o<t;++o)n+=mt[e[o]];return n}function lt(e,r,t){for(var i=e.slice(r,t),n="",o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}a.prototype.slice=function(r,t){var i=this.length;r=~~r,t=t===void 0?i:~~t,r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),t<r&&(t=r);var n=this.subarray(r,t);return Object.setPrototypeOf(n,a.prototype),n};function y(e,r,t){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+r>t)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(r,t,i){r=r>>>0,t=t>>>0,i||y(r,t,this.length);for(var n=this[r],o=1,u=0;++u<t&&(o*=256);)n+=this[r+u]*o;return n};a.prototype.readUintBE=a.prototype.readUIntBE=function(r,t,i){r=r>>>0,t=t>>>0,i||y(r,t,this.length);for(var n=this[r+--t],o=1;t>0&&(o*=256);)n+=this[r+--t]*o;return n};a.prototype.readUint8=a.prototype.readUInt8=function(r,t){return r=r>>>0,t||y(r,1,this.length),this[r]};a.prototype.readUint16LE=a.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||y(r,2,this.length),this[r]|this[r+1]<<8};a.prototype.readUint16BE=a.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||y(r,2,this.length),this[r]<<8|this[r+1]};a.prototype.readUint32LE=a.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||y(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};a.prototype.readUint32BE=a.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||y(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};a.prototype.readIntLE=function(r,t,i){r=r>>>0,t=t>>>0,i||y(r,t,this.length);for(var n=this[r],o=1,u=0;++u<t&&(o*=256);)n+=this[r+u]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n};a.prototype.readIntBE=function(r,t,i){r=r>>>0,t=t>>>0,i||y(r,t,this.length);for(var n=t,o=1,u=this[r+--n];n>0&&(o*=256);)u+=this[r+--n]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*t)),u};a.prototype.readInt8=function(r,t){return r=r>>>0,t||y(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};a.prototype.readInt16LE=function(r,t){r=r>>>0,t||y(r,2,this.length);var i=this[r]|this[r+1]<<8;return i&32768?i|4294901760:i};a.prototype.readInt16BE=function(r,t){r=r>>>0,t||y(r,2,this.length);var i=this[r+1]|this[r]<<8;return i&32768?i|4294901760:i};a.prototype.readInt32LE=function(r,t){return r=r>>>0,t||y(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};a.prototype.readInt32BE=function(r,t){return r=r>>>0,t||y(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};a.prototype.readFloatLE=function(r,t){return r=r>>>0,t||y(r,4,this.length),D.read(this,r,!0,23,4)};a.prototype.readFloatBE=function(r,t){return r=r>>>0,t||y(r,4,this.length),D.read(this,r,!1,23,4)};a.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||y(r,8,this.length),D.read(this,r,!0,52,8)};a.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||y(r,8,this.length),D.read(this,r,!1,52,8)};function m(e,r,t,i,n,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>n||r<o)throw new RangeError('"value" argument is out of bounds');if(t+i>e.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(r,t,i,n){if(r=+r,t=t>>>0,i=i>>>0,!n){var o=Math.pow(2,8*i)-1;m(this,r,t,i,o,0)}var u=1,f=0;for(this[t]=r&255;++f<i&&(u*=256);)this[t+f]=r/u&255;return t+i};a.prototype.writeUintBE=a.prototype.writeUIntBE=function(r,t,i,n){if(r=+r,t=t>>>0,i=i>>>0,!n){var o=Math.pow(2,8*i)-1;m(this,r,t,i,o,0)}var u=i-1,f=1;for(this[t+u]=r&255;--u>=0&&(f*=256);)this[t+u]=r/f&255;return t+i};a.prototype.writeUint8=a.prototype.writeUInt8=function(r,t,i){return r=+r,t=t>>>0,i||m(this,r,t,1,255,0),this[t]=r&255,t+1};a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(r,t,i){return r=+r,t=t>>>0,i||m(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2};a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(r,t,i){return r=+r,t=t>>>0,i||m(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2};a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(r,t,i){return r=+r,t=t>>>0,i||m(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4};a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(r,t,i){return r=+r,t=t>>>0,i||m(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};a.prototype.writeIntLE=function(r,t,i,n){if(r=+r,t=t>>>0,!n){var o=Math.pow(2,8*i-1);m(this,r,t,i,o-1,-o)}var u=0,f=1,h=0;for(this[t]=r&255;++u<i&&(f*=256);)r<0&&h===0&&this[t+u-1]!==0&&(h=1),this[t+u]=(r/f>>0)-h&255;return t+i};a.prototype.writeIntBE=function(r,t,i,n){if(r=+r,t=t>>>0,!n){var o=Math.pow(2,8*i-1);m(this,r,t,i,o-1,-o)}var u=i-1,f=1,h=0;for(this[t+u]=r&255;--u>=0&&(f*=256);)r<0&&h===0&&this[t+u+1]!==0&&(h=1),this[t+u]=(r/f>>0)-h&255;return t+i};a.prototype.writeInt8=function(r,t,i){return r=+r,t=t>>>0,i||m(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1};a.prototype.writeInt16LE=function(r,t,i){return r=+r,t=t>>>0,i||m(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2};a.prototype.writeInt16BE=function(r,t,i){return r=+r,t=t>>>0,i||m(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2};a.prototype.writeInt32LE=function(r,t,i){return r=+r,t=t>>>0,i||m(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4};a.prototype.writeInt32BE=function(r,t,i){return r=+r,t=t>>>0,i||m(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function Ar(e,r,t,i,n,o){if(t+i>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function vr(e,r,t,i,n){return r=+r,t=t>>>0,n||Ar(e,r,t,4,34028234663852886e22,-34028234663852886e22),D.write(e,r,t,i,23,4),t+4}a.prototype.writeFloatLE=function(r,t,i){return vr(this,r,t,!0,i)};a.prototype.writeFloatBE=function(r,t,i){return vr(this,r,t,!1,i)};function Br(e,r,t,i,n){return r=+r,t=t>>>0,n||Ar(e,r,t,8,17976931348623157e292,-17976931348623157e292),D.write(e,r,t,i,52,8),t+8}a.prototype.writeDoubleLE=function(r,t,i){return Br(this,r,t,!0,i)};a.prototype.writeDoubleBE=function(r,t,i){return Br(this,r,t,!1,i)};a.prototype.copy=function(r,t,i,n){if(!a.isBuffer(r))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=r.length&&(t=r.length),t||(t=0),n>0&&n<i&&(n=i),n===i||r.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),r.length-t<n-i&&(n=r.length-t+i);var o=n-i;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,i,n):Uint8Array.prototype.set.call(r,this.subarray(i,n),t),o};a.prototype.fill=function(r,t,i,n){if(typeof r=="string"){if(typeof t=="string"?(n=t,t=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(r.length===1){var o=r.charCodeAt(0);(n==="utf8"&&o<128||n==="latin1")&&(r=o)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;t=t>>>0,i=i===void 0?this.length:i>>>0,r||(r=0);var u;if(typeof r=="number")for(u=t;u<i;++u)this[u]=r;else{var f=a.isBuffer(r)?r:a.from(r,n),h=f.length;if(h===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(u=0;u<i-t;++u)this[u+t]=f[u%h]}return this};var st=/[^+/0-9A-Za-z-_]/g;function wt(e){if(e=e.split("=")[0],e=e.trim().replace(st,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function er(e,r){r=r||1/0;for(var t,i=e.length,n=null,o=[],u=0;u<i;++u){if(t=e.charCodeAt(u),t>55295&&t<57344){if(!n){if(t>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(u+1===i){(r-=3)>-1&&o.push(239,191,189);continue}n=t;continue}if(t<56320){(r-=3)>-1&&o.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(r-=3)>-1&&o.push(239,191,189);if(n=null,t<128){if((r-=1)<0)break;o.push(t)}else if(t<2048){if((r-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function yt(e){for(var r=[],t=0;t<e.length;++t)r.push(e.charCodeAt(t)&255);return r}function xt(e,r){for(var t,i,n,o=[],u=0;u<e.length&&!((r-=2)<0);++u)t=e.charCodeAt(u),i=t>>8,n=t%256,o.push(n),o.push(i);return o}function dr(e){return q.toByteArray(wt(e))}function G(e,r,t,i){for(var n=0;n<i&&!(n+t>=r.length||n>=e.length);++n)r[n+t]=e[n];return n}function v(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function or(e){return e!==e}var mt=function(){for(var e="0123456789abcdef",r=new Array(256),t=0;t<16;++t)for(var i=t*16,n=0;n<16;++n)r[i+n]=e[t]+e[n];return r}()});var Sr=H((kt,Lr)=>{w();var s=Lr.exports={},B,d;function ur(){throw new Error("setTimeout has not been defined")}function ar(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?B=setTimeout:B=ur}catch(e){B=ur}try{typeof clearTimeout=="function"?d=clearTimeout:d=ar}catch(e){d=ar}})();function Ur(e){if(B===setTimeout)return setTimeout(e,0);if((B===ur||!B)&&setTimeout)return B=setTimeout,setTimeout(e,0);try{return B(e,0)}catch(r){try{return B.call(null,e,0)}catch(t){return B.call(this,e,0)}}}function Et(e){if(d===clearTimeout)return clearTimeout(e);if((d===ar||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(r){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}var L=[],N=!1,b,Y=-1;function gt(){!N||!b||(N=!1,b.length?L=b.concat(L):Y=-1,L.length&&Ir())}function Ir(){if(!N){var e=Ur(gt);N=!0;for(var r=L.length;r;){for(b=L,L=[];++Y<r;)b&&b[Y].run();Y=-1,r=L.length}b=null,N=!1,Et(e)}}s.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)r[t-1]=arguments[t];L.push(new Cr(e,r)),L.length===1&&!N&&Ur(Ir)};function Cr(e,r){this.fun=e,this.array=r}Cr.prototype.run=function(){this.fun.apply(null,this.array)};s.title="browser";s.browser=!0;s.env={};s.argv=[];s.version="";s.versions={};function S(){}s.on=S;s.addListener=S;s.once=S;s.off=S;s.removeListener=S;s.removeAllListeners=S;s.emit=S;s.prependListener=S;s.prependOnceListener=S;s.listeners=function(e){return[]};s.binding=function(e){throw new Error("process.binding is not supported")};s.cwd=function(){return"/"};s.chdir=function(e){throw new Error("process.chdir is not supported")};s.umask=function(){return 0}});var U,I,Rt,w=Pr(()=>{U=V(Tr()),I=V(Sr()),Rt=function(e){function r(){var i=this||self;return delete e.prototype.__magic__,i}if(typeof globalThis=="object")return globalThis;if(this)return r();e.defineProperty(e.prototype,"__magic__",{configurable:!0,get:r});var t=__magic__;return t}(Object)});var Ut={};Hr(Ut,{useLazyQueryWrapper:()=>Tt});module.exports=Wr(Ut);w();var X=require("react");w();w();var Mr=V(require("react")),z=require("@apollo/client"),Ft=require("@apollo/client/link/context"),At=require("@apollo/client/link/error"),vt=require("@apollo/client/link/ws"),Bt=require("@apollo/client/utilities"),dt=require("graphql");w();w();var $=require("react"),kr=(0,$.createContext)({accessToken:"",isAuthenticated:!1}),Rr=()=>{let e=(0,$.useContext)(kr);if(e==null)throw new Error("useAuthorizationContext must be used within a AuthorizationProvider");return e};var Tt=({query:e,queryOptions:r})=>{let{client:t}=Rr(),[i,n]=(0,X.useState)(),[o,u]=(0,X.useState)(),[f,h]=(0,X.useState)();return{isLoading:i,isError:o,error:f,execute:p=>K(void 0,null,function*(){var x,T;let c=(x=p==null?void 0:p.onCompleted)!=null?x:r==null?void 0:r.onCompleted,E=(T=p==null?void 0:p.variables)!=null?T:r==null?void 0:r.variables;try{n(!0);let F=yield t==null?void 0:t.query({query:e,variables:E}),J=F==null?void 0:F.data,O=F==null?void 0:F.errors;return O&&O.length>0&&(u(!0),h(O[0].message)),J&&(u(!1),h(void 0),c==null||c(J)),n(!1),J}catch(F){n(!1),u(!0),console.error(F);return}})}};0&&(module.exports={useLazyQueryWrapper});
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
//# sourceMappingURL=useLazyQueryWrapper.js.map