@mocanetwork/airkit 0.5.0-beta.2

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 (80) hide show
  1. package/README.md +177 -0
  2. package/dist/airkit.cjs.js +2662 -0
  3. package/dist/airkit.esm.js +2468 -0
  4. package/dist/airkit.umd.min.js +2 -0
  5. package/dist/airkit.umd.min.js.LICENSE.txt +12 -0
  6. package/dist/lib.cjs/common/src/error.js +25 -0
  7. package/dist/lib.cjs/common/src/realm/messaging/auth.js +28 -0
  8. package/dist/lib.cjs/common/src/realm/messaging/types.js +15 -0
  9. package/dist/lib.cjs/ws-embed/src/PopupHandler.js +64 -0
  10. package/dist/lib.cjs/ws-embed/src/airService.js +364 -0
  11. package/dist/lib.cjs/ws-embed/src/baseProvider.js +178 -0
  12. package/dist/lib.cjs/ws-embed/src/communicationProvider.js +346 -0
  13. package/dist/lib.cjs/ws-embed/src/embed.js +735 -0
  14. package/dist/lib.cjs/ws-embed/src/error.js +21 -0
  15. package/dist/lib.cjs/ws-embed/src/iframeController.js +68 -0
  16. package/dist/lib.cjs/ws-embed/src/inPageProvider.js +307 -0
  17. package/dist/lib.cjs/ws-embed/src/index.js +20 -0
  18. package/dist/lib.cjs/ws-embed/src/interfaces.js +29 -0
  19. package/dist/lib.cjs/ws-embed/src/isStream.js +20 -0
  20. package/dist/lib.cjs/ws-embed/src/loglevel.js +7 -0
  21. package/dist/lib.cjs/ws-embed/src/messageService.js +212 -0
  22. package/dist/lib.cjs/ws-embed/src/messages.js +22 -0
  23. package/dist/lib.cjs/ws-embed/src/siteMetadata.js +77 -0
  24. package/dist/lib.cjs/ws-embed/src/utils.js +95 -0
  25. package/dist/lib.esm/common/src/error.js +23 -0
  26. package/dist/lib.esm/common/src/realm/messaging/auth.js +26 -0
  27. package/dist/lib.esm/common/src/realm/messaging/types.js +13 -0
  28. package/dist/lib.esm/ws-embed/src/PopupHandler.js +62 -0
  29. package/dist/lib.esm/ws-embed/src/airService.js +362 -0
  30. package/dist/lib.esm/ws-embed/src/baseProvider.js +176 -0
  31. package/dist/lib.esm/ws-embed/src/communicationProvider.js +344 -0
  32. package/dist/lib.esm/ws-embed/src/embed.js +730 -0
  33. package/dist/lib.esm/ws-embed/src/error.js +18 -0
  34. package/dist/lib.esm/ws-embed/src/iframeController.js +66 -0
  35. package/dist/lib.esm/ws-embed/src/inPageProvider.js +302 -0
  36. package/dist/lib.esm/ws-embed/src/index.js +5 -0
  37. package/dist/lib.esm/ws-embed/src/interfaces.js +21 -0
  38. package/dist/lib.esm/ws-embed/src/isStream.js +15 -0
  39. package/dist/lib.esm/ws-embed/src/loglevel.js +5 -0
  40. package/dist/lib.esm/ws-embed/src/messageService.js +210 -0
  41. package/dist/lib.esm/ws-embed/src/messages.js +20 -0
  42. package/dist/lib.esm/ws-embed/src/siteMetadata.js +75 -0
  43. package/dist/lib.esm/ws-embed/src/utils.js +88 -0
  44. package/dist/types/PopupHandler.d.ts +24 -0
  45. package/dist/types/airService.d.ts +34 -0
  46. package/dist/types/baseProvider.d.ts +66 -0
  47. package/dist/types/common/custom.d.ts +4 -0
  48. package/dist/types/common/error.d.ts +17 -0
  49. package/dist/types/common/realm/error/auth.d.ts +1 -0
  50. package/dist/types/common/realm/error/types.d.ts +1 -0
  51. package/dist/types/common/realm/messaging/auth.d.ts +138 -0
  52. package/dist/types/common/realm/messaging/types.d.ts +95 -0
  53. package/dist/types/common/realm/partner/config.d.ts +68 -0
  54. package/dist/types/common/realm/user/types.d.ts +78 -0
  55. package/dist/types/common/realm/wallet/bybit/bybit.d.ts +2 -0
  56. package/dist/types/common/realm/wallet/coinbase/coinbase.d.ts +2 -0
  57. package/dist/types/common/realm/wallet/cryptoCom/cryptoCom.d.ts +2 -0
  58. package/dist/types/common/realm/wallet/index.d.ts +22 -0
  59. package/dist/types/common/realm/wallet/metamask/metamask.d.ts +2 -0
  60. package/dist/types/common/realm/wallet/okx/okx.d.ts +2 -0
  61. package/dist/types/common/realm/wallet/phantom/phantom.d.ts +2 -0
  62. package/dist/types/common/realm/wallet/rabby/rabby.d.ts +2 -0
  63. package/dist/types/common/realm/wallet/rainbow/rainbow.d.ts +2 -0
  64. package/dist/types/common/realm/wallet/trust/trust.d.ts +2 -0
  65. package/dist/types/common/types.d.ts +8 -0
  66. package/dist/types/common/utils.d.ts +2 -0
  67. package/dist/types/communicationProvider.d.ts +82 -0
  68. package/dist/types/embed.d.ts +42 -0
  69. package/dist/types/error.d.ts +9 -0
  70. package/dist/types/iframeController.d.ts +18 -0
  71. package/dist/types/inPageProvider.d.ts +106 -0
  72. package/dist/types/index.d.ts +4 -0
  73. package/dist/types/interfaces.d.ts +261 -0
  74. package/dist/types/isStream.d.ts +4 -0
  75. package/dist/types/loglevel.d.ts +3 -0
  76. package/dist/types/messageService.d.ts +51 -0
  77. package/dist/types/messages.d.ts +19 -0
  78. package/dist/types/siteMetadata.d.ts +9 -0
  79. package/dist/types/utils.d.ts +24 -0
  80. package/package.json +76 -0
@@ -0,0 +1,2 @@
1
+ /*! For license information please see airkit.umd.min.js.LICENSE.txt */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Airkit=t():e.Airkit=t()}(globalThis,(()=>(()=>{var e={7083:e=>{"use strict";const{AbortController:t,AbortSignal:r}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=t,e.exports.AbortSignal=r,e.exports.default=t},7991:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=a(e),s=o[0],l=o[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,l)),c=0,f=l>0?s-4:s;for(r=0;r<f;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===l&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===l&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=16383,a=0,u=n-i;a<u;a+=s)o.push(l(e,a,a+s>u?u:a+s));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},1048:(e,t,r)=>{"use strict";const n=r(7991),i=r(9318),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let n=a(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(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(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return d(e,t,r);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 l.from(n,t,r);const i=function(e){if(l.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||J(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(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 f(e){return c(e),a(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,l.prototype),n}function p(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function y(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))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 r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(i)return n?-1:V(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return R(this,t,r);case"ascii":return x(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function w(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){let o,s=1,a=e.length,l=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;s=2,a/=2,l/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===l)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+l>a&&(r=a-l),o=r;o>=0;o--){let r=!0;for(let n=0;n<l;n++)if(u(e,o+n)!==u(t,n)){r=!1;break}if(r)return o}return-1}function v(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(J(n))return s;e[r+s]=n}return s}function _(e,t,r,n){return Y(V(t,e.length-r),e,r,n)}function E(e,t,r,n){return Y(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function S(e,t,r,n){return Y(G(t),e,r,n)}function A(e,t,r,n){return Y(function(e,t){let r,n,i;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function I(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function R(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,l;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(l=(31&t)<<6|63&r,l>127&&(o=l));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(l=(15&t)<<12|(63&r)<<6|63&n,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(l=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,l>65535&&l<1114112&&(o=l))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=O));return r}(n)}t.kMaxLength=s,l.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.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(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,r){return function(e,t,r){return c(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},l.allocUnsafe=function(e){return f(e)},l.allocUnsafeSlow=function(e){return f(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(K(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},l.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}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=l.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(K(t,Uint8Array))i+t.length>n.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},l.byteLength=y,l.prototype._isBuffer=!0,l.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)b(this,t,t+1);return this},l.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)b(this,t,t+3),b(this,t+1,t+2);return this},l.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)b(this,t,t+7),b(this,t+1,t+6),b(this,t+2,t+5),b(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?R(this,0,e):g.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(l.prototype[o]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,i){if(K(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.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===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(n,i),c=e.slice(t,r);for(let e=0;e<a;++e)if(u[e]!==c[e]){o=u[e],s=c[e];break}return o<s?-1:s<o?1:0},l.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return w(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return w(this,e,t,r,!1)},l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function x(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function T(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function k(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=Z[e[n]];return i}function L(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function P(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,n,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function B(e,t,r,n,i){$(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function M(e,t,r,n,i){$(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function j(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(e,t,r,n,o){return t=+t,r>>>=0,o||j(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function C(e,t,r,n,o){return t=+t,r>>>=0,o||j(e,0,r,8),i.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,l.prototype),n},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=X((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),l.prototype.readBigUInt64BE=X((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=X((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),l.prototype.readBigInt64BE=X((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||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]+r)})),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||N(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||N(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(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},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(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},l.prototype.writeBigUInt64LE=X((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=X((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(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},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(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},l.prototype.writeBigInt64LE=X((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=X((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(e,t,r){return U(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return U(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return C(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return C(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},l.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.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<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const o=l.isBuffer(e)?e:l.from(e,n),s=o.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%s]}return this};const D={};function W(e,t,r){D[e]=class extends r{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 F(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function $(e,t,r,n,i,o){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new D.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){q(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||H(t,e.length-(r+1))}(n,i,o)}function q(e,t){if("number"!=typeof e)throw new D.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,r){if(Math.floor(e)!==e)throw q(e,r),new D.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new D.ERR_BUFFER_OUT_OF_BOUNDS;throw new D.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}W("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),W("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),W("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=F(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function V(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const Z=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},9818:(e,t,r)=>{"use strict";var n=r(528),i=r(8498),o=i(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?i(r):r}},8498:(e,t,r)=>{"use strict";var n=r(9138),i=r(528),o=r(6108),s=r(3468),a=i("%Function.prototype.apply%"),l=i("%Function.prototype.call%"),u=i("%Reflect.apply%",!0)||n.call(l,a),c=r(4940),f=i("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new s("a function is required");var t=u(n,l,arguments);return o(t,1+f(0,e.length-(arguments.length-1)),!0)};var h=function(){return u(n,a,arguments)};c?c(e.exports,"apply",{value:h}):e.exports.apply=h},686:(e,t,r)=>{"use strict";var n=r(4940),i=r(5731),o=r(3468),s=r(9336);e.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new o("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],f=!!s&&s(e,t);if(n)n(e,t,{configurable:null===u&&f?f.configurable:!u,enumerable:null===a&&f?f.enumerable:!a,value:r,writable:null===l&&f?f.writable:!l});else{if(!c&&(a||l||u))throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},1822:(e,t,r)=>{var n=r(9907),i=r(3358),o=function(){},s=function(e,t,r){if("function"==typeof t)return s(e,null,t);t||(t={}),r=i(r||o);var a=e._writableState,l=e._readableState,u=t.readable||!1!==t.readable&&e.readable,c=t.writable||!1!==t.writable&&e.writable,f=!1,h=function(){e.writable||d()},d=function(){c=!1,u||r.call(e)},p=function(){u=!1,c||r.call(e)},y=function(t){r.call(e,t?new Error("exited with error code: "+t):null)},g=function(t){r.call(e,t)},b=function(){n.nextTick(w)},w=function(){if(!f)return(!u||l&&l.ended&&!l.destroyed)&&(!c||a&&a.ended&&!a.destroyed)?void 0:r.call(e,new Error("premature close"))},m=function(){e.req.on("finish",d)};return function(e){return e.setHeader&&"function"==typeof e.abort}(e)?(e.on("complete",d),e.on("abort",b),e.req?m():e.on("request",m)):c&&!a&&(e.on("end",h),e.on("close",h)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",y),e.on("end",p),e.on("finish",d),!1!==t.error&&e.on("error",g),e.on("close",b),function(){f=!0,e.removeListener("complete",d),e.removeListener("abort",b),e.removeListener("request",m),e.req&&e.req.removeListener("finish",d),e.removeListener("end",h),e.removeListener("close",h),e.removeListener("finish",d),e.removeListener("exit",y),e.removeListener("end",p),e.removeListener("error",g),e.removeListener("close",b)}};e.exports=s},4940:(e,t,r)=>{"use strict";var n=r(528)("%Object.defineProperty%",!0)||!1;if(n)try{n({},"a",{value:1})}catch(e){n=!1}e.exports=n},9110:e=>{"use strict";e.exports=EvalError},9838:e=>{"use strict";e.exports=Error},1155:e=>{"use strict";e.exports=RangeError},4943:e=>{"use strict";e.exports=ReferenceError},5731:e=>{"use strict";e.exports=SyntaxError},3468:e=>{"use strict";e.exports=TypeError},2140:e=>{"use strict";e.exports=URIError},46:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}y(e,t,o,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,o,s,u;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=l(e))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,u=c,console&&console.warn&&console.warn(u)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=c.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):p(i,i.length)}function d(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function y(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var u=l.length,c=p(l,u);for(r=0;r<u;++r)n(c[r],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,f(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,f(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,s;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},8792:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(i=n;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(o=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;0!=i--;){var s=o[i];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}},8794:e=>{"use strict";var t=Object.prototype.toString,r=Math.max,n=function(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var i=0;i<t.length;i+=1)r[i+e.length]=t[i];return r};e.exports=function(e){var i=this;if("function"!=typeof i||"[object Function]"!==t.apply(i))throw new TypeError("Function.prototype.bind called on incompatible "+i);for(var o,s=function(e){for(var t=[],r=1,n=0;r<e.length;r+=1,n+=1)t[n]=e[r];return t}(arguments),a=r(0,i.length-s.length),l=[],u=0;u<a;u++)l[u]="$"+u;if(o=Function("binder","return function ("+function(e){for(var t="",r=0;r<e.length;r+=1)t+=e[r],r+1<e.length&&(t+=",");return t}(l)+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof o){var t=i.apply(this,n(s,arguments));return Object(t)===t?t:this}return i.apply(e,n(s,arguments))})),i.prototype){var c=function(){};c.prototype=i.prototype,o.prototype=new c,c.prototype=null}return o}},9138:(e,t,r)=>{"use strict";var n=r(8794);e.exports=Function.prototype.bind||n},528:(e,t,r)=>{"use strict";var n,i=r(9838),o=r(9110),s=r(1155),a=r(4943),l=r(5731),u=r(3468),c=r(2140),f=Function,h=function(e){try{return f('"use strict"; return ('+e+").constructor;")()}catch(e){}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch(e){d=null}var p=function(){throw new u},y=d?function(){try{return p}catch(e){try{return d(arguments,"callee").get}catch(e){return p}}}():p,g=r(3558)(),b=r(6869)(),w=Object.getPrototypeOf||(b?function(e){return e.__proto__}:null),m={},v="undefined"!=typeof Uint8Array&&w?w(Uint8Array):n,_={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":g&&w?w([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":m,"%AsyncGenerator%":m,"%AsyncGeneratorFunction%":m,"%AsyncIteratorPrototype%":m,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":o,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":f,"%GeneratorFunction%":m,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":g&&w?w(w([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&g&&w?w((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":s,"%ReferenceError%":a,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&g&&w?w((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":g&&w?w(""[Symbol.iterator]()):n,"%Symbol%":g?Symbol:n,"%SyntaxError%":l,"%ThrowTypeError%":y,"%TypedArray%":v,"%TypeError%":u,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":c,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet};if(w)try{null.error}catch(e){var E=w(w(e));_["%Error.prototype%"]=E}var S=function e(t){var r;if("%AsyncFunction%"===t)r=h("async function () {}");else if("%GeneratorFunction%"===t)r=h("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=h("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&w&&(r=w(i.prototype))}return _[t]=r,r},A={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},I=r(9138),R=r(8554),O=I.call(Function.call,Array.prototype.concat),x=I.call(Function.apply,Array.prototype.splice),T=I.call(Function.call,String.prototype.replace),k=I.call(Function.call,String.prototype.slice),L=I.call(Function.call,RegExp.prototype.exec),P=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,N=/\\(\\)?/g,B=function(e,t){var r,n=e;if(R(A,n)&&(n="%"+(r=A[n])[0]+"%"),R(_,n)){var i=_[n];if(i===m&&(i=S(n)),void 0===i&&!t)throw new u("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new l("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new u('"allowMissing" argument must be a boolean');if(null===L(/^%?[^%]*%?$/,e))throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=k(e,0,1),r=k(e,-1);if("%"===t&&"%"!==r)throw new l("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new l("invalid intrinsic syntax, expected opening `%`");var n=[];return T(e,P,(function(e,t,r,i){n[n.length]=r?T(i,N,"$1"):t||e})),n}(e),n=r.length>0?r[0]:"",i=B("%"+n+"%",t),o=i.name,s=i.value,a=!1,c=i.alias;c&&(n=c[0],x(r,O([0,1],c)));for(var f=1,h=!0;f<r.length;f+=1){var p=r[f],y=k(p,0,1),g=k(p,-1);if(('"'===y||"'"===y||"`"===y||'"'===g||"'"===g||"`"===g)&&y!==g)throw new l("property names with quotes must have matching quotes");if("constructor"!==p&&h||(a=!0),R(_,o="%"+(n+="."+p)+"%"))s=_[o];else if(null!=s){if(!(p in s)){if(!t)throw new u("base intrinsic for "+e+" exists, but the property is not available.");return}if(d&&f+1>=r.length){var b=d(s,p);s=(h=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:s[p]}else h=R(s,p),s=s[p];h&&!a&&(_[o]=s)}}return s}},9336:(e,t,r)=>{"use strict";var n=r(528)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(e){n=null}e.exports=n},7239:(e,t,r)=>{"use strict";var n=r(4940),i=function(){return!!n};i.hasArrayLengthDefineBug=function(){if(!n)return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=i},6869:e=>{"use strict";var t={__proto__:null,foo:{}},r=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof r)}},3558:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(2908);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},2908:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},8554:(e,t,r)=>{"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,o=r(9138);e.exports=o.call(n,i)},9318:(e,t)=>{t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<<a)-1,u=l>>1,c=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-c)-1,d>>=-c,c+=a;c>0;o=256*o+e[t+f],f+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+e[t+f],f+=h,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=u}return(d?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,l,u=8*o-i-1,c=(1<<u)-1,f=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+f>=1?h/l:h*Math.pow(2,1-f))*l>=2&&(s++,l/=2),s+f>=c?(a=0,s=c):s+f>=1?(a=(t*l-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+d]=255&s,d+=p,s/=256,u-=8);e[r+d-p]|=128*y}},6815:e=>{var t={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==t.call(e)}},5172:(e,t,r)=>{"use strict";var n=("undefined"!=typeof JSON?JSON:r(6998)).stringify,i=r(6815),o=r(9228),s=r(8498),a=r(9818),l=a("Array.prototype.join"),u=a("Array.prototype.push"),c=function(e,t){for(var r="",n=0;n<e;n+=1)r+=t;return r},f=function(e,t,r){return r};e.exports=function(e){var t=arguments.length>1?arguments[1]:void 0,r=t&&t.space||"";"number"==typeof r&&(r=c(r," "));var a=!!t&&"boolean"==typeof t.cycles&&t.cycles,h=t&&t.replacer?s(t.replacer):f,d="function"==typeof t?t:t&&t.cmp,p=d&&function(e){var t=d.length>2&&function(t){return e[t]};return function(r,n){return d({key:r,value:e[r]},{key:n,value:e[n]},t?{__proto__:null,get:t}:void 0)}},y=[];return function e(t,s,f,d){var g=r?"\n"+c(d,r):"",b=r?": ":":";if(f&&f.toJSON&&"function"==typeof f.toJSON&&(f=f.toJSON()),void 0!==(f=h(t,s,f))){if("object"!=typeof f||null===f)return n(f);if(i(f)){for(var w=[],m=0;m<f.length;m++){var v=e(f,m,f[m],d+1)||n(null);u(w,g+r+v)}return"["+l(w,",")+g+"]"}if(-1!==y.indexOf(f)){if(a)return n("__cycle__");throw new TypeError("Converting circular structure to JSON")}u(y,f);var _=o(f).sort(p&&p(f));for(w=[],m=0;m<_.length;m++){var E=e(f,s=_[m],f[s],d+1);if(E){var S=n(s)+b+E;u(w,g+r+S)}}return y.splice(y.indexOf(f),1),"{"+l(w,",")+g+"}"}}({"":e},"",e,0)}},6998:(e,t,r)=>{"use strict";t.parse=r(6921),t.stringify=r(9191)},6921:e=>{"use strict";var t,r,n,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function o(e){throw{name:"SyntaxError",message:e,at:t,text:n}}function s(e){return e&&e!==r&&o("Expected '"+e+"' instead of '"+r+"'"),r=n.charAt(t),t+=1,r}function a(){var e,t="";for("-"===r&&(t="-",s("-"));r>="0"&&r<="9";)t+=r,s();if("."===r)for(t+=".";s()&&r>="0"&&r<="9";)t+=r;if("e"===r||"E"===r)for(t+=r,s(),"-"!==r&&"+"!==r||(t+=r,s());r>="0"&&r<="9";)t+=r,s();return e=Number(t),isFinite(e)||o("Bad number"),e}function l(){var e,t,n,a="";if('"'===r)for(;s();){if('"'===r)return s(),a;if("\\"===r)if(s(),"u"===r){for(n=0,t=0;t<4&&(e=parseInt(s(),16),isFinite(e));t+=1)n=16*n+e;a+=String.fromCharCode(n)}else{if("string"!=typeof i[r])break;a+=i[r]}else a+=r}o("Bad string")}function u(){for(;r&&r<=" ";)s()}function c(){switch(u(),r){case"{":return function(){var e,t={};if("{"===r){if(s("{"),u(),"}"===r)return s("}"),t;for(;r;){if(e=l(),u(),s(":"),Object.prototype.hasOwnProperty.call(t,e)&&o('Duplicate key "'+e+'"'),t[e]=c(),u(),"}"===r)return s("}"),t;s(","),u()}}o("Bad object")}();case"[":return function(){var e=[];if("["===r){if(s("["),u(),"]"===r)return s("]"),e;for(;r;){if(e.push(c()),u(),"]"===r)return s("]"),e;s(","),u()}}o("Bad array")}();case'"':return l();case"-":return a();default:return r>="0"&&r<="9"?a():function(){switch(r){case"t":return s("t"),s("r"),s("u"),s("e"),!0;case"f":return s("f"),s("a"),s("l"),s("s"),s("e"),!1;case"n":return s("n"),s("u"),s("l"),s("l"),null;default:o("Unexpected '"+r+"'")}}()}}e.exports=function(e,i){var s;return n=e,t=0,r=" ",s=c(),u(),r&&o("Syntax error"),"function"==typeof i?function e(t,r){var n,o,s=t[r];if(s&&"object"==typeof s)for(n in c)Object.prototype.hasOwnProperty.call(s,n)&&(void 0===(o=e(s,n))?delete s[n]:s[n]=o);return i.call(t,r,s)}({"":s},""):s}},9191:e=>{"use strict";var t,r,n,i=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function s(e){return i.lastIndex=0,i.test(e)?'"'+e.replace(i,(function(e){var t=o[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}function a(e,i){var o,l,u,c,f,h=t,d=i[e];switch(d&&"object"==typeof d&&"function"==typeof d.toJSON&&(d=d.toJSON(e)),"function"==typeof n&&(d=n.call(i,e,d)),typeof d){case"string":return s(d);case"number":return isFinite(d)?String(d):"null";case"boolean":case"null":return String(d);case"object":if(!d)return"null";if(t+=r,f=[],"[object Array]"===Object.prototype.toString.apply(d)){for(c=d.length,o=0;o<c;o+=1)f[o]=a(o,d)||"null";return u=0===f.length?"[]":t?"[\n"+t+f.join(",\n"+t)+"\n"+h+"]":"["+f.join(",")+"]",t=h,u}if(n&&"object"==typeof n)for(c=n.length,o=0;o<c;o+=1)"string"==typeof(l=n[o])&&(u=a(l,d))&&f.push(s(l)+(t?": ":":")+u);else for(l in d)Object.prototype.hasOwnProperty.call(d,l)&&(u=a(l,d))&&f.push(s(l)+(t?": ":":")+u);return u=0===f.length?"{}":t?"{\n"+t+f.join(",\n"+t)+"\n"+h+"}":"{"+f.join(",")+"}",t=h,u}}e.exports=function(e,i,o){var s;if(t="",r="","number"==typeof o)for(s=0;s<o;s+=1)r+=" ";else"string"==typeof o&&(r=o);if(n=i,i&&"function"!=typeof i&&("object"!=typeof i||"number"!=typeof i.length))throw new Error("JSON.stringify");return a("",{"":e})}},5880:function(e,t,r){var n,i;!function(){"use strict";n=function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"],i={},o=null;function s(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(){for(var r=this.getLevel(),i=0;i<n.length;i++){var o=n[i];this[o]=i<r?e:this.methodFactory(o,r,this.name)}if(this.log=this.debug,typeof console===t&&r<this.levels.SILENT)return"No console available for logging"}function u(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function c(n,i,o){return function(n){return"debug"===n&&(n="log"),typeof console!==t&&("trace"===n&&r?a:void 0!==console[n]?s(console,n):void 0!==console.log?s(console,"log"):e)}(n)||u.apply(this,arguments)}function f(e,r){var s,a,u,f=this,h="loglevel";function d(){var e;if(typeof window!==t&&h){try{e=window.localStorage[h]}catch(e){}if(typeof e===t)try{var r=window.document.cookie,n=encodeURIComponent(h),i=r.indexOf(n+"=");-1!==i&&(e=/^([^;]+)/.exec(r.slice(i+n.length+1))[1])}catch(e){}return void 0===f.levels[e]&&(e=void 0),e}}function p(e){var t=e;if("string"==typeof t&&void 0!==f.levels[t.toUpperCase()]&&(t=f.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=f.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?h+=":"+e:"symbol"==typeof e&&(h=void 0),f.name=e,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=r||c,f.getLevel=function(){return null!=u?u:null!=a?a:s},f.setLevel=function(e,r){return u=p(e),!1!==r&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t&&h){try{return void(window.localStorage[h]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"="+r+";"}catch(e){}}}(u),l.call(f)},f.setDefaultLevel=function(e){a=p(e),d()||f.setLevel(e,!1)},f.resetLevel=function(){u=null,function(){if(typeof window!==t&&h){try{window.localStorage.removeItem(h)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),l.call(f)},f.enableAll=function(e){f.setLevel(f.levels.TRACE,e)},f.disableAll=function(e){f.setLevel(f.levels.SILENT,e)},f.rebuild=function(){if(o!==f&&(s=p(o.getLevel())),l.call(f),o===f)for(var e in i)i[e].rebuild()},s=p(o?o.getLevel():"WARN");var y=d();null!=y&&(u=p(y)),l.call(f)}(o=new f).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=i[e];return t||(t=i[e]=new f(e,o.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return i},o.default=o,o},void 0===(i=n.call(t,r,t,e))||(e.exports=i)}()},8160:(e,t,r)=>{"use strict";var n;if(!Object.keys){var i=Object.prototype.hasOwnProperty,o=Object.prototype.toString,s=r(968),a=Object.prototype.propertyIsEnumerable,l=!a.call({toString:null},"toString"),u=a.call((function(){}),"prototype"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=function(e){var t=e.constructor;return t&&t.prototype===e},h={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!h["$"+e]&&i.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{f(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();n=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===o.call(e),n=s(e),a=t&&"[object String]"===o.call(e),h=[];if(!t&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var p=u&&r;if(a&&e.length>0&&!i.call(e,0))for(var y=0;y<e.length;++y)h.push(String(y));if(n&&e.length>0)for(var g=0;g<e.length;++g)h.push(String(g));else for(var b in e)p&&"prototype"===b||!i.call(e,b)||h.push(String(b));if(l)for(var w=function(e){if("undefined"==typeof window||!d)return f(e);try{return f(e)}catch(e){return!1}}(e),m=0;m<c.length;++m)w&&"constructor"===c[m]||!i.call(e,c[m])||h.push(c[m]);return h}}e.exports=n},9228:(e,t,r)=>{"use strict";var n=Array.prototype.slice,i=r(968),o=Object.keys,s=o?function(e){return o(e)}:r(8160),a=Object.keys;s.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return i(e)?a(n.call(e)):a(e)})}else Object.keys=s;return Object.keys||s},e.exports=s},968:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var r=t.call(e),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),n}},3358:(e,t,r)=>{var n=r(7086);function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}e.exports=n(i),e.exports.strict=n(o),i.proto=i((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})}))},9907:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var a,l=[],u=!1,c=-1;function f(){u&&a&&(u=!1,a.length?l=a.concat(l):c=-1,l.length&&h())}function h(){if(!u){var e=s(f);u=!0;for(var t=l.length;t;){for(a=l,l=[];++c<t;)a&&a[c].run();c=-1,t=l.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function p(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new d(e,t)),1!==l.length||u||s(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},2720:(e,t,r)=>{var n,i=r(9907),o=r(3358),s=r(1822);try{n=r(9467)}catch(e){}var a=function(){},l=/^v?\.0/.test(i.version),u=function(e){return"function"==typeof e},c=function(e){e()},f=function(e,t){return e.pipe(t)};e.exports=function(){var e,t=Array.prototype.slice.call(arguments),r=u(t[t.length-1]||a)&&t.pop()||a;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var i=t.map((function(f,h){var d=h<t.length-1;return function(e,t,r,i){i=o(i);var c=!1;e.on("close",(function(){c=!0})),s(e,{readable:t,writable:r},(function(e){if(e)return i(e);c=!0,i()}));var f=!1;return function(t){if(!c&&!f)return f=!0,function(e){return!!l&&!!n&&(e instanceof(n.ReadStream||a)||e instanceof(n.WriteStream||a))&&u(e.close)}(e)?e.close(a):function(e){return e.setHeader&&u(e.abort)}(e)?e.abort():u(e.destroy)?e.destroy():void i(t||new Error("stream was destroyed"))}}(f,d,h>0,(function(t){e||(e=t),t&&i.forEach(c),d||(i.forEach(c),r(e))}))}));return t.reduce(f)}},1434:(e,t,r)=>{"use strict";const{SymbolDispose:n}=r(1473),{AbortError:i,codes:o}=r(2590),{isNodeStream:s,isWebStream:a,kControllerErrorFunction:l}=r(2520),u=r(4869),{ERR_INVALID_ARG_TYPE:c}=o;let f;e.exports.addAbortSignal=function(t,r){if((e=>{if("object"!=typeof e||!("aborted"in e))throw new c("signal","AbortSignal",e)})(t),!s(r)&&!a(r))throw new c("stream",["ReadableStream","WritableStream","Stream"],r);return e.exports.addAbortSignalNoValidate(t,r)},e.exports.addAbortSignalNoValidate=function(e,t){if("object"!=typeof e||!("aborted"in e))return t;const o=s(t)?()=>{t.destroy(new i(void 0,{cause:e.reason}))}:()=>{t[l](new i(void 0,{cause:e.reason}))};if(e.aborted)o();else{f=f||r(6609).addAbortListener;const i=f(e,o);u(t,i[n])}return t}},82:(e,t,r)=>{"use strict";const{StringPrototypeSlice:n,SymbolIterator:i,TypedArrayPrototypeSet:o,Uint8Array:s}=r(1473),{Buffer:a}=r(1048),{inspect:l}=r(6609);e.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(0===this.length)return"";let t=this.head,r=""+t.data;for(;null!==(t=t.next);)r+=e+t.data;return r}concat(e){if(0===this.length)return a.alloc(0);const t=a.allocUnsafe(e>>>0);let r=this.head,n=0;for(;r;)o(t,r.data,n),n+=r.data.length,r=r.next;return t}consume(e,t){const r=this.head.data;if(e<r.length){const t=r.slice(0,e);return this.head.data=r.slice(e),t}return e===r.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[i](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t="",r=this.head,i=0;do{const o=r.data;if(!(e>o.length)){e===o.length?(t+=o,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(o,0,e),this.head=r,r.data=n(o,e));break}t+=o,e-=o.length,++i}while(null!==(r=r.next));return this.length-=i,t}_getBuffer(e){const t=a.allocUnsafe(e),r=e;let n=this.head,i=0;do{const a=n.data;if(!(e>a.length)){e===a.length?(o(t,a,r-e),++i,n.next?this.head=n.next:this.head=this.tail=null):(o(t,new s(a.buffer,a.byteOffset,e),r-e),this.head=n,n.data=a.slice(e));break}o(t,a,r-e),e-=a.length,++i}while(null!==(n=n.next));return this.length-=i,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return l(this,{...t,depth:0,customInspect:!1})}}},7369:(e,t,r)=>{"use strict";const{pipeline:n}=r(9196),i=r(6279),{destroyer:o}=r(6527),{isNodeStream:s,isReadable:a,isWritable:l,isWebStream:u,isTransformStream:c,isWritableStream:f,isReadableStream:h}=r(2520),{AbortError:d,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:y}}=r(2590),g=r(4869);e.exports=function(...e){if(0===e.length)throw new y("streams");if(1===e.length)return i.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=i.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=i.from(e[t])}for(let r=0;r<e.length;++r)if(s(e[r])||u(e[r])){if(r<e.length-1&&!(a(e[r])||h(e[r])||c(e[r])))throw new p(`streams[${r}]`,t[r],"must be readable");if(r>0&&!(l(e[r])||f(e[r])||c(e[r])))throw new p(`streams[${r}]`,t[r],"must be writable")}let r,b,w,m,v;const _=e[0],E=n(e,(function(e){const t=m;m=null,t?t(e):e?v.destroy(e):A||S||v.destroy()})),S=!!(l(_)||f(_)||c(_)),A=!!(a(E)||h(E)||c(E));if(v=new i({writableObjectMode:!(null==_||!_.writableObjectMode),readableObjectMode:!(null==E||!E.readableObjectMode),writable:S,readable:A}),S){if(s(_))v._write=function(e,t,n){_.write(e,t)?n():r=n},v._final=function(e){_.end(),b=e},_.on("drain",(function(){if(r){const e=r;r=null,e()}}));else if(u(_)){const e=(c(_)?_.writable:_).getWriter();v._write=async function(t,r,n){try{await e.ready,e.write(t).catch((()=>{})),n()}catch(e){n(e)}},v._final=async function(t){try{await e.ready,e.close().catch((()=>{})),b=t}catch(e){t(e)}}}const e=c(E)?E.readable:E;g(e,(()=>{if(b){const e=b;b=null,e()}}))}if(A)if(s(E))E.on("readable",(function(){if(w){const e=w;w=null,e()}})),E.on("end",(function(){v.push(null)})),v._read=function(){for(;;){const e=E.read();if(null===e)return void(w=v._read);if(!v.push(e))return}};else if(u(E)){const e=(c(E)?E.readable:E).getReader();v._read=async function(){for(;;)try{const{value:t,done:r}=await e.read();if(!v.push(t))return;if(r)return void v.push(null)}catch{return}}}return v._destroy=function(e,t){e||null===m||(e=new d),w=null,r=null,b=null,null===m?t(e):(m=t,s(E)&&o(E,e))},v}},6527:(e,t,r)=>{"use strict";const n=r(9907),{aggregateTwoErrors:i,codes:{ERR_MULTIPLE_CALLBACK:o},AbortError:s}=r(2590),{Symbol:a}=r(1473),{kIsDestroyed:l,isDestroyed:u,isFinished:c,isServerRequest:f}=r(2520),h=a("kDestroy"),d=a("kConstruct");function p(e,t,r){e&&(e.stack,t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e))}function y(e,t,r){let i=!1;function o(t){if(i)return;i=!0;const o=e._readableState,s=e._writableState;p(t,s,o),s&&(s.closed=!0),o&&(o.closed=!0),"function"==typeof r&&r(t),t?n.nextTick(g,e,t):n.nextTick(b,e)}try{e._destroy(t||null,o)}catch(t){o(t)}}function g(e,t){w(e,t),b(e)}function b(e){const t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=r&&r.emitClose||null!=t&&t.emitClose)&&e.emit("close")}function w(e,t){const r=e._readableState,n=e._writableState;null!=n&&n.errorEmitted||null!=r&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t))}function m(e,t,r){const i=e._readableState,o=e._writableState;if(null!=o&&o.destroyed||null!=i&&i.destroyed)return this;null!=i&&i.autoDestroy||null!=o&&o.autoDestroy?e.destroy(t):t&&(t.stack,o&&!o.errored&&(o.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(w,e,t):w(e,t))}function v(e){let t=!1;function r(r){if(t)return void m(e,null!=r?r:new o);t=!0;const i=e._readableState,s=e._writableState,a=s||i;i&&(i.constructed=!0),s&&(s.constructed=!0),a.destroyed?e.emit(h,r):r?m(e,r,!0):n.nextTick(_,e)}try{e._construct((e=>{n.nextTick(r,e)}))}catch(e){n.nextTick(r,e)}}function _(e){e.emit(d)}function E(e){return(null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function S(e){e.emit("close")}function A(e,t){e.emit("error",t),n.nextTick(S,e)}e.exports={construct:function(e,t){if("function"!=typeof e._construct)return;const r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(d,t),e.listenerCount(d)>1||n.nextTick(v,e)},destroyer:function(e,t){e&&!u(e)&&(t||c(e)||(t=new s),f(e)?(e.socket=null,e.destroy(t)):E(e)?e.abort():E(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?n.nextTick(A,e,t):n.nextTick(S,e),e.destroyed||(e[l]=!0))},destroy:function(e,t){const r=this._readableState,n=this._writableState,o=n||r;return null!=n&&n.destroyed||null!=r&&r.destroyed?("function"==typeof t&&t(),this):(p(e,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?y(this,e,t):this.once(h,(function(r){y(this,i(r,e),t)})),this)},undestroy:function(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable)},errorOrDestroy:m}},6279:(e,t,r)=>{"use strict";const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:i,ObjectKeys:o,ObjectSetPrototypeOf:s}=r(1473);e.exports=u;const a=r(1509),l=r(5605);s(u.prototype,a.prototype),s(u,a);{const e=o(l.prototype);for(let t=0;t<e.length;t++){const r=e[t];u.prototype[r]||(u.prototype[r]=l.prototype[r])}}function u(e){if(!(this instanceof u))return new u(e);a.call(this,e),l.call(this,e),e?(this.allowHalfOpen=!1!==e.allowHalfOpen,!1===e.readable&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===e.writable&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}let c,f;function h(){return void 0===c&&(c={}),c}n(u.prototype,{writable:{__proto__:null,...i(l.prototype,"writable")},writableHighWaterMark:{__proto__:null,...i(l.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...i(l.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...i(l.prototype,"writableBuffer")},writableLength:{__proto__:null,...i(l.prototype,"writableLength")},writableFinished:{__proto__:null,...i(l.prototype,"writableFinished")},writableCorked:{__proto__:null,...i(l.prototype,"writableCorked")},writableEnded:{__proto__:null,...i(l.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...i(l.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}}),u.fromWeb=function(e,t){return h().newStreamDuplexFromReadableWritablePair(e,t)},u.toWeb=function(e){return h().newReadableWritablePairFromDuplex(e)},u.from=function(e){return f||(f=r(5397)),f(e,"body")}},5397:(e,t,r)=>{const n=r(9907),i=r(1048),{isReadable:o,isWritable:s,isIterable:a,isNodeStream:l,isReadableNodeStream:u,isWritableNodeStream:c,isDuplexNodeStream:f,isReadableStream:h,isWritableStream:d}=r(2520),p=r(4869),{AbortError:y,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:b}}=r(2590),{destroyer:w}=r(6527),m=r(6279),v=r(1509),_=r(5605),{createDeferredPromise:E}=r(6609),S=r(1613),A=globalThis.Blob||i.Blob,I=void 0!==A?function(e){return e instanceof A}:function(e){return!1},R=globalThis.AbortController||r(7083).AbortController,{FunctionPrototypeCall:O}=r(1473);class x extends m{constructor(e){super(e),!1===(null==e?void 0:e.readable)&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===(null==e?void 0:e.writable)&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}function T(e){const t=e.readable&&"function"!=typeof e.readable.read?v.wrap(e.readable):e.readable,r=e.writable;let n,i,a,l,u,c=!!o(t),f=!!s(r);function h(e){const t=l;l=null,t?t(e):e&&u.destroy(e)}return u=new x({readableObjectMode:!(null==t||!t.readableObjectMode),writableObjectMode:!(null==r||!r.writableObjectMode),readable:c,writable:f}),f&&(p(r,(e=>{f=!1,e&&w(t,e),h(e)})),u._write=function(e,t,i){r.write(e,t)?i():n=i},u._final=function(e){r.end(),i=e},r.on("drain",(function(){if(n){const e=n;n=null,e()}})),r.on("finish",(function(){if(i){const e=i;i=null,e()}}))),c&&(p(t,(e=>{c=!1,e&&w(t,e),h(e)})),t.on("readable",(function(){if(a){const e=a;a=null,e()}})),t.on("end",(function(){u.push(null)})),u._read=function(){for(;;){const e=t.read();if(null===e)return void(a=u._read);if(!u.push(e))return}}),u._destroy=function(e,o){e||null===l||(e=new y),a=null,n=null,i=null,null===l?o(e):(l=o,w(r,e),w(t,e))},u}e.exports=function e(t,r){if(f(t))return t;if(u(t))return T({readable:t});if(c(t))return T({writable:t});if(l(t))return T({writable:!1,readable:!1});if(h(t))return T({readable:v.fromWeb(t)});if(d(t))return T({writable:_.fromWeb(t)});if("function"==typeof t){const{value:e,write:i,final:o,destroy:s}=function(e){let{promise:t,resolve:r}=E();const i=new R,o=i.signal;return{value:e(async function*(){for(;;){const e=t;t=null;const{chunk:i,done:s,cb:a}=await e;if(n.nextTick(a),s)return;if(o.aborted)throw new y(void 0,{cause:o.reason});({promise:t,resolve:r}=E()),yield i}}(),{signal:o}),write(e,t,n){const i=r;r=null,i({chunk:e,done:!1,cb:n})},final(e){const t=r;r=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}(t);if(a(e))return S(x,e,{objectMode:!0,write:i,final:o,destroy:s});const l=null==e?void 0:e.then;if("function"==typeof l){let t;const r=O(l,e,(e=>{if(null!=e)throw new b("nully","body",e)}),(e=>{w(t,e)}));return t=new x({objectMode:!0,readable:!1,write:i,final(e){o((async()=>{try{await r,n.nextTick(e,null)}catch(t){n.nextTick(e,t)}}))},destroy:s})}throw new b("Iterable, AsyncIterable or AsyncFunction",r,e)}if(I(t))return e(t.arrayBuffer());if(a(t))return S(x,t,{objectMode:!0,writable:!1});if(h(null==t?void 0:t.readable)&&d(null==t?void 0:t.writable))return x.fromWeb(t);if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable))return T({readable:null!=t&&t.readable?u(null==t?void 0:t.readable)?null==t?void 0:t.readable:e(t.readable):void 0,writable:null!=t&&t.writable?c(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0});const i=null==t?void 0:t.then;if("function"==typeof i){let e;return O(i,t,(t=>{null!=t&&e.push(t),e.push(null)}),(t=>{w(e,t)})),e=new x({objectMode:!0,writable:!1,read(){}})}throw new g(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)}},4869:(e,t,r)=>{const n=r(9907),{AbortError:i,codes:o}=r(2590),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_PREMATURE_CLOSE:a}=o,{kEmptyObject:l,once:u}=r(6609),{validateAbortSignal:c,validateFunction:f,validateObject:h,validateBoolean:d}=r(7840),{Promise:p,PromisePrototypeThen:y,SymbolDispose:g}=r(1473),{isClosed:b,isReadable:w,isReadableNodeStream:m,isReadableStream:v,isReadableFinished:_,isReadableErrored:E,isWritable:S,isWritableNodeStream:A,isWritableStream:I,isWritableFinished:R,isWritableErrored:O,isNodeStream:x,willEmitClose:T,kIsClosedPromise:k}=r(2520);let L;const P=()=>{};function N(e,t,o){var d,p;if(2===arguments.length?(o=t,t=l):null==t?t=l:h(t,"options"),f(o,"callback"),c(t.signal,"options.signal"),o=u(o),v(e)||I(e))return function(e,t,o){let s=!1,a=P;if(t.signal)if(a=()=>{s=!0,o.call(e,new i(void 0,{cause:t.signal.reason}))},t.signal.aborted)n.nextTick(a);else{L=L||r(6609).addAbortListener;const n=L(t.signal,a),i=o;o=u(((...t)=>{n[g](),i.apply(e,t)}))}const l=(...t)=>{s||n.nextTick((()=>o.apply(e,t)))};return y(e[k].promise,l,l),P}(e,t,o);if(!x(e))throw new s("stream",["ReadableStream","WritableStream","Stream"],e);const N=null!==(d=t.readable)&&void 0!==d?d:m(e),B=null!==(p=t.writable)&&void 0!==p?p:A(e),M=e._writableState,j=e._readableState,U=()=>{e.writable||W()};let C=T(e)&&m(e)===N&&A(e)===B,D=R(e,!1);const W=()=>{D=!0,e.destroyed&&(C=!1),(!C||e.readable&&!N)&&(N&&!F||o.call(e))};let F=_(e,!1);const $=()=>{F=!0,e.destroyed&&(C=!1),(!C||e.writable&&!B)&&(B&&!D||o.call(e))},q=t=>{o.call(e,t)};let H=b(e);const z=()=>{H=!0;const t=O(e)||E(e);return t&&"boolean"!=typeof t?o.call(e,t):N&&!F&&m(e,!0)&&!_(e,!1)?o.call(e,new a):!B||D||R(e,!1)?void o.call(e):o.call(e,new a)},V=()=>{H=!0;const t=O(e)||E(e);if(t&&"boolean"!=typeof t)return o.call(e,t);o.call(e)},G=()=>{e.req.on("finish",W)};!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?B&&!M&&(e.on("end",U),e.on("close",U)):(e.on("complete",W),C||e.on("abort",z),e.req?G():e.on("request",G)),C||"boolean"!=typeof e.aborted||e.on("aborted",z),e.on("end",$),e.on("finish",W),!1!==t.error&&e.on("error",q),e.on("close",z),H?n.nextTick(z):null!=M&&M.errorEmitted||null!=j&&j.errorEmitted?C||n.nextTick(V):(N||C&&!w(e)||!D&&!1!==S(e))&&(B||C&&!S(e)||!F&&!1!==w(e))?j&&e.req&&e.aborted&&n.nextTick(V):n.nextTick(V);const Y=()=>{o=P,e.removeListener("aborted",z),e.removeListener("complete",W),e.removeListener("abort",z),e.removeListener("request",G),e.req&&e.req.removeListener("finish",W),e.removeListener("end",U),e.removeListener("close",U),e.removeListener("finish",W),e.removeListener("end",$),e.removeListener("error",q),e.removeListener("close",z)};if(t.signal&&!H){const s=()=>{const r=o;Y(),r.call(e,new i(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)n.nextTick(s);else{L=L||r(6609).addAbortListener;const n=L(t.signal,s),i=o;o=u(((...t)=>{n[g](),i.apply(e,t)}))}}return Y}e.exports=N,e.exports.finished=function(e,t){var r;let n=!1;return null===t&&(t=l),null!==(r=t)&&void 0!==r&&r.cleanup&&(d(t.cleanup,"cleanup"),n=t.cleanup),new p(((r,i)=>{const o=N(e,t,(e=>{n&&o(),e?i(e):r()}))}))}},1613:(e,t,r)=>{"use strict";const n=r(9907),{PromisePrototypeThen:i,SymbolAsyncIterator:o,SymbolIterator:s}=r(1473),{Buffer:a}=r(1048),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_NULL_VALUES:u}=r(2590).codes;e.exports=function(e,t,r){let c,f;if("string"==typeof t||t instanceof a)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null)}});if(t&&t[o])f=!0,c=t[o]();else{if(!t||!t[s])throw new l("iterable",["Iterable"],t);f=!1,c=t[s]()}const h=new e({objectMode:!0,highWaterMark:1,...r});let d=!1;return h._read=function(){d||(d=!0,async function(){for(;;){try{const{value:e,done:t}=f?await c.next():c.next();if(t)h.push(null);else{const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw d=!1,new u;if(h.push(t))continue;d=!1}}catch(e){h.destroy(e)}break}}())},h._destroy=function(e,t){i(async function(e){const t=null!=e,r="function"==typeof c.throw;if(t&&r){const{value:t,done:r}=await c.throw(e);if(await t,r)return}if("function"==typeof c.return){const{value:e}=await c.return();await e}}(e),(()=>n.nextTick(t,e)),(r=>n.nextTick(t,r||e)))},h}},3054:(e,t,r)=>{"use strict";const{ArrayIsArray:n,ObjectSetPrototypeOf:i}=r(1473),{EventEmitter:o}=r(46);function s(e){o.call(this,e)}function a(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}i(s.prototype,o.prototype),i(s,o),s.prototype.pipe=function(e,t){const r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",i),e._isStdio||t&&!1===t.end||(r.on("end",l),r.on("close",u));let s=!1;function l(){s||(s=!0,e.end())}function u(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){f(),0===o.listenerCount(this,"error")&&this.emit("error",e)}function f(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",l),r.removeListener("close",u),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",f),r.removeListener("close",f),e.removeListener("close",f)}return a(r,"error",c),a(e,"error",c),r.on("end",f),r.on("close",f),e.on("close",f),e.emit("pipe",r),e},e.exports={Stream:s,prependListener:a}},4708:(e,t,r)=>{"use strict";const n=globalThis.AbortController||r(7083).AbortController,{codes:{ERR_INVALID_ARG_VALUE:i,ERR_INVALID_ARG_TYPE:o,ERR_MISSING_ARGS:s,ERR_OUT_OF_RANGE:a},AbortError:l}=r(2590),{validateAbortSignal:u,validateInteger:c,validateObject:f}=r(7840),h=r(1473).Symbol("kWeak"),d=r(1473).Symbol("kResistStopPropagation"),{finished:p}=r(4869),y=r(7369),{addAbortSignalNoValidate:g}=r(1434),{isWritable:b,isNodeStream:w}=r(2520),{deprecate:m}=r(6609),{ArrayPrototypePush:v,Boolean:_,MathFloor:E,Number:S,NumberIsNaN:A,Promise:I,PromiseReject:R,PromiseResolve:O,PromisePrototypeThen:x,Symbol:T}=r(1473),k=T("kEmpty"),L=T("kEof");function P(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);null!=t&&f(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal");let n=1;null!=(null==t?void 0:t.concurrency)&&(n=E(t.concurrency));let i=n-1;return null!=(null==t?void 0:t.highWaterMark)&&(i=E(t.highWaterMark)),c(n,"options.concurrency",1),c(i,"options.highWaterMark",0),i+=n,async function*(){const o=r(6609).AbortSignalAny([null==t?void 0:t.signal].filter(_)),s=this,a=[],u={signal:o};let c,f,h=!1,d=0;function p(){h=!0,y()}function y(){d-=1,g()}function g(){f&&!h&&d<n&&a.length<i&&(f(),f=null)}!async function(){try{for await(let t of s){if(h)return;if(o.aborted)throw new l;try{if(t=e(t,u),t===k)continue;t=O(t)}catch(e){t=R(e)}d+=1,x(t,y,p),a.push(t),c&&(c(),c=null),!h&&(a.length>=i||d>=n)&&await new I((e=>{f=e}))}a.push(L)}catch(e){const t=R(e);x(t,y,p),a.push(t)}finally{h=!0,c&&(c(),c=null)}}();try{for(;;){for(;a.length>0;){const e=await a[0];if(e===L)return;if(o.aborted)throw new l;e!==k&&(yield e),a.shift(),g()}await new I((e=>{c=e}))}}finally{h=!0,f&&(f(),f=null)}}.call(this)}async function N(e,t=void 0){for await(const r of B.call(this,e,t))return!0;return!1}function B(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return P.call(this,(async function(t,r){return await e(t,r)?t:k}),t)}class M extends s{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}function j(e){if(e=S(e),A(e))return 0;if(e<0)throw new a("number",">= 0",e);return e}e.exports.streamReturningOperators={asIndexedPairs:m((function(e=void 0){return null!=e&&f(e,"options"),null!=(null==e?void 0:e.signal)&&u(e.signal,"options.signal"),async function*(){let t=0;for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new l({cause:e.signal.reason});yield[t++,n]}}.call(this)}),"readable.asIndexedPairs will be removed in a future version."),drop:function(e,t=void 0){return null!=t&&f(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),e=j(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;e--<=0&&(yield r)}}.call(this)},filter:B,flatMap:function(e,t){const r=P.call(this,e,t);return async function*(){for await(const e of r)yield*e}.call(this)},map:P,take:function(e,t=void 0){return null!=t&&f(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),e=j(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;if(e-- >0&&(yield r),e<=0)return}}.call(this)},compose:function(e,t){if(null!=t&&f(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),w(e)&&!b(e))throw new i("stream",e,"must be writable");const r=y(this,e);return null!=t&&t.signal&&g(t.signal,r),r}},e.exports.promiseReturningOperators={every:async function(e,t=void 0){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return!await N.call(this,(async(...t)=>!await e(...t)),t)},forEach:async function(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);for await(const r of P.call(this,(async function(t,r){return await e(t,r),k}),t));},reduce:async function(e,t,r){var i;if("function"!=typeof e)throw new o("reducer",["Function","AsyncFunction"],e);null!=r&&f(r,"options"),null!=(null==r?void 0:r.signal)&&u(r.signal,"options.signal");let s=arguments.length>1;if(null!=r&&null!==(i=r.signal)&&void 0!==i&&i.aborted){const e=new l(void 0,{cause:r.signal.reason});throw this.once("error",(()=>{})),await p(this.destroy(e)),e}const a=new n,c=a.signal;if(null!=r&&r.signal){const e={once:!0,[h]:this,[d]:!0};r.signal.addEventListener("abort",(()=>a.abort()),e)}let y=!1;try{for await(const n of this){var g;if(y=!0,null!=r&&null!==(g=r.signal)&&void 0!==g&&g.aborted)throw new l;s?t=await e(t,n,{signal:c}):(t=n,s=!0)}if(!y&&!s)throw new M}finally{a.abort()}return t},toArray:async function(e){null!=e&&f(e,"options"),null!=(null==e?void 0:e.signal)&&u(e.signal,"options.signal");const t=[];for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new l(void 0,{cause:e.signal.reason});v(t,n)}return t},some:N,find:async function(e,t){for await(const r of B.call(this,e,t))return r}}},6587:(e,t,r)=>{"use strict";const{ObjectSetPrototypeOf:n}=r(1473);e.exports=o;const i=r(2073);function o(e){if(!(this instanceof o))return new o(e);i.call(this,e)}n(o.prototype,i.prototype),n(o,i),o.prototype._transform=function(e,t,r){r(null,e)}},9196:(e,t,r)=>{const n=r(9907),{ArrayIsArray:i,Promise:o,SymbolAsyncIterator:s,SymbolDispose:a}=r(1473),l=r(4869),{once:u}=r(6609),c=r(6527),f=r(6279),{aggregateTwoErrors:h,codes:{ERR_INVALID_ARG_TYPE:d,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:y,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:b},AbortError:w}=r(2590),{validateFunction:m,validateAbortSignal:v}=r(7840),{isIterable:_,isReadable:E,isReadableNodeStream:S,isNodeStream:A,isTransformStream:I,isWebStream:R,isReadableStream:O,isReadableFinished:x}=r(2520),T=globalThis.AbortController||r(7083).AbortController;let k,L,P;function N(e,t,r){let n=!1;return e.on("close",(()=>{n=!0})),{destroy:t=>{n||(n=!0,c.destroyer(e,t||new g("pipe")))},cleanup:l(e,{readable:t,writable:r},(e=>{n=!e}))}}function B(e){if(_(e))return e;if(S(e))return async function*(e){L||(L=r(1509)),yield*L.prototype[s].call(e)}(e);throw new d("val",["Readable","Iterable","AsyncIterable"],e)}async function M(e,t,r,{end:n}){let i,s=null;const a=e=>{if(e&&(i=e),s){const e=s;s=null,e()}},u=()=>new o(((e,t)=>{i?t(i):s=()=>{i?t(i):e()}}));t.on("drain",a);const c=l(t,{readable:!1},a);try{t.writableNeedDrain&&await u();for await(const r of e)t.write(r)||await u();n&&(t.end(),await u()),r()}catch(e){r(i!==e?h(i,e):e)}finally{c(),t.off("drain",a)}}async function j(e,t,r,{end:n}){I(t)&&(t=t.writable);const i=t.getWriter();try{for await(const t of e)await i.ready,i.write(t).catch((()=>{}));await i.ready,n&&await i.close(),r()}catch(e){try{await i.abort(e),r(e)}catch(e){r(e)}}}function U(e,t,o){if(1===e.length&&i(e[0])&&(e=e[0]),e.length<2)throw new y("streams");const s=new T,l=s.signal,u=null==o?void 0:o.signal,c=[];function h(){W(new w)}let g,b,m;v(u,"options.signal"),P=P||r(6609).addAbortListener,u&&(g=P(u,h));const x=[];let L,U=0;function D(e){W(e,0==--U)}function W(e,r){var i;if(!e||b&&"ERR_STREAM_PREMATURE_CLOSE"!==b.code||(b=e),b||r){for(;x.length;)x.shift()(b);null===(i=g)||void 0===i||i[a](),s.abort(),r&&(b||c.forEach((e=>e())),n.nextTick(t,b,m))}}for(let H=0;H<e.length;H++){const z=e[H],V=H<e.length-1,G=H>0,Y=V||!1!==(null==o?void 0:o.end),K=H===e.length-1;if(A(z)){if(Y){const{destroy:J,cleanup:Z}=N(z,V,G);x.push(J),E(z)&&K&&c.push(Z)}function F(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&D(e)}z.on("error",F),E(z)&&K&&c.push((()=>{z.removeListener("error",F)}))}if(0===H)if("function"==typeof z){if(L=z({signal:l}),!_(L))throw new p("Iterable, AsyncIterable or Stream","source",L)}else L=_(z)||S(z)||I(z)?z:f.from(z);else if("function"==typeof z){var $;if(L=I(L)?B(null===($=L)||void 0===$?void 0:$.readable):B(L),L=z(L,{signal:l}),V){if(!_(L,!0))throw new p("AsyncIterable",`transform[${H-1}]`,L)}else{var q;k||(k=r(6587));const X=new k({objectMode:!0}),Q=null===(q=L)||void 0===q?void 0:q.then;if("function"==typeof Q)U++,Q.call(L,(e=>{m=e,null!=e&&X.write(e),Y&&X.end(),n.nextTick(D)}),(e=>{X.destroy(e),n.nextTick(D,e)}));else if(_(L,!0))U++,M(L,X,D,{end:Y});else{if(!O(L)&&!I(L))throw new p("AsyncIterable or Promise","destination",L);{const re=L.readable||L;U++,M(re,X,D,{end:Y})}}L=X;const{destroy:ee,cleanup:te}=N(L,!1,!0);x.push(ee),K&&c.push(te)}}else if(A(z)){if(S(L)){U+=2;const ne=C(L,z,D,{end:Y});E(z)&&K&&c.push(ne)}else if(I(L)||O(L)){const ie=L.readable||L;U++,M(ie,z,D,{end:Y})}else{if(!_(L))throw new d("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],L);U++,M(L,z,D,{end:Y})}L=z}else if(R(z)){if(S(L))U++,j(B(L),z,D,{end:Y});else if(O(L)||_(L))U++,j(L,z,D,{end:Y});else{if(!I(L))throw new d("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],L);U++,j(L.readable,z,D,{end:Y})}L=z}else L=f.from(z)}return(null!=l&&l.aborted||null!=u&&u.aborted)&&n.nextTick(h),L}function C(e,t,r,{end:i}){let o=!1;if(t.on("close",(()=>{o||r(new b)})),e.pipe(t,{end:!1}),i){function s(){o=!0,t.end()}x(e)?n.nextTick(s):e.once("end",s)}else r();return l(e,{readable:!0,writable:!1},(t=>{const n=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once("end",r).once("error",r):r(t)})),l(t,{readable:!1,writable:!0},r)}e.exports={pipelineImpl:U,pipeline:function(...e){return U(e,u(function(e){return m(e[e.length-1],"streams[stream.length - 1]"),e.pop()}(e)))}}},1509:(e,t,r)=>{const n=r(9907),{ArrayPrototypeIndexOf:i,NumberIsInteger:o,NumberIsNaN:s,NumberParseInt:a,ObjectDefineProperties:l,ObjectKeys:u,ObjectSetPrototypeOf:c,Promise:f,SafeSet:h,SymbolAsyncDispose:d,SymbolAsyncIterator:p,Symbol:y}=r(1473);e.exports=G,G.ReadableState=V;const{EventEmitter:g}=r(46),{Stream:b,prependListener:w}=r(3054),{Buffer:m}=r(1048),{addAbortSignal:v}=r(1434),_=r(4869);let E=r(6609).debuglog("stream",(e=>{E=e}));const S=r(82),A=r(6527),{getHighWaterMark:I,getDefaultHighWaterMark:R}=r(9952),{aggregateTwoErrors:O,codes:{ERR_INVALID_ARG_TYPE:x,ERR_METHOD_NOT_IMPLEMENTED:T,ERR_OUT_OF_RANGE:k,ERR_STREAM_PUSH_AFTER_EOF:L,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:P},AbortError:N}=r(2590),{validateObject:B}=r(7840),M=y("kPaused"),{StringDecoder:j}=r(8888),U=r(1613);c(G.prototype,b.prototype),c(G,b);const C=()=>{},{errorOrDestroy:D}=A,W=1,F=16,$=32,q=2048,H=4096;function z(e){return{enumerable:!1,get(){return!!(this.state&e)},set(t){t?this.state|=e:this.state&=~e}}}function V(e,t,n){"boolean"!=typeof n&&(n=t instanceof r(6279)),this.state=q|H|F|$,e&&e.objectMode&&(this.state|=W),n&&e&&e.readableObjectMode&&(this.state|=W),this.highWaterMark=e?I(this,e,"readableHighWaterMark",n):R(!1),this.buffer=new S,this.length=0,this.pipes=[],this.flowing=null,this[M]=null,e&&!1===e.emitClose&&(this.state&=~q),e&&!1===e.autoDestroy&&(this.state&=~H),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new j(e.encoding),this.encoding=e.encoding)}function G(e){if(!(this instanceof G))return new G(e);const t=this instanceof r(6279);this._readableState=new V(e,this,t),e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&!t&&v(e.signal,this)),b.call(this,e),A.construct(this,(()=>{this._readableState.needReadable&&Q(this,this._readableState)}))}function Y(e,t,r,n){E("readableAddChunk",t);const i=e._readableState;let o;if(i.state&W||("string"==typeof t?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?t=m.from(t,r).toString(i.encoding):(t=m.from(t,r),r=""))):t instanceof m?r="":b._isUint8Array(t)?(t=b._uint8ArrayToBuffer(t),r=""):null!=t&&(o=new x("chunk",["string","Buffer","Uint8Array"],t))),o)D(e,o);else if(null===t)i.state&=-9,function(e,t){if(E("onEofChunk"),!t.ended){if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?Z(e):(t.needReadable=!1,t.emittedReadable=!0,X(e))}}(e,i);else if(i.state&W||t&&t.length>0)if(n)if(4&i.state)D(e,new P);else{if(i.destroyed||i.errored)return!1;K(e,i,t,!0)}else if(i.ended)D(e,new L);else{if(i.destroyed||i.errored)return!1;i.state&=-9,i.decoder&&!r?(t=i.decoder.write(t),i.objectMode||0!==t.length?K(e,i,t,!1):Q(e,i)):K(e,i,t,!1)}else n||(i.state&=-9,Q(e,i));return!i.ended&&(i.length<i.highWaterMark||0===i.length)}function K(e,t,r,n){t.flowing&&0===t.length&&!t.sync&&e.listenerCount("data")>0?(65536&t.state?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),64&t.state&&Z(e)),Q(e,t)}function J(e,t){return e<=0||0===t.length&&t.ended?0:t.state&W?1:s(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function Z(e){const t=e._readableState;E("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(E("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(X,e))}function X(e){const t=e._readableState;E("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,ie(e)}function Q(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(ee,e,t))}function ee(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){const r=t.length;if(E("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function te(e){const t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!1===t[M]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null)}function re(e){E("readable nexttick read 0"),e.read(0)}function ne(e,t){E("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),ie(e),t.flowing&&!t.reading&&e.read(0)}function ie(e){const t=e._readableState;for(E("flow",t.flowing);t.flowing&&null!==e.read(););}function oe(e,t){"function"!=typeof e.read&&(e=G.wrap(e,{objectMode:!0}));const r=async function*(e,t){let r,n=C;function i(t){this===e?(n(),n=C):n=t}e.on("readable",i);const o=_(e,{writable:!1},(e=>{r=e?O(r,e):null,n(),n=C}));try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else{if(r)throw r;if(null===r)return;await new f(i)}}}catch(e){throw r=O(r,e),r}finally{!r&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==r&&!e._readableState.autoDestroy?(e.off("readable",i),o()):A.destroyer(e,null)}}(e,t);return r.stream=e,r}function se(e,t){if(0===t.length)return null;let r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function ae(e){const t=e._readableState;E("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(le,t,e))}function le(e,t){if(E("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&0===e.length)if(e.endEmitted=!0,t.emit("end"),t.writable&&!1===t.allowHalfOpen)n.nextTick(ue,t);else if(e.autoDestroy){const e=t._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&t.destroy()}}function ue(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}let ce;function fe(){return void 0===ce&&(ce={}),ce}l(V.prototype,{objectMode:z(W),ended:z(2),endEmitted:z(4),reading:z(8),constructed:z(F),sync:z($),needReadable:z(64),emittedReadable:z(128),readableListening:z(256),resumeScheduled:z(512),errorEmitted:z(1024),emitClose:z(q),autoDestroy:z(H),destroyed:z(8192),closed:z(16384),closeEmitted:z(32768),multiAwaitDrain:z(65536),readingMore:z(1<<17),dataEmitted:z(1<<18)}),G.prototype.destroy=A.destroy,G.prototype._undestroy=A.undestroy,G.prototype._destroy=function(e,t){t(e)},G.prototype[g.captureRejectionSymbol]=function(e){this.destroy(e)},G.prototype[d]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new N,this.destroy(e)),new f(((t,r)=>_(this,(n=>n&&n!==e?r(n):t(null)))))},G.prototype.push=function(e,t){return Y(this,e,t,!1)},G.prototype.unshift=function(e,t){return Y(this,e,t,!0)},G.prototype.isPaused=function(){const e=this._readableState;return!0===e[M]||!1===e.flowing},G.prototype.setEncoding=function(e){const t=new j(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const r=this._readableState.buffer;let n="";for(const e of r)n+=t.write(e);return r.clear(),""!==n&&r.push(n),this._readableState.length=n.length,this},G.prototype.read=function(e){E("read",e),void 0===e?e=NaN:o(e)||(e=a(e,10));const t=this._readableState,r=e;if(e>t.highWaterMark&&(t.highWaterMark=function(e){if(e>1073741824)throw new k("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}(e)),0!==e&&(t.state&=-129),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return E("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?ae(this):Z(this),null;if(0===(e=J(e,t))&&t.ended)return 0===t.length&&ae(this),null;let n,i=!!(64&t.state);if(E("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&(i=!0,E("length less than watermark",i)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)i=!1,E("reading, ended or constructing",i);else if(i){E("do read"),t.state|=8|$,0===t.length&&(t.state|=64);try{this._read(t.highWaterMark)}catch(e){D(this,e)}t.state&=~$,t.reading||(e=J(r,t))}return n=e>0?se(e,t):null,null===n?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&ae(this)),null===n||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",n)),n},G.prototype._read=function(e){throw new T("_read()")},G.prototype.pipe=function(e,t){const r=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new h(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),E("pipe count=%d opts=%j",i.pipes.length,t);const o=t&&!1===t.end||e===n.stdout||e===n.stderr?y:s;function s(){E("onend"),e.end()}let a;i.endEmitted?n.nextTick(o):r.once("end",o),e.on("unpipe",(function t(n,o){E("onunpipe"),n===r&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,E("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),a&&e.removeListener("drain",a),e.removeListener("error",f),e.removeListener("unpipe",t),r.removeListener("end",s),r.removeListener("end",y),r.removeListener("data",c),l=!0,a&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&a())}));let l=!1;function u(){l||(1===i.pipes.length&&i.pipes[0]===e?(E("false write response, pause",0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(E("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),a||(a=function(e,t){return function(){const r=e._readableState;r.awaitDrainWriters===t?(E("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(E("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(t)),r.awaitDrainWriters&&0!==r.awaitDrainWriters.size||!e.listenerCount("data")||e.resume()}}(r,e),e.on("drain",a))}function c(t){E("ondata");const r=e.write(t);E("dest.write",r),!1===r&&u()}function f(t){if(E("onerror",t),y(),e.removeListener("error",f),0===e.listenerCount("error")){const r=e._writableState||e._readableState;r&&!r.errorEmitted?D(e,t):e.emit("error",t)}}function d(){e.removeListener("finish",p),y()}function p(){E("onfinish"),e.removeListener("close",d),y()}function y(){E("unpipe"),r.unpipe(e)}return r.on("data",c),w(e,"error",f),e.once("close",d),e.once("finish",p),e.emit("pipe",r),!0===e.writableNeedDrain?u():i.flowing||(E("pipe resume"),r.resume()),e},G.prototype.unpipe=function(e){const t=this._readableState;if(0===t.pipes.length)return this;if(!e){const e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit("unpipe",this,{hasUnpiped:!1});return this}const r=i(t.pipes,e);return-1===r||(t.pipes.splice(r,1),0===t.pipes.length&&this.pause(),e.emit("unpipe",this,{hasUnpiped:!1})),this},G.prototype.on=function(e,t){const r=b.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,E("on readable",i.length,i.reading),i.length?Z(this):i.reading||n.nextTick(re,this))),r},G.prototype.addListener=G.prototype.on,G.prototype.removeListener=function(e,t){const r=b.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(te,this),r},G.prototype.off=G.prototype.removeListener,G.prototype.removeAllListeners=function(e){const t=b.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(te,this),t},G.prototype.resume=function(){const e=this._readableState;return e.flowing||(E("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(ne,e,t))}(this,e)),e[M]=!1,this},G.prototype.pause=function(){return E("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(E("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[M]=!0,this},G.prototype.wrap=function(e){let t=!1;e.on("data",(r=>{!this.push(r)&&e.pause&&(t=!0,e.pause())})),e.on("end",(()=>{this.push(null)})),e.on("error",(e=>{D(this,e)})),e.on("close",(()=>{this.destroy()})),e.on("destroy",(()=>{this.destroy()})),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};const r=u(e);for(let t=1;t<r.length;t++){const n=r[t];void 0===this[n]&&"function"==typeof e[n]&&(this[n]=e[n].bind(e))}return this},G.prototype[p]=function(){return oe(this)},G.prototype.iterator=function(e){return void 0!==e&&B(e,"options"),oe(this,e)},l(G.prototype,{readable:{__proto__:null,get(){const e=this._readableState;return!(!e||!1===e.readable||e.destroyed||e.errorEmitted||e.endEmitted)},set(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!(!1===this._readableState.readable||!this._readableState.destroyed&&!this._readableState.errored||this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.objectMode}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return!!this._readableState&&this._readableState.closed}},destroyed:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.destroyed},set(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.endEmitted}}}),l(V.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return!1!==this[M]},set(e){this[M]=!!e}}}),G._fromList=se,G.from=function(e,t){return U(G,e,t)},G.fromWeb=function(e,t){return fe().newStreamReadableFromReadableStream(e,t)},G.toWeb=function(e,t){return fe().newReadableStreamFromStreamReadable(e,t)},G.wrap=function(e,t){var r,n;return new G({objectMode:null===(r=null!==(n=e.readableObjectMode)&&void 0!==n?n:e.objectMode)||void 0===r||r,...t,destroy(t,r){A.destroyer(e,t),r(t)}}).wrap(e)}},9952:(e,t,r)=>{"use strict";const{MathFloor:n,NumberIsInteger:i}=r(1473),{validateInteger:o}=r(7840),{ERR_INVALID_ARG_VALUE:s}=r(2590).codes;let a=16384,l=16;function u(e){return e?l:a}e.exports={getHighWaterMark:function(e,t,r,o){const a=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,o,r);if(null!=a){if(!i(a)||a<0)throw new s(o?`options.${r}`:"options.highWaterMark",a);return n(a)}return u(e.objectMode)},getDefaultHighWaterMark:u,setDefaultHighWaterMark:function(e,t){o(t,"value",0),e?l=t:a=t}}},2073:(e,t,r)=>{"use strict";const{ObjectSetPrototypeOf:n,Symbol:i}=r(1473);e.exports=u;const{ERR_METHOD_NOT_IMPLEMENTED:o}=r(2590).codes,s=r(6279),{getHighWaterMark:a}=r(9952);n(u.prototype,s.prototype),n(u,s);const l=i("kCallback");function u(e){if(!(this instanceof u))return new u(e);const t=e?a(this,e,"readableHighWaterMark",!0):null;0===t&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),s.call(this,e),this._readableState.sync=!1,this[l]=null,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",f)}function c(e){"function"!=typeof this._flush||this.destroyed?(this.push(null),e&&e()):this._flush(((t,r)=>{t?e?e(t):this.destroy(t):(null!=r&&this.push(r),this.push(null),e&&e())}))}function f(){this._final!==c&&c.call(this)}u.prototype._final=c,u.prototype._transform=function(e,t,r){throw new o("_transform()")},u.prototype._write=function(e,t,r){const n=this._readableState,i=this._writableState,o=n.length;this._transform(e,t,((e,t)=>{e?r(e):(null!=t&&this.push(t),i.ended||o===n.length||n.length<n.highWaterMark?r():this[l]=r)}))},u.prototype._read=function(){if(this[l]){const e=this[l];this[l]=null,e()}}},2520:(e,t,r)=>{"use strict";const{SymbolAsyncIterator:n,SymbolIterator:i,SymbolFor:o}=r(1473),s=o("nodejs.stream.destroyed"),a=o("nodejs.stream.errored"),l=o("nodejs.stream.readable"),u=o("nodejs.stream.writable"),c=o("nodejs.stream.disturbed"),f=o("nodejs.webstream.isClosedPromise"),h=o("nodejs.webstream.controllerErrorFunction");function d(e,t=!1){var r;return!(!e||"function"!=typeof e.pipe||"function"!=typeof e.on||t&&("function"!=typeof e.pause||"function"!=typeof e.resume)||e._writableState&&!1===(null===(r=e._readableState)||void 0===r?void 0:r.readable)||e._writableState&&!e._readableState)}function p(e){var t;return!(!e||"function"!=typeof e.write||"function"!=typeof e.on||e._readableState&&!1===(null===(t=e._writableState)||void 0===t?void 0:t.writable))}function y(e){return e&&(e._readableState||e._writableState||"function"==typeof e.write&&"function"==typeof e.on||"function"==typeof e.pipe&&"function"==typeof e.on)}function g(e){return!(!e||y(e)||"function"!=typeof e.pipeThrough||"function"!=typeof e.getReader||"function"!=typeof e.cancel)}function b(e){return!(!e||y(e)||"function"!=typeof e.getWriter||"function"!=typeof e.abort)}function w(e){return!(!e||y(e)||"object"!=typeof e.readable||"object"!=typeof e.writable)}function m(e){if(!y(e))return null;const t=e._writableState,r=e._readableState,n=t||r;return!!(e.destroyed||e[s]||null!=n&&n.destroyed)}function v(e){if(!p(e))return null;if(!0===e.writableEnded)return!0;const t=e._writableState;return(null==t||!t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function _(e,t){if(!d(e))return null;const r=e._readableState;return(null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.endEmitted)?null:!!(r.endEmitted||!1===t&&!0===r.ended&&0===r.length))}function E(e){return e&&null!=e[l]?e[l]:"boolean"!=typeof(null==e?void 0:e.readable)?null:!m(e)&&d(e)&&e.readable&&!_(e)}function S(e){return e&&null!=e[u]?e[u]:"boolean"!=typeof(null==e?void 0:e.writable)?null:!m(e)&&p(e)&&e.writable&&!v(e)}function A(e){return"boolean"==typeof e._closed&&"boolean"==typeof e._defaultKeepAlive&&"boolean"==typeof e._removedConnection&&"boolean"==typeof e._removedContLen}function I(e){return"boolean"==typeof e._sent100&&A(e)}e.exports={isDestroyed:m,kIsDestroyed:s,isDisturbed:function(e){var t;return!(!e||!(null!==(t=e[c])&&void 0!==t?t:e.readableDidRead||e.readableAborted))},kIsDisturbed:c,isErrored:function(e){var t,r,n,i,o,s,l,u,c,f;return!(!e||!(null!==(t=null!==(r=null!==(n=null!==(i=null!==(o=null!==(s=e[a])&&void 0!==s?s:e.readableErrored)&&void 0!==o?o:e.writableErrored)&&void 0!==i?i:null===(l=e._readableState)||void 0===l?void 0:l.errorEmitted)&&void 0!==n?n:null===(u=e._writableState)||void 0===u?void 0:u.errorEmitted)&&void 0!==r?r:null===(c=e._readableState)||void 0===c?void 0:c.errored)&&void 0!==t?t:null===(f=e._writableState)||void 0===f?void 0:f.errored))},kIsErrored:a,isReadable:E,kIsReadable:l,kIsClosedPromise:f,kControllerErrorFunction:h,kIsWritable:u,isClosed:function(e){if(!y(e))return null;if("boolean"==typeof e.closed)return e.closed;const t=e._writableState,r=e._readableState;return"boolean"==typeof(null==t?void 0:t.closed)||"boolean"==typeof(null==r?void 0:r.closed)?(null==t?void 0:t.closed)||(null==r?void 0:r.closed):"boolean"==typeof e._closed&&A(e)?e._closed:null},isDuplexNodeStream:function(e){return!(!e||"function"!=typeof e.pipe||!e._readableState||"function"!=typeof e.on||"function"!=typeof e.write)},isFinished:function(e,t){return y(e)?!(!m(e)&&(!1!==(null==t?void 0:t.readable)&&E(e)||!1!==(null==t?void 0:t.writable)&&S(e))):null},isIterable:function(e,t){return null!=e&&(!0===t?"function"==typeof e[n]:!1===t?"function"==typeof e[i]:"function"==typeof e[n]||"function"==typeof e[i])},isReadableNodeStream:d,isReadableStream:g,isReadableEnded:function(e){if(!d(e))return null;if(!0===e.readableEnded)return!0;const t=e._readableState;return!(!t||t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)},isReadableFinished:_,isReadableErrored:function(e){var t,r;return y(e)?e.readableErrored?e.readableErrored:null!==(t=null===(r=e._readableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null},isNodeStream:y,isWebStream:function(e){return g(e)||b(e)||w(e)},isWritable:S,isWritableNodeStream:p,isWritableStream:b,isWritableEnded:v,isWritableFinished:function(e,t){if(!p(e))return null;if(!0===e.writableFinished)return!0;const r=e._writableState;return(null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.finished)?null:!!(r.finished||!1===t&&!0===r.ended&&0===r.length))},isWritableErrored:function(e){var t,r;return y(e)?e.writableErrored?e.writableErrored:null!==(t=null===(r=e._writableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null},isServerRequest:function(e){var t;return"boolean"==typeof e._consuming&&"boolean"==typeof e._dumped&&void 0===(null===(t=e.req)||void 0===t?void 0:t.upgradeOrConnect)},isServerResponse:I,willEmitClose:function(e){if(!y(e))return null;const t=e._writableState,r=e._readableState,n=t||r;return!n&&I(e)||!!(n&&n.autoDestroy&&n.emitClose&&!1===n.closed)},isTransformStream:w}},5605:(e,t,r)=>{const n=r(9907),{ArrayPrototypeSlice:i,Error:o,FunctionPrototypeSymbolHasInstance:s,ObjectDefineProperty:a,ObjectDefineProperties:l,ObjectSetPrototypeOf:u,StringPrototypeToLowerCase:c,Symbol:f,SymbolHasInstance:h}=r(1473);e.exports=B,B.WritableState=P;const{EventEmitter:d}=r(46),p=r(3054).Stream,{Buffer:y}=r(1048),g=r(6527),{addAbortSignal:b}=r(1434),{getHighWaterMark:w,getDefaultHighWaterMark:m}=r(9952),{ERR_INVALID_ARG_TYPE:v,ERR_METHOD_NOT_IMPLEMENTED:_,ERR_MULTIPLE_CALLBACK:E,ERR_STREAM_CANNOT_PIPE:S,ERR_STREAM_DESTROYED:A,ERR_STREAM_ALREADY_FINISHED:I,ERR_STREAM_NULL_VALUES:R,ERR_STREAM_WRITE_AFTER_END:O,ERR_UNKNOWN_ENCODING:x}=r(2590).codes,{errorOrDestroy:T}=g;function k(){}u(B.prototype,p.prototype),u(B,p);const L=f("kOnFinished");function P(e,t,n){"boolean"!=typeof n&&(n=t instanceof r(6279)),this.objectMode=!(!e||!e.objectMode),n&&(this.objectMode=this.objectMode||!(!e||!e.writableObjectMode)),this.highWaterMark=e?w(this,e,"writableHighWaterMark",n):m(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const i=!(!e||!1!==e.decodeStrings);this.decodeStrings=!i,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=C.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,N(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||!1!==e.emitClose,this.autoDestroy=!e||!1!==e.autoDestroy,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[L]=[]}function N(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}function B(e){const t=this instanceof r(6279);if(!t&&!s(B,this))return new B(e);this._writableState=new P(e,this,t),e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&b(e.signal,this)),p.call(this,e),g.construct(this,(()=>{const e=this._writableState;e.writing||$(this,e),H(this,e)}))}function M(e,t,r,i){const o=e._writableState;if("function"==typeof r)i=r,r=o.defaultEncoding;else{if(r){if("buffer"!==r&&!y.isEncoding(r))throw new x(r)}else r=o.defaultEncoding;"function"!=typeof i&&(i=k)}if(null===t)throw new R;if(!o.objectMode)if("string"==typeof t)!1!==o.decodeStrings&&(t=y.from(t,r),r="buffer");else if(t instanceof y)r="buffer";else{if(!p._isUint8Array(t))throw new v("chunk",["string","Buffer","Uint8Array"],t);t=p._uint8ArrayToBuffer(t),r="buffer"}let s;return o.ending?s=new O:o.destroyed&&(s=new A("write")),s?(n.nextTick(i,s),T(e,s,!0),s):(o.pendingcb++,function(e,t,r,n,i){const o=t.objectMode?1:r.length;t.length+=o;const s=t.length<t.highWaterMark;return s||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:r,encoding:n,callback:i}),t.allBuffers&&"buffer"!==n&&(t.allBuffers=!1),t.allNoop&&i!==k&&(t.allNoop=!1)):(t.writelen=o,t.writecb=i,t.writing=!0,t.sync=!0,e._write(r,n,t.onwrite),t.sync=!1),s&&!t.errored&&!t.destroyed}(e,o,t,r,i))}function j(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new A("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function U(e,t,r,n){--t.pendingcb,n(r),F(t),T(e,r)}function C(e,t){const r=e._writableState,i=r.sync,o=r.writecb;"function"==typeof o?(r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t?(t.stack,r.errored||(r.errored=t),e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?n.nextTick(U,e,r,t,o):U(e,r,t,o)):(r.buffered.length>r.bufferedIndex&&$(e,r),i?null!==r.afterWriteTickInfo&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:e,state:r},n.nextTick(D,r.afterWriteTickInfo)):W(e,r,1,o))):T(e,new E)}function D({stream:e,state:t,count:r,cb:n}){return t.afterWriteTickInfo=null,W(e,t,r,n)}function W(e,t,r,n){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));r-- >0;)t.pendingcb--,n();t.destroyed&&F(t),H(e,t)}function F(e){if(e.writing)return;for(let r=e.bufferedIndex;r<e.buffered.length;++r){var t;const{chunk:n,callback:i}=e.buffered[r],o=e.objectMode?1:n.length;e.length-=o,i(null!==(t=e.errored)&&void 0!==t?t:new A("write"))}const r=e[L].splice(0);for(let t=0;t<r.length;t++){var n;r[t](null!==(n=e.errored)&&void 0!==n?n:new A("end"))}N(e)}function $(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;const{buffered:r,bufferedIndex:n,objectMode:o}=t,s=r.length-n;if(!s)return;let a=n;if(t.bufferProcessing=!0,s>1&&e._writev){t.pendingcb-=s-1;const n=t.allNoop?k:e=>{for(let t=a;t<r.length;++t)r[t].callback(e)},o=t.allNoop&&0===a?r:i(r,a);o.allBuffers=t.allBuffers,j(e,t,!0,t.length,o,"",n),N(t)}else{do{const{chunk:n,encoding:i,callback:s}=r[a];r[a++]=null,j(e,t,!1,o?1:n.length,n,i,s)}while(a<r.length&&!t.writing);a===r.length?N(t):a>256?(r.splice(0,a),t.bufferedIndex=0):t.bufferedIndex=a}t.bufferProcessing=!1}function q(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function H(e,t,r){q(t)&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.finalCalled=!0,function(e,t){let r=!1;function i(i){if(r)T(e,null!=i?i:E());else if(r=!0,t.pendingcb--,i){const r=t[L].splice(0);for(let e=0;e<r.length;e++)r[e](i);T(e,i,t.sync)}else q(t)&&(t.prefinished=!0,e.emit("prefinish"),t.pendingcb++,n.nextTick(z,e,t))}t.sync=!0,t.pendingcb++;try{e._final(i)}catch(e){i(e)}t.sync=!1}(e,t)))}(e,t),0===t.pendingcb&&(r?(t.pendingcb++,n.nextTick(((e,t)=>{q(t)?z(e,t):t.pendingcb--}),e,t)):q(t)&&(t.pendingcb++,z(e,t))))}function z(e,t){t.pendingcb--,t.finished=!0;const r=t[L].splice(0);for(let e=0;e<r.length;e++)r[e]();if(e.emit("finish"),t.autoDestroy){const t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||!1===t.readable))&&e.destroy()}}P.prototype.getBuffer=function(){return i(this.buffered,this.bufferedIndex)},a(P.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}}),a(B,h,{__proto__:null,value:function(e){return!!s(this,e)||this===B&&e&&e._writableState instanceof P}}),B.prototype.pipe=function(){T(this,new S)},B.prototype.write=function(e,t,r){return!0===M(this,e,t,r)},B.prototype.cork=function(){this._writableState.corked++},B.prototype.uncork=function(){const e=this._writableState;e.corked&&(e.corked--,e.writing||$(this,e))},B.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=c(e)),!y.isEncoding(e))throw new x(e);return this._writableState.defaultEncoding=e,this},B.prototype._write=function(e,t,r){if(!this._writev)throw new _("_write()");this._writev([{chunk:e,encoding:t}],r)},B.prototype._writev=null,B.prototype.end=function(e,t,r){const i=this._writableState;let s;if("function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e){const r=M(this,e,t);r instanceof o&&(s=r)}return i.corked&&(i.corked=1,this.uncork()),s||(i.errored||i.ending?i.finished?s=new I("end"):i.destroyed&&(s=new A("end")):(i.ending=!0,H(this,i,!0),i.ended=!0)),"function"==typeof r&&(s||i.finished?n.nextTick(r,s):i[L].push(r)),this},l(B.prototype,{closed:{__proto__:null,get(){return!!this._writableState&&this._writableState.closed}},destroyed:{__proto__:null,get(){return!!this._writableState&&this._writableState.destroyed},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){const e=this._writableState;return!(!e||!1===e.writable||e.destroyed||e.errored||e.ending||e.ended)},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return!!this._writableState&&this._writableState.finished}},writableObjectMode:{__proto__:null,get(){return!!this._writableState&&this._writableState.objectMode}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return!!this._writableState&&this._writableState.ending}},writableNeedDrain:{__proto__:null,get(){const e=this._writableState;return!!e&&!e.destroyed&&!e.ending&&e.needDrain}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!(!1===this._writableState.writable||!this._writableState.destroyed&&!this._writableState.errored||this._writableState.finished)}}});const V=g.destroy;let G;function Y(){return void 0===G&&(G={}),G}B.prototype.destroy=function(e,t){const r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[L].length)&&n.nextTick(F,r),V.call(this,e,t),this},B.prototype._undestroy=g.undestroy,B.prototype._destroy=function(e,t){t(e)},B.prototype[d.captureRejectionSymbol]=function(e){this.destroy(e)},B.fromWeb=function(e,t){return Y().newStreamWritableFromWritableStream(e,t)},B.toWeb=function(e){return Y().newWritableStreamFromStreamWritable(e)}},7840:(e,t,r)=>{"use strict";const{ArrayIsArray:n,ArrayPrototypeIncludes:i,ArrayPrototypeJoin:o,ArrayPrototypeMap:s,NumberIsInteger:a,NumberIsNaN:l,NumberMAX_SAFE_INTEGER:u,NumberMIN_SAFE_INTEGER:c,NumberParseInt:f,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:d,String:p,StringPrototypeToUpperCase:y,StringPrototypeTrim:g}=r(1473),{hideStackFrames:b,codes:{ERR_SOCKET_BAD_PORT:w,ERR_INVALID_ARG_TYPE:m,ERR_INVALID_ARG_VALUE:v,ERR_OUT_OF_RANGE:_,ERR_UNKNOWN_SIGNAL:E}}=r(2590),{normalizeEncoding:S}=r(6609),{isAsyncFunction:A,isArrayBufferView:I}=r(6609).types,R={},O=/^[0-7]+$/,x=b(((e,t,r=c,n=u)=>{if("number"!=typeof e)throw new m(t,"number",e);if(!a(e))throw new _(t,"an integer",e);if(e<r||e>n)throw new _(t,`>= ${r} && <= ${n}`,e)})),T=b(((e,t,r=-2147483648,n=2147483647)=>{if("number"!=typeof e)throw new m(t,"number",e);if(!a(e))throw new _(t,"an integer",e);if(e<r||e>n)throw new _(t,`>= ${r} && <= ${n}`,e)})),k=b(((e,t,r=!1)=>{if("number"!=typeof e)throw new m(t,"number",e);if(!a(e))throw new _(t,"an integer",e);const n=r?1:0,i=4294967295;if(e<n||e>i)throw new _(t,`>= ${n} && <= ${i}`,e)}));function L(e,t){if("string"!=typeof e)throw new m(t,"string",e)}const P=b(((e,t,r)=>{if(!i(r,e)){const n=o(s(r,(e=>"string"==typeof e?`'${e}'`:p(e))),", ");throw new v(t,e,"must be one of: "+n)}}));function N(e,t){if("boolean"!=typeof e)throw new m(t,"boolean",e)}function B(e,t,r){return null!=e&&h(e,t)?e[t]:r}const M=b(((e,t,r=null)=>{const i=B(r,"allowArray",!1),o=B(r,"allowFunction",!1);if(!B(r,"nullable",!1)&&null===e||!i&&n(e)||"object"!=typeof e&&(!o||"function"!=typeof e))throw new m(t,"Object",e)})),j=b(((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new m(t,"a dictionary",e)})),U=b(((e,t,r=0)=>{if(!n(e))throw new m(t,"Array",e);if(e.length<r)throw new v(t,e,`must be longer than ${r}`)})),C=b(((e,t="buffer")=>{if(!I(e))throw new m(t,["Buffer","TypedArray","DataView"],e)})),D=b(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new m(t,"AbortSignal",e)})),W=b(((e,t)=>{if("function"!=typeof e)throw new m(t,"Function",e)})),F=b(((e,t)=>{if("function"!=typeof e||A(e))throw new m(t,"Function",e)})),$=b(((e,t)=>{if(void 0!==e)throw new m(t,"undefined",e)})),q=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function H(e,t){if(void 0===e||!d(q,e))throw new v(t,e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}e.exports={isInt32:function(e){return e===(0|e)},isUint32:function(e){return e===e>>>0},parseFileMode:function(e,t,r){if(void 0===e&&(e=r),"string"==typeof e){if(null===d(O,e))throw new v(t,e,"must be a 32-bit unsigned integer or an octal string");e=f(e,8)}return k(e,t),e},validateArray:U,validateStringArray:function(e,t){U(e,t);for(let r=0;r<e.length;r++)L(e[r],`${t}[${r}]`)},validateBooleanArray:function(e,t){U(e,t);for(let r=0;r<e.length;r++)N(e[r],`${t}[${r}]`)},validateAbortSignalArray:function(e,t){U(e,t);for(let r=0;r<e.length;r++){const n=e[r],i=`${t}[${r}]`;if(null==n)throw new m(i,"AbortSignal",n);D(n,i)}},validateBoolean:N,validateBuffer:C,validateDictionary:j,validateEncoding:function(e,t){const r=S(t),n=e.length;if("hex"===r&&n%2!=0)throw new v("encoding",t,`is invalid for data of length ${n}`)},validateFunction:W,validateInt32:T,validateInteger:x,validateNumber:function(e,t,r=void 0,n){if("number"!=typeof e)throw new m(t,"number",e);if(null!=r&&e<r||null!=n&&e>n||(null!=r||null!=n)&&l(e))throw new _(t,`${null!=r?`>= ${r}`:""}${null!=r&&null!=n?" && ":""}${null!=n?`<= ${n}`:""}`,e)},validateObject:M,validateOneOf:P,validatePlainFunction:F,validatePort:function(e,t="Port",r=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===g(e).length||+e!=+e>>>0||e>65535||0===e&&!r)throw new w(t,e,r);return 0|e},validateSignalName:function(e,t="signal"){if(L(e,t),void 0===R[e]){if(void 0!==R[y(e)])throw new E(e+" (signals must use all capital letters)");throw new E(e)}},validateString:L,validateUint32:k,validateUndefined:$,validateUnion:function(e,t,r){if(!i(r,e))throw new m(t,`('${o(r,"|")}')`,e)},validateAbortSignal:D,validateLinkHeaderValue:function(e){if("string"==typeof e)return H(e,"hints"),e;if(n(e)){const t=e.length;let r="";if(0===t)return r;for(let n=0;n<t;n++){const i=e[n];H(i,"hints"),r+=i,n!==t-1&&(r+=", ")}return r}throw new v("hints",e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}}},8521:(e,t,r)=>{"use strict";const n=r(601),i=r(2010),o=n.Readable.destroy;e.exports=n.Readable,e.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,e.exports._isUint8Array=n._isUint8Array,e.exports.isDisturbed=n.isDisturbed,e.exports.isErrored=n.isErrored,e.exports.isReadable=n.isReadable,e.exports.Readable=n.Readable,e.exports.Writable=n.Writable,e.exports.Duplex=n.Duplex,e.exports.Transform=n.Transform,e.exports.PassThrough=n.PassThrough,e.exports.addAbortSignal=n.addAbortSignal,e.exports.finished=n.finished,e.exports.destroy=n.destroy,e.exports.destroy=o,e.exports.pipeline=n.pipeline,e.exports.compose=n.compose,Object.defineProperty(n,"promises",{configurable:!0,enumerable:!0,get:()=>i}),e.exports.Stream=n.Stream,e.exports.default=e.exports},2590:(e,t,r)=>{"use strict";const{format:n,inspect:i,AggregateError:o}=r(6609),s=globalThis.AggregateError||o,a=Symbol("kIsNodeError"),l=["string","function","number","object","Function","Object","boolean","bigint","symbol"],u=/^([A-Z][a-z0-9]*)+$/,c={};function f(e,t){if(!e)throw new c.ERR_INTERNAL_ASSERTION(t)}function h(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function d(e,t,r){r||(r=Error);class i extends r{constructor(...r){super(function(e,t,r){if("function"==typeof t)return f(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);const i=(t.match(/%[dfijoOs]/g)||[]).length;return f(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),0===r.length?t:n(t,...r)}(e,t,r))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=e,i.prototype[a]=!0,c[e]=i}function p(e){const t="__node_internal_"+e.name;return Object.defineProperty(e,"name",{value:t}),e}class y extends Error{constructor(e="The operation was aborted",t=void 0){if(void 0!==t&&"object"!=typeof t)throw new c.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}}d("ERR_ASSERTION","%s",Error),d("ERR_INVALID_ARG_TYPE",((e,t,r)=>{f("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let n="The ";e.endsWith(" argument")?n+=`${e} `:n+=`"${e}" ${e.includes(".")?"property":"argument"} `,n+="must be ";const o=[],s=[],a=[];for(const e of t)f("string"==typeof e,"All expected entries have to be of type string"),l.includes(e)?o.push(e.toLowerCase()):u.test(e)?s.push(e):(f("object"!==e,'The value "object" should be written as "Object"'),a.push(e));if(s.length>0){const e=o.indexOf("object");-1!==e&&(o.splice(o,e,1),s.push("Object"))}if(o.length>0){switch(o.length){case 1:n+=`of type ${o[0]}`;break;case 2:n+=`one of type ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();n+=`one of type ${o.join(", ")}, or ${e}`}}(s.length>0||a.length>0)&&(n+=" or ")}if(s.length>0){switch(s.length){case 1:n+=`an instance of ${s[0]}`;break;case 2:n+=`an instance of ${s[0]} or ${s[1]}`;break;default:{const e=s.pop();n+=`an instance of ${s.join(", ")}, or ${e}`}}a.length>0&&(n+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(n+="an "),n+=`${a[0]}`;break;case 2:n+=`one of ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();n+=`one of ${a.join(", ")}, or ${e}`}}if(null==r)n+=`. Received ${r}`;else if("function"==typeof r&&r.name)n+=`. Received function ${r.name}`;else if("object"==typeof r){var c;null!==(c=r.constructor)&&void 0!==c&&c.name?n+=`. Received an instance of ${r.constructor.name}`:n+=`. Received ${i(r,{depth:-1})}`}else{let e=i(r,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),n+=`. Received type ${typeof r} (${e})`}return n}),TypeError),d("ERR_INVALID_ARG_VALUE",((e,t,r="is invalid")=>{let n=i(t);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${n}`}),TypeError),d("ERR_INVALID_RETURN_VALUE",((e,t,r)=>{var n;return`Expected ${e} to be returned from the "${t}" function but got ${null!=r&&null!==(n=r.constructor)&&void 0!==n&&n.name?`instance of ${r.constructor.name}`:"type "+typeof r}.`}),TypeError),d("ERR_MISSING_ARGS",((...e)=>{let t;f(e.length>0,"At least one arg needs to be specified");const r=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const r=e.pop();t+=`The ${e.join(", ")}, and ${r} arguments`}}return`${t} must be specified`}),TypeError),d("ERR_OUT_OF_RANGE",((e,t,r)=>{let n;return f(t,'Missing "range" argument'),Number.isInteger(r)&&Math.abs(r)>2**32?n=h(String(r)):"bigint"==typeof r?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=h(n)),n+="n"):n=i(r),`The value of "${e}" is out of range. It must be ${t}. Received ${n}`}),RangeError),d("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),d("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),d("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),d("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),d("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),d("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),d("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),d("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),d("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),d("ERR_STREAM_WRITE_AFTER_END","write after end",Error),d("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),e.exports={AbortError:y,aggregateTwoErrors:p((function(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const r=new s([t,e],t.message);return r.code=t.code,r}return e||t})),hideStackFrames:p,codes:c}},1473:e=>{"use strict";e.exports={ArrayIsArray:e=>Array.isArray(e),ArrayPrototypeIncludes:(e,t)=>e.includes(t),ArrayPrototypeIndexOf:(e,t)=>e.indexOf(t),ArrayPrototypeJoin:(e,t)=>e.join(t),ArrayPrototypeMap:(e,t)=>e.map(t),ArrayPrototypePop:(e,t)=>e.pop(t),ArrayPrototypePush:(e,t)=>e.push(t),ArrayPrototypeSlice:(e,t,r)=>e.slice(t,r),Error,FunctionPrototypeCall:(e,t,...r)=>e.call(t,...r),FunctionPrototypeSymbolHasInstance:(e,t)=>Function.prototype[Symbol.hasInstance].call(e,t),MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties:(e,t)=>Object.defineProperties(e,t),ObjectDefineProperty:(e,t,r)=>Object.defineProperty(e,t,r),ObjectGetOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e,t),ObjectKeys:e=>Object.keys(e),ObjectSetPrototypeOf:(e,t)=>Object.setPrototypeOf(e,t),Promise,PromisePrototypeCatch:(e,t)=>e.catch(t),PromisePrototypeThen:(e,t,r)=>e.then(t,r),PromiseReject:e=>Promise.reject(e),PromiseResolve:e=>Promise.resolve(e),ReflectApply:Reflect.apply,RegExpPrototypeTest:(e,t)=>e.test(t),SafeSet:Set,String,StringPrototypeSlice:(e,t,r)=>e.slice(t,r),StringPrototypeToLowerCase:e=>e.toLowerCase(),StringPrototypeToUpperCase:e=>e.toUpperCase(),StringPrototypeTrim:e=>e.trim(),Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet:(e,t,r)=>e.set(t,r),Boolean,Uint8Array}},6609:(e,t,r)=>{"use strict";const n=r(1048),{kResistStopPropagation:i,SymbolDispose:o}=r(1473),s=globalThis.AbortSignal||r(7083).AbortSignal,a=globalThis.AbortController||r(7083).AbortController,l=Object.getPrototypeOf((async function(){})).constructor,u=globalThis.Blob||n.Blob,c=void 0!==u?function(e){return e instanceof u}:function(e){return!1},f=(e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new ERR_INVALID_ARG_TYPE(t,"AbortSignal",e)};class h extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let r=0;r<e.length;r++)t+=` ${e[r].stack}\n`;super(t),this.name="AggregateError",this.errors=e}}e.exports={AggregateError:h,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...r){t||(t=!0,e.apply(this,r))}},createDeferredPromise:function(){let e,t;return{promise:new Promise(((r,n)=>{e=r,t=n})),resolve:e,reject:t}},promisify:e=>new Promise(((t,r)=>{e(((e,...n)=>e?r(e):t(...n)))})),debuglog:()=>function(){},format:(e,...t)=>e.replace(/%([sdifj])/g,(function(...[e,r]){const n=t.shift();return"f"===r?n.toFixed(6):"j"===r?JSON.stringify(n):"s"===r&&"object"==typeof n?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})),inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return`${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return"{}"}},types:{isAsyncFunction:e=>e instanceof l,isArrayBufferView:e=>ArrayBuffer.isView(e)},isBlob:c,deprecate:(e,t)=>e,addAbortListener:r(46).addAbortListener||function(e,t){if(void 0===e)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);let r;return f(e,"signal"),(e=>{if("function"!=typeof e)throw new ERR_INVALID_ARG_TYPE("listener","Function",e)})(t),e.aborted?queueMicrotask((()=>t())):(e.addEventListener("abort",t,{__proto__:null,once:!0,[i]:!0}),r=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[o](){var e;null===(e=r)||void 0===e||e()}}},AbortSignalAny:s.any||function(e){if(1===e.length)return e[0];const t=new a,r=()=>t.abort();return e.forEach((e=>{f(e,"signals"),e.addEventListener("abort",r,{once:!0})})),t.signal.addEventListener("abort",(()=>{e.forEach((e=>e.removeEventListener("abort",r)))}),{once:!0}),t.signal}},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")},601:(e,t,r)=>{const{Buffer:n}=r(1048),{ObjectDefineProperty:i,ObjectKeys:o,ReflectApply:s}=r(1473),{promisify:{custom:a}}=r(6609),{streamReturningOperators:l,promiseReturningOperators:u}=r(4708),{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=r(2590),f=r(7369),{setDefaultHighWaterMark:h,getDefaultHighWaterMark:d}=r(9952),{pipeline:p}=r(9196),{destroyer:y}=r(6527),g=r(4869),b=r(2010),w=r(2520),m=e.exports=r(3054).Stream;m.isDestroyed=w.isDestroyed,m.isDisturbed=w.isDisturbed,m.isErrored=w.isErrored,m.isReadable=w.isReadable,m.isWritable=w.isWritable,m.Readable=r(1509);for(const E of o(l)){const S=l[E];function v(...e){if(new.target)throw c();return m.Readable.from(s(S,this,e))}i(v,"name",{__proto__:null,value:S.name}),i(v,"length",{__proto__:null,value:S.length}),i(m.Readable.prototype,E,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}for(const A of o(u)){const I=u[A];function v(...e){if(new.target)throw c();return s(I,this,e)}i(v,"name",{__proto__:null,value:I.name}),i(v,"length",{__proto__:null,value:I.length}),i(m.Readable.prototype,A,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}m.Writable=r(5605),m.Duplex=r(6279),m.Transform=r(2073),m.PassThrough=r(6587),m.pipeline=p;const{addAbortSignal:_}=r(1434);m.addAbortSignal=_,m.finished=g,m.destroy=y,m.compose=f,m.setDefaultHighWaterMark=h,m.getDefaultHighWaterMark=d,i(m,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>b}),i(p,a,{__proto__:null,enumerable:!0,get:()=>b.pipeline}),i(g,a,{__proto__:null,enumerable:!0,get:()=>b.finished}),m.Stream=m,m._isUint8Array=function(e){return e instanceof Uint8Array},m._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)}},2010:(e,t,r)=>{"use strict";const{ArrayPrototypePop:n,Promise:i}=r(1473),{isIterable:o,isNodeStream:s,isWebStream:a}=r(2520),{pipelineImpl:l}=r(9196),{finished:u}=r(4869);r(601),e.exports={finished:u,pipeline:function(...e){return new i(((t,r)=>{let i,u;const c=e[e.length-1];if(c&&"object"==typeof c&&!s(c)&&!o(c)&&!a(c)){const t=n(e);i=t.signal,u=t.end}l(e,((e,n)=>{e?r(e):t(n)}),{signal:i,end:u})}))}}},6108:(e,t,r)=>{"use strict";var n=r(528),i=r(686),o=r(7239)(),s=r(9336),a=r(3468),l=n("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new a("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||l(t)!==t)throw new a("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,u=!0;if("length"in e&&s){var c=s(e,"length");c&&!c.configurable&&(n=!1),c&&!c.writable&&(u=!1)}return(n||u||!r)&&(o?i(e,"length",t,!0,!0):i(e,"length",t)),e}},8888:(e,t,r)=>{"use strict";var n=r(8322).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=c,this.end=f,t=3;break;default:return this.write=h,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function l(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function c(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=s(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=s(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=s(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},8322:(e,t,r)=>{var n=r(1048),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},7086:e=>{e.exports=function e(t,r){if(t&&r)return e(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){n[e]=t[e]})),n;function n(){for(var e=new Array(arguments.length),r=0;r<e.length;r++)e[r]=arguments[r];var n=t.apply(this,e),i=e[e.length-1];return"function"==typeof n&&n!==i&&Object.keys(i).forEach((function(e){n[e]=i[e]})),n}}},9467:()=>{}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{AirInPageProvider:()=>yn,AirService:()=>Yo,BUTTON_POSITION:()=>Qr,CONFIRMATION_STRATEGY:()=>Jt,EMBED_BUILD_ENV:()=>Xr,EXTERNAL_LOGIN_PROVIDER:()=>en,RealmEmbed:()=>Eo});var e={};function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function i(e,r,n){return(r=function(e){var r=function(e){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function l(e,t){a(e,t),t.add(e)}function u(e,t,r){a(e,t),t.set(e,r)}function c(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function f(e,...t){if(!((r=e)instanceof Uint8Array||null!=r&&"object"==typeof r&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");var r;if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function h(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");c(e.outputLen),c(e.blockLen)}function d(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function p(e,t){f(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}r.r(e),r.d(e,{DO:()=>U,OG:()=>J,My:()=>D,Ph:()=>H,lX:()=>z,Id:()=>K,fg:()=>Q,qj:()=>Y,aT:()=>q,aY:()=>j,lq:()=>V,z:()=>G,Q5:()=>te});const y={number:c,bool:function(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)},bytes:f,hash:h,exists:d,output:p},g="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,b=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),w=(e,t)=>e<<32-t|e>>>t,m=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function v(e){for(let r=0;r<e.length;r++)e[r]=(t=e[r])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var t}function _(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),f(e),e}class E{clone(){return this._cloneInto()}}function S(e){const t=t=>e().update(_(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function A(e=32){if(g&&"function"==typeof g.getRandomValues)return g.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}const I=(e,t,r)=>e&t^e&r^t&r;class R extends E{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=b(this.buffer)}update(e){d(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=_(e)).length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s!==n)r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0);else{const t=b(e);for(;n<=i-o;o+=n)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){d(this),p(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),l=n?4:0,u=n?0:4;e.setUint32(t+l,s,n),e.setUint32(t+u,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=b(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)s.setUint32(4*e,u[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.length=n,e.pos=s,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}}const O=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),x=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),T=new Uint32Array(64);class k extends R{constructor(){super(64,32,8,!1),this.A=0|x[0],this.B=0|x[1],this.C=0|x[2],this.D=0|x[3],this.E=0|x[4],this.F=0|x[5],this.G=0|x[6],this.H=0|x[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)T[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=T[e-15],r=T[e-2],n=w(t,7)^w(t,18)^t>>>3,i=w(r,17)^w(r,19)^r>>>10;T[e]=i+T[e-7]+n+T[e-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:l,H:u}=this;for(let e=0;e<64;e++){const t=u+(w(s,6)^w(s,11)^w(s,25))+((c=s)&a^~c&l)+O[e]+T[e]|0,f=(w(r,2)^w(r,13)^w(r,22))+I(r,n,i)|0;u=l,l=a,a=s,s=o+t|0,o=i,i=n,n=r,r=t+f|0}var c;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,n,i,o,s,a,l,u)}roundClean(){T.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const L=S((()=>new k));class P extends E{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,h(e);const r=_(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),i.fill(0)}update(e){return d(this),this.iHash.update(e),this}digestInto(e){d(this),f(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=n,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const N=(e,t,r)=>new P(e,t).update(r).digest();N.create=(e,t)=>new P(e,t);const B=BigInt(1),M=BigInt(2);function j(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function U(e){if(!j(e))throw new Error("Uint8Array expected")}const C=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function D(e){U(e);let t="";for(let r=0;r<e.length;r++)t+=C[e[r]];return t}function W(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}const F={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function $(e){return e>=F._0&&e<=F._9?e-F._0:e>=F._A&&e<=F._F?e-(F._A-10):e>=F._a&&e<=F._f?e-(F._a-10):void 0}function q(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){const r=$(e.charCodeAt(i)),o=$(e.charCodeAt(i+1));if(void 0===r||void 0===o){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}n[t]=16*r+o}return n}function H(e){return W(D(e))}function z(e){return U(e),W(D(Uint8Array.from(e).reverse()))}function V(e,t){return q(e.toString(16).padStart(2*t,"0"))}function G(e,t){return V(e,t).reverse()}function Y(e,t,r){let n;if("string"==typeof t)try{n=q(t)}catch(r){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${r}`)}else{if(!j(t))throw new Error(`${e} must be hex string or Uint8Array`);n=Uint8Array.from(t)}const i=n.length;if("number"==typeof r&&i!==r)throw new Error(`${e} expected ${r} bytes, got ${i}`);return n}function K(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];U(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r}const J=e=>(M<<BigInt(e-1))-B,Z=e=>new Uint8Array(e),X=e=>Uint8Array.from(e);function Q(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=Z(e),i=Z(e),o=0;const s=()=>{n.fill(1),i.fill(0),o=0},a=(...e)=>r(i,n,...e),l=(e=Z())=>{i=a(X([0]),e),n=a(),0!==e.length&&(i=a(X([1]),e),n=a())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e<t;){n=a();const t=n.slice();r.push(t),e+=n.length}return K(...r)};return(e,t)=>{let r;for(s(),l(e);!(r=t(u()));)l();return s(),r}}const ee={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||j(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function te(e,t,r={}){const n=(t,r,n)=>{const i=ee[r];if("function"!=typeof i)throw new Error(`Invalid validator "${r}", expected function`);const o=e[t];if(!(n&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${r}`)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}const re=BigInt(0),ne=BigInt(1),ie=BigInt(2),oe=BigInt(3),se=BigInt(4),ae=BigInt(5),le=BigInt(8);function ue(e,t){const r=e%t;return r>=re?r:t+r}function ce(e,t,r){if(r<=re||t<re)throw new Error("Expected power/modulo > 0");if(r===ne)return re;let n=ne;for(;t>re;)t&ne&&(n=n*e%r),e=e*e%r,t>>=ne;return n}function fe(e,t,r){let n=e;for(;t-- >re;)n*=n,n%=r;return n}function he(e,t){if(e===re||t<=re)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=ue(e,t),n=t,i=re,o=ne,s=ne,a=re;for(;r!==re;){const e=n/r,t=n%r,l=i-s*e,u=o-a*e;n=r,r=t,i=s,o=a,s=l,a=u}if(n!==ne)throw new Error("invert: does not exist");return ue(i,t)}BigInt(9),BigInt(16);const de=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function pe(e,t){const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function ye(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function ge(e){const t=ye(e);return t+Math.ceil(t/2)}const be=BigInt(0),we=BigInt(1);function me(e){return te(e.Fp,de.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),te(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...pe(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const{Ph:ve,aT:_e}=e,Ee={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=Ee;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");const r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:ve(n),l:e.subarray(r+2)}},toSig(e){const{Err:t}=Ee,r="string"==typeof e?_e(e):e;U(r);let n=r.length;if(n<2||48!=r[0])throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:i,l:o}=Ee._parseInt(r.subarray(2)),{d:s,l:a}=Ee._parseInt(o);if(a.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,r=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},n=t(r(e.s)),i=t(r(e.r)),o=n.length/2,s=i.length/2,a=r(o),l=r(s);return`30${r(s+o+4)}02${l}${i}02${a}${n}`}},Se=BigInt(0),Ae=BigInt(1),Ie=(BigInt(2),BigInt(3));function Re(e){const t=function(e){const t=me(e);return te(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n}=t,i=r.BYTES+1,o=2*r.BYTES+1;function s(e){return ue(e,n)}function a(e){return he(e,n)}const{ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:c,isWithinCurveOrder:f}=function(e){const t=function(e){const t=me(e);te(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=t;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:r}=t,n=t.toBytes||((e,t,n)=>{const i=t.toAffine();return K(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),i=t.fromBytes||(e=>{const t=e.subarray(1);return{x:r.fromBytes(t.subarray(0,r.BYTES)),y:r.fromBytes(t.subarray(r.BYTES,2*r.BYTES))}});function o(e){const{a:n,b:i}=t,o=r.sqr(e),s=r.mul(o,e);return r.add(r.add(s,r.mul(e,n)),i)}if(!r.eql(r.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function s(e){return"bigint"==typeof e&&Se<e&&e<t.n}function a(e){if(!s(e))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(e){const{allowedPrivateKeyLengths:r,nByteLength:n,wrapPrivateKey:i,n:o}=t;if(r&&"bigint"!=typeof e){if(j(e)&&(e=D(e)),"string"!=typeof e||!r.includes(e.length))throw new Error("Invalid key");e=e.padStart(2*n,"0")}let s;try{s="bigint"==typeof e?e:H(Y("private key",e,n))}catch(t){throw new Error(`private key must be ${n} bytes, hex or bigint, not ${typeof e}`)}return i&&(s=ue(s,o)),a(s),s}const u=new Map;function c(e){if(!(e instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(e,t,n){if(this.px=e,this.py=t,this.pz=n,null==e||!r.isValid(e))throw new Error("x required");if(null==t||!r.isValid(t))throw new Error("y required");if(null==n||!r.isValid(n))throw new Error("z required")}static fromAffine(e){const{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw new Error("invalid affine point");if(e instanceof f)throw new Error("projective point not allowed");const i=e=>r.eql(e,r.ZERO);return i(t)&&i(n)?f.ZERO:new f(t,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(f.fromAffine)}static fromHex(e){const t=f.fromAffine(i(Y("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return f.BASE.multiply(l(e))}_setWindowSize(e){this._WINDOW_SIZE=e,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:n}=this.toAffine();if(!r.isValid(e)||!r.isValid(n))throw new Error("bad point: x or y not FE");const i=r.sqr(n),s=o(e);if(!r.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(r.isOdd)return!r.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){c(e);const{px:t,py:n,pz:i}=this,{px:o,py:s,pz:a}=e,l=r.eql(r.mul(t,a),r.mul(o,i)),u=r.eql(r.mul(n,a),r.mul(s,i));return l&&u}negate(){return new f(this.px,r.neg(this.py),this.pz)}double(){const{a:e,b:n}=t,i=r.mul(n,Ie),{px:o,py:s,pz:a}=this;let l=r.ZERO,u=r.ZERO,c=r.ZERO,h=r.mul(o,o),d=r.mul(s,s),p=r.mul(a,a),y=r.mul(o,s);return y=r.add(y,y),c=r.mul(o,a),c=r.add(c,c),l=r.mul(e,c),u=r.mul(i,p),u=r.add(l,u),l=r.sub(d,u),u=r.add(d,u),u=r.mul(l,u),l=r.mul(y,l),c=r.mul(i,c),p=r.mul(e,p),y=r.sub(h,p),y=r.mul(e,y),y=r.add(y,c),c=r.add(h,h),h=r.add(c,h),h=r.add(h,p),h=r.mul(h,y),u=r.add(u,h),p=r.mul(s,a),p=r.add(p,p),h=r.mul(p,y),l=r.sub(l,h),c=r.mul(p,d),c=r.add(c,c),c=r.add(c,c),new f(l,u,c)}add(e){c(e);const{px:n,py:i,pz:o}=this,{px:s,py:a,pz:l}=e;let u=r.ZERO,h=r.ZERO,d=r.ZERO;const p=t.a,y=r.mul(t.b,Ie);let g=r.mul(n,s),b=r.mul(i,a),w=r.mul(o,l),m=r.add(n,i),v=r.add(s,a);m=r.mul(m,v),v=r.add(g,b),m=r.sub(m,v),v=r.add(n,o);let _=r.add(s,l);return v=r.mul(v,_),_=r.add(g,w),v=r.sub(v,_),_=r.add(i,o),u=r.add(a,l),_=r.mul(_,u),u=r.add(b,w),_=r.sub(_,u),d=r.mul(p,v),u=r.mul(y,w),d=r.add(u,d),u=r.sub(b,d),d=r.add(b,d),h=r.mul(u,d),b=r.add(g,g),b=r.add(b,g),w=r.mul(p,w),v=r.mul(y,v),b=r.add(b,w),w=r.sub(g,w),w=r.mul(p,w),v=r.add(v,w),g=r.mul(b,v),h=r.add(h,g),g=r.mul(_,v),u=r.mul(m,u),u=r.sub(u,g),g=r.mul(m,b),d=r.mul(_,d),d=r.add(d,g),new f(u,h,d)}subtract(e){return this.add(e.negate())}is0(){return this.equals(f.ZERO)}wNAF(e){return d.wNAFCached(this,u,e,(e=>{const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(f.fromAffine)}))}multiplyUnsafe(e){const n=f.ZERO;if(e===Se)return n;if(a(e),e===Ae)return this;const{endo:i}=t;if(!i)return d.unsafeLadder(this,e);let{k1neg:o,k1:s,k2neg:l,k2:u}=i.splitScalar(e),c=n,h=n,p=this;for(;s>Se||u>Se;)s&Ae&&(c=c.add(p)),u&Ae&&(h=h.add(p)),p=p.double(),s>>=Ae,u>>=Ae;return o&&(c=c.negate()),l&&(h=h.negate()),h=new f(r.mul(h.px,i.beta),h.py,h.pz),c.add(h)}multiply(e){a(e);let n,i,o=e;const{endo:s}=t;if(s){const{k1neg:e,k1:t,k2neg:a,k2:l}=s.splitScalar(o);let{p:u,f:c}=this.wNAF(t),{p:h,f:p}=this.wNAF(l);u=d.constTimeNegate(e,u),h=d.constTimeNegate(a,h),h=new f(r.mul(h.px,s.beta),h.py,h.pz),n=u.add(h),i=c.add(p)}else{const{p:e,f:t}=this.wNAF(o);n=e,i=t}return f.normalizeZ([n,i])[0]}multiplyAndAddUnsafe(e,t,r){const n=f.BASE,i=(e,t)=>t!==Se&&t!==Ae&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,r));return o.is0()?void 0:o}toAffine(e){const{px:t,py:n,pz:i}=this,o=this.is0();null==e&&(e=o?r.ONE:r.inv(i));const s=r.mul(t,e),a=r.mul(n,e),l=r.mul(i,e);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(l,r.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:e,isTorsionFree:r}=t;if(e===Ae)return!0;if(r)return r(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:r}=t;return e===Ae?this:r?r(f,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),n(f,this,e)}toHex(e=!0){return D(this.toRawBytes(e))}}f.BASE=new f(t.Gx,t.Gy,r.ONE),f.ZERO=new f(r.ZERO,r.ONE,r.ZERO);const h=t.nBitLength,d=function(e,t){const r=(e,t)=>{const r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,i=t;for(;r>be;)r&we&&(n=n.add(i)),i=i.double(),r>>=we;return n},precomputeWindow(e,t){const{windows:r,windowSize:i}=n(t),o=[];let s=e,a=s;for(let e=0;e<r;e++){a=s,o.push(a);for(let e=1;e<i;e++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(t,i,o){const{windows:s,windowSize:a}=n(t);let l=e.ZERO,u=e.BASE;const c=BigInt(2**t-1),f=2**t,h=BigInt(t);for(let e=0;e<s;e++){const t=e*a;let n=Number(o&c);o>>=h,n>a&&(n-=f,o+=we);const s=t,d=t+Math.abs(n)-1,p=e%2!=0,y=n<0;0===n?u=u.add(r(p,i[s])):l=l.add(r(y,i[d]))}return{p:l,f:u}},wNAFCached(e,t,r,n){const i=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,n(o))),this.wNAF(i,o,r)}}}(f,t.endo?Math.ceil(h/2):h);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:o,isWithinCurveOrder:s}}({...t,toBytes(e,t,n){const i=t.toAffine(),o=r.toBytes(i.x),s=K;return n?s(Uint8Array.from([t.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes(e){const t=e.length,n=e[0],s=e.subarray(1);if(t!==i||2!==n&&3!==n){if(t===o&&4===n)return{x:r.fromBytes(s.subarray(0,r.BYTES)),y:r.fromBytes(s.subarray(r.BYTES,2*r.BYTES))};throw new Error(`Point of length ${t} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const e=H(s);if(!(Se<(a=e)&&a<r.ORDER))throw new Error("Point is not on curve");const t=c(e);let i;try{i=r.sqrt(t)}catch(e){const t=e instanceof Error?": "+e.message:"";throw new Error("Point is not on curve"+t)}return!(1&~n)!=((i&Ae)===Ae)&&(i=r.neg(i)),{x:e,y:i}}var a}}),h=e=>D(V(e,t.nByteLength));function d(e){return e>n>>Ae}const p=(e,t,r)=>H(e.slice(t,r));class y{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){const r=t.nByteLength;return e=Y("compactSignature",e,2*r),new y(p(e,0,r),p(e,r,2*r))}static fromDER(e){const{r:t,s:r}=Ee.toSig(Y("DER",e));return new y(t,r)}assertValidity(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new y(this.r,this.s,e)}recoverPublicKey(e){const{r:n,s:i,recovery:o}=this,u=m(Y("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const c=2===o||3===o?n+t.n:n;if(c>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const f=1&o?"03":"02",d=l.fromHex(f+h(c)),p=a(c),y=s(-u*p),g=s(i*p),b=l.BASE.multiplyAndAddUnsafe(d,y,g);if(!b)throw new Error("point at infinify");return b.assertValidity(),b}hasHighS(){return d(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return q(this.toDERHex())}toDERHex(){return Ee.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return q(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const g={isValidPrivateKey(e){try{return u(e),!0}catch(e){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const e=ge(t.n);return function(e,t,r=!1){const n=e.length,i=ye(t),o=ge(t);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);const s=ue(r?H(e):z(e),t-ne)+ne;return r?G(s,i):V(s,i)}(t.randomBytes(e),t.n)},precompute:(e=8,t=l.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function b(e){const t=j(e),r="string"==typeof e,n=(t||r)&&e.length;return t?n===i||n===o:r?n===2*i||n===2*o:e instanceof l}const w=t.bits2int||function(e){const r=H(e),n=8*e.length-t.nBitLength;return n>0?r>>BigInt(n):r},m=t.bits2int_modN||function(e){return s(w(e))},v=J(t.nBitLength);function _(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(Se<=e&&e<v))throw new Error(`bigint expected < 2^${t.nBitLength}`);return V(e,t.nByteLength)}const E={lowS:t.lowS,prehash:!1},S={lowS:t.lowS,prehash:!1};return l.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return l.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(b(e))throw new Error("first arg must be private key");if(!b(t))throw new Error("second arg must be public key");return l.fromHex(t).multiply(u(e)).toRawBytes(r)},sign:function(e,n,i=E){const{seed:o,k2sig:c}=function(e,n,i=E){if(["recovered","canonical"].some((e=>e in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:c}=t;let{lowS:h,prehash:p,extraEntropy:g}=i;null==h&&(h=!0),e=Y("msgHash",e),p&&(e=Y("prehashed msgHash",o(e)));const b=m(e),v=u(n),S=[_(v),_(b)];if(null!=g&&!1!==g){const e=!0===g?c(r.BYTES):g;S.push(Y("extraEntropy",e))}const A=K(...S),I=b;return{seed:A,k2sig:function(e){const t=w(e);if(!f(t))return;const r=a(t),n=l.BASE.multiply(t).toAffine(),i=s(n.x);if(i===Se)return;const o=s(r*s(I+i*v));if(o===Se)return;let u=(n.x===i?0:2)|Number(n.y&Ae),c=o;return h&&d(o)&&(c=function(e){return d(e)?s(-e):e}(o),u^=1),new y(i,c,u)}}}(e,n,i),h=t;return Q(h.hash.outputLen,h.nByteLength,h.hmac)(o,c)},verify:function(e,r,n,i=S){const o=e;if(r=Y("msgHash",r),n=Y("publicKey",n),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:u,prehash:c}=i;let f,h;try{if("string"==typeof o||j(o))try{f=y.fromDER(o)}catch(e){if(!(e instanceof Ee.Err))throw e;f=y.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:e,s:t}=o;f=new y(e,t)}}h=l.fromHex(n)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&f.hasHighS())return!1;c&&(r=t.hash(r));const{r:d,s:p}=f,g=m(r),b=a(p),w=s(g*b),v=s(d*b),_=l.BASE.multiplyAndAddUnsafe(h,w,v)?.toAffine();return!!_&&s(_.x)===d},ProjectivePoint:l,Signature:y,utils:g}}function Oe(e){return{hash:e,hmac:(t,...r)=>N(e,t,function(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];f(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r}(...r)),randomBytes:A}}BigInt(4);const xe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Te=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ke=BigInt(1),Le=BigInt(2),Pe=(e,t)=>(e+t/Le)/t;const Ne=function(e,t,r=!1,n={}){if(e<=re)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=pe(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=function(e){if(e%se===oe){const t=(e+ne)/se;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}if(e%le===ae){const t=(e-ae)/le;return function(e,r){const n=e.mul(r,ie),i=e.pow(n,t),o=e.mul(r,i),s=e.mul(e.mul(o,ie),i),a=e.mul(o,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),r))throw new Error("Cannot find square root");return a}}return function(e){const t=(e-ne)/ie;let r,n,i;for(r=e-ne,n=0;r%ie===re;r/=ie,n++);for(i=ie;i<e&&ce(i,t,e)!==e-ne;i++);if(1===n){const t=(e+ne)/se;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}const o=(r+ne)/ie;return function(e,s){if(e.pow(s,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let a=n,l=e.pow(e.mul(e.ONE,i),r),u=e.pow(s,o),c=e.pow(s,r);for(;!e.eql(c,e.ONE);){if(e.eql(c,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(c);t<a&&!e.eql(r,e.ONE);t++)r=e.sqr(r);const r=e.pow(l,ne<<BigInt(a-t-1));l=e.sqr(r),u=e.mul(u,r),c=e.mul(c,l),a=t}return u}}(e)}(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:J(i),ZERO:re,ONE:ne,create:t=>ue(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return re<=t&&t<e},is0:e=>e===re,isOdd:e=>(e&ne)===ne,neg:t=>ue(-t,e),eql:(e,t)=>e===t,sqr:t=>ue(t*t,e),add:(t,r)=>ue(t+r,e),sub:(t,r)=>ue(t-r,e),mul:(t,r)=>ue(t*r,e),pow:(e,t)=>function(e,t,r){if(r<re)throw new Error("Expected power > 0");if(r===re)return e.ONE;if(r===ne)return t;let n=e.ONE,i=t;for(;r>re;)r&ne&&(n=e.mul(n,i)),i=e.sqr(i),r>>=ne;return n}(a,e,t),div:(t,r)=>ue(t*he(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>he(t,e),sqrt:n.sqrt||(e=>s(a,e)),invertBatch:e=>function(e,t){const r=new Array(t.length),n=t.reduce(((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n))),e.ONE),i=e.inv(n);return t.reduceRight(((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n))),i),r}(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?G(e,o):V(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return r?z(e):H(e)}});return Object.freeze(a)}(xe,void 0,void 0,{sqrt:function(e){const t=xe,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),l=BigInt(88),u=e*e*e%t,c=u*u*e%t,f=fe(c,r,t)*c%t,h=fe(f,r,t)*c%t,d=fe(h,Le,t)*u%t,p=fe(d,i,t)*d%t,y=fe(p,o,t)*p%t,g=fe(y,a,t)*y%t,b=fe(g,l,t)*g%t,w=fe(b,a,t)*y%t,m=fe(w,r,t)*c%t,v=fe(m,s,t)*p%t,_=fe(v,n,t)*u%t,E=fe(_,Le,t);if(!Ne.eql(Ne.sqr(E),e))throw new Error("Cannot find square root");return E}}),Be=function(e,t){const r=t=>Re({...e,...Oe(t)});return Object.freeze({...r(t),create:r})}({a:BigInt(0),b:BigInt(7),Fp:Ne,n:Te,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Te,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-ke*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=Pe(o*e,t),l=Pe(-n*e,t);let u=ue(e-a*r-l*i,t),c=ue(-a*n-l*o,t);const f=u>s,h=c>s;if(f&&(u=t-u),h&&(c=t-c),u>s||c>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:u,k2neg:h,k2:c}}}},L);function Me(e){return t=>(y.bytes(t),e(t))}BigInt(0),Be.ProjectivePoint,y.bool,y.bytes,(()=>{const e="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,t="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);t&&!e&&t("crypto")})(),BigInt(0);const je={},Ue={};for(let e=0;e<16;e++){const t=e,r=16*e,n=e.toString(16).toLowerCase();Ue[n]=t,Ue[n.toUpperCase()]=t,je[n]=r,je[n.toUpperCase()]=r}Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));const Ce=[];for(let e=0;e<=65535;e++)Ce[e]=BigInt(e);const De=e=>{if("string"!=typeof e)throw new Error(`hex argument type ${typeof e} must be of type string`);if(!/^0x[0-9a-fA-F]*$/.test(e))throw new Error(`Input must be a 0x-prefixed hexadecimal string, got ${e}`);const t=e.slice(2);return function(e){const t=e.length,r=new Uint8Array(t/2);for(let n=0;n<t;n+=2)r[n/2]=je[e[n]]+Ue[e[n+1]];return r}(t.length%2==0?t:function(e){let t=e;if("string"!=typeof t)throw new Error("[padToEven] value must be type 'string', received "+typeof t);return t.length%2&&(t=`0${t}`),t}(t))},We=e=>{const t=(e=>{if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`})(e);return De(t)};BigInt("0xffffffffffffffff"),BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),Be.CURVE.n,Be.CURVE.n,BigInt(2),BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),De("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"),De("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"),De("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"),Uint8Array.from([128]),BigInt(-1),BigInt(0),BigInt(1),BigInt(2),BigInt(3),BigInt(7),BigInt(8),BigInt(27),BigInt(28),BigInt(31),BigInt(32),BigInt(64),BigInt(128),BigInt(255),BigInt(256),BigInt(96),BigInt(100),BigInt(160),BigInt(224),BigInt(7922816251426434e13),BigInt(1461501637330903e33),BigInt(2695994666715064e52),BigInt(1e9),Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));const Fe=BigInt(2**32-1),$e=BigInt(32);function qe(e,t=!1){return t?{h:Number(e&Fe),l:Number(e>>$e&Fe)}:{h:0|Number(e>>$e&Fe),l:0|Number(e&Fe)}}function He(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:s}=qe(e[i],t);[r[i],n[i]]=[o,s]}return[r,n]}const ze=[],Ve=[],Ge=[],Ye=BigInt(0),Ke=BigInt(1),Je=BigInt(2),Ze=BigInt(7),Xe=BigInt(256),Qe=BigInt(113);for(let e=0,t=Ke,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],ze.push(2*(5*n+r)),Ve.push((e+1)*(e+2)/2%64);let i=Ye;for(let e=0;e<7;e++)t=(t<<Ke^(t>>Ze)*Qe)%Xe,t&Je&&(i^=Ke<<(Ke<<BigInt(e))-Ke);Ge.push(i)}const[et,tt]=He(Ge,!0),rt=(e,t,r)=>r>32?((e,t,r)=>t<<r-32|e>>>64-r)(e,t,r):((e,t,r)=>e<<r|t>>>32-r)(e,t,r),nt=(e,t,r)=>r>32?((e,t,r)=>e<<r-32|t>>>64-r)(e,t,r):((e,t,r)=>t<<r|e>>>32-r)(e,t,r);class it extends E{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,c(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}keccak(){m||v(this.state32),function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],s=r[i+1],a=rt(o,s,1)^r[n],l=nt(o,s,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=l}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=Ve[r],o=rt(t,i,n),s=nt(t,i,n),a=ze[r];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=et[n],e[1]^=tt[n]}r.fill(0)}(this.state32,this.rounds),m||v(this.state32),this.posOut=0,this.pos=0}update(e){d(this);const{blockLen:t,state:r}=this,n=(e=_(e)).length;for(let i=0;i<n;){const o=Math.min(t-this.pos,n-i);for(let t=0;t<o;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,128&t&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){d(this,!1),f(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return c(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(p(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new it(t,r,n,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=o,e.destroyed=this.destroyed,e}}const ot=(e,t,r)=>S((()=>new it(t,e,r))),st=ot(1,144,28),at=ot(1,136,32),lt=ot(1,104,48),ut=ot(1,72,64);var ct,ft,ht,dt;Me(st),Me(at).create=at.create,Me(lt),Me(ut),new Uint8Array(0),function(e){e.String="string",e.Bytes="view",e.Number="number"}(ct||(ct={})),function(e){e.String="string",e.Bytes="view",e.JSON="json"}(ft||(ft={})),(dt=ht||(ht={}))[dt.Number=0]="Number",dt[dt.BigInt=1]="BigInt",dt[dt.Uint8Array=2]="Uint8Array",dt[dt.PrefixedHexString=3]="PrefixedHexString";var pt,yt,gt=r(46);Me(L),function(e){e[e.Deposit=0]="Deposit",e[e.Withdrawal=1]="Withdrawal",e[e.Consolidation=2]="Consolidation"}(pt||(pt={})),function(e){e[e.Version=0]="Version",e[e.Balance=1]="Balance",e[e.Nonce=2]="Nonce",e[e.CodeHash=3]="CodeHash",e[e.CodeSize=4]="CodeSize"}(yt||(yt={})),We(yt.Version),We(yt.Balance),We(yt.Nonce),We(yt.CodeHash),We(yt.CodeSize),BigInt(256),BigInt(31);var bt=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,wt=Math.ceil,mt=Math.floor,vt="[BigNumber Error] ",_t=vt+"Number primitive has more than 15 significant digits: ",Et=1e14,St=14,At=9007199254740991,It=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Rt=1e7,Ot=1e9;function xt(e){var t=0|e;return e>0||e===t?t:t-1}function Tt(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=St-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function kt(e,t){var r,n,i=e.c,o=t.c,s=e.s,a=t.s,l=e.e,u=t.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=l==u,!i||!o)return n?0:!i^r?1:-1;if(!n)return l>u^r?1:-1;for(a=(l=i.length)<(u=o.length)?l:u,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return l==u?0:l>u^r?1:-1}function Lt(e,t,r,n){if(e<t||e>r||e!==mt(e))throw Error(vt+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Pt(e){var t=e.c.length-1;return xt(e.e/St)==t&&e.c[t]%2!=0}function Nt(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Bt(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}!function e(t){var r,n,i,o,s,a,l,u,c,f,h=R.prototype={constructor:R,toString:null,valueOf:null},d=new R(1),p=20,y=4,g=-7,b=21,w=-1e7,m=1e7,v=!1,_=1,E=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},A="0123456789abcdefghijklmnopqrstuvwxyz",I=!0;function R(e,t){var r,o,s,a,l,u,c,f,h=this;if(!(h instanceof R))return new R(e,t);if(null==t){if(e&&!0===e._isBigNumber)return h.s=e.s,void(!e.c||e.e>m?h.c=h.e=null:e.e<w?h.c=[h.e=0]:(h.e=e.e,h.c=e.c.slice()));if((u="number"==typeof e)&&0*e==0){if(h.s=1/e<0?(e=-e,-1):1,e===~~e){for(a=0,l=e;l>=10;l/=10,a++);return void(a>m?h.c=h.e=null:(h.e=a,h.c=[e]))}f=String(e)}else{if(!bt.test(f=String(e)))return i(h,f,u);h.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(a=f.indexOf("."))>-1&&(f=f.replace(".","")),(l=f.search(/e/i))>0?(a<0&&(a=l),a+=+f.slice(l+1),f=f.substring(0,l)):a<0&&(a=f.length)}else{if(Lt(t,2,A.length,"Base"),10==t&&I)return k(h=new R(e),p+h.e+1,y);if(f=String(e),u="number"==typeof e){if(0*e!=0)return i(h,f,u,t);if(h.s=1/e<0?(f=f.slice(1),-1):1,R.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(_t+e)}else h.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(r=A.slice(0,t),a=l=0,c=f.length;l<c;l++)if(r.indexOf(o=f.charAt(l))<0){if("."==o){if(l>a){a=c;continue}}else if(!s&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){s=!0,l=-1,a=0;continue}return i(h,String(e),u,t)}u=!1,(a=(f=n(f,t,10,h.s)).indexOf("."))>-1?f=f.replace(".",""):a=f.length}for(l=0;48===f.charCodeAt(l);l++);for(c=f.length;48===f.charCodeAt(--c););if(f=f.slice(l,++c)){if(c-=l,u&&R.DEBUG&&c>15&&(e>At||e!==mt(e)))throw Error(_t+h.s*e);if((a=a-l-1)>m)h.c=h.e=null;else if(a<w)h.c=[h.e=0];else{if(h.e=a,h.c=[],l=(a+1)%St,a<0&&(l+=St),l<c){for(l&&h.c.push(+f.slice(0,l)),c-=St;l<c;)h.c.push(+f.slice(l,l+=St));l=St-(f=f.slice(l)).length}else l-=c;for(;l--;f+="0");h.c.push(+f)}}else h.c=[h.e=0]}function O(e,t,r,n){var i,o,s,a,l;if(null==r?r=y:Lt(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)l=Tt(e.c),l=1==n||2==n&&(s<=g||s>=b)?Nt(l,s):Bt(l,s,"0");else if(o=(e=k(new R(e),t,r)).e,a=(l=Tt(e.c)).length,1==n||2==n&&(t<=o||o<=g)){for(;a<t;l+="0",a++);l=Nt(l,o)}else if(t-=s,l=Bt(l,o,"0"),o+1>a){if(--t>0)for(l+=".";t--;l+="0");}else if((t+=o-a)>0)for(o+1==a&&(l+=".");t--;l+="0");return e.s<0&&i?"-"+l:l}function x(e,t){for(var r,n,i=1,o=new R(e[0]);i<e.length;i++)(!(n=new R(e[i])).s||(r=kt(o,n))===t||0===r&&o.s===t)&&(o=n);return o}function T(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*St-1)>m?e.c=e.e=null:r<w?e.c=[e.e=0]:(e.e=r,e.c=t),e}function k(e,t,r,n){var i,o,s,a,l,u,c,f=e.c,h=It;if(f){e:{for(i=1,a=f[0];a>=10;a/=10,i++);if((o=t-i)<0)o+=St,s=t,l=f[u=0],c=mt(l/h[i-s-1]%10);else if((u=wt((o+1)/St))>=f.length){if(!n)break e;for(;f.length<=u;f.push(0));l=c=0,i=1,s=(o%=St)-St+1}else{for(l=a=f[u],i=1;a>=10;a/=10,i++);c=(s=(o%=St)-St+i)<0?0:mt(l/h[i-s-1]%10)}if(n=n||t<0||null!=f[u+1]||(s<0?l:l%h[i-s-1]),n=r<4?(c||n)&&(0==r||r==(e.s<0?3:2)):c>5||5==c&&(4==r||n||6==r&&(o>0?s>0?l/h[i-s]:0:f[u-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,n?(t-=e.e+1,f[0]=h[(St-t%St)%St],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=u,a=1,u--):(f.length=u+1,a=h[St-o],f[u]=s>0?mt(l/h[i-s]%h[s])*a:0),n)for(;;){if(0==u){for(o=1,s=f[0];s>=10;s/=10,o++);for(s=f[0]+=a,a=1;s>=10;s/=10,a++);o!=a&&(e.e++,f[0]==Et&&(f[0]=1));break}if(f[u]+=a,f[u]!=Et)break;f[u--]=0,a=1}for(o=f.length;0===f[--o];f.pop());}e.e>m?e.c=e.e=null:e.e<w&&(e.c=[e.e=0])}return e}function L(e){var t,r=e.e;return null===r?e.toString():(t=Tt(e.c),t=r<=g||r>=b?Nt(t,r):Bt(t,r,"0"),e.s<0?"-"+t:t)}return R.clone=e,R.ROUND_UP=0,R.ROUND_DOWN=1,R.ROUND_CEIL=2,R.ROUND_FLOOR=3,R.ROUND_HALF_UP=4,R.ROUND_HALF_DOWN=5,R.ROUND_HALF_EVEN=6,R.ROUND_HALF_CEIL=7,R.ROUND_HALF_FLOOR=8,R.EUCLID=9,R.config=R.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(vt+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(Lt(r=e[t],0,Ot,t),p=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(Lt(r=e[t],0,8,t),y=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(Lt(r[0],-Ot,0,t),Lt(r[1],0,Ot,t),g=r[0],b=r[1]):(Lt(r,-Ot,Ot,t),g=-(b=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)Lt(r[0],-Ot,-1,t),Lt(r[1],1,Ot,t),w=r[0],m=r[1];else{if(Lt(r,-Ot,Ot,t),!r)throw Error(vt+t+" cannot be zero: "+r);w=-(m=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(vt+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw v=!r,Error(vt+"crypto unavailable");v=r}else v=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(Lt(r=e[t],0,9,t),_=r),e.hasOwnProperty(t="POW_PRECISION")&&(Lt(r=e[t],0,Ot,t),E=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(vt+t+" not an object: "+r);S=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(vt+t+" invalid: "+r);I="0123456789"==r.slice(0,10),A=r}}return{DECIMAL_PLACES:p,ROUNDING_MODE:y,EXPONENTIAL_AT:[g,b],RANGE:[w,m],CRYPTO:v,MODULO_MODE:_,POW_PRECISION:E,FORMAT:S,ALPHABET:A}},R.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!R.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-Ot&&i<=Ot&&i===mt(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%St)<1&&(t+=St),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=Et||r!==mt(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(vt+"Invalid BigNumber: "+e)},R.maximum=R.max=function(){return x(arguments,-1)},R.minimum=R.min=function(){return x(arguments,1)},R.random=(o=9007199254740992,s=Math.random()*o&2097151?function(){return mt(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,a=0,l=[],u=new R(d);if(null==e?e=p:Lt(e,0,Ot),i=wt(e/St),v)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));a<i;)(o=131072*t[a]+(t[a+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[a]=r[0],t[a+1]=r[1]):(l.push(o%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw v=!1,Error(vt+"crypto unavailable");for(t=crypto.randomBytes(i*=7);a<i;)(o=281474976710656*(31&t[a])+1099511627776*t[a+1]+4294967296*t[a+2]+16777216*t[a+3]+(t[a+4]<<16)+(t[a+5]<<8)+t[a+6])>=9e15?crypto.randomBytes(7).copy(t,a):(l.push(o%1e14),a+=7);a=i/7}if(!v)for(;a<i;)(o=s())<9e15&&(l[a++]=o%1e14);for(i=l[--a],e%=St,i&&e&&(o=It[St-e],l[a]=mt(i/o)*o);0===l[a];l.pop(),a--);if(a<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=St);for(a=1,o=l[0];o>=10;o/=10,a++);a<St&&(n-=St-a)}return u.e=n,u.c=l,u}),R.sum=function(){for(var e=1,t=arguments,r=new R(t[0]);e<t.length;)r=r.plus(t[e++]);return r},n=function(){var e="0123456789";function t(e,t,r,n){for(var i,o,s=[0],a=0,l=e.length;a<l;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var l,u,c,f,h,d,g,b,w=n.indexOf("."),m=p,v=y;for(w>=0&&(f=E,E=0,n=n.replace(".",""),d=(b=new R(i)).pow(n.length-w),E=f,b.c=t(Bt(Tt(d.c),d.e,"0"),10,o,e),b.e=b.c.length),c=f=(g=t(n,i,o,a?(l=A,e):(l=e,A))).length;0==g[--f];g.pop());if(!g[0])return l.charAt(0);if(w<0?--c:(d.c=g,d.e=c,d.s=s,g=(d=r(d,b,m,v,o)).c,h=d.r,c=d.e),w=g[u=c+m+1],f=o/2,h=h||u<0||null!=g[u+1],h=v<4?(null!=w||h)&&(0==v||v==(d.s<0?3:2)):w>f||w==f&&(4==v||h||6==v&&1&g[u-1]||v==(d.s<0?8:7)),u<1||!g[0])n=h?Bt(l.charAt(1),-m,l.charAt(0)):l.charAt(0);else{if(g.length=u,h)for(--o;++g[--u]>o;)g[u]=0,u||(++c,g=[1].concat(g));for(f=g.length;!g[--f];);for(w=0,n="";w<=f;n+=l.charAt(g[w++]));n=Bt(n,c,l.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,l=e.length,u=t%Rt,c=t/Rt|0;for(e=e.slice();l--;)a=((i=u*(o=e[l]%Rt)+(n=c*o+(s=e[l]/Rt|0)*u)%Rt*Rt+a)/r|0)+(n/Rt|0)+c*s,e[l]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,s,a){var l,u,c,f,h,d,p,y,g,b,w,m,v,_,E,S,A,I=n.s==i.s?1:-1,O=n.c,x=i.c;if(!(O&&O[0]&&x&&x[0]))return new R(n.s&&i.s&&(O?!x||O[0]!=x[0]:x)?O&&0==O[0]||!x?0*I:I/0:NaN);for(g=(y=new R(I)).c=[],I=o+(u=n.e-i.e)+1,a||(a=Et,u=xt(n.e/St)-xt(i.e/St),I=I/St|0),c=0;x[c]==(O[c]||0);c++);if(x[c]>(O[c]||0)&&u--,I<0)g.push(1),f=!0;else{for(_=O.length,S=x.length,c=0,I+=2,(h=mt(a/(x[0]+1)))>1&&(x=e(x,h,a),O=e(O,h,a),S=x.length,_=O.length),v=S,w=(b=O.slice(0,S)).length;w<S;b[w++]=0);A=x.slice(),A=[0].concat(A),E=x[0],x[1]>=a/2&&E++;do{if(h=0,(l=t(x,b,S,w))<0){if(m=b[0],S!=w&&(m=m*a+(b[1]||0)),(h=mt(m/E))>1)for(h>=a&&(h=a-1),p=(d=e(x,h,a)).length,w=b.length;1==t(d,b,p,w);)h--,r(d,S<p?A:x,p,a),p=d.length,l=1;else 0==h&&(l=h=1),p=(d=x.slice()).length;if(p<w&&(d=[0].concat(d)),r(b,d,w,a),w=b.length,-1==l)for(;t(x,b,S,w)<1;)h++,r(b,S<w?A:x,w,a),w=b.length}else 0===l&&(h++,b=[0]);g[c++]=h,b[0]?b[w++]=O[v]||0:(b=[O[v]],w=1)}while((v++<_||null!=b[0])&&I--);f=null!=b[0],g[0]||g.splice(0,1)}if(a==Et){for(c=1,I=g[0];I>=10;I/=10,c++);k(y,o+(y.e=c+u*St-1)+1,s,f)}else y.e=u,y.r=+f;return y}}(),a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,u=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,f=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,o=r?t:t.replace(f,"");if(c.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(a,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(l,"$1").replace(u,"0.$1")),t!=o))return new R(o,i);if(R.DEBUG)throw Error(vt+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},h.absoluteValue=h.abs=function(){var e=new R(this);return e.s<0&&(e.s=1),e},h.comparedTo=function(e,t){return kt(this,new R(e,t))},h.decimalPlaces=h.dp=function(e,t){var r,n,i,o=this;if(null!=e)return Lt(e,0,Ot),null==t?t=y:Lt(t,0,8),k(new R(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-xt(this.e/St))*St,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},h.dividedBy=h.div=function(e,t){return r(this,new R(e,t),p,y)},h.dividedToIntegerBy=h.idiv=function(e,t){return r(this,new R(e,t),0,1)},h.exponentiatedBy=h.pow=function(e,t){var r,n,i,o,s,a,l,u,c=this;if((e=new R(e)).c&&!e.isInteger())throw Error(vt+"Exponent not an integer: "+L(e));if(null!=t&&(t=new R(t)),s=e.e>14,!c.c||!c.c[0]||1==c.c[0]&&!c.e&&1==c.c.length||!e.c||!e.c[0])return u=new R(Math.pow(+L(c),s?e.s*(2-Pt(e)):+L(e))),t?u.mod(t):u;if(a=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new R(NaN);(n=!a&&c.isInteger()&&t.isInteger())&&(c=c.mod(t))}else{if(e.e>9&&(c.e>0||c.e<-1||(0==c.e?c.c[0]>1||s&&c.c[1]>=24e7:c.c[0]<8e13||s&&c.c[0]<=9999975e7)))return o=c.s<0&&Pt(e)?-0:0,c.e>-1&&(o=1/o),new R(a?1/o:o);E&&(o=wt(E/St+2))}for(s?(r=new R(.5),a&&(e.s=1),l=Pt(e)):l=(i=Math.abs(+L(e)))%2,u=new R(d);;){if(l){if(!(u=u.times(c)).c)break;o?u.c.length>o&&(u.c.length=o):n&&(u=u.mod(t))}if(i){if(0===(i=mt(i/2)))break;l=i%2}else if(k(e=e.times(r),e.e+1,1),e.e>14)l=Pt(e);else{if(0==(i=+L(e)))break;l=i%2}c=c.times(c),o?c.c&&c.c.length>o&&(c.c.length=o):n&&(c=c.mod(t))}return n?u:(a&&(u=d.div(u)),t?u.mod(t):o?k(u,E,y,void 0):u)},h.integerValue=function(e){var t=new R(this);return null==e?e=y:Lt(e,0,8),k(t,t.e+1,e)},h.isEqualTo=h.eq=function(e,t){return 0===kt(this,new R(e,t))},h.isFinite=function(){return!!this.c},h.isGreaterThan=h.gt=function(e,t){return kt(this,new R(e,t))>0},h.isGreaterThanOrEqualTo=h.gte=function(e,t){return 1===(t=kt(this,new R(e,t)))||0===t},h.isInteger=function(){return!!this.c&&xt(this.e/St)>this.c.length-2},h.isLessThan=h.lt=function(e,t){return kt(this,new R(e,t))<0},h.isLessThanOrEqualTo=h.lte=function(e,t){return-1===(t=kt(this,new R(e,t)))||0===t},h.isNaN=function(){return!this.s},h.isNegative=function(){return this.s<0},h.isPositive=function(){return this.s>0},h.isZero=function(){return!!this.c&&0==this.c[0]},h.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new R(e,t)).s,!a||!t)return new R(NaN);if(a!=t)return e.s=-t,s.plus(e);var l=s.e/St,u=e.e/St,c=s.c,f=e.c;if(!l||!u){if(!c||!f)return c?(e.s=-t,e):new R(f?s:NaN);if(!c[0]||!f[0])return f[0]?(e.s=-t,e):new R(c[0]?s:3==y?-0:0)}if(l=xt(l),u=xt(u),c=c.slice(),a=l-u){for((o=a<0)?(a=-a,i=c):(u=l,i=f),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=c.length)<(t=f.length))?a:t,a=t=0;t<n;t++)if(c[t]!=f[t]){o=c[t]<f[t];break}if(o&&(i=c,c=f,f=i,e.s=-e.s),(t=(n=f.length)-(r=c.length))>0)for(;t--;c[r++]=0);for(t=Et-1;n>a;){if(c[--n]<f[n]){for(r=n;r&&!c[--r];c[r]=t);--c[r],c[n]+=Et}c[n]-=f[n]}for(;0==c[0];c.splice(0,1),--u);return c[0]?T(e,c,u):(e.s=3==y?-1:1,e.c=[e.e=0],e)},h.modulo=h.mod=function(e,t){var n,i,o=this;return e=new R(e,t),!o.c||!e.s||e.c&&!e.c[0]?new R(NaN):!e.c||o.c&&!o.c[0]?new R(o):(9==_?(i=e.s,e.s=1,n=r(o,e,0,3),e.s=i,n.s*=i):n=r(o,e,0,_),(e=o.minus(n.times(e))).c[0]||1!=_||(e.s=o.s),e)},h.multipliedBy=h.times=function(e,t){var r,n,i,o,s,a,l,u,c,f,h,d,p,y,g,b=this,w=b.c,m=(e=new R(e,t)).c;if(!(w&&m&&w[0]&&m[0]))return!b.s||!e.s||w&&!w[0]&&!m||m&&!m[0]&&!w?e.c=e.e=e.s=null:(e.s*=b.s,w&&m?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=xt(b.e/St)+xt(e.e/St),e.s*=b.s,(l=w.length)<(f=m.length)&&(p=w,w=m,m=p,i=l,l=f,f=i),i=l+f,p=[];i--;p.push(0));for(y=Et,g=Rt,i=f;--i>=0;){for(r=0,h=m[i]%g,d=m[i]/g|0,o=i+(s=l);o>i;)r=((u=h*(u=w[--s]%g)+(a=d*u+(c=w[s]/g|0)*h)%g*g+p[o]+r)/y|0)+(a/g|0)+d*c,p[o--]=u%y;p[o]=r}return r?++n:p.splice(0,1),T(e,p,n)},h.negated=function(){var e=new R(this);return e.s=-e.s||null,e},h.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new R(e,t)).s,!i||!t)return new R(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/St,s=e.e/St,a=n.c,l=e.c;if(!o||!s){if(!a||!l)return new R(i/0);if(!a[0]||!l[0])return l[0]?e:new R(a[0]?n:0*i)}if(o=xt(o),s=xt(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=l):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=l.length)<0&&(r=l,l=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+l[t]+i)/Et|0,a[t]=Et===a[t]?0:a[t]%Et;return i&&(a=[i].concat(a),++s),T(e,a,s)},h.precision=h.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return Lt(e,1,Ot),null==t?t=y:Lt(t,0,8),k(new R(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*St+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},h.shiftedBy=function(e){return Lt(e,-9007199254740991,At),this.times("1e"+e)},h.squareRoot=h.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,l=s.s,u=s.e,c=p+4,f=new R("0.5");if(1!==l||!a||!a[0])return new R(!l||l<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(l=Math.sqrt(+L(s)))||l==1/0?(((t=Tt(a)).length+u)%2==0&&(t+="0"),l=Math.sqrt(+t),u=xt((u+1)/2)-(u<0||u%2),n=new R(t=l==1/0?"5e"+u:(t=l.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new R(l+""),n.c[0])for((l=(u=n.e)+c)<3&&(l=0);;)if(o=n,n=f.times(o.plus(r(s,o,c,1))),Tt(o.c).slice(0,l)===(t=Tt(n.c)).slice(0,l)){if(n.e<u&&--l,"9999"!=(t=t.slice(l-3,l+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(k(n,n.e+p+2,1),e=!n.times(n).eq(s));break}if(!i&&(k(o,o.e+p+2,0),o.times(o).eq(s))){n=o;break}c+=4,l+=4,i=1}return k(n,n.e+p+1,y,e)},h.toExponential=function(e,t){return null!=e&&(Lt(e,0,Ot),e++),O(this,e,t,1)},h.toFixed=function(e,t){return null!=e&&(Lt(e,0,Ot),e=e+this.e+1),O(this,e,t)},h.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=S;else if("object"!=typeof r)throw Error(vt+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,s=n.split("."),a=+r.groupSize,l=+r.secondaryGroupSize,u=r.groupSeparator||"",c=s[0],f=s[1],h=i.s<0,d=h?c.slice(1):c,p=d.length;if(l&&(o=a,a=l,l=o,p-=o),a>0&&p>0){for(o=p%a||a,c=d.substr(0,o);o<p;o+=a)c+=u+d.substr(o,a);l>0&&(c+=u+d.slice(o)),h&&(c="-"+c)}n=f?c+(r.decimalSeparator||"")+((l=+r.fractionGroupSize)?f.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):c}return(r.prefix||"")+n+(r.suffix||"")},h.toFraction=function(e){var t,n,i,o,s,a,l,u,c,f,h,p,g=this,b=g.c;if(null!=e&&(!(l=new R(e)).isInteger()&&(l.c||1!==l.s)||l.lt(d)))throw Error(vt+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+L(l));if(!b)return new R(g);for(t=new R(d),c=n=new R(d),i=u=new R(d),p=Tt(b),s=t.e=p.length-g.e-1,t.c[0]=It[(a=s%St)<0?St+a:a],e=!e||l.comparedTo(t)>0?s>0?t:c:l,a=m,m=1/0,l=new R(p),u.c[0]=0;f=r(l,t,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,c=u.plus(f.times(o=c)),u=o,t=l.minus(f.times(o=t)),l=o;return o=r(e.minus(n),i,0,1),u=u.plus(o.times(c)),n=n.plus(o.times(i)),u.s=c.s=g.s,h=r(c,i,s*=2,y).minus(g).abs().comparedTo(r(u,n,s,y).minus(g).abs())<1?[c,i]:[u,n],m=a,h},h.toNumber=function(){return+L(this)},h.toPrecision=function(e,t){return null!=e&&Lt(e,1,Ot),O(this,e,t,2)},h.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=g||o>=b?Nt(Tt(r.c),o):Bt(Tt(r.c),o,"0"):10===e&&I?t=Bt(Tt((r=k(new R(r),p+o+1,y)).c),r.e,"0"):(Lt(e,2,A.length,"Base"),t=n(Bt(Tt(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},h.valueOf=h.toJSON=function(){return L(this)},h._isBigNumber=!0,h[Symbol.toStringTag]="BigNumber",h[Symbol.for("nodejs.util.inspect.custom")]=h.valueOf,null!=t&&R.set(t),R}(),r(1048).Buffer;const Mt=()=>Math.random().toString(36).slice(2);function jt({width:e,height:t}){const r=void 0!==window.screenLeft?window.screenLeft:window.screenX,n=void 0!==window.screenTop?window.screenTop:window.screenY,i=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:window.screen.width,o=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:window.screen.height,s=Math.abs((i-e)/2/1+r);return`titlebar=0,toolbar=0,status=0,location=0,menubar=0,height=${t/1},width=${e/1},top=${Math.abs((o-t)/2/1+n)},left=${s}`}const Ut="air_auth_login_response",Ct="air_auth_user_info_response",Dt="air_auth_partner_user_info_response",Wt="air_auth_initialization_response",Ft="air_auth_iframe_visibility_request",$t="air_auth_setup_wallet_request",qt="air_auth_setup_wallet_response",Ht="air_auth_logout_response",zt={height:660,width:375},Vt={height:700,width:1200},Gt={height:700,width:450},Yt="user_logged_in",Kt="eip155",Jt={POPUP:"popup",MODAL:"modal",AUTO_APPROVE:"auto-approve",DEFAULT:"default"};r(9907).env.VITE_APP_INFURA_PROJECT_KEY;const Zt=(new Set(["btc","eth","ltc","bch","bnb","eos","xrp","xlm","link","dot","yfi","usd","aed","ars","aud","bdt","bhd","bmd","brl","cad","chf","clp","cny","czk","dkk","eur","gbp","hkd","huf","idr","ils","inr","jpy","krw","kwd","lkr","mmk","mxn","myr","ngn","nok","nzd","php","pkr","pln","rub","sar","sek","sgd","thb","try","twd","uah","vef","vnd","zar","xdr","xag","xau","bits","sats"]),{MAINNET:"mainnet",TESTNET:"testnet",CYAN:"cyan",AQUA:"aqua",CELESTE:"celeste"}),Xt=s(s({},{SAPPHIRE_DEVNET:"sapphire_devnet",SAPPHIRE_MAINNET:"sapphire_mainnet"}),Zt);var Qt=r(8521);function er(e,t,r){try{Reflect.apply(e,t,r)}catch(e){setTimeout((()=>{throw e}))}}class tr extends gt.EventEmitter{emit(e,...t){let r="error"===e;const n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const i=n[e];if(void 0===i)return!1;if("function"==typeof i)er(i,this,t);else{const e=i.length,r=function(e){const t=e.length,r=new Array(t);for(let n=0;n<t;n+=1)r[n]=e[n];return r}(i);for(let n=0;n<e;n+=1)er(r[n],this,t)}return!0}}const rr=(e,t,r=!0)=>(n,i)=>{n||i.error?t(n||i.error):!r||Array.isArray(i)?e(i):e(i.result)};function nr(){}const ir="ACK";class or extends Qt.Duplex{constructor({name:e,target:t,targetWindow:r=window,targetOrigin:n="*"}){if(super({objectMode:!0}),i(this,"_init",void 0),i(this,"_haveSyn",void 0),i(this,"_name",void 0),i(this,"_target",void 0),i(this,"_targetWindow",void 0),i(this,"_targetOrigin",void 0),i(this,"_onMessage",void 0),i(this,"_synIntervalId",void 0),!e||!t)throw new Error("Invalid input.");this._init=!1,this._haveSyn=!1,this._name=e,this._target=t,this._targetWindow=r,this._targetOrigin=n,this._onMessage=this.onMessage.bind(this),this._synIntervalId=null,window.addEventListener("message",this._onMessage,!1),this._handShake()}_break(){this.cork(),this._write("BRK",null,nr),this._haveSyn=!1,this._init=!1}_handShake(){this._write("SYN",null,nr),this.cork()}_onData(e){if(this._init)if("BRK"===e)this._break();else try{this.push(e)}catch(e){this.emit("error",e)}else"SYN"===e?(this._haveSyn=!0,this._write(ir,null,nr)):e===ir&&(this._init=!0,this._haveSyn||this._write(ir,null,nr),this.uncork())}_postMessage(e){const t=this._targetOrigin;this._targetWindow.postMessage({target:this._target,data:e},t)}onMessage(e){const t=e.data;"*"!==this._targetOrigin&&e.origin!==this._targetOrigin||e.source!==this._targetWindow||"object"!=typeof t||t.target!==this._name||!t.data||this._onData(t.data)}_read(){}_write(e,t,r){this._postMessage(e),r()}_destroy(){window.removeEventListener("message",this._onMessage,!1)}}const sr="air_service_initialized",ar="air_service_initialized_error",lr="air_login_claim_state",ur="air_close_modal",cr="air_deploy_smart_account_response";var fr=r(5172),hr=r.n(fr);const dr=-32600,pr=-32603,yr={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};function gr(e){return Number.isInteger(e)}function br(e){return"string"==typeof e&&e.length>0}function wr(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}function mr(e){const t=e;return!(!t||!gr(t.code)||!br(t.message)||t.stack&&!br(t.stack))}function vr(e,t="Unspecified error message. This is a bug, please report it."){if(gr(e)){const t=e.toString();if(Object.hasOwn(yr,t))return yr[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return"Unspecified server error."}return t}const _r={code:pr,message:vr(pr)};function Er(e){try{JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"===e||"constructor"===e)throw new Error("Not valid json");if("function"==typeof t||"symbol"==typeof t)throw new Error("Not valid json");return t})),((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))}catch(e){return!1}return!0}function Sr(e){return Object.getOwnPropertyNames(e).reduce(((t,r)=>{const n=e[r];return Er(n)&&(t[r]=n),t}),{})}function Ar(e){return Array.isArray(e)?e.map((e=>Er(e)?e:wr(e)?Sr(e):null)):wr(e)?Sr(e):Er(e)?e:null}function Ir(e,{fallbackError:t=_r,shouldIncludeStack:r=!0}={}){if(!mr(t))throw new Error("Must provide fallback error with integer number code and string message.");const n=function(e,t){if(e&&"object"==typeof e&&"serialize"in e&&"function"==typeof e.serialize)return e.serialize();if(mr(e))return e;const r=Ar(e);return s(s({},t),{},{data:{cause:r}})}(e,t);return r||delete n.stack,n}function Rr(e,t){if("[Circular]"!==t)return t}class Or extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a non-empty string.');!function(e){return wr(e)&&Object.hasOwn(e,"cause")&&wr(e.cause)}(r)?(super(t),i(this,"cause",void 0),i(this,"code",void 0),i(this,"data",void 0)):(super(t,{cause:r.cause}),i(this,"cause",void 0),i(this,"code",void 0),i(this,"data",void 0),Object.hasOwn(this,"cause")||Object.assign(this,{cause:r.cause})),void 0!==r&&(this.data=r),this.code=e,this.cause=null==r?void 0:r.cause}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(this.data)&&(e.data.cause=Ar(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return hr()(this.serialize(),{replacer:Rr,space:2})}}class xr extends Or{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}var Tr=r(5880),kr=r.n(Tr),Lr=r(1822),Pr=r.n(Lr),Nr=r(3358),Br=r.n(Nr),Mr=r(2720),jr=r.n(Mr);class Ur extends Qt.Duplex{constructor({parent:e,name:t}){super({objectMode:!0}),i(this,"_parent",void 0),i(this,"_name",void 0),this._parent=e,this._name=t}_read(){}_write(e,t,r){this._parent.push({name:this._name,data:e}),r()}}const Cr=Symbol("IGNORE_SUBSTREAM");class Dr extends Qt.Duplex{constructor(e={}){super(s(s({},e),{},{objectMode:!0})),i(this,"_substreams",void 0),i(this,"getStream",void 0),this._substreams={}}createStream(e){if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error(`ObjectMultiplex - Substream for name "${e}" already exists`);const t=new Ur({parent:this,name:e});return this._substreams[e]=t,function(e){const r=Br()((e=>t.destroy(e||void 0)));Pr()(e,{readable:!1},r),Pr()(e,{writable:!1},r)}(this),t}ignoreStream(e){if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error(`ObjectMultiplex - Substream for name "${e}" already exists`);this._substreams[e]=Cr}_read(){}_write(e,t,r){const{name:n,data:i}=e;if(!n)return window.console.warn(`ObjectMultiplex - malformed chunk without name "${e}"`),r();const o=this._substreams[n];return o?(o!==Cr&&o.push(i),r()):(window.console.warn(`ObjectMultiplex - orphaned data for stream "${n}"`),r())}}class Wr extends Error{constructor({code:e,message:t,data:r}){if(!Number.isInteger(e))throw new Error("code must be an integer");if(!t||"string"!=typeof t)throw new Error("message must be string");super(t),i(this,"code",void 0),i(this,"data",void 0),this.code=e,void 0!==r&&(this.data=r)}toString(){return hr()({code:this.code,message:this.message,data:this.data,stack:this.stack})}}class Fr extends tr{constructor(){super(),i(this,"_middleware",void 0),this._middleware=[]}static async _runAllMiddleware(e,t,r){const n=[];let i=null,o=!1;for(const s of r)if([i,o]=await Fr._runMiddleware(e,t,s,n),o)break;return[i,o,n.reverse()]}static _runMiddleware(e,t,r,n){return new Promise((i=>{const o=e=>{const r=e||t.error;r&&("object"==typeof r&&!1===Object.keys(r).includes("stack")&&(r.stack="Stack trace is not available."),t.error=Ir(r,{shouldIncludeStack:!0,fallbackError:{message:(null==r?void 0:r.message)||(null==r?void 0:r.toString()),code:(null==r?void 0:r.code)||-32603,stack:(null==r?void 0:r.stack)||"Stack trace is not available.",data:(null==r?void 0:r.data)||(null==r?void 0:r.message)||(null==r?void 0:r.toString())}})),i([r,!0])},s=e=>{t.error?o(t.error):(e&&("function"!=typeof e&&o(new Wr({code:-32603,message:"JRPCEngine: 'next' return handlers must be functions"})),n.push(e)),i([null,!1]))};try{r(e,t,s,o)}catch(e){o(e)}}))}static async _runReturnHandlers(e){for(const t of e)await new Promise(((e,r)=>{t((t=>t?r(t):e()))}))}static _checkForCompletion(e,t,r){if(!("result"in t)&&!("error"in t))throw new Wr({code:-32603,message:"Response has no error or result for request"});if(!r)throw new Wr({code:-32603,message:"Nothing ended request"})}push(e){this._middleware.push(e)}handle(e,t){if(t&&"function"!=typeof t)throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?t?this._handleBatch(e,t):this._handleBatch(e):t?this._handle(e,t):this._promiseHandle(e)}asMiddleware(){return async(e,t,r,n)=>{try{const[i,o,s]=await Fr._runAllMiddleware(e,t,this._middleware);return o?(await Fr._runReturnHandlers(s),n(i)):r((async e=>{try{await Fr._runReturnHandlers(s)}catch(t){return e(t)}return e()}))}catch(e){return n(e)}}}async _handleBatch(e,t){try{const r=await Promise.all(e.map(this._promiseHandle.bind(this)));return t?t(null,r):r}catch(e){if(t)return t(e);throw e}}_promiseHandle(e){return new Promise(((t,r)=>{this._handle(e,((e,n)=>{e&&void 0===n?r(e):t(n)})).catch(r)}))}async _handle(e,t){if(!e||Array.isArray(e)||"object"!=typeof e){const e=new Wr({code:-32603,message:"request must be plain object"});return t(e,{id:void 0,jsonrpc:"2.0",error:e})}if("string"!=typeof e.method){const r=new Wr({code:-32603,message:"method must be string"});return t(r,{id:e.id,jsonrpc:"2.0",error:r})}const r=s({},e),n={id:r.id,jsonrpc:r.jsonrpc};let i=null;try{await this._processRequest(r,n)}catch(e){i=e}var o,a,l,u,c,f,h;return i&&(delete n.result,n.error||("object"==typeof i&&!1===Object.keys(i).includes("stack")&&(i.stack="Stack trace is not available."),n.error=Ir(i,{shouldIncludeStack:!0,fallbackError:{message:(null===(o=i)||void 0===o?void 0:o.message)||(null===(a=i)||void 0===a?void 0:a.toString()),code:(null===(l=i)||void 0===l?void 0:l.code)||-32603,stack:(null===(u=i)||void 0===u?void 0:u.stack)||"Stack trace is not available.",data:(null===(c=i)||void 0===c?void 0:c.data)||(null===(f=i)||void 0===f?void 0:f.message)||(null===(h=i)||void 0===h?void 0:h.toString())}}))),t(i,n)}async _processRequest(e,t){const[r,n,i]=await Fr._runAllMiddleware(e,t,this._middleware);if(Fr._checkForCompletion(e,t,n),await Fr._runReturnHandlers(i),r)throw r}}function $r(e,t){const[r,n]=function(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[null!=t?t:void 0,r]}}return[]}(t);return new Or(e,null!=r?r:vr(e),n)}const qr=e=>$r(dr,e);function Hr(e){return null!==e&&"object"==typeof e&&"function"==typeof e.pipe}const zr=()=>"Web3Auth: Lost connection to Web3Auth.",Vr=()=>"Web3Auth: Disconnected from iframe. Page reload required.",Gr=()=>"Must provide a Node.js-style duplex stream.",Yr=()=>"Expected a single, non-array, object argument.",Kr=()=>"'args.method' must be a non-empty string.",Jr=()=>"'args.params' must be an object or array if provided.",Zr=e=>`Web3Auth: Connected to chain with ID "${e}".`,Xr={PRODUCTION:"production",STAGING:"staging",DEVELOPMENT:"development",TESTING:"testing"},Qr={BOTTOM_LEFT:"bottom-left",TOP_LEFT:"top-left",BOTTOM_RIGHT:"bottom-right",TOP_RIGHT:"top-right"},en={METAMASK:"metamask",WALLET_CONNECT:"walletconnect",WAGMI:"wagmi"},tn=kr().getLogger("ws-embed"),rn={[Xr.TESTING]:{authUrl:"http://localhost:8100",walletUrl:"https://lrc-mocaverse.web3auth.io",logLevel:"debug"},[Xr.DEVELOPMENT]:{authUrl:"http://localhost:8100",walletUrl:"https://localhost:4050",logLevel:"debug"},[Xr.STAGING]:{authUrl:"https://login.staging.realmnetwork.io",walletUrl:"https://account.staging.realmnetwork.io",logLevel:"info"},[Xr.PRODUCTION]:{authUrl:"https://login.realmnetwork.io",walletUrl:"https://account.realmnetwork.io",logLevel:"error"}},nn=["eth_subscription"],on=class extends tr{constructor(e,{maxEventListeners:t=100,jsonRpcStreamName:r="provider"}){if(super(),i(this,"rpcEngine",void 0),i(this,"jsonRpcConnectionEvents",void 0),i(this,"isWeb3Auth",void 0),i(this,"state",void 0),!function(e){return Hr(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState}(n=e)||!function(e){return Hr(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState}(n))throw new Error(Gr());var n;this.isWeb3Auth=!0,this.setMaxListeners(t),this.handleConnect=this.handleConnect.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleStreamDisconnect=this.handleStreamDisconnect.bind(this),this.rpcRequest=this.rpcRequest.bind(this),this.initializeState=this.initializeState.bind(this),this.request=this.request.bind(this),this.sendAsync=this.sendAsync.bind(this),this.send=this.send.bind(this);const o=new Dr;jr()(e,o,e,this.handleStreamDisconnect.bind(this,"Web3Auth")),o.ignoreStream("phishing");const a=function(){const e={},t=new tr,r=new Qt.Duplex({objectMode:!0,read:function(){return!1},write:function(r,n,i){let o;try{r.id?function(t){const r=e[t.id];if(!r)throw new Error(`StreamMiddleware - Unknown response id "${t.id}"`);delete e[t.id],Object.assign(r.res,t),setTimeout(r.end)}(r):function(e){t.emit("notification",e)}(r)}catch(e){o=e}i(o)}});return{events:t,middleware:(t,n,i,o)=>{r.push(t),e[t.id]={req:t,res:n,next:i,end:o}},stream:r}}();jr()(a.stream,o.createStream(r),a.stream,this.handleStreamDisconnect.bind(this,"Web3Auth RpcProvider"));const l=new Fr;var u;l.push(((e,t,r,n)=>{const i=e.id,o=Math.random().toString(36).slice(2);e.id=o,t.id=o,r((r=>{e.id=i,t.id=i,r()}))})),l.push(((e,t,r)=>{"string"==typeof e.method&&e.method||(t.error=qr({message:"The request 'method' must be a non-empty string.",data:s(s({},e||{}),{},{cause:"The request 'method' must be a non-empty string."})})),r((e=>{const{error:r}=t;return r?(tn.error(`Ws-Embed - RPC Error: ${r.message}`,r),e()):e()}))})),l.push((u={origin:location.origin},function(e,t,r){r((r=>{t.error&&kr().warn("Error in RPC response:\n",t),e.isTorusInternal||(kr().info(`RPC (${u.origin}):`,e,"->",t),r())}))})),l.push(a.middleware),this.rpcEngine=l,this.jsonRpcConnectionEvents=a.events}async request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw qr({message:Yr(),data:s(s({},e||{}),{},{cause:Yr()})});const{method:t,params:r}=e;if("string"!=typeof t||0===t.length)throw qr({message:Kr(),data:s(s({},e||{}),{},{cause:Yr()})});if(void 0!==r&&!Array.isArray(r)&&("object"!=typeof r||null===r))throw qr({message:Jr(),data:s(s({},e||{}),{},{cause:Yr()})});return new Promise(((e,n)=>{this.rpcRequest({method:t,params:r},rr(e,n))}))}send(e,t){this.rpcRequest(e,t)}sendAsync(e){return new Promise(((t,r)=>{this.rpcRequest(e,rr(t,r))}))}handleStreamDisconnect(e,t){!function(e,t,r){let n=`Web3Auth: Lost connection to "${e}".`;null!=t&&t.stack&&(n+=`\n${t.stack}`),tn.warn(n),r&&r.listenerCount("error")>0&&r.emit("error",n)}(e,t,this),this.handleDisconnect(!1,t?t.message:void 0)}},sn=class extends tr{constructor({url:e,target:t,features:r,timeout:n=3e4}){super(),i(this,"url",void 0),i(this,"target",void 0),i(this,"features",void 0),i(this,"window",void 0),i(this,"windowTimer",void 0),i(this,"iClosedWindow",void 0),i(this,"timeout",void 0),this.url=e,this.target=t||"_blank",this.features=r||jt(Vt),this.window=void 0,this.windowTimer=void 0,this.iClosedWindow=!1,this.timeout=n,this._setupTimer()}_setupTimer(){this.windowTimer=Number(setInterval((()=>{this.window&&this.window.closed&&(clearInterval(this.windowTimer),setTimeout((()=>{this.iClosedWindow||this.emit("close"),this.iClosedWindow=!1,this.window=void 0}),this.timeout)),void 0===this.window&&clearInterval(this.windowTimer)}),500))}open(){var e;this.window=window.open(this.url.href,this.target,this.features),null!==(e=this.window)&&void 0!==e&&e.focus&&this.window.focus()}close(){this.iClosedWindow=!0,this.window&&this.window.close()}redirect(e){e?window.location.replace(this.url.href):window.location.href=this.url.href}};class an extends on{constructor(e,{maxEventListeners:t=100,jsonRpcStreamName:r="provider"},n){super(e,{maxEventListeners:t,jsonRpcStreamName:r}),i(this,"tryWindowHandle",void 0),i(this,"onLoginStateHandle",void 0),i(this,"windowRefs",void 0),i(this,"iframeUrl",void 0),i(this,"iframeId",void 0),this.state=s(s({},an.defaultState),n),this.iframeUrl="",this.iframeId="",this.windowRefs=new Map,this.on("connect",(()=>{this.state.isConnected=!0})),this.jsonRpcConnectionEvents.on("notification",(e=>{const{method:t,params:r}=e;if("iframe_status"===t){const{isFullScreen:e,rid:t}=r;this.displayIframe({isFull:e,rid:t},!0)}else if("close_window"===t)this.handleCloseWindow(r);else if(t===Yt){tn.info("[TEST METAMASK] User received notification ",Yt);const{currentLoginProvider:e}=r;this.state.isLoggedIn=!0,this.state.currentLoginProvider=e,this.onLoginStateHandle&&this.onLoginStateHandle(!0)}else"user_logged_out"===t&&(this.state.isLoggedIn=!1,this.state.currentLoginProvider=null,this.displayIframe(),this.onLoginStateHandle&&this.onLoginStateHandle(!1))}))}get isLoggedIn(){return this.state.isLoggedIn}get isExternalWallet(){return!this.state.currentLoginProvider||this.state.currentLoginProvider===en.METAMASK||this.state.currentLoginProvider===en.WALLET_CONNECT||this.state.currentLoginProvider===en.WAGMI}get isIFrameFullScreen(){return this.state.isIFrameFullScreen}isConnected(){return this.state.isConnected}async initializeState(e){try{const{torusUrl:t,torusIframeId:r}=e;this.iframeUrl=t,this.iframeId=r;const{currentLoginProvider:n,isLoggedIn:i}=await this.request({method:"get_provider_state",params:[]});i&&this.handleConnect(n,i)}catch(e){tn.error("Web3Auth: Failed to get initial state. Please report this bug.",e)}finally{tn.info("initialized communication state"),this.state.initialized=!0}}hideTorusButton(){this.state.widgetVisibility=!1,this.displayIframe()}showTorusButton(){this.state.widgetVisibility=!0,this.displayIframe()}moveToBackground(){this.state.isBackground=!0,this.displayIframe({isFull:this.state.isIFrameFullScreen})}moveToForeground(){this.state.isBackground=!1,this.displayIframe({isFull:this.state.isIFrameFullScreen})}setIframeVisibility({isVisible:e}){this.state.isBackground=!e}displayIframe({isFull:e=!1,rid:t=""}={},r=!1){const n={};if(e)n.display=this.state.isBackground?"none":"block",n.width="100%",n.height="100%",n.top="0px",n.right="0px",n.left="0px",n.bottom="0px";else switch(n.display=this.state.widgetVisibility&&!this.state.isBackground?"block":"none",n.height="70px",n.width="70px",this.state.buttonPosition){case Qr.TOP_LEFT:n.top="0px",n.left="0px",n.right="auto",n.bottom="auto";break;case Qr.TOP_RIGHT:n.top="0px",n.right="0px",n.left="auto",n.bottom="auto";break;case Qr.BOTTOM_RIGHT:n.bottom="0px",n.right="0px",n.top="auto",n.left="auto";break;case Qr.BOTTOM_LEFT:default:n.bottom="0px",n.left="0px",n.top="auto",n.right="auto"}const i=document.getElementById(this.iframeId);Object.assign(i.style,n),this.state.isIFrameFullScreen=e,r||this.request({method:"iframe_status",params:{isIFrameFullScreen:e,rid:t}})}async handleWindow(e,{url:t,target:r,features:n,timeout:i}={}){const o=new URL(t||`${this.iframeUrl}/redirect?windowId=${e}&sessionNamespace=${window.location.hostname}`),s=new sn({url:o,target:r,features:n,timeout:i});if(s.open(),!s.window)return this.displayIframe({isFull:!0}),void this.request({method:"window_blocked",params:{windowId:e,finalUrl:o.href}});this.windowRefs.set(e,s),s.once("close",(()=>{this.windowRefs.delete(e),this.request({method:"closed_window",params:{windowId:e}})}))}rpcRequest(e,t){const r=t,n=e;Array.isArray(n)||n.jsonrpc||(n.jsonrpc="2.0"),this.rpcEngine.handle(n,r)}handleConnect(e,t){this.state.isConnected||(this.state.isConnected=!0,this.emit("connect",{currentLoginProvider:e,isLoggedIn:t}),tn.debug(Zr(e)))}handleDisconnect(e,t){if(this.state.isConnected||!this.state.isPermanentlyDisconnected&&!e){let r;this.state.isConnected=!1,e?(r=new xr(1013,t||zr()),tn.debug(r)):(r=new xr(1011,t||Vr()),tn.error(r),this.state.currentLoginProvider=null,this.state.isLoggedIn=!1,this.state.widgetVisibility=!1,this.state.isIFrameFullScreen=!1,this.state.isPermanentlyDisconnected=!0),this.emit("disconnect",r)}}handleCloseWindow(e){const{windowId:t}=e;this.windowRefs.has(t)&&(this.windowRefs.get(t).close(),this.windowRefs.delete(t))}}i(an,"defaultState",{buttonPosition:"bottom-left",currentLoginProvider:null,isIFrameFullScreen:!1,isBackground:!1,widgetVisibility:!1,initialized:!1,isLoggedIn:!1,isPermanentlyDisconnected:!1,isConnected:!1,hasEmittedConnection:!1});const ln=an;class un extends Error{constructor(e,t,r={}){const{cause:n,context:i}=r;super(t||e),this.name=e,this.stack=null==n?void 0:n.stack,this.cause=n,this.context=i}toJSON(){return{name:this.name,message:this.message,context:this.context,cause:this.cause}}}class cn extends un{static from(e){return e instanceof cn?e:e instanceof Object&&"message"in e?"User cancelled login"===e.message?new cn("USER_CANCELLED",e.message):new cn("UNKNOWN_ERROR",e.message.toString()):new cn("UNKNOWN_ERROR")}}class fn extends cn{}var hn=r(8792),dn=r.n(hn);class pn extends on{constructor(e,{maxEventListeners:t=100,jsonRpcStreamName:r="provider"}){super(e,{maxEventListeners:t,jsonRpcStreamName:r}),i(this,"chainId",void 0),i(this,"selectedAddress",void 0),i(this,"tryWindowHandle",void 0),this.state=s({},pn.defaultState),this.selectedAddress=null,this.chainId=null,this.handleAccountsChanged=this.handleAccountsChanged.bind(this),this.handleChainChanged=this.handleChainChanged.bind(this),this.handleUnlockStateChanged=this.handleUnlockStateChanged.bind(this),this.on("connect",(()=>{this.state.isConnected=!0})),this.jsonRpcConnectionEvents.on("notification",(e=>{const{method:t,params:r}=e;"wallet_accounts_changed"===t?this.handleAccountsChanged(r):"wallet_unlock_state_changed"===t?this.handleUnlockStateChanged(r):"wallet_chain_changed"===t?this.handleChainChanged(r):nn.includes(t)&&(this.emit("data",e),this.emit("notification",r.result),this.emit("message",{type:t,data:r}))}))}isConnected(){return this.state.isConnected}async initializeState(){try{const{accounts:e,chainId:t,isUnlocked:r}=await this.request({method:"wallet_get_provider_state",params:[]});this.emit("connect",{chainId:t}),this.handleChainChanged({chainId:t}),this.handleUnlockStateChanged({accounts:e,isUnlocked:r}),this.handleAccountsChanged(e)}catch(e){tn.error("WsEmbed: Failed to get initial state. Please report this bug.",e)}finally{tn.info("initialized provider state"),this.state.initialized=!0}}rpcRequest(e,t,r=!1){let n=t;const i=e;if(!Array.isArray(i))if(i.jsonrpc||(i.jsonrpc="2.0"),"eth_accounts"===i.method||"eth_requestAccounts"===i.method)n=(e,n)=>{this.handleAccountsChanged(n.result||[],"eth_accounts"===i.method,r),t(e,n)};else if("wallet_getProviderState"===i.method)return void this.rpcEngine.handle(e,n);this.tryWindowHandle(i,n)}handleConnect(e){this.state.isConnected||(this.state.isConnected=!0,this.emit("connect",{chainId:e}),tn.debug(Zr(e)))}handleDisconnect(e,t){if(this.state.isConnected||!this.state.isPermanentlyDisconnected&&!e){let r;this.state.isConnected=!1,e?(r=new xr(1013,t||zr()),tn.debug(r)):(r=new xr(1011,t||Vr()),tn.error(r),this.chainId=null,this.state.accounts=null,this.selectedAddress=null,this.state.isUnlocked=!1,this.state.isPermanentlyDisconnected=!0),this.emit("disconnect",r)}}handleAccountsChanged(e,t=!1,r=!1){let n=e;Array.isArray(n)||(tn.error("WsEmbed: Received non-array accounts parameter. Please report this bug.",n),n=[]);for(const t of e)if("string"!=typeof t){tn.error("WsEmbed: Received non-string account. Please report this bug.",e),n=[];break}dn()(this.state.accounts,n)||(t&&Array.isArray(this.state.accounts)&&this.state.accounts.length>0&&!r&&tn.error('WsEmbed: "eth_accounts" unexpectedly updated accounts. Please report this bug.',n),this.state.accounts=n,this.emit("accountsChanged",n)),this.selectedAddress!==n[0]&&(this.selectedAddress=n[0]||null)}handleChainChanged({chainId:e}={}){e?"loading"===e?this.handleDisconnect(!0):(this.handleConnect(e),e!==this.chainId&&(this.chainId=e,this.state.initialized&&this.emit("chainChanged",this.chainId))):tn.error("WsEmbed: Received invalid network parameters. Please report this bug.",{chainId:e})}handleUnlockStateChanged({accounts:e,isUnlocked:t}={}){"boolean"==typeof t?t!==this.state.isUnlocked&&(this.state.isUnlocked=t,this.handleAccountsChanged(e||[])):tn.error("WsEmbed: Received invalid isUnlocked parameter. Please report this bug.",{isUnlocked:t})}}i(pn,"defaultState",{accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1,hasEmittedConnection:!1});const yn=pn;class gn extends pn{}function bn(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var wn=bn((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),mn=function(e,t){return mn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},mn(e,t)};function vn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}mn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function _n(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function En(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Sn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function An(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function In(e){return this instanceof In?(this.v=e,this):new In(e)}function Rn(e){return"function"==typeof e}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var On=bn((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function xn(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Tn=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,r,n,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=En(o),a=s.next();!a.done;a=s.next())a.value.remove(this)}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var l=this.initialTeardown;if(Rn(l))try{l()}catch(e){i=e instanceof On?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var c=En(u),f=c.next();!f.done;f=c.next()){var h=f.value;try{Pn(h)}catch(e){i=null!=i?i:[],e instanceof On?i=An(An([],Sn(i)),Sn(e.errors)):i.push(e)}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}}if(i)throw new On(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Pn(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&xn(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&xn(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e;var t}(),kn=Tn.EMPTY;function Ln(e){return e instanceof Tn||e&&"closed"in e&&Rn(e.remove)&&Rn(e.add)&&Rn(e.unsubscribe)}function Pn(e){Rn(e)?e():e.unsubscribe()}var Nn=null,Bn=null,Mn=void 0,jn=!1,Un=!1,Cn={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=Cn.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,An([e,t],Sn(r))):setTimeout.apply(void 0,An([e,t],Sn(r)))},clearTimeout:function(e){var t=Cn.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Dn(e){Cn.setTimeout((function(){if(!Nn)throw e;Nn(e)}))}function Wn(){}var Fn=$n("C",void 0,void 0);function $n(e,t,r){return{kind:e,value:t,error:r}}var qn=null;function Hn(e){if(jn){var t=!qn;if(t&&(qn={errorThrown:!1,error:null}),e(),t){var r=qn,n=r.errorThrown,i=r.error;if(qn=null,n)throw i}}else e()}var zn=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,Ln(t)&&t.add(r)):r.destination=Xn,r}return vn(t,e),t.create=function(e,t,r){return new Kn(e,t,r)},t.prototype.next=function(e){this.isStopped?Zn(function(e){return $n("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?Zn($n("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?Zn(Fn,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Tn),Vn=Function.prototype.bind;function Gn(e,t){return Vn.call(e,t)}var Yn=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){Jn(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Jn(e)}else Jn(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Jn(e)}},e}(),Kn=function(e){function t(t,r,n){var i,o,s=e.call(this)||this;return Rn(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&Un?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&Gn(t.next,o),error:t.error&&Gn(t.error,o),complete:t.complete&&Gn(t.complete,o)}):i=t,s.destination=new Yn(i),s}return vn(t,e),t}(zn);function Jn(e){var t;jn?(t=e,jn&&qn&&(qn.errorThrown=!0,qn.error=t)):Dn(e)}function Zn(e,t){var r=Bn;r&&Cn.setTimeout((function(){return r(e,t)}))}var Xn={closed:!0,next:Wn,error:function(e){throw e},complete:Wn};function Qn(e,t){var r="object"==typeof t;return new Promise((function(n,i){var o=new Kn({next:function(e){n(e),o.unsubscribe()},error:i,complete:function(){r?n(t.defaultValue):i(new wn)}});e.subscribe(o)}))}function ei(e){return function(t){if(function(e){return Rn(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function ti(e,t,r,n,i){return new ri(e,t,r,n,i)}var ri=function(e){function t(t,r,n,i,o,s){var a=e.call(this,t)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return vn(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(zn);function ni(e,t){return ei((function(r,n){var i=0;r.subscribe(ti(n,(function(r){return e.call(t,r,i++)&&n.next(r)})))}))}function ii(e,t){var r="object"==typeof t;return new Promise((function(n,i){var o,s=!1;e.subscribe({next:function(e){o=e,s=!0},error:i,complete:function(){s?n(o):r?n(t.defaultValue):i(new wn)}})}))}function oi(e,t){return void 0===t&&(t=!1),ei((function(r,n){var i=0;r.subscribe(ti(n,(function(r){var o=e(r,i++);(o||t)&&n.next(r),!o&&n.complete()})))}))}function si(e){return e}function ai(e,t,r){var n=Rn(e)||t||r?{next:e,error:t,complete:r}:e;return n?ei((function(e,t){var r;null===(r=n.subscribe)||void 0===r||r.call(n);var i=!0;e.subscribe(ti(t,(function(e){var r;null===(r=n.next)||void 0===r||r.call(n,e),t.next(e)}),(function(){var e;i=!1,null===(e=n.complete)||void 0===e||e.call(n),t.complete()}),(function(e){var r;i=!1,null===(r=n.error)||void 0===r||r.call(n,e),t.error(e)}),(function(){var e,t;i&&(null===(e=n.unsubscribe)||void 0===e||e.call(n)),null===(t=n.finalize)||void 0===t||t.call(n)})))})):si}var li="function"==typeof Symbol&&Symbol.observable||"@@observable";var ui=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,i=this,o=(n=e)&&n instanceof zn||function(e){return e&&Rn(e.next)&&Rn(e.error)&&Rn(e.complete)}(n)&&Ln(n)?e:new Kn(e,t,r);return Hn((function(){var e=i,t=e.operator,r=e.source;o.add(t?t.call(o,r):r?i._subscribe(o):i._trySubscribe(o))})),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=ci(t))((function(t,n){var i=new Kn({next:function(t){try{e(t)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t});r.subscribe(i)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[li]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===(r=e).length?si:1===r.length?r[0]:function(e){return r.reduce((function(e,t){return t(e)}),e)})(this);var r},e.prototype.toPromise=function(e){var t=this;return new(e=ci(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function ci(e){var t;return null!==(t=null!=e?e:Mn)&&void 0!==t?t:Promise}var fi=Array.isArray,hi=Object.getPrototypeOf,di=Object.prototype,pi=Object.keys;var yi="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function gi(e){if(e instanceof ui)return e;if(null!=e){if(function(e){return Rn(e[li])}(e))return s=e,new ui((function(e){var t=s[li]();if(Rn(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if((o=e)&&"number"==typeof o.length&&"function"!=typeof o)return i=e,new ui((function(e){for(var t=0;t<i.length&&!e.closed;t++)e.next(i[t]);e.complete()}));if(Rn(null==(n=e)?void 0:n.then))return r=e,new ui((function(e){r.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,Dn)}));if(function(e){return Symbol.asyncIterator&&Rn(null==e?void 0:e[Symbol.asyncIterator])}(e))return bi(e);if(function(e){return Rn(null==e?void 0:e[yi])}(e))return t=e,new ui((function(e){var r,n;try{for(var i=En(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}e.complete()}));if(function(e){return Rn(null==e?void 0:e.getReader)}(e))return bi(function(e){return function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),o=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,u)}})),n[Symbol.asyncIterator]=function(){return this},n;function s(e,t){i[e]&&(n[e]=function(t){return new Promise((function(r,n){o.push([e,t,r,n])>1||a(e,t)}))},t&&(n[e]=t(n[e])))}function a(e,t){try{(r=i[e](t)).value instanceof In?Promise.resolve(r.value.v).then(l,u):c(o[0][2],r)}catch(e){c(o[0][3],e)}var r}function l(e){a("next",e)}function u(e){a("throw",e)}function c(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}(this,arguments,(function(){var t,r,n;return _n(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,In(t.read())];case 3:return r=i.sent(),n=r.value,r.done?[4,In(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,In(n)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}(e))}var t,r,n,i,o,s;throw function(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(e)}function bi(e){return new ui((function(t){(function(e,t){var r,n,i,o,s,a,l,u;return s=this,a=void 0,u=function(){var s,a;return _n(this,(function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),r=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=En(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){!function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,i,(t=e[r](t)).done,t.value)}))}}}(e),l.label=1;case 1:return[4,r.next()];case 2:if((n=l.sent()).done)return[3,4];if(s=n.value,t.next(s),t.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=l.sent(),i={error:a},[3,11];case 6:return l.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))},new((l=void 0)||(l=Promise))((function(e,t){function r(e){try{i(u.next(e))}catch(e){t(e)}}function n(e){try{i(u.throw(e))}catch(e){t(e)}}function i(t){var i;t.done?e(t.value):(i=t.value,i instanceof l?i:new l((function(e){e(i)}))).then(r,n)}i((u=u.apply(s,a||[])).next())}))})(e,t).catch((function(e){return t.error(e)}))}))}var wi=Array.isArray;function mi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r,n,i=function(e){return Rn((t=e)[t.length-1])?e.pop():void 0;var t}(e),o=function(e){if(1===e.length){var t=e[0];if(fi(t))return{args:t,keys:null};if((n=t)&&"object"==typeof n&&hi(n)===di){var r=pi(t);return{args:r.map((function(e){return t[e]})),keys:r}}}var n;return{args:e,keys:null}}(e),s=o.args,a=o.keys,l=new ui((function(e){var t=s.length;if(t)for(var r=new Array(t),n=t,i=t,o=function(t){var o=!1;gi(s[t]).subscribe(ti(e,(function(e){o||(o=!0,i--),r[t]=e}),(function(){return n--}),void 0,(function(){n&&o||(i||e.next(a?function(e,t){return e.reduce((function(e,r,n){return e[r]=t[n],e}),{})}(a,r):r),e.complete())})))},l=0;l<t;l++)o(l);else e.complete()}));return i?l.pipe((r=i,n=function(e){return function(e,t){return wi(t)?e.apply(void 0,An([],Sn(t))):e(t)}(r,e)},ei((function(e,t){var r=0;e.subscribe(ti(t,(function(e){t.next(n.call(void 0,e,r++))})))})))):l}var vi=new ui((function(e){return e.complete()}));function _i(e){return void 0===e&&(e=Ei),ei((function(t,r){var n=!1;t.subscribe(ti(r,(function(e){n=!0,r.next(e)}),(function(){return n?r.complete():r.error(e())})))}))}function Ei(){return new wn}function Si(e){return ei((function(t,r){var n=!1;t.subscribe(ti(r,(function(e){n=!0,r.next(e)}),(function(){n||r.next(e),r.complete()})))}))}function Ai(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?ni((function(t,r){return e(t,r,n)})):si,1<=0?function(){return vi}:ei((function(e,t){var r=[];e.subscribe(ti(t,(function(e){r.push(e),1<r.length&&r.shift()}),(function(){var e,n;try{for(var i=En(r),o=i.next();!o.done;o=i.next()){var s=o.value;t.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}t.complete()}),void 0,(function(){r=null})))})),r?Si(t):_i((function(){return new wn})))}}function Ii(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?ni((function(t,r){return e(t,r,n)})):si,1<=0?function(){return vi}:ei((function(e,t){var r=0;e.subscribe(ti(t,(function(e){++r<=1&&(t.next(e),1<=r&&t.complete())})))})),r?Si(t):_i((function(){return new wn})))}}var Ri=bn((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Oi=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return vn(t,e),t.prototype.lift=function(e){var t=new xi(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Ri},t.prototype.next=function(e){var t=this;Hn((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=En(t.currentObservers),o=i.next();!o.done;o=i.next())o.value.next(e)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;Hn((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;Hn((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,i=r.isStopped,o=r.observers;return n||i?kn:(this.currentObservers=null,o.push(e),new Tn((function(){t.currentObservers=null,xn(o,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,i=t.isStopped;r?e.error(n):i&&e.complete()},t.prototype.asObservable=function(){var e=new ui;return e.source=this,e},t.create=function(e,t){return new xi(e,t)},t}(ui),xi=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return vn(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:kn},t}(Oi);function Ti(e,t){return e===t}const ki=[lr,ur,sr,ar,cr],Li=[Ut,Ct,Dt,"air_auth_refresh_token_response",Wt,Ht,Ft,$t];class Pi{constructor(){i(this,"airMessages$",void 0),i(this,"_loginState$",void 0),i(this,"_authMessage$",void 0),i(this,"_authIframe",null),i(this,"closeAuthMessageListeners",null),i(this,"closeRealmMessageListeners",null)}static get instance(){return Pi._instance||(Pi._instance=new Pi),Pi._instance}get messages$(){return this.airMessages$.asObservable()}get loginState$(){return this._loginState$}get authMessage$(){return this._authMessage$.asObservable()}async openAuthObservables({authIframeOrigin:e}){this.closeAuthObservables(),this.setupAuthObservables();const t=async t=>{t.origin===e&&t.data&&t.data instanceof Object&&(tn.debug("Embed auth message received from auth",t.data),Li.includes(t.data.type)&&this._authMessage$.next(t.data))};window.addEventListener("message",t),this.closeAuthMessageListeners=()=>{window.removeEventListener("message",t)}}async openRealmObservables({walletIframeOrigin:e}){this.closeRealmObservables(),this.setupRealmObservables();const t=async t=>{t.origin===e&&t.data&&t.data instanceof Object&&(!("target"in t.data)||"embed_torus"!==t.data.target&&"embed_communication"!==t.data.target)&&(tn.debug("Embed realm message received from wallet",t.data),ki.includes(t.data.type)&&this.airMessages$.next(t.data))};window.addEventListener("message",t),this.closeRealmMessageListeners=()=>{window.removeEventListener("message",t)}}setupAuthIframe(e){this._authIframe=e}setupIframeCommunication(e){if(!this._authIframe)return;const t=new MessageChannel,r=new URL(this._authIframe.src).origin;this._authIframe.contentWindow.postMessage({type:"air_auth_init_wallet_communication"},r,[t.port1]);const n=new URL(e.src).origin;e.contentWindow.postMessage({type:"air_init_auth_communication"},n,[t.port2]),this._authIframe=void 0}onInitialized(){return Qn(this.messages$.pipe(ni((e=>e.type===sr))))}sendLoginRequest(e,t){const r=ii(this.loginState$.pipe(oi((e=>(!t.skipClaimFlow||"connected"!==e.payload.state)&&"logged_in"!==e.payload.state&&"claim_flow_cancelled"!==e.payload.state),!0),ai((e=>{if("claim_flow_cancelled"===e.payload.state)throw new fn(e.payload.errorName,e.payload.errorMessage)})))),{origin:n}=new URL(e.src);return e.contentWindow.postMessage({type:"air_login_request",payload:t},n),r}sendClaimRequest(e,t){const r=ii(mi([this.loginState$.pipe(oi((e=>!["logged_in","claim_flow_cancelled"].includes(e.payload.state)),!0),ai((e=>{if("claim_flow_cancelled"===e.payload.state)throw new fn(e.payload.errorName,e.payload.errorMessage)})),Ai()),this.messages$.pipe(ni((e=>e.type===ur)),Ii())])),{origin:n}=new URL(e.src);return e.contentWindow.postMessage({type:"air_claim_request",payload:{token:null==t?void 0:t.token,claimInBackground:null==t?void 0:t.background}},n),r}sendDeploySmartAccountRequest(e){const t=Qn(this.messages$.pipe(ni((e=>e.type===cr)))),{origin:r}=new URL(e.src);return e.contentWindow.postMessage({type:"air_deploy_smart_account_request"},r),t}async sendUserInfoRequest(e){const t=Qn(this.authMessage$.pipe(ni((e=>e.type===Ct)))),{origin:r}=new URL(e.src);return e.contentWindow.postMessage({type:"air_auth_user_info_request"},r),t}async sendPartnerUserInfoRequest(e){const t=Qn(this.authMessage$.pipe(ni((e=>e.type===Dt)))),{origin:r}=new URL(e.src);return e.contentWindow.postMessage({type:"air_auth_partner_user_info_request"},r),t}async sendAuthLoginRequest(e,t){const r=Qn(this.authMessage$.pipe(ni((e=>e.type===Ut)))),{origin:n}=new URL(e.src);return e.contentWindow.postMessage({type:"air_auth_login_request",payload:t},n),r}async logoutAuth(e){const t=Qn(this.authMessage$.pipe(ni((e=>e.type===Ht)))),{origin:r}=new URL(e.src);return e.contentWindow.postMessage({type:"air_auth_logout_request"},r),t}async waitForAuthInitialization(){const e=await Qn(this._authMessage$.pipe(ni((e=>e.type===Wt))));if(!1===e.payload.success)throw new fn(e.payload.errorName,e.payload.errorMessage);return e.payload}async waitForWalletInitialization(){const e=await Qn(this.messages$.pipe(ni((e=>e.type===sr||e.type===ar))));if(e.type===ar)throw new fn(e.payload.errorName,e.payload.errorMessage)}closeAuthObservables(){this._authMessage$&&!this._authMessage$.closed&&this._authMessage$.complete(),this.closeAuthMessageListeners&&this.closeAuthMessageListeners()}closeRealmObservables(){this.airMessages$&&!this.airMessages$.closed&&this.airMessages$.complete(),this.closeRealmMessageListeners&&this.closeRealmMessageListeners()}setupAuthObservables(){this._authMessage$=new Oi}setupRealmObservables(){var e,t;this.airMessages$=new Oi,this._loginState$=this.airMessages$.pipe(ni((e=>e.type===lr)),(e=dn(),void 0===t&&(t=si),e=null!=e?e:Ti,ei((function(r,n){var i,o=!0;r.subscribe(ti(n,(function(r){var s=t(r);!o&&e(i,s)||(o=!1,i=s,n.next(r))})))}))))}}i(Pi,"_instance",void 0);const Ni=Pi.instance;function Bi(e){return new Promise(((t,r)=>{try{const r=document.createElement("img");r.onload=()=>t(!0),r.onerror=()=>t(!1),r.src=e}catch(e){r(e)}}))}const Mi=e=>{const{document:t}=e,r=t.querySelector('head > meta[property="og:site_name"]');if(r)return r.content;const n=t.querySelector('head > meta[name="title"]');return n?n.content:t.title&&t.title.length>0?t.title:e.location.hostname};async function ji(e){try{const{document:t}=e;let r=t.querySelector('head > link[rel="shortcut icon"]');return r&&await Bi(r.href)?r.href:(r=Array.from(t.querySelectorAll('head > link[rel="icon"]')).find((e=>Boolean(e.href))),r&&await Bi(r.href)?r.href:"")}catch(e){return""}}function Ui(e,t){return e.get(Di(e,t))}function Ci(e,t,r){return e.set(Di(e,t),r),r}function Di(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}!async function(){try{if("undefined"==typeof document)return;const e=document.createElement("link"),{walletUrl:t}=rn.production;e.href=`${t}/frame`,e.crossOrigin="anonymous",e.type="text/html",e.rel="prefetch",e.relList&&e.relList.supports&&e.relList.supports("prefetch")&&document.head.appendChild(e)}catch(e){tn.warn(e)}}(),new Set(["set_provider"]);const Wi=new Set(["eth_sign","eth_signTypedData_v4","personal_sign","eth_sendTransaction","wallet_addEthereumChain","wallet_switchEthereumChain"]),Fi={polygon:{chainNamespace:Kt,chainId:"0x89",decimals:18,displayName:"Polygon",blockExplorerUrl:"https://polygonscan.com",logo:"https://cryptologos.cc/logos/polygon-matic-logo.png",ticker:"MATIC",tickerName:"Matic Network Token"},polygonAmoy:{chainNamespace:Kt,chainId:"0x13882",decimals:18,displayName:"Polygon Amoy",blockExplorerUrl:"https://amoy.polygonscan.com",logo:"https://cryptologos.cc/logos/polygon-matic-logo.png",ticker:"MATIC",tickerName:"Matic Network Token",isTestnet:!0}},$i=Xt.SAPPHIRE_MAINNET;var qi=new WeakMap,Hi=new WeakMap,zi=new WeakMap,Vi=new WeakMap,Gi=new WeakMap,Yi=new WeakMap,Ki=new WeakMap,Ji=new WeakMap,Zi=new WeakMap,Xi=new WeakMap,Qi=new WeakMap,eo=new WeakMap,to=new WeakMap,ro=new WeakMap,no=new WeakMap,io=new WeakMap,oo=new WeakMap,so=new WeakMap,ao=new WeakMap,lo=new WeakSet;function uo(){const{walletUrl:e}=rn[Ui(ro,this)],t=new URL(e);t.pathname.endsWith("/")?t.pathname+="frame":t.pathname+="/frame";const r=new URLSearchParams;return r.append("origin",window.location.origin),t.hash=r.toString(),t}async function co(e,t){let r;return r=this.isLoggedIn?Di(lo,this,fo).call(this):this.isConnected?!0===(null==e?void 0:e.skipClaiming)?Di(lo,this,fo).call(this):await this.claimRealmId(e):await Di(lo,this,po).call(this,e,t),r}function fo(){return this.isLoggedIn?{isLoggedIn:!0,realmId:Ui(io,this),addresses:Ui(no,this),token:Ui(oo,this),sessionId:Ui(so,this)}:{isLoggedIn:!1,addresses:Ui(no,this),token:Ui(oo,this),sessionId:Ui(so,this)}}async function ho(e={}){try{e.loginProvider&&e.loginProvider!==en.WALLET_CONNECT||Ui(Yi,this).displayIframe({isFull:!0});const t=await new Promise(((t,r)=>{Ui(Hi,this).rpcRequest({method:"eth_requestAccounts",params:[e.loginProvider,e.login_hint]},rr(t,r))}));if(tn.debug("check: res",t),Array.isArray(t)&&t.length>0)return Ui(eo,this)===Jt.AUTO_APPROVE&&tn.warn("Confirmation strategy auto approve is not allowed on Embed Mode, using Default instead."),t;throw new Error("Login failed")}catch(e){throw tn.error("login failed",e),e}}async function po(e,t){const r=!0===(null==e?void 0:e.skipClaiming);try{null!=e&&e.authToken&&Ui(Yi,this).setIframeVisibility({isVisible:!1});const n=Promise.all([Di(lo,this,ho).call(this),Ni.sendLoginRequest(Ui(to,this),{skipClaimFlow:r,token:null==e?void 0:e.token,customAuthToken:null==e?void 0:e.authToken,isLegacyLogin:!!t})]);return tn.debug("start logging in..."),await n,tn.debug("login ended"),Di(lo,this,fo).call(this)}catch(e){throw await Di(lo,this,yo).call(this),fn.from(e)}finally{null!=e&&e.authToken&&Ui(Yi,this).setIframeVisibility({isVisible:!0}),Ui(Yi,this).displayIframe({isFull:!1})}}async function yo(){var e;const t=!Ui(no,this);null!==(e=Ui(Yi,this))&&void 0!==e&&e.isLoggedIn&&await Ui(Yi,this).request({method:"logout",params:[]}),Ui(Yi,this)&&(Ui(Yi,this).onLoginStateHandle=void 0),Ci(no,this,void 0),Ci(io,this,void 0),t||Di(lo,this,mo).call(this,{event:"logged_out"})}async function go(e){var t;((t=Ui(to,this))instanceof Element||t instanceof Document)&&window.document.body.contains(Ui(to,this))&&(Ui(to,this).remove(),Ci(to,this,void 0)),Ni.closeRealmObservables(),Ci(zi,this,!1),Ci(no,this,void 0),Ci(io,this,void 0),!0===e&&Di(lo,this,mo).call(this,{event:"reset"})}function bo(e,t){let r=Ui(eo,this);return Array.isArray(e)||!Wi.has(e.method)||Ui(eo,this)===Jt.MODAL||Ui(Qi,this)||t.isExternalWallet||(r=Jt.POPUP),r}async function wo(e){tn.debug("setup embed communication...");const t=new or({name:"embed_torus",target:"iframe_torus",targetWindow:Ui(to,this).contentWindow,targetOrigin:new URL(e.torusUrl).origin}),r=new or({name:"embed_communication",target:"iframe_communication",targetWindow:Ui(to,this).contentWindow,targetOrigin:new URL(e.torusUrl).origin}),n=new gn(t,{}),i=new ln(r,{},{buttonPosition:Ui(Ki,this)});n.tryWindowHandle=(e,t)=>{const r=e;if(Di(lo,this,bo).call(this,e,i)===Jt.POPUP){const e=Mt();i.handleWindow(e,{target:"_blank",features:jt(Gt),timeout:500}),r.windowId=e}n.rpcEngine.handle(r,t)},i.tryWindowHandle=(e,t)=>{const r=e;if(Di(lo,this,bo).call(this,e,i)===Jt.POPUP){const e=Mt();i.handleWindow(e,{target:"_blank",features:jt(zt),timeout:500}),r.params.windowId=e}i.rpcEngine.handle(r,t)};const o=e=>{const t=n[e],r=this;n[e]=function(e,n){const{method:i,params:o=[]}=e;if("eth_requestAccounts"===i){let e=Di(lo,r,ho).call(r,{loginProvider:o[0]});return n&&(e=e.then((e=>n(null,e))).catch((e=>n(e)))),e.finally((()=>{Ui(Yi,r).displayIframe({isFull:!1})}))}return t.apply(this,[e,n])}};o("request"),o("sendAsync"),o("send");const a=new Proxy(n,{deleteProperty:()=>!0}),l=new Proxy(i,{deleteProperty:()=>!0});Ci(Hi,this,a),Ci(Yi,this,l),await Promise.all([n.initializeState(),i.initializeState(s(s({},e),{},{torusIframeId:Ui(to,this).id}))]),tn.debug("embed communication setup ended")}function mo(e){[...Ui(ao,this)].forEach((t=>{try{t(e)}catch(e){tn.error(e)}}))}function vo(){Ui(zi,this)&&Ui(Vi,this)&&Di(lo,this,mo).call(this,{event:"initialized",result:{rehydration:Ui(Vi,this)}})}function _o(){return new Promise((e=>{if(Ui(zi,this)&&Ui(Vi,this))e();else{const t=r=>{tn.debug("onInitialized:",r),"initialized"===r.event&&(this.off(t),e())};this.on(t)}}))}const Eo=class{constructor({modalZIndex:e=99999,partnerId:t}){l(this,lo),u(this,qi,Mt()),u(this,Hi,void 0),u(this,zi,void 0),u(this,Vi,void 0),u(this,Gi,void 0),u(this,Yi,void 0),u(this,Ki,void 0),u(this,Ji,void 0),u(this,Zi,void 0),u(this,Xi,void 0),u(this,Qi,void 0),u(this,eo,void 0),u(this,to,void 0),u(this,ro,void 0),u(this,no,void 0),u(this,io,void 0),u(this,oo,void 0),u(this,so,void 0),u(this,ao,[]),Ci(zi,this,!1),Ci(Gi,this,e),Ci(Ji,this,t),Ci(Zi,this,"BANbxuTYFGeYi8HxUzaPQkvQlSAXiKRtUqb1vqsXbsZsZKrNr05PEPCM2J2PhUJZpIYl0XzQa6jxUjnYzSU9LXY"),Ci(Xi,this,$i)}get isConnected(){return!!Ui(no,this)&&Ui(Yi,this).isLoggedIn}get isInitialized(){return Ui(zi,this)&&!!Ui(Vi,this)}get isLoggedIn(){return!!Ui(io,this)&&this.isConnected}get getBuildEnv(){return Ui(ro,this)}get walletAddresses(){var e;return null!==(e=Ui(no,this))&&void 0!==e?e:null}get sessionId(){var e;return null!==(e=Ui(so,this))&&void 0!==e?e:null}get realmId(){var e;return null!==(e=Ui(io,this))&&void 0!==e?e:null}get provider(){return Ui(no,this)?Ui(Hi,this):null}async init({buildEnv:e=Xr.PRODUCTION,enableLogging:t=!1,skipRehydration:r=!1}={}){if(Ui(zi,this))throw new fn("ALREADY_INITIALISED","Already initialized");Ci(ro,this,e),Ci(eo,this,Jt.DEFAULT),Ci(Ki,this,"bottom-left");const{walletUrl:n,logLevel:i}=rn[e];tn.info(n,"url loaded"),tn.setDefaultLevel(i),t?tn.enableAll():tn.disableAll();const o=Di(lo,this,uo).call(this),s=o.origin;Ni.openRealmObservables({walletIframeOrigin:s}),Ci(to,this,(e=>{const t=window.document.createElement("template"),r=e.trim();return t.innerHTML=r,t.content.firstChild})(`<iframe\n id="walletIframe-${Ui(qi,this)}"\n class="walletIframe-${Ui(qi,this)}"\n sandbox="allow-popups allow-scripts allow-same-origin allow-forms allow-modals allow-downloads"\n src="${o.href}"\n style="display: none; position: fixed; top: 0; right: 0; width: 100%; color-scheme: none; border-width: 0px; height: 100%; border: none; border-radius: 0; z-index: ${Ui(Gi,this).toString()}"\n allow="clipboard-write"\n ></iframe>`)),Ni.messages$.subscribe((e=>{e.type===sr&&(Ci(Vi,this,e.payload.rehydration),Di(lo,this,vo).call(this))})),Ni.loginState$.subscribe((async e=>{switch(e.payload.state){case"connected":await Di(lo,this,_o).call(this),e.payload.addresses&&!this.isLoggedIn&&(Ci(no,this,e.payload.addresses),Ci(oo,this,e.payload.token),Ci(so,this,e.payload.sessionId),Di(lo,this,mo).call(this,{event:"connected",result:{isLoggedIn:!1,addresses:e.payload.addresses,token:e.payload.token,sessionId:e.payload.sessionId}}));break;case"logged_in":{await Di(lo,this,_o).call(this);const t=!Ui(no,this);Ci(io,this,e.payload.airId),Ci(no,this,e.payload.addresses),Ci(oo,this,e.payload.token),Ci(so,this,e.payload.sessionId),t&&Di(lo,this,mo).call(this,{event:"connected",result:{isLoggedIn:!1,addresses:e.payload.addresses,token:e.payload.token,sessionId:e.payload.sessionId}}),Di(lo,this,mo).call(this,{event:"logged_in",result:{isLoggedIn:!0,realmId:e.payload.airId,addresses:e.payload.addresses,token:e.payload.token,sessionId:e.payload.sessionId}});break}case"minting_started":Di(lo,this,mo).call(this,{event:"minting_started"});break;case"minting_failed":Di(lo,this,mo).call(this,{event:"minting_failed",errorMessage:e.payload.errorMessage})}}));try{window.document.body.appendChild(Ui(to,this));const e=new Promise(((e,i)=>{const o=async a=>{try{if(a.origin!==s)return;if("setup_complete"===a.data){window.removeEventListener("message",o);const i=await(async()=>({name:Mi(window),icon:await ji(window)}))();Ui(to,this).contentWindow.postMessage({chainConfig:Ui(ro,this)===Xr.PRODUCTION?Fi.polygon:Fi.polygonAmoy,dappMetadata:i,enableLogging:t,skipRehydration:r,realmPartnerId:Ui(Ji,this),web3AuthClientId:Ui(Zi,this),web3AuthNetwork:Ui(Xi,this),confirmationStrategy:Ui(eo,this)},s),await Di(lo,this,wo).call(this,{torusUrl:n}),Ui(Yi,this).onLoginStateHandle=async e=>{e||await Di(lo,this,yo).call(this)},e()}}catch(e){i(e)}};window.addEventListener("message",o)})),i=Ni.waitForWalletInitialization();await Promise.all([e,i]),Ni.setupIframeCommunication(Ui(to,this)),Ci(zi,this,!0),Di(lo,this,vo).call(this),tn.debug("Wallet service initialization resolved")}catch(e){throw tn.debug("Wallet service initialization error",e),Di(lo,this,go).call(this,!0),e}}moveToBackground(){Ui(Yi,this).moveToBackground()}moveToForeground(){Ui(Yi,this).moveToForeground()}async getUserInfo(){return Ui(io,this)?s(s({},await Ui(Yi,this).request({method:"user_info",params:[]})),{},{realmId:Ui(io,this)}):null}async login(e){var t;return Di(lo,this,co).call(this,e,null===(t=null==e?void 0:e.legacy)||void 0===t||t)}async _deploySmartAccount(){if(!this.isConnected)throw new fn("NOT_LOGGED_IN","User needs to be connected first");try{await Ni.sendDeploySmartAccountRequest(Ui(to,this))}catch(e){throw fn.from(e)}}async _loginWithSessionId(e){if(!Ui(zi,this))throw new Error("Call init() first");if(!e.sessionId)throw new Error("sessionId is required");try{const t=await Ui(Yi,this).request({method:"login_with_session_id",params:[e.sessionId,""]});return tn.info("Login with session id",t),t.success}catch(e){throw tn.error("login with session id failed",e),e}}async _showWalletWidget(){Ui(Yi,this).showTorusButton()}async claimRealmId(e){if(!this.isConnected)throw new fn("NOT_CONNECTED","User needs to be connected first");try{null!=e&&e.background&&Ui(Yi,this).setIframeVisibility({isVisible:!1}),Ui(Yi,this).displayIframe({isFull:!0});const t=Ni.sendClaimRequest(Ui(to,this),e);return tn.debug("before claimPromise"),await t,tn.debug("after claimPromise"),{isLoggedIn:!0,realmId:Ui(io,this),addresses:Ui(no,this),token:Ui(oo,this),sessionId:Ui(so,this)}}catch(e){throw fn.from(e)}finally{null!=e&&e.background&&Ui(Yi,this).setIframeVisibility({isVisible:!0}),Ui(Yi,this).displayIframe({isFull:!1})}}async logout(){if(!Ui(Yi,this).isLoggedIn)throw new fn("NOT_LOGGED_IN","Not logged in");await Di(lo,this,yo).call(this)}async cleanUp(){var e;null!==(e=Ui(Yi,this))&&void 0!==e&&e.isLoggedIn&&await this.logout(),await this.clearInit()}async clearInit(){Di(lo,this,go).call(this)}on(e){Ui(ao,this).indexOf(e)<0&&Ui(ao,this).push(e)}off(e){const t=Ui(ao,this).indexOf(e);t>=0&&Ui(ao,this).splice(t,1)}clearEventListeners(){Ci(ao,this,[])}};class So{constructor(e,t,r){i(this,"state",void 0),i(this,"_iframeElement",null),i(this,"iframeUrl",void 0),i(this,"iframeId",void 0),this.state=s(s({},So.defaultState),r),this.iframeUrl=e,this.iframeId=t}get iframeElement(){return this._iframeElement}createIframe(){if(this._iframeElement)return this._iframeElement;const e=document.createElement("iframe");return e.id=this.iframeId,e.allow="publickey-credentials-get *; publickey-credentials-create *",e.src=this.iframeUrl,e.style.position="fixed",e.style.zIndex="999999",e.style.border="none",e.style.margin="0",e.style.padding="0",e.style.display="none",document.body.appendChild(e),this._iframeElement=e,e}setIframeVisibility(e){this.state.isVisible=e}updateIframeState(){if(!this.iframeElement)return;const e={};e.display=this.state.isVisible?"block":"none",e.width="100%",e.height="100%",e.top="0px",e.right="0px",e.left="0px",e.bottom="0px",Object.assign(this.iframeElement.style,e)}destroy(){this.iframeElement&&(this.iframeElement.remove(),this._iframeElement=null)}postMessage(e){if(!this.iframeElement)return;const{origin:t}=new URL(this.iframeElement.src);this.iframeElement.contentWindow.postMessage(e,t)}}function Ao(e,t){return e.get(Ro(e,t))}function Io(e,t,r){return e.set(Ro(e,t),r),r}function Ro(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}i(So,"defaultState",{isVisible:!1});var Oo=new WeakMap,xo=new WeakMap,To=new WeakMap,ko=new WeakMap,Lo=new WeakMap,Po=new WeakMap,No=new WeakMap,Bo=new WeakMap,Mo=new WeakMap,jo=new WeakMap,Uo=new WeakSet;async function Co(){return Ao(Bo,this).login({skipClaiming:!0,legacy:!1})}async function Do(){if(!this.isLoggedIn)throw new Error("No active session to create wallet");return Ao(Mo,this)||(Ni.setupAuthIframe(Ao(Oo,this).iframeElement),Io(Mo,this,(async()=>{try{return await Ro(Uo,this,Fo).call(this),await Ro(Uo,this,Co).call(this)}catch(e){throw tn.error("Error initializing wallet",e),e}})())),Ao(Mo,this)}async function Wo(){(Ao(Mo,this)||Ao(Bo,this))&&(await Ao(Mo,this),await Ao(Bo,this).cleanUp(),Io(Mo,this,void 0))}async function Fo(){if(!Ao(Bo,this).isInitialized)try{await Ao(Bo,this).init({buildEnv:Ao(To,this),skipRehydration:!0,enableLogging:Ao(Lo,this)||!1}),Ao(Oo,this).postMessage({type:qt,payload:{success:!0}})}catch(e){throw tn.error("Error initializing wallet",e),Ao(Oo,this).postMessage({type:qt,payload:{success:!1,errorName:"UNKNOWN_ERROR",errorMessage:"Unknown error occurred"}}),e}}async function $o(e){Ao(jo,this).forEach((t=>{t(e)}))}async function qo(){await Ro(Uo,this,$o).call(this,{event:"initialized"})}async function Ho(){await Ro(Uo,this,$o).call(this,{event:"logged_in",result:Ao(xo,this)})}async function zo(){await Ro(Uo,this,$o).call(this,{event:"logged_out"})}function Vo(e){return{isLoggedIn:!0,id:e.id,abstractAccountAddress:e.abstractAccountAddress,token:e.partnerAccessToken}}async function Go(){Ao(Bo,this).on((e=>{if("connected"===e.event||"logged_in"===e.event){var t;const r=s(s({},e.result),{},{addresses:{eoa:e.result.addresses.eoa,aa:null!==(t=e.result.addresses.aa)&&void 0!==t?t:""}});Ro(Uo,this,$o).call(this,{event:"wallet_loaded",result:r})}else"minting_started"===e.event?Ro(Uo,this,$o).call(this,{event:"minting_started"}):"minting_failed"===e.event&&Ro(Uo,this,$o).call(this,{event:"minting_failed",errorMessage:e.errorMessage})}))}const Yo=class{constructor({partnerId:e}){l(this,Uo),u(this,Oo,void 0),u(this,xo,void 0),u(this,To,void 0),u(this,ko,Mt()),u(this,Lo,!1),u(this,Po,!1),u(this,No,void 0),u(this,Bo,void 0),u(this,Mo,void 0),u(this,jo,[]),Io(No,this,e),Io(Bo,this,new Eo({partnerId:Ao(No,this)}))}get buildEnv(){return Ao(To,this)}get isAirAuth(){return!0}get isInitialized(){return Ao(Po,this)}get isLoggedIn(){return!!Ao(xo,this)}get isWalletLoaded(){var e;return null===(e=Ao(Bo,this))||void 0===e?void 0:e.isInitialized}async init({buildEnv:e=Xr.PRODUCTION,enableLogging:t=!1,skipRehydration:r=!1}){if(!Ao(No,this))throw new Error("Partner ID is required to initialize auth service");if(Ao(Po,this))return;Io(To,this,e),Io(Lo,this,t);const{authUrl:n,logLevel:i}=rn[e];tn.setDefaultLevel(i),Ao(Lo,this)?tn.enableAll():tn.disableAll();const o=new URL(n).origin;await Ni.openAuthObservables({authIframeOrigin:o}),Io(Oo,this,new So(n,`air-login-${Ao(ko,this)}`)),Ni.authMessage$.subscribe((async e=>{switch(e.type){case Ft:{const t=Ao(Oo,this);t.setIframeVisibility(e.payload.visible),t.updateIframeState();break}case $t:await Ro(Uo,this,Fo).call(this)}}));try{Ao(Oo,this).createIframe();const e=new Promise(((e,t)=>{const n=i=>{try{if(i.origin!==o)return;"air_auth_setup_completed"===i.data&&(window.removeEventListener("message",n),Ao(Oo,this).postMessage({type:"air_auth_initialization_request",payload:{partnerId:Ao(No,this),skipRehydration:r}}),e())}catch(e){t(e)}};window.addEventListener("message",n)})),t=Ni.waitForAuthInitialization(),n=await Promise.all([e,t]);if(Io(Po,this,!0),Ro(Uo,this,qo).call(this),Ro(Uo,this,Go).call(this),n[1].rehydrated)return Io(xo,this,Ro(Uo,this,Vo).call(this,n[1])),Ro(Uo,this,Ho).call(this),Ao(xo,this)}catch(e){throw tn.debug("Error initializing auth service",e),await this.cleanUp(),e}return null}async cleanUp(){var e;await Ro(Uo,this,Wo).call(this),await Ni.logoutAuth(Ao(Oo,this).iframeElement);const t=null===(e=Ao(Oo,this))||void 0===e?void 0:e.iframeElement;var r;((r=t)instanceof Element||r instanceof Document)&&window.document.body.contains(t)&&(Ao(Oo,this).destroy(),Io(Oo,this,void 0)),Ni.closeAuthObservables(),this.clearEventListeners(),Io(Po,this,!1)}async login(e){if(!Ao(Po,this))throw new Error("Service is not initialized");if(Ao(xo,this))return Ao(xo,this);const t=Ao(Oo,this),{payload:r}=await Ni.sendAuthLoginRequest(t.iframeElement,{partnerLoginToken:null==e?void 0:e.authToken});if(!0===r.success)return Io(xo,this,Ro(Uo,this,Vo).call(this,r)),Ro(Uo,this,Ho).call(this),Ao(xo,this);throw new cn("UNKNOWN_ERROR","Unknown error occurred")}async deploySmartAccount(){if(!Ao(Po,this))throw new Error("Service is not initialized");return await Ro(Uo,this,Do).call(this),Ao(Bo,this)._deploySmartAccount()}async logout(){if(!Ao(Po,this))throw new Error("Service is not initialized");if(!this.isLoggedIn)throw new Error("No active session to logout");await Ro(Uo,this,Wo).call(this),await Ni.logoutAuth(Ao(Oo,this).iframeElement),Io(xo,this,void 0),Ro(Uo,this,zo).call(this)}async getProvider(){return this.isLoggedIn?(await Ro(Uo,this,Do).call(this),Ao(Bo,this).provider):null}async preloadWallet(){return Ro(Uo,this,Do).call(this)}async claimAirId(e){return await Ro(Uo,this,Do).call(this),Ao(Bo,this).claimRealmId(e)}async getUserInfo(){if(!this.isLoggedIn)throw new Error("User not logged in");const e=await Ni.sendUserInfoRequest(Ao(Oo,this).iframeElement);if(!1===e.payload.success)throw new cn(e.payload.errorName,e.payload.errorMessage);return{id:e.payload.id,abstractAccountAddress:e.payload.abstractAccountAddress,email:e.payload.email,airIds:e.payload.airIds}}async getPartnerUserInfo(){if(!this.isLoggedIn)throw new Error("User not logged in");const e=await Ni.sendPartnerUserInfoRequest(Ao(Oo,this).iframeElement);if(!1===e.payload.success)throw new cn(e.payload.errorName,e.payload.errorMessage);return{partnerId:e.payload.partnerId,partnerUserId:e.payload.partnerUserId,airId:e.payload.airId}}on(e){Ao(jo,this).indexOf(e)<0&&Ao(jo,this).push(e)}off(e){Ao(jo,this).indexOf(e)>=0&&Ao(jo,this).splice(Ao(jo,this).indexOf(e),1)}clearEventListeners(){Io(jo,this,[])}async _showWalletWidget(){return await Ro(Uo,this,Do).call(this),Ao(Bo,this)._showWalletWidget()}}})(),n})()));