@omnity/ree-client-ts-sdk 0.4.8 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -95,6 +95,14 @@ declare class Maestro {
95
95
  };
96
96
  data: RawBtcUtxo[];
97
97
  }>;
98
+ utxosByAddressMempoolAware(address: string, cursor?: string | null, excludeMetaprotocols?: boolean): Promise<{
99
+ next_cursor: string | null;
100
+ last_updated: {
101
+ block_hash: string;
102
+ block_height: bigint;
103
+ };
104
+ data: RawBtcUtxo[];
105
+ }>;
98
106
  inscriptionIdsByCollectionSymbol(collection: string, cursor?: string | null): Promise<{
99
107
  next_cursor: string | null;
100
108
  last_updated: {
@@ -27,7 +27,7 @@ variant ${n} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.displ
27
27
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[Yd]=this[Yd]={accessors:{}}).accessors,i=this.prototype;function s(o){const c=ro(o);r[c]||(UT(i,o),r[c]=!0)}return z.isArray(t)?t.forEach(s):s(t),this}};yn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);z.reduceDescriptors(yn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});z.freezeMethods(yn);function Yu(e,t){const n=this||yc,r=t||n,i=yn.from(r.headers);let s=r.data;return z.forEach(e,function(c){s=c.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function Ym(e){return!!(e&&e.__CANCEL__)}function Gs(e,t,n){Pe.call(this,e??"canceled",Pe.ERR_CANCELED,t,n),this.name="CanceledError"}z.inherits(Gs,Pe,{__CANCEL__:!0});function Zm(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Pe("Request failed with status code "+n.status,[Pe.ERR_BAD_REQUEST,Pe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function CT(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function HT(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,s=0,o;return t=t!==void 0?t:1e3,function(a){const u=Date.now(),f=r[s];o||(o=u),n[i]=a,r[i]=u;let l=s,d=0;for(;l!==i;)d+=n[l++],l=l%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o<t)return;const y=f&&u-f;return y?Math.round(d*1e3/y):void 0}}function FT(e,t){let n=0,r=1e3/t,i,s;const o=(u,f=Date.now())=>{n=f,i=null,s&&(clearTimeout(s),s=null),e(...u)};return[(...u)=>{const f=Date.now(),l=f-n;l>=r?o(u,f):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},r-l)))},()=>i&&o(i)]}const Sa=(e,t,n=3)=>{let r=0;const i=HT(50,250);return FT(s=>{const o=s.loaded,c=s.lengthComputable?s.total:void 0,a=o-r,u=i(a),f=o<=c;r=o;const l={loaded:o,total:c,progress:c?o/c:void 0,bytes:a,rate:u||void 0,estimated:u&&c&&f?(c-o)/u:void 0,event:s,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},n)},Zd=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Jd=e=>(...t)=>z.asap(()=>e(...t)),MT=jt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,jt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(jt.origin),jt.navigator&&/(msie|trident)/i.test(jt.navigator.userAgent)):()=>!0,qT=jt.hasStandardBrowserEnv?{write(e,t,n,r,i,s){const o=[e+"="+encodeURIComponent(t)];z.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),z.isString(r)&&o.push("path="+r),z.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function LT(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function VT(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Jm(e,t,n){let r=!LT(t);return e&&(r||n==!1)?VT(e,t):t}const Qd=e=>e instanceof yn?{...e}:e;function Wi(e,t){t=t||{};const n={};function r(u,f,l,d){return z.isPlainObject(u)&&z.isPlainObject(f)?z.merge.call({caseless:d},u,f):z.isPlainObject(f)?z.merge({},f):z.isArray(f)?f.slice():f}function i(u,f,l,d){if(z.isUndefined(f)){if(!z.isUndefined(u))return r(void 0,u,l,d)}else return r(u,f,l,d)}function s(u,f){if(!z.isUndefined(f))return r(void 0,f)}function o(u,f){if(z.isUndefined(f)){if(!z.isUndefined(u))return r(void 0,u)}else return r(void 0,f)}function c(u,f,l){if(l in t)return r(u,f);if(l in e)return r(void 0,u)}const a={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,f,l)=>i(Qd(u),Qd(f),l,!0)};return z.forEach(Object.keys({...e,...t}),function(f){const l=a[f]||i,d=l(e[f],t[f],f);z.isUndefined(d)&&l!==c||(n[f]=d)}),n}const Qm=e=>{const t=Wi({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:c}=t;t.headers=o=yn.from(o),t.url=Wm(Jm(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let a;if(z.isFormData(n)){if(jt.hasStandardBrowserEnv||jt.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((a=o.getContentType())!==!1){const[u,...f]=a?a.split(";").map(l=>l.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...f].join("; "))}}if(jt.hasStandardBrowserEnv&&(r&&z.isFunction(r)&&(r=r(t)),r||r!==!1&&MT(t.url))){const u=i&&s&&qT.read(s);u&&o.set(i,u)}return t},$T=typeof XMLHttpRequest<"u",DT=$T&&function(e){return new Promise(function(n,r){const i=Qm(e);let s=i.data;const o=yn.from(i.headers).normalize();let{responseType:c,onUploadProgress:a,onDownloadProgress:u}=i,f,l,d,y,g;function m(){y&&y(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(f),i.signal&&i.signal.removeEventListener("abort",f)}let E=new XMLHttpRequest;E.open(i.method.toUpperCase(),i.url,!0),E.timeout=i.timeout;function _(){if(!E)return;const w=yn.from("getAllResponseHeaders"in E&&E.getAllResponseHeaders()),O={data:!c||c==="text"||c==="json"?E.responseText:E.response,status:E.status,statusText:E.statusText,headers:w,config:e,request:E};Zm(function(R){n(R),m()},function(R){r(R),m()},O),E=null}"onloadend"in E?E.onloadend=_:E.onreadystatechange=function(){!E||E.readyState!==4||E.status===0&&!(E.responseURL&&E.responseURL.indexOf("file:")===0)||setTimeout(_)},E.onabort=function(){E&&(r(new Pe("Request aborted",Pe.ECONNABORTED,e,E)),E=null)},E.onerror=function(){r(new Pe("Network Error",Pe.ERR_NETWORK,e,E)),E=null},E.ontimeout=function(){let T=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const O=i.transitional||Xm;i.timeoutErrorMessage&&(T=i.timeoutErrorMessage),r(new Pe(T,O.clarifyTimeoutError?Pe.ETIMEDOUT:Pe.ECONNABORTED,e,E)),E=null},s===void 0&&o.setContentType(null),"setRequestHeader"in E&&z.forEach(o.toJSON(),function(T,O){E.setRequestHeader(O,T)}),z.isUndefined(i.withCredentials)||(E.withCredentials=!!i.withCredentials),c&&c!=="json"&&(E.responseType=i.responseType),u&&([d,g]=Sa(u,!0),E.addEventListener("progress",d)),a&&E.upload&&([l,y]=Sa(a),E.upload.addEventListener("progress",l),E.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(f=w=>{E&&(r(!w||w.type?new Gs(null,e,E):w),E.abort(),E=null)},i.cancelToken&&i.cancelToken.subscribe(f),i.signal&&(i.signal.aborted?f():i.signal.addEventListener("abort",f)));const S=CT(i.url);if(S&&jt.protocols.indexOf(S)===-1){r(new Pe("Unsupported protocol "+S+":",Pe.ERR_BAD_REQUEST,e));return}E.send(s||null)})},jT=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const s=function(u){if(!i){i=!0,c();const f=u instanceof Error?u:this.reason;r.abort(f instanceof Pe?f:new Gs(f instanceof Error?f.message:f))}};let o=t&&setTimeout(()=>{o=null,s(new Pe(`timeout ${t} of ms exceeded`,Pe.ETIMEDOUT))},t);const c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>z.asap(c),a}},KT=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},GT=async function*(e,t){for await(const n of WT(e))yield*KT(n,t)},WT=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},e0=(e,t,n,r)=>{const i=GT(e,t);let s=0,o,c=a=>{o||(o=!0,r&&r(a))};return new ReadableStream({async pull(a){try{const{done:u,value:f}=await i.next();if(u){c(),a.close();return}let l=f.byteLength;if(n){let d=s+=l;n(d)}a.enqueue(new Uint8Array(f))}catch(u){throw c(u),u}},cancel(a){return c(a),i.return()}},{highWaterMark:2})},au=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",ew=au&&typeof ReadableStream=="function",XT=au&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),tw=(e,...t)=>{try{return!!e(...t)}catch{return!1}},zT=ew&&tw(()=>{let e=!1;const t=new Request(jt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),t0=64*1024,el=ew&&tw(()=>z.isReadableStream(new Response("").body)),Ta={stream:el&&(e=>e.body)};au&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ta[t]&&(Ta[t]=z.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new Pe(`Response type '${t}' is not supported`,Pe.ERR_NOT_SUPPORT,r)})})})(new Response);const YT=async e=>{if(e==null)return 0;if(z.isBlob(e))return e.size;if(z.isSpecCompliantForm(e))return(await new Request(jt.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(z.isArrayBufferView(e)||z.isArrayBuffer(e))return e.byteLength;if(z.isURLSearchParams(e)&&(e=e+""),z.isString(e))return(await XT(e)).byteLength},ZT=async(e,t)=>{const n=z.toFiniteNumber(e.getContentLength());return n??YT(t)},JT=au&&(async e=>{let{url:t,method:n,data:r,signal:i,cancelToken:s,timeout:o,onDownloadProgress:c,onUploadProgress:a,responseType:u,headers:f,withCredentials:l="same-origin",fetchOptions:d}=Qm(e);u=u?(u+"").toLowerCase():"text";let y=jT([i,s&&s.toAbortSignal()],o),g;const m=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let E;try{if(a&&zT&&n!=="get"&&n!=="head"&&(E=await ZT(f,r))!==0){let O=new Request(t,{method:"POST",body:r,duplex:"half"}),A;if(z.isFormData(r)&&(A=O.headers.get("content-type"))&&f.setContentType(A),O.body){const[R,M]=Zd(E,Sa(Jd(a)));r=e0(O.body,t0,R,M)}}z.isString(l)||(l=l?"include":"omit");const _="credentials"in Request.prototype;g=new Request(t,{...d,signal:y,method:n.toUpperCase(),headers:f.normalize().toJSON(),body:r,duplex:"half",credentials:_?l:void 0});let S=await fetch(g,d);const w=el&&(u==="stream"||u==="response");if(el&&(c||w&&m)){const O={};["status","statusText","headers"].forEach(v=>{O[v]=S[v]});const A=z.toFiniteNumber(S.headers.get("content-length")),[R,M]=c&&Zd(A,Sa(Jd(c),!0))||[];S=new Response(e0(S.body,t0,R,()=>{M&&M(),m&&m()}),O)}u=u||"text";let T=await Ta[z.findKey(Ta,u)||"text"](S,e);return!w&&m&&m(),await new Promise((O,A)=>{Zm(O,A,{data:T,headers:yn.from(S.headers),status:S.status,statusText:S.statusText,config:e,request:g})})}catch(_){throw m&&m(),_&&_.name==="TypeError"&&/Load failed|fetch/i.test(_.message)?Object.assign(new Pe("Network Error",Pe.ERR_NETWORK,e,g),{cause:_.cause||_}):Pe.from(_,_&&_.code,e,g)}}),tl={http:dT,xhr:DT,fetch:JT};z.forEach(tl,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const n0=e=>`- ${e}`,QT=e=>z.isFunction(e)||e===null||e===!1,nw={getAdapter:e=>{e=z.isArray(e)?e:[e];const{length:t}=e;let n,r;const i={};for(let s=0;s<t;s++){n=e[s];let o;if(r=n,!QT(n)&&(r=tl[(o=String(n)).toLowerCase()],r===void 0))throw new Pe(`Unknown adapter '${o}'`);if(r)break;i[o||"#"+s]=r}if(!r){const s=Object.entries(i).map(([c,a])=>`adapter ${c} `+(a===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
28
28
  `+s.map(n0).join(`
29
29
  `):" "+n0(s[0]):"as no adapter specified";throw new Pe("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:tl};function Zu(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Gs(null,e)}function r0(e){return Zu(e),e.headers=yn.from(e.headers),e.data=Yu.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),nw.getAdapter(e.adapter||yc.adapter)(e).then(function(r){return Zu(e),r.data=Yu.call(e,e.transformResponse,r),r.headers=yn.from(r.headers),r},function(r){return Ym(r)||(Zu(e),r&&r.response&&(r.response.data=Yu.call(e,e.transformResponse,r.response),r.response.headers=yn.from(r.response.headers))),Promise.reject(r)})}const rw="1.11.0",uu={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{uu[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const i0={};uu.transitional=function(t,n,r){function i(s,o){return"[Axios v"+rw+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,c)=>{if(t===!1)throw new Pe(i(o," has been removed"+(n?" in "+n:"")),Pe.ERR_DEPRECATED);return n&&!i0[o]&&(i0[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,o,c):!0}};uu.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function ex(e,t,n){if(typeof e!="object")throw new Pe("options must be an object",Pe.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],o=t[s];if(o){const c=e[s],a=c===void 0||o(c,s,e);if(a!==!0)throw new Pe("option "+s+" must be "+a,Pe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Pe("Unknown option "+s,Pe.ERR_BAD_OPTION)}}const ta={assertOptions:ex,validators:uu},Zn=ta.validators;let qi=class{constructor(t){this.defaults=t||{},this.interceptors={request:new zd,response:new zd}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
30
- `+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Wi(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&ta.assertOptions(r,{silentJSONParsing:Zn.transitional(Zn.boolean),forcedJSONParsing:Zn.transitional(Zn.boolean),clarifyTimeoutError:Zn.transitional(Zn.boolean)},!1),i!=null&&(z.isFunction(i)?n.paramsSerializer={serialize:i}:ta.assertOptions(i,{encode:Zn.function,serialize:Zn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ta.assertOptions(n,{baseUrl:Zn.spelling("baseURL"),withXsrfToken:Zn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&z.merge(s.common,s[n.method]);s&&z.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),n.headers=yn.concat(o,s);const c=[];let a=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(a=a&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let f,l=0,d;if(!a){const g=[r0.bind(this),void 0];for(g.unshift(...c),g.push(...u),d=g.length,f=Promise.resolve(n);l<d;)f=f.then(g[l++],g[l++]);return f}d=c.length;let y=n;for(l=0;l<d;){const g=c[l++],m=c[l++];try{y=g(y)}catch(E){m.call(this,E);break}}try{f=r0.call(this,y)}catch(g){return Promise.reject(g)}for(l=0,d=u.length;l<d;)f=f.then(u[l++],u[l++]);return f}getUri(t){t=Wi(this.defaults,t);const n=Jm(t.baseURL,t.url,t.allowAbsoluteUrls);return Wm(n,t.params,t.paramsSerializer)}};z.forEach(["delete","get","head","options"],function(t){qi.prototype[t]=function(n,r){return this.request(Wi(r||{},{method:t,url:n,data:(r||{}).data}))}});z.forEach(["post","put","patch"],function(t){function n(r){return function(s,o,c){return this.request(Wi(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}qi.prototype[t]=n(),qi.prototype[t+"Form"]=n(!0)});let tx=class iw{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(c=>{r.subscribe(c),s=c}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},t(function(s,o,c){r.reason||(r.reason=new Gs(s,o,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new iw(function(i){t=i}),cancel:t}}};function nx(e){return function(n){return e.apply(null,n)}}function rx(e){return z.isObject(e)&&e.isAxiosError===!0}const nl={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(nl).forEach(([e,t])=>{nl[t]=e});function sw(e){const t=new qi(e),n=Cm(qi.prototype.request,t);return z.extend(n,qi.prototype,t,{allOwnKeys:!0}),z.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return sw(Wi(e,i))},n}const dt=sw(yc);dt.Axios=qi;dt.CanceledError=Gs;dt.CancelToken=tx;dt.isCancel=Ym;dt.VERSION=rw;dt.toFormData=cu;dt.AxiosError=Pe;dt.Cancel=dt.CanceledError;dt.all=function(t){return Promise.all(t)};dt.spread=nx;dt.isAxiosError=rx;dt.mergeConfig=Wi;dt.AxiosHeaders=yn;dt.formToJSON=e=>zm(z.isHTMLForm(e)?new FormData(e):e);dt.getAdapter=nw.getAdapter;dt.HttpStatusCode=nl;dt.default=dt;const{Axios:aI,AxiosError:uI,CanceledError:fI,isCancel:lI,CancelToken:hI,VERSION:dI,all:pI,Cancel:yI,isAxiosError:gI,spread:mI,toFormData:wI,AxiosHeaders:bI,HttpStatusCode:EI,formToJSON:_I,getAdapter:SI,mergeConfig:TI}=dt;class ix{axios;constructor(t){this.axios=dt.create({baseURL:t.baseUrl,headers:{Accept:"application/json","Content-Type":"application/json","api-key":`${t.apiKey}`}})}async utxosByAddress(t,n,r=!0){return await this.axios.get(`/addresses/${t}/utxos?filter_dust=true&filter_dust_threshold=547&exclude_metaprotocols=${r}&ignore_used_brc20=true&order=asc&count=100${n?`&cursor=${n}`:""}`).then(s=>s.data)}async inscriptionIdsByCollectionSymbol(t,n){return await this.axios.get(`/assets/collections/${t}/inscriptions?count=100${n?`&cursor=${n}`:""}`).then(i=>i.data)}async runeUtxosByAddress(t,n,r){return await this.axios.get(`/addresses/${t}/runes/utxos?order_by=height&order=asc&count=100&rune=${n}${r?`&cursor=${r}`:""}`).then(s=>s.data)}async runeInfo(t){return await this.axios.get(`/assets/runes/${t}`).then(r=>r.data)}}var s0;(function(e){e[e.SysFatal=1]="SysFatal",e[e.SysTransient=2]="SysTransient",e[e.DestinationInvalid=3]="DestinationInvalid",e[e.CanisterReject=4]="CanisterReject",e[e.CanisterError=5]="CanisterError"})(s0||(s0={}));var Hs;(function(e){e.Replied="replied",e.Rejected="rejected"})(Hs||(Hs={}));function sx(e){return e!=null&&"reject_code"in e}function ox(e){return e!=null&&"certificate"in e}var kr;(function(e){e.Trust="Trust",e.Protocol="Protocol",e.Reject="Reject",e.Transport="Transport",e.External="External",e.Limit="Limit",e.Input="Input",e.Unknown="Unknown"})(kr||(kr={}));class Ce{constructor(t=!1){this.isCertified=t}toString(){let t=this.toErrorMessage();return this.requestContext&&(t+=`
30
+ `+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Wi(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&ta.assertOptions(r,{silentJSONParsing:Zn.transitional(Zn.boolean),forcedJSONParsing:Zn.transitional(Zn.boolean),clarifyTimeoutError:Zn.transitional(Zn.boolean)},!1),i!=null&&(z.isFunction(i)?n.paramsSerializer={serialize:i}:ta.assertOptions(i,{encode:Zn.function,serialize:Zn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ta.assertOptions(n,{baseUrl:Zn.spelling("baseURL"),withXsrfToken:Zn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&z.merge(s.common,s[n.method]);s&&z.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),n.headers=yn.concat(o,s);const c=[];let a=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(a=a&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let f,l=0,d;if(!a){const g=[r0.bind(this),void 0];for(g.unshift(...c),g.push(...u),d=g.length,f=Promise.resolve(n);l<d;)f=f.then(g[l++],g[l++]);return f}d=c.length;let y=n;for(l=0;l<d;){const g=c[l++],m=c[l++];try{y=g(y)}catch(E){m.call(this,E);break}}try{f=r0.call(this,y)}catch(g){return Promise.reject(g)}for(l=0,d=u.length;l<d;)f=f.then(u[l++],u[l++]);return f}getUri(t){t=Wi(this.defaults,t);const n=Jm(t.baseURL,t.url,t.allowAbsoluteUrls);return Wm(n,t.params,t.paramsSerializer)}};z.forEach(["delete","get","head","options"],function(t){qi.prototype[t]=function(n,r){return this.request(Wi(r||{},{method:t,url:n,data:(r||{}).data}))}});z.forEach(["post","put","patch"],function(t){function n(r){return function(s,o,c){return this.request(Wi(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}qi.prototype[t]=n(),qi.prototype[t+"Form"]=n(!0)});let tx=class iw{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(c=>{r.subscribe(c),s=c}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},t(function(s,o,c){r.reason||(r.reason=new Gs(s,o,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new iw(function(i){t=i}),cancel:t}}};function nx(e){return function(n){return e.apply(null,n)}}function rx(e){return z.isObject(e)&&e.isAxiosError===!0}const nl={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(nl).forEach(([e,t])=>{nl[t]=e});function sw(e){const t=new qi(e),n=Cm(qi.prototype.request,t);return z.extend(n,qi.prototype,t,{allOwnKeys:!0}),z.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return sw(Wi(e,i))},n}const dt=sw(yc);dt.Axios=qi;dt.CanceledError=Gs;dt.CancelToken=tx;dt.isCancel=Ym;dt.VERSION=rw;dt.toFormData=cu;dt.AxiosError=Pe;dt.Cancel=dt.CanceledError;dt.all=function(t){return Promise.all(t)};dt.spread=nx;dt.isAxiosError=rx;dt.mergeConfig=Wi;dt.AxiosHeaders=yn;dt.formToJSON=e=>zm(z.isHTMLForm(e)?new FormData(e):e);dt.getAdapter=nw.getAdapter;dt.HttpStatusCode=nl;dt.default=dt;const{Axios:aI,AxiosError:uI,CanceledError:fI,isCancel:lI,CancelToken:hI,VERSION:dI,all:pI,Cancel:yI,isAxiosError:gI,spread:mI,toFormData:wI,AxiosHeaders:bI,HttpStatusCode:EI,formToJSON:_I,getAdapter:SI,mergeConfig:TI}=dt;class ix{axios;constructor(t){this.axios=dt.create({baseURL:t.baseUrl,headers:{Accept:"application/json","Content-Type":"application/json","api-key":`${t.apiKey}`}})}async utxosByAddress(t,n,r=!0){return await this.axios.get(`/addresses/${t}/utxos?filter_dust=true&filter_dust_threshold=547&exclude_metaprotocols=${r}&ignore_used_brc20=true&order=asc&count=100${n?`&cursor=${n}`:""}`).then(s=>s.data)}async utxosByAddressMempoolAware(t,n,r=!0){return await this.axios.get(`/mempool/addresses/${t}/utxos?filter_dust=true&exclude_metaprotocols=${r}&filter_dust_threshold=547&order=asc&count=100${n?`&cursor=${n}`:""}`).then(s=>s.data)}async inscriptionIdsByCollectionSymbol(t,n){return await this.axios.get(`/assets/collections/${t}/inscriptions?count=100${n?`&cursor=${n}`:""}`).then(i=>i.data)}async runeUtxosByAddress(t,n,r){return await this.axios.get(`/addresses/${t}/runes/utxos?order_by=height&order=asc&count=100&rune=${n}${r?`&cursor=${r}`:""}`).then(s=>s.data)}async runeInfo(t){return await this.axios.get(`/assets/runes/${t}`).then(r=>r.data)}}var s0;(function(e){e[e.SysFatal=1]="SysFatal",e[e.SysTransient=2]="SysTransient",e[e.DestinationInvalid=3]="DestinationInvalid",e[e.CanisterReject=4]="CanisterReject",e[e.CanisterError=5]="CanisterError"})(s0||(s0={}));var Hs;(function(e){e.Replied="replied",e.Rejected="rejected"})(Hs||(Hs={}));function sx(e){return e!=null&&"reject_code"in e}function ox(e){return e!=null&&"certificate"in e}var kr;(function(e){e.Trust="Trust",e.Protocol="Protocol",e.Reject="Reject",e.Transport="Transport",e.External="External",e.Limit="Limit",e.Input="Input",e.Unknown="Unknown"})(kr||(kr={}));class Ce{constructor(t=!1){this.isCertified=t}toString(){let t=this.toErrorMessage();return this.requestContext&&(t+=`
31
31
  Request context:
32
32
  Request ID (hex): ${this.requestContext.requestId?it(this.requestContext.requestId):"undefined"}
33
33
  Sender pubkey (hex): ${it(this.requestContext.senderPubKey)}
@@ -129,7 +129,7 @@ ${String(e)}`)}catch(t){return t}},Iy=e=>{if(typeof e!="object"||e===null)throw
129
129
  * https://github.com/MikeMcl/decimal.js
130
130
  * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
131
131
  * MIT Licence
132
- */var Es=9e15,mi=1e9,El="0123456789abcdef",Ma="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",qa="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",_l={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Es,maxE:Es,crypto:!1},g1,vr,Ie=!0,xu="[DecimalError] ",di=xu+"Invalid argument: ",m1=xu+"Precision limit exceeded",w1=xu+"crypto unavailable",b1="[object Decimal]",Xt=Math.floor,At=Math.pow,Qv=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,e6=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,t6=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,E1=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Kn=1e7,Se=7,n6=9007199254740991,r6=Ma.length-1,Sl=qa.length-1,se={toStringTag:b1};se.absoluteValue=se.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),be(e)};se.ceil=function(){return be(new this.constructor(this),this.e+1,2)};se.clampedTo=se.clamp=function(e,t){var n,r=this,i=r.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(di+t);return n=r.cmp(e),n<0?e:r.cmp(t)>0?t:new i(r)};se.comparedTo=se.cmp=function(e){var t,n,r,i,s=this,o=s.d,c=(e=new s.constructor(e)).d,a=s.s,u=e.s;if(!o||!c)return!a||!u?NaN:a!==u?a:o===c?0:!o^a<0?1:-1;if(!o[0]||!c[0])return o[0]?a:c[0]?-u:0;if(a!==u)return a;if(s.e!==e.e)return s.e>e.e^a<0?1:-1;for(r=o.length,i=c.length,t=0,n=r<i?r:i;t<n;++t)if(o[t]!==c[t])return o[t]>c[t]^a<0?1:-1;return r===i?0:r>i^a<0?1:-1};se.cosine=se.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+Se,r.rounding=1,n=i6(r,A1(r,n)),r.precision=e,r.rounding=t,be(vr==2||vr==3?n.neg():n,e,t,!0)):new r(1):new r(NaN)};se.cubeRoot=se.cbrt=function(){var e,t,n,r,i,s,o,c,a,u,f=this,l=f.constructor;if(!f.isFinite()||f.isZero())return new l(f);for(Ie=!1,s=f.s*At(f.s*f,1/3),!s||Math.abs(s)==1/0?(n=Ft(f.d),e=f.e,(s=(e-n.length+1)%3)&&(n+=s==1||s==-2?"0":"00"),s=At(n,1/3),e=Xt((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?n="5e"+e:(n=s.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),r=new l(n),r.s=f.s):r=new l(s.toString()),o=(e=l.precision)+3;;)if(c=r,a=c.times(c).times(c),u=a.plus(f),r=Je(u.plus(f).times(c),u.plus(a),o+2,1),Ft(c.d).slice(0,o)===(n=Ft(r.d)).slice(0,o))if(n=n.slice(o-3,o+1),n=="9999"||!i&&n=="4999"){if(!i&&(be(c,e+1,0),c.times(c).times(c).eq(f))){r=c;break}o+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(be(r,e+1,1),t=!r.times(r).times(r).eq(f));break}return Ie=!0,be(r,e,l.rounding,t)};se.decimalPlaces=se.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-Xt(this.e/Se))*Se,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n};se.dividedBy=se.div=function(e){return Je(this,new this.constructor(e))};se.dividedToIntegerBy=se.divToInt=function(e){var t=this,n=t.constructor;return be(Je(t,new n(e),0,1,1),n.precision,n.rounding)};se.equals=se.eq=function(e){return this.cmp(e)===0};se.floor=function(){return be(new this.constructor(this),this.e+1,3)};se.greaterThan=se.gt=function(e){return this.cmp(e)>0};se.greaterThanOrEqualTo=se.gte=function(e){var t=this.cmp(e);return t==1||t===0};se.hyperbolicCosine=se.cosh=function(){var e,t,n,r,i,s=this,o=s.constructor,c=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return c;n=o.precision,r=o.rounding,o.precision=n+Math.max(s.e,s.sd())+4,o.rounding=1,i=s.d.length,i<32?(e=Math.ceil(i/3),t=(1/vu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=qs(o,1,s.times(t),new o(1),!0);for(var a,u=e,f=new o(8);u--;)a=s.times(s),s=c.minus(a.times(f.minus(a.times(f))));return be(s,o.precision=n,o.rounding=r,!0)};se.hyperbolicSine=se.sinh=function(){var e,t,n,r,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(t=s.precision,n=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,r=i.d.length,r<3)i=qs(s,2,i,i,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:e|0,i=i.times(1/vu(5,e)),i=qs(s,2,i,i,!0);for(var o,c=new s(5),a=new s(16),u=new s(20);e--;)o=i.times(i),i=i.times(c.plus(o.times(a.times(o).plus(u))))}return s.precision=t,s.rounding=n,be(i,t,n,!0)};se.hyperbolicTangent=se.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,Je(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)};se.inverseCosine=se.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return n!==-1?n===0?e.isNeg()?nr(t,r,i):new t(0):new t(NaN):e.isZero()?nr(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=r,t.rounding=i,e.times(2))};se.inverseHyperbolicCosine=se.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,Ie=!1,n=n.times(n).minus(1).sqrt().plus(n),Ie=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)};se.inverseHyperbolicSine=se.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,Ie=!1,n=n.times(n).plus(1).sqrt().plus(n),Ie=!0,r.precision=e,r.rounding=t,n.ln())};se.inverseHyperbolicTangent=se.atanh=function(){var e,t,n,r,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=s.precision,t=s.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?be(new s(i),e,t,!0):(s.precision=n=r-i.e,i=Je(i.plus(1),new s(1).minus(i),n+e,1),s.precision=e+4,s.rounding=1,i=i.ln(),s.precision=e,s.rounding=t,i.times(.5))):new s(NaN)};se.inverseSine=se.asin=function(){var e,t,n,r,i=this,s=i.constructor;return i.isZero()?new s(i):(t=i.abs().cmp(1),n=s.precision,r=s.rounding,t!==-1?t===0?(e=nr(s,n+4,r).times(.5),e.s=i.s,e):new s(NaN):(s.precision=n+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=n,s.rounding=r,i.times(2)))};se.inverseTangent=se.atan=function(){var e,t,n,r,i,s,o,c,a,u=this,f=u.constructor,l=f.precision,d=f.rounding;if(u.isFinite()){if(u.isZero())return new f(u);if(u.abs().eq(1)&&l+4<=Sl)return o=nr(f,l+4,d).times(.25),o.s=u.s,o}else{if(!u.s)return new f(NaN);if(l+4<=Sl)return o=nr(f,l+4,d).times(.5),o.s=u.s,o}for(f.precision=c=l+10,f.rounding=1,n=Math.min(28,c/Se+2|0),e=n;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(Ie=!1,t=Math.ceil(c/Se),r=1,a=u.times(u),o=new f(u),i=u;e!==-1;)if(i=i.times(a),s=o.minus(i.div(r+=2)),i=i.times(a),o=s.plus(i.div(r+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===s.d[e]&&e--;);return n&&(o=o.times(2<<n-1)),Ie=!0,be(o,f.precision=l,f.rounding=d,!0)};se.isFinite=function(){return!!this.d};se.isInteger=se.isInt=function(){return!!this.d&&Xt(this.e/Se)>this.d.length-2};se.isNaN=function(){return!this.s};se.isNegative=se.isNeg=function(){return this.s<0};se.isPositive=se.isPos=function(){return this.s>0};se.isZero=function(){return!!this.d&&this.d[0]===0};se.lessThan=se.lt=function(e){return this.cmp(e)<0};se.lessThanOrEqualTo=se.lte=function(e){return this.cmp(e)<1};se.logarithm=se.log=function(e){var t,n,r,i,s,o,c,a,u=this,f=u.constructor,l=f.precision,d=f.rounding,y=5;if(e==null)e=new f(10),t=!0;else{if(e=new f(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new f(NaN);t=e.eq(10)}if(n=u.d,u.s<0||!n||!n[0]||u.eq(1))return new f(n&&!n[0]?-1/0:u.s!=1?NaN:n?0:1/0);if(t)if(n.length>1)s=!0;else{for(i=n[0];i%10===0;)i/=10;s=i!==1}if(Ie=!1,c=l+y,o=ci(u,c),r=t?La(f,c+10):ci(e,c),a=Je(o,r,c,1),Go(a.d,i=l,d))do if(c+=10,o=ci(u,c),r=t?La(f,c+10):ci(e,c),a=Je(o,r,c,1),!s){+Ft(a.d).slice(i+1,i+15)+1==1e14&&(a=be(a,l+1,0));break}while(Go(a.d,i+=10,d));return Ie=!0,be(a,l,d)};se.minus=se.sub=function(e){var t,n,r,i,s,o,c,a,u,f,l,d,y=this,g=y.constructor;if(e=new g(e),!y.d||!e.d)return!y.s||!e.s?e=new g(NaN):y.d?e.s=-e.s:e=new g(e.d||y.s!==e.s?y:NaN),e;if(y.s!=e.s)return e.s=-e.s,y.plus(e);if(u=y.d,d=e.d,c=g.precision,a=g.rounding,!u[0]||!d[0]){if(d[0])e.s=-e.s;else if(u[0])e=new g(y);else return new g(a===3?-0:0);return Ie?be(e,c,a):e}if(n=Xt(e.e/Se),f=Xt(y.e/Se),u=u.slice(),s=f-n,s){for(l=s<0,l?(t=u,s=-s,o=d.length):(t=d,n=f,o=u.length),r=Math.max(Math.ceil(c/Se),o)+2,s>r&&(s=r,t.length=1),t.reverse(),r=s;r--;)t.push(0);t.reverse()}else{for(r=u.length,o=d.length,l=r<o,l&&(o=r),r=0;r<o;r++)if(u[r]!=d[r]){l=u[r]<d[r];break}s=0}for(l&&(t=u,u=d,d=t,e.s=-e.s),o=u.length,r=d.length-o;r>0;--r)u[o++]=0;for(r=d.length;r>s;){if(u[--r]<d[r]){for(i=r;i&&u[--i]===0;)u[i]=Kn-1;--u[i],u[r]+=Kn}u[r]-=d[r]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(e.d=u,e.e=Au(u,n),Ie?be(e,c,a):e):new g(a===3?-0:0)};se.modulo=se.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?be(new r(n),r.precision,r.rounding):(Ie=!1,r.modulo==9?(t=Je(n,e.abs(),0,3,1),t.s*=e.s):t=Je(n,e,0,r.modulo,1),t=t.times(e),Ie=!0,n.minus(t))};se.naturalExponential=se.exp=function(){return Tl(this)};se.naturalLogarithm=se.ln=function(){return ci(this)};se.negated=se.neg=function(){var e=new this.constructor(this);return e.s=-e.s,be(e)};se.plus=se.add=function(e){var t,n,r,i,s,o,c,a,u,f,l=this,d=l.constructor;if(e=new d(e),!l.d||!e.d)return!l.s||!e.s?e=new d(NaN):l.d||(e=new d(e.d||l.s===e.s?l:NaN)),e;if(l.s!=e.s)return e.s=-e.s,l.minus(e);if(u=l.d,f=e.d,c=d.precision,a=d.rounding,!u[0]||!f[0])return f[0]||(e=new d(l)),Ie?be(e,c,a):e;if(s=Xt(l.e/Se),r=Xt(e.e/Se),u=u.slice(),i=s-r,i){for(i<0?(n=u,i=-i,o=f.length):(n=f,r=s,o=u.length),s=Math.ceil(c/Se),o=s>o?s+1:o+1,i>o&&(i=o,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(o=u.length,i=f.length,o-i<0&&(i=o,n=f,f=u,u=n),t=0;i;)t=(u[--i]=u[i]+f[i]+t)/Kn|0,u[i]%=Kn;for(t&&(u.unshift(t),++r),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Au(u,r),Ie?be(e,c,a):e};se.precision=se.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(di+e);return n.d?(t=_1(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t};se.round=function(){var e=this,t=e.constructor;return be(new t(e),e.e+1,t.rounding)};se.sine=se.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+Se,r.rounding=1,n=o6(r,A1(r,n)),r.precision=e,r.rounding=t,be(vr>2?n.neg():n,e,t,!0)):new r(NaN)};se.squareRoot=se.sqrt=function(){var e,t,n,r,i,s,o=this,c=o.d,a=o.e,u=o.s,f=o.constructor;if(u!==1||!c||!c[0])return new f(!u||u<0&&(!c||c[0])?NaN:c?o:1/0);for(Ie=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=Ft(c),(t.length+a)%2==0&&(t+="0"),u=Math.sqrt(t),a=Xt((a+1)/2)-(a<0||a%2),u==1/0?t="5e"+a:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+a),r=new f(t)):r=new f(u.toString()),n=(a=f.precision)+3;;)if(s=r,r=s.plus(Je(o,s,n+2,1)).times(.5),Ft(s.d).slice(0,n)===(t=Ft(r.d)).slice(0,n))if(t=t.slice(n-3,n+1),t=="9999"||!i&&t=="4999"){if(!i&&(be(s,a+1,0),s.times(s).eq(o))){r=s;break}n+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(be(r,a+1,1),e=!r.times(r).eq(o));break}return Ie=!0,be(r,a,f.rounding,e)};se.tangent=se.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,n=n.sin(),n.s=1,n=Je(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,be(vr==2||vr==4?n.neg():n,e,t,!0)):new r(NaN)};se.times=se.mul=function(e){var t,n,r,i,s,o,c,a,u,f=this,l=f.constructor,d=f.d,y=(e=new l(e)).d;if(e.s*=f.s,!d||!d[0]||!y||!y[0])return new l(!e.s||d&&!d[0]&&!y||y&&!y[0]&&!d?NaN:!d||!y?e.s/0:e.s*0);for(n=Xt(f.e/Se)+Xt(e.e/Se),a=d.length,u=y.length,a<u&&(s=d,d=y,y=s,o=a,a=u,u=o),s=[],o=a+u,r=o;r--;)s.push(0);for(r=u;--r>=0;){for(t=0,i=a+r;i>r;)c=s[i]+y[r]*d[i-r-1]+t,s[i--]=c%Kn|0,t=c/Kn|0;s[i]=(s[i]+t)%Kn|0}for(;!s[--o];)s.pop();return t?++n:s.shift(),e.d=s,e.e=Au(s,n),Ie?be(e,l.precision,l.rounding):e};se.toBinary=function(e,t){return Ch(this,2,e,t)};se.toDecimalPlaces=se.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(gn(e,0,mi),t===void 0?t=r.rounding:gn(t,0,8),be(n,e+n.e+1,t))};se.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=sr(r,!0):(gn(e,0,mi),t===void 0?t=i.rounding:gn(t,0,8),r=be(new i(r),e+1,t),n=sr(r,!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n};se.toFixed=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?n=sr(i):(gn(e,0,mi),t===void 0?t=s.rounding:gn(t,0,8),r=be(new s(i),e+i.e+1,t),n=sr(r,!1,e+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n};se.toFraction=function(e){var t,n,r,i,s,o,c,a,u,f,l,d,y=this,g=y.d,m=y.constructor;if(!g)return new m(y);if(u=n=new m(1),r=a=new m(0),t=new m(r),s=t.e=_1(g)-y.e-1,o=s%Se,t.d[0]=At(10,o<0?Se+o:o),e==null)e=s>0?t:u;else{if(c=new m(e),!c.isInt()||c.lt(u))throw Error(di+c);e=c.gt(t)?s>0?t:u:c}for(Ie=!1,c=new m(Ft(g)),f=m.precision,m.precision=s=g.length*Se*2;l=Je(c,t,0,1,1),i=n.plus(l.times(r)),i.cmp(e)!=1;)n=r,r=i,i=u,u=a.plus(l.times(i)),a=i,i=t,t=c.minus(l.times(i)),c=i;return i=Je(e.minus(n),r,0,1,1),a=a.plus(i.times(u)),n=n.plus(i.times(r)),a.s=u.s=y.s,d=Je(u,r,s,1).minus(y).abs().cmp(Je(a,n,s,1).minus(y).abs())<1?[u,r]:[a,n],m.precision=f,Ie=!0,d};se.toHexadecimal=se.toHex=function(e,t){return Ch(this,16,e,t)};se.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),e==null){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),t===void 0?t=r.rounding:gn(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(Ie=!1,n=Je(n,e,0,t,1).times(e),Ie=!0,be(n)):(e.s=n.s,n=e),n};se.toNumber=function(){return+this};se.toOctal=function(e,t){return Ch(this,8,e,t)};se.toPower=se.pow=function(e){var t,n,r,i,s,o,c=this,a=c.constructor,u=+(e=new a(e));if(!c.d||!e.d||!c.d[0]||!e.d[0])return new a(At(+c,u));if(c=new a(c),c.eq(1))return c;if(r=a.precision,s=a.rounding,e.eq(1))return be(c,r,s);if(t=Xt(e.e/Se),t>=e.d.length-1&&(n=u<0?-u:u)<=n6)return i=S1(a,c,n,r),e.s<0?new a(1).div(i):be(i,r,s);if(o=c.s,o<0){if(t<e.d.length-1)return new a(NaN);if((e.d[t]&1)==0&&(o=1),c.e==0&&c.d[0]==1&&c.d.length==1)return c.s=o,c}return n=At(+c,u),t=n==0||!isFinite(n)?Xt(u*(Math.log("0."+Ft(c.d))/Math.LN10+c.e+1)):new a(n+"").e,t>a.maxE+1||t<a.minE-1?new a(t>0?o/0:0):(Ie=!1,a.rounding=c.s=1,n=Math.min(12,(t+"").length),i=Tl(e.times(ci(c,r+n)),r),i.d&&(i=be(i,r+5,1),Go(i.d,r,s)&&(t=r+10,i=be(Tl(e.times(ci(c,t+n)),t),t+5,1),+Ft(i.d).slice(r+1,r+15)+1==1e14&&(i=be(i,r+1,0)))),i.s=o,Ie=!0,a.rounding=s,be(i,r,s))};se.toPrecision=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=sr(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(gn(e,1,mi),t===void 0?t=i.rounding:gn(t,0,8),r=be(new i(r),e,t),n=sr(r,e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n};se.toSignificantDigits=se.toSD=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(gn(e,1,mi),t===void 0?t=r.rounding:gn(t,0,8)),be(new r(n),e,t)};se.toString=function(){var e=this,t=e.constructor,n=sr(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n};se.truncated=se.trunc=function(){return be(new this.constructor(this),this.e+1,1)};se.valueOf=se.toJSON=function(){var e=this,t=e.constructor,n=sr(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};function Ft(e){var t,n,r,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;t<i;t++)r=e[t]+"",n=Se-r.length,n&&(s+=si(n)),s+=r;o=e[t],r=o+"",n=Se-r.length,n&&(s+=si(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function gn(e,t,n){if(e!==~~e||e<t||e>n)throw Error(di+e)}function Go(e,t,n,r){var i,s,o,c;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=Se,i=0):(i=Math.ceil((t+1)/Se),t%=Se),s=At(10,Se-t),c=e[i]%s|0,r==null?t<3?(t==0?c=c/100|0:t==1&&(c=c/10|0),o=n<4&&c==99999||n>3&&c==49999||c==5e4||c==0):o=(n<4&&c+1==s||n>3&&c+1==s/2)&&(e[i+1]/s/100|0)==At(10,t-2)-1||(c==s/2||c==0)&&(e[i+1]/s/100|0)==0:t<4?(t==0?c=c/1e3|0:t==1?c=c/100|0:t==2&&(c=c/10|0),o=(r||n<4)&&c==9999||!r&&n>3&&c==4999):o=((r||n<4)&&c+1==s||!r&&n>3&&c+1==s/2)&&(e[i+1]/s/1e3|0)==At(10,t-3)-1,o}function ca(e,t,n){for(var r,i=[0],s,o=0,c=e.length;o<c;){for(s=i.length;s--;)i[s]*=t;for(i[0]+=El.indexOf(e.charAt(o++)),r=0;r<i.length;r++)i[r]>n-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function i6(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?(n=Math.ceil(r/3),i=(1/vu(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),e.precision+=n,t=qs(e,1,t.times(i),new e(1));for(var s=n;s--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=n,t}var Je=(function(){function e(r,i,s){var o,c=0,a=r.length;for(r=r.slice();a--;)o=r[a]*i+c,r[a]=o%s|0,c=o/s|0;return c&&r.unshift(c),r}function t(r,i,s,o){var c,a;if(s!=o)a=s>o?1:-1;else for(c=a=0;c<s;c++)if(r[c]!=i[c]){a=r[c]>i[c]?1:-1;break}return a}function n(r,i,s,o){for(var c=0;s--;)r[s]-=c,c=r[s]<i[s]?1:0,r[s]=c*o+r[s]-i[s];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,s,o,c,a){var u,f,l,d,y,g,m,E,_,S,w,T,O,A,R,M,v,U,L,K,H=r.constructor,$=r.s==i.s?1:-1,P=r.d,D=i.d;if(!P||!P[0]||!D||!D[0])return new H(!r.s||!i.s||(P?D&&P[0]==D[0]:!D)?NaN:P&&P[0]==0||!D?$*0:$/0);for(a?(y=1,f=r.e-i.e):(a=Kn,y=Se,f=Xt(r.e/y)-Xt(i.e/y)),L=D.length,v=P.length,_=new H($),S=_.d=[],l=0;D[l]==(P[l]||0);l++);if(D[l]>(P[l]||0)&&f--,s==null?(A=s=H.precision,o=H.rounding):c?A=s+(r.e-i.e)+1:A=s,A<0)S.push(1),g=!0;else{if(A=A/y+2|0,l=0,L==1){for(d=0,D=D[0],A++;(l<v||d)&&A--;l++)R=d*a+(P[l]||0),S[l]=R/D|0,d=R%D|0;g=d||l<v}else{for(d=a/(D[0]+1)|0,d>1&&(D=e(D,d,a),P=e(P,d,a),L=D.length,v=P.length),M=L,w=P.slice(0,L),T=w.length;T<L;)w[T++]=0;K=D.slice(),K.unshift(0),U=D[0],D[1]>=a/2&&++U;do d=0,u=t(D,w,L,T),u<0?(O=w[0],L!=T&&(O=O*a+(w[1]||0)),d=O/U|0,d>1?(d>=a&&(d=a-1),m=e(D,d,a),E=m.length,T=w.length,u=t(m,w,E,T),u==1&&(d--,n(m,L<E?K:D,E,a))):(d==0&&(u=d=1),m=D.slice()),E=m.length,E<T&&m.unshift(0),n(w,m,T,a),u==-1&&(T=w.length,u=t(D,w,L,T),u<1&&(d++,n(w,L<T?K:D,T,a))),T=w.length):u===0&&(d++,w=[0]),S[l++]=d,u&&w[0]?w[T++]=P[M]||0:(w=[P[M]],T=1);while((M++<v||w[0]!==void 0)&&A--);g=w[0]!==void 0}S[0]||S.shift()}if(y==1)_.e=f,g1=g;else{for(l=1,d=S[0];d>=10;d/=10)l++;_.e=l+f*y-1,be(_,c?s+_.e+1:s,o,g)}return _}})();function be(e,t,n,r){var i,s,o,c,a,u,f,l,d,y=e.constructor;e:if(t!=null){if(l=e.d,!l)return e;for(i=1,c=l[0];c>=10;c/=10)i++;if(s=t-i,s<0)s+=Se,o=t,f=l[d=0],a=f/At(10,i-o-1)%10|0;else if(d=Math.ceil((s+1)/Se),c=l.length,d>=c)if(r){for(;c++<=d;)l.push(0);f=a=0,i=1,s%=Se,o=s-Se+1}else break e;else{for(f=c=l[d],i=1;c>=10;c/=10)i++;s%=Se,o=s-Se+i,a=o<0?0:f/At(10,i-o-1)%10|0}if(r=r||t<0||l[d+1]!==void 0||(o<0?f:f%At(10,i-o-1)),u=n<4?(a||r)&&(n==0||n==(e.s<0?3:2)):a>5||a==5&&(n==4||r||n==6&&(s>0?o>0?f/At(10,i-o):0:l[d-1])%10&1||n==(e.s<0?8:7)),t<1||!l[0])return l.length=0,u?(t-=e.e+1,l[0]=At(10,(Se-t%Se)%Se),e.e=-t||0):l[0]=e.e=0,e;if(s==0?(l.length=d,c=1,d--):(l.length=d+1,c=At(10,Se-s),l[d]=o>0?(f/At(10,i-o)%At(10,o)|0)*c:0),u)for(;;)if(d==0){for(s=1,o=l[0];o>=10;o/=10)s++;for(o=l[0]+=c,c=1;o>=10;o/=10)c++;s!=c&&(e.e++,l[0]==Kn&&(l[0]=1));break}else{if(l[d]+=c,l[d]!=Kn)break;l[d--]=0,c=1}for(s=l.length;l[--s]===0;)l.pop()}return Ie&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function sr(e,t,n){if(!e.isFinite())return x1(e);var r,i=e.e,s=Ft(e.d),o=s.length;return t?(n&&(r=n-o)>0?s=s.charAt(0)+"."+s.slice(1)+si(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+si(-i-1)+s,n&&(r=n-o)>0&&(s+=si(r))):i>=o?(s+=si(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+si(r))):((r=i+1)<o&&(s=s.slice(0,r)+"."+s.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(s+="."),s+=si(r))),s}function Au(e,t){var n=e[0];for(t*=Se;n>=10;n/=10)t++;return t}function La(e,t,n){if(t>r6)throw Ie=!0,n&&(e.precision=n),Error(m1);return be(new e(Ma),t,1,!0)}function nr(e,t,n){if(t>Sl)throw Error(m1);return be(new e(qa),t,n,!0)}function _1(e){var t=e.length-1,n=t*Se+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function si(e){for(var t="";e--;)t+="0";return t}function S1(e,t,n,r){var i,s=new e(1),o=Math.ceil(r/Se+4);for(Ie=!1;;){if(n%2&&(s=s.times(t),ky(s.d,o)&&(i=!0)),n=Xt(n/2),n===0){n=s.d.length-1,i&&s.d[n]===0&&++s.d[n];break}t=t.times(t),ky(t.d,o)}return Ie=!0,s}function Ny(e){return e.d[e.d.length-1]&1}function T1(e,t,n){for(var r,i,s=new e(t[0]),o=0;++o<t.length;){if(i=new e(t[o]),!i.s){s=i;break}r=s.cmp(i),(r===n||r===0&&s.s===n)&&(s=i)}return s}function Tl(e,t){var n,r,i,s,o,c,a,u=0,f=0,l=0,d=e.constructor,y=d.rounding,g=d.precision;if(!e.d||!e.d[0]||e.e>17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(t==null?(Ie=!1,a=g):a=t,c=new d(.03125);e.e>-2;)e=e.times(c),l+=5;for(r=Math.log(At(2,l))/Math.LN10*2+5|0,a+=r,n=s=o=new d(1),d.precision=a;;){if(s=be(s.times(e),a,1),n=n.times(++f),c=o.plus(Je(s,n,a,1)),Ft(c.d).slice(0,a)===Ft(o.d).slice(0,a)){for(i=l;i--;)o=be(o.times(o),a,1);if(t==null)if(u<3&&Go(o.d,a-r,y,u))d.precision=a+=10,n=s=c=new d(1),f=0,u++;else return be(o,d.precision=g,y,Ie=!0);else return d.precision=g,o}o=c}}function ci(e,t){var n,r,i,s,o,c,a,u,f,l,d,y=1,g=10,m=e,E=m.d,_=m.constructor,S=_.rounding,w=_.precision;if(m.s<0||!E||!E[0]||!m.e&&E[0]==1&&E.length==1)return new _(E&&!E[0]?-1/0:m.s!=1?NaN:E?0:m);if(t==null?(Ie=!1,f=w):f=t,_.precision=f+=g,n=Ft(E),r=n.charAt(0),Math.abs(s=m.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)m=m.times(e),n=Ft(m.d),r=n.charAt(0),y++;s=m.e,r>1?(m=new _("0."+n),s++):m=new _(r+"."+n.slice(1))}else return u=La(_,f+2,w).times(s+""),m=ci(new _(r+"."+n.slice(1)),f-g).plus(u),_.precision=w,t==null?be(m,w,S,Ie=!0):m;for(l=m,a=o=m=Je(m.minus(1),m.plus(1),f,1),d=be(m.times(m),f,1),i=3;;){if(o=be(o.times(d),f,1),u=a.plus(Je(o,new _(i),f,1)),Ft(u.d).slice(0,f)===Ft(a.d).slice(0,f))if(a=a.times(2),s!==0&&(a=a.plus(La(_,f+2,w).times(s+""))),a=Je(a,new _(y),f,1),t==null)if(Go(a.d,f-g,S,c))_.precision=f+=g,u=o=m=Je(l.minus(1),l.plus(1),f,1),d=be(m.times(m),f,1),i=c=1;else return be(a,_.precision=w,S,Ie=!0);else return _.precision=w,a;a=u,i+=2}}function x1(e){return String(e.s*e.s/0)}function aa(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;r++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(r,i),t){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%Se,n<0&&(r+=Se),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=Se;r<i;)e.d.push(+t.slice(r,r+=Se));t=t.slice(r),r=Se-t.length}else r-=i;for(;r--;)t+="0";e.d.push(+t),Ie&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function s6(e,t){var n,r,i,s,o,c,a,u,f;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),E1.test(t))return aa(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(e6.test(t))n=16,t=t.toLowerCase();else if(Qv.test(t))n=2;else if(t6.test(t))n=8;else throw Error(di+t);for(s=t.search(/p/i),s>0?(a=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),o=s>=0,r=e.constructor,o&&(t=t.replace(".",""),c=t.length,s=c-s,i=S1(r,new r(n),s,s*2)),u=ca(t,n,Kn),f=u.length-1,s=f;u[s]===0;--s)u.pop();return s<0?new r(e.s*0):(e.e=Au(u,f),e.d=u,Ie=!1,o&&(e=Je(e,i,c*4)),a&&(e=e.times(Math.abs(a)<54?At(2,a):_r.pow(2,a))),Ie=!0,e)}function o6(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:qs(e,2,t,t);n=1.4*Math.sqrt(r),n=n>16?16:n|0,t=t.times(1/vu(5,n)),t=qs(e,2,t,t);for(var i,s=new e(5),o=new e(16),c=new e(20);n--;)i=t.times(t),t=t.times(s.plus(i.times(o.times(i).minus(c))));return t}function qs(e,t,n,r,i){var s,o,c,a,u=e.precision,f=Math.ceil(u/Se);for(Ie=!1,a=n.times(n),c=new e(r);;){if(o=Je(c.times(a),new e(t++*t++),u,1),c=i?r.plus(o):r.minus(o),r=Je(o.times(a),new e(t++*t++),u,1),o=c.plus(r),o.d[f]!==void 0){for(s=f;o.d[s]===c.d[s]&&s--;);if(s==-1)break}s=c,c=r,r=o,o=s}return Ie=!0,o.d.length=f+1,o}function vu(e,t){for(var n=e;--t;)n*=e;return n}function A1(e,t){var n,r=t.s<0,i=nr(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return vr=r?4:1,t;if(n=t.divToInt(i),n.isZero())vr=r?3:2;else{if(t=t.minus(n.times(i)),t.lte(s))return vr=Ny(n)?r?2:3:r?4:1,t;vr=Ny(n)?r?1:4:r?3:2}return t.minus(i).abs()}function Ch(e,t,n,r){var i,s,o,c,a,u,f,l,d,y=e.constructor,g=n!==void 0;if(g?(gn(n,1,mi),r===void 0?r=y.rounding:gn(r,0,8)):(n=y.precision,r=y.rounding),!e.isFinite())f=x1(e);else{for(f=sr(e),o=f.indexOf("."),g?(i=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):i=t,o>=0&&(f=f.replace(".",""),d=new y(1),d.e=f.length-o,d.d=ca(sr(d),10,i),d.e=d.d.length),l=ca(f,10,i),s=a=l.length;l[--a]==0;)l.pop();if(!l[0])f=g?"0p+0":"0";else{if(o<0?s--:(e=new y(e),e.d=l,e.e=s,e=Je(e,d,n,r,0,i),l=e.d,s=e.e,u=g1),o=l[n],c=i/2,u=u||l[n+1]!==void 0,u=r<4?(o!==void 0||u)&&(r===0||r===(e.s<0?3:2)):o>c||o===c&&(r===4||u||r===6&&l[n-1]&1||r===(e.s<0?8:7)),l.length=n,u)for(;++l[--n]>i-1;)l[n]=0,n||(++s,l.unshift(1));for(a=l.length;!l[a-1];--a);for(o=0,f="";o<a;o++)f+=El.charAt(l[o]);if(g){if(a>1)if(t==16||t==8){for(o=t==16?4:3,--a;a%o;a++)f+="0";for(l=ca(f,i,t),a=l.length;!l[a-1];--a);for(o=1,f="1.";o<a;o++)f+=El.charAt(l[o])}else f=f.charAt(0)+"."+f.slice(1);f=f+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)f="0"+f;f="0."+f}else if(++s>a)for(s-=a;s--;)f+="0";else s<a&&(f=f.slice(0,s)+"."+f.slice(s))}f=(t==16?"0x":t==2?"0b":t==8?"0o":"")+f}return e.s<0?"-"+f:f}function ky(e,t){if(e.length>t)return e.length=t,!0}function c6(e){return new this(e).abs()}function a6(e){return new this(e).acos()}function u6(e){return new this(e).acosh()}function f6(e,t){return new this(e).plus(t)}function l6(e){return new this(e).asin()}function h6(e){return new this(e).asinh()}function d6(e){return new this(e).atan()}function p6(e){return new this(e).atanh()}function y6(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,s=r+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=nr(this,s,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?nr(this,r,i):new this(0),n.s=e.s):!e.d||t.isZero()?(n=nr(this,s,1).times(.5),n.s=e.s):t.s<0?(this.precision=s,this.rounding=1,n=this.atan(Je(e,t,s,1)),t=nr(this,s,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(Je(e,t,s,1)),n}function g6(e){return new this(e).cbrt()}function m6(e){return be(e=new this(e),e.e+1,2)}function w6(e,t,n){return new this(e).clamp(t,n)}function b6(e){if(!e||typeof e!="object")throw Error(xu+"Object expected");var t,n,r,i=e.defaults===!0,s=["precision",1,mi,"rounding",0,8,"toExpNeg",-Es,0,"toExpPos",0,Es,"maxE",0,Es,"minE",-Es,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(n=s[t],i&&(this[n]=_l[n]),(r=e[n])!==void 0)if(Xt(r)===r&&r>=s[t+1]&&r<=s[t+2])this[n]=r;else throw Error(di+n+": "+r);if(n="crypto",i&&(this[n]=_l[n]),(r=e[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(w1);else this[n]=!1;else throw Error(di+n+": "+r);return this}function E6(e){return new this(e).cos()}function _6(e){return new this(e).cosh()}function v1(e){var t,n,r;function i(s){var o,c,a,u=this;if(!(u instanceof i))return new i(s);if(u.constructor=i,Py(s)){u.s=s.s,Ie?!s.d||s.e>i.maxE?(u.e=NaN,u.d=null):s.e<i.minE?(u.e=0,u.d=[0]):(u.e=s.e,u.d=s.d.slice()):(u.e=s.e,u.d=s.d?s.d.slice():s.d);return}if(a=typeof s,a==="number"){if(s===0){u.s=1/s<0?-1:1,u.e=0,u.d=[0];return}if(s<0?(s=-s,u.s=-1):u.s=1,s===~~s&&s<1e7){for(o=0,c=s;c>=10;c/=10)o++;Ie?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[s]):(u.e=o,u.d=[s]);return}if(s*0!==0){s||(u.s=NaN),u.e=NaN,u.d=null;return}return aa(u,s.toString())}if(a==="string")return(c=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(c===43&&(s=s.slice(1)),u.s=1),E1.test(s)?aa(u,s):s6(u,s);if(a==="bigint")return s<0?(s=-s,u.s=-1):u.s=1,aa(u,s.toString());throw Error(di+s)}if(i.prototype=se,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=b6,i.clone=v1,i.isDecimal=Py,i.abs=c6,i.acos=a6,i.acosh=u6,i.add=f6,i.asin=l6,i.asinh=h6,i.atan=d6,i.atanh=p6,i.atan2=y6,i.cbrt=g6,i.ceil=m6,i.clamp=w6,i.cos=E6,i.cosh=_6,i.div=S6,i.exp=T6,i.floor=x6,i.hypot=A6,i.ln=v6,i.log=I6,i.log10=B6,i.log2=O6,i.max=N6,i.min=k6,i.mod=P6,i.mul=R6,i.pow=U6,i.random=C6,i.round=H6,i.sign=F6,i.sin=M6,i.sinh=q6,i.sqrt=L6,i.sub=V6,i.sum=$6,i.tan=D6,i.tanh=j6,i.trunc=K6,e===void 0&&(e={}),e&&e.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return i.config(e),i}function S6(e,t){return new this(e).div(t)}function T6(e){return new this(e).exp()}function x6(e){return be(e=new this(e),e.e+1,3)}function A6(){var e,t,n=new this(0);for(Ie=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return Ie=!0,new this(1/0);n=t}return Ie=!0,n.sqrt()}function Py(e){return e instanceof _r||e&&e.toStringTag===b1||!1}function v6(e){return new this(e).ln()}function I6(e,t){return new this(e).log(t)}function O6(e){return new this(e).log(2)}function B6(e){return new this(e).log(10)}function N6(){return T1(this,arguments,-1)}function k6(){return T1(this,arguments,1)}function P6(e,t){return new this(e).mod(t)}function R6(e,t){return new this(e).mul(t)}function U6(e,t){return new this(e).pow(t)}function C6(e){var t,n,r,i,s=0,o=new this(1),c=[];if(e===void 0?e=this.precision:gn(e,1,mi),r=Math.ceil(e/Se),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));s<r;)i=t[s],i>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:c[s++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);s<r;)i=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,s):(c.push(i%1e7),s+=4);s=r/4}else throw Error(w1);else for(;s<r;)c[s++]=Math.random()*1e7|0;for(r=c[--s],e%=Se,r&&e&&(i=At(10,Se-e),c[s]=(r/i|0)*i);c[s]===0;s--)c.pop();if(s<0)n=0,c=[0];else{for(n=-1;c[0]===0;n-=Se)c.shift();for(r=1,i=c[0];i>=10;i/=10)r++;r<Se&&(n-=Se-r)}return o.e=n,o.d=c,o}function H6(e){return be(e=new this(e),e.e+1,this.rounding)}function F6(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function M6(e){return new this(e).sin()}function q6(e){return new this(e).sinh()}function L6(e){return new this(e).sqrt()}function V6(e,t){return new this(e).sub(t)}function $6(){var e=0,t=arguments,n=new this(t[e]);for(Ie=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return Ie=!0,be(n,this.precision,this.rounding)}function D6(e){return new this(e).tan()}function j6(e){return new this(e).tanh()}function K6(e){return be(e=new this(e),e.e+1,1)}se[Symbol.for("nodejs.util.inspect.custom")]=se.toString;se[Symbol.toStringTag]="Decimal";var _r=se.constructor=v1(_l);Ma=new _r(Ma);qa=new _r(qa);const G6=({IDL:e})=>{const t=e.Record({exchange_id:e.Text,reason:e.Text}),n=e.Variant({Ok:e.Null,Err:e.Text}),r=e.Variant({P2WPKH:e.Null,OpReturn:e.Nat64,P2SH:e.Null,P2TR:e.Null}),i=e.Record({input_types:e.Vec(r),pool_address:e.Vec(e.Text),output_types:e.Vec(r)}),s=e.Variant({Ok:e.Nat64,Err:e.Text}),o=e.Record({user_id:e.Principal}),c=e.Record({canister_version:e.Opt(e.Nat64),canister_id:e.Principal}),a=e.Variant({from_user:o,from_canister:c}),u=e.Record({controllers:e.Vec(e.Principal)}),f=e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),l=e.Record({mode:f,module_hash:e.Vec(e.Nat8)}),d=e.Record({canister_version:e.Nat64,taken_at_timestamp:e.Nat64,snapshot_id:e.Vec(e.Nat8)}),y=e.Variant({creation:u,code_deployment:l,load_snapshot:d,controllers_change:u,code_uninstall:e.Null}),g=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:a,details:y}),m=e.Record({controllers:e.Vec(e.Principal),module_hash:e.Opt(e.Vec(e.Nat8)),recent_changes:e.Vec(g),total_num_changes:e.Nat64}),E=e.Variant({Ok:m,Err:e.Text}),_=e.Record({exchange_id:e.Text,pool_address:e.Text,pool_key:e.Text}),S=e.Variant({All:e.Null,ByTxid:e.Text,ByStatusCode:e.Text,ByAddress:e.Text,BySecondsPassed:e.Nat64}),w=e.Variant({Ok:e.Text,Err:e.Text}),T=e.Record({result:w,exchange_id:e.Text,maybe_return_time:e.Opt(e.Text),calling_method:e.Text,calling_args:e.Text,pool_address:e.Text,calling_time:e.Text}),O=e.Record({rollback_results:e.Vec(e.Text),invoke_args:e.Text,invoke_time:e.Text,finalized_time:e.Opt(e.Text),confirmed_time:e.Opt(e.Text),execution_steps:e.Vec(T),processing_result:w,broadcasted_time:e.Opt(e.Text)}),A=e.Record({block_hash:e.Text,block_height:e.Nat32}),R=e.Record({processing_results:e.Vec(e.Text),block_basic:A,txids:e.Vec(e.Text),block_time:e.Text,received_time:e.Text}),M=e.Variant({Abandoned:e.Record({reason:e.Text}),Active:e.Null,Halted:e.Record({reason:e.Text})}),v=e.Record({status:M,exchange_id:e.Text,canister_id:e.Principal,utxo_proof_enabled:e.Bool,client_canisters:e.Vec(e.Principal)}),U=e.Record({rollback_results:e.Vec(e.Text),txid:e.Text,received_time:e.Text,reason:e.Text}),L=e.Variant({mainnet:e.Null,regtest:e.Null,testnet:e.Null}),K=e.Record({min_seconds_of_unconfirmed_tx_in_pool_for_raising_fee_rate:e.Nat32,exchange_registry_principal:e.Principal,max_input_count_of_psbt:e.Nat32,min_tx_confirmations:e.Nat32,mempool_connector_principal:e.Principal,max_unconfirmed_tx_count_in_pool:e.Nat32,min_btc_amount_for_utxo:e.Nat64,rune_indexer_principal:e.Principal,max_intentions_per_invoke:e.Nat32,mempool_connector_public_key:e.Text,max_received_blocks_count:e.Nat32,min_unconfirmed_tx_count_in_pool_for_raising_fee_rate:e.Nat32,bitcoin_network:L}),H=e.Record({low:e.Nat64,high:e.Nat64,update_time:e.Text,medium:e.Nat64}),$=e.Record({last_block:e.Opt(A),pending_tx_count:e.Nat64,mempool_tx_fee_rate:H,invoke_paused:e.Bool,concurrent_invoke_status:e.Text,last_block_time:e.Opt(e.Tuple(e.Nat64,e.Text)),failed_new_block_height:e.Opt(e.Tuple(e.Nat32,e.Text))}),P=e.Variant({Error:e.Null,AvailableUnconfirmed:e.Null,InvalidTxid:e.Null,InvalidVout:e.Null,SpentInMempool:e.Null,SpentOnChain:e.Null,AvailableConfirmed:e.Null}),D=e.Record({status:P,value:e.Opt(e.Text),txid:e.Text,vout:e.Nat32,ancestors:e.Opt(e.Nat32),address:e.Opt(e.Text)}),F=e.Record({id:e.Text,value:e.Nat}),x=e.Record({coins:e.Vec(F),sats:e.Nat64,txid:e.Text,vout:e.Nat32}),B=e.Record({status:e.Opt(D),coins:e.Vec(F),utxo:x,is_signed:e.Bool,owner_pubkey:e.Opt(e.Text),owner_address:e.Text}),q=e.Record({coins_in_inputs:e.Vec(B),txid:e.Text,signed_address_coins:e.Vec(e.Tuple(e.Text,e.Vec(F))),address_coins:e.Vec(e.Tuple(e.Text,e.Vec(F)))}),N=e.Record({is_op_return:e.Bool,utxo:x,owner_address:e.Opt(e.Text)}),V=e.Record({burned_coins:e.Vec(F),coins_in_outputs:e.Vec(N),address_coins:e.Vec(e.Tuple(e.Text,e.Vec(F)))}),G=e.Record({coin:F,from:e.Text}),X=e.Record({to:e.Text,coin:F}),Y=e.Record({input_coins:e.Vec(G),output_coins:e.Vec(X),action:e.Text,exchange_id:e.Text,pool_utxo_spent:e.Vec(e.Text),action_params:e.Text,nonce:e.Nat64,pool_address:e.Text,pool_utxo_received:e.Vec(x)}),ce=e.Record({tx_fee_in_sats:e.Nat64,initiator_address:e.Text,intentions:e.Vec(Y)}),ue=e.Record({applied_fee_rate:e.Nat64,pool_addresses:e.Vec(e.Text),coins_in_inputs:q,txid:e.Text,estimated_min_tx_fee:e.Nat64,actual_tx_fee:e.Nat64,coins_in_outputs:V,tx_vsize:e.Nat64,intention_set:ce,user_coins_in_inputs:e.Vec(F),initially_signed_addresses:e.Vec(e.Text)}),te=e.Variant({Confirmed:e.Nat32,Rejected:e.Text,Pending:e.Null}),Z=e.Record({status:e.Opt(te),invoke_log:O,included_block:e.Opt(A),sent_tx_hex:e.Text}),ae=e.Variant({Failed:O,NotFound:e.Null,Succeeded:Z}),we=e.Record({maybe_rune:e.Opt(F),value:e.Nat64,script_pubkey_hex:e.Text,outpoint:e.Text}),ye=e.Record({client_info:e.Opt(e.Text),intention_set:ce,initiator_utxo_proof:e.Vec(e.Nat8),psbt_hex:e.Text}),J=e.Record({block_hash:e.Text,block_timestamp:e.Nat64,tx_ids:e.Vec(e.Text),block_height:e.Nat32}),le=e.Variant({Ok:e.Vec(e.Text),Err:e.Text}),ve=e.Record({exchange_canister:e.Principal,exchange_id:e.Text,utxo_proof_enabled:e.Bool,client_canisters:e.Vec(e.Principal)}),Le=e.Record({txid:e.Text,reason_code:e.Text,reason:e.Text}),nt=e.Record({txid:e.Text,timestamp:e.Nat64,block:A}),ft=e.Record({low:e.Nat64,high:e.Nat64,medium:e.Nat64});return e.Service({abandon_exchange:e.Func([t],[n],[]),clear_exchange_pools:e.Func([],[n],[]),clear_failed_invoke_logs:e.Func([e.Opt(e.Nat64),e.Vec(e.Text)],[n],[]),clear_last_block:e.Func([],[n],[]),clear_rejected_txs:e.Func([],[n],[]),clear_txs_with_min_confirmations:e.Func([e.Nat32],[n],[]),delete_tx_detail:e.Func([e.Text],[n],[]),delete_used_outpoints:e.Func([e.Text],[n],[]),estimate_min_tx_fee:e.Func([i],[s],["query"]),get_canister_info:e.Func([e.Nat64],[E],[]),get_exchange_pools:e.Func([],[e.Vec(_)],["query"]),get_failed_invoke_logs:e.Func([S],[e.Vec(e.Tuple(e.Text,O))],["query"]),get_last_sent_txs:e.Func([],[e.Vec(e.Tuple(e.Text,e.Text,e.Opt(e.Nat32)))],["query"]),get_received_blocks:e.Func([e.Opt(e.Bool)],[e.Vec(R)],["query"]),get_registered_exchanges:e.Func([e.Opt(M)],[e.Vec(v)],["query"]),get_rejected_txs:e.Func([],[e.Vec(U)],["query"]),get_settings:e.Func([],[K],["query"]),get_status:e.Func([],[$],["query"]),get_tx_execution_context_view:e.Func([e.Text],[e.Opt(ue)],["query"]),get_tx_execution_result:e.Func([e.Text],[ae],["query"]),get_tx_for_outpoint:e.Func([e.Text],[e.Opt(Z)],["query"]),get_tx_queue_of_pool:e.Func([e.Text],[e.Vec(e.Tuple(e.Text,e.Opt(e.Nat32)))],["query"]),get_tx_sent:e.Func([e.Text],[e.Opt(Z)],["query"]),get_used_outpoints:e.Func([e.Opt(e.Text)],[e.Vec(e.Tuple(e.Text,e.Text))],["query"]),get_zero_confirmed_tx_count_of_pool:e.Func([e.Text],[e.Nat32],["query"]),get_zero_confirmed_txs:e.Func([e.Opt(e.Text)],[e.Vec(e.Text)],["query"]),get_zero_confirmed_utxos_of_address:e.Func([e.Text],[e.Vec(we)],["query"]),init_status_code_message:e.Func([],[n],[]),inspect_status_code:e.Func([e.Text],[e.Text],["query"]),invoke:e.Func([ye],[w],[]),new_block_detected:e.Func([J],[n],[]),notify_exchange_for_blocks_from_height:e.Func([e.Text,e.Nat32],[le],[]),notify_exchanges_for_block:e.Func([e.Vec(e.Text),A,e.Nat64,e.Vec(e.Text)],[le],[]),pause_invoke:e.Func([],[n],[]),reapply_tx:e.Func([e.Text],[n],[]),register_exchange:e.Func([ve],[n],[]),reject_tx:e.Func([Le],[n],[]),resume_invoke:e.Func([],[n],[]),rollback_tx:e.Func([e.Text],[le],[]),save_included_block_for_tx:e.Func([nt],[n],[]),set_bitcoin_network:e.Func([L],[n],[]),set_exchange_registry_principal:e.Func([e.Principal],[n],[]),set_max_input_count_of_psbt:e.Func([e.Nat32],[n],[]),set_max_intentions_per_invoke:e.Func([e.Nat32],[n],[]),set_max_received_blocks_count:e.Func([e.Nat32],[n],[]),set_max_unconfirmed_tx_count_in_pool:e.Func([e.Nat32],[n],[]),set_mempool_connector_principal:e.Func([e.Principal],[n],[]),set_mempool_connector_public_key:e.Func([e.Text],[n],[]),set_min_btc_amount_for_utxo:e.Func([e.Nat64],[n],[]),set_min_tx_confirmations:e.Func([e.Nat32],[n],[]),set_rune_indexer_principal:e.Func([e.Principal],[n],[]),set_tx_fee_per_vbyte:e.Func([ft],[n],[]),unhalt_exchange:e.Func([e.Text],[n],[]),version:e.Func([],[e.Text],["query"])})};class I1{maestro;config;exchange;orchestrator;constructor(t){this.config=t;const n=t.network===Ps.Testnet,r=n?"https://xbt-testnet.gomaestro-api.org/v0":"https://xbt-mainnet.gomaestro-api.org/v0";this.maestro=new ix({baseUrl:r,apiKey:t.maestroApiKey});const i="https://icp0.io";this.exchange=Fa.createActor(t.exchangeIdlFactory,{agent:Ar.createSync({host:i,retryTimes:50,verifyQuerySignatures:!1}),canisterId:t.exchangeCanisterId}),this.orchestrator=Fa.createActor(G6,{agent:Ar.createSync({host:i,retryTimes:50,verifyQuerySignatures:!1}),canisterId:n?DA:$A})}async filterSpentUtxos(t,n){const r=await this.orchestrator.get_used_outpoints([t]);return n.filter(({txid:i,vout:s})=>r.findIndex(([o])=>`${i}:${s}`===o)<0)}async getPendingBtcUtxos(t){const n=await this.orchestrator.get_zero_confirmed_utxos_of_address(t),r=Mi(t);return n.filter(({maybe_rune:i})=>!i.length).map(({value:i,script_pubkey_hex:s,outpoint:o})=>{const[c,a]=o.split(":");return{txid:c,vout:Number(a),satoshis:i.toString(),scriptPk:s,addressType:r,address:t,runes:[]}})}async getPendingRuneUtxos(t){const n=await this.orchestrator.get_zero_confirmed_utxos_of_address(t),r=Mi(t);return n.filter(({maybe_rune:i})=>i.length).map(({value:i,script_pubkey_hex:s,outpoint:o,maybe_rune:c})=>{const[a,u]=o.split(":"),f=c[0];return{txid:a,vout:Number(u),satoshis:i.toString(),scriptPk:s,addressType:r,address:t,runes:f?[{id:f.id,amount:f.value.toString()}]:[]}})}async getBtcUtxos(t,n=!0){let r=null;const i=[],s=await this.getPendingBtcUtxos(t);do{const c=await this.maestro.utxosByAddress(t,r,n);i.push(...c.data),r=c.next_cursor}while(r!==null);const o=i.map(({txid:c,vout:a,runes:u,satoshis:f,script_pubkey:l,address:d})=>({txid:c,vout:a,address:d,runes:u.map(({rune_id:y,amount:g})=>{const m=(g.split(".")[1]??"").length,E=new _r(g).mul(10**m).toFixed(0);return{id:y,amount:E}}),satoshis:f,scriptPk:l}));return this.filterSpentUtxos(t,o.concat(s))}async getRuneUtxos(t,n){let r=null;const i=[],s=await this.getPendingRuneUtxos(t);do{const c=await this.maestro.runeUtxosByAddress(t,n,r);i.push(...c.data),r=c.next_cursor}while(r!==null);const o=i.map(({txid:c,vout:a,runes:u,satoshis:f})=>{const l=Nh(t,this.config.network);return{txid:c,vout:a,address:t,runes:u.map(({rune_id:d,amount:y})=>{const g=(y.split(".")[1]??"").length,m=new _r(y).mul(10**g).toFixed(0);return{id:d,amount:m}}),satoshis:f,scriptPk:Oh(l)}});return this.filterSpentUtxos(t,o.concat(s))}async searchRunes(t){const n=this.config.network===Ps.Testnet?KA:jA,r=Jv`
132
+ */var Es=9e15,mi=1e9,El="0123456789abcdef",Ma="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",qa="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",_l={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Es,maxE:Es,crypto:!1},g1,vr,Ie=!0,xu="[DecimalError] ",di=xu+"Invalid argument: ",m1=xu+"Precision limit exceeded",w1=xu+"crypto unavailable",b1="[object Decimal]",Xt=Math.floor,At=Math.pow,Qv=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,e6=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,t6=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,E1=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Kn=1e7,Se=7,n6=9007199254740991,r6=Ma.length-1,Sl=qa.length-1,se={toStringTag:b1};se.absoluteValue=se.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),be(e)};se.ceil=function(){return be(new this.constructor(this),this.e+1,2)};se.clampedTo=se.clamp=function(e,t){var n,r=this,i=r.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(di+t);return n=r.cmp(e),n<0?e:r.cmp(t)>0?t:new i(r)};se.comparedTo=se.cmp=function(e){var t,n,r,i,s=this,o=s.d,c=(e=new s.constructor(e)).d,a=s.s,u=e.s;if(!o||!c)return!a||!u?NaN:a!==u?a:o===c?0:!o^a<0?1:-1;if(!o[0]||!c[0])return o[0]?a:c[0]?-u:0;if(a!==u)return a;if(s.e!==e.e)return s.e>e.e^a<0?1:-1;for(r=o.length,i=c.length,t=0,n=r<i?r:i;t<n;++t)if(o[t]!==c[t])return o[t]>c[t]^a<0?1:-1;return r===i?0:r>i^a<0?1:-1};se.cosine=se.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+Se,r.rounding=1,n=i6(r,A1(r,n)),r.precision=e,r.rounding=t,be(vr==2||vr==3?n.neg():n,e,t,!0)):new r(1):new r(NaN)};se.cubeRoot=se.cbrt=function(){var e,t,n,r,i,s,o,c,a,u,f=this,l=f.constructor;if(!f.isFinite()||f.isZero())return new l(f);for(Ie=!1,s=f.s*At(f.s*f,1/3),!s||Math.abs(s)==1/0?(n=Ft(f.d),e=f.e,(s=(e-n.length+1)%3)&&(n+=s==1||s==-2?"0":"00"),s=At(n,1/3),e=Xt((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?n="5e"+e:(n=s.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),r=new l(n),r.s=f.s):r=new l(s.toString()),o=(e=l.precision)+3;;)if(c=r,a=c.times(c).times(c),u=a.plus(f),r=Je(u.plus(f).times(c),u.plus(a),o+2,1),Ft(c.d).slice(0,o)===(n=Ft(r.d)).slice(0,o))if(n=n.slice(o-3,o+1),n=="9999"||!i&&n=="4999"){if(!i&&(be(c,e+1,0),c.times(c).times(c).eq(f))){r=c;break}o+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(be(r,e+1,1),t=!r.times(r).times(r).eq(f));break}return Ie=!0,be(r,e,l.rounding,t)};se.decimalPlaces=se.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-Xt(this.e/Se))*Se,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n};se.dividedBy=se.div=function(e){return Je(this,new this.constructor(e))};se.dividedToIntegerBy=se.divToInt=function(e){var t=this,n=t.constructor;return be(Je(t,new n(e),0,1,1),n.precision,n.rounding)};se.equals=se.eq=function(e){return this.cmp(e)===0};se.floor=function(){return be(new this.constructor(this),this.e+1,3)};se.greaterThan=se.gt=function(e){return this.cmp(e)>0};se.greaterThanOrEqualTo=se.gte=function(e){var t=this.cmp(e);return t==1||t===0};se.hyperbolicCosine=se.cosh=function(){var e,t,n,r,i,s=this,o=s.constructor,c=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return c;n=o.precision,r=o.rounding,o.precision=n+Math.max(s.e,s.sd())+4,o.rounding=1,i=s.d.length,i<32?(e=Math.ceil(i/3),t=(1/vu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=qs(o,1,s.times(t),new o(1),!0);for(var a,u=e,f=new o(8);u--;)a=s.times(s),s=c.minus(a.times(f.minus(a.times(f))));return be(s,o.precision=n,o.rounding=r,!0)};se.hyperbolicSine=se.sinh=function(){var e,t,n,r,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(t=s.precision,n=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,r=i.d.length,r<3)i=qs(s,2,i,i,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:e|0,i=i.times(1/vu(5,e)),i=qs(s,2,i,i,!0);for(var o,c=new s(5),a=new s(16),u=new s(20);e--;)o=i.times(i),i=i.times(c.plus(o.times(a.times(o).plus(u))))}return s.precision=t,s.rounding=n,be(i,t,n,!0)};se.hyperbolicTangent=se.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,Je(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)};se.inverseCosine=se.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return n!==-1?n===0?e.isNeg()?nr(t,r,i):new t(0):new t(NaN):e.isZero()?nr(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=r,t.rounding=i,e.times(2))};se.inverseHyperbolicCosine=se.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,Ie=!1,n=n.times(n).minus(1).sqrt().plus(n),Ie=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)};se.inverseHyperbolicSine=se.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,Ie=!1,n=n.times(n).plus(1).sqrt().plus(n),Ie=!0,r.precision=e,r.rounding=t,n.ln())};se.inverseHyperbolicTangent=se.atanh=function(){var e,t,n,r,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=s.precision,t=s.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?be(new s(i),e,t,!0):(s.precision=n=r-i.e,i=Je(i.plus(1),new s(1).minus(i),n+e,1),s.precision=e+4,s.rounding=1,i=i.ln(),s.precision=e,s.rounding=t,i.times(.5))):new s(NaN)};se.inverseSine=se.asin=function(){var e,t,n,r,i=this,s=i.constructor;return i.isZero()?new s(i):(t=i.abs().cmp(1),n=s.precision,r=s.rounding,t!==-1?t===0?(e=nr(s,n+4,r).times(.5),e.s=i.s,e):new s(NaN):(s.precision=n+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=n,s.rounding=r,i.times(2)))};se.inverseTangent=se.atan=function(){var e,t,n,r,i,s,o,c,a,u=this,f=u.constructor,l=f.precision,d=f.rounding;if(u.isFinite()){if(u.isZero())return new f(u);if(u.abs().eq(1)&&l+4<=Sl)return o=nr(f,l+4,d).times(.25),o.s=u.s,o}else{if(!u.s)return new f(NaN);if(l+4<=Sl)return o=nr(f,l+4,d).times(.5),o.s=u.s,o}for(f.precision=c=l+10,f.rounding=1,n=Math.min(28,c/Se+2|0),e=n;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(Ie=!1,t=Math.ceil(c/Se),r=1,a=u.times(u),o=new f(u),i=u;e!==-1;)if(i=i.times(a),s=o.minus(i.div(r+=2)),i=i.times(a),o=s.plus(i.div(r+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===s.d[e]&&e--;);return n&&(o=o.times(2<<n-1)),Ie=!0,be(o,f.precision=l,f.rounding=d,!0)};se.isFinite=function(){return!!this.d};se.isInteger=se.isInt=function(){return!!this.d&&Xt(this.e/Se)>this.d.length-2};se.isNaN=function(){return!this.s};se.isNegative=se.isNeg=function(){return this.s<0};se.isPositive=se.isPos=function(){return this.s>0};se.isZero=function(){return!!this.d&&this.d[0]===0};se.lessThan=se.lt=function(e){return this.cmp(e)<0};se.lessThanOrEqualTo=se.lte=function(e){return this.cmp(e)<1};se.logarithm=se.log=function(e){var t,n,r,i,s,o,c,a,u=this,f=u.constructor,l=f.precision,d=f.rounding,y=5;if(e==null)e=new f(10),t=!0;else{if(e=new f(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new f(NaN);t=e.eq(10)}if(n=u.d,u.s<0||!n||!n[0]||u.eq(1))return new f(n&&!n[0]?-1/0:u.s!=1?NaN:n?0:1/0);if(t)if(n.length>1)s=!0;else{for(i=n[0];i%10===0;)i/=10;s=i!==1}if(Ie=!1,c=l+y,o=ci(u,c),r=t?La(f,c+10):ci(e,c),a=Je(o,r,c,1),Go(a.d,i=l,d))do if(c+=10,o=ci(u,c),r=t?La(f,c+10):ci(e,c),a=Je(o,r,c,1),!s){+Ft(a.d).slice(i+1,i+15)+1==1e14&&(a=be(a,l+1,0));break}while(Go(a.d,i+=10,d));return Ie=!0,be(a,l,d)};se.minus=se.sub=function(e){var t,n,r,i,s,o,c,a,u,f,l,d,y=this,g=y.constructor;if(e=new g(e),!y.d||!e.d)return!y.s||!e.s?e=new g(NaN):y.d?e.s=-e.s:e=new g(e.d||y.s!==e.s?y:NaN),e;if(y.s!=e.s)return e.s=-e.s,y.plus(e);if(u=y.d,d=e.d,c=g.precision,a=g.rounding,!u[0]||!d[0]){if(d[0])e.s=-e.s;else if(u[0])e=new g(y);else return new g(a===3?-0:0);return Ie?be(e,c,a):e}if(n=Xt(e.e/Se),f=Xt(y.e/Se),u=u.slice(),s=f-n,s){for(l=s<0,l?(t=u,s=-s,o=d.length):(t=d,n=f,o=u.length),r=Math.max(Math.ceil(c/Se),o)+2,s>r&&(s=r,t.length=1),t.reverse(),r=s;r--;)t.push(0);t.reverse()}else{for(r=u.length,o=d.length,l=r<o,l&&(o=r),r=0;r<o;r++)if(u[r]!=d[r]){l=u[r]<d[r];break}s=0}for(l&&(t=u,u=d,d=t,e.s=-e.s),o=u.length,r=d.length-o;r>0;--r)u[o++]=0;for(r=d.length;r>s;){if(u[--r]<d[r]){for(i=r;i&&u[--i]===0;)u[i]=Kn-1;--u[i],u[r]+=Kn}u[r]-=d[r]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(e.d=u,e.e=Au(u,n),Ie?be(e,c,a):e):new g(a===3?-0:0)};se.modulo=se.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?be(new r(n),r.precision,r.rounding):(Ie=!1,r.modulo==9?(t=Je(n,e.abs(),0,3,1),t.s*=e.s):t=Je(n,e,0,r.modulo,1),t=t.times(e),Ie=!0,n.minus(t))};se.naturalExponential=se.exp=function(){return Tl(this)};se.naturalLogarithm=se.ln=function(){return ci(this)};se.negated=se.neg=function(){var e=new this.constructor(this);return e.s=-e.s,be(e)};se.plus=se.add=function(e){var t,n,r,i,s,o,c,a,u,f,l=this,d=l.constructor;if(e=new d(e),!l.d||!e.d)return!l.s||!e.s?e=new d(NaN):l.d||(e=new d(e.d||l.s===e.s?l:NaN)),e;if(l.s!=e.s)return e.s=-e.s,l.minus(e);if(u=l.d,f=e.d,c=d.precision,a=d.rounding,!u[0]||!f[0])return f[0]||(e=new d(l)),Ie?be(e,c,a):e;if(s=Xt(l.e/Se),r=Xt(e.e/Se),u=u.slice(),i=s-r,i){for(i<0?(n=u,i=-i,o=f.length):(n=f,r=s,o=u.length),s=Math.ceil(c/Se),o=s>o?s+1:o+1,i>o&&(i=o,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(o=u.length,i=f.length,o-i<0&&(i=o,n=f,f=u,u=n),t=0;i;)t=(u[--i]=u[i]+f[i]+t)/Kn|0,u[i]%=Kn;for(t&&(u.unshift(t),++r),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Au(u,r),Ie?be(e,c,a):e};se.precision=se.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(di+e);return n.d?(t=_1(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t};se.round=function(){var e=this,t=e.constructor;return be(new t(e),e.e+1,t.rounding)};se.sine=se.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+Se,r.rounding=1,n=o6(r,A1(r,n)),r.precision=e,r.rounding=t,be(vr>2?n.neg():n,e,t,!0)):new r(NaN)};se.squareRoot=se.sqrt=function(){var e,t,n,r,i,s,o=this,c=o.d,a=o.e,u=o.s,f=o.constructor;if(u!==1||!c||!c[0])return new f(!u||u<0&&(!c||c[0])?NaN:c?o:1/0);for(Ie=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=Ft(c),(t.length+a)%2==0&&(t+="0"),u=Math.sqrt(t),a=Xt((a+1)/2)-(a<0||a%2),u==1/0?t="5e"+a:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+a),r=new f(t)):r=new f(u.toString()),n=(a=f.precision)+3;;)if(s=r,r=s.plus(Je(o,s,n+2,1)).times(.5),Ft(s.d).slice(0,n)===(t=Ft(r.d)).slice(0,n))if(t=t.slice(n-3,n+1),t=="9999"||!i&&t=="4999"){if(!i&&(be(s,a+1,0),s.times(s).eq(o))){r=s;break}n+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(be(r,a+1,1),e=!r.times(r).eq(o));break}return Ie=!0,be(r,a,f.rounding,e)};se.tangent=se.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,n=n.sin(),n.s=1,n=Je(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,be(vr==2||vr==4?n.neg():n,e,t,!0)):new r(NaN)};se.times=se.mul=function(e){var t,n,r,i,s,o,c,a,u,f=this,l=f.constructor,d=f.d,y=(e=new l(e)).d;if(e.s*=f.s,!d||!d[0]||!y||!y[0])return new l(!e.s||d&&!d[0]&&!y||y&&!y[0]&&!d?NaN:!d||!y?e.s/0:e.s*0);for(n=Xt(f.e/Se)+Xt(e.e/Se),a=d.length,u=y.length,a<u&&(s=d,d=y,y=s,o=a,a=u,u=o),s=[],o=a+u,r=o;r--;)s.push(0);for(r=u;--r>=0;){for(t=0,i=a+r;i>r;)c=s[i]+y[r]*d[i-r-1]+t,s[i--]=c%Kn|0,t=c/Kn|0;s[i]=(s[i]+t)%Kn|0}for(;!s[--o];)s.pop();return t?++n:s.shift(),e.d=s,e.e=Au(s,n),Ie?be(e,l.precision,l.rounding):e};se.toBinary=function(e,t){return Ch(this,2,e,t)};se.toDecimalPlaces=se.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(gn(e,0,mi),t===void 0?t=r.rounding:gn(t,0,8),be(n,e+n.e+1,t))};se.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=sr(r,!0):(gn(e,0,mi),t===void 0?t=i.rounding:gn(t,0,8),r=be(new i(r),e+1,t),n=sr(r,!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n};se.toFixed=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?n=sr(i):(gn(e,0,mi),t===void 0?t=s.rounding:gn(t,0,8),r=be(new s(i),e+i.e+1,t),n=sr(r,!1,e+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n};se.toFraction=function(e){var t,n,r,i,s,o,c,a,u,f,l,d,y=this,g=y.d,m=y.constructor;if(!g)return new m(y);if(u=n=new m(1),r=a=new m(0),t=new m(r),s=t.e=_1(g)-y.e-1,o=s%Se,t.d[0]=At(10,o<0?Se+o:o),e==null)e=s>0?t:u;else{if(c=new m(e),!c.isInt()||c.lt(u))throw Error(di+c);e=c.gt(t)?s>0?t:u:c}for(Ie=!1,c=new m(Ft(g)),f=m.precision,m.precision=s=g.length*Se*2;l=Je(c,t,0,1,1),i=n.plus(l.times(r)),i.cmp(e)!=1;)n=r,r=i,i=u,u=a.plus(l.times(i)),a=i,i=t,t=c.minus(l.times(i)),c=i;return i=Je(e.minus(n),r,0,1,1),a=a.plus(i.times(u)),n=n.plus(i.times(r)),a.s=u.s=y.s,d=Je(u,r,s,1).minus(y).abs().cmp(Je(a,n,s,1).minus(y).abs())<1?[u,r]:[a,n],m.precision=f,Ie=!0,d};se.toHexadecimal=se.toHex=function(e,t){return Ch(this,16,e,t)};se.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),e==null){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),t===void 0?t=r.rounding:gn(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(Ie=!1,n=Je(n,e,0,t,1).times(e),Ie=!0,be(n)):(e.s=n.s,n=e),n};se.toNumber=function(){return+this};se.toOctal=function(e,t){return Ch(this,8,e,t)};se.toPower=se.pow=function(e){var t,n,r,i,s,o,c=this,a=c.constructor,u=+(e=new a(e));if(!c.d||!e.d||!c.d[0]||!e.d[0])return new a(At(+c,u));if(c=new a(c),c.eq(1))return c;if(r=a.precision,s=a.rounding,e.eq(1))return be(c,r,s);if(t=Xt(e.e/Se),t>=e.d.length-1&&(n=u<0?-u:u)<=n6)return i=S1(a,c,n,r),e.s<0?new a(1).div(i):be(i,r,s);if(o=c.s,o<0){if(t<e.d.length-1)return new a(NaN);if((e.d[t]&1)==0&&(o=1),c.e==0&&c.d[0]==1&&c.d.length==1)return c.s=o,c}return n=At(+c,u),t=n==0||!isFinite(n)?Xt(u*(Math.log("0."+Ft(c.d))/Math.LN10+c.e+1)):new a(n+"").e,t>a.maxE+1||t<a.minE-1?new a(t>0?o/0:0):(Ie=!1,a.rounding=c.s=1,n=Math.min(12,(t+"").length),i=Tl(e.times(ci(c,r+n)),r),i.d&&(i=be(i,r+5,1),Go(i.d,r,s)&&(t=r+10,i=be(Tl(e.times(ci(c,t+n)),t),t+5,1),+Ft(i.d).slice(r+1,r+15)+1==1e14&&(i=be(i,r+1,0)))),i.s=o,Ie=!0,a.rounding=s,be(i,r,s))};se.toPrecision=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=sr(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(gn(e,1,mi),t===void 0?t=i.rounding:gn(t,0,8),r=be(new i(r),e,t),n=sr(r,e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n};se.toSignificantDigits=se.toSD=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(gn(e,1,mi),t===void 0?t=r.rounding:gn(t,0,8)),be(new r(n),e,t)};se.toString=function(){var e=this,t=e.constructor,n=sr(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n};se.truncated=se.trunc=function(){return be(new this.constructor(this),this.e+1,1)};se.valueOf=se.toJSON=function(){var e=this,t=e.constructor,n=sr(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};function Ft(e){var t,n,r,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;t<i;t++)r=e[t]+"",n=Se-r.length,n&&(s+=si(n)),s+=r;o=e[t],r=o+"",n=Se-r.length,n&&(s+=si(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function gn(e,t,n){if(e!==~~e||e<t||e>n)throw Error(di+e)}function Go(e,t,n,r){var i,s,o,c;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=Se,i=0):(i=Math.ceil((t+1)/Se),t%=Se),s=At(10,Se-t),c=e[i]%s|0,r==null?t<3?(t==0?c=c/100|0:t==1&&(c=c/10|0),o=n<4&&c==99999||n>3&&c==49999||c==5e4||c==0):o=(n<4&&c+1==s||n>3&&c+1==s/2)&&(e[i+1]/s/100|0)==At(10,t-2)-1||(c==s/2||c==0)&&(e[i+1]/s/100|0)==0:t<4?(t==0?c=c/1e3|0:t==1?c=c/100|0:t==2&&(c=c/10|0),o=(r||n<4)&&c==9999||!r&&n>3&&c==4999):o=((r||n<4)&&c+1==s||!r&&n>3&&c+1==s/2)&&(e[i+1]/s/1e3|0)==At(10,t-3)-1,o}function ca(e,t,n){for(var r,i=[0],s,o=0,c=e.length;o<c;){for(s=i.length;s--;)i[s]*=t;for(i[0]+=El.indexOf(e.charAt(o++)),r=0;r<i.length;r++)i[r]>n-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function i6(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?(n=Math.ceil(r/3),i=(1/vu(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),e.precision+=n,t=qs(e,1,t.times(i),new e(1));for(var s=n;s--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=n,t}var Je=(function(){function e(r,i,s){var o,c=0,a=r.length;for(r=r.slice();a--;)o=r[a]*i+c,r[a]=o%s|0,c=o/s|0;return c&&r.unshift(c),r}function t(r,i,s,o){var c,a;if(s!=o)a=s>o?1:-1;else for(c=a=0;c<s;c++)if(r[c]!=i[c]){a=r[c]>i[c]?1:-1;break}return a}function n(r,i,s,o){for(var c=0;s--;)r[s]-=c,c=r[s]<i[s]?1:0,r[s]=c*o+r[s]-i[s];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,s,o,c,a){var u,f,l,d,y,g,m,E,_,S,w,T,O,A,R,M,v,U,L,K,H=r.constructor,$=r.s==i.s?1:-1,P=r.d,D=i.d;if(!P||!P[0]||!D||!D[0])return new H(!r.s||!i.s||(P?D&&P[0]==D[0]:!D)?NaN:P&&P[0]==0||!D?$*0:$/0);for(a?(y=1,f=r.e-i.e):(a=Kn,y=Se,f=Xt(r.e/y)-Xt(i.e/y)),L=D.length,v=P.length,_=new H($),S=_.d=[],l=0;D[l]==(P[l]||0);l++);if(D[l]>(P[l]||0)&&f--,s==null?(A=s=H.precision,o=H.rounding):c?A=s+(r.e-i.e)+1:A=s,A<0)S.push(1),g=!0;else{if(A=A/y+2|0,l=0,L==1){for(d=0,D=D[0],A++;(l<v||d)&&A--;l++)R=d*a+(P[l]||0),S[l]=R/D|0,d=R%D|0;g=d||l<v}else{for(d=a/(D[0]+1)|0,d>1&&(D=e(D,d,a),P=e(P,d,a),L=D.length,v=P.length),M=L,w=P.slice(0,L),T=w.length;T<L;)w[T++]=0;K=D.slice(),K.unshift(0),U=D[0],D[1]>=a/2&&++U;do d=0,u=t(D,w,L,T),u<0?(O=w[0],L!=T&&(O=O*a+(w[1]||0)),d=O/U|0,d>1?(d>=a&&(d=a-1),m=e(D,d,a),E=m.length,T=w.length,u=t(m,w,E,T),u==1&&(d--,n(m,L<E?K:D,E,a))):(d==0&&(u=d=1),m=D.slice()),E=m.length,E<T&&m.unshift(0),n(w,m,T,a),u==-1&&(T=w.length,u=t(D,w,L,T),u<1&&(d++,n(w,L<T?K:D,T,a))),T=w.length):u===0&&(d++,w=[0]),S[l++]=d,u&&w[0]?w[T++]=P[M]||0:(w=[P[M]],T=1);while((M++<v||w[0]!==void 0)&&A--);g=w[0]!==void 0}S[0]||S.shift()}if(y==1)_.e=f,g1=g;else{for(l=1,d=S[0];d>=10;d/=10)l++;_.e=l+f*y-1,be(_,c?s+_.e+1:s,o,g)}return _}})();function be(e,t,n,r){var i,s,o,c,a,u,f,l,d,y=e.constructor;e:if(t!=null){if(l=e.d,!l)return e;for(i=1,c=l[0];c>=10;c/=10)i++;if(s=t-i,s<0)s+=Se,o=t,f=l[d=0],a=f/At(10,i-o-1)%10|0;else if(d=Math.ceil((s+1)/Se),c=l.length,d>=c)if(r){for(;c++<=d;)l.push(0);f=a=0,i=1,s%=Se,o=s-Se+1}else break e;else{for(f=c=l[d],i=1;c>=10;c/=10)i++;s%=Se,o=s-Se+i,a=o<0?0:f/At(10,i-o-1)%10|0}if(r=r||t<0||l[d+1]!==void 0||(o<0?f:f%At(10,i-o-1)),u=n<4?(a||r)&&(n==0||n==(e.s<0?3:2)):a>5||a==5&&(n==4||r||n==6&&(s>0?o>0?f/At(10,i-o):0:l[d-1])%10&1||n==(e.s<0?8:7)),t<1||!l[0])return l.length=0,u?(t-=e.e+1,l[0]=At(10,(Se-t%Se)%Se),e.e=-t||0):l[0]=e.e=0,e;if(s==0?(l.length=d,c=1,d--):(l.length=d+1,c=At(10,Se-s),l[d]=o>0?(f/At(10,i-o)%At(10,o)|0)*c:0),u)for(;;)if(d==0){for(s=1,o=l[0];o>=10;o/=10)s++;for(o=l[0]+=c,c=1;o>=10;o/=10)c++;s!=c&&(e.e++,l[0]==Kn&&(l[0]=1));break}else{if(l[d]+=c,l[d]!=Kn)break;l[d--]=0,c=1}for(s=l.length;l[--s]===0;)l.pop()}return Ie&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function sr(e,t,n){if(!e.isFinite())return x1(e);var r,i=e.e,s=Ft(e.d),o=s.length;return t?(n&&(r=n-o)>0?s=s.charAt(0)+"."+s.slice(1)+si(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+si(-i-1)+s,n&&(r=n-o)>0&&(s+=si(r))):i>=o?(s+=si(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+si(r))):((r=i+1)<o&&(s=s.slice(0,r)+"."+s.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(s+="."),s+=si(r))),s}function Au(e,t){var n=e[0];for(t*=Se;n>=10;n/=10)t++;return t}function La(e,t,n){if(t>r6)throw Ie=!0,n&&(e.precision=n),Error(m1);return be(new e(Ma),t,1,!0)}function nr(e,t,n){if(t>Sl)throw Error(m1);return be(new e(qa),t,n,!0)}function _1(e){var t=e.length-1,n=t*Se+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function si(e){for(var t="";e--;)t+="0";return t}function S1(e,t,n,r){var i,s=new e(1),o=Math.ceil(r/Se+4);for(Ie=!1;;){if(n%2&&(s=s.times(t),ky(s.d,o)&&(i=!0)),n=Xt(n/2),n===0){n=s.d.length-1,i&&s.d[n]===0&&++s.d[n];break}t=t.times(t),ky(t.d,o)}return Ie=!0,s}function Ny(e){return e.d[e.d.length-1]&1}function T1(e,t,n){for(var r,i,s=new e(t[0]),o=0;++o<t.length;){if(i=new e(t[o]),!i.s){s=i;break}r=s.cmp(i),(r===n||r===0&&s.s===n)&&(s=i)}return s}function Tl(e,t){var n,r,i,s,o,c,a,u=0,f=0,l=0,d=e.constructor,y=d.rounding,g=d.precision;if(!e.d||!e.d[0]||e.e>17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(t==null?(Ie=!1,a=g):a=t,c=new d(.03125);e.e>-2;)e=e.times(c),l+=5;for(r=Math.log(At(2,l))/Math.LN10*2+5|0,a+=r,n=s=o=new d(1),d.precision=a;;){if(s=be(s.times(e),a,1),n=n.times(++f),c=o.plus(Je(s,n,a,1)),Ft(c.d).slice(0,a)===Ft(o.d).slice(0,a)){for(i=l;i--;)o=be(o.times(o),a,1);if(t==null)if(u<3&&Go(o.d,a-r,y,u))d.precision=a+=10,n=s=c=new d(1),f=0,u++;else return be(o,d.precision=g,y,Ie=!0);else return d.precision=g,o}o=c}}function ci(e,t){var n,r,i,s,o,c,a,u,f,l,d,y=1,g=10,m=e,E=m.d,_=m.constructor,S=_.rounding,w=_.precision;if(m.s<0||!E||!E[0]||!m.e&&E[0]==1&&E.length==1)return new _(E&&!E[0]?-1/0:m.s!=1?NaN:E?0:m);if(t==null?(Ie=!1,f=w):f=t,_.precision=f+=g,n=Ft(E),r=n.charAt(0),Math.abs(s=m.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)m=m.times(e),n=Ft(m.d),r=n.charAt(0),y++;s=m.e,r>1?(m=new _("0."+n),s++):m=new _(r+"."+n.slice(1))}else return u=La(_,f+2,w).times(s+""),m=ci(new _(r+"."+n.slice(1)),f-g).plus(u),_.precision=w,t==null?be(m,w,S,Ie=!0):m;for(l=m,a=o=m=Je(m.minus(1),m.plus(1),f,1),d=be(m.times(m),f,1),i=3;;){if(o=be(o.times(d),f,1),u=a.plus(Je(o,new _(i),f,1)),Ft(u.d).slice(0,f)===Ft(a.d).slice(0,f))if(a=a.times(2),s!==0&&(a=a.plus(La(_,f+2,w).times(s+""))),a=Je(a,new _(y),f,1),t==null)if(Go(a.d,f-g,S,c))_.precision=f+=g,u=o=m=Je(l.minus(1),l.plus(1),f,1),d=be(m.times(m),f,1),i=c=1;else return be(a,_.precision=w,S,Ie=!0);else return _.precision=w,a;a=u,i+=2}}function x1(e){return String(e.s*e.s/0)}function aa(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;r++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(r,i),t){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%Se,n<0&&(r+=Se),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=Se;r<i;)e.d.push(+t.slice(r,r+=Se));t=t.slice(r),r=Se-t.length}else r-=i;for(;r--;)t+="0";e.d.push(+t),Ie&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function s6(e,t){var n,r,i,s,o,c,a,u,f;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),E1.test(t))return aa(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(e6.test(t))n=16,t=t.toLowerCase();else if(Qv.test(t))n=2;else if(t6.test(t))n=8;else throw Error(di+t);for(s=t.search(/p/i),s>0?(a=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),o=s>=0,r=e.constructor,o&&(t=t.replace(".",""),c=t.length,s=c-s,i=S1(r,new r(n),s,s*2)),u=ca(t,n,Kn),f=u.length-1,s=f;u[s]===0;--s)u.pop();return s<0?new r(e.s*0):(e.e=Au(u,f),e.d=u,Ie=!1,o&&(e=Je(e,i,c*4)),a&&(e=e.times(Math.abs(a)<54?At(2,a):_r.pow(2,a))),Ie=!0,e)}function o6(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:qs(e,2,t,t);n=1.4*Math.sqrt(r),n=n>16?16:n|0,t=t.times(1/vu(5,n)),t=qs(e,2,t,t);for(var i,s=new e(5),o=new e(16),c=new e(20);n--;)i=t.times(t),t=t.times(s.plus(i.times(o.times(i).minus(c))));return t}function qs(e,t,n,r,i){var s,o,c,a,u=e.precision,f=Math.ceil(u/Se);for(Ie=!1,a=n.times(n),c=new e(r);;){if(o=Je(c.times(a),new e(t++*t++),u,1),c=i?r.plus(o):r.minus(o),r=Je(o.times(a),new e(t++*t++),u,1),o=c.plus(r),o.d[f]!==void 0){for(s=f;o.d[s]===c.d[s]&&s--;);if(s==-1)break}s=c,c=r,r=o,o=s}return Ie=!0,o.d.length=f+1,o}function vu(e,t){for(var n=e;--t;)n*=e;return n}function A1(e,t){var n,r=t.s<0,i=nr(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return vr=r?4:1,t;if(n=t.divToInt(i),n.isZero())vr=r?3:2;else{if(t=t.minus(n.times(i)),t.lte(s))return vr=Ny(n)?r?2:3:r?4:1,t;vr=Ny(n)?r?1:4:r?3:2}return t.minus(i).abs()}function Ch(e,t,n,r){var i,s,o,c,a,u,f,l,d,y=e.constructor,g=n!==void 0;if(g?(gn(n,1,mi),r===void 0?r=y.rounding:gn(r,0,8)):(n=y.precision,r=y.rounding),!e.isFinite())f=x1(e);else{for(f=sr(e),o=f.indexOf("."),g?(i=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):i=t,o>=0&&(f=f.replace(".",""),d=new y(1),d.e=f.length-o,d.d=ca(sr(d),10,i),d.e=d.d.length),l=ca(f,10,i),s=a=l.length;l[--a]==0;)l.pop();if(!l[0])f=g?"0p+0":"0";else{if(o<0?s--:(e=new y(e),e.d=l,e.e=s,e=Je(e,d,n,r,0,i),l=e.d,s=e.e,u=g1),o=l[n],c=i/2,u=u||l[n+1]!==void 0,u=r<4?(o!==void 0||u)&&(r===0||r===(e.s<0?3:2)):o>c||o===c&&(r===4||u||r===6&&l[n-1]&1||r===(e.s<0?8:7)),l.length=n,u)for(;++l[--n]>i-1;)l[n]=0,n||(++s,l.unshift(1));for(a=l.length;!l[a-1];--a);for(o=0,f="";o<a;o++)f+=El.charAt(l[o]);if(g){if(a>1)if(t==16||t==8){for(o=t==16?4:3,--a;a%o;a++)f+="0";for(l=ca(f,i,t),a=l.length;!l[a-1];--a);for(o=1,f="1.";o<a;o++)f+=El.charAt(l[o])}else f=f.charAt(0)+"."+f.slice(1);f=f+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)f="0"+f;f="0."+f}else if(++s>a)for(s-=a;s--;)f+="0";else s<a&&(f=f.slice(0,s)+"."+f.slice(s))}f=(t==16?"0x":t==2?"0b":t==8?"0o":"")+f}return e.s<0?"-"+f:f}function ky(e,t){if(e.length>t)return e.length=t,!0}function c6(e){return new this(e).abs()}function a6(e){return new this(e).acos()}function u6(e){return new this(e).acosh()}function f6(e,t){return new this(e).plus(t)}function l6(e){return new this(e).asin()}function h6(e){return new this(e).asinh()}function d6(e){return new this(e).atan()}function p6(e){return new this(e).atanh()}function y6(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,s=r+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=nr(this,s,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?nr(this,r,i):new this(0),n.s=e.s):!e.d||t.isZero()?(n=nr(this,s,1).times(.5),n.s=e.s):t.s<0?(this.precision=s,this.rounding=1,n=this.atan(Je(e,t,s,1)),t=nr(this,s,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(Je(e,t,s,1)),n}function g6(e){return new this(e).cbrt()}function m6(e){return be(e=new this(e),e.e+1,2)}function w6(e,t,n){return new this(e).clamp(t,n)}function b6(e){if(!e||typeof e!="object")throw Error(xu+"Object expected");var t,n,r,i=e.defaults===!0,s=["precision",1,mi,"rounding",0,8,"toExpNeg",-Es,0,"toExpPos",0,Es,"maxE",0,Es,"minE",-Es,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(n=s[t],i&&(this[n]=_l[n]),(r=e[n])!==void 0)if(Xt(r)===r&&r>=s[t+1]&&r<=s[t+2])this[n]=r;else throw Error(di+n+": "+r);if(n="crypto",i&&(this[n]=_l[n]),(r=e[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(w1);else this[n]=!1;else throw Error(di+n+": "+r);return this}function E6(e){return new this(e).cos()}function _6(e){return new this(e).cosh()}function v1(e){var t,n,r;function i(s){var o,c,a,u=this;if(!(u instanceof i))return new i(s);if(u.constructor=i,Py(s)){u.s=s.s,Ie?!s.d||s.e>i.maxE?(u.e=NaN,u.d=null):s.e<i.minE?(u.e=0,u.d=[0]):(u.e=s.e,u.d=s.d.slice()):(u.e=s.e,u.d=s.d?s.d.slice():s.d);return}if(a=typeof s,a==="number"){if(s===0){u.s=1/s<0?-1:1,u.e=0,u.d=[0];return}if(s<0?(s=-s,u.s=-1):u.s=1,s===~~s&&s<1e7){for(o=0,c=s;c>=10;c/=10)o++;Ie?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[s]):(u.e=o,u.d=[s]);return}if(s*0!==0){s||(u.s=NaN),u.e=NaN,u.d=null;return}return aa(u,s.toString())}if(a==="string")return(c=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(c===43&&(s=s.slice(1)),u.s=1),E1.test(s)?aa(u,s):s6(u,s);if(a==="bigint")return s<0?(s=-s,u.s=-1):u.s=1,aa(u,s.toString());throw Error(di+s)}if(i.prototype=se,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=b6,i.clone=v1,i.isDecimal=Py,i.abs=c6,i.acos=a6,i.acosh=u6,i.add=f6,i.asin=l6,i.asinh=h6,i.atan=d6,i.atanh=p6,i.atan2=y6,i.cbrt=g6,i.ceil=m6,i.clamp=w6,i.cos=E6,i.cosh=_6,i.div=S6,i.exp=T6,i.floor=x6,i.hypot=A6,i.ln=v6,i.log=I6,i.log10=B6,i.log2=O6,i.max=N6,i.min=k6,i.mod=P6,i.mul=R6,i.pow=U6,i.random=C6,i.round=H6,i.sign=F6,i.sin=M6,i.sinh=q6,i.sqrt=L6,i.sub=V6,i.sum=$6,i.tan=D6,i.tanh=j6,i.trunc=K6,e===void 0&&(e={}),e&&e.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return i.config(e),i}function S6(e,t){return new this(e).div(t)}function T6(e){return new this(e).exp()}function x6(e){return be(e=new this(e),e.e+1,3)}function A6(){var e,t,n=new this(0);for(Ie=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return Ie=!0,new this(1/0);n=t}return Ie=!0,n.sqrt()}function Py(e){return e instanceof _r||e&&e.toStringTag===b1||!1}function v6(e){return new this(e).ln()}function I6(e,t){return new this(e).log(t)}function O6(e){return new this(e).log(2)}function B6(e){return new this(e).log(10)}function N6(){return T1(this,arguments,-1)}function k6(){return T1(this,arguments,1)}function P6(e,t){return new this(e).mod(t)}function R6(e,t){return new this(e).mul(t)}function U6(e,t){return new this(e).pow(t)}function C6(e){var t,n,r,i,s=0,o=new this(1),c=[];if(e===void 0?e=this.precision:gn(e,1,mi),r=Math.ceil(e/Se),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));s<r;)i=t[s],i>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:c[s++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);s<r;)i=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,s):(c.push(i%1e7),s+=4);s=r/4}else throw Error(w1);else for(;s<r;)c[s++]=Math.random()*1e7|0;for(r=c[--s],e%=Se,r&&e&&(i=At(10,Se-e),c[s]=(r/i|0)*i);c[s]===0;s--)c.pop();if(s<0)n=0,c=[0];else{for(n=-1;c[0]===0;n-=Se)c.shift();for(r=1,i=c[0];i>=10;i/=10)r++;r<Se&&(n-=Se-r)}return o.e=n,o.d=c,o}function H6(e){return be(e=new this(e),e.e+1,this.rounding)}function F6(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function M6(e){return new this(e).sin()}function q6(e){return new this(e).sinh()}function L6(e){return new this(e).sqrt()}function V6(e,t){return new this(e).sub(t)}function $6(){var e=0,t=arguments,n=new this(t[e]);for(Ie=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return Ie=!0,be(n,this.precision,this.rounding)}function D6(e){return new this(e).tan()}function j6(e){return new this(e).tanh()}function K6(e){return be(e=new this(e),e.e+1,1)}se[Symbol.for("nodejs.util.inspect.custom")]=se.toString;se[Symbol.toStringTag]="Decimal";var _r=se.constructor=v1(_l);Ma=new _r(Ma);qa=new _r(qa);const G6=({IDL:e})=>{const t=e.Record({exchange_id:e.Text,reason:e.Text}),n=e.Variant({Ok:e.Null,Err:e.Text}),r=e.Variant({P2WPKH:e.Null,OpReturn:e.Nat64,P2SH:e.Null,P2TR:e.Null}),i=e.Record({input_types:e.Vec(r),pool_address:e.Vec(e.Text),output_types:e.Vec(r)}),s=e.Variant({Ok:e.Nat64,Err:e.Text}),o=e.Record({user_id:e.Principal}),c=e.Record({canister_version:e.Opt(e.Nat64),canister_id:e.Principal}),a=e.Variant({from_user:o,from_canister:c}),u=e.Record({controllers:e.Vec(e.Principal)}),f=e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),l=e.Record({mode:f,module_hash:e.Vec(e.Nat8)}),d=e.Record({canister_version:e.Nat64,taken_at_timestamp:e.Nat64,snapshot_id:e.Vec(e.Nat8)}),y=e.Variant({creation:u,code_deployment:l,load_snapshot:d,controllers_change:u,code_uninstall:e.Null}),g=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:a,details:y}),m=e.Record({controllers:e.Vec(e.Principal),module_hash:e.Opt(e.Vec(e.Nat8)),recent_changes:e.Vec(g),total_num_changes:e.Nat64}),E=e.Variant({Ok:m,Err:e.Text}),_=e.Record({exchange_id:e.Text,pool_address:e.Text,pool_key:e.Text}),S=e.Variant({All:e.Null,ByTxid:e.Text,ByStatusCode:e.Text,ByAddress:e.Text,BySecondsPassed:e.Nat64}),w=e.Variant({Ok:e.Text,Err:e.Text}),T=e.Record({result:w,exchange_id:e.Text,maybe_return_time:e.Opt(e.Text),calling_method:e.Text,calling_args:e.Text,pool_address:e.Text,calling_time:e.Text}),O=e.Record({rollback_results:e.Vec(e.Text),invoke_args:e.Text,invoke_time:e.Text,finalized_time:e.Opt(e.Text),confirmed_time:e.Opt(e.Text),execution_steps:e.Vec(T),processing_result:w,broadcasted_time:e.Opt(e.Text)}),A=e.Record({block_hash:e.Text,block_height:e.Nat32}),R=e.Record({processing_results:e.Vec(e.Text),block_basic:A,txids:e.Vec(e.Text),block_time:e.Text,received_time:e.Text}),M=e.Variant({Abandoned:e.Record({reason:e.Text}),Active:e.Null,Halted:e.Record({reason:e.Text})}),v=e.Record({status:M,exchange_id:e.Text,canister_id:e.Principal,utxo_proof_enabled:e.Bool,client_canisters:e.Vec(e.Principal)}),U=e.Record({rollback_results:e.Vec(e.Text),txid:e.Text,received_time:e.Text,reason:e.Text}),L=e.Variant({mainnet:e.Null,regtest:e.Null,testnet:e.Null}),K=e.Record({min_seconds_of_unconfirmed_tx_in_pool_for_raising_fee_rate:e.Nat32,exchange_registry_principal:e.Principal,max_input_count_of_psbt:e.Nat32,min_tx_confirmations:e.Nat32,mempool_connector_principal:e.Principal,max_unconfirmed_tx_count_in_pool:e.Nat32,min_btc_amount_for_utxo:e.Nat64,rune_indexer_principal:e.Principal,max_intentions_per_invoke:e.Nat32,mempool_connector_public_key:e.Text,max_received_blocks_count:e.Nat32,min_unconfirmed_tx_count_in_pool_for_raising_fee_rate:e.Nat32,bitcoin_network:L}),H=e.Record({low:e.Nat64,high:e.Nat64,update_time:e.Text,medium:e.Nat64}),$=e.Record({last_block:e.Opt(A),pending_tx_count:e.Nat64,mempool_tx_fee_rate:H,invoke_paused:e.Bool,concurrent_invoke_status:e.Text,last_block_time:e.Opt(e.Tuple(e.Nat64,e.Text)),failed_new_block_height:e.Opt(e.Tuple(e.Nat32,e.Text))}),P=e.Variant({Error:e.Null,AvailableUnconfirmed:e.Null,InvalidTxid:e.Null,InvalidVout:e.Null,SpentInMempool:e.Null,SpentOnChain:e.Null,AvailableConfirmed:e.Null}),D=e.Record({status:P,value:e.Opt(e.Text),txid:e.Text,vout:e.Nat32,ancestors:e.Opt(e.Nat32),address:e.Opt(e.Text)}),F=e.Record({id:e.Text,value:e.Nat}),x=e.Record({coins:e.Vec(F),sats:e.Nat64,txid:e.Text,vout:e.Nat32}),B=e.Record({status:e.Opt(D),coins:e.Vec(F),utxo:x,is_signed:e.Bool,owner_pubkey:e.Opt(e.Text),owner_address:e.Text}),q=e.Record({coins_in_inputs:e.Vec(B),txid:e.Text,signed_address_coins:e.Vec(e.Tuple(e.Text,e.Vec(F))),address_coins:e.Vec(e.Tuple(e.Text,e.Vec(F)))}),N=e.Record({is_op_return:e.Bool,utxo:x,owner_address:e.Opt(e.Text)}),V=e.Record({burned_coins:e.Vec(F),coins_in_outputs:e.Vec(N),address_coins:e.Vec(e.Tuple(e.Text,e.Vec(F)))}),G=e.Record({coin:F,from:e.Text}),X=e.Record({to:e.Text,coin:F}),Y=e.Record({input_coins:e.Vec(G),output_coins:e.Vec(X),action:e.Text,exchange_id:e.Text,pool_utxo_spent:e.Vec(e.Text),action_params:e.Text,nonce:e.Nat64,pool_address:e.Text,pool_utxo_received:e.Vec(x)}),ce=e.Record({tx_fee_in_sats:e.Nat64,initiator_address:e.Text,intentions:e.Vec(Y)}),ue=e.Record({applied_fee_rate:e.Nat64,pool_addresses:e.Vec(e.Text),coins_in_inputs:q,txid:e.Text,estimated_min_tx_fee:e.Nat64,actual_tx_fee:e.Nat64,coins_in_outputs:V,tx_vsize:e.Nat64,intention_set:ce,user_coins_in_inputs:e.Vec(F),initially_signed_addresses:e.Vec(e.Text)}),te=e.Variant({Confirmed:e.Nat32,Rejected:e.Text,Pending:e.Null}),Z=e.Record({status:e.Opt(te),invoke_log:O,included_block:e.Opt(A),sent_tx_hex:e.Text}),ae=e.Variant({Failed:O,NotFound:e.Null,Succeeded:Z}),we=e.Record({maybe_rune:e.Opt(F),value:e.Nat64,script_pubkey_hex:e.Text,outpoint:e.Text}),ye=e.Record({client_info:e.Opt(e.Text),intention_set:ce,initiator_utxo_proof:e.Vec(e.Nat8),psbt_hex:e.Text}),J=e.Record({block_hash:e.Text,block_timestamp:e.Nat64,tx_ids:e.Vec(e.Text),block_height:e.Nat32}),le=e.Variant({Ok:e.Vec(e.Text),Err:e.Text}),ve=e.Record({exchange_canister:e.Principal,exchange_id:e.Text,utxo_proof_enabled:e.Bool,client_canisters:e.Vec(e.Principal)}),Le=e.Record({txid:e.Text,reason_code:e.Text,reason:e.Text}),nt=e.Record({txid:e.Text,timestamp:e.Nat64,block:A}),ft=e.Record({low:e.Nat64,high:e.Nat64,medium:e.Nat64});return e.Service({abandon_exchange:e.Func([t],[n],[]),clear_exchange_pools:e.Func([],[n],[]),clear_failed_invoke_logs:e.Func([e.Opt(e.Nat64),e.Vec(e.Text)],[n],[]),clear_last_block:e.Func([],[n],[]),clear_rejected_txs:e.Func([],[n],[]),clear_txs_with_min_confirmations:e.Func([e.Nat32],[n],[]),delete_tx_detail:e.Func([e.Text],[n],[]),delete_used_outpoints:e.Func([e.Text],[n],[]),estimate_min_tx_fee:e.Func([i],[s],["query"]),get_canister_info:e.Func([e.Nat64],[E],[]),get_exchange_pools:e.Func([],[e.Vec(_)],["query"]),get_failed_invoke_logs:e.Func([S],[e.Vec(e.Tuple(e.Text,O))],["query"]),get_last_sent_txs:e.Func([],[e.Vec(e.Tuple(e.Text,e.Text,e.Opt(e.Nat32)))],["query"]),get_received_blocks:e.Func([e.Opt(e.Bool)],[e.Vec(R)],["query"]),get_registered_exchanges:e.Func([e.Opt(M)],[e.Vec(v)],["query"]),get_rejected_txs:e.Func([],[e.Vec(U)],["query"]),get_settings:e.Func([],[K],["query"]),get_status:e.Func([],[$],["query"]),get_tx_execution_context_view:e.Func([e.Text],[e.Opt(ue)],["query"]),get_tx_execution_result:e.Func([e.Text],[ae],["query"]),get_tx_for_outpoint:e.Func([e.Text],[e.Opt(Z)],["query"]),get_tx_queue_of_pool:e.Func([e.Text],[e.Vec(e.Tuple(e.Text,e.Opt(e.Nat32)))],["query"]),get_tx_sent:e.Func([e.Text],[e.Opt(Z)],["query"]),get_used_outpoints:e.Func([e.Opt(e.Text)],[e.Vec(e.Tuple(e.Text,e.Text))],["query"]),get_zero_confirmed_tx_count_of_pool:e.Func([e.Text],[e.Nat32],["query"]),get_zero_confirmed_txs:e.Func([e.Opt(e.Text)],[e.Vec(e.Text)],["query"]),get_zero_confirmed_utxos_of_address:e.Func([e.Text],[e.Vec(we)],["query"]),init_status_code_message:e.Func([],[n],[]),inspect_status_code:e.Func([e.Text],[e.Text],["query"]),invoke:e.Func([ye],[w],[]),new_block_detected:e.Func([J],[n],[]),notify_exchange_for_blocks_from_height:e.Func([e.Text,e.Nat32],[le],[]),notify_exchanges_for_block:e.Func([e.Vec(e.Text),A,e.Nat64,e.Vec(e.Text)],[le],[]),pause_invoke:e.Func([],[n],[]),reapply_tx:e.Func([e.Text],[n],[]),register_exchange:e.Func([ve],[n],[]),reject_tx:e.Func([Le],[n],[]),resume_invoke:e.Func([],[n],[]),rollback_tx:e.Func([e.Text],[le],[]),save_included_block_for_tx:e.Func([nt],[n],[]),set_bitcoin_network:e.Func([L],[n],[]),set_exchange_registry_principal:e.Func([e.Principal],[n],[]),set_max_input_count_of_psbt:e.Func([e.Nat32],[n],[]),set_max_intentions_per_invoke:e.Func([e.Nat32],[n],[]),set_max_received_blocks_count:e.Func([e.Nat32],[n],[]),set_max_unconfirmed_tx_count_in_pool:e.Func([e.Nat32],[n],[]),set_mempool_connector_principal:e.Func([e.Principal],[n],[]),set_mempool_connector_public_key:e.Func([e.Text],[n],[]),set_min_btc_amount_for_utxo:e.Func([e.Nat64],[n],[]),set_min_tx_confirmations:e.Func([e.Nat32],[n],[]),set_rune_indexer_principal:e.Func([e.Principal],[n],[]),set_tx_fee_per_vbyte:e.Func([ft],[n],[]),unhalt_exchange:e.Func([e.Text],[n],[]),version:e.Func([],[e.Text],["query"])})};class I1{maestro;config;exchange;orchestrator;constructor(t){this.config=t;const n=t.network===Ps.Testnet,r=n?"https://xbt-testnet.gomaestro-api.org/v0":"https://xbt-mainnet.gomaestro-api.org/v0";this.maestro=new ix({baseUrl:r,apiKey:t.maestroApiKey});const i="https://icp0.io";this.exchange=Fa.createActor(t.exchangeIdlFactory,{agent:Ar.createSync({host:i,retryTimes:50,verifyQuerySignatures:!1}),canisterId:t.exchangeCanisterId}),this.orchestrator=Fa.createActor(G6,{agent:Ar.createSync({host:i,retryTimes:50,verifyQuerySignatures:!1}),canisterId:n?DA:$A})}async filterSpentUtxos(t,n){const r=await this.orchestrator.get_used_outpoints([t]);return n.filter(({txid:i,vout:s})=>r.findIndex(([o])=>`${i}:${s}`===o)<0)}async getPendingBtcUtxos(t){const n=await this.orchestrator.get_zero_confirmed_utxos_of_address(t),r=Mi(t);return n.filter(({maybe_rune:i})=>!i.length).map(({value:i,script_pubkey_hex:s,outpoint:o})=>{const[c,a]=o.split(":");return{txid:c,vout:Number(a),satoshis:i.toString(),scriptPk:s,addressType:r,address:t,runes:[]}})}async getPendingRuneUtxos(t){const n=await this.orchestrator.get_zero_confirmed_utxos_of_address(t),r=Mi(t);return n.filter(({maybe_rune:i})=>i.length).map(({value:i,script_pubkey_hex:s,outpoint:o,maybe_rune:c})=>{const[a,u]=o.split(":"),f=c[0];return{txid:a,vout:Number(u),satoshis:i.toString(),scriptPk:s,addressType:r,address:t,runes:f?[{id:f.id,amount:f.value.toString()}]:[]}})}async getBtcUtxos(t,n=!0){let r=null;const i=[],s=await this.getPendingBtcUtxos(t);do{const c=await this.maestro.utxosByAddressMempoolAware(t,r,n);i.push(...c.data),r=c.next_cursor}while(r!==null);const o=i.map(({txid:c,vout:a,runes:u,satoshis:f,script_pubkey:l,address:d})=>({txid:c,vout:a,address:d,runes:u.map(({rune_id:y,amount:g})=>{const m=(g.split(".")[1]??"").length,E=new _r(g).mul(10**m).toFixed(0);return{id:y,amount:E}}),satoshis:f,scriptPk:l}));return this.filterSpentUtxos(t,o.concat(s))}async getRuneUtxos(t,n){let r=null;const i=[],s=await this.getPendingRuneUtxos(t);do{const c=await this.maestro.runeUtxosByAddress(t,n,r);i.push(...c.data),r=c.next_cursor}while(r!==null);const o=i.map(({txid:c,vout:a,runes:u,satoshis:f})=>{const l=Nh(t,this.config.network);return{txid:c,vout:a,address:t,runes:u.map(({rune_id:d,amount:y})=>{const g=(y.split(".")[1]??"").length,m=new _r(y).mul(10**g).toFixed(0);return{id:d,amount:m}}),satoshis:f,scriptPk:Oh(l)}});return this.filterSpentUtxos(t,o.concat(s))}async searchRunes(t){const n=this.config.network===Ps.Testnet?KA:jA,r=Jv`
133
133
  query GetRunes($keyword: String!, $regex: String!) {
134
134
  runes(
135
135
  where: {
@@ -14792,6 +14792,11 @@ class ax {
14792
14792
  `/addresses/${t}/utxos?filter_dust=true&filter_dust_threshold=547&exclude_metaprotocols=${r}&ignore_used_brc20=true&order=asc&count=100${n ? `&cursor=${n}` : ""}`
14793
14793
  ).then((s) => s.data);
14794
14794
  }
14795
+ async utxosByAddressMempoolAware(t, n, r = !0) {
14796
+ return await this.axios.get(
14797
+ `/mempool/addresses/${t}/utxos?filter_dust=true&exclude_metaprotocols=${r}&filter_dust_threshold=547&order=asc&count=100${n ? `&cursor=${n}` : ""}`
14798
+ ).then((s) => s.data);
14799
+ }
14795
14800
  async inscriptionIdsByCollectionSymbol(t, n) {
14796
14801
  return await this.axios.get(
14797
14802
  `/assets/collections/${t}/inscriptions?count=100${n ? `&cursor=${n}` : ""}`
@@ -32795,7 +32800,7 @@ class Y6 {
32795
32800
  let r = null;
32796
32801
  const i = [], s = await this.getPendingBtcUtxos(t);
32797
32802
  do {
32798
- const c = await this.maestro.utxosByAddress(
32803
+ const c = await this.maestro.utxosByAddressMempoolAware(
32799
32804
  t,
32800
32805
  r,
32801
32806
  n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnity/ree-client-ts-sdk",
3
- "version": "0.4.8",
3
+ "version": "0.5.0",
4
4
  "description": "A TypeScript SDK for interacting with the Ree protocol on Bitcoin",
5
5
  "keywords": [
6
6
  "bitcoin",
@@ -36,8 +36,16 @@
36
36
  }
37
37
  },
38
38
  "peerDependencies": {
39
- "react": ">=17",
40
- "react-dom": ">=17"
39
+ "react": "^18.0.0",
40
+ "react-dom": "^18.0.0"
41
+ },
42
+ "peerDependenciesMeta": {
43
+ "react": {
44
+ "optional": true
45
+ },
46
+ "react-dom": {
47
+ "optional": true
48
+ }
41
49
  },
42
50
  "scripts": {
43
51
  "dev": "vite",