@hashgraphonline/standards-sdk 0.0.132 → 0.0.134

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 (35) hide show
  1. package/dist/cjs/hcs-10/base-client.d.ts +8 -1
  2. package/dist/cjs/hcs-10/base-client.d.ts.map +1 -1
  3. package/dist/cjs/{index-U-8_6nvw-DtqqxEKh.cjs → index-U-8_6nvw-D6N0eu0v.cjs} +2 -2
  4. package/dist/cjs/{index-U-8_6nvw-DtqqxEKh.cjs.map → index-U-8_6nvw-D6N0eu0v.cjs.map} +1 -1
  5. package/dist/cjs/{index-DkjLvi-3.cjs → index-VOcWhzLh.cjs} +4 -4
  6. package/dist/cjs/{index-DkjLvi-3.cjs.map → index-VOcWhzLh.cjs.map} +1 -1
  7. package/dist/cjs/standards-sdk.cjs +1 -1
  8. package/dist/cjs/{standards-sdk.es34-ChBjKBbQ-Bp01gBzX.cjs → standards-sdk.es34-ChBjKBbQ-DvtLNZWB.cjs} +2 -2
  9. package/dist/cjs/{standards-sdk.es34-ChBjKBbQ-Bp01gBzX.cjs.map → standards-sdk.es34-ChBjKBbQ-DvtLNZWB.cjs.map} +1 -1
  10. package/dist/es/hcs-10/base-client.d.ts +8 -1
  11. package/dist/es/hcs-10/base-client.d.ts.map +1 -1
  12. package/dist/es/standards-sdk.es20.js +1 -1
  13. package/dist/es/standards-sdk.es26.js +6 -6
  14. package/dist/es/standards-sdk.es32.js +501 -2
  15. package/dist/es/standards-sdk.es32.js.map +1 -1
  16. package/dist/es/standards-sdk.es33.js +64 -456
  17. package/dist/es/standards-sdk.es33.js.map +1 -1
  18. package/dist/es/standards-sdk.es34.js +36 -79
  19. package/dist/es/standards-sdk.es34.js.map +1 -1
  20. package/dist/es/standards-sdk.es35.js +222 -32
  21. package/dist/es/standards-sdk.es35.js.map +1 -1
  22. package/dist/es/standards-sdk.es36.js +100 -183
  23. package/dist/es/standards-sdk.es36.js.map +1 -1
  24. package/dist/es/standards-sdk.es37.js +5 -167
  25. package/dist/es/standards-sdk.es37.js.map +1 -1
  26. package/dist/es/standards-sdk.es38.js +2 -11
  27. package/dist/es/standards-sdk.es38.js.map +1 -1
  28. package/dist/es/standards-sdk.es5.js +42 -0
  29. package/dist/es/standards-sdk.es5.js.map +1 -1
  30. package/dist/es/standards-sdk.es9.js +1 -1
  31. package/dist/umd/hcs-10/base-client.d.ts +8 -1
  32. package/dist/umd/hcs-10/base-client.d.ts.map +1 -1
  33. package/dist/umd/standards-sdk.umd.js +1 -1
  34. package/dist/umd/standards-sdk.umd.js.map +1 -1
  35. package/package.json +1 -1
@@ -7,7 +7,7 @@ read:function(e,t,i,n,o){var a,r,s=8*o-n-1,c=(1<<s)-1,p=c>>1,l=-7,u=i?o-1:0,d=i?
7
7
  * @author Feross Aboukhadijeh <https://feross.org>
8
8
  * @license MIT
9
9
  */
10
- !function(e){const t=v,i=E,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=p,e.SlowBuffer=function(e){+e!=e&&(e=0);return p.alloc(+e)},e.INSPECT_MAX_BYTES=50;const o=2147483647;e.kMaxLength=o;const{Uint8Array:a,ArrayBuffer:r,SharedArrayBuffer:s}=globalThis;function c(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new a(e);return Object.setPrototypeOf(t,p.prototype),t}function p(e,t,i){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,i)}function l(e,t,i){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!p.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const i=0|g(e,t);let n=c(i);const o=n.write(e,t);o!==i&&(n=n.slice(0,o));return n}(e,t);if(r.isView(e))return function(e){if(Y(e,a)){const t=new a(e);return f(t.buffer,t.byteOffset,t.byteLength)}return m(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,r)||e&&Y(e.buffer,r))return f(e,t,i);if(void 0!==s&&(Y(e,s)||e&&Y(e.buffer,s)))return f(e,t,i);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return p.from(n,t,i);const o=function(e){if(p.isBuffer(e)){const t=0|h(e.length),i=c(t);return 0===i.length||e.copy(i,0,0,t),i}if(void 0!==e.length)return"number"!=typeof e.length||Q(e.length)?c(0):m(e);if("Buffer"===e.type&&Array.isArray(e.data))return m(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return p.from(e[Symbol.toPrimitive]("string"),t,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),c(e<0?0:0|h(e))}function m(e){const t=e.length<0?0:0|h(e.length),i=c(t);for(let n=0;n<t;n+=1)i[n]=255&e[n];return i}function f(e,t,i){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(i||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===i?new a(e):void 0===i?new a(e,t):new a(e,t,i),Object.setPrototypeOf(n,p.prototype),n}function h(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function g(e,t){if(p.isBuffer(e))return e.length;if(r.isView(e)||Y(e,r))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const i=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===i)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return Z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return J(e).length;default:if(o)return n?-1:Z(e).length;t=(""+t).toLowerCase(),o=!0}}function b(e,t,i){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,i);case"utf8":case"utf-8":return C(this,t,i);case"ascii":return N(this,t,i);case"latin1":case"binary":return P(this,t,i);case"base64":return _(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,i);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function x(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function y(e,t,i,n,o){if(0===e.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),Q(i=+i)&&(i=o?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(o)return-1;i=e.length-1}else if(i<0){if(!o)return-1;i=0}if("string"==typeof t&&(t=p.from(t,n)),p.isBuffer(t))return 0===t.length?-1:w(e,t,i,n,o);if("number"==typeof t)return t&=255,"function"==typeof a.prototype.indexOf?o?a.prototype.indexOf.call(e,t,i):a.prototype.lastIndexOf.call(e,t,i):w(e,[t],i,n,o);throw new TypeError("val must be string, number or Buffer")}function w(e,t,i,n,o){let a,r=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;r=2,s/=2,c/=2,i/=2}function p(e,t){return 1===r?e[t]:e.readUInt16BE(t*r)}if(o){let n=-1;for(a=i;a<s;a++)if(p(e,a)===p(t,-1===n?0:a-n)){if(-1===n&&(n=a),a-n+1===c)return n*r}else-1!==n&&(a-=a-n),n=-1}else for(i+c>s&&(i=s-c),a=i;a>=0;a--){let i=!0;for(let n=0;n<c;n++)if(p(e,a+n)!==p(t,n)){i=!1;break}if(i)return a}return-1}function k(e,t,i,n){i=Number(i)||0;const o=e.length-i;n?(n=Number(n))>o&&(n=o):n=o;const a=t.length;let r;for(n>a/2&&(n=a/2),r=0;r<n;++r){const n=parseInt(t.substr(2*r,2),16);if(Q(n))return r;e[i+r]=n}return r}function I(e,t,i,n){return X(Z(t,e.length-i),e,i,n)}function T(e,t,i,n){return X(function(e){const t=[];for(let i=0;i<e.length;++i)t.push(255&e.charCodeAt(i));return t}(t),e,i,n)}function S(e,t,i,n){return X(J(t),e,i,n)}function A(e,t,i,n){return X(function(e,t){let i,n,o;const a=[];for(let r=0;r<e.length&&!((t-=2)<0);++r)i=e.charCodeAt(r),n=i>>8,o=i%256,a.push(o),a.push(n);return a}(t,e.length-i),e,i,n)}function _(e,i,n){return 0===i&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(i,n))}function C(e,t,i){i=Math.min(e.length,i);const n=[];let o=t;for(;o<i;){const t=e[o];let a=null,r=t>239?4:t>223?3:t>191?2:1;if(o+r<=i){let i,n,s,c;switch(r){case 1:t<128&&(a=t);break;case 2:i=e[o+1],128==(192&i)&&(c=(31&t)<<6|63&i,c>127&&(a=c));break;case 3:i=e[o+1],n=e[o+2],128==(192&i)&&128==(192&n)&&(c=(15&t)<<12|(63&i)<<6|63&n,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:i=e[o+1],n=e[o+2],s=e[o+3],128==(192&i)&&128==(192&n)&&128==(192&s)&&(c=(15&t)<<18|(63&i)<<12|(63&n)<<6|63&s,c>65535&&c<1114112&&(a=c))}}null===a?(a=65533,r=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),o+=r}return function(e){const t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);let i="",n=0;for(;n<t;)i+=String.fromCharCode.apply(String,e.slice(n,n+=R));return i}(n)}p.TYPED_ARRAY_SUPPORT=function(){try{const e=new a(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,a.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),p.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}}),p.poolSize=8192,p.from=function(e,t,i){return l(e,t,i)},Object.setPrototypeOf(p.prototype,a.prototype),Object.setPrototypeOf(p,a),p.alloc=function(e,t,i){return function(e,t,i){return u(e),e<=0?c(e):void 0!==t?"string"==typeof i?c(e).fill(t,i):c(e).fill(t):c(e)}(e,t,i)},p.allocUnsafe=function(e){return d(e)},p.allocUnsafeSlow=function(e){return d(e)},p.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==p.prototype},p.compare=function(e,t){if(Y(e,a)&&(e=p.from(e,e.offset,e.byteLength)),Y(t,a)&&(t=p.from(t,t.offset,t.byteLength)),!p.isBuffer(e)||!p.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let o=0,a=Math.min(i,n);o<a;++o)if(e[o]!==t[o]){i=e[o],n=t[o];break}return i<n?-1:n<i?1:0},p.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}},p.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return p.alloc(0);let i;if(void 0===t)for(t=0,i=0;i<e.length;++i)t+=e[i].length;const n=p.allocUnsafe(t);let o=0;for(i=0;i<e.length;++i){let t=e[i];if(Y(t,a))o+t.length>n.length?(p.isBuffer(t)||(t=p.from(t)),t.copy(n,o)):a.prototype.set.call(n,t,o);else{if(!p.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,o)}o+=t.length}return n},p.byteLength=g,p.prototype._isBuffer=!0,p.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)x(this,t,t+1);return this},p.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},p.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},p.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?C(this,0,e):b.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===p.compare(this,e)},p.prototype.inspect=function(){let t="";const i=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,i).replace(/(.{2})/g,"$1 ").trim(),this.length>i&&(t+=" ... "),"<Buffer "+t+">"},n&&(p.prototype[n]=p.prototype.inspect),p.prototype.compare=function(e,t,i,n,o){if(Y(e,a)&&(e=p.from(e,e.offset,e.byteLength)),!p.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||i>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(this===e)return 0;let r=(o>>>=0)-(n>>>=0),s=(i>>>=0)-(t>>>=0);const c=Math.min(r,s),l=this.slice(n,o),u=e.slice(t,i);for(let a=0;a<c;++a)if(l[a]!==u[a]){r=l[a],s=u[a];break}return r<s?-1:s<r?1:0},p.prototype.includes=function(e,t,i){return-1!==this.indexOf(e,t,i)},p.prototype.indexOf=function(e,t,i){return y(this,e,t,i,!0)},p.prototype.lastIndexOf=function(e,t,i){return y(this,e,t,i,!1)},p.prototype.write=function(e,t,i,n){if(void 0===t)n="utf8",i=this.length,t=0;else if(void 0===i&&"string"==typeof t)n=t,i=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(i)?(i>>>=0,void 0===n&&(n="utf8")):(n=i,i=void 0)}const o=this.length-t;if((void 0===i||i>o)&&(i=o),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return k(this,e,t,i);case"utf8":case"utf-8":return I(this,e,t,i);case"ascii":case"latin1":case"binary":return T(this,e,t,i);case"base64":return S(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function N(e,t,i){let n="";i=Math.min(e.length,i);for(let o=t;o<i;++o)n+=String.fromCharCode(127&e[o]);return n}function P(e,t,i){let n="";i=Math.min(e.length,i);for(let o=t;o<i;++o)n+=String.fromCharCode(e[o]);return n}function O(e,t,i){const n=e.length;(!t||t<0)&&(t=0),(!i||i<0||i>n)&&(i=n);let o="";for(let a=t;a<i;++a)o+=ee[e[a]];return o}function j(e,t,i){const n=e.slice(t,i);let o="";for(let a=0;a<n.length-1;a+=2)o+=String.fromCharCode(n[a]+256*n[a+1]);return o}function $(e,t,i){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>i)throw new RangeError("Trying to access beyond buffer length")}function F(e,t,i,n,o,a){if(!p.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<a)throw new RangeError('"value" argument is out of bounds');if(i+n>e.length)throw new RangeError("Index out of range")}function L(e,t,i,n,o){W(t,n,o,e,i,7);let a=Number(t&BigInt(4294967295));e[i++]=a,a>>=8,e[i++]=a,a>>=8,e[i++]=a,a>>=8,e[i++]=a;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[i++]=r,r>>=8,e[i++]=r,r>>=8,e[i++]=r,r>>=8,e[i++]=r,i}function U(e,t,i,n,o){W(t,n,o,e,i,7);let a=Number(t&BigInt(4294967295));e[i+7]=a,a>>=8,e[i+6]=a,a>>=8,e[i+5]=a,a>>=8,e[i+4]=a;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[i+3]=r,r>>=8,e[i+2]=r,r>>=8,e[i+1]=r,r>>=8,e[i]=r,i+8}function B(e,t,i,n,o,a){if(i+n>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function M(e,t,n,o,a){return t=+t,n>>>=0,a||B(e,0,n,4),i.write(e,t,n,o,23,4),n+4}function D(e,t,n,o,a){return t=+t,n>>>=0,a||B(e,0,n,8),i.write(e,t,n,o,52,8),n+8}p.prototype.slice=function(e,t){const i=this.length;(e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,p.prototype),n},p.prototype.readUintLE=p.prototype.readUIntLE=function(e,t,i){e>>>=0,t>>>=0,i||$(e,t,this.length);let n=this[e],o=1,a=0;for(;++a<t&&(o*=256);)n+=this[e+a]*o;return n},p.prototype.readUintBE=p.prototype.readUIntBE=function(e,t,i){e>>>=0,t>>>=0,i||$(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n},p.prototype.readUint8=p.prototype.readUInt8=function(e,t){return e>>>=0,t||$(e,1,this.length),this[e]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(e,t){return e>>>=0,t||$(e,2,this.length),this[e]|this[e+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(e,t){return e>>>=0,t||$(e,2,this.length),this[e]<<8|this[e+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(e,t){return e>>>=0,t||$(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(e,t){return e>>>=0,t||$(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},p.prototype.readBigUInt64LE=te((function(e){H(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||V(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))})),p.prototype.readBigUInt64BE=te((function(e){H(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||V(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+i;return(BigInt(n)<<BigInt(32))+BigInt(o)})),p.prototype.readIntLE=function(e,t,i){e>>>=0,t>>>=0,i||$(e,t,this.length);let n=this[e],o=1,a=0;for(;++a<t&&(o*=256);)n+=this[e+a]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},p.prototype.readIntBE=function(e,t,i){e>>>=0,t>>>=0,i||$(e,t,this.length);let n=t,o=1,a=this[e+--n];for(;n>0&&(o*=256);)a+=this[e+--n]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*t)),a},p.prototype.readInt8=function(e,t){return e>>>=0,t||$(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},p.prototype.readInt16LE=function(e,t){e>>>=0,t||$(e,2,this.length);const i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},p.prototype.readInt16BE=function(e,t){e>>>=0,t||$(e,2,this.length);const i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},p.prototype.readInt32LE=function(e,t){return e>>>=0,t||$(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},p.prototype.readInt32BE=function(e,t){return e>>>=0,t||$(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},p.prototype.readBigInt64LE=te((function(e){H(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||V(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),p.prototype.readBigInt64BE=te((function(e){H(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||V(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+i)})),p.prototype.readFloatLE=function(e,t){return e>>>=0,t||$(e,4,this.length),i.read(this,e,!0,23,4)},p.prototype.readFloatBE=function(e,t){return e>>>=0,t||$(e,4,this.length),i.read(this,e,!1,23,4)},p.prototype.readDoubleLE=function(e,t){return e>>>=0,t||$(e,8,this.length),i.read(this,e,!0,52,8)},p.prototype.readDoubleBE=function(e,t){return e>>>=0,t||$(e,8,this.length),i.read(this,e,!1,52,8)},p.prototype.writeUintLE=p.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t>>>=0,i>>>=0,!n){F(this,e,t,i,Math.pow(2,8*i)-1,0)}let o=1,a=0;for(this[t]=255&e;++a<i&&(o*=256);)this[t+a]=e/o&255;return t+i},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(e,t,i,n){if(e=+e,t>>>=0,i>>>=0,!n){F(this,e,t,i,Math.pow(2,8*i)-1,0)}let o=i-1,a=1;for(this[t+o]=255&e;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+i},p.prototype.writeUint8=p.prototype.writeUInt8=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,1,255,0),this[t]=255&e,t+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},p.prototype.writeBigUInt64LE=te((function(e,t=0){return L(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),p.prototype.writeBigUInt64BE=te((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),p.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*i-1);F(this,e,t,i,n-1,-n)}let o=0,a=1,r=0;for(this[t]=255&e;++o<i&&(a*=256);)e<0&&0===r&&0!==this[t+o-1]&&(r=1),this[t+o]=(e/a|0)-r&255;return t+i},p.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*i-1);F(this,e,t,i,n-1,-n)}let o=i-1,a=1,r=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===r&&0!==this[t+o+1]&&(r=1),this[t+o]=(e/a|0)-r&255;return t+i},p.prototype.writeInt8=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},p.prototype.writeInt16LE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},p.prototype.writeInt16BE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},p.prototype.writeInt32LE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},p.prototype.writeInt32BE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},p.prototype.writeBigInt64LE=te((function(e,t=0){return L(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),p.prototype.writeBigInt64BE=te((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),p.prototype.writeFloatLE=function(e,t,i){return M(this,e,t,!0,i)},p.prototype.writeFloatBE=function(e,t,i){return M(this,e,t,!1,i)},p.prototype.writeDoubleLE=function(e,t,i){return D(this,e,t,!0,i)},p.prototype.writeDoubleBE=function(e,t,i){return D(this,e,t,!1,i)},p.prototype.copy=function(e,t,i,n){if(!p.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<i&&(n=i),n===i)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-i&&(n=e.length-t+i);const o=n-i;return this===e&&"function"==typeof a.prototype.copyWithin?this.copyWithin(t,i,n):a.prototype.set.call(e,this.subarray(i,n),t),o},p.prototype.fill=function(e,t,i,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,i=this.length):"string"==typeof i&&(n=i,i=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!p.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;let o;if(t>>>=0,i=void 0===i?this.length:i>>>0,e||(e=0),"number"==typeof e)for(o=t;o<i;++o)this[o]=e;else{const a=p.isBuffer(e)?e:p.from(e,n),r=a.length;if(0===r)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<i-t;++o)this[o+t]=a[o%r]}return this};const z={};function q(e,t,i){z[e]=class extends i{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function K(e){let t="",i=e.length;const n="-"===e[0]?1:0;for(;i>=n+4;i-=3)t=`_${e.slice(i-3,i)}${t}`;return`${e.slice(0,i)}${t}`}function W(e,t,i,n,o,a){if(e>i||e<t){const i="bigint"==typeof t?"n":"";let n;throw n=0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(a+1)}${i}`:`>= -(2${i} ** ${8*(a+1)-1}${i}) and < 2 ** ${8*(a+1)-1}${i}`,new z.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,i){H(t,"offset"),void 0!==e[t]&&void 0!==e[t+i]||V(t,e.length-(i+1))}(n,o,a)}function H(e,t){if("number"!=typeof e)throw new z.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,i){if(Math.floor(e)!==e)throw H(e,i),new z.ERR_OUT_OF_RANGE("offset","an integer",e);if(t<0)throw new z.ERR_BUFFER_OUT_OF_BOUNDS;throw new z.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}q("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),q("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),q("ERR_OUT_OF_RANGE",(function(e,t,i){let n=`The value of "${e}" is out of range.`,o=i;return Number.isInteger(i)&&Math.abs(i)>2**32?o=K(String(i)):"bigint"==typeof i&&(o=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(o=K(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function Z(e,t){let i;t=t||1/0;const n=e.length;let o=null;const a=[];for(let r=0;r<n;++r){if(i=e.charCodeAt(r),i>55295&&i<57344){if(!o){if(i>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(r+1===n){(t-=3)>-1&&a.push(239,191,189);continue}o=i;continue}if(i<56320){(t-=3)>-1&&a.push(239,191,189),o=i;continue}i=65536+(o-55296<<10|i-56320)}else o&&(t-=3)>-1&&a.push(239,191,189);if(o=null,i<128){if((t-=1)<0)break;a.push(i)}else if(i<2048){if((t-=2)<0)break;a.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;a.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return a}function J(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,i,n){let o;for(o=0;o<n&&!(o+i>=t.length||o>=e.length);++o)t[o+i]=e[o];return o}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Q(e){return e!=e}const ee=function(){const e="0123456789abcdef",t=new Array(256);for(let i=0;i<16;++i){const n=16*i;for(let o=0;o<16;++o)t[n+o]=e[i]+e[o]}return t}();function te(e){return"undefined"==typeof BigInt?ie:e}function ie(){throw new Error("BigInt not supported")}}(x);const _=x.Buffer,C=x.Buffer,R=globalThis||self;function N(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var P,O,j={exports:{}},$=j.exports={};function F(){throw new Error("setTimeout has not been defined")}function L(){throw new Error("clearTimeout has not been defined")}function U(e){if(P===setTimeout)return setTimeout(e,0);if((P===F||!P)&&setTimeout)return P=setTimeout,setTimeout(e,0);try{return P(e,0)}catch(t){try{return P.call(null,e,0)}catch(i){return P.call(this,e,0)}}}!function(){try{P="function"==typeof setTimeout?setTimeout:F}catch(e){P=F}try{O="function"==typeof clearTimeout?clearTimeout:L}catch(e){O=L}}();var B,M=[],D=!1,z=-1;function q(){D&&B&&(D=!1,B.length?M=B.concat(M):z=-1,M.length&&K())}function K(){if(!D){var e=U(q);D=!0;for(var t=M.length;t;){for(B=M,M=[];++z<t;)B&&B[z].run();z=-1,t=M.length}B=null,D=!1,function(e){if(O===clearTimeout)return clearTimeout(e);if((O===L||!O)&&clearTimeout)return O=clearTimeout,clearTimeout(e);try{return O(e)}catch(t){try{return O.call(null,e)}catch(i){return O.call(this,e)}}}(e)}}function W(e,t){this.fun=e,this.array=t}function H(){}$.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];M.push(new W(e,t)),1!==M.length||D||U(K)},W.prototype.run=function(){this.fun.apply(null,this.array)},$.title="browser",$.browser=!0,$.env={},$.argv=[],$.version="",$.versions={},$.on=H,$.addListener=H,$.once=H,$.off=H,$.removeListener=H,$.removeAllListeners=H,$.emit=H,$.prependListener=H,$.prependOnceListener=H,$.listeners=function(e){return[]},$.binding=function(e){throw new Error("process.binding is not supported")},$.cwd=function(){return"/"},$.chdir=function(e){throw new Error("process.chdir is not supported")},$.umask=function(){return 0};const V=N(j.exports);function G(e,t){return function(){return e.apply(t,arguments)}}const{toString:Z}=Object.prototype,{getPrototypeOf:J}=Object,{iterator:X,toStringTag:Y}=Symbol,Q=(e=>t=>{const i=Z.call(t);return e[i]||(e[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),ee=e=>(e=e.toLowerCase(),t=>Q(t)===e),te=e=>t=>typeof t===e,{isArray:ie}=Array,ne=te("undefined");const oe=ee("ArrayBuffer");const ae=te("string"),re=te("function"),se=te("number"),ce=e=>null!==e&&"object"==typeof e,pe=e=>{if("object"!==Q(e))return!1;const t=J(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Y in e||X in e)},le=ee("Date"),ue=ee("File"),de=ee("Blob"),me=ee("FileList"),fe=ee("URLSearchParams"),[he,ge,be,xe]=["ReadableStream","Request","Response","Headers"].map(ee);function ve(e,t,{allOwnKeys:i=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),ie(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{const o=i?Object.getOwnPropertyNames(e):Object.keys(e),a=o.length;let r;for(n=0;n<a;n++)r=o[n],t.call(null,e[r],r,e)}}function ye(e,t){t=t.toLowerCase();const i=Object.keys(e);let n,o=i.length;for(;o-- >0;)if(n=i[o],t===n.toLowerCase())return n;return null}const we="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:R,ke=e=>!ne(e)&&e!==we;const Ie=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&J(Uint8Array)),Te=ee("HTMLFormElement"),Se=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype),Ae=ee("RegExp"),Ee=(e,t)=>{const i=Object.getOwnPropertyDescriptors(e),n={};ve(i,((i,o)=>{let a;!1!==(a=t(i,o,e))&&(n[o]=a||i)})),Object.defineProperties(e,n)};const _e=ee("AsyncFunction"),Ce=(Re="function"==typeof setImmediate,Ne=re(we.postMessage),Re?setImmediate:Ne?(Pe=`axios@${Math.random()}`,Oe=[],we.addEventListener("message",(({source:e,data:t})=>{e===we&&t===Pe&&Oe.length&&Oe.shift()()}),!1),e=>{Oe.push(e),we.postMessage(Pe,"*")}):e=>setTimeout(e));var Re,Ne,Pe,Oe;const je="undefined"!=typeof queueMicrotask?queueMicrotask.bind(we):void 0!==V&&V.nextTick||Ce,$e={isArray:ie,isArrayBuffer:oe,isBuffer:function(e){return null!==e&&!ne(e)&&null!==e.constructor&&!ne(e.constructor)&&re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||re(e.append)&&("formdata"===(t=Q(e))||"object"===t&&re(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&oe(e.buffer),t},isString:ae,isNumber:se,isBoolean:e=>!0===e||!1===e,isObject:ce,isPlainObject:pe,isReadableStream:he,isRequest:ge,isResponse:be,isHeaders:xe,isUndefined:ne,isDate:le,isFile:ue,isBlob:de,isRegExp:Ae,isFunction:re,isStream:e=>ce(e)&&re(e.pipe),isURLSearchParams:fe,isTypedArray:Ie,isFileList:me,forEach:ve,merge:function e(){const{caseless:t}=ke(this)&&this||{},i={},n=(n,o)=>{const a=t&&ye(i,o)||o;pe(i[a])&&pe(n)?i[a]=e(i[a],n):pe(n)?i[a]=e({},n):ie(n)?i[a]=n.slice():i[a]=n};for(let o=0,a=arguments.length;o<a;o++)arguments[o]&&ve(arguments[o],n);return i},extend:(e,t,i,{allOwnKeys:n}={})=>(ve(t,((t,n)=>{i&&re(t)?e[n]=G(t,i):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,i,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),i&&Object.assign(e.prototype,i)},toFlatObject:(e,t,i,n)=>{let o,a,r;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),a=o.length;a-- >0;)r=o[a],n&&!n(r,e,t)||s[r]||(t[r]=e[r],s[r]=!0);e=!1!==i&&J(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype);return t},kindOf:Q,kindOfTest:ee,endsWith:(e,t,i)=>{e=String(e),(void 0===i||i>e.length)&&(i=e.length),i-=t.length;const n=e.indexOf(t,i);return-1!==n&&n===i},toArray:e=>{if(!e)return null;if(ie(e))return e;let t=e.length;if(!se(t))return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},forEachEntry:(e,t)=>{const i=(e&&e[X]).call(e);let n;for(;(n=i.next())&&!n.done;){const i=n.value;t.call(e,i[0],i[1])}},matchAll:(e,t)=>{let i;const n=[];for(;null!==(i=e.exec(t));)n.push(i);return n},isHTMLForm:Te,hasOwnProperty:Se,hasOwnProp:Se,reduceDescriptors:Ee,freezeMethods:e=>{Ee(e,((t,i)=>{if(re(e)&&-1!==["arguments","caller","callee"].indexOf(i))return!1;const n=e[i];re(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")}))}))},toObjectSet:(e,t)=>{const i={},n=e=>{e.forEach((e=>{i[e]=!0}))};return ie(e)?n(e):n(String(e).split(t)),i},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,i){return t.toUpperCase()+i})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:ye,global:we,isContextDefined:ke,isSpecCompliantForm:function(e){return!!(e&&re(e.append)&&"FormData"===e[Y]&&e[X])},toJSONObject:e=>{const t=new Array(10),i=(e,n)=>{if(ce(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const o=ie(e)?[]:{};return ve(e,((e,t)=>{const a=i(e,n+1);!ne(a)&&(o[t]=a)})),t[n]=void 0,o}}return e};return i(e,0)},isAsyncFn:_e,isThenable:e=>e&&(ce(e)||re(e))&&re(e.then)&&re(e.catch),setImmediate:Ce,asap:je,isIterable:e=>null!=e&&re(e[X])};function Fe(e,t,i,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}$e.inherits(Fe,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:$e.toJSONObject(this.config),code:this.code,status:this.status}}});const Le=Fe.prototype,Ue={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{Ue[e]={value:e}})),Object.defineProperties(Fe,Ue),Object.defineProperty(Le,"isAxiosError",{value:!0}),Fe.from=(e,t,i,n,o,a)=>{const r=Object.create(Le);return $e.toFlatObject(e,r,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),Fe.call(r,e.message,t,i,n,o),r.cause=e,r.name=e.name,a&&Object.assign(r,a),r};function Be(e){return $e.isPlainObject(e)||$e.isArray(e)}function Me(e){return $e.endsWith(e,"[]")?e.slice(0,-2):e}function De(e,t,i){return e?e.concat(t).map((function(e,t){return e=Me(e),!i&&t?"["+e+"]":e})).join(i?".":""):t}const ze=$e.toFlatObject($e,{},null,(function(e){return/^is[A-Z]/.test(e)}));function qe(e,t,i){if(!$e.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(i=$e.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!$e.isUndefined(t[e])}))).metaTokens,o=i.visitor||p,a=i.dots,r=i.indexes,s=(i.Blob||"undefined"!=typeof Blob&&Blob)&&$e.isSpecCompliantForm(t);if(!$e.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if($e.isDate(e))return e.toISOString();if(!s&&$e.isBlob(e))throw new Fe("Blob is not supported. Use a Buffer instead.");return $e.isArrayBuffer(e)||$e.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):_.from(e):e}function p(e,i,o){let s=e;if(e&&!o&&"object"==typeof e)if($e.endsWith(i,"{}"))i=n?i:i.slice(0,-2),e=JSON.stringify(e);else if($e.isArray(e)&&function(e){return $e.isArray(e)&&!e.some(Be)}(e)||($e.isFileList(e)||$e.endsWith(i,"[]"))&&(s=$e.toArray(e)))return i=Me(i),s.forEach((function(e,n){!$e.isUndefined(e)&&null!==e&&t.append(!0===r?De([i],n,a):null===r?i:i+"[]",c(e))})),!1;return!!Be(e)||(t.append(De(o,i,a),c(e)),!1)}const l=[],u=Object.assign(ze,{defaultVisitor:p,convertValue:c,isVisitable:Be});if(!$e.isObject(e))throw new TypeError("data must be an object");return function e(i,n){if(!$e.isUndefined(i)){if(-1!==l.indexOf(i))throw Error("Circular reference detected in "+n.join("."));l.push(i),$e.forEach(i,(function(i,a){!0===(!($e.isUndefined(i)||null===i)&&o.call(t,i,$e.isString(a)?a.trim():a,n,u))&&e(i,n?n.concat(a):[a])})),l.pop()}}(e),t}function Ke(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function We(e,t){this._pairs=[],e&&qe(e,this,t)}const He=We.prototype;function Ve(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ge(e,t,i){if(!t)return e;const n=i&&i.encode||Ve;$e.isFunction(i)&&(i={serialize:i});const o=i&&i.serialize;let a;if(a=o?o(t,i):$e.isURLSearchParams(t)?t.toString():new We(t,i).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}He.append=function(e,t){this._pairs.push([e,t])},He.toString=function(e){const t=e?function(t){return e.call(this,t,Ke)}:Ke;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};let Ze=class{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){$e.forEach(this.handlers,(function(t){null!==t&&e(t)}))}};const Je={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xe={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:We,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Ye="undefined"!=typeof window&&"undefined"!=typeof document,Qe="object"==typeof navigator&&navigator||void 0,et=Ye&&(!Qe||["ReactNative","NativeScript","NS"].indexOf(Qe.product)<0),tt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,it=Ye&&window.location.href||"http://localhost",nt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ye,hasStandardBrowserEnv:et,hasStandardBrowserWebWorkerEnv:tt,navigator:Qe,origin:it},Symbol.toStringTag,{value:"Module"})),...Xe};function ot(e){function t(e,i,n,o){let a=e[o++];if("__proto__"===a)return!0;const r=Number.isFinite(+a),s=o>=e.length;if(a=!a&&$e.isArray(n)?n.length:a,s)return $e.hasOwnProp(n,a)?n[a]=[n[a],i]:n[a]=i,!r;n[a]&&$e.isObject(n[a])||(n[a]=[]);return t(e,i,n[a],o)&&$e.isArray(n[a])&&(n[a]=function(e){const t={},i=Object.keys(e);let n;const o=i.length;let a;for(n=0;n<o;n++)a=i[n],t[a]=e[a];return t}(n[a])),!r}if($e.isFormData(e)&&$e.isFunction(e.entries)){const i={};return $e.forEachEntry(e,((e,n)=>{t(function(e){return $e.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,i,0)})),i}return null}const at={transitional:Je,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const i=t.getContentType()||"",n=i.indexOf("application/json")>-1,o=$e.isObject(e);o&&$e.isHTMLForm(e)&&(e=new FormData(e));if($e.isFormData(e))return n?JSON.stringify(ot(e)):e;if($e.isArrayBuffer(e)||$e.isBuffer(e)||$e.isStream(e)||$e.isFile(e)||$e.isBlob(e)||$e.isReadableStream(e))return e;if($e.isArrayBufferView(e))return e.buffer;if($e.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return qe(e,new nt.classes.URLSearchParams,Object.assign({visitor:function(e,t,i,n){return nt.isNode&&$e.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=$e.isFileList(e))||i.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return qe(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||n?(t.setContentType("application/json",!1),function(e,t){if($e.isString(e))try{return(t||JSON.parse)(e),$e.trim(e)}catch(i){if("SyntaxError"!==i.name)throw i}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||at.transitional,i=t&&t.forcedJSONParsing,n="json"===this.responseType;if($e.isResponse(e)||$e.isReadableStream(e))return e;if(e&&$e.isString(e)&&(i&&!this.responseType||n)){const i=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(o){if(i){if("SyntaxError"===o.name)throw Fe.from(o,Fe.ERR_BAD_RESPONSE,this,null,this.response);throw o}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:nt.classes.FormData,Blob:nt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};$e.forEach(["delete","get","head","post","put","patch"],(e=>{at.headers[e]={}}));const rt=$e.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),st=Symbol("internals");function ct(e){return e&&String(e).trim().toLowerCase()}function pt(e){return!1===e||null==e?e:$e.isArray(e)?e.map(pt):String(e)}function lt(e,t,i,n,o){return $e.isFunction(n)?n.call(this,t,i):(o&&(t=i),$e.isString(t)?$e.isString(n)?-1!==t.indexOf(n):$e.isRegExp(n)?n.test(t):void 0:void 0)}let ut=class{constructor(e){e&&this.set(e)}set(e,t,i){const n=this;function o(e,t,i){const o=ct(t);if(!o)throw new Error("header name must be a non-empty string");const a=$e.findKey(n,o);(!a||void 0===n[a]||!0===i||void 0===i&&!1!==n[a])&&(n[a||t]=pt(e))}const a=(e,t)=>$e.forEach(e,((e,i)=>o(e,i,t)));if($e.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if($e.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))a((e=>{const t={};let i,n,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),i=e.substring(0,o).trim().toLowerCase(),n=e.substring(o+1).trim(),!i||t[i]&&rt[i]||("set-cookie"===i?t[i]?t[i].push(n):t[i]=[n]:t[i]=t[i]?t[i]+", "+n:n)})),t})(e),t);else if($e.isObject(e)&&$e.isIterable(e)){let i,n,o={};for(const t of e){if(!$e.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[n=t[0]]=(i=o[n])?$e.isArray(i)?[...i,t[1]]:[i,t[1]]:t[1]}a(o,t)}else null!=e&&o(t,e,i);return this}get(e,t){if(e=ct(e)){const i=$e.findKey(this,e);if(i){const e=this[i];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=i.exec(e);)t[n[1]]=n[2];return t}(e);if($e.isFunction(t))return t.call(this,e,i);if($e.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ct(e)){const i=$e.findKey(this,e);return!(!i||void 0===this[i]||t&&!lt(0,this[i],i,t))}return!1}delete(e,t){const i=this;let n=!1;function o(e){if(e=ct(e)){const o=$e.findKey(i,e);!o||t&&!lt(0,i[o],o,t)||(delete i[o],n=!0)}}return $e.isArray(e)?e.forEach(o):o(e),n}clear(e){const t=Object.keys(this);let i=t.length,n=!1;for(;i--;){const o=t[i];e&&!lt(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}normalize(e){const t=this,i={};return $e.forEach(this,((n,o)=>{const a=$e.findKey(i,o);if(a)return t[a]=pt(n),void delete t[o];const r=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,i)=>t.toUpperCase()+i))}(o):String(o).trim();r!==o&&delete t[o],t[r]=pt(n),i[r]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return $e.forEach(this,((i,n)=>{null!=i&&!1!==i&&(t[n]=e&&$e.isArray(i)?i.join(", "):i)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach((e=>i.set(e))),i}static accessor(e){const t=(this[st]=this[st]={accessors:{}}).accessors,i=this.prototype;function n(e){const n=ct(e);t[n]||(!function(e,t){const i=$e.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+i,{value:function(e,i,o){return this[n].call(this,t,e,i,o)},configurable:!0})}))}(i,e),t[n]=!0)}return $e.isArray(e)?e.forEach(n):n(e),this}};function dt(e,t){const i=this||at,n=t||i,o=ut.from(n.headers);let a=n.data;return $e.forEach(e,(function(e){a=e.call(i,a,o.normalize(),t?t.status:void 0)})),o.normalize(),a}function mt(e){return!(!e||!e.__CANCEL__)}function ft(e,t,i){Fe.call(this,null==e?"canceled":e,Fe.ERR_CANCELED,t,i),this.name="CanceledError"}function ht(e,t,i){const n=i.config.validateStatus;i.status&&n&&!n(i.status)?t(new Fe("Request failed with status code "+i.status,[Fe.ERR_BAD_REQUEST,Fe.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):e(i)}ut.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),$e.reduceDescriptors(ut.prototype,(({value:e},t)=>{let i=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[i]=e}}})),$e.freezeMethods(ut),$e.inherits(ft,Fe,{__CANCEL__:!0});const gt=(e,t,i=3)=>{let n=0;const o=function(e,t){e=e||10;const i=new Array(e),n=new Array(e);let o,a=0,r=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),p=n[r];o||(o=c),i[a]=s,n[a]=c;let l=r,u=0;for(;l!==a;)u+=i[l++],l%=e;if(a=(a+1)%e,a===r&&(r=(r+1)%e),c-o<t)return;const d=p&&c-p;return d?Math.round(1e3*u/d):void 0}}(50,250);return function(e,t){let i,n,o=0,a=1e3/t;const r=(t,a=Date.now())=>{o=a,i=null,n&&(clearTimeout(n),n=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),s=t-o;s>=a?r(e,t):(i=e,n||(n=setTimeout((()=>{n=null,r(i)}),a-s)))},()=>i&&r(i)]}((i=>{const a=i.loaded,r=i.lengthComputable?i.total:void 0,s=a-n,c=o(s);n=a;e({loaded:a,total:r,progress:r?a/r:void 0,bytes:s,rate:c||void 0,estimated:c&&r&&a<=r?(r-a)/c:void 0,event:i,lengthComputable:null!=r,[t?"download":"upload"]:!0})}),i)},bt=(e,t)=>{const i=null!=e;return[n=>t[0]({lengthComputable:i,total:e,loaded:n}),t[1]]},xt=e=>(...t)=>$e.asap((()=>e(...t))),vt=nt.hasStandardBrowserEnv?((e,t)=>i=>(i=new URL(i,nt.origin),e.protocol===i.protocol&&e.host===i.host&&(t||e.port===i.port)))(new URL(nt.origin),nt.navigator&&/(msie|trident)/i.test(nt.navigator.userAgent)):()=>!0,yt=nt.hasStandardBrowserEnv?{write(e,t,i,n,o,a){const r=[e+"="+encodeURIComponent(t)];$e.isNumber(i)&&r.push("expires="+new Date(i).toGMTString()),$e.isString(n)&&r.push("path="+n),$e.isString(o)&&r.push("domain="+o),!0===a&&r.push("secure"),document.cookie=r.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function wt(e,t,i){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==i)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const kt=e=>e instanceof ut?{...e}:e;function It(e,t){t=t||{};const i={};function n(e,t,i,n){return $e.isPlainObject(e)&&$e.isPlainObject(t)?$e.merge.call({caseless:n},e,t):$e.isPlainObject(t)?$e.merge({},t):$e.isArray(t)?t.slice():t}function o(e,t,i,o){return $e.isUndefined(t)?$e.isUndefined(e)?void 0:n(void 0,e,0,o):n(e,t,0,o)}function a(e,t){if(!$e.isUndefined(t))return n(void 0,t)}function r(e,t){return $e.isUndefined(t)?$e.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(i,o,a){return a in t?n(i,o):a in e?n(void 0,i):void 0}const c={url:a,method:a,data:a,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,withXSRFToken:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:s,headers:(e,t,i)=>o(kt(e),kt(t),0,!0)};return $e.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||o,r=a(e[n],t[n],n);$e.isUndefined(r)&&a!==s||(i[n]=r)})),i}const Tt=e=>{const t=It({},e);let i,{data:n,withXSRFToken:o,xsrfHeaderName:a,xsrfCookieName:r,headers:s,auth:c}=t;if(t.headers=s=ut.from(s),t.url=Ge(wt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),$e.isFormData(n))if(nt.hasStandardBrowserEnv||nt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(!1!==(i=s.getContentType())){const[e,...t]=i?i.split(";").map((e=>e.trim())).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...t].join("; "))}if(nt.hasStandardBrowserEnv&&(o&&$e.isFunction(o)&&(o=o(t)),o||!1!==o&&vt(t.url))){const e=a&&r&&yt.read(r);e&&s.set(a,e)}return t},St="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,i){const n=Tt(e);let o=n.data;const a=ut.from(n.headers).normalize();let r,s,c,p,l,{responseType:u,onUploadProgress:d,onDownloadProgress:m}=n;function f(){p&&p(),l&&l(),n.cancelToken&&n.cancelToken.unsubscribe(r),n.signal&&n.signal.removeEventListener("abort",r)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=ut.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());ht((function(e){t(e),f()}),(function(e){i(e),f()}),{data:u&&"text"!==u&&"json"!==u?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:n,config:e,request:h}),h=null}h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout,"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(g)},h.onabort=function(){h&&(i(new Fe("Request aborted",Fe.ECONNABORTED,e,h)),h=null)},h.onerror=function(){i(new Fe("Network Error",Fe.ERR_NETWORK,e,h)),h=null},h.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const o=n.transitional||Je;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),i(new Fe(t,o.clarifyTimeoutError?Fe.ETIMEDOUT:Fe.ECONNABORTED,e,h)),h=null},void 0===o&&a.setContentType(null),"setRequestHeader"in h&&$e.forEach(a.toJSON(),(function(e,t){h.setRequestHeader(t,e)})),$e.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),m&&([c,l]=gt(m,!0),h.addEventListener("progress",c)),d&&h.upload&&([s,p]=gt(d),h.upload.addEventListener("progress",s),h.upload.addEventListener("loadend",p)),(n.cancelToken||n.signal)&&(r=t=>{h&&(i(!t||t.type?new ft(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(r),n.signal&&(n.signal.aborted?r():n.signal.addEventListener("abort",r)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);b&&-1===nt.protocols.indexOf(b)?i(new Fe("Unsupported protocol "+b+":",Fe.ERR_BAD_REQUEST,e)):h.send(o||null)}))},At=(e,t)=>{const{length:i}=e=e?e.filter(Boolean):[];if(t||i){let i,n=new AbortController;const o=function(e){if(!i){i=!0,r();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Fe?t:new ft(t instanceof Error?t.message:t))}};let a=t&&setTimeout((()=>{a=null,o(new Fe(`timeout ${t} of ms exceeded`,Fe.ETIMEDOUT))}),t);const r=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)})),e=null)};e.forEach((e=>e.addEventListener("abort",o)));const{signal:s}=n;return s.unsubscribe=()=>$e.asap(r),s}},Et=function*(e,t){let i=e.byteLength;if(i<t)return void(yield e);let n,o=0;for(;o<i;)n=o+t,yield e.slice(o,n),o=n},_t=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:i}=await t.read();if(e)break;yield i}}finally{await t.cancel()}},Ct=(e,t,i,n)=>{const o=async function*(e,t){for await(const i of _t(e))yield*Et(i,t)}(e,t);let a,r=0,s=e=>{a||(a=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await o.next();if(t)return s(),void e.close();let a=n.byteLength;if(i){let e=r+=a;i(e)}e.enqueue(new Uint8Array(n))}catch(t){throw s(t),t}},cancel:e=>(s(e),o.return())},{highWaterMark:2})},Rt="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Nt=Rt&&"function"==typeof ReadableStream,Pt=Rt&&("function"==typeof TextEncoder?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Ot=(e,...t)=>{try{return!!e(...t)}catch(i){return!1}},jt=Nt&&Ot((()=>{let e=!1;const t=new Request(nt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),$t=Nt&&Ot((()=>$e.isReadableStream(new Response("").body))),Ft={stream:$t&&(e=>e.body)};var Lt;Rt&&(Lt=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!Ft[e]&&(Ft[e]=$e.isFunction(Lt[e])?t=>t[e]():(t,i)=>{throw new Fe(`Response type '${e}' is not supported`,Fe.ERR_NOT_SUPPORT,i)})})));const Ut=async(e,t)=>{const i=$e.toFiniteNumber(e.getContentLength());return null==i?(async e=>{if(null==e)return 0;if($e.isBlob(e))return e.size;if($e.isSpecCompliantForm(e)){const t=new Request(nt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return $e.isArrayBufferView(e)||$e.isArrayBuffer(e)?e.byteLength:($e.isURLSearchParams(e)&&(e+=""),$e.isString(e)?(await Pt(e)).byteLength:void 0)})(t):i},Bt={http:null,xhr:St,fetch:Rt&&(async e=>{let{url:t,method:i,data:n,signal:o,cancelToken:a,timeout:r,onDownloadProgress:s,onUploadProgress:c,responseType:p,headers:l,withCredentials:u="same-origin",fetchOptions:d}=Tt(e);p=p?(p+"").toLowerCase():"text";let m,f=At([o,a&&a.toAbortSignal()],r);const h=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let g;try{if(c&&jt&&"get"!==i&&"head"!==i&&0!==(g=await Ut(l,n))){let e,i=new Request(t,{method:"POST",body:n,duplex:"half"});if($e.isFormData(n)&&(e=i.headers.get("content-type"))&&l.setContentType(e),i.body){const[e,t]=bt(g,gt(xt(c)));n=Ct(i.body,65536,e,t)}}$e.isString(u)||(u=u?"include":"omit");const o="credentials"in Request.prototype;m=new Request(t,{...d,signal:f,method:i.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:o?u:void 0});let a=await fetch(m);const r=$t&&("stream"===p||"response"===p);if($t&&(s||r&&h)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=a[t]}));const t=$e.toFiniteNumber(a.headers.get("content-length")),[i,n]=s&&bt(t,gt(xt(s),!0))||[];a=new Response(Ct(a.body,65536,i,(()=>{n&&n(),h&&h()})),e)}p=p||"text";let b=await Ft[$e.findKey(Ft,p)||"text"](a,e);return!r&&h&&h(),await new Promise(((t,i)=>{ht(t,i,{data:b,headers:ut.from(a.headers),status:a.status,statusText:a.statusText,config:e,request:m})}))}catch(b){if(h&&h(),b&&"TypeError"===b.name&&/Load failed|fetch/i.test(b.message))throw Object.assign(new Fe("Network Error",Fe.ERR_NETWORK,e,m),{cause:b.cause||b});throw Fe.from(b,b&&b.code,e,m)}})};$e.forEach(Bt,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(i){}Object.defineProperty(e,"adapterName",{value:t})}}));const Mt=e=>`- ${e}`,Dt=e=>$e.isFunction(e)||null===e||!1===e,zt=e=>{e=$e.isArray(e)?e:[e];const{length:t}=e;let i,n;const o={};for(let a=0;a<t;a++){let t;if(i=e[a],n=i,!Dt(i)&&(n=Bt[(t=String(i)).toLowerCase()],void 0===n))throw new Fe(`Unknown adapter '${t}'`);if(n)break;o[t||"#"+a]=n}if(!n){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new Fe("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Mt).join("\n"):" "+Mt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function qt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ft(null,e)}function Kt(e){qt(e),e.headers=ut.from(e.headers),e.data=dt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return zt(e.adapter||at.adapter)(e).then((function(t){return qt(e),t.data=dt.call(e,e.transformResponse,t),t.headers=ut.from(t.headers),t}),(function(t){return mt(t)||(qt(e),t&&t.response&&(t.response.data=dt.call(e,e.transformResponse,t.response),t.response.headers=ut.from(t.response.headers))),Promise.reject(t)}))}const Wt="1.9.0",Ht={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Ht[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));const Vt={};Ht.transitional=function(e,t,i){function n(e,t){return"[Axios v1.9.0] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,o,a)=>{if(!1===e)throw new Fe(n(o," has been removed"+(t?" in "+t:"")),Fe.ERR_DEPRECATED);return t&&!Vt[o]&&(Vt[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,o,a)}},Ht.spelling=function(e){return(t,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};const Gt={assertOptions:function(e,t,i){if("object"!=typeof e)throw new Fe("options must be an object",Fe.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const a=n[o],r=t[a];if(r){const t=e[a],i=void 0===t||r(t,a,e);if(!0!==i)throw new Fe("option "+a+" must be "+i,Fe.ERR_BAD_OPTION_VALUE)}else if(!0!==i)throw new Fe("Unknown option "+a,Fe.ERR_BAD_OPTION)}},validators:Ht},Zt=Gt.validators;let Jt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ze,response:new Ze}}async request(e,t){try{return await this._request(e,t)}catch(i){if(i instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{i.stack?t&&!String(i.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(i.stack+="\n"+t):i.stack=t}catch(n){}}throw i}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=It(this.defaults,t);const{transitional:i,paramsSerializer:n,headers:o}=t;void 0!==i&&Gt.assertOptions(i,{silentJSONParsing:Zt.transitional(Zt.boolean),forcedJSONParsing:Zt.transitional(Zt.boolean),clarifyTimeoutError:Zt.transitional(Zt.boolean)},!1),null!=n&&($e.isFunction(n)?t.paramsSerializer={serialize:n}:Gt.assertOptions(n,{encode:Zt.function,serialize:Zt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Gt.assertOptions(t,{baseUrl:Zt.spelling("baseURL"),withXsrfToken:Zt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=o&&$e.merge(o.common,o[t.method]);o&&$e.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=ut.concat(a,o);const r=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));const c=[];let p;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,u=0;if(!s){const e=[Kt.bind(this),void 0];for(e.unshift.apply(e,r),e.push.apply(e,c),l=e.length,p=Promise.resolve(t);u<l;)p=p.then(e[u++],e[u++]);return p}l=r.length;let d=t;for(u=0;u<l;){const e=r[u++],t=r[u++];try{d=e(d)}catch(m){t.call(this,m);break}}try{p=Kt.call(this,d)}catch(m){return Promise.reject(m)}for(u=0,l=c.length;u<l;)p=p.then(c[u++],c[u++]);return p}getUri(e){return Ge(wt((e=It(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};$e.forEach(["delete","get","head","options"],(function(e){Jt.prototype[e]=function(t,i){return this.request(It(i||{},{method:e,url:t,data:(i||{}).data}))}})),$e.forEach(["post","put","patch"],(function(e){function t(t){return function(i,n,o){return this.request(It(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:n}))}}Jt.prototype[e]=t(),Jt.prototype[e+"Form"]=t(!0)}));const Xt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Xt).forEach((([e,t])=>{Xt[t]=e}));const Yt=function e(t){const i=new Jt(t),n=G(Jt.prototype.request,i);return $e.extend(n,Jt.prototype,i,{allOwnKeys:!0}),$e.extend(n,i,null,{allOwnKeys:!0}),n.create=function(i){return e(It(t,i))},n}(at);Yt.Axios=Jt,Yt.CanceledError=ft,Yt.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const i=this;this.promise.then((e=>{if(!i._listeners)return;let t=i._listeners.length;for(;t-- >0;)i._listeners[t](e);i._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{i.subscribe(e),t=e})).then(e);return n.cancel=function(){i.unsubscribe(t)},n},e((function(e,n,o){i.reason||(i.reason=new ft(e,n,o),t(i.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e((function(e){t=e})),cancel:t}}},Yt.isCancel=mt,Yt.VERSION=Wt,Yt.toFormData=qe,Yt.AxiosError=Fe,Yt.Cancel=Yt.CanceledError,Yt.all=function(e){return Promise.all(e)},Yt.spread=function(e){return function(t){return e.apply(null,t)}},Yt.isAxiosError=function(e){return $e.isObject(e)&&!0===e.isAxiosError},Yt.mergeConfig=It,Yt.AxiosHeaders=ut,Yt.formToJSON=e=>ot($e.isHTMLForm(e)?new FormData(e):e),Yt.getAdapter=zt,Yt.HttpStatusCode=Xt,Yt.default=Yt;let Qt=(h=class{constructor(){b(this,"isProduction"),this.isProduction="production"===V.env.NODE_ENV}static getInstance(){return h.instance||(h.instance=new h),h.instance}debug(e,...t){this.isProduction||console.debug(e,...t)}info(e,...t){this.isProduction||console.info(e,...t)}warn(e,...t){console.warn(e,...t)}error(e,...t){console.error(e,...t)}},b(h,"instance"),h),ei=class extends Error{constructor(e){super(e),this.name="ValidationError"}},ti=class{constructor(e){b(this,"accountId"),b(this,"privateKey"),b(this,"baseUrl"),b(this,"network"),this.accountId=e.accountId,this.privateKey="string"==typeof e.privateKey?i.PrivateKey.fromStringED25519(e.privateKey):e.privateKey,this.network=e.network||"mainnet",this.baseUrl=e.baseUrl||"https://kiloscribe.com"}async authenticate(){var e,t,i;const n=await Yt.get(`${this.baseUrl}/api/auth/request-signature`,{headers:{"x-session":this.accountId}});if(!(null==(e=n.data)?void 0:e.message))throw new Error("Failed to get signature message");const o=n.data.message,a=await this.signMessage(o),r=await Yt.post(`${this.baseUrl}/api/auth/authenticate`,{authData:{id:this.accountId,signature:a,data:o,network:this.network},include:"apiKey"});if(!(null==(i=null==(t=r.data)?void 0:t.user)?void 0:i.sessionToken))throw new Error("Authentication failed");return{apiKey:r.data.apiKey}}async signMessage(e){const t=(new TextEncoder).encode(e),i=await this.privateKey.sign(t);return C.from(i).toString("hex")}};var ii,ni,oi,ai={exports:{}};!function(){if(oi)return ai.exports;oi=1;const e=function(){if(ni)return ii;function e(e){try{return JSON.stringify(e)}catch(t){return'"[Circular]"'}}return ni=1,ii=function(t,i,n){var o=n&&n.stringify||e;if("object"==typeof t&&null!==t){var a=i.length+1;if(1===a)return t;var r=new Array(a);r[0]=o(t);for(var s=1;s<a;s++)r[s]=o(i[s]);return r.join(" ")}if("string"!=typeof t)return t;var c=i.length;if(0===c)return t;for(var p="",l=0,u=-1,d=t&&t.length||0,m=0;m<d;){if(37===t.charCodeAt(m)&&m+1<d){switch(u=u>-1?u:0,t.charCodeAt(m+1)){case 100:case 102:if(l>=c)break;if(null==i[l])break;u<m&&(p+=t.slice(u,m)),p+=Number(i[l]),u=m+2,m++;break;case 105:if(l>=c)break;if(null==i[l])break;u<m&&(p+=t.slice(u,m)),p+=Math.floor(Number(i[l])),u=m+2,m++;break;case 79:case 111:case 106:if(l>=c)break;if(void 0===i[l])break;u<m&&(p+=t.slice(u,m));var f=typeof i[l];if("string"===f){p+="'"+i[l]+"'",u=m+2,m++;break}if("function"===f){p+=i[l].name||"<anonymous>",u=m+2,m++;break}p+=o(i[l]),u=m+2,m++;break;case 115:if(l>=c)break;u<m&&(p+=t.slice(u,m)),p+=String(i[l]),u=m+2,m++;break;case 37:u<m&&(p+=t.slice(u,m)),p+="%",u=m+2,m++,l--}++l}++m}return-1===u?t:(u<d&&(p+=t.slice(u)),p)},ii}();ai.exports=c;const t=function(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{},i={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:h,wrapResponseSerializer:h,wrapErrorSerializer:h,req:f,res:f,err:d,errWithCause:d};function n(e,t){return"silent"===e?1/0:t.levels.values[e]}const o=Symbol("pino.logFuncs"),a=Symbol("pino.hierarchy"),r={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function s(e,t){const i={logger:t,parent:e[a]};t[a]=i}function c(e){(e=e||{}).browser=e.browser||{};const i=e.browser.transmit;if(i&&"function"!=typeof i.send)throw Error("pino: transmit option must have a send function");const a=e.browser.write||t;e.browser.write&&(e.browser.asObject=!0);const d=e.serializers||{},f=function(e,t){if(Array.isArray(e))return e.filter((function(e){return"!stdSerializers.err"!==e}));return!0===e&&Object.keys(t)}(e.browser.serialize,d);let h=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(h=!1);const b=Object.keys(e.customLevels||{}),x=["error","fatal","warn","info","debug","trace"].concat(b);"function"==typeof a&&x.forEach((function(e){a[e]=a})),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const v=e.level||"info",y=Object.create(a);y.log||(y.log=g),function(e,i,n){const a={};i.forEach((e=>{a[e]=n[e]?n[e]:t[e]||t[r[e]||"log"]||g})),e[o]=a}(y,x,a),s({},y),Object.defineProperty(y,"levelVal",{get:function(){return n(this.level,this)}}),Object.defineProperty(y,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,p(this,w,y,"error"),p(this,w,y,"fatal"),p(this,w,y,"warn"),p(this,w,y,"info"),p(this,w,y,"debug"),p(this,w,y,"trace"),b.forEach((e=>{p(this,w,y,e)}))}});const w={transmit:i,serialize:f,asObject:e.browser.asObject,formatters:e.browser.formatters,levels:x,timestamp:m(e),messageKey:e.messageKey||"msg",onChild:e.onChild||g};function k(t,n,o){if(!n)throw new Error("missing bindings for child Pino");o=o||{},f&&n.serializers&&(o.serializers=n.serializers);const a=o.serializers;if(f&&a){var r=Object.assign({},d,a),c=!0===e.browser.serialize?Object.keys(r):f;delete n.serializers,l([n],c,r,this._stdErrSerialize)}function p(e){this._childLevel=1+(0|e._childLevel),this.bindings=n,r&&(this.serializers=r,this._serialize=c),i&&(this._logEvent=u([].concat(e._logEvent.bindings,n)))}p.prototype=this;const m=new p(this);return s(this,m),m.child=function(...e){return k.call(this,t,...e)},m.level=o.level||this.level,t.onChild(m),m}return y.levels=function(e){const t=e.customLevels||{},i=Object.assign({},c.levels.values,t),n=Object.assign({},c.levels.labels,function(e){const t={};return Object.keys(e).forEach((function(i){t[e[i]]=i})),t}(t));return{values:i,labels:n}}(e),y.level=v,y.setMaxListeners=y.getMaxListeners=y.emit=y.addListener=y.on=y.prependListener=y.once=y.prependOnceListener=y.removeListener=y.removeAllListeners=y.listeners=y.listenerCount=y.eventNames=y.write=y.flush=g,y.serializers=d,y._serialize=f,y._stdErrSerialize=h,y.child=function(...e){return k.call(this,w,...e)},i&&(y._logEvent=u()),y}function p(i,r,s,c){if(Object.defineProperty(i,c,{value:n(i.level,s)>n(c,s)?g:s[o][c],writable:!0,enumerable:!0,configurable:!0}),i[c]===g){if(!r.transmit)return;const e=n(r.transmit.level||i.level,s);if(n(c,s)<e)return}i[c]=function(i,a,r,s){return function(o){return function(){const c=a.timestamp(),p=new Array(arguments.length),d=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var m=0;m<p.length;m++)p[m]=arguments[m];var f=!1;if(a.serialize&&(l(p,this._serialize,this.serializers,this._stdErrSerialize),f=!0),a.asObject||a.formatters?o.call(d,function(t,i,n,o,a){const{level:r,log:s=e=>e}=a.formatters||{},c=n.slice();let p=c[0];const l={};o&&(l.time=o);if(r){const e=r(i,t.levels.values[i]);Object.assign(l,e)}else l.level=t.levels.values[i];let u=1+(0|t._childLevel);u<1&&(u=1);if(null!==p&&"object"==typeof p){for(;u--&&"object"==typeof c[0];)Object.assign(l,c.shift());p=c.length?e(c.shift(),c):void 0}else"string"==typeof p&&(p=e(c.shift(),c));void 0!==p&&(l[a.messageKey]=p);return s(l)}(this,s,p,c,a)):o.apply(d,p),a.transmit){const e=n(a.transmit.level||i._level,r),t=n(s,r);if(t<e)return;!function(e,t,i,n=!1){const o=t.send,a=t.ts,r=t.methodLevel,s=t.methodValue,c=t.val,p=e._logEvent.bindings;n||l(i,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize);e._logEvent.ts=a,e._logEvent.messages=i.filter((function(e){return-1===p.indexOf(e)})),e._logEvent.level.label=r,e._logEvent.level.value=s,o(r,e._logEvent,c),e._logEvent=u(p)}(this,{ts:c,methodLevel:s,methodValue:t,transmitValue:r.levels.values[a.transmit.level||i._level],send:a.transmit.send,val:n(i._level,r)},p,f)}}}(i[o][s])}(i,r,s,c);const p=function(e){const t=[];e.bindings&&t.push(e.bindings);let i=e[a];for(;i.parent;)i=i.parent,i.logger.bindings&&t.push(i.logger.bindings);return t.reverse()}(i);0!==p.length&&(i[c]=function(e,t){return function(){return t.apply(this,[...e,...arguments])}}(p,i[c]))}function l(e,t,i,n){for(const o in e)if(n&&e[o]instanceof Error)e[o]=c.stdSerializers.err(e[o]);else if("object"==typeof e[o]&&!Array.isArray(e[o])&&t)for(const n in e[o])t.indexOf(n)>-1&&n in i&&(e[o][n]=i[n](e[o][n]))}function u(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function d(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const i in e)void 0===t[i]&&(t[i]=e[i]);return t}function m(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?b:x}function f(){return{}}function h(e){return e}function g(){}function b(){return!1}function x(){return Date.now()}c.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},c.stdSerializers=i,c.stdTimeFunctions=Object.assign({},{nullTime:b,epochTime:x,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}}),ai.exports.default=c,ai.exports.pino=c,ai.exports}();for(var ri=Object.defineProperty,si=((e,t,i)=>((e,t,i)=>t in e?ri(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i)),ci={},pi={byteLength:function(e){var t=hi(e),i=t[0],n=t[1];return 3*(i+n)/4-n},toByteArray:function(e){var t,i,n=hi(e),o=n[0],a=n[1],r=new di(function(e,t,i){return 3*(t+i)/4-i}(0,o,a)),s=0,c=a>0?o-4:o;for(i=0;i<c;i+=4)t=ui[e.charCodeAt(i)]<<18|ui[e.charCodeAt(i+1)]<<12|ui[e.charCodeAt(i+2)]<<6|ui[e.charCodeAt(i+3)],r[s++]=t>>16&255,r[s++]=t>>8&255,r[s++]=255&t;2===a&&(t=ui[e.charCodeAt(i)]<<2|ui[e.charCodeAt(i+1)]>>4,r[s++]=255&t);1===a&&(t=ui[e.charCodeAt(i)]<<10|ui[e.charCodeAt(i+1)]<<4|ui[e.charCodeAt(i+2)]>>2,r[s++]=t>>8&255,r[s++]=255&t);return r},fromByteArray:function(e){for(var t,i=e.length,n=i%3,o=[],a=16383,r=0,s=i-n;r<s;r+=a)o.push(gi(e,r,r+a>s?s:r+a));1===n?(t=e[i-1],o.push(li[t>>2]+li[t<<4&63]+"==")):2===n&&(t=(e[i-2]<<8)+e[i-1],o.push(li[t>>10]+li[t>>4&63]+li[t<<2&63]+"="));return o.join("")}},li=[],ui=[],di="undefined"!=typeof Uint8Array?Uint8Array:Array,mi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fi=0;fi<64;++fi)li[fi]=mi[fi],ui[mi.charCodeAt(fi)]=fi;function hi(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=e.indexOf("=");return-1===i&&(i=t),[i,i===t?0:4-i%4]}function gi(e,t,i){for(var n,o,a=[],r=t;r<i;r+=3)n=(e[r]<<16&16711680)+(e[r+1]<<8&65280)+(255&e[r+2]),a.push(li[(o=n)>>18&63]+li[o>>12&63]+li[o>>6&63]+li[63&o]);return a.join("")}ui["-".charCodeAt(0)]=62,ui["_".charCodeAt(0)]=63;var bi={
10
+ !function(e){const t=v,i=E,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=p,e.SlowBuffer=function(e){+e!=e&&(e=0);return p.alloc(+e)},e.INSPECT_MAX_BYTES=50;const o=2147483647;e.kMaxLength=o;const{Uint8Array:a,ArrayBuffer:r,SharedArrayBuffer:s}=globalThis;function c(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new a(e);return Object.setPrototypeOf(t,p.prototype),t}function p(e,t,i){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,i)}function l(e,t,i){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!p.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const i=0|g(e,t);let n=c(i);const o=n.write(e,t);o!==i&&(n=n.slice(0,o));return n}(e,t);if(r.isView(e))return function(e){if(Y(e,a)){const t=new a(e);return f(t.buffer,t.byteOffset,t.byteLength)}return m(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,r)||e&&Y(e.buffer,r))return f(e,t,i);if(void 0!==s&&(Y(e,s)||e&&Y(e.buffer,s)))return f(e,t,i);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return p.from(n,t,i);const o=function(e){if(p.isBuffer(e)){const t=0|h(e.length),i=c(t);return 0===i.length||e.copy(i,0,0,t),i}if(void 0!==e.length)return"number"!=typeof e.length||Q(e.length)?c(0):m(e);if("Buffer"===e.type&&Array.isArray(e.data))return m(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return p.from(e[Symbol.toPrimitive]("string"),t,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),c(e<0?0:0|h(e))}function m(e){const t=e.length<0?0:0|h(e.length),i=c(t);for(let n=0;n<t;n+=1)i[n]=255&e[n];return i}function f(e,t,i){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(i||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===i?new a(e):void 0===i?new a(e,t):new a(e,t,i),Object.setPrototypeOf(n,p.prototype),n}function h(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function g(e,t){if(p.isBuffer(e))return e.length;if(r.isView(e)||Y(e,r))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const i=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===i)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return Z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return J(e).length;default:if(o)return n?-1:Z(e).length;t=(""+t).toLowerCase(),o=!0}}function b(e,t,i){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,i);case"utf8":case"utf-8":return C(this,t,i);case"ascii":return N(this,t,i);case"latin1":case"binary":return P(this,t,i);case"base64":return _(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,t,i);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function x(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function y(e,t,i,n,o){if(0===e.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),Q(i=+i)&&(i=o?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(o)return-1;i=e.length-1}else if(i<0){if(!o)return-1;i=0}if("string"==typeof t&&(t=p.from(t,n)),p.isBuffer(t))return 0===t.length?-1:w(e,t,i,n,o);if("number"==typeof t)return t&=255,"function"==typeof a.prototype.indexOf?o?a.prototype.indexOf.call(e,t,i):a.prototype.lastIndexOf.call(e,t,i):w(e,[t],i,n,o);throw new TypeError("val must be string, number or Buffer")}function w(e,t,i,n,o){let a,r=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;r=2,s/=2,c/=2,i/=2}function p(e,t){return 1===r?e[t]:e.readUInt16BE(t*r)}if(o){let n=-1;for(a=i;a<s;a++)if(p(e,a)===p(t,-1===n?0:a-n)){if(-1===n&&(n=a),a-n+1===c)return n*r}else-1!==n&&(a-=a-n),n=-1}else for(i+c>s&&(i=s-c),a=i;a>=0;a--){let i=!0;for(let n=0;n<c;n++)if(p(e,a+n)!==p(t,n)){i=!1;break}if(i)return a}return-1}function k(e,t,i,n){i=Number(i)||0;const o=e.length-i;n?(n=Number(n))>o&&(n=o):n=o;const a=t.length;let r;for(n>a/2&&(n=a/2),r=0;r<n;++r){const n=parseInt(t.substr(2*r,2),16);if(Q(n))return r;e[i+r]=n}return r}function I(e,t,i,n){return X(Z(t,e.length-i),e,i,n)}function T(e,t,i,n){return X(function(e){const t=[];for(let i=0;i<e.length;++i)t.push(255&e.charCodeAt(i));return t}(t),e,i,n)}function S(e,t,i,n){return X(J(t),e,i,n)}function A(e,t,i,n){return X(function(e,t){let i,n,o;const a=[];for(let r=0;r<e.length&&!((t-=2)<0);++r)i=e.charCodeAt(r),n=i>>8,o=i%256,a.push(o),a.push(n);return a}(t,e.length-i),e,i,n)}function _(e,i,n){return 0===i&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(i,n))}function C(e,t,i){i=Math.min(e.length,i);const n=[];let o=t;for(;o<i;){const t=e[o];let a=null,r=t>239?4:t>223?3:t>191?2:1;if(o+r<=i){let i,n,s,c;switch(r){case 1:t<128&&(a=t);break;case 2:i=e[o+1],128==(192&i)&&(c=(31&t)<<6|63&i,c>127&&(a=c));break;case 3:i=e[o+1],n=e[o+2],128==(192&i)&&128==(192&n)&&(c=(15&t)<<12|(63&i)<<6|63&n,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:i=e[o+1],n=e[o+2],s=e[o+3],128==(192&i)&&128==(192&n)&&128==(192&s)&&(c=(15&t)<<18|(63&i)<<12|(63&n)<<6|63&s,c>65535&&c<1114112&&(a=c))}}null===a?(a=65533,r=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),o+=r}return function(e){const t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);let i="",n=0;for(;n<t;)i+=String.fromCharCode.apply(String,e.slice(n,n+=R));return i}(n)}p.TYPED_ARRAY_SUPPORT=function(){try{const e=new a(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,a.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),p.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}}),p.poolSize=8192,p.from=function(e,t,i){return l(e,t,i)},Object.setPrototypeOf(p.prototype,a.prototype),Object.setPrototypeOf(p,a),p.alloc=function(e,t,i){return function(e,t,i){return u(e),e<=0?c(e):void 0!==t?"string"==typeof i?c(e).fill(t,i):c(e).fill(t):c(e)}(e,t,i)},p.allocUnsafe=function(e){return d(e)},p.allocUnsafeSlow=function(e){return d(e)},p.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==p.prototype},p.compare=function(e,t){if(Y(e,a)&&(e=p.from(e,e.offset,e.byteLength)),Y(t,a)&&(t=p.from(t,t.offset,t.byteLength)),!p.isBuffer(e)||!p.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let o=0,a=Math.min(i,n);o<a;++o)if(e[o]!==t[o]){i=e[o],n=t[o];break}return i<n?-1:n<i?1:0},p.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}},p.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return p.alloc(0);let i;if(void 0===t)for(t=0,i=0;i<e.length;++i)t+=e[i].length;const n=p.allocUnsafe(t);let o=0;for(i=0;i<e.length;++i){let t=e[i];if(Y(t,a))o+t.length>n.length?(p.isBuffer(t)||(t=p.from(t)),t.copy(n,o)):a.prototype.set.call(n,t,o);else{if(!p.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,o)}o+=t.length}return n},p.byteLength=g,p.prototype._isBuffer=!0,p.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)x(this,t,t+1);return this},p.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},p.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},p.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?C(this,0,e):b.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===p.compare(this,e)},p.prototype.inspect=function(){let t="";const i=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,i).replace(/(.{2})/g,"$1 ").trim(),this.length>i&&(t+=" ... "),"<Buffer "+t+">"},n&&(p.prototype[n]=p.prototype.inspect),p.prototype.compare=function(e,t,i,n,o){if(Y(e,a)&&(e=p.from(e,e.offset,e.byteLength)),!p.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||i>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(this===e)return 0;let r=(o>>>=0)-(n>>>=0),s=(i>>>=0)-(t>>>=0);const c=Math.min(r,s),l=this.slice(n,o),u=e.slice(t,i);for(let a=0;a<c;++a)if(l[a]!==u[a]){r=l[a],s=u[a];break}return r<s?-1:s<r?1:0},p.prototype.includes=function(e,t,i){return-1!==this.indexOf(e,t,i)},p.prototype.indexOf=function(e,t,i){return y(this,e,t,i,!0)},p.prototype.lastIndexOf=function(e,t,i){return y(this,e,t,i,!1)},p.prototype.write=function(e,t,i,n){if(void 0===t)n="utf8",i=this.length,t=0;else if(void 0===i&&"string"==typeof t)n=t,i=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(i)?(i>>>=0,void 0===n&&(n="utf8")):(n=i,i=void 0)}const o=this.length-t;if((void 0===i||i>o)&&(i=o),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return k(this,e,t,i);case"utf8":case"utf-8":return I(this,e,t,i);case"ascii":case"latin1":case"binary":return T(this,e,t,i);case"base64":return S(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function N(e,t,i){let n="";i=Math.min(e.length,i);for(let o=t;o<i;++o)n+=String.fromCharCode(127&e[o]);return n}function P(e,t,i){let n="";i=Math.min(e.length,i);for(let o=t;o<i;++o)n+=String.fromCharCode(e[o]);return n}function O(e,t,i){const n=e.length;(!t||t<0)&&(t=0),(!i||i<0||i>n)&&(i=n);let o="";for(let a=t;a<i;++a)o+=ee[e[a]];return o}function $(e,t,i){const n=e.slice(t,i);let o="";for(let a=0;a<n.length-1;a+=2)o+=String.fromCharCode(n[a]+256*n[a+1]);return o}function j(e,t,i){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>i)throw new RangeError("Trying to access beyond buffer length")}function F(e,t,i,n,o,a){if(!p.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<a)throw new RangeError('"value" argument is out of bounds');if(i+n>e.length)throw new RangeError("Index out of range")}function L(e,t,i,n,o){H(t,n,o,e,i,7);let a=Number(t&BigInt(4294967295));e[i++]=a,a>>=8,e[i++]=a,a>>=8,e[i++]=a,a>>=8,e[i++]=a;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[i++]=r,r>>=8,e[i++]=r,r>>=8,e[i++]=r,r>>=8,e[i++]=r,i}function U(e,t,i,n,o){H(t,n,o,e,i,7);let a=Number(t&BigInt(4294967295));e[i+7]=a,a>>=8,e[i+6]=a,a>>=8,e[i+5]=a,a>>=8,e[i+4]=a;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[i+3]=r,r>>=8,e[i+2]=r,r>>=8,e[i+1]=r,r>>=8,e[i]=r,i+8}function B(e,t,i,n,o,a){if(i+n>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function M(e,t,n,o,a){return t=+t,n>>>=0,a||B(e,0,n,4),i.write(e,t,n,o,23,4),n+4}function D(e,t,n,o,a){return t=+t,n>>>=0,a||B(e,0,n,8),i.write(e,t,n,o,52,8),n+8}p.prototype.slice=function(e,t){const i=this.length;(e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,p.prototype),n},p.prototype.readUintLE=p.prototype.readUIntLE=function(e,t,i){e>>>=0,t>>>=0,i||j(e,t,this.length);let n=this[e],o=1,a=0;for(;++a<t&&(o*=256);)n+=this[e+a]*o;return n},p.prototype.readUintBE=p.prototype.readUIntBE=function(e,t,i){e>>>=0,t>>>=0,i||j(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n},p.prototype.readUint8=p.prototype.readUInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),this[e]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]|this[e+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]<<8|this[e+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},p.prototype.readBigUInt64LE=te((function(e){W(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||V(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))})),p.prototype.readBigUInt64BE=te((function(e){W(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||V(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+i;return(BigInt(n)<<BigInt(32))+BigInt(o)})),p.prototype.readIntLE=function(e,t,i){e>>>=0,t>>>=0,i||j(e,t,this.length);let n=this[e],o=1,a=0;for(;++a<t&&(o*=256);)n+=this[e+a]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},p.prototype.readIntBE=function(e,t,i){e>>>=0,t>>>=0,i||j(e,t,this.length);let n=t,o=1,a=this[e+--n];for(;n>0&&(o*=256);)a+=this[e+--n]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*t)),a},p.prototype.readInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},p.prototype.readInt16LE=function(e,t){e>>>=0,t||j(e,2,this.length);const i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},p.prototype.readInt16BE=function(e,t){e>>>=0,t||j(e,2,this.length);const i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},p.prototype.readInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},p.prototype.readInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},p.prototype.readBigInt64LE=te((function(e){W(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||V(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),p.prototype.readBigInt64BE=te((function(e){W(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||V(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+i)})),p.prototype.readFloatLE=function(e,t){return e>>>=0,t||j(e,4,this.length),i.read(this,e,!0,23,4)},p.prototype.readFloatBE=function(e,t){return e>>>=0,t||j(e,4,this.length),i.read(this,e,!1,23,4)},p.prototype.readDoubleLE=function(e,t){return e>>>=0,t||j(e,8,this.length),i.read(this,e,!0,52,8)},p.prototype.readDoubleBE=function(e,t){return e>>>=0,t||j(e,8,this.length),i.read(this,e,!1,52,8)},p.prototype.writeUintLE=p.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t>>>=0,i>>>=0,!n){F(this,e,t,i,Math.pow(2,8*i)-1,0)}let o=1,a=0;for(this[t]=255&e;++a<i&&(o*=256);)this[t+a]=e/o&255;return t+i},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(e,t,i,n){if(e=+e,t>>>=0,i>>>=0,!n){F(this,e,t,i,Math.pow(2,8*i)-1,0)}let o=i-1,a=1;for(this[t+o]=255&e;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+i},p.prototype.writeUint8=p.prototype.writeUInt8=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,1,255,0),this[t]=255&e,t+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},p.prototype.writeBigUInt64LE=te((function(e,t=0){return L(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),p.prototype.writeBigUInt64BE=te((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),p.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*i-1);F(this,e,t,i,n-1,-n)}let o=0,a=1,r=0;for(this[t]=255&e;++o<i&&(a*=256);)e<0&&0===r&&0!==this[t+o-1]&&(r=1),this[t+o]=(e/a|0)-r&255;return t+i},p.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*i-1);F(this,e,t,i,n-1,-n)}let o=i-1,a=1,r=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===r&&0!==this[t+o+1]&&(r=1),this[t+o]=(e/a|0)-r&255;return t+i},p.prototype.writeInt8=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},p.prototype.writeInt16LE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},p.prototype.writeInt16BE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},p.prototype.writeInt32LE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},p.prototype.writeInt32BE=function(e,t,i){return e=+e,t>>>=0,i||F(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},p.prototype.writeBigInt64LE=te((function(e,t=0){return L(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),p.prototype.writeBigInt64BE=te((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),p.prototype.writeFloatLE=function(e,t,i){return M(this,e,t,!0,i)},p.prototype.writeFloatBE=function(e,t,i){return M(this,e,t,!1,i)},p.prototype.writeDoubleLE=function(e,t,i){return D(this,e,t,!0,i)},p.prototype.writeDoubleBE=function(e,t,i){return D(this,e,t,!1,i)},p.prototype.copy=function(e,t,i,n){if(!p.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<i&&(n=i),n===i)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-i&&(n=e.length-t+i);const o=n-i;return this===e&&"function"==typeof a.prototype.copyWithin?this.copyWithin(t,i,n):a.prototype.set.call(e,this.subarray(i,n),t),o},p.prototype.fill=function(e,t,i,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,i=this.length):"string"==typeof i&&(n=i,i=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!p.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;let o;if(t>>>=0,i=void 0===i?this.length:i>>>0,e||(e=0),"number"==typeof e)for(o=t;o<i;++o)this[o]=e;else{const a=p.isBuffer(e)?e:p.from(e,n),r=a.length;if(0===r)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<i-t;++o)this[o+t]=a[o%r]}return this};const z={};function q(e,t,i){z[e]=class extends i{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function K(e){let t="",i=e.length;const n="-"===e[0]?1:0;for(;i>=n+4;i-=3)t=`_${e.slice(i-3,i)}${t}`;return`${e.slice(0,i)}${t}`}function H(e,t,i,n,o,a){if(e>i||e<t){const i="bigint"==typeof t?"n":"";let n;throw n=0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(a+1)}${i}`:`>= -(2${i} ** ${8*(a+1)-1}${i}) and < 2 ** ${8*(a+1)-1}${i}`,new z.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,i){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+i]||V(t,e.length-(i+1))}(n,o,a)}function W(e,t){if("number"!=typeof e)throw new z.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,i){if(Math.floor(e)!==e)throw W(e,i),new z.ERR_OUT_OF_RANGE("offset","an integer",e);if(t<0)throw new z.ERR_BUFFER_OUT_OF_BOUNDS;throw new z.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}q("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),q("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),q("ERR_OUT_OF_RANGE",(function(e,t,i){let n=`The value of "${e}" is out of range.`,o=i;return Number.isInteger(i)&&Math.abs(i)>2**32?o=K(String(i)):"bigint"==typeof i&&(o=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(o=K(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function Z(e,t){let i;t=t||1/0;const n=e.length;let o=null;const a=[];for(let r=0;r<n;++r){if(i=e.charCodeAt(r),i>55295&&i<57344){if(!o){if(i>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(r+1===n){(t-=3)>-1&&a.push(239,191,189);continue}o=i;continue}if(i<56320){(t-=3)>-1&&a.push(239,191,189),o=i;continue}i=65536+(o-55296<<10|i-56320)}else o&&(t-=3)>-1&&a.push(239,191,189);if(o=null,i<128){if((t-=1)<0)break;a.push(i)}else if(i<2048){if((t-=2)<0)break;a.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;a.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return a}function J(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,i,n){let o;for(o=0;o<n&&!(o+i>=t.length||o>=e.length);++o)t[o+i]=e[o];return o}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Q(e){return e!=e}const ee=function(){const e="0123456789abcdef",t=new Array(256);for(let i=0;i<16;++i){const n=16*i;for(let o=0;o<16;++o)t[n+o]=e[i]+e[o]}return t}();function te(e){return"undefined"==typeof BigInt?ie:e}function ie(){throw new Error("BigInt not supported")}}(x);const _=x.Buffer,C=x.Buffer,R=globalThis||self;function N(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var P,O,$={exports:{}},j=$.exports={};function F(){throw new Error("setTimeout has not been defined")}function L(){throw new Error("clearTimeout has not been defined")}function U(e){if(P===setTimeout)return setTimeout(e,0);if((P===F||!P)&&setTimeout)return P=setTimeout,setTimeout(e,0);try{return P(e,0)}catch(t){try{return P.call(null,e,0)}catch(i){return P.call(this,e,0)}}}!function(){try{P="function"==typeof setTimeout?setTimeout:F}catch(e){P=F}try{O="function"==typeof clearTimeout?clearTimeout:L}catch(e){O=L}}();var B,M=[],D=!1,z=-1;function q(){D&&B&&(D=!1,B.length?M=B.concat(M):z=-1,M.length&&K())}function K(){if(!D){var e=U(q);D=!0;for(var t=M.length;t;){for(B=M,M=[];++z<t;)B&&B[z].run();z=-1,t=M.length}B=null,D=!1,function(e){if(O===clearTimeout)return clearTimeout(e);if((O===L||!O)&&clearTimeout)return O=clearTimeout,clearTimeout(e);try{return O(e)}catch(t){try{return O.call(null,e)}catch(i){return O.call(this,e)}}}(e)}}function H(e,t){this.fun=e,this.array=t}function W(){}j.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];M.push(new H(e,t)),1!==M.length||D||U(K)},H.prototype.run=function(){this.fun.apply(null,this.array)},j.title="browser",j.browser=!0,j.env={},j.argv=[],j.version="",j.versions={},j.on=W,j.addListener=W,j.once=W,j.off=W,j.removeListener=W,j.removeAllListeners=W,j.emit=W,j.prependListener=W,j.prependOnceListener=W,j.listeners=function(e){return[]},j.binding=function(e){throw new Error("process.binding is not supported")},j.cwd=function(){return"/"},j.chdir=function(e){throw new Error("process.chdir is not supported")},j.umask=function(){return 0};const V=N($.exports);function G(e,t){return function(){return e.apply(t,arguments)}}const{toString:Z}=Object.prototype,{getPrototypeOf:J}=Object,{iterator:X,toStringTag:Y}=Symbol,Q=(e=>t=>{const i=Z.call(t);return e[i]||(e[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),ee=e=>(e=e.toLowerCase(),t=>Q(t)===e),te=e=>t=>typeof t===e,{isArray:ie}=Array,ne=te("undefined");const oe=ee("ArrayBuffer");const ae=te("string"),re=te("function"),se=te("number"),ce=e=>null!==e&&"object"==typeof e,pe=e=>{if("object"!==Q(e))return!1;const t=J(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Y in e||X in e)},le=ee("Date"),ue=ee("File"),de=ee("Blob"),me=ee("FileList"),fe=ee("URLSearchParams"),[he,ge,be,xe]=["ReadableStream","Request","Response","Headers"].map(ee);function ve(e,t,{allOwnKeys:i=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),ie(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{const o=i?Object.getOwnPropertyNames(e):Object.keys(e),a=o.length;let r;for(n=0;n<a;n++)r=o[n],t.call(null,e[r],r,e)}}function ye(e,t){t=t.toLowerCase();const i=Object.keys(e);let n,o=i.length;for(;o-- >0;)if(n=i[o],t===n.toLowerCase())return n;return null}const we="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:R,ke=e=>!ne(e)&&e!==we;const Ie=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&J(Uint8Array)),Te=ee("HTMLFormElement"),Se=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype),Ae=ee("RegExp"),Ee=(e,t)=>{const i=Object.getOwnPropertyDescriptors(e),n={};ve(i,((i,o)=>{let a;!1!==(a=t(i,o,e))&&(n[o]=a||i)})),Object.defineProperties(e,n)};const _e=ee("AsyncFunction"),Ce=(Re="function"==typeof setImmediate,Ne=re(we.postMessage),Re?setImmediate:Ne?(Pe=`axios@${Math.random()}`,Oe=[],we.addEventListener("message",(({source:e,data:t})=>{e===we&&t===Pe&&Oe.length&&Oe.shift()()}),!1),e=>{Oe.push(e),we.postMessage(Pe,"*")}):e=>setTimeout(e));var Re,Ne,Pe,Oe;const $e="undefined"!=typeof queueMicrotask?queueMicrotask.bind(we):void 0!==V&&V.nextTick||Ce,je={isArray:ie,isArrayBuffer:oe,isBuffer:function(e){return null!==e&&!ne(e)&&null!==e.constructor&&!ne(e.constructor)&&re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||re(e.append)&&("formdata"===(t=Q(e))||"object"===t&&re(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&oe(e.buffer),t},isString:ae,isNumber:se,isBoolean:e=>!0===e||!1===e,isObject:ce,isPlainObject:pe,isReadableStream:he,isRequest:ge,isResponse:be,isHeaders:xe,isUndefined:ne,isDate:le,isFile:ue,isBlob:de,isRegExp:Ae,isFunction:re,isStream:e=>ce(e)&&re(e.pipe),isURLSearchParams:fe,isTypedArray:Ie,isFileList:me,forEach:ve,merge:function e(){const{caseless:t}=ke(this)&&this||{},i={},n=(n,o)=>{const a=t&&ye(i,o)||o;pe(i[a])&&pe(n)?i[a]=e(i[a],n):pe(n)?i[a]=e({},n):ie(n)?i[a]=n.slice():i[a]=n};for(let o=0,a=arguments.length;o<a;o++)arguments[o]&&ve(arguments[o],n);return i},extend:(e,t,i,{allOwnKeys:n}={})=>(ve(t,((t,n)=>{i&&re(t)?e[n]=G(t,i):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,i,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),i&&Object.assign(e.prototype,i)},toFlatObject:(e,t,i,n)=>{let o,a,r;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),a=o.length;a-- >0;)r=o[a],n&&!n(r,e,t)||s[r]||(t[r]=e[r],s[r]=!0);e=!1!==i&&J(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype);return t},kindOf:Q,kindOfTest:ee,endsWith:(e,t,i)=>{e=String(e),(void 0===i||i>e.length)&&(i=e.length),i-=t.length;const n=e.indexOf(t,i);return-1!==n&&n===i},toArray:e=>{if(!e)return null;if(ie(e))return e;let t=e.length;if(!se(t))return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},forEachEntry:(e,t)=>{const i=(e&&e[X]).call(e);let n;for(;(n=i.next())&&!n.done;){const i=n.value;t.call(e,i[0],i[1])}},matchAll:(e,t)=>{let i;const n=[];for(;null!==(i=e.exec(t));)n.push(i);return n},isHTMLForm:Te,hasOwnProperty:Se,hasOwnProp:Se,reduceDescriptors:Ee,freezeMethods:e=>{Ee(e,((t,i)=>{if(re(e)&&-1!==["arguments","caller","callee"].indexOf(i))return!1;const n=e[i];re(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")}))}))},toObjectSet:(e,t)=>{const i={},n=e=>{e.forEach((e=>{i[e]=!0}))};return ie(e)?n(e):n(String(e).split(t)),i},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,i){return t.toUpperCase()+i})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:ye,global:we,isContextDefined:ke,isSpecCompliantForm:function(e){return!!(e&&re(e.append)&&"FormData"===e[Y]&&e[X])},toJSONObject:e=>{const t=new Array(10),i=(e,n)=>{if(ce(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const o=ie(e)?[]:{};return ve(e,((e,t)=>{const a=i(e,n+1);!ne(a)&&(o[t]=a)})),t[n]=void 0,o}}return e};return i(e,0)},isAsyncFn:_e,isThenable:e=>e&&(ce(e)||re(e))&&re(e.then)&&re(e.catch),setImmediate:Ce,asap:$e,isIterable:e=>null!=e&&re(e[X])};function Fe(e,t,i,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}je.inherits(Fe,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:je.toJSONObject(this.config),code:this.code,status:this.status}}});const Le=Fe.prototype,Ue={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{Ue[e]={value:e}})),Object.defineProperties(Fe,Ue),Object.defineProperty(Le,"isAxiosError",{value:!0}),Fe.from=(e,t,i,n,o,a)=>{const r=Object.create(Le);return je.toFlatObject(e,r,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),Fe.call(r,e.message,t,i,n,o),r.cause=e,r.name=e.name,a&&Object.assign(r,a),r};function Be(e){return je.isPlainObject(e)||je.isArray(e)}function Me(e){return je.endsWith(e,"[]")?e.slice(0,-2):e}function De(e,t,i){return e?e.concat(t).map((function(e,t){return e=Me(e),!i&&t?"["+e+"]":e})).join(i?".":""):t}const ze=je.toFlatObject(je,{},null,(function(e){return/^is[A-Z]/.test(e)}));function qe(e,t,i){if(!je.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(i=je.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!je.isUndefined(t[e])}))).metaTokens,o=i.visitor||p,a=i.dots,r=i.indexes,s=(i.Blob||"undefined"!=typeof Blob&&Blob)&&je.isSpecCompliantForm(t);if(!je.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(je.isDate(e))return e.toISOString();if(!s&&je.isBlob(e))throw new Fe("Blob is not supported. Use a Buffer instead.");return je.isArrayBuffer(e)||je.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):_.from(e):e}function p(e,i,o){let s=e;if(e&&!o&&"object"==typeof e)if(je.endsWith(i,"{}"))i=n?i:i.slice(0,-2),e=JSON.stringify(e);else if(je.isArray(e)&&function(e){return je.isArray(e)&&!e.some(Be)}(e)||(je.isFileList(e)||je.endsWith(i,"[]"))&&(s=je.toArray(e)))return i=Me(i),s.forEach((function(e,n){!je.isUndefined(e)&&null!==e&&t.append(!0===r?De([i],n,a):null===r?i:i+"[]",c(e))})),!1;return!!Be(e)||(t.append(De(o,i,a),c(e)),!1)}const l=[],u=Object.assign(ze,{defaultVisitor:p,convertValue:c,isVisitable:Be});if(!je.isObject(e))throw new TypeError("data must be an object");return function e(i,n){if(!je.isUndefined(i)){if(-1!==l.indexOf(i))throw Error("Circular reference detected in "+n.join("."));l.push(i),je.forEach(i,(function(i,a){!0===(!(je.isUndefined(i)||null===i)&&o.call(t,i,je.isString(a)?a.trim():a,n,u))&&e(i,n?n.concat(a):[a])})),l.pop()}}(e),t}function Ke(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function He(e,t){this._pairs=[],e&&qe(e,this,t)}const We=He.prototype;function Ve(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ge(e,t,i){if(!t)return e;const n=i&&i.encode||Ve;je.isFunction(i)&&(i={serialize:i});const o=i&&i.serialize;let a;if(a=o?o(t,i):je.isURLSearchParams(t)?t.toString():new He(t,i).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}We.append=function(e,t){this._pairs.push([e,t])},We.toString=function(e){const t=e?function(t){return e.call(this,t,Ke)}:Ke;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};let Ze=class{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){je.forEach(this.handlers,(function(t){null!==t&&e(t)}))}};const Je={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xe={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:He,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Ye="undefined"!=typeof window&&"undefined"!=typeof document,Qe="object"==typeof navigator&&navigator||void 0,et=Ye&&(!Qe||["ReactNative","NativeScript","NS"].indexOf(Qe.product)<0),tt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,it=Ye&&window.location.href||"http://localhost",nt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ye,hasStandardBrowserEnv:et,hasStandardBrowserWebWorkerEnv:tt,navigator:Qe,origin:it},Symbol.toStringTag,{value:"Module"})),...Xe};function ot(e){function t(e,i,n,o){let a=e[o++];if("__proto__"===a)return!0;const r=Number.isFinite(+a),s=o>=e.length;if(a=!a&&je.isArray(n)?n.length:a,s)return je.hasOwnProp(n,a)?n[a]=[n[a],i]:n[a]=i,!r;n[a]&&je.isObject(n[a])||(n[a]=[]);return t(e,i,n[a],o)&&je.isArray(n[a])&&(n[a]=function(e){const t={},i=Object.keys(e);let n;const o=i.length;let a;for(n=0;n<o;n++)a=i[n],t[a]=e[a];return t}(n[a])),!r}if(je.isFormData(e)&&je.isFunction(e.entries)){const i={};return je.forEachEntry(e,((e,n)=>{t(function(e){return je.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,i,0)})),i}return null}const at={transitional:Je,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const i=t.getContentType()||"",n=i.indexOf("application/json")>-1,o=je.isObject(e);o&&je.isHTMLForm(e)&&(e=new FormData(e));if(je.isFormData(e))return n?JSON.stringify(ot(e)):e;if(je.isArrayBuffer(e)||je.isBuffer(e)||je.isStream(e)||je.isFile(e)||je.isBlob(e)||je.isReadableStream(e))return e;if(je.isArrayBufferView(e))return e.buffer;if(je.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return qe(e,new nt.classes.URLSearchParams,Object.assign({visitor:function(e,t,i,n){return nt.isNode&&je.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=je.isFileList(e))||i.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return qe(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||n?(t.setContentType("application/json",!1),function(e,t){if(je.isString(e))try{return(t||JSON.parse)(e),je.trim(e)}catch(i){if("SyntaxError"!==i.name)throw i}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||at.transitional,i=t&&t.forcedJSONParsing,n="json"===this.responseType;if(je.isResponse(e)||je.isReadableStream(e))return e;if(e&&je.isString(e)&&(i&&!this.responseType||n)){const i=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(o){if(i){if("SyntaxError"===o.name)throw Fe.from(o,Fe.ERR_BAD_RESPONSE,this,null,this.response);throw o}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:nt.classes.FormData,Blob:nt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};je.forEach(["delete","get","head","post","put","patch"],(e=>{at.headers[e]={}}));const rt=je.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),st=Symbol("internals");function ct(e){return e&&String(e).trim().toLowerCase()}function pt(e){return!1===e||null==e?e:je.isArray(e)?e.map(pt):String(e)}function lt(e,t,i,n,o){return je.isFunction(n)?n.call(this,t,i):(o&&(t=i),je.isString(t)?je.isString(n)?-1!==t.indexOf(n):je.isRegExp(n)?n.test(t):void 0:void 0)}let ut=class{constructor(e){e&&this.set(e)}set(e,t,i){const n=this;function o(e,t,i){const o=ct(t);if(!o)throw new Error("header name must be a non-empty string");const a=je.findKey(n,o);(!a||void 0===n[a]||!0===i||void 0===i&&!1!==n[a])&&(n[a||t]=pt(e))}const a=(e,t)=>je.forEach(e,((e,i)=>o(e,i,t)));if(je.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(je.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))a((e=>{const t={};let i,n,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),i=e.substring(0,o).trim().toLowerCase(),n=e.substring(o+1).trim(),!i||t[i]&&rt[i]||("set-cookie"===i?t[i]?t[i].push(n):t[i]=[n]:t[i]=t[i]?t[i]+", "+n:n)})),t})(e),t);else if(je.isObject(e)&&je.isIterable(e)){let i,n,o={};for(const t of e){if(!je.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[n=t[0]]=(i=o[n])?je.isArray(i)?[...i,t[1]]:[i,t[1]]:t[1]}a(o,t)}else null!=e&&o(t,e,i);return this}get(e,t){if(e=ct(e)){const i=je.findKey(this,e);if(i){const e=this[i];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=i.exec(e);)t[n[1]]=n[2];return t}(e);if(je.isFunction(t))return t.call(this,e,i);if(je.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ct(e)){const i=je.findKey(this,e);return!(!i||void 0===this[i]||t&&!lt(0,this[i],i,t))}return!1}delete(e,t){const i=this;let n=!1;function o(e){if(e=ct(e)){const o=je.findKey(i,e);!o||t&&!lt(0,i[o],o,t)||(delete i[o],n=!0)}}return je.isArray(e)?e.forEach(o):o(e),n}clear(e){const t=Object.keys(this);let i=t.length,n=!1;for(;i--;){const o=t[i];e&&!lt(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}normalize(e){const t=this,i={};return je.forEach(this,((n,o)=>{const a=je.findKey(i,o);if(a)return t[a]=pt(n),void delete t[o];const r=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,i)=>t.toUpperCase()+i))}(o):String(o).trim();r!==o&&delete t[o],t[r]=pt(n),i[r]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return je.forEach(this,((i,n)=>{null!=i&&!1!==i&&(t[n]=e&&je.isArray(i)?i.join(", "):i)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach((e=>i.set(e))),i}static accessor(e){const t=(this[st]=this[st]={accessors:{}}).accessors,i=this.prototype;function n(e){const n=ct(e);t[n]||(!function(e,t){const i=je.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+i,{value:function(e,i,o){return this[n].call(this,t,e,i,o)},configurable:!0})}))}(i,e),t[n]=!0)}return je.isArray(e)?e.forEach(n):n(e),this}};function dt(e,t){const i=this||at,n=t||i,o=ut.from(n.headers);let a=n.data;return je.forEach(e,(function(e){a=e.call(i,a,o.normalize(),t?t.status:void 0)})),o.normalize(),a}function mt(e){return!(!e||!e.__CANCEL__)}function ft(e,t,i){Fe.call(this,null==e?"canceled":e,Fe.ERR_CANCELED,t,i),this.name="CanceledError"}function ht(e,t,i){const n=i.config.validateStatus;i.status&&n&&!n(i.status)?t(new Fe("Request failed with status code "+i.status,[Fe.ERR_BAD_REQUEST,Fe.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):e(i)}ut.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),je.reduceDescriptors(ut.prototype,(({value:e},t)=>{let i=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[i]=e}}})),je.freezeMethods(ut),je.inherits(ft,Fe,{__CANCEL__:!0});const gt=(e,t,i=3)=>{let n=0;const o=function(e,t){e=e||10;const i=new Array(e),n=new Array(e);let o,a=0,r=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),p=n[r];o||(o=c),i[a]=s,n[a]=c;let l=r,u=0;for(;l!==a;)u+=i[l++],l%=e;if(a=(a+1)%e,a===r&&(r=(r+1)%e),c-o<t)return;const d=p&&c-p;return d?Math.round(1e3*u/d):void 0}}(50,250);return function(e,t){let i,n,o=0,a=1e3/t;const r=(t,a=Date.now())=>{o=a,i=null,n&&(clearTimeout(n),n=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),s=t-o;s>=a?r(e,t):(i=e,n||(n=setTimeout((()=>{n=null,r(i)}),a-s)))},()=>i&&r(i)]}((i=>{const a=i.loaded,r=i.lengthComputable?i.total:void 0,s=a-n,c=o(s);n=a;e({loaded:a,total:r,progress:r?a/r:void 0,bytes:s,rate:c||void 0,estimated:c&&r&&a<=r?(r-a)/c:void 0,event:i,lengthComputable:null!=r,[t?"download":"upload"]:!0})}),i)},bt=(e,t)=>{const i=null!=e;return[n=>t[0]({lengthComputable:i,total:e,loaded:n}),t[1]]},xt=e=>(...t)=>je.asap((()=>e(...t))),vt=nt.hasStandardBrowserEnv?((e,t)=>i=>(i=new URL(i,nt.origin),e.protocol===i.protocol&&e.host===i.host&&(t||e.port===i.port)))(new URL(nt.origin),nt.navigator&&/(msie|trident)/i.test(nt.navigator.userAgent)):()=>!0,yt=nt.hasStandardBrowserEnv?{write(e,t,i,n,o,a){const r=[e+"="+encodeURIComponent(t)];je.isNumber(i)&&r.push("expires="+new Date(i).toGMTString()),je.isString(n)&&r.push("path="+n),je.isString(o)&&r.push("domain="+o),!0===a&&r.push("secure"),document.cookie=r.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function wt(e,t,i){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==i)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const kt=e=>e instanceof ut?{...e}:e;function It(e,t){t=t||{};const i={};function n(e,t,i,n){return je.isPlainObject(e)&&je.isPlainObject(t)?je.merge.call({caseless:n},e,t):je.isPlainObject(t)?je.merge({},t):je.isArray(t)?t.slice():t}function o(e,t,i,o){return je.isUndefined(t)?je.isUndefined(e)?void 0:n(void 0,e,0,o):n(e,t,0,o)}function a(e,t){if(!je.isUndefined(t))return n(void 0,t)}function r(e,t){return je.isUndefined(t)?je.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(i,o,a){return a in t?n(i,o):a in e?n(void 0,i):void 0}const c={url:a,method:a,data:a,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,withXSRFToken:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:s,headers:(e,t,i)=>o(kt(e),kt(t),0,!0)};return je.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||o,r=a(e[n],t[n],n);je.isUndefined(r)&&a!==s||(i[n]=r)})),i}const Tt=e=>{const t=It({},e);let i,{data:n,withXSRFToken:o,xsrfHeaderName:a,xsrfCookieName:r,headers:s,auth:c}=t;if(t.headers=s=ut.from(s),t.url=Ge(wt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),je.isFormData(n))if(nt.hasStandardBrowserEnv||nt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(!1!==(i=s.getContentType())){const[e,...t]=i?i.split(";").map((e=>e.trim())).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...t].join("; "))}if(nt.hasStandardBrowserEnv&&(o&&je.isFunction(o)&&(o=o(t)),o||!1!==o&&vt(t.url))){const e=a&&r&&yt.read(r);e&&s.set(a,e)}return t},St="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,i){const n=Tt(e);let o=n.data;const a=ut.from(n.headers).normalize();let r,s,c,p,l,{responseType:u,onUploadProgress:d,onDownloadProgress:m}=n;function f(){p&&p(),l&&l(),n.cancelToken&&n.cancelToken.unsubscribe(r),n.signal&&n.signal.removeEventListener("abort",r)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=ut.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());ht((function(e){t(e),f()}),(function(e){i(e),f()}),{data:u&&"text"!==u&&"json"!==u?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:n,config:e,request:h}),h=null}h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout,"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(g)},h.onabort=function(){h&&(i(new Fe("Request aborted",Fe.ECONNABORTED,e,h)),h=null)},h.onerror=function(){i(new Fe("Network Error",Fe.ERR_NETWORK,e,h)),h=null},h.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const o=n.transitional||Je;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),i(new Fe(t,o.clarifyTimeoutError?Fe.ETIMEDOUT:Fe.ECONNABORTED,e,h)),h=null},void 0===o&&a.setContentType(null),"setRequestHeader"in h&&je.forEach(a.toJSON(),(function(e,t){h.setRequestHeader(t,e)})),je.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),m&&([c,l]=gt(m,!0),h.addEventListener("progress",c)),d&&h.upload&&([s,p]=gt(d),h.upload.addEventListener("progress",s),h.upload.addEventListener("loadend",p)),(n.cancelToken||n.signal)&&(r=t=>{h&&(i(!t||t.type?new ft(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(r),n.signal&&(n.signal.aborted?r():n.signal.addEventListener("abort",r)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);b&&-1===nt.protocols.indexOf(b)?i(new Fe("Unsupported protocol "+b+":",Fe.ERR_BAD_REQUEST,e)):h.send(o||null)}))},At=(e,t)=>{const{length:i}=e=e?e.filter(Boolean):[];if(t||i){let i,n=new AbortController;const o=function(e){if(!i){i=!0,r();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Fe?t:new ft(t instanceof Error?t.message:t))}};let a=t&&setTimeout((()=>{a=null,o(new Fe(`timeout ${t} of ms exceeded`,Fe.ETIMEDOUT))}),t);const r=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)})),e=null)};e.forEach((e=>e.addEventListener("abort",o)));const{signal:s}=n;return s.unsubscribe=()=>je.asap(r),s}},Et=function*(e,t){let i=e.byteLength;if(i<t)return void(yield e);let n,o=0;for(;o<i;)n=o+t,yield e.slice(o,n),o=n},_t=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:i}=await t.read();if(e)break;yield i}}finally{await t.cancel()}},Ct=(e,t,i,n)=>{const o=async function*(e,t){for await(const i of _t(e))yield*Et(i,t)}(e,t);let a,r=0,s=e=>{a||(a=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await o.next();if(t)return s(),void e.close();let a=n.byteLength;if(i){let e=r+=a;i(e)}e.enqueue(new Uint8Array(n))}catch(t){throw s(t),t}},cancel:e=>(s(e),o.return())},{highWaterMark:2})},Rt="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Nt=Rt&&"function"==typeof ReadableStream,Pt=Rt&&("function"==typeof TextEncoder?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Ot=(e,...t)=>{try{return!!e(...t)}catch(i){return!1}},$t=Nt&&Ot((()=>{let e=!1;const t=new Request(nt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),jt=Nt&&Ot((()=>je.isReadableStream(new Response("").body))),Ft={stream:jt&&(e=>e.body)};var Lt;Rt&&(Lt=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!Ft[e]&&(Ft[e]=je.isFunction(Lt[e])?t=>t[e]():(t,i)=>{throw new Fe(`Response type '${e}' is not supported`,Fe.ERR_NOT_SUPPORT,i)})})));const Ut=async(e,t)=>{const i=je.toFiniteNumber(e.getContentLength());return null==i?(async e=>{if(null==e)return 0;if(je.isBlob(e))return e.size;if(je.isSpecCompliantForm(e)){const t=new Request(nt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return je.isArrayBufferView(e)||je.isArrayBuffer(e)?e.byteLength:(je.isURLSearchParams(e)&&(e+=""),je.isString(e)?(await Pt(e)).byteLength:void 0)})(t):i},Bt={http:null,xhr:St,fetch:Rt&&(async e=>{let{url:t,method:i,data:n,signal:o,cancelToken:a,timeout:r,onDownloadProgress:s,onUploadProgress:c,responseType:p,headers:l,withCredentials:u="same-origin",fetchOptions:d}=Tt(e);p=p?(p+"").toLowerCase():"text";let m,f=At([o,a&&a.toAbortSignal()],r);const h=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let g;try{if(c&&$t&&"get"!==i&&"head"!==i&&0!==(g=await Ut(l,n))){let e,i=new Request(t,{method:"POST",body:n,duplex:"half"});if(je.isFormData(n)&&(e=i.headers.get("content-type"))&&l.setContentType(e),i.body){const[e,t]=bt(g,gt(xt(c)));n=Ct(i.body,65536,e,t)}}je.isString(u)||(u=u?"include":"omit");const o="credentials"in Request.prototype;m=new Request(t,{...d,signal:f,method:i.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:o?u:void 0});let a=await fetch(m);const r=jt&&("stream"===p||"response"===p);if(jt&&(s||r&&h)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=a[t]}));const t=je.toFiniteNumber(a.headers.get("content-length")),[i,n]=s&&bt(t,gt(xt(s),!0))||[];a=new Response(Ct(a.body,65536,i,(()=>{n&&n(),h&&h()})),e)}p=p||"text";let b=await Ft[je.findKey(Ft,p)||"text"](a,e);return!r&&h&&h(),await new Promise(((t,i)=>{ht(t,i,{data:b,headers:ut.from(a.headers),status:a.status,statusText:a.statusText,config:e,request:m})}))}catch(b){if(h&&h(),b&&"TypeError"===b.name&&/Load failed|fetch/i.test(b.message))throw Object.assign(new Fe("Network Error",Fe.ERR_NETWORK,e,m),{cause:b.cause||b});throw Fe.from(b,b&&b.code,e,m)}})};je.forEach(Bt,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(i){}Object.defineProperty(e,"adapterName",{value:t})}}));const Mt=e=>`- ${e}`,Dt=e=>je.isFunction(e)||null===e||!1===e,zt=e=>{e=je.isArray(e)?e:[e];const{length:t}=e;let i,n;const o={};for(let a=0;a<t;a++){let t;if(i=e[a],n=i,!Dt(i)&&(n=Bt[(t=String(i)).toLowerCase()],void 0===n))throw new Fe(`Unknown adapter '${t}'`);if(n)break;o[t||"#"+a]=n}if(!n){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new Fe("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Mt).join("\n"):" "+Mt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function qt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ft(null,e)}function Kt(e){qt(e),e.headers=ut.from(e.headers),e.data=dt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return zt(e.adapter||at.adapter)(e).then((function(t){return qt(e),t.data=dt.call(e,e.transformResponse,t),t.headers=ut.from(t.headers),t}),(function(t){return mt(t)||(qt(e),t&&t.response&&(t.response.data=dt.call(e,e.transformResponse,t.response),t.response.headers=ut.from(t.response.headers))),Promise.reject(t)}))}const Ht="1.9.0",Wt={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Wt[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));const Vt={};Wt.transitional=function(e,t,i){function n(e,t){return"[Axios v1.9.0] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,o,a)=>{if(!1===e)throw new Fe(n(o," has been removed"+(t?" in "+t:"")),Fe.ERR_DEPRECATED);return t&&!Vt[o]&&(Vt[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,o,a)}},Wt.spelling=function(e){return(t,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};const Gt={assertOptions:function(e,t,i){if("object"!=typeof e)throw new Fe("options must be an object",Fe.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const a=n[o],r=t[a];if(r){const t=e[a],i=void 0===t||r(t,a,e);if(!0!==i)throw new Fe("option "+a+" must be "+i,Fe.ERR_BAD_OPTION_VALUE)}else if(!0!==i)throw new Fe("Unknown option "+a,Fe.ERR_BAD_OPTION)}},validators:Wt},Zt=Gt.validators;let Jt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ze,response:new Ze}}async request(e,t){try{return await this._request(e,t)}catch(i){if(i instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{i.stack?t&&!String(i.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(i.stack+="\n"+t):i.stack=t}catch(n){}}throw i}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=It(this.defaults,t);const{transitional:i,paramsSerializer:n,headers:o}=t;void 0!==i&&Gt.assertOptions(i,{silentJSONParsing:Zt.transitional(Zt.boolean),forcedJSONParsing:Zt.transitional(Zt.boolean),clarifyTimeoutError:Zt.transitional(Zt.boolean)},!1),null!=n&&(je.isFunction(n)?t.paramsSerializer={serialize:n}:Gt.assertOptions(n,{encode:Zt.function,serialize:Zt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Gt.assertOptions(t,{baseUrl:Zt.spelling("baseURL"),withXsrfToken:Zt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=o&&je.merge(o.common,o[t.method]);o&&je.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=ut.concat(a,o);const r=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));const c=[];let p;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,u=0;if(!s){const e=[Kt.bind(this),void 0];for(e.unshift.apply(e,r),e.push.apply(e,c),l=e.length,p=Promise.resolve(t);u<l;)p=p.then(e[u++],e[u++]);return p}l=r.length;let d=t;for(u=0;u<l;){const e=r[u++],t=r[u++];try{d=e(d)}catch(m){t.call(this,m);break}}try{p=Kt.call(this,d)}catch(m){return Promise.reject(m)}for(u=0,l=c.length;u<l;)p=p.then(c[u++],c[u++]);return p}getUri(e){return Ge(wt((e=It(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};je.forEach(["delete","get","head","options"],(function(e){Jt.prototype[e]=function(t,i){return this.request(It(i||{},{method:e,url:t,data:(i||{}).data}))}})),je.forEach(["post","put","patch"],(function(e){function t(t){return function(i,n,o){return this.request(It(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:n}))}}Jt.prototype[e]=t(),Jt.prototype[e+"Form"]=t(!0)}));const Xt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Xt).forEach((([e,t])=>{Xt[t]=e}));const Yt=function e(t){const i=new Jt(t),n=G(Jt.prototype.request,i);return je.extend(n,Jt.prototype,i,{allOwnKeys:!0}),je.extend(n,i,null,{allOwnKeys:!0}),n.create=function(i){return e(It(t,i))},n}(at);Yt.Axios=Jt,Yt.CanceledError=ft,Yt.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const i=this;this.promise.then((e=>{if(!i._listeners)return;let t=i._listeners.length;for(;t-- >0;)i._listeners[t](e);i._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{i.subscribe(e),t=e})).then(e);return n.cancel=function(){i.unsubscribe(t)},n},e((function(e,n,o){i.reason||(i.reason=new ft(e,n,o),t(i.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e((function(e){t=e})),cancel:t}}},Yt.isCancel=mt,Yt.VERSION=Ht,Yt.toFormData=qe,Yt.AxiosError=Fe,Yt.Cancel=Yt.CanceledError,Yt.all=function(e){return Promise.all(e)},Yt.spread=function(e){return function(t){return e.apply(null,t)}},Yt.isAxiosError=function(e){return je.isObject(e)&&!0===e.isAxiosError},Yt.mergeConfig=It,Yt.AxiosHeaders=ut,Yt.formToJSON=e=>ot(je.isHTMLForm(e)?new FormData(e):e),Yt.getAdapter=zt,Yt.HttpStatusCode=Xt,Yt.default=Yt;let Qt=(h=class{constructor(){b(this,"isProduction"),this.isProduction="production"===V.env.NODE_ENV}static getInstance(){return h.instance||(h.instance=new h),h.instance}debug(e,...t){this.isProduction||console.debug(e,...t)}info(e,...t){this.isProduction||console.info(e,...t)}warn(e,...t){console.warn(e,...t)}error(e,...t){console.error(e,...t)}},b(h,"instance"),h),ei=class extends Error{constructor(e){super(e),this.name="ValidationError"}},ti=class{constructor(e){b(this,"accountId"),b(this,"privateKey"),b(this,"baseUrl"),b(this,"network"),this.accountId=e.accountId,this.privateKey="string"==typeof e.privateKey?i.PrivateKey.fromStringED25519(e.privateKey):e.privateKey,this.network=e.network||"mainnet",this.baseUrl=e.baseUrl||"https://kiloscribe.com"}async authenticate(){var e,t,i;const n=await Yt.get(`${this.baseUrl}/api/auth/request-signature`,{headers:{"x-session":this.accountId}});if(!(null==(e=n.data)?void 0:e.message))throw new Error("Failed to get signature message");const o=n.data.message,a=await this.signMessage(o),r=await Yt.post(`${this.baseUrl}/api/auth/authenticate`,{authData:{id:this.accountId,signature:a,data:o,network:this.network},include:"apiKey"});if(!(null==(i=null==(t=r.data)?void 0:t.user)?void 0:i.sessionToken))throw new Error("Authentication failed");return{apiKey:r.data.apiKey}}async signMessage(e){const t=(new TextEncoder).encode(e),i=await this.privateKey.sign(t);return C.from(i).toString("hex")}};var ii,ni,oi,ai={exports:{}};!function(){if(oi)return ai.exports;oi=1;const e=function(){if(ni)return ii;function e(e){try{return JSON.stringify(e)}catch(t){return'"[Circular]"'}}return ni=1,ii=function(t,i,n){var o=n&&n.stringify||e;if("object"==typeof t&&null!==t){var a=i.length+1;if(1===a)return t;var r=new Array(a);r[0]=o(t);for(var s=1;s<a;s++)r[s]=o(i[s]);return r.join(" ")}if("string"!=typeof t)return t;var c=i.length;if(0===c)return t;for(var p="",l=0,u=-1,d=t&&t.length||0,m=0;m<d;){if(37===t.charCodeAt(m)&&m+1<d){switch(u=u>-1?u:0,t.charCodeAt(m+1)){case 100:case 102:if(l>=c)break;if(null==i[l])break;u<m&&(p+=t.slice(u,m)),p+=Number(i[l]),u=m+2,m++;break;case 105:if(l>=c)break;if(null==i[l])break;u<m&&(p+=t.slice(u,m)),p+=Math.floor(Number(i[l])),u=m+2,m++;break;case 79:case 111:case 106:if(l>=c)break;if(void 0===i[l])break;u<m&&(p+=t.slice(u,m));var f=typeof i[l];if("string"===f){p+="'"+i[l]+"'",u=m+2,m++;break}if("function"===f){p+=i[l].name||"<anonymous>",u=m+2,m++;break}p+=o(i[l]),u=m+2,m++;break;case 115:if(l>=c)break;u<m&&(p+=t.slice(u,m)),p+=String(i[l]),u=m+2,m++;break;case 37:u<m&&(p+=t.slice(u,m)),p+="%",u=m+2,m++,l--}++l}++m}return-1===u?t:(u<d&&(p+=t.slice(u)),p)},ii}();ai.exports=c;const t=function(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{},i={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:h,wrapResponseSerializer:h,wrapErrorSerializer:h,req:f,res:f,err:d,errWithCause:d};function n(e,t){return"silent"===e?1/0:t.levels.values[e]}const o=Symbol("pino.logFuncs"),a=Symbol("pino.hierarchy"),r={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function s(e,t){const i={logger:t,parent:e[a]};t[a]=i}function c(e){(e=e||{}).browser=e.browser||{};const i=e.browser.transmit;if(i&&"function"!=typeof i.send)throw Error("pino: transmit option must have a send function");const a=e.browser.write||t;e.browser.write&&(e.browser.asObject=!0);const d=e.serializers||{},f=function(e,t){if(Array.isArray(e))return e.filter((function(e){return"!stdSerializers.err"!==e}));return!0===e&&Object.keys(t)}(e.browser.serialize,d);let h=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(h=!1);const b=Object.keys(e.customLevels||{}),x=["error","fatal","warn","info","debug","trace"].concat(b);"function"==typeof a&&x.forEach((function(e){a[e]=a})),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const v=e.level||"info",y=Object.create(a);y.log||(y.log=g),function(e,i,n){const a={};i.forEach((e=>{a[e]=n[e]?n[e]:t[e]||t[r[e]||"log"]||g})),e[o]=a}(y,x,a),s({},y),Object.defineProperty(y,"levelVal",{get:function(){return n(this.level,this)}}),Object.defineProperty(y,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,p(this,w,y,"error"),p(this,w,y,"fatal"),p(this,w,y,"warn"),p(this,w,y,"info"),p(this,w,y,"debug"),p(this,w,y,"trace"),b.forEach((e=>{p(this,w,y,e)}))}});const w={transmit:i,serialize:f,asObject:e.browser.asObject,formatters:e.browser.formatters,levels:x,timestamp:m(e),messageKey:e.messageKey||"msg",onChild:e.onChild||g};function k(t,n,o){if(!n)throw new Error("missing bindings for child Pino");o=o||{},f&&n.serializers&&(o.serializers=n.serializers);const a=o.serializers;if(f&&a){var r=Object.assign({},d,a),c=!0===e.browser.serialize?Object.keys(r):f;delete n.serializers,l([n],c,r,this._stdErrSerialize)}function p(e){this._childLevel=1+(0|e._childLevel),this.bindings=n,r&&(this.serializers=r,this._serialize=c),i&&(this._logEvent=u([].concat(e._logEvent.bindings,n)))}p.prototype=this;const m=new p(this);return s(this,m),m.child=function(...e){return k.call(this,t,...e)},m.level=o.level||this.level,t.onChild(m),m}return y.levels=function(e){const t=e.customLevels||{},i=Object.assign({},c.levels.values,t),n=Object.assign({},c.levels.labels,function(e){const t={};return Object.keys(e).forEach((function(i){t[e[i]]=i})),t}(t));return{values:i,labels:n}}(e),y.level=v,y.setMaxListeners=y.getMaxListeners=y.emit=y.addListener=y.on=y.prependListener=y.once=y.prependOnceListener=y.removeListener=y.removeAllListeners=y.listeners=y.listenerCount=y.eventNames=y.write=y.flush=g,y.serializers=d,y._serialize=f,y._stdErrSerialize=h,y.child=function(...e){return k.call(this,w,...e)},i&&(y._logEvent=u()),y}function p(i,r,s,c){if(Object.defineProperty(i,c,{value:n(i.level,s)>n(c,s)?g:s[o][c],writable:!0,enumerable:!0,configurable:!0}),i[c]===g){if(!r.transmit)return;const e=n(r.transmit.level||i.level,s);if(n(c,s)<e)return}i[c]=function(i,a,r,s){return function(o){return function(){const c=a.timestamp(),p=new Array(arguments.length),d=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var m=0;m<p.length;m++)p[m]=arguments[m];var f=!1;if(a.serialize&&(l(p,this._serialize,this.serializers,this._stdErrSerialize),f=!0),a.asObject||a.formatters?o.call(d,function(t,i,n,o,a){const{level:r,log:s=e=>e}=a.formatters||{},c=n.slice();let p=c[0];const l={};o&&(l.time=o);if(r){const e=r(i,t.levels.values[i]);Object.assign(l,e)}else l.level=t.levels.values[i];let u=1+(0|t._childLevel);u<1&&(u=1);if(null!==p&&"object"==typeof p){for(;u--&&"object"==typeof c[0];)Object.assign(l,c.shift());p=c.length?e(c.shift(),c):void 0}else"string"==typeof p&&(p=e(c.shift(),c));void 0!==p&&(l[a.messageKey]=p);return s(l)}(this,s,p,c,a)):o.apply(d,p),a.transmit){const e=n(a.transmit.level||i._level,r),t=n(s,r);if(t<e)return;!function(e,t,i,n=!1){const o=t.send,a=t.ts,r=t.methodLevel,s=t.methodValue,c=t.val,p=e._logEvent.bindings;n||l(i,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize);e._logEvent.ts=a,e._logEvent.messages=i.filter((function(e){return-1===p.indexOf(e)})),e._logEvent.level.label=r,e._logEvent.level.value=s,o(r,e._logEvent,c),e._logEvent=u(p)}(this,{ts:c,methodLevel:s,methodValue:t,transmitValue:r.levels.values[a.transmit.level||i._level],send:a.transmit.send,val:n(i._level,r)},p,f)}}}(i[o][s])}(i,r,s,c);const p=function(e){const t=[];e.bindings&&t.push(e.bindings);let i=e[a];for(;i.parent;)i=i.parent,i.logger.bindings&&t.push(i.logger.bindings);return t.reverse()}(i);0!==p.length&&(i[c]=function(e,t){return function(){return t.apply(this,[...e,...arguments])}}(p,i[c]))}function l(e,t,i,n){for(const o in e)if(n&&e[o]instanceof Error)e[o]=c.stdSerializers.err(e[o]);else if("object"==typeof e[o]&&!Array.isArray(e[o])&&t)for(const n in e[o])t.indexOf(n)>-1&&n in i&&(e[o][n]=i[n](e[o][n]))}function u(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function d(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const i in e)void 0===t[i]&&(t[i]=e[i]);return t}function m(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?b:x}function f(){return{}}function h(e){return e}function g(){}function b(){return!1}function x(){return Date.now()}c.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},c.stdSerializers=i,c.stdTimeFunctions=Object.assign({},{nullTime:b,epochTime:x,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}}),ai.exports.default=c,ai.exports.pino=c,ai.exports}();for(var ri=Object.defineProperty,si=((e,t,i)=>((e,t,i)=>t in e?ri(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i)),ci={},pi={byteLength:function(e){var t=hi(e),i=t[0],n=t[1];return 3*(i+n)/4-n},toByteArray:function(e){var t,i,n=hi(e),o=n[0],a=n[1],r=new di(function(e,t,i){return 3*(t+i)/4-i}(0,o,a)),s=0,c=a>0?o-4:o;for(i=0;i<c;i+=4)t=ui[e.charCodeAt(i)]<<18|ui[e.charCodeAt(i+1)]<<12|ui[e.charCodeAt(i+2)]<<6|ui[e.charCodeAt(i+3)],r[s++]=t>>16&255,r[s++]=t>>8&255,r[s++]=255&t;2===a&&(t=ui[e.charCodeAt(i)]<<2|ui[e.charCodeAt(i+1)]>>4,r[s++]=255&t);1===a&&(t=ui[e.charCodeAt(i)]<<10|ui[e.charCodeAt(i+1)]<<4|ui[e.charCodeAt(i+2)]>>2,r[s++]=t>>8&255,r[s++]=255&t);return r},fromByteArray:function(e){for(var t,i=e.length,n=i%3,o=[],a=16383,r=0,s=i-n;r<s;r+=a)o.push(gi(e,r,r+a>s?s:r+a));1===n?(t=e[i-1],o.push(li[t>>2]+li[t<<4&63]+"==")):2===n&&(t=(e[i-2]<<8)+e[i-1],o.push(li[t>>10]+li[t>>4&63]+li[t<<2&63]+"="));return o.join("")}},li=[],ui=[],di="undefined"!=typeof Uint8Array?Uint8Array:Array,mi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fi=0;fi<64;++fi)li[fi]=mi[fi],ui[mi.charCodeAt(fi)]=fi;function hi(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=e.indexOf("=");return-1===i&&(i=t),[i,i===t?0:4-i%4]}function gi(e,t,i){for(var n,o,a=[],r=t;r<i;r+=3)n=(e[r]<<16&16711680)+(e[r+1]<<8&65280)+(255&e[r+2]),a.push(li[(o=n)>>18&63]+li[o>>12&63]+li[o>>6&63]+li[63&o]);return a.join("")}ui["-".charCodeAt(0)]=62,ui["_".charCodeAt(0)]=63;var bi={
11
11
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
12
12
  read:function(e,t,i,n,o){var a,r,s=8*o-n-1,c=(1<<s)-1,p=c>>1,l=-7,u=i?o-1:0,d=i?-1:1,m=e[t+u];for(u+=d,a=m&(1<<-l)-1,m>>=-l,l+=s;l>0;a=256*a+e[t+u],u+=d,l-=8);for(r=a&(1<<-l)-1,a>>=-l,l+=n;l>0;r=256*r+e[t+u],u+=d,l-=8);if(0===a)a=1-p;else{if(a===c)return r?NaN:1/0*(m?-1:1);r+=Math.pow(2,n),a-=p}return(m?-1:1)*r*Math.pow(2,a-n)},write:function(e,t,i,n,o,a){var r,s,c,p=8*a-o-1,l=(1<<p)-1,u=l>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:a-1,f=n?1:-1,h=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,r=l):(r=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-r))<1&&(r--,c*=2),(t+=r+u>=1?d/c:d*Math.pow(2,1-u))*c>=2&&(r++,c/=2),r+u>=l?(s=0,r=l):r+u>=1?(s=(t*c-1)*Math.pow(2,o),r+=u):(s=t*Math.pow(2,u-1)*Math.pow(2,o),r=0));o>=8;e[i+m]=255&s,m+=f,s/=256,o-=8);for(r=r<<o|s,p+=o;p>0;e[i+m]=255&r,m+=f,r/=256,p-=8);e[i+m-f]|=128*h}};
13
13
  /*!
@@ -16,7 +16,7 @@ read:function(e,t,i,n,o){var a,r,s=8*o-n-1,c=(1<<s)-1,p=c>>1,l=-7,u=i?o-1:0,d=i?
16
16
  * @author Feross Aboukhadijeh <https://feross.org>
17
17
  * @license MIT
18
18
  */
19
- !function(e){const t=pi,i=bi,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=p,e.SlowBuffer=function(e){+e!=e&&(e=0);return p.alloc(+e)},e.INSPECT_MAX_BYTES=50;const o=2147483647;e.kMaxLength=o;const{Uint8Array:a,ArrayBuffer:r,SharedArrayBuffer:s}=globalThis;function c(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new a(e);return Object.setPrototypeOf(t,p.prototype),t}function p(e,t,i){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,i)}function l(e,t,i){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!p.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const i=0|g(e,t);let n=c(i);const o=n.write(e,t);o!==i&&(n=n.slice(0,o));return n}(e,t);if(r.isView(e))return function(e){if(J(e,a)){const t=new a(e);return f(t.buffer,t.byteOffset,t.byteLength)}return m(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(J(e,r)||e&&J(e.buffer,r))return f(e,t,i);if(void 0!==s&&(J(e,s)||e&&J(e.buffer,s)))return f(e,t,i);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return p.from(n,t,i);const o=function(e){if(p.isBuffer(e)){const t=0|h(e.length),i=c(t);return 0===i.length||e.copy(i,0,0,t),i}if(void 0!==e.length)return"number"!=typeof e.length||X(e.length)?c(0):m(e);if("Buffer"===e.type&&Array.isArray(e.data))return m(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return p.from(e[Symbol.toPrimitive]("string"),t,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),c(e<0?0:0|h(e))}function m(e){const t=e.length<0?0:0|h(e.length),i=c(t);for(let n=0;n<t;n+=1)i[n]=255&e[n];return i}function f(e,t,i){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(i||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===i?new a(e):void 0===i?new a(e,t):new a(e,t,i),Object.setPrototypeOf(n,p.prototype),n}function h(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function g(e,t){if(p.isBuffer(e))return e.length;if(r.isView(e)||J(e,r))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const i=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===i)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return G(e).length;default:if(o)return n?-1:V(e).length;t=(""+t).toLowerCase(),o=!0}}function b(e,t,i){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,i);case"utf8":case"utf-8":return E(this,t,i);case"ascii":return C(this,t,i);case"latin1":case"binary":return R(this,t,i);case"base64":return A(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,i);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function x(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function v(e,t,i,n,o){if(0===e.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),X(i=+i)&&(i=o?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(o)return-1;i=e.length-1}else if(i<0){if(!o)return-1;i=0}if("string"==typeof t&&(t=p.from(t,n)),p.isBuffer(t))return 0===t.length?-1:y(e,t,i,n,o);if("number"==typeof t)return t&=255,"function"==typeof a.prototype.indexOf?o?a.prototype.indexOf.call(e,t,i):a.prototype.lastIndexOf.call(e,t,i):y(e,[t],i,n,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,i,n,o){let a,r=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;r=2,s/=2,c/=2,i/=2}function p(e,t){return 1===r?e[t]:e.readUInt16BE(t*r)}if(o){let n=-1;for(a=i;a<s;a++)if(p(e,a)===p(t,-1===n?0:a-n)){if(-1===n&&(n=a),a-n+1===c)return n*r}else-1!==n&&(a-=a-n),n=-1}else for(i+c>s&&(i=s-c),a=i;a>=0;a--){let i=!0;for(let n=0;n<c;n++)if(p(e,a+n)!==p(t,n)){i=!1;break}if(i)return a}return-1}function w(e,t,i,n){i=Number(i)||0;const o=e.length-i;n?(n=Number(n))>o&&(n=o):n=o;const a=t.length;let r;for(n>a/2&&(n=a/2),r=0;r<n;++r){const n=parseInt(t.substr(2*r,2),16);if(X(n))return r;e[i+r]=n}return r}function k(e,t,i,n){return Z(V(t,e.length-i),e,i,n)}function I(e,t,i,n){return Z(function(e){const t=[];for(let i=0;i<e.length;++i)t.push(255&e.charCodeAt(i));return t}(t),e,i,n)}function T(e,t,i,n){return Z(G(t),e,i,n)}function S(e,t,i,n){return Z(function(e,t){let i,n,o;const a=[];for(let r=0;r<e.length&&!((t-=2)<0);++r)i=e.charCodeAt(r),n=i>>8,o=i%256,a.push(o),a.push(n);return a}(t,e.length-i),e,i,n)}function A(e,i,n){return 0===i&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(i,n))}function E(e,t,i){i=Math.min(e.length,i);const n=[];let o=t;for(;o<i;){const t=e[o];let a=null,r=t>239?4:t>223?3:t>191?2:1;if(o+r<=i){let i,n,s,c;switch(r){case 1:t<128&&(a=t);break;case 2:i=e[o+1],128==(192&i)&&(c=(31&t)<<6|63&i,c>127&&(a=c));break;case 3:i=e[o+1],n=e[o+2],128==(192&i)&&128==(192&n)&&(c=(15&t)<<12|(63&i)<<6|63&n,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:i=e[o+1],n=e[o+2],s=e[o+3],128==(192&i)&&128==(192&n)&&128==(192&s)&&(c=(15&t)<<18|(63&i)<<12|(63&n)<<6|63&s,c>65535&&c<1114112&&(a=c))}}null===a?(a=65533,r=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),o+=r}return function(e){const t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);let i="",n=0;for(;n<t;)i+=String.fromCharCode.apply(String,e.slice(n,n+=_));return i}(n)}p.TYPED_ARRAY_SUPPORT=function(){try{const e=new a(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,a.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),p.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}}),p.poolSize=8192,p.from=function(e,t,i){return l(e,t,i)},Object.setPrototypeOf(p.prototype,a.prototype),Object.setPrototypeOf(p,a),p.alloc=function(e,t,i){return function(e,t,i){return u(e),e<=0?c(e):void 0!==t?"string"==typeof i?c(e).fill(t,i):c(e).fill(t):c(e)}(e,t,i)},p.allocUnsafe=function(e){return d(e)},p.allocUnsafeSlow=function(e){return d(e)},p.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==p.prototype},p.compare=function(e,t){if(J(e,a)&&(e=p.from(e,e.offset,e.byteLength)),J(t,a)&&(t=p.from(t,t.offset,t.byteLength)),!p.isBuffer(e)||!p.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let o=0,a=Math.min(i,n);o<a;++o)if(e[o]!==t[o]){i=e[o],n=t[o];break}return i<n?-1:n<i?1:0},p.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}},p.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return p.alloc(0);let i;if(void 0===t)for(t=0,i=0;i<e.length;++i)t+=e[i].length;const n=p.allocUnsafe(t);let o=0;for(i=0;i<e.length;++i){let t=e[i];if(J(t,a))o+t.length>n.length?(p.isBuffer(t)||(t=p.from(t)),t.copy(n,o)):a.prototype.set.call(n,t,o);else{if(!p.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,o)}o+=t.length}return n},p.byteLength=g,p.prototype._isBuffer=!0,p.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)x(this,t,t+1);return this},p.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},p.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},p.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?E(this,0,e):b.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===p.compare(this,e)},p.prototype.inspect=function(){let t="";const i=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,i).replace(/(.{2})/g,"$1 ").trim(),this.length>i&&(t+=" ... "),"<Buffer "+t+">"},n&&(p.prototype[n]=p.prototype.inspect),p.prototype.compare=function(e,t,i,n,o){if(J(e,a)&&(e=p.from(e,e.offset,e.byteLength)),!p.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||i>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(this===e)return 0;let r=(o>>>=0)-(n>>>=0),s=(i>>>=0)-(t>>>=0);const c=Math.min(r,s),l=this.slice(n,o),u=e.slice(t,i);for(let a=0;a<c;++a)if(l[a]!==u[a]){r=l[a],s=u[a];break}return r<s?-1:s<r?1:0},p.prototype.includes=function(e,t,i){return-1!==this.indexOf(e,t,i)},p.prototype.indexOf=function(e,t,i){return v(this,e,t,i,!0)},p.prototype.lastIndexOf=function(e,t,i){return v(this,e,t,i,!1)},p.prototype.write=function(e,t,i,n){if(void 0===t)n="utf8",i=this.length,t=0;else if(void 0===i&&"string"==typeof t)n=t,i=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(i)?(i>>>=0,void 0===n&&(n="utf8")):(n=i,i=void 0)}const o=this.length-t;if((void 0===i||i>o)&&(i=o),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return w(this,e,t,i);case"utf8":case"utf-8":return k(this,e,t,i);case"ascii":case"latin1":case"binary":return I(this,e,t,i);case"base64":return T(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const _=4096;function C(e,t,i){let n="";i=Math.min(e.length,i);for(let o=t;o<i;++o)n+=String.fromCharCode(127&e[o]);return n}function R(e,t,i){let n="";i=Math.min(e.length,i);for(let o=t;o<i;++o)n+=String.fromCharCode(e[o]);return n}function N(e,t,i){const n=e.length;(!t||t<0)&&(t=0),(!i||i<0||i>n)&&(i=n);let o="";for(let a=t;a<i;++a)o+=Y[e[a]];return o}function P(e,t,i){const n=e.slice(t,i);let o="";for(let a=0;a<n.length-1;a+=2)o+=String.fromCharCode(n[a]+256*n[a+1]);return o}function O(e,t,i){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>i)throw new RangeError("Trying to access beyond buffer length")}function j(e,t,i,n,o,a){if(!p.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<a)throw new RangeError('"value" argument is out of bounds');if(i+n>e.length)throw new RangeError("Index out of range")}function $(e,t,i,n,o){q(t,n,o,e,i,7);let a=Number(t&BigInt(4294967295));e[i++]=a,a>>=8,e[i++]=a,a>>=8,e[i++]=a,a>>=8,e[i++]=a;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[i++]=r,r>>=8,e[i++]=r,r>>=8,e[i++]=r,r>>=8,e[i++]=r,i}function F(e,t,i,n,o){q(t,n,o,e,i,7);let a=Number(t&BigInt(4294967295));e[i+7]=a,a>>=8,e[i+6]=a,a>>=8,e[i+5]=a,a>>=8,e[i+4]=a;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[i+3]=r,r>>=8,e[i+2]=r,r>>=8,e[i+1]=r,r>>=8,e[i]=r,i+8}function L(e,t,i,n,o,a){if(i+n>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function U(e,t,n,o,a){return t=+t,n>>>=0,a||L(e,0,n,4),i.write(e,t,n,o,23,4),n+4}function B(e,t,n,o,a){return t=+t,n>>>=0,a||L(e,0,n,8),i.write(e,t,n,o,52,8),n+8}p.prototype.slice=function(e,t){const i=this.length;(e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,p.prototype),n},p.prototype.readUintLE=p.prototype.readUIntLE=function(e,t,i){e>>>=0,t>>>=0,i||O(e,t,this.length);let n=this[e],o=1,a=0;for(;++a<t&&(o*=256);)n+=this[e+a]*o;return n},p.prototype.readUintBE=p.prototype.readUIntBE=function(e,t,i){e>>>=0,t>>>=0,i||O(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n},p.prototype.readUint8=p.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},p.prototype.readBigUInt64LE=Q((function(e){K(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||W(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))})),p.prototype.readBigUInt64BE=Q((function(e){K(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||W(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+i;return(BigInt(n)<<BigInt(32))+BigInt(o)})),p.prototype.readIntLE=function(e,t,i){e>>>=0,t>>>=0,i||O(e,t,this.length);let n=this[e],o=1,a=0;for(;++a<t&&(o*=256);)n+=this[e+a]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},p.prototype.readIntBE=function(e,t,i){e>>>=0,t>>>=0,i||O(e,t,this.length);let n=t,o=1,a=this[e+--n];for(;n>0&&(o*=256);)a+=this[e+--n]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*t)),a},p.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},p.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},p.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},p.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},p.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},p.prototype.readBigInt64LE=Q((function(e){K(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||W(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),p.prototype.readBigInt64BE=Q((function(e){K(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||W(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+i)})),p.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},p.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},p.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},p.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},p.prototype.writeUintLE=p.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t>>>=0,i>>>=0,!n){j(this,e,t,i,Math.pow(2,8*i)-1,0)}let o=1,a=0;for(this[t]=255&e;++a<i&&(o*=256);)this[t+a]=e/o&255;return t+i},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(e,t,i,n){if(e=+e,t>>>=0,i>>>=0,!n){j(this,e,t,i,Math.pow(2,8*i)-1,0)}let o=i-1,a=1;for(this[t+o]=255&e;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+i},p.prototype.writeUint8=p.prototype.writeUInt8=function(e,t,i){return e=+e,t>>>=0,i||j(this,e,t,1,255,0),this[t]=255&e,t+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(e,t,i){return e=+e,t>>>=0,i||j(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(e,t,i){return e=+e,t>>>=0,i||j(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(e,t,i){return e=+e,t>>>=0,i||j(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(e,t,i){return e=+e,t>>>=0,i||j(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},p.prototype.writeBigUInt64LE=Q((function(e,t=0){return $(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),p.prototype.writeBigUInt64BE=Q((function(e,t=0){return F(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),p.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*i-1);j(this,e,t,i,n-1,-n)}let o=0,a=1,r=0;for(this[t]=255&e;++o<i&&(a*=256);)e<0&&0===r&&0!==this[t+o-1]&&(r=1),this[t+o]=(e/a|0)-r&255;return t+i},p.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*i-1);j(this,e,t,i,n-1,-n)}let o=i-1,a=1,r=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===r&&0!==this[t+o+1]&&(r=1),this[t+o]=(e/a|0)-r&255;return t+i},p.prototype.writeInt8=function(e,t,i){return e=+e,t>>>=0,i||j(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},p.prototype.writeInt16LE=function(e,t,i){return e=+e,t>>>=0,i||j(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},p.prototype.writeInt16BE=function(e,t,i){return e=+e,t>>>=0,i||j(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},p.prototype.writeInt32LE=function(e,t,i){return e=+e,t>>>=0,i||j(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},p.prototype.writeInt32BE=function(e,t,i){return e=+e,t>>>=0,i||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},p.prototype.writeBigInt64LE=Q((function(e,t=0){return $(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),p.prototype.writeBigInt64BE=Q((function(e,t=0){return F(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),p.prototype.writeFloatLE=function(e,t,i){return U(this,e,t,!0,i)},p.prototype.writeFloatBE=function(e,t,i){return U(this,e,t,!1,i)},p.prototype.writeDoubleLE=function(e,t,i){return B(this,e,t,!0,i)},p.prototype.writeDoubleBE=function(e,t,i){return B(this,e,t,!1,i)},p.prototype.copy=function(e,t,i,n){if(!p.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<i&&(n=i),n===i)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-i&&(n=e.length-t+i);const o=n-i;return this===e&&"function"==typeof a.prototype.copyWithin?this.copyWithin(t,i,n):a.prototype.set.call(e,this.subarray(i,n),t),o},p.prototype.fill=function(e,t,i,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,i=this.length):"string"==typeof i&&(n=i,i=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!p.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;let o;if(t>>>=0,i=void 0===i?this.length:i>>>0,e||(e=0),"number"==typeof e)for(o=t;o<i;++o)this[o]=e;else{const a=p.isBuffer(e)?e:p.from(e,n),r=a.length;if(0===r)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<i-t;++o)this[o+t]=a[o%r]}return this};const M={};function D(e,t,i){M[e]=class extends i{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function z(e){let t="",i=e.length;const n="-"===e[0]?1:0;for(;i>=n+4;i-=3)t=`_${e.slice(i-3,i)}${t}`;return`${e.slice(0,i)}${t}`}function q(e,t,i,n,o,a){if(e>i||e<t){const i="bigint"==typeof t?"n":"";let n;throw n=0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(a+1)}${i}`:`>= -(2${i} ** ${8*(a+1)-1}${i}) and < 2 ** ${8*(a+1)-1}${i}`,new M.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,i){K(t,"offset"),void 0!==e[t]&&void 0!==e[t+i]||W(t,e.length-(i+1))}(n,o,a)}function K(e,t){if("number"!=typeof e)throw new M.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,i){if(Math.floor(e)!==e)throw K(e,i),new M.ERR_OUT_OF_RANGE("offset","an integer",e);if(t<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(e,t,i){let n=`The value of "${e}" is out of range.`,o=i;return Number.isInteger(i)&&Math.abs(i)>2**32?o=z(String(i)):"bigint"==typeof i&&(o=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(o=z(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function V(e,t){let i;t=t||1/0;const n=e.length;let o=null;const a=[];for(let r=0;r<n;++r){if(i=e.charCodeAt(r),i>55295&&i<57344){if(!o){if(i>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(r+1===n){(t-=3)>-1&&a.push(239,191,189);continue}o=i;continue}if(i<56320){(t-=3)>-1&&a.push(239,191,189),o=i;continue}i=65536+(o-55296<<10|i-56320)}else o&&(t-=3)>-1&&a.push(239,191,189);if(o=null,i<128){if((t-=1)<0)break;a.push(i)}else if(i<2048){if((t-=2)<0)break;a.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;a.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return a}function G(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Z(e,t,i,n){let o;for(o=0;o<n&&!(o+i>=t.length||o>=e.length);++o)t[o+i]=e[o];return o}function J(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let i=0;i<16;++i){const n=16*i;for(let o=0;o<16;++o)t[n+o]=e[i]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?ee:e}function ee(){throw new Error("BigInt not supported")}}(ci);const xi=ci.Buffer,vi=ci.Buffer,yi=globalThis||self;function wi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ki,Ii,Ti={exports:{}},Si=Ti.exports={};function Ai(){throw new Error("setTimeout has not been defined")}function Ei(){throw new Error("clearTimeout has not been defined")}function _i(e){if(ki===setTimeout)return setTimeout(e,0);if((ki===Ai||!ki)&&setTimeout)return ki=setTimeout,setTimeout(e,0);try{return ki(e,0)}catch(t){try{return ki.call(null,e,0)}catch(i){return ki.call(this,e,0)}}}!function(){try{ki="function"==typeof setTimeout?setTimeout:Ai}catch(e){ki=Ai}try{Ii="function"==typeof clearTimeout?clearTimeout:Ei}catch(e){Ii=Ei}}();var Ci,Ri=[],Ni=!1,Pi=-1;function Oi(){Ni&&Ci&&(Ni=!1,Ci.length?Ri=Ci.concat(Ri):Pi=-1,Ri.length&&ji())}function ji(){if(!Ni){var e=_i(Oi);Ni=!0;for(var t=Ri.length;t;){for(Ci=Ri,Ri=[];++Pi<t;)Ci&&Ci[Pi].run();Pi=-1,t=Ri.length}Ci=null,Ni=!1,function(e){if(Ii===clearTimeout)return clearTimeout(e);if((Ii===Ei||!Ii)&&clearTimeout)return Ii=clearTimeout,clearTimeout(e);try{return Ii(e)}catch(t){try{return Ii.call(null,e)}catch(i){return Ii.call(this,e)}}}(e)}}function $i(e,t){this.fun=e,this.array=t}function Fi(){}Si.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];Ri.push(new $i(e,t)),1!==Ri.length||Ni||_i(ji)},$i.prototype.run=function(){this.fun.apply(null,this.array)},Si.title="browser",Si.browser=!0,Si.env={},Si.argv=[],Si.version="",Si.versions={},Si.on=Fi,Si.addListener=Fi,Si.once=Fi,Si.off=Fi,Si.removeListener=Fi,Si.removeAllListeners=Fi,Si.emit=Fi,Si.prependListener=Fi,Si.prependOnceListener=Fi,Si.listeners=function(e){return[]},Si.binding=function(e){throw new Error("process.binding is not supported")},Si.cwd=function(){return"/"},Si.chdir=function(e){throw new Error("process.chdir is not supported")},Si.umask=function(){return 0};const Li=wi(Ti.exports);function Ui(e,t){return function(){return e.apply(t,arguments)}}const{toString:Bi}=Object.prototype,{getPrototypeOf:Mi}=Object,Di=(e=>t=>{const i=Bi.call(t);return e[i]||(e[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),zi=e=>(e=e.toLowerCase(),t=>Di(t)===e),qi=e=>t=>typeof t===e,{isArray:Ki}=Array,Wi=qi("undefined");const Hi=zi("ArrayBuffer");const Vi=qi("string"),Gi=qi("function"),Zi=qi("number"),Ji=e=>null!==e&&"object"==typeof e,Xi=e=>{if("object"!==Di(e))return!1;const t=Mi(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},Yi=zi("Date"),Qi=zi("File"),en=zi("Blob"),tn=zi("FileList"),nn=zi("URLSearchParams"),[on,an,rn,sn]=["ReadableStream","Request","Response","Headers"].map(zi);function cn(e,t,{allOwnKeys:i=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),Ki(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{const o=i?Object.getOwnPropertyNames(e):Object.keys(e),a=o.length;let r;for(n=0;n<a;n++)r=o[n],t.call(null,e[r],r,e)}}function pn(e,t){t=t.toLowerCase();const i=Object.keys(e);let n,o=i.length;for(;o-- >0;)if(n=i[o],t===n.toLowerCase())return n;return null}const ln="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:yi,un=e=>!Wi(e)&&e!==ln;const dn=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&Mi(Uint8Array)),mn=zi("HTMLFormElement"),fn=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype),hn=zi("RegExp"),gn=(e,t)=>{const i=Object.getOwnPropertyDescriptors(e),n={};cn(i,((i,o)=>{let a;!1!==(a=t(i,o,e))&&(n[o]=a||i)})),Object.defineProperties(e,n)};const bn=zi("AsyncFunction"),xn=((e,t)=>e?setImmediate:t?((e,t)=>(ln.addEventListener("message",(({source:i,data:n})=>{i===ln&&n===e&&t.length&&t.shift()()}),!1),i=>{t.push(i),ln.postMessage(e,"*")}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))("function"==typeof setImmediate,Gi(ln.postMessage)),vn="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ln):void 0!==Li&&Li.nextTick||xn,yn={isArray:Ki,isArrayBuffer:Hi,isBuffer:function(e){return null!==e&&!Wi(e)&&null!==e.constructor&&!Wi(e.constructor)&&Gi(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Gi(e.append)&&("formdata"===(t=Di(e))||"object"===t&&Gi(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Hi(e.buffer),t},isString:Vi,isNumber:Zi,isBoolean:e=>!0===e||!1===e,isObject:Ji,isPlainObject:Xi,isReadableStream:on,isRequest:an,isResponse:rn,isHeaders:sn,isUndefined:Wi,isDate:Yi,isFile:Qi,isBlob:en,isRegExp:hn,isFunction:Gi,isStream:e=>Ji(e)&&Gi(e.pipe),isURLSearchParams:nn,isTypedArray:dn,isFileList:tn,forEach:cn,merge:function e(){const{caseless:t}=un(this)&&this||{},i={},n=(n,o)=>{const a=t&&pn(i,o)||o;Xi(i[a])&&Xi(n)?i[a]=e(i[a],n):Xi(n)?i[a]=e({},n):Ki(n)?i[a]=n.slice():i[a]=n};for(let o=0,a=arguments.length;o<a;o++)arguments[o]&&cn(arguments[o],n);return i},extend:(e,t,i,{allOwnKeys:n}={})=>(cn(t,((t,n)=>{i&&Gi(t)?e[n]=Ui(t,i):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,i,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),i&&Object.assign(e.prototype,i)},toFlatObject:(e,t,i,n)=>{let o,a,r;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),a=o.length;a-- >0;)r=o[a],n&&!n(r,e,t)||s[r]||(t[r]=e[r],s[r]=!0);e=!1!==i&&Mi(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype);return t},kindOf:Di,kindOfTest:zi,endsWith:(e,t,i)=>{e=String(e),(void 0===i||i>e.length)&&(i=e.length),i-=t.length;const n=e.indexOf(t,i);return-1!==n&&n===i},toArray:e=>{if(!e)return null;if(Ki(e))return e;let t=e.length;if(!Zi(t))return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},forEachEntry:(e,t)=>{const i=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=i.next())&&!n.done;){const i=n.value;t.call(e,i[0],i[1])}},matchAll:(e,t)=>{let i;const n=[];for(;null!==(i=e.exec(t));)n.push(i);return n},isHTMLForm:mn,hasOwnProperty:fn,hasOwnProp:fn,reduceDescriptors:gn,freezeMethods:e=>{gn(e,((t,i)=>{if(Gi(e)&&-1!==["arguments","caller","callee"].indexOf(i))return!1;const n=e[i];Gi(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")}))}))},toObjectSet:(e,t)=>{const i={},n=e=>{e.forEach((e=>{i[e]=!0}))};return Ki(e)?n(e):n(String(e).split(t)),i},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,i){return t.toUpperCase()+i})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:pn,global:ln,isContextDefined:un,isSpecCompliantForm:function(e){return!!(e&&Gi(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),i=(e,n)=>{if(Ji(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const o=Ki(e)?[]:{};return cn(e,((e,t)=>{const a=i(e,n+1);!Wi(a)&&(o[t]=a)})),t[n]=void 0,o}}return e};return i(e,0)},isAsyncFn:bn,isThenable:e=>e&&(Ji(e)||Gi(e))&&Gi(e.then)&&Gi(e.catch),setImmediate:xn,asap:vn};function wn(e,t,i,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}yn.inherits(wn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:yn.toJSONObject(this.config),code:this.code,status:this.status}}});const kn=wn.prototype,In={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{In[e]={value:e}})),Object.defineProperties(wn,In),Object.defineProperty(kn,"isAxiosError",{value:!0}),wn.from=(e,t,i,n,o,a)=>{const r=Object.create(kn);return yn.toFlatObject(e,r,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),wn.call(r,e.message,t,i,n,o),r.cause=e,r.name=e.name,a&&Object.assign(r,a),r};function Tn(e){return yn.isPlainObject(e)||yn.isArray(e)}function Sn(e){return yn.endsWith(e,"[]")?e.slice(0,-2):e}function An(e,t,i){return e?e.concat(t).map((function(e,t){return e=Sn(e),!i&&t?"["+e+"]":e})).join(i?".":""):t}const En=yn.toFlatObject(yn,{},null,(function(e){return/^is[A-Z]/.test(e)}));function _n(e,t,i){if(!yn.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(i=yn.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!yn.isUndefined(t[e])}))).metaTokens,o=i.visitor||p,a=i.dots,r=i.indexes,s=(i.Blob||"undefined"!=typeof Blob&&Blob)&&yn.isSpecCompliantForm(t);if(!yn.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(yn.isDate(e))return e.toISOString();if(!s&&yn.isBlob(e))throw new wn("Blob is not supported. Use a Buffer instead.");return yn.isArrayBuffer(e)||yn.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):xi.from(e):e}function p(e,i,o){let s=e;if(e&&!o&&"object"==typeof e)if(yn.endsWith(i,"{}"))i=n?i:i.slice(0,-2),e=JSON.stringify(e);else if(yn.isArray(e)&&function(e){return yn.isArray(e)&&!e.some(Tn)}(e)||(yn.isFileList(e)||yn.endsWith(i,"[]"))&&(s=yn.toArray(e)))return i=Sn(i),s.forEach((function(e,n){!yn.isUndefined(e)&&null!==e&&t.append(!0===r?An([i],n,a):null===r?i:i+"[]",c(e))})),!1;return!!Tn(e)||(t.append(An(o,i,a),c(e)),!1)}const l=[],u=Object.assign(En,{defaultVisitor:p,convertValue:c,isVisitable:Tn});if(!yn.isObject(e))throw new TypeError("data must be an object");return function e(i,n){if(!yn.isUndefined(i)){if(-1!==l.indexOf(i))throw Error("Circular reference detected in "+n.join("."));l.push(i),yn.forEach(i,(function(i,a){!0===(!(yn.isUndefined(i)||null===i)&&o.call(t,i,yn.isString(a)?a.trim():a,n,u))&&e(i,n?n.concat(a):[a])})),l.pop()}}(e),t}function Cn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Rn(e,t){this._pairs=[],e&&_n(e,this,t)}const Nn=Rn.prototype;function Pn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function On(e,t,i){if(!t)return e;const n=i&&i.encode||Pn;yn.isFunction(i)&&(i={serialize:i});const o=i&&i.serialize;let a;if(a=o?o(t,i):yn.isURLSearchParams(t)?t.toString():new Rn(t,i).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}Nn.append=function(e,t){this._pairs.push([e,t])},Nn.toString=function(e){const t=e?function(t){return e.call(this,t,Cn)}:Cn;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class jn{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){yn.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}const $n={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Fn={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Rn,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Ln="undefined"!=typeof window&&"undefined"!=typeof document,Un="object"==typeof navigator&&navigator||void 0,Bn=Ln&&(!Un||["ReactNative","NativeScript","NS"].indexOf(Un.product)<0),Mn="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Dn=Ln&&window.location.href||"http://localhost",zn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ln,hasStandardBrowserEnv:Bn,hasStandardBrowserWebWorkerEnv:Mn,navigator:Un,origin:Dn},Symbol.toStringTag,{value:"Module"})),...Fn};function qn(e){function t(e,i,n,o){let a=e[o++];if("__proto__"===a)return!0;const r=Number.isFinite(+a),s=o>=e.length;if(a=!a&&yn.isArray(n)?n.length:a,s)return yn.hasOwnProp(n,a)?n[a]=[n[a],i]:n[a]=i,!r;n[a]&&yn.isObject(n[a])||(n[a]=[]);return t(e,i,n[a],o)&&yn.isArray(n[a])&&(n[a]=function(e){const t={},i=Object.keys(e);let n;const o=i.length;let a;for(n=0;n<o;n++)a=i[n],t[a]=e[a];return t}(n[a])),!r}if(yn.isFormData(e)&&yn.isFunction(e.entries)){const i={};return yn.forEachEntry(e,((e,n)=>{t(function(e){return yn.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,i,0)})),i}return null}const Kn={transitional:$n,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const i=t.getContentType()||"",n=i.indexOf("application/json")>-1,o=yn.isObject(e);o&&yn.isHTMLForm(e)&&(e=new FormData(e));if(yn.isFormData(e))return n?JSON.stringify(qn(e)):e;if(yn.isArrayBuffer(e)||yn.isBuffer(e)||yn.isStream(e)||yn.isFile(e)||yn.isBlob(e)||yn.isReadableStream(e))return e;if(yn.isArrayBufferView(e))return e.buffer;if(yn.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return _n(e,new zn.classes.URLSearchParams,Object.assign({visitor:function(e,t,i,n){return zn.isNode&&yn.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=yn.isFileList(e))||i.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return _n(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||n?(t.setContentType("application/json",!1),function(e,t){if(yn.isString(e))try{return(t||JSON.parse)(e),yn.trim(e)}catch(i){if("SyntaxError"!==i.name)throw i}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Kn.transitional,i=t&&t.forcedJSONParsing,n="json"===this.responseType;if(yn.isResponse(e)||yn.isReadableStream(e))return e;if(e&&yn.isString(e)&&(i&&!this.responseType||n)){const i=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(o){if(i){if("SyntaxError"===o.name)throw wn.from(o,wn.ERR_BAD_RESPONSE,this,null,this.response);throw o}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:zn.classes.FormData,Blob:zn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};yn.forEach(["delete","get","head","post","put","patch"],(e=>{Kn.headers[e]={}}));const Wn=yn.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Hn=Symbol("internals");function Vn(e){return e&&String(e).trim().toLowerCase()}function Gn(e){return!1===e||null==e?e:yn.isArray(e)?e.map(Gn):String(e)}function Zn(e,t,i,n,o){return yn.isFunction(n)?n.call(this,t,i):(o&&(t=i),yn.isString(t)?yn.isString(n)?-1!==t.indexOf(n):yn.isRegExp(n)?n.test(t):void 0:void 0)}class Jn{constructor(e){e&&this.set(e)}set(e,t,i){const n=this;function o(e,t,i){const o=Vn(t);if(!o)throw new Error("header name must be a non-empty string");const a=yn.findKey(n,o);(!a||void 0===n[a]||!0===i||void 0===i&&!1!==n[a])&&(n[a||t]=Gn(e))}const a=(e,t)=>yn.forEach(e,((e,i)=>o(e,i,t)));if(yn.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(yn.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))a((e=>{const t={};let i,n,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),i=e.substring(0,o).trim().toLowerCase(),n=e.substring(o+1).trim(),!i||t[i]&&Wn[i]||("set-cookie"===i?t[i]?t[i].push(n):t[i]=[n]:t[i]=t[i]?t[i]+", "+n:n)})),t})(e),t);else if(yn.isHeaders(e))for(const[r,s]of e.entries())o(s,r,i);else null!=e&&o(t,e,i);return this}get(e,t){if(e=Vn(e)){const i=yn.findKey(this,e);if(i){const e=this[i];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=i.exec(e);)t[n[1]]=n[2];return t}(e);if(yn.isFunction(t))return t.call(this,e,i);if(yn.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Vn(e)){const i=yn.findKey(this,e);return!(!i||void 0===this[i]||t&&!Zn(0,this[i],i,t))}return!1}delete(e,t){const i=this;let n=!1;function o(e){if(e=Vn(e)){const o=yn.findKey(i,e);!o||t&&!Zn(0,i[o],o,t)||(delete i[o],n=!0)}}return yn.isArray(e)?e.forEach(o):o(e),n}clear(e){const t=Object.keys(this);let i=t.length,n=!1;for(;i--;){const o=t[i];e&&!Zn(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}normalize(e){const t=this,i={};return yn.forEach(this,((n,o)=>{const a=yn.findKey(i,o);if(a)return t[a]=Gn(n),void delete t[o];const r=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,i)=>t.toUpperCase()+i))}(o):String(o).trim();r!==o&&delete t[o],t[r]=Gn(n),i[r]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return yn.forEach(this,((i,n)=>{null!=i&&!1!==i&&(t[n]=e&&yn.isArray(i)?i.join(", "):i)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach((e=>i.set(e))),i}static accessor(e){const t=(this[Hn]=this[Hn]={accessors:{}}).accessors,i=this.prototype;function n(e){const n=Vn(e);t[n]||(!function(e,t){const i=yn.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+i,{value:function(e,i,o){return this[n].call(this,t,e,i,o)},configurable:!0})}))}(i,e),t[n]=!0)}return yn.isArray(e)?e.forEach(n):n(e),this}}function Xn(e,t){const i=this||Kn,n=t||i,o=Jn.from(n.headers);let a=n.data;return yn.forEach(e,(function(e){a=e.call(i,a,o.normalize(),t?t.status:void 0)})),o.normalize(),a}function Yn(e){return!(!e||!e.__CANCEL__)}function Qn(e,t,i){wn.call(this,null==e?"canceled":e,wn.ERR_CANCELED,t,i),this.name="CanceledError"}function eo(e,t,i){const n=i.config.validateStatus;i.status&&n&&!n(i.status)?t(new wn("Request failed with status code "+i.status,[wn.ERR_BAD_REQUEST,wn.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):e(i)}Jn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),yn.reduceDescriptors(Jn.prototype,(({value:e},t)=>{let i=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[i]=e}}})),yn.freezeMethods(Jn),yn.inherits(Qn,wn,{__CANCEL__:!0});const to=(e,t,i=3)=>{let n=0;const o=function(e,t){e=e||10;const i=new Array(e),n=new Array(e);let o,a=0,r=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),p=n[r];o||(o=c),i[a]=s,n[a]=c;let l=r,u=0;for(;l!==a;)u+=i[l++],l%=e;if(a=(a+1)%e,a===r&&(r=(r+1)%e),c-o<t)return;const d=p&&c-p;return d?Math.round(1e3*u/d):void 0}}(50,250);return function(e,t){let i,n,o=0,a=1e3/t;const r=(t,a=Date.now())=>{o=a,i=null,n&&(clearTimeout(n),n=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),s=t-o;s>=a?r(e,t):(i=e,n||(n=setTimeout((()=>{n=null,r(i)}),a-s)))},()=>i&&r(i)]}((i=>{const a=i.loaded,r=i.lengthComputable?i.total:void 0,s=a-n,c=o(s);n=a;e({loaded:a,total:r,progress:r?a/r:void 0,bytes:s,rate:c||void 0,estimated:c&&r&&a<=r?(r-a)/c:void 0,event:i,lengthComputable:null!=r,[t?"download":"upload"]:!0})}),i)},io=(e,t)=>{const i=null!=e;return[n=>t[0]({lengthComputable:i,total:e,loaded:n}),t[1]]},no=e=>(...t)=>yn.asap((()=>e(...t))),oo=zn.hasStandardBrowserEnv?((e,t)=>i=>(i=new URL(i,zn.origin),e.protocol===i.protocol&&e.host===i.host&&(t||e.port===i.port)))(new URL(zn.origin),zn.navigator&&/(msie|trident)/i.test(zn.navigator.userAgent)):()=>!0,ao=zn.hasStandardBrowserEnv?{write(e,t,i,n,o,a){const r=[e+"="+encodeURIComponent(t)];yn.isNumber(i)&&r.push("expires="+new Date(i).toGMTString()),yn.isString(n)&&r.push("path="+n),yn.isString(o)&&r.push("domain="+o),!0===a&&r.push("secure"),document.cookie=r.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function ro(e,t,i){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==i)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const so=e=>e instanceof Jn?{...e}:e;function co(e,t){t=t||{};const i={};function n(e,t,i,n){return yn.isPlainObject(e)&&yn.isPlainObject(t)?yn.merge.call({caseless:n},e,t):yn.isPlainObject(t)?yn.merge({},t):yn.isArray(t)?t.slice():t}function o(e,t,i,o){return yn.isUndefined(t)?yn.isUndefined(e)?void 0:n(void 0,e,0,o):n(e,t,0,o)}function a(e,t){if(!yn.isUndefined(t))return n(void 0,t)}function r(e,t){return yn.isUndefined(t)?yn.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(i,o,a){return a in t?n(i,o):a in e?n(void 0,i):void 0}const c={url:a,method:a,data:a,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,withXSRFToken:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:s,headers:(e,t,i)=>o(so(e),so(t),0,!0)};return yn.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||o,r=a(e[n],t[n],n);yn.isUndefined(r)&&a!==s||(i[n]=r)})),i}const po=e=>{const t=co({},e);let i,{data:n,withXSRFToken:o,xsrfHeaderName:a,xsrfCookieName:r,headers:s,auth:c}=t;if(t.headers=s=Jn.from(s),t.url=On(ro(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),yn.isFormData(n))if(zn.hasStandardBrowserEnv||zn.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(!1!==(i=s.getContentType())){const[e,...t]=i?i.split(";").map((e=>e.trim())).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...t].join("; "))}if(zn.hasStandardBrowserEnv&&(o&&yn.isFunction(o)&&(o=o(t)),o||!1!==o&&oo(t.url))){const e=a&&r&&ao.read(r);e&&s.set(a,e)}return t},lo="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,i){const n=po(e);let o=n.data;const a=Jn.from(n.headers).normalize();let r,s,c,p,l,{responseType:u,onUploadProgress:d,onDownloadProgress:m}=n;function f(){p&&p(),l&&l(),n.cancelToken&&n.cancelToken.unsubscribe(r),n.signal&&n.signal.removeEventListener("abort",r)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=Jn.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());eo((function(e){t(e),f()}),(function(e){i(e),f()}),{data:u&&"text"!==u&&"json"!==u?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:n,config:e,request:h}),h=null}h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout,"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(g)},h.onabort=function(){h&&(i(new wn("Request aborted",wn.ECONNABORTED,e,h)),h=null)},h.onerror=function(){i(new wn("Network Error",wn.ERR_NETWORK,e,h)),h=null},h.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const o=n.transitional||$n;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),i(new wn(t,o.clarifyTimeoutError?wn.ETIMEDOUT:wn.ECONNABORTED,e,h)),h=null},void 0===o&&a.setContentType(null),"setRequestHeader"in h&&yn.forEach(a.toJSON(),(function(e,t){h.setRequestHeader(t,e)})),yn.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),m&&([c,l]=to(m,!0),h.addEventListener("progress",c)),d&&h.upload&&([s,p]=to(d),h.upload.addEventListener("progress",s),h.upload.addEventListener("loadend",p)),(n.cancelToken||n.signal)&&(r=t=>{h&&(i(!t||t.type?new Qn(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(r),n.signal&&(n.signal.aborted?r():n.signal.addEventListener("abort",r)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);b&&-1===zn.protocols.indexOf(b)?i(new wn("Unsupported protocol "+b+":",wn.ERR_BAD_REQUEST,e)):h.send(o||null)}))},uo=(e,t)=>{const{length:i}=e=e?e.filter(Boolean):[];if(t||i){let i,n=new AbortController;const o=function(e){if(!i){i=!0,r();const t=e instanceof Error?e:this.reason;n.abort(t instanceof wn?t:new Qn(t instanceof Error?t.message:t))}};let a=t&&setTimeout((()=>{a=null,o(new wn(`timeout ${t} of ms exceeded`,wn.ETIMEDOUT))}),t);const r=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)})),e=null)};e.forEach((e=>e.addEventListener("abort",o)));const{signal:s}=n;return s.unsubscribe=()=>yn.asap(r),s}},mo=function*(e,t){let i=e.byteLength;if(i<t)return void(yield e);let n,o=0;for(;o<i;)n=o+t,yield e.slice(o,n),o=n},fo=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:i}=await t.read();if(e)break;yield i}}finally{await t.cancel()}},ho=(e,t,i,n)=>{const o=async function*(e,t){for await(const i of fo(e))yield*mo(i,t)}(e,t);let a,r=0,s=e=>{a||(a=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await o.next();if(t)return s(),void e.close();let a=n.byteLength;if(i){let e=r+=a;i(e)}e.enqueue(new Uint8Array(n))}catch(t){throw s(t),t}},cancel:e=>(s(e),o.return())},{highWaterMark:2})},go="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,bo=go&&"function"==typeof ReadableStream,xo=go&&("function"==typeof TextEncoder?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),vo=(e,...t)=>{try{return!!e(...t)}catch(i){return!1}},yo=bo&&vo((()=>{let e=!1;const t=new Request(zn.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),wo=bo&&vo((()=>yn.isReadableStream(new Response("").body))),ko={stream:wo&&(e=>e.body)};go&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!ko[t]&&(ko[t]=yn.isFunction(e[t])?e=>e[t]():(e,i)=>{throw new wn(`Response type '${t}' is not supported`,wn.ERR_NOT_SUPPORT,i)})}))})(new Response);const Io=async(e,t)=>{const i=yn.toFiniteNumber(e.getContentLength());return null==i?(async e=>{if(null==e)return 0;if(yn.isBlob(e))return e.size;if(yn.isSpecCompliantForm(e)){const t=new Request(zn.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return yn.isArrayBufferView(e)||yn.isArrayBuffer(e)?e.byteLength:(yn.isURLSearchParams(e)&&(e+=""),yn.isString(e)?(await xo(e)).byteLength:void 0)})(t):i},To={http:null,xhr:lo,fetch:go&&(async e=>{let{url:t,method:i,data:n,signal:o,cancelToken:a,timeout:r,onDownloadProgress:s,onUploadProgress:c,responseType:p,headers:l,withCredentials:u="same-origin",fetchOptions:d}=po(e);p=p?(p+"").toLowerCase():"text";let m,f=uo([o,a&&a.toAbortSignal()],r);const h=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let g;try{if(c&&yo&&"get"!==i&&"head"!==i&&0!==(g=await Io(l,n))){let e,i=new Request(t,{method:"POST",body:n,duplex:"half"});if(yn.isFormData(n)&&(e=i.headers.get("content-type"))&&l.setContentType(e),i.body){const[e,t]=io(g,to(no(c)));n=ho(i.body,65536,e,t)}}yn.isString(u)||(u=u?"include":"omit");const o="credentials"in Request.prototype;m=new Request(t,{...d,signal:f,method:i.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:o?u:void 0});let a=await fetch(m);const r=wo&&("stream"===p||"response"===p);if(wo&&(s||r&&h)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=a[t]}));const t=yn.toFiniteNumber(a.headers.get("content-length")),[i,n]=s&&io(t,to(no(s),!0))||[];a=new Response(ho(a.body,65536,i,(()=>{n&&n(),h&&h()})),e)}p=p||"text";let b=await ko[yn.findKey(ko,p)||"text"](a,e);return!r&&h&&h(),await new Promise(((t,i)=>{eo(t,i,{data:b,headers:Jn.from(a.headers),status:a.status,statusText:a.statusText,config:e,request:m})}))}catch(b){if(h&&h(),b&&"TypeError"===b.name&&/fetch/i.test(b.message))throw Object.assign(new wn("Network Error",wn.ERR_NETWORK,e,m),{cause:b.cause||b});throw wn.from(b,b&&b.code,e,m)}})};yn.forEach(To,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(i){}Object.defineProperty(e,"adapterName",{value:t})}}));const So=e=>`- ${e}`,Ao=e=>yn.isFunction(e)||null===e||!1===e,Eo=e=>{e=yn.isArray(e)?e:[e];const{length:t}=e;let i,n;const o={};for(let a=0;a<t;a++){let t;if(i=e[a],n=i,!Ao(i)&&(n=To[(t=String(i)).toLowerCase()],void 0===n))throw new wn(`Unknown adapter '${t}'`);if(n)break;o[t||"#"+a]=n}if(!n){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new wn("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(So).join("\n"):" "+So(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function _o(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Qn(null,e)}function Co(e){_o(e),e.headers=Jn.from(e.headers),e.data=Xn.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Eo(e.adapter||Kn.adapter)(e).then((function(t){return _o(e),t.data=Xn.call(e,e.transformResponse,t),t.headers=Jn.from(t.headers),t}),(function(t){return Yn(t)||(_o(e),t&&t.response&&(t.response.data=Xn.call(e,e.transformResponse,t.response),t.response.headers=Jn.from(t.response.headers))),Promise.reject(t)}))}const Ro="1.8.4",No={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{No[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));const Po={};No.transitional=function(e,t,i){function n(e,t){return"[Axios v1.8.4] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,o,a)=>{if(!1===e)throw new wn(n(o," has been removed"+(t?" in "+t:"")),wn.ERR_DEPRECATED);return t&&!Po[o]&&(Po[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,o,a)}},No.spelling=function(e){return(t,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};const Oo={assertOptions:function(e,t,i){if("object"!=typeof e)throw new wn("options must be an object",wn.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const a=n[o],r=t[a];if(r){const t=e[a],i=void 0===t||r(t,a,e);if(!0!==i)throw new wn("option "+a+" must be "+i,wn.ERR_BAD_OPTION_VALUE)}else if(!0!==i)throw new wn("Unknown option "+a,wn.ERR_BAD_OPTION)}},validators:No},jo=Oo.validators;class $o{constructor(e){this.defaults=e,this.interceptors={request:new jn,response:new jn}}async request(e,t){try{return await this._request(e,t)}catch(i){if(i instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{i.stack?t&&!String(i.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(i.stack+="\n"+t):i.stack=t}catch(n){}}throw i}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=co(this.defaults,t);const{transitional:i,paramsSerializer:n,headers:o}=t;void 0!==i&&Oo.assertOptions(i,{silentJSONParsing:jo.transitional(jo.boolean),forcedJSONParsing:jo.transitional(jo.boolean),clarifyTimeoutError:jo.transitional(jo.boolean)},!1),null!=n&&(yn.isFunction(n)?t.paramsSerializer={serialize:n}:Oo.assertOptions(n,{encode:jo.function,serialize:jo.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Oo.assertOptions(t,{baseUrl:jo.spelling("baseURL"),withXsrfToken:jo.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=o&&yn.merge(o.common,o[t.method]);o&&yn.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=Jn.concat(a,o);const r=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));const c=[];let p;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,u=0;if(!s){const e=[Co.bind(this),void 0];for(e.unshift.apply(e,r),e.push.apply(e,c),l=e.length,p=Promise.resolve(t);u<l;)p=p.then(e[u++],e[u++]);return p}l=r.length;let d=t;for(u=0;u<l;){const e=r[u++],t=r[u++];try{d=e(d)}catch(m){t.call(this,m);break}}try{p=Co.call(this,d)}catch(m){return Promise.reject(m)}for(u=0,l=c.length;u<l;)p=p.then(c[u++],c[u++]);return p}getUri(e){return On(ro((e=co(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}yn.forEach(["delete","get","head","options"],(function(e){$o.prototype[e]=function(t,i){return this.request(co(i||{},{method:e,url:t,data:(i||{}).data}))}})),yn.forEach(["post","put","patch"],(function(e){function t(t){return function(i,n,o){return this.request(co(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:n}))}}$o.prototype[e]=t(),$o.prototype[e+"Form"]=t(!0)}));class Fo{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const i=this;this.promise.then((e=>{if(!i._listeners)return;let t=i._listeners.length;for(;t-- >0;)i._listeners[t](e);i._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{i.subscribe(e),t=e})).then(e);return n.cancel=function(){i.unsubscribe(t)},n},e((function(e,n,o){i.reason||(i.reason=new Qn(e,n,o),t(i.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Fo((function(t){e=t})),cancel:e}}}const Lo={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Lo).forEach((([e,t])=>{Lo[t]=e}));const Uo=function e(t){const i=new $o(t),n=Ui($o.prototype.request,i);return yn.extend(n,$o.prototype,i,{allOwnKeys:!0}),yn.extend(n,i,null,{allOwnKeys:!0}),n.create=function(i){return e(co(t,i))},n}(Kn);Uo.Axios=$o,Uo.CanceledError=Qn,Uo.CancelToken=Fo,Uo.isCancel=Yn,Uo.VERSION=Ro,Uo.toFormData=_n,Uo.AxiosError=wn,Uo.Cancel=Uo.CanceledError,Uo.all=function(e){return Promise.all(e)},Uo.spread=function(e){return function(t){return e.apply(null,t)}},Uo.isAxiosError=function(e){return yn.isObject(e)&&!0===e.isAxiosError},Uo.mergeConfig=co,Uo.AxiosHeaders=Jn,Uo.formToJSON=e=>qn(yn.isHTMLForm(e)?new FormData(e):e),Uo.getAdapter=Eo,Uo.HttpStatusCode=Lo,Uo.default=Uo;const Bo=class e{constructor(){si(this,"isProduction"),this.isProduction="production"===Li.env.NODE_ENV}static getInstance(){return e.instance||(e.instance=new e),e.instance}debug(e,...t){this.isProduction||console.debug(e,...t)}info(e,...t){this.isProduction||console.info(e,...t)}warn(e,...t){console.warn(e,...t)}error(e,...t){console.error(e,...t)}};si(Bo,"instance");let Mo=Bo;class Do extends Error{constructor(e){super(e),this.name="ValidationError"}}class zo{constructor(e){si(this,"accountId"),si(this,"privateKey"),si(this,"baseUrl"),si(this,"network"),this.accountId=e.accountId,this.privateKey=i.PrivateKey.fromStringED25519(e.privateKey),this.network=e.network||"mainnet",this.baseUrl=e.baseUrl||"https://kiloscribe.com"}async authenticate(){var e,t,i;const n=await Uo.get(`${this.baseUrl}/api/auth/request-signature`,{headers:{"x-session":this.accountId}});if(!(null==(e=n.data)?void 0:e.message))throw new Error("Failed to get signature message");const o=n.data.message,a=await this.signMessage(o),r=await Uo.post(`${this.baseUrl}/api/auth/authenticate`,{authData:{id:this.accountId,signature:a,data:o,network:this.network},include:"apiKey"});if(!(null==(i=null==(t=r.data)?void 0:t.user)?void 0:i.sessionToken))throw new Error("Authentication failed");return{apiKey:r.data.apiKey}}async signMessage(e){const t=(new TextEncoder).encode(e),i=await this.privateKey.sign(t);return vi.from(i).toString("hex")}}let qo=class{constructor(e){si(this,"accountId"),si(this,"signer"),si(this,"baseUrl"),si(this,"network"),si(this,"logger"),this.accountId=e.accountId,this.signer=e.signer,this.network=e.network||"mainnet",this.baseUrl=e.baseUrl||"https://kiloscribe.com",this.logger=e.logger}async authenticate(){var e,t,i;const n=await Uo.get(`${this.baseUrl}/api/auth/request-signature`,{headers:{"x-session":this.accountId}});if(!(null==(e=n.data)?void 0:e.message))throw new Error("Failed to get signature message");const o=n.data.message,a=await this.signMessage(JSON.stringify(o)),r=await Uo.post(`${this.baseUrl}/api/auth/authenticate`,{authData:{id:this.accountId,signature:a,data:o,network:this.network},include:"apiKey"});if(!(null==(i=null==(t=r.data)?void 0:t.user)?void 0:i.sessionToken))throw new Error("Authentication failed");return{apiKey:r.data.apiKey}}async signMessage(e){try{const t=(new TextEncoder).encode(e);this.logger.debug("signing message");const i=await this.signer.sign([t],{encoding:"utf-8"});return vi.from(null==i?void 0:i[0].signature).toString("hex")}catch(t){throw this.logger.error("Failed to sign message",t),new Error("Failed to sign message")}}};function Ko(e){return new DataView(e.buffer,e.byteOffset)}const Wo={len:1,get:(e,t)=>Ko(e).getUint8(t),put:(e,t,i)=>(Ko(e).setUint8(t,i),t+1)},Ho={len:2,get:(e,t)=>Ko(e).getUint16(t,!0),put:(e,t,i)=>(Ko(e).setUint16(t,i,!0),t+2)},Vo={len:2,get:(e,t)=>Ko(e).getUint16(t),put:(e,t,i)=>(Ko(e).setUint16(t,i),t+2)},Go={len:4,get:(e,t)=>Ko(e).getUint32(t,!0),put:(e,t,i)=>(Ko(e).setUint32(t,i,!0),t+4)},Zo={len:4,get:(e,t)=>Ko(e).getUint32(t),put:(e,t,i)=>(Ko(e).setUint32(t,i),t+4)},Jo={len:4,get:(e,t)=>Ko(e).getInt32(t),put:(e,t,i)=>(Ko(e).setInt32(t,i),t+4)},Xo={len:8,get:(e,t)=>Ko(e).getBigUint64(t,!0),put:(e,t,i)=>(Ko(e).setBigUint64(t,i,!0),t+8)};let Yo=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t){return vi.from(e).toString(this.encoding,t,t+this.len)}};let Qo=class extends Error{constructor(){super("End-Of-Stream")}},ea=class{constructor(){this.resolve=()=>null,this.reject=()=>null,this.promise=new Promise(((e,t)=>{this.reject=t,this.resolve=e}))}},ta=class{constructor(){this.maxStreamReadSize=1048576,this.endOfStream=!1,this.peekQueue=[]}async peek(e,t,i){const n=await this.read(e,t,i);return this.peekQueue.push(e.subarray(t,t+n)),n}async read(e,t,i){if(0===i)return 0;let n=this.readFromPeekBuffer(e,t,i);if(n+=await this.readRemainderFromStream(e,t+n,i-n),0===n)throw new Qo;return n}readFromPeekBuffer(e,t,i){let n=i,o=0;for(;this.peekQueue.length>0&&n>0;){const i=this.peekQueue.pop();if(!i)throw new Error("peekData should be defined");const a=Math.min(i.length,n);e.set(i.subarray(0,a),t+o),o+=a,n-=a,a<i.length&&this.peekQueue.push(i.subarray(a))}return o}async readRemainderFromStream(e,t,i){let n=i,o=0;for(;n>0&&!this.endOfStream;){const i=Math.min(n,this.maxStreamReadSize),a=await this.readFromStream(e,t+o,i);if(0===a)break;o+=a,n-=a}return o}},ia=class extends ta{constructor(e){if(super(),this.s=e,this.deferred=null,!e.read||!e.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",(()=>this.reject(new Qo))),this.s.once("error",(e=>this.reject(e))),this.s.once("close",(()=>this.reject(new Error("Stream closed"))))}async readFromStream(e,t,i){if(this.endOfStream)return 0;const n=this.s.read(i);if(n)return e.set(n,t),n.length;const o={buffer:e,offset:t,length:i,deferred:new ea};return this.deferred=o.deferred,this.s.once("readable",(()=>{this.readDeferred(o)})),o.deferred.promise}readDeferred(e){const t=this.s.read(e.length);t?(e.buffer.set(t,e.offset),e.deferred.resolve(t.length),this.deferred=null):this.s.once("readable",(()=>{this.readDeferred(e)}))}reject(e){this.endOfStream=!0,this.deferred&&(this.deferred.reject(e),this.deferred=null)}async abort(){this.reject(new Error("abort"))}async close(){return this.abort()}},na=class{constructor(e){this.position=0,this.numBuffer=new Uint8Array(8),this.fileInfo=e||{}}async readToken(e,t=this.position){const i=new Uint8Array(e.len);if(await this.readBuffer(i,{position:t})<e.len)throw new Qo;return e.get(i,0)}async peekToken(e,t=this.position){const i=new Uint8Array(e.len);if(await this.peekBuffer(i,{position:t})<e.len)throw new Qo;return e.get(i,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new Qo;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new Qo;return e.get(this.numBuffer,0)}async ignore(e){if(void 0!==this.fileInfo.size){const t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){}normalizeOptions(e,t){if(t&&void 0!==t.position&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return t?{mayBeLess:!0===t.mayBeLess,offset:t.offset?t.offset:0,length:t.length?t.length:e.length-(t.offset?t.offset:0),position:t.position?t.position:this.position}:{mayBeLess:!1,offset:0,length:e.length,position:this.position}}};let oa=class extends na{constructor(e,t){super(t),this.streamReader=e}async getFileInfo(){return this.fileInfo}async readBuffer(e,t){const i=this.normalizeOptions(e,t),n=i.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(0===i.length)return 0;const o=await this.streamReader.read(e,i.offset,i.length);if(this.position+=o,(!t||!t.mayBeLess)&&o<i.length)throw new Qo;return o}async peekBuffer(e,t){const i=this.normalizeOptions(e,t);let n=0;if(i.position){const t=i.position-this.position;if(t>0){const o=new Uint8Array(i.length+t);return n=await this.peekBuffer(o,{mayBeLess:i.mayBeLess}),e.set(o.subarray(t),i.offset),n-t}if(t<0)throw new Error("Cannot peek from a negative offset in a stream")}if(i.length>0){try{n=await this.streamReader.peek(e,i.offset,i.length)}catch(o){if(t&&t.mayBeLess&&o instanceof Qo)return 0;throw o}if(!i.mayBeLess&&n<i.length)throw new Qo}return n}async ignore(e){const t=Math.min(256e3,e),i=new Uint8Array(t);let n=0;for(;n<e;){const o=e-n,a=await this.readBuffer(i,{length:Math.min(t,o)});if(a<0)return a;n+=a}return n}},aa=class extends na{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo.size=this.fileInfo.size?this.fileInfo.size:e.length}async readBuffer(e,t){if(t&&t.position){if(t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");this.position=t.position}const i=await this.peekBuffer(e,t);return this.position+=i,i}async peekBuffer(e,t){const i=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-i.position,i.length);if(!i.mayBeLess&&n<i.length)throw new Qo;return e.set(this.uint8Array.subarray(i.position,i.position+n),i.offset),n}async close(){}};const ra={get:(e,t)=>127&e[t+3]|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},sa=4100;function ca(e,t,i){i={offset:0,...i};for(const[n,o]of t.entries())if(i.mask){if(o!==(i.mask[n]&e[n+i.offset]))return!1}else if(o!==e[n+i.offset])return!1;return!0}let pa=class{constructor(e){this.detectors=null==e?void 0:e.customDetectors,this.fromTokenizer=this.fromTokenizer.bind(this),this.fromBuffer=this.fromBuffer.bind(this),this.parse=this.parse.bind(this)}async fromTokenizer(e){const t=e.position;for(const i of this.detectors||[]){const n=await i(e);if(n)return n;if(t!==e.position)return}return this.parse(e)}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof e}\``);const t=e instanceof Uint8Array?e:new Uint8Array(e);var i;if((null==t?void 0:t.length)>1)return this.fromTokenizer(new aa(t,i))}async fromBlob(e){const t=await e.arrayBuffer();return this.fromBuffer(new Uint8Array(t))}async fromStream(e){const t=await function(e,t){return t=t||{},new oa(new ia(e),t)}(e);try{return await this.fromTokenizer(t)}finally{await t.close()}}async toDetectionStream(e,t={}){const{default:i}=await Promise.resolve().then((()=>require("./standards-sdk.es34-ChBjKBbQ-Bp01gBzX.cjs"))).then((e=>e.i)),{sampleSize:n=sa}=t;return new Promise(((t,o)=>{e.on("error",o),e.once("readable",(()=>{(async()=>{try{const r=new i.PassThrough,s=i.pipeline?i.pipeline(e,r,(()=>{})):e.pipe(r),c=e.read(n)??e.read()??vi.alloc(0);try{r.fileType=await this.fromBuffer(c)}catch(a){a instanceof Qo?r.fileType=void 0:o(a)}t(s)}catch(a){o(a)}})()}))}))}check(e,t){return ca(this.buffer,e,t)}checkString(e,t){return this.check((i=e,[...i].map((e=>e.charCodeAt(0)))),t);var i}async parse(e){if(this.buffer=vi.alloc(sa),void 0===e.fileInfo.size&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:12,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.parse(e);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);const i=await e.readToken(ra);return e.position+i>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(i),this.fromTokenizer(e))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((67===this.buffer[0]||70===this.buffer[0])&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){try{for(;e.position+30<e.fileInfo.size;){await e.readBuffer(this.buffer,{length:30});const n={compressedSize:this.buffer.readUInt32LE(18),uncompressedSize:this.buffer.readUInt32LE(22),filenameLength:this.buffer.readUInt16LE(26),extraFieldLength:this.buffer.readUInt16LE(28)};if(n.filename=await e.readToken(new Yo(n.filenameLength,"utf-8")),await e.ignore(n.extraFieldLength),"META-INF/mozilla.rsa"===n.filename)return{ext:"xpi",mime:"application/x-xpinstall"};if(n.filename.endsWith(".rels")||n.filename.endsWith(".xml")){switch(n.filename.split("/")[0]){case"_rels":default:break;case"word":return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};case"ppt":return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};case"xl":return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}}}if(n.filename.startsWith("xl/"))return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(n.filename.startsWith("3D/")&&n.filename.endsWith(".model"))return{ext:"3mf",mime:"model/3mf"};if("mimetype"===n.filename&&n.compressedSize===n.uncompressedSize){let o=await e.readToken(new Yo(n.compressedSize,"utf-8"));switch(o=o.trim(),o){case"application/epub+zip":return{ext:"epub",mime:"application/epub+zip"};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"}}}if(0===n.compressedSize){let a=-1;for(;a<0&&e.position<e.fileInfo.size;)await e.peekBuffer(this.buffer,{mayBeLess:!0}),a=this.buffer.indexOf("504B0304",0,"hex"),await e.ignore(a>=0?a:this.buffer.length)}else await e.ignore(n.compressedSize)}}catch(t){if(!(t instanceof Qo))throw t}return{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);const r=vi.alloc(8);return await e.readBuffer(r),ca(r,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/opus"}:ca(r,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:ca(r,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:ca(r,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:ca(r,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:ca(r,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(3===this.buffer[2]||5===this.buffer[2]||7===this.buffer[2])&&(4===this.buffer[3]||6===this.buffer[3]||8===this.buffer[3]))return{ext:"zip",mime:"application/zip"};if(this.checkString("ftyp",{offset:4})&&96&this.buffer[8]){const s=this.buffer.toString("binary",8,12).replace("\0"," ").trim();switch(s){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return s.startsWith("3g")?s.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/x-flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF")){try{await e.ignore(1350);const c=10485760,p=vi.alloc(Math.min(c,e.fileInfo.size));if(await e.readBuffer(p,{mayBeLess:!0}),p.includes(vi.from("AIPrivateData")))return{ext:"ai",mime:"application/postscript"}}catch(t){if(!(t instanceof Qo))throw t}return{ext:"pdf",mime:"application/pdf"}}if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const l=await this.readTiffHeader(!1);if(l)return l}if(this.check([77,77])){const u=await this.readTiffHeader(!0);if(u)return u}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function d(){const t=await e.peekNumber(Wo);let i=128,n=0;for(;!(t&i)&&0!==i;)++n,i>>=1;const o=vi.alloc(n+1);return await e.readBuffer(o),o}async function m(){const e=await d(),t=await d();t[0]^=128>>t.length-1;const i=Math.min(6,t.length);return{id:e.readUIntBE(0,e.length),len:t.readUIntBE(t.length-i,i)}}async function f(t){for(;t>0;){const i=await m();if(17026===i.id){return(await e.readToken(new Yo(i.len,"utf-8"))).replace(/\00.*$/g,"")}await e.ignore(i.len),--t}}const h=await m();switch(await f(h.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/x-matroska"};default:return}}if(this.check([82,73,70,70])){if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1"))return{ext:"parquet",mime:"application/x-parquet"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(0===this.buffer[6]||1===this.buffer[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const g=this.buffer.toString("binary",2,6);if(g.match("^d*")&&g>=1e3&&g<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>")){await e.ignore(8);return"debian-binary"===await e.readToken(new Yo(13,"ascii"))?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"}}if(this.checkString("**ACE",{offset:7})&&(await e.peekBuffer(this.buffer,{length:14,mayBeLess:!0}),this.checkString("**",{offset:12})))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.check([137,80,78,71,13,10,26,10])){async function b(){return{length:await e.readToken(Jo),type:await e.readToken(new Yo(4,"binary"))}}await e.ignore(8);do{const x=await b();if(x.length<0)return;switch(x.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(x.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/x-apache-arrow"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function v(){const t=vi.alloc(16);return await e.readBuffer(t),{id:t,size:Number(await e.readToken(Xo))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){const y=await v();let w=y.size-24;if(ca(y.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const k=vi.alloc(16);if(w-=await e.readBuffer(k),ca(k,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(ca(k,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await e.ignore(w)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10])){await e.ignore(20);switch(await e.readToken(new Yo(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.check([0,60,0,63,0,120,0,109,0,108],{offset:2})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const I=this.buffer.readUInt32LE(12);if(I>12&&this.buffer.length>=I+16)try{const T=this.buffer.slice(16,I+16).toString();if(JSON.parse(T).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),function(e,t=0){const i=Number.parseInt(e.toString("utf8",148,154).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(i))return!1;let n=256;for(let o=t;o<t+148;o++)n+=e[o];for(let o=t+156;o<t+512;o++)n+=e[o];return i===n}(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254]))return this.check([60,0,63,0,120,0,109,0,108,0],{offset:2})?{ext:"xml",mime:"application/xml"}:this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:void 0;if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"};if(this.buffer.length>=2&&this.check([255,224],{offset:0,mask:[255,224]})){if(this.check([16],{offset:1,mask:[22]}))return this.check([8],{offset:1,mask:[8]}),{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}async readTiffTag(e){const t=await this.tokenizer.readToken(e?Vo:Ho);switch(this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(e){const t=await this.tokenizer.readToken(e?Vo:Ho);for(let i=0;i<t;++i){const t=await this.readTiffTag(e);if(t)return t}}async readTiffHeader(e){const t=(e?Vo:Ho).get(this.buffer,2),i=(e?Zo:Go).get(this.buffer,4);if(42===t){if(i>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(i>=8&&(this.check([28,0,254,0],{offset:8})||this.check([31,0,11,0],{offset:8})))return{ext:"nef",mime:"image/x-nikon-nef"}}await this.tokenizer.ignore(i);return await this.readTiffIFD(e)??{ext:"tif",mime:"image/tiff"}}if(43===t)return{ext:"tif",mime:"image/tiff"}}};new Set(["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx"]),new Set(["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/vnd.wave","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","audio/opus","video/ogg","audio/ogg","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/x-parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx"]);const la=class e{constructor(e){if(si(this,"client"),si(this,"config"),si(this,"logger",Mo.getInstance()),this.config=e,!e.apiKey)throw new Do("API key is required");if(!e.network)throw new Do("Network is required");const t={"x-api-key":e.apiKey,"Content-Type":"application/json"};this.client=Uo.create({baseURL:"https://v2-api.tier.bot/api",headers:t}),this.logger=Mo.getInstance()}async getFileMetadata(e){try{const t=await Uo.get(e),i=t.headers["content-type"]||"";return{size:parseInt(t.headers["content-length"]||"0",10),mimeType:i}}catch(t){throw this.logger.error("Error fetching file metadata:",t),new Do("Unable to fetch file metadata")}}getMimeType(t){const i=t.toLowerCase().split(".").pop();if(!i)throw new Do("File must have an extension");const n=e.VALID_MIME_TYPES[i];if(!n)throw new Do(`Unsupported file type: ${i}`);return n}validateRequest(t){if(this.logger.debug("Validating request:",t),!t.holderId||""===t.holderId.trim())throw this.logger.warn("holderId is missing or empty"),new Do("holderId is required");if(!e.VALID_MODES.includes(t.mode))throw new Do(`Invalid mode: ${t.mode}. Must be one of: ${e.VALID_MODES.join(", ")}`);if("hashinal"===t.mode&&!t.jsonFileURL&&!t.metadataObject)throw new Do("Hashinal mode requires either jsonFileURL or metadataObject");if(t.onlyJSONCollection&&"hashinal-collection"!==t.mode)throw new Do("onlyJSONCollection can only be used with hashinal-collection mode");this.validateFileInput(t.file)}normalizeMimeType(e){return"image/vnd.microsoft.icon"===e?(this.logger.debug("Normalizing MIME type from image/vnd.microsoft.icon to image/x-icon"),"image/x-icon"):e}validateMimeType(t){return!!Object.values(e.VALID_MIME_TYPES).includes(t)||"image/vnd.microsoft.icon"===t&&(this.logger.debug("Accepting alternative MIME type for ICO: image/vnd.microsoft.icon"),!0)}validateFileInput(t){if("base64"===t.type){if(!t.base64)throw new Do("Base64 data is required");const i=t.base64.replace(/^data:.*?;base64,/,"");if(Math.ceil(.75*i.length)>e.MAX_BASE64_SIZE)throw new Do(`File size exceeds maximum limit of ${e.MAX_BASE64_SIZE/1024/1024}MB`);const n=t.mimeType||this.getMimeType(t.fileName);if(!this.validateMimeType(n))throw new Do("File must have one of the supported MIME types");"image/vnd.microsoft.icon"===t.mimeType&&(t.mimeType=this.normalizeMimeType(t.mimeType))}else if("url"===t.type&&!t.url)throw new Do("URL is required")}async detectMimeTypeFromBase64(e){if(e.startsWith("data:")){const t=e.match(/^data:([^;]+);base64,/);if(t&&t.length>1)return t[1]}try{const t=e.replace(/\s/g,""),i=xi.from(t,"base64"),n=await async function(e){return(new pa).fromBuffer(e)}(i);return(null==n?void 0:n.mime)||"application/octet-stream"}catch(t){return this.logger.warn("Failed to detect MIME type from buffer"),"application/octet-stream"}}async startInscription(t){var i,n;try{this.validateRequest(t);let i=t.file.mimeType;if("url"===t.file.type){const n=await this.getFileMetadata(t.file.url);if(i=n.mimeType||i,n.size>e.MAX_URL_FILE_SIZE)throw new Do(`File size exceeds maximum URL file limit of ${e.MAX_URL_FILE_SIZE/1024/1024}MB`)}else"base64"===t.file.type&&(i=await this.detectMimeTypeFromBase64(t.file.base64));if("image/vnd.microsoft.icon"===i&&(i=this.normalizeMimeType(i)),t.jsonFileURL){if("application/json"!==(await this.getFileMetadata(t.jsonFileURL)).mimeType)throw new Do("JSON file must be of type application/json")}const n={holderId:t.holderId,mode:t.mode,network:this.config.network,onlyJSONCollection:t.onlyJSONCollection?1:0,creator:t.creator,description:t.description,fileStandard:t.fileStandard,metadataObject:t.metadataObject,jsonFileURL:t.jsonFileURL};let o;return o="url"===t.file.type?await this.client.post("/inscriptions/start-inscription",{...n,fileURL:t.file.url}):await this.client.post("/inscriptions/start-inscription",{...n,fileBase64:t.file.base64,fileName:t.file.fileName,fileMimeType:i||this.getMimeType(t.file.fileName)}),o.data}catch(o){if(o instanceof Do)throw o;if(Uo.isAxiosError(o))throw new Error((null==(n=null==(i=o.response)?void 0:i.data)?void 0:n.message)||"Failed to start inscription");throw o}}async executeTransaction(e,t){try{const n="mainnet"===t.network?i.Client.forMainnet():i.Client.forTestnet(),o=i.PrivateKey.fromString(t.privateKey);n.setOperator(t.accountId,o);const a=i.TransferTransaction.fromBytes(xi.from(e,"base64")),r=await a.sign(o),s=await r.execute(n),c=(await s.getReceipt(n)).status.toString();if("SUCCESS"!==c)throw new Error(`Transaction failed with status: ${c}`);return s.transactionId.toString()}catch(n){throw new Error(`Failed to execute transaction: ${n instanceof Error?n.message:"Unknown error"}`)}}async executeTransactionWithSigner(e,t){try{const n=i.TransferTransaction.fromBytes(xi.from(e,"base64")),o=await n.executeWithSigner(t),a=(await o.getReceiptWithSigner(t)).status.toString();if("SUCCESS"!==a)throw new Error(`Transaction failed with status: ${a}`);return o.transactionId.toString()}catch(n){throw new Error(`Failed to execute transaction: ${n instanceof Error?n.message:"Unknown error"}`)}}async inscribeAndExecute(e,t){const i=await this.startInscription(e);if(!i.transactionBytes)throw this.logger.error("No transaction bytes returned from inscription request",i),new Error("No transaction bytes returned from inscription request");this.logger.info("executing transaction");const n=await this.executeTransaction(i.transactionBytes,t);return{jobId:i.tx_id,transactionId:n}}async inscribe(e,t){const i=await this.startInscription(e);if(!i.transactionBytes)throw this.logger.error("No transaction bytes returned from inscription request",i),new Error("No transaction bytes returned from inscription request");this.logger.info("executing transaction");const n=await this.executeTransactionWithSigner(i.transactionBytes,t);return{jobId:i.tx_id,transactionId:n}}async retryWithBackoff(e,t=3,i=1e3){for(let o=0;o<t;o++)try{return await e()}catch(n){if(o===t-1)throw n;const e=i*Math.pow(2,o);await new Promise((t=>setTimeout(t,e))),this.logger.debug(`Retry attempt ${o+1}/${t} after ${e}ms delay`)}throw new Error("Retry operation failed")}async retrieveInscription(e){if(!e)throw new Do("Transaction ID is required");try{return await this.retryWithBackoff((async()=>{const t=(await this.client.get(`/inscriptions/retrieve-inscription?id=${e}`)).data;return{...t,jobId:t.id}}))}catch(t){throw this.logger.error("Failed to retrieve inscription:",t),t}}async getInscriptionNumbers(e={}){try{return(await this.client.get("/inscriptions/numbers",{params:e})).data}catch(t){throw this.logger.error("Failed to fetch inscription numbers:",t),t}}static async authenticate(e){return new zo(e).authenticate()}static async createWithAuth(t){const i="client"===t.type?new qo({...t,logger:Mo.getInstance()}):new zo(t),{apiKey:n}=await i.authenticate();return new e({apiKey:n,network:t.network||"mainnet"})}async waitForInscription(e,t=30,i=4e3,n=!1,o){var a;let r=0,s=0;const c=(i,n,a,c)=>{if(o)try{s=Math.max(s,a),o({stage:i,message:n,progressPercent:s,details:{...c,txId:e,currentAttempt:r,maxAttempts:t}})}catch(p){this.logger.warn(`Error in progress callback: ${p}`)}};for(c("confirming","Starting inscription verification",0);r<t;){c("confirming",`Verifying inscription status (attempt ${r+1}/${t})`,5,{attempt:r+1});const o=await this.retrieveInscription(e);if(o.error)throw c("verifying",`Error: ${o.error}`,100,{error:o.error}),new Error(o.error);let s=5;void 0!==o.messages&&void 0!==o.maxMessages&&o.maxMessages>0?(s=Math.min(95,5+o.messages/o.maxMessages*90),o.completed&&(s=100)):"processing"===o.status?s=10:o.completed&&(s=100),c(o.completed?"completed":"confirming",o.completed?"Inscription completed successfully":`Processing inscription (${o.status})`,s,{status:o.status,messagesProcessed:o.messages,maxMessages:o.maxMessages,messageCount:o.messages,completed:o.completed,confirmedMessages:o.confirmedMessages,result:o});const p="hashinal"===o.mode,l="6"===(null==(a=o.fileStandard)?void 0:a.toString());if(p&&o.topic_id&&o.jsonTopicId&&(!n||o.completed))return c("completed","Inscription verification complete",100,{result:o}),o;if(!p&&!l&&o.topic_id&&(!n||o.completed))return c("completed","Inscription verification complete",100,{result:o}),o;if(l&&o.topic_id&&o.jsonTopicId&&o.registryTopicId&&(!n||o.completed))return c("completed","Inscription verification complete",100,{result:o}),o;await new Promise((e=>setTimeout(e,i))),r++}throw c("verifying",`Inscription ${e} did not complete within ${t} attempts`,100,{timedOut:!0}),new Error(`Inscription ${e} did not complete within ${t} attempts`)}async getHolderInscriptions(e){var t,i;if(!e.holderId)throw new Do("Holder ID is required");try{const t={holderId:e.holderId};e.includeCollections&&(t.includeCollections="1");return(await this.client.get("/inscriptions/holder-inscriptions",{params:t})).data}catch(n){if(this.logger.error("Failed to fetch holder inscriptions:",n),Uo.isAxiosError(n))throw new Error((null==(i=null==(t=n.response)?void 0:t.data)?void 0:i.message)||"Failed to fetch holder inscriptions");throw n}}};si(la,"VALID_MODES",["file","upload","hashinal","hashinal-collection"]),si(la,"MAX_BASE64_SIZE",2097152),si(la,"MAX_URL_FILE_SIZE",104857600),si(la,"VALID_MIME_TYPES",{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",ico:"image/x-icon",heic:"image/heic",heif:"image/heif",bmp:"image/bmp",webp:"image/webp",tiff:"image/tiff",tif:"image/tiff",svg:"image/svg+xml",mp4:"video/mp4",webm:"video/webm",mp3:"audio/mpeg",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",html:"text/html",htm:"text/html",css:"text/css",php:"application/x-httpd-php",java:"text/x-java-source",js:"application/javascript",mjs:"application/javascript",csv:"text/csv",json:"application/json",txt:"text/plain",glb:"model/gltf-binary",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",flac:"audio/flac",aac:"audio/aac",m4a:"audio/mp4",avi:"video/x-msvideo",mov:"video/quicktime",mkv:"video/x-matroska",m4v:"video/mp4",mpg:"video/mpeg",mpeg:"video/mpeg",ts:"application/typescript",zip:"application/zip",rar:"application/vnd.rar",tar:"application/x-tar",gz:"application/gzip","7z":"application/x-7z-compressed",xml:"application/xml",yaml:"application/yaml",yml:"application/yaml",md:"text/markdown",markdown:"text/markdown",rtf:"application/rtf",gltf:"model/gltf+json",usdz:"model/vnd.usdz+zip",obj:"model/obj",stl:"model/stl",fbx:"application/octet-stream",ttf:"font/ttf",otf:"font/otf",woff:"font/woff",woff2:"font/woff2",eot:"application/vnd.ms-fontobject",psd:"application/vnd.adobe.photoshop",ai:"application/postscript",eps:"application/postscript",ps:"application/postscript",sqlite:"application/x-sqlite3",db:"application/x-sqlite3",apk:"application/vnd.android.package-archive",ics:"text/calendar",vcf:"text/vcard",py:"text/x-python",rb:"text/x-ruby",go:"text/x-go",rs:"text/x-rust",typescript:"application/typescript",jsx:"text/jsx",tsx:"text/tsx",sql:"application/sql",toml:"application/toml",avif:"image/avif",jxl:"image/jxl",weba:"audio/webm"});var ua={};const da={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}};
19
+ !function(e){const t=pi,i=bi,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=p,e.SlowBuffer=function(e){+e!=e&&(e=0);return p.alloc(+e)},e.INSPECT_MAX_BYTES=50;const o=2147483647;e.kMaxLength=o;const{Uint8Array:a,ArrayBuffer:r,SharedArrayBuffer:s}=globalThis;function c(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new a(e);return Object.setPrototypeOf(t,p.prototype),t}function p(e,t,i){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,i)}function l(e,t,i){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!p.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const i=0|g(e,t);let n=c(i);const o=n.write(e,t);o!==i&&(n=n.slice(0,o));return n}(e,t);if(r.isView(e))return function(e){if(J(e,a)){const t=new a(e);return f(t.buffer,t.byteOffset,t.byteLength)}return m(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(J(e,r)||e&&J(e.buffer,r))return f(e,t,i);if(void 0!==s&&(J(e,s)||e&&J(e.buffer,s)))return f(e,t,i);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return p.from(n,t,i);const o=function(e){if(p.isBuffer(e)){const t=0|h(e.length),i=c(t);return 0===i.length||e.copy(i,0,0,t),i}if(void 0!==e.length)return"number"!=typeof e.length||X(e.length)?c(0):m(e);if("Buffer"===e.type&&Array.isArray(e.data))return m(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return p.from(e[Symbol.toPrimitive]("string"),t,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),c(e<0?0:0|h(e))}function m(e){const t=e.length<0?0:0|h(e.length),i=c(t);for(let n=0;n<t;n+=1)i[n]=255&e[n];return i}function f(e,t,i){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(i||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===i?new a(e):void 0===i?new a(e,t):new a(e,t,i),Object.setPrototypeOf(n,p.prototype),n}function h(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function g(e,t){if(p.isBuffer(e))return e.length;if(r.isView(e)||J(e,r))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const i=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===i)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return G(e).length;default:if(o)return n?-1:V(e).length;t=(""+t).toLowerCase(),o=!0}}function b(e,t,i){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,i);case"utf8":case"utf-8":return E(this,t,i);case"ascii":return C(this,t,i);case"latin1":case"binary":return R(this,t,i);case"base64":return A(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,i);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function x(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function v(e,t,i,n,o){if(0===e.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),X(i=+i)&&(i=o?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(o)return-1;i=e.length-1}else if(i<0){if(!o)return-1;i=0}if("string"==typeof t&&(t=p.from(t,n)),p.isBuffer(t))return 0===t.length?-1:y(e,t,i,n,o);if("number"==typeof t)return t&=255,"function"==typeof a.prototype.indexOf?o?a.prototype.indexOf.call(e,t,i):a.prototype.lastIndexOf.call(e,t,i):y(e,[t],i,n,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,i,n,o){let a,r=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;r=2,s/=2,c/=2,i/=2}function p(e,t){return 1===r?e[t]:e.readUInt16BE(t*r)}if(o){let n=-1;for(a=i;a<s;a++)if(p(e,a)===p(t,-1===n?0:a-n)){if(-1===n&&(n=a),a-n+1===c)return n*r}else-1!==n&&(a-=a-n),n=-1}else for(i+c>s&&(i=s-c),a=i;a>=0;a--){let i=!0;for(let n=0;n<c;n++)if(p(e,a+n)!==p(t,n)){i=!1;break}if(i)return a}return-1}function w(e,t,i,n){i=Number(i)||0;const o=e.length-i;n?(n=Number(n))>o&&(n=o):n=o;const a=t.length;let r;for(n>a/2&&(n=a/2),r=0;r<n;++r){const n=parseInt(t.substr(2*r,2),16);if(X(n))return r;e[i+r]=n}return r}function k(e,t,i,n){return Z(V(t,e.length-i),e,i,n)}function I(e,t,i,n){return Z(function(e){const t=[];for(let i=0;i<e.length;++i)t.push(255&e.charCodeAt(i));return t}(t),e,i,n)}function T(e,t,i,n){return Z(G(t),e,i,n)}function S(e,t,i,n){return Z(function(e,t){let i,n,o;const a=[];for(let r=0;r<e.length&&!((t-=2)<0);++r)i=e.charCodeAt(r),n=i>>8,o=i%256,a.push(o),a.push(n);return a}(t,e.length-i),e,i,n)}function A(e,i,n){return 0===i&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(i,n))}function E(e,t,i){i=Math.min(e.length,i);const n=[];let o=t;for(;o<i;){const t=e[o];let a=null,r=t>239?4:t>223?3:t>191?2:1;if(o+r<=i){let i,n,s,c;switch(r){case 1:t<128&&(a=t);break;case 2:i=e[o+1],128==(192&i)&&(c=(31&t)<<6|63&i,c>127&&(a=c));break;case 3:i=e[o+1],n=e[o+2],128==(192&i)&&128==(192&n)&&(c=(15&t)<<12|(63&i)<<6|63&n,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:i=e[o+1],n=e[o+2],s=e[o+3],128==(192&i)&&128==(192&n)&&128==(192&s)&&(c=(15&t)<<18|(63&i)<<12|(63&n)<<6|63&s,c>65535&&c<1114112&&(a=c))}}null===a?(a=65533,r=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),o+=r}return function(e){const t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);let i="",n=0;for(;n<t;)i+=String.fromCharCode.apply(String,e.slice(n,n+=_));return i}(n)}p.TYPED_ARRAY_SUPPORT=function(){try{const e=new a(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,a.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),p.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}}),p.poolSize=8192,p.from=function(e,t,i){return l(e,t,i)},Object.setPrototypeOf(p.prototype,a.prototype),Object.setPrototypeOf(p,a),p.alloc=function(e,t,i){return function(e,t,i){return u(e),e<=0?c(e):void 0!==t?"string"==typeof i?c(e).fill(t,i):c(e).fill(t):c(e)}(e,t,i)},p.allocUnsafe=function(e){return d(e)},p.allocUnsafeSlow=function(e){return d(e)},p.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==p.prototype},p.compare=function(e,t){if(J(e,a)&&(e=p.from(e,e.offset,e.byteLength)),J(t,a)&&(t=p.from(t,t.offset,t.byteLength)),!p.isBuffer(e)||!p.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let o=0,a=Math.min(i,n);o<a;++o)if(e[o]!==t[o]){i=e[o],n=t[o];break}return i<n?-1:n<i?1:0},p.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}},p.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return p.alloc(0);let i;if(void 0===t)for(t=0,i=0;i<e.length;++i)t+=e[i].length;const n=p.allocUnsafe(t);let o=0;for(i=0;i<e.length;++i){let t=e[i];if(J(t,a))o+t.length>n.length?(p.isBuffer(t)||(t=p.from(t)),t.copy(n,o)):a.prototype.set.call(n,t,o);else{if(!p.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,o)}o+=t.length}return n},p.byteLength=g,p.prototype._isBuffer=!0,p.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)x(this,t,t+1);return this},p.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},p.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},p.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?E(this,0,e):b.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===p.compare(this,e)},p.prototype.inspect=function(){let t="";const i=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,i).replace(/(.{2})/g,"$1 ").trim(),this.length>i&&(t+=" ... "),"<Buffer "+t+">"},n&&(p.prototype[n]=p.prototype.inspect),p.prototype.compare=function(e,t,i,n,o){if(J(e,a)&&(e=p.from(e,e.offset,e.byteLength)),!p.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||i>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(this===e)return 0;let r=(o>>>=0)-(n>>>=0),s=(i>>>=0)-(t>>>=0);const c=Math.min(r,s),l=this.slice(n,o),u=e.slice(t,i);for(let a=0;a<c;++a)if(l[a]!==u[a]){r=l[a],s=u[a];break}return r<s?-1:s<r?1:0},p.prototype.includes=function(e,t,i){return-1!==this.indexOf(e,t,i)},p.prototype.indexOf=function(e,t,i){return v(this,e,t,i,!0)},p.prototype.lastIndexOf=function(e,t,i){return v(this,e,t,i,!1)},p.prototype.write=function(e,t,i,n){if(void 0===t)n="utf8",i=this.length,t=0;else if(void 0===i&&"string"==typeof t)n=t,i=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(i)?(i>>>=0,void 0===n&&(n="utf8")):(n=i,i=void 0)}const o=this.length-t;if((void 0===i||i>o)&&(i=o),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return w(this,e,t,i);case"utf8":case"utf-8":return k(this,e,t,i);case"ascii":case"latin1":case"binary":return I(this,e,t,i);case"base64":return T(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const _=4096;function C(e,t,i){let n="";i=Math.min(e.length,i);for(let o=t;o<i;++o)n+=String.fromCharCode(127&e[o]);return n}function R(e,t,i){let n="";i=Math.min(e.length,i);for(let o=t;o<i;++o)n+=String.fromCharCode(e[o]);return n}function N(e,t,i){const n=e.length;(!t||t<0)&&(t=0),(!i||i<0||i>n)&&(i=n);let o="";for(let a=t;a<i;++a)o+=Y[e[a]];return o}function P(e,t,i){const n=e.slice(t,i);let o="";for(let a=0;a<n.length-1;a+=2)o+=String.fromCharCode(n[a]+256*n[a+1]);return o}function O(e,t,i){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>i)throw new RangeError("Trying to access beyond buffer length")}function $(e,t,i,n,o,a){if(!p.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<a)throw new RangeError('"value" argument is out of bounds');if(i+n>e.length)throw new RangeError("Index out of range")}function j(e,t,i,n,o){q(t,n,o,e,i,7);let a=Number(t&BigInt(4294967295));e[i++]=a,a>>=8,e[i++]=a,a>>=8,e[i++]=a,a>>=8,e[i++]=a;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[i++]=r,r>>=8,e[i++]=r,r>>=8,e[i++]=r,r>>=8,e[i++]=r,i}function F(e,t,i,n,o){q(t,n,o,e,i,7);let a=Number(t&BigInt(4294967295));e[i+7]=a,a>>=8,e[i+6]=a,a>>=8,e[i+5]=a,a>>=8,e[i+4]=a;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[i+3]=r,r>>=8,e[i+2]=r,r>>=8,e[i+1]=r,r>>=8,e[i]=r,i+8}function L(e,t,i,n,o,a){if(i+n>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function U(e,t,n,o,a){return t=+t,n>>>=0,a||L(e,0,n,4),i.write(e,t,n,o,23,4),n+4}function B(e,t,n,o,a){return t=+t,n>>>=0,a||L(e,0,n,8),i.write(e,t,n,o,52,8),n+8}p.prototype.slice=function(e,t){const i=this.length;(e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,p.prototype),n},p.prototype.readUintLE=p.prototype.readUIntLE=function(e,t,i){e>>>=0,t>>>=0,i||O(e,t,this.length);let n=this[e],o=1,a=0;for(;++a<t&&(o*=256);)n+=this[e+a]*o;return n},p.prototype.readUintBE=p.prototype.readUIntBE=function(e,t,i){e>>>=0,t>>>=0,i||O(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n},p.prototype.readUint8=p.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},p.prototype.readBigUInt64LE=Q((function(e){K(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||H(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))})),p.prototype.readBigUInt64BE=Q((function(e){K(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||H(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+i;return(BigInt(n)<<BigInt(32))+BigInt(o)})),p.prototype.readIntLE=function(e,t,i){e>>>=0,t>>>=0,i||O(e,t,this.length);let n=this[e],o=1,a=0;for(;++a<t&&(o*=256);)n+=this[e+a]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},p.prototype.readIntBE=function(e,t,i){e>>>=0,t>>>=0,i||O(e,t,this.length);let n=t,o=1,a=this[e+--n];for(;n>0&&(o*=256);)a+=this[e+--n]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*t)),a},p.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},p.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},p.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},p.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},p.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},p.prototype.readBigInt64LE=Q((function(e){K(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||H(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),p.prototype.readBigInt64BE=Q((function(e){K(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||H(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+i)})),p.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},p.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},p.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},p.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},p.prototype.writeUintLE=p.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t>>>=0,i>>>=0,!n){$(this,e,t,i,Math.pow(2,8*i)-1,0)}let o=1,a=0;for(this[t]=255&e;++a<i&&(o*=256);)this[t+a]=e/o&255;return t+i},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(e,t,i,n){if(e=+e,t>>>=0,i>>>=0,!n){$(this,e,t,i,Math.pow(2,8*i)-1,0)}let o=i-1,a=1;for(this[t+o]=255&e;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+i},p.prototype.writeUint8=p.prototype.writeUInt8=function(e,t,i){return e=+e,t>>>=0,i||$(this,e,t,1,255,0),this[t]=255&e,t+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(e,t,i){return e=+e,t>>>=0,i||$(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(e,t,i){return e=+e,t>>>=0,i||$(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(e,t,i){return e=+e,t>>>=0,i||$(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(e,t,i){return e=+e,t>>>=0,i||$(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},p.prototype.writeBigUInt64LE=Q((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),p.prototype.writeBigUInt64BE=Q((function(e,t=0){return F(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),p.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*i-1);$(this,e,t,i,n-1,-n)}let o=0,a=1,r=0;for(this[t]=255&e;++o<i&&(a*=256);)e<0&&0===r&&0!==this[t+o-1]&&(r=1),this[t+o]=(e/a|0)-r&255;return t+i},p.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*i-1);$(this,e,t,i,n-1,-n)}let o=i-1,a=1,r=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===r&&0!==this[t+o+1]&&(r=1),this[t+o]=(e/a|0)-r&255;return t+i},p.prototype.writeInt8=function(e,t,i){return e=+e,t>>>=0,i||$(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},p.prototype.writeInt16LE=function(e,t,i){return e=+e,t>>>=0,i||$(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},p.prototype.writeInt16BE=function(e,t,i){return e=+e,t>>>=0,i||$(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},p.prototype.writeInt32LE=function(e,t,i){return e=+e,t>>>=0,i||$(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},p.prototype.writeInt32BE=function(e,t,i){return e=+e,t>>>=0,i||$(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},p.prototype.writeBigInt64LE=Q((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),p.prototype.writeBigInt64BE=Q((function(e,t=0){return F(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),p.prototype.writeFloatLE=function(e,t,i){return U(this,e,t,!0,i)},p.prototype.writeFloatBE=function(e,t,i){return U(this,e,t,!1,i)},p.prototype.writeDoubleLE=function(e,t,i){return B(this,e,t,!0,i)},p.prototype.writeDoubleBE=function(e,t,i){return B(this,e,t,!1,i)},p.prototype.copy=function(e,t,i,n){if(!p.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<i&&(n=i),n===i)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-i&&(n=e.length-t+i);const o=n-i;return this===e&&"function"==typeof a.prototype.copyWithin?this.copyWithin(t,i,n):a.prototype.set.call(e,this.subarray(i,n),t),o},p.prototype.fill=function(e,t,i,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,i=this.length):"string"==typeof i&&(n=i,i=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!p.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;let o;if(t>>>=0,i=void 0===i?this.length:i>>>0,e||(e=0),"number"==typeof e)for(o=t;o<i;++o)this[o]=e;else{const a=p.isBuffer(e)?e:p.from(e,n),r=a.length;if(0===r)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<i-t;++o)this[o+t]=a[o%r]}return this};const M={};function D(e,t,i){M[e]=class extends i{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function z(e){let t="",i=e.length;const n="-"===e[0]?1:0;for(;i>=n+4;i-=3)t=`_${e.slice(i-3,i)}${t}`;return`${e.slice(0,i)}${t}`}function q(e,t,i,n,o,a){if(e>i||e<t){const i="bigint"==typeof t?"n":"";let n;throw n=0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(a+1)}${i}`:`>= -(2${i} ** ${8*(a+1)-1}${i}) and < 2 ** ${8*(a+1)-1}${i}`,new M.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,i){K(t,"offset"),void 0!==e[t]&&void 0!==e[t+i]||H(t,e.length-(i+1))}(n,o,a)}function K(e,t){if("number"!=typeof e)throw new M.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,i){if(Math.floor(e)!==e)throw K(e,i),new M.ERR_OUT_OF_RANGE("offset","an integer",e);if(t<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(e,t,i){let n=`The value of "${e}" is out of range.`,o=i;return Number.isInteger(i)&&Math.abs(i)>2**32?o=z(String(i)):"bigint"==typeof i&&(o=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(o=z(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function V(e,t){let i;t=t||1/0;const n=e.length;let o=null;const a=[];for(let r=0;r<n;++r){if(i=e.charCodeAt(r),i>55295&&i<57344){if(!o){if(i>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(r+1===n){(t-=3)>-1&&a.push(239,191,189);continue}o=i;continue}if(i<56320){(t-=3)>-1&&a.push(239,191,189),o=i;continue}i=65536+(o-55296<<10|i-56320)}else o&&(t-=3)>-1&&a.push(239,191,189);if(o=null,i<128){if((t-=1)<0)break;a.push(i)}else if(i<2048){if((t-=2)<0)break;a.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;a.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return a}function G(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Z(e,t,i,n){let o;for(o=0;o<n&&!(o+i>=t.length||o>=e.length);++o)t[o+i]=e[o];return o}function J(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let i=0;i<16;++i){const n=16*i;for(let o=0;o<16;++o)t[n+o]=e[i]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?ee:e}function ee(){throw new Error("BigInt not supported")}}(ci);const xi=ci.Buffer,vi=ci.Buffer,yi=globalThis||self;function wi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ki,Ii,Ti={exports:{}},Si=Ti.exports={};function Ai(){throw new Error("setTimeout has not been defined")}function Ei(){throw new Error("clearTimeout has not been defined")}function _i(e){if(ki===setTimeout)return setTimeout(e,0);if((ki===Ai||!ki)&&setTimeout)return ki=setTimeout,setTimeout(e,0);try{return ki(e,0)}catch(t){try{return ki.call(null,e,0)}catch(i){return ki.call(this,e,0)}}}!function(){try{ki="function"==typeof setTimeout?setTimeout:Ai}catch(e){ki=Ai}try{Ii="function"==typeof clearTimeout?clearTimeout:Ei}catch(e){Ii=Ei}}();var Ci,Ri=[],Ni=!1,Pi=-1;function Oi(){Ni&&Ci&&(Ni=!1,Ci.length?Ri=Ci.concat(Ri):Pi=-1,Ri.length&&$i())}function $i(){if(!Ni){var e=_i(Oi);Ni=!0;for(var t=Ri.length;t;){for(Ci=Ri,Ri=[];++Pi<t;)Ci&&Ci[Pi].run();Pi=-1,t=Ri.length}Ci=null,Ni=!1,function(e){if(Ii===clearTimeout)return clearTimeout(e);if((Ii===Ei||!Ii)&&clearTimeout)return Ii=clearTimeout,clearTimeout(e);try{return Ii(e)}catch(t){try{return Ii.call(null,e)}catch(i){return Ii.call(this,e)}}}(e)}}function ji(e,t){this.fun=e,this.array=t}function Fi(){}Si.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];Ri.push(new ji(e,t)),1!==Ri.length||Ni||_i($i)},ji.prototype.run=function(){this.fun.apply(null,this.array)},Si.title="browser",Si.browser=!0,Si.env={},Si.argv=[],Si.version="",Si.versions={},Si.on=Fi,Si.addListener=Fi,Si.once=Fi,Si.off=Fi,Si.removeListener=Fi,Si.removeAllListeners=Fi,Si.emit=Fi,Si.prependListener=Fi,Si.prependOnceListener=Fi,Si.listeners=function(e){return[]},Si.binding=function(e){throw new Error("process.binding is not supported")},Si.cwd=function(){return"/"},Si.chdir=function(e){throw new Error("process.chdir is not supported")},Si.umask=function(){return 0};const Li=wi(Ti.exports);function Ui(e,t){return function(){return e.apply(t,arguments)}}const{toString:Bi}=Object.prototype,{getPrototypeOf:Mi}=Object,Di=(e=>t=>{const i=Bi.call(t);return e[i]||(e[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),zi=e=>(e=e.toLowerCase(),t=>Di(t)===e),qi=e=>t=>typeof t===e,{isArray:Ki}=Array,Hi=qi("undefined");const Wi=zi("ArrayBuffer");const Vi=qi("string"),Gi=qi("function"),Zi=qi("number"),Ji=e=>null!==e&&"object"==typeof e,Xi=e=>{if("object"!==Di(e))return!1;const t=Mi(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},Yi=zi("Date"),Qi=zi("File"),en=zi("Blob"),tn=zi("FileList"),nn=zi("URLSearchParams"),[on,an,rn,sn]=["ReadableStream","Request","Response","Headers"].map(zi);function cn(e,t,{allOwnKeys:i=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),Ki(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{const o=i?Object.getOwnPropertyNames(e):Object.keys(e),a=o.length;let r;for(n=0;n<a;n++)r=o[n],t.call(null,e[r],r,e)}}function pn(e,t){t=t.toLowerCase();const i=Object.keys(e);let n,o=i.length;for(;o-- >0;)if(n=i[o],t===n.toLowerCase())return n;return null}const ln="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:yi,un=e=>!Hi(e)&&e!==ln;const dn=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&Mi(Uint8Array)),mn=zi("HTMLFormElement"),fn=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype),hn=zi("RegExp"),gn=(e,t)=>{const i=Object.getOwnPropertyDescriptors(e),n={};cn(i,((i,o)=>{let a;!1!==(a=t(i,o,e))&&(n[o]=a||i)})),Object.defineProperties(e,n)};const bn=zi("AsyncFunction"),xn=((e,t)=>e?setImmediate:t?((e,t)=>(ln.addEventListener("message",(({source:i,data:n})=>{i===ln&&n===e&&t.length&&t.shift()()}),!1),i=>{t.push(i),ln.postMessage(e,"*")}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))("function"==typeof setImmediate,Gi(ln.postMessage)),vn="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ln):void 0!==Li&&Li.nextTick||xn,yn={isArray:Ki,isArrayBuffer:Wi,isBuffer:function(e){return null!==e&&!Hi(e)&&null!==e.constructor&&!Hi(e.constructor)&&Gi(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Gi(e.append)&&("formdata"===(t=Di(e))||"object"===t&&Gi(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Wi(e.buffer),t},isString:Vi,isNumber:Zi,isBoolean:e=>!0===e||!1===e,isObject:Ji,isPlainObject:Xi,isReadableStream:on,isRequest:an,isResponse:rn,isHeaders:sn,isUndefined:Hi,isDate:Yi,isFile:Qi,isBlob:en,isRegExp:hn,isFunction:Gi,isStream:e=>Ji(e)&&Gi(e.pipe),isURLSearchParams:nn,isTypedArray:dn,isFileList:tn,forEach:cn,merge:function e(){const{caseless:t}=un(this)&&this||{},i={},n=(n,o)=>{const a=t&&pn(i,o)||o;Xi(i[a])&&Xi(n)?i[a]=e(i[a],n):Xi(n)?i[a]=e({},n):Ki(n)?i[a]=n.slice():i[a]=n};for(let o=0,a=arguments.length;o<a;o++)arguments[o]&&cn(arguments[o],n);return i},extend:(e,t,i,{allOwnKeys:n}={})=>(cn(t,((t,n)=>{i&&Gi(t)?e[n]=Ui(t,i):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,i,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),i&&Object.assign(e.prototype,i)},toFlatObject:(e,t,i,n)=>{let o,a,r;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),a=o.length;a-- >0;)r=o[a],n&&!n(r,e,t)||s[r]||(t[r]=e[r],s[r]=!0);e=!1!==i&&Mi(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype);return t},kindOf:Di,kindOfTest:zi,endsWith:(e,t,i)=>{e=String(e),(void 0===i||i>e.length)&&(i=e.length),i-=t.length;const n=e.indexOf(t,i);return-1!==n&&n===i},toArray:e=>{if(!e)return null;if(Ki(e))return e;let t=e.length;if(!Zi(t))return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},forEachEntry:(e,t)=>{const i=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=i.next())&&!n.done;){const i=n.value;t.call(e,i[0],i[1])}},matchAll:(e,t)=>{let i;const n=[];for(;null!==(i=e.exec(t));)n.push(i);return n},isHTMLForm:mn,hasOwnProperty:fn,hasOwnProp:fn,reduceDescriptors:gn,freezeMethods:e=>{gn(e,((t,i)=>{if(Gi(e)&&-1!==["arguments","caller","callee"].indexOf(i))return!1;const n=e[i];Gi(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")}))}))},toObjectSet:(e,t)=>{const i={},n=e=>{e.forEach((e=>{i[e]=!0}))};return Ki(e)?n(e):n(String(e).split(t)),i},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,i){return t.toUpperCase()+i})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:pn,global:ln,isContextDefined:un,isSpecCompliantForm:function(e){return!!(e&&Gi(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),i=(e,n)=>{if(Ji(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const o=Ki(e)?[]:{};return cn(e,((e,t)=>{const a=i(e,n+1);!Hi(a)&&(o[t]=a)})),t[n]=void 0,o}}return e};return i(e,0)},isAsyncFn:bn,isThenable:e=>e&&(Ji(e)||Gi(e))&&Gi(e.then)&&Gi(e.catch),setImmediate:xn,asap:vn};function wn(e,t,i,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}yn.inherits(wn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:yn.toJSONObject(this.config),code:this.code,status:this.status}}});const kn=wn.prototype,In={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{In[e]={value:e}})),Object.defineProperties(wn,In),Object.defineProperty(kn,"isAxiosError",{value:!0}),wn.from=(e,t,i,n,o,a)=>{const r=Object.create(kn);return yn.toFlatObject(e,r,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),wn.call(r,e.message,t,i,n,o),r.cause=e,r.name=e.name,a&&Object.assign(r,a),r};function Tn(e){return yn.isPlainObject(e)||yn.isArray(e)}function Sn(e){return yn.endsWith(e,"[]")?e.slice(0,-2):e}function An(e,t,i){return e?e.concat(t).map((function(e,t){return e=Sn(e),!i&&t?"["+e+"]":e})).join(i?".":""):t}const En=yn.toFlatObject(yn,{},null,(function(e){return/^is[A-Z]/.test(e)}));function _n(e,t,i){if(!yn.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(i=yn.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!yn.isUndefined(t[e])}))).metaTokens,o=i.visitor||p,a=i.dots,r=i.indexes,s=(i.Blob||"undefined"!=typeof Blob&&Blob)&&yn.isSpecCompliantForm(t);if(!yn.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(yn.isDate(e))return e.toISOString();if(!s&&yn.isBlob(e))throw new wn("Blob is not supported. Use a Buffer instead.");return yn.isArrayBuffer(e)||yn.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):xi.from(e):e}function p(e,i,o){let s=e;if(e&&!o&&"object"==typeof e)if(yn.endsWith(i,"{}"))i=n?i:i.slice(0,-2),e=JSON.stringify(e);else if(yn.isArray(e)&&function(e){return yn.isArray(e)&&!e.some(Tn)}(e)||(yn.isFileList(e)||yn.endsWith(i,"[]"))&&(s=yn.toArray(e)))return i=Sn(i),s.forEach((function(e,n){!yn.isUndefined(e)&&null!==e&&t.append(!0===r?An([i],n,a):null===r?i:i+"[]",c(e))})),!1;return!!Tn(e)||(t.append(An(o,i,a),c(e)),!1)}const l=[],u=Object.assign(En,{defaultVisitor:p,convertValue:c,isVisitable:Tn});if(!yn.isObject(e))throw new TypeError("data must be an object");return function e(i,n){if(!yn.isUndefined(i)){if(-1!==l.indexOf(i))throw Error("Circular reference detected in "+n.join("."));l.push(i),yn.forEach(i,(function(i,a){!0===(!(yn.isUndefined(i)||null===i)&&o.call(t,i,yn.isString(a)?a.trim():a,n,u))&&e(i,n?n.concat(a):[a])})),l.pop()}}(e),t}function Cn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Rn(e,t){this._pairs=[],e&&_n(e,this,t)}const Nn=Rn.prototype;function Pn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function On(e,t,i){if(!t)return e;const n=i&&i.encode||Pn;yn.isFunction(i)&&(i={serialize:i});const o=i&&i.serialize;let a;if(a=o?o(t,i):yn.isURLSearchParams(t)?t.toString():new Rn(t,i).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}Nn.append=function(e,t){this._pairs.push([e,t])},Nn.toString=function(e){const t=e?function(t){return e.call(this,t,Cn)}:Cn;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class $n{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){yn.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}const jn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Fn={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Rn,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Ln="undefined"!=typeof window&&"undefined"!=typeof document,Un="object"==typeof navigator&&navigator||void 0,Bn=Ln&&(!Un||["ReactNative","NativeScript","NS"].indexOf(Un.product)<0),Mn="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Dn=Ln&&window.location.href||"http://localhost",zn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ln,hasStandardBrowserEnv:Bn,hasStandardBrowserWebWorkerEnv:Mn,navigator:Un,origin:Dn},Symbol.toStringTag,{value:"Module"})),...Fn};function qn(e){function t(e,i,n,o){let a=e[o++];if("__proto__"===a)return!0;const r=Number.isFinite(+a),s=o>=e.length;if(a=!a&&yn.isArray(n)?n.length:a,s)return yn.hasOwnProp(n,a)?n[a]=[n[a],i]:n[a]=i,!r;n[a]&&yn.isObject(n[a])||(n[a]=[]);return t(e,i,n[a],o)&&yn.isArray(n[a])&&(n[a]=function(e){const t={},i=Object.keys(e);let n;const o=i.length;let a;for(n=0;n<o;n++)a=i[n],t[a]=e[a];return t}(n[a])),!r}if(yn.isFormData(e)&&yn.isFunction(e.entries)){const i={};return yn.forEachEntry(e,((e,n)=>{t(function(e){return yn.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,i,0)})),i}return null}const Kn={transitional:jn,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const i=t.getContentType()||"",n=i.indexOf("application/json")>-1,o=yn.isObject(e);o&&yn.isHTMLForm(e)&&(e=new FormData(e));if(yn.isFormData(e))return n?JSON.stringify(qn(e)):e;if(yn.isArrayBuffer(e)||yn.isBuffer(e)||yn.isStream(e)||yn.isFile(e)||yn.isBlob(e)||yn.isReadableStream(e))return e;if(yn.isArrayBufferView(e))return e.buffer;if(yn.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return _n(e,new zn.classes.URLSearchParams,Object.assign({visitor:function(e,t,i,n){return zn.isNode&&yn.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=yn.isFileList(e))||i.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return _n(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||n?(t.setContentType("application/json",!1),function(e,t){if(yn.isString(e))try{return(t||JSON.parse)(e),yn.trim(e)}catch(i){if("SyntaxError"!==i.name)throw i}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Kn.transitional,i=t&&t.forcedJSONParsing,n="json"===this.responseType;if(yn.isResponse(e)||yn.isReadableStream(e))return e;if(e&&yn.isString(e)&&(i&&!this.responseType||n)){const i=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(o){if(i){if("SyntaxError"===o.name)throw wn.from(o,wn.ERR_BAD_RESPONSE,this,null,this.response);throw o}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:zn.classes.FormData,Blob:zn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};yn.forEach(["delete","get","head","post","put","patch"],(e=>{Kn.headers[e]={}}));const Hn=yn.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Wn=Symbol("internals");function Vn(e){return e&&String(e).trim().toLowerCase()}function Gn(e){return!1===e||null==e?e:yn.isArray(e)?e.map(Gn):String(e)}function Zn(e,t,i,n,o){return yn.isFunction(n)?n.call(this,t,i):(o&&(t=i),yn.isString(t)?yn.isString(n)?-1!==t.indexOf(n):yn.isRegExp(n)?n.test(t):void 0:void 0)}class Jn{constructor(e){e&&this.set(e)}set(e,t,i){const n=this;function o(e,t,i){const o=Vn(t);if(!o)throw new Error("header name must be a non-empty string");const a=yn.findKey(n,o);(!a||void 0===n[a]||!0===i||void 0===i&&!1!==n[a])&&(n[a||t]=Gn(e))}const a=(e,t)=>yn.forEach(e,((e,i)=>o(e,i,t)));if(yn.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(yn.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))a((e=>{const t={};let i,n,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),i=e.substring(0,o).trim().toLowerCase(),n=e.substring(o+1).trim(),!i||t[i]&&Hn[i]||("set-cookie"===i?t[i]?t[i].push(n):t[i]=[n]:t[i]=t[i]?t[i]+", "+n:n)})),t})(e),t);else if(yn.isHeaders(e))for(const[r,s]of e.entries())o(s,r,i);else null!=e&&o(t,e,i);return this}get(e,t){if(e=Vn(e)){const i=yn.findKey(this,e);if(i){const e=this[i];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=i.exec(e);)t[n[1]]=n[2];return t}(e);if(yn.isFunction(t))return t.call(this,e,i);if(yn.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Vn(e)){const i=yn.findKey(this,e);return!(!i||void 0===this[i]||t&&!Zn(0,this[i],i,t))}return!1}delete(e,t){const i=this;let n=!1;function o(e){if(e=Vn(e)){const o=yn.findKey(i,e);!o||t&&!Zn(0,i[o],o,t)||(delete i[o],n=!0)}}return yn.isArray(e)?e.forEach(o):o(e),n}clear(e){const t=Object.keys(this);let i=t.length,n=!1;for(;i--;){const o=t[i];e&&!Zn(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}normalize(e){const t=this,i={};return yn.forEach(this,((n,o)=>{const a=yn.findKey(i,o);if(a)return t[a]=Gn(n),void delete t[o];const r=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,i)=>t.toUpperCase()+i))}(o):String(o).trim();r!==o&&delete t[o],t[r]=Gn(n),i[r]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return yn.forEach(this,((i,n)=>{null!=i&&!1!==i&&(t[n]=e&&yn.isArray(i)?i.join(", "):i)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach((e=>i.set(e))),i}static accessor(e){const t=(this[Wn]=this[Wn]={accessors:{}}).accessors,i=this.prototype;function n(e){const n=Vn(e);t[n]||(!function(e,t){const i=yn.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+i,{value:function(e,i,o){return this[n].call(this,t,e,i,o)},configurable:!0})}))}(i,e),t[n]=!0)}return yn.isArray(e)?e.forEach(n):n(e),this}}function Xn(e,t){const i=this||Kn,n=t||i,o=Jn.from(n.headers);let a=n.data;return yn.forEach(e,(function(e){a=e.call(i,a,o.normalize(),t?t.status:void 0)})),o.normalize(),a}function Yn(e){return!(!e||!e.__CANCEL__)}function Qn(e,t,i){wn.call(this,null==e?"canceled":e,wn.ERR_CANCELED,t,i),this.name="CanceledError"}function eo(e,t,i){const n=i.config.validateStatus;i.status&&n&&!n(i.status)?t(new wn("Request failed with status code "+i.status,[wn.ERR_BAD_REQUEST,wn.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):e(i)}Jn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),yn.reduceDescriptors(Jn.prototype,(({value:e},t)=>{let i=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[i]=e}}})),yn.freezeMethods(Jn),yn.inherits(Qn,wn,{__CANCEL__:!0});const to=(e,t,i=3)=>{let n=0;const o=function(e,t){e=e||10;const i=new Array(e),n=new Array(e);let o,a=0,r=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),p=n[r];o||(o=c),i[a]=s,n[a]=c;let l=r,u=0;for(;l!==a;)u+=i[l++],l%=e;if(a=(a+1)%e,a===r&&(r=(r+1)%e),c-o<t)return;const d=p&&c-p;return d?Math.round(1e3*u/d):void 0}}(50,250);return function(e,t){let i,n,o=0,a=1e3/t;const r=(t,a=Date.now())=>{o=a,i=null,n&&(clearTimeout(n),n=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),s=t-o;s>=a?r(e,t):(i=e,n||(n=setTimeout((()=>{n=null,r(i)}),a-s)))},()=>i&&r(i)]}((i=>{const a=i.loaded,r=i.lengthComputable?i.total:void 0,s=a-n,c=o(s);n=a;e({loaded:a,total:r,progress:r?a/r:void 0,bytes:s,rate:c||void 0,estimated:c&&r&&a<=r?(r-a)/c:void 0,event:i,lengthComputable:null!=r,[t?"download":"upload"]:!0})}),i)},io=(e,t)=>{const i=null!=e;return[n=>t[0]({lengthComputable:i,total:e,loaded:n}),t[1]]},no=e=>(...t)=>yn.asap((()=>e(...t))),oo=zn.hasStandardBrowserEnv?((e,t)=>i=>(i=new URL(i,zn.origin),e.protocol===i.protocol&&e.host===i.host&&(t||e.port===i.port)))(new URL(zn.origin),zn.navigator&&/(msie|trident)/i.test(zn.navigator.userAgent)):()=>!0,ao=zn.hasStandardBrowserEnv?{write(e,t,i,n,o,a){const r=[e+"="+encodeURIComponent(t)];yn.isNumber(i)&&r.push("expires="+new Date(i).toGMTString()),yn.isString(n)&&r.push("path="+n),yn.isString(o)&&r.push("domain="+o),!0===a&&r.push("secure"),document.cookie=r.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function ro(e,t,i){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==i)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const so=e=>e instanceof Jn?{...e}:e;function co(e,t){t=t||{};const i={};function n(e,t,i,n){return yn.isPlainObject(e)&&yn.isPlainObject(t)?yn.merge.call({caseless:n},e,t):yn.isPlainObject(t)?yn.merge({},t):yn.isArray(t)?t.slice():t}function o(e,t,i,o){return yn.isUndefined(t)?yn.isUndefined(e)?void 0:n(void 0,e,0,o):n(e,t,0,o)}function a(e,t){if(!yn.isUndefined(t))return n(void 0,t)}function r(e,t){return yn.isUndefined(t)?yn.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(i,o,a){return a in t?n(i,o):a in e?n(void 0,i):void 0}const c={url:a,method:a,data:a,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,withXSRFToken:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:s,headers:(e,t,i)=>o(so(e),so(t),0,!0)};return yn.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||o,r=a(e[n],t[n],n);yn.isUndefined(r)&&a!==s||(i[n]=r)})),i}const po=e=>{const t=co({},e);let i,{data:n,withXSRFToken:o,xsrfHeaderName:a,xsrfCookieName:r,headers:s,auth:c}=t;if(t.headers=s=Jn.from(s),t.url=On(ro(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),yn.isFormData(n))if(zn.hasStandardBrowserEnv||zn.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(!1!==(i=s.getContentType())){const[e,...t]=i?i.split(";").map((e=>e.trim())).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...t].join("; "))}if(zn.hasStandardBrowserEnv&&(o&&yn.isFunction(o)&&(o=o(t)),o||!1!==o&&oo(t.url))){const e=a&&r&&ao.read(r);e&&s.set(a,e)}return t},lo="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,i){const n=po(e);let o=n.data;const a=Jn.from(n.headers).normalize();let r,s,c,p,l,{responseType:u,onUploadProgress:d,onDownloadProgress:m}=n;function f(){p&&p(),l&&l(),n.cancelToken&&n.cancelToken.unsubscribe(r),n.signal&&n.signal.removeEventListener("abort",r)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=Jn.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());eo((function(e){t(e),f()}),(function(e){i(e),f()}),{data:u&&"text"!==u&&"json"!==u?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:n,config:e,request:h}),h=null}h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout,"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(g)},h.onabort=function(){h&&(i(new wn("Request aborted",wn.ECONNABORTED,e,h)),h=null)},h.onerror=function(){i(new wn("Network Error",wn.ERR_NETWORK,e,h)),h=null},h.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const o=n.transitional||jn;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),i(new wn(t,o.clarifyTimeoutError?wn.ETIMEDOUT:wn.ECONNABORTED,e,h)),h=null},void 0===o&&a.setContentType(null),"setRequestHeader"in h&&yn.forEach(a.toJSON(),(function(e,t){h.setRequestHeader(t,e)})),yn.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),m&&([c,l]=to(m,!0),h.addEventListener("progress",c)),d&&h.upload&&([s,p]=to(d),h.upload.addEventListener("progress",s),h.upload.addEventListener("loadend",p)),(n.cancelToken||n.signal)&&(r=t=>{h&&(i(!t||t.type?new Qn(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(r),n.signal&&(n.signal.aborted?r():n.signal.addEventListener("abort",r)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);b&&-1===zn.protocols.indexOf(b)?i(new wn("Unsupported protocol "+b+":",wn.ERR_BAD_REQUEST,e)):h.send(o||null)}))},uo=(e,t)=>{const{length:i}=e=e?e.filter(Boolean):[];if(t||i){let i,n=new AbortController;const o=function(e){if(!i){i=!0,r();const t=e instanceof Error?e:this.reason;n.abort(t instanceof wn?t:new Qn(t instanceof Error?t.message:t))}};let a=t&&setTimeout((()=>{a=null,o(new wn(`timeout ${t} of ms exceeded`,wn.ETIMEDOUT))}),t);const r=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)})),e=null)};e.forEach((e=>e.addEventListener("abort",o)));const{signal:s}=n;return s.unsubscribe=()=>yn.asap(r),s}},mo=function*(e,t){let i=e.byteLength;if(i<t)return void(yield e);let n,o=0;for(;o<i;)n=o+t,yield e.slice(o,n),o=n},fo=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:i}=await t.read();if(e)break;yield i}}finally{await t.cancel()}},ho=(e,t,i,n)=>{const o=async function*(e,t){for await(const i of fo(e))yield*mo(i,t)}(e,t);let a,r=0,s=e=>{a||(a=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await o.next();if(t)return s(),void e.close();let a=n.byteLength;if(i){let e=r+=a;i(e)}e.enqueue(new Uint8Array(n))}catch(t){throw s(t),t}},cancel:e=>(s(e),o.return())},{highWaterMark:2})},go="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,bo=go&&"function"==typeof ReadableStream,xo=go&&("function"==typeof TextEncoder?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),vo=(e,...t)=>{try{return!!e(...t)}catch(i){return!1}},yo=bo&&vo((()=>{let e=!1;const t=new Request(zn.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),wo=bo&&vo((()=>yn.isReadableStream(new Response("").body))),ko={stream:wo&&(e=>e.body)};go&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!ko[t]&&(ko[t]=yn.isFunction(e[t])?e=>e[t]():(e,i)=>{throw new wn(`Response type '${t}' is not supported`,wn.ERR_NOT_SUPPORT,i)})}))})(new Response);const Io=async(e,t)=>{const i=yn.toFiniteNumber(e.getContentLength());return null==i?(async e=>{if(null==e)return 0;if(yn.isBlob(e))return e.size;if(yn.isSpecCompliantForm(e)){const t=new Request(zn.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return yn.isArrayBufferView(e)||yn.isArrayBuffer(e)?e.byteLength:(yn.isURLSearchParams(e)&&(e+=""),yn.isString(e)?(await xo(e)).byteLength:void 0)})(t):i},To={http:null,xhr:lo,fetch:go&&(async e=>{let{url:t,method:i,data:n,signal:o,cancelToken:a,timeout:r,onDownloadProgress:s,onUploadProgress:c,responseType:p,headers:l,withCredentials:u="same-origin",fetchOptions:d}=po(e);p=p?(p+"").toLowerCase():"text";let m,f=uo([o,a&&a.toAbortSignal()],r);const h=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let g;try{if(c&&yo&&"get"!==i&&"head"!==i&&0!==(g=await Io(l,n))){let e,i=new Request(t,{method:"POST",body:n,duplex:"half"});if(yn.isFormData(n)&&(e=i.headers.get("content-type"))&&l.setContentType(e),i.body){const[e,t]=io(g,to(no(c)));n=ho(i.body,65536,e,t)}}yn.isString(u)||(u=u?"include":"omit");const o="credentials"in Request.prototype;m=new Request(t,{...d,signal:f,method:i.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:o?u:void 0});let a=await fetch(m);const r=wo&&("stream"===p||"response"===p);if(wo&&(s||r&&h)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=a[t]}));const t=yn.toFiniteNumber(a.headers.get("content-length")),[i,n]=s&&io(t,to(no(s),!0))||[];a=new Response(ho(a.body,65536,i,(()=>{n&&n(),h&&h()})),e)}p=p||"text";let b=await ko[yn.findKey(ko,p)||"text"](a,e);return!r&&h&&h(),await new Promise(((t,i)=>{eo(t,i,{data:b,headers:Jn.from(a.headers),status:a.status,statusText:a.statusText,config:e,request:m})}))}catch(b){if(h&&h(),b&&"TypeError"===b.name&&/fetch/i.test(b.message))throw Object.assign(new wn("Network Error",wn.ERR_NETWORK,e,m),{cause:b.cause||b});throw wn.from(b,b&&b.code,e,m)}})};yn.forEach(To,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(i){}Object.defineProperty(e,"adapterName",{value:t})}}));const So=e=>`- ${e}`,Ao=e=>yn.isFunction(e)||null===e||!1===e,Eo=e=>{e=yn.isArray(e)?e:[e];const{length:t}=e;let i,n;const o={};for(let a=0;a<t;a++){let t;if(i=e[a],n=i,!Ao(i)&&(n=To[(t=String(i)).toLowerCase()],void 0===n))throw new wn(`Unknown adapter '${t}'`);if(n)break;o[t||"#"+a]=n}if(!n){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new wn("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(So).join("\n"):" "+So(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function _o(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Qn(null,e)}function Co(e){_o(e),e.headers=Jn.from(e.headers),e.data=Xn.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Eo(e.adapter||Kn.adapter)(e).then((function(t){return _o(e),t.data=Xn.call(e,e.transformResponse,t),t.headers=Jn.from(t.headers),t}),(function(t){return Yn(t)||(_o(e),t&&t.response&&(t.response.data=Xn.call(e,e.transformResponse,t.response),t.response.headers=Jn.from(t.response.headers))),Promise.reject(t)}))}const Ro="1.8.4",No={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{No[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));const Po={};No.transitional=function(e,t,i){function n(e,t){return"[Axios v1.8.4] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,o,a)=>{if(!1===e)throw new wn(n(o," has been removed"+(t?" in "+t:"")),wn.ERR_DEPRECATED);return t&&!Po[o]&&(Po[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,o,a)}},No.spelling=function(e){return(t,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};const Oo={assertOptions:function(e,t,i){if("object"!=typeof e)throw new wn("options must be an object",wn.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const a=n[o],r=t[a];if(r){const t=e[a],i=void 0===t||r(t,a,e);if(!0!==i)throw new wn("option "+a+" must be "+i,wn.ERR_BAD_OPTION_VALUE)}else if(!0!==i)throw new wn("Unknown option "+a,wn.ERR_BAD_OPTION)}},validators:No},$o=Oo.validators;class jo{constructor(e){this.defaults=e,this.interceptors={request:new $n,response:new $n}}async request(e,t){try{return await this._request(e,t)}catch(i){if(i instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{i.stack?t&&!String(i.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(i.stack+="\n"+t):i.stack=t}catch(n){}}throw i}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=co(this.defaults,t);const{transitional:i,paramsSerializer:n,headers:o}=t;void 0!==i&&Oo.assertOptions(i,{silentJSONParsing:$o.transitional($o.boolean),forcedJSONParsing:$o.transitional($o.boolean),clarifyTimeoutError:$o.transitional($o.boolean)},!1),null!=n&&(yn.isFunction(n)?t.paramsSerializer={serialize:n}:Oo.assertOptions(n,{encode:$o.function,serialize:$o.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Oo.assertOptions(t,{baseUrl:$o.spelling("baseURL"),withXsrfToken:$o.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=o&&yn.merge(o.common,o[t.method]);o&&yn.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=Jn.concat(a,o);const r=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));const c=[];let p;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,u=0;if(!s){const e=[Co.bind(this),void 0];for(e.unshift.apply(e,r),e.push.apply(e,c),l=e.length,p=Promise.resolve(t);u<l;)p=p.then(e[u++],e[u++]);return p}l=r.length;let d=t;for(u=0;u<l;){const e=r[u++],t=r[u++];try{d=e(d)}catch(m){t.call(this,m);break}}try{p=Co.call(this,d)}catch(m){return Promise.reject(m)}for(u=0,l=c.length;u<l;)p=p.then(c[u++],c[u++]);return p}getUri(e){return On(ro((e=co(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}yn.forEach(["delete","get","head","options"],(function(e){jo.prototype[e]=function(t,i){return this.request(co(i||{},{method:e,url:t,data:(i||{}).data}))}})),yn.forEach(["post","put","patch"],(function(e){function t(t){return function(i,n,o){return this.request(co(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:n}))}}jo.prototype[e]=t(),jo.prototype[e+"Form"]=t(!0)}));class Fo{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const i=this;this.promise.then((e=>{if(!i._listeners)return;let t=i._listeners.length;for(;t-- >0;)i._listeners[t](e);i._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{i.subscribe(e),t=e})).then(e);return n.cancel=function(){i.unsubscribe(t)},n},e((function(e,n,o){i.reason||(i.reason=new Qn(e,n,o),t(i.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Fo((function(t){e=t})),cancel:e}}}const Lo={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Lo).forEach((([e,t])=>{Lo[t]=e}));const Uo=function e(t){const i=new jo(t),n=Ui(jo.prototype.request,i);return yn.extend(n,jo.prototype,i,{allOwnKeys:!0}),yn.extend(n,i,null,{allOwnKeys:!0}),n.create=function(i){return e(co(t,i))},n}(Kn);Uo.Axios=jo,Uo.CanceledError=Qn,Uo.CancelToken=Fo,Uo.isCancel=Yn,Uo.VERSION=Ro,Uo.toFormData=_n,Uo.AxiosError=wn,Uo.Cancel=Uo.CanceledError,Uo.all=function(e){return Promise.all(e)},Uo.spread=function(e){return function(t){return e.apply(null,t)}},Uo.isAxiosError=function(e){return yn.isObject(e)&&!0===e.isAxiosError},Uo.mergeConfig=co,Uo.AxiosHeaders=Jn,Uo.formToJSON=e=>qn(yn.isHTMLForm(e)?new FormData(e):e),Uo.getAdapter=Eo,Uo.HttpStatusCode=Lo,Uo.default=Uo;const Bo=class e{constructor(){si(this,"isProduction"),this.isProduction="production"===Li.env.NODE_ENV}static getInstance(){return e.instance||(e.instance=new e),e.instance}debug(e,...t){this.isProduction||console.debug(e,...t)}info(e,...t){this.isProduction||console.info(e,...t)}warn(e,...t){console.warn(e,...t)}error(e,...t){console.error(e,...t)}};si(Bo,"instance");let Mo=Bo;class Do extends Error{constructor(e){super(e),this.name="ValidationError"}}class zo{constructor(e){si(this,"accountId"),si(this,"privateKey"),si(this,"baseUrl"),si(this,"network"),this.accountId=e.accountId,this.privateKey=i.PrivateKey.fromStringED25519(e.privateKey),this.network=e.network||"mainnet",this.baseUrl=e.baseUrl||"https://kiloscribe.com"}async authenticate(){var e,t,i;const n=await Uo.get(`${this.baseUrl}/api/auth/request-signature`,{headers:{"x-session":this.accountId}});if(!(null==(e=n.data)?void 0:e.message))throw new Error("Failed to get signature message");const o=n.data.message,a=await this.signMessage(o),r=await Uo.post(`${this.baseUrl}/api/auth/authenticate`,{authData:{id:this.accountId,signature:a,data:o,network:this.network},include:"apiKey"});if(!(null==(i=null==(t=r.data)?void 0:t.user)?void 0:i.sessionToken))throw new Error("Authentication failed");return{apiKey:r.data.apiKey}}async signMessage(e){const t=(new TextEncoder).encode(e),i=await this.privateKey.sign(t);return vi.from(i).toString("hex")}}let qo=class{constructor(e){si(this,"accountId"),si(this,"signer"),si(this,"baseUrl"),si(this,"network"),si(this,"logger"),this.accountId=e.accountId,this.signer=e.signer,this.network=e.network||"mainnet",this.baseUrl=e.baseUrl||"https://kiloscribe.com",this.logger=e.logger}async authenticate(){var e,t,i;const n=await Uo.get(`${this.baseUrl}/api/auth/request-signature`,{headers:{"x-session":this.accountId}});if(!(null==(e=n.data)?void 0:e.message))throw new Error("Failed to get signature message");const o=n.data.message,a=await this.signMessage(JSON.stringify(o)),r=await Uo.post(`${this.baseUrl}/api/auth/authenticate`,{authData:{id:this.accountId,signature:a,data:o,network:this.network},include:"apiKey"});if(!(null==(i=null==(t=r.data)?void 0:t.user)?void 0:i.sessionToken))throw new Error("Authentication failed");return{apiKey:r.data.apiKey}}async signMessage(e){try{const t=(new TextEncoder).encode(e);this.logger.debug("signing message");const i=await this.signer.sign([t],{encoding:"utf-8"});return vi.from(null==i?void 0:i[0].signature).toString("hex")}catch(t){throw this.logger.error("Failed to sign message",t),new Error("Failed to sign message")}}};function Ko(e){return new DataView(e.buffer,e.byteOffset)}const Ho={len:1,get:(e,t)=>Ko(e).getUint8(t),put:(e,t,i)=>(Ko(e).setUint8(t,i),t+1)},Wo={len:2,get:(e,t)=>Ko(e).getUint16(t,!0),put:(e,t,i)=>(Ko(e).setUint16(t,i,!0),t+2)},Vo={len:2,get:(e,t)=>Ko(e).getUint16(t),put:(e,t,i)=>(Ko(e).setUint16(t,i),t+2)},Go={len:4,get:(e,t)=>Ko(e).getUint32(t,!0),put:(e,t,i)=>(Ko(e).setUint32(t,i,!0),t+4)},Zo={len:4,get:(e,t)=>Ko(e).getUint32(t),put:(e,t,i)=>(Ko(e).setUint32(t,i),t+4)},Jo={len:4,get:(e,t)=>Ko(e).getInt32(t),put:(e,t,i)=>(Ko(e).setInt32(t,i),t+4)},Xo={len:8,get:(e,t)=>Ko(e).getBigUint64(t,!0),put:(e,t,i)=>(Ko(e).setBigUint64(t,i,!0),t+8)};let Yo=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t){return vi.from(e).toString(this.encoding,t,t+this.len)}};let Qo=class extends Error{constructor(){super("End-Of-Stream")}},ea=class{constructor(){this.resolve=()=>null,this.reject=()=>null,this.promise=new Promise(((e,t)=>{this.reject=t,this.resolve=e}))}},ta=class{constructor(){this.maxStreamReadSize=1048576,this.endOfStream=!1,this.peekQueue=[]}async peek(e,t,i){const n=await this.read(e,t,i);return this.peekQueue.push(e.subarray(t,t+n)),n}async read(e,t,i){if(0===i)return 0;let n=this.readFromPeekBuffer(e,t,i);if(n+=await this.readRemainderFromStream(e,t+n,i-n),0===n)throw new Qo;return n}readFromPeekBuffer(e,t,i){let n=i,o=0;for(;this.peekQueue.length>0&&n>0;){const i=this.peekQueue.pop();if(!i)throw new Error("peekData should be defined");const a=Math.min(i.length,n);e.set(i.subarray(0,a),t+o),o+=a,n-=a,a<i.length&&this.peekQueue.push(i.subarray(a))}return o}async readRemainderFromStream(e,t,i){let n=i,o=0;for(;n>0&&!this.endOfStream;){const i=Math.min(n,this.maxStreamReadSize),a=await this.readFromStream(e,t+o,i);if(0===a)break;o+=a,n-=a}return o}},ia=class extends ta{constructor(e){if(super(),this.s=e,this.deferred=null,!e.read||!e.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",(()=>this.reject(new Qo))),this.s.once("error",(e=>this.reject(e))),this.s.once("close",(()=>this.reject(new Error("Stream closed"))))}async readFromStream(e,t,i){if(this.endOfStream)return 0;const n=this.s.read(i);if(n)return e.set(n,t),n.length;const o={buffer:e,offset:t,length:i,deferred:new ea};return this.deferred=o.deferred,this.s.once("readable",(()=>{this.readDeferred(o)})),o.deferred.promise}readDeferred(e){const t=this.s.read(e.length);t?(e.buffer.set(t,e.offset),e.deferred.resolve(t.length),this.deferred=null):this.s.once("readable",(()=>{this.readDeferred(e)}))}reject(e){this.endOfStream=!0,this.deferred&&(this.deferred.reject(e),this.deferred=null)}async abort(){this.reject(new Error("abort"))}async close(){return this.abort()}},na=class{constructor(e){this.position=0,this.numBuffer=new Uint8Array(8),this.fileInfo=e||{}}async readToken(e,t=this.position){const i=new Uint8Array(e.len);if(await this.readBuffer(i,{position:t})<e.len)throw new Qo;return e.get(i,0)}async peekToken(e,t=this.position){const i=new Uint8Array(e.len);if(await this.peekBuffer(i,{position:t})<e.len)throw new Qo;return e.get(i,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new Qo;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new Qo;return e.get(this.numBuffer,0)}async ignore(e){if(void 0!==this.fileInfo.size){const t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){}normalizeOptions(e,t){if(t&&void 0!==t.position&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return t?{mayBeLess:!0===t.mayBeLess,offset:t.offset?t.offset:0,length:t.length?t.length:e.length-(t.offset?t.offset:0),position:t.position?t.position:this.position}:{mayBeLess:!1,offset:0,length:e.length,position:this.position}}};let oa=class extends na{constructor(e,t){super(t),this.streamReader=e}async getFileInfo(){return this.fileInfo}async readBuffer(e,t){const i=this.normalizeOptions(e,t),n=i.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(0===i.length)return 0;const o=await this.streamReader.read(e,i.offset,i.length);if(this.position+=o,(!t||!t.mayBeLess)&&o<i.length)throw new Qo;return o}async peekBuffer(e,t){const i=this.normalizeOptions(e,t);let n=0;if(i.position){const t=i.position-this.position;if(t>0){const o=new Uint8Array(i.length+t);return n=await this.peekBuffer(o,{mayBeLess:i.mayBeLess}),e.set(o.subarray(t),i.offset),n-t}if(t<0)throw new Error("Cannot peek from a negative offset in a stream")}if(i.length>0){try{n=await this.streamReader.peek(e,i.offset,i.length)}catch(o){if(t&&t.mayBeLess&&o instanceof Qo)return 0;throw o}if(!i.mayBeLess&&n<i.length)throw new Qo}return n}async ignore(e){const t=Math.min(256e3,e),i=new Uint8Array(t);let n=0;for(;n<e;){const o=e-n,a=await this.readBuffer(i,{length:Math.min(t,o)});if(a<0)return a;n+=a}return n}},aa=class extends na{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo.size=this.fileInfo.size?this.fileInfo.size:e.length}async readBuffer(e,t){if(t&&t.position){if(t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");this.position=t.position}const i=await this.peekBuffer(e,t);return this.position+=i,i}async peekBuffer(e,t){const i=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-i.position,i.length);if(!i.mayBeLess&&n<i.length)throw new Qo;return e.set(this.uint8Array.subarray(i.position,i.position+n),i.offset),n}async close(){}};const ra={get:(e,t)=>127&e[t+3]|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},sa=4100;function ca(e,t,i){i={offset:0,...i};for(const[n,o]of t.entries())if(i.mask){if(o!==(i.mask[n]&e[n+i.offset]))return!1}else if(o!==e[n+i.offset])return!1;return!0}let pa=class{constructor(e){this.detectors=null==e?void 0:e.customDetectors,this.fromTokenizer=this.fromTokenizer.bind(this),this.fromBuffer=this.fromBuffer.bind(this),this.parse=this.parse.bind(this)}async fromTokenizer(e){const t=e.position;for(const i of this.detectors||[]){const n=await i(e);if(n)return n;if(t!==e.position)return}return this.parse(e)}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof e}\``);const t=e instanceof Uint8Array?e:new Uint8Array(e);var i;if((null==t?void 0:t.length)>1)return this.fromTokenizer(new aa(t,i))}async fromBlob(e){const t=await e.arrayBuffer();return this.fromBuffer(new Uint8Array(t))}async fromStream(e){const t=await function(e,t){return t=t||{},new oa(new ia(e),t)}(e);try{return await this.fromTokenizer(t)}finally{await t.close()}}async toDetectionStream(e,t={}){const{default:i}=await Promise.resolve().then((()=>require("./standards-sdk.es34-ChBjKBbQ-DvtLNZWB.cjs"))).then((e=>e.i)),{sampleSize:n=sa}=t;return new Promise(((t,o)=>{e.on("error",o),e.once("readable",(()=>{(async()=>{try{const r=new i.PassThrough,s=i.pipeline?i.pipeline(e,r,(()=>{})):e.pipe(r),c=e.read(n)??e.read()??vi.alloc(0);try{r.fileType=await this.fromBuffer(c)}catch(a){a instanceof Qo?r.fileType=void 0:o(a)}t(s)}catch(a){o(a)}})()}))}))}check(e,t){return ca(this.buffer,e,t)}checkString(e,t){return this.check((i=e,[...i].map((e=>e.charCodeAt(0)))),t);var i}async parse(e){if(this.buffer=vi.alloc(sa),void 0===e.fileInfo.size&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:12,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.parse(e);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);const i=await e.readToken(ra);return e.position+i>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(i),this.fromTokenizer(e))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((67===this.buffer[0]||70===this.buffer[0])&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){try{for(;e.position+30<e.fileInfo.size;){await e.readBuffer(this.buffer,{length:30});const n={compressedSize:this.buffer.readUInt32LE(18),uncompressedSize:this.buffer.readUInt32LE(22),filenameLength:this.buffer.readUInt16LE(26),extraFieldLength:this.buffer.readUInt16LE(28)};if(n.filename=await e.readToken(new Yo(n.filenameLength,"utf-8")),await e.ignore(n.extraFieldLength),"META-INF/mozilla.rsa"===n.filename)return{ext:"xpi",mime:"application/x-xpinstall"};if(n.filename.endsWith(".rels")||n.filename.endsWith(".xml")){switch(n.filename.split("/")[0]){case"_rels":default:break;case"word":return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};case"ppt":return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};case"xl":return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}}}if(n.filename.startsWith("xl/"))return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(n.filename.startsWith("3D/")&&n.filename.endsWith(".model"))return{ext:"3mf",mime:"model/3mf"};if("mimetype"===n.filename&&n.compressedSize===n.uncompressedSize){let o=await e.readToken(new Yo(n.compressedSize,"utf-8"));switch(o=o.trim(),o){case"application/epub+zip":return{ext:"epub",mime:"application/epub+zip"};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"}}}if(0===n.compressedSize){let a=-1;for(;a<0&&e.position<e.fileInfo.size;)await e.peekBuffer(this.buffer,{mayBeLess:!0}),a=this.buffer.indexOf("504B0304",0,"hex"),await e.ignore(a>=0?a:this.buffer.length)}else await e.ignore(n.compressedSize)}}catch(t){if(!(t instanceof Qo))throw t}return{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);const r=vi.alloc(8);return await e.readBuffer(r),ca(r,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/opus"}:ca(r,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:ca(r,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:ca(r,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:ca(r,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:ca(r,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(3===this.buffer[2]||5===this.buffer[2]||7===this.buffer[2])&&(4===this.buffer[3]||6===this.buffer[3]||8===this.buffer[3]))return{ext:"zip",mime:"application/zip"};if(this.checkString("ftyp",{offset:4})&&96&this.buffer[8]){const s=this.buffer.toString("binary",8,12).replace("\0"," ").trim();switch(s){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return s.startsWith("3g")?s.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/x-flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF")){try{await e.ignore(1350);const c=10485760,p=vi.alloc(Math.min(c,e.fileInfo.size));if(await e.readBuffer(p,{mayBeLess:!0}),p.includes(vi.from("AIPrivateData")))return{ext:"ai",mime:"application/postscript"}}catch(t){if(!(t instanceof Qo))throw t}return{ext:"pdf",mime:"application/pdf"}}if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const l=await this.readTiffHeader(!1);if(l)return l}if(this.check([77,77])){const u=await this.readTiffHeader(!0);if(u)return u}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function d(){const t=await e.peekNumber(Ho);let i=128,n=0;for(;!(t&i)&&0!==i;)++n,i>>=1;const o=vi.alloc(n+1);return await e.readBuffer(o),o}async function m(){const e=await d(),t=await d();t[0]^=128>>t.length-1;const i=Math.min(6,t.length);return{id:e.readUIntBE(0,e.length),len:t.readUIntBE(t.length-i,i)}}async function f(t){for(;t>0;){const i=await m();if(17026===i.id){return(await e.readToken(new Yo(i.len,"utf-8"))).replace(/\00.*$/g,"")}await e.ignore(i.len),--t}}const h=await m();switch(await f(h.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/x-matroska"};default:return}}if(this.check([82,73,70,70])){if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1"))return{ext:"parquet",mime:"application/x-parquet"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(0===this.buffer[6]||1===this.buffer[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const g=this.buffer.toString("binary",2,6);if(g.match("^d*")&&g>=1e3&&g<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>")){await e.ignore(8);return"debian-binary"===await e.readToken(new Yo(13,"ascii"))?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"}}if(this.checkString("**ACE",{offset:7})&&(await e.peekBuffer(this.buffer,{length:14,mayBeLess:!0}),this.checkString("**",{offset:12})))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.check([137,80,78,71,13,10,26,10])){async function b(){return{length:await e.readToken(Jo),type:await e.readToken(new Yo(4,"binary"))}}await e.ignore(8);do{const x=await b();if(x.length<0)return;switch(x.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(x.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/x-apache-arrow"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function v(){const t=vi.alloc(16);return await e.readBuffer(t),{id:t,size:Number(await e.readToken(Xo))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){const y=await v();let w=y.size-24;if(ca(y.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const k=vi.alloc(16);if(w-=await e.readBuffer(k),ca(k,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(ca(k,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await e.ignore(w)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10])){await e.ignore(20);switch(await e.readToken(new Yo(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.check([0,60,0,63,0,120,0,109,0,108],{offset:2})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const I=this.buffer.readUInt32LE(12);if(I>12&&this.buffer.length>=I+16)try{const T=this.buffer.slice(16,I+16).toString();if(JSON.parse(T).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),function(e,t=0){const i=Number.parseInt(e.toString("utf8",148,154).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(i))return!1;let n=256;for(let o=t;o<t+148;o++)n+=e[o];for(let o=t+156;o<t+512;o++)n+=e[o];return i===n}(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254]))return this.check([60,0,63,0,120,0,109,0,108,0],{offset:2})?{ext:"xml",mime:"application/xml"}:this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:void 0;if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"};if(this.buffer.length>=2&&this.check([255,224],{offset:0,mask:[255,224]})){if(this.check([16],{offset:1,mask:[22]}))return this.check([8],{offset:1,mask:[8]}),{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}async readTiffTag(e){const t=await this.tokenizer.readToken(e?Vo:Wo);switch(this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(e){const t=await this.tokenizer.readToken(e?Vo:Wo);for(let i=0;i<t;++i){const t=await this.readTiffTag(e);if(t)return t}}async readTiffHeader(e){const t=(e?Vo:Wo).get(this.buffer,2),i=(e?Zo:Go).get(this.buffer,4);if(42===t){if(i>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(i>=8&&(this.check([28,0,254,0],{offset:8})||this.check([31,0,11,0],{offset:8})))return{ext:"nef",mime:"image/x-nikon-nef"}}await this.tokenizer.ignore(i);return await this.readTiffIFD(e)??{ext:"tif",mime:"image/tiff"}}if(43===t)return{ext:"tif",mime:"image/tiff"}}};new Set(["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx"]),new Set(["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/vnd.wave","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","audio/opus","video/ogg","audio/ogg","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/x-parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx"]);const la=class e{constructor(e){if(si(this,"client"),si(this,"config"),si(this,"logger",Mo.getInstance()),this.config=e,!e.apiKey)throw new Do("API key is required");if(!e.network)throw new Do("Network is required");const t={"x-api-key":e.apiKey,"Content-Type":"application/json"};this.client=Uo.create({baseURL:"https://v2-api.tier.bot/api",headers:t}),this.logger=Mo.getInstance()}async getFileMetadata(e){try{const t=await Uo.get(e),i=t.headers["content-type"]||"";return{size:parseInt(t.headers["content-length"]||"0",10),mimeType:i}}catch(t){throw this.logger.error("Error fetching file metadata:",t),new Do("Unable to fetch file metadata")}}getMimeType(t){const i=t.toLowerCase().split(".").pop();if(!i)throw new Do("File must have an extension");const n=e.VALID_MIME_TYPES[i];if(!n)throw new Do(`Unsupported file type: ${i}`);return n}validateRequest(t){if(this.logger.debug("Validating request:",t),!t.holderId||""===t.holderId.trim())throw this.logger.warn("holderId is missing or empty"),new Do("holderId is required");if(!e.VALID_MODES.includes(t.mode))throw new Do(`Invalid mode: ${t.mode}. Must be one of: ${e.VALID_MODES.join(", ")}`);if("hashinal"===t.mode&&!t.jsonFileURL&&!t.metadataObject)throw new Do("Hashinal mode requires either jsonFileURL or metadataObject");if(t.onlyJSONCollection&&"hashinal-collection"!==t.mode)throw new Do("onlyJSONCollection can only be used with hashinal-collection mode");this.validateFileInput(t.file)}normalizeMimeType(e){return"image/vnd.microsoft.icon"===e?(this.logger.debug("Normalizing MIME type from image/vnd.microsoft.icon to image/x-icon"),"image/x-icon"):e}validateMimeType(t){return!!Object.values(e.VALID_MIME_TYPES).includes(t)||"image/vnd.microsoft.icon"===t&&(this.logger.debug("Accepting alternative MIME type for ICO: image/vnd.microsoft.icon"),!0)}validateFileInput(t){if("base64"===t.type){if(!t.base64)throw new Do("Base64 data is required");const i=t.base64.replace(/^data:.*?;base64,/,"");if(Math.ceil(.75*i.length)>e.MAX_BASE64_SIZE)throw new Do(`File size exceeds maximum limit of ${e.MAX_BASE64_SIZE/1024/1024}MB`);const n=t.mimeType||this.getMimeType(t.fileName);if(!this.validateMimeType(n))throw new Do("File must have one of the supported MIME types");"image/vnd.microsoft.icon"===t.mimeType&&(t.mimeType=this.normalizeMimeType(t.mimeType))}else if("url"===t.type&&!t.url)throw new Do("URL is required")}async detectMimeTypeFromBase64(e){if(e.startsWith("data:")){const t=e.match(/^data:([^;]+);base64,/);if(t&&t.length>1)return t[1]}try{const t=e.replace(/\s/g,""),i=xi.from(t,"base64"),n=await async function(e){return(new pa).fromBuffer(e)}(i);return(null==n?void 0:n.mime)||"application/octet-stream"}catch(t){return this.logger.warn("Failed to detect MIME type from buffer"),"application/octet-stream"}}async startInscription(t){var i,n;try{this.validateRequest(t);let i=t.file.mimeType;if("url"===t.file.type){const n=await this.getFileMetadata(t.file.url);if(i=n.mimeType||i,n.size>e.MAX_URL_FILE_SIZE)throw new Do(`File size exceeds maximum URL file limit of ${e.MAX_URL_FILE_SIZE/1024/1024}MB`)}else"base64"===t.file.type&&(i=await this.detectMimeTypeFromBase64(t.file.base64));if("image/vnd.microsoft.icon"===i&&(i=this.normalizeMimeType(i)),t.jsonFileURL){if("application/json"!==(await this.getFileMetadata(t.jsonFileURL)).mimeType)throw new Do("JSON file must be of type application/json")}const n={holderId:t.holderId,mode:t.mode,network:this.config.network,onlyJSONCollection:t.onlyJSONCollection?1:0,creator:t.creator,description:t.description,fileStandard:t.fileStandard,metadataObject:t.metadataObject,jsonFileURL:t.jsonFileURL};let o;return o="url"===t.file.type?await this.client.post("/inscriptions/start-inscription",{...n,fileURL:t.file.url}):await this.client.post("/inscriptions/start-inscription",{...n,fileBase64:t.file.base64,fileName:t.file.fileName,fileMimeType:i||this.getMimeType(t.file.fileName)}),o.data}catch(o){if(o instanceof Do)throw o;if(Uo.isAxiosError(o))throw new Error((null==(n=null==(i=o.response)?void 0:i.data)?void 0:n.message)||"Failed to start inscription");throw o}}async executeTransaction(e,t){try{const n="mainnet"===t.network?i.Client.forMainnet():i.Client.forTestnet(),o=i.PrivateKey.fromString(t.privateKey);n.setOperator(t.accountId,o);const a=i.TransferTransaction.fromBytes(xi.from(e,"base64")),r=await a.sign(o),s=await r.execute(n),c=(await s.getReceipt(n)).status.toString();if("SUCCESS"!==c)throw new Error(`Transaction failed with status: ${c}`);return s.transactionId.toString()}catch(n){throw new Error(`Failed to execute transaction: ${n instanceof Error?n.message:"Unknown error"}`)}}async executeTransactionWithSigner(e,t){try{const n=i.TransferTransaction.fromBytes(xi.from(e,"base64")),o=await n.executeWithSigner(t),a=(await o.getReceiptWithSigner(t)).status.toString();if("SUCCESS"!==a)throw new Error(`Transaction failed with status: ${a}`);return o.transactionId.toString()}catch(n){throw new Error(`Failed to execute transaction: ${n instanceof Error?n.message:"Unknown error"}`)}}async inscribeAndExecute(e,t){const i=await this.startInscription(e);if(!i.transactionBytes)throw this.logger.error("No transaction bytes returned from inscription request",i),new Error("No transaction bytes returned from inscription request");this.logger.info("executing transaction");const n=await this.executeTransaction(i.transactionBytes,t);return{jobId:i.tx_id,transactionId:n}}async inscribe(e,t){const i=await this.startInscription(e);if(!i.transactionBytes)throw this.logger.error("No transaction bytes returned from inscription request",i),new Error("No transaction bytes returned from inscription request");this.logger.info("executing transaction");const n=await this.executeTransactionWithSigner(i.transactionBytes,t);return{jobId:i.tx_id,transactionId:n}}async retryWithBackoff(e,t=3,i=1e3){for(let o=0;o<t;o++)try{return await e()}catch(n){if(o===t-1)throw n;const e=i*Math.pow(2,o);await new Promise((t=>setTimeout(t,e))),this.logger.debug(`Retry attempt ${o+1}/${t} after ${e}ms delay`)}throw new Error("Retry operation failed")}async retrieveInscription(e){if(!e)throw new Do("Transaction ID is required");try{return await this.retryWithBackoff((async()=>{const t=(await this.client.get(`/inscriptions/retrieve-inscription?id=${e}`)).data;return{...t,jobId:t.id}}))}catch(t){throw this.logger.error("Failed to retrieve inscription:",t),t}}async getInscriptionNumbers(e={}){try{return(await this.client.get("/inscriptions/numbers",{params:e})).data}catch(t){throw this.logger.error("Failed to fetch inscription numbers:",t),t}}static async authenticate(e){return new zo(e).authenticate()}static async createWithAuth(t){const i="client"===t.type?new qo({...t,logger:Mo.getInstance()}):new zo(t),{apiKey:n}=await i.authenticate();return new e({apiKey:n,network:t.network||"mainnet"})}async waitForInscription(e,t=30,i=4e3,n=!1,o){var a;let r=0,s=0;const c=(i,n,a,c)=>{if(o)try{s=Math.max(s,a),o({stage:i,message:n,progressPercent:s,details:{...c,txId:e,currentAttempt:r,maxAttempts:t}})}catch(p){this.logger.warn(`Error in progress callback: ${p}`)}};for(c("confirming","Starting inscription verification",0);r<t;){c("confirming",`Verifying inscription status (attempt ${r+1}/${t})`,5,{attempt:r+1});const o=await this.retrieveInscription(e);if(o.error)throw c("verifying",`Error: ${o.error}`,100,{error:o.error}),new Error(o.error);let s=5;void 0!==o.messages&&void 0!==o.maxMessages&&o.maxMessages>0?(s=Math.min(95,5+o.messages/o.maxMessages*90),o.completed&&(s=100)):"processing"===o.status?s=10:o.completed&&(s=100),c(o.completed?"completed":"confirming",o.completed?"Inscription completed successfully":`Processing inscription (${o.status})`,s,{status:o.status,messagesProcessed:o.messages,maxMessages:o.maxMessages,messageCount:o.messages,completed:o.completed,confirmedMessages:o.confirmedMessages,result:o});const p="hashinal"===o.mode,l="6"===(null==(a=o.fileStandard)?void 0:a.toString());if(p&&o.topic_id&&o.jsonTopicId&&(!n||o.completed))return c("completed","Inscription verification complete",100,{result:o}),o;if(!p&&!l&&o.topic_id&&(!n||o.completed))return c("completed","Inscription verification complete",100,{result:o}),o;if(l&&o.topic_id&&o.jsonTopicId&&o.registryTopicId&&(!n||o.completed))return c("completed","Inscription verification complete",100,{result:o}),o;await new Promise((e=>setTimeout(e,i))),r++}throw c("verifying",`Inscription ${e} did not complete within ${t} attempts`,100,{timedOut:!0}),new Error(`Inscription ${e} did not complete within ${t} attempts`)}async getHolderInscriptions(e){var t,i;if(!e.holderId)throw new Do("Holder ID is required");try{const t={holderId:e.holderId};e.includeCollections&&(t.includeCollections="1");return(await this.client.get("/inscriptions/holder-inscriptions",{params:t})).data}catch(n){if(this.logger.error("Failed to fetch holder inscriptions:",n),Uo.isAxiosError(n))throw new Error((null==(i=null==(t=n.response)?void 0:t.data)?void 0:i.message)||"Failed to fetch holder inscriptions");throw n}}};si(la,"VALID_MODES",["file","upload","hashinal","hashinal-collection"]),si(la,"MAX_BASE64_SIZE",2097152),si(la,"MAX_URL_FILE_SIZE",104857600),si(la,"VALID_MIME_TYPES",{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",ico:"image/x-icon",heic:"image/heic",heif:"image/heif",bmp:"image/bmp",webp:"image/webp",tiff:"image/tiff",tif:"image/tiff",svg:"image/svg+xml",mp4:"video/mp4",webm:"video/webm",mp3:"audio/mpeg",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",html:"text/html",htm:"text/html",css:"text/css",php:"application/x-httpd-php",java:"text/x-java-source",js:"application/javascript",mjs:"application/javascript",csv:"text/csv",json:"application/json",txt:"text/plain",glb:"model/gltf-binary",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",flac:"audio/flac",aac:"audio/aac",m4a:"audio/mp4",avi:"video/x-msvideo",mov:"video/quicktime",mkv:"video/x-matroska",m4v:"video/mp4",mpg:"video/mpeg",mpeg:"video/mpeg",ts:"application/typescript",zip:"application/zip",rar:"application/vnd.rar",tar:"application/x-tar",gz:"application/gzip","7z":"application/x-7z-compressed",xml:"application/xml",yaml:"application/yaml",yml:"application/yaml",md:"text/markdown",markdown:"text/markdown",rtf:"application/rtf",gltf:"model/gltf+json",usdz:"model/vnd.usdz+zip",obj:"model/obj",stl:"model/stl",fbx:"application/octet-stream",ttf:"font/ttf",otf:"font/otf",woff:"font/woff",woff2:"font/woff2",eot:"application/vnd.ms-fontobject",psd:"application/vnd.adobe.photoshop",ai:"application/postscript",eps:"application/postscript",ps:"application/postscript",sqlite:"application/x-sqlite3",db:"application/x-sqlite3",apk:"application/vnd.android.package-archive",ics:"text/calendar",vcf:"text/vcard",py:"text/x-python",rb:"text/x-ruby",go:"text/x-go",rs:"text/x-rust",typescript:"application/typescript",jsx:"text/jsx",tsx:"text/tsx",sql:"application/sql",toml:"application/toml",avif:"image/avif",jxl:"image/jxl",weba:"audio/webm"});var ua={};const da={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}};
20
20
  /*!
21
21
  * mime-db
22
22
  * Copyright(c) 2014 Jonathan Ong
@@ -28,5 +28,5 @@ read:function(e,t,i,n,o){var a,r,s=8*o-n-1,c=(1<<s)-1,p=c>>1,l=-7,u=i?o-1:0,d=i?
28
28
  * Copyright(c) 2014 Jonathan Ong
29
29
  * Copyright(c) 2015 Douglas Christopher Wilson
30
30
  * MIT Licensed
31
- */().extname,r=/^\s*([^;\s]*)(?:;|\s|$)/,s=/^text\//i;function c(e){if(!e||"string"!=typeof e)return!1;var t=r.exec(e),i=t&&o[t[1].toLowerCase()];return i&&i.charset?i.charset:!(!t||!s.test(t[1]))&&"UTF-8"}e.charset=c,e.charsets={lookup:c},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var i=-1===t.indexOf("/")?e.lookup(t):t;if(!i)return!1;if(-1===i.indexOf("charset")){var n=e.charset(i);n&&(i+="; charset="+n.toLowerCase())}return i},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var i=r.exec(t),n=i&&e.extensions[i[1].toLowerCase()];return!(!n||!n.length)&&n[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var i=a("x."+t).toLowerCase().substr(1);return i&&e.types[i]||!1},e.types=Object.create(null),t=e.extensions,i=e.types,n=["nginx","apache",void 0,"iana"],Object.keys(o).forEach((function(e){var a=o[e],r=a.extensions;if(r&&r.length){t[e]=r;for(var s=0;s<r.length;s++){var c=r[s];if(i[c]){var p=n.indexOf(o[i[c]].source),l=n.indexOf(a.source);if("application/octet-stream"!==i[c]&&(p>l||p===l&&"application/"===i[c].substr(0,12)))continue}i[c]=e}}}))}(ua)),(va=xa||(xa={})).assertEqual=e=>{},va.assertIs=function(e){},va.assertNever=function(e){throw new Error},va.arrayToEnum=e=>{const t={};for(const i of e)t[i]=i;return t},va.getValidEnumValues=e=>{const t=va.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),i={};for(const n of t)i[n]=e[n];return va.objectValues(i)},va.objectValues=e=>va.objectKeys(e).map((function(t){return e[t]})),va.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.push(i);return t},va.find=(e,t)=>{for(const i of e)if(t(i))return i},va.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,va.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},va.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(ya||(ya={})).mergeShapes=(e,t)=>({...e,...t});const wa=xa.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ka=e=>{switch(typeof e){case"undefined":return wa.undefined;case"string":return wa.string;case"number":return Number.isNaN(e)?wa.nan:wa.number;case"boolean":return wa.boolean;case"function":return wa.function;case"bigint":return wa.bigint;case"symbol":return wa.symbol;case"object":return Array.isArray(e)?wa.array:null===e?wa.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?wa.promise:"undefined"!=typeof Map&&e instanceof Map?wa.map:"undefined"!=typeof Set&&e instanceof Set?wa.set:"undefined"!=typeof Date&&e instanceof Date?wa.date:wa.object;default:return wa.unknown}},Ia=xa.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ta extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},i={_errors:[]},n=e=>{for(const o of e.issues)if("invalid_union"===o.code)o.unionErrors.map(n);else if("invalid_return_type"===o.code)n(o.returnTypeError);else if("invalid_arguments"===o.code)n(o.argumentsError);else if(0===o.path.length)i._errors.push(t(o));else{let e=i,n=0;for(;n<o.path.length;){const i=o.path[n];n===o.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(t(o))):e[i]=e[i]||{_errors:[]},e=e[i],n++}}};return n(this),i}static assert(e){if(!(e instanceof Ta))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,xa.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},i=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}}Ta.create=e=>new Ta(e);const Sa=(e,t)=>{let i;switch(e.code){case Ia.invalid_type:i=e.received===wa.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Ia.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(e.expected,xa.jsonStringifyReplacer)}`;break;case Ia.unrecognized_keys:i=`Unrecognized key(s) in object: ${xa.joinValues(e.keys,", ")}`;break;case Ia.invalid_union:i="Invalid input";break;case Ia.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${xa.joinValues(e.options)}`;break;case Ia.invalid_enum_value:i=`Invalid enum value. Expected ${xa.joinValues(e.options)}, received '${e.received}'`;break;case Ia.invalid_arguments:i="Invalid function arguments";break;case Ia.invalid_return_type:i="Invalid function return type";break;case Ia.invalid_date:i="Invalid date";break;case Ia.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(i=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(i=`${i} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?i=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?i=`Invalid input: must end with "${e.validation.endsWith}"`:xa.assertNever(e.validation):i="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Ia.too_small:i="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Ia.too_big:i="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Ia.custom:i="Invalid input";break;case Ia.invalid_intersection_types:i="Intersection results could not be merged";break;case Ia.not_multiple_of:i=`Number must be a multiple of ${e.multipleOf}`;break;case Ia.not_finite:i="Number must be finite";break;default:i=t.defaultError,xa.assertNever(e)}return{message:i}};let Aa=Sa;function Ea(e,t){const i=Aa,n=(e=>{const{data:t,path:i,errorMaps:n,issueData:o}=e,a=[...i,...o.path||[]],r={...o,path:a};if(void 0!==o.message)return{...o,path:a,message:o.message};let s="";const c=n.filter((e=>!!e)).slice().reverse();for(const p of c)s=p(r,{data:t,defaultError:s}).message;return{...o,path:a,message:s}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,i,i===Sa?void 0:Sa].filter((e=>!!e))});e.common.issues.push(n)}class _a{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const i=[];for(const n of t){if("aborted"===n.status)return Ca;"dirty"===n.status&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const i=[];for(const n of t){const e=await n.key,t=await n.value;i.push({key:e,value:t})}return _a.mergeObjectSync(e,i)}static mergeObjectSync(e,t){const i={};for(const n of t){const{key:t,value:o}=n;if("aborted"===t.status)return Ca;if("aborted"===o.status)return Ca;"dirty"===t.status&&e.dirty(),"dirty"===o.status&&e.dirty(),"__proto__"===t.value||void 0===o.value&&!n.alwaysSet||(i[t.value]=o.value)}return{status:e.value,value:i}}}const Ca=Object.freeze({status:"aborted"}),Ra=e=>({status:"dirty",value:e}),Na=e=>({status:"valid",value:e}),Pa=e=>"aborted"===e.status,Oa=e=>"dirty"===e.status,ja=e=>"valid"===e.status,$a=e=>"undefined"!=typeof Promise&&e instanceof Promise;var Fa,La;(La=Fa||(Fa={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},La.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class Ua{constructor(e,t,i,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ba=(e,t)=>{if(ja(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ta(e.common.issues);return this._error=t,this._error}}};function Ma(e){if(!e)return{};const{errorMap:t,invalid_type_error:i,required_error:n,description:o}=e;if(t&&(i||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:o};return{errorMap:(t,o)=>{const{message:a}=e;return"invalid_enum_value"===t.code?{message:a??o.defaultError}:void 0===o.data?{message:a??n??o.defaultError}:"invalid_type"!==t.code?{message:o.defaultError}:{message:a??i??o.defaultError}},description:o}}class Da{get description(){return this._def.description}_getType(e){return ka(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ka(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _a,ctx:{common:e.parent.common,data:e.data,parsedType:ka(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if($a(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){const i={common:{issues:[],async:(null==t?void 0:t.async)??!1,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ka(e)},n=this._parseSync({data:e,path:i.path,parent:i});return Ba(i,n)}"~validate"(e){var t,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ka(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:n});return ja(t)?{value:t.value}:{issues:n.common.issues}}catch(o){(null==(i=null==(t=null==o?void 0:o.message)?void 0:t.toLowerCase())?void 0:i.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then((e=>ja(e)?{value:e.value}:{issues:n.common.issues}))}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ka(e)},n=this._parse({data:e,path:i.path,parent:i}),o=await($a(n)?n:Promise.resolve(n));return Ba(i,o)}refine(e,t){const i=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const o=e(t),a=()=>n.addIssue({code:Ia.custom,...i(t)});return"undefined"!=typeof Promise&&o instanceof Promise?o.then((e=>!!e||(a(),!1))):!!o||(a(),!1)}))}refinement(e,t){return this._refinement(((i,n)=>!!e(i)||(n.addIssue("function"==typeof t?t(i,n):t),!1)))}_refinement(e){return new Ur({schema:this,typeName:Vr.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Br.create(this,this._def)}nullable(){return Mr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return kr.create(this)}promise(){return Lr.create(this,this._def)}or(e){return Sr.create([this,e],this._def)}and(e){return Er.create(this,e,this._def)}transform(e){return new Ur({...Ma(this._def),schema:this,typeName:Vr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Dr({...Ma(this._def),innerType:this,defaultValue:t,typeName:Vr.ZodDefault})}brand(){return new Kr({typeName:Vr.ZodBranded,type:this,...Ma(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new zr({...Ma(this._def),innerType:this,catchValue:t,typeName:Vr.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Wr.create(this,e)}readonly(){return Hr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const za=/^c[^\s-]{8,}$/i,qa=/^[0-9a-z]+$/,Ka=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Wa=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ha=/^[a-z0-9_-]{21}$/i,Va=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ga=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Za=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Ja;const Xa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ya=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Qa=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,er=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ir=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",or=new RegExp(`^${nr}$`);function ar(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function rr(e){let t=`${nr}T${ar(e)}`;const i=[];return i.push(e.local?"Z?":"Z"),e.offset&&i.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${i.join("|")})`,new RegExp(`^${t}$`)}function sr(e,t){if(!Va.test(e))return!1;try{const[i]=e.split("."),n=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),o=JSON.parse(atob(n));return"object"==typeof o&&null!==o&&((!("typ"in o)||"JWT"===(null==o?void 0:o.typ))&&(!!o.alg&&(!t||o.alg===t)))}catch{return!1}}function cr(e,t){return!("v4"!==t&&t||!Ya.test(e))||!("v6"!==t&&t||!er.test(e))}class pr extends Da{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==wa.string){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.string,received:t.parsedType}),Ca}const t=new _a;let i;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const n=e.data.length>a.value,o=e.data.length<a.value;(n||o)&&(i=this._getOrReturnCtx(e,i),n?Ea(i,{code:Ia.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&Ea(i,{code:Ia.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)Za.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"email",code:Ia.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)Ja||(Ja=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ja.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"emoji",code:Ia.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)Wa.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"uuid",code:Ia.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)Ha.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"nanoid",code:Ia.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)za.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"cuid",code:Ia.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)qa.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"cuid2",code:Ia.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)Ka.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"ulid",code:Ia.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Ea(i,{validation:"url",code:Ia.invalid_string,message:a.message}),t.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"regex",code:Ia.invalid_string,message:a.message}),t.dirty())}else if("trim"===a.kind)e.data=e.data.trim();else if("includes"===a.kind)e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty());else if("toLowerCase"===a.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===a.kind)e.data=e.data.toUpperCase();else if("startsWith"===a.kind)e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty());else if("endsWith"===a.kind)e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty());else if("datetime"===a.kind){rr(a).test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.invalid_string,validation:"datetime",message:a.message}),t.dirty())}else if("date"===a.kind){or.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.invalid_string,validation:"date",message:a.message}),t.dirty())}else if("time"===a.kind){new RegExp(`^${ar(a)}$`).test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.invalid_string,validation:"time",message:a.message}),t.dirty())}else"duration"===a.kind?Ga.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"duration",code:Ia.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?(n=e.data,("v4"!==(o=a.version)&&o||!Xa.test(n))&&("v6"!==o&&o||!Qa.test(n))&&(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"ip",code:Ia.invalid_string,message:a.message}),t.dirty())):"jwt"===a.kind?sr(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"jwt",code:Ia.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?cr(e.data,a.version)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"cidr",code:Ia.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?tr.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"base64",code:Ia.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?ir.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"base64url",code:Ia.invalid_string,message:a.message}),t.dirty()):xa.assertNever(a);var n,o;return{status:t.value,value:e.data}}_regex(e,t,i){return this.refinement((t=>e.test(t)),{validation:t,code:Ia.invalid_string,...Fa.errToObj(i)})}_addCheck(e){return new pr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Fa.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Fa.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Fa.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Fa.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Fa.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Fa.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Fa.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Fa.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Fa.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Fa.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Fa.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Fa.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Fa.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:(null==e?void 0:e.offset)??!1,local:(null==e?void 0:e.local)??!1,...Fa.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Fa.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Fa.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Fa.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Fa.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Fa.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Fa.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Fa.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Fa.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Fa.errToObj(t)})}nonempty(e){return this.min(1,Fa.errToObj(e))}trim(){return new pr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new pr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new pr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function lr(e,t){const i=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=i>n?i:n;return Number.parseInt(e.toFixed(o).replace(".",""))%Number.parseInt(t.toFixed(o).replace(".",""))/10**o}pr.create=e=>new pr({checks:[],typeName:Vr.ZodString,coerce:(null==e?void 0:e.coerce)??!1,...Ma(e)});class ur extends Da{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==wa.number){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.number,received:t.parsedType}),Ca}let t;const i=new _a;for(const n of this._def.checks)if("int"===n.kind)xa.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty())}else"multipleOf"===n.kind?0!==lr(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.not_finite,message:n.message}),i.dirty()):xa.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Fa.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Fa.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Fa.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Fa.toString(t))}setLimit(e,t,i,n){return new ur({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:Fa.toString(n)}]})}_addCheck(e){return new ur({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Fa.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Fa.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Fa.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Fa.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Fa.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Fa.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Fa.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Fa.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Fa.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&xa.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if("finite"===i.kind||"int"===i.kind||"multipleOf"===i.kind)return!0;"min"===i.kind?(null===t||i.value>t)&&(t=i.value):"max"===i.kind&&(null===e||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ur.create=e=>new ur({checks:[],typeName:Vr.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Ma(e)});class dr extends Da{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==wa.bigint)return this._getInvalidInput(e);let t;const i=new _a;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):xa.assertNever(n);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.bigint,received:t.parsedType}),Ca}gte(e,t){return this.setLimit("min",e,!0,Fa.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Fa.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Fa.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Fa.toString(t))}setLimit(e,t,i,n){return new dr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:Fa.toString(n)}]})}_addCheck(e){return new dr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Fa.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Fa.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Fa.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Fa.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Fa.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}dr.create=e=>new dr({checks:[],typeName:Vr.ZodBigInt,coerce:(null==e?void 0:e.coerce)??!1,...Ma(e)});class mr extends Da{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==wa.boolean){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.boolean,received:t.parsedType}),Ca}return Na(e.data)}}mr.create=e=>new mr({typeName:Vr.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Ma(e)});class fr extends Da{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==wa.date){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.date,received:t.parsedType}),Ca}if(Number.isNaN(e.data.getTime())){return Ea(this._getOrReturnCtx(e),{code:Ia.invalid_date}),Ca}const t=new _a;let i;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):xa.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new fr({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Fa.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Fa.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}fr.create=e=>new fr({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Vr.ZodDate,...Ma(e)});class hr extends Da{_parse(e){if(this._getType(e)!==wa.symbol){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.symbol,received:t.parsedType}),Ca}return Na(e.data)}}hr.create=e=>new hr({typeName:Vr.ZodSymbol,...Ma(e)});class gr extends Da{_parse(e){if(this._getType(e)!==wa.undefined){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.undefined,received:t.parsedType}),Ca}return Na(e.data)}}gr.create=e=>new gr({typeName:Vr.ZodUndefined,...Ma(e)});class br extends Da{_parse(e){if(this._getType(e)!==wa.null){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.null,received:t.parsedType}),Ca}return Na(e.data)}}br.create=e=>new br({typeName:Vr.ZodNull,...Ma(e)});class xr extends Da{constructor(){super(...arguments),this._any=!0}_parse(e){return Na(e.data)}}xr.create=e=>new xr({typeName:Vr.ZodAny,...Ma(e)});class vr extends Da{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Na(e.data)}}vr.create=e=>new vr({typeName:Vr.ZodUnknown,...Ma(e)});class yr extends Da{_parse(e){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.never,received:t.parsedType}),Ca}}yr.create=e=>new yr({typeName:Vr.ZodNever,...Ma(e)});class wr extends Da{_parse(e){if(this._getType(e)!==wa.undefined){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.void,received:t.parsedType}),Ca}return Na(e.data)}}wr.create=e=>new wr({typeName:Vr.ZodVoid,...Ma(e)});class kr extends Da{_parse(e){const{ctx:t,status:i}=this._processInputParams(e),n=this._def;if(t.parsedType!==wa.array)return Ea(t,{code:Ia.invalid_type,expected:wa.array,received:t.parsedType}),Ca;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(e||o)&&(Ea(t,{code:e?Ia.too_big:Ia.too_small,minimum:o?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(Ea(t,{code:Ia.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(Ea(t,{code:Ia.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map(((e,i)=>n.type._parseAsync(new Ua(t,e,t.path,i))))).then((e=>_a.mergeArray(i,e)));const o=[...t.data].map(((e,i)=>n.type._parseSync(new Ua(t,e,t.path,i))));return _a.mergeArray(i,o)}get element(){return this._def.type}min(e,t){return new kr({...this._def,minLength:{value:e,message:Fa.toString(t)}})}max(e,t){return new kr({...this._def,maxLength:{value:e,message:Fa.toString(t)}})}length(e,t){return new kr({...this._def,exactLength:{value:e,message:Fa.toString(t)}})}nonempty(e){return this.min(1,e)}}function Ir(e){if(e instanceof Tr){const t={};for(const i in e.shape){const n=e.shape[i];t[i]=Br.create(Ir(n))}return new Tr({...e._def,shape:()=>t})}return e instanceof kr?new kr({...e._def,type:Ir(e.element)}):e instanceof Br?Br.create(Ir(e.unwrap())):e instanceof Mr?Mr.create(Ir(e.unwrap())):e instanceof _r?_r.create(e.items.map((e=>Ir(e)))):e}kr.create=(e,t)=>new kr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Vr.ZodArray,...Ma(t)});class Tr extends Da{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=xa.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==wa.object){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.object,received:t.parsedType}),Ca}const{status:t,ctx:i}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof yr&&"strip"===this._def.unknownKeys))for(const s in i.data)o.includes(s)||a.push(s);const r=[];for(const s of o){const e=n[s],t=i.data[s];r.push({key:{status:"valid",value:s},value:e._parse(new Ua(i,t,i.path,s)),alwaysSet:s in i.data})}if(this._def.catchall instanceof yr){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of a)r.push({key:{status:"valid",value:t},value:{status:"valid",value:i.data[t]}});else if("strict"===e)a.length>0&&(Ea(i,{code:Ia.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const n=i.data[t];r.push({key:{status:"valid",value:t},value:e._parse(new Ua(i,n,i.path,t)),alwaysSet:t in i.data})}}return i.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of r){const i=await t.key,n=await t.value;e.push({key:i,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>_a.mergeObjectSync(t,e))):_a.mergeObjectSync(t,r)}get shape(){return this._def.shape()}strict(e){return Fa.errToObj,new Tr({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,i)=>{var n,o;const a=(null==(o=(n=this._def).errorMap)?void 0:o.call(n,t,i).message)??i.defaultError;return"unrecognized_keys"===t.code?{message:Fa.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Tr({...this._def,unknownKeys:"strip"})}passthrough(){return new Tr({...this._def,unknownKeys:"passthrough"})}extend(e){return new Tr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Tr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Vr.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Tr({...this._def,catchall:e})}pick(e){const t={};for(const i of xa.objectKeys(e))e[i]&&this.shape[i]&&(t[i]=this.shape[i]);return new Tr({...this._def,shape:()=>t})}omit(e){const t={};for(const i of xa.objectKeys(this.shape))e[i]||(t[i]=this.shape[i]);return new Tr({...this._def,shape:()=>t})}deepPartial(){return Ir(this)}partial(e){const t={};for(const i of xa.objectKeys(this.shape)){const n=this.shape[i];e&&!e[i]?t[i]=n:t[i]=n.optional()}return new Tr({...this._def,shape:()=>t})}required(e){const t={};for(const i of xa.objectKeys(this.shape))if(e&&!e[i])t[i]=this.shape[i];else{let e=this.shape[i];for(;e instanceof Br;)e=e._def.innerType;t[i]=e}return new Tr({...this._def,shape:()=>t})}keyof(){return jr(xa.objectKeys(this.shape))}}Tr.create=(e,t)=>new Tr({shape:()=>e,unknownKeys:"strip",catchall:yr.create(),typeName:Vr.ZodObject,...Ma(t)}),Tr.strictCreate=(e,t)=>new Tr({shape:()=>e,unknownKeys:"strict",catchall:yr.create(),typeName:Vr.ZodObject,...Ma(t)}),Tr.lazycreate=(e,t)=>new Tr({shape:e,unknownKeys:"strip",catchall:yr.create(),typeName:Vr.ZodObject,...Ma(t)});class Sr extends Da{_parse(e){const{ctx:t}=this._processInputParams(e),i=this._def.options;if(t.common.async)return Promise.all(i.map((async e=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const i=e.map((e=>new Ta(e.ctx.common.issues)));return Ea(t,{code:Ia.invalid_union,unionErrors:i}),Ca}));{let e;const n=[];for(const a of i){const i={...t,common:{...t.common,issues:[]},parent:null},o=a._parseSync({data:t.data,path:t.path,parent:i});if("valid"===o.status)return o;"dirty"!==o.status||e||(e={result:o,ctx:i}),i.common.issues.length&&n.push(i.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const o=n.map((e=>new Ta(e)));return Ea(t,{code:Ia.invalid_union,unionErrors:o}),Ca}}get options(){return this._def.options}}function Ar(e,t){const i=ka(e),n=ka(t);if(e===t)return{valid:!0,data:e};if(i===wa.object&&n===wa.object){const i=xa.objectKeys(t),n=xa.objectKeys(e).filter((e=>-1!==i.indexOf(e))),o={...e,...t};for(const a of n){const i=Ar(e[a],t[a]);if(!i.valid)return{valid:!1};o[a]=i.data}return{valid:!0,data:o}}if(i===wa.array&&n===wa.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let n=0;n<e.length;n++){const o=Ar(e[n],t[n]);if(!o.valid)return{valid:!1};i.push(o.data)}return{valid:!0,data:i}}return i===wa.date&&n===wa.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}Sr.create=(e,t)=>new Sr({options:e,typeName:Vr.ZodUnion,...Ma(t)});class Er extends Da{_parse(e){const{status:t,ctx:i}=this._processInputParams(e),n=(e,n)=>{if(Pa(e)||Pa(n))return Ca;const o=Ar(e.value,n.value);return o.valid?((Oa(e)||Oa(n))&&t.dirty(),{status:t.value,value:o.data}):(Ea(i,{code:Ia.invalid_intersection_types}),Ca)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}Er.create=(e,t,i)=>new Er({left:e,right:t,typeName:Vr.ZodIntersection,...Ma(i)});class _r extends Da{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==wa.array)return Ea(i,{code:Ia.invalid_type,expected:wa.array,received:i.parsedType}),Ca;if(i.data.length<this._def.items.length)return Ea(i,{code:Ia.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ca;!this._def.rest&&i.data.length>this._def.items.length&&(Ea(i,{code:Ia.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...i.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Ua(i,e,i.path,t)):null})).filter((e=>!!e));return i.common.async?Promise.all(n).then((e=>_a.mergeArray(t,e))):_a.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new _r({...this._def,rest:e})}}_r.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _r({items:e,typeName:Vr.ZodTuple,rest:null,...Ma(t)})};class Cr extends Da{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==wa.object)return Ea(i,{code:Ia.invalid_type,expected:wa.object,received:i.parsedType}),Ca;const n=[],o=this._def.keyType,a=this._def.valueType;for(const r in i.data)n.push({key:o._parse(new Ua(i,r,i.path,r)),value:a._parse(new Ua(i,i.data[r],i.path,r)),alwaysSet:r in i.data});return i.common.async?_a.mergeObjectAsync(t,n):_a.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,i){return new Cr(t instanceof Da?{keyType:e,valueType:t,typeName:Vr.ZodRecord,...Ma(i)}:{keyType:pr.create(),valueType:e,typeName:Vr.ZodRecord,...Ma(t)})}}class Rr extends Da{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==wa.map)return Ea(i,{code:Ia.invalid_type,expected:wa.map,received:i.parsedType}),Ca;const n=this._def.keyType,o=this._def.valueType,a=[...i.data.entries()].map((([e,t],a)=>({key:n._parse(new Ua(i,e,i.path,[a,"key"])),value:o._parse(new Ua(i,t,i.path,[a,"value"]))})));if(i.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const i of a){const n=await i.key,o=await i.value;if("aborted"===n.status||"aborted"===o.status)return Ca;"dirty"!==n.status&&"dirty"!==o.status||t.dirty(),e.set(n.value,o.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const i of a){const n=i.key,o=i.value;if("aborted"===n.status||"aborted"===o.status)return Ca;"dirty"!==n.status&&"dirty"!==o.status||t.dirty(),e.set(n.value,o.value)}return{status:t.value,value:e}}}}Rr.create=(e,t,i)=>new Rr({valueType:t,keyType:e,typeName:Vr.ZodMap,...Ma(i)});class Nr extends Da{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==wa.set)return Ea(i,{code:Ia.invalid_type,expected:wa.set,received:i.parsedType}),Ca;const n=this._def;null!==n.minSize&&i.data.size<n.minSize.value&&(Ea(i,{code:Ia.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&i.data.size>n.maxSize.value&&(Ea(i,{code:Ia.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const o=this._def.valueType;function a(e){const i=new Set;for(const n of e){if("aborted"===n.status)return Ca;"dirty"===n.status&&t.dirty(),i.add(n.value)}return{status:t.value,value:i}}const r=[...i.data.values()].map(((e,t)=>o._parse(new Ua(i,e,i.path,t))));return i.common.async?Promise.all(r).then((e=>a(e))):a(r)}min(e,t){return new Nr({...this._def,minSize:{value:e,message:Fa.toString(t)}})}max(e,t){return new Nr({...this._def,maxSize:{value:e,message:Fa.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Nr.create=(e,t)=>new Nr({valueType:e,minSize:null,maxSize:null,typeName:Vr.ZodSet,...Ma(t)});class Pr extends Da{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Pr.create=(e,t)=>new Pr({getter:e,typeName:Vr.ZodLazy,...Ma(t)});class Or extends Da{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ea(t,{received:t.data,code:Ia.invalid_literal,expected:this._def.value}),Ca}return{status:"valid",value:e.data}}get value(){return this._def.value}}function jr(e,t){return new $r({values:e,typeName:Vr.ZodEnum,...Ma(t)})}Or.create=(e,t)=>new Or({value:e,typeName:Vr.ZodLiteral,...Ma(t)});class $r extends Da{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),i=this._def.values;return Ea(t,{expected:xa.joinValues(i),received:t.parsedType,code:Ia.invalid_type}),Ca}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),i=this._def.values;return Ea(t,{received:t.data,code:Ia.invalid_enum_value,options:i}),Ca}return Na(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return $r.create(e,{...this._def,...t})}exclude(e,t=this._def){return $r.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}$r.create=jr;class Fr extends Da{_parse(e){const t=xa.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==wa.string&&i.parsedType!==wa.number){const e=xa.objectValues(t);return Ea(i,{expected:xa.joinValues(e),received:i.parsedType,code:Ia.invalid_type}),Ca}if(this._cache||(this._cache=new Set(xa.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=xa.objectValues(t);return Ea(i,{received:i.data,code:Ia.invalid_enum_value,options:e}),Ca}return Na(e.data)}get enum(){return this._def.values}}Fr.create=(e,t)=>new Fr({values:e,typeName:Vr.ZodNativeEnum,...Ma(t)});class Lr extends Da{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==wa.promise&&!1===t.common.async)return Ea(t,{code:Ia.invalid_type,expected:wa.promise,received:t.parsedType}),Ca;const i=t.parsedType===wa.promise?t.data:Promise.resolve(t.data);return Na(i.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Lr.create=(e,t)=>new Lr({type:e,typeName:Vr.ZodPromise,...Ma(t)});class Ur extends Da{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Vr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:i}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:e=>{Ea(i,e),e.fatal?t.abort():t.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),"preprocess"===n.type){const e=n.transform(i.data,o);if(i.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return Ca;const n=await this._def.schema._parseAsync({data:e,path:i.path,parent:i});return"aborted"===n.status?Ca:"dirty"===n.status||"dirty"===t.value?Ra(n.value):n}));{if("aborted"===t.value)return Ca;const n=this._def.schema._parseSync({data:e,path:i.path,parent:i});return"aborted"===n.status?Ca:"dirty"===n.status||"dirty"===t.value?Ra(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,o);if(i.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===i.common.async){const n=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===n.status?Ca:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((i=>"aborted"===i.status?Ca:("dirty"===i.status&&t.dirty(),e(i.value).then((()=>({status:t.value,value:i.value}))))))}if("transform"===n.type){if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!ja(e))return Ca;const a=n.transform(e.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>ja(e)?Promise.resolve(n.transform(e.value,o)).then((e=>({status:t.value,value:e}))):Ca))}xa.assertNever(n)}}Ur.create=(e,t,i)=>new Ur({schema:e,typeName:Vr.ZodEffects,effect:t,...Ma(i)}),Ur.createWithPreprocess=(e,t,i)=>new Ur({schema:t,effect:{type:"preprocess",transform:e},typeName:Vr.ZodEffects,...Ma(i)});class Br extends Da{_parse(e){return this._getType(e)===wa.undefined?Na(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Br.create=(e,t)=>new Br({innerType:e,typeName:Vr.ZodOptional,...Ma(t)});class Mr extends Da{_parse(e){return this._getType(e)===wa.null?Na(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Mr.create=(e,t)=>new Mr({innerType:e,typeName:Vr.ZodNullable,...Ma(t)});class Dr extends Da{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===wa.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Dr.create=(e,t)=>new Dr({innerType:e,typeName:Vr.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Ma(t)});class zr extends Da{_parse(e){const{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return $a(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Ta(i.common.issues)},input:i.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new Ta(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}zr.create=(e,t)=>new zr({innerType:e,typeName:Vr.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Ma(t)});class qr extends Da{_parse(e){if(this._getType(e)!==wa.nan){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.nan,received:t.parsedType}),Ca}return{status:"valid",value:e.data}}}qr.create=e=>new qr({typeName:Vr.ZodNaN,...Ma(e)});class Kr extends Da{_parse(e){const{ctx:t}=this._processInputParams(e),i=t.data;return this._def.type._parse({data:i,path:t.path,parent:t})}unwrap(){return this._def.type}}class Wr extends Da{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?Ca:"dirty"===e.status?(t.dirty(),Ra(e.value)):this._def.out._parseAsync({data:e.value,path:i.path,parent:i})})()}{const e=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?Ca:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:i.path,parent:i})}}static create(e,t){return new Wr({in:e,out:t,typeName:Vr.ZodPipeline})}}class Hr extends Da{_parse(e){const t=this._def.innerType._parse(e),i=e=>(ja(e)&&(e.value=Object.freeze(e.value)),e);return $a(t)?t.then((e=>i(e))):i(t)}unwrap(){return this._def.innerType}}var Vr,Gr;Hr.create=(e,t)=>new Hr({innerType:e,typeName:Vr.ZodReadonly,...Ma(t)}),(Gr=Vr||(Vr={})).ZodString="ZodString",Gr.ZodNumber="ZodNumber",Gr.ZodNaN="ZodNaN",Gr.ZodBigInt="ZodBigInt",Gr.ZodBoolean="ZodBoolean",Gr.ZodDate="ZodDate",Gr.ZodSymbol="ZodSymbol",Gr.ZodUndefined="ZodUndefined",Gr.ZodNull="ZodNull",Gr.ZodAny="ZodAny",Gr.ZodUnknown="ZodUnknown",Gr.ZodNever="ZodNever",Gr.ZodVoid="ZodVoid",Gr.ZodArray="ZodArray",Gr.ZodObject="ZodObject",Gr.ZodUnion="ZodUnion",Gr.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Gr.ZodIntersection="ZodIntersection",Gr.ZodTuple="ZodTuple",Gr.ZodRecord="ZodRecord",Gr.ZodMap="ZodMap",Gr.ZodSet="ZodSet",Gr.ZodFunction="ZodFunction",Gr.ZodLazy="ZodLazy",Gr.ZodLiteral="ZodLiteral",Gr.ZodEnum="ZodEnum",Gr.ZodEffects="ZodEffects",Gr.ZodNativeEnum="ZodNativeEnum",Gr.ZodOptional="ZodOptional",Gr.ZodNullable="ZodNullable",Gr.ZodDefault="ZodDefault",Gr.ZodCatch="ZodCatch",Gr.ZodPromise="ZodPromise",Gr.ZodBranded="ZodBranded",Gr.ZodPipeline="ZodPipeline",Gr.ZodReadonly="ZodReadonly";const Zr=pr.create,Jr=xr.create;yr.create;const Xr=kr.create,Yr=Tr.create,Qr=Sr.create;Er.create,_r.create;const es=Cr.create,ts=Or.create,is=$r.create,ns=Fr.create;Lr.create,Br.create,Mr.create;var os=(e=>(e[e.PERSONAL=0]="PERSONAL",e[e.AI_AGENT=1]="AI_AGENT",e[e.MCP_SERVER=2]="MCP_SERVER",e))(os||{}),as=(e=>(e[e.MANUAL=0]="MANUAL",e[e.AUTONOMOUS=1]="AUTONOMOUS",e))(as||{}),rs=(e=>(e[e.TEXT_GENERATION=0]="TEXT_GENERATION",e[e.IMAGE_GENERATION=1]="IMAGE_GENERATION",e[e.AUDIO_GENERATION=2]="AUDIO_GENERATION",e[e.VIDEO_GENERATION=3]="VIDEO_GENERATION",e[e.CODE_GENERATION=4]="CODE_GENERATION",e[e.LANGUAGE_TRANSLATION=5]="LANGUAGE_TRANSLATION",e[e.SUMMARIZATION_EXTRACTION=6]="SUMMARIZATION_EXTRACTION",e[e.KNOWLEDGE_RETRIEVAL=7]="KNOWLEDGE_RETRIEVAL",e[e.DATA_INTEGRATION=8]="DATA_INTEGRATION",e[e.MARKET_INTELLIGENCE=9]="MARKET_INTELLIGENCE",e[e.TRANSACTION_ANALYTICS=10]="TRANSACTION_ANALYTICS",e[e.SMART_CONTRACT_AUDIT=11]="SMART_CONTRACT_AUDIT",e[e.GOVERNANCE_FACILITATION=12]="GOVERNANCE_FACILITATION",e[e.SECURITY_MONITORING=13]="SECURITY_MONITORING",e[e.COMPLIANCE_ANALYSIS=14]="COMPLIANCE_ANALYSIS",e[e.FRAUD_DETECTION=15]="FRAUD_DETECTION",e[e.MULTI_AGENT_COORDINATION=16]="MULTI_AGENT_COORDINATION",e[e.API_INTEGRATION=17]="API_INTEGRATION",e[e.WORKFLOW_AUTOMATION=18]="WORKFLOW_AUTOMATION",e))(rs||{}),ss=(e=>(e[e.RESOURCE_PROVIDER=0]="RESOURCE_PROVIDER",e[e.TOOL_PROVIDER=1]="TOOL_PROVIDER",e[e.PROMPT_TEMPLATE_PROVIDER=2]="PROMPT_TEMPLATE_PROVIDER",e[e.LOCAL_FILE_ACCESS=3]="LOCAL_FILE_ACCESS",e[e.DATABASE_INTEGRATION=4]="DATABASE_INTEGRATION",e[e.API_INTEGRATION=5]="API_INTEGRATION",e[e.WEB_ACCESS=6]="WEB_ACCESS",e[e.KNOWLEDGE_BASE=7]="KNOWLEDGE_BASE",e[e.MEMORY_PERSISTENCE=8]="MEMORY_PERSISTENCE",e[e.CODE_ANALYSIS=9]="CODE_ANALYSIS",e[e.CONTENT_GENERATION=10]="CONTENT_GENERATION",e[e.COMMUNICATION=11]="COMMUNICATION",e[e.DOCUMENT_PROCESSING=12]="DOCUMENT_PROCESSING",e[e.CALENDAR_SCHEDULE=13]="CALENDAR_SCHEDULE",e[e.SEARCH=14]="SEARCH",e[e.ASSISTANT_ORCHESTRATION=15]="ASSISTANT_ORCHESTRATION",e))(ss||{}),cs=(e=>(e.DNS="dns",e.SIGNATURE="signature",e.CHALLENGE="challenge",e))(cs||{});const ps=Yr({platform:Zr().min(1),handle:Zr().min(1)}),ls=Yr({type:ns(as),capabilities:Xr(ns(rs)).min(1),model:Zr().min(1),creator:Zr().optional()}),us=Yr({url:Zr().min(1),transport:is(["stdio","sse"])}),ds=Yr({type:ns(cs),value:Zr(),dns_field:Zr().optional(),challenge_path:Zr().optional()}),ms=Yr({minVersion:Zr().optional()}),fs=Yr({name:Zr().min(1),description:Zr().min(1)}),hs=Yr({name:Zr().min(1),description:Zr().min(1)}),gs=Yr({version:Zr().min(1),connectionInfo:us,services:Xr(ns(ss)).min(1),description:Zr().min(1),verification:ds.optional(),host:ms.optional(),capabilities:Xr(Zr()).optional(),resources:Xr(fs).optional(),tools:Xr(hs).optional(),maintainer:Zr().optional(),repository:Zr().optional(),docs:Zr().optional()}),bs=Yr({version:Zr().min(1),type:ns(os),display_name:Zr().min(1),alias:Zr().optional(),bio:Zr().optional(),socials:Xr(ps).optional(),profileImage:Zr().optional(),properties:es(Jr()).optional(),inboundTopicId:Zr().optional(),outboundTopicId:Zr().optional()});Qr([bs.extend({type:ts(os.PERSONAL),language:Zr().optional(),timezone:Zr().optional()}),bs.extend({type:ts(os.AI_AGENT),aiAgent:ls}),bs.extend({type:ts(os.MCP_SERVER),mcpServer:gs})]);class xs{constructor(e){b(this,"accountId"),b(this,"signer"),b(this,"baseUrl"),b(this,"network"),b(this,"logger"),this.accountId=e.accountId,this.signer=e.signer,this.network=e.network||"mainnet",this.baseUrl=e.baseUrl||"https://kiloscribe.com",this.logger=e.logger}async authenticate(){var e,t,i;const n=await Yt.get(`${this.baseUrl}/api/auth/request-signature`,{headers:{"x-session":this.accountId}});if(!(null==(e=n.data)?void 0:e.message))throw new Error("Failed to get signature message");const o=n.data.message,a=await this.signMessage(JSON.stringify(o)),r=await Yt.post(`${this.baseUrl}/api/auth/authenticate`,{authData:{id:this.accountId,signature:a,data:o,network:this.network},include:"apiKey"});if(!(null==(i=null==(t=r.data)?void 0:t.user)?void 0:i.sessionToken))throw new Error("Authentication failed");return{apiKey:r.data.apiKey}}async signMessage(e){try{const t=(new TextEncoder).encode(e);this.logger.debug("signing message");const i=await this.signer.sign([t],{encoding:"utf-8"});return C.from(null==i?void 0:i[0].signature).toString("hex")}catch(t){throw this.logger.error("Failed to sign message",t),new Error("Failed to sign message")}}}function vs(e){return new DataView(e.buffer,e.byteOffset)}const ys={len:1,get:(e,t)=>vs(e).getUint8(t),put:(e,t,i)=>(vs(e).setUint8(t,i),t+1)},ws={len:2,get:(e,t)=>vs(e).getUint16(t,!0),put:(e,t,i)=>(vs(e).setUint16(t,i,!0),t+2)},ks={len:2,get:(e,t)=>vs(e).getUint16(t),put:(e,t,i)=>(vs(e).setUint16(t,i),t+2)},Is={len:4,get:(e,t)=>vs(e).getUint32(t,!0),put:(e,t,i)=>(vs(e).setUint32(t,i,!0),t+4)},Ts={len:4,get:(e,t)=>vs(e).getUint32(t),put:(e,t,i)=>(vs(e).setUint32(t,i),t+4)},Ss={len:4,get:(e,t)=>vs(e).getInt32(t),put:(e,t,i)=>(vs(e).setInt32(t,i),t+4)},As={len:8,get:(e,t)=>vs(e).getBigUint64(t,!0),put:(e,t,i)=>(vs(e).setBigUint64(t,i,!0),t+8)};class Es{constructor(e,t){this.len=e,this.encoding=t}get(e,t){return C.from(e).toString(this.encoding,t,t+this.len)}}class _s extends Error{constructor(){super("End-Of-Stream")}}class Cs{constructor(){this.resolve=()=>null,this.reject=()=>null,this.promise=new Promise(((e,t)=>{this.reject=t,this.resolve=e}))}}class Rs{constructor(){this.maxStreamReadSize=1048576,this.endOfStream=!1,this.peekQueue=[]}async peek(e,t,i){const n=await this.read(e,t,i);return this.peekQueue.push(e.subarray(t,t+n)),n}async read(e,t,i){if(0===i)return 0;let n=this.readFromPeekBuffer(e,t,i);if(n+=await this.readRemainderFromStream(e,t+n,i-n),0===n)throw new _s;return n}readFromPeekBuffer(e,t,i){let n=i,o=0;for(;this.peekQueue.length>0&&n>0;){const i=this.peekQueue.pop();if(!i)throw new Error("peekData should be defined");const a=Math.min(i.length,n);e.set(i.subarray(0,a),t+o),o+=a,n-=a,a<i.length&&this.peekQueue.push(i.subarray(a))}return o}async readRemainderFromStream(e,t,i){let n=i,o=0;for(;n>0&&!this.endOfStream;){const i=Math.min(n,this.maxStreamReadSize),a=await this.readFromStream(e,t+o,i);if(0===a)break;o+=a,n-=a}return o}}class Ns extends Rs{constructor(e){if(super(),this.s=e,this.deferred=null,!e.read||!e.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",(()=>this.reject(new _s))),this.s.once("error",(e=>this.reject(e))),this.s.once("close",(()=>this.reject(new Error("Stream closed"))))}async readFromStream(e,t,i){if(this.endOfStream)return 0;const n=this.s.read(i);if(n)return e.set(n,t),n.length;const o={buffer:e,offset:t,length:i,deferred:new Cs};return this.deferred=o.deferred,this.s.once("readable",(()=>{this.readDeferred(o)})),o.deferred.promise}readDeferred(e){const t=this.s.read(e.length);t?(e.buffer.set(t,e.offset),e.deferred.resolve(t.length),this.deferred=null):this.s.once("readable",(()=>{this.readDeferred(e)}))}reject(e){this.endOfStream=!0,this.deferred&&(this.deferred.reject(e),this.deferred=null)}async abort(){this.reject(new Error("abort"))}async close(){return this.abort()}}class Ps{constructor(e){this.position=0,this.numBuffer=new Uint8Array(8),this.fileInfo=e||{}}async readToken(e,t=this.position){const i=new Uint8Array(e.len);if(await this.readBuffer(i,{position:t})<e.len)throw new _s;return e.get(i,0)}async peekToken(e,t=this.position){const i=new Uint8Array(e.len);if(await this.peekBuffer(i,{position:t})<e.len)throw new _s;return e.get(i,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new _s;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new _s;return e.get(this.numBuffer,0)}async ignore(e){if(void 0!==this.fileInfo.size){const t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){}normalizeOptions(e,t){if(t&&void 0!==t.position&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return t?{mayBeLess:!0===t.mayBeLess,offset:t.offset?t.offset:0,length:t.length?t.length:e.length-(t.offset?t.offset:0),position:t.position?t.position:this.position}:{mayBeLess:!1,offset:0,length:e.length,position:this.position}}}class Os extends Ps{constructor(e,t){super(t),this.streamReader=e}async getFileInfo(){return this.fileInfo}async readBuffer(e,t){const i=this.normalizeOptions(e,t),n=i.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(0===i.length)return 0;const o=await this.streamReader.read(e,i.offset,i.length);if(this.position+=o,(!t||!t.mayBeLess)&&o<i.length)throw new _s;return o}async peekBuffer(e,t){const i=this.normalizeOptions(e,t);let n=0;if(i.position){const t=i.position-this.position;if(t>0){const o=new Uint8Array(i.length+t);return n=await this.peekBuffer(o,{mayBeLess:i.mayBeLess}),e.set(o.subarray(t),i.offset),n-t}if(t<0)throw new Error("Cannot peek from a negative offset in a stream")}if(i.length>0){try{n=await this.streamReader.peek(e,i.offset,i.length)}catch(o){if(t&&t.mayBeLess&&o instanceof _s)return 0;throw o}if(!i.mayBeLess&&n<i.length)throw new _s}return n}async ignore(e){const t=Math.min(256e3,e),i=new Uint8Array(t);let n=0;for(;n<e;){const o=e-n,a=await this.readBuffer(i,{length:Math.min(t,o)});if(a<0)return a;n+=a}return n}}class js extends Ps{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo.size=this.fileInfo.size?this.fileInfo.size:e.length}async readBuffer(e,t){if(t&&t.position){if(t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");this.position=t.position}const i=await this.peekBuffer(e,t);return this.position+=i,i}async peekBuffer(e,t){const i=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-i.position,i.length);if(!i.mayBeLess&&n<i.length)throw new _s;return e.set(this.uint8Array.subarray(i.position,i.position+n),i.offset),n}async close(){}}const $s={get:(e,t)=>127&e[t+3]|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},Fs=4100;function Ls(e,t,i){i={offset:0,...i};for(const[n,o]of t.entries())if(i.mask){if(o!==(i.mask[n]&e[n+i.offset]))return!1}else if(o!==e[n+i.offset])return!1;return!0}class Us{constructor(e){this.detectors=null==e?void 0:e.customDetectors,this.fromTokenizer=this.fromTokenizer.bind(this),this.fromBuffer=this.fromBuffer.bind(this),this.parse=this.parse.bind(this)}async fromTokenizer(e){const t=e.position;for(const i of this.detectors||[]){const n=await i(e);if(n)return n;if(t!==e.position)return}return this.parse(e)}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof e}\``);const t=e instanceof Uint8Array?e:new Uint8Array(e);var i;if((null==t?void 0:t.length)>1)return this.fromTokenizer(new js(t,i))}async fromBlob(e){const t=await e.arrayBuffer();return this.fromBuffer(new Uint8Array(t))}async fromStream(e){const t=await function(e,t){return t=t||{},new Os(new Ns(e),t)}(e);try{return await this.fromTokenizer(t)}finally{await t.close()}}async toDetectionStream(e,t={}){const{default:i}=await Promise.resolve().then((()=>require("./index-U-8_6nvw-DtqqxEKh.cjs"))).then((e=>e.i)),{sampleSize:n=Fs}=t;return new Promise(((t,o)=>{e.on("error",o),e.once("readable",(()=>{(async()=>{try{const r=new i.PassThrough,s=i.pipeline?i.pipeline(e,r,(()=>{})):e.pipe(r),c=e.read(n)??e.read()??C.alloc(0);try{r.fileType=await this.fromBuffer(c)}catch(a){a instanceof _s?r.fileType=void 0:o(a)}t(s)}catch(a){o(a)}})()}))}))}check(e,t){return Ls(this.buffer,e,t)}checkString(e,t){return this.check((i=e,[...i].map((e=>e.charCodeAt(0)))),t);var i}async parse(e){if(this.buffer=C.alloc(Fs),void 0===e.fileInfo.size&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:12,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.parse(e);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);const i=await e.readToken($s);return e.position+i>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(i),this.fromTokenizer(e))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((67===this.buffer[0]||70===this.buffer[0])&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){try{for(;e.position+30<e.fileInfo.size;){await e.readBuffer(this.buffer,{length:30});const n={compressedSize:this.buffer.readUInt32LE(18),uncompressedSize:this.buffer.readUInt32LE(22),filenameLength:this.buffer.readUInt16LE(26),extraFieldLength:this.buffer.readUInt16LE(28)};if(n.filename=await e.readToken(new Es(n.filenameLength,"utf-8")),await e.ignore(n.extraFieldLength),"META-INF/mozilla.rsa"===n.filename)return{ext:"xpi",mime:"application/x-xpinstall"};if(n.filename.endsWith(".rels")||n.filename.endsWith(".xml")){switch(n.filename.split("/")[0]){case"_rels":default:break;case"word":return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};case"ppt":return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};case"xl":return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}}}if(n.filename.startsWith("xl/"))return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(n.filename.startsWith("3D/")&&n.filename.endsWith(".model"))return{ext:"3mf",mime:"model/3mf"};if("mimetype"===n.filename&&n.compressedSize===n.uncompressedSize){let o=await e.readToken(new Es(n.compressedSize,"utf-8"));switch(o=o.trim(),o){case"application/epub+zip":return{ext:"epub",mime:"application/epub+zip"};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"}}}if(0===n.compressedSize){let a=-1;for(;a<0&&e.position<e.fileInfo.size;)await e.peekBuffer(this.buffer,{mayBeLess:!0}),a=this.buffer.indexOf("504B0304",0,"hex"),await e.ignore(a>=0?a:this.buffer.length)}else await e.ignore(n.compressedSize)}}catch(t){if(!(t instanceof _s))throw t}return{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);const r=C.alloc(8);return await e.readBuffer(r),Ls(r,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/opus"}:Ls(r,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Ls(r,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Ls(r,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Ls(r,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Ls(r,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(3===this.buffer[2]||5===this.buffer[2]||7===this.buffer[2])&&(4===this.buffer[3]||6===this.buffer[3]||8===this.buffer[3]))return{ext:"zip",mime:"application/zip"};if(this.checkString("ftyp",{offset:4})&&96&this.buffer[8]){const s=this.buffer.toString("binary",8,12).replace("\0"," ").trim();switch(s){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return s.startsWith("3g")?s.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/x-flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF")){try{await e.ignore(1350);const c=10485760,p=C.alloc(Math.min(c,e.fileInfo.size));if(await e.readBuffer(p,{mayBeLess:!0}),p.includes(C.from("AIPrivateData")))return{ext:"ai",mime:"application/postscript"}}catch(t){if(!(t instanceof _s))throw t}return{ext:"pdf",mime:"application/pdf"}}if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const l=await this.readTiffHeader(!1);if(l)return l}if(this.check([77,77])){const u=await this.readTiffHeader(!0);if(u)return u}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function d(){const t=await e.peekNumber(ys);let i=128,n=0;for(;!(t&i)&&0!==i;)++n,i>>=1;const o=C.alloc(n+1);return await e.readBuffer(o),o}async function m(){const e=await d(),t=await d();t[0]^=128>>t.length-1;const i=Math.min(6,t.length);return{id:e.readUIntBE(0,e.length),len:t.readUIntBE(t.length-i,i)}}async function f(t){for(;t>0;){const i=await m();if(17026===i.id){return(await e.readToken(new Es(i.len,"utf-8"))).replace(/\00.*$/g,"")}await e.ignore(i.len),--t}}const h=await m();switch(await f(h.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/x-matroska"};default:return}}if(this.check([82,73,70,70])){if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1"))return{ext:"parquet",mime:"application/x-parquet"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(0===this.buffer[6]||1===this.buffer[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const g=this.buffer.toString("binary",2,6);if(g.match("^d*")&&g>=1e3&&g<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>")){await e.ignore(8);return"debian-binary"===await e.readToken(new Es(13,"ascii"))?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"}}if(this.checkString("**ACE",{offset:7})&&(await e.peekBuffer(this.buffer,{length:14,mayBeLess:!0}),this.checkString("**",{offset:12})))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.check([137,80,78,71,13,10,26,10])){async function b(){return{length:await e.readToken(Ss),type:await e.readToken(new Es(4,"binary"))}}await e.ignore(8);do{const x=await b();if(x.length<0)return;switch(x.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(x.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/x-apache-arrow"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function v(){const t=C.alloc(16);return await e.readBuffer(t),{id:t,size:Number(await e.readToken(As))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){const y=await v();let w=y.size-24;if(Ls(y.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const k=C.alloc(16);if(w-=await e.readBuffer(k),Ls(k,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(Ls(k,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await e.ignore(w)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10])){await e.ignore(20);switch(await e.readToken(new Es(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.check([0,60,0,63,0,120,0,109,0,108],{offset:2})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const I=this.buffer.readUInt32LE(12);if(I>12&&this.buffer.length>=I+16)try{const T=this.buffer.slice(16,I+16).toString();if(JSON.parse(T).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),function(e,t=0){const i=Number.parseInt(e.toString("utf8",148,154).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(i))return!1;let n=256;for(let o=t;o<t+148;o++)n+=e[o];for(let o=t+156;o<t+512;o++)n+=e[o];return i===n}(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254]))return this.check([60,0,63,0,120,0,109,0,108,0],{offset:2})?{ext:"xml",mime:"application/xml"}:this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:void 0;if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"};if(this.buffer.length>=2&&this.check([255,224],{offset:0,mask:[255,224]})){if(this.check([16],{offset:1,mask:[22]}))return this.check([8],{offset:1,mask:[8]}),{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}async readTiffTag(e){const t=await this.tokenizer.readToken(e?ks:ws);switch(this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(e){const t=await this.tokenizer.readToken(e?ks:ws);for(let i=0;i<t;++i){const t=await this.readTiffTag(e);if(t)return t}}async readTiffHeader(e){const t=(e?ks:ws).get(this.buffer,2),i=(e?Ts:Is).get(this.buffer,4);if(42===t){if(i>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(i>=8&&(this.check([28,0,254,0],{offset:8})||this.check([31,0,11,0],{offset:8})))return{ext:"nef",mime:"image/x-nikon-nef"}}await this.tokenizer.ignore(i);return await this.readTiffIFD(e)??{ext:"tif",mime:"image/tiff"}}if(43===t)return{ext:"tif",mime:"image/tiff"}}}new Set(["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx"]),new Set(["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/vnd.wave","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","audio/opus","video/ogg","audio/ogg","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/x-parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx"]);const Bs=class e{constructor(e){if(b(this,"client"),b(this,"config"),b(this,"logger",Qt.getInstance()),this.config=e,!e.apiKey)throw new ei("API key is required");if(!e.network)throw new ei("Network is required");const t={"x-api-key":e.apiKey,"Content-Type":"application/json"};this.client=Yt.create({baseURL:"https://v2-api.tier.bot/api",headers:t}),this.logger=Qt.getInstance()}async getFileMetadata(e){try{const t=await Yt.get(e),i=t.headers["content-type"]||"";return{size:parseInt(t.headers["content-length"]||"0",10),mimeType:i}}catch(t){throw this.logger.error("Error fetching file metadata:",t),new ei("Unable to fetch file metadata")}}getMimeType(t){const i=t.toLowerCase().split(".").pop();if(!i)throw new ei("File must have an extension");const n=e.VALID_MIME_TYPES[i];if(!n)throw new ei(`Unsupported file type: ${i}`);return n}validateRequest(t){if(this.logger.debug("Validating request:",t),!t.holderId||""===t.holderId.trim())throw this.logger.warn("holderId is missing or empty"),new ei("holderId is required");if(!e.VALID_MODES.includes(t.mode))throw new ei(`Invalid mode: ${t.mode}. Must be one of: ${e.VALID_MODES.join(", ")}`);if("hashinal"===t.mode&&!t.jsonFileURL&&!t.metadataObject)throw new ei("Hashinal mode requires either jsonFileURL or metadataObject");if(t.onlyJSONCollection&&"hashinal-collection"!==t.mode)throw new ei("onlyJSONCollection can only be used with hashinal-collection mode");this.validateFileInput(t.file)}normalizeMimeType(e){return"image/vnd.microsoft.icon"===e?(this.logger.debug("Normalizing MIME type from image/vnd.microsoft.icon to image/x-icon"),"image/x-icon"):e}validateMimeType(t){return!!Object.values(e.VALID_MIME_TYPES).includes(t)||"image/vnd.microsoft.icon"===t&&(this.logger.debug("Accepting alternative MIME type for ICO: image/vnd.microsoft.icon"),!0)}validateFileInput(t){if("base64"===t.type){if(!t.base64)throw new ei("Base64 data is required");const i=t.base64.replace(/^data:.*?;base64,/,"");if(Math.ceil(.75*i.length)>e.MAX_BASE64_SIZE)throw new ei(`File size exceeds maximum limit of ${e.MAX_BASE64_SIZE/1024/1024}MB`);const n=t.mimeType||this.getMimeType(t.fileName);if(!this.validateMimeType(n))throw new ei("File must have one of the supported MIME types");"image/vnd.microsoft.icon"===t.mimeType&&(t.mimeType=this.normalizeMimeType(t.mimeType))}else if("url"===t.type&&!t.url)throw new ei("URL is required")}async detectMimeTypeFromBase64(e){if(e.startsWith("data:")){const t=e.match(/^data:([^;]+);base64,/);if(t&&t.length>1)return t[1]}try{const t=e.replace(/\s/g,""),i=_.from(t,"base64"),n=await async function(e){return(new Us).fromBuffer(e)}(i);return(null==n?void 0:n.mime)||"application/octet-stream"}catch(t){return this.logger.warn("Failed to detect MIME type from buffer"),"application/octet-stream"}}async startInscription(t){var i,n;try{this.validateRequest(t);let i=t.file.mimeType;if("url"===t.file.type){const n=await this.getFileMetadata(t.file.url);if(i=n.mimeType||i,n.size>e.MAX_URL_FILE_SIZE)throw new ei(`File size exceeds maximum URL file limit of ${e.MAX_URL_FILE_SIZE/1024/1024}MB`)}else"base64"===t.file.type&&(i=await this.detectMimeTypeFromBase64(t.file.base64));if("image/vnd.microsoft.icon"===i&&(i=this.normalizeMimeType(i)),t.jsonFileURL){if("application/json"!==(await this.getFileMetadata(t.jsonFileURL)).mimeType)throw new ei("JSON file must be of type application/json")}const n={holderId:t.holderId,mode:t.mode,network:this.config.network,onlyJSONCollection:t.onlyJSONCollection?1:0,creator:t.creator,description:t.description,fileStandard:t.fileStandard,metadataObject:t.metadataObject,jsonFileURL:t.jsonFileURL};let o;return o="url"===t.file.type?await this.client.post("/inscriptions/start-inscription",{...n,fileURL:t.file.url}):await this.client.post("/inscriptions/start-inscription",{...n,fileBase64:t.file.base64,fileName:t.file.fileName,fileMimeType:i||this.getMimeType(t.file.fileName)}),o.data}catch(o){if(o instanceof ei)throw o;if(Yt.isAxiosError(o))throw new Error((null==(n=null==(i=o.response)?void 0:i.data)?void 0:n.message)||"Failed to start inscription");throw o}}async executeTransaction(e,t){try{const n="mainnet"===t.network?i.Client.forMainnet():i.Client.forTestnet(),o="string"==typeof t.privateKey,a=o?function(e){let t="ed25519";e.startsWith("0x")?t="ecdsa":e.startsWith("302e020100300506032b6570")?t="ed25519":e.startsWith("3030020100300706052b8104000a")?t="ecdsa":96===e.length?t="ed25519":88===e.length&&(t="ecdsa");try{return{detectedType:t,privateKey:"ecdsa"===t?i.PrivateKey.fromStringECDSA(e):i.PrivateKey.fromStringED25519(e)}}catch(n){const a="ecdsa"===t?"ed25519":"ecdsa";try{return{detectedType:a,privateKey:"ecdsa"===a?i.PrivateKey.fromStringECDSA(e):i.PrivateKey.fromStringED25519(e)}}catch(o){throw new Error(`Failed to parse private key as either ED25519 or ECDSA: ${n}`)}}}(t.privateKey):void 0;let r;r=o?"ed25519"===(null==a?void 0:a.detectedType)?i.PrivateKey.fromStringED25519(t.privateKey):i.PrivateKey.fromStringECDSA(t.privateKey):t.privateKey,n.setOperator(t.accountId,r);const s=i.TransferTransaction.fromBytes(_.from(e,"base64")),c=await s.sign(r),p=await c.execute(n),l=(await p.getReceipt(n)).status.toString();if("SUCCESS"!==l)throw new Error(`Transaction failed with status: ${l}`);return p.transactionId.toString()}catch(n){throw new Error(`Failed to execute transaction: ${n instanceof Error?n.message:"Unknown error"}`)}}async executeTransactionWithSigner(e,t){try{const n=i.TransferTransaction.fromBytes(_.from(e,"base64")),o=await n.executeWithSigner(t),a=(await o.getReceiptWithSigner(t)).status.toString();if("SUCCESS"!==a)throw new Error(`Transaction failed with status: ${a}`);return o.transactionId.toString()}catch(n){throw new Error(`Failed to execute transaction: ${n instanceof Error?n.message:"Unknown error"}`)}}async inscribeAndExecute(e,t){const i=await this.startInscription(e);if(!i.transactionBytes)throw this.logger.error("No transaction bytes returned from inscription request",i),new Error("No transaction bytes returned from inscription request");this.logger.info("executing transaction");const n=await this.executeTransaction(i.transactionBytes,t);return{jobId:i.tx_id,transactionId:n}}async inscribe(e,t){const i=await this.startInscription(e);if(!i.transactionBytes)throw this.logger.error("No transaction bytes returned from inscription request",i),new Error("No transaction bytes returned from inscription request");this.logger.info("executing transaction");const n=await this.executeTransactionWithSigner(i.transactionBytes,t);return{jobId:i.tx_id,transactionId:n}}async retryWithBackoff(e,t=3,i=1e3){for(let o=0;o<t;o++)try{return await e()}catch(n){if(o===t-1)throw n;const e=i*Math.pow(2,o);await new Promise((t=>setTimeout(t,e))),this.logger.debug(`Retry attempt ${o+1}/${t} after ${e}ms delay`)}throw new Error("Retry operation failed")}async retrieveInscription(e){if(!e)throw new ei("Transaction ID is required");try{return await this.retryWithBackoff((async()=>{const t=(await this.client.get(`/inscriptions/retrieve-inscription?id=${e}`)).data;return{...t,jobId:t.id}}))}catch(t){throw this.logger.error("Failed to retrieve inscription:",t),t}}async getInscriptionNumbers(e={}){try{return(await this.client.get("/inscriptions/numbers",{params:e})).data}catch(t){throw this.logger.error("Failed to fetch inscription numbers:",t),t}}static async authenticate(e){return new ti(e).authenticate()}static async createWithAuth(t){const i="client"===t.type?new xs({...t,logger:Qt.getInstance()}):new ti(t),{apiKey:n}=await i.authenticate();return new e({apiKey:n,network:t.network||"mainnet"})}async waitForInscription(e,t=30,i=4e3,n=!1,o){var a;let r=0,s=0;const c=(i,n,a,c)=>{if(o)try{s=Math.max(s,a),o({stage:i,message:n,progressPercent:s,details:{...c,txId:e,currentAttempt:r,maxAttempts:t}})}catch(p){this.logger.warn(`Error in progress callback: ${p}`)}};for(c("confirming","Starting inscription verification",0);r<t;){c("confirming",`Verifying inscription status (attempt ${r+1}/${t})`,5,{attempt:r+1});const o=await this.retrieveInscription(e);if(o.error)throw c("verifying",`Error: ${o.error}`,100,{error:o.error}),new Error(o.error);let s=5;void 0!==o.messages&&void 0!==o.maxMessages&&o.maxMessages>0?(s=Math.min(95,5+o.messages/o.maxMessages*90),o.completed&&(s=100)):"processing"===o.status?s=10:o.completed&&(s=100),c(o.completed?"completed":"confirming",o.completed?"Inscription completed successfully":`Processing inscription (${o.status})`,s,{status:o.status,messagesProcessed:o.messages,maxMessages:o.maxMessages,messageCount:o.messages,completed:o.completed,confirmedMessages:o.confirmedMessages,result:o});const p="hashinal"===o.mode,l="6"===(null==(a=o.fileStandard)?void 0:a.toString());if(p&&o.topic_id&&o.jsonTopicId&&(!n||o.completed))return c("completed","Inscription verification complete",100,{result:o}),o;if(!p&&!l&&o.topic_id&&(!n||o.completed))return c("completed","Inscription verification complete",100,{result:o}),o;if(l&&o.topic_id&&o.jsonTopicId&&o.registryTopicId&&(!n||o.completed))return c("completed","Inscription verification complete",100,{result:o}),o;await new Promise((e=>setTimeout(e,i))),r++}throw c("verifying",`Inscription ${e} did not complete within ${t} attempts`,100,{timedOut:!0}),new Error(`Inscription ${e} did not complete within ${t} attempts`)}async getHolderInscriptions(e){var t,i;if(!e.holderId)throw new ei("Holder ID is required");try{const t={holderId:e.holderId};e.includeCollections&&(t.includeCollections="1");return(await this.client.get("/inscriptions/holder-inscriptions",{params:t})).data}catch(n){if(this.logger.error("Failed to fetch holder inscriptions:",n),Yt.isAxiosError(n))throw new Error((null==(i=null==(t=n.response)?void 0:t.data)?void 0:i.message)||"Failed to fetch holder inscriptions");throw n}}};b(Bs,"VALID_MODES",["file","upload","hashinal","hashinal-collection"]),b(Bs,"MAX_BASE64_SIZE",2097152),b(Bs,"MAX_URL_FILE_SIZE",104857600),b(Bs,"VALID_MIME_TYPES",{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",ico:"image/x-icon",heic:"image/heic",heif:"image/heif",bmp:"image/bmp",webp:"image/webp",tiff:"image/tiff",tif:"image/tiff",svg:"image/svg+xml",mp4:"video/mp4",webm:"video/webm",mp3:"audio/mpeg",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",html:"text/html",htm:"text/html",css:"text/css",php:"application/x-httpd-php",java:"text/x-java-source",js:"application/javascript",mjs:"application/javascript",csv:"text/csv",json:"application/json",txt:"text/plain",glb:"model/gltf-binary",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",flac:"audio/flac",aac:"audio/aac",m4a:"audio/mp4",avi:"video/x-msvideo",mov:"video/quicktime",mkv:"video/x-matroska",m4v:"video/mp4",mpg:"video/mpeg",mpeg:"video/mpeg",ts:"application/typescript",zip:"application/zip",rar:"application/vnd.rar",tar:"application/x-tar",gz:"application/gzip","7z":"application/x-7z-compressed",xml:"application/xml",yaml:"application/yaml",yml:"application/yaml",md:"text/markdown",markdown:"text/markdown",rtf:"application/rtf",gltf:"model/gltf+json",usdz:"model/vnd.usdz+zip",obj:"model/obj",stl:"model/stl",fbx:"application/octet-stream",ttf:"font/ttf",otf:"font/otf",woff:"font/woff",woff2:"font/woff2",eot:"application/vnd.ms-fontobject",psd:"application/vnd.adobe.photoshop",ai:"application/postscript",eps:"application/postscript",ps:"application/postscript",sqlite:"application/x-sqlite3",db:"application/x-sqlite3",apk:"application/vnd.android.package-archive",ics:"text/calendar",vcf:"text/vcard",py:"text/x-python",rb:"text/x-ruby",go:"text/x-go",rs:"text/x-rust",typescript:"application/typescript",jsx:"text/jsx",tsx:"text/tsx",sql:"application/sql",toml:"application/toml",avif:"image/avif",jxl:"image/jxl",weba:"audio/webm"});let Ms=Bs;class Ds{constructor(e={}){this.module=e.module||"Progress",this.callback=e.callback,this.logger=e.logger||new d({level:"info",module:"ProgressReporter"}),this.logProgress=e.logProgress??!0,this.minPercent=e.minPercent??0,this.maxPercent=e.maxPercent??100,this.lastReportedPercent=-1,this.lastReportedTime=0,this.throttleMs=100}static getInstance(e={}){return Ds.instance?(e.callback&&Ds.instance.setCallback(e.callback),e.module&&Ds.instance.setModule(e.module),e.logger&&Ds.instance.setLogger(e.logger),void 0!==e.minPercent&&Ds.instance.setMinPercent(e.minPercent),void 0!==e.maxPercent&&Ds.instance.setMaxPercent(e.maxPercent)):Ds.instance=new Ds(e),Ds.instance}setCallback(e){this.callback=e}setModule(e){this.module=e}setLogger(e){this.logger=e}setMinPercent(e){this.minPercent=e}setMaxPercent(e){this.maxPercent=e}createSubProgress(e){const t=new Ds({module:this.module,logger:this.logger,logProgress:this.logProgress,minPercent:e.minPercent,maxPercent:e.maxPercent}),i=e.logPrefix||"";return t.setCallback((t=>{const n=this.scalePercent(t.progressPercent,e.minPercent,e.maxPercent);let o=t.message;i&&!o.startsWith(i)&&(o=`${i}: ${o}`),this.report({stage:t.stage,message:o,progressPercent:n,details:t.details})})),t}report(e){const t=e.progressPercent,i=Math.max(0,Math.min(100,t)),n=this.scalePercent(i,0,100),o=Date.now();if(n===this.lastReportedPercent&&o-this.lastReportedTime<this.throttleMs&&"completed"!==e.stage&&"failed"!==e.stage)return;this.lastReportedPercent=n,this.lastReportedTime=o;const a={...e,progressPercent:n};if(this.logProgress&&this.logger.debug(`[${this.module}] [${e.stage.toUpperCase()}] ${e.message} (${n.toFixed(1)}%)`,e.details),this.callback)try{this.callback(a)}catch(r){this.logger.warn(`Error in progress callback: ${r}`)}}scalePercent(e,t,i){const n=(this.maxPercent-this.minPercent)/(i-t);return this.minPercent+(e-t)*n}preparing(e,t,i){this.report({stage:"preparing",message:e,progressPercent:t,details:i})}submitting(e,t,i){this.report({stage:"submitting",message:e,progressPercent:t,details:i})}confirming(e,t,i){this.report({stage:"confirming",message:e,progressPercent:t,details:i})}verifying(e,t,i){this.report({stage:"verifying",message:e,progressPercent:t,details:i})}completed(e,t){this.report({stage:"completed",message:e,progressPercent:100,details:t})}failed(e,t){this.report({stage:"failed",message:e,progressPercent:this.lastReportedPercent,details:t})}}async function zs(e,t,i,n){const o=d.getInstance({module:"Inscriber",...i.logging});o.info("Starting inscription process",{type:e.type,mode:i.mode||"file",..."url"===e.type?{url:e.url}:{},..."file"===e.type?{path:e.path}:{},..."buffer"===e.type?{fileName:e.fileName,bufferSize:e.buffer.byteLength}:{}});try{let a;"hashinal"===i.mode&&i.metadata&&Ks(i.metadata,o),n?(o.debug("Using existing InscriptionSDK instance"),a=n):i.apiKey?(o.debug("Initializing InscriptionSDK with API key"),a=new Ms({apiKey:i.apiKey,network:t.network||"mainnet"})):(o.debug("Initializing InscriptionSDK with server auth"),a=await Ms.createWithAuth({type:"server",accountId:t.accountId,privateKey:t.privateKey,network:t.network||"mainnet"}));const r={holderId:t.accountId,metadata:i.metadata||{},tags:i.tags||[],mode:i.mode||"file",chunkSize:i.chunkSize};let s;switch(e.type){case"url":s={...r,file:{type:"url",url:e.url}};break;case"file":s={...r,file:{type:"path",path:e.path}};break;case"buffer":s={...r,file:{type:"base64",base64:globalThis.Buffer.from(e.buffer).toString("base64"),fileName:e.fileName,mimeType:e.mimeType}}}"hashinal"===i.mode&&(s.metadataObject=i.metadata,s.creator=i.metadata?.creator||t.accountId,s.description=i.metadata?.description,i.jsonFileURL&&(s.jsonFileURL=i.jsonFileURL)),o.debug("Preparing to inscribe content",{type:e.type,mode:i.mode||"file",holderId:t.accountId});const c=await a.inscribeAndExecute(s,t);if(o.info("Starting to inscribe.",{type:e.type,mode:i.mode||"file",transactionId:c.jobId}),i.waitForConfirmation){o.debug("Waiting for inscription confirmation",{transactionId:c.jobId,maxAttempts:i.waitMaxAttempts,intervalMs:i.waitIntervalMs});const e=await Ws(a,c.jobId,i.waitMaxAttempts,i.waitIntervalMs,i.progressCallback);return o.info("Inscription confirmation received",{transactionId:c.jobId}),{confirmed:!0,result:c,inscription:e,sdk:a}}return{confirmed:!1,result:c,sdk:a}}catch(a){throw o.error("Error during inscription process",a),a}}async function qs(e,t,i,n){const o=d.getInstance({module:"Inscriber",...i.logging});o.info("Starting inscription process with signer",{type:e.type,mode:i.mode||"file",..."url"===e.type?{url:e.url}:{},..."file"===e.type?{path:e.path}:{},..."buffer"===e.type?{fileName:e.fileName,bufferSize:e.buffer.byteLength}:{}});try{"hashinal"===i.mode&&i.metadata&&Ks(i.metadata,o);const a=t.getAccountId().toString();let r;o.debug("Using account ID from signer",{accountId:a}),n?(o.debug("Using existing InscriptionSDK instance"),r=n):i.apiKey?(o.debug("Initializing InscriptionSDK with API key"),r=new Ms({apiKey:i.apiKey,network:i.network||"mainnet"})):(o.debug("Initializing InscriptionSDK with client auth"),r=await Ms.createWithAuth({type:"client",accountId:a,signer:t,network:i.network||"mainnet"}));const s={holderId:a,metadata:i.metadata||{},tags:i.tags||[],mode:i.mode||"file",chunkSize:i.chunkSize};let c;switch(e.type){case"url":c={...s,file:{type:"url",url:e.url}};break;case"file":c={...s,file:{type:"path",path:e.path}};break;case"buffer":c={...s,file:{type:"base64",base64:globalThis.Buffer.from(e.buffer).toString("base64"),fileName:e.fileName,mimeType:e.mimeType}}}"hashinal"===i.mode&&(c.metadataObject=i.metadata,c.creator=i.metadata?.creator||a,c.description=i.metadata?.description,i.jsonFileURL&&(c.jsonFileURL=i.jsonFileURL)),o.debug("Preparing to inscribe content with signer",{type:e.type,mode:i.mode||"file",holderId:a});const p=await r.inscribe({...c,holderId:a},t);if(o.info("Inscription started",{type:e.type,mode:i.mode||"file",transactionId:p.jobId}),i.waitForConfirmation){o.debug("Waiting for inscription confirmation",{transactionId:p.jobId,maxAttempts:i.waitMaxAttempts,intervalMs:i.waitIntervalMs});const e=await Ws(r,p.jobId,i.waitMaxAttempts,i.waitIntervalMs,i.progressCallback);return o.info("Inscription confirmation received",{transactionId:p.jobId}),{confirmed:!0,result:p,inscription:e,sdk:r}}return{confirmed:!1,result:p,sdk:r}}catch(a){throw o.error("Error during inscription process",a),a}}function Ks(e,t){const i=["name","creator","description","type"].filter((t=>!e[t]));if(i.length>0){const e=new Error(`Missing required Hashinal metadata fields: ${i.join(", ")}`);throw t.error("Hashinal metadata validation failed",{missingFields:i}),e}t.debug("Hashinal metadata validation passed",{name:e.name,creator:e.creator,description:e.description,type:e.type,hasAttributes:!!e.attributes,hasProperties:!!e.properties})}async function Ws(e,t,i=30,n=4e3,o){const a=d.getInstance({module:"Inscriber"}),r=new Ds({module:"Inscriber",logger:a,callback:o});try{a.debug("Waiting for inscription confirmation",{transactionId:t,maxAttempts:i,intervalMs:n}),r.preparing("Preparing for inscription confirmation",5,{transactionId:t,maxAttempts:i,intervalMs:n});try{const o=e.waitForInscription.bind(e),a=e=>{const t=e.stage||"confirming",i=e.message||"Processing inscription",n=e.progressPercent||50;r.report({stage:t,message:i,progressPercent:n,details:{}})};return await o(t,i,n,!0,a)}catch(s){return console.log(s),a.debug("Falling back to standard waitForInscription method",{error:s}),r.verifying("Verifying inscription status",50,{error:s}),await e.waitForInscription(t,i,n,!0)}}catch(c){throw a.error("Error waiting for inscription confirmation",{transactionId:t,maxAttempts:i,intervalMs:n,error:c}),r.failed("Inscription confirmation failed",{transactionId:t,error:c}),c}}class Hs{constructor(e,t,i){this.maxRetries=5,this.initialDelayMs=2e3,this.maxDelayMs=3e4,this.backoffFactor=2,this.network=e,this.apiKey=i?.apiKey,this.customHeaders=i?.headers||{},this.baseUrl=i?.customUrl||this.getMirrorNodeUrl(),this.logger=t||new d({level:"debug",module:"MirrorNode"}),this.isServerEnvironment="undefined"==typeof window,i?.customUrl&&this.logger.info(`Using custom mirror node URL: ${i.customUrl}`),i?.apiKey&&this.logger.info("Using API key for mirror node requests")}configureRetry(e){this.maxRetries=e.maxRetries??this.maxRetries,this.initialDelayMs=e.initialDelayMs??this.initialDelayMs,this.maxDelayMs=e.maxDelayMs??this.maxDelayMs,this.backoffFactor=e.backoffFactor??this.backoffFactor,this.logger.info(`Retry configuration updated: maxRetries=${this.maxRetries}, initialDelayMs=${this.initialDelayMs}, maxDelayMs=${this.maxDelayMs}, backoffFactor=${this.backoffFactor}`)}configureMirrorNode(e){e.customUrl&&(this.baseUrl=e.customUrl,this.logger.info(`Updated mirror node URL: ${e.customUrl}`)),e.apiKey&&(this.apiKey=e.apiKey,this.logger.info("Updated API key for mirror node requests")),e.headers&&(this.customHeaders={...this.customHeaders,...e.headers},this.logger.info("Updated custom headers for mirror node requests"))}constructUrl(e){if(this.baseUrl.includes("<API-KEY>")&&this.apiKey){const t=this.baseUrl.replace("<API-KEY>",this.apiKey);return e.startsWith("/")?`${t}${e}`:`${t}/${e}`}return e.startsWith("/")?`${this.baseUrl}${e}`:`${this.baseUrl}/${e}`}getMirrorNodeUrl(){return"mainnet"===this.network?"https://mainnet-public.mirrornode.hedera.com":"https://testnet.mirrornode.hedera.com"}getBaseUrl(){return this.baseUrl}async getPublicKey(e){this.logger.info(`Getting public key for account ${e}`);const t=await this.requestAccount(e);try{if(!t||!t.key)throw new Error(`Failed to retrieve public key for account ID: ${e}`);return i.PublicKey.fromString(t.key.key)}catch(n){const e=`Error fetching public key from Mirror Node: ${n.message}`;throw this.logger.error(e),new Error(e)}}async getAccountMemo(e){this.logger.info(`Getting account memo for account ID: ${e}`);try{const t=await this._requestWithRetry(`/api/v1/accounts/${e}`);return t?.memo?t.memo:(this.logger.warn(`No memo found for account ${e}`),null)}catch(t){const i=t;return this.logger.error(`Failed to get account memo for ${e} after retries: ${i.message}`),null}}async getTopicInfo(e){try{this.logger.debug(`Fetching topic info for ${e}`);return await this._requestWithRetry(`/api/v1/topics/${e}`)}catch(t){const i=`Error retrieving topic information for ${e} after retries: ${t.message}`;throw this.logger.error(i),new Error(i)}}async getTopicFees(e){try{return(await this.getTopicInfo(e)).custom_fees}catch(t){const e=`Error retrieving topic fees: ${t.message}`;return this.logger.error(e),null}}async getHBARPrice(e){try{const t=i.Timestamp.fromDate(e).toString();this.logger.debug(`Fetching HBAR price for timestamp ${t}`);const n=await this._requestWithRetry(`/api/v1/network/exchangerate?timestamp=${t}`);return Number(n?.current_rate?.cent_equivalent)/Number(n?.current_rate?.hbar_equivalent)/100}catch(t){const e=`Error retrieving HBAR price: ${t.message}`;return this.logger.error(e),null}}async getTokenInfo(e){this.logger.debug(`Fetching token info for ${e}`);try{const t=await this._requestWithRetry(`/api/v1/tokens/${e}`);return t?(this.logger.trace(`Token info found for ${e}:`,t),t):(this.logger.warn(`No token info found for ${e}`),null)}catch(t){const i=`Error fetching token info for ${e}: ${t.message}`;return this.logger.error(i),null}}async getTopicMessages(e,t){this.logger.trace(`Querying messages for topic ${e}${t?" with filters":""}`);let i=`/api/v1/topics/${e}/messages`;const n=new URLSearchParams;if(t){if(void 0!==t.sequenceNumber){const e="number"==typeof t.sequenceNumber?t.sequenceNumber.toString():t.sequenceNumber;e.match(/^(gt|gte|lt|lte|eq|ne):/)?n.append("sequencenumber",e):n.append("sequencenumber",`gt:${e}`)}t.limit&&n.append("limit",t.limit.toString()),t.order&&n.append("order",t.order)}const o=n.toString();o&&(i+=`?${o}`);const a=[];let r=i;for(;r;)try{const e=await this._requestWithRetry(r);if(e.messages&&e.messages.length>0)for(const t of e.messages)try{if(!t.message)continue;let e,i;try{e=this.isServerEnvironment?globalThis.Buffer.from(t.message,"base64").toString("utf-8"):(new TextDecoder).decode(Uint8Array.from(atob(t.message),(e=>e.charCodeAt(0))))}catch(s){const e=`Error decoding message: ${s}`;this.logger.error(e);continue}try{i=JSON.parse(e)}catch(s){const t=`Invalid JSON message content: ${e}`;this.logger.error(t);continue}i.sequence_number=t.sequence_number,a.push({...i,consensus_timestamp:t.consensus_timestamp,sequence_number:t.sequence_number,created:new Date(1e3*Number(t.consensus_timestamp))})}catch(s){const e=`Error processing message: ${s.message}`;this.logger.error(e)}r=e.links?.next||""}catch(c){const t=`Error querying topic messages for topic ${e} (endpoint: ${r}) after retries: ${c.message}`;throw this.logger.error(t),new Error(t)}return a}async requestAccount(e){try{this.logger.debug(`Requesting account info for ${e}`);const t=await this._requestWithRetry(`/api/v1/accounts/${e}`);if(!t)throw new Error(`No data received from mirror node for account: ${e}`);return t}catch(t){const i=`Failed to fetch account ${e} after retries: ${t.message}`;throw this.logger.error(i),new Error(i)}}async checkKeyListAccess(e,t){try{const i=o.proto.Key.decode(e);return this.evaluateKeyAccess(i,t)}catch(i){const e=`Error decoding protobuf key: ${i.message}`;throw this.logger.error(e),new Error(e)}}async evaluateKeyAccess(e,t){return e.ed25519?this.compareEd25519Key(e.ed25519,t):e.keyList?this.evaluateKeyList(e.keyList,t):!(!e.thresholdKey||!e.thresholdKey.keys)&&this.evaluateKeyList(e.thresholdKey.keys,t)}async evaluateKeyList(e,t){const i=e.keys||[];for(const a of i)if(a)if(a.ed25519){if(this.compareEd25519Key(a.ed25519,t))return!0}else if(a.keyList||a.thresholdKey)try{const e=o.proto.Key.encode({...a.keyList?{keyList:a.keyList}:{},...a.thresholdKey?{thresholdKey:a.thresholdKey}:{}}).finish();if(await this.checkKeyListAccess(globalThis.Buffer.from(e),t))return!0}catch(n){const e=`Error in nested key: ${n.message}`;this.logger.debug(e)}return!1}compareEd25519Key(e,t){try{return i.PublicKey.fromBytes(globalThis.Buffer.from(e)).toString()===t.toString()}catch(n){const e=`Error comparing Ed25519 key: ${n.message}`;return this.logger.debug(e),!1}}async getScheduleInfo(e){try{this.logger.info(`Getting information for scheduled transaction ${e}`);const t=await this._requestWithRetry(`/api/v1/schedules/${e}`);return t||(this.logger.warn(`No schedule info found for ${e} after retries.`),null)}catch(t){return this.logger.error(`Error fetching schedule info for ${e} after retries: ${t.message}`),null}}async getScheduledTransactionStatus(e){try{this.logger.info(`Checking status of scheduled transaction ${e}`);const t=await this.getScheduleInfo(e);if(!t)throw new Error(`Schedule ${e} not found`);return{executed:Boolean(t.executed_timestamp),executedDate:t.executed_timestamp?new Date(1e3*Number(t.executed_timestamp)):void 0,deleted:t.deleted||!1}}catch(t){throw this.logger.error(`Error checking scheduled transaction status: ${t}`),t}}async getTransaction(e){this.logger.info(`Getting transaction details for ID/hash: ${e}`);try{const t=await this._requestWithRetry(`/api/v1/transactions/${e}`);return t?.transactions?.length>0?(this.logger.trace(`Transaction details found for ${e}:`,t.transactions[0]),t.transactions[0]):(this.logger.warn(`No transaction details found for ${e} or unexpected response structure.`),null)}catch(t){const i=t;return this.logger.error(`Failed to get transaction details for ${e} after retries: ${i.message}`),null}}async _requestWithRetry(e,t){let i=0,n=this.initialDelayMs;const o=this.constructUrl(e),r={...t,headers:{...this.customHeaders,...t?.headers}};for(this.apiKey&&(r.headers={...r.headers,Authorization:`Bearer ${this.apiKey}`,"X-API-Key":this.apiKey});i<this.maxRetries;)try{return(await a.get(o,r)).data}catch(s){i++;const e=i>=this.maxRetries,t=s.response?.status;if(t&&t>404&&t<500&&429!==t)throw this.logger.error(`Client error for ${o} (status ${t}): ${s.message}. Not retrying.`),s;if(e)throw this.logger.error(`Max retries (${this.maxRetries}) reached for ${o}. Last error: ${s.message}`),s;this.logger.warn(`Attempt ${i}/${this.maxRetries} failed for ${o}: ${s.message}. Retrying in ${n}ms...`),await new Promise((e=>setTimeout(e,n))),n=Math.min(n*this.backoffFactor,this.maxDelayMs)}throw new Error(`Failed to fetch data from ${o} after ${this.maxRetries} attempts.`)}async _fetchWithRetry(e,t){let i=0,n=this.initialDelayMs;const o={...this.customHeaders};t?.headers&&(t.headers instanceof Headers?t.headers.forEach(((e,t)=>{o[t]=e})):Array.isArray(t.headers)?t.headers.forEach((([e,t])=>{o[e]=t})):Object.assign(o,t.headers)),this.apiKey&&(o.Authorization=`Bearer ${this.apiKey}`,o["X-API-Key"]=this.apiKey);const a={...t,headers:o};for(;i<this.maxRetries;)try{const t=await fetch(e,a);if(!t.ok){if(t.status>=400&&t.status<500&&429!==t.status)throw this.logger.error(`Client error for ${e} (status ${t.status}): ${t.statusText}. Not retrying.`),new Error(`Fetch failed with status ${t.status}: ${t.statusText} for URL: ${e}`);throw new Error(`Fetch failed with status ${t.status}: ${t.statusText} for URL: ${e}`)}return await t.json()}catch(r){if(i++,i>=this.maxRetries)throw this.logger.error(`Max retries (${this.maxRetries}) reached for ${e}. Last error: ${r.message}`),r;this.logger.warn(`Attempt ${i}/${this.maxRetries} failed for ${e}: ${r.message}. Retrying in ${n}ms...`),await new Promise((e=>setTimeout(e,n))),n=Math.min(n*this.backoffFactor,this.maxDelayMs)}throw new Error(`Failed to fetch data from ${e} after ${this.maxRetries} attempts.`)}async getAccountBalance(e){this.logger.info(`Getting balance for account ${e}`);try{const t=await this.requestAccount(e);if(t&&t.balance){return t.balance.balance/1e8}return this.logger.warn(`Could not retrieve balance for account ${e} from account info.`),null}catch(t){return this.logger.error(`Error fetching numerical balance for account ${e}: ${t.message}`),null}}async getTopicMessagesByFilter(e,t){this.logger.trace(`Querying messages for topic ${e} with filters: ${JSON.stringify(t)}`);let i=`/api/v1/topics/${e}/messages`;const n=new URLSearchParams;t?.limit&&n.append("limit",t.limit.toString()),t?.sequenceNumber&&n.append("sequencenumber",t.sequenceNumber),t?.startTime&&n.append("timestamp",`gte:${t.startTime}`),t?.endTime&&n.append("timestamp",`lt:${t.endTime}`),t?.order&&n.append("order",t.order);const o=n.toString();o&&(i+=`?${o}`);const a=[];let r=0;try{for(;i&&r<10;){r++;const e=await this._requestWithRetry(i);if(e.messages&&e.messages.length>0)for(const t of e.messages)try{if(!t.message)continue;let e;e=this.isServerEnvironment?globalThis.Buffer.from(t.message,"base64").toString("utf-8"):(new TextDecoder).decode(Uint8Array.from(atob(t.message),(e=>e.charCodeAt(0))));let i={};try{i=JSON.parse(e)}catch(s){this.logger.debug(`Message content is not valid JSON, using raw: ${e}`),i={raw_content:e}}const n={...i,consensus_timestamp:t.consensus_timestamp,sequence_number:t.sequence_number,payer_account_id:t.payer_account_id,topic_id:t.topic_id,running_hash:t.running_hash,running_hash_version:t.running_hash_version,chunk_info:t.chunk_info,created:new Date(1e3*Number(t.consensus_timestamp.split(".")[0])+Number(t.consensus_timestamp.split(".")[1]||0)/1e6),payer:t.payer_account_id};a.push(n)}catch(c){this.logger.error(`Error processing individual message: ${c.message}`)}if(t?.limit&&a.length>=t.limit)break;i=e.links?.next?`${e.links.next}`:""}return a}catch(p){const t=p;return this.logger.error(`Error querying filtered topic messages for ${e}: ${t.message}`),null}}async getAccountTokens(e,t=100){this.logger.info(`Getting tokens for account ${e}`);let i=[],n=`/api/v1/accounts/${e}/tokens?limit=${t}`;try{for(let e=0;e<10&&n;e++){const e=await this._requestWithRetry(n);if(e&&e.tokens&&(i=i.concat(e.tokens)),n=e.links?.next||"",!n||t&&i.length>=t){t&&i.length>t&&(i=i.slice(0,t));break}}return i}catch(o){return this.logger.error(`Error fetching tokens for account ${e}: ${o.message}`),null}}async getTransactionByTimestamp(e){this.logger.info(`Getting transaction by timestamp: ${e}`);try{return(await this._requestWithRetry(`/api/v1/transactions?timestamp=${e}&limit=1`)).transactions}catch(t){return this.logger.error(`Error fetching transaction by timestamp ${e}: ${t}`),[]}}async getAccountNfts(e,t,i=100){this.logger.info(`Getting NFTs for account ${e}${t?` for token ${t}`:""}`);let n=[],o=`/api/v1/accounts/${e}/nfts?limit=${i}`;t&&(o+=`&token.id=${t}`);try{for(let e=0;e<10&&o;e++){const e=await this._requestWithRetry(o);if(e&&e.nfts){const t=e.nfts.map((e=>{let t;if(e.metadata)try{t=this.isServerEnvironment?globalThis.Buffer.from(e.metadata,"base64").toString("utf-8"):(new TextDecoder).decode(Uint8Array.from(atob(e.metadata),(e=>e.charCodeAt(0))))}catch(i){this.logger.warn(`Failed to decode metadata for NFT ${e.token_id} SN ${e.serial_number}: ${i.message}`)}return{...e,token_uri:t}}));n=n.concat(t)}if(o=e.links?.next||"",!o)break}return n}catch(a){return this.logger.error(`Error fetching NFTs for account ${e}: ${a.message}`),null}}async validateNFTOwnership(e,t,i){this.logger.info(`Validating ownership of NFT ${t} SN ${i} for account ${e}`);try{const n=await this.getAccountNfts(e,t);if(n){return n.find((e=>e.token_id===t&&e.serial_number===i))||null}return null}catch(n){return this.logger.error(`Error validating NFT ownership: ${n.message}`),null}}async readSmartContractQuery(e,t,n,o){this.logger.info(`Reading smart contract ${e} with selector ${t}`);const a=e.startsWith("0x")?e:`0x${i.AccountId.fromString(e).toSolidityAddress()}`,r=n.startsWith("0x")?n:`0x${i.AccountId.fromString(n).toSolidityAddress()}`,s={block:o?.block||"latest",data:t,estimate:o?.estimate||!1,from:r,to:a,gas:o?.gas,gasPrice:o?.gasPrice,value:o?.value||0};Object.keys(s).forEach((e=>{const t=e;void 0===s[t]&&delete s[t]}));try{const e=this.constructUrl("/api/v1/contracts/call");return await this._fetchWithRetry(e,{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})}catch(c){return this.logger.error(`Error reading smart contract ${e}: ${c.message}`),null}}async getOutstandingTokenAirdrops(e,t){this.logger.info(`Getting outstanding token airdrops sent by account ${e}`);let i=`/api/v1/accounts/${e}/airdrops/outstanding`;const n=new URLSearchParams;t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order),t?.receiverId&&n.append("receiver.id",t.receiverId),t?.serialNumber&&n.append("serialnumber",t.serialNumber),t?.tokenId&&n.append("token.id",t.tokenId);const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).airdrops||[]}catch(a){return this.logger.error(`Error fetching outstanding token airdrops for account ${e}: ${a.message}`),null}}async getPendingTokenAirdrops(e,t){this.logger.info(`Getting pending token airdrops received by account ${e}`);let i=`/api/v1/accounts/${e}/airdrops/pending`;const n=new URLSearchParams;t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order),t?.senderId&&n.append("sender.id",t.senderId),t?.serialNumber&&n.append("serialnumber",t.serialNumber),t?.tokenId&&n.append("token.id",t.tokenId);const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).airdrops||[]}catch(a){return this.logger.error(`Error fetching pending token airdrops for account ${e}: ${a.message}`),null}}async getBlocks(e){this.logger.info("Getting blocks from the network");let t="/api/v1/blocks";const i=new URLSearchParams;e?.limit&&i.append("limit",e.limit.toString()),e?.order&&i.append("order",e.order),e?.timestamp&&i.append("timestamp",e.timestamp),e?.blockNumber&&i.append("block.number",e.blockNumber);const n=i.toString();n&&(t+=`?${n}`);try{return(await this._requestWithRetry(t)).blocks||[]}catch(o){return this.logger.error(`Error fetching blocks: ${o.message}`),null}}async getBlock(e){this.logger.info(`Getting block ${e}`);try{return await this._requestWithRetry(`/api/v1/blocks/${e}`)}catch(t){return this.logger.error(`Error fetching block ${e}: ${t.message}`),null}}async getContracts(e){this.logger.info("Getting contracts from the network");let t="/api/v1/contracts";const i=new URLSearchParams;e?.contractId&&i.append("contract.id",e.contractId),e?.limit&&i.append("limit",e.limit.toString()),e?.order&&i.append("order",e.order);const n=i.toString();n&&(t+=`?${n}`);try{return(await this._requestWithRetry(t)).contracts||[]}catch(o){return this.logger.error(`Error fetching contracts: ${o.message}`),null}}async getContract(e,t){this.logger.info(`Getting contract ${e}`);let i=`/api/v1/contracts/${e}`;t&&(i+=`?timestamp=${t}`);try{return await this._requestWithRetry(i)}catch(n){return this.logger.error(`Error fetching contract ${e}: ${n.message}`),null}}async getContractResults(e){this.logger.info("Getting contract results from the network");let t="/api/v1/contracts/results";const i=new URLSearchParams;e?.from&&i.append("from",e.from),e?.blockHash&&i.append("block.hash",e.blockHash),e?.blockNumber&&i.append("block.number",e.blockNumber),void 0!==e?.internal&&i.append("internal",e.internal.toString()),e?.limit&&i.append("limit",e.limit.toString()),e?.order&&i.append("order",e.order),e?.timestamp&&i.append("timestamp",e.timestamp),e?.transactionIndex&&i.append("transaction.index",e.transactionIndex.toString());const n=i.toString();n&&(t+=`?${n}`);try{return(await this._requestWithRetry(t)).results||[]}catch(o){return this.logger.error(`Error fetching contract results: ${o.message}`),null}}async getContractResult(e,t){this.logger.info(`Getting contract result for ${e}`);let i=`/api/v1/contracts/results/${e}`;void 0!==t&&(i+=`?nonce=${t}`);try{return await this._requestWithRetry(i)}catch(n){return this.logger.error(`Error fetching contract result for ${e}: ${n.message}`),null}}async getContractResultsByContract(e,t){this.logger.info(`Getting contract results for contract ${e}`);let i=`/api/v1/contracts/${e}/results`;const n=new URLSearchParams;t?.blockHash&&n.append("block.hash",t.blockHash),t?.blockNumber&&n.append("block.number",t.blockNumber),t?.from&&n.append("from",t.from),void 0!==t?.internal&&n.append("internal",t.internal.toString()),t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order),t?.timestamp&&n.append("timestamp",t.timestamp),t?.transactionIndex&&n.append("transaction.index",t.transactionIndex.toString());const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).results||[]}catch(a){return this.logger.error(`Error fetching contract results for ${e}: ${a.message}`),null}}async getContractState(e,t){this.logger.info(`Getting contract state for ${e}`);let i=`/api/v1/contracts/${e}/state`;const n=new URLSearchParams;t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order),t?.slot&&n.append("slot",t.slot),t?.timestamp&&n.append("timestamp",t.timestamp);const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).state||[]}catch(a){return this.logger.error(`Error fetching contract state for ${e}: ${a.message}`),null}}async getContractActions(e,t){this.logger.info(`Getting contract actions for ${e}`);let i=`/api/v1/contracts/results/${e}/actions`;const n=new URLSearchParams;t?.index&&n.append("index",t.index),t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order);const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).actions||[]}catch(a){return this.logger.error(`Error fetching contract actions for ${e}: ${a.message}`),null}}async getContractLogs(e){this.logger.info("Getting contract logs from the network");let t="/api/v1/contracts/results/logs";const i=new URLSearchParams;e?.index&&i.append("index",e.index),e?.limit&&i.append("limit",e.limit.toString()),e?.order&&i.append("order",e.order),e?.timestamp&&i.append("timestamp",e.timestamp),e?.topic0&&i.append("topic0",e.topic0),e?.topic1&&i.append("topic1",e.topic1),e?.topic2&&i.append("topic2",e.topic2),e?.topic3&&i.append("topic3",e.topic3),e?.transactionHash&&i.append("transaction.hash",e.transactionHash);const n=i.toString();n&&(t+=`?${n}`);try{return(await this._requestWithRetry(t)).logs||[]}catch(o){return this.logger.error(`Error fetching contract logs: ${o.message}`),null}}async getContractLogsByContract(e,t){this.logger.info(`Getting contract logs for contract ${e}`);let i=`/api/v1/contracts/${e}/results/logs`;const n=new URLSearchParams;t?.index&&n.append("index",t.index),t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order),t?.timestamp&&n.append("timestamp",t.timestamp),t?.topic0&&n.append("topic0",t.topic0),t?.topic1&&n.append("topic1",t.topic1),t?.topic2&&n.append("topic2",t.topic2),t?.topic3&&n.append("topic3",t.topic3);const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).logs||[]}catch(a){return this.logger.error(`Error fetching contract logs for ${e}: ${a.message}`),null}}async getNftInfo(e,t){this.logger.info(`Getting NFT info for ${e}/${t}`);const i=`/api/v1/tokens/${e}/nfts/${t}`;try{return await this._requestWithRetry(i)}catch(n){return this.logger.error(`Error fetching NFT info for ${e}/${t}: ${n.message}`),null}}async getNftsByToken(e,t){this.logger.info(`Getting NFTs for token ${e}`);let i=`/api/v1/tokens/${e}/nfts`;const n=new URLSearchParams;t?.accountId&&n.append("account.id",t.accountId),t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order),t?.serialNumber&&n.append("serialnumber",t.serialNumber);const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).nfts||[]}catch(a){return this.logger.error(`Error fetching NFTs for token ${e}: ${a.message}`),null}}async getNetworkInfo(){this.logger.info("Getting network information");try{return await this._requestWithRetry("/api/v1/network/nodes")}catch(e){return this.logger.error(`Error fetching network info: ${e.message}`),null}}async getNetworkFees(e){this.logger.info("Getting network fees");let t="/api/v1/network/fees";e&&(t+=`?timestamp=${e}`);try{return await this._requestWithRetry(t)}catch(i){return this.logger.error(`Error fetching network fees: ${i.message}`),null}}async getNetworkSupply(e){this.logger.info("Getting network supply");let t="/api/v1/network/supply";e&&(t+=`?timestamp=${e}`);try{return await this._requestWithRetry(t)}catch(i){return this.logger.error(`Error fetching network supply: ${i.message}`),null}}async getNetworkStake(e){this.logger.info("Getting network stake");let t="/api/v1/network/stake";e&&(t+=`?timestamp=${e}`);try{return await this._requestWithRetry(t)}catch(i){return this.logger.error(`Error fetching network stake: ${i.message}`),null}}async getOpcodeTraces(e,t){this.logger.info(`Getting opcode traces for ${e}`);let i=`/api/v1/contracts/results/${e}/opcodes`;const n=new URLSearchParams;void 0!==t?.stack&&n.append("stack",t.stack.toString()),void 0!==t?.memory&&n.append("memory",t.memory.toString()),void 0!==t?.storage&&n.append("storage",t.storage.toString());const o=n.toString();o&&(i+=`?${o}`);try{return await this._requestWithRetry(i)}catch(a){return this.logger.error(`Error fetching opcode traces for ${e}: ${a.message}`),null}}}async function Vs(e,t,i){const n=new Hs(t,i),o=[];for(const r of e)try{const e=await n.getPublicKey(r);o.push(e)}catch(a){i&&i.warn(`Could not get public key for account ${r}: ${a}`)}return o}class Gs{constructor(e="info"){this.defaultEndpoint="https://kiloscribe.com/api/inscription-cdn",this.logger=d.getInstance({level:e,module:"HRLResolver"})}isBinaryContentType(e){return["image/","audio/","video/","application/octet-stream","application/pdf","application/zip","application/gzip","application/x-binary","application/vnd.ms-","application/x-msdownload","application/x-shockwave-flash","font/","application/wasm"].some((t=>e.startsWith(t)))}parseHRL(e){if(!e)return null;const t=e.match(/^hcs:\/\/(\d+)\/([0-9]+\.[0-9]+\.[0-9]+)$/);return t?{standard:t[1],topicId:t[2]}:null}isValidHRL(e){if(!e||"string"!=typeof e)return!1;const t=this.parseHRL(e);if(!t)return!1;return!!/^[0-9]+\.[0-9]+\.[0-9]+$/.test(t.topicId)}async getContentWithType(e,t){if(!this.isValidHRL(e))return{content:e,contentType:"text/plain",isBinary:!1};try{const i=await this.resolveHRL(e,t);return{content:i.content,contentType:i.contentType,isBinary:i.isBinary}}catch(i){const e=`Error resolving HRL for content and type: ${i.message}`;throw this.logger.error(e),new Error(e)}}async resolveHRL(e,t){const i=this.parseHRL(e);if(!i)throw new Error(`Invalid HRL format: ${e}`);const{standard:n,topicId:o}=i;this.logger.debug(`Resolving HRL reference: standard=${n}, topicId=${o}`);try{const e=`${t.cdnEndpoint||this.defaultEndpoint}/${o}?network=${t.network}`;this.logger.debug(`Fetching content from CDN: ${e}`);const i=(await a.head(e)).headers["content-type"]||"";if(this.isBinaryContentType(i)||t.returnRaw){return{content:(await a.get(e,{responseType:"arraybuffer"})).data,contentType:i,topicId:o,isBinary:!0}}if("application/json"===i){const t=await a.get(e,{responseType:"json"});if(!t.data)throw new Error(`Failed to fetch content from topic: ${o}`);return{content:t.data,contentType:i,topicId:o,isBinary:!1}}const n=await a.get(e);if(!n.data)throw new Error(`Failed to fetch content from topic: ${o}`);let r;return r="object"==typeof n.data?n.data.content||n.data.text||JSON.stringify(n.data):n.data,{content:r,contentType:i,topicId:o,isBinary:!1}}catch(r){const e=`Error resolving HRL reference: ${r.message}`;throw this.logger.error(e),new Error(e)}}}function Zs(e){if(e){if(e.contractID)return`ContractID: ${new i.ContractId(e.contractID.shardNum??0,e.contractID.realmNum??0,e.contractID.contractNum??0).toString()}`;if(e.ed25519)return`ED25519: ${r.Buffer.from(e.ed25519).toString("hex")}`;if(e.ECDSASecp256k1)return`ECDSA_secp256k1: ${r.Buffer.from(e.ECDSASecp256k1).toString("hex")}`;if(e?.keyList?.keys?.length>0){const t=e.keyList.keys.map((e=>Zs(e))).filter(Boolean);return`KeyList (${t.length} keys): [${t.join(", ")}]`}if(e?.thresholdKey?.keys?.keys?.length>0){const t=e.thresholdKey.keys.keys.map((e=>Zs(e))).filter(Boolean);return`ThresholdKey (${e.thresholdKey.threshold} of ${t.length}): [${t.join(", ")}]`}return e.delegatableContractId?`DelegatableContractID: ${new i.ContractId(e.delegatableContractId.shardNum??0,e.delegatableContractId.realmNum??0,e.delegatableContractId.contractNum??0).toString()}`:0===Object.keys(e).length?"Empty Key Structure":"Unknown or Unset Key Type"}}class Js{static parseTokenCreate(e){if(!e)return;const t={};return e.name&&(t.tokenName=e.name),e.symbol&&(t.tokenSymbol=e.symbol),e.treasury&&(t.treasuryAccountId=new i.AccountId(e.treasury.shardNum??0,e.treasury.realmNum??0,e.treasury.accountNum??0).toString()),e.initialSupply&&(t.initialSupply=i.Long.fromValue(e.initialSupply).toString()),void 0!==e.decimals&&null!==e.decimals&&(t.decimals=i.Long.fromValue(e.decimals).toNumber()),e.maxSupply&&(t.maxSupply=i.Long.fromValue(e.maxSupply).toString()),e.memo&&(t.memo=e.memo),null!==e.tokenType&&void 0!==e.tokenType&&(t.tokenType=o.proto.TokenType[e.tokenType]),null!==e.supplyType&&void 0!==e.supplyType&&(t.supplyType=o.proto.TokenSupplyType[e.supplyType]),t.adminKey=Zs(e.adminKey),t.kycKey=Zs(e.kycKey),t.freezeKey=Zs(e.freezeKey),t.wipeKey=Zs(e.wipeKey),t.supplyKey=Zs(e.supplyKey),t.feeScheduleKey=Zs(e.feeScheduleKey),t.pauseKey=Zs(e.pauseKey),e.autoRenewAccount&&(t.autoRenewAccount=new i.AccountId(e.autoRenewAccount.shardNum??0,e.autoRenewAccount.realmNum??0,e.autoRenewAccount.accountNum??0).toString()),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),e.customFees&&e.customFees.length>0&&(t.customFees=e.customFees.map((e=>{const t={feeCollectorAccountId:e.feeCollectorAccountId?new i.AccountId(e.feeCollectorAccountId.shardNum??0,e.feeCollectorAccountId.realmNum??0,e.feeCollectorAccountId.accountNum??0).toString():"Not Set",allCollectorsAreExempt:e.allCollectorsAreExempt||!1};if(e.fixedFee)return{...t,feeType:"FIXED_FEE",fixedFee:{amount:i.Long.fromValue(e.fixedFee.amount||0).toString(),denominatingTokenId:e.fixedFee.denominatingTokenId?new i.TokenId(e.fixedFee.denominatingTokenId.shardNum??0,e.fixedFee.denominatingTokenId.realmNum??0,e.fixedFee.denominatingTokenId.tokenNum??0).toString():void 0}};if(e.fractionalFee)return{...t,feeType:"FRACTIONAL_FEE",fractionalFee:{numerator:i.Long.fromValue(e.fractionalFee.fractionalAmount?.numerator||0).toString(),denominator:i.Long.fromValue(e.fractionalFee.fractionalAmount?.denominator||1).toString(),minimumAmount:i.Long.fromValue(e.fractionalFee.minimumAmount||0).toString(),maximumAmount:i.Long.fromValue(e.fractionalFee.maximumAmount||0).toString(),netOfTransfers:e.fractionalFee.netOfTransfers||!1}};if(e.royaltyFee){let n;return e.royaltyFee.fallbackFee&&(n={amount:i.Long.fromValue(e.royaltyFee.fallbackFee.amount||0).toString(),denominatingTokenId:e.royaltyFee.fallbackFee.denominatingTokenId?new i.TokenId(e.royaltyFee.fallbackFee.denominatingTokenId.shardNum??0,e.royaltyFee.fallbackFee.denominatingTokenId.realmNum??0,e.royaltyFee.fallbackFee.denominatingTokenId.tokenNum??0).toString():void 0}),{...t,feeType:"ROYALTY_FEE",royaltyFee:{numerator:i.Long.fromValue(e.royaltyFee.exchangeValueFraction?.numerator||0).toString(),denominator:i.Long.fromValue(e.royaltyFee.exchangeValueFraction?.denominator||1).toString(),fallbackFee:n}}}return{...t,feeType:"FIXED_FEE",fixedFee:{amount:"0"}}}))),t}static parseTokenMint(e){if(!e||!e.token||null===e.amount||void 0===e.amount)return;const t={tokenId:new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString(),amount:i.Long.fromValue(e.amount).toNumber()};return e.metadata&&e.metadata.length>0&&(t.metadata=e.metadata.map((e=>r.Buffer.from(e).toString("base64")))),t}static parseTokenBurn(e){if(!e||!e.token||null===e.amount||void 0===e.amount)return;const t={tokenId:new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString(),amount:i.Long.fromValue(e.amount).toNumber()};return e.serialNumbers&&e.serialNumbers.length>0&&(t.serialNumbers=e.serialNumbers.map((e=>i.Long.fromValue(e).toNumber()))),t}static parseTokenUpdate(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),e.name&&(t.name=e.name),e.symbol&&(t.symbol=e.symbol),e.treasury&&(t.treasuryAccountId=new i.AccountId(e.treasury.shardNum??0,e.treasury.realmNum??0,e.treasury.accountNum??0).toString()),t.adminKey=Zs(e.adminKey),t.kycKey=Zs(e.kycKey),t.freezeKey=Zs(e.freezeKey),t.wipeKey=Zs(e.wipeKey),t.supplyKey=Zs(e.supplyKey),t.feeScheduleKey=Zs(e.feeScheduleKey),t.pauseKey=Zs(e.pauseKey),e.autoRenewAccount&&(t.autoRenewAccountId=new i.AccountId(e.autoRenewAccount.shardNum??0,e.autoRenewAccount.realmNum??0,e.autoRenewAccount.accountNum??0).toString()),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),void 0!==e.memo?.value&&(t.memo=e.memo.value),e.expiry?.seconds&&(t.expiry=`${i.Long.fromValue(e.expiry.seconds).toString()}.${e.expiry.nanos}`),t}static parseTokenFeeScheduleUpdate(e){if(!e)return;const t={};return e.tokenId&&(t.tokenId=new i.TokenId(e.tokenId.shardNum??0,e.tokenId.realmNum??0,e.tokenId.tokenNum??0).toString()),e.customFees&&e.customFees.length>0&&(t.customFees=e.customFees.map((e=>{const t={feeCollectorAccountId:e.feeCollectorAccountId?new i.AccountId(e.feeCollectorAccountId.shardNum??0,e.feeCollectorAccountId.realmNum??0,e.feeCollectorAccountId.accountNum??0).toString():"Not Set",allCollectorsAreExempt:e.allCollectorsAreExempt||!1};if(e.fixedFee)return{...t,feeType:"FIXED_FEE",fixedFee:{amount:i.Long.fromValue(e.fixedFee.amount||0).toString(),denominatingTokenId:e.fixedFee.denominatingTokenId?new i.TokenId(e.fixedFee.denominatingTokenId.shardNum??0,e.fixedFee.denominatingTokenId.realmNum??0,e.fixedFee.denominatingTokenId.tokenNum??0).toString():void 0}};if(e.fractionalFee)return{...t,feeType:"FRACTIONAL_FEE",fractionalFee:{numerator:i.Long.fromValue(e.fractionalFee.fractionalAmount?.numerator||0).toString(),denominator:i.Long.fromValue(e.fractionalFee.fractionalAmount?.denominator||1).toString(),minimumAmount:i.Long.fromValue(e.fractionalFee.minimumAmount||0).toString(),maximumAmount:i.Long.fromValue(e.fractionalFee.maximumAmount||0).toString(),netOfTransfers:e.fractionalFee.netOfTransfers||!1}};if(e.royaltyFee){let n;return e.royaltyFee.fallbackFee&&(n={amount:i.Long.fromValue(e.royaltyFee.fallbackFee.amount||0).toString(),denominatingTokenId:e.royaltyFee.fallbackFee.denominatingTokenId?new i.TokenId(e.royaltyFee.fallbackFee.denominatingTokenId.shardNum??0,e.royaltyFee.fallbackFee.denominatingTokenId.realmNum??0,e.royaltyFee.fallbackFee.denominatingTokenId.tokenNum??0).toString():void 0}),{...t,feeType:"ROYALTY_FEE",royaltyFee:{numerator:i.Long.fromValue(e.royaltyFee.exchangeValueFraction?.numerator||0).toString(),denominator:i.Long.fromValue(e.royaltyFee.exchangeValueFraction?.denominator||1).toString(),fallbackFee:n}}}return{...t,feeType:"FIXED_FEE",fixedFee:{amount:"0"}}}))),t}static parseTokenFreeze(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),t}static parseTokenUnfreeze(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),t}static parseTokenGrantKyc(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),t}static parseTokenRevokeKyc(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),t}static parseTokenPause(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),t}static parseTokenUnpause(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),t}static parseTokenWipeAccount(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),e.serialNumbers&&e.serialNumbers.length>0&&(t.serialNumbers=e.serialNumbers.map((e=>i.Long.fromValue(e).toString()))),e.amount&&(t.amount=i.Long.fromValue(e.amount).toString()),t}static parseTokenDelete(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),t}static parseTokenAssociate(e){if(!e)return;const t={};return e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),e.tokens&&e.tokens.length>0&&(t.tokenIds=e.tokens.map((e=>new i.TokenId(e.shardNum??0,e.realmNum??0,e.tokenNum??0).toString()))),t}static parseTokenDissociate(e){if(!e)return;const t={};return e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),e.tokens&&e.tokens.length>0&&(t.tokenIds=e.tokens.map((e=>new i.TokenId(e.shardNum??0,e.realmNum??0,e.tokenNum??0).toString()))),t}}class Xs{static parseConsensusCreateTopic(e){if(!e)return;const t={};return e.memo&&(t.memo=e.memo),t.adminKey=Zs(e.adminKey),t.submitKey=Zs(e.submitKey),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),e.autoRenewAccount&&(t.autoRenewAccountId=new i.AccountId(e.autoRenewAccount.shardNum??0,e.autoRenewAccount.realmNum??0,e.autoRenewAccount.accountNum??0).toString()),t}static parseConsensusSubmitMessage(e){if(!e)return;const t={};if(e.topicID&&(t.topicId=`${e.topicID.shardNum??0}.${e.topicID.realmNum??0}.${e.topicID.topicNum??0}`),e.message?.length>0){const i=r.Buffer.from(e.message),n=i.toString("utf8");/[\x00-\x08\x0B\x0E-\x1F\x7F]/.test(n)||n.includes("�")?(t.message=i.toString("base64"),t.messageEncoding="base64"):(t.message=n,t.messageEncoding="utf8")}if(e.chunkInfo){if(e.chunkInfo.initialTransactionID){const i=e.chunkInfo.initialTransactionID.accountID,n=e.chunkInfo.initialTransactionID.transactionValidStart;i&&n&&(t.chunkInfoInitialTransactionID=`${i.shardNum??0}.${i.realmNum??0}.${i.accountNum??0}@${n.seconds??0}.${n.nanos??0}`)}void 0!==e.chunkInfo.number&&null!==e.chunkInfo.number&&(t.chunkInfoNumber=e.chunkInfo.number),void 0!==e.chunkInfo.total&&null!==e.chunkInfo.total&&(t.chunkInfoTotal=e.chunkInfo.total)}return t}static parseConsensusUpdateTopic(e){if(!e)return;const t={};return e.topicID&&(t.topicId=`${e.topicID.shardNum}.${e.topicID.realmNum}.${e.topicID.topicNum}`),void 0!==e.memo?.value&&(t.memo=e.memo.value),null===e.adminKey?(t.clearAdminKey=!0,t.adminKey=void 0):e.adminKey?t.adminKey=Zs(e.adminKey):t.adminKey=void 0,null===e.submitKey?(t.clearSubmitKey=!0,t.submitKey=void 0):e.submitKey?t.submitKey=Zs(e.submitKey):t.submitKey=void 0,e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),e.autoRenewAccount&&(t.autoRenewAccountId=new i.AccountId(e.autoRenewAccount.shardNum??0,e.autoRenewAccount.realmNum??0,e.autoRenewAccount.accountNum??0).toString()),t}static parseConsensusDeleteTopic(e){if(!e)return;const t={};return e.topicID&&(t.topicId=`${e.topicID.shardNum}.${e.topicID.realmNum??0}.${e.topicID.topicNum??0}`),t}}class Ys{static parseFileCreate(e){if(!e)return;const t={};return e.expirationTime?.seconds&&(t.expirationTime=`${i.Long.fromValue(e.expirationTime.seconds).toString()}.${e.expirationTime.nanos}`),e.keys&&(t.keys=Zs({keyList:e.keys})),e.contents&&(t.contents=r.Buffer.from(e.contents).toString("base64")),e.memo&&(t.memo=e.memo),t}static parseFileAppend(e){if(!e)return;const t={};return e.fileID&&(t.fileId=`${e.fileID.shardNum??0}.${e.fileID.realmNum??0}.${e.fileID.fileNum??0}`),e.contents&&(t.contents=r.Buffer.from(e.contents).toString("base64")),t}static parseFileUpdate(e){if(!e)return;const t={};return e.fileID&&(t.fileId=`${e.fileID.shardNum??0}.${e.fileID.realmNum??0}.${e.fileID.fileNum??0}`),e.expirationTime?.seconds&&(t.expirationTime=`${i.Long.fromValue(e.expirationTime.seconds).toString()}.${e.expirationTime.nanos}`),e.keys&&(t.keys=Zs({keyList:e.keys})),e.contents&&(t.contents=r.Buffer.from(e.contents).toString("base64")),void 0!==e.memo?.value&&(t.memo=e.memo.value),t}static parseFileDelete(e){if(!e)return;const t={};return e.fileID&&(t.fileId=`${e.fileID.shardNum??0}.${e.fileID.realmNum??0}.${e.fileID.fileNum??0}`),t}}class Qs{static parseCryptoTransfers(e,t){if(e.transfers?.accountAmounts&&(t.transfers=e.transfers.accountAmounts.map((e=>{const t=new i.AccountId(e.accountID.shardNum??0,e.accountID.realmNum??0,e.accountID.accountNum??0),n=i.Hbar.fromTinybars(i.Long.fromValue(e.amount));return{accountId:t.toString(),amount:n.toString(i.HbarUnit.Hbar),isDecimal:!0}}))),e.tokenTransfers)for(const n of e.tokenTransfers){const e=new i.TokenId(n.token.shardNum??0,n.token.realmNum??0,n.token.tokenNum??0);if(n.transfers)for(const o of n.transfers){const n=new i.AccountId(o.accountID.shardNum??0,o.accountID.realmNum??0,o.accountID.accountNum??0),a=i.Long.fromValue(o.amount).toNumber();t.tokenTransfers.push({tokenId:e.toString(),accountId:n.toString(),amount:a})}}}static parseCryptoDelete(e){if(!e)return;const t={};return e.deleteAccountID&&(t.deleteAccountId=new i.AccountId(e.deleteAccountID.shardNum??0,e.deleteAccountID.realmNum??0,e.deleteAccountID.accountNum??0).toString()),e.transferAccountID&&(t.transferAccountId=new i.AccountId(e.transferAccountID.shardNum??0,e.transferAccountID.realmNum??0,e.transferAccountID.accountNum??0).toString()),t}static parseCryptoCreateAccount(e){if(!e)return;const t={};return e.initialBalance&&(t.initialBalance=i.Hbar.fromTinybars(i.Long.fromValue(e.initialBalance)).toString(i.HbarUnit.Hbar)),e.key&&(t.key=Zs(e.key)),void 0!==e.receiverSigRequired&&(t.receiverSigRequired=e.receiverSigRequired),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),e.memo&&(t.memo=e.memo),void 0!==e.maxAutomaticTokenAssociations&&(t.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations),e.stakedAccountId?t.stakedAccountId=new i.AccountId(e.stakedAccountId.shardNum??0,e.stakedAccountId.realmNum??0,e.stakedAccountId.accountNum??0).toString():null!==e.stakedNodeId&&void 0!==e.stakedNodeId&&(t.stakedNodeId=i.Long.fromValue(e.stakedNodeId).toString()),void 0!==e.declineReward&&(t.declineReward=e.declineReward),e.alias&&e.alias.length>0&&(t.alias=globalThis.Buffer.from(e.alias).toString("hex")),t}static parseCryptoUpdateAccount(e){if(!e)return;const t={};return e.accountIDToUpdate&&(t.accountIdToUpdate=new i.AccountId(e.accountIDToUpdate.shardNum??0,e.accountIDToUpdate.realmNum??0,e.accountIDToUpdate.accountNum??0).toString()),e.key&&(t.key=Zs(e.key)),e.expirationTime?.seconds&&(t.expirationTime=`${i.Long.fromValue(e.expirationTime.seconds).toString()}.${e.expirationTime.nanos}`),null!==e.receiverSigRequired&&void 0!==e.receiverSigRequired&&(t.receiverSigRequired=Boolean(e.receiverSigRequired)),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),void 0!==e.memo?.value&&(t.memo=e.memo.value),void 0!==e.maxAutomaticTokenAssociations?.value&&(t.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations.value),e.stakedAccountId?(t.stakedAccountId=new i.AccountId(e.stakedAccountId.shardNum??0,e.stakedAccountId.realmNum??0,e.stakedAccountId.accountNum??0).toString(),t.stakedNodeId=void 0):null!==e.stakedNodeId&&void 0!==e.stakedNodeId?(t.stakedNodeId=i.Long.fromValue(e.stakedNodeId).toString(),t.stakedAccountId=void 0):(t.stakedAccountId=void 0,t.stakedNodeId=void 0),null!==e.declineReward&&void 0!==e.declineReward&&(t.declineReward=Boolean(e.declineReward)),t}static parseCryptoApproveAllowance(e){if(!e)return;const t={};return e.cryptoAllowances&&e.cryptoAllowances.length>0&&(t.hbarAllowances=e.cryptoAllowances.map((e=>({ownerAccountId:new i.AccountId(e.owner.shardNum??0,e.owner.realmNum??0,e.owner.accountNum??0).toString(),spenderAccountId:new i.AccountId(e.spender.shardNum??0,e.spender.realmNum??0,e.spender.accountNum??0).toString(),amount:i.Hbar.fromTinybars(i.Long.fromValue(e.amount)).toString(i.HbarUnit.Hbar)})))),e.tokenAllowances&&e.tokenAllowances.length>0&&(t.tokenAllowances=e.tokenAllowances.map((e=>({tokenId:new i.TokenId(e.tokenId.shardNum??0,e.tokenId.realmNum??0,e.tokenId.tokenNum??0).toString(),ownerAccountId:new i.AccountId(e.owner.shardNum??0,e.owner.realmNum??0,e.owner.accountNum??0).toString(),spenderAccountId:new i.AccountId(e.spender.shardNum??0,e.spender.realmNum??0,e.spender.accountNum??0).toString(),amount:i.Long.fromValue(e.amount).toString()})))),e.nftAllowances&&e.nftAllowances.length>0&&(t.nftAllowances=e.nftAllowances.map((e=>{const t={};return e.tokenId&&(t.tokenId=new i.TokenId(e.tokenId.shardNum??0,e.tokenId.realmNum??0,e.tokenId.tokenNum??0).toString()),e.owner&&(t.ownerAccountId=new i.AccountId(e.owner.shardNum??0,e.owner.realmNum??0,e.owner.accountNum??0).toString()),e.spender&&(t.spenderAccountId=new i.AccountId(e.spender.shardNum??0,e.spender.realmNum??0,e.spender.accountNum??0).toString()),e.serialNumbers&&e.serialNumbers.length>0&&(t.serialNumbers=e.serialNumbers.map((e=>i.Long.fromValue(e).toString()))),void 0!==e.approvedForAll?.value&&(t.approvedForAll=e.approvedForAll.value),e.delegatingSpender&&(t.delegatingSpender=new i.AccountId(e.delegatingSpender.shardNum??0,e.delegatingSpender.realmNum??0,e.delegatingSpender.accountNum??0).toString()),t}))),t}static parseCryptoDeleteAllowance(e){if(!e)return;const t={};return e.nftAllowances&&e.nftAllowances.length>0&&(t.nftAllowancesToRemove=e.nftAllowances.map((e=>({ownerAccountId:new i.AccountId(e.owner.shardNum??0,e.owner.realmNum??0,e.owner.accountNum??0).toString(),tokenId:new i.TokenId(e.tokenId.shardNum??0,e.tokenId.realmNum??0,e.tokenId.tokenNum??0).toString(),serialNumbers:e.serialNumbers?e.serialNumbers.map((e=>i.Long.fromValue(e).toString())):[]})))),t}}class ec{static parseContractCall(e){if(!e)return;const t=i.Hbar.fromTinybars(i.Long.fromValue(e.amount??0)),n={contractId:new i.ContractId(e.contractID.shardNum??0,e.contractID.realmNum??0,e.contractID.contractNum??0).toString(),gas:i.Long.fromValue(e.gas??0).toNumber(),amount:parseFloat(t.toString(i.HbarUnit.Hbar))};return e.functionParameters&&(n.functionParameters=r.Buffer.from(e.functionParameters).toString("hex"),n.functionParameters.length>=8&&(n.functionName=n.functionParameters.substring(0,8))),n}static parseContractCreate(e){if(!e)return;const t={};return e.initialBalance&&(t.initialBalance=i.Hbar.fromTinybars(i.Long.fromValue(e.initialBalance)).toString(i.HbarUnit.Hbar)),e.gas&&(t.gas=i.Long.fromValue(e.gas).toString()),e.adminKey&&(t.adminKey=Zs(e.adminKey)),e.constructorParameters&&(t.constructorParameters=r.Buffer.from(e.constructorParameters).toString("hex")),e.memo&&(t.memo=e.memo),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),e.stakedAccountId?t.stakedAccountId=new i.AccountId(e.stakedAccountId.shardNum??0,e.stakedAccountId.realmNum??0,e.stakedAccountId.accountNum??0).toString():null!==e.stakedNodeId&&void 0!==e.stakedNodeId&&(t.stakedNodeId=i.Long.fromValue(e.stakedNodeId).toString()),void 0!==e.declineReward&&(t.declineReward=e.declineReward),void 0!==e.maxAutomaticTokenAssociations&&(t.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations),e.fileID?(t.initcodeSource="fileID",t.initcode=new i.FileId(e.fileID.shardNum??0,e.fileID.realmNum??0,e.fileID.fileNum??0).toString()):e.initcode&&e.initcode.length>0&&(t.initcodeSource="bytes",t.initcode=r.Buffer.from(e.initcode).toString("hex")),t}static parseContractUpdate(e){if(!e)return;const t={};if(e.contractID&&(t.contractIdToUpdate=new i.ContractId(e.contractID.shardNum??0,e.contractID.realmNum??0,e.contractID.contractNum??0).toString()),e.adminKey&&(t.adminKey=Zs(e.adminKey)),e.expirationTime?.seconds&&(t.expirationTime=`${i.Long.fromValue(e.expirationTime.seconds).toString()}.${e.expirationTime.nanos}`),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),e.memo){const i=e.memo;if(i&&"object"==typeof i&&i.hasOwnProperty("value")){const e=i.value;t.memo=null==e?void 0:String(e)}else t.memo="string"==typeof i?i:void 0}else t.memo=void 0;return e.stakedAccountId?(t.stakedAccountId=new i.AccountId(e.stakedAccountId.shardNum??0,e.stakedAccountId.realmNum??0,e.stakedAccountId.accountNum??0).toString(),t.stakedNodeId=void 0):null!==e.stakedNodeId&&void 0!==e.stakedNodeId&&i.Long.fromValue(e.stakedNodeId).notEquals(-1)?(t.stakedNodeId=i.Long.fromValue(e.stakedNodeId).toString(),t.stakedAccountId=void 0):(t.stakedNodeId=void 0,t.stakedAccountId=void 0),void 0!==e.declineReward?.value&&(t.declineReward=e.declineReward.value),void 0!==e.maxAutomaticTokenAssociations?.value&&(t.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations.value),e.autoRenewAccountId&&(t.autoRenewAccountId=new i.AccountId(e.autoRenewAccountId.shardNum??0,e.autoRenewAccountId.realmNum??0,e.autoRenewAccountId.accountNum??0).toString()),t}static parseContractDelete(e){if(!e)return;const t={};return e.contractID&&(t.contractIdToDelete=new i.ContractId(e.contractID.shardNum??0,e.contractID.realmNum??0,e.contractID.contractNum??0).toString()),e.transferAccountID?t.transferAccountId=new i.AccountId(e.transferAccountID.shardNum??0,e.transferAccountID.realmNum??0,e.transferAccountID.accountNum??0).toString():e.transferContractID&&(t.transferContractId=new i.ContractId(e.transferContractID.shardNum??0,e.transferContractID.realmNum??0,e.transferContractID.contractNum??0).toString()),t}}class tc{static parseUtilPrng(e){if(!e)return;const t={};return e.range&&0!==e.range&&(t.range=e.range),t}}function ic(e){let t="ed25519";e.startsWith("0x")?t="ecdsa":e.startsWith("302e020100300506032b6570")?t="ed25519":e.startsWith("3030020100300706052b8104000a")?t="ecdsa":96===e.length?t="ed25519":88===e.length&&(t="ecdsa");try{return{detectedType:t,privateKey:"ecdsa"===t?i.PrivateKey.fromStringECDSA(e):i.PrivateKey.fromStringED25519(e)}}catch(n){const a="ecdsa"===t?"ed25519":"ecdsa";try{return{detectedType:a,privateKey:"ecdsa"===a?i.PrivateKey.fromStringECDSA(e):i.PrivateKey.fromStringED25519(e)}}catch(o){throw new Error(`Failed to parse private key as either ED25519 or ECDSA: ${n}`)}}}var nc=(e=>(e[e.PERSONAL=0]="PERSONAL",e[e.AI_AGENT=1]="AI_AGENT",e[e.MCP_SERVER=2]="MCP_SERVER",e))(nc||{}),oc=(e=>(e[e.MANUAL=0]="MANUAL",e[e.AUTONOMOUS=1]="AUTONOMOUS",e))(oc||{}),ac=(e=>(e[e.REST=0]="REST",e[e.WEBSOCKET=1]="WEBSOCKET",e[e.GRPC=2]="GRPC",e))(ac||{}),rc=(e=>(e[e.TEXT_GENERATION=0]="TEXT_GENERATION",e[e.IMAGE_GENERATION=1]="IMAGE_GENERATION",e[e.AUDIO_GENERATION=2]="AUDIO_GENERATION",e[e.VIDEO_GENERATION=3]="VIDEO_GENERATION",e[e.CODE_GENERATION=4]="CODE_GENERATION",e[e.LANGUAGE_TRANSLATION=5]="LANGUAGE_TRANSLATION",e[e.SUMMARIZATION_EXTRACTION=6]="SUMMARIZATION_EXTRACTION",e[e.KNOWLEDGE_RETRIEVAL=7]="KNOWLEDGE_RETRIEVAL",e[e.DATA_INTEGRATION=8]="DATA_INTEGRATION",e[e.MARKET_INTELLIGENCE=9]="MARKET_INTELLIGENCE",e[e.TRANSACTION_ANALYTICS=10]="TRANSACTION_ANALYTICS",e[e.SMART_CONTRACT_AUDIT=11]="SMART_CONTRACT_AUDIT",e[e.GOVERNANCE_FACILITATION=12]="GOVERNANCE_FACILITATION",e[e.SECURITY_MONITORING=13]="SECURITY_MONITORING",e[e.COMPLIANCE_ANALYSIS=14]="COMPLIANCE_ANALYSIS",e[e.FRAUD_DETECTION=15]="FRAUD_DETECTION",e[e.MULTI_AGENT_COORDINATION=16]="MULTI_AGENT_COORDINATION",e[e.API_INTEGRATION=17]="API_INTEGRATION",e[e.WORKFLOW_AUTOMATION=18]="WORKFLOW_AUTOMATION",e))(rc||{}),sc=(e=>(e[e.RESOURCE_PROVIDER=0]="RESOURCE_PROVIDER",e[e.TOOL_PROVIDER=1]="TOOL_PROVIDER",e[e.PROMPT_TEMPLATE_PROVIDER=2]="PROMPT_TEMPLATE_PROVIDER",e[e.LOCAL_FILE_ACCESS=3]="LOCAL_FILE_ACCESS",e[e.DATABASE_INTEGRATION=4]="DATABASE_INTEGRATION",e[e.API_INTEGRATION=5]="API_INTEGRATION",e[e.WEB_ACCESS=6]="WEB_ACCESS",e[e.KNOWLEDGE_BASE=7]="KNOWLEDGE_BASE",e[e.MEMORY_PERSISTENCE=8]="MEMORY_PERSISTENCE",e[e.CODE_ANALYSIS=9]="CODE_ANALYSIS",e[e.CONTENT_GENERATION=10]="CONTENT_GENERATION",e[e.COMMUNICATION=11]="COMMUNICATION",e[e.DOCUMENT_PROCESSING=12]="DOCUMENT_PROCESSING",e[e.CALENDAR_SCHEDULE=13]="CALENDAR_SCHEDULE",e[e.SEARCH=14]="SEARCH",e[e.ASSISTANT_ORCHESTRATION=15]="ASSISTANT_ORCHESTRATION",e))(sc||{}),cc=(e=>(e.DNS="dns",e.SIGNATURE="signature",e.CHALLENGE="challenge",e))(cc||{}),pc=(e=>(e.PUBLIC="PUBLIC",e.CONTROLLED="CONTROLLED",e.FEE_BASED="FEE_BASED",e))(pc||{});const lc={text_generation:0,image_generation:1,audio_generation:2,video_generation:3,code_generation:4,language_translation:5,summarization:6,extraction:6,knowledge_retrieval:7,data_integration:8,data_visualization:8,market_intelligence:9,transaction_analytics:10,smart_contract_audit:11,governance:12,security_monitoring:13,compliance_analysis:14,fraud_detection:15,multi_agent:16,api_integration:17,workflow_automation:18},uc=c.z.object({platform:c.z.string().min(1),handle:c.z.string().min(1)}),dc=c.z.object({type:c.z.nativeEnum(oc),capabilities:c.z.array(c.z.nativeEnum(rc)).min(1),model:c.z.string().min(1),creator:c.z.string().optional()}),mc=c.z.object({url:c.z.string().min(1),transport:c.z.enum(["stdio","sse"])}),fc=c.z.object({type:c.z.nativeEnum(cc),value:c.z.string(),dns_field:c.z.string().optional(),challenge_path:c.z.string().optional()}),hc=c.z.object({minVersion:c.z.string().optional()}),gc=c.z.object({name:c.z.string().min(1),description:c.z.string().min(1)}),bc=c.z.object({name:c.z.string().min(1),description:c.z.string().min(1)}),xc=c.z.object({version:c.z.string().min(1),connectionInfo:mc,services:c.z.array(c.z.nativeEnum(sc)).min(1),description:c.z.string().min(1),verification:fc.optional(),host:hc.optional(),capabilities:c.z.array(c.z.string()).optional(),resources:c.z.array(gc).optional(),tools:c.z.array(bc).optional(),maintainer:c.z.string().optional(),repository:c.z.string().optional(),docs:c.z.string().optional()}),vc=c.z.object({version:c.z.string().min(1),type:c.z.nativeEnum(nc),display_name:c.z.string().min(1),alias:c.z.string().optional(),bio:c.z.string().optional(),socials:c.z.array(uc).optional(),profileImage:c.z.string().optional(),properties:c.z.record(c.z.any()).optional(),inboundTopicId:c.z.string().optional(),outboundTopicId:c.z.string().optional()}),yc=vc.extend({type:c.z.literal(nc.PERSONAL),language:c.z.string().optional(),timezone:c.z.string().optional()}),wc=vc.extend({type:c.z.literal(nc.AI_AGENT),aiAgent:dc}),kc=vc.extend({type:c.z.literal(nc.MCP_SERVER),mcpServer:xc}),Ic=c.z.union([yc,wc,kc]);class Tc{constructor(e){if(this.client="mainnet"===e.network?i.Client.forMainnet():i.Client.forTestnet(),this.auth=e.auth,this.network=e.network,this.operatorId=e.auth.operatorId,this.logger=d.getInstance({level:e.logLevel||"info",module:"HCS-11",silent:e.silent}),this.mirrorNode=new Hs(this.network,this.logger),this.auth.privateKey)if(e.keyType)this.keyType=e.keyType,this.initializeOperatorWithKeyType();else{try{const e=ic(this.auth.privateKey);this.keyType=e.detectedType,this.client.setOperator(this.operatorId,e.privateKey)}catch(t){this.logger.warn("Failed to detect key type from private key format, will query mirror node"),this.keyType="ed25519"}this.initializeOperator()}}getClient(){return this.client}getOperatorId(){return this.auth.operatorId}async initializeOperator(){const e=await this.mirrorNode.requestAccount(this.operatorId),t=e?.key?._type;t&&t.includes("ECDSA")?this.keyType="ecdsa":(t&&t.includes("ED25519"),this.keyType="ed25519"),this.initializeOperatorWithKeyType()}initializeOperatorWithKeyType(){if(!this.auth.privateKey)return;const e="ecdsa"===this.keyType?i.PrivateKey.fromStringECDSA(this.auth.privateKey):i.PrivateKey.fromStringED25519(this.auth.privateKey);this.client.setOperator(this.operatorId,e)}createPersonalProfile(e,t){return{version:"1.0",type:nc.PERSONAL,display_name:e,alias:t?.alias,bio:t?.bio,socials:t?.socials,profileImage:t?.profileImage,properties:t?.properties,inboundTopicId:t?.inboundTopicId,outboundTopicId:t?.outboundTopicId}}createAIAgentProfile(e,t,i,n,o){const a=this.validateProfile({version:"1.0",type:nc.AI_AGENT,display_name:e,alias:o?.alias,bio:o?.bio,socials:o?.socials,profileImage:o?.profileImage,properties:o?.properties,inboundTopicId:o?.inboundTopicId,outboundTopicId:o?.outboundTopicId,aiAgent:{type:t,capabilities:i,model:n,creator:o?.creator}});if(!a.valid)throw new Error(`Invalid AI Agent Profile: ${a.errors.join(", ")}`);return{version:"1.0",type:nc.AI_AGENT,display_name:e,alias:o?.alias,bio:o?.bio,socials:o?.socials,profileImage:o?.profileImage,properties:o?.properties,inboundTopicId:o?.inboundTopicId,outboundTopicId:o?.outboundTopicId,aiAgent:{type:t,capabilities:i,model:n,creator:o?.creator}}}createMCPServerProfile(e,t,i){const n=this.validateProfile({version:"1.0",type:nc.MCP_SERVER,display_name:e,alias:i?.alias,bio:i?.bio,socials:i?.socials,profileImage:i?.profileImage,properties:i?.properties,inboundTopicId:i?.inboundTopicId,outboundTopicId:i?.outboundTopicId,mcpServer:t});if(!n.valid)throw new Error(`Invalid MCP Server Profile: ${n.errors.join(", ")}`);return{version:"1.0",type:nc.MCP_SERVER,display_name:e,alias:i?.alias,bio:i?.bio,socials:i?.socials,profileImage:i?.profileImage,properties:i?.properties,inboundTopicId:i?.inboundTopicId,outboundTopicId:i?.outboundTopicId,mcpServer:t}}validateProfile(e){const t=Ic.safeParse(e);if(t.success)return{valid:!0,errors:[]};return{valid:!1,errors:t.error.errors.map((e=>{const t=e.path.join(".");let i=e.message;if("invalid_type"===e.code)i=`Expected ${e.expected}, got ${e.received}`;else if("invalid_enum_value"===e.code){const t=e.options?.join(", ");i=`Invalid value. Valid options are: ${t}`}else"too_small"===e.code&&"string"===e.type&&(i="Cannot be empty");return`${t}: ${i}`}))}}profileToJSONString(e){return JSON.stringify(e)}parseProfileFromString(e){try{const t=JSON.parse(e),i=this.validateProfile(t);return i.valid?t:(this.logger.error("Invalid profile format:",i.errors),null)}catch(t){return this.logger.error("Error parsing profile:"),null}}setProfileForAccountMemo(e,t=1){return`hcs-11:hcs://${t}/${e}`}async executeTransaction(e){try{if(this.auth.privateKey){const t=await e.signWithOperator(this.client),n=await t.execute(this.client),o=await n.getReceipt(this.client);return o.status.toString()!==i.Status.Success.toString()?{success:!1,error:`Transaction failed: ${o.status.toString()}`}:{success:!0,result:o}}if(!this.auth.signer)throw new Error("No valid authentication method provided");const t=this.auth.signer,n=await e.freezeWithSigner(t),o=await n.executeWithSigner(t),a=await o.getReceiptWithSigner(t);return a.status.toString()!==i.Status.Success.toString()?{success:!1,error:`Transaction failed: ${a.status.toString()}: ${i.Status.Success.toString()}`}:{success:!0,result:a}}catch(t){return{success:!1,error:t instanceof Error?t.message:"Unknown error during transaction execution"}}}async inscribeImage(e,t,i){try{const n=i?.progressCallback,o=new Ds({module:"HCS11-Image",logger:this.logger,callback:n});o.preparing("Preparing to inscribe image",0);const a=u.lookup(t)||"application/octet-stream",r=i?.waitForConfirmation??!0;let s;if(this.auth.signer){if(!("accountId"in this.auth.signer))throw o.failed("Signer must be a DAppSigner for inscription"),new Error("Signer must be a DAppSigner for inscription");o.preparing("Using signer for inscription",10),s=await qs({type:"buffer",buffer:e,fileName:t,mimeType:a},this.auth.signer,{network:this.network,waitForConfirmation:r,waitMaxAttempts:150,waitIntervalMs:4e3,logging:{level:"debug"},progressCallback:e=>{const t=10+.8*(e.progressPercent||0);o.report({stage:e.stage,message:e.message,progressPercent:t,details:e.details})}})}else{if(!this.auth.privateKey)throw o.failed("Private key is required for inscription"),this.logger.error("Private key is required for inscription"),new Error("Private key is required for inscription");o.preparing("Using private key for inscription",10),s=await zs({type:"buffer",buffer:e,fileName:t,mimeType:a},{accountId:this.auth.operatorId,privateKey:this.auth.privateKey,network:this.network},{waitForConfirmation:r,waitMaxAttempts:150,waitIntervalMs:2e3,logging:{level:"debug"},progressCallback:e=>{const t=10+.8*(e.progressPercent||0);o.report({stage:e.stage,message:e.message,progressPercent:t,details:e.details})}})}return s.confirmed?(o.completed("Image inscription completed",{topic_id:s.inscription.topic_id}),{imageTopicId:s.inscription.topic_id||"",transactionId:s.result.jobId,success:!0}):(o.verifying("Waiting for inscription confirmation",50,{jobId:s.result.jobId}),{imageTopicId:"",transactionId:s.result.jobId,success:!1,error:"Inscription not confirmed"})}catch(n){return this.logger.error("Error inscribing image:",n),{imageTopicId:"",transactionId:"",success:!1,error:n.message||"Error inscribing image"}}}async inscribeProfile(e,t){this.logger.info("Inscribing HCS-11 profile");const n=t?.progressCallback,o=new Ds({module:"HCS11-Profile",logger:this.logger,callback:n});o.preparing("Validating profile data",5);const a=this.validateProfile(e);if(!a.valid)return o.failed(`Invalid profile: ${a.errors.join(", ")}`),{profileTopicId:"",transactionId:"",success:!1,error:`Invalid profile: ${a.errors.join(", ")}`};o.preparing("Formatting profile for inscription",15);const r=this.profileToJSONString(e),s=`profile-${e.display_name.toLowerCase().replace(/\s+/g,"-")}.json`;try{const e=globalThis.Buffer.from(r,"utf-8"),t="application/json";o.preparing("Preparing profile for inscription",20);const n={type:"buffer",buffer:e,fileName:s,mimeType:t},a={waitForConfirmation:!0,mode:"file",network:this.network,waitMaxAttempts:100,waitIntervalMs:2e3,progressCallback:e=>{const t=20+.75*Number(e?.progressPercent||0);o?.report({stage:e.stage,message:e.message,progressPercent:t,details:e.details})}};o.submitting("Submitting profile to Hedera network",30);const c="ed25519"===this.keyType?i.PrivateKey.fromStringED25519(this.auth.privateKey):i.PrivateKey.fromStringECDSA(this.auth.privateKey),p=this.auth.privateKey?await zs(n,{accountId:this.auth.operatorId,privateKey:c,network:this.network},a):await qs(n,this.auth.signer,a);if(!p.confirmed||!p.inscription.topic_id)return o.failed("Failed to inscribe profile content"),{profileTopicId:"",transactionId:"",success:!1,error:"Failed to inscribe profile content"};const l=p.inscription.topic_id;return o.completed("Profile inscription completed",{topicId:l,transactionId:p.result.transactionId}),{profileTopicId:l,transactionId:p.result.transactionId,success:!0}}catch(c){return o.failed(`Error inscribing profile: ${c.message||"Unknown error"}`),{profileTopicId:"",transactionId:"",success:!1,error:c.message||"Unknown error during inscription"}}}async updateAccountMemoWithProfile(e,t){try{this.logger.info(`Updating account memo for ${e} with profile ${t}`);const n=this.setProfileForAccountMemo(t),o=(new i.AccountUpdateTransaction).setAccountMemo(n).setAccountId(e);return this.executeTransaction(o)}catch(n){return this.logger.error(`Error updating account memo: ${n instanceof Error?n.message:"Unknown error"}`),{success:!1,error:n instanceof Error?n.message:"Unknown error updating account memo"}}}async createAndInscribeProfile(e,t=!0,i){const n=i?.progressCallback,o=new Ds({module:"HCS11-ProfileCreation",logger:this.logger,callback:n});o.preparing("Starting profile creation process",0);const a=o.createSubProgress({minPercent:0,maxPercent:80,logPrefix:"Inscription"}),r=await this.inscribeProfile(e,{...i,progressCallback:e=>{a.report({stage:e.stage,message:e.message,progressPercent:e.progressPercent,details:e.details})}});if(!r?.success)return o.failed("Profile inscription failed",{error:r?.error}),r;if(o.confirming("Profile inscribed, updating account memo",85),t){const e=await this.updateAccountMemoWithProfile(this.auth.operatorId,r.profileTopicId);if(!e.success)return o.failed("Failed to update account memo",{error:e?.error}),{...r,success:!1,error:e?.error}}return o.completed("Profile creation completed successfully",{profileTopicId:r.profileTopicId,transactionId:r.transactionId}),r}async getCapabilitiesFromTags(e){const t=[];if(0===e.length)return[rc.TEXT_GENERATION];for(const i of e){const e=lc[i.toLowerCase()];void 0===e||t.includes(e)||t.push(e)}return 0===t.length&&t.push(rc.TEXT_GENERATION),t}getAgentTypeFromMetadata(e){return"autonomous"===e.type?oc.AUTONOMOUS:oc.MANUAL}async fetchProfileByAccountId(e,t){try{this.logger.info(`Fetching profile for account ${e.toString()} on ${this.network}`);const n=await this.mirrorNode.getAccountMemo(e.toString());if(this.logger.info(`Got account memo: ${n}`),!n?.startsWith("hcs-11:"))return{success:!1,error:`Account ${e.toString()} does not have a valid HCS-11 memo`};this.logger.info(`Found HCS-11 memo: ${n}`);const o=n.substring(7);if(!o?.startsWith("hcs://")){if(o.startsWith("ipfs://")){this.logger.warn("IPFS protocol references are not fully supported");const e=await fetch(`https://ipfs.io/ipfs/${o.replace("ipfs://","")}`),t=await e.json();return{success:!0,profile:t,topicInfo:{inboundTopic:t.inboundTopicId,outboundTopic:t.outboundTopicId,profileTopicId:t.profileTopicId}}}if(o.startsWith("ar://")){const e=o.replace("ar://",""),t=await fetch(`https://arweave.net/${e}`);if(!t.ok)return{success:!1,error:`Failed to fetch profile from Arweave ${e}: ${t.statusText}`};const i=await t.json();return{success:!0,profile:i,topicInfo:{inboundTopic:i.inboundTopicId,outboundTopic:i.outboundTopicId,profileTopicId:i.profileTopicId}}}return{success:!1,error:`Invalid protocol reference format: ${o}`}}{const e=o.match(/hcs:\/\/(\d+)\/(.+)/);if(!e)return{success:!1,error:`Invalid HCS protocol reference format: ${o}`};const[n,a,r]=e,s=t||this.network||"mainnet";this.logger.info(`Retrieving profile from Kiloscribe CDN: ${r}`);const c=`https://kiloscribe.com/api/inscription-cdn/${r}?network=${s}`;try{const e=await fetch(c);if(!e.ok)return{success:!1,error:`Failed to fetch profile from Kiloscribe CDN: ${e.statusText}`};const t=await e.json();return t?{success:!0,profile:t,topicInfo:{inboundTopic:t.inboundTopicId,outboundTopic:t.outboundTopicId,profileTopicId:r}}:{success:!1,error:`No profile data found for topic ${r}`}}catch(i){return this.logger.error(`Error retrieving from Kiloscribe CDN: ${i.message}`),{success:!1,error:`Error retrieving from Kiloscribe CDN: ${i.message}`}}}}catch(n){return this.logger.error(`Error fetching profile: ${n.message}`),{success:!1,error:`Error fetching profile: ${n.message}`}}}}const Sc=e=>new Promise((t=>setTimeout(t,e)));class Ac{async checkRegistrationStatus(e,t,i,n){try{const o=await fetch(`${i}/api/request-confirm`,{method:"POST",headers:{"Content-Type":"application/json","X-Network":t},body:JSON.stringify({transaction_id:e})});if(!o.ok){const e=`Failed to confirm registration: ${o.statusText}`;throw n&&n.error(e),new Error(e)}return await o.json()}catch(o){throw n&&n.error(`Error checking registration status: ${o.message}`),o}}async waitForRegistrationConfirmation(e,t,i,n=60,o=2e3,a){let r=0;for(;r<n;){a&&a.info(`Checking registration status. Attempt ${r+1}/${n}`);const s=await this.checkRegistrationStatus(e,t,i,a);if("success"===s.status)return a&&a.info("Registration confirmed successfully"),!0;if("failed"===s.status)throw a&&a.error("Registration confirmation failed"),new Error("Registration confirmation failed");a&&a.info(`Registration still pending. Waiting ${o}ms before next attempt`),await new Promise((e=>setTimeout(e,o))),r++}return a&&a.warn(`Registration not confirmed after ${n} attempts`),!1}async executeRegistration(e,t="mainnet",i="https://moonscape.tech",n){try{n&&n.info("Registering agent with guarded registry");try{const i=new Tc({network:t,auth:{operatorId:"0.0.0"}});n?.info(`Fetching profile by account ID ${e} on ${t}`),await Sc(5e3);const o=await i.fetchProfileByAccountId(e,t);if(n?.info("Profile fetched",o),o?.error)return n?.error("Error fetching profile",o.error),{error:o.error,success:!1};if(!o?.success||!o?.profile)return n&&n.error("Profile not found for agent registration"),{error:"Profile not found for the provided account ID",success:!1};if(!o.profile.inboundTopicId)return n&&n.error("Missing inbound topic ID in profile"),{error:"Profile is missing required inbound topic ID",success:!1};if(!o.profile.outboundTopicId)return n&&n.error("Missing outbound topic ID in profile"),{error:"Profile is missing required outbound topic ID",success:!1};n&&n.info(`Profile validation successful. Inbound topic: ${o.profile.inboundTopicId}, Outbound topic: ${o.profile.outboundTopicId}`)}catch(o){return n&&n.error(`Error validating profile: ${o.message}`),{error:`Error validating profile: ${o.message}`,success:!1}}const a=await fetch(`${i}/api/request-register`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"*/*","Accept-Language":"en;q=0.5",Origin:i,Referer:`${i}/`,"X-Network":t},body:JSON.stringify({accountId:e})}),r=await a.json();return a.ok?(n&&n.info(`Created new registration request. Transaction ID: ${r.transaction_id}`),{transactionId:r.transaction_id,transaction:r.transaction,success:!0}):r.details?.length>0?{validationErrors:r.details,error:r.error||"Validation failed",success:!1}:{error:r.error||"Failed to register agent",success:!1}}catch(a){return{error:`Error during registration request: ${a.message}`,success:!1}}}async findRegistrations(e={},t="https://moonscape.tech"){try{const i=new URLSearchParams;e.tags?.forEach((e=>i.append("tags",e.toString()))),e.accountId&&i.append("accountId",e.accountId),e.network&&i.append("network",e.network);const n=await fetch(`${t}/api/registrations?${i}`,{headers:{Accept:"*/*","Accept-Language":"en;q=0.5",Origin:t,Referer:`${t}/`}});if(!n.ok){return{registrations:[],error:await n.text()||"Failed to fetch registrations",success:!1}}const o=await n.json();return o.error?{registrations:[],error:o.error,success:!1}:{registrations:o.registrations||[],success:!0}}catch(i){return{registrations:[],error:`Error fetching registrations: ${i.message}`,success:!1}}}}var Ec=(e=>(e.INBOUND="inbound",e.OUTBOUND="outbound",e.CONNECTION="connection",e))(Ec||{});class _c extends Ac{constructor(e){super(),this.network=e.network,this.logger=d.getInstance({level:e.logLevel||"info",module:"HCS10-BaseClient",prettyPrint:e.prettyPrint,silent:e.silent}),this.mirrorNode=new Hs(e.network,this.logger,e.mirrorNode),this.feeAmount=e.feeAmount||.001}configureMirrorNode(e){this.mirrorNode.configureMirrorNode(e),this.logger.info("Mirror node configuration updated")}extractTopicFromOperatorId(e){if(!e)return"";const t=e.split("@");return t.length>0?t[0]:""}extractAccountFromOperatorId(e){if(!e)return"";const t=e.split("@");return t.length>1?t[1]:""}async getMessageStream(e,t){try{const i=await this.mirrorNode.getTopicMessages(e,t),n=["message","close_connection","transaction"];return{messages:i.filter((e=>{if("hcs-10"!==e.p||!n.includes(e.op))return!1;if("message"===e.op||"close_connection"===e.op){if(!e.operator_id)return!1;if(!this.isValidOperatorId(e.operator_id))return!1;if("message"===e.op&&!e.data)return!1}if("transaction"===e.op){if(!e.operator_id||!e.schedule_id)return!1;if(!this.isValidOperatorId(e.operator_id))return!1}return!0}))}}catch(i){return this.logger&&this.logger.error(`Error fetching messages: ${i.message}`),{messages:[]}}}async getPublicTopicInfo(e){try{return await this.mirrorNode.getTopicInfo(e)}catch(t){return this.logger.error(`Error getting public topic info for ${e}:`,t),null}}async canSubmitToTopic(e,t){try{const o=await this.mirrorNode.getTopicInfo(e);if(!o)return{canSubmit:!1,requiresFee:!1,reason:"Topic does not exist"};if(!o.submit_key?.key)return{canSubmit:!0,requiresFee:!1};try{const e=await this.mirrorNode.getPublicKey(t);if("ProtobufEncoded"===o.submit_key._type){const t=globalThis.Buffer.from(o.submit_key.key,"hex");if(await this.mirrorNode.checkKeyListAccess(t,e))return{canSubmit:!0,requiresFee:!1}}else{const t=i.PublicKey.fromString(o.submit_key.key);if(e.toString()===t.toString())return{canSubmit:!0,requiresFee:!1}}}catch(n){this.logger.error(`Key validation error: ${n instanceof Error?n.message:String(n)}`)}return o.fee_schedule_key?.key&&o.custom_fees?.fixed_fees?.length>0?{canSubmit:!0,requiresFee:!0,reason:"Requires fee payment via HIP-991"}:{canSubmit:!1,requiresFee:!1,reason:"User does not have submit permission for this topic"}}catch(n){const e=n instanceof Error?n.message:String(n);return this.logger.error(`Topic submission validation error: ${e}`),{canSubmit:!1,requiresFee:!1,reason:`Error: ${e}`}}}async getMessages(e,t){try{const i=await this.mirrorNode.getTopicMessages(e,t);return{messages:i.filter((e=>{if("hcs-10"!==e.p)return!1;if("message"===e.op){if(!e.data)return!1;if(e.operator_id&&!this.isValidOperatorId(e.operator_id))return!1}return!0}))}}catch(i){return this.logger&&this.logger.error(`Error fetching messages: ${i.message}`),{messages:[]}}}async requestAccount(e){try{if(!e)throw new Error("Account ID is required");return await this.mirrorNode.requestAccount(e)}catch(t){throw this.logger.error("Failed to fetch account",t),t}}async getAccountMemo(e){return await this.mirrorNode.getAccountMemo(e)}async retrieveProfile(e,t){this.logger.debug(`Retrieving profile for account: ${e}`);const i=`${e}-${this.network}`;if(!t){const t=Cc.getInstance().get(i);if(t)return this.logger.debug(`Cache hit for profile: ${e}`),t}try{const t=new Tc({network:this.network,auth:{operatorId:"0.0.0"},logLevel:"info"}),n=await t.fetchProfileByAccountId(e,this.network);if(!n?.success)return this.logger.error(`Failed to retrieve profile for account ID: ${e}`,n?.error),{profile:null,success:!1,error:n?.error||`Failed to retrieve profile for account ID: ${e}`};const o=n.profile;let a=null;n.topicInfo?.inboundTopic&&n.topicInfo?.outboundTopic&&n.topicInfo?.profileTopicId&&(a={inboundTopic:n.topicInfo.inboundTopic,outboundTopic:n.topicInfo.outboundTopic,profileTopicId:n.topicInfo.profileTopicId});const r={profile:o,topicInfo:a,success:!0};return Cc.getInstance().set(i,r),r}catch(n){const e=`Failed to retrieve profile: ${n.message}`;return this.logger.error(e),{profile:null,success:!1,error:e}}}async retrieveOutboundConnectTopic(e){return await this.retrieveCommunicationTopics(e,!0)}async retrieveCommunicationTopics(e,t){try{const i=await this.retrieveProfile(e,t);if(!i?.success)throw new Error(i.error||"Failed to retrieve profile");const n=i.profile;if(!n.inboundTopicId||!n.outboundTopicId)throw new Error("Invalid HCS-11 profile for HCS-10 agent: missing inboundTopicId or outboundTopicId");if(!i.topicInfo)throw new Error(`TopicInfo is missing in the profile for account ${e}`);return i.topicInfo}catch(i){const e=i,t=`Failed to retrieve topic info: ${e.message}`;throw this.logger.error(t),e}}async retrieveOutboundMessages(e,t){try{const i=await this.retrieveCommunicationTopics(e);if(!i)return this.logger.warn(`No outbound connect topic found for agentAccountId: ${e}`),[];return(await this.getMessages(i.outboundTopic,t)).messages.filter((e=>"hcs-10"===e.p&&("connection_request"===e.op||"connection_created"===e.op||"message"===e.op)))}catch(i){const e=`Failed to retrieve outbound messages: ${i.message}`;return this.logger.error(e),[]}}async hasConnectionCreated(e,t){try{const i=await this.retrieveCommunicationTopics(e);return(await this.retrieveOutboundMessages(i.outboundTopic)).some((e=>"connection_created"===e.op&&e.connection_id===t))}catch(i){const e=`Failed to check connection created: ${i.message}`;return this.logger.error(e),!1}}async getMessageContent(e,t=!1){if(!e.match(/^hcs:\/\/(\d+)\/([0-9]+\.[0-9]+\.[0-9]+)$/))return e;try{const i=new Gs(this.logger.getLevel());if(!i.isValidHRL(e))return e;return(await i.resolveHRL(e,{network:this.network,returnRaw:t})).content}catch(i){const e=`Error resolving HRL reference: ${i.message}`;throw this.logger.error(e),new Error(e)}}async getMessageContentWithType(e,t=!1){if(!e.match(/^hcs:\/\/(\d+)\/([0-9]+\.[0-9]+\.[0-9]+)$/))return{content:e,contentType:"text/plain",isBinary:!1};try{const i=new Gs(this.logger.getLevel());return await i.getContentWithType(e,{network:this.network,returnRaw:t})}catch(i){const e=`Error resolving HRL reference with type: ${i.message}`;throw this.logger.error(e),new Error(e)}}async submitConnectionRequest(e,t){const i=this.getAccountAndSigner();if(!i?.accountId)throw new Error("Operator account ID is not set");const n=await this.getOperatorId(),o=i.accountId,a=await this.canSubmitToTopic(e,o);if(!a?.canSubmit)throw new Error(`Cannot submit to topic: ${a.reason}`);const r=await this.retrieveInboundAccountId(e);if(!r)throw new Error("Failed to retrieve topic info account ID");const s={p:"hcs-10",op:"connection_request",operator_id:n,m:t},c=a.requiresFee,p=await this.submitPayload(e,s,void 0,c);this.logger.info(`Submitted connection request to topic ID: ${e}`);const l=await this.retrieveCommunicationTopics(o);if(!l)throw new Error("Failed to retrieve outbound topic");const u=p.topicSequenceNumber?.toNumber();if(!u)throw new Error("Failed to get response sequence number");const d=`${e}@${r}`;return await this.submitPayload(l.outboundTopic,{...s,outbound_topic_id:l.outboundTopic,connection_request_id:u,operator_id:d}),p}async recordOutboundConnectionConfirmation({outboundTopicId:e,requestorOutboundTopicId:t,connectionRequestId:i,confirmedRequestId:n,connectionTopicId:o,operatorId:a,memo:r}){const s={p:"hcs-10",op:"connection_created",connection_topic_id:o,outbound_topic_id:e,requestor_outbound_topic_id:t,confirmed_request_id:n,connection_request_id:i,operator_id:a,m:r};return await this.submitPayload(e,s)}async waitForConnectionConfirmation(e,t,i=60,n=2e3,o=!0){this.logger.info(`Waiting for connection confirmation on inbound topic ${e} for request ID ${t}`);for(let a=0;a<i;a++){this.logger.info(`Attempt ${a+1}/${i} to find connection confirmation`);const r=(await this.mirrorNode.getTopicMessages(e,{order:"desc",limit:100})).filter((e=>"connection_created"===e.op));if(this.logger.info(`Found ${r.length} connection_created messages`),r.length>0)for(const e of r)if(Number(e.connection_id)===Number(t)){const i={connectionTopicId:e.connection_topic_id,sequence_number:Number(e.sequence_number),confirmedBy:e.operator_id,memo:e.m},n=this.extractAccountFromOperatorId(i.confirmedBy),a=this.getAccountAndSigner(),r=await this.retrieveCommunicationTopics(n),s=await this.retrieveCommunicationTopics(a.accountId);return this.logger.info("Connection confirmation found",i),o&&await this.recordOutboundConnectionConfirmation({requestorOutboundTopicId:r.outboundTopic,outboundTopicId:s.outboundTopic,connectionRequestId:t,confirmedRequestId:i.sequence_number,connectionTopicId:i.connectionTopicId,operatorId:i.confirmedBy,memo:i.memo||"Connection confirmed"}),i}a<i-1&&(this.logger.info(`No matching confirmation found, waiting ${n}ms before retrying...`),await new Promise((e=>setTimeout(e,n))))}throw new Error(`Connection confirmation not found after ${i} attempts for request ID ${t}`)}async getOperatorId(e){if(this.operatorId&&!e)return this.operatorId;const t=this.getAccountAndSigner();if(!t.accountId)throw new Error("Operator ID not found");const i=await this.retrieveProfile(t.accountId);if(!i.success)throw new Error("Failed to retrieve profile");const n=`${i.topicInfo?.inboundTopic}@${t.accountId}`;return this.operatorId=n,n}async retrieveInboundAccountId(e){const t=await this.mirrorNode.getTopicInfo(e);if(!t?.memo)throw new Error("Failed to retrieve topic info");const i=t.memo.toString().split(":"),n=i?.[4];if(!n)throw new Error("Failed to retrieve topic info account ID");return n}clearCache(){Cc.getInstance().clear()}_generateHcs10Memo(e,t){const i=t.ttl??60;switch(e){case"inbound":if(!t.accountId)throw new Error("accountId is required for inbound memo");return`hcs-10:0:${i}:0:${t.accountId}`;case"outbound":return`hcs-10:0:${i}:1`;case"connection":if(!t.inboundTopicId||void 0===t.connectionId)throw new Error("inboundTopicId and connectionId are required for connection memo");return`hcs-10:1:${i}:2:${t.inboundTopicId}:${t.connectionId}`;default:throw new Error(`Invalid HCS-10 memo type: ${e}`)}}async checkRegistrationStatus(e,t,i){try{const n=await fetch(`${i}/api/request-confirm`,{method:"POST",headers:{"Content-Type":"application/json","X-Network":t},body:JSON.stringify({transaction_id:e})});if(!n.ok)throw new Error(`Failed to confirm registration: ${n.statusText}`);return await n.json()}catch(n){const e=n,t=`Error checking registration status: ${e.message}`;throw this.logger.error(t),e}}isValidOperatorId(e){if(!e)return!1;const t=e.split("@");if(2!==t.length)return!1;const i=t[0],n=t[1];if(!i)return!1;if(!n)return!1;const o=/^[0-9]+\.[0-9]+\.[0-9]+$/;return!!o.test(n)&&!!o.test(i)}async getTransactionRequests(e,t){this.logger.debug(`Retrieving transaction requests from topic ${e}`);const{messages:i}=await this.getMessageStream(e,{limit:t?.limit,sequenceNumber:t?.sequenceNumber,order:t?.order||"desc"}),n=i.filter((e=>"transaction"===e.op&&e.schedule_id)).map((e=>({operator_id:e.operator_id||"",schedule_id:e.schedule_id||"",data:e.data||"",memo:e.m,sequence_number:Number(e.sequence_number)}))).sort(((e,t)=>e.sequence_number&&t.sequence_number?t.sequence_number-e.sequence_number:0));return t?.limit?n.slice(0,t.limit):n}getHcs10TransactionMemo(e){if("object"!=typeof e||!("op"in e))return null;const t=e;let i,n;switch(t.op){case"register":i="0",n="0";break;case"delete":i="1",n="0";break;case"migrate":i="2",n="0";break;case"connection_request":i="3",n=t.outbound_topic_id?"2":"1";break;case"connection_created":i="4",n=t.outbound_topic_id?"2":"1";break;case"connection_closed":i="5",n=t.outbound_topic_id?"2":"3";break;case"message":case"transaction":default:i="6",n="3";break;case"close_connection":i="5",n="3"}return`hcs-10:op:${i}:${n}`}}class Cc{constructor(){this.CACHE_TTL=36e5,this.cache=new Map,this.cacheExpiry=new Map}static getInstance(){return Cc.instance||(Cc.instance=new Cc),Cc.instance}set(e,t){this.cache.set(e,t),this.cacheExpiry.set(e,Date.now()+this.CACHE_TTL)}get(e){const t=this.cacheExpiry.get(e);if(t&&t>Date.now())return this.cache.get(e);t&&(this.cache.delete(e),this.cacheExpiry.delete(e))}clear(){this.cache.clear(),this.cacheExpiry.clear()}}class Rc extends Error{constructor(e,t){super(e),this.payloadSize=t,this.name="PayloadSizeError"}}class Nc extends Error{constructor(e){super(e),this.name="AccountCreationError"}}class Pc extends Error{constructor(e){super(e),this.name="TopicCreationError"}}class Oc extends Error{constructor(e){super(e),this.name="ConnectionConfirmationError"}}class jc{constructor(){this.config={},this.logger=d.getInstance({module:"AgentBuilder"})}setName(e){return this.config.name=e,this}setAlias(e){return this.config.alias=e,this}setBio(e){return this.config.bio=e,this}setDescription(e){return this.config.bio=e,this}setCapabilities(e){return this.config.capabilities=e,this}setAgentType(e){return this.config.metadata?this.config.metadata.type=e:this.config.metadata={type:e},this}setType(e){return this.config.metadata?this.config.metadata.type=e:this.config.metadata={type:e},this}setModel(e){return this.config.metadata||(this.config.metadata={type:"manual"}),this.config.metadata.model=e,this}setCreator(e){return this.config.metadata||(this.config.metadata={type:"manual"}),this.config.metadata.creator=e,this}addSocial(e,t){return this.config.metadata||(this.config.metadata={type:"manual"}),this.config.metadata.socials||(this.config.metadata.socials={}),this.config.metadata.socials[e]=t,this}addProperty(e,t){return this.config.metadata||(this.config.metadata={type:"manual"}),this.config.metadata.properties||(this.config.metadata.properties={}),this.config.metadata.properties[e]=t,this}setMetadata(e){return this.config.metadata=e,this}setProfilePicture(e,t){return this.config.pfpBuffer=e,this.config.pfpFileName=t,this}setExistingProfilePicture(e){return this.config.existingPfpTopicId=e,this}setNetwork(e){return this.config.network=e,this}setInboundTopicType(e){return this.config.inboundTopicType=e,this}setFeeConfig(e){return this.config.feeConfig=e,this}setConnectionFeeConfig(e){return this.config.connectionFeeConfig=e,this}setExistingAccount(e,t){return this.config.existingAccount={accountId:e,privateKey:t},this}build(){if(!this.config.name)throw new Error("Agent display name is required");if(this.config.bio||this.logger?.warn("Agent description is not set"),this.config.pfpBuffer||this.config.existingPfpTopicId||this.logger.warn("No profile picture provided or referenced."),!this.config.network)throw new Error("Network is required");if(this.config.inboundTopicType||(this.config.inboundTopicType=pc.PUBLIC),this.config.capabilities||(this.config.capabilities=[]),this.config.metadata?this.config.metadata.type||(this.config.metadata.type="manual"):this.config.metadata={type:"manual"},this.config.inboundTopicType===pc.FEE_BASED&&!this.config.feeConfig)throw new Error("Fee configuration is required for fee-based topics");return this.config}}class $c extends _c{constructor(e){if(super({network:e.network,logLevel:e.logLevel,prettyPrint:e.prettyPrint,feeAmount:e.feeAmount,mirrorNode:e.mirrorNode,silent:e.silent,keyType:e.keyType}),this.client="mainnet"===e.network?i.Client.forMainnet():i.Client.forTestnet(),this.operatorPrivateKey=e.operatorPrivateKey,this.operatorAccountId=e.operatorId,e.keyType){this.keyType=e.keyType;const t="ecdsa"===this.keyType?i.PrivateKey.fromStringECDSA(this.operatorPrivateKey):i.PrivateKey.fromStringED25519(this.operatorPrivateKey);this.client.setOperator(e.operatorId,t)}else{try{const t=ic(this.operatorPrivateKey);this.client.setOperator(e.operatorId,t.privateKey),this.keyType=t.detectedType}catch(t){this.logger.warn("Failed to detect key type from private key format, will query mirror node"),this.keyType="ed25519"}this.initializeOperator()}this.network=e.network,this.logger=d.getInstance({level:e.logLevel||"info",module:"HCS-SDK",silent:e.silent}),this.guardedRegistryBaseUrl=e.guardedRegistryBaseUrl||"https://moonscape.tech",this.hcs11Client=new Tc({network:e.network,auth:{operatorId:e.operatorId,privateKey:e.operatorPrivateKey},logLevel:e.logLevel,silent:e.silent,keyType:e.keyType})}async initializeOperator(){const e=await this.requestAccount(this.operatorAccountId),t=e?.key?._type;t.includes("ECDSA")?this.keyType="ecdsa":(t.includes("ED25519"),this.keyType="ed25519");const n="ecdsa"===this.keyType?i.PrivateKey.fromStringECDSA(this.operatorPrivateKey):i.PrivateKey.fromStringED25519(this.operatorPrivateKey);return this.logger.debug(`Setting operator: ${this.operatorAccountId} with key type: ${this.keyType}`),this.client.setOperator(this.operatorAccountId,n),{accountId:this.operatorAccountId,privateKey:this.operatorPrivateKey,keyType:this.keyType,client:this.client}}getClient(){return this.client}async createAccount(e=50){this.keyType||await this.initializeOperator(),this.logger.info(`Creating new account with ${e} HBAR initial balance`);const t=i.PrivateKey.generateED25519(),n=(new i.AccountCreateTransaction).setKeyWithoutAlias(t.publicKey).setInitialBalance(new i.Hbar(e));this.logger.debug("Executing account creation transaction");const o=await n.execute(this.client),a=(await o.getReceipt(this.client)).accountId;if(!a)throw this.logger.error("Account creation failed: accountId is null"),new Nc("Failed to create account: accountId is null");return this.logger.info(`Account created successfully: ${a.toString()}`),{accountId:a.toString(),privateKey:t.toString()}}async createInboundTopic(e,t,i=60,n){this.keyType||await this.initializeOperator();const o=this._generateHcs10Memo(Ec.INBOUND,{accountId:e,ttl:i});let a,r;switch(t){case pc.PUBLIC:a=!1;break;case pc.CONTROLLED:a=!0;break;case pc.FEE_BASED:if(a=!1,!n)throw new Error("Fee configuration builder is required for fee-based topics");n.customFees.forEach((t=>{t.feeCollectorAccountId||(this.logger.debug(`Defaulting fee collector for token ${t.feeTokenId||"HBAR"} to agent ${e}`),t.feeCollectorAccountId=e)})),r=n.build();break;default:throw new Error(`Unsupported inbound topic type: ${t}`)}return this.createTopic(o,!0,a,r)}async createAgent(e,t=60,i,n){this.keyType||await this.initializeOperator();const o=e.build(),a=this.client.operatorAccountId?.toString();if(!a)throw new Error("Failed to retrieve operator account ID");const r=await this._createEntityTopics(t,{outboundTopicId:i?.outboundTopicId||"",inboundTopicId:i?.inboundTopicId||"",pfpTopicId:i?.pfpTopicId||o.existingPfpTopicId||"",profileTopicId:i?.profileTopicId||""},a,o.inboundTopicType,o.feeConfig,o.pfpBuffer,o.pfpFileName,n);if(r.profileTopicId)this.logger.info(`Using existing profile topic ID: ${r.profileTopicId}`);else{n&&n({stage:"preparing",message:"Creating agent profile",progressPercent:60,details:{outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,state:{currentStage:"profile",completedPercentage:60}}});const e=await this.storeHCS11Profile(o.name,o.bio,r.inboundTopicId,r.outboundTopicId,o.capabilities,o.metadata,o.pfpBuffer&&o.pfpBuffer.length>0&&!r.pfpTopicId?o.pfpBuffer:void 0,o.pfpFileName,r.pfpTopicId);r.profileTopicId=e.profileTopicId,this.logger.info(`Profile stored with topic ID: ${r.profileTopicId}`),n&&n({stage:"preparing",message:"Agent profile created",progressPercent:70,details:{outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,profileTopicId:r.profileTopicId,state:{currentStage:"profile",completedPercentage:70}}})}return r}async inscribePfp(e,t){try{this.logger.info("Inscribing profile picture using HCS-11 client");const i=await this.hcs11Client.inscribeImage(e,t);if(!i.success)throw this.logger.error(`Failed to inscribe profile picture: ${i.error}`),new Error(i?.error||"Failed to inscribe profile picture");return this.logger.info(`Successfully inscribed profile picture with topic ID: ${i.imageTopicId}`),{pfpTopicId:i.imageTopicId,transactionId:i.transactionId,success:!0}}catch(i){const e=i,t=`Error inscribing profile picture: ${e.message}`;return this.logger.error(t),{pfpTopicId:"",transactionId:"",success:!1,error:e.message}}}async storeHCS11Profile(e,t,i,n,o=[],a,r,s,c){try{let p=c||"";if(!p&&r&&s){this.logger.info("Inscribing profile picture for HCS-11 profile");const e=await this.inscribePfp(r,s);e.success?p=e.pfpTopicId:this.logger.warn(`Failed to inscribe profile picture: ${e.error}, proceeding without pfp`)}else c&&(this.logger.info(`Using existing profile picture with topic ID: ${c} for HCS-11 profile`),p=c);const l=this.hcs11Client.getAgentTypeFromMetadata({type:a.type||"autonomous"}),u=a.socials?Object.entries(a.socials).filter((([e,t])=>t)).map((([e,t])=>({platform:e,handle:t}))):void 0,d=this.hcs11Client.createAIAgentProfile(e,l,o,a.model||"unknown",{alias:e.toLowerCase().replace(/\s+/g,"_"),bio:t,profileImage:p?`hcs://1/${p}`:void 0,socials:u,properties:a.properties,inboundTopicId:i,outboundTopicId:n,creator:a.creator}),m=await this.hcs11Client.createAndInscribeProfile(d,!0);if(!m.success)throw this.logger.error(`Failed to inscribe profile: ${m.error}`),new Error(m.error||"Failed to inscribe profile");return this.logger.info(`Profile inscribed with topic ID: ${m.profileTopicId}, transaction ID: ${m.transactionId}`),{profileTopicId:m.profileTopicId,pfpTopicId:p,transactionId:m.transactionId,success:!0}}catch(p){const e=p,t=`Error storing HCS-11 profile: ${e.message}`;return this.logger.error(t),{profileTopicId:"",pfpTopicId:"",transactionId:"",success:!1,error:e.message}}}async setupFees(e,t,n=[]){let o=e;if(!this.client.operatorPublicKey)return o;if(!t.customFees||0===t.customFees.length)return this.logger.warn("No custom fees provided in fee config for setupFees"),o;t.customFees.length>10&&(this.logger.warn("More than 10 custom fees provided, only the first 10 will be used"),t.customFees=t.customFees.slice(0,10));const a=t.customFees.map((e=>{if(!e.feeCollectorAccountId)return this.logger.error("Internal Error: Fee collector ID missing in setupFees"),null;if("FIXED_FEE"===e.type){const t=(new i.CustomFixedFee).setAmount(Number(e.feeAmount.amount)).setFeeCollectorAccountId(i.AccountId.fromString(e.feeCollectorAccountId));return e.feeTokenId&&t.setDenominatingTokenId(i.TokenId.fromString(e.feeTokenId)),t}return null})).filter(Boolean);if(0===a.length)return this.logger.warn("No valid custom fees to apply in setupFees"),o;const r=[...t.exemptAccounts||[],...n];return r.length>0&&(o=await this.setupExemptKeys(e,r)),o.setFeeScheduleKey(this.client.operatorPublicKey).setCustomFees(a)}async setupExemptKeys(e,t){let i=e;const n=Array.from(new Set(t)).filter((e=>e!==this.client.operatorAccountId?.toString()));let o=[];if(n.length>0)try{o=await Vs(n,this.network,this.logger)}catch(a){const e=`Error getting exempt keys: ${a.message}, continuing without exempt keys`;this.logger.warn(e)}return o.length>0&&(i=i.setFeeExemptKeys(o)),i}async handleConnectionRequest(e,t,n,o,a=60){const r=this._generateHcs10Memo(Ec.CONNECTION,{ttl:a,inboundTopicId:e,connectionId:n});this.logger.info(`Handling connection request ${n} from ${t}`);const s=this.getClient().operatorAccountId?.toString();if(!s)throw new Error("Failed to retrieve operator account ID");let c=await this.mirrorNode.getPublicKey(t);const p=await this.mirrorNode.getPublicKey(s);if(!p)throw new Error("Failed to retrieve public key");const l=new i.KeyList([p,c],1);let u;try{if(o){const e=o.build(),t={...e,exemptAccounts:[...e.exemptAccounts||[]]};u=await this.createTopic(r,l,l,t)}else u=await this.createTopic(r,l,l);this.logger.info(`Created new connection topic ID: ${u}`)}catch(b){const e=`Failed to create connection topic: ${b}`;throw this.logger.error(e),new Pc(e)}const d=`${e}@${s}`,m=await this.confirmConnection(e,u,t,n,"Connection accepted. Looking forward to collaborating!"),f=await this.retrieveCommunicationTopics(s),h=await this.retrieveCommunicationTopics(t),g=`${h.inboundTopic}@${t}`;return await this.recordOutboundConnectionConfirmation({outboundTopicId:f.outboundTopic,requestorOutboundTopicId:h.outboundTopic,connectionRequestId:n,confirmedRequestId:m,connectionTopicId:u,operatorId:g,memo:`Connection established with ${t}`}),{connectionTopicId:u,confirmedConnectionSequenceNumber:m,operatorId:d}}async confirmConnection(e,t,i,n,o,a){const r=await this.getOperatorId();this.logger.info(`Confirming connection with ID ${n}`);const s={p:"hcs-10",op:"connection_created",connection_topic_id:t,connected_account_id:i,operator_id:r,connection_id:n,m:o},c=await this.canSubmitToTopic(e,this.client.operatorAccountId?.toString()||""),p=await this.submitPayload(e,s,a,c.requiresFee),l=p.topicSequenceNumber?.toNumber();if(!l)throw new Oc("Failed to confirm connection: sequence number is null");return l}async sendMessage(e,t,i,n,o){const a=await this.canSubmitToTopic(e,this.client.operatorAccountId?.toString()||""),r={p:"hcs-10",op:"message",operator_id:await this.getOperatorId(),data:t,m:i},s=JSON.stringify(r);if(globalThis.Buffer.from(s).length>1e3){this.logger.info("Message payload exceeds 1000 bytes, storing via inscription");try{const e=globalThis.Buffer.from(t),i=`message-${Date.now()}.json`,n=await this.inscribeFile(e,i,{progressCallback:o?.progressCallback,waitMaxAttempts:o?.waitMaxAttempts,waitIntervalMs:o?.waitIntervalMs});if(!n?.topic_id)throw new Error("Failed to inscribe large message content");r.data=`hcs://1/${n.topic_id}`,this.logger.info(`Large message inscribed with topic ID: ${n.topic_id}`)}catch(c){const e=`Error inscribing large message: ${c.message}`;throw this.logger.error(e),new Error(e)}}return this.logger.info("Submitting message to connection topic",r),await this.submitPayload(e,r,n,a.requiresFee)}async createTopic(e,t,n,o){this.logger.info("Creating topic");const a=(new i.TopicCreateTransaction).setTopicMemo(e);t&&("boolean"==typeof t&&t&&this.client.operatorPublicKey?(a.setAdminKey(this.client.operatorPublicKey),a.setAutoRenewAccountId(this.client.operatorAccountId)):(t instanceof i.PublicKey||t instanceof i.KeyList)&&(a.setAdminKey(t),this.client.operatorAccountId&&a.setAutoRenewAccountId(this.client.operatorAccountId))),n&&("boolean"==typeof n&&n&&this.client.operatorPublicKey?a.setSubmitKey(this.client.operatorPublicKey):(n instanceof i.PublicKey||n instanceof i.KeyList)&&a.setSubmitKey(n)),o&&await this.setupFees(a,o),this.logger.debug("Executing topic creation transaction");const r=await a.execute(this.client),s=await r.getReceipt(this.client);if(!s.topicId)throw this.logger.error("Failed to create topic: topicId is null"),new Error("Failed to create topic: topicId is null");return s.topicId.toString()}async submitPayload(e,t,n,o=!1){const a="string"==typeof t?t:JSON.stringify(t),r=globalThis.Buffer.byteLength(a,"utf8");if(r>1e3)throw new Rc("Payload size exceeds 1000 bytes limit",r);const s=(new i.TopicMessageSubmitTransaction).setTopicId(i.TopicId.fromString(e)).setMessage(a),c=this.getHcs10TransactionMemo(t);let p;if(c&&s.setTransactionMemo(c),o&&(this.logger.info("Topic requires fee payment, setting max transaction fee"),s.setMaxTransactionFee(new i.Hbar(this.feeAmount))),n){const e=s.freezeWith(this.client),t=await e.sign(n);p=await t.execute(this.client)}else p=await s.execute(this.client);const l=await p.getReceipt(this.client);if(!l)throw this.logger.error("Failed to submit message: receipt is null"),new Error("Failed to submit message: receipt is null");return this.logger.info("Message submitted successfully"),l}async inscribeFile(e,t,i){if(this.logger.info("Inscribing file"),!this.client.operatorAccountId)throw this.logger.error("Operator account ID is not set"),new Error("Operator account ID is not set");if(!this.operatorPrivateKey)throw this.logger.error("Operator private key is not set"),new Error("Operator private key is not set");const n=u.lookup(t)||"application/octet-stream",o=await Ms.createWithAuth({type:"server",accountId:this.client.operatorAccountId.toString(),privateKey:this.operatorPrivateKey.toString(),network:this.network}),a={mode:"file",waitForConfirmation:!0,waitMaxAttempts:i?.waitMaxAttempts||30,waitIntervalMs:i?.waitIntervalMs||4e3,progressCallback:i?.progressCallback,logging:{level:this.logger.getLevel?this.logger.getLevel():"info"}},r=await zs({type:"buffer",buffer:e,fileName:t,mimeType:n},{accountId:this.client.operatorAccountId.toString(),privateKey:this.operatorPrivateKey.toString(),network:this.network},a,o);if(!r.confirmed||!r.inscription)throw new Error("Inscription was not confirmed");return r.inscription}async waitForConnectionConfirmation(e,t,i=60,n=2e3,o=!0){this.logger.info(`Waiting for connection confirmation on inbound topic ${e} for request ID ${t}`);for(let a=0;a<i;a++){this.logger.info(`Attempt ${a+1}/${i} to find connection confirmation`);const r=(await this.mirrorNode.getTopicMessages(e)).filter((e=>"connection_created"===e.op));if(this.logger.info(`Found ${r.length} connection_created messages`),r.length>0)for(const e of r)if(Number(e.connection_id)===Number(t)){const i={connectionTopicId:e.connection_topic_id,sequence_number:Number(e.sequence_number),confirmedBy:e.operator_id,memo:e.m},n=this.extractAccountFromOperatorId(i.confirmedBy),a=this.getAccountAndSigner(),r=await this.retrieveCommunicationTopics(n),s=await this.retrieveCommunicationTopics(a.accountId);return this.logger.info("Connection confirmation found",i),o&&await this.recordOutboundConnectionConfirmation({requestorOutboundTopicId:r.outboundTopic,outboundTopicId:s.outboundTopic,connectionRequestId:t,confirmedRequestId:i.sequence_number,connectionTopicId:i.connectionTopicId,operatorId:i.confirmedBy,memo:i.memo||"Connection confirmed"}),i}a<i-1&&(this.logger.info(`No matching confirmation found, waiting ${n}ms before retrying...`),await new Promise((e=>setTimeout(e,n))))}throw new Error(`Connection confirmation not found after ${i} attempts for request ID ${t}`)}getAccountAndSigner(){const e="ecdsa"===this.keyType?i.PrivateKey.fromStringECDSA(this.operatorPrivateKey):i.PrivateKey.fromStringED25519(this.operatorPrivateKey);return{accountId:this.client.operatorAccountId.toString(),signer:e}}async createAndRegisterAgent(e,t){try{const n=e.build(),o=t?.progressCallback,a=t?.baseUrl||this.guardedRegistryBaseUrl;let r=t?.existingState||{currentStage:"init",completedPercentage:0,createdResources:[]};r.agentMetadata=n.metadata,o&&o({stage:"preparing",message:"Starting agent creation process",progressPercent:0,details:{state:r}});let s,c=n.existingAccount;if(r.inboundTopicId&&r.outboundTopicId&&r.profileTopicId){if(c=c||n.existingAccount,!c)throw new Error("Cannot resume registration without account information");s=new $c({network:n.network,operatorId:c.accountId,operatorPrivateKey:c.privateKey,operatorPublicKey:i.PrivateKey.fromString(c.privateKey).publicKey.toString(),logLevel:"info",guardedRegistryBaseUrl:a}),this.logger.info("Resuming registration with existing state",{inboundTopicId:r.inboundTopicId,outboundTopicId:r.outboundTopicId,profileTopicId:r.profileTopicId,pfpTopicId:r.pfpTopicId})}else{if(!c)if(r.createdResources&&r.createdResources.some((e=>e.startsWith("account:")))){const e=r.createdResources.find((e=>e.startsWith("account:"))),i=e?.split(":")[1];i&&n.existingAccount?(c=n.existingAccount,this.logger.info(`Resuming with existing account: ${i}`)):(c=await this.createAccount(t?.initialBalance),r.createdResources=r.createdResources||[],r.createdResources.push(`account:${c.accountId}`))}else c=await this.createAccount(t?.initialBalance),r.createdResources=r.createdResources||[],r.createdResources.push(`account:${c.accountId}`);o&&o({stage:"preparing",message:"Created account or using existing account",progressPercent:20,details:{state:r,account:c}});const p=ic(c.privateKey),l=("ed25519"===p.detectedType?i.PrivateKey.fromStringED25519(c.privateKey):i.PrivateKey.fromStringECDSA(c.privateKey)).publicKey.toString();s=new $c({network:n.network,operatorId:c.accountId,operatorPrivateKey:c.privateKey,operatorPublicKey:l,keyType:p.detectedType,logLevel:"info",guardedRegistryBaseUrl:a}),o&&o({stage:"preparing",message:"Initialized agent client",progressPercent:25,details:{state:r}});let u=r.outboundTopicId,d=r.inboundTopicId,m=r.pfpTopicId,f=r.profileTopicId;if(!u||!d||!f){m&&e.setExistingProfilePicture(m);const t=await s.createAgent(e,60,r,(e=>{o&&o({stage:e.stage,message:e.message,progressPercent:e.progressPercent||0,details:{...e.details,state:{...r,...e.details?.state}}})}));u=t.outboundTopicId,d=t.inboundTopicId,m=t.pfpTopicId,f=t.profileTopicId,r.outboundTopicId=u,r.inboundTopicId=d,r.pfpTopicId=m,r.profileTopicId=f,r.createdResources||(r.createdResources=[]),m&&!r.createdResources.includes(`pfp:${m}`)&&r.createdResources.push(`pfp:${m}`),r.createdResources.includes(`inbound:${d}`)||r.createdResources.push(`inbound:${d}`),r.createdResources.includes(`outbound:${u}`)||r.createdResources.push(`outbound:${u}`),r.createdResources.includes(`profile:${f}`)||r.createdResources.push(`profile:${f}`)}r.currentStage="profile",r.completedPercentage=60,o&&o({stage:"submitting",message:"Created agent with topics and profile",progressPercent:60,details:{state:r,outboundTopicId:u,inboundTopicId:d,pfpTopicId:m,profileTopicId:f}})}const p=`${r.inboundTopicId}@${c.accountId}`;if("complete"!==r.currentStage||!r.createdResources?.includes(`registration:${r.inboundTopicId}`)){const e=await s.registerAgentWithGuardedRegistry(c.accountId,n.network,{progressCallback:e=>{const t=60+.4*(e.progressPercent||0);o&&o({stage:e.stage,message:e.message,progressPercent:t,details:{...e.details,outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,profileTopicId:r.profileTopicId,operatorId:p,state:e.details?.state||r}})},existingState:r});if(!e.success)return{...e,state:r};r=e.state||r}return o&&o({stage:"completed",message:"Agent creation and registration complete",progressPercent:100,details:{outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,profileTopicId:r.profileTopicId,operatorId:p,state:r}}),{success:!0,state:r,metadata:{accountId:c.accountId,privateKey:c.privateKey,operatorId:p,inboundTopicId:r.inboundTopicId,outboundTopicId:r.outboundTopicId,profileTopicId:r.profileTopicId,pfpTopicId:r.pfpTopicId}}}catch(n){const e=n,i=`Failed to create and register agent: ${e.message}`;return this.logger.error(i),{error:e.message,success:!1,state:t?.existingState||{currentStage:"init",completedPercentage:0,error:e.message}}}}async registerAgentWithGuardedRegistry(e,t=this.network,n){try{this.logger.info("Registering agent with guarded registry");const o=n?.maxAttempts??60,a=n?.delayMs??2e3,r=n?.progressCallback;let s=n?.existingState||{currentStage:"registration",completedPercentage:0,createdResources:[]};r&&r({stage:"preparing",message:"Preparing agent registration",progressPercent:10,details:{state:s}});const c=await this.executeRegistration(e,t,this.guardedRegistryBaseUrl,this.logger);if(!c.success)return{...c,state:s};if(r&&r({stage:"submitting",message:"Submitting registration to registry",progressPercent:30,details:{transactionId:c.transactionId,state:s}}),c.transaction){const e=i.Transaction.fromBytes(globalThis.Buffer.from(c.transaction,"base64"));this.logger.info("Processing registration transaction"),await e.execute(this.client),this.logger.info("Successfully processed registration transaction")}r&&r({stage:"confirming",message:"Confirming registration transaction",progressPercent:60,details:{accountId:e,transactionId:c.transactionId,state:s}});const p=await this.waitForRegistrationConfirmation(c.transactionId,t,this.guardedRegistryBaseUrl,o,a,this.logger);return s.currentStage="complete",s.completedPercentage=100,s.createdResources||(s.createdResources=[]),c.transactionId&&s.createdResources.push(`registration:${c.transactionId}`),r&&r({stage:"completed",message:"Agent registration complete",progressPercent:100,details:{confirmed:p,transactionId:c.transactionId,state:s}}),{...c,confirmed:p,state:s}}catch(o){const e=o,t=`Failed to register agent: ${e.message}`;return this.logger.error(t),{error:e.message,success:!1}}}async registerAgent(e,t,i,n,o){this.logger.info("Registering agent");const a={p:"hcs-10",op:"register",account_id:t,inbound_topic_id:i,m:n};await this.submitPayload(e,a,o)}async getInboundTopicType(e){try{const t=await this.mirrorNode.getTopicInfo(e);if(!t)throw new Error("Topic does not exist");if(!(t.submit_key&&t.submit_key.key))return pc.PUBLIC;if(t.fee_schedule_key&&t.fee_schedule_key.key&&t.custom_fees){const i=t.custom_fees;if(i&&i.fixed_fees&&i.fixed_fees.length>0)return this.logger.info(`Topic ${e} is fee-based with ${i.fixed_fees.length} custom fees`),pc.FEE_BASED}return pc.CONTROLLED}catch(t){const e=`Error determining topic type: ${t.message}`;throw this.logger.error(e),new Error(e)}}getNetwork(){return this.network}getLogger(){return this.logger}getOperatorAccountId(){return this.client.operatorAccountId?.toString()??null}async createScheduledTransaction(e,t,n,o){this.logger.info("Creating scheduled transaction");const a=(new i.ScheduleCreateTransaction).setScheduledTransaction(e).setPayerAccountId(o?i.AccountId.fromString(o):this.client.operatorAccountId);if(t&&a.setScheduleMemo(t),n){const e=p.addSeconds(new Date,n),t=i.Timestamp.fromDate(e);a.setExpirationTime(t)}this.logger.debug("Executing schedule create transaction");const r=await a.execute(this.client),s=await r.getReceipt(this.client);if(!s.scheduleId)throw this.logger.error("Failed to create scheduled transaction: scheduleId is null"),new Error("Failed to create scheduled transaction: scheduleId is null");const c=s.scheduleId.toString(),l=r.transactionId.toString();return this.logger.info(`Scheduled transaction created successfully: ${c}`),{scheduleId:c,transactionId:l}}async sendTransactionOperation(e,t,i,n,o){const a=await this.canSubmitToTopic(e,this.client.operatorAccountId?.toString()||""),r={p:"hcs-10",op:"transaction",operator_id:await this.getOperatorId(),schedule_id:t,data:i,m:o?.memo};return this.logger.info("Submitting transaction operation to connection topic",r),await this.submitPayload(e,r,n,a.requiresFee)}async sendTransaction(e,t,i,n){this.logger.info("Creating scheduled transaction and sending transaction operation");const{scheduleId:o,transactionId:a}=await this.createScheduledTransaction(t,n?.scheduleMemo,n?.expirationTime,n?.schedulePayerAccountId);return{scheduleId:o,transactionId:a,receipt:await this.sendTransactionOperation(e,o,i,n?.submitKey,{memo:n?.operationMemo})}}async createMCPServer(e,t=60,i,n){this.keyType||await this.initializeOperator();const o=e.build(),a=this.client.operatorAccountId?.toString();if(!a)throw new Error("Failed to retrieve operator account ID");const r=await this._createEntityTopics(t,{outboundTopicId:i?.outboundTopicId||"",inboundTopicId:i?.inboundTopicId||"",pfpTopicId:i?.pfpTopicId||o.existingPfpTopicId||"",profileTopicId:i?.profileTopicId||""},a,pc.PUBLIC,void 0,o.pfpBuffer,o.pfpFileName,n);if(r.profileTopicId)this.logger.info(`Using existing profile topic ID: ${r.profileTopicId}`);else{this.logger.info("Creating and storing HCS-11 MCP server profile"),n&&n({stage:"preparing",message:"Creating MCP server profile",progressPercent:60,details:{outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,state:{currentStage:"profile",completedPercentage:60}}}),await this.hcs11Client.initializeOperator();const e=this.hcs11Client.createMCPServerProfile(o.name,o.mcpServer,{alias:o.alias,bio:o.bio,socials:o.socials||[],inboundTopicId:r.inboundTopicId,outboundTopicId:r.outboundTopicId,profileImage:r.pfpTopicId?`hcs://1/${r.pfpTopicId}`:void 0}),t=await this.hcs11Client.inscribeProfile(e);if(!t.success)throw this.logger.error(`Failed to inscribe MCP server profile: ${t.error}`),new Error(t.error||"Failed to inscribe MCP server profile");r.profileTopicId=t.profileTopicId,this.logger.info(`MCP server profile stored with topic ID: ${r.profileTopicId}`);const i=await this.hcs11Client.updateAccountMemoWithProfile(a,r.profileTopicId);i.success?this.logger.info("Updated account memo with profile reference"):this.logger.warn(`Failed to update account memo: ${i.error}, but continuing with MCP server creation`),n&&n({stage:"preparing",message:"MCP server profile created",progressPercent:70,details:{outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,profileTopicId:r.profileTopicId,state:{currentStage:"profile",completedPercentage:70}}})}return r}async _createEntityTopics(e,t,i,n,o,a,r,s){let{outboundTopicId:c,inboundTopicId:p,pfpTopicId:l,profileTopicId:u}=t;if(c)this.logger.info(`Using existing outbound topic ID: ${c}`);else{const t=this._generateHcs10Memo(Ec.OUTBOUND,{ttl:e});c=await this.createTopic(t,!0,!0),this.logger.info(`Created new outbound topic ID: ${c}`),s&&s({stage:"preparing",message:"Created outbound topic",progressPercent:30,details:{outboundTopicId:c,state:{currentStage:"topics",completedPercentage:30}}})}if(p?this.logger.info(`Using existing inbound topic ID: ${p}`):(p=await this.createInboundTopic(i,n,e,n===pc.FEE_BASED?o:void 0),this.logger.info(`Created new inbound topic ID: ${p}`),s&&s({stage:"preparing",message:"Created inbound topic",progressPercent:40,details:{outboundTopicId:c,inboundTopicId:p,state:{currentStage:"topics",completedPercentage:40}}})),!l&&a&&a.length>0&&r){this.logger.info("Inscribing new profile picture"),s&&s({stage:"preparing",message:"Inscribing profile picture",progressPercent:50,details:{outboundTopicId:c,inboundTopicId:p,state:{currentStage:"pfp",completedPercentage:50}}});l=(await this.inscribePfp(a,r)).pfpTopicId,this.logger.info(`Profile picture inscribed with topic ID: ${l}`),s&&s({stage:"preparing",message:"Profile picture inscribed",progressPercent:55,details:{outboundTopicId:c,inboundTopicId:p,pfpTopicId:l,state:{currentStage:"pfp",completedPercentage:55}}})}else l&&this.logger.info(`Using existing profile picture with topic ID: ${l}`);return{inboundTopicId:p,outboundTopicId:c,pfpTopicId:l,profileTopicId:u}}async createAndRegisterMCPServer(e,t){try{const n=e.build(),o=t?.progressCallback,a=t?.baseUrl||this.guardedRegistryBaseUrl;let r=t?.existingState||{currentStage:"init",completedPercentage:0,createdResources:[]};r.serverMetadata={name:n.name,description:n.mcpServer.description,services:n.mcpServer.services},o&&o({stage:"preparing",message:"Starting MCP server creation process",progressPercent:0,details:{state:r}});let s,c=n.existingAccount;if(r.inboundTopicId&&r.outboundTopicId&&r.profileTopicId){if(c=c||n.existingAccount,!c)throw new Error("Cannot resume registration without account information");const e=ic(c.privateKey),t=("ed25519"===e.detectedType?i.PrivateKey.fromStringED25519(c.privateKey):i.PrivateKey.fromStringECDSA(c.privateKey)).publicKey.toString();s=new $c({network:n.network,operatorId:c.accountId,operatorPrivateKey:c.privateKey,operatorPublicKey:t,keyType:e.detectedType,logLevel:"info",guardedRegistryBaseUrl:a}),this.logger.info("Resuming registration with existing state",{inboundTopicId:r.inboundTopicId,outboundTopicId:r.outboundTopicId,profileTopicId:r.profileTopicId,pfpTopicId:r.pfpTopicId})}else{if(!c)if(r.createdResources&&r.createdResources.some((e=>e.startsWith("account:")))){const e=r.createdResources.find((e=>e.startsWith("account:"))),i=e?.split(":")[1];i&&n.existingAccount?(c=n.existingAccount,this.logger.info(`Resuming with existing account: ${i}`)):(c=await this.createAccount(t?.initialBalance),r.createdResources=r.createdResources||[],r.createdResources.push(`account:${c.accountId}`))}else c=await this.createAccount(t?.initialBalance),r.createdResources=r.createdResources||[],r.createdResources.push(`account:${c.accountId}`);o&&o({stage:"preparing",message:"Created account or using existing account",progressPercent:20,details:{state:r,account:c}});const p=ic(c.privateKey);e.setExistingAccount(c.accountId,c.privateKey);const l=("ed25519"===p.detectedType?i.PrivateKey.fromStringED25519(c.privateKey):i.PrivateKey.fromStringECDSA(c.privateKey)).publicKey.toString();s=new $c({network:n.network,operatorId:c.accountId,operatorPrivateKey:c.privateKey,operatorPublicKey:l,logLevel:"info",guardedRegistryBaseUrl:a}),o&&o({stage:"preparing",message:"Initialized MCP server client",progressPercent:25,details:{state:r}});let u=r.outboundTopicId,d=r.inboundTopicId,m=r.pfpTopicId,f=r.profileTopicId;if(!u||!d||!f){m&&e.setExistingProfilePicture(m);const t=await s.createMCPServer(e,60,r,(e=>{o&&o({stage:e.stage,message:e.message,progressPercent:e.progressPercent||0,details:{...e.details,state:{...r,...e.details?.state}}})}));u=t.outboundTopicId,d=t.inboundTopicId,m=t.pfpTopicId,f=t.profileTopicId,r.outboundTopicId=u,r.inboundTopicId=d,r.pfpTopicId=m,r.profileTopicId=f,r.createdResources||(r.createdResources=[]),m&&!r.createdResources.includes(`pfp:${m}`)&&r.createdResources.push(`pfp:${m}`),r.createdResources.includes(`inbound:${d}`)||r.createdResources.push(`inbound:${d}`),r.createdResources.includes(`outbound:${u}`)||r.createdResources.push(`outbound:${u}`),r.createdResources.includes(`profile:${f}`)||r.createdResources.push(`profile:${f}`)}r.currentStage="profile",r.completedPercentage=60,o&&o({stage:"submitting",message:"Created MCP server with topics and profile",progressPercent:60,details:{state:r,outboundTopicId:u,inboundTopicId:d,pfpTopicId:m,profileTopicId:f}})}const p=`${r.inboundTopicId}@${c.accountId}`;if("complete"!==r.currentStage||!r.createdResources?.includes(`registration:${r.inboundTopicId}`)){const e=await s.registerAgentWithGuardedRegistry(c.accountId,n.network,{progressCallback:e=>{const t=60+.4*(e.progressPercent||0);o&&o({stage:e.stage,message:e.message,progressPercent:t,details:{...e.details,outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,profileTopicId:r.profileTopicId,operatorId:p,state:e.details?.state||r}})},existingState:r});if(!e.success)return{...e,state:r};r=e.state||r}return o&&o({stage:"completed",message:"MCP server creation and registration complete",progressPercent:100,details:{outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,profileTopicId:r.profileTopicId,operatorId:p,state:r}}),{success:!0,state:r,metadata:{accountId:c.accountId,privateKey:c.privateKey,operatorId:p,inboundTopicId:r.inboundTopicId,outboundTopicId:r.outboundTopicId,profileTopicId:r.profileTopicId,pfpTopicId:r.pfpTopicId}}}catch(n){const e=n,i=`Failed to create and register MCP server: ${e.message}`;return this.logger.error(i),{error:e.message,success:!1,state:t?.existingState||{currentStage:"init",completedPercentage:0,error:e.message}}}}}const Fc="undefined"!=typeof window;const Lc={PROTOCOL:"hcs-20",PUBLIC_TOPIC_ID:"0.0.4350190",REGISTRY_TOPIC_ID:"0.0.4362300",MAX_NUMBER_LENGTH:18,MAX_NAME_LENGTH:100,MAX_METADATA_LENGTH:100,HEDERA_ACCOUNT_REGEX:/^(0|(?:[1-9]\d*))\.(0|(?:[1-9]\d*))\.(0|(?:[1-9]\d*))$/},Uc=c.z.string().regex(Lc.HEDERA_ACCOUNT_REGEX,"Invalid Hedera account ID format"),Bc=c.z.string().regex(/^\d+$/,"Must be a valid number").max(Lc.MAX_NUMBER_LENGTH,`Max ${Lc.MAX_NUMBER_LENGTH} digits`),Mc=c.z.string().min(1,"Tick cannot be empty").transform((e=>e.toLowerCase().trim())),Dc=c.z.object({p:c.z.literal("hcs-20"),m:c.z.string().optional()}),zc=Dc.extend({op:c.z.literal("deploy"),name:c.z.string().min(1).max(Lc.MAX_NAME_LENGTH),tick:Mc,max:Bc,lim:Bc.optional(),metadata:c.z.string().max(Lc.MAX_METADATA_LENGTH).optional()}),qc=Dc.extend({op:c.z.literal("mint"),tick:Mc,amt:Bc,to:Uc}),Kc=Dc.extend({op:c.z.literal("burn"),tick:Mc,amt:Bc,from:Uc}),Wc=Dc.extend({op:c.z.literal("transfer"),tick:Mc,amt:Bc,from:Uc,to:Uc}),Hc=Dc.extend({op:c.z.literal("register"),name:c.z.string().min(1).max(Lc.MAX_NAME_LENGTH),metadata:c.z.string().max(Lc.MAX_METADATA_LENGTH).optional(),private:c.z.boolean(),t_id:Uc}),Vc=c.z.discriminatedUnion("op",[zc,qc,Kc,Wc,Hc]);class Gc extends Error{constructor(e){super(e),this.name="HCS20Error"}}class Zc extends Gc{constructor(e,t){super(e),this.tick=t,this.name="PointsDeploymentError"}}class Jc extends Gc{constructor(e,t,i,n,o,a){super(e),this.tick=t,this.from=i,this.to=n,this.amount=o,this.availableBalance=a,this.name="PointsTransferError"}}class Xc extends Gc{constructor(e,t,i,n,o){super(e),this.tick=t,this.from=i,this.amount=n,this.availableBalance=o,this.name="PointsBurnError"}}class Yc extends Gc{constructor(e,t){super(e),this.validationErrors=t,this.name="PointsValidationError"}}class Qc extends Gc{constructor(e,t){super(e),this.topicId=t,this.name="TopicRegistrationError"}}class ep extends Gc{constructor(e){super(`Invalid Hedera account format: ${e}`),this.account=e,this.name="InvalidAccountFormatError"}}class tp{constructor(e){this.logger=e.logger||new d({module:"HCS20Client"}),this.network="mainnet"===e.network?"mainnet":"testnet",this.mirrorNode=new Hs(this.network,this.logger,e.mirrorNodeUrl?{customUrl:e.mirrorNodeUrl}:void 0),this.registryTopicId=e.registryTopicId||Lc.REGISTRY_TOPIC_ID,this.publicTopicId=e.publicTopicId||Lc.PUBLIC_TOPIC_ID}validateMessage(e){try{return Vc.parse(e),{valid:!0}}catch(t){if(t.errors){return{valid:!1,errors:t.errors.map((e=>`${e.path.join(".")}: ${e.message}`))}}return{valid:!1,errors:[t.message]}}}normalizeTick(e){return e.toLowerCase().trim()}accountToString(e){if("string"==typeof e){if(!Lc.HEDERA_ACCOUNT_REGEX.test(e))throw new ep(e);return e}return e.toString()}topicToString(e){if("string"==typeof e){if(!Lc.HEDERA_ACCOUNT_REGEX.test(e))throw new ep(e);return e}return e.toString()}}var ip=(e=>(e.FIXED_FEE="FIXED_FEE",e.FRACTIONAL_FEE="FRACTIONAL_FEE",e.ROYALTY_FEE="ROYALTY_FEE",e))(ip||{});class np{constructor(e){this.customFees=[],this.logger=e.logger,this.mirrorNode=new Hs(e.network,e.logger),this.defaultCollectorAccountId=e.defaultCollectorAccountId||""}static forHbar(e,t,i,n,o=[]){return new np({network:i,logger:n,defaultCollectorAccountId:t}).addHbarFee(e,t,o)}static async forToken(e,t,i,n,o,a=[],r){const s=new np({network:n,logger:o,defaultCollectorAccountId:i});return await s.addTokenFee(e,t,i,r,a),s}addHbarFee(e,t,i=[]){if(e<=0)throw new Error("HBAR amount must be greater than zero");return this.customFees.push({feeAmount:{amount:1e8*e,decimals:0},feeCollectorAccountId:t||"",feeTokenId:void 0,exemptAccounts:[...i],type:ip.FIXED_FEE}),this}async addTokenFee(e,t,i,n,o=[]){if(e<=0)throw new Error("Token amount must be greater than zero");if(!t)throw new Error("Fee token ID is required when adding a token fee");let a=n;if(void 0===a)try{const e=await this.mirrorNode.getTokenInfo(t);e?.decimals?(a=parseInt(e.decimals,10),this.logger.info(`Fetched decimals for ${t}: ${a}`)):(this.logger.warn(`Could not fetch decimals for ${t}, defaulting to 0.`),a=0)}catch(r){this.logger.error(`Error fetching decimals for ${t}, defaulting to 0: ${r}`),a=0}return this.customFees.push({feeAmount:{amount:e*10**a,decimals:a},feeCollectorAccountId:i||"",feeTokenId:t,exemptAccounts:[...o],type:ip.FIXED_FEE}),this}build(){if(0===this.customFees.length)throw new Error("At least one fee must be added using addHbarFee/addTokenFee or created using forHbar/forToken");if(this.customFees.length>10)throw new Error("Maximum of 10 custom fees per topic allowed");const e=new Set;return this.customFees.forEach((t=>{t.exemptAccounts.forEach((t=>e.add(t)))})),{customFees:this.customFees,exemptAccounts:Array.from(e)}}}exports.AIAgentCapability=rc,exports.AIAgentType=oc,exports.AccountCreationError=Nc,exports.AgentBuilder=jc,exports.BrowserHCS20Client=class extends tp{constructor(e){super({network:e.network,logger:e.logger,mirrorNodeUrl:e.mirrorNodeUrl,registryTopicId:e.registryTopicId,publicTopicId:e.publicTopicId}),this.hwc=e.hwc,this.feeAmount=e.feeAmount||20}getOperatorId(){const e=this.hwc.getAccountInfo();if(!e?.accountId)throw new Error("Wallet not connected");return e.accountId}async deployPoints(e){const t=this.getOperatorId(),{progressCallback:n}=e;try{let o;if(n?.({stage:"creating-topic",percentage:20}),e.usePrivateTopic){const n=await this.mirrorNode.getPublicKey(t),a=(new i.TopicCreateTransaction).setTopicMemo(e.topicMemo||`HCS-20: ${e.name}`).setSubmitKey(n).setAdminKey(n).setAutoRenewAccountId(i.AccountId.fromString(t)),r=await this.hwc.executeTransactionWithErrorHandling(a,!1);if(r?.error)throw new Error(r.error);const s=r?.result;if(!s?.topicId)throw new Error("Failed to create topic: topicId is null");o=s.topicId.toString(),this.logger.info(`Created private topic: ${o}`)}else o=this.publicTopicId;n?.({stage:"submitting-deploy",percentage:50,topicId:o});const a={p:"hcs-20",op:"deploy",name:e.name,tick:this.normalizeTick(e.tick),max:e.maxSupply,lim:e.limitPerMint,metadata:e.metadata,m:e.topicMemo},r=this.validateMessage(a);if(!r.valid)throw new Yc("Invalid deploy message",r.errors);const s=await this.submitPayload(o,a,e.usePrivateTopic),c=s.transactionHash?.toString()||"";return n?.({stage:"confirming",percentage:80,topicId:o,deployTxId:c}),await new Promise((e=>setTimeout(e,2e3))),n?.({stage:"complete",percentage:100,topicId:o,deployTxId:c}),{name:e.name,tick:this.normalizeTick(e.tick),maxSupply:e.maxSupply,limitPerMint:e.limitPerMint,metadata:e.metadata,topicId:o,deployerAccountId:t,currentSupply:"0",deploymentTimestamp:(new Date).toISOString(),isPrivate:e.usePrivateTopic||!1}}catch(o){throw n?.({stage:"complete",percentage:100,error:o instanceof Error?o.message:"Unknown error"}),o}}async mintPoints(e){this.getOperatorId();const{progressCallback:t}=e;try{t?.({stage:"validating",percentage:20}),t?.({stage:"submitting",percentage:50});const i={p:"hcs-20",op:"mint",tick:this.normalizeTick(e.tick),amt:e.amount,to:this.accountToString(e.to),m:e.memo},n=e.topicId||this.publicTopicId,o=await this.submitPayload(n,i,!1),a=o.transactionHash?.toString()||"";return t?.({stage:"confirming",percentage:80,mintTxId:a}),await new Promise((e=>setTimeout(e,2e3))),t?.({stage:"complete",percentage:100,mintTxId:a}),{id:a,operation:"mint",tick:this.normalizeTick(e.tick),amount:e.amount,to:this.accountToString(e.to),timestamp:(new Date).toISOString(),sequenceNumber:0,topicId:n,transactionId:a,memo:e.memo}}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async transferPoints(e){this.getOperatorId();const{progressCallback:t}=e;try{t?.({stage:"validating-balance",percentage:20}),t?.({stage:"submitting",percentage:50});const i={p:"hcs-20",op:"transfer",tick:this.normalizeTick(e.tick),amt:e.amount,from:this.accountToString(e.from),to:this.accountToString(e.to),m:e.memo},n=e.topicId||this.publicTopicId,o=await this.submitPayload(n,i,!1),a=o.transactionHash?.toString()||"";return t?.({stage:"confirming",percentage:80,transferTxId:a}),await new Promise((e=>setTimeout(e,2e3))),t?.({stage:"complete",percentage:100,transferTxId:a}),{id:a,operation:"transfer",tick:this.normalizeTick(e.tick),amount:e.amount,from:this.accountToString(e.from),to:this.accountToString(e.to),timestamp:(new Date).toISOString(),sequenceNumber:0,topicId:n,transactionId:a,memo:e.memo}}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async burnPoints(e){this.getOperatorId();const{progressCallback:t}=e;try{t?.({stage:"validating-balance",percentage:20}),t?.({stage:"submitting",percentage:50});const i={p:"hcs-20",op:"burn",tick:this.normalizeTick(e.tick),amt:e.amount,from:this.accountToString(e.from),m:e.memo},n=e.topicId||this.publicTopicId,o=await this.submitPayload(n,i,!1),a=o.transactionHash?.toString()||"";return t?.({stage:"confirming",percentage:80,burnTxId:a}),await new Promise((e=>setTimeout(e,2e3))),t?.({stage:"complete",percentage:100,burnTxId:a}),{id:a,operation:"burn",tick:this.normalizeTick(e.tick),amount:e.amount,from:this.accountToString(e.from),timestamp:(new Date).toISOString(),sequenceNumber:0,topicId:n,transactionId:a,memo:e.memo}}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async registerTopic(e){const{progressCallback:t}=e;try{t?.({stage:"validating",percentage:20});const i={p:"hcs-20",op:"register",name:e.name,metadata:e.metadata,private:e.isPrivate,t_id:this.topicToString(e.topicId),m:e.memo},n=this.validateMessage(i);if(!n.valid)throw new Yc("Invalid register message",n.errors);t?.({stage:"submitting",percentage:50});const o=await this.submitPayload(this.registryTopicId,i,!1),a=o.transactionHash?.toString()||"";t?.({stage:"confirming",percentage:80,registerTxId:a}),await new Promise((e=>setTimeout(e,2e3))),t?.({stage:"complete",percentage:100,registerTxId:a})}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),new Qc(i instanceof Error?i.message:"Unknown error",this.topicToString(e.topicId))}}async submitPayload(e,t,n){let o;this.logger.debug(`Submitting payload to topic ${e}`),o="string"==typeof t?t:JSON.stringify(t);const a=(new i.TopicMessageSubmitTransaction).setTopicId(i.TopicId.fromString(e)).setMessage(o);n&&(this.logger.info("Topic requires fee payment, setting max transaction fee"),a.setMaxTransactionFee(new i.Hbar(this.feeAmount)));const r=await this.hwc.executeTransactionWithErrorHandling(a,!1);if(r?.error)throw this.logger.error(`Failed to submit payload: ${r.error}`),new Error(`Failed to submit payload: ${r.error}`);if(!r?.result)throw this.logger.error("Failed to submit message: receipt is null or undefined"),new Error("Failed to submit message: receipt is null or undefined");return this.logger.debug("Payload submitted successfully via HWC"),r.result}},exports.BrowserHCSClient=class extends _c{constructor(e){let t;if(super({network:e.network,logLevel:e.logLevel,prettyPrint:e.prettyPrint,feeAmount:e.feeAmount,mirrorNode:e.mirrorNode,silent:e.silent}),this.hcs11Client=null,this.hwc=e.hwc,e.guardedRegistryBaseUrl?this.guardedRegistryBaseUrl=e.guardedRegistryBaseUrl:this.guardedRegistryBaseUrl="https://moonscape.tech",t=e.logLevel?e.logLevel:"info",this.logger=d.getInstance({level:t,module:"HCS-Browser",prettyPrint:e.prettyPrint,silent:e.silent}),Fc)try{const{accountId:t,signer:i}=this.getAccountAndSigner();this.hcs11Client=new Tc({network:e.network,auth:{operatorId:t,signer:i},logLevel:e.logLevel,silent:e.silent})}catch(i){this.logger.warn(`Failed to initialize HCS11Client: ${i}`)}else this.logger.error("BrowserHCSClient initialized in server environment - browser-specific features will not be available. Use HCS10Client instead.")}async sendMessage(e,t,i,n,o){this.logger.info("Sending message");const a={p:"hcs-10",op:"message",operator_id:await this.getOperatorId(),data:t,m:i},r=await this.canSubmitToTopic(e,this.hwc.getAccountInfo().accountId),s=JSON.stringify(a);if(globalThis.Buffer.from(s).length>1e3){this.logger.info("Message payload exceeds 1000 bytes, storing via inscription");try{const e=globalThis.Buffer.from(t),i=`message-${Date.now()}.json`,n=await this.inscribeFile(e,i,{progressCallback:o?.progressCallback,waitMaxAttempts:o?.waitMaxAttempts,waitIntervalMs:o?.waitIntervalMs});if(!n?.topic_id)throw new Error("Failed to inscribe large message content");a.data=`hcs://1/${n.topic_id}`,this.logger.info(`Large message inscribed with topic ID: ${n.topic_id}`)}catch(c){throw this.logger.error("Error inscribing large message:",c),new Error(`Failed to handle large message: ${c instanceof Error?c.message:"Unknown error"}`)}}return await this.submitPayload(e,a,n,r.requiresFee)}async getPublicKey(e){return await this.mirrorNode.getPublicKey(e)}async handleConnectionRequest(e,t,n,o="Connection accepted. Looking forward to collaborating!",a=60){this.logger.info("Handling connection request");const r=this.hwc.getAccountInfo().accountId;if(!r)throw new Error("Failed to retrieve user account ID");const s=await this.mirrorNode.getPublicKey(t),c=await this.mirrorNode.getPublicKey(r);if(!c)throw new Error("Failed to retrieve public key");const p=new i.KeyList([c,s],1),l=this._generateHcs10Memo(Ec.CONNECTION,{ttl:a,inboundTopicId:e,connectionId:n}),u=(new i.TopicCreateTransaction).setTopicMemo(l).setAutoRenewAccountId(i.AccountId.fromString(r)).setAdminKey(p).setSubmitKey(p);this.logger.debug("Executing topic creation transaction");const d=await this.hwc.executeTransactionWithErrorHandling(u,!1);if(d?.error)throw this.logger.error(d.error),new Error(d.error);const m=d?.result;if(!m?.topicId)throw this.logger.error("Failed to create topic: topicId is null"),new Error("Failed to create topic: topicId is null");const f=m.topicId.toString(),h=`${e}@${r}`,g=await this.confirmConnection(e,f,t,n,h,o),b=await this.retrieveCommunicationTopics(r),x=await this.retrieveCommunicationTopics(t),v=`${x.inboundTopic}@${t}`;return await this.recordOutboundConnectionConfirmation({outboundTopicId:b.outboundTopic,requestorOutboundTopicId:x.outboundTopic,connectionRequestId:n,confirmedRequestId:g,connectionTopicId:f,operatorId:v,memo:`Connection established with ${t}`}),{connectionTopicId:f,confirmedConnectionSequenceNumber:g,operatorId:h}}async confirmConnection(e,t,i,n,o,a){this.logger.info("Confirming connection");const r={p:"hcs-10",op:"connection_created",connection_topic_id:t,connected_account_id:i,operator_id:o,connection_id:n,m:a},s=await this.submitPayload(e,r);if(!s?.topicSequenceNumber)throw this.logger.error("Failed to confirm connection: sequence number is null"),new Error("Failed to confirm connection: sequence number is null");return s.topicSequenceNumber.toNumber()}async create(e,t){const i=t?.progressCallback,n=new Ds({module:"ProfileCreate",logger:this.logger,callback:i});try{const i=e instanceof jc;let o;if(o=t?.existingState?t.existingState:{currentStage:"init",completedPercentage:0,createdResources:[]},i){this.logger.info("Creating Agent Profile and HCS-10 Topics");const t=e.build();o.agentMetadata=t.metadata}else this.logger.info("Creating Person HCS-11 Profile");n.preparing(`Starting ${i?"agent":"person"} resource creation`,0,{state:o});const{inboundTopicId:a,outboundTopicId:r,state:s}=await this.createCommunicationTopics(t,n);let c,p,l;if(o=s,i||(e.setInboundTopicId(a),e.setOutboundTopicId(r)),i){const t=e.build();c=t.existingPfpTopicId||o.pfpTopicId,p=t.pfpBuffer,l=t.pfpFileName||"pfp.png"}else{const t=e.build();c=o.pfpTopicId,p=t.pfpBuffer,l=t.pfpFileName}!c&&p&&l?c=await this.handleProfilePictureCreation(p,l,o,n):c&&(n.preparing(`Using existing profile picture: ${c}`,50,{state:o}),o.pfpTopicId=c),await this.createAndInscribeProfile(i,e,c,o,a,r,t,n),o.currentStage="complete",o.completedPercentage=100,n.completed((i?"Agent":"Person")+" profile created successfully",{profileTopicId:o.profileTopicId,inboundTopicId:a,outboundTopicId:r,pfpTopicId:c,state:o});let u="";o.outboundTopicId&&(u=o.outboundTopicId);let d="";o.inboundTopicId&&(d=o.inboundTopicId);let m="";o.pfpTopicId&&(m=o.pfpTopicId);let f="";return o.profileTopicId&&(f=o.profileTopicId),{outboundTopicId:u,inboundTopicId:d,pfpTopicId:m,profileTopicId:f,success:!0,state:o}}catch(o){return n.failed("Error during profile creation",{error:o.message}),{outboundTopicId:"",inboundTopicId:"",pfpTopicId:"",profileTopicId:"",success:!1,error:o.message,state:{currentStage:"init",completedPercentage:0,error:o.message}}}}async handleProfilePictureCreation(e,t,i,n){i.currentStage="pfp",n.preparing("Creating profile picture",30,{state:i});const o=n.createSubProgress({minPercent:30,maxPercent:50,logPrefix:"PFP"}),a=await this.inscribePfp(e,t,{progressCallback:e=>o.report({...e,progressPercent:e.progressPercent??0,details:{...e.details,state:i}})});if(!a.success){let e="Failed to inscribe profile picture";throw a.error&&(e=a.error),new Error(e)}const r=a.pfpTopicId;return i.pfpTopicId=r,i.createdResources&&i.createdResources.push(`pfp:${i.pfpTopicId}`),n.preparing("Profile picture created",50,{state:i}),r}async createAndInscribeProfile(e,t,i,n,o,a,r,s){if(!this.hcs11Client)throw s&&s.failed("HCS11Client is not available"),new Error("HCS11Client is not available");if(this.logger.info("Creating and inscribing profile"),n.profileTopicId)s&&s.preparing(`Using existing ${e?"agent":"person"} profile`,95,{state:n});else{s&&s.preparing(`Storing HCS-11 ${e?"agent":"person"} profile`,80);const c=s?.createSubProgress({minPercent:80,maxPercent:95,logPrefix:"StoreProfile"});let p;if(e){const e=t.build(),n=e.metadata?.socials?Object.entries(e.metadata.socials).map((([e,t])=>({platform:e,handle:t}))):[];p=this.hcs11Client.createAIAgentProfile(e.name,"manual"===e.metadata?.type?0:1,e.capabilities||[],e.metadata?.model||"unknown",{alias:e.name.toLowerCase().replace(/\s+/g,"_"),bio:e.bio,profileImage:i?`hcs://1/${i}`:void 0,socials:n,properties:e.metadata?.properties||{},inboundTopicId:o,outboundTopicId:a,creator:e.metadata?.creator})}else{const e=t.build(),{pfpBuffer:n,pfpFileName:r,...s}=e;p=this.hcs11Client.createPersonalProfile(e.display_name,{alias:e.alias,bio:e.bio,socials:e.socials,profileImage:i?`hcs://1/${i}`:e.profileImage,properties:e.properties,inboundTopicId:o,outboundTopicId:a})}const l=await this.hcs11Client.createAndInscribeProfile(p,r?.updateAccountMemo??!0,{progressCallback:e=>c?.report({...e,progressPercent:e.progressPercent??0})});if(!l.success){s&&s.failed(`Failed to inscribe ${e?"agent":"person"} profile`,{error:l.error});let t=`Failed to inscribe ${e?"agent":"person"} profile`;throw l.error&&(t=l.error),new Error(t)}n.profileTopicId=l.profileTopicId,n.createdResources&&n.createdResources.push(`profile:${l.profileTopicId}`),s&&s.preparing("HCS-11 Profile stored",95,{state:n})}}initializeRegistrationState(e,t){const i=t||{inboundTopicId:e,currentStage:"registration",completedPercentage:0,createdResources:[]};return"registration"!==i.currentStage&&"complete"!==i.currentStage&&(i.currentStage="registration"),i}updateStateForCompletedRegistration(e,t){e.currentStage="complete",e.completedPercentage=100,e.createdResources&&e.createdResources.push(`registration:${t}`)}async registerAgentWithGuardedRegistry(e,t=this.network,n){try{this.logger.info("Registering agent with guarded registry");const o=(await this.retrieveProfile(e)).topicInfo.inboundTopic,a=this.initializeRegistrationState(o,n?.existingState),r=new Ds({module:"AgentRegistration",logger:this.logger,callback:n?.progressCallback});r.preparing("Preparing agent registration",10,{inboundTopicId:o,accountId:e});const s=await this.executeRegistration(e,t,this.guardedRegistryBaseUrl,this.logger);if(!s.success)return{...s,state:a};if(r.submitting("Submitting registration to registry",30,{transactionId:s.transactionId}),s.transaction){const e=i.Transaction.fromBytes(globalThis.Buffer.from(s.transaction,"base64"));this.logger.info("Processing registration transaction");const t=await this.hwc.executeTransactionWithErrorHandling(e,!0);if(t.error)return{...s,error:t.error,success:!1,state:a};this.logger.info("Successfully processed registration transaction")}r.confirming("Confirming registration transaction",60,{accountId:e,inboundTopicId:o,transactionId:s.transactionId});const c=n?.maxAttempts??60,p=n?.delayMs??2e3,l=await this.waitForRegistrationConfirmation(s.transactionId,t,this.guardedRegistryBaseUrl,c,p,this.logger);return this.updateStateForCompletedRegistration(a,o),r.completed("Agent registration complete",{transactionId:s.transactionId,inboundTopicId:o,state:a,confirmed:l}),{...s,confirmed:l,state:a}}catch(o){return this.logger.error(`Registration error: ${o.message}`),{error:`Error during registration: ${o.message}`,success:!1,state:{currentStage:"registration",completedPercentage:0,error:o.message}}}}async createAndRegisterAgent(e,t){try{const i=e.build(),n=t?.progressCallback,o=new Ds({module:"AgentCreateRegister",logger:this.logger,callback:n});let a=t?.existingState||{currentStage:"init",completedPercentage:0,createdResources:[]};if(a.agentMetadata=i.metadata,o.preparing("Starting agent creation process",0,{state:a}),"complete"!==a.currentStage||!a.inboundTopicId||!a.outboundTopicId||!a.profileTopicId){const t=await this.create(e,{progressCallback:e=>{const t=.3*(e.progressPercent||0);o.report({...e,progressPercent:t,details:{...e.details,state:e.details?.state||a}})},existingState:a,updateAccountMemo:!1});if(!("state"in t))throw new Error("Create method did not return expected agent state.");if(!t.success)throw new Error(t.error||"Failed to create agent resources");a=t.state,a.agentMetadata=i.metadata}o.preparing(`Agent creation status: ${a.currentStage}, ${a.completedPercentage}%`,30,{state:a});const{accountId:r}=this.getAccountAndSigner();if("complete"!==a.currentStage||!a.createdResources?.includes(`registration:${a.inboundTopicId}`)){t?.baseUrl&&(this.guardedRegistryBaseUrl=t.baseUrl);const e=await this.registerAgentWithGuardedRegistry(r,i.network,{progressCallback:e=>{const t=30+.7*(e.progressPercent||0);o.report({...e,progressPercent:t,details:{...e.details,state:e.details?.state||a}})},maxAttempts:t?.maxAttempts,delayMs:t?.delayMs,existingState:a});if(!e.success)throw new Error(e.error||"Failed to register agent with registry");a=e.state,a.profileTopicId&&await(this.hcs11Client?.updateAccountMemoWithProfile(r,a.profileTopicId))}return o.completed("Agent creation and registration complete",{state:a}),{success:!0,state:a,metadata:{accountId:r,operatorId:`${a.inboundTopicId}@${r}`,inboundTopicId:a.inboundTopicId,outboundTopicId:a.outboundTopicId,profileTopicId:a.profileTopicId,pfpTopicId:a.pfpTopicId,privateKey:null,...a.agentMetadata}}}catch(i){return this.logger.error(`Failed to create and register agent: ${i.message}`),{success:!1,error:`Failed to create and register agent: ${i.message}`,state:t?.existingState||{currentStage:"init",completedPercentage:0,error:i.message}}}}async storeHCS11Profile(e,t,i,n,o=[],a={},r,s,c,p){try{const l=p?.progressCallback,u=new Ds({module:"StoreHCS11Profile",logger:this.logger,callback:l});u.preparing("Preparing agent profile data",0);let d=c;if(!d&&r&&s){const e=u.createSubProgress({minPercent:0,maxPercent:60,logPrefix:"PFP"}),t=await this.inscribePfp(r,s,{progressCallback:t=>{e.report({stage:t.stage,message:t.message,progressPercent:t.progressPercent||0,details:t.details})}});t.success?d=t.pfpTopicId:u.failed("Failed to inscribe profile picture, continuing without PFP")}else c?u.preparing(`Using existing profile picture: ${c}`,30):u.preparing("No profile picture provided",30);if(!this.hcs11Client)return u.failed("HCS11Client is not available in this environment"),{profileTopicId:"",success:!1,error:"HCS11Client is not available in this environment",transactionId:""};const m=this.hcs11Client.getAgentTypeFromMetadata({type:a.type||"autonomous"});u.preparing("Building agent profile",65);const f=a.socials?Object.entries(a.socials).filter((([e,t])=>t)).map((([e,t])=>({platform:e,handle:t}))):void 0,h=this.hcs11Client.createAIAgentProfile(e,m,o,a.model||"unknown",{alias:e.toLowerCase().replace(/\s+/g,"_"),bio:t,profileImage:d?`hcs://1/${d}`:void 0,socials:f,properties:{version:a.version||"1.0.0",creator:a.creator||"Unknown",supported_languages:a.supported_languages||["en"],permissions:a.permissions||[],model_details:a.model_details,training:a.training,capabilities_description:a.capabilities_description,...a},inboundTopicId:i,outboundTopicId:n,creator:a.creator}),g=u.createSubProgress({minPercent:65,maxPercent:100,logPrefix:"Profile"}),b=await this.hcs11Client.createAndInscribeProfile(h,!0,{progressCallback:e=>{g.report({stage:e.stage,message:e.message,progressPercent:e.progressPercent||0,details:e.details})}});return b.success?(u.completed("Profile stored successfully",{profileTopicId:b.profileTopicId}),{profileTopicId:b.profileTopicId,pfpTopicId:d,success:!0,transactionId:b.transactionId||""}):(u.failed("Failed to inscribe profile"),{profileTopicId:"",success:!1,error:b.error||"Failed to inscribe profile",transactionId:b.transactionId||""})}catch(l){return this.logger.error(`Error storing HCS11 profile: ${l.message}`),{profileTopicId:"",success:!1,error:l.message,transactionId:""}}}async createTopic(e,t,n){this.logger.info("Creating topic");const{accountId:o,signer:a}=this.getAccountAndSigner(),r=(new i.TopicCreateTransaction).setTopicMemo(e),s=await this.mirrorNode.getPublicKey(o);t&&s&&(r.setAdminKey(s),r.setAutoRenewAccountId(o)),n&&s&&r.setSubmitKey(s);const c=await this.hwc.executeTransactionWithErrorHandling(r,!1),p=c.error;if(p)return this.logger.error(p),{success:!1,error:p};const l=c.result;return l?.topicId?{success:!0,topicId:l.topicId.toString()}:(this.logger.error("Failed to create topic: topicId is null"),{success:!1,error:"Failed to create topic: topicId is null"})}async submitPayload(e,t,n,o){let a;this.logger.debug(`Submitting payload to topic ${e}`),a="string"==typeof t?t:JSON.stringify(t);const r=(new i.TopicMessageSubmitTransaction).setTopicId(e).setMessage(a),s=this.getHcs10TransactionMemo(t);let c;if(s&&r.setTransactionMemo(s),o&&(this.logger.info("Topic requires fee payment, setting max transaction fee"),r.setMaxTransactionFee(new i.Hbar(this.feeAmount))),n){const{signer:e}=this.getAccountAndSigner();r.freezeWithSigner(e);const t=await r.sign(n);c=await this.hwc.executeTransactionWithErrorHandling(t,!0)}else c=await this.hwc.executeTransactionWithErrorHandling(r,!1);if(c?.error)throw this.logger.error(`Failed to submit payload: ${c.error}`),new Error(`Failed to submit payload: ${c.error}`);if(!c?.result)throw this.logger.error("Failed to submit message: receipt is null or undefined"),new Error("Failed to submit message: receipt is null or undefined");return this.logger.debug("Payload submitted successfully via HWC"),c.result}async inscribeFile(e,t,i){const{accountId:n,signer:o}=this.getAccountAndSigner(),a=u.lookup(t)||"application/octet-stream",r=await Ms.createWithAuth({type:"client",accountId:n,signer:o,network:this.network}),s={mode:"file",waitForConfirmation:!0,waitMaxAttempts:i?.waitMaxAttempts||30,waitIntervalMs:i?.waitIntervalMs||4e3,progressCallback:i?.progressCallback,logging:{level:this.logger.getLevel?this.logger.getLevel():"info"}},c=await qs({type:"buffer",buffer:e,fileName:t,mimeType:a},o,{...s,network:this.network},r);if(!c.confirmed||!c.inscription)throw new Error("Inscription was not confirmed");return c.inscription}getAccountAndSigner(){const e=this?.hwc?.getAccountInfo(),t=e?.accountId?.toString(),i=this?.hwc?.dAppConnector?.signers?.find((e=>e.getAccountId().toString()===t));if(!i)throw this.logger.error("Failed to find signer",{accountId:t,signers:this?.hwc?.dAppConnector?.signers,accountInfo:e}),new Error("Failed to find signer");return{accountId:t,signer:i}}async inscribePfp(e,t,i){try{const n=i?.progressCallback,o=new Ds({module:"PFP-Inscription",logger:this.logger,callback:n});if(!this.hcs11Client)return o.failed("HCS11Client is not available in this environment"),{pfpTopicId:"",success:!1,error:"HCS11Client is not available in this environment",transactionId:""};o.preparing("Preparing to inscribe profile picture",10),this.logger.info("Inscribing profile picture using HCS-11 client");const a=e=>{o.report({stage:e.stage||"confirming",message:e.message||"Processing PFP inscription",progressPercent:e.progressPercent||50,details:e.details})},r=await this.hcs11Client.inscribeImage(e,t,{progressCallback:a});if(!r.success){let e="Failed to inscribe profile picture";r.error&&(e=r.error);let t="";return r.transactionId&&(t=r.transactionId),{pfpTopicId:"",success:!1,error:e,transactionId:t}}return o.completed("Successfully inscribed profile picture",{pfpTopicId:r.imageTopicId}),this.logger.info(`Successfully inscribed profile picture with topic ID: ${r.imageTopicId}`),{pfpTopicId:r.imageTopicId,success:!0,transactionId:r.transactionId||""}}catch(n){return this.logger.error(`Error inscribing profile picture: ${n.message}`),{pfpTopicId:"",success:!1,error:n.message,transactionId:""}}}async createCommunicationTopics(e,t){let i=e?.existingState||{currentStage:"init",completedPercentage:0,createdResources:[]};t&&t.preparing("Starting communication topic creation",0,{state:i});const{accountId:n}=this.getAccountAndSigner();if(!i.outboundTopicId){i.currentStage="topics",t&&t.preparing("Creating outbound topic",5,{state:i});const o=this._generateHcs10Memo(Ec.OUTBOUND,{ttl:e?.ttl,accountId:n}),a=await this.createTopic(o,!0,!0);if(!a.success||!a.topicId)throw new Error(a.error||"Failed to create outbound topic");i.outboundTopicId=a.topicId,i.createdResources&&i.createdResources.push(`outbound:${i.outboundTopicId}`)}if(!i.inboundTopicId){i.currentStage="topics",t&&t.preparing("Creating inbound topic",10,{state:i});const o=this._generateHcs10Memo(Ec.INBOUND,{ttl:e?.ttl,accountId:n}),a=await this.createTopic(o,!0,!1);if(!a.success||!a.topicId)throw new Error(a.error||"Failed to create inbound topic");i.inboundTopicId=a.topicId,i.createdResources&&i.createdResources.push(`inbound:${i.inboundTopicId}`)}return{inboundTopicId:i.inboundTopicId,outboundTopicId:i.outboundTopicId,state:i}}},exports.ConnectionConfirmationError=Oc,exports.ConnectionsManager=class{constructor(e){this.connections=new Map,this.pendingRequests=new Map,this.profileCache=new Map,this.filterPendingAccountIds=new Set;const t={module:"ConnectionsManager",level:e?.logLevel||"info",prettyPrint:!0,silent:e?.silent};if(this.logger=new d(t),e?.filterPendingAccountIds&&(this.filterPendingAccountIds=new Set(e.filterPendingAccountIds)),!e.baseClient)throw new Error("ConnectionsManager requires a baseClient to operate");this.baseClient=e.baseClient}async fetchConnectionData(e){try{const t=await this.baseClient.retrieveCommunicationTopics(e),i=e=>Boolean(e)&&!e.includes(":");if(!i(t.inboundTopic)||!i(t.outboundTopic))return this.logger.warn("Invalid topic IDs detected in retrieved communication topics"),this.getAllConnections();const[n,o]=await Promise.all([this.baseClient.getMessages(t.outboundTopic),this.baseClient.getMessages(t.inboundTopic)]);this.processOutboundMessages(n.messages||[],e),this.processInboundMessages(o.messages||[]);const a=Array.from(this.connections.values()).filter((e=>"pending"===e.status||e.isPending)).length;return this.logger.debug(`Processed ${n.messages?.length||0} outbound and ${o.messages?.length||0} inbound messages. Found ${a} pending connections.`),await this.checkTargetInboundTopicsForConfirmations(),await this.checkOutboundRequestsForConfirmations(),await this.fetchProfilesForConnections(),await this.fetchConnectionActivity(),this.getAllConnections()}catch(t){return this.logger.error("Error fetching connection data:",t),this.getAllConnections()}}async checkTargetInboundTopicsForConfirmations(){const e=Array.from(this.connections.values()).filter((e=>(e.isPending||"pending"===e.status)&&e.targetInboundTopicId));if(0===e.length)return;const t=new Map;e.forEach((e=>{if(e.targetInboundTopicId){const i=t.get(e.targetInboundTopicId)||[];i.push(e),t.set(e.targetInboundTopicId,i)}}));for(const[n,o]of t.entries())for(let e=1;e<=2;e++)try{const t=(await this.baseClient.getMessages(n)).messages||[];let i=!1;for(const e of o){const n=e.connectionRequestId;if(!n)continue;const o=t.find((t=>{if("connection_created"!==t.op||!t.connection_topic_id)return!1;if(t.connection_id!==n)return!1;if(e.uniqueRequestKey){const i=e.uniqueRequestKey.split(":");if(i.length>1){const n=i[1];if(t.operator_id&&t.operator_id===n)return!0;if(t.connected_account_id===e.targetAccountId)return!0}}return!0}));if(o?.connection_topic_id){i=!0;const t=o.connection_topic_id;let a=e.uniqueRequestKey;const r={connectionTopicId:t,targetAccountId:e.targetAccountId,targetAgentName:e.targetAgentName,targetInboundTopicId:e.targetInboundTopicId,status:"established",isPending:!1,needsConfirmation:!1,created:new Date(o.created||e.created),profileInfo:e.profileInfo,connectionRequestId:n,uniqueRequestKey:e.uniqueRequestKey,originTopicId:e.originTopicId,processed:e.processed,memo:e.memo};this.connections.set(t,r),a&&this.connections.delete(a),this.logger.debug(`Confirmed connection in target inbound topic: ${t}`)}}if(i||2===e)break;await new Promise((e=>setTimeout(e,500)))}catch(i){if(this.logger.debug(`Error fetching target inbound topic ${n}:`,i),2===e)break;await new Promise((e=>setTimeout(e,500)))}}async checkOutboundRequestsForConfirmations(){const e=Array.from(this.connections.values());this.logger.info(`Total connections in map: ${e.length}`);const t=e.filter((e=>"pending"===e.status));this.logger.info(`Connections with status='pending': ${t.length}`);const i=e.filter((e=>"pending"===e.status));if(Boolean(i?.length))for(const o of i){if(this.logger.debug(`Processing pending connection: ${o.connectionTopicId}`),!o.targetAccountId){this.logger.debug(`Skipping connection ${o.connectionTopicId} - no targetAccountId`);continue}let e=o.targetInboundTopicId;if(!e)try{const t=await this.baseClient.retrieveProfile(o.targetAccountId);if(!t?.profile?.inboundTopicId){this.logger.debug(`Couldn't get inbound topic ID for account ${o.targetAccountId}`);continue}e=t.profile.inboundTopicId,this.connections.set(o.connectionTopicId,{...o,targetInboundTopicId:e}),this.logger.debug(`Updated connection ${o.connectionTopicId} with inbound topic ID: ${e}`)}catch(n){this.logger.debug(`Error fetching profile for ${o.targetAccountId}: ${n}`);continue}if(!e||e.includes(":")){this.logger.debug(`Skipping invalid inbound topic format: ${e}`);continue}const t=o.connectionRequestId||o.inboundRequestId;if(t)try{this.logger.debug(`Checking for confirmations on topic ${e} for request ID ${t}`);const i=await this.baseClient.getMessages(e),n=(i.messages||[]).find((e=>"connection_created"===e.op&&e.connection_id===t&&e.connection_topic_id));if(n?.connection_topic_id){const e=n.connection_topic_id;this.logger.info(`Found confirmation for request #${t} to ${o.targetAccountId} on their inbound topic`),this.connections.set(o.connectionTopicId,{...o,connectionTopicId:e,status:"established",isPending:!1,needsConfirmation:!1,created:new Date(n.created||o.created),lastActivity:new Date(n.created||o.created)})}else this.logger.debug(`No confirmation found for request ID ${t} on topic ${e}`)}catch(n){this.logger.warn(`Error checking for confirmations on target inbound topic for ${o.targetAccountId}: ${n}`)}else this.logger.debug(`Skipping connection ${o.connectionTopicId} - no request ID`)}else this.logger.info("No pending connections found")}async fetchProfilesForConnections(){const e=new Set;for(const i of this.connections.values())i.targetAccountId&&!this.profileCache.has(i.targetAccountId)&&e.add(i.targetAccountId);const t=Array.from(e).map((async e=>{try{const t=await this.baseClient.retrieveProfile(e);t.success&&t.profile&&(this.addProfileInfo(e,t.profile),this.updatePendingConnectionsWithProfileInfo(e,t.profile))}catch(t){this.logger.debug(`Failed to fetch profile for ${e}:`,t)}}));await Promise.allSettled(t)}updatePendingConnectionsWithProfileInfo(e,t){const i=Array.from(this.connections.values()).filter((t=>t.targetAccountId===e&&(t.isPending||t.needsConfirmation)&&!t.targetInboundTopicId));if(i.length>0&&t.inboundTopicId)for(const n of i){const e={...n,targetInboundTopicId:t.inboundTopicId};this.connections.set(n.connectionTopicId,e)}}async fetchConnectionActivity(){const e=this.getActiveConnections().filter((e=>{const t=e.connectionTopicId;return!(!t||t.includes(":")||!t.match(/^0\.0\.\d+$/))||(this.logger.debug(`Skipping activity fetch for invalid topic ID format: ${t}`),!1)})).map((async e=>{try{const t=e.connectionTopicId,i=await this.baseClient.getMessages(t);i?.messages?.length>0&&this.processConnectionMessages(t,i.messages)}catch(t){this.logger.debug(`Failed to fetch activity for ${e.connectionTopicId}:`,t)}}));await Promise.allSettled(e)}shouldFilterAccount(e){return!!this.filterPendingAccountIds.has(e)&&!this.hasEstablishedConnectionWithAccount(e)}processOutboundMessages(e,t){if(!Boolean(e?.length))return Array.from(this.connections.values());const i=e.filter((e=>"connection_request"===e.op&&e.connection_request_id));for(const a of i){const e=a.connection_request_id,i=a.operator_id||"",n=this.baseClient.extractAccountFromOperatorId(i),o=this.baseClient.extractTopicFromOperatorId(i);if(this.shouldFilterAccount(n)){this.logger.debug(`Filtering out outbound request to account: ${n}`);continue}const r=Array.from(this.connections.values()).some((t=>t.connectionRequestId===e&&!t.isPending&&t.targetAccountId===n)),s=`req-${e}:${i}`;if(!r&&!this.pendingRequests.has(s)){const r={id:e,requesterId:t,requesterTopicId:a.outbound_topic_id||"",targetAccountId:n,targetTopicId:o,operatorId:i,sequenceNumber:a.sequence_number,created:a.created||new Date,memo:a.m,status:"pending"};if(this.pendingRequests.set(s,r),!this.connections.has(s)){const t={connectionTopicId:s,targetAccountId:n,targetInboundTopicId:o,status:"pending",isPending:!0,needsConfirmation:!1,created:a.created||new Date,connectionRequestId:e,uniqueRequestKey:s,originTopicId:a.outbound_topic_id||"",processed:!1,memo:a.m};this.connections.set(s,t)}}}const n=e.filter((e=>"connection_created"===e.op&&e.connection_topic_id&&e.connection_request_id));for(const a of n){const e=a.connection_request_id,t=a.connection_topic_id,i=this.baseClient.extractAccountFromOperatorId(a.operator_id||"");if(this.shouldFilterAccount(i)){this.logger.debug(`Filtering out outbound confirmation to account: ${i}`);continue}const n=`req-${e}:${a.operator_id}`,o=this.pendingRequests.get(n);if(o&&(o.status="confirmed"),this.connections.has(n)&&this.connections.delete(n),this.connections.has(t)){const i=this.connections.get(t);this.connections.set(t,{...i,status:"established",isPending:!1,needsConfirmation:!1,connectionRequestId:e,confirmedRequestId:a.confirmed_request_id,requesterOutboundTopicId:a.outbound_topic_id,uniqueRequestKey:n,originTopicId:a.outbound_topic_id||"",processed:!1,memo:a.m})}else this.connections.set(t,{connectionTopicId:t,targetAccountId:i,status:"established",isPending:!1,needsConfirmation:!1,created:a.created||new Date,connectionRequestId:e,confirmedRequestId:a.confirmed_request_id,requesterOutboundTopicId:a.outbound_topic_id,uniqueRequestKey:n,originTopicId:a.outbound_topic_id||"",processed:!1,memo:a.m})}const o=e.filter((e=>"connection_closed"===e.op||"close_connection"===e.op&&e.connection_topic_id));for(const a of o){const e=a.connection_topic_id;if(this.connections.has(e)){const t=this.connections.get(e);if(this.shouldFilterAccount(t.targetAccountId)&&"established"!==t.status)continue;const i=a.connection_request_id&&a.operator_id?`req-${a.connection_request_id}:${a.operator_id}`:void 0;this.connections.set(e,{...t,status:"closed",isPending:!1,needsConfirmation:!1,lastActivity:a.created||new Date,closedReason:a.reason,closeMethod:a.close_method,uniqueRequestKey:i,originTopicId:t.originTopicId,processed:!1,memo:a.m})}}return Array.from(this.connections.values()).filter((e=>"established"===e.status||"closed"===e.status||!this.filterPendingAccountIds.has(e.targetAccountId)))}processInboundMessages(e){if(!Boolean(e?.length))return Array.from(this.connections.values());const t=e.filter((e=>"connection_request"===e.op&&e.sequence_number)),i=e.filter((e=>"connection_created"===e.op&&e.connection_topic_id&&e.connection_id));for(const n of t){const e=n.sequence_number,t=n.operator_id||"",o=this.baseClient.extractAccountFromOperatorId(t),a=this.baseClient.extractTopicFromOperatorId(t);if(this.shouldFilterAccount(o)){this.logger.debug(`Filtering out request from account: ${o}`);continue}const r=`inb-${e}:${t}`;i.some((t=>t.connection_id===e))?this.logger.debug(`Skipping request from ${o} as it has already been confirmed`):this.connections.has(r)||this.connections.set(r,{connectionTopicId:r,targetAccountId:o,targetInboundTopicId:a,status:"needs_confirmation",isPending:!1,needsConfirmation:!0,created:n.created||new Date,inboundRequestId:e,uniqueRequestKey:r,originTopicId:a,processed:!1,memo:n.m})}for(const n of i){const e=n.connection_id,t=n.connection_topic_id,i=n.connected_account_id||"",o=n.operator_id||"";if(this.shouldFilterAccount(i)){this.logger.debug(`Filtering out confirmation for account: ${i}`);continue}const a=`inb-${e}:${o}`;if(this.connections.has(a)&&this.connections.delete(a),this.connections.has(t)){const i=this.connections.get(t);this.connections.set(t,{...i,status:"established",isPending:!1,needsConfirmation:!1,inboundRequestId:e,uniqueRequestKey:a,originTopicId:n.connection_topic_id,processed:!1,memo:n.m})}else this.connections.set(t,{connectionTopicId:t,targetAccountId:i,status:"established",isPending:!1,needsConfirmation:!1,created:n.created||new Date,inboundRequestId:e,uniqueRequestKey:a,originTopicId:n.connection_topic_id,processed:!1,memo:n.m})}return Array.from(this.connections.values()).filter((e=>"established"===e.status||"closed"===e.status||!this.filterPendingAccountIds.has(e.targetAccountId)))}processConnectionMessages(e,t){if(!t||0===t.length||!this.connections.has(e))return this.connections.get(e);const i=t.filter((e=>e.created)).sort(((e,t)=>{const i=e.created?new Date(e.created).getTime():0;return(t.created?new Date(t.created).getTime():0)-i}))[0];if(i?.created){const t=this.connections.get(e);this.connections.set(e,{...t,lastActivity:i.created})}const n=t.find((e=>"close_connection"===e.op));if(n){const t=this.connections.get(e);this.connections.set(e,{...t,status:"closed",lastActivity:n.created||new Date,closedReason:n.reason,closeMethod:"explicit"})}return this.connections.get(e)}addProfileInfo(e,t){this.profileCache.set(e,t);const i=Array.from(this.connections.values()).filter((t=>t.targetAccountId===e));for(const n of i)this.connections.set(n.connectionTopicId,{...n,profileInfo:t,targetAgentName:t.display_name,targetInboundTopicId:t.inboundTopicId,targetOutboundTopicId:t.outboundTopicId})}getAllConnections(){return Array.from(this.connections.values()).filter((e=>"established"===e.status||"closed"===e.status||!this.filterPendingAccountIds.has(e.targetAccountId)))}getPendingRequests(){return Array.from(this.connections.values()).filter((e=>e.isPending&&!this.filterPendingAccountIds.has(e.targetAccountId)))}hasEstablishedConnectionWithAccount(e){return Array.from(this.connections.values()).some((t=>t.targetAccountId===e&&"established"===t.status))}getActiveConnections(){return Array.from(this.connections.values()).filter((e=>"established"===e.status))}getConnectionsNeedingConfirmation(){return Array.from(this.connections.values()).filter((e=>e.needsConfirmation&&!this.filterPendingAccountIds.has(e.targetAccountId)))}getConnectionByTopicId(e){return this.connections.get(e)}getConnectionByAccountId(e){return Array.from(this.connections.values()).find((t=>t.targetAccountId===e&&"established"===t.status))}getConnectionsByAccountId(e){return Array.from(this.connections.values()).filter((t=>t.targetAccountId===e))}updateOrAddConnection(e){this.connections.set(e.connectionTopicId,e)}clearAll(){this.connections.clear(),this.pendingRequests.clear()}isConnectionRequestProcessed(e,t){for(const i of this.connections.values()){if(i.originTopicId===e&&i.inboundRequestId===t&&i.processed)return!0;if(i.originTopicId===e&&i.connectionRequestId===t&&i.processed)return!0}return!1}markConnectionRequestProcessed(e,t){let i=!1;for(const[n,o]of this.connections.entries())o.originTopicId===e&&o.inboundRequestId===t&&(this.connections.set(n,{...o,processed:!0}),i=!0,this.logger.debug(`Marked inbound connection request #${t} on topic ${e} as processed`)),o.originTopicId===e&&o.connectionRequestId===t&&(this.connections.set(n,{...o,processed:!0}),i=!0,this.logger.debug(`Marked outbound connection request #${t} on topic ${e} as processed`));return i}async getPendingTransactions(e,t){try{const n=await this.baseClient.getTransactionRequests(e,t?{...t}:void 0),o=[];for(const e of n)try{const t=await this.baseClient.mirrorNode.getScheduledTransactionStatus(e.schedule_id);t.executed||t.deleted||o.push(e)}catch(i){this.logger.error(`Error checking transaction status: ${i}`),o.push(e)}return o}catch(i){return this.logger.error(`Error getting pending transactions: ${i}`),[]}}getScheduledTransactionStatus(e){return this.baseClient.mirrorNode.getScheduledTransactionStatus(e)}async getLastOperatorActivity(e,t){try{const i=(await this.baseClient.getMessageStream(e)).messages.filter((e=>e.operator_id&&e.operator_id.includes(t)&&e.created));if(0===i.length)return;return i.sort(((e,t)=>t.created.getTime()-e.created.getTime())),i[0].created}catch(i){return void this.logger.error(`Error getting last operator activity: ${i}`)}}},exports.CustomFeeType=ip,exports.EVMBridge=class{constructor(e="mainnet-public",t="mirrornode.hedera.com/api/v1/contracts/call",i){this.network=e,this.mirrorNodeUrl=t,this.cache=i||new m,this.logger=d.getInstance({module:"EVMBridge"})}async executeCommands(e,t={}){let o={...t};const a={};for(const s of e){const e=`${s.c.contractAddress}-${s.c.abi.name}`,t=await this.cache.get(e);if(t)a[s.c.abi.name]=JSON.parse(t),Object.assign(o,a[s.c.abi.name]);else try{const t=new n.ethers.Interface([{...s.c.abi}]),r=t.encodeFunctionData(s.c.abi.name),c=i.ContractId.fromSolidityAddress(s.c.contractAddress),p=await this.readFromMirrorNode(r,i.AccountId.fromString("0.0.800"),c);if(this.logger.info(`Result for ${s.c.contractAddress}:`,p?.result),!p?.result){this.logger.warn(`Failed to get result from mirror node for ${s.c.contractAddress}`),a[s.c.abi.name]="0",Object.assign(o,a[s.c.abi.name]);continue}const l=t?.decodeFunctionResult(s.c.abi.name,p.result);let u={values:[]};l&&s.c.abi.outputs?.forEach(((e,t)=>{const i=f(l[t],e.type);u.values.push(i),e.name&&(u[e.name]=i)})),await this.cache.set(e,JSON.stringify(u)),a[s.c.abi.name]=u,o[s.c.abi.name]=u}catch(r){this.logger.error(`Error executing command for ${s.c.contractAddress}:`,r),a[s.c.abi.name]="0",Object.assign(o,a[s.c.abi.name])}}return{results:a,stateData:o}}async executeCommand(e,t={}){const{results:i,stateData:n}=await this.executeCommands([e],t);return{result:i[e.c.abi.name],stateData:n}}async readFromMirrorNode(e,t,i){try{const n=i.toSolidityAddress(),o=t.toSolidityAddress(),a=await fetch(`https://${this.network}.${this.mirrorNodeUrl}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({block:"latest",data:e,estimate:!1,gas:3e5,gasPrice:1e8,from:o.startsWith("0x")?o:`0x${o}`,to:n?.startsWith("0x")?n:`0x${n}`,value:0})});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}catch(n){return this.logger.error("Error reading from mirror node:",n),null}}async clearCache(){await this.cache.clear()}async clearCacheForContract(e,t){await this.cache.delete(`${e}-${t}`)}setLogLevel(e){this.logger.setLogLevel(e)}},exports.EndpointType=ac,exports.FeeConfigBuilder=np,exports.HCS=class{constructor(){this.modelViewerLoaded=!1,this.modelViewerLoading=null,this.config={cdnUrl:"https://kiloscribe.com/api/inscription-cdn/",network:"mainnet",retryAttempts:3,retryBackoff:300,debug:!1,showLoadingIndicator:!1,loadingCallbackName:null},this.configMapping={hcsCdnUrl:"cdnUrl",hcsNetwork:"network",hcsRetryAttempts:"retryAttempts",hcsRetryBackoff:"retryBackoff",hcsDebug:"debug",hcsShowLoadingIndicator:"showLoadingIndicator",hcsLoadingCallbackName:"loadingCallbackName"},this.LoadedScripts={},this.LoadedWasm={},this.LoadedImages={},this.LoadedVideos={},this.LoadedAudios={},this.LoadedAudioUrls={},this.LoadedGLBs={},this.scriptLoadedEvent=new Event("HCSScriptLoaded"),this.loadQueue=[],this.isProcessingQueue=!1;try{this.logger=d.getInstance({module:"HCS-3",level:this.config.debug?"debug":"error"})}catch(e){this.logger=this.createFallbackLogger()}}createFallbackLogger(){return{debug:(...e)=>this.config.debug&&console.debug("[HCS-3]",...e),info:(...e)=>this.config.debug&&console.info("[HCS-3]",...e),warn:(...e)=>console.warn("[HCS-3]",...e),error:(...e)=>console.error("[HCS-3]",...e),setLogLevel:e=>{this.config.debug="debug"===e}}}log(...e){if(0===e.length)this.logger.debug("");else if(1===e.length)this.logger.debug(String(e[0]));else{const t=String(e[0]),i=e.slice(1);this.logger.debug(t,i)}}error(...e){if(0===e.length)this.logger.error("");else if(1===e.length)this.logger.error(String(e[0]));else{const t=String(e[0]),i=e.slice(1);this.logger.error(t,i)}}loadConfigFromHTML(){const e=document.querySelector("script[data-hcs-config]");e&&(Object.keys(this.configMapping).forEach((t=>{if(e.dataset[t]){const i=this.configMapping[t];let n=e.dataset[t];"true"===n&&(n=!0),"false"===n&&(n=!1),isNaN(Number(n))||""===n||(n=Number(n)),this.config[i]=n}})),this.logger.setLogLevel(this.config.debug?"debug":"error")),this.log("Loaded config:",this.config)}updateLoadingStatus(e,t){if("loaded"!==this.LoadedScripts[e]&&(this.config.showLoadingIndicator&&console.log("[HCS Loading] "+e+" : "+t),this.LoadedScripts[e]=t,this.config.loadingCallbackName&&"function"==typeof window[this.config.loadingCallbackName])){const i=window[this.config.loadingCallbackName];"function"==typeof i&&i(e,t)}}async fetchWithRetry(e,t=this.config.retryAttempts,i=this.config.retryBackoff){try{const t=await fetch(e);if(!t.ok)throw new Error("HTTP error! status: "+t.status);return t}catch(n){if(t>0)return this.log("Retrying fetch for "+e+" Attempts left: "+(t-1)),await this.sleep(i),this.fetchWithRetry(e,t-1,2*i);throw n}}sleep(e){return new Promise((t=>setTimeout(t,e)))}isDuplicate(e){return!!this.LoadedScripts[e]}async retrieveHCS1Data(e,t=this.config.cdnUrl,i=this.config.network){const n=i.replace(/['"]+/g,""),o=await this.fetchWithRetry(t+e+"?network="+n);return await o.blob()}async loadScript(e){const t=e.getAttribute("data-src"),i=e.getAttribute("data-script-id"),n=t?.split("/").pop(),o=e.getAttribute("type"),a=e.hasAttribute("data-required"),r="module"===e.getAttribute("type");if(!this.isDuplicate(n||"")){this.updateLoadingStatus(i,"loading");try{const t=e.getAttribute("data-cdn-url")||this.config.cdnUrl,s=e.getAttribute("data-network")||this.config.network,c=await this.retrieveHCS1Data(n,t,s);if("wasm"===o){const t=await c.arrayBuffer(),n=await WebAssembly.compile(t);this.LoadedWasm[i]=await WebAssembly.instantiate(n,{env:{},...e.dataset}),this.updateLoadingStatus(i,"loaded"),window.dispatchEvent(this.scriptLoadedEvent),this.log("Loaded wasm: "+i)}else{const e=await c.text(),t=document.createElement("script");if(t.textContent=e,t.className="hcs-inline-script",i&&t.setAttribute("data-loaded-script-id",i),r){t.type="module";const i=new Blob([e],{type:"application/javascript"});t.src=URL.createObjectURL(i)}document.body.appendChild(t),this.updateLoadingStatus(i,"loaded"),window.dispatchEvent(this.scriptLoadedEvent),this.log("Loaded script: "+i),t.onerror=e=>{if(this.error("Failed to load "+o+": "+i,e),this.updateLoadingStatus(i,"failed"),a)throw e}}}catch(s){if(this.error("Failed to load "+o+": "+i,s),this.updateLoadingStatus(i,"failed"),a)throw s}}}async loadModuleExports(e){const t=document.querySelector('script[data-loaded-script-id="'+e+'"]');if(!t)throw new Error("Module script with id "+e+" not found");const i=t.getAttribute("src");if(!i)throw new Error("Module script "+e+" has no src attribute");try{return await import(i)}catch(n){throw this.error("Failed to import module",n),n}}async loadStylesheet(e){const t=e.getAttribute("data-src"),i=e.getAttribute("data-script-id"),n=t?.split("/").pop(),o=e.hasAttribute("data-required");if(!this.isDuplicate(n||"")){this.updateLoadingStatus(i,"loading");try{const t=e.getAttribute("data-cdn-url")||this.config.cdnUrl,o=e.getAttribute("data-network")||this.config.network,a=await this.retrieveHCS1Data(n,t,o),r=await a.text(),s=document.createElement("style");s.textContent=r,document.head.appendChild(s),this.updateLoadingStatus(i,"loaded"),window.dispatchEvent(this.scriptLoadedEvent),this.log("Loaded and inlined stylesheet: "+i)}catch(a){if(this.error("Failed to load stylesheet: "+i,a),this.updateLoadingStatus(i,"failed"),o)throw a}}}async loadImage(e){const t=e.getAttribute("data-src"),i=t?.split("/").pop();this.log("Loading image: "+i),this.updateLoadingStatus("Image: "+i,"loaded");try{const t=e.getAttribute("data-cdn-url")||this.config.cdnUrl,n=e.getAttribute("data-network")||this.config.network,o=await this.retrieveHCS1Data(i,t,n),a=URL.createObjectURL(o);e.src=a,this.LoadedImages[i]=a,this.updateLoadingStatus("Image: "+i,"loaded"),this.log("Loaded image: "+i)}catch(n){this.error("Failed to load image: "+i,n),this.updateLoadingStatus("Image: "+i,"failed")}}async loadMedia(e,t){const i=e.getAttribute("data-src"),n=i?.split("/").pop();this.log("Loading "+t+": "+n),this.updateLoadingStatus(t+": "+n,"loading");try{const i=e.getAttribute("data-cdn-url")||this.config.cdnUrl,o=e.getAttribute("data-network")||this.config.network,a=await this.retrieveHCS1Data(n,i,o),r=URL.createObjectURL(a);e.src=r,"video"===t?this.LoadedVideos[n]=r:this.LoadedAudioUrls[n]=r,this.updateLoadingStatus(t+": "+n,"loaded"),this.log("Loaded "+t+": "+n)}catch(o){this.error("Failed to load "+t+": "+n,o),this.updateLoadingStatus(t+": "+n,"failed")}}async loadModelViewer(){return this.modelViewerLoading?this.modelViewerLoading:this.modelViewerLoaded?Promise.resolve():(this.modelViewerLoading=new Promise((e=>{const t=document.createElement("script");t.setAttribute("data-src","hcs://1/0.0.7293044"),t.setAttribute("data-script-id","model-viewer"),t.setAttribute("type","module"),window.addEventListener("HCSScriptLoaded",(()=>{this.modelViewerLoaded=!0,e()}),{once:!0}),this.loadScript(t)})),this.modelViewerLoading)}async loadGLB(e){await this.loadModelViewer();const t=e.getAttribute("data-src"),i=t?.split("/").pop();this.log("Loading GLB: "+i),this.updateLoadingStatus("GLB: "+i,"loading");try{const t=e.getAttribute("data-cdn-url")||this.config.cdnUrl,n=e.getAttribute("data-network")||this.config.network;let o;"model-viewer"!==e.tagName.toLowerCase()?(o=document.createElement("model-viewer"),Array.from(e.attributes).forEach((e=>{o.setAttribute(e.name,e.value)})),o.setAttribute("camera-controls",""),o.setAttribute("auto-rotate",""),o.setAttribute("ar",""),e.parentNode?.replaceChild(o,e)):o=e;const a=await this.retrieveHCS1Data(i,t,n),r=URL.createObjectURL(a);o.setAttribute("src",r),this.LoadedGLBs[i]=r,this.updateLoadingStatus("GLB: "+i,"loaded"),this.log("Loaded GLB: "+i)}catch(n){this.error("Failed to load GLB: "+i,n),this.updateLoadingStatus("GLB: "+i,"failed")}}async loadResource(e,t,i){return new Promise((n=>{this.loadQueue.push({element:e,type:t,order:i,resolve:n}),this.processQueue()}))}async processQueue(){if(!this.isProcessingQueue){for(this.isProcessingQueue=!0;this.loadQueue.length>0;){const t=this.loadQueue.shift();try{"script"===t.type?await this.loadScript(t.element):"image"===t.type?await this.loadImage(t.element):"video"===t.type||"audio"===t.type?await this.loadMedia(t.element,t.type):"glb"===t.type?await this.loadGLB(t.element):"css"===t.type&&await this.loadStylesheet(t.element),t.resolve()}catch(e){if(this.error("Error processing queue item:",e),"script"===t.type&&t.element.hasAttribute("data-required"))break}}this.isProcessingQueue=!1}}async replaceHCSInStyle(e){let t=e,i=t.indexOf("hcs://");for(;-1!==i;){let e=i;for(;e<t.length&&!["'",'"'," ",")"].includes(t[e]);)e++;const o=t.substring(i,e),a=o.split("/").pop();try{const n=this.config.cdnUrl,r=this.config.network,s=await this.retrieveHCS1Data(a,n,r),c=URL.createObjectURL(s);t=t.substring(0,i)+c+t.substring(e),this.LoadedImages[a]=c,this.log("Replaced CSS HCS URL: "+o+" with "+c)}catch(n){this.error("Failed to load CSS image: "+a,n)}i=t.indexOf("hcs://",i+1)}return t}async processInlineStyles(){const e=document.querySelectorAll('[style*="hcs://"]');this.log("Found "+e.length+" elements with HCS style references");for(const i of Array.from(e)){const e=i.getAttribute("style");if(e){this.log("Processing style: "+e);const t=await this.replaceHCSInStyle(e);e!==t&&(i.setAttribute("style",t),this.log("Updated style to: "+t))}}const t=document.querySelectorAll("style");for(const i of Array.from(t))if(i.textContent?.includes("hcs://")){const e=await this.replaceHCSInStyle(i.textContent);i.textContent!==e&&(i.textContent=e)}}async init(){return this.loadConfigFromHTML(),new Promise((e=>{const t=async()=>{const t=document.querySelectorAll('script[data-src^="hcs://"]'),i=document.querySelectorAll('img[data-src^="hcs://"], img[src^="hcs://"]'),n=document.querySelectorAll('video[data-src^="hcs://"], video[src^="hcs://"]'),o=document.querySelectorAll('audio[data-src^="hcs://"], audio[src^="hcs://"]'),a=document.querySelectorAll('model-viewer[data-src^="hcs://"]'),r=document.querySelectorAll('link[data-src^="hcs://"]');document.querySelectorAll('[src^="hcs://"]').forEach((e=>{const t=e.getAttribute("src");t&&(e.setAttribute("data-src",t),e.removeAttribute("src"))})),await this.processInlineStyles();const s=[];[{elements:t,type:"script"},{elements:i,type:"image"},{elements:n,type:"video"},{elements:o,type:"audio"},{elements:a,type:"glb"},{elements:r,type:"css"}].forEach((({elements:e,type:t})=>{e.forEach((e=>{const i=parseInt(e.getAttribute("data-load-order")||"")||1/0;s.push(this.loadResource(e,t,i))}))})),await Promise.all(s);const c=new MutationObserver((e=>{e.forEach((e=>{if(e.addedNodes.forEach((e=>{if(e.nodeType===Node.ELEMENT_NODE){const t=e;if(t.getAttribute("style")?.includes("hcs://")&&this.processInlineStyles(),"style"===t.tagName.toLowerCase()&&t.textContent?.includes("hcs://")&&this.processInlineStyles(),t.getAttribute("src")?.startsWith("hcs://")){const e=t.getAttribute("src");t.setAttribute("data-src",e),t.removeAttribute("src");switch(t.tagName.toLowerCase()){case"img":this.loadResource(t,"image",1/0);break;case"video":this.loadResource(t,"video",1/0);break;case"audio":this.loadResource(t,"audio",1/0);break;case"script":this.loadResource(t,"script",1/0)}}t.matches('script[data-src^="hcs://"]')?this.loadResource(t,"script",1/0):t.matches('img[data-src^="hcs://"]')?this.loadResource(t,"image",1/0):t.matches('video[data-src^="hcs://"]')?this.loadResource(t,"video",1/0):t.matches('audio[data-src^="hcs://"]')?this.loadResource(t,"audio",1/0):t.matches('model-viewer[data-src^="hcs://"]')?this.loadResource(t,"glb",1/0):t.matches('link[data-src^="hcs://"]')&&this.loadResource(t,"css",1/0);t.querySelectorAll('[data-src^="hcs://"], [src^="hcs://"]').forEach((e=>{const t=e,i=t.tagName.toLowerCase(),n=t.getAttribute("src");switch(n?.startsWith("hcs://")&&(t.setAttribute("data-src",n),t.removeAttribute("src")),i){case"script":this.loadResource(t,"script",1/0);break;case"img":this.loadResource(t,"image",1/0);break;case"video":this.loadResource(t,"video",1/0);break;case"audio":this.loadResource(t,"audio",1/0);break;case"model-viewer":this.loadResource(t,"glb",1/0);break;case"link":this.loadResource(t,"css",1/0)}}))}})),"attributes"===e.type){const t=e.target;if("style"===e.attributeName&&t.getAttribute("style")?.includes("hcs://"))this.processInlineStyles();else if("src"===e.attributeName){const e=t.getAttribute("src");if(e?.startsWith("hcs://")){t.setAttribute("data-src",e),t.removeAttribute("src");const i=t.tagName.toLowerCase();["img","video","audio"].includes(i)&&this.loadResource(t,i,1/0)}}}}))}));document.body?c.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","src","data-src"]}):document.addEventListener("DOMContentLoaded",(()=>{c.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","src","data-src"]})})),e()};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}))}async preloadImage(e){this.log("Loading image:"+e),this.updateLoadingStatus("image: "+e,"loading");const t=await this.retrieveHCS1Data(e),i=URL.createObjectURL(t);return this.LoadedImages[e]=i,this.updateLoadingStatus("image: "+e,"loaded"),i}async preloadAudio(e){const t=document.createElement("audio");t.setAttribute("data-topic-id",e),t.setAttribute("data-src","hcs://1/"+e),document.body.appendChild(t),await this.loadMedia(t,"audio");const i=document.querySelector('audio[data-topic-id="'+e+'"]');return i?this.LoadedAudioUrls[e]=i.src:console.error("Failed to preload audio: "+e),this.LoadedAudioUrls[e]}async playAudio(e,t=1){const i=this.LoadedAudioUrls[e];if(i){const n=new Audio(i);n.volume=t,this.LoadedAudios[e]=n,n.play().catch((e=>{console.error("Failed to play audio:",e)})),n.addEventListener("ended",(()=>{n.remove(),delete this.LoadedAudios[e]}))}else console.error("Audio not preloaded: "+e)}async pauseAudio(e){const t=document.querySelector('audio[data-topic-id="'+e+'"]');t?(console.log("found element",t),t.pause(),this.LoadedAudios[e]?.pause()):this.LoadedAudios[e]?.pause()}async loadAndPlayAudio(e,t=!1,i=1){let n=document.querySelector('audio[data-topic-id="'+e+'"]');if(n)n.volume=i,await n.play();else{const o=document.createElement("audio");o.volume=i,t&&o.setAttribute("autoplay","autoplay"),o.setAttribute("data-topic-id",e),o.setAttribute("data-src","hcs://1/"+e),document.body.appendChild(o),await this.loadMedia(o,"audio"),n=document.querySelector('audio[data-topic-id="'+e+'"]'),t||await n.play()}}},exports.HCS10BaseClient=_c,exports.HCS10Cache=Cc,exports.HCS10Client=$c,exports.HCS11Client=Tc,exports.HCS20BaseClient=tp,exports.HCS20BurnMessageSchema=Kc,exports.HCS20Client=class extends tp{constructor(e){super(e),this.initialized=!1,this.operatorId="string"==typeof e.operatorId?i.AccountId.fromString(e.operatorId):e.operatorId,this.operatorKeyString=e.operatorKey,this.client="mainnet"===this.network?i.Client.forMainnet():i.Client.forTestnet();try{const{privateKey:t,detectedType:i}=ic(e.operatorKey);this.operatorKey=t,this.keyType=i,this.client.setOperator(this.operatorId,this.operatorKey),this.initialized=!0}catch(t){this.logger.debug("Failed to detect key type from string, will initialize later")}}async initializeOperator(){if(!this.initialized)try{const e=await this.mirrorNode.requestAccount(this.operatorId.toString()),t=e?.key?._type;t?.includes("ECDSA")?this.keyType="ecdsa":(t?.includes("ED25519"),this.keyType="ed25519"),this.operatorKey="ecdsa"===this.keyType?i.PrivateKey.fromStringECDSA(this.operatorKeyString):i.PrivateKey.fromStringED25519(this.operatorKeyString),this.client.setOperator(this.operatorId,this.operatorKey),this.initialized=!0,this.logger.debug(`Initialized operator with key type: ${this.keyType}`)}catch(e){this.logger.warn("Failed to query mirror node for key type, using ED25519"),this.keyType="ed25519",this.operatorKey=i.PrivateKey.fromStringED25519(this.operatorKeyString),this.client.setOperator(this.operatorId,this.operatorKey),this.initialized=!0}}async ensureInitialized(){this.initialized||await this.initializeOperator()}async submitPayload(e,t,n){const o="string"==typeof t?t:JSON.stringify(t),a=(new i.TopicMessageSubmitTransaction).setTopicId(i.TopicId.fromString(e)).setMessage(o);let r;if(n){const e=a.freezeWith(this.client),t=await e.sign(n);r=await t.execute(this.client)}else r=await a.execute(this.client);const s=await r.getReceipt(this.client);if(!s||s.status!==i.Status.Success)throw new Error("Failed to submit message to topic");return{receipt:s,transactionId:r.transactionId.toString()}}async createPublicTopic(e){await this.ensureInitialized(),this.logger.info("Creating public HCS-20 topic...");const t=await(new i.TopicCreateTransaction).setTopicMemo(e||"HCS-20 Public Topic").execute(this.client),n=await t.getReceipt(this.client);if(n.status!==i.Status.Success||!n.topicId)throw new Error("Failed to create public topic");const o=n.topicId.toString();return this.logger.info(`Created public topic: ${o}`),this.publicTopicId=o,o}async createRegistryTopic(e){await this.ensureInitialized(),this.logger.info("Creating HCS-20 registry topic...");const t=await(new i.TopicCreateTransaction).setTopicMemo(e||"HCS-20 Registry").execute(this.client),n=await t.getReceipt(this.client);if(n.status!==i.Status.Success||!n.topicId)throw new Error("Failed to create registry topic");const o=n.topicId.toString();return this.logger.info(`Created registry topic: ${o}`),this.registryTopicId=o,o}async deployPoints(e){await this.ensureInitialized();const{progressCallback:t}=e;try{let n;if(t?.({stage:"creating-topic",percentage:20}),e.usePrivateTopic){const t=await(new i.TopicCreateTransaction).setTopicMemo(e.topicMemo||`HCS-20: ${e.name}`).setSubmitKey(this.operatorKey.publicKey).setAdminKey(this.operatorKey.publicKey).execute(this.client),o=await t.getReceipt(this.client);if(o.status!==i.Status.Success||!o.topicId)throw new Zc("Failed to create topic",e.tick);n=o.topicId.toString(),this.logger.info(`Created private topic: ${n}`)}else n=this.publicTopicId;t?.({stage:"submitting-deploy",percentage:50,topicId:n});const o={p:"hcs-20",op:"deploy",name:e.name,tick:this.normalizeTick(e.tick),max:e.maxSupply,lim:e.limitPerMint,metadata:e.metadata,m:e.topicMemo},a=this.validateMessage(o);if(!a.valid)throw new Yc("Invalid deploy message",a.errors);const{transactionId:r}=await this.submitPayload(n,o);t?.({stage:"confirming",percentage:80,topicId:n,deployTxId:r}),await this.waitForMirrorNodeConfirmation(n,r),t?.({stage:"complete",percentage:100,topicId:n,deployTxId:r});return{name:e.name,tick:this.normalizeTick(e.tick),maxSupply:e.maxSupply,limitPerMint:e.limitPerMint,metadata:e.metadata,topicId:n,deployerAccountId:this.operatorId.toString(),currentSupply:"0",deploymentTimestamp:(new Date).toISOString(),isPrivate:e.usePrivateTopic||!1}}catch(n){throw t?.({stage:"complete",percentage:100,error:n instanceof Error?n.message:"Unknown error"}),n}}async mintPoints(e){await this.ensureInitialized();const{progressCallback:t}=e;try{t?.({stage:"validating",percentage:20});const i=this.normalizeTick(e.tick);t?.({stage:"submitting",percentage:50});const n={p:"hcs-20",op:"mint",tick:i,amt:e.amount,to:this.accountToString(e.to),m:e.memo},o=e.topicId||this.publicTopicId,{transactionId:a}=await this.submitPayload(o,n);t?.({stage:"confirming",percentage:80,mintTxId:a}),await this.waitForMirrorNodeConfirmation(o,a),t?.({stage:"complete",percentage:100,mintTxId:a});return{id:a,operation:"mint",tick:i,amount:e.amount,to:this.accountToString(e.to),timestamp:(new Date).toISOString(),sequenceNumber:0,topicId:o,transactionId:a,memo:e.memo}}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async transferPoints(e){await this.ensureInitialized();const{progressCallback:t}=e;try{t?.({stage:"validating-balance",percentage:20});const i=this.normalizeTick(e.tick),n=this.accountToString(e.from),o=this.accountToString(e.to);if(n!==this.operatorId.toString())throw new Jc("For public topics, transaction payer must match sender",e.tick,n,o,e.amount);t?.({stage:"submitting",percentage:50});const a={p:"hcs-20",op:"transfer",tick:i,amt:e.amount,from:n,to:o,m:e.memo},r=e.topicId||this.publicTopicId,{transactionId:s}=await this.submitPayload(r,a);t?.({stage:"confirming",percentage:80,transferTxId:s}),await this.waitForMirrorNodeConfirmation(r,s),t?.({stage:"complete",percentage:100,transferTxId:s});return{id:s,operation:"transfer",tick:i,amount:e.amount,from:n,to:o,timestamp:(new Date).toISOString(),sequenceNumber:0,topicId:r,transactionId:s,memo:e.memo}}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async burnPoints(e){await this.ensureInitialized();const{progressCallback:t}=e;try{t?.({stage:"validating-balance",percentage:20});const i=this.normalizeTick(e.tick),n=this.accountToString(e.from);if(n!==this.operatorId.toString())throw new Xc("For public topics, transaction payer must match burner",e.tick,n,e.amount);t?.({stage:"submitting",percentage:50});const o={p:"hcs-20",op:"burn",tick:i,amt:e.amount,from:n,m:e.memo},a=e.topicId||this.publicTopicId,{transactionId:r}=await this.submitPayload(a,o);t?.({stage:"confirming",percentage:80,burnTxId:r}),await this.waitForMirrorNodeConfirmation(a,r),t?.({stage:"complete",percentage:100,burnTxId:r});return{id:r,operation:"burn",tick:i,amount:e.amount,from:n,timestamp:(new Date).toISOString(),sequenceNumber:0,topicId:a,transactionId:r,memo:e.memo}}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async registerTopic(e){await this.ensureInitialized();const{progressCallback:t}=e;try{t?.({stage:"validating",percentage:20});const i={p:"hcs-20",op:"register",name:e.name,metadata:e.metadata,private:e.isPrivate,t_id:this.topicToString(e.topicId),m:e.memo},n=this.validateMessage(i);if(!n.valid)throw new Yc("Invalid register message",n.errors);t?.({stage:"submitting",percentage:50});const{transactionId:o}=await this.submitPayload(this.registryTopicId,i);t?.({stage:"confirming",percentage:80,registerTxId:o}),await this.waitForMirrorNodeConfirmation(this.registryTopicId,o),t?.({stage:"complete",percentage:100,registerTxId:o}),this.logger.info(`Registered topic ${e.topicId} in registry`)}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async waitForMirrorNodeConfirmation(e,t,i=10){for(let o=0;o<i;o++){try{const i=await this.mirrorNode.getTopicMessages(e,{limit:10,order:"desc"});if(i.some((e=>e.consensus_timestamp)))return void this.logger.debug(`Transaction ${t} confirmed on mirror node`)}catch(n){this.logger.debug(`Mirror node check attempt ${o+1} failed:`,n)}await Sc(2e3)}this.logger.warn(`Transaction ${t} not found on mirror node after ${i} attempts`)}},exports.HCS20DeployMessageSchema=zc,exports.HCS20Error=Gc,exports.HCS20MessageSchema=Vc,exports.HCS20MintMessageSchema=qc,exports.HCS20PointsIndexer=class{constructor(e,t,i){this.isProcessing=!1,this.lastIndexedSequence=new Map,this.logger=t||new d({level:"info",module:"HCS20PointsIndexer"}),this.mirrorNode=new Hs(e,this.logger,{customUrl:i}),this.state=this.initializeState()}initializeState(){return{deployedPoints:new Map,balances:new Map,transactions:[],lastProcessedSequence:0,lastProcessedTimestamp:(new Date).toISOString()}}getState(){return{...this.state,deployedPoints:new Map(this.state.deployedPoints),balances:new Map(this.state.balances),transactions:[...this.state.transactions]}}getPointsInfo(e){return this.state.deployedPoints.get(this.normalizeTick(e))}getBalance(e,t){const i=this.normalizeTick(e),n=this.state.balances.get(i);if(!n)return"0";const o=n.get(t);return o?.balance||"0"}async startIndexing(e){if(this.isProcessing)return void this.logger.warn("Indexing already in progress");this.isProcessing=!0;const t=e?.publicTopicId||Lc.PUBLIC_TOPIC_ID,i=e?.registryTopicId||Lc.REGISTRY_TOPIC_ID,n=e?.pollInterval||3e4;await this.indexTopics(t,i,e?.privateTopics);const o=async()=>{if(this.isProcessing){try{await this.indexTopics(t,i,e?.privateTopics)}catch(a){this.logger.error("Polling error:",a)}this.isProcessing&&setTimeout(o,n)}};setTimeout(o,n)}async indexOnce(e){const t=e?.publicTopicId||Lc.PUBLIC_TOPIC_ID,i=e?.registryTopicId||Lc.REGISTRY_TOPIC_ID;await this.indexTopics(t,i,e?.privateTopics)}stopIndexing(){this.isProcessing=!1,this.logger.info("Indexing stopped")}async indexTopics(e,t,i){this.logger.debug("Starting indexing cycle"),await this.indexTopic(e,!1);const n=[...await this.getRegisteredTopics(t),...i||[]];for(const o of n)await this.indexTopic(o,!0);this.logger.debug("Indexing cycle complete")}async getRegisteredTopics(e){const t=[];try{const n=await this.mirrorNode.getTopicMessages(e,{limit:100,order:"asc"});for(const e of n)try{const i=e.data||e;i&&"object"==typeof i&&"hcs-20"===i.p&&"register"===i.op&&i.t_id&&t.push(i.t_id)}catch(i){continue}}catch(i){this.logger.error("Failed to fetch registry messages:",i)}return t}async indexTopic(e,t){try{const n=this.lastIndexedSequence.get(e);this.logger.debug(`Indexing topic ${e}, starting from sequence ${n||0}`);const o=await this.mirrorNode.getTopicMessages(e,{sequenceNumber:n?n+1:void 0,limit:1e3,order:"asc"});this.logger.debug(`Fetched ${o.length} messages from topic ${e}`);let a=n||0;for(const r of o)try{const i=r;if(!i.p||"hcs-20"!==i.p)continue;const n=i,o=i.sequence_number||0;this.logger.debug(`Found HCS-20 message: op=${n.op}, sequence=${o}`),o>a&&(a=o);const s={consensus_timestamp:i.consensus_timestamp||"",sequence_number:o,payer_account_id:i.payer_account_id||"",transaction_id:i.transaction_id||""};this.processMessage(n,s,e,t),this.state.lastProcessedSequence++,this.state.lastProcessedTimestamp=i.consensus_timestamp||""}catch(i){this.logger.debug(`Failed to process message: ${i}`);continue}a>(n||0)&&this.lastIndexedSequence.set(e,a)}catch(i){this.logger.error(`Failed to index topic ${e}:`,i)}}processMessage(e,t,i,n){switch(e.op){case"deploy":this.processDeployMessage(e,t,i,n);break;case"mint":this.processMintMessage(e,t,i,n);break;case"transfer":this.processTransferMessage(e,t,i,n);break;case"burn":this.processBurnMessage(e,t,i,n)}}processDeployMessage(e,t,i,n){const o=this.normalizeTick(e.tick);if(this.state.deployedPoints.has(o))return;const a={name:e.name,tick:o,maxSupply:e.max,limitPerMint:e.lim,metadata:e.metadata,topicId:i,deployerAccountId:t.payer_account_id,currentSupply:"0",deploymentTimestamp:t.consensus_timestamp,isPrivate:n};this.state.deployedPoints.set(o,a),this.logger.info(`Deployed points: ${o}`)}processMintMessage(e,t,i,n){const o=this.normalizeTick(e.tick),a=this.state.deployedPoints.get(o);if(!a)return;const r=BigInt(e.amt),s=BigInt(a.currentSupply);if(s+r>BigInt(a.maxSupply))return;if(a.limitPerMint&&r>BigInt(a.limitPerMint))return;a.currentSupply=(s+r).toString();let c=this.state.balances.get(o);c||(c=new Map,this.state.balances.set(o,c));const p=c.get(e.to),l=p?(BigInt(p.balance)+r).toString():e.amt;c.set(e.to,{tick:o,accountId:e.to,balance:l,lastUpdated:t.consensus_timestamp}),this.state.transactions.push({id:t.transaction_id||`${i}-${t.sequence_number}`,operation:"mint",tick:o,amount:e.amt,to:e.to,timestamp:t.consensus_timestamp,sequenceNumber:t.sequence_number,topicId:i,transactionId:t.transaction_id||"",memo:e.m})}processTransferMessage(e,t,i,n){const o=this.normalizeTick(e.tick),a=this.state.balances.get(o);if(!a)return;if(!n&&t.payer_account_id!==e.from)return;const r=a.get(e.from);if(!r||BigInt(r.balance)<BigInt(e.amt))return;const s=BigInt(e.amt);r.balance=(BigInt(r.balance)-s).toString(),r.lastUpdated=t.consensus_timestamp;const c=a.get(e.to);c?(c.balance=(BigInt(c.balance)+s).toString(),c.lastUpdated=t.consensus_timestamp):a.set(e.to,{tick:o,accountId:e.to,balance:e.amt,lastUpdated:t.consensus_timestamp}),this.state.transactions.push({id:t.transaction_id||`${i}-${t.sequence_number}`,operation:"transfer",tick:o,amount:e.amt,from:e.from,to:e.to,timestamp:t.consensus_timestamp,sequenceNumber:t.sequence_number,topicId:i,transactionId:t.transaction_id||"",memo:e.m})}processBurnMessage(e,t,i,n){const o=this.normalizeTick(e.tick),a=this.state.deployedPoints.get(o),r=this.state.balances.get(o);if(!a||!r)return;if(!n&&t.payer_account_id!==e.from)return;const s=r.get(e.from);if(!s||BigInt(s.balance)<BigInt(e.amt))return;const c=BigInt(e.amt);s.balance=(BigInt(s.balance)-c).toString(),s.lastUpdated=t.consensus_timestamp,a.currentSupply=(BigInt(a.currentSupply)-c).toString(),this.state.transactions.push({id:t.transaction_id||`${i}-${t.sequence_number}`,operation:"burn",tick:o,amount:e.amt,from:e.from,timestamp:t.consensus_timestamp,sequenceNumber:t.sequence_number,topicId:i,transactionId:t.transaction_id||"",memo:e.m})}normalizeTick(e){return e.toLowerCase().trim()}},exports.HCS20RegisterMessageSchema=Hc,exports.HCS20TransferMessageSchema=Wc,exports.HCS20_CONSTANTS=Lc,exports.HRLResolver=Gs,exports.Hcs10MemoType=Ec,exports.HederaMirrorNode=Hs,exports.InboundTopicType=pc,exports.InsufficientBalanceError=class extends Gc{constructor(e,t,i,n){super(`Insufficient balance for ${t}: required ${i}, available ${n}`),this.accountId=e,this.tick=t,this.required=i,this.available=n,this.name="InsufficientBalanceError"}},exports.InvalidAccountFormatError=ep,exports.InvalidMessageFormatError=class extends Gc{constructor(e,t){super(e),this.messageData=t,this.name="InvalidMessageFormatError"}},exports.InvalidNumberFormatError=class extends Gc{constructor(e,t){super(`Invalid number format for ${t}: ${e}`),this.value=e,this.field=t,this.name="InvalidNumberFormatError"}},exports.InvalidTickFormatError=class extends Gc{constructor(e){super(`Invalid tick format: ${e}`),this.tick=e,this.name="InvalidTickFormatError"}},exports.Logger=d,exports.MCPServerBuilder=class{constructor(){this.config={mcpServer:{}},this.socials=[],this.logger=d.getInstance({module:"MCPServerBuilder"})}setName(e){return this.config.name=e,this}setAlias(e){return this.config.alias=e,this}setBio(e){return this.config.bio=e,this}setDescription(e){return this.setBio(e)}setVersion(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.version=e,this}setConnectionInfo(e,t){this.config.mcpServer||(this.config.mcpServer={});const i={url:e,transport:t};return this.config.mcpServer.connectionInfo=i,this}setServerDescription(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.description=e,this}setServices(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.services=e,this}setHostRequirements(e){this.config.mcpServer||(this.config.mcpServer={});const t={minVersion:e};return this.config.mcpServer.host=t,this}setCapabilities(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.capabilities=e,this}addResource(e,t){this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.resources||(this.config.mcpServer.resources=[]);const i={name:e,description:t};return this.config.mcpServer.resources.push(i),this}setResources(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.resources=e,this}addTool(e,t){this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.tools||(this.config.mcpServer.tools=[]);const i={name:e,description:t};return this.config.mcpServer.tools.push(i),this}setTools(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.tools=e,this}setMaintainer(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.maintainer=e,this}setRepository(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.repository=e,this}setDocs(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.docs=e,this}setVerification(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.verification=e,this}addVerificationDNS(e,t){this.config.mcpServer||(this.config.mcpServer={});const i={type:cc.DNS,value:e,dns_field:t};return this.config.mcpServer.verification=i,this}addVerificationSignature(e){this.config.mcpServer||(this.config.mcpServer={});const t={type:cc.SIGNATURE,value:e};return this.config.mcpServer.verification=t,this}addVerificationChallenge(e){this.config.mcpServer||(this.config.mcpServer={});const t={type:cc.CHALLENGE,value:"",challenge_path:e};return this.config.mcpServer.verification=t,this}addSocial(e,t){const i=this.socials.find((t=>t.platform===e));if(i)i.handle=t;else{const i={platform:e,handle:t};this.socials.push(i)}return this}setSocials(e){return this.socials=e,this}setProfilePicture(e,t){return this.config.pfpBuffer=e,this.config.pfpFileName=t,this}setExistingProfilePicture(e){return this.config.existingPfpTopicId=e,this}setNetworkType(e){return this.config.network=e,this}setExistingAccount(e,t){return this.config.existingAccount={accountId:e,privateKey:t},this}build(){if(!this.config.name)throw new Error("MCP server name is required");if(!this.config.network)throw new Error("Network type is required");if(!this.config.mcpServer)throw new Error("MCP server details are required");if(!this.config.mcpServer.version)throw new Error("MCP server version is required");if(!this.config.mcpServer.connectionInfo)throw new Error("MCP server connection info is required");if(!this.config.mcpServer.services||0===this.config.mcpServer.services.length)throw new Error("At least one MCP service type is required");if(!this.config.mcpServer.description)throw new Error("MCP server description is required");return this.config.bio||this.logger.warn("No bio provided for MCP server profile"),this.config.pfpBuffer||this.config.existingPfpTopicId||this.logger.warn("No profile picture provided or referenced"),this.socials.length>0?{...this.config,socials:this.socials}:this.config}},exports.MCPServerCapability=sc,exports.MintLimitExceededError=class extends Gc{constructor(e,t,i){super(`Mint limit exceeded for ${e}: requested ${t}, limit ${i}`),this.tick=e,this.requested=t,this.limit=i,this.name="MintLimitExceededError"}},exports.PayloadSizeError=Rc,exports.PersonBuilder=class{constructor(){this.config={version:"1.0",type:0},this.logger=d.getInstance({module:"PersonBuilder"})}setName(e){return this.config.display_name=e,this}setAlias(e){return this.config.alias=e,this}setBio(e){return this.config.bio=e,this}setDescription(e){return this.setBio(e)}addSocial(e,t){this.config.socials||(this.config.socials=[]);const i=this.config.socials.find((t=>t.platform===e));return i?i.handle=t:this.config.socials.push({platform:e,handle:t}),this}setProfileImage(e){return this.config.profileImage=e,this}setProfilePicture(e,t){return this.config.pfpBuffer=e,this.config.pfpFileName=t,this}setExistingProfilePicture(e){return this.config.profileImage=`hcs://1/${e}`,this}addProperty(e,t){return this.config.properties||(this.config.properties={}),this.config.properties[e]=t,this}setInboundTopicId(e){return this.config.inboundTopicId=e,this}setOutboundTopicId(e){return this.config.outboundTopicId=e,this}getProfilePicture(){return{pfpBuffer:this.config.pfpBuffer,pfpFileName:this.config.pfpFileName}}build(){if(!this.config.display_name)throw new Error("Display name is required for the profile");return this.config.bio||this.logger.warn("No bio provided for person profile"),this.config.pfpBuffer||this.config.profileImage||this.logger.warn("No profile picture provided or referenced"),{version:this.config.version,type:0,display_name:this.config.display_name,alias:this.config.alias,bio:this.config.bio,socials:this.config.socials,profileImage:this.config.profileImage,properties:this.config.properties,inboundTopicId:this.config.inboundTopicId,outboundTopicId:this.config.outboundTopicId,pfpBuffer:this.config.pfpBuffer,pfpFileName:this.config.pfpFileName}}},exports.PointsBurnError=Xc,exports.PointsDeploymentError=Zc,exports.PointsMintError=class extends Gc{constructor(e,t,i,n){super(e),this.tick=t,this.requestedAmount=i,this.availableSupply=n,this.name="PointsMintError"}},exports.PointsNotFoundError=class extends Gc{constructor(e){super(`Points with tick "${e}" not found`),this.tick=e,this.name="PointsNotFoundError"}},exports.PointsTransferError=Jc,exports.PointsValidationError=Yc,exports.ProfileType=nc,exports.ProgressReporter=Ds,exports.Registration=Ac,exports.SUPPORTED_SOCIAL_PLATFORMS=["twitter","github","discord","telegram","linkedin","youtube","website","x"],exports.SupplyLimitExceededError=class extends Gc{constructor(e,t,i,n){super(`Supply limit exceeded for ${e}: max ${i}, current ${n}, requested ${t}`),this.tick=e,this.requested=t,this.maxSupply=i,this.currentSupply=n,this.name="SupplyLimitExceededError"}},exports.TopicCreationError=Pc,exports.TopicRegistrationError=Qc,exports.TransactionParser=class{static parseTransactionBody(e){try{const t=n.ethers.decodeBase64(e),a=o.proto.SchedulableTransactionBody.decode(t),r=this.getTransactionType(a),s={type:r,humanReadableType:this.getHumanReadableType(r),transfers:[],tokenTransfers:[],raw:a};if(a.memo&&(s.memo=a.memo),a.transactionFee){const e=i.Hbar.fromTinybars(i.Long.fromValue(a.transactionFee));s.transactionFee=e.toString(i.HbarUnit.Hbar)}return a.cryptoTransfer&&Qs.parseCryptoTransfers(a.cryptoTransfer,s),a.cryptoDelete&&(s.cryptoDelete=Qs.parseCryptoDelete(a.cryptoDelete)),a.cryptoCreateAccount&&(s.cryptoCreateAccount=Qs.parseCryptoCreateAccount(a.cryptoCreateAccount)),a.cryptoUpdateAccount&&(s.cryptoUpdateAccount=Qs.parseCryptoUpdateAccount(a.cryptoUpdateAccount)),a.cryptoApproveAllowance&&(s.cryptoApproveAllowance=Qs.parseCryptoApproveAllowance(a.cryptoApproveAllowance)),a.cryptoDeleteAllowance&&(s.cryptoDeleteAllowance=Qs.parseCryptoDeleteAllowance(a.cryptoDeleteAllowance)),a.contractCall&&(s.contractCall=ec.parseContractCall(a.contractCall)),a.contractCreateInstance&&(s.contractCreate=ec.parseContractCreate(a.contractCreateInstance)),a.contractUpdateInstance&&(s.contractUpdate=ec.parseContractUpdate(a.contractUpdateInstance)),a.contractDeleteInstance&&(s.contractDelete=ec.parseContractDelete(a.contractDeleteInstance)),a.tokenCreation&&(s.tokenCreation=Js.parseTokenCreate(a.tokenCreation)),a.tokenMint&&(s.tokenMint=Js.parseTokenMint(a.tokenMint)),a.tokenBurn&&(s.tokenBurn=Js.parseTokenBurn(a.tokenBurn)),a.tokenUpdate&&(s.tokenUpdate=Js.parseTokenUpdate(a.tokenUpdate)),a.tokenFeeScheduleUpdate&&(s.tokenFeeScheduleUpdate=Js.parseTokenFeeScheduleUpdate(a.tokenFeeScheduleUpdate)),a.tokenFreeze&&(s.tokenFreeze=Js.parseTokenFreeze(a.tokenFreeze)),a.tokenUnfreeze&&(s.tokenUnfreeze=Js.parseTokenUnfreeze(a.tokenUnfreeze)),a.tokenGrantKyc&&(s.tokenGrantKyc=Js.parseTokenGrantKyc(a.tokenGrantKyc)),a.tokenRevokeKyc&&(s.tokenRevokeKyc=Js.parseTokenRevokeKyc(a.tokenRevokeKyc)),a.tokenPause&&(s.tokenPause=Js.parseTokenPause(a.tokenPause)),a.tokenUnpause&&(s.tokenUnpause=Js.parseTokenUnpause(a.tokenUnpause)),a.tokenWipe&&(s.tokenWipeAccount=Js.parseTokenWipeAccount(a.tokenWipe)),a.tokenDeletion&&(s.tokenDelete=Js.parseTokenDelete(a.tokenDeletion)),a.tokenAssociate&&(s.tokenAssociate=Js.parseTokenAssociate(a.tokenAssociate)),a.tokenDissociate&&(s.tokenDissociate=Js.parseTokenDissociate(a.tokenDissociate)),a.consensusCreateTopic&&(s.consensusCreateTopic=Xs.parseConsensusCreateTopic(a.consensusCreateTopic)),a.consensusSubmitMessage&&(s.consensusSubmitMessage=Xs.parseConsensusSubmitMessage(a.consensusSubmitMessage)),a.consensusUpdateTopic&&(s.consensusUpdateTopic=Xs.parseConsensusUpdateTopic(a.consensusUpdateTopic)),a.consensusDeleteTopic&&(s.consensusDeleteTopic=Xs.parseConsensusDeleteTopic(a.consensusDeleteTopic)),a.fileCreate&&(s.fileCreate=Ys.parseFileCreate(a.fileCreate)),a.fileAppend&&(s.fileAppend=Ys.parseFileAppend(a.fileAppend)),a.fileUpdate&&(s.fileUpdate=Ys.parseFileUpdate(a.fileUpdate)),a.fileDelete&&(s.fileDelete=Ys.parseFileDelete(a.fileDelete)),a.utilPrng&&(s.utilPrng=tc.parseUtilPrng(a.utilPrng)),s}catch(t){throw new Error(`Failed to parse transaction body: ${t instanceof Error?t.message:String(t)}`)}}static parseScheduleResponse(e){if(!e.transaction_body)throw new Error("Schedule response missing transaction_body");const t=this.parseTransactionBody(e.transaction_body);return e.memo&&(t.memo=e.memo),t}static getTransactionType(e){let t="unknown";return e.cryptoTransfer?t="cryptoTransfer":e.cryptoCreateAccount?t="cryptoCreateAccount":e.cryptoUpdateAccount?t="cryptoUpdateAccount":e.cryptoApproveAllowance?t="cryptoApproveAllowance":e.cryptoDeleteAllowance?t="cryptoDeleteAllowance":e.cryptoDelete?t="cryptoDelete":e.consensusCreateTopic?t="consensusCreateTopic":e.consensusUpdateTopic?t="consensusUpdateTopic":e.consensusSubmitMessage?t="consensusSubmitMessage":e.consensusDeleteTopic?t="consensusDeleteTopic":e.fileCreate?t="fileCreate":e.fileAppend?t="fileAppend":e.fileUpdate?t="fileUpdate":e.fileDelete?t="fileDelete":e.contractCall?t="contractCall":e.contractCreateInstance?t="contractCreate":e.contractUpdateInstance?t="contractUpdate":e.contractDeleteInstance?t="contractDelete":e.tokenCreation?t="tokenCreate":e.tokenUpdate?t="tokenUpdate":e.tokenDeletion?t="tokenDelete":e.tokenAssociate?t="tokenAssociate":e.tokenDissociate?t="tokenDissociate":e.tokenMint?t="tokenMint":e.tokenBurn?t="tokenBurn":e.tokenFeeScheduleUpdate?t="tokenFeeScheduleUpdate":e.tokenFreeze?t="tokenFreeze":e.tokenUnfreeze?t="tokenUnfreeze":e.tokenGrantKyc?t="tokenGrantKyc":e.tokenRevokeKyc?t="tokenRevokeKyc":e.tokenPause?t="tokenPause":e.tokenUnpause?t="tokenUnpause":e.tokenWipe?t="tokenWipe":e.utilPrng&&(t="utilPrng"),t}static getHumanReadableType(e){const t={cryptoTransfer:"HBAR Transfer",cryptoCreateAccount:"Create Account",cryptoUpdateAccount:"Update Account",cryptoDeleteAccount:"Delete Account",cryptoApproveAllowance:"Approve Allowance",cryptoDeleteAllowance:"Delete Allowance",cryptoDelete:"Delete Account",consensusCreateTopic:"Create Topic",consensusUpdateTopic:"Update Topic",consensusSubmitMessage:"Submit Message",consensusDeleteTopic:"Delete Topic",fileCreate:"Create File",fileAppend:"Append File",fileUpdate:"Update File",fileDelete:"Delete File",contractCall:"Contract Call",contractCreate:"Create Contract",contractUpdate:"Update Contract",contractDelete:"Delete Contract",ethereumTransaction:"Ethereum Transaction",tokenCreate:"Create Token",tokenUpdate:"Update Token",tokenDelete:"Delete Token",tokenAssociate:"Associate Token",tokenDissociate:"Dissociate Token",tokenMint:"Mint Token",tokenBurn:"Burn Token",tokenFeeScheduleUpdate:"Update Token Fee Schedule",tokenFreeze:"Freeze Token",tokenUnfreeze:"Unfreeze Token",tokenGrantKyc:"Grant KYC",tokenRevokeKyc:"Revoke KYC",tokenPause:"Pause Token",tokenUnpause:"Unpause Token",tokenWipe:"Wipe Token",scheduleCreate:"Create Schedule",scheduleSign:"Sign Schedule",utilPrng:"Generate Random Number",unknown:"Unknown Transaction"};let i;return i=t[e]?t[e]:"Unknown Transaction",i}static getTransactionSummary(e){if("cryptoTransfer"===e.type){const t=[],i=[];for(const n of e.transfers){const e=parseFloat(n.amount);let o=n.amount;o.startsWith("-")&&(o=o.substring(1)),o=o.replace(/\s*ℏ$/,""),e<0?t.push(`${n.accountId} (${o} ℏ)`):e>0&&i.push(`${n.accountId} (${o} ℏ)`)}return t.length>0&&i.length>0?`Transfer of HBAR from ${t.join(", ")} to ${i.join(", ")}`:e.humanReadableType}if(e.contractCall){let t=`Contract call to ${e.contractCall.contractId} with ${e.contractCall.gas} gas`;return e.contractCall.amount>0&&(t+=` and ${e.contractCall.amount} HBAR`),e.contractCall.functionName&&(t+=` calling function ${e.contractCall.functionName}`),t}if(e.tokenMint)return`Mint ${e.tokenMint.amount} tokens for token ${e.tokenMint.tokenId}`;if(e.tokenBurn)return`Burn ${e.tokenBurn.amount} tokens for token ${e.tokenBurn.tokenId}`;if(e.tokenCreation){let t=`Create token ${e.tokenCreation.tokenName||"(No Name)"} (${e.tokenCreation.tokenSymbol||"(No Symbol)"})`;return e.tokenCreation.initialSupply&&(t+=` with initial supply ${e.tokenCreation.initialSupply}`),e.tokenCreation.customFees?.length&&(t+=` including ${e.tokenCreation.customFees.length} custom fee(s)`),t}if(e.tokenTransfers.length>0){const t={};for(const n of e.tokenTransfers)t[n.tokenId]||(t[n.tokenId]=[]),t[n.tokenId].push(n);const i=[];for(const[e,n]of Object.entries(t)){const t=[],o=[];for(const e of n){const i=parseFloat(e.amount.toString());i<0?t.push(`${e.accountId} (${Math.abs(i)})`):i>0&&o.push(`${e.accountId} (${i})`)}t.length>0&&o.length>0&&i.push(`Transfer of token ${e} from ${t.join(", ")} to ${o.join(", ")}`)}return i.length>0?i.join("; "):e.humanReadableType}if(e.consensusCreateTopic){let t="Create new topic";return e.consensusCreateTopic.memo&&(t+=` with memo "${e.consensusCreateTopic.memo}"`),e.consensusCreateTopic.autoRenewAccountId&&(t+=`, auto-renew by ${e.consensusCreateTopic.autoRenewAccountId}`),t}if(e.consensusSubmitMessage){let t="Submit message";if(e.consensusSubmitMessage.topicId&&(t+=` to topic ${e.consensusSubmitMessage.topicId}`),e.consensusSubmitMessage.message)if("utf8"===e.consensusSubmitMessage.messageEncoding){t+=`: "${e.consensusSubmitMessage.message.substring(0,70)}${e.consensusSubmitMessage.message.length>70?"...":""}"`}else t+=` (binary message data, length: ${r.Buffer.from(e.consensusSubmitMessage.message,"base64").length} bytes)`;return e.consensusSubmitMessage.chunkInfoNumber&&e.consensusSubmitMessage.chunkInfoTotal&&(t+=` (chunk ${e.consensusSubmitMessage.chunkInfoNumber}/${e.consensusSubmitMessage.chunkInfoTotal})`),t}if(e.fileCreate){let t="Create File";return e.fileCreate.memo&&(t+=` with memo "${e.fileCreate.memo}"`),e.fileCreate.contents&&(t+=" (includes content)"),t}if(e.fileAppend)return`Append to File ${e.fileAppend.fileId||"(Unknown ID)"}`;if(e.fileUpdate)return`Update File ${e.fileUpdate.fileId||"(Unknown ID)"}`;if(e.fileDelete)return`Delete File ${e.fileDelete.fileId||"(Unknown ID)"}`;if(e.consensusUpdateTopic)return`Update Topic ${e.consensusUpdateTopic.topicId||"(Unknown ID)"}`;if(e.consensusDeleteTopic)return`Delete Topic ${e.consensusDeleteTopic.topicId||"(Unknown ID)"}`;if(e.tokenUpdate)return`Update Token ${e.tokenUpdate.tokenId||"(Unknown ID)"}`;if(e.tokenFeeScheduleUpdate)return`Update Fee Schedule for Token ${e.tokenFeeScheduleUpdate.tokenId||"(Unknown ID)"}`;if(e.utilPrng){let t="Generate Random Number";return e.utilPrng.range&&e.utilPrng.range>0&&(t+=` (range up to ${e.utilPrng.range-1})`),t}if(e.tokenFreeze)return`Freeze Token ${e.tokenFreeze.tokenId} for Account ${e.tokenFreeze.accountId}`;if(e.tokenUnfreeze)return`Unfreeze Token ${e.tokenUnfreeze.tokenId} for Account ${e.tokenUnfreeze.accountId}`;if(e.tokenGrantKyc)return`Grant KYC for Token ${e.tokenGrantKyc.tokenId} to Account ${e.tokenGrantKyc.accountId}`;if(e.tokenRevokeKyc)return`Revoke KYC for Token ${e.tokenRevokeKyc.tokenId} from Account ${e.tokenRevokeKyc.accountId}`;if(e.tokenPause)return`Pause Token ${e.tokenPause.tokenId}`;if(e.tokenUnpause)return`Unpause Token ${e.tokenUnpause.tokenId}`;if(e.tokenWipeAccount){let t=`Wipe Token ${e.tokenWipeAccount.tokenId} from Account ${e.tokenWipeAccount.accountId}`;return e.tokenWipeAccount.serialNumbers?.length&&(t+=` (Serials: ${e.tokenWipeAccount.serialNumbers.join(", ")})`),e.tokenWipeAccount.amount&&(t+=` (Amount: ${e.tokenWipeAccount.amount})`),t}if(e.tokenDelete)return`Delete Token ${e.tokenDelete.tokenId}`;if(e.tokenAssociate)return`Associate Account ${e.tokenAssociate.accountId} with Tokens: ${e.tokenAssociate.tokenIds?.join(", ")}`;if(e.tokenDissociate)return`Dissociate Account ${e.tokenDissociate.accountId} from Tokens: ${e.tokenDissociate.tokenIds?.join(", ")}`;if(e.cryptoDelete)return`Delete Account ${e.cryptoDelete.deleteAccountId}`;if(e.cryptoCreateAccount){let t="Create Account";return e.cryptoCreateAccount.initialBalance&&"0"!==e.cryptoCreateAccount.initialBalance&&(t+=` with balance ${e.cryptoCreateAccount.initialBalance}`),e.cryptoCreateAccount.alias&&(t+=` (Alias: ${e.cryptoCreateAccount.alias})`),t}if(e.cryptoUpdateAccount)return`Update Account ${e.cryptoUpdateAccount.accountIdToUpdate||"(Unknown ID)"}`;if(e.cryptoApproveAllowance){return`Approve ${(e.cryptoApproveAllowance.hbarAllowances?.length||0)+(e.cryptoApproveAllowance.tokenAllowances?.length||0)+(e.cryptoApproveAllowance.nftAllowances?.length||0)} Crypto Allowance(s)`}if(e.cryptoDeleteAllowance)return`Delete ${e.cryptoDeleteAllowance.nftAllowancesToRemove?.length||0} NFT Crypto Allowance(s)`;if(e.contractCreate){let t="Create Contract";return e.contractCreate.memo&&(t+=` (Memo: ${e.contractCreate.memo})`),t}if(e.contractUpdate)return`Update Contract ${e.contractUpdate.contractIdToUpdate||"(Unknown ID)"}`;if(e.contractDelete){let t=`Delete Contract ${e.contractDelete.contractIdToDelete||"(Unknown ID)"}`;return e.contractDelete.transferAccountId?t+=` (Transfer to Account: ${e.contractDelete.transferAccountId})`:e.contractDelete.transferContractId&&(t+=` (Transfer to Contract: ${e.contractDelete.transferContractId})`),t}if(e.humanReadableType&&"Unknown Transaction"!==e.humanReadableType)return e.humanReadableType;if(e.tokenTransfers.length>0){const t={};for(const n of e.tokenTransfers)t[n.tokenId]||(t[n.tokenId]=[]),t[n.tokenId].push(n);const i=[];for(const[e,n]of Object.entries(t)){const t=n.filter((e=>e.amount<0)).map((e=>`${e.accountId} (${Math.abs(e.amount)})`)),o=n.filter((e=>e.amount>0)).map((e=>`${e.accountId} (${e.amount})`));t.length>0&&o.length>0?i.push(`Transfer of token ${e} from ${t.join(", ")} to ${o.join(", ")}`):o.length>0?i.push(`Token ${e} received by ${o.join(", ")}`):t.length>0&&i.push(`Token ${e} sent from ${t.join(", ")}`)}if(i.length>0)return i.join("; ")}return"Unknown Transaction"}},exports.VerificationType=cc,exports.WasmBridge=class{constructor(){this.wasm=null,this.WASM_VECTOR_LEN=0,this.cachedUint8Memory=null,this.cachedDataViewMemory=null,this.textEncoder=new TextEncoder,this.textDecoder=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),this.textDecoder.decode(),this.logger=d.getInstance({module:"WasmBridge"})}setLogLevel(e){this.logger.setLogLevel(e)}get wasmInstance(){if(!this.wasm)throw new Error("WASM not initialized");return this.wasm}getUint8Memory(){if(!this.wasm)throw new Error("WASM not initialized");return null!==this.cachedUint8Memory&&0!==this.cachedUint8Memory.byteLength||(this.cachedUint8Memory=new Uint8Array(this.wasm.memory.buffer)),this.cachedUint8Memory}getDataViewMemory(){if(!this.wasm)throw new Error("WASM not initialized");return null!==this.cachedDataViewMemory&&this.cachedDataViewMemory.buffer===this.wasm.memory.buffer||(this.cachedDataViewMemory=new DataView(this.wasm.memory.buffer)),this.cachedDataViewMemory}encodeString(e,t){if(0===e.length)return{read:0,written:0};const i=this.textEncoder.encode(e);return t.set(i),{read:e.length,written:i.length}}passStringToWasm(e,t,i){if(void 0===i){const i=this.textEncoder.encode(e),n=t(i.length,1);return this.getUint8Memory().set(i,n),this.WASM_VECTOR_LEN=i.length,n}let n=this.textEncoder.encode(e).length,o=t(n,1);const a=this.getUint8Memory();let r=0;for(;r<n;r++){const t=e.charCodeAt(r);if(t>127)break;a[o+r]=t}if(r!==n){0!==r&&(e=e.slice(r)),o=i(o,n,n=r+3*this.textEncoder.encode(e).length,1);const t=this.getUint8Memory().subarray(o+r,o+n);r+=this.encodeString(e,t).written}return this.WASM_VECTOR_LEN=r,o}getStringFromWasm(e,t){return e>>>=0,this.textDecoder.decode(this.getUint8Memory().subarray(e,e+t))}createWasmFunction(e){if(!this.wasm)throw new Error("WASM not initialized");return(...t)=>{const i=this.wasm.__wbindgen_add_to_stack_pointer(-16);let n=[0,0];try{const o=[i,...t.map((e=>[this.passStringToWasm(e,this.wasm.__wbindgen_malloc,this.wasm.__wbindgen_realloc),this.WASM_VECTOR_LEN])).flat()];e.apply(this.wasm,o);const a=this.getDataViewMemory().getInt32(i+0,!0),r=this.getDataViewMemory().getInt32(i+4,!0);return n=[a,r],this.getStringFromWasm(a,r)}finally{this.wasm.__wbindgen_add_to_stack_pointer(16),this.wasm.__wbindgen_free(n[0],n[1],1)}}}async initWasm(e){const t=this,i={__wbindgen_placeholder__:{__wbindgen_throw:function(e,i){const n=t.getStringFromWasm(e,i);throw t.logger.error(`WASM error: ${n}`),new Error(n)}}};try{this.logger.debug("Compiling WASM module");const t=await WebAssembly.compile(e);this.logger.debug("Instantiating WASM module");const n=await WebAssembly.instantiate(t,i);return this.wasm=n.exports,this.logger.info("WASM module initialized successfully"),this.wasm}catch(n){throw this.logger.error("Failed to initialize WASM module",n),n}}createStateData(e,t={}){let i={};return e?.c?.inputType?.stateData&&(t.latestRoundData&&Object.keys(e.c.inputType.stateData).every((e=>e in t.latestRoundData))?(i.latestRoundData={},Object.entries(e.c.inputType.stateData).forEach((([e,n])=>{i.latestRoundData[e]=String(t.latestRoundData[e])}))):Object.entries(e.c.inputType.stateData).forEach((([e,n])=>{const o=t[e];o&&"object"==typeof o&&"values"in o&&o.values.length>0?i[e]=String(o.values[0]):i[e]=this.getDefaultValueForType(n)}))),i}getDefaultValueForType(e){return e.startsWith("uint")||e.startsWith("int")||"number"===e?"0":"bool"===e?"false":""}executeWasm(e,t){if(!this.wasm)throw this.logger.error("WASM not initialized"),new Error("WASM not initialized");try{this.logger.debug("Executing WASM with stateData",e);return this.createWasmFunction(this.wasmInstance.process_state)(JSON.stringify(e),JSON.stringify(t))}catch(i){throw this.logger.error("Error executing WASM",i),i}}getParams(){return this.createWasmFunction(this.wasmInstance.get_params)()}},exports.accountIdsToExemptKeys=Vs,exports.capabilityNameToCapabilityMap=lc,exports.detectKeyTypeFromString=ic,exports.global$1=R,exports.inscribe=zs,exports.inscribeWithSigner=qs,exports.mcpServiceNameToCapabilityMap={resource_provider:0,tool_provider:1,prompt_template_provider:2,local_file_access:3,database_integration:4,api_integration:5,web_access:6,knowledge_base:7,memory_persistence:8,code_analysis:9,content_generation:10,communication:11,document_processing:12,calendar_schedule:13,search:14,assistant_orchestration:15},exports.process$1=Li,exports.process$1$1=V,exports.retrieveInscription=async function(e,t){const i=d.getInstance({module:"Inscriber",...t?.logging||{}}),n=e.includes("@")?`${e.split("@")[0]}-${e.split("@")[1].replace(/\./g,"-")}`:e;i.info("Retrieving inscription",{originalTransactionId:e,formattedTransactionId:n});try{let e;if(t?.apiKey)i.debug("Initializing InscriptionSDK with API key"),e=new Ms({apiKey:t.apiKey,network:t.network||"mainnet"});else{if(!t?.accountId||!t?.privateKey){const e=new Error("Either API key or account ID and private key are required for retrieving inscriptions");throw i.error("Missing authentication credentials",{hasApiKey:Boolean(t?.apiKey),hasAccountId:Boolean(t?.accountId),hasPrivateKey:Boolean(t?.privateKey)}),e}i.debug("Initializing InscriptionSDK with server auth"),e=await Ms.createWithAuth({type:"server",accountId:t.accountId,privateKey:t.privateKey,network:t.network||"mainnet"})}i.debug("Initialized SDK for inscription retrieval",{formattedTransactionId:n,network:t.network||"mainnet"});const o=await e.retrieveInscription(n);return i.info("Successfully retrieved inscription",{formattedTransactionId:n}),o}catch(o){throw i.error("Error retrieving inscription",{formattedTransactionId:n,error:o}),o}},exports.sleep=e=>new Promise((t=>setTimeout(t,e))),exports.waitForInscriptionConfirmation=Ws;
32
- //# sourceMappingURL=index-DkjLvi-3.cjs.map
31
+ */().extname,r=/^\s*([^;\s]*)(?:;|\s|$)/,s=/^text\//i;function c(e){if(!e||"string"!=typeof e)return!1;var t=r.exec(e),i=t&&o[t[1].toLowerCase()];return i&&i.charset?i.charset:!(!t||!s.test(t[1]))&&"UTF-8"}e.charset=c,e.charsets={lookup:c},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var i=-1===t.indexOf("/")?e.lookup(t):t;if(!i)return!1;if(-1===i.indexOf("charset")){var n=e.charset(i);n&&(i+="; charset="+n.toLowerCase())}return i},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var i=r.exec(t),n=i&&e.extensions[i[1].toLowerCase()];return!(!n||!n.length)&&n[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var i=a("x."+t).toLowerCase().substr(1);return i&&e.types[i]||!1},e.types=Object.create(null),t=e.extensions,i=e.types,n=["nginx","apache",void 0,"iana"],Object.keys(o).forEach((function(e){var a=o[e],r=a.extensions;if(r&&r.length){t[e]=r;for(var s=0;s<r.length;s++){var c=r[s];if(i[c]){var p=n.indexOf(o[i[c]].source),l=n.indexOf(a.source);if("application/octet-stream"!==i[c]&&(p>l||p===l&&"application/"===i[c].substr(0,12)))continue}i[c]=e}}}))}(ua)),(va=xa||(xa={})).assertEqual=e=>{},va.assertIs=function(e){},va.assertNever=function(e){throw new Error},va.arrayToEnum=e=>{const t={};for(const i of e)t[i]=i;return t},va.getValidEnumValues=e=>{const t=va.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),i={};for(const n of t)i[n]=e[n];return va.objectValues(i)},va.objectValues=e=>va.objectKeys(e).map((function(t){return e[t]})),va.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.push(i);return t},va.find=(e,t)=>{for(const i of e)if(t(i))return i},va.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,va.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},va.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(ya||(ya={})).mergeShapes=(e,t)=>({...e,...t});const wa=xa.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ka=e=>{switch(typeof e){case"undefined":return wa.undefined;case"string":return wa.string;case"number":return Number.isNaN(e)?wa.nan:wa.number;case"boolean":return wa.boolean;case"function":return wa.function;case"bigint":return wa.bigint;case"symbol":return wa.symbol;case"object":return Array.isArray(e)?wa.array:null===e?wa.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?wa.promise:"undefined"!=typeof Map&&e instanceof Map?wa.map:"undefined"!=typeof Set&&e instanceof Set?wa.set:"undefined"!=typeof Date&&e instanceof Date?wa.date:wa.object;default:return wa.unknown}},Ia=xa.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ta extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},i={_errors:[]},n=e=>{for(const o of e.issues)if("invalid_union"===o.code)o.unionErrors.map(n);else if("invalid_return_type"===o.code)n(o.returnTypeError);else if("invalid_arguments"===o.code)n(o.argumentsError);else if(0===o.path.length)i._errors.push(t(o));else{let e=i,n=0;for(;n<o.path.length;){const i=o.path[n];n===o.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(t(o))):e[i]=e[i]||{_errors:[]},e=e[i],n++}}};return n(this),i}static assert(e){if(!(e instanceof Ta))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,xa.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},i=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}}Ta.create=e=>new Ta(e);const Sa=(e,t)=>{let i;switch(e.code){case Ia.invalid_type:i=e.received===wa.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Ia.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(e.expected,xa.jsonStringifyReplacer)}`;break;case Ia.unrecognized_keys:i=`Unrecognized key(s) in object: ${xa.joinValues(e.keys,", ")}`;break;case Ia.invalid_union:i="Invalid input";break;case Ia.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${xa.joinValues(e.options)}`;break;case Ia.invalid_enum_value:i=`Invalid enum value. Expected ${xa.joinValues(e.options)}, received '${e.received}'`;break;case Ia.invalid_arguments:i="Invalid function arguments";break;case Ia.invalid_return_type:i="Invalid function return type";break;case Ia.invalid_date:i="Invalid date";break;case Ia.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(i=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(i=`${i} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?i=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?i=`Invalid input: must end with "${e.validation.endsWith}"`:xa.assertNever(e.validation):i="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Ia.too_small:i="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Ia.too_big:i="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Ia.custom:i="Invalid input";break;case Ia.invalid_intersection_types:i="Intersection results could not be merged";break;case Ia.not_multiple_of:i=`Number must be a multiple of ${e.multipleOf}`;break;case Ia.not_finite:i="Number must be finite";break;default:i=t.defaultError,xa.assertNever(e)}return{message:i}};let Aa=Sa;function Ea(e,t){const i=Aa,n=(e=>{const{data:t,path:i,errorMaps:n,issueData:o}=e,a=[...i,...o.path||[]],r={...o,path:a};if(void 0!==o.message)return{...o,path:a,message:o.message};let s="";const c=n.filter((e=>!!e)).slice().reverse();for(const p of c)s=p(r,{data:t,defaultError:s}).message;return{...o,path:a,message:s}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,i,i===Sa?void 0:Sa].filter((e=>!!e))});e.common.issues.push(n)}class _a{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const i=[];for(const n of t){if("aborted"===n.status)return Ca;"dirty"===n.status&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const i=[];for(const n of t){const e=await n.key,t=await n.value;i.push({key:e,value:t})}return _a.mergeObjectSync(e,i)}static mergeObjectSync(e,t){const i={};for(const n of t){const{key:t,value:o}=n;if("aborted"===t.status)return Ca;if("aborted"===o.status)return Ca;"dirty"===t.status&&e.dirty(),"dirty"===o.status&&e.dirty(),"__proto__"===t.value||void 0===o.value&&!n.alwaysSet||(i[t.value]=o.value)}return{status:e.value,value:i}}}const Ca=Object.freeze({status:"aborted"}),Ra=e=>({status:"dirty",value:e}),Na=e=>({status:"valid",value:e}),Pa=e=>"aborted"===e.status,Oa=e=>"dirty"===e.status,$a=e=>"valid"===e.status,ja=e=>"undefined"!=typeof Promise&&e instanceof Promise;var Fa,La;(La=Fa||(Fa={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},La.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class Ua{constructor(e,t,i,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ba=(e,t)=>{if($a(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ta(e.common.issues);return this._error=t,this._error}}};function Ma(e){if(!e)return{};const{errorMap:t,invalid_type_error:i,required_error:n,description:o}=e;if(t&&(i||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:o};return{errorMap:(t,o)=>{const{message:a}=e;return"invalid_enum_value"===t.code?{message:a??o.defaultError}:void 0===o.data?{message:a??n??o.defaultError}:"invalid_type"!==t.code?{message:o.defaultError}:{message:a??i??o.defaultError}},description:o}}class Da{get description(){return this._def.description}_getType(e){return ka(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ka(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _a,ctx:{common:e.parent.common,data:e.data,parsedType:ka(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ja(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){const i={common:{issues:[],async:(null==t?void 0:t.async)??!1,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ka(e)},n=this._parseSync({data:e,path:i.path,parent:i});return Ba(i,n)}"~validate"(e){var t,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ka(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:n});return $a(t)?{value:t.value}:{issues:n.common.issues}}catch(o){(null==(i=null==(t=null==o?void 0:o.message)?void 0:t.toLowerCase())?void 0:i.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then((e=>$a(e)?{value:e.value}:{issues:n.common.issues}))}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ka(e)},n=this._parse({data:e,path:i.path,parent:i}),o=await(ja(n)?n:Promise.resolve(n));return Ba(i,o)}refine(e,t){const i=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const o=e(t),a=()=>n.addIssue({code:Ia.custom,...i(t)});return"undefined"!=typeof Promise&&o instanceof Promise?o.then((e=>!!e||(a(),!1))):!!o||(a(),!1)}))}refinement(e,t){return this._refinement(((i,n)=>!!e(i)||(n.addIssue("function"==typeof t?t(i,n):t),!1)))}_refinement(e){return new Ur({schema:this,typeName:Vr.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Br.create(this,this._def)}nullable(){return Mr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return kr.create(this)}promise(){return Lr.create(this,this._def)}or(e){return Sr.create([this,e],this._def)}and(e){return Er.create(this,e,this._def)}transform(e){return new Ur({...Ma(this._def),schema:this,typeName:Vr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Dr({...Ma(this._def),innerType:this,defaultValue:t,typeName:Vr.ZodDefault})}brand(){return new Kr({typeName:Vr.ZodBranded,type:this,...Ma(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new zr({...Ma(this._def),innerType:this,catchValue:t,typeName:Vr.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Hr.create(this,e)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const za=/^c[^\s-]{8,}$/i,qa=/^[0-9a-z]+$/,Ka=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ha=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Wa=/^[a-z0-9_-]{21}$/i,Va=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ga=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Za=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Ja;const Xa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ya=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Qa=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,er=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ir=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",or=new RegExp(`^${nr}$`);function ar(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function rr(e){let t=`${nr}T${ar(e)}`;const i=[];return i.push(e.local?"Z?":"Z"),e.offset&&i.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${i.join("|")})`,new RegExp(`^${t}$`)}function sr(e,t){if(!Va.test(e))return!1;try{const[i]=e.split("."),n=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),o=JSON.parse(atob(n));return"object"==typeof o&&null!==o&&((!("typ"in o)||"JWT"===(null==o?void 0:o.typ))&&(!!o.alg&&(!t||o.alg===t)))}catch{return!1}}function cr(e,t){return!("v4"!==t&&t||!Ya.test(e))||!("v6"!==t&&t||!er.test(e))}class pr extends Da{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==wa.string){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.string,received:t.parsedType}),Ca}const t=new _a;let i;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const n=e.data.length>a.value,o=e.data.length<a.value;(n||o)&&(i=this._getOrReturnCtx(e,i),n?Ea(i,{code:Ia.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&Ea(i,{code:Ia.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)Za.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"email",code:Ia.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)Ja||(Ja=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ja.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"emoji",code:Ia.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)Ha.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"uuid",code:Ia.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)Wa.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"nanoid",code:Ia.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)za.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"cuid",code:Ia.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)qa.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"cuid2",code:Ia.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)Ka.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"ulid",code:Ia.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Ea(i,{validation:"url",code:Ia.invalid_string,message:a.message}),t.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"regex",code:Ia.invalid_string,message:a.message}),t.dirty())}else if("trim"===a.kind)e.data=e.data.trim();else if("includes"===a.kind)e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty());else if("toLowerCase"===a.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===a.kind)e.data=e.data.toUpperCase();else if("startsWith"===a.kind)e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty());else if("endsWith"===a.kind)e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty());else if("datetime"===a.kind){rr(a).test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.invalid_string,validation:"datetime",message:a.message}),t.dirty())}else if("date"===a.kind){or.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.invalid_string,validation:"date",message:a.message}),t.dirty())}else if("time"===a.kind){new RegExp(`^${ar(a)}$`).test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.invalid_string,validation:"time",message:a.message}),t.dirty())}else"duration"===a.kind?Ga.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"duration",code:Ia.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?(n=e.data,("v4"!==(o=a.version)&&o||!Xa.test(n))&&("v6"!==o&&o||!Qa.test(n))&&(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"ip",code:Ia.invalid_string,message:a.message}),t.dirty())):"jwt"===a.kind?sr(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"jwt",code:Ia.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?cr(e.data,a.version)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"cidr",code:Ia.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?tr.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"base64",code:Ia.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?ir.test(e.data)||(i=this._getOrReturnCtx(e,i),Ea(i,{validation:"base64url",code:Ia.invalid_string,message:a.message}),t.dirty()):xa.assertNever(a);var n,o;return{status:t.value,value:e.data}}_regex(e,t,i){return this.refinement((t=>e.test(t)),{validation:t,code:Ia.invalid_string,...Fa.errToObj(i)})}_addCheck(e){return new pr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Fa.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Fa.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Fa.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Fa.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Fa.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Fa.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Fa.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Fa.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Fa.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Fa.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Fa.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Fa.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Fa.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:(null==e?void 0:e.offset)??!1,local:(null==e?void 0:e.local)??!1,...Fa.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Fa.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Fa.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Fa.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Fa.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Fa.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Fa.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Fa.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Fa.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Fa.errToObj(t)})}nonempty(e){return this.min(1,Fa.errToObj(e))}trim(){return new pr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new pr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new pr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function lr(e,t){const i=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=i>n?i:n;return Number.parseInt(e.toFixed(o).replace(".",""))%Number.parseInt(t.toFixed(o).replace(".",""))/10**o}pr.create=e=>new pr({checks:[],typeName:Vr.ZodString,coerce:(null==e?void 0:e.coerce)??!1,...Ma(e)});class ur extends Da{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==wa.number){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.number,received:t.parsedType}),Ca}let t;const i=new _a;for(const n of this._def.checks)if("int"===n.kind)xa.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty())}else"multipleOf"===n.kind?0!==lr(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.not_finite,message:n.message}),i.dirty()):xa.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Fa.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Fa.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Fa.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Fa.toString(t))}setLimit(e,t,i,n){return new ur({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:Fa.toString(n)}]})}_addCheck(e){return new ur({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Fa.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Fa.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Fa.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Fa.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Fa.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Fa.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Fa.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Fa.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Fa.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&xa.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if("finite"===i.kind||"int"===i.kind||"multipleOf"===i.kind)return!0;"min"===i.kind?(null===t||i.value>t)&&(t=i.value):"max"===i.kind&&(null===e||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ur.create=e=>new ur({checks:[],typeName:Vr.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Ma(e)});class dr extends Da{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==wa.bigint)return this._getInvalidInput(e);let t;const i=new _a;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ea(t,{code:Ia.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):xa.assertNever(n);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.bigint,received:t.parsedType}),Ca}gte(e,t){return this.setLimit("min",e,!0,Fa.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Fa.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Fa.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Fa.toString(t))}setLimit(e,t,i,n){return new dr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:Fa.toString(n)}]})}_addCheck(e){return new dr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Fa.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Fa.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Fa.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Fa.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Fa.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}dr.create=e=>new dr({checks:[],typeName:Vr.ZodBigInt,coerce:(null==e?void 0:e.coerce)??!1,...Ma(e)});class mr extends Da{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==wa.boolean){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.boolean,received:t.parsedType}),Ca}return Na(e.data)}}mr.create=e=>new mr({typeName:Vr.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Ma(e)});class fr extends Da{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==wa.date){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.date,received:t.parsedType}),Ca}if(Number.isNaN(e.data.getTime())){return Ea(this._getOrReturnCtx(e),{code:Ia.invalid_date}),Ca}const t=new _a;let i;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(i=this._getOrReturnCtx(e,i),Ea(i,{code:Ia.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):xa.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new fr({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Fa.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Fa.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}fr.create=e=>new fr({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Vr.ZodDate,...Ma(e)});class hr extends Da{_parse(e){if(this._getType(e)!==wa.symbol){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.symbol,received:t.parsedType}),Ca}return Na(e.data)}}hr.create=e=>new hr({typeName:Vr.ZodSymbol,...Ma(e)});class gr extends Da{_parse(e){if(this._getType(e)!==wa.undefined){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.undefined,received:t.parsedType}),Ca}return Na(e.data)}}gr.create=e=>new gr({typeName:Vr.ZodUndefined,...Ma(e)});class br extends Da{_parse(e){if(this._getType(e)!==wa.null){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.null,received:t.parsedType}),Ca}return Na(e.data)}}br.create=e=>new br({typeName:Vr.ZodNull,...Ma(e)});class xr extends Da{constructor(){super(...arguments),this._any=!0}_parse(e){return Na(e.data)}}xr.create=e=>new xr({typeName:Vr.ZodAny,...Ma(e)});class vr extends Da{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Na(e.data)}}vr.create=e=>new vr({typeName:Vr.ZodUnknown,...Ma(e)});class yr extends Da{_parse(e){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.never,received:t.parsedType}),Ca}}yr.create=e=>new yr({typeName:Vr.ZodNever,...Ma(e)});class wr extends Da{_parse(e){if(this._getType(e)!==wa.undefined){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.void,received:t.parsedType}),Ca}return Na(e.data)}}wr.create=e=>new wr({typeName:Vr.ZodVoid,...Ma(e)});class kr extends Da{_parse(e){const{ctx:t,status:i}=this._processInputParams(e),n=this._def;if(t.parsedType!==wa.array)return Ea(t,{code:Ia.invalid_type,expected:wa.array,received:t.parsedType}),Ca;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(e||o)&&(Ea(t,{code:e?Ia.too_big:Ia.too_small,minimum:o?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(Ea(t,{code:Ia.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(Ea(t,{code:Ia.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map(((e,i)=>n.type._parseAsync(new Ua(t,e,t.path,i))))).then((e=>_a.mergeArray(i,e)));const o=[...t.data].map(((e,i)=>n.type._parseSync(new Ua(t,e,t.path,i))));return _a.mergeArray(i,o)}get element(){return this._def.type}min(e,t){return new kr({...this._def,minLength:{value:e,message:Fa.toString(t)}})}max(e,t){return new kr({...this._def,maxLength:{value:e,message:Fa.toString(t)}})}length(e,t){return new kr({...this._def,exactLength:{value:e,message:Fa.toString(t)}})}nonempty(e){return this.min(1,e)}}function Ir(e){if(e instanceof Tr){const t={};for(const i in e.shape){const n=e.shape[i];t[i]=Br.create(Ir(n))}return new Tr({...e._def,shape:()=>t})}return e instanceof kr?new kr({...e._def,type:Ir(e.element)}):e instanceof Br?Br.create(Ir(e.unwrap())):e instanceof Mr?Mr.create(Ir(e.unwrap())):e instanceof _r?_r.create(e.items.map((e=>Ir(e)))):e}kr.create=(e,t)=>new kr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Vr.ZodArray,...Ma(t)});class Tr extends Da{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=xa.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==wa.object){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.object,received:t.parsedType}),Ca}const{status:t,ctx:i}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof yr&&"strip"===this._def.unknownKeys))for(const s in i.data)o.includes(s)||a.push(s);const r=[];for(const s of o){const e=n[s],t=i.data[s];r.push({key:{status:"valid",value:s},value:e._parse(new Ua(i,t,i.path,s)),alwaysSet:s in i.data})}if(this._def.catchall instanceof yr){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of a)r.push({key:{status:"valid",value:t},value:{status:"valid",value:i.data[t]}});else if("strict"===e)a.length>0&&(Ea(i,{code:Ia.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const n=i.data[t];r.push({key:{status:"valid",value:t},value:e._parse(new Ua(i,n,i.path,t)),alwaysSet:t in i.data})}}return i.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of r){const i=await t.key,n=await t.value;e.push({key:i,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>_a.mergeObjectSync(t,e))):_a.mergeObjectSync(t,r)}get shape(){return this._def.shape()}strict(e){return Fa.errToObj,new Tr({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,i)=>{var n,o;const a=(null==(o=(n=this._def).errorMap)?void 0:o.call(n,t,i).message)??i.defaultError;return"unrecognized_keys"===t.code?{message:Fa.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Tr({...this._def,unknownKeys:"strip"})}passthrough(){return new Tr({...this._def,unknownKeys:"passthrough"})}extend(e){return new Tr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Tr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Vr.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Tr({...this._def,catchall:e})}pick(e){const t={};for(const i of xa.objectKeys(e))e[i]&&this.shape[i]&&(t[i]=this.shape[i]);return new Tr({...this._def,shape:()=>t})}omit(e){const t={};for(const i of xa.objectKeys(this.shape))e[i]||(t[i]=this.shape[i]);return new Tr({...this._def,shape:()=>t})}deepPartial(){return Ir(this)}partial(e){const t={};for(const i of xa.objectKeys(this.shape)){const n=this.shape[i];e&&!e[i]?t[i]=n:t[i]=n.optional()}return new Tr({...this._def,shape:()=>t})}required(e){const t={};for(const i of xa.objectKeys(this.shape))if(e&&!e[i])t[i]=this.shape[i];else{let e=this.shape[i];for(;e instanceof Br;)e=e._def.innerType;t[i]=e}return new Tr({...this._def,shape:()=>t})}keyof(){return $r(xa.objectKeys(this.shape))}}Tr.create=(e,t)=>new Tr({shape:()=>e,unknownKeys:"strip",catchall:yr.create(),typeName:Vr.ZodObject,...Ma(t)}),Tr.strictCreate=(e,t)=>new Tr({shape:()=>e,unknownKeys:"strict",catchall:yr.create(),typeName:Vr.ZodObject,...Ma(t)}),Tr.lazycreate=(e,t)=>new Tr({shape:e,unknownKeys:"strip",catchall:yr.create(),typeName:Vr.ZodObject,...Ma(t)});class Sr extends Da{_parse(e){const{ctx:t}=this._processInputParams(e),i=this._def.options;if(t.common.async)return Promise.all(i.map((async e=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const i=e.map((e=>new Ta(e.ctx.common.issues)));return Ea(t,{code:Ia.invalid_union,unionErrors:i}),Ca}));{let e;const n=[];for(const a of i){const i={...t,common:{...t.common,issues:[]},parent:null},o=a._parseSync({data:t.data,path:t.path,parent:i});if("valid"===o.status)return o;"dirty"!==o.status||e||(e={result:o,ctx:i}),i.common.issues.length&&n.push(i.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const o=n.map((e=>new Ta(e)));return Ea(t,{code:Ia.invalid_union,unionErrors:o}),Ca}}get options(){return this._def.options}}function Ar(e,t){const i=ka(e),n=ka(t);if(e===t)return{valid:!0,data:e};if(i===wa.object&&n===wa.object){const i=xa.objectKeys(t),n=xa.objectKeys(e).filter((e=>-1!==i.indexOf(e))),o={...e,...t};for(const a of n){const i=Ar(e[a],t[a]);if(!i.valid)return{valid:!1};o[a]=i.data}return{valid:!0,data:o}}if(i===wa.array&&n===wa.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let n=0;n<e.length;n++){const o=Ar(e[n],t[n]);if(!o.valid)return{valid:!1};i.push(o.data)}return{valid:!0,data:i}}return i===wa.date&&n===wa.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}Sr.create=(e,t)=>new Sr({options:e,typeName:Vr.ZodUnion,...Ma(t)});class Er extends Da{_parse(e){const{status:t,ctx:i}=this._processInputParams(e),n=(e,n)=>{if(Pa(e)||Pa(n))return Ca;const o=Ar(e.value,n.value);return o.valid?((Oa(e)||Oa(n))&&t.dirty(),{status:t.value,value:o.data}):(Ea(i,{code:Ia.invalid_intersection_types}),Ca)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}Er.create=(e,t,i)=>new Er({left:e,right:t,typeName:Vr.ZodIntersection,...Ma(i)});class _r extends Da{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==wa.array)return Ea(i,{code:Ia.invalid_type,expected:wa.array,received:i.parsedType}),Ca;if(i.data.length<this._def.items.length)return Ea(i,{code:Ia.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ca;!this._def.rest&&i.data.length>this._def.items.length&&(Ea(i,{code:Ia.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...i.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Ua(i,e,i.path,t)):null})).filter((e=>!!e));return i.common.async?Promise.all(n).then((e=>_a.mergeArray(t,e))):_a.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new _r({...this._def,rest:e})}}_r.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _r({items:e,typeName:Vr.ZodTuple,rest:null,...Ma(t)})};class Cr extends Da{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==wa.object)return Ea(i,{code:Ia.invalid_type,expected:wa.object,received:i.parsedType}),Ca;const n=[],o=this._def.keyType,a=this._def.valueType;for(const r in i.data)n.push({key:o._parse(new Ua(i,r,i.path,r)),value:a._parse(new Ua(i,i.data[r],i.path,r)),alwaysSet:r in i.data});return i.common.async?_a.mergeObjectAsync(t,n):_a.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,i){return new Cr(t instanceof Da?{keyType:e,valueType:t,typeName:Vr.ZodRecord,...Ma(i)}:{keyType:pr.create(),valueType:e,typeName:Vr.ZodRecord,...Ma(t)})}}class Rr extends Da{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==wa.map)return Ea(i,{code:Ia.invalid_type,expected:wa.map,received:i.parsedType}),Ca;const n=this._def.keyType,o=this._def.valueType,a=[...i.data.entries()].map((([e,t],a)=>({key:n._parse(new Ua(i,e,i.path,[a,"key"])),value:o._parse(new Ua(i,t,i.path,[a,"value"]))})));if(i.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const i of a){const n=await i.key,o=await i.value;if("aborted"===n.status||"aborted"===o.status)return Ca;"dirty"!==n.status&&"dirty"!==o.status||t.dirty(),e.set(n.value,o.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const i of a){const n=i.key,o=i.value;if("aborted"===n.status||"aborted"===o.status)return Ca;"dirty"!==n.status&&"dirty"!==o.status||t.dirty(),e.set(n.value,o.value)}return{status:t.value,value:e}}}}Rr.create=(e,t,i)=>new Rr({valueType:t,keyType:e,typeName:Vr.ZodMap,...Ma(i)});class Nr extends Da{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==wa.set)return Ea(i,{code:Ia.invalid_type,expected:wa.set,received:i.parsedType}),Ca;const n=this._def;null!==n.minSize&&i.data.size<n.minSize.value&&(Ea(i,{code:Ia.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&i.data.size>n.maxSize.value&&(Ea(i,{code:Ia.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const o=this._def.valueType;function a(e){const i=new Set;for(const n of e){if("aborted"===n.status)return Ca;"dirty"===n.status&&t.dirty(),i.add(n.value)}return{status:t.value,value:i}}const r=[...i.data.values()].map(((e,t)=>o._parse(new Ua(i,e,i.path,t))));return i.common.async?Promise.all(r).then((e=>a(e))):a(r)}min(e,t){return new Nr({...this._def,minSize:{value:e,message:Fa.toString(t)}})}max(e,t){return new Nr({...this._def,maxSize:{value:e,message:Fa.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Nr.create=(e,t)=>new Nr({valueType:e,minSize:null,maxSize:null,typeName:Vr.ZodSet,...Ma(t)});class Pr extends Da{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Pr.create=(e,t)=>new Pr({getter:e,typeName:Vr.ZodLazy,...Ma(t)});class Or extends Da{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ea(t,{received:t.data,code:Ia.invalid_literal,expected:this._def.value}),Ca}return{status:"valid",value:e.data}}get value(){return this._def.value}}function $r(e,t){return new jr({values:e,typeName:Vr.ZodEnum,...Ma(t)})}Or.create=(e,t)=>new Or({value:e,typeName:Vr.ZodLiteral,...Ma(t)});class jr extends Da{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),i=this._def.values;return Ea(t,{expected:xa.joinValues(i),received:t.parsedType,code:Ia.invalid_type}),Ca}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),i=this._def.values;return Ea(t,{received:t.data,code:Ia.invalid_enum_value,options:i}),Ca}return Na(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return jr.create(e,{...this._def,...t})}exclude(e,t=this._def){return jr.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}jr.create=$r;class Fr extends Da{_parse(e){const t=xa.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==wa.string&&i.parsedType!==wa.number){const e=xa.objectValues(t);return Ea(i,{expected:xa.joinValues(e),received:i.parsedType,code:Ia.invalid_type}),Ca}if(this._cache||(this._cache=new Set(xa.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=xa.objectValues(t);return Ea(i,{received:i.data,code:Ia.invalid_enum_value,options:e}),Ca}return Na(e.data)}get enum(){return this._def.values}}Fr.create=(e,t)=>new Fr({values:e,typeName:Vr.ZodNativeEnum,...Ma(t)});class Lr extends Da{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==wa.promise&&!1===t.common.async)return Ea(t,{code:Ia.invalid_type,expected:wa.promise,received:t.parsedType}),Ca;const i=t.parsedType===wa.promise?t.data:Promise.resolve(t.data);return Na(i.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Lr.create=(e,t)=>new Lr({type:e,typeName:Vr.ZodPromise,...Ma(t)});class Ur extends Da{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Vr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:i}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:e=>{Ea(i,e),e.fatal?t.abort():t.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),"preprocess"===n.type){const e=n.transform(i.data,o);if(i.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return Ca;const n=await this._def.schema._parseAsync({data:e,path:i.path,parent:i});return"aborted"===n.status?Ca:"dirty"===n.status||"dirty"===t.value?Ra(n.value):n}));{if("aborted"===t.value)return Ca;const n=this._def.schema._parseSync({data:e,path:i.path,parent:i});return"aborted"===n.status?Ca:"dirty"===n.status||"dirty"===t.value?Ra(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,o);if(i.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===i.common.async){const n=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===n.status?Ca:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((i=>"aborted"===i.status?Ca:("dirty"===i.status&&t.dirty(),e(i.value).then((()=>({status:t.value,value:i.value}))))))}if("transform"===n.type){if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!$a(e))return Ca;const a=n.transform(e.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>$a(e)?Promise.resolve(n.transform(e.value,o)).then((e=>({status:t.value,value:e}))):Ca))}xa.assertNever(n)}}Ur.create=(e,t,i)=>new Ur({schema:e,typeName:Vr.ZodEffects,effect:t,...Ma(i)}),Ur.createWithPreprocess=(e,t,i)=>new Ur({schema:t,effect:{type:"preprocess",transform:e},typeName:Vr.ZodEffects,...Ma(i)});class Br extends Da{_parse(e){return this._getType(e)===wa.undefined?Na(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Br.create=(e,t)=>new Br({innerType:e,typeName:Vr.ZodOptional,...Ma(t)});class Mr extends Da{_parse(e){return this._getType(e)===wa.null?Na(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Mr.create=(e,t)=>new Mr({innerType:e,typeName:Vr.ZodNullable,...Ma(t)});class Dr extends Da{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===wa.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Dr.create=(e,t)=>new Dr({innerType:e,typeName:Vr.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Ma(t)});class zr extends Da{_parse(e){const{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return ja(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Ta(i.common.issues)},input:i.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new Ta(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}zr.create=(e,t)=>new zr({innerType:e,typeName:Vr.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Ma(t)});class qr extends Da{_parse(e){if(this._getType(e)!==wa.nan){const t=this._getOrReturnCtx(e);return Ea(t,{code:Ia.invalid_type,expected:wa.nan,received:t.parsedType}),Ca}return{status:"valid",value:e.data}}}qr.create=e=>new qr({typeName:Vr.ZodNaN,...Ma(e)});class Kr extends Da{_parse(e){const{ctx:t}=this._processInputParams(e),i=t.data;return this._def.type._parse({data:i,path:t.path,parent:t})}unwrap(){return this._def.type}}class Hr extends Da{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?Ca:"dirty"===e.status?(t.dirty(),Ra(e.value)):this._def.out._parseAsync({data:e.value,path:i.path,parent:i})})()}{const e=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?Ca:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:i.path,parent:i})}}static create(e,t){return new Hr({in:e,out:t,typeName:Vr.ZodPipeline})}}class Wr extends Da{_parse(e){const t=this._def.innerType._parse(e),i=e=>($a(e)&&(e.value=Object.freeze(e.value)),e);return ja(t)?t.then((e=>i(e))):i(t)}unwrap(){return this._def.innerType}}var Vr,Gr;Wr.create=(e,t)=>new Wr({innerType:e,typeName:Vr.ZodReadonly,...Ma(t)}),(Gr=Vr||(Vr={})).ZodString="ZodString",Gr.ZodNumber="ZodNumber",Gr.ZodNaN="ZodNaN",Gr.ZodBigInt="ZodBigInt",Gr.ZodBoolean="ZodBoolean",Gr.ZodDate="ZodDate",Gr.ZodSymbol="ZodSymbol",Gr.ZodUndefined="ZodUndefined",Gr.ZodNull="ZodNull",Gr.ZodAny="ZodAny",Gr.ZodUnknown="ZodUnknown",Gr.ZodNever="ZodNever",Gr.ZodVoid="ZodVoid",Gr.ZodArray="ZodArray",Gr.ZodObject="ZodObject",Gr.ZodUnion="ZodUnion",Gr.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Gr.ZodIntersection="ZodIntersection",Gr.ZodTuple="ZodTuple",Gr.ZodRecord="ZodRecord",Gr.ZodMap="ZodMap",Gr.ZodSet="ZodSet",Gr.ZodFunction="ZodFunction",Gr.ZodLazy="ZodLazy",Gr.ZodLiteral="ZodLiteral",Gr.ZodEnum="ZodEnum",Gr.ZodEffects="ZodEffects",Gr.ZodNativeEnum="ZodNativeEnum",Gr.ZodOptional="ZodOptional",Gr.ZodNullable="ZodNullable",Gr.ZodDefault="ZodDefault",Gr.ZodCatch="ZodCatch",Gr.ZodPromise="ZodPromise",Gr.ZodBranded="ZodBranded",Gr.ZodPipeline="ZodPipeline",Gr.ZodReadonly="ZodReadonly";const Zr=pr.create,Jr=xr.create;yr.create;const Xr=kr.create,Yr=Tr.create,Qr=Sr.create;Er.create,_r.create;const es=Cr.create,ts=Or.create,is=jr.create,ns=Fr.create;Lr.create,Br.create,Mr.create;var os=(e=>(e[e.PERSONAL=0]="PERSONAL",e[e.AI_AGENT=1]="AI_AGENT",e[e.MCP_SERVER=2]="MCP_SERVER",e))(os||{}),as=(e=>(e[e.MANUAL=0]="MANUAL",e[e.AUTONOMOUS=1]="AUTONOMOUS",e))(as||{}),rs=(e=>(e[e.TEXT_GENERATION=0]="TEXT_GENERATION",e[e.IMAGE_GENERATION=1]="IMAGE_GENERATION",e[e.AUDIO_GENERATION=2]="AUDIO_GENERATION",e[e.VIDEO_GENERATION=3]="VIDEO_GENERATION",e[e.CODE_GENERATION=4]="CODE_GENERATION",e[e.LANGUAGE_TRANSLATION=5]="LANGUAGE_TRANSLATION",e[e.SUMMARIZATION_EXTRACTION=6]="SUMMARIZATION_EXTRACTION",e[e.KNOWLEDGE_RETRIEVAL=7]="KNOWLEDGE_RETRIEVAL",e[e.DATA_INTEGRATION=8]="DATA_INTEGRATION",e[e.MARKET_INTELLIGENCE=9]="MARKET_INTELLIGENCE",e[e.TRANSACTION_ANALYTICS=10]="TRANSACTION_ANALYTICS",e[e.SMART_CONTRACT_AUDIT=11]="SMART_CONTRACT_AUDIT",e[e.GOVERNANCE_FACILITATION=12]="GOVERNANCE_FACILITATION",e[e.SECURITY_MONITORING=13]="SECURITY_MONITORING",e[e.COMPLIANCE_ANALYSIS=14]="COMPLIANCE_ANALYSIS",e[e.FRAUD_DETECTION=15]="FRAUD_DETECTION",e[e.MULTI_AGENT_COORDINATION=16]="MULTI_AGENT_COORDINATION",e[e.API_INTEGRATION=17]="API_INTEGRATION",e[e.WORKFLOW_AUTOMATION=18]="WORKFLOW_AUTOMATION",e))(rs||{}),ss=(e=>(e[e.RESOURCE_PROVIDER=0]="RESOURCE_PROVIDER",e[e.TOOL_PROVIDER=1]="TOOL_PROVIDER",e[e.PROMPT_TEMPLATE_PROVIDER=2]="PROMPT_TEMPLATE_PROVIDER",e[e.LOCAL_FILE_ACCESS=3]="LOCAL_FILE_ACCESS",e[e.DATABASE_INTEGRATION=4]="DATABASE_INTEGRATION",e[e.API_INTEGRATION=5]="API_INTEGRATION",e[e.WEB_ACCESS=6]="WEB_ACCESS",e[e.KNOWLEDGE_BASE=7]="KNOWLEDGE_BASE",e[e.MEMORY_PERSISTENCE=8]="MEMORY_PERSISTENCE",e[e.CODE_ANALYSIS=9]="CODE_ANALYSIS",e[e.CONTENT_GENERATION=10]="CONTENT_GENERATION",e[e.COMMUNICATION=11]="COMMUNICATION",e[e.DOCUMENT_PROCESSING=12]="DOCUMENT_PROCESSING",e[e.CALENDAR_SCHEDULE=13]="CALENDAR_SCHEDULE",e[e.SEARCH=14]="SEARCH",e[e.ASSISTANT_ORCHESTRATION=15]="ASSISTANT_ORCHESTRATION",e))(ss||{}),cs=(e=>(e.DNS="dns",e.SIGNATURE="signature",e.CHALLENGE="challenge",e))(cs||{});const ps=Yr({platform:Zr().min(1),handle:Zr().min(1)}),ls=Yr({type:ns(as),capabilities:Xr(ns(rs)).min(1),model:Zr().min(1),creator:Zr().optional()}),us=Yr({url:Zr().min(1),transport:is(["stdio","sse"])}),ds=Yr({type:ns(cs),value:Zr(),dns_field:Zr().optional(),challenge_path:Zr().optional()}),ms=Yr({minVersion:Zr().optional()}),fs=Yr({name:Zr().min(1),description:Zr().min(1)}),hs=Yr({name:Zr().min(1),description:Zr().min(1)}),gs=Yr({version:Zr().min(1),connectionInfo:us,services:Xr(ns(ss)).min(1),description:Zr().min(1),verification:ds.optional(),host:ms.optional(),capabilities:Xr(Zr()).optional(),resources:Xr(fs).optional(),tools:Xr(hs).optional(),maintainer:Zr().optional(),repository:Zr().optional(),docs:Zr().optional()}),bs=Yr({version:Zr().min(1),type:ns(os),display_name:Zr().min(1),alias:Zr().optional(),bio:Zr().optional(),socials:Xr(ps).optional(),profileImage:Zr().optional(),properties:es(Jr()).optional(),inboundTopicId:Zr().optional(),outboundTopicId:Zr().optional()});Qr([bs.extend({type:ts(os.PERSONAL),language:Zr().optional(),timezone:Zr().optional()}),bs.extend({type:ts(os.AI_AGENT),aiAgent:ls}),bs.extend({type:ts(os.MCP_SERVER),mcpServer:gs})]);class xs{constructor(e){b(this,"accountId"),b(this,"signer"),b(this,"baseUrl"),b(this,"network"),b(this,"logger"),this.accountId=e.accountId,this.signer=e.signer,this.network=e.network||"mainnet",this.baseUrl=e.baseUrl||"https://kiloscribe.com",this.logger=e.logger}async authenticate(){var e,t,i;const n=await Yt.get(`${this.baseUrl}/api/auth/request-signature`,{headers:{"x-session":this.accountId}});if(!(null==(e=n.data)?void 0:e.message))throw new Error("Failed to get signature message");const o=n.data.message,a=await this.signMessage(JSON.stringify(o)),r=await Yt.post(`${this.baseUrl}/api/auth/authenticate`,{authData:{id:this.accountId,signature:a,data:o,network:this.network},include:"apiKey"});if(!(null==(i=null==(t=r.data)?void 0:t.user)?void 0:i.sessionToken))throw new Error("Authentication failed");return{apiKey:r.data.apiKey}}async signMessage(e){try{const t=(new TextEncoder).encode(e);this.logger.debug("signing message");const i=await this.signer.sign([t],{encoding:"utf-8"});return C.from(null==i?void 0:i[0].signature).toString("hex")}catch(t){throw this.logger.error("Failed to sign message",t),new Error("Failed to sign message")}}}function vs(e){return new DataView(e.buffer,e.byteOffset)}const ys={len:1,get:(e,t)=>vs(e).getUint8(t),put:(e,t,i)=>(vs(e).setUint8(t,i),t+1)},ws={len:2,get:(e,t)=>vs(e).getUint16(t,!0),put:(e,t,i)=>(vs(e).setUint16(t,i,!0),t+2)},ks={len:2,get:(e,t)=>vs(e).getUint16(t),put:(e,t,i)=>(vs(e).setUint16(t,i),t+2)},Is={len:4,get:(e,t)=>vs(e).getUint32(t,!0),put:(e,t,i)=>(vs(e).setUint32(t,i,!0),t+4)},Ts={len:4,get:(e,t)=>vs(e).getUint32(t),put:(e,t,i)=>(vs(e).setUint32(t,i),t+4)},Ss={len:4,get:(e,t)=>vs(e).getInt32(t),put:(e,t,i)=>(vs(e).setInt32(t,i),t+4)},As={len:8,get:(e,t)=>vs(e).getBigUint64(t,!0),put:(e,t,i)=>(vs(e).setBigUint64(t,i,!0),t+8)};class Es{constructor(e,t){this.len=e,this.encoding=t}get(e,t){return C.from(e).toString(this.encoding,t,t+this.len)}}class _s extends Error{constructor(){super("End-Of-Stream")}}class Cs{constructor(){this.resolve=()=>null,this.reject=()=>null,this.promise=new Promise(((e,t)=>{this.reject=t,this.resolve=e}))}}class Rs{constructor(){this.maxStreamReadSize=1048576,this.endOfStream=!1,this.peekQueue=[]}async peek(e,t,i){const n=await this.read(e,t,i);return this.peekQueue.push(e.subarray(t,t+n)),n}async read(e,t,i){if(0===i)return 0;let n=this.readFromPeekBuffer(e,t,i);if(n+=await this.readRemainderFromStream(e,t+n,i-n),0===n)throw new _s;return n}readFromPeekBuffer(e,t,i){let n=i,o=0;for(;this.peekQueue.length>0&&n>0;){const i=this.peekQueue.pop();if(!i)throw new Error("peekData should be defined");const a=Math.min(i.length,n);e.set(i.subarray(0,a),t+o),o+=a,n-=a,a<i.length&&this.peekQueue.push(i.subarray(a))}return o}async readRemainderFromStream(e,t,i){let n=i,o=0;for(;n>0&&!this.endOfStream;){const i=Math.min(n,this.maxStreamReadSize),a=await this.readFromStream(e,t+o,i);if(0===a)break;o+=a,n-=a}return o}}class Ns extends Rs{constructor(e){if(super(),this.s=e,this.deferred=null,!e.read||!e.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",(()=>this.reject(new _s))),this.s.once("error",(e=>this.reject(e))),this.s.once("close",(()=>this.reject(new Error("Stream closed"))))}async readFromStream(e,t,i){if(this.endOfStream)return 0;const n=this.s.read(i);if(n)return e.set(n,t),n.length;const o={buffer:e,offset:t,length:i,deferred:new Cs};return this.deferred=o.deferred,this.s.once("readable",(()=>{this.readDeferred(o)})),o.deferred.promise}readDeferred(e){const t=this.s.read(e.length);t?(e.buffer.set(t,e.offset),e.deferred.resolve(t.length),this.deferred=null):this.s.once("readable",(()=>{this.readDeferred(e)}))}reject(e){this.endOfStream=!0,this.deferred&&(this.deferred.reject(e),this.deferred=null)}async abort(){this.reject(new Error("abort"))}async close(){return this.abort()}}class Ps{constructor(e){this.position=0,this.numBuffer=new Uint8Array(8),this.fileInfo=e||{}}async readToken(e,t=this.position){const i=new Uint8Array(e.len);if(await this.readBuffer(i,{position:t})<e.len)throw new _s;return e.get(i,0)}async peekToken(e,t=this.position){const i=new Uint8Array(e.len);if(await this.peekBuffer(i,{position:t})<e.len)throw new _s;return e.get(i,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new _s;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new _s;return e.get(this.numBuffer,0)}async ignore(e){if(void 0!==this.fileInfo.size){const t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){}normalizeOptions(e,t){if(t&&void 0!==t.position&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return t?{mayBeLess:!0===t.mayBeLess,offset:t.offset?t.offset:0,length:t.length?t.length:e.length-(t.offset?t.offset:0),position:t.position?t.position:this.position}:{mayBeLess:!1,offset:0,length:e.length,position:this.position}}}class Os extends Ps{constructor(e,t){super(t),this.streamReader=e}async getFileInfo(){return this.fileInfo}async readBuffer(e,t){const i=this.normalizeOptions(e,t),n=i.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(0===i.length)return 0;const o=await this.streamReader.read(e,i.offset,i.length);if(this.position+=o,(!t||!t.mayBeLess)&&o<i.length)throw new _s;return o}async peekBuffer(e,t){const i=this.normalizeOptions(e,t);let n=0;if(i.position){const t=i.position-this.position;if(t>0){const o=new Uint8Array(i.length+t);return n=await this.peekBuffer(o,{mayBeLess:i.mayBeLess}),e.set(o.subarray(t),i.offset),n-t}if(t<0)throw new Error("Cannot peek from a negative offset in a stream")}if(i.length>0){try{n=await this.streamReader.peek(e,i.offset,i.length)}catch(o){if(t&&t.mayBeLess&&o instanceof _s)return 0;throw o}if(!i.mayBeLess&&n<i.length)throw new _s}return n}async ignore(e){const t=Math.min(256e3,e),i=new Uint8Array(t);let n=0;for(;n<e;){const o=e-n,a=await this.readBuffer(i,{length:Math.min(t,o)});if(a<0)return a;n+=a}return n}}class $s extends Ps{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo.size=this.fileInfo.size?this.fileInfo.size:e.length}async readBuffer(e,t){if(t&&t.position){if(t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");this.position=t.position}const i=await this.peekBuffer(e,t);return this.position+=i,i}async peekBuffer(e,t){const i=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-i.position,i.length);if(!i.mayBeLess&&n<i.length)throw new _s;return e.set(this.uint8Array.subarray(i.position,i.position+n),i.offset),n}async close(){}}const js={get:(e,t)=>127&e[t+3]|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},Fs=4100;function Ls(e,t,i){i={offset:0,...i};for(const[n,o]of t.entries())if(i.mask){if(o!==(i.mask[n]&e[n+i.offset]))return!1}else if(o!==e[n+i.offset])return!1;return!0}class Us{constructor(e){this.detectors=null==e?void 0:e.customDetectors,this.fromTokenizer=this.fromTokenizer.bind(this),this.fromBuffer=this.fromBuffer.bind(this),this.parse=this.parse.bind(this)}async fromTokenizer(e){const t=e.position;for(const i of this.detectors||[]){const n=await i(e);if(n)return n;if(t!==e.position)return}return this.parse(e)}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof e}\``);const t=e instanceof Uint8Array?e:new Uint8Array(e);var i;if((null==t?void 0:t.length)>1)return this.fromTokenizer(new $s(t,i))}async fromBlob(e){const t=await e.arrayBuffer();return this.fromBuffer(new Uint8Array(t))}async fromStream(e){const t=await function(e,t){return t=t||{},new Os(new Ns(e),t)}(e);try{return await this.fromTokenizer(t)}finally{await t.close()}}async toDetectionStream(e,t={}){const{default:i}=await Promise.resolve().then((()=>require("./index-U-8_6nvw-D6N0eu0v.cjs"))).then((e=>e.i)),{sampleSize:n=Fs}=t;return new Promise(((t,o)=>{e.on("error",o),e.once("readable",(()=>{(async()=>{try{const r=new i.PassThrough,s=i.pipeline?i.pipeline(e,r,(()=>{})):e.pipe(r),c=e.read(n)??e.read()??C.alloc(0);try{r.fileType=await this.fromBuffer(c)}catch(a){a instanceof _s?r.fileType=void 0:o(a)}t(s)}catch(a){o(a)}})()}))}))}check(e,t){return Ls(this.buffer,e,t)}checkString(e,t){return this.check((i=e,[...i].map((e=>e.charCodeAt(0)))),t);var i}async parse(e){if(this.buffer=C.alloc(Fs),void 0===e.fileInfo.size&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:12,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.parse(e);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);const i=await e.readToken(js);return e.position+i>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(i),this.fromTokenizer(e))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((67===this.buffer[0]||70===this.buffer[0])&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){try{for(;e.position+30<e.fileInfo.size;){await e.readBuffer(this.buffer,{length:30});const n={compressedSize:this.buffer.readUInt32LE(18),uncompressedSize:this.buffer.readUInt32LE(22),filenameLength:this.buffer.readUInt16LE(26),extraFieldLength:this.buffer.readUInt16LE(28)};if(n.filename=await e.readToken(new Es(n.filenameLength,"utf-8")),await e.ignore(n.extraFieldLength),"META-INF/mozilla.rsa"===n.filename)return{ext:"xpi",mime:"application/x-xpinstall"};if(n.filename.endsWith(".rels")||n.filename.endsWith(".xml")){switch(n.filename.split("/")[0]){case"_rels":default:break;case"word":return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};case"ppt":return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};case"xl":return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}}}if(n.filename.startsWith("xl/"))return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(n.filename.startsWith("3D/")&&n.filename.endsWith(".model"))return{ext:"3mf",mime:"model/3mf"};if("mimetype"===n.filename&&n.compressedSize===n.uncompressedSize){let o=await e.readToken(new Es(n.compressedSize,"utf-8"));switch(o=o.trim(),o){case"application/epub+zip":return{ext:"epub",mime:"application/epub+zip"};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"}}}if(0===n.compressedSize){let a=-1;for(;a<0&&e.position<e.fileInfo.size;)await e.peekBuffer(this.buffer,{mayBeLess:!0}),a=this.buffer.indexOf("504B0304",0,"hex"),await e.ignore(a>=0?a:this.buffer.length)}else await e.ignore(n.compressedSize)}}catch(t){if(!(t instanceof _s))throw t}return{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);const r=C.alloc(8);return await e.readBuffer(r),Ls(r,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/opus"}:Ls(r,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Ls(r,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Ls(r,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Ls(r,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Ls(r,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(3===this.buffer[2]||5===this.buffer[2]||7===this.buffer[2])&&(4===this.buffer[3]||6===this.buffer[3]||8===this.buffer[3]))return{ext:"zip",mime:"application/zip"};if(this.checkString("ftyp",{offset:4})&&96&this.buffer[8]){const s=this.buffer.toString("binary",8,12).replace("\0"," ").trim();switch(s){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return s.startsWith("3g")?s.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/x-flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF")){try{await e.ignore(1350);const c=10485760,p=C.alloc(Math.min(c,e.fileInfo.size));if(await e.readBuffer(p,{mayBeLess:!0}),p.includes(C.from("AIPrivateData")))return{ext:"ai",mime:"application/postscript"}}catch(t){if(!(t instanceof _s))throw t}return{ext:"pdf",mime:"application/pdf"}}if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const l=await this.readTiffHeader(!1);if(l)return l}if(this.check([77,77])){const u=await this.readTiffHeader(!0);if(u)return u}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function d(){const t=await e.peekNumber(ys);let i=128,n=0;for(;!(t&i)&&0!==i;)++n,i>>=1;const o=C.alloc(n+1);return await e.readBuffer(o),o}async function m(){const e=await d(),t=await d();t[0]^=128>>t.length-1;const i=Math.min(6,t.length);return{id:e.readUIntBE(0,e.length),len:t.readUIntBE(t.length-i,i)}}async function f(t){for(;t>0;){const i=await m();if(17026===i.id){return(await e.readToken(new Es(i.len,"utf-8"))).replace(/\00.*$/g,"")}await e.ignore(i.len),--t}}const h=await m();switch(await f(h.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/x-matroska"};default:return}}if(this.check([82,73,70,70])){if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1"))return{ext:"parquet",mime:"application/x-parquet"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(0===this.buffer[6]||1===this.buffer[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const g=this.buffer.toString("binary",2,6);if(g.match("^d*")&&g>=1e3&&g<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>")){await e.ignore(8);return"debian-binary"===await e.readToken(new Es(13,"ascii"))?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"}}if(this.checkString("**ACE",{offset:7})&&(await e.peekBuffer(this.buffer,{length:14,mayBeLess:!0}),this.checkString("**",{offset:12})))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.check([137,80,78,71,13,10,26,10])){async function b(){return{length:await e.readToken(Ss),type:await e.readToken(new Es(4,"binary"))}}await e.ignore(8);do{const x=await b();if(x.length<0)return;switch(x.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(x.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/x-apache-arrow"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function v(){const t=C.alloc(16);return await e.readBuffer(t),{id:t,size:Number(await e.readToken(As))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){const y=await v();let w=y.size-24;if(Ls(y.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const k=C.alloc(16);if(w-=await e.readBuffer(k),Ls(k,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(Ls(k,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await e.ignore(w)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10])){await e.ignore(20);switch(await e.readToken(new Es(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.check([0,60,0,63,0,120,0,109,0,108],{offset:2})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const I=this.buffer.readUInt32LE(12);if(I>12&&this.buffer.length>=I+16)try{const T=this.buffer.slice(16,I+16).toString();if(JSON.parse(T).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),function(e,t=0){const i=Number.parseInt(e.toString("utf8",148,154).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(i))return!1;let n=256;for(let o=t;o<t+148;o++)n+=e[o];for(let o=t+156;o<t+512;o++)n+=e[o];return i===n}(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254]))return this.check([60,0,63,0,120,0,109,0,108,0],{offset:2})?{ext:"xml",mime:"application/xml"}:this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:void 0;if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"};if(this.buffer.length>=2&&this.check([255,224],{offset:0,mask:[255,224]})){if(this.check([16],{offset:1,mask:[22]}))return this.check([8],{offset:1,mask:[8]}),{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}async readTiffTag(e){const t=await this.tokenizer.readToken(e?ks:ws);switch(this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(e){const t=await this.tokenizer.readToken(e?ks:ws);for(let i=0;i<t;++i){const t=await this.readTiffTag(e);if(t)return t}}async readTiffHeader(e){const t=(e?ks:ws).get(this.buffer,2),i=(e?Ts:Is).get(this.buffer,4);if(42===t){if(i>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(i>=8&&(this.check([28,0,254,0],{offset:8})||this.check([31,0,11,0],{offset:8})))return{ext:"nef",mime:"image/x-nikon-nef"}}await this.tokenizer.ignore(i);return await this.readTiffIFD(e)??{ext:"tif",mime:"image/tiff"}}if(43===t)return{ext:"tif",mime:"image/tiff"}}}new Set(["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx"]),new Set(["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/vnd.wave","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","audio/opus","video/ogg","audio/ogg","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/x-parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx"]);const Bs=class e{constructor(e){if(b(this,"client"),b(this,"config"),b(this,"logger",Qt.getInstance()),this.config=e,!e.apiKey)throw new ei("API key is required");if(!e.network)throw new ei("Network is required");const t={"x-api-key":e.apiKey,"Content-Type":"application/json"};this.client=Yt.create({baseURL:"https://v2-api.tier.bot/api",headers:t}),this.logger=Qt.getInstance()}async getFileMetadata(e){try{const t=await Yt.get(e),i=t.headers["content-type"]||"";return{size:parseInt(t.headers["content-length"]||"0",10),mimeType:i}}catch(t){throw this.logger.error("Error fetching file metadata:",t),new ei("Unable to fetch file metadata")}}getMimeType(t){const i=t.toLowerCase().split(".").pop();if(!i)throw new ei("File must have an extension");const n=e.VALID_MIME_TYPES[i];if(!n)throw new ei(`Unsupported file type: ${i}`);return n}validateRequest(t){if(this.logger.debug("Validating request:",t),!t.holderId||""===t.holderId.trim())throw this.logger.warn("holderId is missing or empty"),new ei("holderId is required");if(!e.VALID_MODES.includes(t.mode))throw new ei(`Invalid mode: ${t.mode}. Must be one of: ${e.VALID_MODES.join(", ")}`);if("hashinal"===t.mode&&!t.jsonFileURL&&!t.metadataObject)throw new ei("Hashinal mode requires either jsonFileURL or metadataObject");if(t.onlyJSONCollection&&"hashinal-collection"!==t.mode)throw new ei("onlyJSONCollection can only be used with hashinal-collection mode");this.validateFileInput(t.file)}normalizeMimeType(e){return"image/vnd.microsoft.icon"===e?(this.logger.debug("Normalizing MIME type from image/vnd.microsoft.icon to image/x-icon"),"image/x-icon"):e}validateMimeType(t){return!!Object.values(e.VALID_MIME_TYPES).includes(t)||"image/vnd.microsoft.icon"===t&&(this.logger.debug("Accepting alternative MIME type for ICO: image/vnd.microsoft.icon"),!0)}validateFileInput(t){if("base64"===t.type){if(!t.base64)throw new ei("Base64 data is required");const i=t.base64.replace(/^data:.*?;base64,/,"");if(Math.ceil(.75*i.length)>e.MAX_BASE64_SIZE)throw new ei(`File size exceeds maximum limit of ${e.MAX_BASE64_SIZE/1024/1024}MB`);const n=t.mimeType||this.getMimeType(t.fileName);if(!this.validateMimeType(n))throw new ei("File must have one of the supported MIME types");"image/vnd.microsoft.icon"===t.mimeType&&(t.mimeType=this.normalizeMimeType(t.mimeType))}else if("url"===t.type&&!t.url)throw new ei("URL is required")}async detectMimeTypeFromBase64(e){if(e.startsWith("data:")){const t=e.match(/^data:([^;]+);base64,/);if(t&&t.length>1)return t[1]}try{const t=e.replace(/\s/g,""),i=_.from(t,"base64"),n=await async function(e){return(new Us).fromBuffer(e)}(i);return(null==n?void 0:n.mime)||"application/octet-stream"}catch(t){return this.logger.warn("Failed to detect MIME type from buffer"),"application/octet-stream"}}async startInscription(t){var i,n;try{this.validateRequest(t);let i=t.file.mimeType;if("url"===t.file.type){const n=await this.getFileMetadata(t.file.url);if(i=n.mimeType||i,n.size>e.MAX_URL_FILE_SIZE)throw new ei(`File size exceeds maximum URL file limit of ${e.MAX_URL_FILE_SIZE/1024/1024}MB`)}else"base64"===t.file.type&&(i=await this.detectMimeTypeFromBase64(t.file.base64));if("image/vnd.microsoft.icon"===i&&(i=this.normalizeMimeType(i)),t.jsonFileURL){if("application/json"!==(await this.getFileMetadata(t.jsonFileURL)).mimeType)throw new ei("JSON file must be of type application/json")}const n={holderId:t.holderId,mode:t.mode,network:this.config.network,onlyJSONCollection:t.onlyJSONCollection?1:0,creator:t.creator,description:t.description,fileStandard:t.fileStandard,metadataObject:t.metadataObject,jsonFileURL:t.jsonFileURL};let o;return o="url"===t.file.type?await this.client.post("/inscriptions/start-inscription",{...n,fileURL:t.file.url}):await this.client.post("/inscriptions/start-inscription",{...n,fileBase64:t.file.base64,fileName:t.file.fileName,fileMimeType:i||this.getMimeType(t.file.fileName)}),o.data}catch(o){if(o instanceof ei)throw o;if(Yt.isAxiosError(o))throw new Error((null==(n=null==(i=o.response)?void 0:i.data)?void 0:n.message)||"Failed to start inscription");throw o}}async executeTransaction(e,t){try{const n="mainnet"===t.network?i.Client.forMainnet():i.Client.forTestnet(),o="string"==typeof t.privateKey,a=o?function(e){let t="ed25519";e.startsWith("0x")?t="ecdsa":e.startsWith("302e020100300506032b6570")?t="ed25519":e.startsWith("3030020100300706052b8104000a")?t="ecdsa":96===e.length?t="ed25519":88===e.length&&(t="ecdsa");try{return{detectedType:t,privateKey:"ecdsa"===t?i.PrivateKey.fromStringECDSA(e):i.PrivateKey.fromStringED25519(e)}}catch(n){const a="ecdsa"===t?"ed25519":"ecdsa";try{return{detectedType:a,privateKey:"ecdsa"===a?i.PrivateKey.fromStringECDSA(e):i.PrivateKey.fromStringED25519(e)}}catch(o){throw new Error(`Failed to parse private key as either ED25519 or ECDSA: ${n}`)}}}(t.privateKey):void 0;let r;r=o?"ed25519"===(null==a?void 0:a.detectedType)?i.PrivateKey.fromStringED25519(t.privateKey):i.PrivateKey.fromStringECDSA(t.privateKey):t.privateKey,n.setOperator(t.accountId,r);const s=i.TransferTransaction.fromBytes(_.from(e,"base64")),c=await s.sign(r),p=await c.execute(n),l=(await p.getReceipt(n)).status.toString();if("SUCCESS"!==l)throw new Error(`Transaction failed with status: ${l}`);return p.transactionId.toString()}catch(n){throw new Error(`Failed to execute transaction: ${n instanceof Error?n.message:"Unknown error"}`)}}async executeTransactionWithSigner(e,t){try{const n=i.TransferTransaction.fromBytes(_.from(e,"base64")),o=await n.executeWithSigner(t),a=(await o.getReceiptWithSigner(t)).status.toString();if("SUCCESS"!==a)throw new Error(`Transaction failed with status: ${a}`);return o.transactionId.toString()}catch(n){throw new Error(`Failed to execute transaction: ${n instanceof Error?n.message:"Unknown error"}`)}}async inscribeAndExecute(e,t){const i=await this.startInscription(e);if(!i.transactionBytes)throw this.logger.error("No transaction bytes returned from inscription request",i),new Error("No transaction bytes returned from inscription request");this.logger.info("executing transaction");const n=await this.executeTransaction(i.transactionBytes,t);return{jobId:i.tx_id,transactionId:n}}async inscribe(e,t){const i=await this.startInscription(e);if(!i.transactionBytes)throw this.logger.error("No transaction bytes returned from inscription request",i),new Error("No transaction bytes returned from inscription request");this.logger.info("executing transaction");const n=await this.executeTransactionWithSigner(i.transactionBytes,t);return{jobId:i.tx_id,transactionId:n}}async retryWithBackoff(e,t=3,i=1e3){for(let o=0;o<t;o++)try{return await e()}catch(n){if(o===t-1)throw n;const e=i*Math.pow(2,o);await new Promise((t=>setTimeout(t,e))),this.logger.debug(`Retry attempt ${o+1}/${t} after ${e}ms delay`)}throw new Error("Retry operation failed")}async retrieveInscription(e){if(!e)throw new ei("Transaction ID is required");try{return await this.retryWithBackoff((async()=>{const t=(await this.client.get(`/inscriptions/retrieve-inscription?id=${e}`)).data;return{...t,jobId:t.id}}))}catch(t){throw this.logger.error("Failed to retrieve inscription:",t),t}}async getInscriptionNumbers(e={}){try{return(await this.client.get("/inscriptions/numbers",{params:e})).data}catch(t){throw this.logger.error("Failed to fetch inscription numbers:",t),t}}static async authenticate(e){return new ti(e).authenticate()}static async createWithAuth(t){const i="client"===t.type?new xs({...t,logger:Qt.getInstance()}):new ti(t),{apiKey:n}=await i.authenticate();return new e({apiKey:n,network:t.network||"mainnet"})}async waitForInscription(e,t=30,i=4e3,n=!1,o){var a;let r=0,s=0;const c=(i,n,a,c)=>{if(o)try{s=Math.max(s,a),o({stage:i,message:n,progressPercent:s,details:{...c,txId:e,currentAttempt:r,maxAttempts:t}})}catch(p){this.logger.warn(`Error in progress callback: ${p}`)}};for(c("confirming","Starting inscription verification",0);r<t;){c("confirming",`Verifying inscription status (attempt ${r+1}/${t})`,5,{attempt:r+1});const o=await this.retrieveInscription(e);if(o.error)throw c("verifying",`Error: ${o.error}`,100,{error:o.error}),new Error(o.error);let s=5;void 0!==o.messages&&void 0!==o.maxMessages&&o.maxMessages>0?(s=Math.min(95,5+o.messages/o.maxMessages*90),o.completed&&(s=100)):"processing"===o.status?s=10:o.completed&&(s=100),c(o.completed?"completed":"confirming",o.completed?"Inscription completed successfully":`Processing inscription (${o.status})`,s,{status:o.status,messagesProcessed:o.messages,maxMessages:o.maxMessages,messageCount:o.messages,completed:o.completed,confirmedMessages:o.confirmedMessages,result:o});const p="hashinal"===o.mode,l="6"===(null==(a=o.fileStandard)?void 0:a.toString());if(p&&o.topic_id&&o.jsonTopicId&&(!n||o.completed))return c("completed","Inscription verification complete",100,{result:o}),o;if(!p&&!l&&o.topic_id&&(!n||o.completed))return c("completed","Inscription verification complete",100,{result:o}),o;if(l&&o.topic_id&&o.jsonTopicId&&o.registryTopicId&&(!n||o.completed))return c("completed","Inscription verification complete",100,{result:o}),o;await new Promise((e=>setTimeout(e,i))),r++}throw c("verifying",`Inscription ${e} did not complete within ${t} attempts`,100,{timedOut:!0}),new Error(`Inscription ${e} did not complete within ${t} attempts`)}async getHolderInscriptions(e){var t,i;if(!e.holderId)throw new ei("Holder ID is required");try{const t={holderId:e.holderId};e.includeCollections&&(t.includeCollections="1");return(await this.client.get("/inscriptions/holder-inscriptions",{params:t})).data}catch(n){if(this.logger.error("Failed to fetch holder inscriptions:",n),Yt.isAxiosError(n))throw new Error((null==(i=null==(t=n.response)?void 0:t.data)?void 0:i.message)||"Failed to fetch holder inscriptions");throw n}}};b(Bs,"VALID_MODES",["file","upload","hashinal","hashinal-collection"]),b(Bs,"MAX_BASE64_SIZE",2097152),b(Bs,"MAX_URL_FILE_SIZE",104857600),b(Bs,"VALID_MIME_TYPES",{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",ico:"image/x-icon",heic:"image/heic",heif:"image/heif",bmp:"image/bmp",webp:"image/webp",tiff:"image/tiff",tif:"image/tiff",svg:"image/svg+xml",mp4:"video/mp4",webm:"video/webm",mp3:"audio/mpeg",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",html:"text/html",htm:"text/html",css:"text/css",php:"application/x-httpd-php",java:"text/x-java-source",js:"application/javascript",mjs:"application/javascript",csv:"text/csv",json:"application/json",txt:"text/plain",glb:"model/gltf-binary",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",flac:"audio/flac",aac:"audio/aac",m4a:"audio/mp4",avi:"video/x-msvideo",mov:"video/quicktime",mkv:"video/x-matroska",m4v:"video/mp4",mpg:"video/mpeg",mpeg:"video/mpeg",ts:"application/typescript",zip:"application/zip",rar:"application/vnd.rar",tar:"application/x-tar",gz:"application/gzip","7z":"application/x-7z-compressed",xml:"application/xml",yaml:"application/yaml",yml:"application/yaml",md:"text/markdown",markdown:"text/markdown",rtf:"application/rtf",gltf:"model/gltf+json",usdz:"model/vnd.usdz+zip",obj:"model/obj",stl:"model/stl",fbx:"application/octet-stream",ttf:"font/ttf",otf:"font/otf",woff:"font/woff",woff2:"font/woff2",eot:"application/vnd.ms-fontobject",psd:"application/vnd.adobe.photoshop",ai:"application/postscript",eps:"application/postscript",ps:"application/postscript",sqlite:"application/x-sqlite3",db:"application/x-sqlite3",apk:"application/vnd.android.package-archive",ics:"text/calendar",vcf:"text/vcard",py:"text/x-python",rb:"text/x-ruby",go:"text/x-go",rs:"text/x-rust",typescript:"application/typescript",jsx:"text/jsx",tsx:"text/tsx",sql:"application/sql",toml:"application/toml",avif:"image/avif",jxl:"image/jxl",weba:"audio/webm"});let Ms=Bs;class Ds{constructor(e={}){this.module=e.module||"Progress",this.callback=e.callback,this.logger=e.logger||new d({level:"info",module:"ProgressReporter"}),this.logProgress=e.logProgress??!0,this.minPercent=e.minPercent??0,this.maxPercent=e.maxPercent??100,this.lastReportedPercent=-1,this.lastReportedTime=0,this.throttleMs=100}static getInstance(e={}){return Ds.instance?(e.callback&&Ds.instance.setCallback(e.callback),e.module&&Ds.instance.setModule(e.module),e.logger&&Ds.instance.setLogger(e.logger),void 0!==e.minPercent&&Ds.instance.setMinPercent(e.minPercent),void 0!==e.maxPercent&&Ds.instance.setMaxPercent(e.maxPercent)):Ds.instance=new Ds(e),Ds.instance}setCallback(e){this.callback=e}setModule(e){this.module=e}setLogger(e){this.logger=e}setMinPercent(e){this.minPercent=e}setMaxPercent(e){this.maxPercent=e}createSubProgress(e){const t=new Ds({module:this.module,logger:this.logger,logProgress:this.logProgress,minPercent:e.minPercent,maxPercent:e.maxPercent}),i=e.logPrefix||"";return t.setCallback((t=>{const n=this.scalePercent(t.progressPercent,e.minPercent,e.maxPercent);let o=t.message;i&&!o.startsWith(i)&&(o=`${i}: ${o}`),this.report({stage:t.stage,message:o,progressPercent:n,details:t.details})})),t}report(e){const t=e.progressPercent,i=Math.max(0,Math.min(100,t)),n=this.scalePercent(i,0,100),o=Date.now();if(n===this.lastReportedPercent&&o-this.lastReportedTime<this.throttleMs&&"completed"!==e.stage&&"failed"!==e.stage)return;this.lastReportedPercent=n,this.lastReportedTime=o;const a={...e,progressPercent:n};if(this.logProgress&&this.logger.debug(`[${this.module}] [${e.stage.toUpperCase()}] ${e.message} (${n.toFixed(1)}%)`,e.details),this.callback)try{this.callback(a)}catch(r){this.logger.warn(`Error in progress callback: ${r}`)}}scalePercent(e,t,i){const n=(this.maxPercent-this.minPercent)/(i-t);return this.minPercent+(e-t)*n}preparing(e,t,i){this.report({stage:"preparing",message:e,progressPercent:t,details:i})}submitting(e,t,i){this.report({stage:"submitting",message:e,progressPercent:t,details:i})}confirming(e,t,i){this.report({stage:"confirming",message:e,progressPercent:t,details:i})}verifying(e,t,i){this.report({stage:"verifying",message:e,progressPercent:t,details:i})}completed(e,t){this.report({stage:"completed",message:e,progressPercent:100,details:t})}failed(e,t){this.report({stage:"failed",message:e,progressPercent:this.lastReportedPercent,details:t})}}async function zs(e,t,i,n){const o=d.getInstance({module:"Inscriber",...i.logging});o.info("Starting inscription process",{type:e.type,mode:i.mode||"file",..."url"===e.type?{url:e.url}:{},..."file"===e.type?{path:e.path}:{},..."buffer"===e.type?{fileName:e.fileName,bufferSize:e.buffer.byteLength}:{}});try{let a;"hashinal"===i.mode&&i.metadata&&Ks(i.metadata,o),n?(o.debug("Using existing InscriptionSDK instance"),a=n):i.apiKey?(o.debug("Initializing InscriptionSDK with API key"),a=new Ms({apiKey:i.apiKey,network:t.network||"mainnet"})):(o.debug("Initializing InscriptionSDK with server auth"),a=await Ms.createWithAuth({type:"server",accountId:t.accountId,privateKey:t.privateKey,network:t.network||"mainnet"}));const r={holderId:t.accountId,metadata:i.metadata||{},tags:i.tags||[],mode:i.mode||"file",chunkSize:i.chunkSize};let s;switch(e.type){case"url":s={...r,file:{type:"url",url:e.url}};break;case"file":s={...r,file:{type:"path",path:e.path}};break;case"buffer":s={...r,file:{type:"base64",base64:globalThis.Buffer.from(e.buffer).toString("base64"),fileName:e.fileName,mimeType:e.mimeType}}}"hashinal"===i.mode&&(s.metadataObject=i.metadata,s.creator=i.metadata?.creator||t.accountId,s.description=i.metadata?.description,i.jsonFileURL&&(s.jsonFileURL=i.jsonFileURL)),o.debug("Preparing to inscribe content",{type:e.type,mode:i.mode||"file",holderId:t.accountId});const c=await a.inscribeAndExecute(s,t);if(o.info("Starting to inscribe.",{type:e.type,mode:i.mode||"file",transactionId:c.jobId}),i.waitForConfirmation){o.debug("Waiting for inscription confirmation",{transactionId:c.jobId,maxAttempts:i.waitMaxAttempts,intervalMs:i.waitIntervalMs});const e=await Hs(a,c.jobId,i.waitMaxAttempts,i.waitIntervalMs,i.progressCallback);return o.info("Inscription confirmation received",{transactionId:c.jobId}),{confirmed:!0,result:c,inscription:e,sdk:a}}return{confirmed:!1,result:c,sdk:a}}catch(a){throw o.error("Error during inscription process",a),a}}async function qs(e,t,i,n){const o=d.getInstance({module:"Inscriber",...i.logging});o.info("Starting inscription process with signer",{type:e.type,mode:i.mode||"file",..."url"===e.type?{url:e.url}:{},..."file"===e.type?{path:e.path}:{},..."buffer"===e.type?{fileName:e.fileName,bufferSize:e.buffer.byteLength}:{}});try{"hashinal"===i.mode&&i.metadata&&Ks(i.metadata,o);const a=t.getAccountId().toString();let r;o.debug("Using account ID from signer",{accountId:a}),n?(o.debug("Using existing InscriptionSDK instance"),r=n):i.apiKey?(o.debug("Initializing InscriptionSDK with API key"),r=new Ms({apiKey:i.apiKey,network:i.network||"mainnet"})):(o.debug("Initializing InscriptionSDK with client auth"),r=await Ms.createWithAuth({type:"client",accountId:a,signer:t,network:i.network||"mainnet"}));const s={holderId:a,metadata:i.metadata||{},tags:i.tags||[],mode:i.mode||"file",chunkSize:i.chunkSize};let c;switch(e.type){case"url":c={...s,file:{type:"url",url:e.url}};break;case"file":c={...s,file:{type:"path",path:e.path}};break;case"buffer":c={...s,file:{type:"base64",base64:globalThis.Buffer.from(e.buffer).toString("base64"),fileName:e.fileName,mimeType:e.mimeType}}}"hashinal"===i.mode&&(c.metadataObject=i.metadata,c.creator=i.metadata?.creator||a,c.description=i.metadata?.description,i.jsonFileURL&&(c.jsonFileURL=i.jsonFileURL)),o.debug("Preparing to inscribe content with signer",{type:e.type,mode:i.mode||"file",holderId:a});const p=await r.inscribe({...c,holderId:a},t);if(o.info("Inscription started",{type:e.type,mode:i.mode||"file",transactionId:p.jobId}),i.waitForConfirmation){o.debug("Waiting for inscription confirmation",{transactionId:p.jobId,maxAttempts:i.waitMaxAttempts,intervalMs:i.waitIntervalMs});const e=await Hs(r,p.jobId,i.waitMaxAttempts,i.waitIntervalMs,i.progressCallback);return o.info("Inscription confirmation received",{transactionId:p.jobId}),{confirmed:!0,result:p,inscription:e,sdk:r}}return{confirmed:!1,result:p,sdk:r}}catch(a){throw o.error("Error during inscription process",a),a}}function Ks(e,t){const i=["name","creator","description","type"].filter((t=>!e[t]));if(i.length>0){const e=new Error(`Missing required Hashinal metadata fields: ${i.join(", ")}`);throw t.error("Hashinal metadata validation failed",{missingFields:i}),e}t.debug("Hashinal metadata validation passed",{name:e.name,creator:e.creator,description:e.description,type:e.type,hasAttributes:!!e.attributes,hasProperties:!!e.properties})}async function Hs(e,t,i=30,n=4e3,o){const a=d.getInstance({module:"Inscriber"}),r=new Ds({module:"Inscriber",logger:a,callback:o});try{a.debug("Waiting for inscription confirmation",{transactionId:t,maxAttempts:i,intervalMs:n}),r.preparing("Preparing for inscription confirmation",5,{transactionId:t,maxAttempts:i,intervalMs:n});try{const o=e.waitForInscription.bind(e),a=e=>{const t=e.stage||"confirming",i=e.message||"Processing inscription",n=e.progressPercent||50;r.report({stage:t,message:i,progressPercent:n,details:{}})};return await o(t,i,n,!0,a)}catch(s){return console.log(s),a.debug("Falling back to standard waitForInscription method",{error:s}),r.verifying("Verifying inscription status",50,{error:s}),await e.waitForInscription(t,i,n,!0)}}catch(c){throw a.error("Error waiting for inscription confirmation",{transactionId:t,maxAttempts:i,intervalMs:n,error:c}),r.failed("Inscription confirmation failed",{transactionId:t,error:c}),c}}class Ws{constructor(e,t,i){this.maxRetries=5,this.initialDelayMs=2e3,this.maxDelayMs=3e4,this.backoffFactor=2,this.network=e,this.apiKey=i?.apiKey,this.customHeaders=i?.headers||{},this.baseUrl=i?.customUrl||this.getMirrorNodeUrl(),this.logger=t||new d({level:"debug",module:"MirrorNode"}),this.isServerEnvironment="undefined"==typeof window,i?.customUrl&&this.logger.info(`Using custom mirror node URL: ${i.customUrl}`),i?.apiKey&&this.logger.info("Using API key for mirror node requests")}configureRetry(e){this.maxRetries=e.maxRetries??this.maxRetries,this.initialDelayMs=e.initialDelayMs??this.initialDelayMs,this.maxDelayMs=e.maxDelayMs??this.maxDelayMs,this.backoffFactor=e.backoffFactor??this.backoffFactor,this.logger.info(`Retry configuration updated: maxRetries=${this.maxRetries}, initialDelayMs=${this.initialDelayMs}, maxDelayMs=${this.maxDelayMs}, backoffFactor=${this.backoffFactor}`)}configureMirrorNode(e){e.customUrl&&(this.baseUrl=e.customUrl,this.logger.info(`Updated mirror node URL: ${e.customUrl}`)),e.apiKey&&(this.apiKey=e.apiKey,this.logger.info("Updated API key for mirror node requests")),e.headers&&(this.customHeaders={...this.customHeaders,...e.headers},this.logger.info("Updated custom headers for mirror node requests"))}constructUrl(e){if(this.baseUrl.includes("<API-KEY>")&&this.apiKey){const t=this.baseUrl.replace("<API-KEY>",this.apiKey);return e.startsWith("/")?`${t}${e}`:`${t}/${e}`}return e.startsWith("/")?`${this.baseUrl}${e}`:`${this.baseUrl}/${e}`}getMirrorNodeUrl(){return"mainnet"===this.network?"https://mainnet-public.mirrornode.hedera.com":"https://testnet.mirrornode.hedera.com"}getBaseUrl(){return this.baseUrl}async getPublicKey(e){this.logger.info(`Getting public key for account ${e}`);const t=await this.requestAccount(e);try{if(!t||!t.key)throw new Error(`Failed to retrieve public key for account ID: ${e}`);return i.PublicKey.fromString(t.key.key)}catch(n){const e=`Error fetching public key from Mirror Node: ${n.message}`;throw this.logger.error(e),new Error(e)}}async getAccountMemo(e){this.logger.info(`Getting account memo for account ID: ${e}`);try{const t=await this._requestWithRetry(`/api/v1/accounts/${e}`);return t?.memo?t.memo:(this.logger.warn(`No memo found for account ${e}`),null)}catch(t){const i=t;return this.logger.error(`Failed to get account memo for ${e} after retries: ${i.message}`),null}}async getTopicInfo(e){try{this.logger.debug(`Fetching topic info for ${e}`);return await this._requestWithRetry(`/api/v1/topics/${e}`)}catch(t){const i=`Error retrieving topic information for ${e} after retries: ${t.message}`;throw this.logger.error(i),new Error(i)}}async getTopicFees(e){try{return(await this.getTopicInfo(e)).custom_fees}catch(t){const e=`Error retrieving topic fees: ${t.message}`;return this.logger.error(e),null}}async getHBARPrice(e){try{const t=i.Timestamp.fromDate(e).toString();this.logger.debug(`Fetching HBAR price for timestamp ${t}`);const n=await this._requestWithRetry(`/api/v1/network/exchangerate?timestamp=${t}`);return Number(n?.current_rate?.cent_equivalent)/Number(n?.current_rate?.hbar_equivalent)/100}catch(t){const e=`Error retrieving HBAR price: ${t.message}`;return this.logger.error(e),null}}async getTokenInfo(e){this.logger.debug(`Fetching token info for ${e}`);try{const t=await this._requestWithRetry(`/api/v1/tokens/${e}`);return t?(this.logger.trace(`Token info found for ${e}:`,t),t):(this.logger.warn(`No token info found for ${e}`),null)}catch(t){const i=`Error fetching token info for ${e}: ${t.message}`;return this.logger.error(i),null}}async getTopicMessages(e,t){this.logger.trace(`Querying messages for topic ${e}${t?" with filters":""}`);let i=`/api/v1/topics/${e}/messages`;const n=new URLSearchParams;if(t){if(void 0!==t.sequenceNumber){const e="number"==typeof t.sequenceNumber?t.sequenceNumber.toString():t.sequenceNumber;e.match(/^(gt|gte|lt|lte|eq|ne):/)?n.append("sequencenumber",e):n.append("sequencenumber",`gt:${e}`)}t.limit&&n.append("limit",t.limit.toString()),t.order&&n.append("order",t.order)}const o=n.toString();o&&(i+=`?${o}`);const a=[];let r=i;for(;r;)try{const e=await this._requestWithRetry(r);if(e.messages&&e.messages.length>0)for(const t of e.messages)try{if(!t.message)continue;let e,i;try{e=this.isServerEnvironment?globalThis.Buffer.from(t.message,"base64").toString("utf-8"):(new TextDecoder).decode(Uint8Array.from(atob(t.message),(e=>e.charCodeAt(0))))}catch(s){const e=`Error decoding message: ${s}`;this.logger.error(e);continue}try{i=JSON.parse(e)}catch(s){const t=`Invalid JSON message content: ${e}`;this.logger.error(t);continue}i.sequence_number=t.sequence_number,a.push({...i,consensus_timestamp:t.consensus_timestamp,sequence_number:t.sequence_number,created:new Date(1e3*Number(t.consensus_timestamp))})}catch(s){const e=`Error processing message: ${s.message}`;this.logger.error(e)}r=e.links?.next||""}catch(c){const t=`Error querying topic messages for topic ${e} (endpoint: ${r}) after retries: ${c.message}`;throw this.logger.error(t),new Error(t)}return a}async requestAccount(e){try{this.logger.debug(`Requesting account info for ${e}`);const t=await this._requestWithRetry(`/api/v1/accounts/${e}`);if(!t)throw new Error(`No data received from mirror node for account: ${e}`);return t}catch(t){const i=`Failed to fetch account ${e} after retries: ${t.message}`;throw this.logger.error(i),new Error(i)}}async checkKeyListAccess(e,t){try{const i=o.proto.Key.decode(e);return this.evaluateKeyAccess(i,t)}catch(i){const e=`Error decoding protobuf key: ${i.message}`;throw this.logger.error(e),new Error(e)}}async evaluateKeyAccess(e,t){return e.ed25519?this.compareEd25519Key(e.ed25519,t):e.keyList?this.evaluateKeyList(e.keyList,t):!(!e.thresholdKey||!e.thresholdKey.keys)&&this.evaluateKeyList(e.thresholdKey.keys,t)}async evaluateKeyList(e,t){const i=e.keys||[];for(const a of i)if(a)if(a.ed25519){if(this.compareEd25519Key(a.ed25519,t))return!0}else if(a.keyList||a.thresholdKey)try{const e=o.proto.Key.encode({...a.keyList?{keyList:a.keyList}:{},...a.thresholdKey?{thresholdKey:a.thresholdKey}:{}}).finish();if(await this.checkKeyListAccess(globalThis.Buffer.from(e),t))return!0}catch(n){const e=`Error in nested key: ${n.message}`;this.logger.debug(e)}return!1}compareEd25519Key(e,t){try{return i.PublicKey.fromBytes(globalThis.Buffer.from(e)).toString()===t.toString()}catch(n){const e=`Error comparing Ed25519 key: ${n.message}`;return this.logger.debug(e),!1}}async getScheduleInfo(e){try{this.logger.info(`Getting information for scheduled transaction ${e}`);const t=await this._requestWithRetry(`/api/v1/schedules/${e}`);return t||(this.logger.warn(`No schedule info found for ${e} after retries.`),null)}catch(t){return this.logger.error(`Error fetching schedule info for ${e} after retries: ${t.message}`),null}}async getScheduledTransactionStatus(e){try{this.logger.info(`Checking status of scheduled transaction ${e}`);const t=await this.getScheduleInfo(e);if(!t)throw new Error(`Schedule ${e} not found`);return{executed:Boolean(t.executed_timestamp),executedDate:t.executed_timestamp?new Date(1e3*Number(t.executed_timestamp)):void 0,deleted:t.deleted||!1}}catch(t){throw this.logger.error(`Error checking scheduled transaction status: ${t}`),t}}async getTransaction(e){this.logger.info(`Getting transaction details for ID/hash: ${e}`);try{const t=await this._requestWithRetry(`/api/v1/transactions/${e}`);return t?.transactions?.length>0?(this.logger.trace(`Transaction details found for ${e}:`,t.transactions[0]),t.transactions[0]):(this.logger.warn(`No transaction details found for ${e} or unexpected response structure.`),null)}catch(t){const i=t;return this.logger.error(`Failed to get transaction details for ${e} after retries: ${i.message}`),null}}async _requestWithRetry(e,t){let i=0,n=this.initialDelayMs;const o=this.constructUrl(e),r={...t,headers:{...this.customHeaders,...t?.headers}};for(this.apiKey&&(r.headers={...r.headers,Authorization:`Bearer ${this.apiKey}`,"X-API-Key":this.apiKey});i<this.maxRetries;)try{return(await a.get(o,r)).data}catch(s){i++;const e=i>=this.maxRetries,t=s.response?.status;if(t&&t>404&&t<500&&429!==t)throw this.logger.error(`Client error for ${o} (status ${t}): ${s.message}. Not retrying.`),s;if(e)throw this.logger.error(`Max retries (${this.maxRetries}) reached for ${o}. Last error: ${s.message}`),s;this.logger.warn(`Attempt ${i}/${this.maxRetries} failed for ${o}: ${s.message}. Retrying in ${n}ms...`),await new Promise((e=>setTimeout(e,n))),n=Math.min(n*this.backoffFactor,this.maxDelayMs)}throw new Error(`Failed to fetch data from ${o} after ${this.maxRetries} attempts.`)}async _fetchWithRetry(e,t){let i=0,n=this.initialDelayMs;const o={...this.customHeaders};t?.headers&&(t.headers instanceof Headers?t.headers.forEach(((e,t)=>{o[t]=e})):Array.isArray(t.headers)?t.headers.forEach((([e,t])=>{o[e]=t})):Object.assign(o,t.headers)),this.apiKey&&(o.Authorization=`Bearer ${this.apiKey}`,o["X-API-Key"]=this.apiKey);const a={...t,headers:o};for(;i<this.maxRetries;)try{const t=await fetch(e,a);if(!t.ok){if(t.status>=400&&t.status<500&&429!==t.status)throw this.logger.error(`Client error for ${e} (status ${t.status}): ${t.statusText}. Not retrying.`),new Error(`Fetch failed with status ${t.status}: ${t.statusText} for URL: ${e}`);throw new Error(`Fetch failed with status ${t.status}: ${t.statusText} for URL: ${e}`)}return await t.json()}catch(r){if(i++,i>=this.maxRetries)throw this.logger.error(`Max retries (${this.maxRetries}) reached for ${e}. Last error: ${r.message}`),r;this.logger.warn(`Attempt ${i}/${this.maxRetries} failed for ${e}: ${r.message}. Retrying in ${n}ms...`),await new Promise((e=>setTimeout(e,n))),n=Math.min(n*this.backoffFactor,this.maxDelayMs)}throw new Error(`Failed to fetch data from ${e} after ${this.maxRetries} attempts.`)}async getAccountBalance(e){this.logger.info(`Getting balance for account ${e}`);try{const t=await this.requestAccount(e);if(t&&t.balance){return t.balance.balance/1e8}return this.logger.warn(`Could not retrieve balance for account ${e} from account info.`),null}catch(t){return this.logger.error(`Error fetching numerical balance for account ${e}: ${t.message}`),null}}async getTopicMessagesByFilter(e,t){this.logger.trace(`Querying messages for topic ${e} with filters: ${JSON.stringify(t)}`);let i=`/api/v1/topics/${e}/messages`;const n=new URLSearchParams;t?.limit&&n.append("limit",t.limit.toString()),t?.sequenceNumber&&n.append("sequencenumber",t.sequenceNumber),t?.startTime&&n.append("timestamp",`gte:${t.startTime}`),t?.endTime&&n.append("timestamp",`lt:${t.endTime}`),t?.order&&n.append("order",t.order);const o=n.toString();o&&(i+=`?${o}`);const a=[];let r=0;try{for(;i&&r<10;){r++;const e=await this._requestWithRetry(i);if(e.messages&&e.messages.length>0)for(const t of e.messages)try{if(!t.message)continue;let e;e=this.isServerEnvironment?globalThis.Buffer.from(t.message,"base64").toString("utf-8"):(new TextDecoder).decode(Uint8Array.from(atob(t.message),(e=>e.charCodeAt(0))));let i={};try{i=JSON.parse(e)}catch(s){this.logger.debug(`Message content is not valid JSON, using raw: ${e}`),i={raw_content:e}}const n={...i,consensus_timestamp:t.consensus_timestamp,sequence_number:t.sequence_number,payer_account_id:t.payer_account_id,topic_id:t.topic_id,running_hash:t.running_hash,running_hash_version:t.running_hash_version,chunk_info:t.chunk_info,created:new Date(1e3*Number(t.consensus_timestamp.split(".")[0])+Number(t.consensus_timestamp.split(".")[1]||0)/1e6),payer:t.payer_account_id};a.push(n)}catch(c){this.logger.error(`Error processing individual message: ${c.message}`)}if(t?.limit&&a.length>=t.limit)break;i=e.links?.next?`${e.links.next}`:""}return a}catch(p){const t=p;return this.logger.error(`Error querying filtered topic messages for ${e}: ${t.message}`),null}}async getAccountTokens(e,t=100){this.logger.info(`Getting tokens for account ${e}`);let i=[],n=`/api/v1/accounts/${e}/tokens?limit=${t}`;try{for(let e=0;e<10&&n;e++){const e=await this._requestWithRetry(n);if(e&&e.tokens&&(i=i.concat(e.tokens)),n=e.links?.next||"",!n||t&&i.length>=t){t&&i.length>t&&(i=i.slice(0,t));break}}return i}catch(o){return this.logger.error(`Error fetching tokens for account ${e}: ${o.message}`),null}}async getTransactionByTimestamp(e){this.logger.info(`Getting transaction by timestamp: ${e}`);try{return(await this._requestWithRetry(`/api/v1/transactions?timestamp=${e}&limit=1`)).transactions}catch(t){return this.logger.error(`Error fetching transaction by timestamp ${e}: ${t}`),[]}}async getAccountNfts(e,t,i=100){this.logger.info(`Getting NFTs for account ${e}${t?` for token ${t}`:""}`);let n=[],o=`/api/v1/accounts/${e}/nfts?limit=${i}`;t&&(o+=`&token.id=${t}`);try{for(let e=0;e<10&&o;e++){const e=await this._requestWithRetry(o);if(e&&e.nfts){const t=e.nfts.map((e=>{let t;if(e.metadata)try{t=this.isServerEnvironment?globalThis.Buffer.from(e.metadata,"base64").toString("utf-8"):(new TextDecoder).decode(Uint8Array.from(atob(e.metadata),(e=>e.charCodeAt(0))))}catch(i){this.logger.warn(`Failed to decode metadata for NFT ${e.token_id} SN ${e.serial_number}: ${i.message}`)}return{...e,token_uri:t}}));n=n.concat(t)}if(o=e.links?.next||"",!o)break}return n}catch(a){return this.logger.error(`Error fetching NFTs for account ${e}: ${a.message}`),null}}async validateNFTOwnership(e,t,i){this.logger.info(`Validating ownership of NFT ${t} SN ${i} for account ${e}`);try{const n=await this.getAccountNfts(e,t);if(n){return n.find((e=>e.token_id===t&&e.serial_number===i))||null}return null}catch(n){return this.logger.error(`Error validating NFT ownership: ${n.message}`),null}}async readSmartContractQuery(e,t,n,o){this.logger.info(`Reading smart contract ${e} with selector ${t}`);const a=e.startsWith("0x")?e:`0x${i.AccountId.fromString(e).toSolidityAddress()}`,r=n.startsWith("0x")?n:`0x${i.AccountId.fromString(n).toSolidityAddress()}`,s={block:o?.block||"latest",data:t,estimate:o?.estimate||!1,from:r,to:a,gas:o?.gas,gasPrice:o?.gasPrice,value:o?.value||0};Object.keys(s).forEach((e=>{const t=e;void 0===s[t]&&delete s[t]}));try{const e=this.constructUrl("/api/v1/contracts/call");return await this._fetchWithRetry(e,{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})}catch(c){return this.logger.error(`Error reading smart contract ${e}: ${c.message}`),null}}async getOutstandingTokenAirdrops(e,t){this.logger.info(`Getting outstanding token airdrops sent by account ${e}`);let i=`/api/v1/accounts/${e}/airdrops/outstanding`;const n=new URLSearchParams;t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order),t?.receiverId&&n.append("receiver.id",t.receiverId),t?.serialNumber&&n.append("serialnumber",t.serialNumber),t?.tokenId&&n.append("token.id",t.tokenId);const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).airdrops||[]}catch(a){return this.logger.error(`Error fetching outstanding token airdrops for account ${e}: ${a.message}`),null}}async getPendingTokenAirdrops(e,t){this.logger.info(`Getting pending token airdrops received by account ${e}`);let i=`/api/v1/accounts/${e}/airdrops/pending`;const n=new URLSearchParams;t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order),t?.senderId&&n.append("sender.id",t.senderId),t?.serialNumber&&n.append("serialnumber",t.serialNumber),t?.tokenId&&n.append("token.id",t.tokenId);const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).airdrops||[]}catch(a){return this.logger.error(`Error fetching pending token airdrops for account ${e}: ${a.message}`),null}}async getBlocks(e){this.logger.info("Getting blocks from the network");let t="/api/v1/blocks";const i=new URLSearchParams;e?.limit&&i.append("limit",e.limit.toString()),e?.order&&i.append("order",e.order),e?.timestamp&&i.append("timestamp",e.timestamp),e?.blockNumber&&i.append("block.number",e.blockNumber);const n=i.toString();n&&(t+=`?${n}`);try{return(await this._requestWithRetry(t)).blocks||[]}catch(o){return this.logger.error(`Error fetching blocks: ${o.message}`),null}}async getBlock(e){this.logger.info(`Getting block ${e}`);try{return await this._requestWithRetry(`/api/v1/blocks/${e}`)}catch(t){return this.logger.error(`Error fetching block ${e}: ${t.message}`),null}}async getContracts(e){this.logger.info("Getting contracts from the network");let t="/api/v1/contracts";const i=new URLSearchParams;e?.contractId&&i.append("contract.id",e.contractId),e?.limit&&i.append("limit",e.limit.toString()),e?.order&&i.append("order",e.order);const n=i.toString();n&&(t+=`?${n}`);try{return(await this._requestWithRetry(t)).contracts||[]}catch(o){return this.logger.error(`Error fetching contracts: ${o.message}`),null}}async getContract(e,t){this.logger.info(`Getting contract ${e}`);let i=`/api/v1/contracts/${e}`;t&&(i+=`?timestamp=${t}`);try{return await this._requestWithRetry(i)}catch(n){return this.logger.error(`Error fetching contract ${e}: ${n.message}`),null}}async getContractResults(e){this.logger.info("Getting contract results from the network");let t="/api/v1/contracts/results";const i=new URLSearchParams;e?.from&&i.append("from",e.from),e?.blockHash&&i.append("block.hash",e.blockHash),e?.blockNumber&&i.append("block.number",e.blockNumber),void 0!==e?.internal&&i.append("internal",e.internal.toString()),e?.limit&&i.append("limit",e.limit.toString()),e?.order&&i.append("order",e.order),e?.timestamp&&i.append("timestamp",e.timestamp),e?.transactionIndex&&i.append("transaction.index",e.transactionIndex.toString());const n=i.toString();n&&(t+=`?${n}`);try{return(await this._requestWithRetry(t)).results||[]}catch(o){return this.logger.error(`Error fetching contract results: ${o.message}`),null}}async getContractResult(e,t){this.logger.info(`Getting contract result for ${e}`);let i=`/api/v1/contracts/results/${e}`;void 0!==t&&(i+=`?nonce=${t}`);try{return await this._requestWithRetry(i)}catch(n){return this.logger.error(`Error fetching contract result for ${e}: ${n.message}`),null}}async getContractResultsByContract(e,t){this.logger.info(`Getting contract results for contract ${e}`);let i=`/api/v1/contracts/${e}/results`;const n=new URLSearchParams;t?.blockHash&&n.append("block.hash",t.blockHash),t?.blockNumber&&n.append("block.number",t.blockNumber),t?.from&&n.append("from",t.from),void 0!==t?.internal&&n.append("internal",t.internal.toString()),t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order),t?.timestamp&&n.append("timestamp",t.timestamp),t?.transactionIndex&&n.append("transaction.index",t.transactionIndex.toString());const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).results||[]}catch(a){return this.logger.error(`Error fetching contract results for ${e}: ${a.message}`),null}}async getContractState(e,t){this.logger.info(`Getting contract state for ${e}`);let i=`/api/v1/contracts/${e}/state`;const n=new URLSearchParams;t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order),t?.slot&&n.append("slot",t.slot),t?.timestamp&&n.append("timestamp",t.timestamp);const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).state||[]}catch(a){return this.logger.error(`Error fetching contract state for ${e}: ${a.message}`),null}}async getContractActions(e,t){this.logger.info(`Getting contract actions for ${e}`);let i=`/api/v1/contracts/results/${e}/actions`;const n=new URLSearchParams;t?.index&&n.append("index",t.index),t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order);const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).actions||[]}catch(a){return this.logger.error(`Error fetching contract actions for ${e}: ${a.message}`),null}}async getContractLogs(e){this.logger.info("Getting contract logs from the network");let t="/api/v1/contracts/results/logs";const i=new URLSearchParams;e?.index&&i.append("index",e.index),e?.limit&&i.append("limit",e.limit.toString()),e?.order&&i.append("order",e.order),e?.timestamp&&i.append("timestamp",e.timestamp),e?.topic0&&i.append("topic0",e.topic0),e?.topic1&&i.append("topic1",e.topic1),e?.topic2&&i.append("topic2",e.topic2),e?.topic3&&i.append("topic3",e.topic3),e?.transactionHash&&i.append("transaction.hash",e.transactionHash);const n=i.toString();n&&(t+=`?${n}`);try{return(await this._requestWithRetry(t)).logs||[]}catch(o){return this.logger.error(`Error fetching contract logs: ${o.message}`),null}}async getContractLogsByContract(e,t){this.logger.info(`Getting contract logs for contract ${e}`);let i=`/api/v1/contracts/${e}/results/logs`;const n=new URLSearchParams;t?.index&&n.append("index",t.index),t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order),t?.timestamp&&n.append("timestamp",t.timestamp),t?.topic0&&n.append("topic0",t.topic0),t?.topic1&&n.append("topic1",t.topic1),t?.topic2&&n.append("topic2",t.topic2),t?.topic3&&n.append("topic3",t.topic3);const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).logs||[]}catch(a){return this.logger.error(`Error fetching contract logs for ${e}: ${a.message}`),null}}async getNftInfo(e,t){this.logger.info(`Getting NFT info for ${e}/${t}`);const i=`/api/v1/tokens/${e}/nfts/${t}`;try{return await this._requestWithRetry(i)}catch(n){return this.logger.error(`Error fetching NFT info for ${e}/${t}: ${n.message}`),null}}async getNftsByToken(e,t){this.logger.info(`Getting NFTs for token ${e}`);let i=`/api/v1/tokens/${e}/nfts`;const n=new URLSearchParams;t?.accountId&&n.append("account.id",t.accountId),t?.limit&&n.append("limit",t.limit.toString()),t?.order&&n.append("order",t.order),t?.serialNumber&&n.append("serialnumber",t.serialNumber);const o=n.toString();o&&(i+=`?${o}`);try{return(await this._requestWithRetry(i)).nfts||[]}catch(a){return this.logger.error(`Error fetching NFTs for token ${e}: ${a.message}`),null}}async getNetworkInfo(){this.logger.info("Getting network information");try{return await this._requestWithRetry("/api/v1/network/nodes")}catch(e){return this.logger.error(`Error fetching network info: ${e.message}`),null}}async getNetworkFees(e){this.logger.info("Getting network fees");let t="/api/v1/network/fees";e&&(t+=`?timestamp=${e}`);try{return await this._requestWithRetry(t)}catch(i){return this.logger.error(`Error fetching network fees: ${i.message}`),null}}async getNetworkSupply(e){this.logger.info("Getting network supply");let t="/api/v1/network/supply";e&&(t+=`?timestamp=${e}`);try{return await this._requestWithRetry(t)}catch(i){return this.logger.error(`Error fetching network supply: ${i.message}`),null}}async getNetworkStake(e){this.logger.info("Getting network stake");let t="/api/v1/network/stake";e&&(t+=`?timestamp=${e}`);try{return await this._requestWithRetry(t)}catch(i){return this.logger.error(`Error fetching network stake: ${i.message}`),null}}async getOpcodeTraces(e,t){this.logger.info(`Getting opcode traces for ${e}`);let i=`/api/v1/contracts/results/${e}/opcodes`;const n=new URLSearchParams;void 0!==t?.stack&&n.append("stack",t.stack.toString()),void 0!==t?.memory&&n.append("memory",t.memory.toString()),void 0!==t?.storage&&n.append("storage",t.storage.toString());const o=n.toString();o&&(i+=`?${o}`);try{return await this._requestWithRetry(i)}catch(a){return this.logger.error(`Error fetching opcode traces for ${e}: ${a.message}`),null}}}async function Vs(e,t,i){const n=new Ws(t,i),o=[];for(const r of e)try{const e=await n.getPublicKey(r);o.push(e)}catch(a){i&&i.warn(`Could not get public key for account ${r}: ${a}`)}return o}class Gs{constructor(e="info"){this.defaultEndpoint="https://kiloscribe.com/api/inscription-cdn",this.logger=d.getInstance({level:e,module:"HRLResolver"})}isBinaryContentType(e){return["image/","audio/","video/","application/octet-stream","application/pdf","application/zip","application/gzip","application/x-binary","application/vnd.ms-","application/x-msdownload","application/x-shockwave-flash","font/","application/wasm"].some((t=>e.startsWith(t)))}parseHRL(e){if(!e)return null;const t=e.match(/^hcs:\/\/(\d+)\/([0-9]+\.[0-9]+\.[0-9]+)$/);return t?{standard:t[1],topicId:t[2]}:null}isValidHRL(e){if(!e||"string"!=typeof e)return!1;const t=this.parseHRL(e);if(!t)return!1;return!!/^[0-9]+\.[0-9]+\.[0-9]+$/.test(t.topicId)}async getContentWithType(e,t){if(!this.isValidHRL(e))return{content:e,contentType:"text/plain",isBinary:!1};try{const i=await this.resolveHRL(e,t);return{content:i.content,contentType:i.contentType,isBinary:i.isBinary}}catch(i){const e=`Error resolving HRL for content and type: ${i.message}`;throw this.logger.error(e),new Error(e)}}async resolveHRL(e,t){const i=this.parseHRL(e);if(!i)throw new Error(`Invalid HRL format: ${e}`);const{standard:n,topicId:o}=i;this.logger.debug(`Resolving HRL reference: standard=${n}, topicId=${o}`);try{const e=`${t.cdnEndpoint||this.defaultEndpoint}/${o}?network=${t.network}`;this.logger.debug(`Fetching content from CDN: ${e}`);const i=(await a.head(e)).headers["content-type"]||"";if(this.isBinaryContentType(i)||t.returnRaw){return{content:(await a.get(e,{responseType:"arraybuffer"})).data,contentType:i,topicId:o,isBinary:!0}}if("application/json"===i){const t=await a.get(e,{responseType:"json"});if(!t.data)throw new Error(`Failed to fetch content from topic: ${o}`);return{content:t.data,contentType:i,topicId:o,isBinary:!1}}const n=await a.get(e);if(!n.data)throw new Error(`Failed to fetch content from topic: ${o}`);let r;return r="object"==typeof n.data?n.data.content||n.data.text||JSON.stringify(n.data):n.data,{content:r,contentType:i,topicId:o,isBinary:!1}}catch(r){const e=`Error resolving HRL reference: ${r.message}`;throw this.logger.error(e),new Error(e)}}}function Zs(e){if(e){if(e.contractID)return`ContractID: ${new i.ContractId(e.contractID.shardNum??0,e.contractID.realmNum??0,e.contractID.contractNum??0).toString()}`;if(e.ed25519)return`ED25519: ${r.Buffer.from(e.ed25519).toString("hex")}`;if(e.ECDSASecp256k1)return`ECDSA_secp256k1: ${r.Buffer.from(e.ECDSASecp256k1).toString("hex")}`;if(e?.keyList?.keys?.length>0){const t=e.keyList.keys.map((e=>Zs(e))).filter(Boolean);return`KeyList (${t.length} keys): [${t.join(", ")}]`}if(e?.thresholdKey?.keys?.keys?.length>0){const t=e.thresholdKey.keys.keys.map((e=>Zs(e))).filter(Boolean);return`ThresholdKey (${e.thresholdKey.threshold} of ${t.length}): [${t.join(", ")}]`}return e.delegatableContractId?`DelegatableContractID: ${new i.ContractId(e.delegatableContractId.shardNum??0,e.delegatableContractId.realmNum??0,e.delegatableContractId.contractNum??0).toString()}`:0===Object.keys(e).length?"Empty Key Structure":"Unknown or Unset Key Type"}}class Js{static parseTokenCreate(e){if(!e)return;const t={};return e.name&&(t.tokenName=e.name),e.symbol&&(t.tokenSymbol=e.symbol),e.treasury&&(t.treasuryAccountId=new i.AccountId(e.treasury.shardNum??0,e.treasury.realmNum??0,e.treasury.accountNum??0).toString()),e.initialSupply&&(t.initialSupply=i.Long.fromValue(e.initialSupply).toString()),void 0!==e.decimals&&null!==e.decimals&&(t.decimals=i.Long.fromValue(e.decimals).toNumber()),e.maxSupply&&(t.maxSupply=i.Long.fromValue(e.maxSupply).toString()),e.memo&&(t.memo=e.memo),null!==e.tokenType&&void 0!==e.tokenType&&(t.tokenType=o.proto.TokenType[e.tokenType]),null!==e.supplyType&&void 0!==e.supplyType&&(t.supplyType=o.proto.TokenSupplyType[e.supplyType]),t.adminKey=Zs(e.adminKey),t.kycKey=Zs(e.kycKey),t.freezeKey=Zs(e.freezeKey),t.wipeKey=Zs(e.wipeKey),t.supplyKey=Zs(e.supplyKey),t.feeScheduleKey=Zs(e.feeScheduleKey),t.pauseKey=Zs(e.pauseKey),e.autoRenewAccount&&(t.autoRenewAccount=new i.AccountId(e.autoRenewAccount.shardNum??0,e.autoRenewAccount.realmNum??0,e.autoRenewAccount.accountNum??0).toString()),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),e.customFees&&e.customFees.length>0&&(t.customFees=e.customFees.map((e=>{const t={feeCollectorAccountId:e.feeCollectorAccountId?new i.AccountId(e.feeCollectorAccountId.shardNum??0,e.feeCollectorAccountId.realmNum??0,e.feeCollectorAccountId.accountNum??0).toString():"Not Set",allCollectorsAreExempt:e.allCollectorsAreExempt||!1};if(e.fixedFee)return{...t,feeType:"FIXED_FEE",fixedFee:{amount:i.Long.fromValue(e.fixedFee.amount||0).toString(),denominatingTokenId:e.fixedFee.denominatingTokenId?new i.TokenId(e.fixedFee.denominatingTokenId.shardNum??0,e.fixedFee.denominatingTokenId.realmNum??0,e.fixedFee.denominatingTokenId.tokenNum??0).toString():void 0}};if(e.fractionalFee)return{...t,feeType:"FRACTIONAL_FEE",fractionalFee:{numerator:i.Long.fromValue(e.fractionalFee.fractionalAmount?.numerator||0).toString(),denominator:i.Long.fromValue(e.fractionalFee.fractionalAmount?.denominator||1).toString(),minimumAmount:i.Long.fromValue(e.fractionalFee.minimumAmount||0).toString(),maximumAmount:i.Long.fromValue(e.fractionalFee.maximumAmount||0).toString(),netOfTransfers:e.fractionalFee.netOfTransfers||!1}};if(e.royaltyFee){let n;return e.royaltyFee.fallbackFee&&(n={amount:i.Long.fromValue(e.royaltyFee.fallbackFee.amount||0).toString(),denominatingTokenId:e.royaltyFee.fallbackFee.denominatingTokenId?new i.TokenId(e.royaltyFee.fallbackFee.denominatingTokenId.shardNum??0,e.royaltyFee.fallbackFee.denominatingTokenId.realmNum??0,e.royaltyFee.fallbackFee.denominatingTokenId.tokenNum??0).toString():void 0}),{...t,feeType:"ROYALTY_FEE",royaltyFee:{numerator:i.Long.fromValue(e.royaltyFee.exchangeValueFraction?.numerator||0).toString(),denominator:i.Long.fromValue(e.royaltyFee.exchangeValueFraction?.denominator||1).toString(),fallbackFee:n}}}return{...t,feeType:"FIXED_FEE",fixedFee:{amount:"0"}}}))),t}static parseTokenMint(e){if(!e||!e.token||null===e.amount||void 0===e.amount)return;const t={tokenId:new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString(),amount:i.Long.fromValue(e.amount).toNumber()};return e.metadata&&e.metadata.length>0&&(t.metadata=e.metadata.map((e=>r.Buffer.from(e).toString("base64")))),t}static parseTokenBurn(e){if(!e||!e.token||null===e.amount||void 0===e.amount)return;const t={tokenId:new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString(),amount:i.Long.fromValue(e.amount).toNumber()};return e.serialNumbers&&e.serialNumbers.length>0&&(t.serialNumbers=e.serialNumbers.map((e=>i.Long.fromValue(e).toNumber()))),t}static parseTokenUpdate(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),e.name&&(t.name=e.name),e.symbol&&(t.symbol=e.symbol),e.treasury&&(t.treasuryAccountId=new i.AccountId(e.treasury.shardNum??0,e.treasury.realmNum??0,e.treasury.accountNum??0).toString()),t.adminKey=Zs(e.adminKey),t.kycKey=Zs(e.kycKey),t.freezeKey=Zs(e.freezeKey),t.wipeKey=Zs(e.wipeKey),t.supplyKey=Zs(e.supplyKey),t.feeScheduleKey=Zs(e.feeScheduleKey),t.pauseKey=Zs(e.pauseKey),e.autoRenewAccount&&(t.autoRenewAccountId=new i.AccountId(e.autoRenewAccount.shardNum??0,e.autoRenewAccount.realmNum??0,e.autoRenewAccount.accountNum??0).toString()),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),void 0!==e.memo?.value&&(t.memo=e.memo.value),e.expiry?.seconds&&(t.expiry=`${i.Long.fromValue(e.expiry.seconds).toString()}.${e.expiry.nanos}`),t}static parseTokenFeeScheduleUpdate(e){if(!e)return;const t={};return e.tokenId&&(t.tokenId=new i.TokenId(e.tokenId.shardNum??0,e.tokenId.realmNum??0,e.tokenId.tokenNum??0).toString()),e.customFees&&e.customFees.length>0&&(t.customFees=e.customFees.map((e=>{const t={feeCollectorAccountId:e.feeCollectorAccountId?new i.AccountId(e.feeCollectorAccountId.shardNum??0,e.feeCollectorAccountId.realmNum??0,e.feeCollectorAccountId.accountNum??0).toString():"Not Set",allCollectorsAreExempt:e.allCollectorsAreExempt||!1};if(e.fixedFee)return{...t,feeType:"FIXED_FEE",fixedFee:{amount:i.Long.fromValue(e.fixedFee.amount||0).toString(),denominatingTokenId:e.fixedFee.denominatingTokenId?new i.TokenId(e.fixedFee.denominatingTokenId.shardNum??0,e.fixedFee.denominatingTokenId.realmNum??0,e.fixedFee.denominatingTokenId.tokenNum??0).toString():void 0}};if(e.fractionalFee)return{...t,feeType:"FRACTIONAL_FEE",fractionalFee:{numerator:i.Long.fromValue(e.fractionalFee.fractionalAmount?.numerator||0).toString(),denominator:i.Long.fromValue(e.fractionalFee.fractionalAmount?.denominator||1).toString(),minimumAmount:i.Long.fromValue(e.fractionalFee.minimumAmount||0).toString(),maximumAmount:i.Long.fromValue(e.fractionalFee.maximumAmount||0).toString(),netOfTransfers:e.fractionalFee.netOfTransfers||!1}};if(e.royaltyFee){let n;return e.royaltyFee.fallbackFee&&(n={amount:i.Long.fromValue(e.royaltyFee.fallbackFee.amount||0).toString(),denominatingTokenId:e.royaltyFee.fallbackFee.denominatingTokenId?new i.TokenId(e.royaltyFee.fallbackFee.denominatingTokenId.shardNum??0,e.royaltyFee.fallbackFee.denominatingTokenId.realmNum??0,e.royaltyFee.fallbackFee.denominatingTokenId.tokenNum??0).toString():void 0}),{...t,feeType:"ROYALTY_FEE",royaltyFee:{numerator:i.Long.fromValue(e.royaltyFee.exchangeValueFraction?.numerator||0).toString(),denominator:i.Long.fromValue(e.royaltyFee.exchangeValueFraction?.denominator||1).toString(),fallbackFee:n}}}return{...t,feeType:"FIXED_FEE",fixedFee:{amount:"0"}}}))),t}static parseTokenFreeze(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),t}static parseTokenUnfreeze(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),t}static parseTokenGrantKyc(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),t}static parseTokenRevokeKyc(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),t}static parseTokenPause(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),t}static parseTokenUnpause(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),t}static parseTokenWipeAccount(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),e.serialNumbers&&e.serialNumbers.length>0&&(t.serialNumbers=e.serialNumbers.map((e=>i.Long.fromValue(e).toString()))),e.amount&&(t.amount=i.Long.fromValue(e.amount).toString()),t}static parseTokenDelete(e){if(!e)return;const t={};return e.token&&(t.tokenId=new i.TokenId(e.token.shardNum??0,e.token.realmNum??0,e.token.tokenNum??0).toString()),t}static parseTokenAssociate(e){if(!e)return;const t={};return e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),e.tokens&&e.tokens.length>0&&(t.tokenIds=e.tokens.map((e=>new i.TokenId(e.shardNum??0,e.realmNum??0,e.tokenNum??0).toString()))),t}static parseTokenDissociate(e){if(!e)return;const t={};return e.account&&(t.accountId=new i.AccountId(e.account.shardNum??0,e.account.realmNum??0,e.account.accountNum??0).toString()),e.tokens&&e.tokens.length>0&&(t.tokenIds=e.tokens.map((e=>new i.TokenId(e.shardNum??0,e.realmNum??0,e.tokenNum??0).toString()))),t}}class Xs{static parseConsensusCreateTopic(e){if(!e)return;const t={};return e.memo&&(t.memo=e.memo),t.adminKey=Zs(e.adminKey),t.submitKey=Zs(e.submitKey),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),e.autoRenewAccount&&(t.autoRenewAccountId=new i.AccountId(e.autoRenewAccount.shardNum??0,e.autoRenewAccount.realmNum??0,e.autoRenewAccount.accountNum??0).toString()),t}static parseConsensusSubmitMessage(e){if(!e)return;const t={};if(e.topicID&&(t.topicId=`${e.topicID.shardNum??0}.${e.topicID.realmNum??0}.${e.topicID.topicNum??0}`),e.message?.length>0){const i=r.Buffer.from(e.message),n=i.toString("utf8");/[\x00-\x08\x0B\x0E-\x1F\x7F]/.test(n)||n.includes("�")?(t.message=i.toString("base64"),t.messageEncoding="base64"):(t.message=n,t.messageEncoding="utf8")}if(e.chunkInfo){if(e.chunkInfo.initialTransactionID){const i=e.chunkInfo.initialTransactionID.accountID,n=e.chunkInfo.initialTransactionID.transactionValidStart;i&&n&&(t.chunkInfoInitialTransactionID=`${i.shardNum??0}.${i.realmNum??0}.${i.accountNum??0}@${n.seconds??0}.${n.nanos??0}`)}void 0!==e.chunkInfo.number&&null!==e.chunkInfo.number&&(t.chunkInfoNumber=e.chunkInfo.number),void 0!==e.chunkInfo.total&&null!==e.chunkInfo.total&&(t.chunkInfoTotal=e.chunkInfo.total)}return t}static parseConsensusUpdateTopic(e){if(!e)return;const t={};return e.topicID&&(t.topicId=`${e.topicID.shardNum}.${e.topicID.realmNum}.${e.topicID.topicNum}`),void 0!==e.memo?.value&&(t.memo=e.memo.value),null===e.adminKey?(t.clearAdminKey=!0,t.adminKey=void 0):e.adminKey?t.adminKey=Zs(e.adminKey):t.adminKey=void 0,null===e.submitKey?(t.clearSubmitKey=!0,t.submitKey=void 0):e.submitKey?t.submitKey=Zs(e.submitKey):t.submitKey=void 0,e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),e.autoRenewAccount&&(t.autoRenewAccountId=new i.AccountId(e.autoRenewAccount.shardNum??0,e.autoRenewAccount.realmNum??0,e.autoRenewAccount.accountNum??0).toString()),t}static parseConsensusDeleteTopic(e){if(!e)return;const t={};return e.topicID&&(t.topicId=`${e.topicID.shardNum}.${e.topicID.realmNum??0}.${e.topicID.topicNum??0}`),t}}class Ys{static parseFileCreate(e){if(!e)return;const t={};return e.expirationTime?.seconds&&(t.expirationTime=`${i.Long.fromValue(e.expirationTime.seconds).toString()}.${e.expirationTime.nanos}`),e.keys&&(t.keys=Zs({keyList:e.keys})),e.contents&&(t.contents=r.Buffer.from(e.contents).toString("base64")),e.memo&&(t.memo=e.memo),t}static parseFileAppend(e){if(!e)return;const t={};return e.fileID&&(t.fileId=`${e.fileID.shardNum??0}.${e.fileID.realmNum??0}.${e.fileID.fileNum??0}`),e.contents&&(t.contents=r.Buffer.from(e.contents).toString("base64")),t}static parseFileUpdate(e){if(!e)return;const t={};return e.fileID&&(t.fileId=`${e.fileID.shardNum??0}.${e.fileID.realmNum??0}.${e.fileID.fileNum??0}`),e.expirationTime?.seconds&&(t.expirationTime=`${i.Long.fromValue(e.expirationTime.seconds).toString()}.${e.expirationTime.nanos}`),e.keys&&(t.keys=Zs({keyList:e.keys})),e.contents&&(t.contents=r.Buffer.from(e.contents).toString("base64")),void 0!==e.memo?.value&&(t.memo=e.memo.value),t}static parseFileDelete(e){if(!e)return;const t={};return e.fileID&&(t.fileId=`${e.fileID.shardNum??0}.${e.fileID.realmNum??0}.${e.fileID.fileNum??0}`),t}}class Qs{static parseCryptoTransfers(e,t){if(e.transfers?.accountAmounts&&(t.transfers=e.transfers.accountAmounts.map((e=>{const t=new i.AccountId(e.accountID.shardNum??0,e.accountID.realmNum??0,e.accountID.accountNum??0),n=i.Hbar.fromTinybars(i.Long.fromValue(e.amount));return{accountId:t.toString(),amount:n.toString(i.HbarUnit.Hbar),isDecimal:!0}}))),e.tokenTransfers)for(const n of e.tokenTransfers){const e=new i.TokenId(n.token.shardNum??0,n.token.realmNum??0,n.token.tokenNum??0);if(n.transfers)for(const o of n.transfers){const n=new i.AccountId(o.accountID.shardNum??0,o.accountID.realmNum??0,o.accountID.accountNum??0),a=i.Long.fromValue(o.amount).toNumber();t.tokenTransfers.push({tokenId:e.toString(),accountId:n.toString(),amount:a})}}}static parseCryptoDelete(e){if(!e)return;const t={};return e.deleteAccountID&&(t.deleteAccountId=new i.AccountId(e.deleteAccountID.shardNum??0,e.deleteAccountID.realmNum??0,e.deleteAccountID.accountNum??0).toString()),e.transferAccountID&&(t.transferAccountId=new i.AccountId(e.transferAccountID.shardNum??0,e.transferAccountID.realmNum??0,e.transferAccountID.accountNum??0).toString()),t}static parseCryptoCreateAccount(e){if(!e)return;const t={};return e.initialBalance&&(t.initialBalance=i.Hbar.fromTinybars(i.Long.fromValue(e.initialBalance)).toString(i.HbarUnit.Hbar)),e.key&&(t.key=Zs(e.key)),void 0!==e.receiverSigRequired&&(t.receiverSigRequired=e.receiverSigRequired),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),e.memo&&(t.memo=e.memo),void 0!==e.maxAutomaticTokenAssociations&&(t.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations),e.stakedAccountId?t.stakedAccountId=new i.AccountId(e.stakedAccountId.shardNum??0,e.stakedAccountId.realmNum??0,e.stakedAccountId.accountNum??0).toString():null!==e.stakedNodeId&&void 0!==e.stakedNodeId&&(t.stakedNodeId=i.Long.fromValue(e.stakedNodeId).toString()),void 0!==e.declineReward&&(t.declineReward=e.declineReward),e.alias&&e.alias.length>0&&(t.alias=globalThis.Buffer.from(e.alias).toString("hex")),t}static parseCryptoUpdateAccount(e){if(!e)return;const t={};return e.accountIDToUpdate&&(t.accountIdToUpdate=new i.AccountId(e.accountIDToUpdate.shardNum??0,e.accountIDToUpdate.realmNum??0,e.accountIDToUpdate.accountNum??0).toString()),e.key&&(t.key=Zs(e.key)),e.expirationTime?.seconds&&(t.expirationTime=`${i.Long.fromValue(e.expirationTime.seconds).toString()}.${e.expirationTime.nanos}`),null!==e.receiverSigRequired&&void 0!==e.receiverSigRequired&&(t.receiverSigRequired=Boolean(e.receiverSigRequired)),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),void 0!==e.memo?.value&&(t.memo=e.memo.value),void 0!==e.maxAutomaticTokenAssociations?.value&&(t.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations.value),e.stakedAccountId?(t.stakedAccountId=new i.AccountId(e.stakedAccountId.shardNum??0,e.stakedAccountId.realmNum??0,e.stakedAccountId.accountNum??0).toString(),t.stakedNodeId=void 0):null!==e.stakedNodeId&&void 0!==e.stakedNodeId?(t.stakedNodeId=i.Long.fromValue(e.stakedNodeId).toString(),t.stakedAccountId=void 0):(t.stakedAccountId=void 0,t.stakedNodeId=void 0),null!==e.declineReward&&void 0!==e.declineReward&&(t.declineReward=Boolean(e.declineReward)),t}static parseCryptoApproveAllowance(e){if(!e)return;const t={};return e.cryptoAllowances&&e.cryptoAllowances.length>0&&(t.hbarAllowances=e.cryptoAllowances.map((e=>({ownerAccountId:new i.AccountId(e.owner.shardNum??0,e.owner.realmNum??0,e.owner.accountNum??0).toString(),spenderAccountId:new i.AccountId(e.spender.shardNum??0,e.spender.realmNum??0,e.spender.accountNum??0).toString(),amount:i.Hbar.fromTinybars(i.Long.fromValue(e.amount)).toString(i.HbarUnit.Hbar)})))),e.tokenAllowances&&e.tokenAllowances.length>0&&(t.tokenAllowances=e.tokenAllowances.map((e=>({tokenId:new i.TokenId(e.tokenId.shardNum??0,e.tokenId.realmNum??0,e.tokenId.tokenNum??0).toString(),ownerAccountId:new i.AccountId(e.owner.shardNum??0,e.owner.realmNum??0,e.owner.accountNum??0).toString(),spenderAccountId:new i.AccountId(e.spender.shardNum??0,e.spender.realmNum??0,e.spender.accountNum??0).toString(),amount:i.Long.fromValue(e.amount).toString()})))),e.nftAllowances&&e.nftAllowances.length>0&&(t.nftAllowances=e.nftAllowances.map((e=>{const t={};return e.tokenId&&(t.tokenId=new i.TokenId(e.tokenId.shardNum??0,e.tokenId.realmNum??0,e.tokenId.tokenNum??0).toString()),e.owner&&(t.ownerAccountId=new i.AccountId(e.owner.shardNum??0,e.owner.realmNum??0,e.owner.accountNum??0).toString()),e.spender&&(t.spenderAccountId=new i.AccountId(e.spender.shardNum??0,e.spender.realmNum??0,e.spender.accountNum??0).toString()),e.serialNumbers&&e.serialNumbers.length>0&&(t.serialNumbers=e.serialNumbers.map((e=>i.Long.fromValue(e).toString()))),void 0!==e.approvedForAll?.value&&(t.approvedForAll=e.approvedForAll.value),e.delegatingSpender&&(t.delegatingSpender=new i.AccountId(e.delegatingSpender.shardNum??0,e.delegatingSpender.realmNum??0,e.delegatingSpender.accountNum??0).toString()),t}))),t}static parseCryptoDeleteAllowance(e){if(!e)return;const t={};return e.nftAllowances&&e.nftAllowances.length>0&&(t.nftAllowancesToRemove=e.nftAllowances.map((e=>({ownerAccountId:new i.AccountId(e.owner.shardNum??0,e.owner.realmNum??0,e.owner.accountNum??0).toString(),tokenId:new i.TokenId(e.tokenId.shardNum??0,e.tokenId.realmNum??0,e.tokenId.tokenNum??0).toString(),serialNumbers:e.serialNumbers?e.serialNumbers.map((e=>i.Long.fromValue(e).toString())):[]})))),t}}class ec{static parseContractCall(e){if(!e)return;const t=i.Hbar.fromTinybars(i.Long.fromValue(e.amount??0)),n={contractId:new i.ContractId(e.contractID.shardNum??0,e.contractID.realmNum??0,e.contractID.contractNum??0).toString(),gas:i.Long.fromValue(e.gas??0).toNumber(),amount:parseFloat(t.toString(i.HbarUnit.Hbar))};return e.functionParameters&&(n.functionParameters=r.Buffer.from(e.functionParameters).toString("hex"),n.functionParameters.length>=8&&(n.functionName=n.functionParameters.substring(0,8))),n}static parseContractCreate(e){if(!e)return;const t={};return e.initialBalance&&(t.initialBalance=i.Hbar.fromTinybars(i.Long.fromValue(e.initialBalance)).toString(i.HbarUnit.Hbar)),e.gas&&(t.gas=i.Long.fromValue(e.gas).toString()),e.adminKey&&(t.adminKey=Zs(e.adminKey)),e.constructorParameters&&(t.constructorParameters=r.Buffer.from(e.constructorParameters).toString("hex")),e.memo&&(t.memo=e.memo),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),e.stakedAccountId?t.stakedAccountId=new i.AccountId(e.stakedAccountId.shardNum??0,e.stakedAccountId.realmNum??0,e.stakedAccountId.accountNum??0).toString():null!==e.stakedNodeId&&void 0!==e.stakedNodeId&&(t.stakedNodeId=i.Long.fromValue(e.stakedNodeId).toString()),void 0!==e.declineReward&&(t.declineReward=e.declineReward),void 0!==e.maxAutomaticTokenAssociations&&(t.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations),e.fileID?(t.initcodeSource="fileID",t.initcode=new i.FileId(e.fileID.shardNum??0,e.fileID.realmNum??0,e.fileID.fileNum??0).toString()):e.initcode&&e.initcode.length>0&&(t.initcodeSource="bytes",t.initcode=r.Buffer.from(e.initcode).toString("hex")),t}static parseContractUpdate(e){if(!e)return;const t={};if(e.contractID&&(t.contractIdToUpdate=new i.ContractId(e.contractID.shardNum??0,e.contractID.realmNum??0,e.contractID.contractNum??0).toString()),e.adminKey&&(t.adminKey=Zs(e.adminKey)),e.expirationTime?.seconds&&(t.expirationTime=`${i.Long.fromValue(e.expirationTime.seconds).toString()}.${e.expirationTime.nanos}`),e.autoRenewPeriod?.seconds&&(t.autoRenewPeriod=i.Long.fromValue(e.autoRenewPeriod.seconds).toString()),e.memo){const i=e.memo;if(i&&"object"==typeof i&&i.hasOwnProperty("value")){const e=i.value;t.memo=null==e?void 0:String(e)}else t.memo="string"==typeof i?i:void 0}else t.memo=void 0;return e.stakedAccountId?(t.stakedAccountId=new i.AccountId(e.stakedAccountId.shardNum??0,e.stakedAccountId.realmNum??0,e.stakedAccountId.accountNum??0).toString(),t.stakedNodeId=void 0):null!==e.stakedNodeId&&void 0!==e.stakedNodeId&&i.Long.fromValue(e.stakedNodeId).notEquals(-1)?(t.stakedNodeId=i.Long.fromValue(e.stakedNodeId).toString(),t.stakedAccountId=void 0):(t.stakedNodeId=void 0,t.stakedAccountId=void 0),void 0!==e.declineReward?.value&&(t.declineReward=e.declineReward.value),void 0!==e.maxAutomaticTokenAssociations?.value&&(t.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations.value),e.autoRenewAccountId&&(t.autoRenewAccountId=new i.AccountId(e.autoRenewAccountId.shardNum??0,e.autoRenewAccountId.realmNum??0,e.autoRenewAccountId.accountNum??0).toString()),t}static parseContractDelete(e){if(!e)return;const t={};return e.contractID&&(t.contractIdToDelete=new i.ContractId(e.contractID.shardNum??0,e.contractID.realmNum??0,e.contractID.contractNum??0).toString()),e.transferAccountID?t.transferAccountId=new i.AccountId(e.transferAccountID.shardNum??0,e.transferAccountID.realmNum??0,e.transferAccountID.accountNum??0).toString():e.transferContractID&&(t.transferContractId=new i.ContractId(e.transferContractID.shardNum??0,e.transferContractID.realmNum??0,e.transferContractID.contractNum??0).toString()),t}}class tc{static parseUtilPrng(e){if(!e)return;const t={};return e.range&&0!==e.range&&(t.range=e.range),t}}function ic(e){let t="ed25519";e.startsWith("0x")?t="ecdsa":e.startsWith("302e020100300506032b6570")?t="ed25519":e.startsWith("3030020100300706052b8104000a")?t="ecdsa":96===e.length?t="ed25519":88===e.length&&(t="ecdsa");try{return{detectedType:t,privateKey:"ecdsa"===t?i.PrivateKey.fromStringECDSA(e):i.PrivateKey.fromStringED25519(e)}}catch(n){const a="ecdsa"===t?"ed25519":"ecdsa";try{return{detectedType:a,privateKey:"ecdsa"===a?i.PrivateKey.fromStringECDSA(e):i.PrivateKey.fromStringED25519(e)}}catch(o){throw new Error(`Failed to parse private key as either ED25519 or ECDSA: ${n}`)}}}var nc=(e=>(e[e.PERSONAL=0]="PERSONAL",e[e.AI_AGENT=1]="AI_AGENT",e[e.MCP_SERVER=2]="MCP_SERVER",e))(nc||{}),oc=(e=>(e[e.MANUAL=0]="MANUAL",e[e.AUTONOMOUS=1]="AUTONOMOUS",e))(oc||{}),ac=(e=>(e[e.REST=0]="REST",e[e.WEBSOCKET=1]="WEBSOCKET",e[e.GRPC=2]="GRPC",e))(ac||{}),rc=(e=>(e[e.TEXT_GENERATION=0]="TEXT_GENERATION",e[e.IMAGE_GENERATION=1]="IMAGE_GENERATION",e[e.AUDIO_GENERATION=2]="AUDIO_GENERATION",e[e.VIDEO_GENERATION=3]="VIDEO_GENERATION",e[e.CODE_GENERATION=4]="CODE_GENERATION",e[e.LANGUAGE_TRANSLATION=5]="LANGUAGE_TRANSLATION",e[e.SUMMARIZATION_EXTRACTION=6]="SUMMARIZATION_EXTRACTION",e[e.KNOWLEDGE_RETRIEVAL=7]="KNOWLEDGE_RETRIEVAL",e[e.DATA_INTEGRATION=8]="DATA_INTEGRATION",e[e.MARKET_INTELLIGENCE=9]="MARKET_INTELLIGENCE",e[e.TRANSACTION_ANALYTICS=10]="TRANSACTION_ANALYTICS",e[e.SMART_CONTRACT_AUDIT=11]="SMART_CONTRACT_AUDIT",e[e.GOVERNANCE_FACILITATION=12]="GOVERNANCE_FACILITATION",e[e.SECURITY_MONITORING=13]="SECURITY_MONITORING",e[e.COMPLIANCE_ANALYSIS=14]="COMPLIANCE_ANALYSIS",e[e.FRAUD_DETECTION=15]="FRAUD_DETECTION",e[e.MULTI_AGENT_COORDINATION=16]="MULTI_AGENT_COORDINATION",e[e.API_INTEGRATION=17]="API_INTEGRATION",e[e.WORKFLOW_AUTOMATION=18]="WORKFLOW_AUTOMATION",e))(rc||{}),sc=(e=>(e[e.RESOURCE_PROVIDER=0]="RESOURCE_PROVIDER",e[e.TOOL_PROVIDER=1]="TOOL_PROVIDER",e[e.PROMPT_TEMPLATE_PROVIDER=2]="PROMPT_TEMPLATE_PROVIDER",e[e.LOCAL_FILE_ACCESS=3]="LOCAL_FILE_ACCESS",e[e.DATABASE_INTEGRATION=4]="DATABASE_INTEGRATION",e[e.API_INTEGRATION=5]="API_INTEGRATION",e[e.WEB_ACCESS=6]="WEB_ACCESS",e[e.KNOWLEDGE_BASE=7]="KNOWLEDGE_BASE",e[e.MEMORY_PERSISTENCE=8]="MEMORY_PERSISTENCE",e[e.CODE_ANALYSIS=9]="CODE_ANALYSIS",e[e.CONTENT_GENERATION=10]="CONTENT_GENERATION",e[e.COMMUNICATION=11]="COMMUNICATION",e[e.DOCUMENT_PROCESSING=12]="DOCUMENT_PROCESSING",e[e.CALENDAR_SCHEDULE=13]="CALENDAR_SCHEDULE",e[e.SEARCH=14]="SEARCH",e[e.ASSISTANT_ORCHESTRATION=15]="ASSISTANT_ORCHESTRATION",e))(sc||{}),cc=(e=>(e.DNS="dns",e.SIGNATURE="signature",e.CHALLENGE="challenge",e))(cc||{}),pc=(e=>(e.PUBLIC="PUBLIC",e.CONTROLLED="CONTROLLED",e.FEE_BASED="FEE_BASED",e))(pc||{});const lc={text_generation:0,image_generation:1,audio_generation:2,video_generation:3,code_generation:4,language_translation:5,summarization:6,extraction:6,knowledge_retrieval:7,data_integration:8,data_visualization:8,market_intelligence:9,transaction_analytics:10,smart_contract_audit:11,governance:12,security_monitoring:13,compliance_analysis:14,fraud_detection:15,multi_agent:16,api_integration:17,workflow_automation:18},uc=c.z.object({platform:c.z.string().min(1),handle:c.z.string().min(1)}),dc=c.z.object({type:c.z.nativeEnum(oc),capabilities:c.z.array(c.z.nativeEnum(rc)).min(1),model:c.z.string().min(1),creator:c.z.string().optional()}),mc=c.z.object({url:c.z.string().min(1),transport:c.z.enum(["stdio","sse"])}),fc=c.z.object({type:c.z.nativeEnum(cc),value:c.z.string(),dns_field:c.z.string().optional(),challenge_path:c.z.string().optional()}),hc=c.z.object({minVersion:c.z.string().optional()}),gc=c.z.object({name:c.z.string().min(1),description:c.z.string().min(1)}),bc=c.z.object({name:c.z.string().min(1),description:c.z.string().min(1)}),xc=c.z.object({version:c.z.string().min(1),connectionInfo:mc,services:c.z.array(c.z.nativeEnum(sc)).min(1),description:c.z.string().min(1),verification:fc.optional(),host:hc.optional(),capabilities:c.z.array(c.z.string()).optional(),resources:c.z.array(gc).optional(),tools:c.z.array(bc).optional(),maintainer:c.z.string().optional(),repository:c.z.string().optional(),docs:c.z.string().optional()}),vc=c.z.object({version:c.z.string().min(1),type:c.z.nativeEnum(nc),display_name:c.z.string().min(1),alias:c.z.string().optional(),bio:c.z.string().optional(),socials:c.z.array(uc).optional(),profileImage:c.z.string().optional(),properties:c.z.record(c.z.any()).optional(),inboundTopicId:c.z.string().optional(),outboundTopicId:c.z.string().optional()}),yc=vc.extend({type:c.z.literal(nc.PERSONAL),language:c.z.string().optional(),timezone:c.z.string().optional()}),wc=vc.extend({type:c.z.literal(nc.AI_AGENT),aiAgent:dc}),kc=vc.extend({type:c.z.literal(nc.MCP_SERVER),mcpServer:xc}),Ic=c.z.union([yc,wc,kc]);class Tc{constructor(e){if(this.client="mainnet"===e.network?i.Client.forMainnet():i.Client.forTestnet(),this.auth=e.auth,this.network=e.network,this.operatorId=e.auth.operatorId,this.logger=d.getInstance({level:e.logLevel||"info",module:"HCS-11",silent:e.silent}),this.mirrorNode=new Ws(this.network,this.logger),this.auth.privateKey)if(e.keyType)this.keyType=e.keyType,this.initializeOperatorWithKeyType();else{try{const e=ic(this.auth.privateKey);this.keyType=e.detectedType,this.client.setOperator(this.operatorId,e.privateKey)}catch(t){this.logger.warn("Failed to detect key type from private key format, will query mirror node"),this.keyType="ed25519"}this.initializeOperator()}}getClient(){return this.client}getOperatorId(){return this.auth.operatorId}async initializeOperator(){const e=await this.mirrorNode.requestAccount(this.operatorId),t=e?.key?._type;t&&t.includes("ECDSA")?this.keyType="ecdsa":(t&&t.includes("ED25519"),this.keyType="ed25519"),this.initializeOperatorWithKeyType()}initializeOperatorWithKeyType(){if(!this.auth.privateKey)return;const e="ecdsa"===this.keyType?i.PrivateKey.fromStringECDSA(this.auth.privateKey):i.PrivateKey.fromStringED25519(this.auth.privateKey);this.client.setOperator(this.operatorId,e)}createPersonalProfile(e,t){return{version:"1.0",type:nc.PERSONAL,display_name:e,alias:t?.alias,bio:t?.bio,socials:t?.socials,profileImage:t?.profileImage,properties:t?.properties,inboundTopicId:t?.inboundTopicId,outboundTopicId:t?.outboundTopicId}}createAIAgentProfile(e,t,i,n,o){const a=this.validateProfile({version:"1.0",type:nc.AI_AGENT,display_name:e,alias:o?.alias,bio:o?.bio,socials:o?.socials,profileImage:o?.profileImage,properties:o?.properties,inboundTopicId:o?.inboundTopicId,outboundTopicId:o?.outboundTopicId,aiAgent:{type:t,capabilities:i,model:n,creator:o?.creator}});if(!a.valid)throw new Error(`Invalid AI Agent Profile: ${a.errors.join(", ")}`);return{version:"1.0",type:nc.AI_AGENT,display_name:e,alias:o?.alias,bio:o?.bio,socials:o?.socials,profileImage:o?.profileImage,properties:o?.properties,inboundTopicId:o?.inboundTopicId,outboundTopicId:o?.outboundTopicId,aiAgent:{type:t,capabilities:i,model:n,creator:o?.creator}}}createMCPServerProfile(e,t,i){const n=this.validateProfile({version:"1.0",type:nc.MCP_SERVER,display_name:e,alias:i?.alias,bio:i?.bio,socials:i?.socials,profileImage:i?.profileImage,properties:i?.properties,inboundTopicId:i?.inboundTopicId,outboundTopicId:i?.outboundTopicId,mcpServer:t});if(!n.valid)throw new Error(`Invalid MCP Server Profile: ${n.errors.join(", ")}`);return{version:"1.0",type:nc.MCP_SERVER,display_name:e,alias:i?.alias,bio:i?.bio,socials:i?.socials,profileImage:i?.profileImage,properties:i?.properties,inboundTopicId:i?.inboundTopicId,outboundTopicId:i?.outboundTopicId,mcpServer:t}}validateProfile(e){const t=Ic.safeParse(e);if(t.success)return{valid:!0,errors:[]};return{valid:!1,errors:t.error.errors.map((e=>{const t=e.path.join(".");let i=e.message;if("invalid_type"===e.code)i=`Expected ${e.expected}, got ${e.received}`;else if("invalid_enum_value"===e.code){const t=e.options?.join(", ");i=`Invalid value. Valid options are: ${t}`}else"too_small"===e.code&&"string"===e.type&&(i="Cannot be empty");return`${t}: ${i}`}))}}profileToJSONString(e){return JSON.stringify(e)}parseProfileFromString(e){try{const t=JSON.parse(e),i=this.validateProfile(t);return i.valid?t:(this.logger.error("Invalid profile format:",i.errors),null)}catch(t){return this.logger.error("Error parsing profile:"),null}}setProfileForAccountMemo(e,t=1){return`hcs-11:hcs://${t}/${e}`}async executeTransaction(e){try{if(this.auth.privateKey){const t=await e.signWithOperator(this.client),n=await t.execute(this.client),o=await n.getReceipt(this.client);return o.status.toString()!==i.Status.Success.toString()?{success:!1,error:`Transaction failed: ${o.status.toString()}`}:{success:!0,result:o}}if(!this.auth.signer)throw new Error("No valid authentication method provided");const t=this.auth.signer,n=await e.freezeWithSigner(t),o=await n.executeWithSigner(t),a=await o.getReceiptWithSigner(t);return a.status.toString()!==i.Status.Success.toString()?{success:!1,error:`Transaction failed: ${a.status.toString()}: ${i.Status.Success.toString()}`}:{success:!0,result:a}}catch(t){return{success:!1,error:t instanceof Error?t.message:"Unknown error during transaction execution"}}}async inscribeImage(e,t,i){try{const n=i?.progressCallback,o=new Ds({module:"HCS11-Image",logger:this.logger,callback:n});o.preparing("Preparing to inscribe image",0);const a=u.lookup(t)||"application/octet-stream",r=i?.waitForConfirmation??!0;let s;if(this.auth.signer){if(!("accountId"in this.auth.signer))throw o.failed("Signer must be a DAppSigner for inscription"),new Error("Signer must be a DAppSigner for inscription");o.preparing("Using signer for inscription",10),s=await qs({type:"buffer",buffer:e,fileName:t,mimeType:a},this.auth.signer,{network:this.network,waitForConfirmation:r,waitMaxAttempts:150,waitIntervalMs:4e3,logging:{level:"debug"},progressCallback:e=>{const t=10+.8*(e.progressPercent||0);o.report({stage:e.stage,message:e.message,progressPercent:t,details:e.details})}})}else{if(!this.auth.privateKey)throw o.failed("Private key is required for inscription"),this.logger.error("Private key is required for inscription"),new Error("Private key is required for inscription");o.preparing("Using private key for inscription",10),s=await zs({type:"buffer",buffer:e,fileName:t,mimeType:a},{accountId:this.auth.operatorId,privateKey:this.auth.privateKey,network:this.network},{waitForConfirmation:r,waitMaxAttempts:150,waitIntervalMs:2e3,logging:{level:"debug"},progressCallback:e=>{const t=10+.8*(e.progressPercent||0);o.report({stage:e.stage,message:e.message,progressPercent:t,details:e.details})}})}return s.confirmed?(o.completed("Image inscription completed",{topic_id:s.inscription.topic_id}),{imageTopicId:s.inscription.topic_id||"",transactionId:s.result.jobId,success:!0}):(o.verifying("Waiting for inscription confirmation",50,{jobId:s.result.jobId}),{imageTopicId:"",transactionId:s.result.jobId,success:!1,error:"Inscription not confirmed"})}catch(n){return this.logger.error("Error inscribing image:",n),{imageTopicId:"",transactionId:"",success:!1,error:n.message||"Error inscribing image"}}}async inscribeProfile(e,t){this.logger.info("Inscribing HCS-11 profile");const n=t?.progressCallback,o=new Ds({module:"HCS11-Profile",logger:this.logger,callback:n});o.preparing("Validating profile data",5);const a=this.validateProfile(e);if(!a.valid)return o.failed(`Invalid profile: ${a.errors.join(", ")}`),{profileTopicId:"",transactionId:"",success:!1,error:`Invalid profile: ${a.errors.join(", ")}`};o.preparing("Formatting profile for inscription",15);const r=this.profileToJSONString(e),s=`profile-${e.display_name.toLowerCase().replace(/\s+/g,"-")}.json`;try{const e=globalThis.Buffer.from(r,"utf-8"),t="application/json";o.preparing("Preparing profile for inscription",20);const n={type:"buffer",buffer:e,fileName:s,mimeType:t},a={waitForConfirmation:!0,mode:"file",network:this.network,waitMaxAttempts:100,waitIntervalMs:2e3,progressCallback:e=>{const t=20+.75*Number(e?.progressPercent||0);o?.report({stage:e.stage,message:e.message,progressPercent:t,details:e.details})}};o.submitting("Submitting profile to Hedera network",30);const c="ed25519"===this.keyType?i.PrivateKey.fromStringED25519(this.auth.privateKey):i.PrivateKey.fromStringECDSA(this.auth.privateKey),p=this.auth.privateKey?await zs(n,{accountId:this.auth.operatorId,privateKey:c,network:this.network},a):await qs(n,this.auth.signer,a);if(!p.confirmed||!p.inscription.topic_id)return o.failed("Failed to inscribe profile content"),{profileTopicId:"",transactionId:"",success:!1,error:"Failed to inscribe profile content"};const l=p.inscription.topic_id;return o.completed("Profile inscription completed",{topicId:l,transactionId:p.result.transactionId}),{profileTopicId:l,transactionId:p.result.transactionId,success:!0}}catch(c){return o.failed(`Error inscribing profile: ${c.message||"Unknown error"}`),{profileTopicId:"",transactionId:"",success:!1,error:c.message||"Unknown error during inscription"}}}async updateAccountMemoWithProfile(e,t){try{this.logger.info(`Updating account memo for ${e} with profile ${t}`);const n=this.setProfileForAccountMemo(t),o=(new i.AccountUpdateTransaction).setAccountMemo(n).setAccountId(e);return this.executeTransaction(o)}catch(n){return this.logger.error(`Error updating account memo: ${n instanceof Error?n.message:"Unknown error"}`),{success:!1,error:n instanceof Error?n.message:"Unknown error updating account memo"}}}async createAndInscribeProfile(e,t=!0,i){const n=i?.progressCallback,o=new Ds({module:"HCS11-ProfileCreation",logger:this.logger,callback:n});o.preparing("Starting profile creation process",0);const a=o.createSubProgress({minPercent:0,maxPercent:80,logPrefix:"Inscription"}),r=await this.inscribeProfile(e,{...i,progressCallback:e=>{a.report({stage:e.stage,message:e.message,progressPercent:e.progressPercent,details:e.details})}});if(!r?.success)return o.failed("Profile inscription failed",{error:r?.error}),r;if(o.confirming("Profile inscribed, updating account memo",85),t){const e=await this.updateAccountMemoWithProfile(this.auth.operatorId,r.profileTopicId);if(!e.success)return o.failed("Failed to update account memo",{error:e?.error}),{...r,success:!1,error:e?.error}}return o.completed("Profile creation completed successfully",{profileTopicId:r.profileTopicId,transactionId:r.transactionId}),r}async getCapabilitiesFromTags(e){const t=[];if(0===e.length)return[rc.TEXT_GENERATION];for(const i of e){const e=lc[i.toLowerCase()];void 0===e||t.includes(e)||t.push(e)}return 0===t.length&&t.push(rc.TEXT_GENERATION),t}getAgentTypeFromMetadata(e){return"autonomous"===e.type?oc.AUTONOMOUS:oc.MANUAL}async fetchProfileByAccountId(e,t){try{this.logger.info(`Fetching profile for account ${e.toString()} on ${this.network}`);const n=await this.mirrorNode.getAccountMemo(e.toString());if(this.logger.info(`Got account memo: ${n}`),!n?.startsWith("hcs-11:"))return{success:!1,error:`Account ${e.toString()} does not have a valid HCS-11 memo`};this.logger.info(`Found HCS-11 memo: ${n}`);const o=n.substring(7);if(!o?.startsWith("hcs://")){if(o.startsWith("ipfs://")){this.logger.warn("IPFS protocol references are not fully supported");const e=await fetch(`https://ipfs.io/ipfs/${o.replace("ipfs://","")}`),t=await e.json();return{success:!0,profile:t,topicInfo:{inboundTopic:t.inboundTopicId,outboundTopic:t.outboundTopicId,profileTopicId:t.profileTopicId}}}if(o.startsWith("ar://")){const e=o.replace("ar://",""),t=await fetch(`https://arweave.net/${e}`);if(!t.ok)return{success:!1,error:`Failed to fetch profile from Arweave ${e}: ${t.statusText}`};const i=await t.json();return{success:!0,profile:i,topicInfo:{inboundTopic:i.inboundTopicId,outboundTopic:i.outboundTopicId,profileTopicId:i.profileTopicId}}}return{success:!1,error:`Invalid protocol reference format: ${o}`}}{const e=o.match(/hcs:\/\/(\d+)\/(.+)/);if(!e)return{success:!1,error:`Invalid HCS protocol reference format: ${o}`};const[n,a,r]=e,s=t||this.network||"mainnet";this.logger.info(`Retrieving profile from Kiloscribe CDN: ${r}`);const c=`https://kiloscribe.com/api/inscription-cdn/${r}?network=${s}`;try{const e=await fetch(c);if(!e.ok)return{success:!1,error:`Failed to fetch profile from Kiloscribe CDN: ${e.statusText}`};const t=await e.json();return t?{success:!0,profile:t,topicInfo:{inboundTopic:t.inboundTopicId,outboundTopic:t.outboundTopicId,profileTopicId:r}}:{success:!1,error:`No profile data found for topic ${r}`}}catch(i){return this.logger.error(`Error retrieving from Kiloscribe CDN: ${i.message}`),{success:!1,error:`Error retrieving from Kiloscribe CDN: ${i.message}`}}}}catch(n){return this.logger.error(`Error fetching profile: ${n.message}`),{success:!1,error:`Error fetching profile: ${n.message}`}}}}const Sc=e=>new Promise((t=>setTimeout(t,e)));class Ac{async checkRegistrationStatus(e,t,i,n){try{const o=await fetch(`${i}/api/request-confirm`,{method:"POST",headers:{"Content-Type":"application/json","X-Network":t},body:JSON.stringify({transaction_id:e})});if(!o.ok){const e=`Failed to confirm registration: ${o.statusText}`;throw n&&n.error(e),new Error(e)}return await o.json()}catch(o){throw n&&n.error(`Error checking registration status: ${o.message}`),o}}async waitForRegistrationConfirmation(e,t,i,n=60,o=2e3,a){let r=0;for(;r<n;){a&&a.info(`Checking registration status. Attempt ${r+1}/${n}`);const s=await this.checkRegistrationStatus(e,t,i,a);if("success"===s.status)return a&&a.info("Registration confirmed successfully"),!0;if("failed"===s.status)throw a&&a.error("Registration confirmation failed"),new Error("Registration confirmation failed");a&&a.info(`Registration still pending. Waiting ${o}ms before next attempt`),await new Promise((e=>setTimeout(e,o))),r++}return a&&a.warn(`Registration not confirmed after ${n} attempts`),!1}async executeRegistration(e,t="mainnet",i="https://moonscape.tech",n){try{n&&n.info("Registering agent with guarded registry");try{const i=new Tc({network:t,auth:{operatorId:"0.0.0"}});n?.info(`Fetching profile by account ID ${e} on ${t}`),await Sc(5e3);const o=await i.fetchProfileByAccountId(e,t);if(n?.info("Profile fetched",o),o?.error)return n?.error("Error fetching profile",o.error),{error:o.error,success:!1};if(!o?.success||!o?.profile)return n&&n.error("Profile not found for agent registration"),{error:"Profile not found for the provided account ID",success:!1};if(!o.profile.inboundTopicId)return n&&n.error("Missing inbound topic ID in profile"),{error:"Profile is missing required inbound topic ID",success:!1};if(!o.profile.outboundTopicId)return n&&n.error("Missing outbound topic ID in profile"),{error:"Profile is missing required outbound topic ID",success:!1};n&&n.info(`Profile validation successful. Inbound topic: ${o.profile.inboundTopicId}, Outbound topic: ${o.profile.outboundTopicId}`)}catch(o){return n&&n.error(`Error validating profile: ${o.message}`),{error:`Error validating profile: ${o.message}`,success:!1}}const a=await fetch(`${i}/api/request-register`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"*/*","Accept-Language":"en;q=0.5",Origin:i,Referer:`${i}/`,"X-Network":t},body:JSON.stringify({accountId:e})}),r=await a.json();return a.ok?(n&&n.info(`Created new registration request. Transaction ID: ${r.transaction_id}`),{transactionId:r.transaction_id,transaction:r.transaction,success:!0}):r.details?.length>0?{validationErrors:r.details,error:r.error||"Validation failed",success:!1}:{error:r.error||"Failed to register agent",success:!1}}catch(a){return{error:`Error during registration request: ${a.message}`,success:!1}}}async findRegistrations(e={},t="https://moonscape.tech"){try{const i=new URLSearchParams;e.tags?.forEach((e=>i.append("tags",e.toString()))),e.accountId&&i.append("accountId",e.accountId),e.network&&i.append("network",e.network);const n=await fetch(`${t}/api/registrations?${i}`,{headers:{Accept:"*/*","Accept-Language":"en;q=0.5",Origin:t,Referer:`${t}/`}});if(!n.ok){return{registrations:[],error:await n.text()||"Failed to fetch registrations",success:!1}}const o=await n.json();return o.error?{registrations:[],error:o.error,success:!1}:{registrations:o.registrations||[],success:!0}}catch(i){return{registrations:[],error:`Error fetching registrations: ${i.message}`,success:!1}}}}var Ec=(e=>(e.INBOUND="inbound",e.OUTBOUND="outbound",e.CONNECTION="connection",e.REGISTRY="registry",e))(Ec||{});class _c extends Ac{constructor(e){super(),this.network=e.network,this.logger=d.getInstance({level:e.logLevel||"info",module:"HCS10-BaseClient",prettyPrint:e.prettyPrint,silent:e.silent}),this.mirrorNode=new Ws(e.network,this.logger,e.mirrorNode),this.feeAmount=e.feeAmount||.001}configureMirrorNode(e){this.mirrorNode.configureMirrorNode(e),this.logger.info("Mirror node configuration updated")}extractTopicFromOperatorId(e){if(!e)return"";const t=e.split("@");return t.length>0?t[0]:""}extractAccountFromOperatorId(e){if(!e)return"";const t=e.split("@");return t.length>1?t[1]:""}async getMessageStream(e,t){try{const i=await this.mirrorNode.getTopicMessages(e,t),n=["message","close_connection","transaction"];return{messages:i.filter((e=>{if("hcs-10"!==e.p||!n.includes(e.op))return!1;if("message"===e.op||"close_connection"===e.op){if(!e.operator_id)return!1;if(!this.isValidOperatorId(e.operator_id))return!1;if("message"===e.op&&!e.data)return!1}if("transaction"===e.op){if(!e.operator_id||!e.schedule_id)return!1;if(!this.isValidOperatorId(e.operator_id))return!1}return!0}))}}catch(i){return this.logger&&this.logger.error(`Error fetching messages: ${i.message}`),{messages:[]}}}async getPublicTopicInfo(e){try{return await this.mirrorNode.getTopicInfo(e)}catch(t){return this.logger.error(`Error getting public topic info for ${e}:`,t),null}}async canSubmitToTopic(e,t){try{const o=await this.mirrorNode.getTopicInfo(e);if(!o)return{canSubmit:!1,requiresFee:!1,reason:"Topic does not exist"};if(!o.submit_key?.key)return{canSubmit:!0,requiresFee:!1};try{const e=await this.mirrorNode.getPublicKey(t);if("ProtobufEncoded"===o.submit_key._type){const t=globalThis.Buffer.from(o.submit_key.key,"hex");if(await this.mirrorNode.checkKeyListAccess(t,e))return{canSubmit:!0,requiresFee:!1}}else{const t=i.PublicKey.fromString(o.submit_key.key);if(e.toString()===t.toString())return{canSubmit:!0,requiresFee:!1}}}catch(n){this.logger.error(`Key validation error: ${n instanceof Error?n.message:String(n)}`)}return o.fee_schedule_key?.key&&o.custom_fees?.fixed_fees?.length>0?{canSubmit:!0,requiresFee:!0,reason:"Requires fee payment via HIP-991"}:{canSubmit:!1,requiresFee:!1,reason:"User does not have submit permission for this topic"}}catch(n){const e=n instanceof Error?n.message:String(n);return this.logger.error(`Topic submission validation error: ${e}`),{canSubmit:!1,requiresFee:!1,reason:`Error: ${e}`}}}async getMessages(e,t){try{const i=await this.mirrorNode.getTopicMessages(e,t);return{messages:i.filter((e=>{if("hcs-10"!==e.p)return!1;if("message"===e.op){if(!e.data)return!1;if(e.operator_id&&!this.isValidOperatorId(e.operator_id))return!1}return!0}))}}catch(i){return this.logger&&this.logger.error(`Error fetching messages: ${i.message}`),{messages:[]}}}async requestAccount(e){try{if(!e)throw new Error("Account ID is required");return await this.mirrorNode.requestAccount(e)}catch(t){throw this.logger.error("Failed to fetch account",t),t}}async getAccountMemo(e){return await this.mirrorNode.getAccountMemo(e)}async retrieveProfile(e,t){this.logger.debug(`Retrieving profile for account: ${e}`);const i=`${e}-${this.network}`;if(!t){const t=Cc.getInstance().get(i);if(t)return this.logger.debug(`Cache hit for profile: ${e}`),t}try{const t=new Tc({network:this.network,auth:{operatorId:"0.0.0"},logLevel:"info"}),n=await t.fetchProfileByAccountId(e,this.network);if(!n?.success)return this.logger.error(`Failed to retrieve profile for account ID: ${e}`,n?.error),{profile:null,success:!1,error:n?.error||`Failed to retrieve profile for account ID: ${e}`};const o=n.profile;let a=null;n.topicInfo?.inboundTopic&&n.topicInfo?.outboundTopic&&n.topicInfo?.profileTopicId&&(a={inboundTopic:n.topicInfo.inboundTopic,outboundTopic:n.topicInfo.outboundTopic,profileTopicId:n.topicInfo.profileTopicId});const r={profile:o,topicInfo:a,success:!0};return Cc.getInstance().set(i,r),r}catch(n){const e=`Failed to retrieve profile: ${n.message}`;return this.logger.error(e),{profile:null,success:!1,error:e}}}async retrieveOutboundConnectTopic(e){return await this.retrieveCommunicationTopics(e,!0)}async retrieveCommunicationTopics(e,t){try{const i=await this.retrieveProfile(e,t);if(!i?.success)throw new Error(i.error||"Failed to retrieve profile");const n=i.profile;if(!n.inboundTopicId||!n.outboundTopicId)throw new Error("Invalid HCS-11 profile for HCS-10 agent: missing inboundTopicId or outboundTopicId");if(!i.topicInfo)throw new Error(`TopicInfo is missing in the profile for account ${e}`);return i.topicInfo}catch(i){const e=i,t=`Failed to retrieve topic info: ${e.message}`;throw this.logger.error(t),e}}async retrieveOutboundMessages(e,t){try{const i=await this.retrieveCommunicationTopics(e);if(!i)return this.logger.warn(`No outbound connect topic found for agentAccountId: ${e}`),[];return(await this.getMessages(i.outboundTopic,t)).messages.filter((e=>"hcs-10"===e.p&&("connection_request"===e.op||"connection_created"===e.op||"message"===e.op)))}catch(i){const e=`Failed to retrieve outbound messages: ${i.message}`;return this.logger.error(e),[]}}async hasConnectionCreated(e,t){try{const i=await this.retrieveCommunicationTopics(e);return(await this.retrieveOutboundMessages(i.outboundTopic)).some((e=>"connection_created"===e.op&&e.connection_id===t))}catch(i){const e=`Failed to check connection created: ${i.message}`;return this.logger.error(e),!1}}async getMessageContent(e,t=!1){if(!e.match(/^hcs:\/\/(\d+)\/([0-9]+\.[0-9]+\.[0-9]+)$/))return e;try{const i=new Gs(this.logger.getLevel());if(!i.isValidHRL(e))return e;return(await i.resolveHRL(e,{network:this.network,returnRaw:t})).content}catch(i){const e=`Error resolving HRL reference: ${i.message}`;throw this.logger.error(e),new Error(e)}}async getMessageContentWithType(e,t=!1){if(!e.match(/^hcs:\/\/(\d+)\/([0-9]+\.[0-9]+\.[0-9]+)$/))return{content:e,contentType:"text/plain",isBinary:!1};try{const i=new Gs(this.logger.getLevel());return await i.getContentWithType(e,{network:this.network,returnRaw:t})}catch(i){const e=`Error resolving HRL reference with type: ${i.message}`;throw this.logger.error(e),new Error(e)}}async submitConnectionRequest(e,t){const i=this.getAccountAndSigner();if(!i?.accountId)throw new Error("Operator account ID is not set");const n=await this.getOperatorId(),o=i.accountId,a=await this.canSubmitToTopic(e,o);if(!a?.canSubmit)throw new Error(`Cannot submit to topic: ${a.reason}`);const r=await this.retrieveInboundAccountId(e);if(!r)throw new Error("Failed to retrieve topic info account ID");const s={p:"hcs-10",op:"connection_request",operator_id:n,m:t},c=a.requiresFee,p=await this.submitPayload(e,s,void 0,c);this.logger.info(`Submitted connection request to topic ID: ${e}`);const l=await this.retrieveCommunicationTopics(o);if(!l)throw new Error("Failed to retrieve outbound topic");const u=p.topicSequenceNumber?.toNumber();if(!u)throw new Error("Failed to get response sequence number");const d=`${e}@${r}`;return await this.submitPayload(l.outboundTopic,{...s,outbound_topic_id:l.outboundTopic,connection_request_id:u,operator_id:d}),p}async recordOutboundConnectionConfirmation({outboundTopicId:e,requestorOutboundTopicId:t,connectionRequestId:i,confirmedRequestId:n,connectionTopicId:o,operatorId:a,memo:r}){const s={p:"hcs-10",op:"connection_created",connection_topic_id:o,outbound_topic_id:e,requestor_outbound_topic_id:t,confirmed_request_id:n,connection_request_id:i,operator_id:a,m:r};return await this.submitPayload(e,s)}async waitForConnectionConfirmation(e,t,i=60,n=2e3,o=!0){this.logger.info(`Waiting for connection confirmation on inbound topic ${e} for request ID ${t}`);for(let a=0;a<i;a++){this.logger.info(`Attempt ${a+1}/${i} to find connection confirmation`);const r=(await this.mirrorNode.getTopicMessages(e,{order:"desc",limit:100})).filter((e=>"connection_created"===e.op));if(this.logger.info(`Found ${r.length} connection_created messages`),r.length>0)for(const e of r)if(Number(e.connection_id)===Number(t)){const i={connectionTopicId:e.connection_topic_id,sequence_number:Number(e.sequence_number),confirmedBy:e.operator_id,memo:e.m},n=this.extractAccountFromOperatorId(i.confirmedBy),a=this.getAccountAndSigner(),r=await this.retrieveCommunicationTopics(n),s=await this.retrieveCommunicationTopics(a.accountId);return this.logger.info("Connection confirmation found",i),o&&await this.recordOutboundConnectionConfirmation({requestorOutboundTopicId:r.outboundTopic,outboundTopicId:s.outboundTopic,connectionRequestId:t,confirmedRequestId:i.sequence_number,connectionTopicId:i.connectionTopicId,operatorId:i.confirmedBy,memo:i.memo||"Connection confirmed"}),i}a<i-1&&(this.logger.info(`No matching confirmation found, waiting ${n}ms before retrying...`),await new Promise((e=>setTimeout(e,n))))}throw new Error(`Connection confirmation not found after ${i} attempts for request ID ${t}`)}async getOperatorId(e){if(this.operatorId&&!e)return this.operatorId;const t=this.getAccountAndSigner();if(!t.accountId)throw new Error("Operator ID not found");const i=await this.retrieveProfile(t.accountId);if(!i.success)throw new Error("Failed to retrieve profile");const n=`${i.topicInfo?.inboundTopic}@${t.accountId}`;return this.operatorId=n,n}async retrieveInboundAccountId(e){const t=await this.mirrorNode.getTopicInfo(e);if(!t?.memo)throw new Error("Failed to retrieve topic info");const i=t.memo.toString().split(":"),n=i?.[4];if(!n)throw new Error("Failed to retrieve topic info account ID");return n}clearCache(){Cc.getInstance().clear()}_generateHcs10Memo(e,t){const i=t.ttl??60;switch(e){case"inbound":if(!t.accountId)throw new Error("accountId is required for inbound memo");return`hcs-10:0:${i}:0:${t.accountId}`;case"outbound":return`hcs-10:0:${i}:1`;case"connection":if(!t.inboundTopicId||void 0===t.connectionId)throw new Error("inboundTopicId and connectionId are required for connection memo");return`hcs-10:1:${i}:2:${t.inboundTopicId}:${t.connectionId}`;default:throw new Error(`Invalid HCS-10 memo type: ${e}`)}}async getTopicMemoType(e){try{const t=await this.mirrorNode.getTopicInfo(e);if(!t?.memo)return this.logger.debug(`No memo found for topic ${e}`),null;const i=t.memo.toString();if(!i.startsWith("hcs-10:"))return this.logger.debug(`Topic ${e} is not an HCS-10 topic`),null;const n=i.split(":");if(n.length<4)return this.logger.warn(`Invalid HCS-10 memo format for topic ${e}: ${i}`),null;const o=n[3];switch(o){case"0":return"inbound";case"1":return"outbound";case"2":return"connection";case"3":return"registry";default:return this.logger.warn(`Unknown HCS-10 type enum: ${o} for topic ${e}`),null}}catch(t){return this.logger.error(`Error getting topic memo type for ${e}:`,t),null}}async checkRegistrationStatus(e,t,i){try{const n=await fetch(`${i}/api/request-confirm`,{method:"POST",headers:{"Content-Type":"application/json","X-Network":t},body:JSON.stringify({transaction_id:e})});if(!n.ok)throw new Error(`Failed to confirm registration: ${n.statusText}`);return await n.json()}catch(n){const e=n,t=`Error checking registration status: ${e.message}`;throw this.logger.error(t),e}}isValidOperatorId(e){if(!e)return!1;const t=e.split("@");if(2!==t.length)return!1;const i=t[0],n=t[1];if(!i)return!1;if(!n)return!1;const o=/^[0-9]+\.[0-9]+\.[0-9]+$/;return!!o.test(n)&&!!o.test(i)}async getTransactionRequests(e,t){this.logger.debug(`Retrieving transaction requests from topic ${e}`);const{messages:i}=await this.getMessageStream(e,{limit:t?.limit,sequenceNumber:t?.sequenceNumber,order:t?.order||"desc"}),n=i.filter((e=>"transaction"===e.op&&e.schedule_id)).map((e=>({operator_id:e.operator_id||"",schedule_id:e.schedule_id||"",data:e.data||"",memo:e.m,sequence_number:Number(e.sequence_number)}))).sort(((e,t)=>e.sequence_number&&t.sequence_number?t.sequence_number-e.sequence_number:0));return t?.limit?n.slice(0,t.limit):n}getHcs10TransactionMemo(e){if("object"!=typeof e||!("op"in e))return null;const t=e;let i,n;switch(t.op){case"register":i="0",n="0";break;case"delete":i="1",n="0";break;case"migrate":i="2",n="0";break;case"connection_request":i="3",n=t.outbound_topic_id?"2":"1";break;case"connection_created":i="4",n=t.outbound_topic_id?"2":"1";break;case"connection_closed":i="5",n=t.outbound_topic_id?"2":"3";break;case"message":case"transaction":default:i="6",n="3";break;case"close_connection":i="5",n="3"}return`hcs-10:op:${i}:${n}`}}class Cc{constructor(){this.CACHE_TTL=36e5,this.cache=new Map,this.cacheExpiry=new Map}static getInstance(){return Cc.instance||(Cc.instance=new Cc),Cc.instance}set(e,t){this.cache.set(e,t),this.cacheExpiry.set(e,Date.now()+this.CACHE_TTL)}get(e){const t=this.cacheExpiry.get(e);if(t&&t>Date.now())return this.cache.get(e);t&&(this.cache.delete(e),this.cacheExpiry.delete(e))}clear(){this.cache.clear(),this.cacheExpiry.clear()}}class Rc extends Error{constructor(e,t){super(e),this.payloadSize=t,this.name="PayloadSizeError"}}class Nc extends Error{constructor(e){super(e),this.name="AccountCreationError"}}class Pc extends Error{constructor(e){super(e),this.name="TopicCreationError"}}class Oc extends Error{constructor(e){super(e),this.name="ConnectionConfirmationError"}}class $c{constructor(){this.config={},this.logger=d.getInstance({module:"AgentBuilder"})}setName(e){return this.config.name=e,this}setAlias(e){return this.config.alias=e,this}setBio(e){return this.config.bio=e,this}setDescription(e){return this.config.bio=e,this}setCapabilities(e){return this.config.capabilities=e,this}setAgentType(e){return this.config.metadata?this.config.metadata.type=e:this.config.metadata={type:e},this}setType(e){return this.config.metadata?this.config.metadata.type=e:this.config.metadata={type:e},this}setModel(e){return this.config.metadata||(this.config.metadata={type:"manual"}),this.config.metadata.model=e,this}setCreator(e){return this.config.metadata||(this.config.metadata={type:"manual"}),this.config.metadata.creator=e,this}addSocial(e,t){return this.config.metadata||(this.config.metadata={type:"manual"}),this.config.metadata.socials||(this.config.metadata.socials={}),this.config.metadata.socials[e]=t,this}addProperty(e,t){return this.config.metadata||(this.config.metadata={type:"manual"}),this.config.metadata.properties||(this.config.metadata.properties={}),this.config.metadata.properties[e]=t,this}setMetadata(e){return this.config.metadata=e,this}setProfilePicture(e,t){return this.config.pfpBuffer=e,this.config.pfpFileName=t,this}setExistingProfilePicture(e){return this.config.existingPfpTopicId=e,this}setNetwork(e){return this.config.network=e,this}setInboundTopicType(e){return this.config.inboundTopicType=e,this}setFeeConfig(e){return this.config.feeConfig=e,this}setConnectionFeeConfig(e){return this.config.connectionFeeConfig=e,this}setExistingAccount(e,t){return this.config.existingAccount={accountId:e,privateKey:t},this}build(){if(!this.config.name)throw new Error("Agent display name is required");if(this.config.bio||this.logger?.warn("Agent description is not set"),this.config.pfpBuffer||this.config.existingPfpTopicId||this.logger.warn("No profile picture provided or referenced."),!this.config.network)throw new Error("Network is required");if(this.config.inboundTopicType||(this.config.inboundTopicType=pc.PUBLIC),this.config.capabilities||(this.config.capabilities=[]),this.config.metadata?this.config.metadata.type||(this.config.metadata.type="manual"):this.config.metadata={type:"manual"},this.config.inboundTopicType===pc.FEE_BASED&&!this.config.feeConfig)throw new Error("Fee configuration is required for fee-based topics");return this.config}}class jc extends _c{constructor(e){if(super({network:e.network,logLevel:e.logLevel,prettyPrint:e.prettyPrint,feeAmount:e.feeAmount,mirrorNode:e.mirrorNode,silent:e.silent,keyType:e.keyType}),this.client="mainnet"===e.network?i.Client.forMainnet():i.Client.forTestnet(),this.operatorPrivateKey=e.operatorPrivateKey,this.operatorAccountId=e.operatorId,e.keyType){this.keyType=e.keyType;const t="ecdsa"===this.keyType?i.PrivateKey.fromStringECDSA(this.operatorPrivateKey):i.PrivateKey.fromStringED25519(this.operatorPrivateKey);this.client.setOperator(e.operatorId,t)}else{try{const t=ic(this.operatorPrivateKey);this.client.setOperator(e.operatorId,t.privateKey),this.keyType=t.detectedType}catch(t){this.logger.warn("Failed to detect key type from private key format, will query mirror node"),this.keyType="ed25519"}this.initializeOperator()}this.network=e.network,this.logger=d.getInstance({level:e.logLevel||"info",module:"HCS-SDK",silent:e.silent}),this.guardedRegistryBaseUrl=e.guardedRegistryBaseUrl||"https://moonscape.tech",this.hcs11Client=new Tc({network:e.network,auth:{operatorId:e.operatorId,privateKey:e.operatorPrivateKey},logLevel:e.logLevel,silent:e.silent,keyType:e.keyType})}async initializeOperator(){const e=await this.requestAccount(this.operatorAccountId),t=e?.key?._type;t.includes("ECDSA")?this.keyType="ecdsa":(t.includes("ED25519"),this.keyType="ed25519");const n="ecdsa"===this.keyType?i.PrivateKey.fromStringECDSA(this.operatorPrivateKey):i.PrivateKey.fromStringED25519(this.operatorPrivateKey);return this.logger.debug(`Setting operator: ${this.operatorAccountId} with key type: ${this.keyType}`),this.client.setOperator(this.operatorAccountId,n),{accountId:this.operatorAccountId,privateKey:this.operatorPrivateKey,keyType:this.keyType,client:this.client}}getClient(){return this.client}async createAccount(e=50){this.keyType||await this.initializeOperator(),this.logger.info(`Creating new account with ${e} HBAR initial balance`);const t=i.PrivateKey.generateED25519(),n=(new i.AccountCreateTransaction).setKeyWithoutAlias(t.publicKey).setInitialBalance(new i.Hbar(e));this.logger.debug("Executing account creation transaction");const o=await n.execute(this.client),a=(await o.getReceipt(this.client)).accountId;if(!a)throw this.logger.error("Account creation failed: accountId is null"),new Nc("Failed to create account: accountId is null");return this.logger.info(`Account created successfully: ${a.toString()}`),{accountId:a.toString(),privateKey:t.toString()}}async createInboundTopic(e,t,i=60,n){this.keyType||await this.initializeOperator();const o=this._generateHcs10Memo(Ec.INBOUND,{accountId:e,ttl:i});let a,r;switch(t){case pc.PUBLIC:a=!1;break;case pc.CONTROLLED:a=!0;break;case pc.FEE_BASED:if(a=!1,!n)throw new Error("Fee configuration builder is required for fee-based topics");n.customFees.forEach((t=>{t.feeCollectorAccountId||(this.logger.debug(`Defaulting fee collector for token ${t.feeTokenId||"HBAR"} to agent ${e}`),t.feeCollectorAccountId=e)})),r=n.build();break;default:throw new Error(`Unsupported inbound topic type: ${t}`)}return this.createTopic(o,!0,a,r)}async createAgent(e,t=60,i,n){this.keyType||await this.initializeOperator();const o=e.build(),a=this.client.operatorAccountId?.toString();if(!a)throw new Error("Failed to retrieve operator account ID");const r=await this._createEntityTopics(t,{outboundTopicId:i?.outboundTopicId||"",inboundTopicId:i?.inboundTopicId||"",pfpTopicId:i?.pfpTopicId||o.existingPfpTopicId||"",profileTopicId:i?.profileTopicId||""},a,o.inboundTopicType,o.feeConfig,o.pfpBuffer,o.pfpFileName,n);if(r.profileTopicId)this.logger.info(`Using existing profile topic ID: ${r.profileTopicId}`);else{n&&n({stage:"preparing",message:"Creating agent profile",progressPercent:60,details:{outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,state:{currentStage:"profile",completedPercentage:60}}});const e=await this.storeHCS11Profile(o.name,o.bio,r.inboundTopicId,r.outboundTopicId,o.capabilities,o.metadata,o.pfpBuffer&&o.pfpBuffer.length>0&&!r.pfpTopicId?o.pfpBuffer:void 0,o.pfpFileName,r.pfpTopicId);r.profileTopicId=e.profileTopicId,this.logger.info(`Profile stored with topic ID: ${r.profileTopicId}`),n&&n({stage:"preparing",message:"Agent profile created",progressPercent:70,details:{outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,profileTopicId:r.profileTopicId,state:{currentStage:"profile",completedPercentage:70}}})}return r}async inscribePfp(e,t){try{this.logger.info("Inscribing profile picture using HCS-11 client");const i=await this.hcs11Client.inscribeImage(e,t);if(!i.success)throw this.logger.error(`Failed to inscribe profile picture: ${i.error}`),new Error(i?.error||"Failed to inscribe profile picture");return this.logger.info(`Successfully inscribed profile picture with topic ID: ${i.imageTopicId}`),{pfpTopicId:i.imageTopicId,transactionId:i.transactionId,success:!0}}catch(i){const e=i,t=`Error inscribing profile picture: ${e.message}`;return this.logger.error(t),{pfpTopicId:"",transactionId:"",success:!1,error:e.message}}}async storeHCS11Profile(e,t,i,n,o=[],a,r,s,c){try{let p=c||"";if(!p&&r&&s){this.logger.info("Inscribing profile picture for HCS-11 profile");const e=await this.inscribePfp(r,s);e.success?p=e.pfpTopicId:this.logger.warn(`Failed to inscribe profile picture: ${e.error}, proceeding without pfp`)}else c&&(this.logger.info(`Using existing profile picture with topic ID: ${c} for HCS-11 profile`),p=c);const l=this.hcs11Client.getAgentTypeFromMetadata({type:a.type||"autonomous"}),u=a.socials?Object.entries(a.socials).filter((([e,t])=>t)).map((([e,t])=>({platform:e,handle:t}))):void 0,d=this.hcs11Client.createAIAgentProfile(e,l,o,a.model||"unknown",{alias:e.toLowerCase().replace(/\s+/g,"_"),bio:t,profileImage:p?`hcs://1/${p}`:void 0,socials:u,properties:a.properties,inboundTopicId:i,outboundTopicId:n,creator:a.creator}),m=await this.hcs11Client.createAndInscribeProfile(d,!0);if(!m.success)throw this.logger.error(`Failed to inscribe profile: ${m.error}`),new Error(m.error||"Failed to inscribe profile");return this.logger.info(`Profile inscribed with topic ID: ${m.profileTopicId}, transaction ID: ${m.transactionId}`),{profileTopicId:m.profileTopicId,pfpTopicId:p,transactionId:m.transactionId,success:!0}}catch(p){const e=p,t=`Error storing HCS-11 profile: ${e.message}`;return this.logger.error(t),{profileTopicId:"",pfpTopicId:"",transactionId:"",success:!1,error:e.message}}}async setupFees(e,t,n=[]){let o=e;if(!this.client.operatorPublicKey)return o;if(!t.customFees||0===t.customFees.length)return this.logger.warn("No custom fees provided in fee config for setupFees"),o;t.customFees.length>10&&(this.logger.warn("More than 10 custom fees provided, only the first 10 will be used"),t.customFees=t.customFees.slice(0,10));const a=t.customFees.map((e=>{if(!e.feeCollectorAccountId)return this.logger.error("Internal Error: Fee collector ID missing in setupFees"),null;if("FIXED_FEE"===e.type){const t=(new i.CustomFixedFee).setAmount(Number(e.feeAmount.amount)).setFeeCollectorAccountId(i.AccountId.fromString(e.feeCollectorAccountId));return e.feeTokenId&&t.setDenominatingTokenId(i.TokenId.fromString(e.feeTokenId)),t}return null})).filter(Boolean);if(0===a.length)return this.logger.warn("No valid custom fees to apply in setupFees"),o;const r=[...t.exemptAccounts||[],...n];return r.length>0&&(o=await this.setupExemptKeys(e,r)),o.setFeeScheduleKey(this.client.operatorPublicKey).setCustomFees(a)}async setupExemptKeys(e,t){let i=e;const n=Array.from(new Set(t)).filter((e=>e!==this.client.operatorAccountId?.toString()));let o=[];if(n.length>0)try{o=await Vs(n,this.network,this.logger)}catch(a){const e=`Error getting exempt keys: ${a.message}, continuing without exempt keys`;this.logger.warn(e)}return o.length>0&&(i=i.setFeeExemptKeys(o)),i}async handleConnectionRequest(e,t,n,o,a=60){const r=this._generateHcs10Memo(Ec.CONNECTION,{ttl:a,inboundTopicId:e,connectionId:n});this.logger.info(`Handling connection request ${n} from ${t}`);const s=this.getClient().operatorAccountId?.toString();if(!s)throw new Error("Failed to retrieve operator account ID");let c=await this.mirrorNode.getPublicKey(t);const p=await this.mirrorNode.getPublicKey(s);if(!p)throw new Error("Failed to retrieve public key");const l=new i.KeyList([p,c],1);let u;try{if(o){const e=o.build(),t={...e,exemptAccounts:[...e.exemptAccounts||[]]};u=await this.createTopic(r,l,l,t)}else u=await this.createTopic(r,l,l);this.logger.info(`Created new connection topic ID: ${u}`)}catch(b){const e=`Failed to create connection topic: ${b}`;throw this.logger.error(e),new Pc(e)}const d=`${e}@${s}`,m=await this.confirmConnection(e,u,t,n,"Connection accepted. Looking forward to collaborating!"),f=await this.retrieveCommunicationTopics(s),h=await this.retrieveCommunicationTopics(t),g=`${h.inboundTopic}@${t}`;return await this.recordOutboundConnectionConfirmation({outboundTopicId:f.outboundTopic,requestorOutboundTopicId:h.outboundTopic,connectionRequestId:n,confirmedRequestId:m,connectionTopicId:u,operatorId:g,memo:`Connection established with ${t}`}),{connectionTopicId:u,confirmedConnectionSequenceNumber:m,operatorId:d}}async confirmConnection(e,t,i,n,o,a){const r=await this.getOperatorId();this.logger.info(`Confirming connection with ID ${n}`);const s={p:"hcs-10",op:"connection_created",connection_topic_id:t,connected_account_id:i,operator_id:r,connection_id:n,m:o},c=await this.canSubmitToTopic(e,this.client.operatorAccountId?.toString()||""),p=await this.submitPayload(e,s,a,c.requiresFee),l=p.topicSequenceNumber?.toNumber();if(!l)throw new Oc("Failed to confirm connection: sequence number is null");return l}async sendMessage(e,t,i,n,o){const a=await this.canSubmitToTopic(e,this.client.operatorAccountId?.toString()||""),r={p:"hcs-10",op:"message",operator_id:await this.getOperatorId(),data:t,m:i},s=JSON.stringify(r);if(globalThis.Buffer.from(s).length>1e3){this.logger.info("Message payload exceeds 1000 bytes, storing via inscription");try{const e=globalThis.Buffer.from(t),i=`message-${Date.now()}.json`,n=await this.inscribeFile(e,i,{progressCallback:o?.progressCallback,waitMaxAttempts:o?.waitMaxAttempts,waitIntervalMs:o?.waitIntervalMs});if(!n?.topic_id)throw new Error("Failed to inscribe large message content");r.data=`hcs://1/${n.topic_id}`,this.logger.info(`Large message inscribed with topic ID: ${n.topic_id}`)}catch(c){const e=`Error inscribing large message: ${c.message}`;throw this.logger.error(e),new Error(e)}}return this.logger.info("Submitting message to connection topic",r),await this.submitPayload(e,r,n,a.requiresFee)}async createTopic(e,t,n,o){this.logger.info("Creating topic");const a=(new i.TopicCreateTransaction).setTopicMemo(e);t&&("boolean"==typeof t&&t&&this.client.operatorPublicKey?(a.setAdminKey(this.client.operatorPublicKey),a.setAutoRenewAccountId(this.client.operatorAccountId)):(t instanceof i.PublicKey||t instanceof i.KeyList)&&(a.setAdminKey(t),this.client.operatorAccountId&&a.setAutoRenewAccountId(this.client.operatorAccountId))),n&&("boolean"==typeof n&&n&&this.client.operatorPublicKey?a.setSubmitKey(this.client.operatorPublicKey):(n instanceof i.PublicKey||n instanceof i.KeyList)&&a.setSubmitKey(n)),o&&await this.setupFees(a,o),this.logger.debug("Executing topic creation transaction");const r=await a.execute(this.client),s=await r.getReceipt(this.client);if(!s.topicId)throw this.logger.error("Failed to create topic: topicId is null"),new Error("Failed to create topic: topicId is null");return s.topicId.toString()}async submitPayload(e,t,n,o=!1){const a="string"==typeof t?t:JSON.stringify(t),r=globalThis.Buffer.byteLength(a,"utf8");if(r>1e3)throw new Rc("Payload size exceeds 1000 bytes limit",r);const s=(new i.TopicMessageSubmitTransaction).setTopicId(i.TopicId.fromString(e)).setMessage(a),c=this.getHcs10TransactionMemo(t);let p;if(c&&s.setTransactionMemo(c),o&&(this.logger.info("Topic requires fee payment, setting max transaction fee"),s.setMaxTransactionFee(new i.Hbar(this.feeAmount))),n){const e=s.freezeWith(this.client),t=await e.sign(n);p=await t.execute(this.client)}else p=await s.execute(this.client);const l=await p.getReceipt(this.client);if(!l)throw this.logger.error("Failed to submit message: receipt is null"),new Error("Failed to submit message: receipt is null");return this.logger.info("Message submitted successfully"),l}async inscribeFile(e,t,i){if(this.logger.info("Inscribing file"),!this.client.operatorAccountId)throw this.logger.error("Operator account ID is not set"),new Error("Operator account ID is not set");if(!this.operatorPrivateKey)throw this.logger.error("Operator private key is not set"),new Error("Operator private key is not set");const n=u.lookup(t)||"application/octet-stream",o=await Ms.createWithAuth({type:"server",accountId:this.client.operatorAccountId.toString(),privateKey:this.operatorPrivateKey.toString(),network:this.network}),a={mode:"file",waitForConfirmation:!0,waitMaxAttempts:i?.waitMaxAttempts||30,waitIntervalMs:i?.waitIntervalMs||4e3,progressCallback:i?.progressCallback,logging:{level:this.logger.getLevel?this.logger.getLevel():"info"}},r=await zs({type:"buffer",buffer:e,fileName:t,mimeType:n},{accountId:this.client.operatorAccountId.toString(),privateKey:this.operatorPrivateKey.toString(),network:this.network},a,o);if(!r.confirmed||!r.inscription)throw new Error("Inscription was not confirmed");return r.inscription}async waitForConnectionConfirmation(e,t,i=60,n=2e3,o=!0){this.logger.info(`Waiting for connection confirmation on inbound topic ${e} for request ID ${t}`);for(let a=0;a<i;a++){this.logger.info(`Attempt ${a+1}/${i} to find connection confirmation`);const r=(await this.mirrorNode.getTopicMessages(e)).filter((e=>"connection_created"===e.op));if(this.logger.info(`Found ${r.length} connection_created messages`),r.length>0)for(const e of r)if(Number(e.connection_id)===Number(t)){const i={connectionTopicId:e.connection_topic_id,sequence_number:Number(e.sequence_number),confirmedBy:e.operator_id,memo:e.m},n=this.extractAccountFromOperatorId(i.confirmedBy),a=this.getAccountAndSigner(),r=await this.retrieveCommunicationTopics(n),s=await this.retrieveCommunicationTopics(a.accountId);return this.logger.info("Connection confirmation found",i),o&&await this.recordOutboundConnectionConfirmation({requestorOutboundTopicId:r.outboundTopic,outboundTopicId:s.outboundTopic,connectionRequestId:t,confirmedRequestId:i.sequence_number,connectionTopicId:i.connectionTopicId,operatorId:i.confirmedBy,memo:i.memo||"Connection confirmed"}),i}a<i-1&&(this.logger.info(`No matching confirmation found, waiting ${n}ms before retrying...`),await new Promise((e=>setTimeout(e,n))))}throw new Error(`Connection confirmation not found after ${i} attempts for request ID ${t}`)}getAccountAndSigner(){const e="ecdsa"===this.keyType?i.PrivateKey.fromStringECDSA(this.operatorPrivateKey):i.PrivateKey.fromStringED25519(this.operatorPrivateKey);return{accountId:this.client.operatorAccountId.toString(),signer:e}}async createAndRegisterAgent(e,t){try{const n=e.build(),o=t?.progressCallback,a=t?.baseUrl||this.guardedRegistryBaseUrl;let r=t?.existingState||{currentStage:"init",completedPercentage:0,createdResources:[]};r.agentMetadata=n.metadata,o&&o({stage:"preparing",message:"Starting agent creation process",progressPercent:0,details:{state:r}});let s,c=n.existingAccount;if(r.inboundTopicId&&r.outboundTopicId&&r.profileTopicId){if(c=c||n.existingAccount,!c)throw new Error("Cannot resume registration without account information");s=new jc({network:n.network,operatorId:c.accountId,operatorPrivateKey:c.privateKey,operatorPublicKey:i.PrivateKey.fromString(c.privateKey).publicKey.toString(),logLevel:"info",guardedRegistryBaseUrl:a}),this.logger.info("Resuming registration with existing state",{inboundTopicId:r.inboundTopicId,outboundTopicId:r.outboundTopicId,profileTopicId:r.profileTopicId,pfpTopicId:r.pfpTopicId})}else{if(!c)if(r.createdResources&&r.createdResources.some((e=>e.startsWith("account:")))){const e=r.createdResources.find((e=>e.startsWith("account:"))),i=e?.split(":")[1];i&&n.existingAccount?(c=n.existingAccount,this.logger.info(`Resuming with existing account: ${i}`)):(c=await this.createAccount(t?.initialBalance),r.createdResources=r.createdResources||[],r.createdResources.push(`account:${c.accountId}`))}else c=await this.createAccount(t?.initialBalance),r.createdResources=r.createdResources||[],r.createdResources.push(`account:${c.accountId}`);o&&o({stage:"preparing",message:"Created account or using existing account",progressPercent:20,details:{state:r,account:c}});const p=ic(c.privateKey),l=("ed25519"===p.detectedType?i.PrivateKey.fromStringED25519(c.privateKey):i.PrivateKey.fromStringECDSA(c.privateKey)).publicKey.toString();s=new jc({network:n.network,operatorId:c.accountId,operatorPrivateKey:c.privateKey,operatorPublicKey:l,keyType:p.detectedType,logLevel:"info",guardedRegistryBaseUrl:a}),o&&o({stage:"preparing",message:"Initialized agent client",progressPercent:25,details:{state:r}});let u=r.outboundTopicId,d=r.inboundTopicId,m=r.pfpTopicId,f=r.profileTopicId;if(!u||!d||!f){m&&e.setExistingProfilePicture(m);const t=await s.createAgent(e,60,r,(e=>{o&&o({stage:e.stage,message:e.message,progressPercent:e.progressPercent||0,details:{...e.details,state:{...r,...e.details?.state}}})}));u=t.outboundTopicId,d=t.inboundTopicId,m=t.pfpTopicId,f=t.profileTopicId,r.outboundTopicId=u,r.inboundTopicId=d,r.pfpTopicId=m,r.profileTopicId=f,r.createdResources||(r.createdResources=[]),m&&!r.createdResources.includes(`pfp:${m}`)&&r.createdResources.push(`pfp:${m}`),r.createdResources.includes(`inbound:${d}`)||r.createdResources.push(`inbound:${d}`),r.createdResources.includes(`outbound:${u}`)||r.createdResources.push(`outbound:${u}`),r.createdResources.includes(`profile:${f}`)||r.createdResources.push(`profile:${f}`)}r.currentStage="profile",r.completedPercentage=60,o&&o({stage:"submitting",message:"Created agent with topics and profile",progressPercent:60,details:{state:r,outboundTopicId:u,inboundTopicId:d,pfpTopicId:m,profileTopicId:f}})}const p=`${r.inboundTopicId}@${c.accountId}`;if("complete"!==r.currentStage||!r.createdResources?.includes(`registration:${r.inboundTopicId}`)){const e=await s.registerAgentWithGuardedRegistry(c.accountId,n.network,{progressCallback:e=>{const t=60+.4*(e.progressPercent||0);o&&o({stage:e.stage,message:e.message,progressPercent:t,details:{...e.details,outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,profileTopicId:r.profileTopicId,operatorId:p,state:e.details?.state||r}})},existingState:r});if(!e.success)return{...e,state:r};r=e.state||r}return o&&o({stage:"completed",message:"Agent creation and registration complete",progressPercent:100,details:{outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,profileTopicId:r.profileTopicId,operatorId:p,state:r}}),{success:!0,state:r,metadata:{accountId:c.accountId,privateKey:c.privateKey,operatorId:p,inboundTopicId:r.inboundTopicId,outboundTopicId:r.outboundTopicId,profileTopicId:r.profileTopicId,pfpTopicId:r.pfpTopicId}}}catch(n){const e=n,i=`Failed to create and register agent: ${e.message}`;return this.logger.error(i),{error:e.message,success:!1,state:t?.existingState||{currentStage:"init",completedPercentage:0,error:e.message}}}}async registerAgentWithGuardedRegistry(e,t=this.network,n){try{this.logger.info("Registering agent with guarded registry");const o=n?.maxAttempts??60,a=n?.delayMs??2e3,r=n?.progressCallback;let s=n?.existingState||{currentStage:"registration",completedPercentage:0,createdResources:[]};r&&r({stage:"preparing",message:"Preparing agent registration",progressPercent:10,details:{state:s}});const c=await this.executeRegistration(e,t,this.guardedRegistryBaseUrl,this.logger);if(!c.success)return{...c,state:s};if(r&&r({stage:"submitting",message:"Submitting registration to registry",progressPercent:30,details:{transactionId:c.transactionId,state:s}}),c.transaction){const e=i.Transaction.fromBytes(globalThis.Buffer.from(c.transaction,"base64"));this.logger.info("Processing registration transaction"),await e.execute(this.client),this.logger.info("Successfully processed registration transaction")}r&&r({stage:"confirming",message:"Confirming registration transaction",progressPercent:60,details:{accountId:e,transactionId:c.transactionId,state:s}});const p=await this.waitForRegistrationConfirmation(c.transactionId,t,this.guardedRegistryBaseUrl,o,a,this.logger);return s.currentStage="complete",s.completedPercentage=100,s.createdResources||(s.createdResources=[]),c.transactionId&&s.createdResources.push(`registration:${c.transactionId}`),r&&r({stage:"completed",message:"Agent registration complete",progressPercent:100,details:{confirmed:p,transactionId:c.transactionId,state:s}}),{...c,confirmed:p,state:s}}catch(o){const e=o,t=`Failed to register agent: ${e.message}`;return this.logger.error(t),{error:e.message,success:!1}}}async registerAgent(e,t,i,n,o){this.logger.info("Registering agent");const a={p:"hcs-10",op:"register",account_id:t,inbound_topic_id:i,m:n};await this.submitPayload(e,a,o)}async getInboundTopicType(e){try{const t=await this.mirrorNode.getTopicInfo(e);if(!t)throw new Error("Topic does not exist");if(!(t.submit_key&&t.submit_key.key))return pc.PUBLIC;if(t.fee_schedule_key&&t.fee_schedule_key.key&&t.custom_fees){const i=t.custom_fees;if(i&&i.fixed_fees&&i.fixed_fees.length>0)return this.logger.info(`Topic ${e} is fee-based with ${i.fixed_fees.length} custom fees`),pc.FEE_BASED}return pc.CONTROLLED}catch(t){const e=`Error determining topic type: ${t.message}`;throw this.logger.error(e),new Error(e)}}getNetwork(){return this.network}getLogger(){return this.logger}getOperatorAccountId(){return this.client.operatorAccountId?.toString()??null}async createScheduledTransaction(e,t,n,o){this.logger.info("Creating scheduled transaction");const a=(new i.ScheduleCreateTransaction).setScheduledTransaction(e).setPayerAccountId(o?i.AccountId.fromString(o):this.client.operatorAccountId);if(t&&a.setScheduleMemo(t),n){const e=p.addSeconds(new Date,n),t=i.Timestamp.fromDate(e);a.setExpirationTime(t)}this.logger.debug("Executing schedule create transaction");const r=await a.execute(this.client),s=await r.getReceipt(this.client);if(!s.scheduleId)throw this.logger.error("Failed to create scheduled transaction: scheduleId is null"),new Error("Failed to create scheduled transaction: scheduleId is null");const c=s.scheduleId.toString(),l=r.transactionId.toString();return this.logger.info(`Scheduled transaction created successfully: ${c}`),{scheduleId:c,transactionId:l}}async sendTransactionOperation(e,t,i,n,o){const a=await this.canSubmitToTopic(e,this.client.operatorAccountId?.toString()||""),r={p:"hcs-10",op:"transaction",operator_id:await this.getOperatorId(),schedule_id:t,data:i,m:o?.memo};return this.logger.info("Submitting transaction operation to connection topic",r),await this.submitPayload(e,r,n,a.requiresFee)}async sendTransaction(e,t,i,n){this.logger.info("Creating scheduled transaction and sending transaction operation");const{scheduleId:o,transactionId:a}=await this.createScheduledTransaction(t,n?.scheduleMemo,n?.expirationTime,n?.schedulePayerAccountId);return{scheduleId:o,transactionId:a,receipt:await this.sendTransactionOperation(e,o,i,n?.submitKey,{memo:n?.operationMemo})}}async createMCPServer(e,t=60,i,n){this.keyType||await this.initializeOperator();const o=e.build(),a=this.client.operatorAccountId?.toString();if(!a)throw new Error("Failed to retrieve operator account ID");const r=await this._createEntityTopics(t,{outboundTopicId:i?.outboundTopicId||"",inboundTopicId:i?.inboundTopicId||"",pfpTopicId:i?.pfpTopicId||o.existingPfpTopicId||"",profileTopicId:i?.profileTopicId||""},a,pc.PUBLIC,void 0,o.pfpBuffer,o.pfpFileName,n);if(r.profileTopicId)this.logger.info(`Using existing profile topic ID: ${r.profileTopicId}`);else{this.logger.info("Creating and storing HCS-11 MCP server profile"),n&&n({stage:"preparing",message:"Creating MCP server profile",progressPercent:60,details:{outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,state:{currentStage:"profile",completedPercentage:60}}}),await this.hcs11Client.initializeOperator();const e=this.hcs11Client.createMCPServerProfile(o.name,o.mcpServer,{alias:o.alias,bio:o.bio,socials:o.socials||[],inboundTopicId:r.inboundTopicId,outboundTopicId:r.outboundTopicId,profileImage:r.pfpTopicId?`hcs://1/${r.pfpTopicId}`:void 0}),t=await this.hcs11Client.inscribeProfile(e);if(!t.success)throw this.logger.error(`Failed to inscribe MCP server profile: ${t.error}`),new Error(t.error||"Failed to inscribe MCP server profile");r.profileTopicId=t.profileTopicId,this.logger.info(`MCP server profile stored with topic ID: ${r.profileTopicId}`);const i=await this.hcs11Client.updateAccountMemoWithProfile(a,r.profileTopicId);i.success?this.logger.info("Updated account memo with profile reference"):this.logger.warn(`Failed to update account memo: ${i.error}, but continuing with MCP server creation`),n&&n({stage:"preparing",message:"MCP server profile created",progressPercent:70,details:{outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,profileTopicId:r.profileTopicId,state:{currentStage:"profile",completedPercentage:70}}})}return r}async _createEntityTopics(e,t,i,n,o,a,r,s){let{outboundTopicId:c,inboundTopicId:p,pfpTopicId:l,profileTopicId:u}=t;if(c)this.logger.info(`Using existing outbound topic ID: ${c}`);else{const t=this._generateHcs10Memo(Ec.OUTBOUND,{ttl:e});c=await this.createTopic(t,!0,!0),this.logger.info(`Created new outbound topic ID: ${c}`),s&&s({stage:"preparing",message:"Created outbound topic",progressPercent:30,details:{outboundTopicId:c,state:{currentStage:"topics",completedPercentage:30}}})}if(p?this.logger.info(`Using existing inbound topic ID: ${p}`):(p=await this.createInboundTopic(i,n,e,n===pc.FEE_BASED?o:void 0),this.logger.info(`Created new inbound topic ID: ${p}`),s&&s({stage:"preparing",message:"Created inbound topic",progressPercent:40,details:{outboundTopicId:c,inboundTopicId:p,state:{currentStage:"topics",completedPercentage:40}}})),!l&&a&&a.length>0&&r){this.logger.info("Inscribing new profile picture"),s&&s({stage:"preparing",message:"Inscribing profile picture",progressPercent:50,details:{outboundTopicId:c,inboundTopicId:p,state:{currentStage:"pfp",completedPercentage:50}}});l=(await this.inscribePfp(a,r)).pfpTopicId,this.logger.info(`Profile picture inscribed with topic ID: ${l}`),s&&s({stage:"preparing",message:"Profile picture inscribed",progressPercent:55,details:{outboundTopicId:c,inboundTopicId:p,pfpTopicId:l,state:{currentStage:"pfp",completedPercentage:55}}})}else l&&this.logger.info(`Using existing profile picture with topic ID: ${l}`);return{inboundTopicId:p,outboundTopicId:c,pfpTopicId:l,profileTopicId:u}}async createAndRegisterMCPServer(e,t){try{const n=e.build(),o=t?.progressCallback,a=t?.baseUrl||this.guardedRegistryBaseUrl;let r=t?.existingState||{currentStage:"init",completedPercentage:0,createdResources:[]};r.serverMetadata={name:n.name,description:n.mcpServer.description,services:n.mcpServer.services},o&&o({stage:"preparing",message:"Starting MCP server creation process",progressPercent:0,details:{state:r}});let s,c=n.existingAccount;if(r.inboundTopicId&&r.outboundTopicId&&r.profileTopicId){if(c=c||n.existingAccount,!c)throw new Error("Cannot resume registration without account information");const e=ic(c.privateKey),t=("ed25519"===e.detectedType?i.PrivateKey.fromStringED25519(c.privateKey):i.PrivateKey.fromStringECDSA(c.privateKey)).publicKey.toString();s=new jc({network:n.network,operatorId:c.accountId,operatorPrivateKey:c.privateKey,operatorPublicKey:t,keyType:e.detectedType,logLevel:"info",guardedRegistryBaseUrl:a}),this.logger.info("Resuming registration with existing state",{inboundTopicId:r.inboundTopicId,outboundTopicId:r.outboundTopicId,profileTopicId:r.profileTopicId,pfpTopicId:r.pfpTopicId})}else{if(!c)if(r.createdResources&&r.createdResources.some((e=>e.startsWith("account:")))){const e=r.createdResources.find((e=>e.startsWith("account:"))),i=e?.split(":")[1];i&&n.existingAccount?(c=n.existingAccount,this.logger.info(`Resuming with existing account: ${i}`)):(c=await this.createAccount(t?.initialBalance),r.createdResources=r.createdResources||[],r.createdResources.push(`account:${c.accountId}`))}else c=await this.createAccount(t?.initialBalance),r.createdResources=r.createdResources||[],r.createdResources.push(`account:${c.accountId}`);o&&o({stage:"preparing",message:"Created account or using existing account",progressPercent:20,details:{state:r,account:c}});const p=ic(c.privateKey);e.setExistingAccount(c.accountId,c.privateKey);const l=("ed25519"===p.detectedType?i.PrivateKey.fromStringED25519(c.privateKey):i.PrivateKey.fromStringECDSA(c.privateKey)).publicKey.toString();s=new jc({network:n.network,operatorId:c.accountId,operatorPrivateKey:c.privateKey,operatorPublicKey:l,logLevel:"info",guardedRegistryBaseUrl:a}),o&&o({stage:"preparing",message:"Initialized MCP server client",progressPercent:25,details:{state:r}});let u=r.outboundTopicId,d=r.inboundTopicId,m=r.pfpTopicId,f=r.profileTopicId;if(!u||!d||!f){m&&e.setExistingProfilePicture(m);const t=await s.createMCPServer(e,60,r,(e=>{o&&o({stage:e.stage,message:e.message,progressPercent:e.progressPercent||0,details:{...e.details,state:{...r,...e.details?.state}}})}));u=t.outboundTopicId,d=t.inboundTopicId,m=t.pfpTopicId,f=t.profileTopicId,r.outboundTopicId=u,r.inboundTopicId=d,r.pfpTopicId=m,r.profileTopicId=f,r.createdResources||(r.createdResources=[]),m&&!r.createdResources.includes(`pfp:${m}`)&&r.createdResources.push(`pfp:${m}`),r.createdResources.includes(`inbound:${d}`)||r.createdResources.push(`inbound:${d}`),r.createdResources.includes(`outbound:${u}`)||r.createdResources.push(`outbound:${u}`),r.createdResources.includes(`profile:${f}`)||r.createdResources.push(`profile:${f}`)}r.currentStage="profile",r.completedPercentage=60,o&&o({stage:"submitting",message:"Created MCP server with topics and profile",progressPercent:60,details:{state:r,outboundTopicId:u,inboundTopicId:d,pfpTopicId:m,profileTopicId:f}})}const p=`${r.inboundTopicId}@${c.accountId}`;if("complete"!==r.currentStage||!r.createdResources?.includes(`registration:${r.inboundTopicId}`)){const e=await s.registerAgentWithGuardedRegistry(c.accountId,n.network,{progressCallback:e=>{const t=60+.4*(e.progressPercent||0);o&&o({stage:e.stage,message:e.message,progressPercent:t,details:{...e.details,outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,profileTopicId:r.profileTopicId,operatorId:p,state:e.details?.state||r}})},existingState:r});if(!e.success)return{...e,state:r};r=e.state||r}return o&&o({stage:"completed",message:"MCP server creation and registration complete",progressPercent:100,details:{outboundTopicId:r.outboundTopicId,inboundTopicId:r.inboundTopicId,pfpTopicId:r.pfpTopicId,profileTopicId:r.profileTopicId,operatorId:p,state:r}}),{success:!0,state:r,metadata:{accountId:c.accountId,privateKey:c.privateKey,operatorId:p,inboundTopicId:r.inboundTopicId,outboundTopicId:r.outboundTopicId,profileTopicId:r.profileTopicId,pfpTopicId:r.pfpTopicId}}}catch(n){const e=n,i=`Failed to create and register MCP server: ${e.message}`;return this.logger.error(i),{error:e.message,success:!1,state:t?.existingState||{currentStage:"init",completedPercentage:0,error:e.message}}}}}const Fc="undefined"!=typeof window;const Lc={PROTOCOL:"hcs-20",PUBLIC_TOPIC_ID:"0.0.4350190",REGISTRY_TOPIC_ID:"0.0.4362300",MAX_NUMBER_LENGTH:18,MAX_NAME_LENGTH:100,MAX_METADATA_LENGTH:100,HEDERA_ACCOUNT_REGEX:/^(0|(?:[1-9]\d*))\.(0|(?:[1-9]\d*))\.(0|(?:[1-9]\d*))$/},Uc=c.z.string().regex(Lc.HEDERA_ACCOUNT_REGEX,"Invalid Hedera account ID format"),Bc=c.z.string().regex(/^\d+$/,"Must be a valid number").max(Lc.MAX_NUMBER_LENGTH,`Max ${Lc.MAX_NUMBER_LENGTH} digits`),Mc=c.z.string().min(1,"Tick cannot be empty").transform((e=>e.toLowerCase().trim())),Dc=c.z.object({p:c.z.literal("hcs-20"),m:c.z.string().optional()}),zc=Dc.extend({op:c.z.literal("deploy"),name:c.z.string().min(1).max(Lc.MAX_NAME_LENGTH),tick:Mc,max:Bc,lim:Bc.optional(),metadata:c.z.string().max(Lc.MAX_METADATA_LENGTH).optional()}),qc=Dc.extend({op:c.z.literal("mint"),tick:Mc,amt:Bc,to:Uc}),Kc=Dc.extend({op:c.z.literal("burn"),tick:Mc,amt:Bc,from:Uc}),Hc=Dc.extend({op:c.z.literal("transfer"),tick:Mc,amt:Bc,from:Uc,to:Uc}),Wc=Dc.extend({op:c.z.literal("register"),name:c.z.string().min(1).max(Lc.MAX_NAME_LENGTH),metadata:c.z.string().max(Lc.MAX_METADATA_LENGTH).optional(),private:c.z.boolean(),t_id:Uc}),Vc=c.z.discriminatedUnion("op",[zc,qc,Kc,Hc,Wc]);class Gc extends Error{constructor(e){super(e),this.name="HCS20Error"}}class Zc extends Gc{constructor(e,t){super(e),this.tick=t,this.name="PointsDeploymentError"}}class Jc extends Gc{constructor(e,t,i,n,o,a){super(e),this.tick=t,this.from=i,this.to=n,this.amount=o,this.availableBalance=a,this.name="PointsTransferError"}}class Xc extends Gc{constructor(e,t,i,n,o){super(e),this.tick=t,this.from=i,this.amount=n,this.availableBalance=o,this.name="PointsBurnError"}}class Yc extends Gc{constructor(e,t){super(e),this.validationErrors=t,this.name="PointsValidationError"}}class Qc extends Gc{constructor(e,t){super(e),this.topicId=t,this.name="TopicRegistrationError"}}class ep extends Gc{constructor(e){super(`Invalid Hedera account format: ${e}`),this.account=e,this.name="InvalidAccountFormatError"}}class tp{constructor(e){this.logger=e.logger||new d({module:"HCS20Client"}),this.network="mainnet"===e.network?"mainnet":"testnet",this.mirrorNode=new Ws(this.network,this.logger,e.mirrorNodeUrl?{customUrl:e.mirrorNodeUrl}:void 0),this.registryTopicId=e.registryTopicId||Lc.REGISTRY_TOPIC_ID,this.publicTopicId=e.publicTopicId||Lc.PUBLIC_TOPIC_ID}validateMessage(e){try{return Vc.parse(e),{valid:!0}}catch(t){if(t.errors){return{valid:!1,errors:t.errors.map((e=>`${e.path.join(".")}: ${e.message}`))}}return{valid:!1,errors:[t.message]}}}normalizeTick(e){return e.toLowerCase().trim()}accountToString(e){if("string"==typeof e){if(!Lc.HEDERA_ACCOUNT_REGEX.test(e))throw new ep(e);return e}return e.toString()}topicToString(e){if("string"==typeof e){if(!Lc.HEDERA_ACCOUNT_REGEX.test(e))throw new ep(e);return e}return e.toString()}}var ip=(e=>(e.FIXED_FEE="FIXED_FEE",e.FRACTIONAL_FEE="FRACTIONAL_FEE",e.ROYALTY_FEE="ROYALTY_FEE",e))(ip||{});class np{constructor(e){this.customFees=[],this.logger=e.logger,this.mirrorNode=new Ws(e.network,e.logger),this.defaultCollectorAccountId=e.defaultCollectorAccountId||""}static forHbar(e,t,i,n,o=[]){return new np({network:i,logger:n,defaultCollectorAccountId:t}).addHbarFee(e,t,o)}static async forToken(e,t,i,n,o,a=[],r){const s=new np({network:n,logger:o,defaultCollectorAccountId:i});return await s.addTokenFee(e,t,i,r,a),s}addHbarFee(e,t,i=[]){if(e<=0)throw new Error("HBAR amount must be greater than zero");return this.customFees.push({feeAmount:{amount:1e8*e,decimals:0},feeCollectorAccountId:t||"",feeTokenId:void 0,exemptAccounts:[...i],type:ip.FIXED_FEE}),this}async addTokenFee(e,t,i,n,o=[]){if(e<=0)throw new Error("Token amount must be greater than zero");if(!t)throw new Error("Fee token ID is required when adding a token fee");let a=n;if(void 0===a)try{const e=await this.mirrorNode.getTokenInfo(t);e?.decimals?(a=parseInt(e.decimals,10),this.logger.info(`Fetched decimals for ${t}: ${a}`)):(this.logger.warn(`Could not fetch decimals for ${t}, defaulting to 0.`),a=0)}catch(r){this.logger.error(`Error fetching decimals for ${t}, defaulting to 0: ${r}`),a=0}return this.customFees.push({feeAmount:{amount:e*10**a,decimals:a},feeCollectorAccountId:i||"",feeTokenId:t,exemptAccounts:[...o],type:ip.FIXED_FEE}),this}build(){if(0===this.customFees.length)throw new Error("At least one fee must be added using addHbarFee/addTokenFee or created using forHbar/forToken");if(this.customFees.length>10)throw new Error("Maximum of 10 custom fees per topic allowed");const e=new Set;return this.customFees.forEach((t=>{t.exemptAccounts.forEach((t=>e.add(t)))})),{customFees:this.customFees,exemptAccounts:Array.from(e)}}}exports.AIAgentCapability=rc,exports.AIAgentType=oc,exports.AccountCreationError=Nc,exports.AgentBuilder=$c,exports.BrowserHCS20Client=class extends tp{constructor(e){super({network:e.network,logger:e.logger,mirrorNodeUrl:e.mirrorNodeUrl,registryTopicId:e.registryTopicId,publicTopicId:e.publicTopicId}),this.hwc=e.hwc,this.feeAmount=e.feeAmount||20}getOperatorId(){const e=this.hwc.getAccountInfo();if(!e?.accountId)throw new Error("Wallet not connected");return e.accountId}async deployPoints(e){const t=this.getOperatorId(),{progressCallback:n}=e;try{let o;if(n?.({stage:"creating-topic",percentage:20}),e.usePrivateTopic){const n=await this.mirrorNode.getPublicKey(t),a=(new i.TopicCreateTransaction).setTopicMemo(e.topicMemo||`HCS-20: ${e.name}`).setSubmitKey(n).setAdminKey(n).setAutoRenewAccountId(i.AccountId.fromString(t)),r=await this.hwc.executeTransactionWithErrorHandling(a,!1);if(r?.error)throw new Error(r.error);const s=r?.result;if(!s?.topicId)throw new Error("Failed to create topic: topicId is null");o=s.topicId.toString(),this.logger.info(`Created private topic: ${o}`)}else o=this.publicTopicId;n?.({stage:"submitting-deploy",percentage:50,topicId:o});const a={p:"hcs-20",op:"deploy",name:e.name,tick:this.normalizeTick(e.tick),max:e.maxSupply,lim:e.limitPerMint,metadata:e.metadata,m:e.topicMemo},r=this.validateMessage(a);if(!r.valid)throw new Yc("Invalid deploy message",r.errors);const s=await this.submitPayload(o,a,e.usePrivateTopic),c=s.transactionHash?.toString()||"";return n?.({stage:"confirming",percentage:80,topicId:o,deployTxId:c}),await new Promise((e=>setTimeout(e,2e3))),n?.({stage:"complete",percentage:100,topicId:o,deployTxId:c}),{name:e.name,tick:this.normalizeTick(e.tick),maxSupply:e.maxSupply,limitPerMint:e.limitPerMint,metadata:e.metadata,topicId:o,deployerAccountId:t,currentSupply:"0",deploymentTimestamp:(new Date).toISOString(),isPrivate:e.usePrivateTopic||!1}}catch(o){throw n?.({stage:"complete",percentage:100,error:o instanceof Error?o.message:"Unknown error"}),o}}async mintPoints(e){this.getOperatorId();const{progressCallback:t}=e;try{t?.({stage:"validating",percentage:20}),t?.({stage:"submitting",percentage:50});const i={p:"hcs-20",op:"mint",tick:this.normalizeTick(e.tick),amt:e.amount,to:this.accountToString(e.to),m:e.memo},n=e.topicId||this.publicTopicId,o=await this.submitPayload(n,i,!1),a=o.transactionHash?.toString()||"";return t?.({stage:"confirming",percentage:80,mintTxId:a}),await new Promise((e=>setTimeout(e,2e3))),t?.({stage:"complete",percentage:100,mintTxId:a}),{id:a,operation:"mint",tick:this.normalizeTick(e.tick),amount:e.amount,to:this.accountToString(e.to),timestamp:(new Date).toISOString(),sequenceNumber:0,topicId:n,transactionId:a,memo:e.memo}}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async transferPoints(e){this.getOperatorId();const{progressCallback:t}=e;try{t?.({stage:"validating-balance",percentage:20}),t?.({stage:"submitting",percentage:50});const i={p:"hcs-20",op:"transfer",tick:this.normalizeTick(e.tick),amt:e.amount,from:this.accountToString(e.from),to:this.accountToString(e.to),m:e.memo},n=e.topicId||this.publicTopicId,o=await this.submitPayload(n,i,!1),a=o.transactionHash?.toString()||"";return t?.({stage:"confirming",percentage:80,transferTxId:a}),await new Promise((e=>setTimeout(e,2e3))),t?.({stage:"complete",percentage:100,transferTxId:a}),{id:a,operation:"transfer",tick:this.normalizeTick(e.tick),amount:e.amount,from:this.accountToString(e.from),to:this.accountToString(e.to),timestamp:(new Date).toISOString(),sequenceNumber:0,topicId:n,transactionId:a,memo:e.memo}}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async burnPoints(e){this.getOperatorId();const{progressCallback:t}=e;try{t?.({stage:"validating-balance",percentage:20}),t?.({stage:"submitting",percentage:50});const i={p:"hcs-20",op:"burn",tick:this.normalizeTick(e.tick),amt:e.amount,from:this.accountToString(e.from),m:e.memo},n=e.topicId||this.publicTopicId,o=await this.submitPayload(n,i,!1),a=o.transactionHash?.toString()||"";return t?.({stage:"confirming",percentage:80,burnTxId:a}),await new Promise((e=>setTimeout(e,2e3))),t?.({stage:"complete",percentage:100,burnTxId:a}),{id:a,operation:"burn",tick:this.normalizeTick(e.tick),amount:e.amount,from:this.accountToString(e.from),timestamp:(new Date).toISOString(),sequenceNumber:0,topicId:n,transactionId:a,memo:e.memo}}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async registerTopic(e){const{progressCallback:t}=e;try{t?.({stage:"validating",percentage:20});const i={p:"hcs-20",op:"register",name:e.name,metadata:e.metadata,private:e.isPrivate,t_id:this.topicToString(e.topicId),m:e.memo},n=this.validateMessage(i);if(!n.valid)throw new Yc("Invalid register message",n.errors);t?.({stage:"submitting",percentage:50});const o=await this.submitPayload(this.registryTopicId,i,!1),a=o.transactionHash?.toString()||"";t?.({stage:"confirming",percentage:80,registerTxId:a}),await new Promise((e=>setTimeout(e,2e3))),t?.({stage:"complete",percentage:100,registerTxId:a})}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),new Qc(i instanceof Error?i.message:"Unknown error",this.topicToString(e.topicId))}}async submitPayload(e,t,n){let o;this.logger.debug(`Submitting payload to topic ${e}`),o="string"==typeof t?t:JSON.stringify(t);const a=(new i.TopicMessageSubmitTransaction).setTopicId(i.TopicId.fromString(e)).setMessage(o);n&&(this.logger.info("Topic requires fee payment, setting max transaction fee"),a.setMaxTransactionFee(new i.Hbar(this.feeAmount)));const r=await this.hwc.executeTransactionWithErrorHandling(a,!1);if(r?.error)throw this.logger.error(`Failed to submit payload: ${r.error}`),new Error(`Failed to submit payload: ${r.error}`);if(!r?.result)throw this.logger.error("Failed to submit message: receipt is null or undefined"),new Error("Failed to submit message: receipt is null or undefined");return this.logger.debug("Payload submitted successfully via HWC"),r.result}},exports.BrowserHCSClient=class extends _c{constructor(e){let t;if(super({network:e.network,logLevel:e.logLevel,prettyPrint:e.prettyPrint,feeAmount:e.feeAmount,mirrorNode:e.mirrorNode,silent:e.silent}),this.hcs11Client=null,this.hwc=e.hwc,e.guardedRegistryBaseUrl?this.guardedRegistryBaseUrl=e.guardedRegistryBaseUrl:this.guardedRegistryBaseUrl="https://moonscape.tech",t=e.logLevel?e.logLevel:"info",this.logger=d.getInstance({level:t,module:"HCS-Browser",prettyPrint:e.prettyPrint,silent:e.silent}),Fc)try{const{accountId:t,signer:i}=this.getAccountAndSigner();this.hcs11Client=new Tc({network:e.network,auth:{operatorId:t,signer:i},logLevel:e.logLevel,silent:e.silent})}catch(i){this.logger.warn(`Failed to initialize HCS11Client: ${i}`)}else this.logger.error("BrowserHCSClient initialized in server environment - browser-specific features will not be available. Use HCS10Client instead.")}async sendMessage(e,t,i,n,o){this.logger.info("Sending message");const a={p:"hcs-10",op:"message",operator_id:await this.getOperatorId(),data:t,m:i},r=await this.canSubmitToTopic(e,this.hwc.getAccountInfo().accountId),s=JSON.stringify(a);if(globalThis.Buffer.from(s).length>1e3){this.logger.info("Message payload exceeds 1000 bytes, storing via inscription");try{const e=globalThis.Buffer.from(t),i=`message-${Date.now()}.json`,n=await this.inscribeFile(e,i,{progressCallback:o?.progressCallback,waitMaxAttempts:o?.waitMaxAttempts,waitIntervalMs:o?.waitIntervalMs});if(!n?.topic_id)throw new Error("Failed to inscribe large message content");a.data=`hcs://1/${n.topic_id}`,this.logger.info(`Large message inscribed with topic ID: ${n.topic_id}`)}catch(c){throw this.logger.error("Error inscribing large message:",c),new Error(`Failed to handle large message: ${c instanceof Error?c.message:"Unknown error"}`)}}return await this.submitPayload(e,a,n,r.requiresFee)}async getPublicKey(e){return await this.mirrorNode.getPublicKey(e)}async handleConnectionRequest(e,t,n,o="Connection accepted. Looking forward to collaborating!",a=60){this.logger.info("Handling connection request");const r=this.hwc.getAccountInfo().accountId;if(!r)throw new Error("Failed to retrieve user account ID");const s=await this.mirrorNode.getPublicKey(t),c=await this.mirrorNode.getPublicKey(r);if(!c)throw new Error("Failed to retrieve public key");const p=new i.KeyList([c,s],1),l=this._generateHcs10Memo(Ec.CONNECTION,{ttl:a,inboundTopicId:e,connectionId:n}),u=(new i.TopicCreateTransaction).setTopicMemo(l).setAutoRenewAccountId(i.AccountId.fromString(r)).setAdminKey(p).setSubmitKey(p);this.logger.debug("Executing topic creation transaction");const d=await this.hwc.executeTransactionWithErrorHandling(u,!1);if(d?.error)throw this.logger.error(d.error),new Error(d.error);const m=d?.result;if(!m?.topicId)throw this.logger.error("Failed to create topic: topicId is null"),new Error("Failed to create topic: topicId is null");const f=m.topicId.toString(),h=`${e}@${r}`,g=await this.confirmConnection(e,f,t,n,h,o),b=await this.retrieveCommunicationTopics(r),x=await this.retrieveCommunicationTopics(t),v=`${x.inboundTopic}@${t}`;return await this.recordOutboundConnectionConfirmation({outboundTopicId:b.outboundTopic,requestorOutboundTopicId:x.outboundTopic,connectionRequestId:n,confirmedRequestId:g,connectionTopicId:f,operatorId:v,memo:`Connection established with ${t}`}),{connectionTopicId:f,confirmedConnectionSequenceNumber:g,operatorId:h}}async confirmConnection(e,t,i,n,o,a){this.logger.info("Confirming connection");const r={p:"hcs-10",op:"connection_created",connection_topic_id:t,connected_account_id:i,operator_id:o,connection_id:n,m:a},s=await this.submitPayload(e,r);if(!s?.topicSequenceNumber)throw this.logger.error("Failed to confirm connection: sequence number is null"),new Error("Failed to confirm connection: sequence number is null");return s.topicSequenceNumber.toNumber()}async create(e,t){const i=t?.progressCallback,n=new Ds({module:"ProfileCreate",logger:this.logger,callback:i});try{const i=e instanceof $c;let o;if(o=t?.existingState?t.existingState:{currentStage:"init",completedPercentage:0,createdResources:[]},i){this.logger.info("Creating Agent Profile and HCS-10 Topics");const t=e.build();o.agentMetadata=t.metadata}else this.logger.info("Creating Person HCS-11 Profile");n.preparing(`Starting ${i?"agent":"person"} resource creation`,0,{state:o});const{inboundTopicId:a,outboundTopicId:r,state:s}=await this.createCommunicationTopics(t,n);let c,p,l;if(o=s,i||(e.setInboundTopicId(a),e.setOutboundTopicId(r)),i){const t=e.build();c=t.existingPfpTopicId||o.pfpTopicId,p=t.pfpBuffer,l=t.pfpFileName||"pfp.png"}else{const t=e.build();c=o.pfpTopicId,p=t.pfpBuffer,l=t.pfpFileName}!c&&p&&l?c=await this.handleProfilePictureCreation(p,l,o,n):c&&(n.preparing(`Using existing profile picture: ${c}`,50,{state:o}),o.pfpTopicId=c),await this.createAndInscribeProfile(i,e,c,o,a,r,t,n),o.currentStage="complete",o.completedPercentage=100,n.completed((i?"Agent":"Person")+" profile created successfully",{profileTopicId:o.profileTopicId,inboundTopicId:a,outboundTopicId:r,pfpTopicId:c,state:o});let u="";o.outboundTopicId&&(u=o.outboundTopicId);let d="";o.inboundTopicId&&(d=o.inboundTopicId);let m="";o.pfpTopicId&&(m=o.pfpTopicId);let f="";return o.profileTopicId&&(f=o.profileTopicId),{outboundTopicId:u,inboundTopicId:d,pfpTopicId:m,profileTopicId:f,success:!0,state:o}}catch(o){return n.failed("Error during profile creation",{error:o.message}),{outboundTopicId:"",inboundTopicId:"",pfpTopicId:"",profileTopicId:"",success:!1,error:o.message,state:{currentStage:"init",completedPercentage:0,error:o.message}}}}async handleProfilePictureCreation(e,t,i,n){i.currentStage="pfp",n.preparing("Creating profile picture",30,{state:i});const o=n.createSubProgress({minPercent:30,maxPercent:50,logPrefix:"PFP"}),a=await this.inscribePfp(e,t,{progressCallback:e=>o.report({...e,progressPercent:e.progressPercent??0,details:{...e.details,state:i}})});if(!a.success){let e="Failed to inscribe profile picture";throw a.error&&(e=a.error),new Error(e)}const r=a.pfpTopicId;return i.pfpTopicId=r,i.createdResources&&i.createdResources.push(`pfp:${i.pfpTopicId}`),n.preparing("Profile picture created",50,{state:i}),r}async createAndInscribeProfile(e,t,i,n,o,a,r,s){if(!this.hcs11Client)throw s&&s.failed("HCS11Client is not available"),new Error("HCS11Client is not available");if(this.logger.info("Creating and inscribing profile"),n.profileTopicId)s&&s.preparing(`Using existing ${e?"agent":"person"} profile`,95,{state:n});else{s&&s.preparing(`Storing HCS-11 ${e?"agent":"person"} profile`,80);const c=s?.createSubProgress({minPercent:80,maxPercent:95,logPrefix:"StoreProfile"});let p;if(e){const e=t.build(),n=e.metadata?.socials?Object.entries(e.metadata.socials).map((([e,t])=>({platform:e,handle:t}))):[];p=this.hcs11Client.createAIAgentProfile(e.name,"manual"===e.metadata?.type?0:1,e.capabilities||[],e.metadata?.model||"unknown",{alias:e.name.toLowerCase().replace(/\s+/g,"_"),bio:e.bio,profileImage:i?`hcs://1/${i}`:void 0,socials:n,properties:e.metadata?.properties||{},inboundTopicId:o,outboundTopicId:a,creator:e.metadata?.creator})}else{const e=t.build(),{pfpBuffer:n,pfpFileName:r,...s}=e;p=this.hcs11Client.createPersonalProfile(e.display_name,{alias:e.alias,bio:e.bio,socials:e.socials,profileImage:i?`hcs://1/${i}`:e.profileImage,properties:e.properties,inboundTopicId:o,outboundTopicId:a})}const l=await this.hcs11Client.createAndInscribeProfile(p,r?.updateAccountMemo??!0,{progressCallback:e=>c?.report({...e,progressPercent:e.progressPercent??0})});if(!l.success){s&&s.failed(`Failed to inscribe ${e?"agent":"person"} profile`,{error:l.error});let t=`Failed to inscribe ${e?"agent":"person"} profile`;throw l.error&&(t=l.error),new Error(t)}n.profileTopicId=l.profileTopicId,n.createdResources&&n.createdResources.push(`profile:${l.profileTopicId}`),s&&s.preparing("HCS-11 Profile stored",95,{state:n})}}initializeRegistrationState(e,t){const i=t||{inboundTopicId:e,currentStage:"registration",completedPercentage:0,createdResources:[]};return"registration"!==i.currentStage&&"complete"!==i.currentStage&&(i.currentStage="registration"),i}updateStateForCompletedRegistration(e,t){e.currentStage="complete",e.completedPercentage=100,e.createdResources&&e.createdResources.push(`registration:${t}`)}async registerAgentWithGuardedRegistry(e,t=this.network,n){try{this.logger.info("Registering agent with guarded registry");const o=(await this.retrieveProfile(e)).topicInfo.inboundTopic,a=this.initializeRegistrationState(o,n?.existingState),r=new Ds({module:"AgentRegistration",logger:this.logger,callback:n?.progressCallback});r.preparing("Preparing agent registration",10,{inboundTopicId:o,accountId:e});const s=await this.executeRegistration(e,t,this.guardedRegistryBaseUrl,this.logger);if(!s.success)return{...s,state:a};if(r.submitting("Submitting registration to registry",30,{transactionId:s.transactionId}),s.transaction){const e=i.Transaction.fromBytes(globalThis.Buffer.from(s.transaction,"base64"));this.logger.info("Processing registration transaction");const t=await this.hwc.executeTransactionWithErrorHandling(e,!0);if(t.error)return{...s,error:t.error,success:!1,state:a};this.logger.info("Successfully processed registration transaction")}r.confirming("Confirming registration transaction",60,{accountId:e,inboundTopicId:o,transactionId:s.transactionId});const c=n?.maxAttempts??60,p=n?.delayMs??2e3,l=await this.waitForRegistrationConfirmation(s.transactionId,t,this.guardedRegistryBaseUrl,c,p,this.logger);return this.updateStateForCompletedRegistration(a,o),r.completed("Agent registration complete",{transactionId:s.transactionId,inboundTopicId:o,state:a,confirmed:l}),{...s,confirmed:l,state:a}}catch(o){return this.logger.error(`Registration error: ${o.message}`),{error:`Error during registration: ${o.message}`,success:!1,state:{currentStage:"registration",completedPercentage:0,error:o.message}}}}async createAndRegisterAgent(e,t){try{const i=e.build(),n=t?.progressCallback,o=new Ds({module:"AgentCreateRegister",logger:this.logger,callback:n});let a=t?.existingState||{currentStage:"init",completedPercentage:0,createdResources:[]};if(a.agentMetadata=i.metadata,o.preparing("Starting agent creation process",0,{state:a}),"complete"!==a.currentStage||!a.inboundTopicId||!a.outboundTopicId||!a.profileTopicId){const t=await this.create(e,{progressCallback:e=>{const t=.3*(e.progressPercent||0);o.report({...e,progressPercent:t,details:{...e.details,state:e.details?.state||a}})},existingState:a,updateAccountMemo:!1});if(!("state"in t))throw new Error("Create method did not return expected agent state.");if(!t.success)throw new Error(t.error||"Failed to create agent resources");a=t.state,a.agentMetadata=i.metadata}o.preparing(`Agent creation status: ${a.currentStage}, ${a.completedPercentage}%`,30,{state:a});const{accountId:r}=this.getAccountAndSigner();if("complete"!==a.currentStage||!a.createdResources?.includes(`registration:${a.inboundTopicId}`)){t?.baseUrl&&(this.guardedRegistryBaseUrl=t.baseUrl);const e=await this.registerAgentWithGuardedRegistry(r,i.network,{progressCallback:e=>{const t=30+.7*(e.progressPercent||0);o.report({...e,progressPercent:t,details:{...e.details,state:e.details?.state||a}})},maxAttempts:t?.maxAttempts,delayMs:t?.delayMs,existingState:a});if(!e.success)throw new Error(e.error||"Failed to register agent with registry");a=e.state,a.profileTopicId&&await(this.hcs11Client?.updateAccountMemoWithProfile(r,a.profileTopicId))}return o.completed("Agent creation and registration complete",{state:a}),{success:!0,state:a,metadata:{accountId:r,operatorId:`${a.inboundTopicId}@${r}`,inboundTopicId:a.inboundTopicId,outboundTopicId:a.outboundTopicId,profileTopicId:a.profileTopicId,pfpTopicId:a.pfpTopicId,privateKey:null,...a.agentMetadata}}}catch(i){return this.logger.error(`Failed to create and register agent: ${i.message}`),{success:!1,error:`Failed to create and register agent: ${i.message}`,state:t?.existingState||{currentStage:"init",completedPercentage:0,error:i.message}}}}async storeHCS11Profile(e,t,i,n,o=[],a={},r,s,c,p){try{const l=p?.progressCallback,u=new Ds({module:"StoreHCS11Profile",logger:this.logger,callback:l});u.preparing("Preparing agent profile data",0);let d=c;if(!d&&r&&s){const e=u.createSubProgress({minPercent:0,maxPercent:60,logPrefix:"PFP"}),t=await this.inscribePfp(r,s,{progressCallback:t=>{e.report({stage:t.stage,message:t.message,progressPercent:t.progressPercent||0,details:t.details})}});t.success?d=t.pfpTopicId:u.failed("Failed to inscribe profile picture, continuing without PFP")}else c?u.preparing(`Using existing profile picture: ${c}`,30):u.preparing("No profile picture provided",30);if(!this.hcs11Client)return u.failed("HCS11Client is not available in this environment"),{profileTopicId:"",success:!1,error:"HCS11Client is not available in this environment",transactionId:""};const m=this.hcs11Client.getAgentTypeFromMetadata({type:a.type||"autonomous"});u.preparing("Building agent profile",65);const f=a.socials?Object.entries(a.socials).filter((([e,t])=>t)).map((([e,t])=>({platform:e,handle:t}))):void 0,h=this.hcs11Client.createAIAgentProfile(e,m,o,a.model||"unknown",{alias:e.toLowerCase().replace(/\s+/g,"_"),bio:t,profileImage:d?`hcs://1/${d}`:void 0,socials:f,properties:{version:a.version||"1.0.0",creator:a.creator||"Unknown",supported_languages:a.supported_languages||["en"],permissions:a.permissions||[],model_details:a.model_details,training:a.training,capabilities_description:a.capabilities_description,...a},inboundTopicId:i,outboundTopicId:n,creator:a.creator}),g=u.createSubProgress({minPercent:65,maxPercent:100,logPrefix:"Profile"}),b=await this.hcs11Client.createAndInscribeProfile(h,!0,{progressCallback:e=>{g.report({stage:e.stage,message:e.message,progressPercent:e.progressPercent||0,details:e.details})}});return b.success?(u.completed("Profile stored successfully",{profileTopicId:b.profileTopicId}),{profileTopicId:b.profileTopicId,pfpTopicId:d,success:!0,transactionId:b.transactionId||""}):(u.failed("Failed to inscribe profile"),{profileTopicId:"",success:!1,error:b.error||"Failed to inscribe profile",transactionId:b.transactionId||""})}catch(l){return this.logger.error(`Error storing HCS11 profile: ${l.message}`),{profileTopicId:"",success:!1,error:l.message,transactionId:""}}}async createTopic(e,t,n){this.logger.info("Creating topic");const{accountId:o,signer:a}=this.getAccountAndSigner(),r=(new i.TopicCreateTransaction).setTopicMemo(e),s=await this.mirrorNode.getPublicKey(o);t&&s&&(r.setAdminKey(s),r.setAutoRenewAccountId(o)),n&&s&&r.setSubmitKey(s);const c=await this.hwc.executeTransactionWithErrorHandling(r,!1),p=c.error;if(p)return this.logger.error(p),{success:!1,error:p};const l=c.result;return l?.topicId?{success:!0,topicId:l.topicId.toString()}:(this.logger.error("Failed to create topic: topicId is null"),{success:!1,error:"Failed to create topic: topicId is null"})}async submitPayload(e,t,n,o){let a;this.logger.debug(`Submitting payload to topic ${e}`),a="string"==typeof t?t:JSON.stringify(t);const r=(new i.TopicMessageSubmitTransaction).setTopicId(e).setMessage(a),s=this.getHcs10TransactionMemo(t);let c;if(s&&r.setTransactionMemo(s),o&&(this.logger.info("Topic requires fee payment, setting max transaction fee"),r.setMaxTransactionFee(new i.Hbar(this.feeAmount))),n){const{signer:e}=this.getAccountAndSigner();r.freezeWithSigner(e);const t=await r.sign(n);c=await this.hwc.executeTransactionWithErrorHandling(t,!0)}else c=await this.hwc.executeTransactionWithErrorHandling(r,!1);if(c?.error)throw this.logger.error(`Failed to submit payload: ${c.error}`),new Error(`Failed to submit payload: ${c.error}`);if(!c?.result)throw this.logger.error("Failed to submit message: receipt is null or undefined"),new Error("Failed to submit message: receipt is null or undefined");return this.logger.debug("Payload submitted successfully via HWC"),c.result}async inscribeFile(e,t,i){const{accountId:n,signer:o}=this.getAccountAndSigner(),a=u.lookup(t)||"application/octet-stream",r=await Ms.createWithAuth({type:"client",accountId:n,signer:o,network:this.network}),s={mode:"file",waitForConfirmation:!0,waitMaxAttempts:i?.waitMaxAttempts||30,waitIntervalMs:i?.waitIntervalMs||4e3,progressCallback:i?.progressCallback,logging:{level:this.logger.getLevel?this.logger.getLevel():"info"}},c=await qs({type:"buffer",buffer:e,fileName:t,mimeType:a},o,{...s,network:this.network},r);if(!c.confirmed||!c.inscription)throw new Error("Inscription was not confirmed");return c.inscription}getAccountAndSigner(){const e=this?.hwc?.getAccountInfo(),t=e?.accountId?.toString(),i=this?.hwc?.dAppConnector?.signers?.find((e=>e.getAccountId().toString()===t));if(!i)throw this.logger.error("Failed to find signer",{accountId:t,signers:this?.hwc?.dAppConnector?.signers,accountInfo:e}),new Error("Failed to find signer");return{accountId:t,signer:i}}async inscribePfp(e,t,i){try{const n=i?.progressCallback,o=new Ds({module:"PFP-Inscription",logger:this.logger,callback:n});if(!this.hcs11Client)return o.failed("HCS11Client is not available in this environment"),{pfpTopicId:"",success:!1,error:"HCS11Client is not available in this environment",transactionId:""};o.preparing("Preparing to inscribe profile picture",10),this.logger.info("Inscribing profile picture using HCS-11 client");const a=e=>{o.report({stage:e.stage||"confirming",message:e.message||"Processing PFP inscription",progressPercent:e.progressPercent||50,details:e.details})},r=await this.hcs11Client.inscribeImage(e,t,{progressCallback:a});if(!r.success){let e="Failed to inscribe profile picture";r.error&&(e=r.error);let t="";return r.transactionId&&(t=r.transactionId),{pfpTopicId:"",success:!1,error:e,transactionId:t}}return o.completed("Successfully inscribed profile picture",{pfpTopicId:r.imageTopicId}),this.logger.info(`Successfully inscribed profile picture with topic ID: ${r.imageTopicId}`),{pfpTopicId:r.imageTopicId,success:!0,transactionId:r.transactionId||""}}catch(n){return this.logger.error(`Error inscribing profile picture: ${n.message}`),{pfpTopicId:"",success:!1,error:n.message,transactionId:""}}}async createCommunicationTopics(e,t){let i=e?.existingState||{currentStage:"init",completedPercentage:0,createdResources:[]};t&&t.preparing("Starting communication topic creation",0,{state:i});const{accountId:n}=this.getAccountAndSigner();if(!i.outboundTopicId){i.currentStage="topics",t&&t.preparing("Creating outbound topic",5,{state:i});const o=this._generateHcs10Memo(Ec.OUTBOUND,{ttl:e?.ttl,accountId:n}),a=await this.createTopic(o,!0,!0);if(!a.success||!a.topicId)throw new Error(a.error||"Failed to create outbound topic");i.outboundTopicId=a.topicId,i.createdResources&&i.createdResources.push(`outbound:${i.outboundTopicId}`)}if(!i.inboundTopicId){i.currentStage="topics",t&&t.preparing("Creating inbound topic",10,{state:i});const o=this._generateHcs10Memo(Ec.INBOUND,{ttl:e?.ttl,accountId:n}),a=await this.createTopic(o,!0,!1);if(!a.success||!a.topicId)throw new Error(a.error||"Failed to create inbound topic");i.inboundTopicId=a.topicId,i.createdResources&&i.createdResources.push(`inbound:${i.inboundTopicId}`)}return{inboundTopicId:i.inboundTopicId,outboundTopicId:i.outboundTopicId,state:i}}},exports.ConnectionConfirmationError=Oc,exports.ConnectionsManager=class{constructor(e){this.connections=new Map,this.pendingRequests=new Map,this.profileCache=new Map,this.filterPendingAccountIds=new Set;const t={module:"ConnectionsManager",level:e?.logLevel||"info",prettyPrint:!0,silent:e?.silent};if(this.logger=new d(t),e?.filterPendingAccountIds&&(this.filterPendingAccountIds=new Set(e.filterPendingAccountIds)),!e.baseClient)throw new Error("ConnectionsManager requires a baseClient to operate");this.baseClient=e.baseClient}async fetchConnectionData(e){try{const t=await this.baseClient.retrieveCommunicationTopics(e),i=e=>Boolean(e)&&!e.includes(":");if(!i(t.inboundTopic)||!i(t.outboundTopic))return this.logger.warn("Invalid topic IDs detected in retrieved communication topics"),this.getAllConnections();const[n,o]=await Promise.all([this.baseClient.getMessages(t.outboundTopic),this.baseClient.getMessages(t.inboundTopic)]);this.processOutboundMessages(n.messages||[],e),this.processInboundMessages(o.messages||[]);const a=Array.from(this.connections.values()).filter((e=>"pending"===e.status||e.isPending)).length;return this.logger.debug(`Processed ${n.messages?.length||0} outbound and ${o.messages?.length||0} inbound messages. Found ${a} pending connections.`),await this.checkTargetInboundTopicsForConfirmations(),await this.checkOutboundRequestsForConfirmations(),await this.fetchProfilesForConnections(),await this.fetchConnectionActivity(),this.getAllConnections()}catch(t){return this.logger.error("Error fetching connection data:",t),this.getAllConnections()}}async checkTargetInboundTopicsForConfirmations(){const e=Array.from(this.connections.values()).filter((e=>(e.isPending||"pending"===e.status)&&e.targetInboundTopicId));if(0===e.length)return;const t=new Map;e.forEach((e=>{if(e.targetInboundTopicId){const i=t.get(e.targetInboundTopicId)||[];i.push(e),t.set(e.targetInboundTopicId,i)}}));for(const[n,o]of t.entries())for(let e=1;e<=2;e++)try{const t=(await this.baseClient.getMessages(n)).messages||[];let i=!1;for(const e of o){const n=e.connectionRequestId;if(!n)continue;const o=t.find((t=>{if("connection_created"!==t.op||!t.connection_topic_id)return!1;if(t.connection_id!==n)return!1;if(e.uniqueRequestKey){const i=e.uniqueRequestKey.split(":");if(i.length>1){const n=i[1];if(t.operator_id&&t.operator_id===n)return!0;if(t.connected_account_id===e.targetAccountId)return!0}}return!0}));if(o?.connection_topic_id){i=!0;const t=o.connection_topic_id;let a=e.uniqueRequestKey;const r={connectionTopicId:t,targetAccountId:e.targetAccountId,targetAgentName:e.targetAgentName,targetInboundTopicId:e.targetInboundTopicId,status:"established",isPending:!1,needsConfirmation:!1,created:new Date(o.created||e.created),profileInfo:e.profileInfo,connectionRequestId:n,uniqueRequestKey:e.uniqueRequestKey,originTopicId:e.originTopicId,processed:e.processed,memo:e.memo};this.connections.set(t,r),a&&this.connections.delete(a),this.logger.debug(`Confirmed connection in target inbound topic: ${t}`)}}if(i||2===e)break;await new Promise((e=>setTimeout(e,500)))}catch(i){if(this.logger.debug(`Error fetching target inbound topic ${n}:`,i),2===e)break;await new Promise((e=>setTimeout(e,500)))}}async checkOutboundRequestsForConfirmations(){const e=Array.from(this.connections.values());this.logger.info(`Total connections in map: ${e.length}`);const t=e.filter((e=>"pending"===e.status));this.logger.info(`Connections with status='pending': ${t.length}`);const i=e.filter((e=>"pending"===e.status));if(Boolean(i?.length))for(const o of i){if(this.logger.debug(`Processing pending connection: ${o.connectionTopicId}`),!o.targetAccountId){this.logger.debug(`Skipping connection ${o.connectionTopicId} - no targetAccountId`);continue}let e=o.targetInboundTopicId;if(!e)try{const t=await this.baseClient.retrieveProfile(o.targetAccountId);if(!t?.profile?.inboundTopicId){this.logger.debug(`Couldn't get inbound topic ID for account ${o.targetAccountId}`);continue}e=t.profile.inboundTopicId,this.connections.set(o.connectionTopicId,{...o,targetInboundTopicId:e}),this.logger.debug(`Updated connection ${o.connectionTopicId} with inbound topic ID: ${e}`)}catch(n){this.logger.debug(`Error fetching profile for ${o.targetAccountId}: ${n}`);continue}if(!e||e.includes(":")){this.logger.debug(`Skipping invalid inbound topic format: ${e}`);continue}const t=o.connectionRequestId||o.inboundRequestId;if(t)try{this.logger.debug(`Checking for confirmations on topic ${e} for request ID ${t}`);const i=await this.baseClient.getMessages(e),n=(i.messages||[]).find((e=>"connection_created"===e.op&&e.connection_id===t&&e.connection_topic_id));if(n?.connection_topic_id){const e=n.connection_topic_id;this.logger.info(`Found confirmation for request #${t} to ${o.targetAccountId} on their inbound topic`),this.connections.set(o.connectionTopicId,{...o,connectionTopicId:e,status:"established",isPending:!1,needsConfirmation:!1,created:new Date(n.created||o.created),lastActivity:new Date(n.created||o.created)})}else this.logger.debug(`No confirmation found for request ID ${t} on topic ${e}`)}catch(n){this.logger.warn(`Error checking for confirmations on target inbound topic for ${o.targetAccountId}: ${n}`)}else this.logger.debug(`Skipping connection ${o.connectionTopicId} - no request ID`)}else this.logger.info("No pending connections found")}async fetchProfilesForConnections(){const e=new Set;for(const i of this.connections.values())i.targetAccountId&&!this.profileCache.has(i.targetAccountId)&&e.add(i.targetAccountId);const t=Array.from(e).map((async e=>{try{const t=await this.baseClient.retrieveProfile(e);t.success&&t.profile&&(this.addProfileInfo(e,t.profile),this.updatePendingConnectionsWithProfileInfo(e,t.profile))}catch(t){this.logger.debug(`Failed to fetch profile for ${e}:`,t)}}));await Promise.allSettled(t)}updatePendingConnectionsWithProfileInfo(e,t){const i=Array.from(this.connections.values()).filter((t=>t.targetAccountId===e&&(t.isPending||t.needsConfirmation)&&!t.targetInboundTopicId));if(i.length>0&&t.inboundTopicId)for(const n of i){const e={...n,targetInboundTopicId:t.inboundTopicId};this.connections.set(n.connectionTopicId,e)}}async fetchConnectionActivity(){const e=this.getActiveConnections().filter((e=>{const t=e.connectionTopicId;return!(!t||t.includes(":")||!t.match(/^0\.0\.\d+$/))||(this.logger.debug(`Skipping activity fetch for invalid topic ID format: ${t}`),!1)})).map((async e=>{try{const t=e.connectionTopicId,i=await this.baseClient.getMessages(t);i?.messages?.length>0&&this.processConnectionMessages(t,i.messages)}catch(t){this.logger.debug(`Failed to fetch activity for ${e.connectionTopicId}:`,t)}}));await Promise.allSettled(e)}shouldFilterAccount(e){return!!this.filterPendingAccountIds.has(e)&&!this.hasEstablishedConnectionWithAccount(e)}processOutboundMessages(e,t){if(!Boolean(e?.length))return Array.from(this.connections.values());const i=e.filter((e=>"connection_request"===e.op&&e.connection_request_id));for(const a of i){const e=a.connection_request_id,i=a.operator_id||"",n=this.baseClient.extractAccountFromOperatorId(i),o=this.baseClient.extractTopicFromOperatorId(i);if(this.shouldFilterAccount(n)){this.logger.debug(`Filtering out outbound request to account: ${n}`);continue}const r=Array.from(this.connections.values()).some((t=>t.connectionRequestId===e&&!t.isPending&&t.targetAccountId===n)),s=`req-${e}:${i}`;if(!r&&!this.pendingRequests.has(s)){const r={id:e,requesterId:t,requesterTopicId:a.outbound_topic_id||"",targetAccountId:n,targetTopicId:o,operatorId:i,sequenceNumber:a.sequence_number,created:a.created||new Date,memo:a.m,status:"pending"};if(this.pendingRequests.set(s,r),!this.connections.has(s)){const t={connectionTopicId:s,targetAccountId:n,targetInboundTopicId:o,status:"pending",isPending:!0,needsConfirmation:!1,created:a.created||new Date,connectionRequestId:e,uniqueRequestKey:s,originTopicId:a.outbound_topic_id||"",processed:!1,memo:a.m};this.connections.set(s,t)}}}const n=e.filter((e=>"connection_created"===e.op&&e.connection_topic_id&&e.connection_request_id));for(const a of n){const e=a.connection_request_id,t=a.connection_topic_id,i=this.baseClient.extractAccountFromOperatorId(a.operator_id||"");if(this.shouldFilterAccount(i)){this.logger.debug(`Filtering out outbound confirmation to account: ${i}`);continue}const n=`req-${e}:${a.operator_id}`,o=this.pendingRequests.get(n);if(o&&(o.status="confirmed"),this.connections.has(n)&&this.connections.delete(n),this.connections.has(t)){const i=this.connections.get(t);this.connections.set(t,{...i,status:"established",isPending:!1,needsConfirmation:!1,connectionRequestId:e,confirmedRequestId:a.confirmed_request_id,requesterOutboundTopicId:a.outbound_topic_id,uniqueRequestKey:n,originTopicId:a.outbound_topic_id||"",processed:!1,memo:a.m})}else this.connections.set(t,{connectionTopicId:t,targetAccountId:i,status:"established",isPending:!1,needsConfirmation:!1,created:a.created||new Date,connectionRequestId:e,confirmedRequestId:a.confirmed_request_id,requesterOutboundTopicId:a.outbound_topic_id,uniqueRequestKey:n,originTopicId:a.outbound_topic_id||"",processed:!1,memo:a.m})}const o=e.filter((e=>"connection_closed"===e.op||"close_connection"===e.op&&e.connection_topic_id));for(const a of o){const e=a.connection_topic_id;if(this.connections.has(e)){const t=this.connections.get(e);if(this.shouldFilterAccount(t.targetAccountId)&&"established"!==t.status)continue;const i=a.connection_request_id&&a.operator_id?`req-${a.connection_request_id}:${a.operator_id}`:void 0;this.connections.set(e,{...t,status:"closed",isPending:!1,needsConfirmation:!1,lastActivity:a.created||new Date,closedReason:a.reason,closeMethod:a.close_method,uniqueRequestKey:i,originTopicId:t.originTopicId,processed:!1,memo:a.m})}}return Array.from(this.connections.values()).filter((e=>"established"===e.status||"closed"===e.status||!this.filterPendingAccountIds.has(e.targetAccountId)))}processInboundMessages(e){if(!Boolean(e?.length))return Array.from(this.connections.values());const t=e.filter((e=>"connection_request"===e.op&&e.sequence_number)),i=e.filter((e=>"connection_created"===e.op&&e.connection_topic_id&&e.connection_id));for(const n of t){const e=n.sequence_number,t=n.operator_id||"",o=this.baseClient.extractAccountFromOperatorId(t),a=this.baseClient.extractTopicFromOperatorId(t);if(this.shouldFilterAccount(o)){this.logger.debug(`Filtering out request from account: ${o}`);continue}const r=`inb-${e}:${t}`;i.some((t=>t.connection_id===e))?this.logger.debug(`Skipping request from ${o} as it has already been confirmed`):this.connections.has(r)||this.connections.set(r,{connectionTopicId:r,targetAccountId:o,targetInboundTopicId:a,status:"needs_confirmation",isPending:!1,needsConfirmation:!0,created:n.created||new Date,inboundRequestId:e,uniqueRequestKey:r,originTopicId:a,processed:!1,memo:n.m})}for(const n of i){const e=n.connection_id,t=n.connection_topic_id,i=n.connected_account_id||"",o=n.operator_id||"";if(this.shouldFilterAccount(i)){this.logger.debug(`Filtering out confirmation for account: ${i}`);continue}const a=`inb-${e}:${o}`;if(this.connections.has(a)&&this.connections.delete(a),this.connections.has(t)){const i=this.connections.get(t);this.connections.set(t,{...i,status:"established",isPending:!1,needsConfirmation:!1,inboundRequestId:e,uniqueRequestKey:a,originTopicId:n.connection_topic_id,processed:!1,memo:n.m})}else this.connections.set(t,{connectionTopicId:t,targetAccountId:i,status:"established",isPending:!1,needsConfirmation:!1,created:n.created||new Date,inboundRequestId:e,uniqueRequestKey:a,originTopicId:n.connection_topic_id,processed:!1,memo:n.m})}return Array.from(this.connections.values()).filter((e=>"established"===e.status||"closed"===e.status||!this.filterPendingAccountIds.has(e.targetAccountId)))}processConnectionMessages(e,t){if(!t||0===t.length||!this.connections.has(e))return this.connections.get(e);const i=t.filter((e=>e.created)).sort(((e,t)=>{const i=e.created?new Date(e.created).getTime():0;return(t.created?new Date(t.created).getTime():0)-i}))[0];if(i?.created){const t=this.connections.get(e);this.connections.set(e,{...t,lastActivity:i.created})}const n=t.find((e=>"close_connection"===e.op));if(n){const t=this.connections.get(e);this.connections.set(e,{...t,status:"closed",lastActivity:n.created||new Date,closedReason:n.reason,closeMethod:"explicit"})}return this.connections.get(e)}addProfileInfo(e,t){this.profileCache.set(e,t);const i=Array.from(this.connections.values()).filter((t=>t.targetAccountId===e));for(const n of i)this.connections.set(n.connectionTopicId,{...n,profileInfo:t,targetAgentName:t.display_name,targetInboundTopicId:t.inboundTopicId,targetOutboundTopicId:t.outboundTopicId})}getAllConnections(){return Array.from(this.connections.values()).filter((e=>"established"===e.status||"closed"===e.status||!this.filterPendingAccountIds.has(e.targetAccountId)))}getPendingRequests(){return Array.from(this.connections.values()).filter((e=>e.isPending&&!this.filterPendingAccountIds.has(e.targetAccountId)))}hasEstablishedConnectionWithAccount(e){return Array.from(this.connections.values()).some((t=>t.targetAccountId===e&&"established"===t.status))}getActiveConnections(){return Array.from(this.connections.values()).filter((e=>"established"===e.status))}getConnectionsNeedingConfirmation(){return Array.from(this.connections.values()).filter((e=>e.needsConfirmation&&!this.filterPendingAccountIds.has(e.targetAccountId)))}getConnectionByTopicId(e){return this.connections.get(e)}getConnectionByAccountId(e){return Array.from(this.connections.values()).find((t=>t.targetAccountId===e&&"established"===t.status))}getConnectionsByAccountId(e){return Array.from(this.connections.values()).filter((t=>t.targetAccountId===e))}updateOrAddConnection(e){this.connections.set(e.connectionTopicId,e)}clearAll(){this.connections.clear(),this.pendingRequests.clear()}isConnectionRequestProcessed(e,t){for(const i of this.connections.values()){if(i.originTopicId===e&&i.inboundRequestId===t&&i.processed)return!0;if(i.originTopicId===e&&i.connectionRequestId===t&&i.processed)return!0}return!1}markConnectionRequestProcessed(e,t){let i=!1;for(const[n,o]of this.connections.entries())o.originTopicId===e&&o.inboundRequestId===t&&(this.connections.set(n,{...o,processed:!0}),i=!0,this.logger.debug(`Marked inbound connection request #${t} on topic ${e} as processed`)),o.originTopicId===e&&o.connectionRequestId===t&&(this.connections.set(n,{...o,processed:!0}),i=!0,this.logger.debug(`Marked outbound connection request #${t} on topic ${e} as processed`));return i}async getPendingTransactions(e,t){try{const n=await this.baseClient.getTransactionRequests(e,t?{...t}:void 0),o=[];for(const e of n)try{const t=await this.baseClient.mirrorNode.getScheduledTransactionStatus(e.schedule_id);t.executed||t.deleted||o.push(e)}catch(i){this.logger.error(`Error checking transaction status: ${i}`),o.push(e)}return o}catch(i){return this.logger.error(`Error getting pending transactions: ${i}`),[]}}getScheduledTransactionStatus(e){return this.baseClient.mirrorNode.getScheduledTransactionStatus(e)}async getLastOperatorActivity(e,t){try{const i=(await this.baseClient.getMessageStream(e)).messages.filter((e=>e.operator_id&&e.operator_id.includes(t)&&e.created));if(0===i.length)return;return i.sort(((e,t)=>t.created.getTime()-e.created.getTime())),i[0].created}catch(i){return void this.logger.error(`Error getting last operator activity: ${i}`)}}},exports.CustomFeeType=ip,exports.EVMBridge=class{constructor(e="mainnet-public",t="mirrornode.hedera.com/api/v1/contracts/call",i){this.network=e,this.mirrorNodeUrl=t,this.cache=i||new m,this.logger=d.getInstance({module:"EVMBridge"})}async executeCommands(e,t={}){let o={...t};const a={};for(const s of e){const e=`${s.c.contractAddress}-${s.c.abi.name}`,t=await this.cache.get(e);if(t)a[s.c.abi.name]=JSON.parse(t),Object.assign(o,a[s.c.abi.name]);else try{const t=new n.ethers.Interface([{...s.c.abi}]),r=t.encodeFunctionData(s.c.abi.name),c=i.ContractId.fromSolidityAddress(s.c.contractAddress),p=await this.readFromMirrorNode(r,i.AccountId.fromString("0.0.800"),c);if(this.logger.info(`Result for ${s.c.contractAddress}:`,p?.result),!p?.result){this.logger.warn(`Failed to get result from mirror node for ${s.c.contractAddress}`),a[s.c.abi.name]="0",Object.assign(o,a[s.c.abi.name]);continue}const l=t?.decodeFunctionResult(s.c.abi.name,p.result);let u={values:[]};l&&s.c.abi.outputs?.forEach(((e,t)=>{const i=f(l[t],e.type);u.values.push(i),e.name&&(u[e.name]=i)})),await this.cache.set(e,JSON.stringify(u)),a[s.c.abi.name]=u,o[s.c.abi.name]=u}catch(r){this.logger.error(`Error executing command for ${s.c.contractAddress}:`,r),a[s.c.abi.name]="0",Object.assign(o,a[s.c.abi.name])}}return{results:a,stateData:o}}async executeCommand(e,t={}){const{results:i,stateData:n}=await this.executeCommands([e],t);return{result:i[e.c.abi.name],stateData:n}}async readFromMirrorNode(e,t,i){try{const n=i.toSolidityAddress(),o=t.toSolidityAddress(),a=await fetch(`https://${this.network}.${this.mirrorNodeUrl}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({block:"latest",data:e,estimate:!1,gas:3e5,gasPrice:1e8,from:o.startsWith("0x")?o:`0x${o}`,to:n?.startsWith("0x")?n:`0x${n}`,value:0})});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}catch(n){return this.logger.error("Error reading from mirror node:",n),null}}async clearCache(){await this.cache.clear()}async clearCacheForContract(e,t){await this.cache.delete(`${e}-${t}`)}setLogLevel(e){this.logger.setLogLevel(e)}},exports.EndpointType=ac,exports.FeeConfigBuilder=np,exports.HCS=class{constructor(){this.modelViewerLoaded=!1,this.modelViewerLoading=null,this.config={cdnUrl:"https://kiloscribe.com/api/inscription-cdn/",network:"mainnet",retryAttempts:3,retryBackoff:300,debug:!1,showLoadingIndicator:!1,loadingCallbackName:null},this.configMapping={hcsCdnUrl:"cdnUrl",hcsNetwork:"network",hcsRetryAttempts:"retryAttempts",hcsRetryBackoff:"retryBackoff",hcsDebug:"debug",hcsShowLoadingIndicator:"showLoadingIndicator",hcsLoadingCallbackName:"loadingCallbackName"},this.LoadedScripts={},this.LoadedWasm={},this.LoadedImages={},this.LoadedVideos={},this.LoadedAudios={},this.LoadedAudioUrls={},this.LoadedGLBs={},this.scriptLoadedEvent=new Event("HCSScriptLoaded"),this.loadQueue=[],this.isProcessingQueue=!1;try{this.logger=d.getInstance({module:"HCS-3",level:this.config.debug?"debug":"error"})}catch(e){this.logger=this.createFallbackLogger()}}createFallbackLogger(){return{debug:(...e)=>this.config.debug&&console.debug("[HCS-3]",...e),info:(...e)=>this.config.debug&&console.info("[HCS-3]",...e),warn:(...e)=>console.warn("[HCS-3]",...e),error:(...e)=>console.error("[HCS-3]",...e),setLogLevel:e=>{this.config.debug="debug"===e}}}log(...e){if(0===e.length)this.logger.debug("");else if(1===e.length)this.logger.debug(String(e[0]));else{const t=String(e[0]),i=e.slice(1);this.logger.debug(t,i)}}error(...e){if(0===e.length)this.logger.error("");else if(1===e.length)this.logger.error(String(e[0]));else{const t=String(e[0]),i=e.slice(1);this.logger.error(t,i)}}loadConfigFromHTML(){const e=document.querySelector("script[data-hcs-config]");e&&(Object.keys(this.configMapping).forEach((t=>{if(e.dataset[t]){const i=this.configMapping[t];let n=e.dataset[t];"true"===n&&(n=!0),"false"===n&&(n=!1),isNaN(Number(n))||""===n||(n=Number(n)),this.config[i]=n}})),this.logger.setLogLevel(this.config.debug?"debug":"error")),this.log("Loaded config:",this.config)}updateLoadingStatus(e,t){if("loaded"!==this.LoadedScripts[e]&&(this.config.showLoadingIndicator&&console.log("[HCS Loading] "+e+" : "+t),this.LoadedScripts[e]=t,this.config.loadingCallbackName&&"function"==typeof window[this.config.loadingCallbackName])){const i=window[this.config.loadingCallbackName];"function"==typeof i&&i(e,t)}}async fetchWithRetry(e,t=this.config.retryAttempts,i=this.config.retryBackoff){try{const t=await fetch(e);if(!t.ok)throw new Error("HTTP error! status: "+t.status);return t}catch(n){if(t>0)return this.log("Retrying fetch for "+e+" Attempts left: "+(t-1)),await this.sleep(i),this.fetchWithRetry(e,t-1,2*i);throw n}}sleep(e){return new Promise((t=>setTimeout(t,e)))}isDuplicate(e){return!!this.LoadedScripts[e]}async retrieveHCS1Data(e,t=this.config.cdnUrl,i=this.config.network){const n=i.replace(/['"]+/g,""),o=await this.fetchWithRetry(t+e+"?network="+n);return await o.blob()}async loadScript(e){const t=e.getAttribute("data-src"),i=e.getAttribute("data-script-id"),n=t?.split("/").pop(),o=e.getAttribute("type"),a=e.hasAttribute("data-required"),r="module"===e.getAttribute("type");if(!this.isDuplicate(n||"")){this.updateLoadingStatus(i,"loading");try{const t=e.getAttribute("data-cdn-url")||this.config.cdnUrl,s=e.getAttribute("data-network")||this.config.network,c=await this.retrieveHCS1Data(n,t,s);if("wasm"===o){const t=await c.arrayBuffer(),n=await WebAssembly.compile(t);this.LoadedWasm[i]=await WebAssembly.instantiate(n,{env:{},...e.dataset}),this.updateLoadingStatus(i,"loaded"),window.dispatchEvent(this.scriptLoadedEvent),this.log("Loaded wasm: "+i)}else{const e=await c.text(),t=document.createElement("script");if(t.textContent=e,t.className="hcs-inline-script",i&&t.setAttribute("data-loaded-script-id",i),r){t.type="module";const i=new Blob([e],{type:"application/javascript"});t.src=URL.createObjectURL(i)}document.body.appendChild(t),this.updateLoadingStatus(i,"loaded"),window.dispatchEvent(this.scriptLoadedEvent),this.log("Loaded script: "+i),t.onerror=e=>{if(this.error("Failed to load "+o+": "+i,e),this.updateLoadingStatus(i,"failed"),a)throw e}}}catch(s){if(this.error("Failed to load "+o+": "+i,s),this.updateLoadingStatus(i,"failed"),a)throw s}}}async loadModuleExports(e){const t=document.querySelector('script[data-loaded-script-id="'+e+'"]');if(!t)throw new Error("Module script with id "+e+" not found");const i=t.getAttribute("src");if(!i)throw new Error("Module script "+e+" has no src attribute");try{return await import(i)}catch(n){throw this.error("Failed to import module",n),n}}async loadStylesheet(e){const t=e.getAttribute("data-src"),i=e.getAttribute("data-script-id"),n=t?.split("/").pop(),o=e.hasAttribute("data-required");if(!this.isDuplicate(n||"")){this.updateLoadingStatus(i,"loading");try{const t=e.getAttribute("data-cdn-url")||this.config.cdnUrl,o=e.getAttribute("data-network")||this.config.network,a=await this.retrieveHCS1Data(n,t,o),r=await a.text(),s=document.createElement("style");s.textContent=r,document.head.appendChild(s),this.updateLoadingStatus(i,"loaded"),window.dispatchEvent(this.scriptLoadedEvent),this.log("Loaded and inlined stylesheet: "+i)}catch(a){if(this.error("Failed to load stylesheet: "+i,a),this.updateLoadingStatus(i,"failed"),o)throw a}}}async loadImage(e){const t=e.getAttribute("data-src"),i=t?.split("/").pop();this.log("Loading image: "+i),this.updateLoadingStatus("Image: "+i,"loaded");try{const t=e.getAttribute("data-cdn-url")||this.config.cdnUrl,n=e.getAttribute("data-network")||this.config.network,o=await this.retrieveHCS1Data(i,t,n),a=URL.createObjectURL(o);e.src=a,this.LoadedImages[i]=a,this.updateLoadingStatus("Image: "+i,"loaded"),this.log("Loaded image: "+i)}catch(n){this.error("Failed to load image: "+i,n),this.updateLoadingStatus("Image: "+i,"failed")}}async loadMedia(e,t){const i=e.getAttribute("data-src"),n=i?.split("/").pop();this.log("Loading "+t+": "+n),this.updateLoadingStatus(t+": "+n,"loading");try{const i=e.getAttribute("data-cdn-url")||this.config.cdnUrl,o=e.getAttribute("data-network")||this.config.network,a=await this.retrieveHCS1Data(n,i,o),r=URL.createObjectURL(a);e.src=r,"video"===t?this.LoadedVideos[n]=r:this.LoadedAudioUrls[n]=r,this.updateLoadingStatus(t+": "+n,"loaded"),this.log("Loaded "+t+": "+n)}catch(o){this.error("Failed to load "+t+": "+n,o),this.updateLoadingStatus(t+": "+n,"failed")}}async loadModelViewer(){return this.modelViewerLoading?this.modelViewerLoading:this.modelViewerLoaded?Promise.resolve():(this.modelViewerLoading=new Promise((e=>{const t=document.createElement("script");t.setAttribute("data-src","hcs://1/0.0.7293044"),t.setAttribute("data-script-id","model-viewer"),t.setAttribute("type","module"),window.addEventListener("HCSScriptLoaded",(()=>{this.modelViewerLoaded=!0,e()}),{once:!0}),this.loadScript(t)})),this.modelViewerLoading)}async loadGLB(e){await this.loadModelViewer();const t=e.getAttribute("data-src"),i=t?.split("/").pop();this.log("Loading GLB: "+i),this.updateLoadingStatus("GLB: "+i,"loading");try{const t=e.getAttribute("data-cdn-url")||this.config.cdnUrl,n=e.getAttribute("data-network")||this.config.network;let o;"model-viewer"!==e.tagName.toLowerCase()?(o=document.createElement("model-viewer"),Array.from(e.attributes).forEach((e=>{o.setAttribute(e.name,e.value)})),o.setAttribute("camera-controls",""),o.setAttribute("auto-rotate",""),o.setAttribute("ar",""),e.parentNode?.replaceChild(o,e)):o=e;const a=await this.retrieveHCS1Data(i,t,n),r=URL.createObjectURL(a);o.setAttribute("src",r),this.LoadedGLBs[i]=r,this.updateLoadingStatus("GLB: "+i,"loaded"),this.log("Loaded GLB: "+i)}catch(n){this.error("Failed to load GLB: "+i,n),this.updateLoadingStatus("GLB: "+i,"failed")}}async loadResource(e,t,i){return new Promise((n=>{this.loadQueue.push({element:e,type:t,order:i,resolve:n}),this.processQueue()}))}async processQueue(){if(!this.isProcessingQueue){for(this.isProcessingQueue=!0;this.loadQueue.length>0;){const t=this.loadQueue.shift();try{"script"===t.type?await this.loadScript(t.element):"image"===t.type?await this.loadImage(t.element):"video"===t.type||"audio"===t.type?await this.loadMedia(t.element,t.type):"glb"===t.type?await this.loadGLB(t.element):"css"===t.type&&await this.loadStylesheet(t.element),t.resolve()}catch(e){if(this.error("Error processing queue item:",e),"script"===t.type&&t.element.hasAttribute("data-required"))break}}this.isProcessingQueue=!1}}async replaceHCSInStyle(e){let t=e,i=t.indexOf("hcs://");for(;-1!==i;){let e=i;for(;e<t.length&&!["'",'"'," ",")"].includes(t[e]);)e++;const o=t.substring(i,e),a=o.split("/").pop();try{const n=this.config.cdnUrl,r=this.config.network,s=await this.retrieveHCS1Data(a,n,r),c=URL.createObjectURL(s);t=t.substring(0,i)+c+t.substring(e),this.LoadedImages[a]=c,this.log("Replaced CSS HCS URL: "+o+" with "+c)}catch(n){this.error("Failed to load CSS image: "+a,n)}i=t.indexOf("hcs://",i+1)}return t}async processInlineStyles(){const e=document.querySelectorAll('[style*="hcs://"]');this.log("Found "+e.length+" elements with HCS style references");for(const i of Array.from(e)){const e=i.getAttribute("style");if(e){this.log("Processing style: "+e);const t=await this.replaceHCSInStyle(e);e!==t&&(i.setAttribute("style",t),this.log("Updated style to: "+t))}}const t=document.querySelectorAll("style");for(const i of Array.from(t))if(i.textContent?.includes("hcs://")){const e=await this.replaceHCSInStyle(i.textContent);i.textContent!==e&&(i.textContent=e)}}async init(){return this.loadConfigFromHTML(),new Promise((e=>{const t=async()=>{const t=document.querySelectorAll('script[data-src^="hcs://"]'),i=document.querySelectorAll('img[data-src^="hcs://"], img[src^="hcs://"]'),n=document.querySelectorAll('video[data-src^="hcs://"], video[src^="hcs://"]'),o=document.querySelectorAll('audio[data-src^="hcs://"], audio[src^="hcs://"]'),a=document.querySelectorAll('model-viewer[data-src^="hcs://"]'),r=document.querySelectorAll('link[data-src^="hcs://"]');document.querySelectorAll('[src^="hcs://"]').forEach((e=>{const t=e.getAttribute("src");t&&(e.setAttribute("data-src",t),e.removeAttribute("src"))})),await this.processInlineStyles();const s=[];[{elements:t,type:"script"},{elements:i,type:"image"},{elements:n,type:"video"},{elements:o,type:"audio"},{elements:a,type:"glb"},{elements:r,type:"css"}].forEach((({elements:e,type:t})=>{e.forEach((e=>{const i=parseInt(e.getAttribute("data-load-order")||"")||1/0;s.push(this.loadResource(e,t,i))}))})),await Promise.all(s);const c=new MutationObserver((e=>{e.forEach((e=>{if(e.addedNodes.forEach((e=>{if(e.nodeType===Node.ELEMENT_NODE){const t=e;if(t.getAttribute("style")?.includes("hcs://")&&this.processInlineStyles(),"style"===t.tagName.toLowerCase()&&t.textContent?.includes("hcs://")&&this.processInlineStyles(),t.getAttribute("src")?.startsWith("hcs://")){const e=t.getAttribute("src");t.setAttribute("data-src",e),t.removeAttribute("src");switch(t.tagName.toLowerCase()){case"img":this.loadResource(t,"image",1/0);break;case"video":this.loadResource(t,"video",1/0);break;case"audio":this.loadResource(t,"audio",1/0);break;case"script":this.loadResource(t,"script",1/0)}}t.matches('script[data-src^="hcs://"]')?this.loadResource(t,"script",1/0):t.matches('img[data-src^="hcs://"]')?this.loadResource(t,"image",1/0):t.matches('video[data-src^="hcs://"]')?this.loadResource(t,"video",1/0):t.matches('audio[data-src^="hcs://"]')?this.loadResource(t,"audio",1/0):t.matches('model-viewer[data-src^="hcs://"]')?this.loadResource(t,"glb",1/0):t.matches('link[data-src^="hcs://"]')&&this.loadResource(t,"css",1/0);t.querySelectorAll('[data-src^="hcs://"], [src^="hcs://"]').forEach((e=>{const t=e,i=t.tagName.toLowerCase(),n=t.getAttribute("src");switch(n?.startsWith("hcs://")&&(t.setAttribute("data-src",n),t.removeAttribute("src")),i){case"script":this.loadResource(t,"script",1/0);break;case"img":this.loadResource(t,"image",1/0);break;case"video":this.loadResource(t,"video",1/0);break;case"audio":this.loadResource(t,"audio",1/0);break;case"model-viewer":this.loadResource(t,"glb",1/0);break;case"link":this.loadResource(t,"css",1/0)}}))}})),"attributes"===e.type){const t=e.target;if("style"===e.attributeName&&t.getAttribute("style")?.includes("hcs://"))this.processInlineStyles();else if("src"===e.attributeName){const e=t.getAttribute("src");if(e?.startsWith("hcs://")){t.setAttribute("data-src",e),t.removeAttribute("src");const i=t.tagName.toLowerCase();["img","video","audio"].includes(i)&&this.loadResource(t,i,1/0)}}}}))}));document.body?c.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","src","data-src"]}):document.addEventListener("DOMContentLoaded",(()=>{c.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","src","data-src"]})})),e()};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}))}async preloadImage(e){this.log("Loading image:"+e),this.updateLoadingStatus("image: "+e,"loading");const t=await this.retrieveHCS1Data(e),i=URL.createObjectURL(t);return this.LoadedImages[e]=i,this.updateLoadingStatus("image: "+e,"loaded"),i}async preloadAudio(e){const t=document.createElement("audio");t.setAttribute("data-topic-id",e),t.setAttribute("data-src","hcs://1/"+e),document.body.appendChild(t),await this.loadMedia(t,"audio");const i=document.querySelector('audio[data-topic-id="'+e+'"]');return i?this.LoadedAudioUrls[e]=i.src:console.error("Failed to preload audio: "+e),this.LoadedAudioUrls[e]}async playAudio(e,t=1){const i=this.LoadedAudioUrls[e];if(i){const n=new Audio(i);n.volume=t,this.LoadedAudios[e]=n,n.play().catch((e=>{console.error("Failed to play audio:",e)})),n.addEventListener("ended",(()=>{n.remove(),delete this.LoadedAudios[e]}))}else console.error("Audio not preloaded: "+e)}async pauseAudio(e){const t=document.querySelector('audio[data-topic-id="'+e+'"]');t?(console.log("found element",t),t.pause(),this.LoadedAudios[e]?.pause()):this.LoadedAudios[e]?.pause()}async loadAndPlayAudio(e,t=!1,i=1){let n=document.querySelector('audio[data-topic-id="'+e+'"]');if(n)n.volume=i,await n.play();else{const o=document.createElement("audio");o.volume=i,t&&o.setAttribute("autoplay","autoplay"),o.setAttribute("data-topic-id",e),o.setAttribute("data-src","hcs://1/"+e),document.body.appendChild(o),await this.loadMedia(o,"audio"),n=document.querySelector('audio[data-topic-id="'+e+'"]'),t||await n.play()}}},exports.HCS10BaseClient=_c,exports.HCS10Cache=Cc,exports.HCS10Client=jc,exports.HCS11Client=Tc,exports.HCS20BaseClient=tp,exports.HCS20BurnMessageSchema=Kc,exports.HCS20Client=class extends tp{constructor(e){super(e),this.initialized=!1,this.operatorId="string"==typeof e.operatorId?i.AccountId.fromString(e.operatorId):e.operatorId,this.operatorKeyString=e.operatorKey,this.client="mainnet"===this.network?i.Client.forMainnet():i.Client.forTestnet();try{const{privateKey:t,detectedType:i}=ic(e.operatorKey);this.operatorKey=t,this.keyType=i,this.client.setOperator(this.operatorId,this.operatorKey),this.initialized=!0}catch(t){this.logger.debug("Failed to detect key type from string, will initialize later")}}async initializeOperator(){if(!this.initialized)try{const e=await this.mirrorNode.requestAccount(this.operatorId.toString()),t=e?.key?._type;t?.includes("ECDSA")?this.keyType="ecdsa":(t?.includes("ED25519"),this.keyType="ed25519"),this.operatorKey="ecdsa"===this.keyType?i.PrivateKey.fromStringECDSA(this.operatorKeyString):i.PrivateKey.fromStringED25519(this.operatorKeyString),this.client.setOperator(this.operatorId,this.operatorKey),this.initialized=!0,this.logger.debug(`Initialized operator with key type: ${this.keyType}`)}catch(e){this.logger.warn("Failed to query mirror node for key type, using ED25519"),this.keyType="ed25519",this.operatorKey=i.PrivateKey.fromStringED25519(this.operatorKeyString),this.client.setOperator(this.operatorId,this.operatorKey),this.initialized=!0}}async ensureInitialized(){this.initialized||await this.initializeOperator()}async submitPayload(e,t,n){const o="string"==typeof t?t:JSON.stringify(t),a=(new i.TopicMessageSubmitTransaction).setTopicId(i.TopicId.fromString(e)).setMessage(o);let r;if(n){const e=a.freezeWith(this.client),t=await e.sign(n);r=await t.execute(this.client)}else r=await a.execute(this.client);const s=await r.getReceipt(this.client);if(!s||s.status!==i.Status.Success)throw new Error("Failed to submit message to topic");return{receipt:s,transactionId:r.transactionId.toString()}}async createPublicTopic(e){await this.ensureInitialized(),this.logger.info("Creating public HCS-20 topic...");const t=await(new i.TopicCreateTransaction).setTopicMemo(e||"HCS-20 Public Topic").execute(this.client),n=await t.getReceipt(this.client);if(n.status!==i.Status.Success||!n.topicId)throw new Error("Failed to create public topic");const o=n.topicId.toString();return this.logger.info(`Created public topic: ${o}`),this.publicTopicId=o,o}async createRegistryTopic(e){await this.ensureInitialized(),this.logger.info("Creating HCS-20 registry topic...");const t=await(new i.TopicCreateTransaction).setTopicMemo(e||"HCS-20 Registry").execute(this.client),n=await t.getReceipt(this.client);if(n.status!==i.Status.Success||!n.topicId)throw new Error("Failed to create registry topic");const o=n.topicId.toString();return this.logger.info(`Created registry topic: ${o}`),this.registryTopicId=o,o}async deployPoints(e){await this.ensureInitialized();const{progressCallback:t}=e;try{let n;if(t?.({stage:"creating-topic",percentage:20}),e.usePrivateTopic){const t=await(new i.TopicCreateTransaction).setTopicMemo(e.topicMemo||`HCS-20: ${e.name}`).setSubmitKey(this.operatorKey.publicKey).setAdminKey(this.operatorKey.publicKey).execute(this.client),o=await t.getReceipt(this.client);if(o.status!==i.Status.Success||!o.topicId)throw new Zc("Failed to create topic",e.tick);n=o.topicId.toString(),this.logger.info(`Created private topic: ${n}`)}else n=this.publicTopicId;t?.({stage:"submitting-deploy",percentage:50,topicId:n});const o={p:"hcs-20",op:"deploy",name:e.name,tick:this.normalizeTick(e.tick),max:e.maxSupply,lim:e.limitPerMint,metadata:e.metadata,m:e.topicMemo},a=this.validateMessage(o);if(!a.valid)throw new Yc("Invalid deploy message",a.errors);const{transactionId:r}=await this.submitPayload(n,o);t?.({stage:"confirming",percentage:80,topicId:n,deployTxId:r}),await this.waitForMirrorNodeConfirmation(n,r),t?.({stage:"complete",percentage:100,topicId:n,deployTxId:r});return{name:e.name,tick:this.normalizeTick(e.tick),maxSupply:e.maxSupply,limitPerMint:e.limitPerMint,metadata:e.metadata,topicId:n,deployerAccountId:this.operatorId.toString(),currentSupply:"0",deploymentTimestamp:(new Date).toISOString(),isPrivate:e.usePrivateTopic||!1}}catch(n){throw t?.({stage:"complete",percentage:100,error:n instanceof Error?n.message:"Unknown error"}),n}}async mintPoints(e){await this.ensureInitialized();const{progressCallback:t}=e;try{t?.({stage:"validating",percentage:20});const i=this.normalizeTick(e.tick);t?.({stage:"submitting",percentage:50});const n={p:"hcs-20",op:"mint",tick:i,amt:e.amount,to:this.accountToString(e.to),m:e.memo},o=e.topicId||this.publicTopicId,{transactionId:a}=await this.submitPayload(o,n);t?.({stage:"confirming",percentage:80,mintTxId:a}),await this.waitForMirrorNodeConfirmation(o,a),t?.({stage:"complete",percentage:100,mintTxId:a});return{id:a,operation:"mint",tick:i,amount:e.amount,to:this.accountToString(e.to),timestamp:(new Date).toISOString(),sequenceNumber:0,topicId:o,transactionId:a,memo:e.memo}}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async transferPoints(e){await this.ensureInitialized();const{progressCallback:t}=e;try{t?.({stage:"validating-balance",percentage:20});const i=this.normalizeTick(e.tick),n=this.accountToString(e.from),o=this.accountToString(e.to);if(n!==this.operatorId.toString())throw new Jc("For public topics, transaction payer must match sender",e.tick,n,o,e.amount);t?.({stage:"submitting",percentage:50});const a={p:"hcs-20",op:"transfer",tick:i,amt:e.amount,from:n,to:o,m:e.memo},r=e.topicId||this.publicTopicId,{transactionId:s}=await this.submitPayload(r,a);t?.({stage:"confirming",percentage:80,transferTxId:s}),await this.waitForMirrorNodeConfirmation(r,s),t?.({stage:"complete",percentage:100,transferTxId:s});return{id:s,operation:"transfer",tick:i,amount:e.amount,from:n,to:o,timestamp:(new Date).toISOString(),sequenceNumber:0,topicId:r,transactionId:s,memo:e.memo}}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async burnPoints(e){await this.ensureInitialized();const{progressCallback:t}=e;try{t?.({stage:"validating-balance",percentage:20});const i=this.normalizeTick(e.tick),n=this.accountToString(e.from);if(n!==this.operatorId.toString())throw new Xc("For public topics, transaction payer must match burner",e.tick,n,e.amount);t?.({stage:"submitting",percentage:50});const o={p:"hcs-20",op:"burn",tick:i,amt:e.amount,from:n,m:e.memo},a=e.topicId||this.publicTopicId,{transactionId:r}=await this.submitPayload(a,o);t?.({stage:"confirming",percentage:80,burnTxId:r}),await this.waitForMirrorNodeConfirmation(a,r),t?.({stage:"complete",percentage:100,burnTxId:r});return{id:r,operation:"burn",tick:i,amount:e.amount,from:n,timestamp:(new Date).toISOString(),sequenceNumber:0,topicId:a,transactionId:r,memo:e.memo}}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async registerTopic(e){await this.ensureInitialized();const{progressCallback:t}=e;try{t?.({stage:"validating",percentage:20});const i={p:"hcs-20",op:"register",name:e.name,metadata:e.metadata,private:e.isPrivate,t_id:this.topicToString(e.topicId),m:e.memo},n=this.validateMessage(i);if(!n.valid)throw new Yc("Invalid register message",n.errors);t?.({stage:"submitting",percentage:50});const{transactionId:o}=await this.submitPayload(this.registryTopicId,i);t?.({stage:"confirming",percentage:80,registerTxId:o}),await this.waitForMirrorNodeConfirmation(this.registryTopicId,o),t?.({stage:"complete",percentage:100,registerTxId:o}),this.logger.info(`Registered topic ${e.topicId} in registry`)}catch(i){throw t?.({stage:"complete",percentage:100,error:i instanceof Error?i.message:"Unknown error"}),i}}async waitForMirrorNodeConfirmation(e,t,i=10){for(let o=0;o<i;o++){try{const i=await this.mirrorNode.getTopicMessages(e,{limit:10,order:"desc"});if(i.some((e=>e.consensus_timestamp)))return void this.logger.debug(`Transaction ${t} confirmed on mirror node`)}catch(n){this.logger.debug(`Mirror node check attempt ${o+1} failed:`,n)}await Sc(2e3)}this.logger.warn(`Transaction ${t} not found on mirror node after ${i} attempts`)}},exports.HCS20DeployMessageSchema=zc,exports.HCS20Error=Gc,exports.HCS20MessageSchema=Vc,exports.HCS20MintMessageSchema=qc,exports.HCS20PointsIndexer=class{constructor(e,t,i){this.isProcessing=!1,this.lastIndexedSequence=new Map,this.logger=t||new d({level:"info",module:"HCS20PointsIndexer"}),this.mirrorNode=new Ws(e,this.logger,{customUrl:i}),this.state=this.initializeState()}initializeState(){return{deployedPoints:new Map,balances:new Map,transactions:[],lastProcessedSequence:0,lastProcessedTimestamp:(new Date).toISOString()}}getState(){return{...this.state,deployedPoints:new Map(this.state.deployedPoints),balances:new Map(this.state.balances),transactions:[...this.state.transactions]}}getPointsInfo(e){return this.state.deployedPoints.get(this.normalizeTick(e))}getBalance(e,t){const i=this.normalizeTick(e),n=this.state.balances.get(i);if(!n)return"0";const o=n.get(t);return o?.balance||"0"}async startIndexing(e){if(this.isProcessing)return void this.logger.warn("Indexing already in progress");this.isProcessing=!0;const t=e?.publicTopicId||Lc.PUBLIC_TOPIC_ID,i=e?.registryTopicId||Lc.REGISTRY_TOPIC_ID,n=e?.pollInterval||3e4;await this.indexTopics(t,i,e?.privateTopics);const o=async()=>{if(this.isProcessing){try{await this.indexTopics(t,i,e?.privateTopics)}catch(a){this.logger.error("Polling error:",a)}this.isProcessing&&setTimeout(o,n)}};setTimeout(o,n)}async indexOnce(e){const t=e?.publicTopicId||Lc.PUBLIC_TOPIC_ID,i=e?.registryTopicId||Lc.REGISTRY_TOPIC_ID;await this.indexTopics(t,i,e?.privateTopics)}stopIndexing(){this.isProcessing=!1,this.logger.info("Indexing stopped")}async indexTopics(e,t,i){this.logger.debug("Starting indexing cycle"),await this.indexTopic(e,!1);const n=[...await this.getRegisteredTopics(t),...i||[]];for(const o of n)await this.indexTopic(o,!0);this.logger.debug("Indexing cycle complete")}async getRegisteredTopics(e){const t=[];try{const n=await this.mirrorNode.getTopicMessages(e,{limit:100,order:"asc"});for(const e of n)try{const i=e.data||e;i&&"object"==typeof i&&"hcs-20"===i.p&&"register"===i.op&&i.t_id&&t.push(i.t_id)}catch(i){continue}}catch(i){this.logger.error("Failed to fetch registry messages:",i)}return t}async indexTopic(e,t){try{const n=this.lastIndexedSequence.get(e);this.logger.debug(`Indexing topic ${e}, starting from sequence ${n||0}`);const o=await this.mirrorNode.getTopicMessages(e,{sequenceNumber:n?n+1:void 0,limit:1e3,order:"asc"});this.logger.debug(`Fetched ${o.length} messages from topic ${e}`);let a=n||0;for(const r of o)try{const i=r;if(!i.p||"hcs-20"!==i.p)continue;const n=i,o=i.sequence_number||0;this.logger.debug(`Found HCS-20 message: op=${n.op}, sequence=${o}`),o>a&&(a=o);const s={consensus_timestamp:i.consensus_timestamp||"",sequence_number:o,payer_account_id:i.payer_account_id||"",transaction_id:i.transaction_id||""};this.processMessage(n,s,e,t),this.state.lastProcessedSequence++,this.state.lastProcessedTimestamp=i.consensus_timestamp||""}catch(i){this.logger.debug(`Failed to process message: ${i}`);continue}a>(n||0)&&this.lastIndexedSequence.set(e,a)}catch(i){this.logger.error(`Failed to index topic ${e}:`,i)}}processMessage(e,t,i,n){switch(e.op){case"deploy":this.processDeployMessage(e,t,i,n);break;case"mint":this.processMintMessage(e,t,i,n);break;case"transfer":this.processTransferMessage(e,t,i,n);break;case"burn":this.processBurnMessage(e,t,i,n)}}processDeployMessage(e,t,i,n){const o=this.normalizeTick(e.tick);if(this.state.deployedPoints.has(o))return;const a={name:e.name,tick:o,maxSupply:e.max,limitPerMint:e.lim,metadata:e.metadata,topicId:i,deployerAccountId:t.payer_account_id,currentSupply:"0",deploymentTimestamp:t.consensus_timestamp,isPrivate:n};this.state.deployedPoints.set(o,a),this.logger.info(`Deployed points: ${o}`)}processMintMessage(e,t,i,n){const o=this.normalizeTick(e.tick),a=this.state.deployedPoints.get(o);if(!a)return;const r=BigInt(e.amt),s=BigInt(a.currentSupply);if(s+r>BigInt(a.maxSupply))return;if(a.limitPerMint&&r>BigInt(a.limitPerMint))return;a.currentSupply=(s+r).toString();let c=this.state.balances.get(o);c||(c=new Map,this.state.balances.set(o,c));const p=c.get(e.to),l=p?(BigInt(p.balance)+r).toString():e.amt;c.set(e.to,{tick:o,accountId:e.to,balance:l,lastUpdated:t.consensus_timestamp}),this.state.transactions.push({id:t.transaction_id||`${i}-${t.sequence_number}`,operation:"mint",tick:o,amount:e.amt,to:e.to,timestamp:t.consensus_timestamp,sequenceNumber:t.sequence_number,topicId:i,transactionId:t.transaction_id||"",memo:e.m})}processTransferMessage(e,t,i,n){const o=this.normalizeTick(e.tick),a=this.state.balances.get(o);if(!a)return;if(!n&&t.payer_account_id!==e.from)return;const r=a.get(e.from);if(!r||BigInt(r.balance)<BigInt(e.amt))return;const s=BigInt(e.amt);r.balance=(BigInt(r.balance)-s).toString(),r.lastUpdated=t.consensus_timestamp;const c=a.get(e.to);c?(c.balance=(BigInt(c.balance)+s).toString(),c.lastUpdated=t.consensus_timestamp):a.set(e.to,{tick:o,accountId:e.to,balance:e.amt,lastUpdated:t.consensus_timestamp}),this.state.transactions.push({id:t.transaction_id||`${i}-${t.sequence_number}`,operation:"transfer",tick:o,amount:e.amt,from:e.from,to:e.to,timestamp:t.consensus_timestamp,sequenceNumber:t.sequence_number,topicId:i,transactionId:t.transaction_id||"",memo:e.m})}processBurnMessage(e,t,i,n){const o=this.normalizeTick(e.tick),a=this.state.deployedPoints.get(o),r=this.state.balances.get(o);if(!a||!r)return;if(!n&&t.payer_account_id!==e.from)return;const s=r.get(e.from);if(!s||BigInt(s.balance)<BigInt(e.amt))return;const c=BigInt(e.amt);s.balance=(BigInt(s.balance)-c).toString(),s.lastUpdated=t.consensus_timestamp,a.currentSupply=(BigInt(a.currentSupply)-c).toString(),this.state.transactions.push({id:t.transaction_id||`${i}-${t.sequence_number}`,operation:"burn",tick:o,amount:e.amt,from:e.from,timestamp:t.consensus_timestamp,sequenceNumber:t.sequence_number,topicId:i,transactionId:t.transaction_id||"",memo:e.m})}normalizeTick(e){return e.toLowerCase().trim()}},exports.HCS20RegisterMessageSchema=Wc,exports.HCS20TransferMessageSchema=Hc,exports.HCS20_CONSTANTS=Lc,exports.HRLResolver=Gs,exports.Hcs10MemoType=Ec,exports.HederaMirrorNode=Ws,exports.InboundTopicType=pc,exports.InsufficientBalanceError=class extends Gc{constructor(e,t,i,n){super(`Insufficient balance for ${t}: required ${i}, available ${n}`),this.accountId=e,this.tick=t,this.required=i,this.available=n,this.name="InsufficientBalanceError"}},exports.InvalidAccountFormatError=ep,exports.InvalidMessageFormatError=class extends Gc{constructor(e,t){super(e),this.messageData=t,this.name="InvalidMessageFormatError"}},exports.InvalidNumberFormatError=class extends Gc{constructor(e,t){super(`Invalid number format for ${t}: ${e}`),this.value=e,this.field=t,this.name="InvalidNumberFormatError"}},exports.InvalidTickFormatError=class extends Gc{constructor(e){super(`Invalid tick format: ${e}`),this.tick=e,this.name="InvalidTickFormatError"}},exports.Logger=d,exports.MCPServerBuilder=class{constructor(){this.config={mcpServer:{}},this.socials=[],this.logger=d.getInstance({module:"MCPServerBuilder"})}setName(e){return this.config.name=e,this}setAlias(e){return this.config.alias=e,this}setBio(e){return this.config.bio=e,this}setDescription(e){return this.setBio(e)}setVersion(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.version=e,this}setConnectionInfo(e,t){this.config.mcpServer||(this.config.mcpServer={});const i={url:e,transport:t};return this.config.mcpServer.connectionInfo=i,this}setServerDescription(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.description=e,this}setServices(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.services=e,this}setHostRequirements(e){this.config.mcpServer||(this.config.mcpServer={});const t={minVersion:e};return this.config.mcpServer.host=t,this}setCapabilities(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.capabilities=e,this}addResource(e,t){this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.resources||(this.config.mcpServer.resources=[]);const i={name:e,description:t};return this.config.mcpServer.resources.push(i),this}setResources(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.resources=e,this}addTool(e,t){this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.tools||(this.config.mcpServer.tools=[]);const i={name:e,description:t};return this.config.mcpServer.tools.push(i),this}setTools(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.tools=e,this}setMaintainer(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.maintainer=e,this}setRepository(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.repository=e,this}setDocs(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.docs=e,this}setVerification(e){return this.config.mcpServer||(this.config.mcpServer={}),this.config.mcpServer.verification=e,this}addVerificationDNS(e,t){this.config.mcpServer||(this.config.mcpServer={});const i={type:cc.DNS,value:e,dns_field:t};return this.config.mcpServer.verification=i,this}addVerificationSignature(e){this.config.mcpServer||(this.config.mcpServer={});const t={type:cc.SIGNATURE,value:e};return this.config.mcpServer.verification=t,this}addVerificationChallenge(e){this.config.mcpServer||(this.config.mcpServer={});const t={type:cc.CHALLENGE,value:"",challenge_path:e};return this.config.mcpServer.verification=t,this}addSocial(e,t){const i=this.socials.find((t=>t.platform===e));if(i)i.handle=t;else{const i={platform:e,handle:t};this.socials.push(i)}return this}setSocials(e){return this.socials=e,this}setProfilePicture(e,t){return this.config.pfpBuffer=e,this.config.pfpFileName=t,this}setExistingProfilePicture(e){return this.config.existingPfpTopicId=e,this}setNetworkType(e){return this.config.network=e,this}setExistingAccount(e,t){return this.config.existingAccount={accountId:e,privateKey:t},this}build(){if(!this.config.name)throw new Error("MCP server name is required");if(!this.config.network)throw new Error("Network type is required");if(!this.config.mcpServer)throw new Error("MCP server details are required");if(!this.config.mcpServer.version)throw new Error("MCP server version is required");if(!this.config.mcpServer.connectionInfo)throw new Error("MCP server connection info is required");if(!this.config.mcpServer.services||0===this.config.mcpServer.services.length)throw new Error("At least one MCP service type is required");if(!this.config.mcpServer.description)throw new Error("MCP server description is required");return this.config.bio||this.logger.warn("No bio provided for MCP server profile"),this.config.pfpBuffer||this.config.existingPfpTopicId||this.logger.warn("No profile picture provided or referenced"),this.socials.length>0?{...this.config,socials:this.socials}:this.config}},exports.MCPServerCapability=sc,exports.MintLimitExceededError=class extends Gc{constructor(e,t,i){super(`Mint limit exceeded for ${e}: requested ${t}, limit ${i}`),this.tick=e,this.requested=t,this.limit=i,this.name="MintLimitExceededError"}},exports.PayloadSizeError=Rc,exports.PersonBuilder=class{constructor(){this.config={version:"1.0",type:0},this.logger=d.getInstance({module:"PersonBuilder"})}setName(e){return this.config.display_name=e,this}setAlias(e){return this.config.alias=e,this}setBio(e){return this.config.bio=e,this}setDescription(e){return this.setBio(e)}addSocial(e,t){this.config.socials||(this.config.socials=[]);const i=this.config.socials.find((t=>t.platform===e));return i?i.handle=t:this.config.socials.push({platform:e,handle:t}),this}setProfileImage(e){return this.config.profileImage=e,this}setProfilePicture(e,t){return this.config.pfpBuffer=e,this.config.pfpFileName=t,this}setExistingProfilePicture(e){return this.config.profileImage=`hcs://1/${e}`,this}addProperty(e,t){return this.config.properties||(this.config.properties={}),this.config.properties[e]=t,this}setInboundTopicId(e){return this.config.inboundTopicId=e,this}setOutboundTopicId(e){return this.config.outboundTopicId=e,this}getProfilePicture(){return{pfpBuffer:this.config.pfpBuffer,pfpFileName:this.config.pfpFileName}}build(){if(!this.config.display_name)throw new Error("Display name is required for the profile");return this.config.bio||this.logger.warn("No bio provided for person profile"),this.config.pfpBuffer||this.config.profileImage||this.logger.warn("No profile picture provided or referenced"),{version:this.config.version,type:0,display_name:this.config.display_name,alias:this.config.alias,bio:this.config.bio,socials:this.config.socials,profileImage:this.config.profileImage,properties:this.config.properties,inboundTopicId:this.config.inboundTopicId,outboundTopicId:this.config.outboundTopicId,pfpBuffer:this.config.pfpBuffer,pfpFileName:this.config.pfpFileName}}},exports.PointsBurnError=Xc,exports.PointsDeploymentError=Zc,exports.PointsMintError=class extends Gc{constructor(e,t,i,n){super(e),this.tick=t,this.requestedAmount=i,this.availableSupply=n,this.name="PointsMintError"}},exports.PointsNotFoundError=class extends Gc{constructor(e){super(`Points with tick "${e}" not found`),this.tick=e,this.name="PointsNotFoundError"}},exports.PointsTransferError=Jc,exports.PointsValidationError=Yc,exports.ProfileType=nc,exports.ProgressReporter=Ds,exports.Registration=Ac,exports.SUPPORTED_SOCIAL_PLATFORMS=["twitter","github","discord","telegram","linkedin","youtube","website","x"],exports.SupplyLimitExceededError=class extends Gc{constructor(e,t,i,n){super(`Supply limit exceeded for ${e}: max ${i}, current ${n}, requested ${t}`),this.tick=e,this.requested=t,this.maxSupply=i,this.currentSupply=n,this.name="SupplyLimitExceededError"}},exports.TopicCreationError=Pc,exports.TopicRegistrationError=Qc,exports.TransactionParser=class{static parseTransactionBody(e){try{const t=n.ethers.decodeBase64(e),a=o.proto.SchedulableTransactionBody.decode(t),r=this.getTransactionType(a),s={type:r,humanReadableType:this.getHumanReadableType(r),transfers:[],tokenTransfers:[],raw:a};if(a.memo&&(s.memo=a.memo),a.transactionFee){const e=i.Hbar.fromTinybars(i.Long.fromValue(a.transactionFee));s.transactionFee=e.toString(i.HbarUnit.Hbar)}return a.cryptoTransfer&&Qs.parseCryptoTransfers(a.cryptoTransfer,s),a.cryptoDelete&&(s.cryptoDelete=Qs.parseCryptoDelete(a.cryptoDelete)),a.cryptoCreateAccount&&(s.cryptoCreateAccount=Qs.parseCryptoCreateAccount(a.cryptoCreateAccount)),a.cryptoUpdateAccount&&(s.cryptoUpdateAccount=Qs.parseCryptoUpdateAccount(a.cryptoUpdateAccount)),a.cryptoApproveAllowance&&(s.cryptoApproveAllowance=Qs.parseCryptoApproveAllowance(a.cryptoApproveAllowance)),a.cryptoDeleteAllowance&&(s.cryptoDeleteAllowance=Qs.parseCryptoDeleteAllowance(a.cryptoDeleteAllowance)),a.contractCall&&(s.contractCall=ec.parseContractCall(a.contractCall)),a.contractCreateInstance&&(s.contractCreate=ec.parseContractCreate(a.contractCreateInstance)),a.contractUpdateInstance&&(s.contractUpdate=ec.parseContractUpdate(a.contractUpdateInstance)),a.contractDeleteInstance&&(s.contractDelete=ec.parseContractDelete(a.contractDeleteInstance)),a.tokenCreation&&(s.tokenCreation=Js.parseTokenCreate(a.tokenCreation)),a.tokenMint&&(s.tokenMint=Js.parseTokenMint(a.tokenMint)),a.tokenBurn&&(s.tokenBurn=Js.parseTokenBurn(a.tokenBurn)),a.tokenUpdate&&(s.tokenUpdate=Js.parseTokenUpdate(a.tokenUpdate)),a.tokenFeeScheduleUpdate&&(s.tokenFeeScheduleUpdate=Js.parseTokenFeeScheduleUpdate(a.tokenFeeScheduleUpdate)),a.tokenFreeze&&(s.tokenFreeze=Js.parseTokenFreeze(a.tokenFreeze)),a.tokenUnfreeze&&(s.tokenUnfreeze=Js.parseTokenUnfreeze(a.tokenUnfreeze)),a.tokenGrantKyc&&(s.tokenGrantKyc=Js.parseTokenGrantKyc(a.tokenGrantKyc)),a.tokenRevokeKyc&&(s.tokenRevokeKyc=Js.parseTokenRevokeKyc(a.tokenRevokeKyc)),a.tokenPause&&(s.tokenPause=Js.parseTokenPause(a.tokenPause)),a.tokenUnpause&&(s.tokenUnpause=Js.parseTokenUnpause(a.tokenUnpause)),a.tokenWipe&&(s.tokenWipeAccount=Js.parseTokenWipeAccount(a.tokenWipe)),a.tokenDeletion&&(s.tokenDelete=Js.parseTokenDelete(a.tokenDeletion)),a.tokenAssociate&&(s.tokenAssociate=Js.parseTokenAssociate(a.tokenAssociate)),a.tokenDissociate&&(s.tokenDissociate=Js.parseTokenDissociate(a.tokenDissociate)),a.consensusCreateTopic&&(s.consensusCreateTopic=Xs.parseConsensusCreateTopic(a.consensusCreateTopic)),a.consensusSubmitMessage&&(s.consensusSubmitMessage=Xs.parseConsensusSubmitMessage(a.consensusSubmitMessage)),a.consensusUpdateTopic&&(s.consensusUpdateTopic=Xs.parseConsensusUpdateTopic(a.consensusUpdateTopic)),a.consensusDeleteTopic&&(s.consensusDeleteTopic=Xs.parseConsensusDeleteTopic(a.consensusDeleteTopic)),a.fileCreate&&(s.fileCreate=Ys.parseFileCreate(a.fileCreate)),a.fileAppend&&(s.fileAppend=Ys.parseFileAppend(a.fileAppend)),a.fileUpdate&&(s.fileUpdate=Ys.parseFileUpdate(a.fileUpdate)),a.fileDelete&&(s.fileDelete=Ys.parseFileDelete(a.fileDelete)),a.utilPrng&&(s.utilPrng=tc.parseUtilPrng(a.utilPrng)),s}catch(t){throw new Error(`Failed to parse transaction body: ${t instanceof Error?t.message:String(t)}`)}}static parseScheduleResponse(e){if(!e.transaction_body)throw new Error("Schedule response missing transaction_body");const t=this.parseTransactionBody(e.transaction_body);return e.memo&&(t.memo=e.memo),t}static getTransactionType(e){let t="unknown";return e.cryptoTransfer?t="cryptoTransfer":e.cryptoCreateAccount?t="cryptoCreateAccount":e.cryptoUpdateAccount?t="cryptoUpdateAccount":e.cryptoApproveAllowance?t="cryptoApproveAllowance":e.cryptoDeleteAllowance?t="cryptoDeleteAllowance":e.cryptoDelete?t="cryptoDelete":e.consensusCreateTopic?t="consensusCreateTopic":e.consensusUpdateTopic?t="consensusUpdateTopic":e.consensusSubmitMessage?t="consensusSubmitMessage":e.consensusDeleteTopic?t="consensusDeleteTopic":e.fileCreate?t="fileCreate":e.fileAppend?t="fileAppend":e.fileUpdate?t="fileUpdate":e.fileDelete?t="fileDelete":e.contractCall?t="contractCall":e.contractCreateInstance?t="contractCreate":e.contractUpdateInstance?t="contractUpdate":e.contractDeleteInstance?t="contractDelete":e.tokenCreation?t="tokenCreate":e.tokenUpdate?t="tokenUpdate":e.tokenDeletion?t="tokenDelete":e.tokenAssociate?t="tokenAssociate":e.tokenDissociate?t="tokenDissociate":e.tokenMint?t="tokenMint":e.tokenBurn?t="tokenBurn":e.tokenFeeScheduleUpdate?t="tokenFeeScheduleUpdate":e.tokenFreeze?t="tokenFreeze":e.tokenUnfreeze?t="tokenUnfreeze":e.tokenGrantKyc?t="tokenGrantKyc":e.tokenRevokeKyc?t="tokenRevokeKyc":e.tokenPause?t="tokenPause":e.tokenUnpause?t="tokenUnpause":e.tokenWipe?t="tokenWipe":e.utilPrng&&(t="utilPrng"),t}static getHumanReadableType(e){const t={cryptoTransfer:"HBAR Transfer",cryptoCreateAccount:"Create Account",cryptoUpdateAccount:"Update Account",cryptoDeleteAccount:"Delete Account",cryptoApproveAllowance:"Approve Allowance",cryptoDeleteAllowance:"Delete Allowance",cryptoDelete:"Delete Account",consensusCreateTopic:"Create Topic",consensusUpdateTopic:"Update Topic",consensusSubmitMessage:"Submit Message",consensusDeleteTopic:"Delete Topic",fileCreate:"Create File",fileAppend:"Append File",fileUpdate:"Update File",fileDelete:"Delete File",contractCall:"Contract Call",contractCreate:"Create Contract",contractUpdate:"Update Contract",contractDelete:"Delete Contract",ethereumTransaction:"Ethereum Transaction",tokenCreate:"Create Token",tokenUpdate:"Update Token",tokenDelete:"Delete Token",tokenAssociate:"Associate Token",tokenDissociate:"Dissociate Token",tokenMint:"Mint Token",tokenBurn:"Burn Token",tokenFeeScheduleUpdate:"Update Token Fee Schedule",tokenFreeze:"Freeze Token",tokenUnfreeze:"Unfreeze Token",tokenGrantKyc:"Grant KYC",tokenRevokeKyc:"Revoke KYC",tokenPause:"Pause Token",tokenUnpause:"Unpause Token",tokenWipe:"Wipe Token",scheduleCreate:"Create Schedule",scheduleSign:"Sign Schedule",utilPrng:"Generate Random Number",unknown:"Unknown Transaction"};let i;return i=t[e]?t[e]:"Unknown Transaction",i}static getTransactionSummary(e){if("cryptoTransfer"===e.type){const t=[],i=[];for(const n of e.transfers){const e=parseFloat(n.amount);let o=n.amount;o.startsWith("-")&&(o=o.substring(1)),o=o.replace(/\s*ℏ$/,""),e<0?t.push(`${n.accountId} (${o} ℏ)`):e>0&&i.push(`${n.accountId} (${o} ℏ)`)}return t.length>0&&i.length>0?`Transfer of HBAR from ${t.join(", ")} to ${i.join(", ")}`:e.humanReadableType}if(e.contractCall){let t=`Contract call to ${e.contractCall.contractId} with ${e.contractCall.gas} gas`;return e.contractCall.amount>0&&(t+=` and ${e.contractCall.amount} HBAR`),e.contractCall.functionName&&(t+=` calling function ${e.contractCall.functionName}`),t}if(e.tokenMint)return`Mint ${e.tokenMint.amount} tokens for token ${e.tokenMint.tokenId}`;if(e.tokenBurn)return`Burn ${e.tokenBurn.amount} tokens for token ${e.tokenBurn.tokenId}`;if(e.tokenCreation){let t=`Create token ${e.tokenCreation.tokenName||"(No Name)"} (${e.tokenCreation.tokenSymbol||"(No Symbol)"})`;return e.tokenCreation.initialSupply&&(t+=` with initial supply ${e.tokenCreation.initialSupply}`),e.tokenCreation.customFees?.length&&(t+=` including ${e.tokenCreation.customFees.length} custom fee(s)`),t}if(e.tokenTransfers.length>0){const t={};for(const n of e.tokenTransfers)t[n.tokenId]||(t[n.tokenId]=[]),t[n.tokenId].push(n);const i=[];for(const[e,n]of Object.entries(t)){const t=[],o=[];for(const e of n){const i=parseFloat(e.amount.toString());i<0?t.push(`${e.accountId} (${Math.abs(i)})`):i>0&&o.push(`${e.accountId} (${i})`)}t.length>0&&o.length>0&&i.push(`Transfer of token ${e} from ${t.join(", ")} to ${o.join(", ")}`)}return i.length>0?i.join("; "):e.humanReadableType}if(e.consensusCreateTopic){let t="Create new topic";return e.consensusCreateTopic.memo&&(t+=` with memo "${e.consensusCreateTopic.memo}"`),e.consensusCreateTopic.autoRenewAccountId&&(t+=`, auto-renew by ${e.consensusCreateTopic.autoRenewAccountId}`),t}if(e.consensusSubmitMessage){let t="Submit message";if(e.consensusSubmitMessage.topicId&&(t+=` to topic ${e.consensusSubmitMessage.topicId}`),e.consensusSubmitMessage.message)if("utf8"===e.consensusSubmitMessage.messageEncoding){t+=`: "${e.consensusSubmitMessage.message.substring(0,70)}${e.consensusSubmitMessage.message.length>70?"...":""}"`}else t+=` (binary message data, length: ${r.Buffer.from(e.consensusSubmitMessage.message,"base64").length} bytes)`;return e.consensusSubmitMessage.chunkInfoNumber&&e.consensusSubmitMessage.chunkInfoTotal&&(t+=` (chunk ${e.consensusSubmitMessage.chunkInfoNumber}/${e.consensusSubmitMessage.chunkInfoTotal})`),t}if(e.fileCreate){let t="Create File";return e.fileCreate.memo&&(t+=` with memo "${e.fileCreate.memo}"`),e.fileCreate.contents&&(t+=" (includes content)"),t}if(e.fileAppend)return`Append to File ${e.fileAppend.fileId||"(Unknown ID)"}`;if(e.fileUpdate)return`Update File ${e.fileUpdate.fileId||"(Unknown ID)"}`;if(e.fileDelete)return`Delete File ${e.fileDelete.fileId||"(Unknown ID)"}`;if(e.consensusUpdateTopic)return`Update Topic ${e.consensusUpdateTopic.topicId||"(Unknown ID)"}`;if(e.consensusDeleteTopic)return`Delete Topic ${e.consensusDeleteTopic.topicId||"(Unknown ID)"}`;if(e.tokenUpdate)return`Update Token ${e.tokenUpdate.tokenId||"(Unknown ID)"}`;if(e.tokenFeeScheduleUpdate)return`Update Fee Schedule for Token ${e.tokenFeeScheduleUpdate.tokenId||"(Unknown ID)"}`;if(e.utilPrng){let t="Generate Random Number";return e.utilPrng.range&&e.utilPrng.range>0&&(t+=` (range up to ${e.utilPrng.range-1})`),t}if(e.tokenFreeze)return`Freeze Token ${e.tokenFreeze.tokenId} for Account ${e.tokenFreeze.accountId}`;if(e.tokenUnfreeze)return`Unfreeze Token ${e.tokenUnfreeze.tokenId} for Account ${e.tokenUnfreeze.accountId}`;if(e.tokenGrantKyc)return`Grant KYC for Token ${e.tokenGrantKyc.tokenId} to Account ${e.tokenGrantKyc.accountId}`;if(e.tokenRevokeKyc)return`Revoke KYC for Token ${e.tokenRevokeKyc.tokenId} from Account ${e.tokenRevokeKyc.accountId}`;if(e.tokenPause)return`Pause Token ${e.tokenPause.tokenId}`;if(e.tokenUnpause)return`Unpause Token ${e.tokenUnpause.tokenId}`;if(e.tokenWipeAccount){let t=`Wipe Token ${e.tokenWipeAccount.tokenId} from Account ${e.tokenWipeAccount.accountId}`;return e.tokenWipeAccount.serialNumbers?.length&&(t+=` (Serials: ${e.tokenWipeAccount.serialNumbers.join(", ")})`),e.tokenWipeAccount.amount&&(t+=` (Amount: ${e.tokenWipeAccount.amount})`),t}if(e.tokenDelete)return`Delete Token ${e.tokenDelete.tokenId}`;if(e.tokenAssociate)return`Associate Account ${e.tokenAssociate.accountId} with Tokens: ${e.tokenAssociate.tokenIds?.join(", ")}`;if(e.tokenDissociate)return`Dissociate Account ${e.tokenDissociate.accountId} from Tokens: ${e.tokenDissociate.tokenIds?.join(", ")}`;if(e.cryptoDelete)return`Delete Account ${e.cryptoDelete.deleteAccountId}`;if(e.cryptoCreateAccount){let t="Create Account";return e.cryptoCreateAccount.initialBalance&&"0"!==e.cryptoCreateAccount.initialBalance&&(t+=` with balance ${e.cryptoCreateAccount.initialBalance}`),e.cryptoCreateAccount.alias&&(t+=` (Alias: ${e.cryptoCreateAccount.alias})`),t}if(e.cryptoUpdateAccount)return`Update Account ${e.cryptoUpdateAccount.accountIdToUpdate||"(Unknown ID)"}`;if(e.cryptoApproveAllowance){return`Approve ${(e.cryptoApproveAllowance.hbarAllowances?.length||0)+(e.cryptoApproveAllowance.tokenAllowances?.length||0)+(e.cryptoApproveAllowance.nftAllowances?.length||0)} Crypto Allowance(s)`}if(e.cryptoDeleteAllowance)return`Delete ${e.cryptoDeleteAllowance.nftAllowancesToRemove?.length||0} NFT Crypto Allowance(s)`;if(e.contractCreate){let t="Create Contract";return e.contractCreate.memo&&(t+=` (Memo: ${e.contractCreate.memo})`),t}if(e.contractUpdate)return`Update Contract ${e.contractUpdate.contractIdToUpdate||"(Unknown ID)"}`;if(e.contractDelete){let t=`Delete Contract ${e.contractDelete.contractIdToDelete||"(Unknown ID)"}`;return e.contractDelete.transferAccountId?t+=` (Transfer to Account: ${e.contractDelete.transferAccountId})`:e.contractDelete.transferContractId&&(t+=` (Transfer to Contract: ${e.contractDelete.transferContractId})`),t}if(e.humanReadableType&&"Unknown Transaction"!==e.humanReadableType)return e.humanReadableType;if(e.tokenTransfers.length>0){const t={};for(const n of e.tokenTransfers)t[n.tokenId]||(t[n.tokenId]=[]),t[n.tokenId].push(n);const i=[];for(const[e,n]of Object.entries(t)){const t=n.filter((e=>e.amount<0)).map((e=>`${e.accountId} (${Math.abs(e.amount)})`)),o=n.filter((e=>e.amount>0)).map((e=>`${e.accountId} (${e.amount})`));t.length>0&&o.length>0?i.push(`Transfer of token ${e} from ${t.join(", ")} to ${o.join(", ")}`):o.length>0?i.push(`Token ${e} received by ${o.join(", ")}`):t.length>0&&i.push(`Token ${e} sent from ${t.join(", ")}`)}if(i.length>0)return i.join("; ")}return"Unknown Transaction"}},exports.VerificationType=cc,exports.WasmBridge=class{constructor(){this.wasm=null,this.WASM_VECTOR_LEN=0,this.cachedUint8Memory=null,this.cachedDataViewMemory=null,this.textEncoder=new TextEncoder,this.textDecoder=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),this.textDecoder.decode(),this.logger=d.getInstance({module:"WasmBridge"})}setLogLevel(e){this.logger.setLogLevel(e)}get wasmInstance(){if(!this.wasm)throw new Error("WASM not initialized");return this.wasm}getUint8Memory(){if(!this.wasm)throw new Error("WASM not initialized");return null!==this.cachedUint8Memory&&0!==this.cachedUint8Memory.byteLength||(this.cachedUint8Memory=new Uint8Array(this.wasm.memory.buffer)),this.cachedUint8Memory}getDataViewMemory(){if(!this.wasm)throw new Error("WASM not initialized");return null!==this.cachedDataViewMemory&&this.cachedDataViewMemory.buffer===this.wasm.memory.buffer||(this.cachedDataViewMemory=new DataView(this.wasm.memory.buffer)),this.cachedDataViewMemory}encodeString(e,t){if(0===e.length)return{read:0,written:0};const i=this.textEncoder.encode(e);return t.set(i),{read:e.length,written:i.length}}passStringToWasm(e,t,i){if(void 0===i){const i=this.textEncoder.encode(e),n=t(i.length,1);return this.getUint8Memory().set(i,n),this.WASM_VECTOR_LEN=i.length,n}let n=this.textEncoder.encode(e).length,o=t(n,1);const a=this.getUint8Memory();let r=0;for(;r<n;r++){const t=e.charCodeAt(r);if(t>127)break;a[o+r]=t}if(r!==n){0!==r&&(e=e.slice(r)),o=i(o,n,n=r+3*this.textEncoder.encode(e).length,1);const t=this.getUint8Memory().subarray(o+r,o+n);r+=this.encodeString(e,t).written}return this.WASM_VECTOR_LEN=r,o}getStringFromWasm(e,t){return e>>>=0,this.textDecoder.decode(this.getUint8Memory().subarray(e,e+t))}createWasmFunction(e){if(!this.wasm)throw new Error("WASM not initialized");return(...t)=>{const i=this.wasm.__wbindgen_add_to_stack_pointer(-16);let n=[0,0];try{const o=[i,...t.map((e=>[this.passStringToWasm(e,this.wasm.__wbindgen_malloc,this.wasm.__wbindgen_realloc),this.WASM_VECTOR_LEN])).flat()];e.apply(this.wasm,o);const a=this.getDataViewMemory().getInt32(i+0,!0),r=this.getDataViewMemory().getInt32(i+4,!0);return n=[a,r],this.getStringFromWasm(a,r)}finally{this.wasm.__wbindgen_add_to_stack_pointer(16),this.wasm.__wbindgen_free(n[0],n[1],1)}}}async initWasm(e){const t=this,i={__wbindgen_placeholder__:{__wbindgen_throw:function(e,i){const n=t.getStringFromWasm(e,i);throw t.logger.error(`WASM error: ${n}`),new Error(n)}}};try{this.logger.debug("Compiling WASM module");const t=await WebAssembly.compile(e);this.logger.debug("Instantiating WASM module");const n=await WebAssembly.instantiate(t,i);return this.wasm=n.exports,this.logger.info("WASM module initialized successfully"),this.wasm}catch(n){throw this.logger.error("Failed to initialize WASM module",n),n}}createStateData(e,t={}){let i={};return e?.c?.inputType?.stateData&&(t.latestRoundData&&Object.keys(e.c.inputType.stateData).every((e=>e in t.latestRoundData))?(i.latestRoundData={},Object.entries(e.c.inputType.stateData).forEach((([e,n])=>{i.latestRoundData[e]=String(t.latestRoundData[e])}))):Object.entries(e.c.inputType.stateData).forEach((([e,n])=>{const o=t[e];o&&"object"==typeof o&&"values"in o&&o.values.length>0?i[e]=String(o.values[0]):i[e]=this.getDefaultValueForType(n)}))),i}getDefaultValueForType(e){return e.startsWith("uint")||e.startsWith("int")||"number"===e?"0":"bool"===e?"false":""}executeWasm(e,t){if(!this.wasm)throw this.logger.error("WASM not initialized"),new Error("WASM not initialized");try{this.logger.debug("Executing WASM with stateData",e);return this.createWasmFunction(this.wasmInstance.process_state)(JSON.stringify(e),JSON.stringify(t))}catch(i){throw this.logger.error("Error executing WASM",i),i}}getParams(){return this.createWasmFunction(this.wasmInstance.get_params)()}},exports.accountIdsToExemptKeys=Vs,exports.capabilityNameToCapabilityMap=lc,exports.detectKeyTypeFromString=ic,exports.global$1=R,exports.inscribe=zs,exports.inscribeWithSigner=qs,exports.mcpServiceNameToCapabilityMap={resource_provider:0,tool_provider:1,prompt_template_provider:2,local_file_access:3,database_integration:4,api_integration:5,web_access:6,knowledge_base:7,memory_persistence:8,code_analysis:9,content_generation:10,communication:11,document_processing:12,calendar_schedule:13,search:14,assistant_orchestration:15},exports.process$1=Li,exports.process$1$1=V,exports.retrieveInscription=async function(e,t){const i=d.getInstance({module:"Inscriber",...t?.logging||{}}),n=e.includes("@")?`${e.split("@")[0]}-${e.split("@")[1].replace(/\./g,"-")}`:e;i.info("Retrieving inscription",{originalTransactionId:e,formattedTransactionId:n});try{let e;if(t?.apiKey)i.debug("Initializing InscriptionSDK with API key"),e=new Ms({apiKey:t.apiKey,network:t.network||"mainnet"});else{if(!t?.accountId||!t?.privateKey){const e=new Error("Either API key or account ID and private key are required for retrieving inscriptions");throw i.error("Missing authentication credentials",{hasApiKey:Boolean(t?.apiKey),hasAccountId:Boolean(t?.accountId),hasPrivateKey:Boolean(t?.privateKey)}),e}i.debug("Initializing InscriptionSDK with server auth"),e=await Ms.createWithAuth({type:"server",accountId:t.accountId,privateKey:t.privateKey,network:t.network||"mainnet"})}i.debug("Initialized SDK for inscription retrieval",{formattedTransactionId:n,network:t.network||"mainnet"});const o=await e.retrieveInscription(n);return i.info("Successfully retrieved inscription",{formattedTransactionId:n}),o}catch(o){throw i.error("Error retrieving inscription",{formattedTransactionId:n,error:o}),o}},exports.sleep=e=>new Promise((t=>setTimeout(t,e))),exports.waitForInscriptionConfirmation=Hs;
32
+ //# sourceMappingURL=index-VOcWhzLh.cjs.map