@junobuild/admin 0.0.7 → 0.0.8

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.
Files changed (43) hide show
  1. package/dist/browser/index.js +14 -14
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/declarations/cmc/cmc.did.d.ts +30 -30
  4. package/dist/declarations/cmc/cmc.factory.did.js +63 -63
  5. package/dist/declarations/cmc/index.d.ts +18 -18
  6. package/dist/declarations/cmc/index.js +22 -22
  7. package/dist/declarations/console/console.did.d.ts +37 -37
  8. package/dist/declarations/console/console.factory.did.js +60 -60
  9. package/dist/declarations/console/console.factory.did.mjs +60 -60
  10. package/dist/declarations/console/index.d.ts +18 -18
  11. package/dist/declarations/console/index.js +22 -22
  12. package/dist/declarations/frontend/frontend.did.d.ts +136 -136
  13. package/dist/declarations/frontend/frontend.factory.did.js +206 -206
  14. package/dist/declarations/frontend/index.d.ts +18 -18
  15. package/dist/declarations/frontend/index.js +22 -22
  16. package/dist/declarations/ic/ic.did.d.ts +63 -63
  17. package/dist/declarations/ic/ic.factory.did.js +126 -126
  18. package/dist/declarations/internet_identity/index.d.ts +18 -18
  19. package/dist/declarations/internet_identity/index.js +22 -22
  20. package/dist/declarations/internet_identity/internet_identity.did.d.ts +136 -136
  21. package/dist/declarations/internet_identity/internet_identity.factory.did.js +231 -231
  22. package/dist/declarations/ledger/index.d.ts +18 -18
  23. package/dist/declarations/ledger/index.js +22 -22
  24. package/dist/declarations/ledger/ledger.did.d.ts +64 -64
  25. package/dist/declarations/ledger/ledger.factory.did.js +96 -96
  26. package/dist/declarations/mission_control/index.d.ts +18 -18
  27. package/dist/declarations/mission_control/index.js +22 -22
  28. package/dist/declarations/mission_control/mission_control.did.d.ts +30 -30
  29. package/dist/declarations/mission_control/mission_control.factory.did.js +48 -48
  30. package/dist/declarations/satellite/index.d.ts +18 -18
  31. package/dist/declarations/satellite/index.js +22 -22
  32. package/dist/declarations/satellite/satellite-deprecated.did.d.ts +186 -0
  33. package/dist/declarations/satellite/satellite-deprecated.factory.did.js +191 -0
  34. package/dist/declarations/satellite/satellite-deprecated.factory.did.mjs +191 -0
  35. package/dist/declarations/satellite/satellite.did.d.ts +124 -120
  36. package/dist/declarations/satellite/satellite.factory.did.js +189 -189
  37. package/dist/declarations/satellite/satellite.factory.did.mjs +189 -189
  38. package/dist/node/index.mjs +23 -23
  39. package/dist/node/index.mjs.map +4 -4
  40. package/dist/types/api/actor.api.d.ts +2 -0
  41. package/dist/types/api/satellite.api.d.ts +3 -0
  42. package/dist/types/services/satellite.services.d.ts +2 -1
  43. package/package.json +1 -1
@@ -1,24 +1,24 @@
1
- import{a as Tt,b as Ee,c as Ft,d,e as At,f as _,g as be,h as k,i as E,j as Ct,k as it,l as Re,m as W,n as z,o as Et}from"./chunk-CAKYEEJ6.js";var Pt=Tt(G=>{"use strict";G.byteLength=Ne;G.toByteArray=Pe;G.fromByteArray=Ue;var F=[],g=[],ve=typeof Uint8Array<"u"?Uint8Array:Array,ot="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(v=0,Nt=ot.length;v<Nt;++v)F[v]=ot[v],g[ot.charCodeAt(v)]=v;var v,Nt;g["-".charCodeAt(0)]=62;g["_".charCodeAt(0)]=63;function St(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Ne(t){var e=St(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Se(t,e,r){return(e+r)*3/4-r}function Pe(t){var e,r=St(t),n=r[0],i=r[1],o=new ve(Se(t,n,i)),a=0,c=i>0?n-4:n,l;for(l=0;l<c;l+=4)e=g[t.charCodeAt(l)]<<18|g[t.charCodeAt(l+1)]<<12|g[t.charCodeAt(l+2)]<<6|g[t.charCodeAt(l+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return i===2&&(e=g[t.charCodeAt(l)]<<2|g[t.charCodeAt(l+1)]>>4,o[a++]=e&255),i===1&&(e=g[t.charCodeAt(l)]<<10|g[t.charCodeAt(l+1)]<<4|g[t.charCodeAt(l+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function Oe(t){return F[t>>18&63]+F[t>>12&63]+F[t>>6&63]+F[t&63]}function Be(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(Oe(n));return i.join("")}function Ue(t){for(var e,r=t.length,n=r%3,i=[],o=16383,a=0,c=r-n;a<c;a+=o)i.push(Be(t,a,a+o>c?c:a+o));return n===1?(e=t[r-1],i.push(F[e>>2]+F[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(F[e>>10]+F[e>>4&63]+F[e<<2&63]+"=")),i.join("")}});var zt=Tt(B=>{"use strict";var at=Pt(),O=be(),Ot=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;B.Buffer=s;B.SlowBuffer=$e;B.INSPECT_MAX_BYTES=50;var Y=2147483647;B.kMaxLength=Y;s.TYPED_ARRAY_SUPPORT=Ve();!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Ve(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function b(t){if(t>Y)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return ut(t)}return Vt(t,e,r)}s.poolSize=8192;function Vt(t,e,r){if(typeof t=="string")return qe(t,e);if(ArrayBuffer.isView(t))return Me(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(A(t,ArrayBuffer)||t&&A(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(A(t,SharedArrayBuffer)||t&&A(t.buffer,SharedArrayBuffer)))return ct(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return s.from(n,e,r);var i=je(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return s.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}s.from=function(t,e,r){return Vt(t,e,r)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function kt(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function ke(t,e,r){return kt(t),t<=0?b(t):e!==void 0?typeof r=="string"?b(t).fill(e,r):b(t).fill(e):b(t)}s.alloc=function(t,e,r){return ke(t,e,r)};function ut(t){return kt(t),b(t<0?0:pt(t)|0)}s.allocUnsafe=function(t){return ut(t)};s.allocUnsafeSlow=function(t){return ut(t)};function qe(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=qt(t,e)|0,n=b(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function st(t){for(var e=t.length<0?0:pt(t.length)|0,r=b(e),n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Me(t){if(A(t,Uint8Array)){var e=new Uint8Array(t);return ct(e.buffer,e.byteOffset,e.byteLength)}return st(t)}function ct(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,s.prototype),n}function je(t){if(s.isBuffer(t)){var e=pt(t.length)|0,r=b(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||ft(t.length)?b(0):st(t);if(t.type==="Buffer"&&Array.isArray(t.data))return st(t.data)}function pt(t){if(t>=Y)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Y.toString(16)+" bytes");return t|0}function $e(t){return+t!=t&&(t=0),s.alloc(+t)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype};s.compare=function(e,r){if(A(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),A(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(e)||!s.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,o=0,a=Math.min(n,i);o<a;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return s.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=s.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){var a=e[n];if(A(a,Uint8Array))o+a.length>i.length?s.from(a).copy(i,o):Uint8Array.prototype.set.call(i,a,o);else if(s.isBuffer(a))a.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=a.length}return i};function qt(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||A(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return lt(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Wt(t).length;default:if(i)return n?-1:lt(t).length;e=(""+e).toLowerCase(),i=!0}}s.byteLength=qt;function He(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Ie(this,e,r);case"utf8":case"utf-8":return jt(this,e,r);case"ascii":return Xe(this,e,r);case"latin1":case"binary":return Ze(this,e,r);case"base64":return Je(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return De(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function N(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}s.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)N(this,r,r+1);return this};s.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)N(this,r,r+3),N(this,r+1,r+2);return this};s.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)N(this,r,r+7),N(this,r+1,r+6),N(this,r+2,r+5),N(this,r+3,r+4);return this};s.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?jt(this,0,e):He.apply(this,arguments)};s.prototype.toLocaleString=s.prototype.toString;s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:s.compare(this,e)===0};s.prototype.inspect=function(){var e="",r=B.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Ot&&(s.prototype[Ot]=s.prototype.inspect);s.prototype.compare=function(e,r,n,i,o){if(A(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var a=o-i,c=n-r,l=Math.min(a,c),u=this.slice(i,o),p=e.slice(r,n),f=0;f<l;++f)if(u[f]!==p[f]){a=u[f],c=p[f];break}return a<c?-1:c<a?1:0};function Mt(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ft(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=s.from(e,n)),s.isBuffer(e))return e.length===0?-1:Bt(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Bt(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Bt(t,e,r,n,i){var o=1,a=t.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,a/=2,c/=2,r/=2}function l(y,x){return o===1?y[x]:y.readUInt16BE(x*o)}var u;if(i){var p=-1;for(u=r;u<a;u++)if(l(t,u)===l(e,p===-1?0:u-p)){if(p===-1&&(p=u),u-p+1===c)return p*o}else p!==-1&&(u-=u-p),p=-1}else for(r+c>a&&(r=a-c),u=r;u>=0;u--){for(var f=!0,h=0;h<c;h++)if(l(t,u+h)!==l(e,h)){f=!1;break}if(f)return u}return-1}s.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};s.prototype.indexOf=function(e,r,n){return Mt(this,e,r,n,!0)};s.prototype.lastIndexOf=function(e,r,n){return Mt(this,e,r,n,!1)};function Ke(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;n>o/2&&(n=o/2);for(var a=0;a<n;++a){var c=parseInt(e.substr(a*2,2),16);if(ft(c))return a;t[r+a]=c}return a}function We(t,e,r,n){return J(lt(e,t.length-r),t,r,n)}function ze(t,e,r,n){return J(er(e),t,r,n)}function Ge(t,e,r,n){return J(Wt(e),t,r,n)}function Ye(t,e,r,n){return J(rr(e,t.length-r),t,r,n)}s.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return Ke(this,e,r,n);case"utf8":case"utf-8":return We(this,e,r,n);case"ascii":case"latin1":case"binary":return ze(this,e,r,n);case"base64":return Ge(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ye(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Je(t,e,r){return e===0&&r===t.length?at.fromByteArray(t):at.fromByteArray(t.slice(e,r))}function jt(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],a=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=r){var l,u,p,f;switch(c){case 1:o<128&&(a=o);break;case 2:l=t[i+1],(l&192)===128&&(f=(o&31)<<6|l&63,f>127&&(a=f));break;case 3:l=t[i+1],u=t[i+2],(l&192)===128&&(u&192)===128&&(f=(o&15)<<12|(l&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(a=f));break;case 4:l=t[i+1],u=t[i+2],p=t[i+3],(l&192)===128&&(u&192)===128&&(p&192)===128&&(f=(o&15)<<18|(l&63)<<12|(u&63)<<6|p&63,f>65535&&f<1114112&&(a=f))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=c}return Qe(n)}var Ut=4096;function Qe(t){var e=t.length;if(e<=Ut)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Ut));return r}function Xe(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function Ze(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function Ie(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=nr[t[o]];return i}function De(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}s.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var i=this.subarray(e,r);return Object.setPrototypeOf(i,s.prototype),i};function m(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||m(e,r,this.length);for(var i=this[e],o=1,a=0;++a<r&&(o*=256);)i+=this[e+a]*o;return i};s.prototype.readUintBE=s.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||m(e,r,this.length);for(var i=this[e+--r],o=1;r>0&&(o*=256);)i+=this[e+--r]*o;return i};s.prototype.readUint8=s.prototype.readUInt8=function(e,r){return e=e>>>0,r||m(e,1,this.length),this[e]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||m(e,2,this.length),this[e]|this[e+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||m(e,2,this.length),this[e]<<8|this[e+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||m(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||m(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};s.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||m(e,r,this.length);for(var i=this[e],o=1,a=0;++a<r&&(o*=256);)i+=this[e+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};s.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||m(e,r,this.length);for(var i=r,o=1,a=this[e+--i];i>0&&(o*=256);)a+=this[e+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*r)),a};s.prototype.readInt8=function(e,r){return e=e>>>0,r||m(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};s.prototype.readInt16LE=function(e,r){e=e>>>0,r||m(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(e,r){e=e>>>0,r||m(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(e,r){return e=e>>>0,r||m(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};s.prototype.readInt32BE=function(e,r){return e=e>>>0,r||m(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};s.prototype.readFloatLE=function(e,r){return e=e>>>0,r||m(e,4,this.length),O.read(this,e,!0,23,4)};s.prototype.readFloatBE=function(e,r){return e=e>>>0,r||m(e,4,this.length),O.read(this,e,!1,23,4)};s.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||m(e,8,this.length),O.read(this,e,!0,52,8)};s.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||m(e,8,this.length),O.read(this,e,!1,52,8)};function w(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;w(this,e,r,n,o,0)}var a=1,c=0;for(this[r]=e&255;++c<n&&(a*=256);)this[r+c]=e/a&255;return r+n};s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;w(this,e,r,n,o,0)}var a=n-1,c=1;for(this[r+a]=e&255;--a>=0&&(c*=256);)this[r+a]=e/c&255;return r+n};s.prototype.writeUint8=s.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,1,255,0),this[r]=e&255,r+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};s.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);w(this,e,r,n,o-1,-o)}var a=0,c=1,l=0;for(this[r]=e&255;++a<n&&(c*=256);)e<0&&l===0&&this[r+a-1]!==0&&(l=1),this[r+a]=(e/c>>0)-l&255;return r+n};s.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);w(this,e,r,n,o-1,-o)}var a=n-1,c=1,l=0;for(this[r+a]=e&255;--a>=0&&(c*=256);)e<0&&l===0&&this[r+a+1]!==0&&(l=1),this[r+a]=(e/c>>0)-l&255;return r+n};s.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};s.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};s.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};s.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};s.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function $t(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Ht(t,e,r,n,i){return e=+e,r=r>>>0,i||$t(t,e,r,4,34028234663852886e22,-34028234663852886e22),O.write(t,e,r,n,23,4),r+4}s.prototype.writeFloatLE=function(e,r,n){return Ht(this,e,r,!0,n)};s.prototype.writeFloatBE=function(e,r,n){return Ht(this,e,r,!1,n)};function Kt(t,e,r,n,i){return e=+e,r=r>>>0,i||$t(t,e,r,8,17976931348623157e292,-17976931348623157e292),O.write(t,e,r,n,52,8),r+8}s.prototype.writeDoubleLE=function(e,r,n){return Kt(this,e,r,!0,n)};s.prototype.writeDoubleBE=function(e,r,n){return Kt(this,e,r,!1,n)};s.prototype.copy=function(e,r,n,i){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);var o=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),o};s.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){var o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var a;if(typeof e=="number")for(a=r;a<n;++a)this[a]=e;else{var c=s.isBuffer(e)?e:s.from(e,i),l=c.length;if(l===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<n-r;++a)this[a+r]=c[a%l]}return this};var Le=/[^+/0-9A-Za-z-_]/g;function tr(t){if(t=t.split("=")[0],t=t.trim().replace(Le,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function lt(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function er(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function rr(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function Wt(t){return at.toByteArray(tr(t))}function J(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function A(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function ft(t){return t!==t}var nr=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var bt=({IDL:t})=>{let e=t.Principal,r=t.Record({freezing_threshold:t.Nat,controllers:t.Vec(t.Principal),memory_allocation:t.Nat,compute_allocation:t.Nat}),n=t.Record({freezing_threshold:t.Opt(t.Nat),controllers:t.Opt(t.Vec(t.Principal)),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),i=t.Record({value:t.Text,name:t.Text}),o=t.Record({status:t.Nat,body:t.Vec(t.Nat8),headers:t.Vec(i)}),a=t.Variant({dns_error:t.Null,no_consensus:t.Null,transform_error:t.Null,unreachable:t.Null,bad_tls:t.Null,conn_timeout:t.Null,invalid_url:t.Null,timeout:t.Null}),c=t.Vec(t.Nat8);return t.Service({canister_status:t.Func([t.Record({canister_id:e})],[t.Record({status:t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),memory_size:t.Nat,cycles:t.Nat,settings:r,module_hash:t.Opt(t.Vec(t.Nat8))})],[]),create_canister:t.Func([t.Record({settings:t.Opt(n)})],[t.Record({canister_id:e})],[]),delete_canister:t.Func([t.Record({canister_id:e})],[],[]),deposit_cycles:t.Func([t.Record({canister_id:e})],[],[]),http_request:t.Func([t.Record({url:t.Text,method:t.Variant({get:t.Null}),body:t.Opt(t.Vec(t.Nat8)),transform:t.Opt(t.Variant({function:t.Func([o],[o],["query"])})),headers:t.Vec(i)})],[t.Variant({Ok:o,Err:t.Opt(a)})],[]),install_code:t.Func([t.Record({arg:t.Vec(t.Nat8),wasm_module:c,mode:t.Variant({reinstall:t.Null,upgrade:t.Null,install:t.Null}),canister_id:e})],[],[]),provisional_create_canister_with_cycles:t.Func([t.Record({settings:t.Opt(n),amount:t.Opt(t.Nat)})],[t.Record({canister_id:e})],[]),provisional_top_up_canister:t.Func([t.Record({canister_id:e,amount:t.Nat})],[],[]),raw_rand:t.Func([],[t.Vec(t.Nat8)],[]),start_canister:t.Func([t.Record({canister_id:e})],[],[]),stop_canister:t.Func([t.Record({canister_id:e})],[],[]),uninstall_code:t.Func([t.Record({canister_id:e})],[],[]),update_settings:t.Func([t.Record({canister_id:t.Principal,settings:n})],[],[])})};var Rt=({IDL:t})=>{let e=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,satellite_id:t.Principal}),r=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,expires_at:t.Opt(t.Nat64)}),n=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),expires_at:t.Opt(t.Nat64)}),i=t.Record({e8s:t.Nat64});return t.Service({add_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),add_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),create_satellite:t.Func([t.Text],[e],[]),del_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),del_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),get_user:t.Func([],[t.Principal],["query"]),list_mission_control_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,r))],["query"]),list_satellites:t.Func([],[t.Vec(t.Tuple(t.Principal,e))],["query"]),remove_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),remove_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),set_mission_control_controllers:t.Func([t.Vec(t.Principal),n],[],[]),set_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal),n],[],[]),top_up:t.Func([t.Principal,i],[],[]),version:t.Func([],[t.Text],["query"])})};var vt=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),n=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,expires_at:t.Opt(t.Nat64)}),i=t.Record({updated_at:t.Opt(t.Nat64)}),o=t.Record({headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text))))}),a=t.Record({storage:o}),c=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),created_at:t.Nat64}),l=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text))}),u=t.Record({token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),p=t.Variant({Callback:t.Record({token:u,callback:t.Func([],[],[])})}),f=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(p),status_code:t.Nat16}),h=t.Record({token:t.Opt(u),body:t.Vec(t.Nat8)}),y=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,encoding_type:t.Opt(t.Text),full_path:t.Text}),x=t.Record({batch_id:t.Nat}),j=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),rt=t.Record({field:j,desc:t.Bool}),$=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),V=t.Record({order:t.Opt(rt),matcher:t.Opt(t.Text),paginate:t.Opt($)}),nt=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,full_path:t.Text}),H=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),he=t.Record({key:nt,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,H)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),me=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,he))}),ye=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),_e=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,c))}),gt=t.Variant({Db:t.Null,Storage:t.Null}),K=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),we=t.Record({updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:K,created_at:t.Nat64,write:K}),xe=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),expires_at:t.Opt(t.Nat64)}),ge=t.Record({controller:xe,controllers:t.Vec(t.Principal)}),Te=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8)}),Fe=t.Record({updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:K,write:K}),Ae=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat}),Ce=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Opt(t.Text)],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,n))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,i],[],[]),get_config:t.Func([],[a],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(c)],["query"]),http_request:t.Func([l],[f],["query"]),http_request_streaming_callback:t.Func([u],[h],["query"]),init_asset_upload:t.Func([y],[x],[]),list_assets:t.Func([t.Opt(t.Text),V],[me],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,n))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,ye))],["query"]),list_docs:t.Func([t.Text,V],[_e],["query"]),list_rules:t.Func([gt],[t.Vec(t.Tuple(t.Text,we))],["query"]),set_config:t.Func([a],[],[]),set_controllers:t.Func([ge],[t.Vec(t.Tuple(t.Principal,n))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,Te],[c],[]),set_rule:t.Func([gt,t.Text,Fe],[],[]),upload_asset_chunk:t.Func([Ae],[Ce],[]),version:t.Func([],[t.Text],["query"])})};var ne=Ft(zt());var Q;(function(t){t[t.SysFatal=1]="SysFatal",t[t.SysTransient=2]="SysTransient",t[t.DestinationInvalid=3]="DestinationInvalid",t[t.CanisterReject=4]="CanisterReject",t[t.CanisterError=5]="CanisterError"})(Q||(Q={}));var Or=new TextEncoder().encode(`
2
- ic-request`);var X=class{getPrincipal(){return d.anonymous()}async transformRequest(e){return Object.assign(Object.assign({},e),{body:{content:e.body}})}};var Gt=Ft(Re());var Z;(function(t){t.Call="call"})(Z||(Z={}));function q(){let t=new ArrayBuffer(16),e=new DataView(t),r=BigInt(+Date.now()),n=Math.floor(Math.random()*4294967295),i=Math.floor(Math.random()*4294967295);if(typeof e.setBigUint64=="function")e.setBigUint64(0,r);else{let o=BigInt(1)<<BigInt(32);e.setUint32(0,Number(r>>BigInt(32))),e.setUint32(4,Number(r%o))}return e.setUint32(8,n),e.setUint32(12,i),t}var ir=BigInt(1e6),or=BigInt(60*1e3),S=class{constructor(e){this._value=(BigInt(Date.now())+BigInt(e)-or)*ir}toCBOR(){return Gt.value.u64(this._value.toString(16),16)}toHash(){return At(this._value)}};function Yt(t=q){return async e=>{let r=t(),n=e.request.headers?new Headers(e.request.headers):new Headers;e.request.headers=n,e.endpoint==="call"&&(e.body.nonce=t())}}var C;(function(t){t.Received="received",t.Processing="processing",t.Replied="replied",t.Rejected="rejected",t.Unknown="unknown",t.Done="done"})(C||(C={}));var I=5*60*1e3,sr="308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae",cr="ic0.app",lr=".ic0.app",ur="icp0.io",pr=".icp0.io",fr="icp-api.io",dr=".icp-api.io",M=class extends k{constructor(e){super(e),this.message=e}},U=class extends k{constructor(e){super(e),this.message=e}};function hr(){let t;if(typeof window<"u")if(window.fetch)t=window.fetch.bind(window);else throw new M("Fetch implementation was not available. You appear to be in a browser context, but window.fetch was not present.");else if(typeof window<"u")if(window.fetch)t=window.fetch.bind(window);else throw new M("Fetch implementation was not available. You appear to be in a Node.js context, but global.fetch was not available.");else typeof self<"u"&&self.fetch&&(t=self.fetch.bind(self));if(t)return t;throw new M("Fetch implementation was not available. Please provide fetch to the HttpAgent constructor, or ensure it is available in the window or global context.")}var P=class{constructor(e={}){if(this.rootKey=Ct(sr),this._pipeline=[],this._timeDiffMsecs=0,this._rootKeyFetched=!1,this._retryTimes=3,this._isAgent=!0,e.source){if(!(e.source instanceof P))throw new Error("An Agent's source can only be another HttpAgent");this._pipeline=[...e.source._pipeline],this._identity=e.source._identity,this._fetch=e.source._fetch,this._host=e.source._host,this._credentials=e.source._credentials}else this._fetch=e.fetch||hr()||fetch.bind(window),this._fetchOptions=e.fetchOptions,this._callOptions=e.callOptions;if(e.host!==void 0)!e.host.match(/^[a-z]+:/)&&typeof window<"u"?this._host=new URL(window.location.protocol+"//"+e.host):this._host=new URL(e.host);else if(e.source!==void 0)this._host=e.source._host;else{let r=typeof window<"u"?window.location:void 0;if(!r)throw new Error("Must specify a host to connect to.");this._host=new URL(r+"")}if(e.retryTimes!==void 0&&(this._retryTimes=e.retryTimes),this._host.hostname.endsWith(lr)?this._host.hostname=cr:this._host.hostname.endsWith(pr)?this._host.hostname=ur:this._host.hostname.endsWith(dr)&&(this._host.hostname=fr),e.credentials){let{name:r,password:n}=e.credentials;this._credentials=`${r}${n?":"+n:""}`}this._identity=Promise.resolve(e.identity||new X),e.disableNonce||this.addTransform(Yt(q))}isLocal(){let e=this._host.hostname;return e==="127.0.0.1"||e.endsWith("localhost")}addTransform(e,r=e.priority||0){let n=this._pipeline.findIndex(i=>(i.priority||0)<r);this._pipeline.splice(n>=0?n:this._pipeline.length,0,Object.assign(e,{priority:r}))}async getPrincipal(){if(!this._identity)throw new U("This identity has expired due this application's security policy. Please refresh your authentication.");return(await this._identity).getPrincipal()}async call(e,r,n){let i=await(n!==void 0?await n:await this._identity);if(!i)throw new U("This identity has expired due this application's security policy. Please refresh your authentication.");let o=d.from(e),a=r.effectiveCanisterId?d.from(r.effectiveCanisterId):o,c=i.getPrincipal()||d.anonymous(),l=new S(I);Math.abs(this._timeDiffMsecs)>1e3*30&&(l=new S(I+this._timeDiffMsecs));let u={request_type:Z.Call,canister_id:o,method_name:r.methodName,arg:r.arg,sender:c,ingress_expiry:l},p=await this._transform({request:{body:null,method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"call",body:u});p=await i.transformRequest(p);let f=W(p.body),h=this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${a.toText()}/call`,this._host),Object.assign(Object.assign(Object.assign({},this._callOptions),p.request),{body:f}))),[y,x]=await Promise.all([h,it(u)]);return{requestId:x,response:{ok:y.ok,status:y.status,statusText:y.statusText}}}async _requestAndRetry(e,r=0){if(r>this._retryTimes&&this._retryTimes!==0)throw new Error(`AgentError: Exceeded configured limit of ${this._retryTimes} retry attempts. Please check your network connection or try again in a few moments`);let n=await e();if(!n.ok){let i=await n.clone().text(),o=`Server returned an error:
1
+ import{a as Vt,b as Ee,c as Bt,d as f,e as Ut,f as y,g as ve,h as z,i as N,j as kt,k as yt,l as Se,m as J,n as Q,o as qt}from"./chunk-CAKYEEJ6.js";var Wt=Vt(X=>{"use strict";X.byteLength=Pe;X.toByteArray=Be;X.fromByteArray=qe;var F=[],g=[],Oe=typeof Uint8Array<"u"?Uint8Array:Array,_t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(S=0,Kt=_t.length;S<Kt;++S)F[S]=_t[S],g[_t.charCodeAt(S)]=S;var S,Kt;g["-".charCodeAt(0)]=62;g["_".charCodeAt(0)]=63;function zt(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Pe(t){var e=zt(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Ve(t,e,r){return(e+r)*3/4-r}function Be(t){var e,r=zt(t),n=r[0],i=r[1],o=new Oe(Ve(t,n,i)),a=0,c=i>0?n-4:n,l;for(l=0;l<c;l+=4)e=g[t.charCodeAt(l)]<<18|g[t.charCodeAt(l+1)]<<12|g[t.charCodeAt(l+2)]<<6|g[t.charCodeAt(l+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return i===2&&(e=g[t.charCodeAt(l)]<<2|g[t.charCodeAt(l+1)]>>4,o[a++]=e&255),i===1&&(e=g[t.charCodeAt(l)]<<10|g[t.charCodeAt(l+1)]<<4|g[t.charCodeAt(l+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function Ue(t){return F[t>>18&63]+F[t>>12&63]+F[t>>6&63]+F[t&63]}function ke(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(Ue(n));return i.join("")}function qe(t){for(var e,r=t.length,n=r%3,i=[],o=16383,a=0,c=r-n;a<c;a+=o)i.push(ke(t,a,a+o>c?c:a+o));return n===1?(e=t[r-1],i.push(F[e>>2]+F[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(F[e>>10]+F[e>>4&63]+F[e<<2&63]+"=")),i.join("")}});var ne=Vt(M=>{"use strict";var xt=Wt(),q=ve(),Gt=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;M.Buffer=s;M.SlowBuffer=ze;M.INSPECT_MAX_BYTES=50;var Z=2147483647;M.kMaxLength=Z;s.TYPED_ARRAY_SUPPORT=Me();!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Me(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function b(t){if(t>Z)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Ft(t)}return Qt(t,e,r)}s.poolSize=8192;function Qt(t,e,r){if(typeof t=="string")return He(t,e);if(ArrayBuffer.isView(t))return $e(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(R(t,ArrayBuffer)||t&&R(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(R(t,SharedArrayBuffer)||t&&R(t.buffer,SharedArrayBuffer)))return gt(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return s.from(n,e,r);var i=Ke(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return s.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}s.from=function(t,e,r){return Qt(t,e,r)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function Xt(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function je(t,e,r){return Xt(t),t<=0?b(t):e!==void 0?typeof r=="string"?b(t).fill(e,r):b(t).fill(e):b(t)}s.alloc=function(t,e,r){return je(t,e,r)};function Ft(t){return Xt(t),b(t<0?0:Rt(t)|0)}s.allocUnsafe=function(t){return Ft(t)};s.allocUnsafeSlow=function(t){return Ft(t)};function He(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=Zt(t,e)|0,n=b(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function wt(t){for(var e=t.length<0?0:Rt(t.length)|0,r=b(e),n=0;n<e;n+=1)r[n]=t[n]&255;return r}function $e(t){if(R(t,Uint8Array)){var e=new Uint8Array(t);return gt(e.buffer,e.byteOffset,e.byteLength)}return wt(t)}function gt(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,s.prototype),n}function Ke(t){if(s.isBuffer(t)){var e=Rt(t.length)|0,r=b(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||At(t.length)?b(0):wt(t);if(t.type==="Buffer"&&Array.isArray(t.data))return wt(t.data)}function Rt(t){if(t>=Z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z.toString(16)+" bytes");return t|0}function ze(t){return+t!=t&&(t=0),s.alloc(+t)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype};s.compare=function(e,r){if(R(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),R(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(e)||!s.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,o=0,a=Math.min(n,i);o<a;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return s.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=s.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){var a=e[n];if(R(a,Uint8Array))o+a.length>i.length?s.from(a).copy(i,o):Uint8Array.prototype.set.call(i,a,o);else if(s.isBuffer(a))a.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=a.length}return i};function Zt(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||R(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Tt(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return re(t).length;default:if(i)return n?-1:Tt(t).length;e=(""+e).toLowerCase(),i=!0}}s.byteLength=Zt;function We(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return tr(this,e,r);case"utf8":case"utf-8":return Dt(this,e,r);case"ascii":return De(this,e,r);case"latin1":case"binary":return Le(this,e,r);case"base64":return Ze(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return er(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function O(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}s.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)O(this,r,r+1);return this};s.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)O(this,r,r+3),O(this,r+1,r+2);return this};s.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)O(this,r,r+7),O(this,r+1,r+6),O(this,r+2,r+5),O(this,r+3,r+4);return this};s.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?Dt(this,0,e):We.apply(this,arguments)};s.prototype.toLocaleString=s.prototype.toString;s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:s.compare(this,e)===0};s.prototype.inspect=function(){var e="",r=M.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Gt&&(s.prototype[Gt]=s.prototype.inspect);s.prototype.compare=function(e,r,n,i,o){if(R(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var a=o-i,c=n-r,l=Math.min(a,c),u=this.slice(i,o),p=e.slice(r,n),d=0;d<l;++d)if(u[d]!==p[d]){a=u[d],c=p[d];break}return a<c?-1:c<a?1:0};function It(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,At(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=s.from(e,n)),s.isBuffer(e))return e.length===0?-1:Yt(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Yt(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Yt(t,e,r,n,i){var o=1,a=t.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,a/=2,c/=2,r/=2}function l(m,x){return o===1?m[x]:m.readUInt16BE(x*o)}var u;if(i){var p=-1;for(u=r;u<a;u++)if(l(t,u)===l(e,p===-1?0:u-p)){if(p===-1&&(p=u),u-p+1===c)return p*o}else p!==-1&&(u-=u-p),p=-1}else for(r+c>a&&(r=a-c),u=r;u>=0;u--){for(var d=!0,h=0;h<c;h++)if(l(t,u+h)!==l(e,h)){d=!1;break}if(d)return u}return-1}s.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};s.prototype.indexOf=function(e,r,n){return It(this,e,r,n,!0)};s.prototype.lastIndexOf=function(e,r,n){return It(this,e,r,n,!1)};function Ge(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;n>o/2&&(n=o/2);for(var a=0;a<n;++a){var c=parseInt(e.substr(a*2,2),16);if(At(c))return a;t[r+a]=c}return a}function Ye(t,e,r,n){return I(Tt(e,t.length-r),t,r,n)}function Je(t,e,r,n){return I(ir(e),t,r,n)}function Qe(t,e,r,n){return I(re(e),t,r,n)}function Xe(t,e,r,n){return I(or(e,t.length-r),t,r,n)}s.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return Ge(this,e,r,n);case"utf8":case"utf-8":return Ye(this,e,r,n);case"ascii":case"latin1":case"binary":return Je(this,e,r,n);case"base64":return Qe(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xe(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ze(t,e,r){return e===0&&r===t.length?xt.fromByteArray(t):xt.fromByteArray(t.slice(e,r))}function Dt(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],a=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=r){var l,u,p,d;switch(c){case 1:o<128&&(a=o);break;case 2:l=t[i+1],(l&192)===128&&(d=(o&31)<<6|l&63,d>127&&(a=d));break;case 3:l=t[i+1],u=t[i+2],(l&192)===128&&(u&192)===128&&(d=(o&15)<<12|(l&63)<<6|u&63,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:l=t[i+1],u=t[i+2],p=t[i+3],(l&192)===128&&(u&192)===128&&(p&192)===128&&(d=(o&15)<<18|(l&63)<<12|(u&63)<<6|p&63,d>65535&&d<1114112&&(a=d))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=c}return Ie(n)}var Jt=4096;function Ie(t){var e=t.length;if(e<=Jt)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Jt));return r}function De(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function Le(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function tr(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=ar[t[o]];return i}function er(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}s.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var i=this.subarray(e,r);return Object.setPrototypeOf(i,s.prototype),i};function _(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||_(e,r,this.length);for(var i=this[e],o=1,a=0;++a<r&&(o*=256);)i+=this[e+a]*o;return i};s.prototype.readUintBE=s.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||_(e,r,this.length);for(var i=this[e+--r],o=1;r>0&&(o*=256);)i+=this[e+--r]*o;return i};s.prototype.readUint8=s.prototype.readUInt8=function(e,r){return e=e>>>0,r||_(e,1,this.length),this[e]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||_(e,2,this.length),this[e]|this[e+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||_(e,2,this.length),this[e]<<8|this[e+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||_(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};s.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||_(e,r,this.length);for(var i=this[e],o=1,a=0;++a<r&&(o*=256);)i+=this[e+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};s.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||_(e,r,this.length);for(var i=r,o=1,a=this[e+--i];i>0&&(o*=256);)a+=this[e+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*r)),a};s.prototype.readInt8=function(e,r){return e=e>>>0,r||_(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};s.prototype.readInt16LE=function(e,r){e=e>>>0,r||_(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(e,r){e=e>>>0,r||_(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(e,r){return e=e>>>0,r||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};s.prototype.readInt32BE=function(e,r){return e=e>>>0,r||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};s.prototype.readFloatLE=function(e,r){return e=e>>>0,r||_(e,4,this.length),q.read(this,e,!0,23,4)};s.prototype.readFloatBE=function(e,r){return e=e>>>0,r||_(e,4,this.length),q.read(this,e,!1,23,4)};s.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||_(e,8,this.length),q.read(this,e,!0,52,8)};s.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||_(e,8,this.length),q.read(this,e,!1,52,8)};function w(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;w(this,e,r,n,o,0)}var a=1,c=0;for(this[r]=e&255;++c<n&&(a*=256);)this[r+c]=e/a&255;return r+n};s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;w(this,e,r,n,o,0)}var a=n-1,c=1;for(this[r+a]=e&255;--a>=0&&(c*=256);)this[r+a]=e/c&255;return r+n};s.prototype.writeUint8=s.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,1,255,0),this[r]=e&255,r+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};s.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);w(this,e,r,n,o-1,-o)}var a=0,c=1,l=0;for(this[r]=e&255;++a<n&&(c*=256);)e<0&&l===0&&this[r+a-1]!==0&&(l=1),this[r+a]=(e/c>>0)-l&255;return r+n};s.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);w(this,e,r,n,o-1,-o)}var a=n-1,c=1,l=0;for(this[r+a]=e&255;--a>=0&&(c*=256);)e<0&&l===0&&this[r+a+1]!==0&&(l=1),this[r+a]=(e/c>>0)-l&255;return r+n};s.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};s.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};s.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};s.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};s.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Lt(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function te(t,e,r,n,i){return e=+e,r=r>>>0,i||Lt(t,e,r,4,34028234663852886e22,-34028234663852886e22),q.write(t,e,r,n,23,4),r+4}s.prototype.writeFloatLE=function(e,r,n){return te(this,e,r,!0,n)};s.prototype.writeFloatBE=function(e,r,n){return te(this,e,r,!1,n)};function ee(t,e,r,n,i){return e=+e,r=r>>>0,i||Lt(t,e,r,8,17976931348623157e292,-17976931348623157e292),q.write(t,e,r,n,52,8),r+8}s.prototype.writeDoubleLE=function(e,r,n){return ee(this,e,r,!0,n)};s.prototype.writeDoubleBE=function(e,r,n){return ee(this,e,r,!1,n)};s.prototype.copy=function(e,r,n,i){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);var o=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),o};s.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){var o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var a;if(typeof e=="number")for(a=r;a<n;++a)this[a]=e;else{var c=s.isBuffer(e)?e:s.from(e,i),l=c.length;if(l===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<n-r;++a)this[a+r]=c[a%l]}return this};var rr=/[^+/0-9A-Za-z-_]/g;function nr(t){if(t=t.split("=")[0],t=t.trim().replace(rr,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Tt(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function ir(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function or(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function re(t){return xt.toByteArray(nr(t))}function I(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function R(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function At(t){return t!==t}var ar=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var Mt=({IDL:t})=>{let e=t.Principal,r=t.Record({freezing_threshold:t.Nat,controllers:t.Vec(t.Principal),memory_allocation:t.Nat,compute_allocation:t.Nat}),n=t.Record({freezing_threshold:t.Opt(t.Nat),controllers:t.Opt(t.Vec(t.Principal)),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),i=t.Record({value:t.Text,name:t.Text}),o=t.Record({status:t.Nat,body:t.Vec(t.Nat8),headers:t.Vec(i)}),a=t.Variant({dns_error:t.Null,no_consensus:t.Null,transform_error:t.Null,unreachable:t.Null,bad_tls:t.Null,conn_timeout:t.Null,invalid_url:t.Null,timeout:t.Null}),c=t.Vec(t.Nat8);return t.Service({canister_status:t.Func([t.Record({canister_id:e})],[t.Record({status:t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),memory_size:t.Nat,cycles:t.Nat,settings:r,module_hash:t.Opt(t.Vec(t.Nat8))})],[]),create_canister:t.Func([t.Record({settings:t.Opt(n)})],[t.Record({canister_id:e})],[]),delete_canister:t.Func([t.Record({canister_id:e})],[],[]),deposit_cycles:t.Func([t.Record({canister_id:e})],[],[]),http_request:t.Func([t.Record({url:t.Text,method:t.Variant({get:t.Null}),body:t.Opt(t.Vec(t.Nat8)),transform:t.Opt(t.Variant({function:t.Func([o],[o],["query"])})),headers:t.Vec(i)})],[t.Variant({Ok:o,Err:t.Opt(a)})],[]),install_code:t.Func([t.Record({arg:t.Vec(t.Nat8),wasm_module:c,mode:t.Variant({reinstall:t.Null,upgrade:t.Null,install:t.Null}),canister_id:e})],[],[]),provisional_create_canister_with_cycles:t.Func([t.Record({settings:t.Opt(n),amount:t.Opt(t.Nat)})],[t.Record({canister_id:e})],[]),provisional_top_up_canister:t.Func([t.Record({canister_id:e,amount:t.Nat})],[],[]),raw_rand:t.Func([],[t.Vec(t.Nat8)],[]),start_canister:t.Func([t.Record({canister_id:e})],[],[]),stop_canister:t.Func([t.Record({canister_id:e})],[],[]),uninstall_code:t.Func([t.Record({canister_id:e})],[],[]),update_settings:t.Func([t.Record({canister_id:t.Principal,settings:n})],[],[])})};var jt=({IDL:t})=>{let e=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,satellite_id:t.Principal}),r=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,expires_at:t.Opt(t.Nat64)}),n=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),expires_at:t.Opt(t.Nat64)}),i=t.Record({e8s:t.Nat64});return t.Service({add_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),add_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),create_satellite:t.Func([t.Text],[e],[]),del_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),del_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),get_user:t.Func([],[t.Principal],["query"]),list_mission_control_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,r))],["query"]),list_satellites:t.Func([],[t.Vec(t.Tuple(t.Principal,e))],["query"]),remove_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),remove_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),set_mission_control_controllers:t.Func([t.Vec(t.Principal),n],[],[]),set_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal),n],[],[]),top_up:t.Func([t.Principal,i],[],[]),version:t.Func([],[t.Text],["query"])})};var Ht=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),n=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,expires_at:t.Opt(t.Nat64)}),i=t.Record({updated_at:t.Opt(t.Nat64)}),o=t.Record({headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text))))}),a=t.Record({storage:o}),c=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),created_at:t.Nat64}),l=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text))}),u=t.Record({token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),p=t.Variant({Callback:t.Record({token:u,callback:t.Func([],[],[])})}),d=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(p),status_code:t.Nat16}),h=t.Record({token:t.Opt(u),body:t.Vec(t.Nat8)}),m=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,encoding_type:t.Opt(t.Text),full_path:t.Text}),x=t.Record({batch_id:t.Nat}),B=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),H=t.Record({field:B,desc:t.Bool}),U=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),v=t.Record({order:t.Opt(H),matcher:t.Opt(t.Text),paginate:t.Opt(U)}),$=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,full_path:t.Text}),k=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),ot=t.Record({key:$,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,k)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),at=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,ot))}),st=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),ct=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,c))}),K=t.Variant({Db:t.Null,Storage:t.Null}),C=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),lt=t.Record({updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:C,created_at:t.Nat64,write:C}),ut=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),expires_at:t.Opt(t.Nat64)}),pt=t.Record({controller:ut,controllers:t.Vec(t.Principal)}),dt=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8)}),ft=t.Record({updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:C,write:C}),ht=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat}),mt=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Opt(t.Text)],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,n))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,i],[],[]),get_config:t.Func([],[a],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(c)],["query"]),http_request:t.Func([l],[d],["query"]),http_request_streaming_callback:t.Func([u],[h],["query"]),init_asset_upload:t.Func([m],[x],[]),list_assets:t.Func([t.Opt(t.Text),v],[at],["query"]),list_controllers:t.Func([],[t.Vec(t.Principal)],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,st))],["query"]),list_docs:t.Func([t.Text,v],[ct],["query"]),list_rules:t.Func([K],[t.Vec(t.Tuple(t.Text,lt))],["query"]),set_config:t.Func([a],[],[]),set_controllers:t.Func([pt],[t.Vec(t.Tuple(t.Principal,n))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,dt],[c],[]),set_rule:t.Func([K,t.Text,ft],[],[]),upload_asset_chunk:t.Func([ht],[mt],[]),version:t.Func([],[t.Text],["query"])})};var $t=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),n=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,expires_at:t.Opt(t.Nat64)}),i=t.Record({updated_at:t.Opt(t.Nat64)}),o=t.Record({headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text))))}),a=t.Record({storage:o}),c=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),created_at:t.Nat64}),l=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text))}),u=t.Record({token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),p=t.Variant({Callback:t.Record({token:u,callback:t.Func([],[],[])})}),d=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(p),status_code:t.Nat16}),h=t.Record({token:t.Opt(u),body:t.Vec(t.Nat8)}),m=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,encoding_type:t.Opt(t.Text),full_path:t.Text}),x=t.Record({batch_id:t.Nat}),B=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),H=t.Record({field:B,desc:t.Bool}),U=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),v=t.Record({order:t.Opt(H),matcher:t.Opt(t.Text),paginate:t.Opt(U)}),$=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,full_path:t.Text}),k=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),ot=t.Record({key:$,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,k)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),at=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,ot))}),st=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),ct=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,c))}),K=t.Variant({Db:t.Null,Storage:t.Null}),C=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),lt=t.Record({updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:C,created_at:t.Nat64,write:C}),ut=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),expires_at:t.Opt(t.Nat64)}),pt=t.Record({controller:ut,controllers:t.Vec(t.Principal)}),dt=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8)}),ft=t.Record({updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:C,write:C}),ht=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat}),mt=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Opt(t.Text)],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,n))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,i],[],[]),get_config:t.Func([],[a],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(c)],["query"]),http_request:t.Func([l],[d],["query"]),http_request_streaming_callback:t.Func([u],[h],["query"]),init_asset_upload:t.Func([m],[x],[]),list_assets:t.Func([t.Opt(t.Text),v],[at],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,n))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,st))],["query"]),list_docs:t.Func([t.Text,v],[ct],["query"]),list_rules:t.Func([K],[t.Vec(t.Tuple(t.Text,lt))],["query"]),set_config:t.Func([a],[],[]),set_controllers:t.Func([pt],[t.Vec(t.Tuple(t.Principal,n))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,dt],[c],[]),set_rule:t.Func([K,t.Text,ft],[],[]),upload_asset_chunk:t.Func([ht],[mt],[]),version:t.Func([],[t.Text],["query"])})};var ye=Bt(ne());var D;(function(t){t[t.SysFatal=1]="SysFatal",t[t.SysTransient=2]="SysTransient",t[t.DestinationInvalid=3]="DestinationInvalid",t[t.CanisterReject=4]="CanisterReject",t[t.CanisterError=5]="CanisterError"})(D||(D={}));var kr=new TextEncoder().encode(`
2
+ ic-request`);var L=class{getPrincipal(){return f.anonymous()}async transformRequest(e){return Object.assign(Object.assign({},e),{body:{content:e.body}})}};var ie=Bt(Se());var tt;(function(t){t.Call="call"})(tt||(tt={}));function W(){let t=new ArrayBuffer(16),e=new DataView(t),r=BigInt(+Date.now()),n=Math.floor(Math.random()*4294967295),i=Math.floor(Math.random()*4294967295);if(typeof e.setBigUint64=="function")e.setBigUint64(0,r);else{let o=BigInt(1)<<BigInt(32);e.setUint32(0,Number(r>>BigInt(32))),e.setUint32(4,Number(r%o))}return e.setUint32(8,n),e.setUint32(12,i),t}var sr=BigInt(1e6),cr=BigInt(60*1e3),P=class{constructor(e){this._value=(BigInt(Date.now())+BigInt(e)-cr)*sr}toCBOR(){return ie.value.u64(this._value.toString(16),16)}toHash(){return Ut(this._value)}};function oe(t=W){return async e=>{let r=t(),n=e.request.headers?new Headers(e.request.headers):new Headers;e.request.headers=n,e.endpoint==="call"&&(e.body.nonce=t())}}var A;(function(t){t.Received="received",t.Processing="processing",t.Replied="replied",t.Rejected="rejected",t.Unknown="unknown",t.Done="done"})(A||(A={}));var et=5*60*1e3,ur="308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae",pr="ic0.app",dr=".ic0.app",fr="icp0.io",hr=".icp0.io",mr="icp-api.io",yr=".icp-api.io",G=class extends z{constructor(e){super(e),this.message=e}},j=class extends z{constructor(e){super(e),this.message=e}};function _r(){let t;if(typeof window<"u")if(window.fetch)t=window.fetch.bind(window);else throw new G("Fetch implementation was not available. You appear to be in a browser context, but window.fetch was not present.");else if(typeof window<"u")if(window.fetch)t=window.fetch.bind(window);else throw new G("Fetch implementation was not available. You appear to be in a Node.js context, but global.fetch was not available.");else typeof self<"u"&&self.fetch&&(t=self.fetch.bind(self));if(t)return t;throw new G("Fetch implementation was not available. Please provide fetch to the HttpAgent constructor, or ensure it is available in the window or global context.")}var V=class{constructor(e={}){if(this.rootKey=kt(ur),this._pipeline=[],this._timeDiffMsecs=0,this._rootKeyFetched=!1,this._retryTimes=3,this._isAgent=!0,e.source){if(!(e.source instanceof V))throw new Error("An Agent's source can only be another HttpAgent");this._pipeline=[...e.source._pipeline],this._identity=e.source._identity,this._fetch=e.source._fetch,this._host=e.source._host,this._credentials=e.source._credentials}else this._fetch=e.fetch||_r()||fetch.bind(window),this._fetchOptions=e.fetchOptions,this._callOptions=e.callOptions;if(e.host!==void 0)!e.host.match(/^[a-z]+:/)&&typeof window<"u"?this._host=new URL(window.location.protocol+"//"+e.host):this._host=new URL(e.host);else if(e.source!==void 0)this._host=e.source._host;else{let r=typeof window<"u"?window.location:void 0;if(!r)throw new Error("Must specify a host to connect to.");this._host=new URL(r+"")}if(e.retryTimes!==void 0&&(this._retryTimes=e.retryTimes),this._host.hostname.endsWith(dr)?this._host.hostname=pr:this._host.hostname.endsWith(hr)?this._host.hostname=fr:this._host.hostname.endsWith(yr)&&(this._host.hostname=mr),e.credentials){let{name:r,password:n}=e.credentials;this._credentials=`${r}${n?":"+n:""}`}this._identity=Promise.resolve(e.identity||new L),e.disableNonce||this.addTransform(oe(W))}isLocal(){let e=this._host.hostname;return e==="127.0.0.1"||e.endsWith("localhost")}addTransform(e,r=e.priority||0){let n=this._pipeline.findIndex(i=>(i.priority||0)<r);this._pipeline.splice(n>=0?n:this._pipeline.length,0,Object.assign(e,{priority:r}))}async getPrincipal(){if(!this._identity)throw new j("This identity has expired due this application's security policy. Please refresh your authentication.");return(await this._identity).getPrincipal()}async call(e,r,n){let i=await(n!==void 0?await n:await this._identity);if(!i)throw new j("This identity has expired due this application's security policy. Please refresh your authentication.");let o=f.from(e),a=r.effectiveCanisterId?f.from(r.effectiveCanisterId):o,c=i.getPrincipal()||f.anonymous(),l=new P(et);Math.abs(this._timeDiffMsecs)>1e3*30&&(l=new P(et+this._timeDiffMsecs));let u={request_type:tt.Call,canister_id:o,method_name:r.methodName,arg:r.arg,sender:c,ingress_expiry:l},p=await this._transform({request:{body:null,method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"call",body:u});p=await i.transformRequest(p);let d=J(p.body),h=this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${a.toText()}/call`,this._host),Object.assign(Object.assign(Object.assign({},this._callOptions),p.request),{body:d}))),[m,x]=await Promise.all([h,yt(u)]);return{requestId:x,response:{ok:m.ok,status:m.status,statusText:m.statusText}}}async _requestAndRetry(e,r=0){if(r>this._retryTimes&&this._retryTimes!==0)throw new Error(`AgentError: Exceeded configured limit of ${this._retryTimes} retry attempts. Please check your network connection or try again in a few moments`);let n=await e();if(!n.ok){let i=await n.clone().text(),o=`Server returned an error:
3
3
  Code: ${n.status} (${n.statusText})
4
4
  Body: ${i}
5
- `;if(this._retryTimes>r)return console.warn(o+" Retrying request."),await this._requestAndRetry(e,r+1);throw new Error(o)}return n}async query(e,r,n){let i=await(n!==void 0?await n:await this._identity);if(!i)throw new U("This identity has expired due this application's security policy. Please refresh your authentication.");let o=typeof e=="string"?d.fromText(e):e,a=i?.getPrincipal()||d.anonymous(),c={request_type:"query",canister_id:o,method_name:r.methodName,arg:r.arg,sender:a,ingress_expiry:new S(I)},l=await this._transform({request:{method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"read",body:c});l=await i?.transformRequest(l);let u=W(l.body),p=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${o.toText()}/query`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),l.request),{body:u})));return z(await p.arrayBuffer())}async createReadStateRequest(e,r){let n=await(r!==void 0?await r:await this._identity);if(!n)throw new U("This identity has expired due this application's security policy. Please refresh your authentication.");let i=n?.getPrincipal()||d.anonymous(),o=await this._transform({request:{method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"read_state",body:{request_type:"read_state",paths:e.paths,sender:i,ingress_expiry:new S(I)}});return n?.transformRequest(o)}async readState(e,r,n,i){let o=typeof e=="string"?d.fromText(e):e,a=i??await this.createReadStateRequest(r,n),c=W(a.body),l=await this._fetch(""+new URL(`/api/v2/canister/${o}/read_state`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),a.request),{body:c}));if(!l.ok)throw new Error(`Server returned an error:
5
+ `;if(this._retryTimes>r)return console.warn(o+" Retrying request."),await this._requestAndRetry(e,r+1);throw new Error(o)}return n}async query(e,r,n){let i=await(n!==void 0?await n:await this._identity);if(!i)throw new j("This identity has expired due this application's security policy. Please refresh your authentication.");let o=typeof e=="string"?f.fromText(e):e,a=i?.getPrincipal()||f.anonymous(),c={request_type:"query",canister_id:o,method_name:r.methodName,arg:r.arg,sender:a,ingress_expiry:new P(et)},l=await this._transform({request:{method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"read",body:c});l=await i?.transformRequest(l);let u=J(l.body),p=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${o.toText()}/query`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),l.request),{body:u})));return Q(await p.arrayBuffer())}async createReadStateRequest(e,r){let n=await(r!==void 0?await r:await this._identity);if(!n)throw new j("This identity has expired due this application's security policy. Please refresh your authentication.");let i=n?.getPrincipal()||f.anonymous(),o=await this._transform({request:{method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"read_state",body:{request_type:"read_state",paths:e.paths,sender:i,ingress_expiry:new P(et)}});return n?.transformRequest(o)}async readState(e,r,n,i){let o=typeof e=="string"?f.fromText(e):e,a=i??await this.createReadStateRequest(r,n),c=J(a.body),l=await this._fetch(""+new URL(`/api/v2/canister/${o}/read_state`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),a.request),{body:c}));if(!l.ok)throw new Error(`Server returned an error:
6
6
  Code: ${l.status} (${l.statusText})
7
7
  Body: ${await l.text()}
8
- `);return z(await l.arrayBuffer())}async syncTime(e){let r=await import("./canisterStatus-D52DQGXX.js"),n=Date.now();try{e||console.log("Syncing time with the IC. No canisterId provided, so falling back to ryjl3-tyaaa-aaaaa-aaaba-cai");let o=(await r.request({canisterId:e??d.from("ryjl3-tyaaa-aaaaa-aaaba-cai"),agent:this,paths:["time"]})).get("time");o&&(this._timeDiffMsecs=Number(o)-Number(n))}catch(i){console.error("Caught exception while attempting to sync time:",i)}}async status(){let e=this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{},r=await this._requestAndRetry(()=>this._fetch(""+new URL("/api/v2/status",this._host),Object.assign({headers:e},this._fetchOptions)));return z(await r.arrayBuffer())}async fetchRootKey(){return this._rootKeyFetched||(this.rootKey=(await this.status()).root_key,this._rootKeyFetched=!0),this.rootKey}invalidateIdentity(){this._identity=null}replaceIdentity(e){this._identity=Promise.resolve(e)}_transform(e){let r=Promise.resolve(e);for(let n of this._pipeline)r=r.then(i=>n(i).then(o=>o||i));return r}};var Jt;(function(t){t.Error="err",t.GetPrincipal="gp",t.GetPrincipalResponse="gpr",t.Query="q",t.QueryResponse="qr",t.Call="c",t.CallResponse="cr",t.ReadState="rs",t.ReadStateResponse="rsr",t.Status="s",t.StatusResponse="sr"})(Jt||(Jt={}));function dt(){let t=typeof window>"u"&&typeof window>"u"?typeof self>"u"?void 0:self.ic.agent:window.ic.agent;if(!t)throw new Error("No Agent could be found.");return t}var D={};Ee(D,{backoff:()=>Dt,chain:()=>Lt,conditionalDelay:()=>Zt,defaultStrategy:()=>Qt,maxAttempts:()=>yr,once:()=>Xt,throttle:()=>_r,timeout:()=>It});var mr=5*60*1e3;function Qt(){return Lt(Zt(Xt(),1e3),Dt(1e3,1.2),It(mr))}function Xt(){let t=!0;return async()=>t?(t=!1,!0):!1}function Zt(t,e){return async(r,n,i)=>{if(await t(r,n,i))return new Promise(o=>setTimeout(o,e))}}function yr(t){let e=t;return async(r,n,i)=>{if(--e<=0)throw new Error(`Failed to retrieve a reply for request after ${t} attempts:
9
- Request ID: ${E(n)}
8
+ `);return Q(await l.arrayBuffer())}async syncTime(e){let r=await import("./canisterStatus-D52DQGXX.js"),n=Date.now();try{e||console.log("Syncing time with the IC. No canisterId provided, so falling back to ryjl3-tyaaa-aaaaa-aaaba-cai");let o=(await r.request({canisterId:e??f.from("ryjl3-tyaaa-aaaaa-aaaba-cai"),agent:this,paths:["time"]})).get("time");o&&(this._timeDiffMsecs=Number(o)-Number(n))}catch(i){console.error("Caught exception while attempting to sync time:",i)}}async status(){let e=this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{},r=await this._requestAndRetry(()=>this._fetch(""+new URL("/api/v2/status",this._host),Object.assign({headers:e},this._fetchOptions)));return Q(await r.arrayBuffer())}async fetchRootKey(){return this._rootKeyFetched||(this.rootKey=(await this.status()).root_key,this._rootKeyFetched=!0),this.rootKey}invalidateIdentity(){this._identity=null}replaceIdentity(e){this._identity=Promise.resolve(e)}_transform(e){let r=Promise.resolve(e);for(let n of this._pipeline)r=r.then(i=>n(i).then(o=>o||i));return r}};var ae;(function(t){t.Error="err",t.GetPrincipal="gp",t.GetPrincipalResponse="gpr",t.Query="q",t.QueryResponse="qr",t.Call="c",t.CallResponse="cr",t.ReadState="rs",t.ReadStateResponse="rsr",t.Status="s",t.StatusResponse="sr"})(ae||(ae={}));function Ct(){let t=typeof window>"u"&&typeof window>"u"?typeof self>"u"?void 0:self.ic.agent:window.ic.agent;if(!t)throw new Error("No Agent could be found.");return t}var rt={};Ee(rt,{backoff:()=>pe,chain:()=>de,conditionalDelay:()=>le,defaultStrategy:()=>se,maxAttempts:()=>wr,once:()=>ce,throttle:()=>gr,timeout:()=>ue});var xr=5*60*1e3;function se(){return de(le(ce(),1e3),pe(1e3,1.2),ue(xr))}function ce(){let t=!0;return async()=>t?(t=!1,!0):!1}function le(t,e){return async(r,n,i)=>{if(await t(r,n,i))return new Promise(o=>setTimeout(o,e))}}function wr(t){let e=t;return async(r,n,i)=>{if(--e<=0)throw new Error(`Failed to retrieve a reply for request after ${t} attempts:
9
+ Request ID: ${N(n)}
10
10
  Request status: ${i}
11
- `)}}function _r(t){return()=>new Promise(e=>setTimeout(e,t))}function It(t){let e=Date.now()+t;return async(r,n,i)=>{if(Date.now()>e)throw new Error(`Request timed out after ${t} msec:
12
- Request ID: ${E(n)}
11
+ `)}}function gr(t){return()=>new Promise(e=>setTimeout(e,t))}function ue(t){let e=Date.now()+t;return async(r,n,i)=>{if(Date.now()>e)throw new Error(`Request timed out after ${t} msec:
12
+ Request ID: ${N(n)}
13
13
  Request status: ${i}
14
- `)}}function Dt(t,e){let r=t;return()=>new Promise(n=>setTimeout(()=>{r*=e,n()},r))}function Lt(...t){return async(e,r,n)=>{for(let i of t)await i(e,r,n)}}async function ht(t,e,r,n,i,o){var a;let c=[new TextEncoder().encode("request_status"),r],l=i??await((a=t.createReadStateRequest)===null||a===void 0?void 0:a.call(t,{paths:[c]})),u=await t.readState(e,{paths:[c]},void 0,l);if(t.rootKey==null)throw new Error("Agent root key not initialized before polling");let p=await Et.create({certificate:u.certificate,rootKey:t.rootKey,canisterId:e,blsVerify:o}),f=p.lookup([...c,new TextEncoder().encode("status")]),h;switch(typeof f>"u"?h=C.Unknown:h=new TextDecoder().decode(f),h){case C.Replied:return p.lookup([...c,"reply"]);case C.Received:case C.Unknown:case C.Processing:return await n(e,r,h),ht(t,e,r,n,l);case C.Rejected:{let y=new Uint8Array(p.lookup([...c,"reject_code"]))[0],x=new TextDecoder().decode(p.lookup([...c,"reject_message"]));throw new Error(`Call was rejected:
15
- Request ID: ${E(r)}
16
- Reject code: ${y}
14
+ `)}}function pe(t,e){let r=t;return()=>new Promise(n=>setTimeout(()=>{r*=e,n()},r))}function de(...t){return async(e,r,n)=>{for(let i of t)await i(e,r,n)}}async function Nt(t,e,r,n,i,o){var a;let c=[new TextEncoder().encode("request_status"),r],l=i??await((a=t.createReadStateRequest)===null||a===void 0?void 0:a.call(t,{paths:[c]})),u=await t.readState(e,{paths:[c]},void 0,l);if(t.rootKey==null)throw new Error("Agent root key not initialized before polling");let p=await qt.create({certificate:u.certificate,rootKey:t.rootKey,canisterId:e,blsVerify:o}),d=p.lookup([...c,new TextEncoder().encode("status")]),h;switch(typeof d>"u"?h=A.Unknown:h=new TextDecoder().decode(d),h){case A.Replied:return p.lookup([...c,"reply"]);case A.Received:case A.Unknown:case A.Processing:return await n(e,r,h),Nt(t,e,r,n,l);case A.Rejected:{let m=new Uint8Array(p.lookup([...c,"reject_code"]))[0],x=new TextDecoder().decode(p.lookup([...c,"reject_message"]));throw new Error(`Call was rejected:
15
+ Request ID: ${N(r)}
16
+ Reject code: ${m}
17
17
  Reject text: ${x}
18
- `)}case C.Done:throw new Error(`Call was marked as done but we never saw the reply:
19
- Request ID: ${E(r)}
20
- `)}throw new Error("unreachable")}var te=({IDL:t})=>{let e=t.Principal,r=t.Record({controllers:t.Vec(t.Principal),freezing_threshold:t.Nat,memory_allocation:t.Nat,compute_allocation:t.Nat}),n=t.Record({controllers:t.Opt(t.Vec(t.Principal)),freezing_threshold:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),i=t.Vec(t.Nat8);return t.Service({canister_status:t.Func([t.Record({canister_id:e})],[t.Record({status:t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),memory_size:t.Nat,cycles:t.Nat,settings:r,module_hash:t.Opt(t.Vec(t.Nat8))})],[]),create_canister:t.Func([t.Record({settings:t.Opt(n)})],[t.Record({canister_id:e})],[]),delete_canister:t.Func([t.Record({canister_id:e})],[],[]),deposit_cycles:t.Func([t.Record({canister_id:e})],[],[]),install_code:t.Func([t.Record({arg:t.Vec(t.Nat8),wasm_module:i,mode:t.Variant({reinstall:t.Null,upgrade:t.Null,install:t.Null}),canister_id:e})],[],[]),provisional_create_canister_with_cycles:t.Func([t.Record({settings:t.Opt(n),amount:t.Opt(t.Nat)})],[t.Record({canister_id:e})],[]),provisional_top_up_canister:t.Func([t.Record({canister_id:e,amount:t.Nat})],[],[]),raw_rand:t.Func([],[t.Vec(t.Nat8)],[]),start_canister:t.Func([t.Record({canister_id:e})],[],[]),stop_canister:t.Func([t.Record({canister_id:e})],[],[]),uninstall_code:t.Func([t.Record({canister_id:e})],[],[]),update_settings:t.Func([t.Record({canister_id:t.Principal,settings:n})],[],[])})};var L=class extends k{constructor(e,r,n,i){super(["Call failed:",` Canister: ${e.toText()}`,` Method: ${r} (${n})`,...Object.getOwnPropertyNames(i).map(o=>` "${o}": ${JSON.stringify(i[o])}`)].join(`
21
- `)),this.canisterId=e,this.methodName=r,this.type=n,this.props=i}},mt=class extends L{constructor(e,r,n){var i;super(e,r,"query",{Status:n.status,Code:(i=Q[n.reject_code])!==null&&i!==void 0?i:`Unknown Code "${n.reject_code}"`,Message:n.reject_message}),this.result=n}},yt=class extends L{constructor(e,r,n,i){super(e,r,"update",{"Request ID":E(n),"HTTP status code":i.status.toString(),"HTTP status text":i.statusText}),this.requestId=n,this.response=i}},_t;(function(t){t.Install="install",t.Reinstall="reinstall",t.Upgrade="upgrade"})(_t||(_t={}));var T=Symbol.for("ic-agent-metadata"),R=class{constructor(e){this[T]=Object.freeze(e)}static agentOf(e){return e[T].config.agent}static interfaceOf(e){return e[T].service}static canisterIdOf(e){return d.from(e[T].config.canisterId)}static async install(e,r){let n=e.mode===void 0?_t.Install:e.mode,i=e.arg?[...new Uint8Array(e.arg)]:[],o=[...new Uint8Array(e.module)],a=typeof r.canisterId=="string"?d.fromText(r.canisterId):r.canisterId;await re(r).install_code({mode:{[n]:null},arg:i,wasm_module:o,canister_id:a})}static async createCanister(e){let{canister_id:r}=await re(e||{}).provisional_create_canister_with_cycles({amount:[],settings:[]});return r}static async createAndInstallCanister(e,r,n){let i=await this.createCanister(n);return await this.install(Object.assign({},r),Object.assign(Object.assign({},n),{canisterId:i})),this.createActor(e,Object.assign(Object.assign({},n),{canisterId:i}))}static createActorClass(e){let r=e({IDL:_});class n extends R{constructor(o){let a=typeof o.canisterId=="string"?d.fromText(o.canisterId):o.canisterId;super({config:Object.assign(Object.assign(Object.assign({},ie),o),{canisterId:a}),service:r});for(let[c,l]of r._fields)this[c]=xr(this,c,l,o.blsVerify)}}return n}static createActor(e,r){return new(this.createActorClass(e))(r)}};function ee(t,e){let r=_.decode(t,ne.Buffer.from(e));switch(r.length){case 0:return;case 1:return r[0];default:return r}}var ie={pollingStrategyFactory:D.defaultStrategy};function xr(t,e,r,n){let i;r.annotations.includes("query")?i=async(a,...c)=>{var l,u;a=Object.assign(Object.assign({},a),(u=(l=t[T].config).queryTransform)===null||u===void 0?void 0:u.call(l,e,c,Object.assign(Object.assign({},t[T].config),a)));let p=a.agent||t[T].config.agent||dt(),f=d.from(a.canisterId||t[T].config.canisterId),h=_.encode(r.argTypes,c),y=await p.query(f,{methodName:e,arg:h});switch(y.status){case"rejected":throw new mt(f,e,y);case"replied":return ee(r.retTypes,y.reply.arg)}}:i=async(a,...c)=>{var l,u;a=Object.assign(Object.assign({},a),(u=(l=t[T].config).callTransform)===null||u===void 0?void 0:u.call(l,e,c,Object.assign(Object.assign({},t[T].config),a)));let p=a.agent||t[T].config.agent||dt(),{canisterId:f,effectiveCanisterId:h,pollingStrategyFactory:y}=Object.assign(Object.assign(Object.assign({},ie),t[T].config),a),x=d.from(f),j=h!==void 0?d.from(h):x,rt=_.encode(r.argTypes,c),{requestId:$,response:V}=await p.call(x,{methodName:e,arg:rt,effectiveCanisterId:j});if(!V.ok)throw new yt(x,e,$,V);let nt=y(),H=await ht(p,j,$,nt,n);if(H!==void 0)return ee(r.retTypes,H);if(r.retTypes.length===0)return;throw new Error(`Call was returned undefined, but type [${r.retTypes.join(",")}].`)};let o=(...a)=>i({},...a);return o.withOptions=a=>(...c)=>i(a,...c),o}function re(t){function e(r,n,i){let o=n[0],a=d.fromHex("");return o&&typeof o=="object"&&o.canister_id&&(a=d.from(o.canister_id)),{effectiveCanisterId:a}}return R.createActor(te,Object.assign(Object.assign(Object.assign({},t),{canisterId:d.fromHex("")}),{callTransform:e,queryTransform:e}))}var wt=async({canisterId:t,idlFactory:e,identity:r,fetch:n,env:i="prod",config:o})=>{let a=i==="dev"?"http://127.0.0.1:8000/":"https://icp0.io",c=new P({identity:r,...a&&{host:a},...n&&{fetch:n}});return i==="dev"&&await c.fetchRootKey(),R.createActor(e,{agent:c,canisterId:t,...o!==void 0?o:{}})};var tt=async({satelliteId:t,...e})=>ae({canisterId:t,...e,idlFactory:vt}),xt=async({missionControlId:t,...e})=>ae({canisterId:t,...e,idlFactory:Rt});var ae=async({canisterId:t,idlFactory:e,...r})=>{if(!t)throw new Error("No canister ID provided.");return wt({canisterId:t,idlFactory:e,...r})},se=d.fromText("aaaaa-aa"),oe=(t,e,r)=>{let n=e[0],i=se;return n&&typeof n=="object"&&n.canister_id&&(i=d.from(n.canister_id)),{effectiveCanisterId:i}},ce=t=>wt({canisterId:se.toText(),config:{callTransform:oe,queryTransform:oe},idlFactory:bt,...t});var et=async({actor:t,code:e})=>{let{install_code:r}=await ce(t);return r({...e,mode:{upgrade:null}})};var le=async({missionControl:t})=>(await xt(t)).version(),ue=async({missionControl:t})=>(await xt(t)).get_user();var ei=async t=>le(t),ri=async({missionControl:t,wasm_module:e})=>{let r=await ue({missionControl:t}),{missionControlId:n,...i}=t;if(!n)throw new Error("No mission control principal defined.");let o=_.encode([_.Record({user:_.Principal})],[{user:r}]);await et({actor:i,code:{canister_id:d.fromText(n),arg:[...new Uint8Array(o)],wasm_module:e}})};var pe=async({config:t,satellite:e})=>(await tt(e)).set_config(t),fe=async({satellite:t})=>(await tt(t)).version(),de=async({satellite:t})=>(await tt(t)).list_controllers();var ui=async({config:{storage:{headers:t}},satellite:e})=>{let r=t.map(({source:n,headers:i})=>[n,i]);return pe({satellite:e,config:{storage:{headers:r}}})},pi=async t=>fe(t),fi=async({satellite:t,wasm_module:e})=>{let r=await de({satellite:t}),{satelliteId:n,...i}=t;if(!n)throw new Error("No satellite principal defined.");let o=_.encode([_.Record({controllers:_.Vec(_.Principal)})],[{controllers:r.map(([a,c])=>a)}]);await et({actor:i,code:{canister_id:d.fromText(n),arg:[...new Uint8Array(o)],wasm_module:e}})};export{ei as missionControlVersion,pi as satelliteVersion,ui as setConfig,ri as upgradeMissionControl,fi as upgradeSatellite};
18
+ `)}case A.Done:throw new Error(`Call was marked as done but we never saw the reply:
19
+ Request ID: ${N(r)}
20
+ `)}throw new Error("unreachable")}var fe=({IDL:t})=>{let e=t.Principal,r=t.Record({controllers:t.Vec(t.Principal),freezing_threshold:t.Nat,memory_allocation:t.Nat,compute_allocation:t.Nat}),n=t.Record({controllers:t.Opt(t.Vec(t.Principal)),freezing_threshold:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),i=t.Vec(t.Nat8);return t.Service({canister_status:t.Func([t.Record({canister_id:e})],[t.Record({status:t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),memory_size:t.Nat,cycles:t.Nat,settings:r,module_hash:t.Opt(t.Vec(t.Nat8))})],[]),create_canister:t.Func([t.Record({settings:t.Opt(n)})],[t.Record({canister_id:e})],[]),delete_canister:t.Func([t.Record({canister_id:e})],[],[]),deposit_cycles:t.Func([t.Record({canister_id:e})],[],[]),install_code:t.Func([t.Record({arg:t.Vec(t.Nat8),wasm_module:i,mode:t.Variant({reinstall:t.Null,upgrade:t.Null,install:t.Null}),canister_id:e})],[],[]),provisional_create_canister_with_cycles:t.Func([t.Record({settings:t.Opt(n),amount:t.Opt(t.Nat)})],[t.Record({canister_id:e})],[]),provisional_top_up_canister:t.Func([t.Record({canister_id:e,amount:t.Nat})],[],[]),raw_rand:t.Func([],[t.Vec(t.Nat8)],[]),start_canister:t.Func([t.Record({canister_id:e})],[],[]),stop_canister:t.Func([t.Record({canister_id:e})],[],[]),uninstall_code:t.Func([t.Record({canister_id:e})],[],[]),update_settings:t.Func([t.Record({canister_id:t.Principal,settings:n})],[],[])})};var nt=class extends z{constructor(e,r,n,i){super(["Call failed:",` Canister: ${e.toText()}`,` Method: ${r} (${n})`,...Object.getOwnPropertyNames(i).map(o=>` "${o}": ${JSON.stringify(i[o])}`)].join(`
21
+ `)),this.canisterId=e,this.methodName=r,this.type=n,this.props=i}},bt=class extends nt{constructor(e,r,n){var i;super(e,r,"query",{Status:n.status,Code:(i=D[n.reject_code])!==null&&i!==void 0?i:`Unknown Code "${n.reject_code}"`,Message:n.reject_message}),this.result=n}},Et=class extends nt{constructor(e,r,n,i){super(e,r,"update",{"Request ID":N(n),"HTTP status code":i.status.toString(),"HTTP status text":i.statusText}),this.requestId=n,this.response=i}},vt;(function(t){t.Install="install",t.Reinstall="reinstall",t.Upgrade="upgrade"})(vt||(vt={}));var T=Symbol.for("ic-agent-metadata"),E=class{constructor(e){this[T]=Object.freeze(e)}static agentOf(e){return e[T].config.agent}static interfaceOf(e){return e[T].service}static canisterIdOf(e){return f.from(e[T].config.canisterId)}static async install(e,r){let n=e.mode===void 0?vt.Install:e.mode,i=e.arg?[...new Uint8Array(e.arg)]:[],o=[...new Uint8Array(e.module)],a=typeof r.canisterId=="string"?f.fromText(r.canisterId):r.canisterId;await me(r).install_code({mode:{[n]:null},arg:i,wasm_module:o,canister_id:a})}static async createCanister(e){let{canister_id:r}=await me(e||{}).provisional_create_canister_with_cycles({amount:[],settings:[]});return r}static async createAndInstallCanister(e,r,n){let i=await this.createCanister(n);return await this.install(Object.assign({},r),Object.assign(Object.assign({},n),{canisterId:i})),this.createActor(e,Object.assign(Object.assign({},n),{canisterId:i}))}static createActorClass(e){let r=e({IDL:y});class n extends E{constructor(o){let a=typeof o.canisterId=="string"?f.fromText(o.canisterId):o.canisterId;super({config:Object.assign(Object.assign(Object.assign({},_e),o),{canisterId:a}),service:r});for(let[c,l]of r._fields)this[c]=Fr(this,c,l,o.blsVerify)}}return n}static createActor(e,r){return new(this.createActorClass(e))(r)}};function he(t,e){let r=y.decode(t,ye.Buffer.from(e));switch(r.length){case 0:return;case 1:return r[0];default:return r}}var _e={pollingStrategyFactory:rt.defaultStrategy};function Fr(t,e,r,n){let i;r.annotations.includes("query")?i=async(a,...c)=>{var l,u;a=Object.assign(Object.assign({},a),(u=(l=t[T].config).queryTransform)===null||u===void 0?void 0:u.call(l,e,c,Object.assign(Object.assign({},t[T].config),a)));let p=a.agent||t[T].config.agent||Ct(),d=f.from(a.canisterId||t[T].config.canisterId),h=y.encode(r.argTypes,c),m=await p.query(d,{methodName:e,arg:h});switch(m.status){case"rejected":throw new bt(d,e,m);case"replied":return he(r.retTypes,m.reply.arg)}}:i=async(a,...c)=>{var l,u;a=Object.assign(Object.assign({},a),(u=(l=t[T].config).callTransform)===null||u===void 0?void 0:u.call(l,e,c,Object.assign(Object.assign({},t[T].config),a)));let p=a.agent||t[T].config.agent||Ct(),{canisterId:d,effectiveCanisterId:h,pollingStrategyFactory:m}=Object.assign(Object.assign(Object.assign({},_e),t[T].config),a),x=f.from(d),B=h!==void 0?f.from(h):x,H=y.encode(r.argTypes,c),{requestId:U,response:v}=await p.call(x,{methodName:e,arg:H,effectiveCanisterId:B});if(!v.ok)throw new Et(x,e,U,v);let $=m(),k=await Nt(p,B,U,$,n);if(k!==void 0)return he(r.retTypes,k);if(r.retTypes.length===0)return;throw new Error(`Call was returned undefined, but type [${r.retTypes.join(",")}].`)};let o=(...a)=>i({},...a);return o.withOptions=a=>(...c)=>i(a,...c),o}function me(t){function e(r,n,i){let o=n[0],a=f.fromHex("");return o&&typeof o=="object"&&o.canister_id&&(a=f.from(o.canister_id)),{effectiveCanisterId:a}}return E.createActor(fe,Object.assign(Object.assign(Object.assign({},t),{canisterId:f.fromHex("")}),{callTransform:e,queryTransform:e}))}var St=async({canisterId:t,idlFactory:e,identity:r,fetch:n,env:i="prod",config:o})=>{let a=i==="dev"?"http://127.0.0.1:8000/":"https://icp0.io",c=new V({identity:r,...a&&{host:a},...n&&{fetch:n}});return i==="dev"&&await c.fetchRootKey(),E.createActor(e,{agent:c,canisterId:t,...o!==void 0?o:{}})};var we=async({satelliteId:t,...e})=>Pt({canisterId:t,...e,idlFactory:Ht}),it=async({satelliteId:t,...e})=>Pt({canisterId:t,...e,idlFactory:$t}),Ot=async({missionControlId:t,...e})=>Pt({canisterId:t,...e,idlFactory:jt});var Pt=async({canisterId:t,idlFactory:e,...r})=>{if(!t)throw new Error("No canister ID provided.");return St({canisterId:t,idlFactory:e,...r})},ge=f.fromText("aaaaa-aa"),xe=(t,e,r)=>{let n=e[0],i=ge;return n&&typeof n=="object"&&n.canister_id&&(i=f.from(n.canister_id)),{effectiveCanisterId:i}},Te=t=>St({canisterId:ge.toText(),config:{callTransform:xe,queryTransform:xe},idlFactory:Mt,...t});var Y=async({actor:t,code:e})=>{let{install_code:r}=await Te(t);return r({...e,mode:{upgrade:null}})};var Fe=async({missionControl:t})=>(await Ot(t)).version(),Re=async({missionControl:t})=>(await Ot(t)).get_user();var ai=async t=>Fe(t),si=async({missionControl:t,wasm_module:e})=>{let r=await Re({missionControl:t}),{missionControlId:n,...i}=t;if(!n)throw new Error("No mission control principal defined.");let o=y.encode([y.Record({user:y.Principal})],[{user:r}]);await Y({actor:i,code:{canister_id:f.fromText(n),arg:[...new Uint8Array(o)],wasm_module:e}})};var Ae=async({config:t,satellite:e})=>(await it(e)).set_config(t),Ce=async({satellite:t})=>(await it(t)).version(),Ne=async({satellite:t})=>(await we(t)).list_controllers(),be=async({satellite:t})=>(await it(t)).list_controllers();var mi=async({config:{storage:{headers:t}},satellite:e})=>{let r=t.map(({source:n,headers:i})=>[n,i]);return Ae({satellite:e,config:{storage:{headers:r}}})},yi=async t=>Ce(t),_i=async({satellite:t,wasm_module:e,deprecated:r})=>{let{satelliteId:n,...i}=t;if(!n)throw new Error("No satellite principal defined.");if(r){let c=await Ne({satellite:t}),l=y.encode([y.Record({controllers:y.Vec(y.Principal)})],[{controllers:c}]);await Y({actor:i,code:{canister_id:f.fromText(n),arg:[...new Uint8Array(l)],wasm_module:e}});return}let o=await be({satellite:t}),a=y.encode([y.Record({controllers:y.Vec(y.Principal)})],[{controllers:o.map(([c,l])=>c)}]);await Y({actor:i,code:{canister_id:f.fromText(n),arg:[...new Uint8Array(a)],wasm_module:e}})};export{ai as missionControlVersion,yi as satelliteVersion,mi as setConfig,si as upgradeMissionControl,_i as upgradeSatellite};
22
22
  /*! Bundled license information:
23
23
 
24
24
  buffer/index.js: