@taquito/taquito 11.2.0 → 12.0.0-beta-RC.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +2 -2
  2. package/dist/lib/batch/rpc-batch-provider.js.map +1 -1
  3. package/dist/lib/constants.js +1 -13
  4. package/dist/lib/constants.js.map +1 -1
  5. package/dist/lib/context.js +25 -45
  6. package/dist/lib/context.js.map +1 -1
  7. package/dist/lib/contract/contract-methods/contract-method-factory.js +2 -2
  8. package/dist/lib/contract/contract-methods/contract-method-factory.js.map +1 -1
  9. package/dist/lib/contract/contract-methods/contract-on-chain-view.js +6 -5
  10. package/dist/lib/contract/contract-methods/contract-on-chain-view.js.map +1 -1
  11. package/dist/lib/contract/contract.js +40 -66
  12. package/dist/lib/contract/contract.js.map +1 -1
  13. package/dist/lib/contract/lambda-view.js +4 -0
  14. package/dist/lib/contract/lambda-view.js.map +1 -1
  15. package/dist/lib/contract/rpc-contract-provider.js +12 -14
  16. package/dist/lib/contract/rpc-contract-provider.js.map +1 -1
  17. package/dist/lib/estimate/error.js +11 -0
  18. package/dist/lib/estimate/error.js.map +1 -0
  19. package/dist/lib/estimate/estimate-provider-interface.js +3 -0
  20. package/dist/lib/estimate/estimate-provider-interface.js.map +1 -0
  21. package/dist/lib/{contract → estimate}/estimate.js +4 -3
  22. package/dist/lib/estimate/estimate.js.map +1 -0
  23. package/dist/lib/estimate/index.js +18 -0
  24. package/dist/lib/estimate/index.js.map +1 -0
  25. package/dist/lib/{contract → estimate}/naive-estimate-provider.js +0 -0
  26. package/dist/lib/estimate/naive-estimate-provider.js.map +1 -0
  27. package/dist/lib/{contract → estimate}/rpc-estimate-provider.js +54 -35
  28. package/dist/lib/estimate/rpc-estimate-provider.js.map +1 -0
  29. package/dist/lib/forger/taquito-local-forger.js +35 -0
  30. package/dist/lib/forger/taquito-local-forger.js.map +1 -0
  31. package/dist/lib/operations/operation-emitter.js +10 -22
  32. package/dist/lib/operations/operation-emitter.js.map +1 -1
  33. package/dist/lib/operations/operations.js +11 -37
  34. package/dist/lib/operations/operations.js.map +1 -1
  35. package/dist/lib/operations/origination-operation.js +2 -2
  36. package/dist/lib/operations/origination-operation.js.map +1 -1
  37. package/dist/lib/parser/michel-codec-parser.js +5 -2
  38. package/dist/lib/parser/michel-codec-parser.js.map +1 -1
  39. package/dist/lib/{forger → read-provider}/interface.js +0 -0
  40. package/dist/lib/read-provider/interface.js.map +1 -0
  41. package/dist/lib/read-provider/rpc-read-adapter.js +199 -0
  42. package/dist/lib/read-provider/rpc-read-adapter.js.map +1 -0
  43. package/dist/lib/subscribe/create-observable-from-subscription.js +22 -0
  44. package/dist/lib/subscribe/create-observable-from-subscription.js.map +1 -0
  45. package/dist/lib/subscribe/polling-subcribe-provider.js +94 -0
  46. package/dist/lib/subscribe/polling-subcribe-provider.js.map +1 -0
  47. package/dist/lib/taquito.js +63 -26
  48. package/dist/lib/taquito.js.map +1 -1
  49. package/dist/lib/tz/rpc-tz-provider.js +2 -2
  50. package/dist/lib/tz/rpc-tz-provider.js.map +1 -1
  51. package/dist/lib/version.js +2 -2
  52. package/dist/lib/version.js.map +1 -1
  53. package/dist/lib/wallet/delegation-operation.js +2 -2
  54. package/dist/lib/wallet/delegation-operation.js.map +1 -1
  55. package/dist/lib/wallet/operation-factory.js +10 -24
  56. package/dist/lib/wallet/operation-factory.js.map +1 -1
  57. package/dist/lib/wallet/operation.js +4 -4
  58. package/dist/lib/wallet/operation.js.map +1 -1
  59. package/dist/lib/wallet/wallet.js +4 -8
  60. package/dist/lib/wallet/wallet.js.map +1 -1
  61. package/dist/taquito.es6.js +745 -664
  62. package/dist/taquito.es6.js.map +1 -1
  63. package/dist/taquito.min.js +2 -0
  64. package/dist/taquito.min.js.LICENSE.txt +27 -0
  65. package/dist/taquito.umd.js +749 -665
  66. package/dist/taquito.umd.js.map +1 -1
  67. package/dist/types/batch/rpc-batch-provider.d.ts +2 -1
  68. package/dist/types/constants.d.ts +0 -11
  69. package/dist/types/context.d.ts +16 -23
  70. package/dist/types/contract/contract-methods/contract-method-factory.d.ts +2 -1
  71. package/dist/types/contract/contract-methods/contract-on-chain-view.d.ts +3 -2
  72. package/dist/types/contract/contract.d.ts +9 -15
  73. package/dist/types/contract/interface.d.ts +0 -58
  74. package/dist/types/contract/lambda-view.d.ts +4 -0
  75. package/dist/types/contract/rpc-contract-provider.d.ts +2 -1
  76. package/dist/types/estimate/error.d.ts +4 -0
  77. package/dist/types/estimate/estimate-provider-interface.d.ts +60 -0
  78. package/dist/types/{contract → estimate}/estimate.d.ts +0 -0
  79. package/dist/types/estimate/index.d.ts +5 -0
  80. package/dist/types/{contract → estimate}/naive-estimate-provider.d.ts +1 -1
  81. package/dist/types/{contract → estimate}/rpc-estimate-provider.d.ts +2 -1
  82. package/dist/types/forger/composite-forger.d.ts +1 -1
  83. package/dist/types/forger/rpc-forger.d.ts +1 -1
  84. package/dist/types/forger/taquito-local-forger.d.ts +8 -0
  85. package/dist/types/operations/operation-emitter.d.ts +2 -2
  86. package/dist/types/operations/operations.d.ts +1 -4
  87. package/dist/types/operations/origination-operation.d.ts +1 -1
  88. package/dist/types/operations/types.d.ts +1 -1
  89. package/dist/types/read-provider/interface.d.ts +113 -0
  90. package/dist/types/read-provider/rpc-read-adapter.d.ts +112 -0
  91. package/dist/types/signer/interface.d.ts +1 -1
  92. package/dist/types/subscribe/create-observable-from-subscription.d.ts +4 -0
  93. package/dist/types/subscribe/interface.d.ts +2 -1
  94. package/dist/types/subscribe/polling-subcribe-provider.d.ts +22 -0
  95. package/dist/types/taquito.d.ts +23 -9
  96. package/dist/types/wallet/delegation-operation.d.ts +2 -2
  97. package/dist/types/wallet/operation-factory.d.ts +2 -3
  98. package/dist/types/wallet/operation.d.ts +2 -1
  99. package/package.json +8 -7
  100. package/dist/lib/contract/estimate.js.map +0 -1
  101. package/dist/lib/contract/naive-estimate-provider.js.map +0 -1
  102. package/dist/lib/contract/rpc-estimate-provider.js.map +0 -1
  103. package/dist/lib/forger/interface.js.map +0 -1
  104. package/dist/lib/subscribe/polling-provider.js +0 -40
  105. package/dist/lib/subscribe/polling-provider.js.map +0 -1
  106. package/dist/types/forger/interface.d.ts +0 -9
  107. package/dist/types/subscribe/polling-provider.d.ts +0 -10
@@ -0,0 +1,2 @@
1
+ /*! For license information please see taquito.min.js.LICENSE.txt */
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.taquito=e():t.taquito=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=183)}([function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)};function i(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return f}));var n=r(0),i=r(32),o=r(76),s=r(5),a=r(56),c=r(16),u=r(46),f=function(t){function e(r,n,i){var s=t.call(this)||this;switch(s.syncErrorValue=null,s.syncErrorThrown=!1,s.syncErrorThrowable=!1,s.isStopped=!1,arguments.length){case 0:s.destination=o.a;break;case 1:if(!r){s.destination=o.a;break}if("object"==typeof r){r instanceof e?(s.syncErrorThrowable=r.syncErrorThrowable,s.destination=r,r.add(s)):(s.syncErrorThrowable=!0,s.destination=new h(s,r));break}default:s.syncErrorThrowable=!0,s.destination=new h(s,r,n,i)}return s}return n.a(e,t),e.prototype[a.a]=function(){return this},e.create=function(t,r,n){var i=new e(t,r,n);return i.syncErrorThrowable=!1,i},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(s.a),h=function(t){function e(e,r,n,s){var a,c=t.call(this)||this;c._parentSubscriber=e;var u=c;return Object(i.a)(r)?a=r:r&&(a=r.next,n=r.error,s=r.complete,r!==o.a&&(u=Object.create(r),Object(i.a)(u.unsubscribe)&&c.add(u.unsubscribe.bind(u)),u.unsubscribe=c.unsubscribe.bind(c))),c._context=u,c._next=a,c._error=n,c._complete=s,c}return n.a(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;c.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,r=c.a.useDeprecatedSynchronousErrorHandling;if(this._error)r&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)r?(e.syncErrorValue=t,e.syncErrorThrown=!0):Object(u.a)(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;Object(u.a)(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};c.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),c.a.useDeprecatedSynchronousErrorHandling)throw t;Object(u.a)(t)}},e.prototype.__tryOrSetError=function(t,e,r){if(!c.a.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return c.a.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(Object(u.a)(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(f)},function(t,e,r){"use strict";r.r(e),r.d(e,"InvalidAddressError",(function(){return _})),r.d(e,"InvalidBlockHashError",(function(){return S})),r.d(e,"InvalidContractAddressError",(function(){return w})),r.d(e,"InvalidKeyHashError",(function(){return E})),r.d(e,"InvalidMessageError",(function(){return y})),r.d(e,"InvalidOperationHashError",(function(){return O})),r.d(e,"InvalidProtocolHashError",(function(){return A})),r.d(e,"InvalidPublicKeyError",(function(){return m})),r.d(e,"InvalidSignatureError",(function(){return v})),r.d(e,"Prefix",(function(){return n})),r.d(e,"VERSION",(function(){return W})),r.d(e,"ValidationResult",(function(){return R})),r.d(e,"b58cdecode",(function(){return X})),r.d(e,"b58cencode",(function(){return Z})),r.d(e,"b58decode",(function(){return Q})),r.d(e,"buf2hex",(function(){return st})),r.d(e,"bytes2Char",(function(){return ut})),r.d(e,"char2Bytes",(function(){return ct})),r.d(e,"encodeExpr",(function(){return Y})),r.d(e,"encodeKey",(function(){return et})),r.d(e,"encodeKeyHash",(function(){return rt})),r.d(e,"encodeOpHash",(function(){return J})),r.d(e,"encodePubKey",(function(){return tt})),r.d(e,"getPkhfromPk",(function(){return at})),r.d(e,"hex2buf",(function(){return nt})),r.d(e,"isValidPrefix",(function(){return I})),r.d(e,"mergebuf",(function(){return it})),r.d(e,"mic2arr",(function(){return ot})),r.d(e,"prefix",(function(){return b})),r.d(e,"prefixLength",(function(){return g})),r.d(e,"validateAddress",(function(){return B})),r.d(e,"validateBlock",(function(){return q})),r.d(e,"validateChain",(function(){return F})),r.d(e,"validateContractAddress",(function(){return V})),r.d(e,"validateKeyHash",(function(){return K})),r.d(e,"validateOperation",(function(){return G})),r.d(e,"validatePkAndExtractPrefix",(function(){return T})),r.d(e,"validateProtocol",(function(){return z})),r.d(e,"validatePublicKey",(function(){return $})),r.d(e,"validateSignature",(function(){return H})),r.d(e,"verifySignature",(function(){return x}));var n,i=r(14),o=r(180),s=r(125),a=r(126),c=r.n(a),u=r(90),f=r.n(u),h=r(127),l=r.n(h),d=r(181),p=r.n(d);!function(t){t.TZ1="tz1",t.TZ2="tz2",t.TZ3="tz3",t.KT="KT",t.KT1="KT1",t.EDSK2="edsk2",t.SPSK="spsk",t.P2SK="p2sk",t.EDPK="edpk",t.SPPK="sppk",t.P2PK="p2pk",t.EDESK="edesk",t.SPESK="spesk",t.P2ESK="p2esk",t.EDSK="edsk",t.EDSIG="edsig",t.SPSIG="spsig",t.P2SIG="p2sig",t.SIG="sig",t.NET="Net",t.NCE="nce",t.B="B",t.O="o",t.LO="Lo",t.LLO="LLo",t.P="P",t.CO="Co",t.ID="id",t.EXPR="expr",t.TZ="TZ",t.VH="vh"}(n||(n={}));const b={[n.TZ1]:new Uint8Array([6,161,159]),[n.TZ2]:new Uint8Array([6,161,161]),[n.TZ3]:new Uint8Array([6,161,164]),[n.KT]:new Uint8Array([2,90,121]),[n.KT1]:new Uint8Array([2,90,121]),[n.EDSK]:new Uint8Array([43,246,78,7]),[n.EDSK2]:new Uint8Array([13,15,58,7]),[n.SPSK]:new Uint8Array([17,162,224,201]),[n.P2SK]:new Uint8Array([16,81,238,189]),[n.EDPK]:new Uint8Array([13,15,37,217]),[n.SPPK]:new Uint8Array([3,254,226,86]),[n.P2PK]:new Uint8Array([3,178,139,127]),[n.EDESK]:new Uint8Array([7,90,60,179,41]),[n.SPESK]:new Uint8Array([9,237,241,174,150]),[n.P2ESK]:new Uint8Array([9,48,57,115,171]),[n.EDSIG]:new Uint8Array([9,245,205,134,18]),[n.SPSIG]:new Uint8Array([13,115,101,19,63]),[n.P2SIG]:new Uint8Array([54,240,44,52]),[n.SIG]:new Uint8Array([4,130,43]),[n.NET]:new Uint8Array([87,82,0]),[n.NCE]:new Uint8Array([69,220,169]),[n.B]:new Uint8Array([1,52]),[n.O]:new Uint8Array([5,116]),[n.LO]:new Uint8Array([133,233]),[n.LLO]:new Uint8Array([29,159,109]),[n.P]:new Uint8Array([2,170]),[n.CO]:new Uint8Array([79,179]),[n.ID]:new Uint8Array([153,103]),[n.EXPR]:new Uint8Array([13,44,64,27]),[n.TZ]:new Uint8Array([2,90,121]),[n.VH]:new Uint8Array([1,106,242])},g={[n.TZ1]:20,[n.TZ2]:20,[n.TZ3]:20,[n.KT]:20,[n.KT1]:20,[n.EDPK]:32,[n.SPPK]:33,[n.P2PK]:33,[n.EDSIG]:64,[n.SPSIG]:64,[n.P2SIG]:64,[n.SIG]:64,[n.NET]:4,[n.B]:32,[n.P]:32,[n.O]:32,[n.VH]:32};class m extends Error{constructor(t){super(t),this.message=t,this.name="InvalidPublicKeyError"}}class v extends Error{constructor(t){super(t),this.message=t,this.name="InvalidSignatureError"}}class y extends Error{constructor(t){super(t),this.message=t,this.name="InvalidMessageError"}}class w extends Error{constructor(t){super(t),this.message=t,this.name="InvalidContractAddressError"}}class _ extends Error{constructor(t){super(t),this.message=t,this.name="InvalidAddressError"}}class E extends Error{constructor(t){super(t),this.message=t,this.name="InvalidKeyHashError"}}class S extends Error{constructor(t){super(t),this.message=t,this.name="InvalidBlockHashError"}}class A extends Error{constructor(t){super(t),this.message=t,this.name="InvalidProtocolHashError"}}class O extends Error{constructor(t){super(t),this.message=t,this.name="InvalidOperationHashError"}}function x(t,e,r){const i=T(e),a=function(t){const e=t.startsWith("sig")?t.substr(0,3):t.substr(0,5),r=H(t);if(r!==R.VALID){if(r===R.INVALID_CHECKSUM)throw new v(`The signature provided has an invalid checksum: ${t}`);if(r===R.INVALID_LENGTH)throw new v(`The signature provided has an invalid length: ${t}`);if(r===R.NO_PREFIX_MATCHED)throw new v(`The signature provided has an unsupported prefix: ${e}`)}return e}(r),c=X(e,b[i]),u=X(r,b[a]),f=Object(s.hash)(nt(function(t){if(""===t)throw new y("The message provided for verifying signature cannot be empty.");return t}(t)),32);return i===n.EDPK?function(t,e,r){try{return Object(o.verify)(r,e,t)}catch(t){return!1}}(u,f,c):i===n.SPPK?function(t,e,r){const n=new l.a.ec("secp256k1").keyFromPublic(r);return P(t,e,n)}(u,f,c):i===n.P2PK&&function(t,e,r){const n=new l.a.ec("p256").keyFromPublic(r);return P(t,e,n)}(u,f,c)}function T(t){if(""===t)throw new m("The public key provided cannot be empty.");const e=t.substring(0,4),r=$(t);if(r!==R.VALID){if(r===R.INVALID_CHECKSUM)throw new m(`The public key provided has an invalid checksum: ${t}`);if(r===R.INVALID_LENGTH)throw new m(`The public key provided has an invalid length: ${t}`);if(r===R.NO_PREFIX_MATCHED)throw new m(`The public key provided has an unsupported prefix: ${e}`)}return e}function P(t,e,r){const n=st(p()(t)).match(/([a-f\d]{64})/gi);if(n)try{const[t,i]=n;return r.verify(e,{r:t,s:i})}catch(t){return!1}return!1}var R;function I(t){return"string"==typeof t&&t in b}function M(t,e){const r=new RegExp(`^(${e.join("|")})`).exec(t);if(!r||0===r.length)return R.NO_PREFIX_MATCHED;const n=r[0];if(!I(n))return R.NO_PREFIX_MATCHED;const i=/^(KT1\w{33})(%(.*))?/.exec(t);i&&(t=i[1]);let o=f.a.decodeUnsafe(t);return o?(o=o.slice(b[n].length),o.length!==g[n]?R.INVALID_LENGTH:R.VALID):R.INVALID_CHECKSUM}!function(t){t[t.NO_PREFIX_MATCHED=0]="NO_PREFIX_MATCHED",t[t.INVALID_CHECKSUM=1]="INVALID_CHECKSUM",t[t.INVALID_LENGTH=2]="INVALID_LENGTH",t[t.VALID=3]="VALID"}(R||(R={}));const N=[n.TZ1,n.TZ2,n.TZ3],k=[n.KT1],C=[n.EDSIG,n.P2SIG,n.SPSIG,n.SIG],L=[n.EDPK,n.SPPK,n.P2PK],j=[n.O],D=[n.P],U=[n.B];function B(t){return M(t,[...N,...k])}function F(t){return M(t,[n.NET])}function V(t){return M(t,k)}function K(t){return M(t,N)}function H(t){return M(t,C)}function $(t){return M(t,L)}function G(t){return M(t,j)}function z(t){return M(t,D)}function q(t){return M(t,U)}const W={commitHash:"5da8cec9c84c0ab7bc37c0eb09e68db1b3a8b1f0",version:"12.0.0-beta-RC.0"};function Y(t){return Z(c.a.blake2b(nt(t),void 0,32),b.expr)}function J(t){return Z(c.a.blake2b(nt(t),void 0,32),b.o)}function Z(t,e){const r="string"==typeof t?Uint8Array.from(i.Buffer.from(t,"hex")):t,n=new Uint8Array(e.length+r.length);return n.set(e),n.set(r,e.length),f.a.encode(i.Buffer.from(n.buffer))}const X=(t,e)=>f.a.decode(t).slice(e.length);function Q(t){const e=f.a.decode(t),r={[b.tz1.toString()]:"0000",[b.tz2.toString()]:"0001",[b.tz3.toString()]:"0002"}[new Uint8Array(e.slice(0,3)).toString()];if(r){return r+st(e.slice(3))}return"01"+st(e.slice(3,42))+"00"}function tt(t){if("00"===t.substring(0,2)){const e={"0000":b.tz1,"0001":b.tz2,"0002":b.tz3};return Z(t.substring(4),e[t.substring(0,4)])}return Z(t.substring(2,42),b.KT)}function et(t){if("0"===t[0]){const e={"00":new Uint8Array([13,15,37,217]),"01":new Uint8Array([3,254,226,86]),"02":new Uint8Array([3,178,139,127])};return Z(t.substring(2),e[t.substring(0,2)])}}function rt(t){if("0"===t[0]){const e={"00":new Uint8Array([6,161,159]),"01":new Uint8Array([6,161,161]),"02":new Uint8Array([6,161,164])};return Z(t.substring(2),e[t.substring(0,2)])}}const nt=t=>{const e=t.match(/[\da-f]{2}/gi);if(e)return new Uint8Array(e.map((t=>parseInt(t,16))));throw new Error(`Unable to convert ${t} to a Uint8Array`)},it=(t,e)=>{const r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r},ot=function t(e){let r=[];if(Object.prototype.hasOwnProperty.call(e,"prim"))"Pair"===e.prim?(r.push(t(e.args[0])),r=r.concat(t(e.args[1]))):"Elt"===e.prim?r={key:t(e.args[0]),val:t(e.args[1])}:"True"===e.prim?r=!0:"False"===e.prim&&(r=!1);else if(Array.isArray(e)){const n=e.length;for(let i=0;i<n;i++){const n=t(e[i]);void 0!==n.key?(Array.isArray(r)&&(r={keys:[],vals:[]}),r.keys.push(n.key),r.vals.push(n.val)):r.push(n)}}else r=Object.prototype.hasOwnProperty.call(e,"string")?e.string:Object.prototype.hasOwnProperty.call(e,"int")?parseInt(e.int,10):e;return r},st=t=>{const e=new Uint8Array(t),r=[];return e.forEach((t=>{const e=`00${t.toString(16)}`.slice(-2);r.push(e)})),r.join("")},at=t=>{let e,r;const i=T(t),o=X(t,b[i]);switch(i){case n.EDPK:e=b[n.TZ1],r=g[n.TZ1];break;case n.SPPK:e=b[n.TZ2],r=g[n.TZ2];break;case n.P2PK:e=b[n.TZ3],r=g[n.TZ3]}return Z(Object(s.hash)(o,r),e)};function ct(t){return i.Buffer.from(t,"utf8").toString("hex")}function ut(t){return i.Buffer.from(nt(t)).toString("utf8")}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a})),r.d(e,"b",(function(){return c})),r.d(e,"c",(function(){return u}));var n=r(0),i=r(1),o=r(4),s=r(45),a=function(t){function e(e){var r=t.call(this)||this;return r.parent=e,r}return n.a(e,t),e.prototype._next=function(t){this.parent.notifyNext(t)},e.prototype._error=function(t){this.parent.notifyError(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(),this.unsubscribe()},e}(i.a),c=(i.a,function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n.a(e,t),e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(){this.destination.complete()},e}(i.a));i.a;function u(t,e){if(!e.closed){if(t instanceof o.a)return t.subscribe(e);var r;try{r=Object(s.a)(t)(e)}catch(t){e.error(t)}return r}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return f}));var n=r(74),i=r(1),o=r(56),s=r(76);var a=r(28),c=r(54),u=r(16),f=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,a=function(t,e,r){if(t){if(t instanceof i.a)return t;if(t[o.a])return t[o.a]()}return t||e||r?new i.a(t,e,r):new i.a(s.a)}(t,e,r);if(n?a.add(n.call(a,this.source)):a.add(this.source||u.a.useDeprecatedSynchronousErrorHandling&&!a.syncErrorThrowable?this._subscribe(a):this._trySubscribe(a)),u.a.useDeprecatedSynchronousErrorHandling&&a.syncErrorThrowable&&(a.syncErrorThrowable=!1,a.syncErrorThrown))throw a.syncErrorValue;return a},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){u.a.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),Object(n.a)(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=h(e))((function(e,n){var i;i=r.subscribe((function(e){try{t(e)}catch(t){n(t),i&&i.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[a.a]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:Object(c.b)(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=h(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function h(t){if(t||(t=u.a.Promise||Promise),!t)throw new Error("no Promise impl found");return t}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(8),i=r(73),o=r(32),s=r(57),a=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var e;if(!this.closed){var r=this,a=r._parentOrParents,u=r._ctorUnsubscribe,f=r._unsubscribe,h=r._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,a instanceof t)a.remove(this);else if(null!==a)for(var l=0;l<a.length;++l){a[l].remove(this)}if(Object(o.a)(f)){u&&(this._unsubscribe=void 0);try{f.call(this)}catch(t){e=t instanceof s.a?c(t.errors):[t]}}if(Object(n.a)(h)){l=-1;for(var d=h.length;++l<d;){var p=h[l];if(Object(i.a)(p))try{p.unsubscribe()}catch(t){e=e||[],t instanceof s.a?e=e.concat(c(t.errors)):e.push(t)}}}if(e)throw new s.a(e)}},t.prototype.add=function(e){var r=e;if(!e)return t.EMPTY;switch(typeof e){case"function":r=new t(e);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof t)){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var i=r._parentOrParents;if(null===i)r._parentOrParents=this;else if(i instanceof t){if(i===this)return r;r._parentOrParents=[i,this]}else{if(-1!==i.indexOf(this))return r;i.push(this)}var o=this._subscriptions;return null===o?this._subscriptions=[r]:o.push(r),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.EMPTY=((e=new t).closed=!0,e),t}();function c(t){return t.reduce((function(t,e){return t.concat(e instanceof s.a?e.errors:e)}),[])}},function(t,e,r){"use strict";r.d(e,"b",(function(){return f})),r.d(e,"a",(function(){return h}));var n=r(0),i=r(4),o=r(1),s=r(5),a=r(29),c=r(108),u=r(56),f=function(t){function e(e){var r=t.call(this,e)||this;return r.destination=e,r}return n.a(e,t),e}(o.a),h=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return n.a(e,t),e.prototype[u.a]=function(){return new f(this)},e.prototype.lift=function(t){var e=new l(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new a.a;if(!this.isStopped)for(var e=this.observers,r=e.length,n=e.slice(),i=0;i<r;i++)n[i].next(t)},e.prototype.error=function(t){if(this.closed)throw new a.a;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,r=e.length,n=e.slice(),i=0;i<r;i++)n[i].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new a.a;this.isStopped=!0;for(var t=this.observers,e=t.length,r=t.slice(),n=0;n<e;n++)r[n].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new a.a;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new a.a;return this.hasError?(t.error(this.thrownError),s.a.EMPTY):this.isStopped?(t.complete(),s.a.EMPTY):(this.observers.push(t),new c.a(this,t))},e.prototype.asObservable=function(){var t=new i.a;return t.source=this,t},e.create=function(t,e){return new l(t,e)},e}(i.a),l=function(t){function e(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return n.a(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):s.a.EMPTY},e}(h)},function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"a",(function(){return o}));var n=r(40),i=new(r(38).a)(n.a),o=i},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));var n=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(0),i=r(1);function o(t,e){return function(r){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new s(t,e))}}var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.thisArg))},t}(),a=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.project=r,i.count=0,i.thisArg=n||i,i}return n.a(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.a)},function(t,e,r){"use strict";function n(t){return t&&"function"==typeof t.schedule}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return i})),r.d(e,"b",(function(){return o}));var n=r(4),i=new n.a((function(t){return t.complete()}));function o(t){return t?function(t){return new n.a((function(e){return t.schedule((function(){return e.complete()}))}))}(t):i}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(4),i=r(45),o=r(107);function s(t,e){return e?Object(o.a)(t,e):t instanceof n.a?t:new n.a(Object(i.a)(t))}},function(t,e,r){"use strict";(function(t){var n=r(201),i=r(202),o=r(136);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=c.prototype:(null===t&&(t=new c(e)),t.length=e),t}function c(t,e,r){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return u(this,t,e,r)}function u(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);c.TYPED_ARRAY_SUPPORT?(t=e).__proto__=c.prototype:t=l(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!c.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(e,r),i=(t=a(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(c.isBuffer(e)){var r=0|d(e.length);return 0===(t=a(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):l(t,e);if("Buffer"===e.type&&o(e.data))return l(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(f(e),t=a(t,e<0?0:0|d(e)),!c.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function l(t,e){var r=e.length<0?0:0|d(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function d(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,e){if(c.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return K(t).length;default:if(n)return V(t).length;e=(""+e).toLowerCase(),n=!0}}function b(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return P(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return O(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function m(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=c.from(e,n)),c.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,s=1,a=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var f=-1;for(o=r;o<a;o++)if(u(t,o)===u(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===c)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){for(var h=!0,l=0;l<c;l++)if(u(t,o+l)!==u(e,l)){h=!1;break}if(h)return o}return-1}function y(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function w(t,e,r,n){return H(V(e,t.length-r),t,r,n)}function _(t,e,r,n){return H(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return _(t,e,r,n)}function S(t,e,r,n){return H(K(e),t,r,n)}function A(t,e,r,n){return H(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function O(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,c,u=t[i],f=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(f=u);break;case 2:128==(192&(o=t[i+1]))&&(c=(31&u)<<6|63&o)>127&&(f=c);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(f=c)}null===f?(f=65533,h=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=h}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=T));return r}(n)}e.Buffer=c,e.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},e.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),c.poolSize=8192,c._augment=function(t){return t.__proto__=c.prototype,t},c.from=function(t,e,r){return u(null,t,e,r)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(t,e,r){return function(t,e,r,n){return f(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},c.allocUnsafe=function(t){return h(null,t)},c.allocUnsafeSlow=function(t){return h(null,t)},c.isBuffer=function(t){return!(null==t||!t._isBuffer)},c.compare=function(t,e){if(!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},c.isEncoding=function(t){switch(String(t).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}},c.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=c.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var s=t[r];if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},c.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},c.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},c.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?x(this,0,t):b.apply(this,arguments)},c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},c.prototype.compare=function(t,e,r,n,i){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),u=this.slice(n,i),f=t.slice(e,r),h=0;h<a;++h)if(u[h]!==f[h]){o=u[h],s=f[h];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},c.prototype.indexOf=function(t,e,r){return m(this,t,e,r,!0)},c.prototype.lastIndexOf=function(t,e,r){return m(this,t,e,r,!1)},c.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return y(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return _(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function P(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function R(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function I(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=F(t[o]);return i}function M(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function N(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function k(t,e,r,n,i,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function C(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function L(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function j(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,o){return o||j(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,o){return o||j(t,0,r,8),i.write(t,e,r,n,52,8),r+8}c.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),c.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=c.prototype;else{var i=e-t;r=new c(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},c.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},c.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},c.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},c.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||k(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},c.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||k(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},c.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):C(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):C(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):L(this,t,e,!0),e+4},c.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},c.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},c.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},c.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):C(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):C(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):L(this,t,e,!0),e+4},c.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},c.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},c.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},c.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},c.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},c.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},c.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=c.isBuffer(t)?t:V(new c(t,n).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var B=/[^+\/0-9A-Za-z-_]/g;function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function V(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=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((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function K(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(B,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(42))},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(0),i=function(t){function e(e,r,n){var i=t.call(this)||this;return i.parent=e,i.outerValue=r,i.outerIndex=n,i.index=0,i}return n.a(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(r(1).a),o=r(45),s=r(4);function a(t,e,r,n,a){if(void 0===a&&(a=new i(t,r,n)),!a.closed)return e instanceof s.a?e.subscribe(a):Object(o.a)(e)(a)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=!1,i={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;n=t},get useDeprecatedSynchronousErrorHandling(){return n}}},function(t,e,r){"use strict";function n(t){return t}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";var n=r(128),i=Object.prototype.toString;function o(t){return Array.isArray(t)}function s(t){return void 0===t}function a(t){return"[object ArrayBuffer]"===i.call(t)}function c(t){return null!==t&&"object"==typeof t}function u(t){if("[object Object]"!==i.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function f(t){return"[object Function]"===i.call(t)}function h(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),o(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}t.exports={isArray:o,isArrayBuffer:a,isBuffer:function(t){return null!==t&&!s(t)&&null!==t.constructor&&!s(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"[object FormData]"===i.call(t)},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&a(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:c,isPlainObject:u,isUndefined:s,isDate:function(t){return"[object Date]"===i.call(t)},isFile:function(t){return"[object File]"===i.call(t)},isBlob:function(t){return"[object Blob]"===i.call(t)},isFunction:f,isStream:function(t){return c(t)&&f(t.pipe)},isURLSearchParams:function(t){return"[object URLSearchParams]"===i.call(t)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:h,merge:function t(){var e={};function r(r,n){u(e[n])&&u(r)?e[n]=t(e[n],r):u(r)?e[n]=t({},r):o(r)?e[n]=r.slice():e[n]=r}for(var n=0,i=arguments.length;n<i;n++)h(arguments[n],r);return e},extend:function(t,e,r){return h(e,(function(e,i){t[i]=r&&"function"==typeof e?n(e,r):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n.a(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(r(1).a)},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(0),i=r(1);function o(t,e){return function(r){return r.lift(new s(t,e))}}var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.predicate,this.thisArg))},t}(),a=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.predicate=r,i.thisArg=n,i.count=0,i}return n.a(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.a)},function(t,e,r){"use strict";r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return a}));var n,i=r(11),o=r(48),s=r(67);n||(n={});var a=function(){function t(t,e,r){this.kind=t,this.value=e,this.error=r,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,r){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return r&&r()}},t.prototype.accept=function(t,e,r){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,r)},t.prototype.toObservable=function(){switch(this.kind){case"N":return Object(o.a)(this.value);case"E":return Object(s.a)(this.error);case"C":return Object(i.b)()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}()},function(t,e,r){"use strict";r.r(e),r.d(e,"METADATA_BALANCE_UPDATES_CATEGORY",(function(){return d})),r.d(e,"OpKind",(function(){return p})),r.d(e,"RpcClient",(function(){return g})),r.d(e,"RpcClientCache",(function(){return l})),r.d(e,"VERSION",(function(){return b})),r.d(e,"castToBigNumber",(function(){return h})),r.d(e,"defaultChain",(function(){return u})),r.d(e,"defaultRPCOptions",(function(){return f}));var n=r(72),i=r(89),o=r.n(i),s=r(2);function a(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}function c(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))}const u="main",f={block:"head"};function h(t,e){const r=Array.isArray(t);void 0===e&&(e=Object.keys(t));const n=r?[]:{};return e.forEach((e=>{const r=t[e];let i;if(void 0!==r){if(Array.isArray(r))return i=h(r),void(n[e]=i);i=new o.a(r),n[e]=i}})),n}class l{constructor(t,e=1e3){this.rpcClient=t,this.ttl=e,this._cache={}}getAllCachedData(){return this._cache}deleteAllCachedData(){for(const t in this._cache)delete this._cache[t]}formatCacheKey(t,e,r,n){let i="";return r.forEach((t=>{i="object"==typeof t?i+JSON.stringify(t)+"/":i+t+"/"})),n?`${t}/${e}/${i}/${JSON.stringify(n)}`:`${t}/${e}/${i}`}has(t){return t in this._cache}get(t){return this._cache[t].response}put(t,e){const r=setTimeout((()=>this.remove(t)),this.ttl);Object.assign(this._cache,{[t]:{handle:r,response:e}})}remove(t){t in this._cache&&delete this._cache[t]}validateAddress(t){if(Object(s.validateAddress)(t)!==s.ValidationResult.VALID)throw new s.InvalidAddressError(`Invalid address: ${t}`)}validateContract(t){if(Object(s.validateContractAddress)(t)!==s.ValidationResult.VALID)throw new s.InvalidContractAddressError(`Invalid contract address: ${t}`)}getBlockHash({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getBlockHash",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getBlockHash({block:t});return this.put(e,r),r}}))}getLiveBlocks({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getLiveBlocks",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getLiveBlocks({block:t});return this.put(e,r),r}}))}getBalance(t,{block:e}=f){return c(this,void 0,void 0,(function*(){this.validateAddress(t);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getBalance",[e,t]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getBalance(t,{block:e});return this.put(r,n),n}}))}getStorage(t,{block:e}=f){return c(this,void 0,void 0,(function*(){this.validateContract(t);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getStorage",[e,t]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getStorage(t,{block:e});return this.put(r,n),n}}))}getScript(t,{block:e}=f){return c(this,void 0,void 0,(function*(){this.validateContract(t);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getScript",[e,t]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getScript(t,{block:e});return this.put(r,n),n}}))}getNormalizedScript(t,e={unparsing_mode:"Readable"},{block:r}=f){return c(this,void 0,void 0,(function*(){this.validateContract(t);const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getNormalizedScript",[r,t,e]);if(this.has(n))return this.get(n);{const i=this.rpcClient.getNormalizedScript(t,e,{block:r});return this.put(n,i),i}}))}getContract(t,{block:e}=f){return c(this,void 0,void 0,(function*(){this.validateAddress(t);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getContract",[e,t]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getContract(t,{block:e});return this.put(r,n),n}}))}getManagerKey(t,{block:e}=f){return c(this,void 0,void 0,(function*(){this.validateAddress(t);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getManagerKey",[e,t]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getManagerKey(t,{block:e});return this.put(r,n),n}}))}getDelegate(t,{block:e}=f){return c(this,void 0,void 0,(function*(){this.validateAddress(t);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getDelegate",[e,t]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getDelegate(t,{block:e});return this.put(r,n),n}}))}getBigMapKey(t,e,{block:r}=f){return c(this,void 0,void 0,(function*(){this.validateAddress(t);const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getBigMapKey",[r,t,e]);if(this.has(n))return this.get(n);{const i=this.rpcClient.getBigMapKey(t,e,{block:r});return this.put(n,i),i}}))}getBigMapExpr(t,e,{block:r}=f){return c(this,void 0,void 0,(function*(){const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getBigMapExpr",[r,t,e]);if(this.has(n))return this.get(n);{const i=this.rpcClient.getBigMapExpr(t,e,{block:r});return this.put(n,i),i}}))}getDelegates(t,{block:e}=f){return c(this,void 0,void 0,(function*(){this.validateAddress(t);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getDelegates",[e,t]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getDelegates(t,{block:e});return this.put(r,n),n}}))}getConstants({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getConstants",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getConstants({block:t});return this.put(e,r),r}}))}getBlock({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getBlock",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getBlock({block:t});return this.put(e,r),r}}))}getBlockHeader({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getBlockHeader",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getBlockHeader({block:t});return this.put(e,r),r}}))}getBlockMetadata({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getBlockMetadata",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getBlockMetadata({block:t});return this.put(e,r),r}}))}getBakingRights(t={},{block:e}=f){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getBakingRights",[e,t]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getBakingRights(t,{block:e});return this.put(r,n),n}}))}getEndorsingRights(t={},{block:e}=f){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getEndorsingRights",[e,t]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getEndorsingRights(t,{block:e});return this.put(r,n),n}}))}getBallotList({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getBallotList",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getBallotList({block:t});return this.put(e,r),r}}))}getBallots({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getBallots",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getBallots({block:t});return this.put(e,r),r}}))}getCurrentProposal({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getCurrentProposal",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getCurrentProposal({block:t});return this.put(e,r),r}}))}getCurrentQuorum({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getCurrentQuorum",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getCurrentQuorum({block:t});return this.put(e,r),r}}))}getVotesListings({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getVotesListings",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getVotesListings({block:t});return this.put(e,r),r}}))}getProposals({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getProposals",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getProposals({block:t});return this.put(e,r),r}}))}forgeOperations(t,{block:e}=f){return c(this,void 0,void 0,(function*(){return this.rpcClient.forgeOperations(t,{block:e})}))}injectOperation(t){return c(this,void 0,void 0,(function*(){return this.rpcClient.injectOperation(t)}))}preapplyOperations(t,{block:e}=f){return c(this,void 0,void 0,(function*(){return this.rpcClient.preapplyOperations(t,{block:e})}))}getEntrypoints(t,{block:e}=f){return c(this,void 0,void 0,(function*(){this.validateContract(t);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getEntrypoints",[e,t]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getEntrypoints(t,{block:e});return this.put(r,n),n}}))}runOperation(t,{block:e}=f){return c(this,void 0,void 0,(function*(){return this.rpcClient.runOperation(t,{block:e})}))}runCode(t,{block:e}=f){return c(this,void 0,void 0,(function*(){return this.rpcClient.runCode(t,{block:e})}))}runView(t,{block:e}=f){var{unparsing_mode:r="Readable"}=t,n=a(t,["unparsing_mode"]);return c(this,void 0,void 0,(function*(){return this.rpcClient.runView(Object.assign({unparsing_mode:r},n),{block:e})}))}getChainId(){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getChainId",[]);if(this.has(t))return this.get(t);{const e=this.rpcClient.getChainId();return this.put(t,e),e}}))}packData(t,{block:e}=f){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),"packData",[e,t]);if(this.has(r))return this.get(r);{const n=this.rpcClient.packData(t,{block:e});return this.put(r,n),n}}))}getRpcUrl(){return this.rpcClient.getRpcUrl()}getCurrentPeriod({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getCurrentPeriod",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getCurrentPeriod({block:t});return this.put(e,r),r}}))}getSuccessorPeriod({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getSuccessorPeriod",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getSuccessorPeriod({block:t});return this.put(e,r),r}}))}getSaplingDiffById(t,{block:e}=f){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getSaplingDiffById",[e,t]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getSaplingDiffById(t,{block:e});return this.put(r,n),n}}))}getSaplingDiffByContract(t,{block:e}=f){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getSaplingDiffByContract",[e,t]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getSaplingDiffByContract(t,{block:e});return this.put(r,n),n}}))}getProtocols({block:t}=f){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),"getProtocols",[t]);if(this.has(e))return this.get(e);{const r=this.rpcClient.getProtocols({block:t});return this.put(e,r),r}}))}}var d,p;!function(t){t.BAKING_REWARDS="baking rewards",t.REWARDS="rewards",t.FEES="fees",t.DEPOSITS="deposits",t.LEGACY_REWARDS="legacy_rewards",t.LEGACY_FEES="legacy_fees",t.LEGACY_DEPOSITS="legacy_deposits",t.BLOCK_FEES="block fees",t.NONCE_REVELATION_REWARDS="nonce revelation rewards",t.DOUBLE_SIGNING_EVIDENCE_REWARDS="double signing evidence rewards",t.ENDORSING_REWARDS="endorsing rewards",t.BAKING_BONUSES="baking bonuses",t.STORAGE_FEES="storage fees",t.PUNISHMENTS="punishments",t.LOST_ENDORSING_REWARDS="lost endorsing rewards",t.SUBSIDY="subsidy",t.BURNED="burned",t.COMMITMENT="commitment",t.BOOTSTRAP="bootstrap",t.INVOICE="invoice",t.MINTED="minted"}(d||(d={})),function(t){t.ORIGINATION="origination",t.DELEGATION="delegation",t.REVEAL="reveal",t.TRANSACTION="transaction",t.ACTIVATION="activate_account",t.ENDORSEMENT="endorsement",t.PREENDORSEMENT="preendorsement",t.SET_DEPOSITS_LIMIT="set_deposits_limit",t.DOUBLE_PREENDORSEMENT_EVIDENCE="double_preendorsement_evidence",t.ENDORSEMENT_WITH_SLOT="endorsement_with_slot",t.SEED_NONCE_REVELATION="seed_nonce_revelation",t.DOUBLE_ENDORSEMENT_EVIDENCE="double_endorsement_evidence",t.DOUBLE_BAKING_EVIDENCE="double_baking_evidence",t.PROPOSALS="proposals",t.BALLOT="ballot",t.FAILING_NOOP="failing_noop",t.REGISTER_GLOBAL_CONSTANT="register_global_constant"}(p||(p={}));const b={commitHash:"5da8cec9c84c0ab7bc37c0eb09e68db1b3a8b1f0",version:"12.0.0-beta-RC.0"};class g{constructor(t,e=u,r=new n.HttpBackend){this.url=t,this.chain=e,this.httpBackend=r}createURL(t){return`${this.url.replace(/\/+$/g,"")}${t}`}validateAddress(t){if(Object(s.validateAddress)(t)!==s.ValidationResult.VALID)throw new s.InvalidAddressError(`Invalid address: ${t}`)}validateContract(t){if(Object(s.validateContractAddress)(t)!==s.ValidationResult.VALID)throw new s.InvalidAddressError(`Invalid address: ${t}`)}getBlockHash({block:t}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/hash`),method:"GET"})}))}getLiveBlocks({block:t}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/live_blocks`),method:"GET"})}))}getBalance(t,{block:e}=f){return c(this,void 0,void 0,(function*(){this.validateAddress(t);const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/contracts/${t}/balance`),method:"GET"});return new o.a(r)}))}getStorage(t,{block:e}=f){return c(this,void 0,void 0,(function*(){return this.validateContract(t),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/contracts/${t}/storage`),method:"GET"})}))}getScript(t,{block:e}=f){return c(this,void 0,void 0,(function*(){return this.validateContract(t),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/contracts/${t}/script`),method:"GET"})}))}getNormalizedScript(t,e={unparsing_mode:"Readable"},{block:r}=f){return c(this,void 0,void 0,(function*(){return this.validateContract(t),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${t}/script/normalized`),method:"POST"},e)}))}getContract(t,{block:e}=f){return c(this,void 0,void 0,(function*(){this.validateAddress(t);const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/contracts/${t}`),method:"GET"});return Object.assign(Object.assign({},r),{balance:new o.a(r.balance)})}))}getManagerKey(t,{block:e}=f){return c(this,void 0,void 0,(function*(){return this.validateAddress(t),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/contracts/${t}/manager_key`),method:"GET"})}))}getDelegate(t,{block:e}=f){return c(this,void 0,void 0,(function*(){let r;this.validateAddress(t);try{r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/contracts/${t}/delegate`),method:"GET"})}catch(t){if(!(t instanceof n.HttpResponseError&&t.status===n.STATUS_CODE.NOT_FOUND))throw t;r=null}return r}))}getBigMapKey(t,e,{block:r}=f){return c(this,void 0,void 0,(function*(){return this.validateAddress(t),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${t}/big_map_get`),method:"POST"},e)}))}getBigMapExpr(t,e,{block:r}=f){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/big_maps/${t}/${e}`),method:"GET"})}))}getDelegates(t,{block:e}=f){return c(this,void 0,void 0,(function*(){this.validateAddress(t);const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/delegates/${t}`),method:"GET"}),n=h(r,["balance","full_balance","current_frozen_deposits","frozen_deposits","frozen_balance","frozen_deposits_limit","staking_balance","delegated_balance"]);return Object.assign(Object.assign(Object.assign({},r),n),{frozen_balance_by_cycle:r.frozen_balance_by_cycle?r.frozen_balance_by_cycle.map((t=>{var{deposit:e,deposits:r,fees:n,rewards:i}=t,o=a(t,["deposit","deposits","fees","rewards"]);const s=h({deposit:e,deposits:r,fees:n,rewards:i},["deposit","deposits","fees","rewards"]);return Object.assign(Object.assign({},o),{deposit:s.deposit,deposits:s.deposits,fees:s.fees,rewards:s.rewards})})):void 0})}))}getConstants({block:t}=f){return c(this,void 0,void 0,(function*(){const e=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/constants`),method:"GET"}),r=h(e,["time_between_blocks","hard_gas_limit_per_operation","hard_gas_limit_per_block","proof_of_work_threshold","tokens_per_roll","seed_nonce_revelation_tip","block_security_deposit","endorsement_security_deposit","block_reward","endorsement_reward","cost_per_byte","hard_storage_limit_per_operation","test_chain_duration","baking_reward_per_endorsement","delay_per_missing_endorsement","minimal_block_delay","liquidity_baking_subsidy","cache_layout","baking_reward_fixed_portion","baking_reward_bonus_per_slot","endorsing_reward_per_slot","double_baking_punishment","delay_increment_per_round"]);return Object.assign(Object.assign({},e),r)}))}getBlock({block:t}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}`),method:"GET"})}))}getBlockHeader({block:t}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/header`),method:"GET"})}))}getBlockMetadata({block:t}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/metadata`),method:"GET"})}))}getBakingRights(t={},{block:e}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/helpers/baking_rights`),method:"GET",query:t})}))}getEndorsingRights(t={},{block:e}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/helpers/endorsing_rights`),method:"GET",query:t})}))}getBallotList({block:t}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/votes/ballot_list`),method:"GET"})}))}getBallots({block:t}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/votes/ballots`),method:"GET"})}))}getCurrentProposal({block:t}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/votes/current_proposal`),method:"GET"})}))}getCurrentQuorum({block:t}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/votes/current_quorum`),method:"GET"})}))}getVotesListings({block:t}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/votes/listings`),method:"GET"})}))}getProposals({block:t}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/votes/proposals`),method:"GET"})}))}forgeOperations(t,{block:e}=f){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/helpers/forge/operations`),method:"POST"},t)}))}injectOperation(t){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL("/injection/operation"),method:"POST"},t)}))}preapplyOperations(t,{block:e}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/helpers/preapply/operations`),method:"POST"},t)}))}getEntrypoints(t,{block:e}=f){return c(this,void 0,void 0,(function*(){this.validateContract(t);return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/contracts/${t}/entrypoints`),method:"GET"})}))}runOperation(t,{block:e}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/helpers/scripts/run_operation`),method:"POST"},t)}))}runCode(t,{block:e}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/helpers/scripts/run_code`),method:"POST"},t)}))}runView(t,{block:e}=f){var{unparsing_mode:r="Readable"}=t,n=a(t,["unparsing_mode"]);return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/helpers/scripts/run_view`),method:"POST"},Object.assign({unparsing_mode:r},n))}))}getChainId(){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/chain_id`),method:"GET"})}))}packData(t,{block:e}=f){return c(this,void 0,void 0,(function*(){const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/helpers/scripts/pack_data`),method:"POST"},t),{gas:n}=r,i=a(r,["gas"]);let s=n;const c=new o.a(n||"");return c.isNaN()||(s=c),Object.assign({gas:s},i)}))}getRpcUrl(){return this.url}getCurrentPeriod({block:t}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/votes/current_period`),method:"GET"})}))}getSuccessorPeriod({block:t}=f){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/votes/successor_period`),method:"GET"})}))}getSaplingDiffById(t,{block:e}=f){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/sapling/${t}/get_diff`),method:"GET"})}))}getSaplingDiffByContract(t,{block:e}=f){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/contracts/${t}/single_sapling_get_diff`),method:"GET"})}))}getProtocols({block:t}=f){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/protocols`),method:"GET"})}))}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hasMetadataWithInternalOperationResult=e.hasMetadataWithResult=e.hasMetadata=e.isSourceOp=e.isOpRequireReveal=e.isOpWithFee=e.isKind=e.findWithKind=e.attachKind=e.OpKind=void 0;var n=r(22);Object.defineProperty(e,"OpKind",{enumerable:!0,get:function(){return n.OpKind}});e.attachKind=(t,e)=>Object.assign(Object.assign({},t),{kind:e});e.findWithKind=(t,r)=>{if(Array.isArray(t)){const n=t.find((t=>t.kind===r));if(n&&e.isKind(n,r))return n}};e.isKind=(t,e)=>t.kind===e;e.isOpWithFee=t=>-1!==["transaction","delegation","origination","reveal","register_global_constant"].indexOf(t.kind);e.isOpRequireReveal=t=>-1!==["transaction","delegation","origination","register_global_constant"].indexOf(t.kind);e.isSourceOp=t=>-1!==["transaction","delegation","origination","reveal","ballot"].indexOf(t.kind);e.hasMetadata=t=>"metadata"in t;e.hasMetadataWithResult=t=>e.hasMetadata(t)&&"operation_result"in t.metadata;e.hasMetadataWithInternalOperationResult=t=>e.hasMetadata(t)&&"internal_operation_results"in t.metadata},function(t,e,r){"use strict";function n(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}r.d(e,"a",(function(){return i}));var i=n()},function(t,e,r){"use strict";function n(){}r.d(e,"a",(function(){return n}))},function(t,e,r){var n=r(14),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){"use strict";var n=e,i=r(43),o=r(50),s=r(151);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),s=0;s<n.length;s++){var a,c=o.andln(i-1);o.isOdd()?(a=c>(i>>1)-1?(i>>1)-c:c,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,c=t.andln(3)+i&3,u=e.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0==(1&c)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==u?c:-c,r[0].push(s),a=0==(1&u)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==c?u:-u,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));var n=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));var n=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",f=u+"Number primitive has more than 15 significant digits: ",h=1e14,l=14,d=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],b=1e7,g=1e9;function m(t){var e=0|t;return t>0||t===e?e:e-1}function v(t){for(var e,r,n=1,i=t.length,o=t[0]+"";n<i;){for(e=t[n++]+"",r=l-e.length;r--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function y(t,e){var r,n,i=t.c,o=e.c,s=t.s,a=e.s,c=t.e,u=e.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=c==u,!i||!o)return n?0:!i^r?1:-1;if(!n)return c>u^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function w(t,e,r,n){if(t<e||t>r||t!==c(t))throw Error(u+(n||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function _(t){var e=t.c.length-1;return m(t.e/l)==e&&t.c[e]%2!=0}function E(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function S(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(++e>(n=t.length)){for(i=r,e-=n;--e;i+=r);t+=i}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}o=function t(e){var r,n,i,o,A,O,x,T,P,R,I=$.prototype={constructor:$,toString:null,valueOf:null},M=new $(1),N=20,k=4,C=-7,L=21,j=-1e7,D=1e7,U=!1,B=1,F=0,V={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",H=!0;function $(t,e){var r,o,a,u,h,p,b,g,m=this;if(!(m instanceof $))return new $(t,e);if(null==e){if(t&&!0===t._isBigNumber)return m.s=t.s,void(!t.c||t.e>D?m.c=m.e=null:t.e<j?m.c=[m.e=0]:(m.e=t.e,m.c=t.c.slice()));if((p="number"==typeof t)&&0*t==0){if(m.s=1/t<0?(t=-t,-1):1,t===~~t){for(u=0,h=t;h>=10;h/=10,u++);return void(u>D?m.c=m.e=null:(m.e=u,m.c=[t]))}g=String(t)}else{if(!s.test(g=String(t)))return i(m,g,p);m.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(h=g.search(/e/i))>0?(u<0&&(u=h),u+=+g.slice(h+1),g=g.substring(0,h)):u<0&&(u=g.length)}else{if(w(e,2,K.length,"Base"),10==e&&H)return W(m=new $(t),N+m.e+1,k);if(g=String(t),p="number"==typeof t){if(0*t!=0)return i(m,g,p,e);if(m.s=1/t<0?(g=g.slice(1),-1):1,$.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(f+t)}else m.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(r=K.slice(0,e),u=h=0,b=g.length;h<b;h++)if(r.indexOf(o=g.charAt(h))<0){if("."==o){if(h>u){u=b;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,h=-1,u=0;continue}return i(m,String(t),p,e)}p=!1,(u=(g=n(g,e,10,m.s)).indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(h=0;48===g.charCodeAt(h);h++);for(b=g.length;48===g.charCodeAt(--b););if(g=g.slice(h,++b)){if(b-=h,p&&$.DEBUG&&b>15&&(t>d||t!==c(t)))throw Error(f+m.s*t);if((u=u-h-1)>D)m.c=m.e=null;else if(u<j)m.c=[m.e=0];else{if(m.e=u,m.c=[],h=(u+1)%l,u<0&&(h+=l),h<b){for(h&&m.c.push(+g.slice(0,h)),b-=l;h<b;)m.c.push(+g.slice(h,h+=l));h=l-(g=g.slice(h)).length}else h-=b;for(;h--;g+="0");m.c.push(+g)}}else m.c=[m.e=0]}function G(t,e,r,n){var i,o,s,a,c;if(null==r?r=k:w(r,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==e)c=v(t.c),c=1==n||2==n&&(s<=C||s>=L)?E(c,s):S(c,s,"0");else if(o=(t=W(new $(t),e,r)).e,a=(c=v(t.c)).length,1==n||2==n&&(e<=o||o<=C)){for(;a<e;c+="0",a++);c=E(c,o)}else if(e-=s,c=S(c,o,"0"),o+1>a){if(--e>0)for(c+=".";e--;c+="0");}else if((e+=o-a)>0)for(o+1==a&&(c+=".");e--;c+="0");return t.s<0&&i?"-"+c:c}function z(t,e){for(var r,n=1,i=new $(t[0]);n<t.length;n++){if(!(r=new $(t[n])).s){i=r;break}e.call(i,r)&&(i=r)}return i}function q(t,e,r){for(var n=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,n++);return(r=n+r*l-1)>D?t.c=t.e=null:r<j?t.c=[t.e=0]:(t.e=r,t.c=e),t}function W(t,e,r,n){var i,o,s,u,f,d,b,g=t.c,m=p;if(g){t:{for(i=1,u=g[0];u>=10;u/=10,i++);if((o=e-i)<0)o+=l,s=e,b=(f=g[d=0])/m[i-s-1]%10|0;else if((d=a((o+1)/l))>=g.length){if(!n)break t;for(;g.length<=d;g.push(0));f=b=0,i=1,s=(o%=l)-l+1}else{for(f=u=g[d],i=1;u>=10;u/=10,i++);b=(s=(o%=l)-l+i)<0?0:f/m[i-s-1]%10|0}if(n=n||e<0||null!=g[d+1]||(s<0?f:f%m[i-s-1]),n=r<4?(b||n)&&(0==r||r==(t.s<0?3:2)):b>5||5==b&&(4==r||n||6==r&&(o>0?s>0?f/m[i-s]:0:g[d-1])%10&1||r==(t.s<0?8:7)),e<1||!g[0])return g.length=0,n?(e-=t.e+1,g[0]=m[(l-e%l)%l],t.e=-e||0):g[0]=t.e=0,t;if(0==o?(g.length=d,u=1,d--):(g.length=d+1,u=m[l-o],g[d]=s>0?c(f/m[i-s]%m[s])*u:0),n)for(;;){if(0==d){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(t.e++,g[0]==h&&(g[0]=1));break}if(g[d]+=u,g[d]!=h)break;g[d--]=0,u=1}for(o=g.length;0===g[--o];g.pop());}t.e>D?t.c=t.e=null:t.e<j&&(t.c=[t.e=0])}return t}function Y(t){var e,r=t.e;return null===r?t.toString():(e=v(t.c),e=r<=C||r>=L?E(e,r):S(e,r,"0"),t.s<0?"-"+e:e)}return $.clone=t,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(u+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(w(r=t[e],0,g,e),N=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(w(r=t[e],0,8,e),k=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(w(r[0],-g,0,e),w(r[1],0,g,e),C=r[0],L=r[1]):(w(r,-g,g,e),C=-(L=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)w(r[0],-g,-1,e),w(r[1],1,g,e),j=r[0],D=r[1];else{if(w(r,-g,g,e),!r)throw Error(u+e+" cannot be zero: "+r);j=-(D=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(u+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw U=!r,Error(u+"crypto unavailable");U=r}else U=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(w(r=t[e],0,9,e),B=r),t.hasOwnProperty(e="POW_PRECISION")&&(w(r=t[e],0,g,e),F=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(u+e+" not an object: "+r);V=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+e+" invalid: "+r);H="0123456789"==r.slice(0,10),K=r}}return{DECIMAL_PLACES:N,ROUNDING_MODE:k,EXPONENTIAL_AT:[C,L],RANGE:[j,D],CRYPTO:U,MODULO_MODE:B,POW_PRECISION:F,FORMAT:V,ALPHABET:K}},$.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!$.DEBUG)return!0;var e,r,n=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===c(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((e=(i+1)%l)<1&&(e+=l),String(n[0]).length==e){for(e=0;e<n.length;e++)if((r=n[e])<0||r>=h||r!==c(r))break t;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(u+"Invalid BigNumber: "+t)},$.maximum=$.max=function(){return z(arguments,I.lt)},$.minimum=$.min=function(){return z(arguments,I.gt)},$.random=(o=9007199254740992,A=Math.random()*o&2097151?function(){return c(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,n,i,o,s=0,f=[],h=new $(M);if(null==t?t=N:w(t,0,g),i=a(t/l),U)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)(o=131072*e[s]+(e[s+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[s]=r[0],e[s+1]=r[1]):(f.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw U=!1,Error(u+"crypto unavailable");for(e=crypto.randomBytes(i*=7);s<i;)(o=281474976710656*(31&e[s])+1099511627776*e[s+1]+4294967296*e[s+2]+16777216*e[s+3]+(e[s+4]<<16)+(e[s+5]<<8)+e[s+6])>=9e15?crypto.randomBytes(7).copy(e,s):(f.push(o%1e14),s+=7);s=i/7}if(!U)for(;s<i;)(o=A())<9e15&&(f[s++]=o%1e14);for(i=f[--s],t%=l,i&&t&&(o=p[l-t],f[s]=c(i/o)*o);0===f[s];f.pop(),s--);if(s<0)f=[n=0];else{for(n=-1;0===f[0];f.splice(0,1),n-=l);for(s=1,o=f[0];o>=10;o/=10,s++);s<l&&(n-=l-s)}return h.e=n,h.c=f,h}),$.sum=function(){for(var t=1,e=arguments,r=new $(e[0]);t<e.length;)r=r.plus(e[t++]);return r},n=function(){var t="0123456789";function e(t,e,r,n){for(var i,o,s=[0],a=0,c=t.length;a<c;){for(o=s.length;o--;s[o]*=e);for(s[0]+=n.indexOf(t.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 c,u,f,h,l,d,p,b,g=n.indexOf("."),m=N,y=k;for(g>=0&&(h=F,F=0,n=n.replace(".",""),d=(b=new $(i)).pow(n.length-g),F=h,b.c=e(S(v(d.c),d.e,"0"),10,o,t),b.e=b.c.length),f=h=(p=e(n,i,o,a?(c=K,t):(c=t,K))).length;0==p[--h];p.pop());if(!p[0])return c.charAt(0);if(g<0?--f:(d.c=p,d.e=f,d.s=s,p=(d=r(d,b,m,y,o)).c,l=d.r,f=d.e),g=p[u=f+m+1],h=o/2,l=l||u<0||null!=p[u+1],l=y<4?(null!=g||l)&&(0==y||y==(d.s<0?3:2)):g>h||g==h&&(4==y||l||6==y&&1&p[u-1]||y==(d.s<0?8:7)),u<1||!p[0])n=l?S(c.charAt(1),-m,c.charAt(0)):c.charAt(0);else{if(p.length=u,l)for(--o;++p[--u]>o;)p[u]=0,u||(++f,p=[1].concat(p));for(h=p.length;!p[--h];);for(g=0,n="";g<=h;n+=c.charAt(p[g++]));n=S(n,f,c.charAt(0))}return n}}(),r=function(){function t(t,e,r){var n,i,o,s,a=0,c=t.length,u=e%b,f=e/b|0;for(t=t.slice();c--;)a=((i=u*(o=t[c]%b)+(n=f*o+(s=t[c]/b|0)*u)%b*b+a)/r|0)+(n/b|0)+f*s,t[c]=i%r;return a&&(t=[a].concat(t)),t}function e(t,e,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,i,o,s,a){var u,f,d,p,b,g,v,y,w,_,E,S,A,O,x,T,P,R=n.s==i.s?1:-1,I=n.c,M=i.c;if(!(I&&I[0]&&M&&M[0]))return new $(n.s&&i.s&&(I?!M||I[0]!=M[0]:M)?I&&0==I[0]||!M?0*R:R/0:NaN);for(w=(y=new $(R)).c=[],R=o+(f=n.e-i.e)+1,a||(a=h,f=m(n.e/l)-m(i.e/l),R=R/l|0),d=0;M[d]==(I[d]||0);d++);if(M[d]>(I[d]||0)&&f--,R<0)w.push(1),p=!0;else{for(O=I.length,T=M.length,d=0,R+=2,(b=c(a/(M[0]+1)))>1&&(M=t(M,b,a),I=t(I,b,a),T=M.length,O=I.length),A=T,E=(_=I.slice(0,T)).length;E<T;_[E++]=0);P=M.slice(),P=[0].concat(P),x=M[0],M[1]>=a/2&&x++;do{if(b=0,(u=e(M,_,T,E))<0){if(S=_[0],T!=E&&(S=S*a+(_[1]||0)),(b=c(S/x))>1)for(b>=a&&(b=a-1),v=(g=t(M,b,a)).length,E=_.length;1==e(g,_,v,E);)b--,r(g,T<v?P:M,v,a),v=g.length,u=1;else 0==b&&(u=b=1),v=(g=M.slice()).length;if(v<E&&(g=[0].concat(g)),r(_,g,E,a),E=_.length,-1==u)for(;e(M,_,T,E)<1;)b++,r(_,T<E?P:M,E,a),E=_.length}else 0===u&&(b++,_=[0]);w[d++]=b,_[0]?_[E++]=I[A]||0:(_=[I[A]],E=1)}while((A++<O||null!=_[0])&&R--);p=null!=_[0],w[0]||w.splice(0,1)}if(a==h){for(d=1,R=w[0];R>=10;R/=10,d++);W(y,o+(y.e=d+f*l-1)+1,s,p)}else y.e=f,y.r=+p;return y}}(),O=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,T=/^\.([^.]+)$/,P=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,r,n){var i,o=r?e:e.replace(R,"");if(P.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(O,(function(t,e,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?t:e})),n&&(i=n,o=o.replace(x,"$1").replace(T,"0.$1")),e!=o))return new $(o,i);if($.DEBUG)throw Error(u+"Not a"+(n?" base "+n:"")+" number: "+e);t.s=null}t.c=t.e=null},I.absoluteValue=I.abs=function(){var t=new $(this);return t.s<0&&(t.s=1),t},I.comparedTo=function(t,e){return y(this,new $(t,e))},I.decimalPlaces=I.dp=function(t,e){var r,n,i,o=this;if(null!=t)return w(t,0,g),null==e?e=k:w(e,0,8),W(new $(o),t+o.e+1,e);if(!(r=o.c))return null;if(n=((i=r.length-1)-m(this.e/l))*l,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},I.dividedBy=I.div=function(t,e){return r(this,new $(t,e),N,k)},I.dividedToIntegerBy=I.idiv=function(t,e){return r(this,new $(t,e),0,1)},I.exponentiatedBy=I.pow=function(t,e){var r,n,i,o,s,f,h,d,p=this;if((t=new $(t)).c&&!t.isInteger())throw Error(u+"Exponent not an integer: "+Y(t));if(null!=e&&(e=new $(e)),s=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return d=new $(Math.pow(+Y(p),s?2-_(t):+Y(t))),e?d.mod(e):d;if(f=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new $(NaN);(n=!f&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&_(t)?-0:0,p.e>-1&&(o=1/o),new $(f?1/o:o);F&&(o=a(F/l+2))}for(s?(r=new $(.5),f&&(t.s=1),h=_(t)):h=(i=Math.abs(+Y(t)))%2,d=new $(M);;){if(h){if(!(d=d.times(p)).c)break;o?d.c.length>o&&(d.c.length=o):n&&(d=d.mod(e))}if(i){if(0===(i=c(i/2)))break;h=i%2}else if(W(t=t.times(r),t.e+1,1),t.e>14)h=_(t);else{if(0===(i=+Y(t)))break;h=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(e))}return n?d:(f&&(d=M.div(d)),e?d.mod(e):o?W(d,F,k,undefined):d)},I.integerValue=function(t){var e=new $(this);return null==t?t=k:w(t,0,8),W(e,e.e+1,t)},I.isEqualTo=I.eq=function(t,e){return 0===y(this,new $(t,e))},I.isFinite=function(){return!!this.c},I.isGreaterThan=I.gt=function(t,e){return y(this,new $(t,e))>0},I.isGreaterThanOrEqualTo=I.gte=function(t,e){return 1===(e=y(this,new $(t,e)))||0===e},I.isInteger=function(){return!!this.c&&m(this.e/l)>this.c.length-2},I.isLessThan=I.lt=function(t,e){return y(this,new $(t,e))<0},I.isLessThanOrEqualTo=I.lte=function(t,e){return-1===(e=y(this,new $(t,e)))||0===e},I.isNaN=function(){return!this.s},I.isNegative=function(){return this.s<0},I.isPositive=function(){return this.s>0},I.isZero=function(){return!!this.c&&0==this.c[0]},I.minus=function(t,e){var r,n,i,o,s=this,a=s.s;if(e=(t=new $(t,e)).s,!a||!e)return new $(NaN);if(a!=e)return t.s=-e,s.plus(t);var c=s.e/l,u=t.e/l,f=s.c,d=t.c;if(!c||!u){if(!f||!d)return f?(t.s=-e,t):new $(d?s:NaN);if(!f[0]||!d[0])return d[0]?(t.s=-e,t):new $(f[0]?s:3==k?-0:0)}if(c=m(c),u=m(u),f=f.slice(),a=c-u){for((o=a<0)?(a=-a,i=f):(u=c,i=d),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(n=(o=(a=f.length)<(e=d.length))?a:e,a=e=0;e<n;e++)if(f[e]!=d[e]){o=f[e]<d[e];break}if(o&&(i=f,f=d,d=i,t.s=-t.s),(e=(n=d.length)-(r=f.length))>0)for(;e--;f[r++]=0);for(e=h-1;n>a;){if(f[--n]<d[n]){for(r=n;r&&!f[--r];f[r]=e);--f[r],f[n]+=h}f[n]-=d[n]}for(;0==f[0];f.splice(0,1),--u);return f[0]?q(t,f,u):(t.s=3==k?-1:1,t.c=[t.e=0],t)},I.modulo=I.mod=function(t,e){var n,i,o=this;return t=new $(t,e),!o.c||!t.s||t.c&&!t.c[0]?new $(NaN):!t.c||o.c&&!o.c[0]?new $(o):(9==B?(i=t.s,t.s=1,n=r(o,t,0,3),t.s=i,n.s*=i):n=r(o,t,0,B),(t=o.minus(n.times(t))).c[0]||1!=B||(t.s=o.s),t)},I.multipliedBy=I.times=function(t,e){var r,n,i,o,s,a,c,u,f,d,p,g,v,y,w,_=this,E=_.c,S=(t=new $(t,e)).c;if(!(E&&S&&E[0]&&S[0]))return!_.s||!t.s||E&&!E[0]&&!S||S&&!S[0]&&!E?t.c=t.e=t.s=null:(t.s*=_.s,E&&S?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=m(_.e/l)+m(t.e/l),t.s*=_.s,(c=E.length)<(d=S.length)&&(v=E,E=S,S=v,i=c,c=d,d=i),i=c+d,v=[];i--;v.push(0));for(y=h,w=b,i=d;--i>=0;){for(r=0,p=S[i]%w,g=S[i]/w|0,o=i+(s=c);o>i;)r=((u=p*(u=E[--s]%w)+(a=g*u+(f=E[s]/w|0)*p)%w*w+v[o]+r)/y|0)+(a/w|0)+g*f,v[o--]=u%y;v[o]=r}return r?++n:v.splice(0,1),q(t,v,n)},I.negated=function(){var t=new $(this);return t.s=-t.s||null,t},I.plus=function(t,e){var r,n=this,i=n.s;if(e=(t=new $(t,e)).s,!i||!e)return new $(NaN);if(i!=e)return t.s=-e,n.minus(t);var o=n.e/l,s=t.e/l,a=n.c,c=t.c;if(!o||!s){if(!a||!c)return new $(i/0);if(!a[0]||!c[0])return c[0]?t:new $(a[0]?n:0*i)}if(o=m(o),s=m(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(e=c.length)<0&&(r=c,c=a,a=r,e=i),i=0;e;)i=(a[--e]=a[e]+c[e]+i)/h|0,a[e]=h===a[e]?0:a[e]%h;return i&&(a=[i].concat(a),++s),q(t,a,s)},I.precision=I.sd=function(t,e){var r,n,i,o=this;if(null!=t&&t!==!!t)return w(t,1,g),null==e?e=k:w(e,0,8),W(new $(o),t,e);if(!(r=o.c))return null;if(n=(i=r.length-1)*l+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return t&&o.e+1>n&&(n=o.e+1),n},I.shiftedBy=function(t){return w(t,-9007199254740991,d),this.times("1e"+t)},I.squareRoot=I.sqrt=function(){var t,e,n,i,o,s=this,a=s.c,c=s.s,u=s.e,f=N+4,h=new $("0.5");if(1!==c||!a||!a[0])return new $(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Y(s)))||c==1/0?(((e=v(a)).length+u)%2==0&&(e+="0"),c=Math.sqrt(+e),u=m((u+1)/2)-(u<0||u%2),n=new $(e=c==1/0?"5e"+u:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+u)):n=new $(c+""),n.c[0])for((c=(u=n.e)+f)<3&&(c=0);;)if(o=n,n=h.times(o.plus(r(s,o,f,1))),v(o.c).slice(0,c)===(e=v(n.c)).slice(0,c)){if(n.e<u&&--c,"9999"!=(e=e.slice(c-3,c+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(W(n,n.e+N+2,1),t=!n.times(n).eq(s));break}if(!i&&(W(o,o.e+N+2,0),o.times(o).eq(s))){n=o;break}f+=4,c+=4,i=1}return W(n,n.e+N+1,k,t)},I.toExponential=function(t,e){return null!=t&&(w(t,0,g),t++),G(this,t,e,1)},I.toFixed=function(t,e){return null!=t&&(w(t,0,g),t=t+this.e+1),G(this,t,e)},I.toFormat=function(t,e,r){var n,i=this;if(null==r)null!=t&&e&&"object"==typeof e?(r=e,e=null):t&&"object"==typeof t?(r=t,t=e=null):r=V;else if("object"!=typeof r)throw Error(u+"Argument not an object: "+r);if(n=i.toFixed(t,e),i.c){var o,s=n.split("."),a=+r.groupSize,c=+r.secondaryGroupSize,f=r.groupSeparator||"",h=s[0],l=s[1],d=i.s<0,p=d?h.slice(1):h,b=p.length;if(c&&(o=a,a=c,c=o,b-=o),a>0&&b>0){for(o=b%a||a,h=p.substr(0,o);o<b;o+=a)h+=f+p.substr(o,a);c>0&&(h+=f+p.slice(o)),d&&(h="-"+h)}n=l?h+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?l.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):l):h}return(r.prefix||"")+n+(r.suffix||"")},I.toFraction=function(t){var e,n,i,o,s,a,c,f,h,d,b,g,m=this,y=m.c;if(null!=t&&(!(c=new $(t)).isInteger()&&(c.c||1!==c.s)||c.lt(M)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Y(c));if(!y)return new $(m);for(e=new $(M),h=n=new $(M),i=f=new $(M),g=v(y),s=e.e=g.length-m.e-1,e.c[0]=p[(a=s%l)<0?l+a:a],t=!t||c.comparedTo(e)>0?s>0?e:h:c,a=D,D=1/0,c=new $(g),f.c[0]=0;d=r(c,e,0,1),1!=(o=n.plus(d.times(i))).comparedTo(t);)n=i,i=o,h=f.plus(d.times(o=h)),f=o,e=c.minus(d.times(o=e)),c=o;return o=r(t.minus(n),i,0,1),f=f.plus(o.times(h)),n=n.plus(o.times(i)),f.s=h.s=m.s,b=r(h,i,s*=2,k).minus(m).abs().comparedTo(r(f,n,s,k).minus(m).abs())<1?[h,i]:[f,n],D=a,b},I.toNumber=function(){return+Y(this)},I.toPrecision=function(t,e){return null!=t&&w(t,1,g),G(this,t,e,2)},I.toString=function(t){var e,r=this,i=r.s,o=r.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=C||o>=L?E(v(r.c),o):S(v(r.c),o,"0"):10===t&&H?e=S(v((r=W(new $(r),N+o+1,k)).c),r.e,"0"):(w(t,2,K.length,"Base"),e=n(S(v(r.c),o,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},I.valueOf=I.toJSON=function(){return Y(this)},I._isBigNumber=!0,null!=e&&$.set(e),$}(),o.default=o.BigNumber=o,void 0===(n=function(){return o}.call(e,r,e,t))||(t.exports=n)}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));var n=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,r){"use strict";function n(t){return"function"==typeof t}r.d(e,"a",(function(){return n}))},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,u=[],f=!1,h=-1;function l(){f&&c&&(f=!1,c.length?u=c.concat(u):h=-1,u.length&&d())}function d(){if(!f){var t=a(l);f=!0;for(var e=u.length;e;){for(c=u,u=[];++h<e;)c&&c[h].run();h=-1,e=u.length}c=null,f=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function b(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new p(t,e)),1!==u.length||f||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=b,i.addListener=b,i.once=b,i.off=b,i.removeListener=b,i.removeAllListeners=b,i.emit=b,i.prependListener=b,i.prependOnceListener=b,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,r){"use strict";var n=r(50),i=r(12);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function c(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var s=t.charCodeAt(i);s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=63&s|128):o(t,i)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i<t.length;i++)r[i]=0|t[i];return r},e.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=a(t[r].toString(16));return e},e.htonl=s,e.toHex32=function(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];"little"===e&&(i=s(i)),r+=c(i.toString(16))}return r},e.zero2=a,e.zero8=c,e.join32=function(t,e,r,i){var o=r-e;n(o%4==0);for(var s=new Array(o/4),a=0,c=e;a<s.length;a++,c+=4){var u;u="big"===i?t[c]<<24|t[c+1]<<16|t[c+2]<<8|t[c+3]:t[c+3]<<24|t[c+2]<<16|t[c+1]<<8|t[c],s[a]=u>>>0}return s},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<<e|t>>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o<n?1:0)+r+i;t[e]=s>>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,s,a){var c=0,u=e;return c+=(u=u+n>>>0)<e?1:0,c+=(u=u+o>>>0)<o?1:0,t+r+i+s+(c+=(u=u+a>>>0)<a?1:0)>>>0},e.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,s,a,c,u){var f=0,h=e;return f+=(h=h+n>>>0)<e?1:0,f+=(h=h+o>>>0)<o?1:0,f+=(h=h+a>>>0)<a?1:0,t+r+i+s+c+(f+=(h=h+u>>>0)<u?1:0)>>>0},e.sum64_5_lo=function(t,e,r,n,i,o,s,a,c,u){return e+n+o+a+u>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));var n=function(){function t(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,r){"use strict";r.d(e,"b",(function(){return a})),r.d(e,"a",(function(){return f}));var n=r(0),i=r(9),o=r(13),s=r(3);function a(t,e,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"function"==typeof e?function(n){return n.pipe(a((function(r,n){return Object(o.a)(t(r,n)).pipe(Object(i.a)((function(t,i){return e(r,t,n,i)})))}),r))}:("number"==typeof e&&(r=e),function(e){return e.lift(new c(t,r))})}var c=function(){function t(t,e){void 0===e&&(e=Number.POSITIVE_INFINITY),this.project=t,this.concurrent=e}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.project,this.concurrent))},t}(),u=function(t){function e(e,r,n){void 0===n&&(n=Number.POSITIVE_INFINITY);var i=t.call(this,e)||this;return i.project=r,i.concurrent=n,i.hasCompleted=!1,i.buffer=[],i.active=0,i.index=0,i}return n.a(e,t),e.prototype._next=function(t){this.active<this.concurrent?this._tryNext(t):this.buffer.push(t)},e.prototype._tryNext=function(t){var e,r=this.index++;try{e=this.project(t,r)}catch(t){return void this.destination.error(t)}this.active++,this._innerSub(e)},e.prototype._innerSub=function(t){var e=new s.a(this),r=this.destination;r.add(e);var n=Object(s.c)(t,e);n!==e&&r.add(n)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(s.b),f=a},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(4),i=r(109),o=r(75);function s(t,e){return e?Object(o.a)(t,e):new n.a(Object(i.a)(t))}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(0),i=r(88),o=function(t){function e(r,n){void 0===n&&(n=i.a.now);var o=t.call(this,r,(function(){return e.delegate&&e.delegate!==o?e.delegate.now():n()}))||this;return o.actions=[],o.active=!1,o.scheduled=void 0,o}return n.a(e,t),e.prototype.schedule=function(r,n,i){return void 0===n&&(n=0),e.delegate&&e.delegate!==this?e.delegate.schedule(r,n,i):t.prototype.schedule.call(this,r,n,i)},e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var r;this.active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},e}(i.a)},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(0),i=r(6),o=r(5),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.value=null,e.hasNext=!1,e.hasCompleted=!1,e}return n.a(e,t),e.prototype._subscribe=function(e){return this.hasError?(e.error(this.thrownError),o.a.EMPTY):this.hasCompleted&&this.hasNext?(e.next(this.value),e.complete(),o.a.EMPTY):t.prototype._subscribe.call(this,e)},e.prototype.next=function(t){this.hasCompleted||(this.value=t,this.hasNext=!0)},e.prototype.error=function(e){this.hasCompleted||t.prototype.error.call(this,e)},e.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&t.prototype.next.call(this,this.value),t.prototype.complete.call(this)},e}(i.a)},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0),i=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n.pending=!1,n}return n.a(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(n,this.id,e),this},e.prototype.requestAsyncId=function(t,e,r){return void 0===r&&(r=0),setInterval(t.flush.bind(t,this),r)},e.prototype.recycleAsyncId=function(t,e,r){if(void 0===r&&(r=0),null!==r&&this.delay===r&&!1===this.pending)return e;clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,e);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var r=!1,n=void 0;try{this.work(t)}catch(t){r=!0,n=!!t&&t||new Error(t)}if(r)return this.unsubscribe(),n},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,r=e.actions,n=r.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==n&&r.splice(n,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(function(t){function e(e,r){return t.call(this)||this}return n.a(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(r(5).a))},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(8);function i(t){return!Object(n.a)(t)&&t-parseFloat(t)+1>=0}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){(function(t){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(248).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function c(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function u(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=c(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=c(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,c=0,f=r;f<a;f+=n)c=u(t,f,f+n,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var h=1;for(c=u(t,f,t.length,e),f=0;f<s;f++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,c=s/67108864|0;r.words[0]=a;for(var u=1;u<n;u++){for(var f=c>>>26,h=67108863&c,l=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=l;d++){var p=u-d|0;f+=(s=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&s}r.words[u]=0|h,c=0|f}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],c=(16777215&(a<<i|o)).toString(16);r=0!==(o=a>>>24-i&16777215)||s!==this.length-1?f[6-c.length]+c+r:c+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=h[t],d=l[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?b+r:f[u-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,c="le"===e,u=new t(o),f=this.clone();if(c){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-i;a++)u[a]=0;for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[o-a-1]=s}return u},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var n,i,o,s=t.words,a=e.words,c=r.words,u=0,f=0|s[0],h=8191&f,l=f>>>13,d=0|s[1],p=8191&d,b=d>>>13,g=0|s[2],m=8191&g,v=g>>>13,y=0|s[3],w=8191&y,_=y>>>13,E=0|s[4],S=8191&E,A=E>>>13,O=0|s[5],x=8191&O,T=O>>>13,P=0|s[6],R=8191&P,I=P>>>13,M=0|s[7],N=8191&M,k=M>>>13,C=0|s[8],L=8191&C,j=C>>>13,D=0|s[9],U=8191&D,B=D>>>13,F=0|a[0],V=8191&F,K=F>>>13,H=0|a[1],$=8191&H,G=H>>>13,z=0|a[2],q=8191&z,W=z>>>13,Y=0|a[3],J=8191&Y,Z=Y>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ct=8191&at,ut=at>>>13,ft=0|a[8],ht=8191&ft,lt=ft>>>13,dt=0|a[9],pt=8191&dt,bt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(n=Math.imul(h,V))|0)+((8191&(i=(i=Math.imul(h,K))+Math.imul(l,V)|0))<<13)|0;u=((o=Math.imul(l,K))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,V),i=(i=Math.imul(p,K))+Math.imul(b,V)|0,o=Math.imul(b,K);var mt=(u+(n=n+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(l,$)|0))<<13)|0;u=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,V),i=(i=Math.imul(m,K))+Math.imul(v,V)|0,o=Math.imul(v,K),n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,G)|0;var vt=(u+(n=n+Math.imul(h,q)|0)|0)+((8191&(i=(i=i+Math.imul(h,W)|0)+Math.imul(l,q)|0))<<13)|0;u=((o=o+Math.imul(l,W)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(w,V),i=(i=Math.imul(w,K))+Math.imul(_,V)|0,o=Math.imul(_,K),n=n+Math.imul(m,$)|0,i=(i=i+Math.imul(m,G)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,W)|0;var yt=(u+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,J)|0))<<13)|0;u=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(S,V),i=(i=Math.imul(S,K))+Math.imul(A,V)|0,o=Math.imul(A,K),n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(m,q)|0,i=(i=i+Math.imul(m,W)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Z)|0;var wt=(u+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,Q)|0))<<13)|0;u=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(x,V),i=(i=Math.imul(x,K))+Math.imul(T,V)|0,o=Math.imul(T,K),n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,G)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,G)|0,n=n+Math.imul(w,q)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,Z)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0;var _t=(u+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(l,rt)|0))<<13)|0;u=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(R,V),i=(i=Math.imul(R,K))+Math.imul(I,V)|0,o=Math.imul(I,K),n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,G)|0,n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0;var Et=(u+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,st)|0)+Math.imul(l,ot)|0))<<13)|0;u=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,V),i=(i=Math.imul(N,K))+Math.imul(k,V)|0,o=Math.imul(k,K),n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,G)|0,n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,Z)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,Z)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,i=(i=i+Math.imul(m,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0;var St=(u+(n=n+Math.imul(h,ct)|0)|0)+((8191&(i=(i=i+Math.imul(h,ut)|0)+Math.imul(l,ct)|0))<<13)|0;u=((o=o+Math.imul(l,ut)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(L,V),i=(i=Math.imul(L,K))+Math.imul(j,V)|0,o=Math.imul(j,K),n=n+Math.imul(N,$)|0,i=(i=i+Math.imul(N,G)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,G)|0,n=n+Math.imul(R,q)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(I,q)|0,o=o+Math.imul(I,W)|0,n=n+Math.imul(x,J)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Z)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(m,ot)|0,i=(i=i+Math.imul(m,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(b,ct)|0,o=o+Math.imul(b,ut)|0;var At=(u+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;u=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,K))+Math.imul(B,V)|0,o=Math.imul(B,K),n=n+Math.imul(L,$)|0,i=(i=i+Math.imul(L,G)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,G)|0,n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(k,q)|0,o=o+Math.imul(k,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,Z)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(m,ct)|0,i=(i=i+Math.imul(m,ut)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ut)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,lt)|0;var Ot=(u+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,bt)|0)+Math.imul(l,pt)|0))<<13)|0;u=((o=o+Math.imul(l,bt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,G))+Math.imul(B,$)|0,o=Math.imul(B,G),n=n+Math.imul(L,q)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(j,q)|0,o=o+Math.imul(j,W)|0,n=n+Math.imul(N,J)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,Z)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,ut)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(m,ht)|0,i=(i=i+Math.imul(m,lt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,lt)|0;var xt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,W))+Math.imul(B,q)|0,o=Math.imul(B,W),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,Z)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Z)|0,n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,ut)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ut)|0,n=n+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,lt)|0;var Tt=(u+(n=n+Math.imul(m,pt)|0)|0)+((8191&(i=(i=i+Math.imul(m,bt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((o=o+Math.imul(v,bt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(U,J),i=(i=Math.imul(U,Z))+Math.imul(B,J)|0,o=Math.imul(B,Z),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,st)|0,n=n+Math.imul(x,ct)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ut)|0,n=n+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,lt)|0;var Pt=(u+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,bt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(U,Q),i=(i=Math.imul(U,tt))+Math.imul(B,Q)|0,o=Math.imul(B,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,nt)|0,n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ut)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,ut)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,lt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0;var Rt=(u+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,bt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((o=o+Math.imul(A,bt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(U,rt),i=(i=Math.imul(U,nt))+Math.imul(B,rt)|0,o=Math.imul(B,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,n=n+Math.imul(N,ct)|0,i=(i=i+Math.imul(N,ut)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,ut)|0,n=n+Math.imul(R,ht)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,lt)|0;var It=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,bt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((o=o+Math.imul(T,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(U,ot),i=(i=Math.imul(U,st))+Math.imul(B,ot)|0,o=Math.imul(B,st),n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,ut)|0)+Math.imul(j,ct)|0,o=o+Math.imul(j,ut)|0,n=n+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,lt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,lt)|0;var Mt=(u+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,bt)|0)+Math.imul(I,pt)|0))<<13)|0;u=((o=o+Math.imul(I,bt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(U,ct),i=(i=Math.imul(U,ut))+Math.imul(B,ct)|0,o=Math.imul(B,ut),n=n+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,lt)|0;var Nt=(u+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,bt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,bt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(U,ht),i=(i=Math.imul(U,lt))+Math.imul(B,ht)|0,o=Math.imul(B,lt);var kt=(u+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,bt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((o=o+Math.imul(j,bt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863;var Ct=(u+(n=Math.imul(U,pt))|0)+((8191&(i=(i=Math.imul(U,bt))+Math.imul(B,pt)|0))<<13)|0;return u=((o=Math.imul(B,bt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,c[0]=gt,c[1]=mt,c[2]=vt,c[3]=yt,c[4]=wt,c[5]=_t,c[6]=Et,c[7]=St,c[8]=At,c[9]=Ot,c[10]=xt,c[11]=Tt,c[12]=Pt,c[13]=Rt,c[14]=It,c[15]=Mt,c[16]=Nt,c[17]=kt,c[18]=Ct,0!==u&&(c[19]=u,r.length++),r};function b(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,c=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=c;u++){var f=o-u,h=(0|t.words[f])*(0|e.words[u]),l=67108863&h;a=67108863&(l=l+a|0),i+=(s=(s=s+(h/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):b(this,t,e),r},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},g.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},g.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},g.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,c=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),f=0;f<i;f+=a)for(var h=c,l=u,d=0;d<s;d++){var p=r[f+d],b=n[f+d],g=r[f+d+s],m=n[f+d+s],v=h*g-l*m;m=h*m+l*g,g=v,r[f+d]=p+g,n[f+d]=b+m,r[f+d+s]=p-g,n[f+d+s]=b-m,d!==a&&(v=c*h-u*l,l=c*l+u*h,h=v)}},g.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},g.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},g.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},g.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},g.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},g.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),c=new Array(n),u=new Array(n),f=new Array(n),h=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,u,n),this.transform(s,o,a,c,n,i),this.transform(u,o,f,h,n,i);for(var d=0;d<n;d++){var p=a[d]*f[d]-c[d]*h[d];c[d]=a[d]*h[d]+c[d]*f[d],a[d]=p}return this.conjugate(a,c,n),this.transform(a,c,l,o,n,i),this.conjugate(l,o,n),this.normalize13b(l,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),b(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,c=(0|this.words[e])-a<<r;this.words[e]=c|s,s=a>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,c=r;if(i-=s,i=Math.max(0,i),c){for(var u=0;u<s;u++)c.words[u]=this.words[u];c.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var f=0;for(u=this.length-1;u>=0&&(0!==f||u>=i);u--){var h=0|this.words[u];this.words[u]=f<<26-o|h>>>o,f=h&a}return c&&0!==f&&(c.words[c.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var c=(0|t.words[i])*e;a=((o-=67108863&c)>>26)-(c/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,c=n.length-i.length;if("mod"!==e){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var f=n.clone()._ishlnsubmul(i,1,c);0===f.negative&&(n=f,a&&(a.words[c]=1));for(var h=c-1;h>=0;h--){var l=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,h);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(f),s.isub(h)),i.iushrn(1),s.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(f),c.isub(h)),a.iushrn(1),c.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(c)):(r.isub(e),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:r.iushln(u)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),c=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var h=0,l=1;0==(r.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(_,v),i(E,v),E.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return m[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,u).cmp(c);)f.redIAdd(c);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var b=d,g=0;0!==b.cmp(a);g++)b=b.redSqr();n(g<p);var m=this.pow(h,new o(1).iushln(p-g-1));l=l.redMul(m),h=m.redSqr(),d=d.redMul(h),p=g}return l},S.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},S.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],s=0,a=0,c=e.bitLength()%26;for(0===c&&(c=26),n=e.length-1;n>=0;n--){for(var u=e.words[n],f=c-1;f>=0;f--){var h=u>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==s?(s<<=1,s|=h,(4===++a||0===n&&0===f)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}c=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,S),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(247)(t))},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(48),i=r(103);function o(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Object(i.a)()(n.a.apply(void 0,t))}},function(t,e,r){"use strict";r.d(e,"a",(function(){return f}));var n=r(109),i=r(46),o=r(24),s=r(28),a=r(110),c=r(111),u=r(73),f=function(t){if(t&&"function"==typeof t[s.a])return f=t,function(t){var e=f[s.a]();if("function"!=typeof e.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return e.subscribe(t)};if(Object(a.a)(t))return Object(n.a)(t);if(Object(c.a)(t))return r=t,function(t){return r.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,i.a),t};if(t&&"function"==typeof t[o.a])return e=t,function(t){for(var r=e[o.a]();;){var n=void 0;try{n=r.next()}catch(e){return t.error(e),t}if(n.done){t.complete();break}if(t.next(n.value),t.closed)break}return"function"==typeof r.return&&t.add((function(){r.return&&r.return()})),t};var e,r,f,h=Object(u.a)(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+h+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")}},function(t,e,r){"use strict";function n(t){setTimeout((function(){throw t}),0)}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.Operation=void 0;const i=r(53),o=r(86),s=r(23),a=r(2),c=r(159);e.Operation=class{constructor(t,e,r,n){if(this.hash=t,this.raw=e,this.results=r,this.context=n,this._pollingConfig$=new i.ReplaySubject(1),this.currentHead$=this._pollingConfig$.pipe(o.switchMap((t=>i.defer((()=>c.createObservableFromSubscription(this.context.stream.subscribeBlock("head")))).pipe(o.timeoutWith(1e3*t.timeout,i.throwError(new Error("Confirmation polling timed out")))))),o.shareReplay({refCount:!0})),this.confirmed$=this.currentHead$.pipe(o.map((t=>{for(let e=3;e>=0;e--)t.operations[e].forEach((e=>{e.hash===this.hash&&(this._foundAt=t.header.level)}));if(t.header.level-this._foundAt>=0)return this._foundAt})),o.filter((t=>void 0!==t)),o.first(),o.shareReplay()),this._foundAt=Number.POSITIVE_INFINITY,a.validateOperation(this.hash)!==a.ValidationResult.VALID)throw new a.InvalidOperationHashError(`Invalid Operation Hash: ${this.hash}`);this.confirmed$.pipe(o.first(),o.catchError((()=>i.of(i.EMPTY)))).subscribe()}get includedInBlock(){return this._foundAt}get revealOperation(){return Array.isArray(this.results)&&this.results.find((t=>"reveal"===t.kind))}get revealStatus(){return this.revealOperation?this.revealOperation.metadata.operation_result.status:"unknown"}get status(){return this.results.map((t=>s.hasMetadataWithResult(t)?t.metadata.operation_result.status:"unknown"))[0]||"unknown"}confirmation(t,e){return n(this,void 0,void 0,(function*(){if(void 0!==t&&t<1)throw new Error("Confirmation count must be at least 1");const{defaultConfirmationCount:r,confirmationPollingTimeoutSecond:n}=this.context.config;this._pollingConfig$.next({timeout:e||n});const i=void 0!==t?t:r;return new Promise(((t,e)=>{this.confirmed$.pipe(o.switchMap((()=>this.currentHead$)),o.filter((t=>t.header.level-this._foundAt>=i-1)),o.first()).subscribe((e=>{t(this._foundAt+(i-1))}),e)}))}))}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(10),i=r(37),o=r(75);function s(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t[t.length-1];return Object(n.a)(r)?(t.pop(),Object(o.a)(t,r)):Object(i.a)(t)}},function(t,e,r){"use strict";var n=r(93),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var o=Object.create(r(81));o.inherits=r(61);var s=r(147),a=r(117);o.inherits(h,s);for(var c=i(a.prototype),u=0;u<c.length;u++){var f=c[u];h.prototype[f]||(h.prototype[f]=a.prototype[f])}function h(t){if(!(this instanceof h))return new h(t);s.call(this,t),a.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",l)}function l(){this.allowHalfOpen||this._writableState.ended||n.nextTick(d,this)}function d(t){t.end()}Object.defineProperty(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),h.prototype._destroy=function(t,e){this.push(null),this.end(),n.nextTick(e,t)}},function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=r,r.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InvalidViewSimulationContext=e.validateAndExtractFailwith=e.ViewSimulationError=e.InvalidViewParameterError=e.InvalidInitParameter=e.InvalidCodeParameter=e.InvalidDelegationSource=e.UndefinedLambdaContractError=e.InvalidParameterError=void 0;class n extends Error{constructor(t,e,r){super(`${t} Received ${r.length} arguments while expecting one of the following signatures (${JSON.stringify(e)})`),this.smartContractMethodName=t,this.sigs=e,this.args=r,this.name="Invalid parameters error"}}e.InvalidParameterError=n;class i extends Error{constructor(){super("This might happen if you are using a sandbox. Please provide the address of a lambda contract as a parameter of the read method."),this.name="Undefined LambdaContract error"}}e.UndefinedLambdaContractError=i;class o extends Error{constructor(t){super(`Since Babylon delegation source can no longer be a contract address ${t}. Please use the smart contract abstraction to set your delegate.`),this.source=t,this.name="Invalid delegation source error"}}e.InvalidDelegationSource=o;class s extends Error{constructor(t,e){super(t),this.message=t,this.data=e,this.name="InvalidCodeParameter"}}e.InvalidCodeParameter=s;class a extends Error{constructor(t,e){super(t),this.message=t,this.data=e,this.name="InvalidInitParameter"}}e.InvalidInitParameter=a;class c extends Error{constructor(t,e,r,n){super(`Unable to encode the parameter of the view: ${t}. Received ${r} as parameter while expecting one of the following signatures (${JSON.stringify(e)})`),this.smartContractViewName=t,this.sigs=e,this.args=r,this.originalError=n,this.name="Invalid view parameters error",this.cause=n}}e.InvalidViewParameterError=c;class u extends Error{constructor(t,e,r,n){super(t),this.message=t,this.viewName=e,this.failWith=r,this.originalError=n,this.name="ViewSimulationError"}}e.ViewSimulationError=u;e.validateAndExtractFailwith=t=>{if(f(t.body)){const e=JSON.parse(t.body);if(Array.isArray(e)&&"with"in e[e.length-1])return e[e.length-1].with}};const f=t=>{try{JSON.parse(t)}catch(t){return!1}return!0};class h extends Error{constructor(t){super(`${t} Please configure the context of the view execution in the executeView method.`),this.info=t,this.name="InvalidViewSimulationContext"}}e.InvalidViewSimulationContext=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.flattenErrors=e.flattenOperationResult=e.TezosPreapplyFailureError=e.TezosOperationError=void 0;const n=r(23);class i extends Error{constructor(t){super(),this.errors=t,this.name="TezosOperationError";const e=t[t.length-1];this.id=e.id,this.kind=e.kind,this.message=`(${this.kind}) ${this.id}`,"with"in e&&e.with.string&&(this.message=e.with.string)}}e.TezosOperationError=i;class o extends Error{constructor(t){super("Preapply returned an unexpected result"),this.result=t,this.name="TezosPreapplyFailureError"}}e.TezosPreapplyFailureError=o;e.flattenOperationResult=t=>{const e=Array.isArray(t)?t:[t],r=[];for(let t=0;t<e.length;t++)for(let i=0;i<e[t].contents.length;i++){const o=e[t].contents[i];n.hasMetadataWithResult(o)&&(r.push(Object.assign({fee:o.fee},o.metadata.operation_result)),Array.isArray(o.metadata.internal_operation_results)&&o.metadata.internal_operation_results.forEach((t=>r.push(t.result))))}return r};e.flattenErrors=(t,e="failed")=>{const r=Array.isArray(t)?t:[t];let i=[];for(let t=0;t<r.length;t++)for(let o=0;o<r[t].contents.length;o++){const s=r[t].contents[o];if(n.hasMetadata(s)&&(n.hasMetadataWithResult(s)&&s.metadata.operation_result.status===e&&(i=i.concat(s.metadata.operation_result.errors||[])),n.hasMetadataWithInternalOperationResult(s)&&Array.isArray(s.metadata.internal_operation_results)))for(const t of s.metadata.internal_operation_results)"result"in t&&t.result.status===e&&(i=i.concat(t.result.errors||[]))}return i}},function(t,e,r){"use strict";r.r(e),r.d(e,"Observable",(function(){return n.a})),r.d(e,"ConnectableObservable",(function(){return i.a})),r.d(e,"GroupedObservable",(function(){return o.a})),r.d(e,"observable",(function(){return s.a})),r.d(e,"Subject",(function(){return a.a})),r.d(e,"BehaviorSubject",(function(){return c.a})),r.d(e,"ReplaySubject",(function(){return u.a})),r.d(e,"AsyncSubject",(function(){return f.a})),r.d(e,"asap",(function(){return h.a})),r.d(e,"asapScheduler",(function(){return h.b})),r.d(e,"async",(function(){return l.a})),r.d(e,"asyncScheduler",(function(){return l.b})),r.d(e,"queue",(function(){return d.a})),r.d(e,"queueScheduler",(function(){return d.b})),r.d(e,"animationFrame",(function(){return w})),r.d(e,"animationFrameScheduler",(function(){return y})),r.d(e,"VirtualTimeScheduler",(function(){return _})),r.d(e,"VirtualAction",(function(){return E})),r.d(e,"Scheduler",(function(){return S.a})),r.d(e,"Subscription",(function(){return A.a})),r.d(e,"Subscriber",(function(){return O.a})),r.d(e,"Notification",(function(){return x.a})),r.d(e,"NotificationKind",(function(){return x.b})),r.d(e,"pipe",(function(){return T.a})),r.d(e,"noop",(function(){return P.a})),r.d(e,"identity",(function(){return R.a})),r.d(e,"isObservable",(function(){return I})),r.d(e,"ArgumentOutOfRangeError",(function(){return M.a})),r.d(e,"EmptyError",(function(){return N.a})),r.d(e,"ObjectUnsubscribedError",(function(){return k.a})),r.d(e,"UnsubscriptionError",(function(){return C.a})),r.d(e,"TimeoutError",(function(){return L.a})),r.d(e,"bindCallback",(function(){return F})),r.d(e,"bindNodeCallback",(function(){return H})),r.d(e,"combineLatest",(function(){return q.b})),r.d(e,"concat",(function(){return W.a})),r.d(e,"defer",(function(){return Y.a})),r.d(e,"empty",(function(){return J.b})),r.d(e,"forkJoin",(function(){return Q})),r.d(e,"from",(function(){return X.a})),r.d(e,"fromEvent",(function(){return rt})),r.d(e,"fromEventPattern",(function(){return it})),r.d(e,"generate",(function(){return ot})),r.d(e,"iif",(function(){return at})),r.d(e,"interval",(function(){return ut})),r.d(e,"merge",(function(){return ht.a})),r.d(e,"never",(function(){return dt})),r.d(e,"of",(function(){return pt.a})),r.d(e,"onErrorResumeNext",(function(){return bt})),r.d(e,"pairs",(function(){return gt})),r.d(e,"partition",(function(){return _t})),r.d(e,"race",(function(){return Et.a})),r.d(e,"range",(function(){return St})),r.d(e,"throwError",(function(){return Ot.a})),r.d(e,"timer",(function(){return xt.a})),r.d(e,"using",(function(){return Tt})),r.d(e,"zip",(function(){return Pt.b})),r.d(e,"scheduled",(function(){return Rt.a})),r.d(e,"EMPTY",(function(){return J.a})),r.d(e,"NEVER",(function(){return lt})),r.d(e,"config",(function(){return It.a}));var n=r(4),i=r(99),o=r(95),s=r(28),a=r(6),c=r(100),u=r(66),f=r(39),h=r(55),l=r(7),d=r(87),p=r(0),b=r(40),g=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return p.a(e,t),e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0?t.prototype.requestAsyncId.call(this,e,r,n):(e.actions.push(this),e.scheduled||(e.scheduled=requestAnimationFrame((function(){return e.flush(null)}))))},e.prototype.recycleAsyncId=function(e,r,n){if(void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,r,n);0===e.actions.length&&(cancelAnimationFrame(r),e.scheduled=void 0)},e}(b.a),m=r(38),v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p.a(e,t),e.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,r=this.actions,n=-1,i=r.length;t=t||r.shift();do{if(e=t.execute(t.state,t.delay))break}while(++n<i&&(t=r.shift()));if(this.active=!1,e){for(;++n<i&&(t=r.shift());)t.unsubscribe();throw e}},e}(m.a),y=new v(g),w=y,_=function(t){function e(e,r){void 0===e&&(e=E),void 0===r&&(r=Number.POSITIVE_INFINITY);var n=t.call(this,e,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}return p.a(e,t),e.prototype.flush=function(){for(var t,e,r=this.actions,n=this.maxFrames;(e=r[0])&&e.delay<=n&&(r.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=r.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10,e}(m.a),E=function(t){function e(e,r,n){void 0===n&&(n=e.index+=1);var i=t.call(this,e,r)||this;return i.scheduler=e,i.work=r,i.index=n,i.active=!0,i.index=e.index=n,i}return p.a(e,t),e.prototype.schedule=function(r,n){if(void 0===n&&(n=0),!this.id)return t.prototype.schedule.call(this,r,n);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(r,n)},e.prototype.requestAsyncId=function(t,r,n){void 0===n&&(n=0),this.delay=t.frame+n;var i=t.actions;return i.push(this),i.sort(e.sortActions),!0},e.prototype.recycleAsyncId=function(t,e,r){void 0===r&&(r=0)},e.prototype._execute=function(e,r){if(!0===this.active)return t.prototype._execute.call(this,e,r)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(b.a),S=r(88),A=r(5),O=r(1),x=r(21),T=r(54),P=r(25),R=r(17);function I(t){return!!t&&(t instanceof n.a||"function"==typeof t.lift&&"function"==typeof t.subscribe)}var M=r(31),N=r(35),k=r(29),C=r(57),L=r(102),j=r(9),D=r(74),U=r(8),B=r(10);function F(t,e,r){if(e){if(!Object(B.a)(e))return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return F(t,r).apply(void 0,n).pipe(Object(j.a)((function(t){return Object(U.a)(t)?e.apply(void 0,t):e(t)})))};r=e}return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o,s=this,a={context:s,subject:o,callbackFunc:t,scheduler:r};return new n.a((function(n){if(r){var i={args:e,subscriber:n,params:a};return r.schedule(V,0,i)}if(!o){o=new f.a;try{t.apply(s,e.concat([function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];o.next(t.length<=1?t[0]:t),o.complete()}]))}catch(t){Object(D.a)(o)?o.error(t):console.warn(t)}}return o.subscribe(n)}))}}function V(t){var e=this,r=t.args,n=t.subscriber,i=t.params,o=i.callbackFunc,s=i.context,a=i.scheduler,c=i.subject;if(!c){c=i.subject=new f.a;try{o.apply(s,r.concat([function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t.length<=1?t[0]:t;e.add(a.schedule(K,0,{value:n,subject:c}))}]))}catch(t){c.error(t)}}this.add(c.subscribe(n))}function K(t){var e=t.value,r=t.subject;r.next(e),r.complete()}function H(t,e,r){if(e){if(!Object(B.a)(e))return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return H(t,r).apply(void 0,n).pipe(Object(j.a)((function(t){return Object(U.a)(t)?e.apply(void 0,t):e(t)})))};r=e}return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o={subject:void 0,args:e,callbackFunc:t,scheduler:r,context:this};return new n.a((function(n){var i=o.context,s=o.subject;if(r)return r.schedule($,0,{params:o,subscriber:n,context:i});if(!s){s=o.subject=new f.a;try{t.apply(i,e.concat([function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t.shift();r?s.error(r):(s.next(t.length<=1?t[0]:t),s.complete())}]))}catch(t){Object(D.a)(s)?s.error(t):console.warn(t)}}return s.subscribe(n)}))}}function $(t){var e=this,r=t.params,n=t.subscriber,i=t.context,o=r.callbackFunc,s=r.args,a=r.scheduler,c=r.subject;if(!c){c=r.subject=new f.a;try{o.apply(i,s.concat([function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t.shift();if(n)e.add(a.schedule(z,0,{err:n,subject:c}));else{var i=t.length<=1?t[0]:t;e.add(a.schedule(G,0,{value:i,subject:c}))}}]))}catch(t){this.add(a.schedule(z,0,{err:t,subject:c}))}}this.add(c.subscribe(n))}function G(t){var e=t.value,r=t.subject;r.next(e),r.complete()}function z(t){var e=t.err;t.subject.error(e)}var q=r(68),W=r(44),Y=r(70),J=r(11),Z=r(73),X=r(13);function Q(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(1===t.length){var r=t[0];if(Object(U.a)(r))return tt(r,null);if(Object(Z.a)(r)&&Object.getPrototypeOf(r)===Object.prototype){var n=Object.keys(r);return tt(n.map((function(t){return r[t]})),n)}}if("function"==typeof t[t.length-1]){var i=t.pop();return tt(t=1===t.length&&Object(U.a)(t[0])?t[0]:t,null).pipe(Object(j.a)((function(t){return i.apply(void 0,t)})))}return tt(t,null)}function tt(t,e){return new n.a((function(r){var n=t.length;if(0!==n)for(var i=new Array(n),o=0,s=0,a=function(a){var c=Object(X.a)(t[a]),u=!1;r.add(c.subscribe({next:function(t){u||(u=!0,s++),i[a]=t},error:function(t){return r.error(t)},complete:function(){++o!==n&&u||(s===n&&r.next(e?e.reduce((function(t,e,r){return t[e]=i[r],t}),{}):i),r.complete())}}))},c=0;c<n;c++)a(c);else r.complete()}))}var et=r(32);function rt(t,e,r,i){return Object(et.a)(r)&&(i=r,r=void 0),i?rt(t,e,r).pipe(Object(j.a)((function(t){return Object(U.a)(t)?i.apply(void 0,t):i(t)}))):new n.a((function(n){nt(t,e,(function(t){arguments.length>1?n.next(Array.prototype.slice.call(arguments)):n.next(t)}),n,r)}))}function nt(t,e,r,n,i){var o;if(function(t){return t&&"function"==typeof t.addEventListener&&"function"==typeof t.removeEventListener}(t)){var s=t;t.addEventListener(e,r,i),o=function(){return s.removeEventListener(e,r,i)}}else if(function(t){return t&&"function"==typeof t.on&&"function"==typeof t.off}(t)){var a=t;t.on(e,r),o=function(){return a.off(e,r)}}else if(function(t){return t&&"function"==typeof t.addListener&&"function"==typeof t.removeListener}(t)){var c=t;t.addListener(e,r),o=function(){return c.removeListener(e,r)}}else{if(!t||!t.length)throw new TypeError("Invalid event target");for(var u=0,f=t.length;u<f;u++)nt(t[u],e,r,n,i)}n.add(o)}function it(t,e,r){return r?it(t,e).pipe(Object(j.a)((function(t){return Object(U.a)(t)?r.apply(void 0,t):r(t)}))):new n.a((function(r){var n,i=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return r.next(1===t.length?t[0]:t)};try{n=t(i)}catch(t){return void r.error(t)}if(Object(et.a)(e))return function(){return e(i,n)}}))}function ot(t,e,r,i,o){var s,a;if(1==arguments.length){var c=t;a=c.initialState,e=c.condition,r=c.iterate,s=c.resultSelector||R.a,o=c.scheduler}else void 0===i||Object(B.a)(i)?(a=t,s=R.a,o=i):(a=t,s=i);return new n.a((function(t){var n=a;if(o)return o.schedule(st,0,{subscriber:t,iterate:r,condition:e,resultSelector:s,state:n});for(;;){if(e){var i=void 0;try{i=e(n)}catch(e){return void t.error(e)}if(!i){t.complete();break}}var c=void 0;try{c=s(n)}catch(e){return void t.error(e)}if(t.next(c),t.closed)break;try{n=r(n)}catch(e){return void t.error(e)}}}))}function st(t){var e=t.subscriber,r=t.condition;if(!e.closed){if(t.needIterate)try{t.state=t.iterate(t.state)}catch(t){return void e.error(t)}else t.needIterate=!0;if(r){var n=void 0;try{n=r(t.state)}catch(t){return void e.error(t)}if(!n)return void e.complete();if(e.closed)return}var i;try{i=t.resultSelector(t.state)}catch(t){return void e.error(t)}if(!e.closed&&(e.next(i),!e.closed))return this.schedule(t)}}function at(t,e,r){return void 0===e&&(e=J.a),void 0===r&&(r=J.a),Object(Y.a)((function(){return t()?e:r}))}var ct=r(41);function ut(t,e){return void 0===t&&(t=0),void 0===e&&(e=l.a),(!Object(ct.a)(t)||t<0)&&(t=0),e&&"function"==typeof e.schedule||(e=l.a),new n.a((function(r){return r.add(e.schedule(ft,t,{subscriber:r,counter:0,period:t})),r}))}function ft(t){var e=t.subscriber,r=t.counter,n=t.period;e.next(r),this.schedule({subscriber:e,counter:r+1,period:n},n)}var ht=r(104),lt=new n.a(P.a);function dt(){return lt}var pt=r(48);function bt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return J.a;var r=t[0],i=t.slice(1);return 1===t.length&&Object(U.a)(r)?bt.apply(void 0,r):new n.a((function(t){var e=function(){return t.add(bt.apply(void 0,i).subscribe(t))};return Object(X.a)(r).subscribe({next:function(e){t.next(e)},error:e,complete:e})}))}function gt(t,e){return e?new n.a((function(r){var n=Object.keys(t),i=new A.a;return i.add(e.schedule(mt,0,{keys:n,index:0,subscriber:r,subscription:i,obj:t})),i})):new n.a((function(e){for(var r=Object.keys(t),n=0;n<r.length&&!e.closed;n++){var i=r[n];t.hasOwnProperty(i)&&e.next([i,t[i]])}e.complete()}))}function mt(t){var e=t.keys,r=t.index,n=t.subscriber,i=t.subscription,o=t.obj;if(!n.closed)if(r<e.length){var s=e[r];n.next([s,o[s]]),i.add(this.schedule({keys:e,index:r+1,subscriber:n,subscription:i,obj:o}))}else n.complete()}var vt=r(112),yt=r(45),wt=r(20);function _t(t,e,r){return[Object(wt.a)(e,r)(new n.a(Object(yt.a)(t))),Object(wt.a)(Object(vt.a)(e,r))(new n.a(Object(yt.a)(t)))]}var Et=r(105);function St(t,e,r){return void 0===t&&(t=0),new n.a((function(n){void 0===e&&(e=t,t=0);var i=0,o=t;if(r)return r.schedule(At,0,{index:i,count:e,start:t,subscriber:n});for(;;){if(i++>=e){n.complete();break}if(n.next(o++),n.closed)break}}))}function At(t){var e=t.start,r=t.index,n=t.count,i=t.subscriber;r>=n?i.complete():(i.next(e),i.closed||(t.index=r+1,t.start=e+1,this.schedule(t)))}var Ot=r(67),xt=r(106);function Tt(t,e){return new n.a((function(r){var n,i;try{n=t()}catch(t){return void r.error(t)}try{i=e(n)}catch(t){return void r.error(t)}var o=(i?Object(X.a)(i):J.a).subscribe(r);return function(){o.unsubscribe(),n&&n.unsubscribe()}}))}var Pt=r(71),Rt=r(107),It=r(16)},function(t,e,r){"use strict";r.d(e,"a",(function(){return i})),r.d(e,"b",(function(){return o}));var n=r(17);function i(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return o(t)}function o(t){return 0===t.length?n.a:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}},function(t,e,r){"use strict";r.d(e,"b",(function(){return l})),r.d(e,"a",(function(){return d}));var n=r(0),i=1,o=function(){return Promise.resolve()}(),s={};function a(t){return t in s&&(delete s[t],!0)}var c=function(t){var e=i++;return s[e]=!0,o.then((function(){return a(e)&&t()})),e},u=function(t){a(t)},f=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return n.a(e,t),e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0?t.prototype.requestAsyncId.call(this,e,r,n):(e.actions.push(this),e.scheduled||(e.scheduled=c(e.flush.bind(e,null))))},e.prototype.recycleAsyncId=function(e,r,n){if(void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,r,n);0===e.actions.length&&(u(r),e.scheduled=void 0)},e}(r(40).a),h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n.a(e,t),e.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,r=this.actions,n=-1,i=r.length;t=t||r.shift();do{if(e=t.execute(t.state,t.delay))break}while(++n<i&&(t=r.shift()));if(this.active=!1,e){for(;++n<i&&(t=r.shift());)t.unsubscribe();throw e}},e}(r(38).a),l=new h(f),d=l},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));var n=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));var n=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,r){"use strict";var n={};function i(t,e,r){r||(r=Error);var i=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=t,n[t]=i}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,s,a;if("string"==typeof e&&(i="not ",e.substr(!s||s<0?0:+s,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))a="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var c=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(c," ").concat(n," ").concat(o(e,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},function(t,e,r){"use strict";(function(e){var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=u;var i=r(139),o=r(143);r(12)(u,i);for(var s=n(o.prototype),a=0;a<s.length;a++){var c=s[a];u.prototype[c]||(u.prototype[c]=o.prototype[c])}function u(t){if(!(this instanceof u))return new u(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",f)))}function f(){this._writableState.ended||e.nextTick(h,this)}function h(t){t.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this,r(33))},function(t,e,r){var n=r(26).Buffer;function i(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,s=this._len,a=0;a<o;){for(var c=s%i,u=Math.min(o-a,i-c),f=0;f<u;f++)r[c+f]=t[a+f];a+=u,(s+=u)%i==0&&this._update(r)}return this._len+=o,this},i.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(t,e,r){"use strict";r.r(e),function(t){r.d(e,"AddressValidationError",(function(){return S})),r.d(e,"BigMapValidationError",(function(){return b})),r.d(e,"BytesValidationError",(function(){return C})),r.d(e,"ChainIDValidationError",(function(){return Z})),r.d(e,"ContractValidationError",(function(){return P})),r.d(e,"EncodeTicketError",(function(){return Q})),r.d(e,"IntValidationError",(function(){return U})),r.d(e,"InvalidScriptError",(function(){return Nt})),r.d(e,"KeyHashValidationError",(function(){return H})),r.d(e,"KeyValidationError",(function(){return V})),r.d(e,"ListValidationError",(function(){return I})),r.d(e,"MapTypecheckError",(function(){return f})),r.d(e,"MapValidationError",(function(){return O})),r.d(e,"MichelsonMap",(function(){return h})),r.d(e,"MutezValidationError",(function(){return N})),r.d(e,"NatValidationError",(function(){return w})),r.d(e,"ParameterSchema",(function(){return It})),r.d(e,"SaplingStateValue",(function(){return jt})),r.d(e,"Schema",(function(){return Rt})),r.d(e,"SetValidationError",(function(){return Y})),r.d(e,"SignatureValidationError",(function(){return G})),r.d(e,"Token",(function(){return d})),r.d(e,"UnitValue",(function(){return Lt})),r.d(e,"VERSION",(function(){return Ct})),r.d(e,"ViewEncodingError",(function(){return Mt})),r.d(e,"ViewSchema",(function(){return kt}));var n,i=r(182),o=r.n(i),s=r(30),a=r.n(s),c=r(2);const u=Symbol.for("taquito-michelson-map-type-symbol");class f extends Error{constructor(t,e,r){super(`${r} not compliant with underlying michelson type`),this.value=t,this.type=e,this.name="MapTypecheckError"}}class h{constructor(t){this.valueMap=new Map,this.keyMap=new Map,this[n]=!0,t&&this.setType(t)}static isMichelsonMap(t){return t&&!0===t[u]}setType(t){if(!("args"in(e=t))||!Array.isArray(e.args)||2!==e.args.length)throw new Error("mapType is not a valid michelson map type");var e;this.keySchema=new Rt(t.args[0]),this.valueSchema=new Rt(t.args[1])}removeType(){this.keySchema=void 0,this.valueSchema=void 0}static fromLiteral(t,e){const r=new h(e);return Object.keys(t).forEach((e=>{r.set(e,t[e])})),r}typecheckKey(t){return!this.keySchema||this.keySchema.Typecheck(t)}typecheckValue(t){return!this.valueSchema||this.valueSchema.Typecheck(t)}assertTypecheckValue(t){if(!this.typecheckValue(t))throw new f(t,this.valueSchema,"value")}assertTypecheckKey(t){if(!this.typecheckKey(t))throw new f(t,this.keySchema,"key")}serializeDeterministically(t){return o()(t)}*keys(){for(const[t]of this.entries())yield t}*values(){for(const[,t]of this.entries())yield t}*entries(){for(const t of this.valueMap.keys())yield[this.keyMap.get(t),this.valueMap.get(t)]}get(t){this.assertTypecheckKey(t);const e=this.serializeDeterministically(t);return this.valueMap.get(e)}set(t,e){this.assertTypecheckKey(t),this.assertTypecheckValue(e);const r=this.serializeDeterministically(t);this.keyMap.set(r,t),this.valueMap.set(r,e)}delete(t){this.assertTypecheckKey(t),this.keyMap.delete(this.serializeDeterministically(t)),this.valueMap.delete(this.serializeDeterministically(t))}has(t){this.assertTypecheckKey(t);const e=this.serializeDeterministically(t);return this.keyMap.has(e)&&this.valueMap.has(e)}clear(){this.keyMap.clear(),this.valueMap.clear()}get size(){return this.keyMap.size}forEach(t){for(const[e,r]of this.entries())t(r,e,this)}}n=u;class l extends Error{constructor(t,e,r){super(),this.value=t,this.token=e,this.name="ValidationError";const n=this.token.annot(),i=n?`[${n}] `:"";this.message=`${i}${r}`}}class d{constructor(t,e,r){this.val=t,this.idx=e,this.fac=r,this.createToken=this.fac}typeWithoutAnnotations(){const t=e=>e.args?{prim:e.prim,args:e.args.map((e=>t(e)))}:{prim:e.prim};return t(this.val)}annot(){return(Array.isArray(this.val.annots)&&this.val.annots.length>0?this.val.annots[0]:String(this.idx)).replace(/(%|:)(_Liq_entry_)?/,"")}hasAnnotations(){return Array.isArray(this.val.annots)&&this.val.annots.length}get tokenVal(){return this.val}ExtractSignature(){return[[this.ExtractSchema()]]}}class p extends d{compare(t,e){return t===e?0:t<e?-1:1}}class b extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="BigMapValidationError"}}class g extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}get ValueSchema(){return this.createToken(this.val.args[1],0)}get KeySchema(){return this.createToken(this.val.args[0],0)}ExtractSchema(){return{big_map:{key:this.KeySchema.ExtractSchema(),value:this.ValueSchema.ExtractSchema()}}}generateSchema(){return{__michelsonType:g.prim,schema:{key:this.KeySchema.generateSchema(),value:this.ValueSchema.generateSchema()}}}isValid(t){return h.isMichelsonMap(t)?null:new b(t,this,"Value must be a MichelsonMap")}Encode(t){const e=t.pop(),r=this.isValid(e);if(r)throw r;return Array.from(e.keys()).sort(((t,e)=>this.KeySchema.compare(t,e))).map((t=>({prim:"Elt",args:[this.KeySchema.EncodeObject(t),this.ValueSchema.EncodeObject(e.get(t))]})))}EncodeObject(t){const e=t,r=this.isValid(e);if(r)throw r;return Array.from(e.keys()).sort(((t,e)=>this.KeySchema.compare(t,e))).map((t=>({prim:"Elt",args:[this.KeySchema.EncodeObject(t),this.ValueSchema.EncodeObject(e.get(t))]})))}Execute(t,e){if(e&&e[g.prim])return e[g.prim](t,this.val);if(Array.isArray(t)){const e=new h(this.val);return t.forEach((t=>{e.set(this.KeySchema.ToKey(t.args[0]),this.ValueSchema.Execute(t.args[1]))})),e}if("int"in t)return t.int;throw new Error(`Big map is expecting either an array (Athens) or an object with an int property (Babylon). Got ${JSON.stringify(t)}`)}findAndReturnTokens(t,e){return g.prim===t&&e.push(this),this.KeySchema.findAndReturnTokens(t,e),this.ValueSchema.findAndReturnTokens(t,e),e}}g.prim="big_map";class m extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Encode(t){const e=t[t.length-1],r=this.createToken(this.val.args[0],this.idx);let n=1;r instanceof m&&(n=Object.keys(r.ExtractSchema()).length);const i=this.createToken(this.val.args[1],this.idx+n);if(String(r.annot())!==String(e)||r instanceof m){if(String(i.annot())!==String(e)||i instanceof m){if(r instanceof m){const e=r.Encode(t);if(e)return{prim:"Left",args:[e]}}if(i instanceof m){const e=i.Encode(t);if(e)return{prim:"Right",args:[e]}}return null}return t.pop(),{prim:"Right",args:[i.Encode(t)]}}return t.pop(),{prim:"Left",args:[r.Encode(t)]}}ExtractSignature(){const t=this.createToken(this.val.args[0],this.idx);let e=1;t instanceof m&&(e=Object.keys(t.ExtractSchema()).length);const r=this.createToken(this.val.args[1],this.idx+e),n=[];if(t instanceof m)n.push(...t.ExtractSignature());else for(const e of t.ExtractSignature())n.push([t.annot(),...e]);if(r instanceof m)n.push(...r.ExtractSignature());else for(const t of r.ExtractSignature())n.push([r.annot(),...t]);return n}EncodeObject(t){const e=Object.keys(t)[0],r=this.createToken(this.val.args[0],this.idx);let n=1;r instanceof m&&(n=Object.keys(r.ExtractSchema()).length);const i=this.createToken(this.val.args[1],this.idx+n);if(String(r.annot())!==String(e)||r instanceof m){if(String(i.annot())!==String(e)||i instanceof m){if(r instanceof m){const e=r.EncodeObject(t);if(e)return{prim:"Left",args:[e]}}if(i instanceof m){const e=i.EncodeObject(t);if(e)return{prim:"Right",args:[e]}}return null}return{prim:"Right",args:[i.EncodeObject(t[e])]}}return{prim:"Left",args:[r.EncodeObject(t[e])]}}Execute(t,e){const r=this.createToken(this.val.args[0],this.idx);let n=1;r instanceof m&&(n=Object.keys(r.ExtractSchema()).length);const i=this.createToken(this.val.args[1],this.idx+n);if("Right"===t.prim)return i instanceof m?i.Execute(t.args[0],e):{[i.annot()]:i.Execute(t.args[0],e)};if("Left"===t.prim)return r instanceof m?r.Execute(t.args[0],e):{[r.annot()]:r.Execute(t.args[0],e)};throw new Error(`Was expecting Left or Right prim but got: ${t.prim}`)}traversal(t,e,r){const n=this.createToken(this.val.args[0],this.idx);let i,o=1;n instanceof m&&!n.hasAnnotations()?(i=t(n),o=Object.keys(n.ExtractSchema()).length):i={[n.annot()]:t(n)};const s=this.createToken(this.val.args[1],this.idx+o);let a;a=s instanceof m&&!s.hasAnnotations()?e(s):{[s.annot()]:e(s)};return r(i,a)}ExtractSchema(){return this.traversal((t=>t.ExtractSchema()),(t=>t.ExtractSchema()),((t,e)=>Object.assign(Object.assign({},t),e)))}generateSchema(){return{__michelsonType:m.prim,schema:this.traversal((t=>t instanceof m&&!t.hasAnnotations()?t.generateSchema().schema:t.generateSchema()),(t=>t instanceof m&&!t.hasAnnotations()?t.generateSchema().schema:t.generateSchema()),((t,e)=>Object.assign(Object.assign({},t),e)))}}findToken(t){const e=this.createToken(this.val.args[0],this.idx);let r=1;e instanceof m&&(r=Object.keys(e.ExtractSchema()).length);const n=this.createToken(this.val.args[1],this.idx+r);if(String(e.annot())===String(t)&&!(e instanceof m)&&e instanceof p)return e;if(String(n.annot())===String(t)&&!(n instanceof m)&&n instanceof p)return n;if(e instanceof m){const r=e.findToken(t);if(r)return r}if(n instanceof m){const e=n.findToken(t);if(e)return e}return null}compare(t,e){const r=Object.keys(t)[0];if(r!==Object.keys(e)[0]){return JSON.stringify(this.EncodeObject(t))<JSON.stringify(this.EncodeObject(e))?-1:1}{const n=this.findToken(r);if(n instanceof p)return n.compare(t[r],e[r])}}ToKey(t){return this.Execute(t)}ToBigMapKey(t){return{key:this.EncodeObject(t),type:this.typeWithoutAnnotations()}}findAndReturnTokens(t,e){return m.prim===t&&e.push(this),this.traversal((r=>r.findAndReturnTokens(t,e)),(r=>r.findAndReturnTokens(t,e)),((t,e)=>Object.assign(Object.assign({},t),e))),e}}function v(t,e=y.prim){if(Array.isArray(t))return v({prim:e,args:t},e);if(void 0===t.args)throw new Error("Token has no arguments");return t.args.length>2?[t.args[0],{prim:e,args:t.args.slice(1)}]:[t.args[0],t.args[1]]}m.prim="or";class y extends p{constructor(t,e,r){super(Array.isArray(t)?{prim:y.prim,args:t}:t,e,r)}args(){return v(this.val)}tokens(){let t=0;return this.args().map((e=>{const r=this.createToken(e,this.idx+t);return r instanceof y?t+=Object.keys(r.ExtractSchema()).length:t++,r}))}Encode(t){return{prim:"Pair",args:this.tokens().map((e=>e.Encode(t)))}}ExtractSignature(){const t=this.args(),e=this.createToken(t[0],this.idx);let r=1;e instanceof m&&(r=Object.keys(e.ExtractSchema()).length);const n=this.createToken(t[1],this.idx+r),i=[];for(const t of e.ExtractSignature())for(const e of n.ExtractSignature())i.push([...t,...e]);return i}ToBigMapKey(t){return{key:this.EncodeObject(t),type:this.typeWithoutAnnotations()}}ToKey(t){return this.Execute(t)}EncodeObject(t){const[e,r]=this.tokens();let n,i;return n=e instanceof y&&!e.hasAnnotations()?t:t[e.annot()],i=r instanceof y&&!r.hasAnnotations()?t:t[r.annot()],{prim:"Pair",args:[e.EncodeObject(n),r.EncodeObject(i)]}}traversal(t,e){const r=this.args(),n=this.createToken(r[0],this.idx);let i,o=1;n instanceof y&&!n.hasAnnotations()?(i=t(n),o=Object.keys(n.ExtractSchema()).length):i={[n.annot()]:t(n)};const s=this.createToken(r[1],this.idx+o);let a;a=s instanceof y&&!s.hasAnnotations()?e(s):{[s.annot()]:e(s)};return Object.assign(Object.assign({},i),a)}Execute(t,e){const r=v(t,"Pair");return this.traversal((t=>t.Execute(r[0],e)),(t=>t.Execute(r[1],e)))}ExtractSchema(){return this.traversal((t=>t.ExtractSchema()),(t=>t.ExtractSchema()))}generateSchema(){return{__michelsonType:y.prim,schema:this.traversal((t=>t instanceof y&&!t.hasAnnotations()?t.generateSchema().schema:t.generateSchema()),(t=>t instanceof y&&!t.hasAnnotations()?t.generateSchema().schema:t.generateSchema()))}}compare(t,e){const[r,n]=this.tokens(),i=(t,e)=>t instanceof y&&!t.hasAnnotations()?e:e[t.annot()];if(r instanceof p&&n instanceof p){const o=r.compare(i(r,t),i(r,e));return 0===o?n.compare(i(n,t),i(n,e)):o}throw new Error("Not a comparable pair")}findAndReturnTokens(t,e){return y.prim===t&&e.push(this),this.tokens().map((r=>r.findAndReturnTokens(t,e))),e}}y.prim="pair";class w extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="NatValidationError"}}class _ extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Execute(t){return new a.a(t[Object.keys(t)[0]])}Encode(t){const e=t.pop(),r=this.isValid(e);if(r)throw r;return{int:new a.a(e).toFixed()}}isValid(t){const e=new a.a(t);return e.isNaN()?new w(t,this,`Value is not a number: ${t}`):e.isNegative()?new w(t,this,`Value cannot be negative: ${t}`):null}EncodeObject(t){const e=this.isValid(t);if(e)throw e;return{int:new a.a(t).toFixed()}}ExtractSchema(){return _.prim}generateSchema(){return{__michelsonType:_.prim,schema:_.prim}}ToBigMapKey(t){return{key:{int:String(t)},type:{prim:_.prim}}}ToKey({int:t}){return new a.a(t)}compare(t,e){const r=Number(t),n=Number(e);return r===n?0:r<n?-1:1}findAndReturnTokens(t,e){return _.prim===t&&e.push(this),e}}_.prim="nat";class E extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Execute(t){return t[Object.keys(t)[0]]}ExtractSchema(){return E.prim}generateSchema(){return{__michelsonType:E.prim,schema:E.prim}}Encode(t){return{string:t.pop()}}EncodeObject(t){return{string:t}}ToKey({string:t}){return t}ToBigMapKey(t){return{key:{string:t},type:{prim:E.prim}}}findAndReturnTokens(t,e){return E.prim===t&&e.push(this),e}}E.prim="string";class S extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="AddressValidationError"}}class A extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}ToBigMapKey(t){return{key:{bytes:Object(c.b58decode)(t)},type:{prim:"bytes"}}}isValid(t){return Object(c.validateAddress)(t)!==c.ValidationResult.VALID?new S(t,this,`Address is not valid: ${t}`):null}Encode(t){const e=t.pop(),r=this.isValid(e);if(r)throw r;return{string:e}}EncodeObject(t){const e=this.isValid(t);if(e)throw e;return{string:t}}Execute(t){return t.string?t.string:Object(c.encodePubKey)(t.bytes)}ExtractSchema(){return A.prim}generateSchema(){return{__michelsonType:A.prim,schema:A.prim}}ToKey({bytes:t,string:e}){return e||Object(c.encodePubKey)(t)}compare(t,e){const r=t=>t.startsWith("tz");return r(t)&&r(e)?super.compare(t,e):r(t)?-1:r(e)?1:super.compare(t,e)}findAndReturnTokens(t,e){return A.prim===t&&e.push(this),e}}A.prim="address";class O extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="MapValidationError"}}class x extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}get ValueSchema(){return this.createToken(this.val.args[1],0)}get KeySchema(){return this.createToken(this.val.args[0],0)}isValid(t){return h.isMichelsonMap(t)?null:new O(t,this,"Value must be a MichelsonMap")}Execute(t,e){const r=new h(this.val);return t.forEach((t=>{r.set(this.KeySchema.ToKey(t.args[0]),this.ValueSchema.Execute(t.args[1],e))})),r}Encode(t){const e=t.pop(),r=this.isValid(e);if(r)throw r;return Array.from(e.keys()).sort(((t,e)=>this.KeySchema.compare(t,e))).map((t=>({prim:"Elt",args:[this.KeySchema.EncodeObject(t),this.ValueSchema.EncodeObject(e.get(t))]})))}EncodeObject(t){const e=t,r=this.isValid(e);if(r)throw r;return Array.from(e.keys()).sort(((t,e)=>this.KeySchema.compare(t,e))).map((t=>({prim:"Elt",args:[this.KeySchema.EncodeObject(t),this.ValueSchema.EncodeObject(e.get(t))]})))}ExtractSchema(){return{map:{key:this.KeySchema.ExtractSchema(),value:this.ValueSchema.ExtractSchema()}}}generateSchema(){return{__michelsonType:x.prim,schema:{key:this.KeySchema.generateSchema(),value:this.ValueSchema.generateSchema()}}}findAndReturnTokens(t,e){return x.prim===t&&e.push(this),this.KeySchema.findAndReturnTokens(t,e),this.ValueSchema.findAndReturnTokens(t,e),e}}x.prim="map";class T extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Execute(t){return"true"===String(t.prim).toLowerCase()}Encode(t){return{prim:t.pop()?"True":"False"}}EncodeObject(t){return{prim:t?"True":"False"}}ExtractSchema(){return T.prim}generateSchema(){return{__michelsonType:T.prim,schema:T.prim}}ToBigMapKey(t){return{key:this.EncodeObject(t),type:{prim:T.prim}}}ToKey(t){return this.EncodeObject(t)}compare(t,e){return t&&e||!t&&!e?0:t?1:-1}findAndReturnTokens(t,e){return T.prim===t&&e.push(this),e}}T.prim="bool";class P extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="ContractValidationError"}}class R extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}isValid(t){return Object(c.validateAddress)(t)!==c.ValidationResult.VALID?new P(t,this,"Contract address is not valid"):null}Execute(t){return t.string?t.string:Object(c.encodePubKey)(t.bytes)}Encode(t){const e=t.pop(),r=this.isValid(e);if(r)throw r;return{string:e}}EncodeObject(t){const e=this.isValid(t);if(e)throw e;return{string:t}}ExtractSchema(){return R.prim}generateSchema(){const t=this.createToken(this.val.args[0],0);return{__michelsonType:R.prim,schema:{parameter:t.generateSchema()}}}findAndReturnTokens(t,e){return R.prim===t&&e.push(this),e}}R.prim="contract";class I extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="ListValidationError"}}class M extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}get valueSchema(){return this.createToken(this.val.args[0],this.idx)}isValid(t){return Array.isArray(t)?null:new I(t,this,"Value must be an array")}Encode(t){const e=t.pop(),r=this.isValid(e);if(r)throw r;const n=this.createToken(this.val.args[0],0);return e.reduce(((t,e)=>[...t,n.EncodeObject(e)]),[])}Execute(t,e){const r=this.createToken(this.val.args[0],0),n=this.isValid(t);if(n)throw n;return t.reduce(((t,n)=>[...t,r.Execute(n,e)]),[])}EncodeObject(t){const e=this.createToken(this.val.args[0],0),r=this.isValid(t);if(r)throw r;return t.reduce(((t,r)=>[...t,e.EncodeObject(r)]),[])}ExtractSchema(){return{[M.prim]:this.valueSchema.ExtractSchema()}}generateSchema(){return{__michelsonType:M.prim,schema:this.valueSchema.generateSchema()}}findAndReturnTokens(t,e){return M.prim===t&&e.push(this),this.createToken(this.val.args[0],this.idx).findAndReturnTokens(t,e),e}}M.prim="list";class N extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="MutezValidationError"}}class k extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Execute(t){return new a.a(t[Object.keys(t)[0]])}ExtractSchema(){return k.prim}generateSchema(){return{__michelsonType:k.prim,schema:k.prim}}isValid(t){return new a.a(t).isNaN()?new N(t,this,`Value is not a number: ${t}`):null}Encode(t){const e=t.pop(),r=this.isValid(e);if(r)throw r;return{int:String(e).toString()}}EncodeObject(t){const e=this.isValid(t);if(e)throw e;return{int:String(t).toString()}}ToBigMapKey(t){return{key:{int:String(t)},type:{prim:k.prim}}}ToKey({int:t}){return t}compare(t,e){const r=Number(t),n=Number(e);return r===n?0:r<n?-1:1}findAndReturnTokens(t,e){return k.prim===t&&e.push(this),e}}k.prim="mutez";class C extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="BytesValidationError"}}class L extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}ToBigMapKey(t){return{key:{bytes:t},type:{prim:L.prim}}}isValid(t){return"string"==typeof t&&/^[0-9a-fA-F]*$/.test(t)&&t.length%2==0?null:new C(t,this,`Invalid bytes: ${t}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?t.from(e).toString("hex"):e}Encode(t){let e=t.pop();e=this.convertUint8ArrayToHexString(e);const r=this.isValid(e);if(r)throw r;return{bytes:String(e).toString()}}EncodeObject(t){t=this.convertUint8ArrayToHexString(t);const e=this.isValid(t);if(e)throw e;return{bytes:String(t).toString()}}Execute(t){return t.bytes}ExtractSchema(){return L.prim}generateSchema(){return{__michelsonType:L.prim,schema:L.prim}}ToKey({bytes:t,string:e}){return e||t}findAndReturnTokens(t,e){return L.prim===t&&e.push(this),e}}L.prim="bytes";class j extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}subToken(){return this.createToken(this.val.args[0],this.idx)}schema(){return this.createToken(this.val.args[0],0)}annot(){return Array.isArray(this.val.annots)?super.annot():this.createToken(this.val.args[0],this.idx).annot()}Encode(t){const e=t;return null==e?{prim:"None"}:!Array.isArray(e)||void 0!==e[e.length-1]&&null!==e[e.length-1]?{prim:"Some",args:[this.schema().Encode(t)]}:(e.pop(),{prim:"None"})}EncodeObject(t){const e=t;return null==e?{prim:"None"}:{prim:"Some",args:[this.schema().EncodeObject(e)]}}Execute(t,e){return"None"===t.prim?null:this.schema().Execute(t.args[0],e)}ExtractSchema(){return this.schema().ExtractSchema()}generateSchema(){return{__michelsonType:j.prim,schema:this.schema().generateSchema()}}ExtractSignature(){return[...this.schema().ExtractSignature(),[]]}get KeySchema(){return this.schema()}compare(t,e){return t?e?this.KeySchema.compare(t,e):1:-1}ToKey(t){return this.Execute(t)}ToBigMapKey(t){return{key:this.EncodeObject(t),type:this.typeWithoutAnnotations()}}findAndReturnTokens(t,e){return j.prim===t&&e.push(this),this.subToken().findAndReturnTokens(t,e),e}}j.prim="option";class D extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Execute(t){return t.string&&/^\d+$/.test(t.string)?new Date(1e3*Number(t.string)).toISOString():t.string?new Date(t.string).toISOString():t.int?new Date(1e3*Number(t.int)).toISOString():void 0}Encode(t){return{string:t.pop()}}EncodeObject(t){return{string:t}}ExtractSchema(){return D.prim}generateSchema(){return{__michelsonType:D.prim,schema:D.prim}}ToKey({string:t}){return t}ToBigMapKey(t){return{key:{string:t},type:{prim:D.prim}}}findAndReturnTokens(t,e){return D.prim===t&&e.push(this),e}}D.prim="timestamp";class U extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="IntValidationError"}}class B extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Execute(t){return new a.a(t[Object.keys(t)[0]])}ExtractSchema(){return B.prim}generateSchema(){return{__michelsonType:B.prim,schema:B.prim}}isValid(t){return new a.a(t).isNaN()?new U(t,this,`Value is not a number: ${t}`):null}Encode(t){const e=t.pop(),r=this.isValid(e);if(r)throw r;return{int:new a.a(e).toFixed()}}EncodeObject(t){const e=this.isValid(t);if(e)throw e;return{int:new a.a(t).toFixed()}}ToBigMapKey(t){return{key:{int:String(t)},type:{prim:B.prim}}}ToKey({int:t}){return t}compare(t,e){const r=Number(t),n=Number(e);return r===n?0:r<n?-1:1}findAndReturnTokens(t,e){return B.prim===t&&e.push(this),e}}B.prim="int";class F extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Encode(t){return t.pop(),{prim:"Unit"}}EncodeObject(t){return{prim:"Unit"}}Execute(t){return Lt}ExtractSchema(){return F.prim}generateSchema(){return{__michelsonType:F.prim,schema:F.prim}}compare(t,e){return 0}ToKey(t){return Lt}ToBigMapKey(t){return{key:{prim:"Unit"},type:{prim:F.prim}}}findAndReturnTokens(t,e){return F.prim===t&&e.push(this),e}}F.prim="unit";class V extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="KeyValidationError"}}class K extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Execute(t){return t.string?t.string:Object(c.encodeKey)(t.bytes)}isValid(t){return Object(c.validatePublicKey)(t)!==c.ValidationResult.VALID?new V(t,this,"Key is not valid"):null}Encode(t){const e=t.pop(),r=this.isValid(e);if(r)throw r;return{string:e}}EncodeObject(t){const e=this.isValid(t);if(e)throw e;return{string:t}}ExtractSchema(){return K.prim}generateSchema(){return{__michelsonType:K.prim,schema:K.prim}}ToKey(t){return this.Execute(t)}ToBigMapKey(t){return{key:{string:t},type:{prim:K.prim}}}compare(e,r){const n=this.getPrefix(e),i=this.getPrefix(r);if(n===c.Prefix.EDPK&&i!==c.Prefix.EDPK)return-1;if(n===c.Prefix.SPPK&&i!==c.Prefix.SPPK)return i===c.Prefix.EDPK?1:-1;if(n===c.Prefix.P2PK){if(i!==c.Prefix.P2PK)return 1;const n=this.getP256PublicKeyComparableBytes(e),o=this.getP256PublicKeyComparableBytes(r);return t.compare(n,o)}return super.compare(e,r)}getPrefix(t){return t.substring(0,4)}getP256PublicKeyComparableBytes(t){return Object(c.b58cdecode)(t,c.prefix[c.Prefix.P2PK]).slice(1)}findAndReturnTokens(t,e){return K.prim===t&&e.push(this),e}}K.prim="key";class H extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="KeyHashValidationError"}}class $ extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Execute(t){return t.string?t.string:Object(c.encodeKeyHash)(t.bytes)}isValid(t){return Object(c.validateKeyHash)(t)!==c.ValidationResult.VALID?new H(t,this,`KeyHash is not valid: ${t}`):null}Encode(t){const e=t.pop(),r=this.isValid(e);if(r)throw r;return{string:e}}EncodeObject(t){const e=this.isValid(t);if(e)throw e;return{string:t}}ExtractSchema(){return $.prim}generateSchema(){return{__michelsonType:$.prim,schema:$.prim}}ToKey({string:t,bytes:e}){return t||Object(c.encodeKeyHash)(e)}ToBigMapKey(t){return{key:{string:t},type:{prim:$.prim}}}findAndReturnTokens(t,e){return $.prim===t&&e.push(this),e}}$.prim="key_hash";class G extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="SignatureValidationError"}}class z extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Execute(t){return t.string}isValid(t){return Object(c.validateSignature)(t)!==c.ValidationResult.VALID?new G(t,this,"Signature is not valid"):null}Encode(t){const e=t.pop(),r=this.isValid(e);if(r)throw r;return{string:e}}EncodeObject(t){const e=this.isValid(t);if(e)throw e;return{string:t}}ExtractSchema(){return z.prim}generateSchema(){return{__michelsonType:z.prim,schema:z.prim}}ToKey(t){return this.Execute(t)}ToBigMapKey(t){return{key:{string:t},type:{prim:z.prim}}}findAndReturnTokens(t,e){return z.prim===t&&e.push(this),e}}z.prim="signature";class q extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}get paramSchema(){return this.createToken(this.val.args[0],this.idx)}get returnSchema(){return this.createToken(this.val.args[1],this.idx+1)}Execute(t){return t.string?t.string:t}Encode(t){return t.pop()}EncodeObject(t){return t}ExtractSchema(){return{[q.prim]:{parameters:this.paramSchema.ExtractSchema(),returns:this.returnSchema.ExtractSchema()}}}generateSchema(){return{__michelsonType:q.prim,schema:{parameters:this.paramSchema.generateSchema(),returns:this.returnSchema.generateSchema()}}}findAndReturnTokens(t,e){return q.prim===t&&e.push(this),this.createToken(this.val.args[0],this.idx).findAndReturnTokens(t,e),this.createToken(this.val.args[1],this.idx).findAndReturnTokens(t,e),e}}q.prim="lambda";class W extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Execute(t){return t.string}Encode(...t){return{string:t.pop()}}EncodeObject(t){return{string:t}}ExtractSchema(){return W.prim}generateSchema(){return{__michelsonType:W.prim,schema:W.prim}}findAndReturnTokens(t,e){return W.prim===t&&e.push(this),e}}W.prim="operation";class Y extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="SetValidationError"}}class J extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}get KeySchema(){return this.createToken(this.val.args[0],0)}isValid(t){return Array.isArray(t)?null:new Y(t,this,"Value must be an array")}Encode(t){const e=t.pop(),r=this.isValid(e);if(r)throw r;return e.sort(((t,e)=>this.KeySchema.compare(t,e))).reduce(((t,e)=>[...t,this.KeySchema.EncodeObject(e)]),[])}Execute(t,e){return t.reduce(((t,r)=>[...t,this.KeySchema.Execute(r,e)]),[])}EncodeObject(t){const e=this.isValid(t);if(e)throw e;return t.sort(((t,e)=>this.KeySchema.compare(t,e))).reduce(((t,e)=>[...t,this.KeySchema.EncodeObject(e)]),[])}ExtractSchema(){return J.prim}generateSchema(){return{__michelsonType:J.prim,schema:this.KeySchema.generateSchema()}}findAndReturnTokens(t,e){return J.prim===t&&e.push(this),this.KeySchema.findAndReturnTokens(t,e),e}}J.prim="set";class Z extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="ChainIDValidationError"}}class X extends p{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}isValid(t){return Object(c.validateChain)(t)!==c.ValidationResult.VALID?new Z(t,this,"ChainID is not valid"):null}Execute(t){return t[Object.keys(t)[0]]}ExtractSchema(){return X.prim}generateSchema(){return{__michelsonType:X.prim,schema:X.prim}}Encode(t){const e=t.pop(),r=this.isValid(e);if(r)throw r;return{string:e}}EncodeObject(t){const e=this.isValid(t);if(e)throw e;return{string:t}}ToKey({string:t}){return t}ToBigMapKey(t){return{key:{string:t},type:{prim:X.prim}}}findAndReturnTokens(t,e){return X.prim===t&&e.push(this),e}}X.prim="chain_id";class Q extends Error{constructor(){super("Tickets cannot be sent to the blockchain; they are created on-chain"),this.name="TicketEncodeError"}}const tt={prim:"contract"},et={prim:"int"};class rt extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(t){throw new Q}EncodeObject(t){throw new Q}Execute(t,e){if(e&&e[rt.prim])return e[rt.prim](t,this.val);const r=this.createToken(tt,this.idx),n=this.valueToken,i=this.createToken(et,this.idx);return void 0===t.args[2]&&void 0!==t.args[1].args?{ticketer:r.Execute(t.args[0],e),value:n.Execute(t.args[1].args[0],e),amount:i.Execute(t.args[1].args[1],e)}:{ticketer:r.Execute(t.args[0],e),value:n.Execute(t.args[1],e),amount:i.Execute(t.args[2],e)}}ExtractSchema(){return{ticketer:R.prim,value:this.valueToken.ExtractSchema(),amount:B.prim}}generateSchema(){return{__michelsonType:rt.prim,schema:{value:this.valueToken.generateSchema(),ticketer:{__michelsonType:R.prim,schema:R.prim},amount:{__michelsonType:B.prim,schema:B.prim}}}}findAndReturnTokens(t,e){return rt.prim===t&&e.push(this),this.valueToken.findAndReturnTokens(t,e),e}}rt.prim="ticket";class nt extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="NeverTokenError"}}class it extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Encode(t){const e=t.pop();throw new nt(e,this,"Assigning a value to the type never is forbidden.")}EncodeObject(t){throw new nt(t,this,"Assigning a value to the type never is forbidden.")}Execute(t){throw new nt(t,this,"There is no literal value for the type never.")}ExtractSchema(){return it.prim}generateSchema(){return{__michelsonType:it.prim,schema:it.prim}}findAndReturnTokens(t,e){return it.prim===t&&e.push(this),e}}it.prim="never";class ot extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="SaplingStateValidationError"}}class st extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}isValid(t){return"object"==typeof t&&0===Object.keys(t).length}Execute(t,e){if(e&&e[st.prim])return e[st.prim](t,this.val);if("int"in t)return t.int;throw new Error(`Sapling state is expecting an object with an int property. Got ${JSON.stringify(t)}`)}Encode(t){const e=t.pop();if(this.isValid(e))return[];throw new ot(e,this,`Invalid sapling_state. Received: ${e} while expecting: {}`)}EncodeObject(t){if(this.isValid(t))return[];throw new ot(t,this,`Invalid sapling_state. Received: ${t} while expecting: {}`)}ExtractSchema(){return{[st.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:st.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(t,e){return st.prim===t&&e.push(this),e}}st.prim="sapling_state";class at extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="SaplingTransactionValidationError"}}class ct extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Execute(t){throw new Error("There is no literal value for the sapling_transaction type.")}validateBytes(t){const e=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(t);if(e&&e[2].length%2==0)return e[2];throw new at(t,this,`Invalid bytes: ${t}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?t.from(e).toString("hex"):e}Encode(t){let e=t.pop();return e=this.validateBytes(this.convertUint8ArrayToHexString(e)),{bytes:String(e).toString()}}EncodeObject(t){return t=this.validateBytes(this.convertUint8ArrayToHexString(t)),{bytes:String(t).toString()}}ExtractSchema(){return{[ct.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:ct.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(t,e){return ct.prim===t&&e.push(this),e}}ct.prim="sapling_transaction";class ut extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="Bls12381frValidationError"}}class ft extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}isValid(t){return/^[0-9a-fA-F]*$/.test(t)&&t.length%2==0?null:new ut(t,this,`Invalid bytes: ${t}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?t.from(e).toString("hex"):e}Encode(t){let e=t.pop();if("number"==typeof e)return{int:e.toString()};{e=this.convertUint8ArrayToHexString(e);const t=this.isValid(e);if(t)throw t;return{bytes:e}}}EncodeObject(t){if("number"==typeof t)return{int:t.toString()};{t=this.convertUint8ArrayToHexString(t);const e=this.isValid(t);if(e)throw e;return{bytes:t}}}Execute(t){return t.bytes}ExtractSchema(){return ft.prim}generateSchema(){return{__michelsonType:ft.prim,schema:ft.prim}}findAndReturnTokens(t,e){return ft.prim===t&&e.push(this),e}}ft.prim="bls12_381_fr";class ht extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="Bls12381g1ValidationError"}}class lt extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}isValid(t){return/^[0-9a-fA-F]*$/.test(t)&&t.length%2==0?null:new ht(t,this,`Invalid bytes: ${t}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?t.from(e).toString("hex"):e}Encode(t){let e=t.pop();e=this.convertUint8ArrayToHexString(e);const r=this.isValid(e);if(r)throw r;return{bytes:e}}EncodeObject(t){t=this.convertUint8ArrayToHexString(t);const e=this.isValid(t);if(e)throw e;return{bytes:t}}Execute(t){return t.bytes}ExtractSchema(){return lt.prim}generateSchema(){return{__michelsonType:lt.prim,schema:lt.prim}}findAndReturnTokens(t,e){return lt.prim===t&&e.push(this),e}}lt.prim="bls12_381_g1";class dt extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="Bls12381g2ValidationError"}}class pt extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}isValid(t){return/^[0-9a-fA-F]*$/.test(t)&&t.length%2==0?null:new dt(t,this,`Invalid bytes: ${t}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?t.from(e).toString("hex"):e}Encode(t){let e=t.pop();e=this.convertUint8ArrayToHexString(e);const r=this.isValid(e);if(r)throw r;return{bytes:e}}EncodeObject(t){t=this.convertUint8ArrayToHexString(t);const e=this.isValid(t);if(e)throw e;return{bytes:t}}Execute(t){return t.bytes}ExtractSchema(){return pt.prim}generateSchema(){return{__michelsonType:pt.prim,schema:pt.prim}}findAndReturnTokens(t,e){return pt.prim===t&&e.push(this),e}}pt.prim="bls12_381_g2";class bt extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="ChestValidationError"}}class gt extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}isValid(t){return/^[0-9a-fA-F]*$/.test(t)&&t.length%2==0?null:new bt(t,this,`Invalid bytes: ${t}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?t.from(e).toString("hex"):e}Encode(t){let e=t.pop();e=this.convertUint8ArrayToHexString(e);const r=this.isValid(e);if(r)throw r;return{bytes:e}}EncodeObject(t){t=this.convertUint8ArrayToHexString(t);const e=this.isValid(t);if(e)throw e;return{bytes:t}}Execute(t){return t.bytes}ExtractSchema(){return gt.prim}generateSchema(){return{__michelsonType:gt.prim,schema:gt.prim}}findAndReturnTokens(t,e){return gt.prim===t&&e.push(this),e}}gt.prim="chest";class mt extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="ChestKeyValidationError"}}class vt extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}isValid(t){return/^[0-9a-fA-F]*$/.test(t)&&t.length%2==0?null:new mt(t,this,`Invalid bytes: ${t}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?t.from(e).toString("hex"):e}Encode(t){let e=t.pop();e=this.convertUint8ArrayToHexString(e);const r=this.isValid(e);if(r)throw r;return{bytes:e}}EncodeObject(t){t=this.convertUint8ArrayToHexString(t);const e=this.isValid(t);if(e)throw e;return{bytes:t}}Execute(t){return t.bytes}ExtractSchema(){return vt.prim}generateSchema(){return{__michelsonType:vt.prim,schema:vt.prim}}findAndReturnTokens(t,e){return vt.prim===t&&e.push(this),e}}vt.prim="chest_key";class yt extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="GlobalConstantEncodingError"}}class wt extends l{constructor(t,e,r){super(t,e,r),this.value=t,this.token=e,this.name="GlobalConstantDecodingError"}}class _t extends d{constructor(t,e,r){super(t,e,r),this.val=t,this.idx=e,this.fac=r}Execute(t,e){if(e&&e[_t.prim])return e[_t.prim](t,this.val);throw new wt(t,this,`Unable to decode a value represented by a global constants. Please provide an expanded script to the Michelson-Encoder or semantics for the decoding. The following global constant hash was encountered: ${this.val.args[0].string}.`)}Encode(t){throw new yt(t,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}EncodeObject(t){throw new yt(t,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}ExtractSchema(){return _t.prim}generateSchema(){return{__michelsonType:_t.prim,schema:{hash:this.val.args[0].string}}}findAndReturnTokens(t,e){return _t.prim===t&&e.push(this),e}}_t.prim="constant";const Et=[y,_,E,g,A,x,T,m,R,M,k,L,j,D,B,F,K,$,z,q,W,J,X,rt,it,st,ct,ft,lt,pt,gt,vt,_t];class St extends Error{constructor(t,e){super(t),this.message=t,this.data=e,this.name="Invalid token error"}}function At(t,e){if(Array.isArray(t))return new y(t,e,At);const r=Et.find((e=>e.prim===t.prim));if(!r)throw new St("Malformed data expected a value with a valid prim property",t);return new r(t,e,At)}var Ot;const xt=Symbol.for("taquito-schema-type-symbol");function Tt(t,e=y.prim){var r,n;return Array.isArray(t)?Tt({prim:e,args:t},e):t.prim===e&&t.args&&t.args.length>2?Object.assign(Object.assign({},t),{args:[null===(r=t.args)||void 0===r?void 0:r[0],{prim:e,args:null===(n=t.args)||void 0===n?void 0:n.slice(1)}]}):t}function Pt(t,e){const r=Tt(t),n=Tt(e);return r.prim===n.prim&&(void 0===r.args&&void 0===n.args||void 0!==r.args&&void 0!==n.args&&r.args.length===n.args.length&&r.args.every(((t,e)=>{var r;return Pt(t,null===(r=n.args)||void 0===r?void 0:r[e])})))&&(void 0===r.annots&&void 0===n.annots||void 0!==r.annots&&void 0!==n.annots&&r.annots.length===n.annots.length&&r.annots.every(((t,e)=>{var r;return t===(null===(r=n.annots)||void 0===r?void 0:r[e])})))}class Rt{constructor(t){if(this.val=t,this[Ot]=!0,this.root=At(t,0),this.root instanceof g)this.bigMap=this.root;else if(this.isExpressionExtended(t)&&"pair"===t.prim){const e=t.args[0];this.isExpressionExtended(e)&&"big_map"===e.prim&&(this.bigMap=new g(e,0,At))}}static isSchema(t){return t&&!0===t[xt]}static fromRPCResponse(t){const e=t&&t.script&&Array.isArray(t.script.code)&&t.script.code.find((t=>"storage"===t.prim));if(!e||!Array.isArray(e.args))throw new Error("Invalid rpc response passed as arguments");return new Rt(e.args[0])}isExpressionExtended(t){return"prim"in t&&Array.isArray(t.args)}removeTopLevelAnnotation(t){return(this.root instanceof y||this.root instanceof m)&&this.root.hasAnnotations()&&"object"==typeof t&&1===Object.keys(t).length?t[Object.keys(t)[0]]:t}Execute(t,e){const r=this.root.Execute(t,e);return this.removeTopLevelAnnotation(r)}Typecheck(t){if(this.root instanceof g&&Number.isInteger(Number(t)))return!0;try{return this.root.EncodeObject(t),!0}catch(t){return!1}}ExecuteOnBigMapDiff(t,e){if(!this.bigMap)throw new Error("No big map schema");if(!Array.isArray(t))throw new Error("Invalid big map diff. It must be an array");const r=t.map((({key:t,value:e})=>({args:[t,e]})));return this.bigMap.Execute(r,e)}ExecuteOnBigMapValue(t,e){if(!this.bigMap)throw new Error("No big map schema");return this.bigMap.ValueSchema.Execute(t,e)}EncodeBigMapKey(t){if(!this.bigMap)throw new Error("No big map schema");try{return this.bigMap.KeySchema.ToBigMapKey(t)}catch(t){throw new Error("Unable to encode big map key: "+t)}}Encode(t){try{return this.root.EncodeObject(t)}catch(t){if(t instanceof l)throw t;throw new Error(`Unable to encode storage object. ${t}`)}}ExtractSchema(){return this.removeTopLevelAnnotation(this.root.ExtractSchema())}generateSchema(){return this.removeTopLevelAnnotation(this.root.generateSchema())}ComputeState(t,e){if(!this.bigMap)throw new Error("No big map schema");const r=t.reduce(((t,e)=>Object.assign(Object.assign({},t),this.ExecuteOnBigMapDiff(e.contents[0].metadata.operation_result.big_map_diff))),{});return Object.assign(Object.assign({},this.Execute(e)),{[this.bigMap.annot()]:r})}FindFirstInTopLevelPair(t,e){return this.findValue(this.root.val,t,e)}findValue(t,e,r){if(Pt(r,t))return e;if(Array.isArray(t)||"pair"===t.prim){const n=Tt(t),i=Tt(e,"Pair");if(void 0===n.args||void 0===i.args)throw new Error("Tokens have no arguments");return this.findValue(n.args[0],i.args[0],r)||this.findValue(n.args[1],i.args[1],r)}}findToken(t){return this.root.findAndReturnTokens(t,[])}}Ot=xt;class It{constructor(t){this.root=At(t,0)}static fromRPCResponse(t){const e=t&&t.script&&Array.isArray(t.script.code)&&t.script.code.find((t=>"parameter"===t.prim));if(!e||!Array.isArray(e.args))throw new Error("Invalid rpc response passed as arguments");return new It(e.args[0])}get isMultipleEntryPoint(){return this.root instanceof m||this.root instanceof j&&this.root.subToken()instanceof m}get hasAnnotation(){return!this.isMultipleEntryPoint||"0"!==Object.keys(this.ExtractSchema())[0]}Execute(t,e){return this.root.Execute(t,e)}Encode(...t){try{return this.root.Encode(t.reverse())}catch(t){if(t instanceof l)throw t;throw new Error(`Unable to encode parameter. ${t}`)}}EncodeObject(t){try{return this.root.EncodeObject(t)}catch(t){if(t instanceof l)throw t;throw new Error(`Unable to encode parameter object. ${t}`)}}ExtractSchema(){return this.root.ExtractSchema()}generateSchema(){return this.root.generateSchema()}ExtractSignatures(){return this.root.ExtractSignature()}}class Mt extends Error{constructor(t,e){super(`Unable to encode the parameter of the view: ${t}.`),this.smartContractViewName=t,this.originalError=e,this.name="ViewEncodingError"}}class Nt extends Error{constructor(t){super(t),this.message=t,this.name="InvalidScriptError"}}class kt{constructor(t){if(4!==t.length||!("string"in t[0]))throw new Nt(`Invalid on-chain view: ${JSON.stringify(t)}`);this.viewName=t[0].string,this.viewArgsType=t[1],this.viewReturnType=t[2],this.instructions=t[3],this.rootArgsType=At(this.viewArgsType,0),this.rootReturnType=At(this.viewReturnType,0)}static fromRPCResponse(t){const e=[],r=t&&t.script&&Array.isArray(t.script.code)&&t.script.code.filter((t=>"view"===t.prim));return r&&r.forEach((t=>{if(!t.args||4!==t.args.length)throw new Nt(`Invalid on-chain view found in the script: ${JSON.stringify(t)}`);e.push(new kt(t.args))})),e}encodeViewArgs(t){try{return this.rootArgsType.EncodeObject(t)}catch(t){throw new Mt(this.viewName,t)}}decodeViewResult(t,e){return this.rootReturnType.Execute(t,e)}extractArgsSchema(){return this.rootArgsType.ExtractSchema()}extractResultSchema(){return this.rootReturnType.ExtractSchema()}}const Ct={commitHash:"5da8cec9c84c0ab7bc37c0eb09e68db1b3a8b1f0",version:"12.0.0-beta-RC.0"},Lt=Symbol(),jt={}}.call(this,r(14).Buffer)},function(t,e,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",f=u+"Number primitive has more than 15 significant digits: ",h=1e14,l=14,d=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],b=1e7,g=1e9;function m(t){var e=0|t;return t>0||t===e?e:e-1}function v(t){for(var e,r,n=1,i=t.length,o=t[0]+"";n<i;){for(e=t[n++]+"",r=l-e.length;r--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function y(t,e){var r,n,i=t.c,o=e.c,s=t.s,a=e.s,c=t.e,u=e.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=c==u,!i||!o)return n?0:!i^r?1:-1;if(!n)return c>u^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function w(t,e,r,n){if(t<e||t>r||t!==c(t))throw Error(u+(n||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function _(t){var e=t.c.length-1;return m(t.e/l)==e&&t.c[e]%2!=0}function E(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function S(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(++e>(n=t.length)){for(i=r,e-=n;--e;i+=r);t+=i}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}o=function t(e){var r,n,i,o,A,O,x,T,P,R,I=$.prototype={constructor:$,toString:null,valueOf:null},M=new $(1),N=20,k=4,C=-7,L=21,j=-1e7,D=1e7,U=!1,B=1,F=0,V={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",H=!0;function $(t,e){var r,o,a,u,h,p,b,g,m=this;if(!(m instanceof $))return new $(t,e);if(null==e){if(t&&!0===t._isBigNumber)return m.s=t.s,void(!t.c||t.e>D?m.c=m.e=null:t.e<j?m.c=[m.e=0]:(m.e=t.e,m.c=t.c.slice()));if((p="number"==typeof t)&&0*t==0){if(m.s=1/t<0?(t=-t,-1):1,t===~~t){for(u=0,h=t;h>=10;h/=10,u++);return void(u>D?m.c=m.e=null:(m.e=u,m.c=[t]))}g=String(t)}else{if(!s.test(g=String(t)))return i(m,g,p);m.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(h=g.search(/e/i))>0?(u<0&&(u=h),u+=+g.slice(h+1),g=g.substring(0,h)):u<0&&(u=g.length)}else{if(w(e,2,K.length,"Base"),10==e&&H)return W(m=new $(t),N+m.e+1,k);if(g=String(t),p="number"==typeof t){if(0*t!=0)return i(m,g,p,e);if(m.s=1/t<0?(g=g.slice(1),-1):1,$.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(f+t)}else m.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(r=K.slice(0,e),u=h=0,b=g.length;h<b;h++)if(r.indexOf(o=g.charAt(h))<0){if("."==o){if(h>u){u=b;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,h=-1,u=0;continue}return i(m,String(t),p,e)}p=!1,(u=(g=n(g,e,10,m.s)).indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(h=0;48===g.charCodeAt(h);h++);for(b=g.length;48===g.charCodeAt(--b););if(g=g.slice(h,++b)){if(b-=h,p&&$.DEBUG&&b>15&&(t>d||t!==c(t)))throw Error(f+m.s*t);if((u=u-h-1)>D)m.c=m.e=null;else if(u<j)m.c=[m.e=0];else{if(m.e=u,m.c=[],h=(u+1)%l,u<0&&(h+=l),h<b){for(h&&m.c.push(+g.slice(0,h)),b-=l;h<b;)m.c.push(+g.slice(h,h+=l));h=l-(g=g.slice(h)).length}else h-=b;for(;h--;g+="0");m.c.push(+g)}}else m.c=[m.e=0]}function G(t,e,r,n){var i,o,s,a,c;if(null==r?r=k:w(r,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==e)c=v(t.c),c=1==n||2==n&&(s<=C||s>=L)?E(c,s):S(c,s,"0");else if(o=(t=W(new $(t),e,r)).e,a=(c=v(t.c)).length,1==n||2==n&&(e<=o||o<=C)){for(;a<e;c+="0",a++);c=E(c,o)}else if(e-=s,c=S(c,o,"0"),o+1>a){if(--e>0)for(c+=".";e--;c+="0");}else if((e+=o-a)>0)for(o+1==a&&(c+=".");e--;c+="0");return t.s<0&&i?"-"+c:c}function z(t,e){for(var r,n=1,i=new $(t[0]);n<t.length;n++){if(!(r=new $(t[n])).s){i=r;break}e.call(i,r)&&(i=r)}return i}function q(t,e,r){for(var n=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,n++);return(r=n+r*l-1)>D?t.c=t.e=null:r<j?t.c=[t.e=0]:(t.e=r,t.c=e),t}function W(t,e,r,n){var i,o,s,u,f,d,b,g=t.c,m=p;if(g){t:{for(i=1,u=g[0];u>=10;u/=10,i++);if((o=e-i)<0)o+=l,s=e,b=(f=g[d=0])/m[i-s-1]%10|0;else if((d=a((o+1)/l))>=g.length){if(!n)break t;for(;g.length<=d;g.push(0));f=b=0,i=1,s=(o%=l)-l+1}else{for(f=u=g[d],i=1;u>=10;u/=10,i++);b=(s=(o%=l)-l+i)<0?0:f/m[i-s-1]%10|0}if(n=n||e<0||null!=g[d+1]||(s<0?f:f%m[i-s-1]),n=r<4?(b||n)&&(0==r||r==(t.s<0?3:2)):b>5||5==b&&(4==r||n||6==r&&(o>0?s>0?f/m[i-s]:0:g[d-1])%10&1||r==(t.s<0?8:7)),e<1||!g[0])return g.length=0,n?(e-=t.e+1,g[0]=m[(l-e%l)%l],t.e=-e||0):g[0]=t.e=0,t;if(0==o?(g.length=d,u=1,d--):(g.length=d+1,u=m[l-o],g[d]=s>0?c(f/m[i-s]%m[s])*u:0),n)for(;;){if(0==d){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(t.e++,g[0]==h&&(g[0]=1));break}if(g[d]+=u,g[d]!=h)break;g[d--]=0,u=1}for(o=g.length;0===g[--o];g.pop());}t.e>D?t.c=t.e=null:t.e<j&&(t.c=[t.e=0])}return t}function Y(t){var e,r=t.e;return null===r?t.toString():(e=v(t.c),e=r<=C||r>=L?E(e,r):S(e,r,"0"),t.s<0?"-"+e:e)}return $.clone=t,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(u+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(w(r=t[e],0,g,e),N=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(w(r=t[e],0,8,e),k=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(w(r[0],-g,0,e),w(r[1],0,g,e),C=r[0],L=r[1]):(w(r,-g,g,e),C=-(L=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)w(r[0],-g,-1,e),w(r[1],1,g,e),j=r[0],D=r[1];else{if(w(r,-g,g,e),!r)throw Error(u+e+" cannot be zero: "+r);j=-(D=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(u+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw U=!r,Error(u+"crypto unavailable");U=r}else U=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(w(r=t[e],0,9,e),B=r),t.hasOwnProperty(e="POW_PRECISION")&&(w(r=t[e],0,g,e),F=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(u+e+" not an object: "+r);V=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+e+" invalid: "+r);H="0123456789"==r.slice(0,10),K=r}}return{DECIMAL_PLACES:N,ROUNDING_MODE:k,EXPONENTIAL_AT:[C,L],RANGE:[j,D],CRYPTO:U,MODULO_MODE:B,POW_PRECISION:F,FORMAT:V,ALPHABET:K}},$.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!$.DEBUG)return!0;var e,r,n=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===c(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((e=(i+1)%l)<1&&(e+=l),String(n[0]).length==e){for(e=0;e<n.length;e++)if((r=n[e])<0||r>=h||r!==c(r))break t;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(u+"Invalid BigNumber: "+t)},$.maximum=$.max=function(){return z(arguments,I.lt)},$.minimum=$.min=function(){return z(arguments,I.gt)},$.random=(o=9007199254740992,A=Math.random()*o&2097151?function(){return c(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,n,i,o,s=0,f=[],h=new $(M);if(null==t?t=N:w(t,0,g),i=a(t/l),U)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)(o=131072*e[s]+(e[s+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[s]=r[0],e[s+1]=r[1]):(f.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw U=!1,Error(u+"crypto unavailable");for(e=crypto.randomBytes(i*=7);s<i;)(o=281474976710656*(31&e[s])+1099511627776*e[s+1]+4294967296*e[s+2]+16777216*e[s+3]+(e[s+4]<<16)+(e[s+5]<<8)+e[s+6])>=9e15?crypto.randomBytes(7).copy(e,s):(f.push(o%1e14),s+=7);s=i/7}if(!U)for(;s<i;)(o=A())<9e15&&(f[s++]=o%1e14);for(i=f[--s],t%=l,i&&t&&(o=p[l-t],f[s]=c(i/o)*o);0===f[s];f.pop(),s--);if(s<0)f=[n=0];else{for(n=-1;0===f[0];f.splice(0,1),n-=l);for(s=1,o=f[0];o>=10;o/=10,s++);s<l&&(n-=l-s)}return h.e=n,h.c=f,h}),$.sum=function(){for(var t=1,e=arguments,r=new $(e[0]);t<e.length;)r=r.plus(e[t++]);return r},n=function(){var t="0123456789";function e(t,e,r,n){for(var i,o,s=[0],a=0,c=t.length;a<c;){for(o=s.length;o--;s[o]*=e);for(s[0]+=n.indexOf(t.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 c,u,f,h,l,d,p,b,g=n.indexOf("."),m=N,y=k;for(g>=0&&(h=F,F=0,n=n.replace(".",""),d=(b=new $(i)).pow(n.length-g),F=h,b.c=e(S(v(d.c),d.e,"0"),10,o,t),b.e=b.c.length),f=h=(p=e(n,i,o,a?(c=K,t):(c=t,K))).length;0==p[--h];p.pop());if(!p[0])return c.charAt(0);if(g<0?--f:(d.c=p,d.e=f,d.s=s,p=(d=r(d,b,m,y,o)).c,l=d.r,f=d.e),g=p[u=f+m+1],h=o/2,l=l||u<0||null!=p[u+1],l=y<4?(null!=g||l)&&(0==y||y==(d.s<0?3:2)):g>h||g==h&&(4==y||l||6==y&&1&p[u-1]||y==(d.s<0?8:7)),u<1||!p[0])n=l?S(c.charAt(1),-m,c.charAt(0)):c.charAt(0);else{if(p.length=u,l)for(--o;++p[--u]>o;)p[u]=0,u||(++f,p=[1].concat(p));for(h=p.length;!p[--h];);for(g=0,n="";g<=h;n+=c.charAt(p[g++]));n=S(n,f,c.charAt(0))}return n}}(),r=function(){function t(t,e,r){var n,i,o,s,a=0,c=t.length,u=e%b,f=e/b|0;for(t=t.slice();c--;)a=((i=u*(o=t[c]%b)+(n=f*o+(s=t[c]/b|0)*u)%b*b+a)/r|0)+(n/b|0)+f*s,t[c]=i%r;return a&&(t=[a].concat(t)),t}function e(t,e,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,i,o,s,a){var u,f,d,p,b,g,v,y,w,_,E,S,A,O,x,T,P,R=n.s==i.s?1:-1,I=n.c,M=i.c;if(!(I&&I[0]&&M&&M[0]))return new $(n.s&&i.s&&(I?!M||I[0]!=M[0]:M)?I&&0==I[0]||!M?0*R:R/0:NaN);for(w=(y=new $(R)).c=[],R=o+(f=n.e-i.e)+1,a||(a=h,f=m(n.e/l)-m(i.e/l),R=R/l|0),d=0;M[d]==(I[d]||0);d++);if(M[d]>(I[d]||0)&&f--,R<0)w.push(1),p=!0;else{for(O=I.length,T=M.length,d=0,R+=2,(b=c(a/(M[0]+1)))>1&&(M=t(M,b,a),I=t(I,b,a),T=M.length,O=I.length),A=T,E=(_=I.slice(0,T)).length;E<T;_[E++]=0);P=M.slice(),P=[0].concat(P),x=M[0],M[1]>=a/2&&x++;do{if(b=0,(u=e(M,_,T,E))<0){if(S=_[0],T!=E&&(S=S*a+(_[1]||0)),(b=c(S/x))>1)for(b>=a&&(b=a-1),v=(g=t(M,b,a)).length,E=_.length;1==e(g,_,v,E);)b--,r(g,T<v?P:M,v,a),v=g.length,u=1;else 0==b&&(u=b=1),v=(g=M.slice()).length;if(v<E&&(g=[0].concat(g)),r(_,g,E,a),E=_.length,-1==u)for(;e(M,_,T,E)<1;)b++,r(_,T<E?P:M,E,a),E=_.length}else 0===u&&(b++,_=[0]);w[d++]=b,_[0]?_[E++]=I[A]||0:(_=[I[A]],E=1)}while((A++<O||null!=_[0])&&R--);p=null!=_[0],w[0]||w.splice(0,1)}if(a==h){for(d=1,R=w[0];R>=10;R/=10,d++);W(y,o+(y.e=d+f*l-1)+1,s,p)}else y.e=f,y.r=+p;return y}}(),O=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,T=/^\.([^.]+)$/,P=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,r,n){var i,o=r?e:e.replace(R,"");if(P.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(O,(function(t,e,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?t:e})),n&&(i=n,o=o.replace(x,"$1").replace(T,"0.$1")),e!=o))return new $(o,i);if($.DEBUG)throw Error(u+"Not a"+(n?" base "+n:"")+" number: "+e);t.s=null}t.c=t.e=null},I.absoluteValue=I.abs=function(){var t=new $(this);return t.s<0&&(t.s=1),t},I.comparedTo=function(t,e){return y(this,new $(t,e))},I.decimalPlaces=I.dp=function(t,e){var r,n,i,o=this;if(null!=t)return w(t,0,g),null==e?e=k:w(e,0,8),W(new $(o),t+o.e+1,e);if(!(r=o.c))return null;if(n=((i=r.length-1)-m(this.e/l))*l,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},I.dividedBy=I.div=function(t,e){return r(this,new $(t,e),N,k)},I.dividedToIntegerBy=I.idiv=function(t,e){return r(this,new $(t,e),0,1)},I.exponentiatedBy=I.pow=function(t,e){var r,n,i,o,s,f,h,d,p=this;if((t=new $(t)).c&&!t.isInteger())throw Error(u+"Exponent not an integer: "+Y(t));if(null!=e&&(e=new $(e)),s=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return d=new $(Math.pow(+Y(p),s?2-_(t):+Y(t))),e?d.mod(e):d;if(f=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new $(NaN);(n=!f&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&_(t)?-0:0,p.e>-1&&(o=1/o),new $(f?1/o:o);F&&(o=a(F/l+2))}for(s?(r=new $(.5),f&&(t.s=1),h=_(t)):h=(i=Math.abs(+Y(t)))%2,d=new $(M);;){if(h){if(!(d=d.times(p)).c)break;o?d.c.length>o&&(d.c.length=o):n&&(d=d.mod(e))}if(i){if(0===(i=c(i/2)))break;h=i%2}else if(W(t=t.times(r),t.e+1,1),t.e>14)h=_(t);else{if(0===(i=+Y(t)))break;h=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(e))}return n?d:(f&&(d=M.div(d)),e?d.mod(e):o?W(d,F,k,undefined):d)},I.integerValue=function(t){var e=new $(this);return null==t?t=k:w(t,0,8),W(e,e.e+1,t)},I.isEqualTo=I.eq=function(t,e){return 0===y(this,new $(t,e))},I.isFinite=function(){return!!this.c},I.isGreaterThan=I.gt=function(t,e){return y(this,new $(t,e))>0},I.isGreaterThanOrEqualTo=I.gte=function(t,e){return 1===(e=y(this,new $(t,e)))||0===e},I.isInteger=function(){return!!this.c&&m(this.e/l)>this.c.length-2},I.isLessThan=I.lt=function(t,e){return y(this,new $(t,e))<0},I.isLessThanOrEqualTo=I.lte=function(t,e){return-1===(e=y(this,new $(t,e)))||0===e},I.isNaN=function(){return!this.s},I.isNegative=function(){return this.s<0},I.isPositive=function(){return this.s>0},I.isZero=function(){return!!this.c&&0==this.c[0]},I.minus=function(t,e){var r,n,i,o,s=this,a=s.s;if(e=(t=new $(t,e)).s,!a||!e)return new $(NaN);if(a!=e)return t.s=-e,s.plus(t);var c=s.e/l,u=t.e/l,f=s.c,d=t.c;if(!c||!u){if(!f||!d)return f?(t.s=-e,t):new $(d?s:NaN);if(!f[0]||!d[0])return d[0]?(t.s=-e,t):new $(f[0]?s:3==k?-0:0)}if(c=m(c),u=m(u),f=f.slice(),a=c-u){for((o=a<0)?(a=-a,i=f):(u=c,i=d),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(n=(o=(a=f.length)<(e=d.length))?a:e,a=e=0;e<n;e++)if(f[e]!=d[e]){o=f[e]<d[e];break}if(o&&(i=f,f=d,d=i,t.s=-t.s),(e=(n=d.length)-(r=f.length))>0)for(;e--;f[r++]=0);for(e=h-1;n>a;){if(f[--n]<d[n]){for(r=n;r&&!f[--r];f[r]=e);--f[r],f[n]+=h}f[n]-=d[n]}for(;0==f[0];f.splice(0,1),--u);return f[0]?q(t,f,u):(t.s=3==k?-1:1,t.c=[t.e=0],t)},I.modulo=I.mod=function(t,e){var n,i,o=this;return t=new $(t,e),!o.c||!t.s||t.c&&!t.c[0]?new $(NaN):!t.c||o.c&&!o.c[0]?new $(o):(9==B?(i=t.s,t.s=1,n=r(o,t,0,3),t.s=i,n.s*=i):n=r(o,t,0,B),(t=o.minus(n.times(t))).c[0]||1!=B||(t.s=o.s),t)},I.multipliedBy=I.times=function(t,e){var r,n,i,o,s,a,c,u,f,d,p,g,v,y,w,_=this,E=_.c,S=(t=new $(t,e)).c;if(!(E&&S&&E[0]&&S[0]))return!_.s||!t.s||E&&!E[0]&&!S||S&&!S[0]&&!E?t.c=t.e=t.s=null:(t.s*=_.s,E&&S?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=m(_.e/l)+m(t.e/l),t.s*=_.s,(c=E.length)<(d=S.length)&&(v=E,E=S,S=v,i=c,c=d,d=i),i=c+d,v=[];i--;v.push(0));for(y=h,w=b,i=d;--i>=0;){for(r=0,p=S[i]%w,g=S[i]/w|0,o=i+(s=c);o>i;)r=((u=p*(u=E[--s]%w)+(a=g*u+(f=E[s]/w|0)*p)%w*w+v[o]+r)/y|0)+(a/w|0)+g*f,v[o--]=u%y;v[o]=r}return r?++n:v.splice(0,1),q(t,v,n)},I.negated=function(){var t=new $(this);return t.s=-t.s||null,t},I.plus=function(t,e){var r,n=this,i=n.s;if(e=(t=new $(t,e)).s,!i||!e)return new $(NaN);if(i!=e)return t.s=-e,n.minus(t);var o=n.e/l,s=t.e/l,a=n.c,c=t.c;if(!o||!s){if(!a||!c)return new $(i/0);if(!a[0]||!c[0])return c[0]?t:new $(a[0]?n:0*i)}if(o=m(o),s=m(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(e=c.length)<0&&(r=c,c=a,a=r,e=i),i=0;e;)i=(a[--e]=a[e]+c[e]+i)/h|0,a[e]=h===a[e]?0:a[e]%h;return i&&(a=[i].concat(a),++s),q(t,a,s)},I.precision=I.sd=function(t,e){var r,n,i,o=this;if(null!=t&&t!==!!t)return w(t,1,g),null==e?e=k:w(e,0,8),W(new $(o),t,e);if(!(r=o.c))return null;if(n=(i=r.length-1)*l+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return t&&o.e+1>n&&(n=o.e+1),n},I.shiftedBy=function(t){return w(t,-9007199254740991,d),this.times("1e"+t)},I.squareRoot=I.sqrt=function(){var t,e,n,i,o,s=this,a=s.c,c=s.s,u=s.e,f=N+4,h=new $("0.5");if(1!==c||!a||!a[0])return new $(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Y(s)))||c==1/0?(((e=v(a)).length+u)%2==0&&(e+="0"),c=Math.sqrt(+e),u=m((u+1)/2)-(u<0||u%2),n=new $(e=c==1/0?"5e"+u:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+u)):n=new $(c+""),n.c[0])for((c=(u=n.e)+f)<3&&(c=0);;)if(o=n,n=h.times(o.plus(r(s,o,f,1))),v(o.c).slice(0,c)===(e=v(n.c)).slice(0,c)){if(n.e<u&&--c,"9999"!=(e=e.slice(c-3,c+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(W(n,n.e+N+2,1),t=!n.times(n).eq(s));break}if(!i&&(W(o,o.e+N+2,0),o.times(o).eq(s))){n=o;break}f+=4,c+=4,i=1}return W(n,n.e+N+1,k,t)},I.toExponential=function(t,e){return null!=t&&(w(t,0,g),t++),G(this,t,e,1)},I.toFixed=function(t,e){return null!=t&&(w(t,0,g),t=t+this.e+1),G(this,t,e)},I.toFormat=function(t,e,r){var n,i=this;if(null==r)null!=t&&e&&"object"==typeof e?(r=e,e=null):t&&"object"==typeof t?(r=t,t=e=null):r=V;else if("object"!=typeof r)throw Error(u+"Argument not an object: "+r);if(n=i.toFixed(t,e),i.c){var o,s=n.split("."),a=+r.groupSize,c=+r.secondaryGroupSize,f=r.groupSeparator||"",h=s[0],l=s[1],d=i.s<0,p=d?h.slice(1):h,b=p.length;if(c&&(o=a,a=c,c=o,b-=o),a>0&&b>0){for(o=b%a||a,h=p.substr(0,o);o<b;o+=a)h+=f+p.substr(o,a);c>0&&(h+=f+p.slice(o)),d&&(h="-"+h)}n=l?h+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?l.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):l):h}return(r.prefix||"")+n+(r.suffix||"")},I.toFraction=function(t){var e,n,i,o,s,a,c,f,h,d,b,g,m=this,y=m.c;if(null!=t&&(!(c=new $(t)).isInteger()&&(c.c||1!==c.s)||c.lt(M)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Y(c));if(!y)return new $(m);for(e=new $(M),h=n=new $(M),i=f=new $(M),g=v(y),s=e.e=g.length-m.e-1,e.c[0]=p[(a=s%l)<0?l+a:a],t=!t||c.comparedTo(e)>0?s>0?e:h:c,a=D,D=1/0,c=new $(g),f.c[0]=0;d=r(c,e,0,1),1!=(o=n.plus(d.times(i))).comparedTo(t);)n=i,i=o,h=f.plus(d.times(o=h)),f=o,e=c.minus(d.times(o=e)),c=o;return o=r(t.minus(n),i,0,1),f=f.plus(o.times(h)),n=n.plus(o.times(i)),f.s=h.s=m.s,b=r(h,i,s*=2,k).minus(m).abs().comparedTo(r(f,n,s,k).minus(m).abs())<1?[h,i]:[f,n],D=a,b},I.toNumber=function(){return+Y(this)},I.toPrecision=function(t,e){return null!=t&&w(t,1,g),G(this,t,e,2)},I.toString=function(t){var e,r=this,i=r.s,o=r.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=C||o>=L?E(v(r.c),o):S(v(r.c),o,"0"):10===t&&H?e=S(v((r=W(new $(r),N+o+1,k)).c),r.e,"0"):(w(t,2,K.length,"Base"),e=n(S(v(r.c),o,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},I.valueOf=I.toJSON=function(){return Y(this)},I._isBigNumber=!0,null!=e&&$.set(e),$}(),o.default=o.BigNumber=o,void 0===(n=function(){return o}.call(e,r,e,t))||(t.exports=n)}()},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.WalletOperation=e.MissedBlockDuringConfirmationError=void 0;const i=r(53),o=r(86),s=r(270),a=r(2);class c extends Error{constructor(){super("Taquito missed a block while waiting for operation confirmation and was not able to find the operation"),this.name="MissedBlockDuringConfirmationError"}}e.MissedBlockDuringConfirmationError=c;e.WalletOperation=class{constructor(t,e,r){if(this.opHash=t,this.context=e,this._newHead$=r,this._operationResult=new i.ReplaySubject(1),this._includedInBlock=new i.ReplaySubject(1),this._included=!1,this.newHead$=this._newHead$.pipe(o.tap((t=>{if(!this._included&&this.lastHead&&t.header.level-this.lastHead.header.level>1)throw new c;this.lastHead=t})),o.shareReplay({bufferSize:1,refCount:!0})),this.confirmed$=this.newHead$.pipe(o.map((t=>{for(const e of t.operations)for(const r of e)if(r.hash===this.opHash)return this._included=!0,this._includedInBlock.next(t),this._operationResult.next(r.contents),t})),o.filter((t=>void 0!==t)),o.first(),o.shareReplay({bufferSize:1,refCount:!0})),a.validateOperation(this.opHash)!==a.ValidationResult.VALID)throw new a.InvalidOperationHashError(`Invalid operation hash: ${this.opHash}`);this.confirmed$.pipe(o.first(),o.catchError((()=>i.of(void 0)))).subscribe()}operationResults(){return n(this,void 0,void 0,(function*(){return this._operationResult.pipe(o.first()).toPromise()}))}receipt(){return n(this,void 0,void 0,(function*(){return s.receiptFromOperation(yield this.operationResults())}))}getCurrentConfirmation(){return n(this,void 0,void 0,(function*(){return this._included?i.combineLatest([this._includedInBlock,i.from(this.context.readProvider.getBlock("head"))]).pipe(o.map((([t,e])=>e.header.level-t.header.level+1)),o.first()).toPromise():0}))}isInCurrentBranch(t="head"){return n(this,void 0,void 0,(function*(){if(!this._included)return!0;const e=yield this.context.readProvider.getBlockLevel(t),r=yield this._includedInBlock.pipe(o.first()).toPromise(),n=e-r.header.level;if(n<=0)return!0;const i=Math.min(r.header.level+n,r.header.level+60);return new Set(yield this.context.readProvider.getLiveBlocks(i)).has(r.hash)}))}confirmationObservable(t){if(void 0!==t&&t<1)throw new Error("Confirmation count must be at least 1");const{defaultConfirmationCount:e}=this.context.config,r=void 0!==t?t:e;if(void 0===r)throw new Error("Default confirmation count can not be undefined!");return i.combineLatest([this._includedInBlock,this.newHead$]).pipe(o.distinctUntilChanged((([,t],[,e])=>t.hash===e.hash)),o.map((([t,e])=>({block:e,expectedConfirmation:r,currentConfirmation:e.header.level-t.header.level+1,completed:e.header.level-t.header.level>=r-1,isInCurrentBranch:()=>this.isInCurrentBranch(e.hash)}))),o.takeWhile((({completed:t})=>!t),!0))}confirmation(t){return this.confirmationObservable(t).toPromise()}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(0),i=r(1);function o(){return function(t){return t.lift(new s(t))}}var s=function(){function t(t){this.connectable=t}return t.prototype.call=function(t,e){var r=this.connectable;r._refCount++;var n=new a(t,r),i=e.subscribe(n);return n.closed||(n.connection=r.connect()),i},t}(),a=function(t){function e(e,r){var n=t.call(this,e)||this;return n.connectable=r,n}return n.a(e,t),e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._refCount;if(e<=0)this.connection=null;else if(t._refCount=e-1,e>1)this.connection=null;else{var r=this.connection,n=t._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()}}else this.connection=null},e}(i.a)},function(t,e,r){"use strict";r.d(e,"a",(function(){return f}));var n=r(0),i=r(6),o=r(87),s=r(5),a=r(101),c=r(29),u=r(108),f=function(t){function e(e,r,n){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===r&&(r=Number.POSITIVE_INFINITY);var i=t.call(this)||this;return i.scheduler=n,i._events=[],i._infiniteTimeWindow=!1,i._bufferSize=e<1?1:e,i._windowTime=r<1?1:r,r===Number.POSITIVE_INFINITY?(i._infiniteTimeWindow=!0,i.next=i.nextInfiniteTimeWindow):i.next=i.nextTimeWindow,i}return n.a(e,t),e.prototype.nextInfiniteTimeWindow=function(e){if(!this.isStopped){var r=this._events;r.push(e),r.length>this._bufferSize&&r.shift()}t.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this.isStopped||(this._events.push(new h(this._getNow(),e)),this._trimBufferThenGetEvents()),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,r=this._infiniteTimeWindow,n=r?this._events:this._trimBufferThenGetEvents(),i=this.scheduler,o=n.length;if(this.closed)throw new c.a;if(this.isStopped||this.hasError?e=s.a.EMPTY:(this.observers.push(t),e=new u.a(this,t)),i&&t.add(t=new a.a(t,i)),r)for(var f=0;f<o&&!t.closed;f++)t.next(n[f]);else for(f=0;f<o&&!t.closed;f++)t.next(n[f].value);return this.hasError?t.error(this.thrownError):this.isStopped&&t.complete(),e},e.prototype._getNow=function(){return(this.scheduler||o.a).now()},e.prototype._trimBufferThenGetEvents=function(){for(var t=this._getNow(),e=this._bufferSize,r=this._windowTime,n=this._events,i=n.length,o=0;o<i&&!(t-n[o].time<r);)o++;return i>e&&(o=Math.max(o,i-e)),o>0&&n.splice(0,o),n},e}(i.a),h=function(){return function(t,e){this.time=t,this.value=e}}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(4);function i(t,e){return e?new n.a((function(r){return e.schedule(o,0,{error:t,subscriber:r})})):new n.a((function(e){return e.error(t)}))}function o(t){var e=t.error;t.subscriber.error(e)}},function(t,e,r){"use strict";r.d(e,"b",(function(){return f})),r.d(e,"a",(function(){return h}));var n=r(0),i=r(10),o=r(8),s=r(19),a=r(15),c=r(37),u={};function f(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=void 0,n=void 0;return Object(i.a)(t[t.length-1])&&(n=t.pop()),"function"==typeof t[t.length-1]&&(r=t.pop()),1===t.length&&Object(o.a)(t[0])&&(t=t[0]),Object(c.a)(t,n).lift(new h(r))}var h=function(){function t(t){this.resultSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new l(t,this.resultSelector))},t}(),l=function(t){function e(e,r){var n=t.call(this,e)||this;return n.resultSelector=r,n.active=0,n.values=[],n.observables=[],n}return n.a(e,t),e.prototype._next=function(t){this.values.push(u),this.observables.push(t)},e.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{this.active=e,this.toRespond=e;for(var r=0;r<e;r++){var n=t[r];this.add(Object(a.a)(this,n,void 0,r))}}},e.prototype.notifyComplete=function(t){0==(this.active-=1)&&this.destination.complete()},e.prototype.notifyNext=function(t,e,r){var n=this.values,i=n[r],o=this.toRespond?i===u?--this.toRespond:this.toRespond:0;n[r]=e,0===o&&(this.resultSelector?this._tryResultSelector(n):this.destination.next(n.slice()))},e.prototype._tryResultSelector=function(t){var e;try{e=this.resultSelector.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(s.a)},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(36),i=r(17);function o(t){return void 0===t&&(t=Number.POSITIVE_INFINITY),Object(n.b)(i.a,t)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(4),i=r(13),o=r(11);function s(t){return new n.a((function(e){var r;try{r=t()}catch(t){return void e.error(t)}return(r?Object(i.a)(r):Object(o.b)()).subscribe(e)}))}},function(t,e,r){"use strict";r.d(e,"b",(function(){return u})),r.d(e,"a",(function(){return f}));var n=r(0),i=r(37),o=r(8),s=r(1),a=r(24),c=r(3);function u(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t[t.length-1];return"function"==typeof r&&t.pop(),Object(i.a)(t,void 0).lift(new f(r))}var f=function(){function t(t){this.resultSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new h(t,this.resultSelector))},t}(),h=function(t){function e(e,r,n){void 0===n&&(n=Object.create(null));var i=t.call(this,e)||this;return i.resultSelector=r,i.iterators=[],i.active=0,i.resultSelector="function"==typeof r?r:void 0,i}return n.a(e,t),e.prototype._next=function(t){var e=this.iterators;Object(o.a)(t)?e.push(new d(t)):"function"==typeof t[a.a]?e.push(new l(t[a.a]())):e.push(new p(this.destination,this,t))},e.prototype._complete=function(){var t=this.iterators,e=t.length;if(this.unsubscribe(),0!==e){this.active=e;for(var r=0;r<e;r++){var n=t[r];if(n.stillUnsubscribed)this.destination.add(n.subscribe());else this.active--}}else this.destination.complete()},e.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},e.prototype.checkIterators=function(){for(var t=this.iterators,e=t.length,r=this.destination,n=0;n<e;n++){if("function"==typeof(s=t[n]).hasValue&&!s.hasValue())return}var i=!1,o=[];for(n=0;n<e;n++){var s,a=(s=t[n]).next();if(s.hasCompleted()&&(i=!0),a.done)return void r.complete();o.push(a.value)}this.resultSelector?this._tryresultSelector(o):r.next(o),i&&r.complete()},e.prototype._tryresultSelector=function(t){var e;try{e=this.resultSelector.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(s.a),l=function(){function t(t){this.iterator=t,this.nextResult=t.next()}return t.prototype.hasValue=function(){return!0},t.prototype.next=function(){var t=this.nextResult;return this.nextResult=this.iterator.next(),t},t.prototype.hasCompleted=function(){var t=this.nextResult;return Boolean(t&&t.done)},t}(),d=function(){function t(t){this.array=t,this.index=0,this.length=0,this.length=t.length}return t.prototype[a.a]=function(){return this},t.prototype.next=function(t){var e=this.index++,r=this.array;return e<this.length?{value:r[e],done:!1}:{value:null,done:!0}},t.prototype.hasValue=function(){return this.array.length>this.index},t.prototype.hasCompleted=function(){return this.array.length===this.index},t}(),p=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.parent=r,i.observable=n,i.stillUnsubscribed=!0,i.buffer=[],i.isComplete=!1,i}return n.a(e,t),e.prototype[a.a]=function(){return this},e.prototype.next=function(){var t=this.buffer;return 0===t.length&&this.isComplete?{value:null,done:!0}:{value:t.shift(),done:!1}},e.prototype.hasValue=function(){return this.buffer.length>0},e.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},e.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},e.prototype.notifyNext=function(t){this.buffer.push(t),this.parent.checkIterators()},e.prototype.subscribe=function(){return Object(c.c)(this.observable,new c.a(this))},e}(c.b)},function(t,e,r){"use strict";r.r(e),r.d(e,"HttpBackend",(function(){return h})),r.d(e,"HttpRequestFailed",(function(){return f})),r.d(e,"HttpResponseError",(function(){return u})),r.d(e,"STATUS_CODE",(function(){return n})),r.d(e,"VERSION",(function(){return a}));var n,i=r(179),o=r.n(i);function s(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))}!function(t){t[t.CONTINUE=100]="CONTINUE",t[t.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",t[t.PROCESSING=102]="PROCESSING",t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.RESET_CONTENT=205]="RESET_CONTENT",t[t.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",t[t.MULTI_STATUS=207]="MULTI_STATUS",t[t.ALREADY_REPORTED=208]="ALREADY_REPORTED",t[t.IM_USED=226]="IM_USED",t[t.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.USE_PROXY=305]="USE_PROXY",t[t.SWITCH_PROXY=306]="SWITCH_PROXY",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",t[t.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",t[t.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",t[t.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",t[t.CONFLICT=409]="CONFLICT",t[t.GONE=410]="GONE",t[t.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",t[t.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.URI_TOO_LONG=414]="URI_TOO_LONG",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.RANGE_NOT_SATISFIABLE=416]="RANGE_NOT_SATISFIABLE",t[t.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",t[t.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",t[t.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",t[t.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",t[t.LOCKED=423]="LOCKED",t[t.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",t[t.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",t[t.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",t[t.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t[t.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",t[t.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",t[t.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",t[t.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",t[t.LOOP_DETECTED=508]="LOOP_DETECTED",t[t.NOT_EXTENDED=510]="NOT_EXTENDED",t[t.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"}(n||(n={}));const a={commitHash:"5da8cec9c84c0ab7bc37c0eb09e68db1b3a8b1f0",version:"12.0.0-beta-RC.0"};var c;!function(t){t.TEXT="text",t.JSON="json"}(c||(c={}));class u extends Error{constructor(t,e,r,n,i){super(t),this.message=t,this.status=e,this.statusText=r,this.body=n,this.url=i,this.name="HttpResponse"}}class f extends Error{constructor(t,e){super(`Request to ${t} failed`),this.url=t,this.innerEvent=e,this.name="HttpRequestFailed"}}class h{serialize(t){if(!t)return"";const e=[];for(const r in t)if(t.hasOwnProperty(r)&&void 0!==t[r]){const n="function"==typeof t[r].toJSON?t[r].toJSON():t[r];if(null===n){e.push(encodeURIComponent(r));continue}if(Array.isArray(n)){n.forEach((t=>{e.push(encodeURIComponent(r)+"="+encodeURIComponent(t))}));continue}e.push(encodeURIComponent(r)+"="+encodeURIComponent(n))}const r=e.join("&");return r?`?${r}`:""}createRequest({url:t,method:e,timeout:r=3e4,query:n,headers:i={},json:a=!0},f){return s(this,void 0,void 0,(function*(){let s,h,l;i["Content-Type"]||(i["Content-Type"]="application/json"),a?s=c.JSON:(s=c.TEXT,h=[t=>t]);try{l=yield o.a.request({url:t+this.serialize(n),method:null!=e?e:"GET",headers:i,responseType:s,transformResponse:h,timeout:r,data:f})}catch(e){if(e.response){let r;throw r="object"==typeof e.response.data?JSON.stringify(e.response.data):e.response.data,new u(`Http error response: (${e.response.status}) ${r}`,e.response.status,e.response.statusText,r,t+this.serialize(n))}throw new Error(e)}return l.data}))}}},function(t,e,r){"use strict";function n(t){return null!==t&&"object"==typeof t}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(1);function i(t){for(;t;){var e=t,r=e.closed,i=e.destination,o=e.isStopped;if(r||o)return!1;t=i&&i instanceof n.a?i:null}return!0}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(4),i=r(5);function o(t,e){return new n.a((function(r){var n=new i.a,o=0;return n.add(e.schedule((function(){o!==t.length?(r.next(t[o++]),r.closed||n.add(this.schedule())):r.complete()}))),n}))}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(16),i=r(46),o={closed:!0,next:function(t){},error:function(t){if(n.a.useDeprecatedSynchronousErrorHandling)throw t;Object(i.a)(t)},complete:function(){}}},function(t,e,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",f=u+"Number primitive has more than 15 significant digits: ",h=1e14,l=14,d=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],b=1e7,g=1e9;function m(t){var e=0|t;return t>0||t===e?e:e-1}function v(t){for(var e,r,n=1,i=t.length,o=t[0]+"";n<i;){for(e=t[n++]+"",r=l-e.length;r--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function y(t,e){var r,n,i=t.c,o=e.c,s=t.s,a=e.s,c=t.e,u=e.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=c==u,!i||!o)return n?0:!i^r?1:-1;if(!n)return c>u^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function w(t,e,r,n){if(t<e||t>r||t!==c(t))throw Error(u+(n||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function _(t){var e=t.c.length-1;return m(t.e/l)==e&&t.c[e]%2!=0}function E(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function S(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(++e>(n=t.length)){for(i=r,e-=n;--e;i+=r);t+=i}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}o=function t(e){var r,n,i,o,A,O,x,T,P,R,I=$.prototype={constructor:$,toString:null,valueOf:null},M=new $(1),N=20,k=4,C=-7,L=21,j=-1e7,D=1e7,U=!1,B=1,F=0,V={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",H=!0;function $(t,e){var r,o,a,u,h,p,b,g,m=this;if(!(m instanceof $))return new $(t,e);if(null==e){if(t&&!0===t._isBigNumber)return m.s=t.s,void(!t.c||t.e>D?m.c=m.e=null:t.e<j?m.c=[m.e=0]:(m.e=t.e,m.c=t.c.slice()));if((p="number"==typeof t)&&0*t==0){if(m.s=1/t<0?(t=-t,-1):1,t===~~t){for(u=0,h=t;h>=10;h/=10,u++);return void(u>D?m.c=m.e=null:(m.e=u,m.c=[t]))}g=String(t)}else{if(!s.test(g=String(t)))return i(m,g,p);m.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(h=g.search(/e/i))>0?(u<0&&(u=h),u+=+g.slice(h+1),g=g.substring(0,h)):u<0&&(u=g.length)}else{if(w(e,2,K.length,"Base"),10==e&&H)return W(m=new $(t),N+m.e+1,k);if(g=String(t),p="number"==typeof t){if(0*t!=0)return i(m,g,p,e);if(m.s=1/t<0?(g=g.slice(1),-1):1,$.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(f+t)}else m.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(r=K.slice(0,e),u=h=0,b=g.length;h<b;h++)if(r.indexOf(o=g.charAt(h))<0){if("."==o){if(h>u){u=b;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,h=-1,u=0;continue}return i(m,String(t),p,e)}p=!1,(u=(g=n(g,e,10,m.s)).indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(h=0;48===g.charCodeAt(h);h++);for(b=g.length;48===g.charCodeAt(--b););if(g=g.slice(h,++b)){if(b-=h,p&&$.DEBUG&&b>15&&(t>d||t!==c(t)))throw Error(f+m.s*t);if((u=u-h-1)>D)m.c=m.e=null;else if(u<j)m.c=[m.e=0];else{if(m.e=u,m.c=[],h=(u+1)%l,u<0&&(h+=l),h<b){for(h&&m.c.push(+g.slice(0,h)),b-=l;h<b;)m.c.push(+g.slice(h,h+=l));h=l-(g=g.slice(h)).length}else h-=b;for(;h--;g+="0");m.c.push(+g)}}else m.c=[m.e=0]}function G(t,e,r,n){var i,o,s,a,c;if(null==r?r=k:w(r,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==e)c=v(t.c),c=1==n||2==n&&(s<=C||s>=L)?E(c,s):S(c,s,"0");else if(o=(t=W(new $(t),e,r)).e,a=(c=v(t.c)).length,1==n||2==n&&(e<=o||o<=C)){for(;a<e;c+="0",a++);c=E(c,o)}else if(e-=s,c=S(c,o,"0"),o+1>a){if(--e>0)for(c+=".";e--;c+="0");}else if((e+=o-a)>0)for(o+1==a&&(c+=".");e--;c+="0");return t.s<0&&i?"-"+c:c}function z(t,e){for(var r,n=1,i=new $(t[0]);n<t.length;n++){if(!(r=new $(t[n])).s){i=r;break}e.call(i,r)&&(i=r)}return i}function q(t,e,r){for(var n=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,n++);return(r=n+r*l-1)>D?t.c=t.e=null:r<j?t.c=[t.e=0]:(t.e=r,t.c=e),t}function W(t,e,r,n){var i,o,s,u,f,d,b,g=t.c,m=p;if(g){t:{for(i=1,u=g[0];u>=10;u/=10,i++);if((o=e-i)<0)o+=l,s=e,b=(f=g[d=0])/m[i-s-1]%10|0;else if((d=a((o+1)/l))>=g.length){if(!n)break t;for(;g.length<=d;g.push(0));f=b=0,i=1,s=(o%=l)-l+1}else{for(f=u=g[d],i=1;u>=10;u/=10,i++);b=(s=(o%=l)-l+i)<0?0:f/m[i-s-1]%10|0}if(n=n||e<0||null!=g[d+1]||(s<0?f:f%m[i-s-1]),n=r<4?(b||n)&&(0==r||r==(t.s<0?3:2)):b>5||5==b&&(4==r||n||6==r&&(o>0?s>0?f/m[i-s]:0:g[d-1])%10&1||r==(t.s<0?8:7)),e<1||!g[0])return g.length=0,n?(e-=t.e+1,g[0]=m[(l-e%l)%l],t.e=-e||0):g[0]=t.e=0,t;if(0==o?(g.length=d,u=1,d--):(g.length=d+1,u=m[l-o],g[d]=s>0?c(f/m[i-s]%m[s])*u:0),n)for(;;){if(0==d){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(t.e++,g[0]==h&&(g[0]=1));break}if(g[d]+=u,g[d]!=h)break;g[d--]=0,u=1}for(o=g.length;0===g[--o];g.pop());}t.e>D?t.c=t.e=null:t.e<j&&(t.c=[t.e=0])}return t}function Y(t){var e,r=t.e;return null===r?t.toString():(e=v(t.c),e=r<=C||r>=L?E(e,r):S(e,r,"0"),t.s<0?"-"+e:e)}return $.clone=t,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(u+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(w(r=t[e],0,g,e),N=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(w(r=t[e],0,8,e),k=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(w(r[0],-g,0,e),w(r[1],0,g,e),C=r[0],L=r[1]):(w(r,-g,g,e),C=-(L=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)w(r[0],-g,-1,e),w(r[1],1,g,e),j=r[0],D=r[1];else{if(w(r,-g,g,e),!r)throw Error(u+e+" cannot be zero: "+r);j=-(D=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(u+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw U=!r,Error(u+"crypto unavailable");U=r}else U=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(w(r=t[e],0,9,e),B=r),t.hasOwnProperty(e="POW_PRECISION")&&(w(r=t[e],0,g,e),F=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(u+e+" not an object: "+r);V=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+e+" invalid: "+r);H="0123456789"==r.slice(0,10),K=r}}return{DECIMAL_PLACES:N,ROUNDING_MODE:k,EXPONENTIAL_AT:[C,L],RANGE:[j,D],CRYPTO:U,MODULO_MODE:B,POW_PRECISION:F,FORMAT:V,ALPHABET:K}},$.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!$.DEBUG)return!0;var e,r,n=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===c(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((e=(i+1)%l)<1&&(e+=l),String(n[0]).length==e){for(e=0;e<n.length;e++)if((r=n[e])<0||r>=h||r!==c(r))break t;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(u+"Invalid BigNumber: "+t)},$.maximum=$.max=function(){return z(arguments,I.lt)},$.minimum=$.min=function(){return z(arguments,I.gt)},$.random=(o=9007199254740992,A=Math.random()*o&2097151?function(){return c(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,n,i,o,s=0,f=[],h=new $(M);if(null==t?t=N:w(t,0,g),i=a(t/l),U)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)(o=131072*e[s]+(e[s+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[s]=r[0],e[s+1]=r[1]):(f.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw U=!1,Error(u+"crypto unavailable");for(e=crypto.randomBytes(i*=7);s<i;)(o=281474976710656*(31&e[s])+1099511627776*e[s+1]+4294967296*e[s+2]+16777216*e[s+3]+(e[s+4]<<16)+(e[s+5]<<8)+e[s+6])>=9e15?crypto.randomBytes(7).copy(e,s):(f.push(o%1e14),s+=7);s=i/7}if(!U)for(;s<i;)(o=A())<9e15&&(f[s++]=o%1e14);for(i=f[--s],t%=l,i&&t&&(o=p[l-t],f[s]=c(i/o)*o);0===f[s];f.pop(),s--);if(s<0)f=[n=0];else{for(n=-1;0===f[0];f.splice(0,1),n-=l);for(s=1,o=f[0];o>=10;o/=10,s++);s<l&&(n-=l-s)}return h.e=n,h.c=f,h}),$.sum=function(){for(var t=1,e=arguments,r=new $(e[0]);t<e.length;)r=r.plus(e[t++]);return r},n=function(){var t="0123456789";function e(t,e,r,n){for(var i,o,s=[0],a=0,c=t.length;a<c;){for(o=s.length;o--;s[o]*=e);for(s[0]+=n.indexOf(t.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 c,u,f,h,l,d,p,b,g=n.indexOf("."),m=N,y=k;for(g>=0&&(h=F,F=0,n=n.replace(".",""),d=(b=new $(i)).pow(n.length-g),F=h,b.c=e(S(v(d.c),d.e,"0"),10,o,t),b.e=b.c.length),f=h=(p=e(n,i,o,a?(c=K,t):(c=t,K))).length;0==p[--h];p.pop());if(!p[0])return c.charAt(0);if(g<0?--f:(d.c=p,d.e=f,d.s=s,p=(d=r(d,b,m,y,o)).c,l=d.r,f=d.e),g=p[u=f+m+1],h=o/2,l=l||u<0||null!=p[u+1],l=y<4?(null!=g||l)&&(0==y||y==(d.s<0?3:2)):g>h||g==h&&(4==y||l||6==y&&1&p[u-1]||y==(d.s<0?8:7)),u<1||!p[0])n=l?S(c.charAt(1),-m,c.charAt(0)):c.charAt(0);else{if(p.length=u,l)for(--o;++p[--u]>o;)p[u]=0,u||(++f,p=[1].concat(p));for(h=p.length;!p[--h];);for(g=0,n="";g<=h;n+=c.charAt(p[g++]));n=S(n,f,c.charAt(0))}return n}}(),r=function(){function t(t,e,r){var n,i,o,s,a=0,c=t.length,u=e%b,f=e/b|0;for(t=t.slice();c--;)a=((i=u*(o=t[c]%b)+(n=f*o+(s=t[c]/b|0)*u)%b*b+a)/r|0)+(n/b|0)+f*s,t[c]=i%r;return a&&(t=[a].concat(t)),t}function e(t,e,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,i,o,s,a){var u,f,d,p,b,g,v,y,w,_,E,S,A,O,x,T,P,R=n.s==i.s?1:-1,I=n.c,M=i.c;if(!(I&&I[0]&&M&&M[0]))return new $(n.s&&i.s&&(I?!M||I[0]!=M[0]:M)?I&&0==I[0]||!M?0*R:R/0:NaN);for(w=(y=new $(R)).c=[],R=o+(f=n.e-i.e)+1,a||(a=h,f=m(n.e/l)-m(i.e/l),R=R/l|0),d=0;M[d]==(I[d]||0);d++);if(M[d]>(I[d]||0)&&f--,R<0)w.push(1),p=!0;else{for(O=I.length,T=M.length,d=0,R+=2,(b=c(a/(M[0]+1)))>1&&(M=t(M,b,a),I=t(I,b,a),T=M.length,O=I.length),A=T,E=(_=I.slice(0,T)).length;E<T;_[E++]=0);P=M.slice(),P=[0].concat(P),x=M[0],M[1]>=a/2&&x++;do{if(b=0,(u=e(M,_,T,E))<0){if(S=_[0],T!=E&&(S=S*a+(_[1]||0)),(b=c(S/x))>1)for(b>=a&&(b=a-1),v=(g=t(M,b,a)).length,E=_.length;1==e(g,_,v,E);)b--,r(g,T<v?P:M,v,a),v=g.length,u=1;else 0==b&&(u=b=1),v=(g=M.slice()).length;if(v<E&&(g=[0].concat(g)),r(_,g,E,a),E=_.length,-1==u)for(;e(M,_,T,E)<1;)b++,r(_,T<E?P:M,E,a),E=_.length}else 0===u&&(b++,_=[0]);w[d++]=b,_[0]?_[E++]=I[A]||0:(_=[I[A]],E=1)}while((A++<O||null!=_[0])&&R--);p=null!=_[0],w[0]||w.splice(0,1)}if(a==h){for(d=1,R=w[0];R>=10;R/=10,d++);W(y,o+(y.e=d+f*l-1)+1,s,p)}else y.e=f,y.r=+p;return y}}(),O=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,T=/^\.([^.]+)$/,P=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,r,n){var i,o=r?e:e.replace(R,"");if(P.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(O,(function(t,e,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?t:e})),n&&(i=n,o=o.replace(x,"$1").replace(T,"0.$1")),e!=o))return new $(o,i);if($.DEBUG)throw Error(u+"Not a"+(n?" base "+n:"")+" number: "+e);t.s=null}t.c=t.e=null},I.absoluteValue=I.abs=function(){var t=new $(this);return t.s<0&&(t.s=1),t},I.comparedTo=function(t,e){return y(this,new $(t,e))},I.decimalPlaces=I.dp=function(t,e){var r,n,i,o=this;if(null!=t)return w(t,0,g),null==e?e=k:w(e,0,8),W(new $(o),t+o.e+1,e);if(!(r=o.c))return null;if(n=((i=r.length-1)-m(this.e/l))*l,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},I.dividedBy=I.div=function(t,e){return r(this,new $(t,e),N,k)},I.dividedToIntegerBy=I.idiv=function(t,e){return r(this,new $(t,e),0,1)},I.exponentiatedBy=I.pow=function(t,e){var r,n,i,o,s,f,h,d,p=this;if((t=new $(t)).c&&!t.isInteger())throw Error(u+"Exponent not an integer: "+Y(t));if(null!=e&&(e=new $(e)),s=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return d=new $(Math.pow(+Y(p),s?2-_(t):+Y(t))),e?d.mod(e):d;if(f=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new $(NaN);(n=!f&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&_(t)?-0:0,p.e>-1&&(o=1/o),new $(f?1/o:o);F&&(o=a(F/l+2))}for(s?(r=new $(.5),f&&(t.s=1),h=_(t)):h=(i=Math.abs(+Y(t)))%2,d=new $(M);;){if(h){if(!(d=d.times(p)).c)break;o?d.c.length>o&&(d.c.length=o):n&&(d=d.mod(e))}if(i){if(0===(i=c(i/2)))break;h=i%2}else if(W(t=t.times(r),t.e+1,1),t.e>14)h=_(t);else{if(0===(i=+Y(t)))break;h=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(e))}return n?d:(f&&(d=M.div(d)),e?d.mod(e):o?W(d,F,k,undefined):d)},I.integerValue=function(t){var e=new $(this);return null==t?t=k:w(t,0,8),W(e,e.e+1,t)},I.isEqualTo=I.eq=function(t,e){return 0===y(this,new $(t,e))},I.isFinite=function(){return!!this.c},I.isGreaterThan=I.gt=function(t,e){return y(this,new $(t,e))>0},I.isGreaterThanOrEqualTo=I.gte=function(t,e){return 1===(e=y(this,new $(t,e)))||0===e},I.isInteger=function(){return!!this.c&&m(this.e/l)>this.c.length-2},I.isLessThan=I.lt=function(t,e){return y(this,new $(t,e))<0},I.isLessThanOrEqualTo=I.lte=function(t,e){return-1===(e=y(this,new $(t,e)))||0===e},I.isNaN=function(){return!this.s},I.isNegative=function(){return this.s<0},I.isPositive=function(){return this.s>0},I.isZero=function(){return!!this.c&&0==this.c[0]},I.minus=function(t,e){var r,n,i,o,s=this,a=s.s;if(e=(t=new $(t,e)).s,!a||!e)return new $(NaN);if(a!=e)return t.s=-e,s.plus(t);var c=s.e/l,u=t.e/l,f=s.c,d=t.c;if(!c||!u){if(!f||!d)return f?(t.s=-e,t):new $(d?s:NaN);if(!f[0]||!d[0])return d[0]?(t.s=-e,t):new $(f[0]?s:3==k?-0:0)}if(c=m(c),u=m(u),f=f.slice(),a=c-u){for((o=a<0)?(a=-a,i=f):(u=c,i=d),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(n=(o=(a=f.length)<(e=d.length))?a:e,a=e=0;e<n;e++)if(f[e]!=d[e]){o=f[e]<d[e];break}if(o&&(i=f,f=d,d=i,t.s=-t.s),(e=(n=d.length)-(r=f.length))>0)for(;e--;f[r++]=0);for(e=h-1;n>a;){if(f[--n]<d[n]){for(r=n;r&&!f[--r];f[r]=e);--f[r],f[n]+=h}f[n]-=d[n]}for(;0==f[0];f.splice(0,1),--u);return f[0]?q(t,f,u):(t.s=3==k?-1:1,t.c=[t.e=0],t)},I.modulo=I.mod=function(t,e){var n,i,o=this;return t=new $(t,e),!o.c||!t.s||t.c&&!t.c[0]?new $(NaN):!t.c||o.c&&!o.c[0]?new $(o):(9==B?(i=t.s,t.s=1,n=r(o,t,0,3),t.s=i,n.s*=i):n=r(o,t,0,B),(t=o.minus(n.times(t))).c[0]||1!=B||(t.s=o.s),t)},I.multipliedBy=I.times=function(t,e){var r,n,i,o,s,a,c,u,f,d,p,g,v,y,w,_=this,E=_.c,S=(t=new $(t,e)).c;if(!(E&&S&&E[0]&&S[0]))return!_.s||!t.s||E&&!E[0]&&!S||S&&!S[0]&&!E?t.c=t.e=t.s=null:(t.s*=_.s,E&&S?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=m(_.e/l)+m(t.e/l),t.s*=_.s,(c=E.length)<(d=S.length)&&(v=E,E=S,S=v,i=c,c=d,d=i),i=c+d,v=[];i--;v.push(0));for(y=h,w=b,i=d;--i>=0;){for(r=0,p=S[i]%w,g=S[i]/w|0,o=i+(s=c);o>i;)r=((u=p*(u=E[--s]%w)+(a=g*u+(f=E[s]/w|0)*p)%w*w+v[o]+r)/y|0)+(a/w|0)+g*f,v[o--]=u%y;v[o]=r}return r?++n:v.splice(0,1),q(t,v,n)},I.negated=function(){var t=new $(this);return t.s=-t.s||null,t},I.plus=function(t,e){var r,n=this,i=n.s;if(e=(t=new $(t,e)).s,!i||!e)return new $(NaN);if(i!=e)return t.s=-e,n.minus(t);var o=n.e/l,s=t.e/l,a=n.c,c=t.c;if(!o||!s){if(!a||!c)return new $(i/0);if(!a[0]||!c[0])return c[0]?t:new $(a[0]?n:0*i)}if(o=m(o),s=m(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(e=c.length)<0&&(r=c,c=a,a=r,e=i),i=0;e;)i=(a[--e]=a[e]+c[e]+i)/h|0,a[e]=h===a[e]?0:a[e]%h;return i&&(a=[i].concat(a),++s),q(t,a,s)},I.precision=I.sd=function(t,e){var r,n,i,o=this;if(null!=t&&t!==!!t)return w(t,1,g),null==e?e=k:w(e,0,8),W(new $(o),t,e);if(!(r=o.c))return null;if(n=(i=r.length-1)*l+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return t&&o.e+1>n&&(n=o.e+1),n},I.shiftedBy=function(t){return w(t,-9007199254740991,d),this.times("1e"+t)},I.squareRoot=I.sqrt=function(){var t,e,n,i,o,s=this,a=s.c,c=s.s,u=s.e,f=N+4,h=new $("0.5");if(1!==c||!a||!a[0])return new $(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Y(s)))||c==1/0?(((e=v(a)).length+u)%2==0&&(e+="0"),c=Math.sqrt(+e),u=m((u+1)/2)-(u<0||u%2),n=new $(e=c==1/0?"5e"+u:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+u)):n=new $(c+""),n.c[0])for((c=(u=n.e)+f)<3&&(c=0);;)if(o=n,n=h.times(o.plus(r(s,o,f,1))),v(o.c).slice(0,c)===(e=v(n.c)).slice(0,c)){if(n.e<u&&--c,"9999"!=(e=e.slice(c-3,c+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(W(n,n.e+N+2,1),t=!n.times(n).eq(s));break}if(!i&&(W(o,o.e+N+2,0),o.times(o).eq(s))){n=o;break}f+=4,c+=4,i=1}return W(n,n.e+N+1,k,t)},I.toExponential=function(t,e){return null!=t&&(w(t,0,g),t++),G(this,t,e,1)},I.toFixed=function(t,e){return null!=t&&(w(t,0,g),t=t+this.e+1),G(this,t,e)},I.toFormat=function(t,e,r){var n,i=this;if(null==r)null!=t&&e&&"object"==typeof e?(r=e,e=null):t&&"object"==typeof t?(r=t,t=e=null):r=V;else if("object"!=typeof r)throw Error(u+"Argument not an object: "+r);if(n=i.toFixed(t,e),i.c){var o,s=n.split("."),a=+r.groupSize,c=+r.secondaryGroupSize,f=r.groupSeparator||"",h=s[0],l=s[1],d=i.s<0,p=d?h.slice(1):h,b=p.length;if(c&&(o=a,a=c,c=o,b-=o),a>0&&b>0){for(o=b%a||a,h=p.substr(0,o);o<b;o+=a)h+=f+p.substr(o,a);c>0&&(h+=f+p.slice(o)),d&&(h="-"+h)}n=l?h+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?l.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):l):h}return(r.prefix||"")+n+(r.suffix||"")},I.toFraction=function(t){var e,n,i,o,s,a,c,f,h,d,b,g,m=this,y=m.c;if(null!=t&&(!(c=new $(t)).isInteger()&&(c.c||1!==c.s)||c.lt(M)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Y(c));if(!y)return new $(m);for(e=new $(M),h=n=new $(M),i=f=new $(M),g=v(y),s=e.e=g.length-m.e-1,e.c[0]=p[(a=s%l)<0?l+a:a],t=!t||c.comparedTo(e)>0?s>0?e:h:c,a=D,D=1/0,c=new $(g),f.c[0]=0;d=r(c,e,0,1),1!=(o=n.plus(d.times(i))).comparedTo(t);)n=i,i=o,h=f.plus(d.times(o=h)),f=o,e=c.minus(d.times(o=e)),c=o;return o=r(t.minus(n),i,0,1),f=f.plus(o.times(h)),n=n.plus(o.times(i)),f.s=h.s=m.s,b=r(h,i,s*=2,k).minus(m).abs().comparedTo(r(f,n,s,k).minus(m).abs())<1?[h,i]:[f,n],D=a,b},I.toNumber=function(){return+Y(this)},I.toPrecision=function(t,e){return null!=t&&w(t,1,g),G(this,t,e,2)},I.toString=function(t){var e,r=this,i=r.s,o=r.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=C||o>=L?E(v(r.c),o):S(v(r.c),o,"0"):10===t&&H?e=S(v((r=W(new $(r),N+o+1,k)).c),r.e,"0"):(w(t,2,K.length,"Base"),e=n(S(v(r.c),o,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},I.valueOf=I.toJSON=function(){return Y(this)},I._isBigNumber=!0,null!=e&&$.set(e),$}(),o.default=o.BigNumber=o,void 0===(n=function(){return o}.call(e,r,e,t))||(t.exports=n)}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.wipe=function(t){for(var e=0;e<t.length;e++)t[e]=0;return t}},function(t,e,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}m(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&m(t,"error",e,r)}(t,i,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function u(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function f(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function h(t,e,r,n){var i,o,s,a;if(u(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"==typeof s?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=f(t))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return t}function l(){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 d(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function p(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):g(i,i.length)}function b(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function m(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){n.once&&t.removeEventListener(e,i),r(o)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");c=t}}),a.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},a.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},a.prototype.getMaxListeners=function(){return f(this)},a.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[t];if(void 0===c)return!1;if("function"==typeof c)o(c,this,e);else{var u=c.length,f=g(c,u);for(r=0;r<u;++r)o(f[r],this,e)}return!0},a.prototype.addListener=function(t,e){return h(this,t,e,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(t,e){return h(this,t,e,!0)},a.prototype.once=function(t,e){return u(e),this.on(t,d(this,t,e)),this},a.prototype.prependOnceListener=function(t,e){return u(e),this.prependListener(t,d(this,t,e)),this},a.prototype.removeListener=function(t,e){var r,n,i,o,s;if(u(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(t){var e,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[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),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(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):b.call(t,e)},a.prototype.listenerCount=b,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(t,e,r){"use strict";var n=r(219).Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.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(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=c,this.end=u,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=f,this.end=h,e=3;break;default:return this.write=l,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function c(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function f(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var i=s(e[n]);if(i>=0)return i>0&&(t.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if((i=s(e[n]))>=0)return i>0&&(t.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if((i=s(e[n]))>=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){(function(t){function r(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===r(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===r(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===r(t)},e.isError=function(t){return"[object Error]"===r(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,r(14).Buffer)},function(t,e,r){"use strict";var n=r(34),i=r(50);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=o,o.prototype.update=function(t,e){if(t=n.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},o.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},o.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RPCBatchProvider=e.OperationBatch=e.BATCH_KINDS=void 0;const i=r(96),o=r(161),s=r(97),a=r(23),c=r(22),u=r(2);e.BATCH_KINDS=[c.OpKind.ACTIVATION,c.OpKind.ORIGINATION,c.OpKind.TRANSACTION,c.OpKind.DELEGATION];class f extends s.OperationEmitter{constructor(t,e){super(t),this.estimator=e,this.operations=[]}withTransfer(t){if(u.validateAddress(t.to)!==u.ValidationResult.VALID)throw new u.InvalidAddressError(`Invalid 'to' address: ${t.to}`);return this.operations.push(Object.assign({kind:c.OpKind.TRANSACTION},t)),this}withContractCall(t){return this.withTransfer(t.toTransferParams())}withDelegation(t){if(t.source&&u.validateAddress(t.source)!==u.ValidationResult.VALID)throw new u.InvalidAddressError(`Invalid source address: ${t.source}`);if(t.delegate&&u.validateAddress(t.delegate)!==u.ValidationResult.VALID)throw new u.InvalidAddressError(`Invalid delegate address: ${t.delegate}`);return this.operations.push(Object.assign({kind:c.OpKind.DELEGATION},t)),this}withActivation({pkh:t,secret:e}){if(u.validateKeyHash(t)!==u.ValidationResult.VALID)throw new u.InvalidKeyHashError(`Invalid Key Hash: ${t}`);return this.operations.push({kind:c.OpKind.ACTIVATION,pkh:t,secret:e}),this}withOrigination(t){return this.operations.push(Object.assign({kind:c.OpKind.ORIGINATION},t)),this}withRegisterGlobalConstant(t){return this.operations.push(Object.assign({kind:c.OpKind.REGISTER_GLOBAL_CONSTANT},t)),this}getRPCOp(t){return n(this,void 0,void 0,(function*(){switch(t.kind){case c.OpKind.TRANSACTION:return i.createTransferOperation(Object.assign({},t));case c.OpKind.ORIGINATION:return i.createOriginationOperation(yield this.context.parser.prepareCodeOrigination(Object.assign({},t)));case c.OpKind.DELEGATION:return i.createSetDelegateOperation(Object.assign({},t));case c.OpKind.ACTIVATION:return Object.assign({},t);case c.OpKind.REGISTER_GLOBAL_CONSTANT:return i.createRegisterGlobalConstantOperation(Object.assign({},t));default:throw new Error(`Unsupported operation kind: ${t.kind}`)}}))}with(t){for(const e of t)switch(e.kind){case c.OpKind.TRANSACTION:this.withTransfer(e);break;case c.OpKind.ORIGINATION:this.withOrigination(e);break;case c.OpKind.DELEGATION:this.withDelegation(e);break;case c.OpKind.ACTIVATION:this.withActivation(e);break;case c.OpKind.REGISTER_GLOBAL_CONSTANT:this.withRegisterGlobalConstant(e);break;default:throw new Error(`Unsupported operation kind: ${e.kind}`)}return this}send(t){return n(this,void 0,void 0,(function*(){const e=yield this.signer.publicKeyHash(),r=yield this.signer.publicKey(),s=yield this.estimator.batch(this.operations),u=yield this.isRevealOpNeeded(this.operations,e);let f=u?1:0;const h=[];for(const t of this.operations){if(a.isOpWithFee(t)){const e=yield this.estimate(t,(()=>n(this,void 0,void 0,(function*(){return s[f]}))));h.push(yield this.getRPCOp(Object.assign(Object.assign({},t),e)))}else h.push(Object.assign({},t));f++}if(u){const t={kind:c.OpKind.REVEAL},o=yield this.estimate(t,(()=>n(this,void 0,void 0,(function*(){return s[0]}))));h.unshift(yield i.createRevealOperation(Object.assign({},o),e,r))}const l=t&&t.source||e,d=yield this.prepareOperation({operation:h,source:l}),p=yield this.forge(d),{hash:b,context:g,forgedBytes:m,opResponse:v}=yield this.signAndInject(p);return new o.BatchOperation(b,h,l,m,v,g)}))}}e.OperationBatch=f;e.RPCBatchProvider=class{constructor(t,e){this.context=t,this.estimator=e}batch(t){const e=new f(this.context,this.estimator);return Array.isArray(t)&&e.with(t),e}}},function(t,e,r){"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.ChainIds=e.protocols=e.Protocols=e.DEFAULT_STORAGE_LIMIT=e.DEFAULT_FEE=e.DEFAULT_GAS_LIMIT=void 0,function(t){t[t.DELEGATION=10600]="DELEGATION",t[t.ORIGINATION=10600]="ORIGINATION",t[t.TRANSFER=10600]="TRANSFER",t[t.REVEAL=1100]="REVEAL"}(e.DEFAULT_GAS_LIMIT||(e.DEFAULT_GAS_LIMIT={})),function(t){t[t.DELEGATION=1257]="DELEGATION",t[t.ORIGINATION=1e4]="ORIGINATION",t[t.TRANSFER=1e4]="TRANSFER",t[t.REVEAL=374]="REVEAL"}(e.DEFAULT_FEE||(e.DEFAULT_FEE={})),function(t){t[t.DELEGATION=0]="DELEGATION",t[t.ORIGINATION=257]="ORIGINATION",t[t.TRANSFER=257]="TRANSFER",t[t.REVEAL=0]="REVEAL"}(e.DEFAULT_STORAGE_LIMIT||(e.DEFAULT_STORAGE_LIMIT={})),function(t){t.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",t.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",t.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",t.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",t.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",t.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",t.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",t.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",t.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",t.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",t.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",t.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"}(n=e.Protocols||(e.Protocols={})),e.protocols={"004":[n.Pt24m4xi],"005":[n.PsBABY5H,n.PsBabyM1],"006":[n.PsCARTHA],"007":[n.PsDELPH1],"008":[n.PtEdo2Zk],"009":[n.PsFLorena],"010":[n.PtGRANADs],"011":[n.PtHangz2],"012":[n.PsiThaCa],"013":[n.Psithaca2],"014":[n.ProtoALpha]},function(t){t.MAINNET="NetXdQprcVkpaWU",t.CARTHAGENET="NetXjD3HPJJjmcd",t.DELPHINET="NetXm8tYqnMWky1",t.EDONET="NetXSgo1ZT2DRUG",t.FLORENCENET="NetXxkAx4woPLyu",t.GRANADANET="NetXz969SFaFn8k",t.HANGZHOUNET="NetXZSsxBpMQeAT",t.ITHACANET="NetXbhmtAbMukLc",t.ITHACANET2="NetXnHfVqm9iesp"}(e.ChainIds||(e.ChainIds={}))},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(276),e),i(r(64),e),i(r(164),e),i(r(163),e),i(r(162),e),i(r(282),e),i(r(283),e)},function(t,e,r){"use strict";r.r(e),r.d(e,"audit",(function(){return o})),r.d(e,"auditTime",(function(){return f})),r.d(e,"buffer",(function(){return h})),r.d(e,"bufferCount",(function(){return b})),r.d(e,"bufferTime",(function(){return w})),r.d(e,"bufferToggle",(function(){return I})),r.d(e,"bufferWhen",(function(){return k})),r.d(e,"catchError",(function(){return j})),r.d(e,"combineAll",(function(){return F})),r.d(e,"combineLatest",(function(){return H})),r.d(e,"concat",(function(){return G})),r.d(e,"concatAll",(function(){return z.a})),r.d(e,"concatMap",(function(){return W})),r.d(e,"concatMapTo",(function(){return Y})),r.d(e,"count",(function(){return J})),r.d(e,"debounce",(function(){return Q})),r.d(e,"debounceTime",(function(){return rt})),r.d(e,"defaultIfEmpty",(function(){return st})),r.d(e,"delay",(function(){return ht})),r.d(e,"delayWhen",(function(){return gt})),r.d(e,"dematerialize",(function(){return _t})),r.d(e,"distinct",(function(){return At})),r.d(e,"distinctUntilChanged",(function(){return Tt})),r.d(e,"distinctUntilKeyChanged",(function(){return It})),r.d(e,"elementAt",(function(){return Kt})),r.d(e,"endWith",(function(){return $t})),r.d(e,"every",(function(){return Gt})),r.d(e,"exhaust",(function(){return Wt})),r.d(e,"exhaustMap",(function(){return Xt})),r.d(e,"expand",(function(){return ee})),r.d(e,"filter",(function(){return Nt.a})),r.d(e,"finalize",(function(){return ie})),r.d(e,"find",(function(){return ae})),r.d(e,"findIndex",(function(){return fe})),r.d(e,"first",(function(){return le})),r.d(e,"groupBy",(function(){return de.b})),r.d(e,"ignoreElements",(function(){return pe})),r.d(e,"isEmpty",(function(){return me})),r.d(e,"last",(function(){return Se})),r.d(e,"map",(function(){return Zt.a})),r.d(e,"mapTo",(function(){return Ae})),r.d(e,"materialize",(function(){return Te})),r.d(e,"max",(function(){return Le})),r.d(e,"merge",(function(){return De})),r.d(e,"mergeAll",(function(){return Ue.a})),r.d(e,"mergeMap",(function(){return q.b})),r.d(e,"flatMap",(function(){return q.a})),r.d(e,"mergeMapTo",(function(){return Be})),r.d(e,"mergeScan",(function(){return Fe})),r.d(e,"min",(function(){return He})),r.d(e,"multicast",(function(){return Ge})),r.d(e,"observeOn",(function(){return qe.b})),r.d(e,"onErrorResumeNext",(function(){return We})),r.d(e,"pairwise",(function(){return Ze})),r.d(e,"partition",(function(){return er})),r.d(e,"pluck",(function(){return rr})),r.d(e,"publish",(function(){return or})),r.d(e,"publishBehavior",(function(){return ar})),r.d(e,"publishLast",(function(){return ur})),r.d(e,"publishReplay",(function(){return hr})),r.d(e,"race",(function(){return dr})),r.d(e,"reduce",(function(){return Ce})),r.d(e,"repeat",(function(){return pr})),r.d(e,"repeatWhen",(function(){return mr})),r.d(e,"retry",(function(){return wr})),r.d(e,"retryWhen",(function(){return Sr})),r.d(e,"refCount",(function(){return xr.a})),r.d(e,"sample",(function(){return Tr})),r.d(e,"sampleTime",(function(){return Ir})),r.d(e,"scan",(function(){return Ie})),r.d(e,"sequenceEqual",(function(){return Cr})),r.d(e,"share",(function(){return Br})),r.d(e,"shareReplay",(function(){return Fr})),r.d(e,"single",(function(){return Vr})),r.d(e,"skip",(function(){return $r})),r.d(e,"skipLast",(function(){return qr})),r.d(e,"skipUntil",(function(){return Jr})),r.d(e,"skipWhile",(function(){return Qr})),r.d(e,"startWith",(function(){return rn})),r.d(e,"subscribeOn",(function(){return an})),r.d(e,"switchAll",(function(){return ln})),r.d(e,"switchMap",(function(){return un})),r.d(e,"switchMapTo",(function(){return dn})),r.d(e,"take",(function(){return Bt})),r.d(e,"takeLast",(function(){return we})),r.d(e,"takeUntil",(function(){return pn})),r.d(e,"takeWhile",(function(){return mn})),r.d(e,"tap",(function(){return En})),r.d(e,"throttle",(function(){return xn})),r.d(e,"throttleTime",(function(){return Rn})),r.d(e,"throwIfEmpty",(function(){return Ct})),r.d(e,"timeInterval",(function(){return Cn})),r.d(e,"timeout",(function(){return Vn})),r.d(e,"timeoutWith",(function(){return Dn})),r.d(e,"timestamp",(function(){return Kn})),r.d(e,"toArray",(function(){return Gn})),r.d(e,"window",(function(){return zn})),r.d(e,"windowCount",(function(){return Yn})),r.d(e,"windowTime",(function(){return Xn})),r.d(e,"windowToggle",(function(){return oi})),r.d(e,"windowWhen",(function(){return ci})),r.d(e,"withLatestFrom",(function(){return hi})),r.d(e,"zip",(function(){return bi})),r.d(e,"zipAll",(function(){return gi}));var n=r(0),i=r(3);function o(t){return function(e){return e.lift(new s(t))}}var s=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.durationSelector))},t}(),a=function(t){function e(e,r){var n=t.call(this,e)||this;return n.durationSelector=r,n.hasValue=!1,n}return n.a(e,t),e.prototype._next=function(t){if(this.value=t,this.hasValue=!0,!this.throttled){var e=void 0;try{e=(0,this.durationSelector)(t)}catch(t){return this.destination.error(t)}var r=Object(i.c)(e,new i.a(this));!r||r.closed?this.clearThrottle():this.add(this.throttled=r)}},e.prototype.clearThrottle=function(){var t=this,e=t.value,r=t.hasValue,n=t.throttled;n&&(this.remove(n),this.throttled=void 0,n.unsubscribe()),r&&(this.value=void 0,this.hasValue=!1,this.destination.next(e))},e.prototype.notifyNext=function(){this.clearThrottle()},e.prototype.notifyComplete=function(){this.clearThrottle()},e}(i.b),c=r(7),u=r(106);function f(t,e){return void 0===e&&(e=c.a),o((function(){return Object(u.a)(t,e)}))}function h(t){return function(e){return e.lift(new l(t))}}var l=function(){function t(t){this.closingNotifier=t}return t.prototype.call=function(t,e){return e.subscribe(new d(t,this.closingNotifier))},t}(),d=function(t){function e(e,r){var n=t.call(this,e)||this;return n.buffer=[],n.add(Object(i.c)(r,new i.a(n))),n}return n.a(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype.notifyNext=function(){var t=this.buffer;this.buffer=[],this.destination.next(t)},e}(i.b),p=r(1);function b(t,e){return void 0===e&&(e=null),function(r){return r.lift(new g(t,e))}}var g=function(){function t(t,e){this.bufferSize=t,this.startBufferEvery=e,this.subscriberClass=e&&t!==e?v:m}return t.prototype.call=function(t,e){return e.subscribe(new this.subscriberClass(t,this.bufferSize,this.startBufferEvery))},t}(),m=function(t){function e(e,r){var n=t.call(this,e)||this;return n.bufferSize=r,n.buffer=[],n}return n.a(e,t),e.prototype._next=function(t){var e=this.buffer;e.push(t),e.length==this.bufferSize&&(this.destination.next(e),this.buffer=[])},e.prototype._complete=function(){var e=this.buffer;e.length>0&&this.destination.next(e),t.prototype._complete.call(this)},e}(p.a),v=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.bufferSize=r,i.startBufferEvery=n,i.buffers=[],i.count=0,i}return n.a(e,t),e.prototype._next=function(t){var e=this,r=e.bufferSize,n=e.startBufferEvery,i=e.buffers,o=e.count;this.count++,o%n==0&&i.push([]);for(var s=i.length;s--;){var a=i[s];a.push(t),a.length===r&&(i.splice(s,1),this.destination.next(a))}},e.prototype._complete=function(){for(var e=this.buffers,r=this.destination;e.length>0;){var n=e.shift();n.length>0&&r.next(n)}t.prototype._complete.call(this)},e}(p.a),y=r(10);function w(t){var e=arguments.length,r=c.a;Object(y.a)(arguments[arguments.length-1])&&(r=arguments[arguments.length-1],e--);var n=null;e>=2&&(n=arguments[1]);var i=Number.POSITIVE_INFINITY;return e>=3&&(i=arguments[2]),function(e){return e.lift(new _(t,n,i,r))}}var _=function(){function t(t,e,r,n){this.bufferTimeSpan=t,this.bufferCreationInterval=e,this.maxBufferSize=r,this.scheduler=n}return t.prototype.call=function(t,e){return e.subscribe(new S(t,this.bufferTimeSpan,this.bufferCreationInterval,this.maxBufferSize,this.scheduler))},t}(),E=function(){return function(){this.buffer=[]}}(),S=function(t){function e(e,r,n,i,o){var s=t.call(this,e)||this;s.bufferTimeSpan=r,s.bufferCreationInterval=n,s.maxBufferSize=i,s.scheduler=o,s.contexts=[];var a=s.openContext();if(s.timespanOnly=null==n||n<0,s.timespanOnly){var c={subscriber:s,context:a,bufferTimeSpan:r};s.add(a.closeAction=o.schedule(A,r,c))}else{var u={subscriber:s,context:a},f={bufferTimeSpan:r,bufferCreationInterval:n,subscriber:s,scheduler:o};s.add(a.closeAction=o.schedule(x,r,u)),s.add(o.schedule(O,n,f))}return s}return n.a(e,t),e.prototype._next=function(t){for(var e,r=this.contexts,n=r.length,i=0;i<n;i++){var o=r[i],s=o.buffer;s.push(t),s.length==this.maxBufferSize&&(e=o)}e&&this.onBufferFull(e)},e.prototype._error=function(e){this.contexts.length=0,t.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts,r=this.destination;e.length>0;){var n=e.shift();r.next(n.buffer)}t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.contexts=null},e.prototype.onBufferFull=function(t){this.closeContext(t);var e=t.closeAction;if(e.unsubscribe(),this.remove(e),!this.closed&&this.timespanOnly){t=this.openContext();var r=this.bufferTimeSpan,n={subscriber:this,context:t,bufferTimeSpan:r};this.add(t.closeAction=this.scheduler.schedule(A,r,n))}},e.prototype.openContext=function(){var t=new E;return this.contexts.push(t),t},e.prototype.closeContext=function(t){this.destination.next(t.buffer);var e=this.contexts;(e?e.indexOf(t):-1)>=0&&e.splice(e.indexOf(t),1)},e}(p.a);function A(t){var e=t.subscriber,r=t.context;r&&e.closeContext(r),e.closed||(t.context=e.openContext(),t.context.closeAction=this.schedule(t,t.bufferTimeSpan))}function O(t){var e=t.bufferCreationInterval,r=t.bufferTimeSpan,n=t.subscriber,i=t.scheduler,o=n.openContext();n.closed||(n.add(o.closeAction=i.schedule(x,r,{subscriber:n,context:o})),this.schedule(t,e))}function x(t){var e=t.subscriber,r=t.context;e.closeContext(r)}var T=r(5),P=r(15),R=r(19);function I(t,e){return function(r){return r.lift(new M(t,e))}}var M=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new N(t,this.openings,this.closingSelector))},t}(),N=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.closingSelector=n,i.contexts=[],i.add(Object(P.a)(i,r)),i}return n.a(e,t),e.prototype._next=function(t){for(var e=this.contexts,r=e.length,n=0;n<r;n++)e[n].buffer.push(t)},e.prototype._error=function(e){for(var r=this.contexts;r.length>0;){var n=r.shift();n.subscription.unsubscribe(),n.buffer=null,n.subscription=null}this.contexts=null,t.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts;e.length>0;){var r=e.shift();this.destination.next(r.buffer),r.subscription.unsubscribe(),r.buffer=null,r.subscription=null}this.contexts=null,t.prototype._complete.call(this)},e.prototype.notifyNext=function(t,e){t?this.closeBuffer(t):this.openBuffer(e)},e.prototype.notifyComplete=function(t){this.closeBuffer(t.context)},e.prototype.openBuffer=function(t){try{var e=this.closingSelector.call(this,t);e&&this.trySubscribe(e)}catch(t){this._error(t)}},e.prototype.closeBuffer=function(t){var e=this.contexts;if(e&&t){var r=t.buffer,n=t.subscription;this.destination.next(r),e.splice(e.indexOf(t),1),this.remove(n),n.unsubscribe()}},e.prototype.trySubscribe=function(t){var e=this.contexts,r=new T.a,n={buffer:[],subscription:r};e.push(n);var i=Object(P.a)(this,t,n);!i||i.closed?this.closeBuffer(n):(i.context=n,this.add(i),r.add(i))},e}(R.a);function k(t){return function(e){return e.lift(new C(t))}}var C=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new L(t,this.closingSelector))},t}(),L=function(t){function e(e,r){var n=t.call(this,e)||this;return n.closingSelector=r,n.subscribing=!1,n.openBuffer(),n}return n.a(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype._complete=function(){var e=this.buffer;e&&this.destination.next(e),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.buffer=void 0,this.subscribing=!1},e.prototype.notifyNext=function(){this.openBuffer()},e.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},e.prototype.openBuffer=function(){var t=this.closingSubscription;t&&(this.remove(t),t.unsubscribe());var e,r=this.buffer;this.buffer&&this.destination.next(r),this.buffer=[];try{e=(0,this.closingSelector)()}catch(t){return this.error(t)}t=new T.a,this.closingSubscription=t,this.add(t),this.subscribing=!0,t.add(Object(i.c)(e,new i.a(this))),this.subscribing=!1},e}(i.b);function j(t){return function(e){var r=new D(t),n=e.lift(r);return r.caught=n}}var D=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new U(t,this.selector,this.caught))},t}(),U=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.selector=r,i.caught=n,i}return n.a(e,t),e.prototype.error=function(e){if(!this.isStopped){var r=void 0;try{r=this.selector(e,this.caught)}catch(e){return void t.prototype.error.call(this,e)}this._unsubscribeAndRecycle();var n=new i.a(this);this.add(n);var o=Object(i.c)(r,n);o!==n&&this.add(o)}},e}(i.b),B=r(68);function F(t){return function(e){return e.lift(new B.a(t))}}var V=r(8),K=r(13);function H(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=null;return"function"==typeof t[t.length-1]&&(r=t.pop()),1===t.length&&Object(V.a)(t[0])&&(t=t[0].slice()),function(e){return e.lift.call(Object(K.a)([e].concat(t)),new B.a(r))}}var $=r(44);function G(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call($.a.apply(void 0,[e].concat(t)))}}var z=r(103),q=r(36);function W(t,e){return Object(q.b)(t,e,1)}function Y(t,e){return W((function(){return t}),e)}function J(t){return function(e){return e.lift(new Z(t,e))}}var Z=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new X(t,this.predicate,this.source))},t}(),X=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.predicate=r,i.source=n,i.count=0,i.index=0,i}return n.a(e,t),e.prototype._next=function(t){this.predicate?this._tryPredicate(t):this.count++},e.prototype._tryPredicate=function(t){var e;try{e=this.predicate(t,this.index++,this.source)}catch(t){return void this.destination.error(t)}e&&this.count++},e.prototype._complete=function(){this.destination.next(this.count),this.destination.complete()},e}(p.a);function Q(t){return function(e){return e.lift(new tt(t))}}var tt=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new et(t,this.durationSelector))},t}(),et=function(t){function e(e,r){var n=t.call(this,e)||this;return n.durationSelector=r,n.hasValue=!1,n}return n.a(e,t),e.prototype._next=function(t){try{var e=this.durationSelector.call(this,t);e&&this._tryNext(t,e)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.emitValue(),this.destination.complete()},e.prototype._tryNext=function(t,e){var r=this.durationSubscription;this.value=t,this.hasValue=!0,r&&(r.unsubscribe(),this.remove(r)),(r=Object(i.c)(e,new i.a(this)))&&!r.closed&&this.add(this.durationSubscription=r)},e.prototype.notifyNext=function(){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){if(this.hasValue){var e=this.value,r=this.durationSubscription;r&&(this.durationSubscription=void 0,r.unsubscribe(),this.remove(r)),this.value=void 0,this.hasValue=!1,t.prototype._next.call(this,e)}},e}(i.b);function rt(t,e){return void 0===e&&(e=c.a),function(r){return r.lift(new nt(t,e))}}var nt=function(){function t(t,e){this.dueTime=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new it(t,this.dueTime,this.scheduler))},t}(),it=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.dueTime=r,i.scheduler=n,i.debouncedSubscription=null,i.lastValue=null,i.hasValue=!1,i}return n.a(e,t),e.prototype._next=function(t){this.clearDebounce(),this.lastValue=t,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(ot,this.dueTime,this))},e.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},e.prototype.debouncedNext=function(){if(this.clearDebounce(),this.hasValue){var t=this.lastValue;this.lastValue=null,this.hasValue=!1,this.destination.next(t)}},e.prototype.clearDebounce=function(){var t=this.debouncedSubscription;null!==t&&(this.remove(t),t.unsubscribe(),this.debouncedSubscription=null)},e}(p.a);function ot(t){t.debouncedNext()}function st(t){return void 0===t&&(t=null),function(e){return e.lift(new at(t))}}var at=function(){function t(t){this.defaultValue=t}return t.prototype.call=function(t,e){return e.subscribe(new ct(t,this.defaultValue))},t}(),ct=function(t){function e(e,r){var n=t.call(this,e)||this;return n.defaultValue=r,n.isEmpty=!0,n}return n.a(e,t),e.prototype._next=function(t){this.isEmpty=!1,this.destination.next(t)},e.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},e}(p.a);function ut(t){return t instanceof Date&&!isNaN(+t)}var ft=r(21);function ht(t,e){void 0===e&&(e=c.a);var r=ut(t)?+t-e.now():Math.abs(t);return function(t){return t.lift(new lt(r,e))}}var lt=function(){function t(t,e){this.delay=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new dt(t,this.delay,this.scheduler))},t}(),dt=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.delay=r,i.scheduler=n,i.queue=[],i.active=!1,i.errored=!1,i}return n.a(e,t),e.dispatch=function(t){for(var e=t.source,r=e.queue,n=t.scheduler,i=t.destination;r.length>0&&r[0].time-n.now()<=0;)r.shift().notification.observe(i);if(r.length>0){var o=Math.max(0,r[0].time-n.now());this.schedule(t,o)}else this.unsubscribe(),e.active=!1},e.prototype._schedule=function(t){this.active=!0,this.destination.add(t.schedule(e.dispatch,this.delay,{source:this,destination:this.destination,scheduler:t}))},e.prototype.scheduleNotification=function(t){if(!0!==this.errored){var e=this.scheduler,r=new pt(e.now()+this.delay,t);this.queue.push(r),!1===this.active&&this._schedule(e)}},e.prototype._next=function(t){this.scheduleNotification(ft.a.createNext(t))},e.prototype._error=function(t){this.errored=!0,this.queue=[],this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.scheduleNotification(ft.a.createComplete()),this.unsubscribe()},e}(p.a),pt=function(){return function(t,e){this.time=t,this.notification=e}}(),bt=r(4);function gt(t,e){return e?function(r){return new yt(r,e).lift(new mt(t))}:function(e){return e.lift(new mt(t))}}var mt=function(){function t(t){this.delayDurationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new vt(t,this.delayDurationSelector))},t}(),vt=function(t){function e(e,r){var n=t.call(this,e)||this;return n.delayDurationSelector=r,n.completed=!1,n.delayNotifierSubscriptions=[],n.index=0,n}return n.a(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.destination.next(t),this.removeSubscription(i),this.tryComplete()},e.prototype.notifyError=function(t,e){this._error(t)},e.prototype.notifyComplete=function(t){var e=this.removeSubscription(t);e&&this.destination.next(e),this.tryComplete()},e.prototype._next=function(t){var e=this.index++;try{var r=this.delayDurationSelector(t,e);r&&this.tryDelay(r,t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.completed=!0,this.tryComplete(),this.unsubscribe()},e.prototype.removeSubscription=function(t){t.unsubscribe();var e=this.delayNotifierSubscriptions.indexOf(t);return-1!==e&&this.delayNotifierSubscriptions.splice(e,1),t.outerValue},e.prototype.tryDelay=function(t,e){var r=Object(P.a)(this,t,e);r&&!r.closed&&(this.destination.add(r),this.delayNotifierSubscriptions.push(r))},e.prototype.tryComplete=function(){this.completed&&0===this.delayNotifierSubscriptions.length&&this.destination.complete()},e}(R.a),yt=function(t){function e(e,r){var n=t.call(this)||this;return n.source=e,n.subscriptionDelay=r,n}return n.a(e,t),e.prototype._subscribe=function(t){this.subscriptionDelay.subscribe(new wt(t,this.source))},e}(bt.a),wt=function(t){function e(e,r){var n=t.call(this)||this;return n.parent=e,n.source=r,n.sourceSubscribed=!1,n}return n.a(e,t),e.prototype._next=function(t){this.subscribeToSource()},e.prototype._error=function(t){this.unsubscribe(),this.parent.error(t)},e.prototype._complete=function(){this.unsubscribe(),this.subscribeToSource()},e.prototype.subscribeToSource=function(){this.sourceSubscribed||(this.sourceSubscribed=!0,this.unsubscribe(),this.source.subscribe(this.parent))},e}(p.a);function _t(){return function(t){return t.lift(new Et)}}var Et=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new St(t))},t}(),St=function(t){function e(e){return t.call(this,e)||this}return n.a(e,t),e.prototype._next=function(t){t.observe(this.destination)},e}(p.a);function At(t,e){return function(r){return r.lift(new Ot(t,e))}}var Ot=function(){function t(t,e){this.keySelector=t,this.flushes=e}return t.prototype.call=function(t,e){return e.subscribe(new xt(t,this.keySelector,this.flushes))},t}(),xt=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.keySelector=r,o.values=new Set,n&&o.add(Object(i.c)(n,new i.a(o))),o}return n.a(e,t),e.prototype.notifyNext=function(){this.values.clear()},e.prototype.notifyError=function(t){this._error(t)},e.prototype._next=function(t){this.keySelector?this._useKeySelector(t):this._finalizeNext(t,t)},e.prototype._useKeySelector=function(t){var e,r=this.destination;try{e=this.keySelector(t)}catch(t){return void r.error(t)}this._finalizeNext(e,t)},e.prototype._finalizeNext=function(t,e){var r=this.values;r.has(t)||(r.add(t),this.destination.next(e))},e}(i.b);function Tt(t,e){return function(r){return r.lift(new Pt(t,e))}}var Pt=function(){function t(t,e){this.compare=t,this.keySelector=e}return t.prototype.call=function(t,e){return e.subscribe(new Rt(t,this.compare,this.keySelector))},t}(),Rt=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.keySelector=n,i.hasKey=!1,"function"==typeof r&&(i.compare=r),i}return n.a(e,t),e.prototype.compare=function(t,e){return t===e},e.prototype._next=function(t){var e;try{var r=this.keySelector;e=r?r(t):t}catch(t){return this.destination.error(t)}var n=!1;if(this.hasKey)try{n=(0,this.compare)(this.key,e)}catch(t){return this.destination.error(t)}else this.hasKey=!0;n||(this.key=e,this.destination.next(t))},e}(p.a);function It(t,e){return Tt((function(r,n){return e?e(r[t],n[t]):r[t]===n[t]}))}var Mt=r(31),Nt=r(20),kt=r(35);function Ct(t){return void 0===t&&(t=Dt),function(e){return e.lift(new Lt(t))}}var Lt=function(){function t(t){this.errorFactory=t}return t.prototype.call=function(t,e){return e.subscribe(new jt(t,this.errorFactory))},t}(),jt=function(t){function e(e,r){var n=t.call(this,e)||this;return n.errorFactory=r,n.hasValue=!1,n}return n.a(e,t),e.prototype._next=function(t){this.hasValue=!0,this.destination.next(t)},e.prototype._complete=function(){if(this.hasValue)return this.destination.complete();var t=void 0;try{t=this.errorFactory()}catch(e){t=e}this.destination.error(t)},e}(p.a);function Dt(){return new kt.a}var Ut=r(11);function Bt(t){return function(e){return 0===t?Object(Ut.b)():e.lift(new Ft(t))}}var Ft=function(){function t(t){if(this.total=t,this.total<0)throw new Mt.a}return t.prototype.call=function(t,e){return e.subscribe(new Vt(t,this.total))},t}(),Vt=function(t){function e(e,r){var n=t.call(this,e)||this;return n.total=r,n.count=0,n}return n.a(e,t),e.prototype._next=function(t){var e=this.total,r=++this.count;r<=e&&(this.destination.next(t),r===e&&(this.destination.complete(),this.unsubscribe()))},e}(p.a);function Kt(t,e){if(t<0)throw new Mt.a;var r=arguments.length>=2;return function(n){return n.pipe(Object(Nt.a)((function(e,r){return r===t})),Bt(1),r?st(e):Ct((function(){return new Mt.a})))}}var Ht=r(48);function $t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return Object($.a)(e,Ht.a.apply(void 0,t))}}function Gt(t,e){return function(r){return r.lift(new zt(t,e,r))}}var zt=function(){function t(t,e,r){this.predicate=t,this.thisArg=e,this.source=r}return t.prototype.call=function(t,e){return e.subscribe(new qt(t,this.predicate,this.thisArg,this.source))},t}(),qt=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.predicate=r,o.thisArg=n,o.source=i,o.index=0,o.thisArg=n||o,o}return n.a(e,t),e.prototype.notifyComplete=function(t){this.destination.next(t),this.destination.complete()},e.prototype._next=function(t){var e=!1;try{e=this.predicate.call(this.thisArg,t,this.index++,this.source)}catch(t){return void this.destination.error(t)}e||this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(p.a);function Wt(){return function(t){return t.lift(new Yt)}}var Yt=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Jt(t))},t}(),Jt=function(t){function e(e){var r=t.call(this,e)||this;return r.hasCompleted=!1,r.hasSubscription=!1,r}return n.a(e,t),e.prototype._next=function(t){this.hasSubscription||(this.hasSubscription=!0,this.add(Object(i.c)(t,new i.a(this))))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete()},e.prototype.notifyComplete=function(){this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(i.b),Zt=r(9);function Xt(t,e){return e?function(r){return r.pipe(Xt((function(r,n){return Object(K.a)(t(r,n)).pipe(Object(Zt.a)((function(t,i){return e(r,t,n,i)})))})))}:function(e){return e.lift(new Qt(t))}}var Qt=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new te(t,this.project))},t}(),te=function(t){function e(e,r){var n=t.call(this,e)||this;return n.project=r,n.hasSubscription=!1,n.hasCompleted=!1,n.index=0,n}return n.a(e,t),e.prototype._next=function(t){this.hasSubscription||this.tryNext(t)},e.prototype.tryNext=function(t){var e,r=this.index++;try{e=this.project(t,r)}catch(t){return void this.destination.error(t)}this.hasSubscription=!0,this._innerSub(e)},e.prototype._innerSub=function(t){var e=new i.a(this),r=this.destination;r.add(e);var n=Object(i.c)(t,e);n!==e&&r.add(n)},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(){this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(i.b);function ee(t,e,r){return void 0===e&&(e=Number.POSITIVE_INFINITY),e=(e||0)<1?Number.POSITIVE_INFINITY:e,function(n){return n.lift(new re(t,e,r))}}var re=function(){function t(t,e,r){this.project=t,this.concurrent=e,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new ne(t,this.project,this.concurrent,this.scheduler))},t}(),ne=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.project=r,o.concurrent=n,o.scheduler=i,o.index=0,o.active=0,o.hasCompleted=!1,n<Number.POSITIVE_INFINITY&&(o.buffer=[]),o}return n.a(e,t),e.dispatch=function(t){var e=t.subscriber,r=t.result,n=t.value,i=t.index;e.subscribeToProjection(r,n,i)},e.prototype._next=function(t){var r=this.destination;if(r.closed)this._complete();else{var n=this.index++;if(this.active<this.concurrent){r.next(t);try{var i=(0,this.project)(t,n);if(this.scheduler){var o={subscriber:this,result:i,value:t,index:n};this.destination.add(this.scheduler.schedule(e.dispatch,0,o))}else this.subscribeToProjection(i,t,n)}catch(t){r.error(t)}}else this.buffer.push(t)}},e.prototype.subscribeToProjection=function(t,e,r){this.active++,this.destination.add(Object(i.c)(t,new i.a(this)))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this._next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t&&t.length>0&&this._next(t.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},e}(i.b);function ie(t){return function(e){return e.lift(new oe(t))}}var oe=function(){function t(t){this.callback=t}return t.prototype.call=function(t,e){return e.subscribe(new se(t,this.callback))},t}(),se=function(t){function e(e,r){var n=t.call(this,e)||this;return n.add(new T.a(r)),n}return n.a(e,t),e}(p.a);function ae(t,e){if("function"!=typeof t)throw new TypeError("predicate is not a function");return function(r){return r.lift(new ce(t,r,!1,e))}}var ce=function(){function t(t,e,r,n){this.predicate=t,this.source=e,this.yieldIndex=r,this.thisArg=n}return t.prototype.call=function(t,e){return e.subscribe(new ue(t,this.predicate,this.source,this.yieldIndex,this.thisArg))},t}(),ue=function(t){function e(e,r,n,i,o){var s=t.call(this,e)||this;return s.predicate=r,s.source=n,s.yieldIndex=i,s.thisArg=o,s.index=0,s}return n.a(e,t),e.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete(),this.unsubscribe()},e.prototype._next=function(t){var e=this.predicate,r=this.thisArg,n=this.index++;try{e.call(r||this,t,n,this.source)&&this.notifyComplete(this.yieldIndex?n:t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.notifyComplete(this.yieldIndex?-1:void 0)},e}(p.a);function fe(t,e){return function(r){return r.lift(new ce(t,r,!0,e))}}var he=r(17);function le(t,e){var r=arguments.length>=2;return function(n){return n.pipe(t?Object(Nt.a)((function(e,r){return t(e,r,n)})):he.a,Bt(1),r?st(e):Ct((function(){return new kt.a})))}}var de=r(95);function pe(){return function(t){return t.lift(new be)}}var be=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new ge(t))},t}(),ge=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n.a(e,t),e.prototype._next=function(t){},e}(p.a);function me(){return function(t){return t.lift(new ve)}}var ve=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new ye(t))},t}(),ye=function(t){function e(e){return t.call(this,e)||this}return n.a(e,t),e.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete()},e.prototype._next=function(t){this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(p.a);function we(t){return function(e){return 0===t?Object(Ut.b)():e.lift(new _e(t))}}var _e=function(){function t(t){if(this.total=t,this.total<0)throw new Mt.a}return t.prototype.call=function(t,e){return e.subscribe(new Ee(t,this.total))},t}(),Ee=function(t){function e(e,r){var n=t.call(this,e)||this;return n.total=r,n.ring=new Array,n.count=0,n}return n.a(e,t),e.prototype._next=function(t){var e=this.ring,r=this.total,n=this.count++;e.length<r?e.push(t):e[n%r]=t},e.prototype._complete=function(){var t=this.destination,e=this.count;if(e>0)for(var r=this.count>=this.total?this.total:this.count,n=this.ring,i=0;i<r;i++){var o=e++%r;t.next(n[o])}t.complete()},e}(p.a);function Se(t,e){var r=arguments.length>=2;return function(n){return n.pipe(t?Object(Nt.a)((function(e,r){return t(e,r,n)})):he.a,we(1),r?st(e):Ct((function(){return new kt.a})))}}function Ae(t){return function(e){return e.lift(new Oe(t))}}var Oe=function(){function t(t){this.value=t}return t.prototype.call=function(t,e){return e.subscribe(new xe(t,this.value))},t}(),xe=function(t){function e(e,r){var n=t.call(this,e)||this;return n.value=r,n}return n.a(e,t),e.prototype._next=function(t){this.destination.next(this.value)},e}(p.a);function Te(){return function(t){return t.lift(new Pe)}}var Pe=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Re(t))},t}(),Re=function(t){function e(e){return t.call(this,e)||this}return n.a(e,t),e.prototype._next=function(t){this.destination.next(ft.a.createNext(t))},e.prototype._error=function(t){var e=this.destination;e.next(ft.a.createError(t)),e.complete()},e.prototype._complete=function(){var t=this.destination;t.next(ft.a.createComplete()),t.complete()},e}(p.a);function Ie(t,e){var r=!1;return arguments.length>=2&&(r=!0),function(n){return n.lift(new Me(t,e,r))}}var Me=function(){function t(t,e,r){void 0===r&&(r=!1),this.accumulator=t,this.seed=e,this.hasSeed=r}return t.prototype.call=function(t,e){return e.subscribe(new Ne(t,this.accumulator,this.seed,this.hasSeed))},t}(),Ne=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.accumulator=r,o._seed=n,o.hasSeed=i,o.index=0,o}return n.a(e,t),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(t){this.hasSeed=!0,this._seed=t},enumerable:!0,configurable:!0}),e.prototype._next=function(t){if(this.hasSeed)return this._tryNext(t);this.seed=t,this.destination.next(t)},e.prototype._tryNext=function(t){var e,r=this.index++;try{e=this.accumulator(this.seed,t,r)}catch(t){this.destination.error(t)}this.seed=e,this.destination.next(e)},e}(p.a),ke=r(54);function Ce(t,e){return arguments.length>=2?function(r){return Object(ke.a)(Ie(t,e),we(1),st(e))(r)}:function(e){return Object(ke.a)(Ie((function(e,r,n){return t(e,r,n+1)})),we(1))(e)}}function Le(t){return Ce("function"==typeof t?function(e,r){return t(e,r)>0?e:r}:function(t,e){return t>e?t:e})}var je=r(104);function De(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(je.a.apply(void 0,[e].concat(t)))}}var Ue=r(69);function Be(t,e,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"function"==typeof e?Object(q.b)((function(){return t}),e,r):("number"==typeof e&&(r=e),Object(q.b)((function(){return t}),r))}function Fe(t,e,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),function(n){return n.lift(new Ve(t,e,r))}}var Ve=function(){function t(t,e,r){this.accumulator=t,this.seed=e,this.concurrent=r}return t.prototype.call=function(t,e){return e.subscribe(new Ke(t,this.accumulator,this.seed,this.concurrent))},t}(),Ke=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.accumulator=r,o.acc=n,o.concurrent=i,o.hasValue=!1,o.hasCompleted=!1,o.buffer=[],o.active=0,o.index=0,o}return n.a(e,t),e.prototype._next=function(t){if(this.active<this.concurrent){var e=this.index++,r=this.destination,n=void 0;try{n=(0,this.accumulator)(this.acc,t,e)}catch(t){return r.error(t)}this.active++,this._innerSub(n)}else this.buffer.push(t)},e.prototype._innerSub=function(t){var e=new i.a(this),r=this.destination;r.add(e);var n=Object(i.c)(t,e);n!==e&&r.add(n)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete()),this.unsubscribe()},e.prototype.notifyNext=function(t){var e=this.destination;this.acc=t,this.hasValue=!0,e.next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())},e}(i.b);function He(t){return Ce("function"==typeof t?function(e,r){return t(e,r)<0?e:r}:function(t,e){return t<e?t:e})}var $e=r(99);function Ge(t,e){return function(r){var n;if(n="function"==typeof t?t:function(){return t},"function"==typeof e)return r.lift(new ze(n,e));var i=Object.create(r,$e.b);return i.source=r,i.subjectFactory=n,i}}var ze=function(){function t(t,e){this.subjectFactory=t,this.selector=e}return t.prototype.call=function(t,e){var r=this.selector,n=this.subjectFactory(),i=r(n).subscribe(t);return i.add(e.subscribe(n)),i},t}(),qe=r(101);function We(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&Object(V.a)(t[0])&&(t=t[0]),function(e){return e.lift(new Ye(t))}}var Ye=function(){function t(t){this.nextSources=t}return t.prototype.call=function(t,e){return e.subscribe(new Je(t,this.nextSources))},t}(),Je=function(t){function e(e,r){var n=t.call(this,e)||this;return n.destination=e,n.nextSources=r,n}return n.a(e,t),e.prototype.notifyError=function(){this.subscribeToNextSource()},e.prototype.notifyComplete=function(){this.subscribeToNextSource()},e.prototype._error=function(t){this.subscribeToNextSource(),this.unsubscribe()},e.prototype._complete=function(){this.subscribeToNextSource(),this.unsubscribe()},e.prototype.subscribeToNextSource=function(){var t=this.nextSources.shift();if(t){var e=new i.a(this),r=this.destination;r.add(e);var n=Object(i.c)(t,e);n!==e&&r.add(n)}else this.destination.complete()},e}(i.b);function Ze(){return function(t){return t.lift(new Xe)}}var Xe=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Qe(t))},t}(),Qe=function(t){function e(e){var r=t.call(this,e)||this;return r.hasPrev=!1,r}return n.a(e,t),e.prototype._next=function(t){var e;this.hasPrev?e=[this.prev,t]:this.hasPrev=!0,this.prev=t,e&&this.destination.next(e)},e}(p.a),tr=r(112);function er(t,e){return function(r){return[Object(Nt.a)(t,e)(r),Object(Nt.a)(Object(tr.a)(t,e))(r)]}}function rr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t.length;if(0===r)throw new Error("list of properties cannot be empty.");return function(e){return Object(Zt.a)(nr(t,r))(e)}}function nr(t,e){return function(r){for(var n=r,i=0;i<e;i++){var o=null!=n?n[t[i]]:void 0;if(void 0===o)return;n=o}return n}}var ir=r(6);function or(t){return t?Ge((function(){return new ir.a}),t):Ge(new ir.a)}var sr=r(100);function ar(t){return function(e){return Ge(new sr.a(t))(e)}}var cr=r(39);function ur(){return function(t){return Ge(new cr.a)(t)}}var fr=r(66);function hr(t,e,r,n){r&&"function"!=typeof r&&(n=r);var i="function"==typeof r?r:void 0,o=new fr.a(t,e,n);return function(t){return Ge((function(){return o}),i)(t)}}var lr=r(105);function dr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return 1===t.length&&Object(V.a)(t[0])&&(t=t[0]),e.lift.call(lr.a.apply(void 0,[e].concat(t)))}}function pr(t){return void 0===t&&(t=-1),function(e){return 0===t?Object(Ut.b)():t<0?e.lift(new br(-1,e)):e.lift(new br(t-1,e))}}var br=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new gr(t,this.count,this.source))},t}(),gr=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.count=r,i.source=n,i}return n.a(e,t),e.prototype.complete=function(){if(!this.isStopped){var e=this.source,r=this.count;if(0===r)return t.prototype.complete.call(this);r>-1&&(this.count=r-1),e.subscribe(this._unsubscribeAndRecycle())}},e}(p.a);function mr(t){return function(e){return e.lift(new vr(t))}}var vr=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new yr(t,this.notifier,e))},t}(),yr=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.notifier=r,i.source=n,i.sourceIsBeingSubscribedTo=!0,i}return n.a(e,t),e.prototype.notifyNext=function(){this.sourceIsBeingSubscribedTo=!0,this.source.subscribe(this)},e.prototype.notifyComplete=function(){if(!1===this.sourceIsBeingSubscribedTo)return t.prototype.complete.call(this)},e.prototype.complete=function(){if(this.sourceIsBeingSubscribedTo=!1,!this.isStopped){if(this.retries||this.subscribeToRetries(),!this.retriesSubscription||this.retriesSubscription.closed)return t.prototype.complete.call(this);this._unsubscribeAndRecycle(),this.notifications.next(void 0)}},e.prototype._unsubscribe=function(){var t=this.notifications,e=this.retriesSubscription;t&&(t.unsubscribe(),this.notifications=void 0),e&&(e.unsubscribe(),this.retriesSubscription=void 0),this.retries=void 0},e.prototype._unsubscribeAndRecycle=function(){var e=this._unsubscribe;return this._unsubscribe=null,t.prototype._unsubscribeAndRecycle.call(this),this._unsubscribe=e,this},e.prototype.subscribeToRetries=function(){var e;this.notifications=new ir.a;try{e=(0,this.notifier)(this.notifications)}catch(e){return t.prototype.complete.call(this)}this.retries=e,this.retriesSubscription=Object(i.c)(e,new i.a(this))},e}(i.b);function wr(t){return void 0===t&&(t=-1),function(e){return e.lift(new _r(t,e))}}var _r=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Er(t,this.count,this.source))},t}(),Er=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.count=r,i.source=n,i}return n.a(e,t),e.prototype.error=function(e){if(!this.isStopped){var r=this.source,n=this.count;if(0===n)return t.prototype.error.call(this,e);n>-1&&(this.count=n-1),r.subscribe(this._unsubscribeAndRecycle())}},e}(p.a);function Sr(t){return function(e){return e.lift(new Ar(t,e))}}var Ar=function(){function t(t,e){this.notifier=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Or(t,this.notifier,this.source))},t}(),Or=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.notifier=r,i.source=n,i}return n.a(e,t),e.prototype.error=function(e){if(!this.isStopped){var r=this.errors,n=this.retries,o=this.retriesSubscription;if(n)this.errors=void 0,this.retriesSubscription=void 0;else{r=new ir.a;try{n=(0,this.notifier)(r)}catch(e){return t.prototype.error.call(this,e)}o=Object(i.c)(n,new i.a(this))}this._unsubscribeAndRecycle(),this.errors=r,this.retries=n,this.retriesSubscription=o,r.next(e)}},e.prototype._unsubscribe=function(){var t=this.errors,e=this.retriesSubscription;t&&(t.unsubscribe(),this.errors=void 0),e&&(e.unsubscribe(),this.retriesSubscription=void 0),this.retries=void 0},e.prototype.notifyNext=function(){var t=this._unsubscribe;this._unsubscribe=null,this._unsubscribeAndRecycle(),this._unsubscribe=t,this.source.subscribe(this)},e}(i.b),xr=r(65);function Tr(t){return function(e){return e.lift(new Pr(t))}}var Pr=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var r=new Rr(t),n=e.subscribe(r);return n.add(Object(i.c)(this.notifier,new i.a(r))),n},t}(),Rr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hasValue=!1,e}return n.a(e,t),e.prototype._next=function(t){this.value=t,this.hasValue=!0},e.prototype.notifyNext=function(){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},e}(i.b);function Ir(t,e){return void 0===e&&(e=c.a),function(r){return r.lift(new Mr(t,e))}}var Mr=function(){function t(t,e){this.period=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new Nr(t,this.period,this.scheduler))},t}(),Nr=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.period=r,i.scheduler=n,i.hasValue=!1,i.add(n.schedule(kr,r,{subscriber:i,period:r})),i}return n.a(e,t),e.prototype._next=function(t){this.lastValue=t,this.hasValue=!0},e.prototype.notifyNext=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.lastValue))},e}(p.a);function kr(t){var e=t.subscriber,r=t.period;e.notifyNext(),this.schedule(t,r)}function Cr(t,e){return function(r){return r.lift(new Lr(t,e))}}var Lr=function(){function t(t,e){this.compareTo=t,this.comparator=e}return t.prototype.call=function(t,e){return e.subscribe(new jr(t,this.compareTo,this.comparator))},t}(),jr=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.compareTo=r,i.comparator=n,i._a=[],i._b=[],i._oneComplete=!1,i.destination.add(r.subscribe(new Dr(e,i))),i}return n.a(e,t),e.prototype._next=function(t){this._oneComplete&&0===this._b.length?this.emit(!1):(this._a.push(t),this.checkValues())},e.prototype._complete=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0,this.unsubscribe()},e.prototype.checkValues=function(){for(var t=this,e=t._a,r=t._b,n=t.comparator;e.length>0&&r.length>0;){var i=e.shift(),o=r.shift(),s=!1;try{s=n?n(i,o):i===o}catch(t){this.destination.error(t)}s||this.emit(!1)}},e.prototype.emit=function(t){var e=this.destination;e.next(t),e.complete()},e.prototype.nextB=function(t){this._oneComplete&&0===this._a.length?this.emit(!1):(this._b.push(t),this.checkValues())},e.prototype.completeB=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0},e}(p.a),Dr=function(t){function e(e,r){var n=t.call(this,e)||this;return n.parent=r,n}return n.a(e,t),e.prototype._next=function(t){this.parent.nextB(t)},e.prototype._error=function(t){this.parent.error(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.completeB(),this.unsubscribe()},e}(p.a);function Ur(){return new ir.a}function Br(){return function(t){return Object(xr.a)()(Ge(Ur)(t))}}function Fr(t,e,r){var n;return n=t&&"object"==typeof t?t:{bufferSize:t,windowTime:e,refCount:!1,scheduler:r},function(t){return t.lift(function(t){var e,r,n=t.bufferSize,i=void 0===n?Number.POSITIVE_INFINITY:n,o=t.windowTime,s=void 0===o?Number.POSITIVE_INFINITY:o,a=t.refCount,c=t.scheduler,u=0,f=!1,h=!1;return function(t){var n;u++,!e||f?(f=!1,e=new fr.a(i,s,c),n=e.subscribe(this),r=t.subscribe({next:function(t){e.next(t)},error:function(t){f=!0,e.error(t)},complete:function(){h=!0,r=void 0,e.complete()}}),h&&(r=void 0)):n=e.subscribe(this),this.add((function(){u--,n.unsubscribe(),n=void 0,r&&!h&&a&&0===u&&(r.unsubscribe(),r=void 0,e=void 0)}))}}(n))}}function Vr(t){return function(e){return e.lift(new Kr(t,e))}}var Kr=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Hr(t,this.predicate,this.source))},t}(),Hr=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.predicate=r,i.source=n,i.seenValue=!1,i.index=0,i}return n.a(e,t),e.prototype.applySingleValue=function(t){this.seenValue?this.destination.error("Sequence contains more than one element"):(this.seenValue=!0,this.singleValue=t)},e.prototype._next=function(t){var e=this.index++;this.predicate?this.tryNext(t,e):this.applySingleValue(t)},e.prototype.tryNext=function(t,e){try{this.predicate(t,e,this.source)&&this.applySingleValue(t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){var t=this.destination;this.index>0?(t.next(this.seenValue?this.singleValue:void 0),t.complete()):t.error(new kt.a)},e}(p.a);function $r(t){return function(e){return e.lift(new Gr(t))}}var Gr=function(){function t(t){this.total=t}return t.prototype.call=function(t,e){return e.subscribe(new zr(t,this.total))},t}(),zr=function(t){function e(e,r){var n=t.call(this,e)||this;return n.total=r,n.count=0,n}return n.a(e,t),e.prototype._next=function(t){++this.count>this.total&&this.destination.next(t)},e}(p.a);function qr(t){return function(e){return e.lift(new Wr(t))}}var Wr=function(){function t(t){if(this._skipCount=t,this._skipCount<0)throw new Mt.a}return t.prototype.call=function(t,e){return 0===this._skipCount?e.subscribe(new p.a(t)):e.subscribe(new Yr(t,this._skipCount))},t}(),Yr=function(t){function e(e,r){var n=t.call(this,e)||this;return n._skipCount=r,n._count=0,n._ring=new Array(r),n}return n.a(e,t),e.prototype._next=function(t){var e=this._skipCount,r=this._count++;if(r<e)this._ring[r]=t;else{var n=r%e,i=this._ring,o=i[n];i[n]=t,this.destination.next(o)}},e}(p.a);function Jr(t){return function(e){return e.lift(new Zr(t))}}var Zr=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new Xr(t,this.notifier))},t}(),Xr=function(t){function e(e,r){var n=t.call(this,e)||this;n.hasValue=!1;var o=new i.a(n);n.add(o),n.innerSubscription=o;var s=Object(i.c)(r,o);return s!==o&&(n.add(s),n.innerSubscription=s),n}return n.a(e,t),e.prototype._next=function(e){this.hasValue&&t.prototype._next.call(this,e)},e.prototype.notifyNext=function(){this.hasValue=!0,this.innerSubscription&&this.innerSubscription.unsubscribe()},e.prototype.notifyComplete=function(){},e}(i.b);function Qr(t){return function(e){return e.lift(new tn(t))}}var tn=function(){function t(t){this.predicate=t}return t.prototype.call=function(t,e){return e.subscribe(new en(t,this.predicate))},t}(),en=function(t){function e(e,r){var n=t.call(this,e)||this;return n.predicate=r,n.skipping=!0,n.index=0,n}return n.a(e,t),e.prototype._next=function(t){var e=this.destination;this.skipping&&this.tryCallPredicate(t),this.skipping||e.next(t)},e.prototype.tryCallPredicate=function(t){try{var e=this.predicate(t,this.index++);this.skipping=Boolean(e)}catch(t){this.destination.error(t)}},e}(p.a);function rn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t[t.length-1];return Object(y.a)(r)?(t.pop(),function(e){return Object($.a)(t,e,r)}):function(e){return Object($.a)(t,e)}}var nn=r(55),on=r(41),sn=function(t){function e(e,r,n){void 0===r&&(r=0),void 0===n&&(n=nn.a);var i=t.call(this)||this;return i.source=e,i.delayTime=r,i.scheduler=n,(!Object(on.a)(r)||r<0)&&(i.delayTime=0),n&&"function"==typeof n.schedule||(i.scheduler=nn.a),i}return n.a(e,t),e.create=function(t,r,n){return void 0===r&&(r=0),void 0===n&&(n=nn.a),new e(t,r,n)},e.dispatch=function(t){var e=t.source,r=t.subscriber;return this.add(e.subscribe(r))},e.prototype._subscribe=function(t){var r=this.delayTime,n=this.source;return this.scheduler.schedule(e.dispatch,r,{source:n,subscriber:t})},e}(bt.a);function an(t,e){return void 0===e&&(e=0),function(r){return r.lift(new cn(t,e))}}var cn=function(){function t(t,e){this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return new sn(e,this.delay,this.scheduler).subscribe(t)},t}();function un(t,e){return"function"==typeof e?function(r){return r.pipe(un((function(r,n){return Object(K.a)(t(r,n)).pipe(Object(Zt.a)((function(t,i){return e(r,t,n,i)})))})))}:function(e){return e.lift(new fn(t))}}var fn=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new hn(t,this.project))},t}(),hn=function(t){function e(e,r){var n=t.call(this,e)||this;return n.project=r,n.index=0,n}return n.a(e,t),e.prototype._next=function(t){var e,r=this.index++;try{e=this.project(t,r)}catch(t){return void this.destination.error(t)}this._innerSub(e)},e.prototype._innerSub=function(t){var e=this.innerSubscription;e&&e.unsubscribe();var r=new i.a(this),n=this.destination;n.add(r),this.innerSubscription=Object(i.c)(t,r),this.innerSubscription!==r&&n.add(this.innerSubscription)},e.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||t.prototype._complete.call(this),this.unsubscribe()},e.prototype._unsubscribe=function(){this.innerSubscription=void 0},e.prototype.notifyComplete=function(){this.innerSubscription=void 0,this.isStopped&&t.prototype._complete.call(this)},e.prototype.notifyNext=function(t){this.destination.next(t)},e}(i.b);function ln(){return un(he.a)}function dn(t,e){return e?un((function(){return t}),e):un((function(){return t}))}function pn(t){return function(e){return e.lift(new bn(t))}}var bn=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var r=new gn(t),n=Object(i.c)(this.notifier,new i.a(r));return n&&!r.seenValue?(r.add(n),e.subscribe(r)):r},t}(),gn=function(t){function e(e){var r=t.call(this,e)||this;return r.seenValue=!1,r}return n.a(e,t),e.prototype.notifyNext=function(){this.seenValue=!0,this.complete()},e.prototype.notifyComplete=function(){},e}(i.b);function mn(t,e){return void 0===e&&(e=!1),function(r){return r.lift(new vn(t,e))}}var vn=function(){function t(t,e){this.predicate=t,this.inclusive=e}return t.prototype.call=function(t,e){return e.subscribe(new yn(t,this.predicate,this.inclusive))},t}(),yn=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.predicate=r,i.inclusive=n,i.index=0,i}return n.a(e,t),e.prototype._next=function(t){var e,r=this.destination;try{e=this.predicate(t,this.index++)}catch(t){return void r.error(t)}this.nextOrComplete(t,e)},e.prototype.nextOrComplete=function(t,e){var r=this.destination;Boolean(e)?r.next(t):(this.inclusive&&r.next(t),r.complete())},e}(p.a),wn=r(25),_n=r(32);function En(t,e,r){return function(n){return n.lift(new Sn(t,e,r))}}var Sn=function(){function t(t,e,r){this.nextOrObserver=t,this.error=e,this.complete=r}return t.prototype.call=function(t,e){return e.subscribe(new An(t,this.nextOrObserver,this.error,this.complete))},t}(),An=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o._tapNext=wn.a,o._tapError=wn.a,o._tapComplete=wn.a,o._tapError=n||wn.a,o._tapComplete=i||wn.a,Object(_n.a)(r)?(o._context=o,o._tapNext=r):r&&(o._context=r,o._tapNext=r.next||wn.a,o._tapError=r.error||wn.a,o._tapComplete=r.complete||wn.a),o}return n.a(e,t),e.prototype._next=function(t){try{this._tapNext.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.next(t)},e.prototype._error=function(t){try{this._tapError.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.error(t)},e.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(t){return void this.destination.error(t)}return this.destination.complete()},e}(p.a),On={leading:!0,trailing:!1};function xn(t,e){return void 0===e&&(e=On),function(r){return r.lift(new Tn(t,!!e.leading,!!e.trailing))}}var Tn=function(){function t(t,e,r){this.durationSelector=t,this.leading=e,this.trailing=r}return t.prototype.call=function(t,e){return e.subscribe(new Pn(t,this.durationSelector,this.leading,this.trailing))},t}(),Pn=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.destination=e,o.durationSelector=r,o._leading=n,o._trailing=i,o._hasValue=!1,o}return n.a(e,t),e.prototype._next=function(t){this._hasValue=!0,this._sendValue=t,this._throttled||(this._leading?this.send():this.throttle(t))},e.prototype.send=function(){var t=this._hasValue,e=this._sendValue;t&&(this.destination.next(e),this.throttle(e)),this._hasValue=!1,this._sendValue=void 0},e.prototype.throttle=function(t){var e=this.tryDurationSelector(t);e&&this.add(this._throttled=Object(i.c)(e,new i.a(this)))},e.prototype.tryDurationSelector=function(t){try{return this.durationSelector(t)}catch(t){return this.destination.error(t),null}},e.prototype.throttlingDone=function(){var t=this._throttled,e=this._trailing;t&&t.unsubscribe(),this._throttled=void 0,e&&this.send()},e.prototype.notifyNext=function(){this.throttlingDone()},e.prototype.notifyComplete=function(){this.throttlingDone()},e}(i.b);function Rn(t,e,r){return void 0===e&&(e=c.a),void 0===r&&(r=On),function(n){return n.lift(new In(t,e,r.leading,r.trailing))}}var In=function(){function t(t,e,r,n){this.duration=t,this.scheduler=e,this.leading=r,this.trailing=n}return t.prototype.call=function(t,e){return e.subscribe(new Mn(t,this.duration,this.scheduler,this.leading,this.trailing))},t}(),Mn=function(t){function e(e,r,n,i,o){var s=t.call(this,e)||this;return s.duration=r,s.scheduler=n,s.leading=i,s.trailing=o,s._hasTrailingValue=!1,s._trailingValue=null,s}return n.a(e,t),e.prototype._next=function(t){this.throttled?this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(Nn,this.duration,{subscriber:this})),this.leading?this.destination.next(t):this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0))},e.prototype._complete=function(){this._hasTrailingValue?(this.destination.next(this._trailingValue),this.destination.complete()):this.destination.complete()},e.prototype.clearThrottle=function(){var t=this.throttled;t&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),t.unsubscribe(),this.remove(t),this.throttled=null)},e}(p.a);function Nn(t){t.subscriber.clearThrottle()}var kn=r(70);function Cn(t){return void 0===t&&(t=c.a),function(e){return Object(kn.a)((function(){return e.pipe(Ie((function(e,r){var n=e.current;return{value:r,current:t.now(),last:n}}),{current:t.now(),value:void 0,last:void 0}),Object(Zt.a)((function(t){var e=t.current,r=t.last,n=t.value;return new Ln(n,e-r)})))}))}}var Ln=function(){return function(t,e){this.value=t,this.interval=e}}(),jn=r(102);function Dn(t,e,r){return void 0===r&&(r=c.a),function(n){var i=ut(t),o=i?+t-r.now():Math.abs(t);return n.lift(new Un(o,i,e,r))}}var Un=function(){function t(t,e,r,n){this.waitFor=t,this.absoluteTimeout=e,this.withObservable=r,this.scheduler=n}return t.prototype.call=function(t,e){return e.subscribe(new Bn(t,this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))},t}(),Bn=function(t){function e(e,r,n,i,o){var s=t.call(this,e)||this;return s.absoluteTimeout=r,s.waitFor=n,s.withObservable=i,s.scheduler=o,s.scheduleTimeout(),s}return n.a(e,t),e.dispatchTimeout=function(t){var e=t.withObservable;t._unsubscribeAndRecycle(),t.add(Object(i.c)(e,new i.a(t)))},e.prototype.scheduleTimeout=function(){var t=this.action;t?this.action=t.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(e.dispatchTimeout,this.waitFor,this))},e.prototype._next=function(e){this.absoluteTimeout||this.scheduleTimeout(),t.prototype._next.call(this,e)},e.prototype._unsubscribe=function(){this.action=void 0,this.scheduler=null,this.withObservable=null},e}(i.b),Fn=r(67);function Vn(t,e){return void 0===e&&(e=c.a),Dn(t,Object(Fn.a)(new jn.a),e)}function Kn(t){return void 0===t&&(t=c.a),Object(Zt.a)((function(e){return new Hn(e,t.now())}))}var Hn=function(){return function(t,e){this.value=t,this.timestamp=e}}();function $n(t,e,r){return 0===r?[e]:(t.push(e),t)}function Gn(){return Ce($n,[])}function zn(t){return function(e){return e.lift(new qn(t))}}var qn=function(){function t(t){this.windowBoundaries=t}return t.prototype.call=function(t,e){var r=new Wn(t),n=e.subscribe(r);return n.closed||r.add(Object(i.c)(this.windowBoundaries,new i.a(r))),n},t}(),Wn=function(t){function e(e){var r=t.call(this,e)||this;return r.window=new ir.a,e.next(r.window),r}return n.a(e,t),e.prototype.notifyNext=function(){this.openWindow()},e.prototype.notifyError=function(t){this._error(t)},e.prototype.notifyComplete=function(){this._complete()},e.prototype._next=function(t){this.window.next(t)},e.prototype._error=function(t){this.window.error(t),this.destination.error(t)},e.prototype._complete=function(){this.window.complete(),this.destination.complete()},e.prototype._unsubscribe=function(){this.window=null},e.prototype.openWindow=function(){var t=this.window;t&&t.complete();var e=this.destination,r=this.window=new ir.a;e.next(r)},e}(i.b);function Yn(t,e){return void 0===e&&(e=0),function(r){return r.lift(new Jn(t,e))}}var Jn=function(){function t(t,e){this.windowSize=t,this.startWindowEvery=e}return t.prototype.call=function(t,e){return e.subscribe(new Zn(t,this.windowSize,this.startWindowEvery))},t}(),Zn=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.destination=e,i.windowSize=r,i.startWindowEvery=n,i.windows=[new ir.a],i.count=0,e.next(i.windows[0]),i}return n.a(e,t),e.prototype._next=function(t){for(var e=this.startWindowEvery>0?this.startWindowEvery:this.windowSize,r=this.destination,n=this.windowSize,i=this.windows,o=i.length,s=0;s<o&&!this.closed;s++)i[s].next(t);var a=this.count-n+1;if(a>=0&&a%e==0&&!this.closed&&i.shift().complete(),++this.count%e==0&&!this.closed){var c=new ir.a;i.push(c),r.next(c)}},e.prototype._error=function(t){var e=this.windows;if(e)for(;e.length>0&&!this.closed;)e.shift().error(t);this.destination.error(t)},e.prototype._complete=function(){var t=this.windows;if(t)for(;t.length>0&&!this.closed;)t.shift().complete();this.destination.complete()},e.prototype._unsubscribe=function(){this.count=0,this.windows=null},e}(p.a);function Xn(t){var e=c.a,r=null,n=Number.POSITIVE_INFINITY;return Object(y.a)(arguments[3])&&(e=arguments[3]),Object(y.a)(arguments[2])?e=arguments[2]:Object(on.a)(arguments[2])&&(n=Number(arguments[2])),Object(y.a)(arguments[1])?e=arguments[1]:Object(on.a)(arguments[1])&&(r=Number(arguments[1])),function(i){return i.lift(new Qn(t,r,n,e))}}var Qn=function(){function t(t,e,r,n){this.windowTimeSpan=t,this.windowCreationInterval=e,this.maxWindowSize=r,this.scheduler=n}return t.prototype.call=function(t,e){return e.subscribe(new ei(t,this.windowTimeSpan,this.windowCreationInterval,this.maxWindowSize,this.scheduler))},t}(),ti=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._numberOfNextedValues=0,e}return n.a(e,t),e.prototype.next=function(e){this._numberOfNextedValues++,t.prototype.next.call(this,e)},Object.defineProperty(e.prototype,"numberOfNextedValues",{get:function(){return this._numberOfNextedValues},enumerable:!0,configurable:!0}),e}(ir.a),ei=function(t){function e(e,r,n,i,o){var s=t.call(this,e)||this;s.destination=e,s.windowTimeSpan=r,s.windowCreationInterval=n,s.maxWindowSize=i,s.scheduler=o,s.windows=[];var a=s.openWindow();if(null!==n&&n>=0){var c={subscriber:s,window:a,context:null},u={windowTimeSpan:r,windowCreationInterval:n,subscriber:s,scheduler:o};s.add(o.schedule(ii,r,c)),s.add(o.schedule(ni,n,u))}else{var f={subscriber:s,window:a,windowTimeSpan:r};s.add(o.schedule(ri,r,f))}return s}return n.a(e,t),e.prototype._next=function(t){for(var e=this.windows,r=e.length,n=0;n<r;n++){var i=e[n];i.closed||(i.next(t),i.numberOfNextedValues>=this.maxWindowSize&&this.closeWindow(i))}},e.prototype._error=function(t){for(var e=this.windows;e.length>0;)e.shift().error(t);this.destination.error(t)},e.prototype._complete=function(){for(var t=this.windows;t.length>0;){var e=t.shift();e.closed||e.complete()}this.destination.complete()},e.prototype.openWindow=function(){var t=new ti;return this.windows.push(t),this.destination.next(t),t},e.prototype.closeWindow=function(t){t.complete();var e=this.windows;e.splice(e.indexOf(t),1)},e}(p.a);function ri(t){var e=t.subscriber,r=t.windowTimeSpan,n=t.window;n&&e.closeWindow(n),t.window=e.openWindow(),this.schedule(t,r)}function ni(t){var e=t.windowTimeSpan,r=t.subscriber,n=t.scheduler,i=t.windowCreationInterval,o=r.openWindow(),s=this,a={action:s,subscription:null},c={subscriber:r,window:o,context:a};a.subscription=n.schedule(ii,e,c),s.add(a.subscription),s.schedule(t,i)}function ii(t){var e=t.subscriber,r=t.window,n=t.context;n&&n.action&&n.subscription&&n.action.remove(n.subscription),e.closeWindow(r)}function oi(t,e){return function(r){return r.lift(new si(t,e))}}var si=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new ai(t,this.openings,this.closingSelector))},t}(),ai=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.openings=r,i.closingSelector=n,i.contexts=[],i.add(i.openSubscription=Object(P.a)(i,r,r)),i}return n.a(e,t),e.prototype._next=function(t){var e=this.contexts;if(e)for(var r=e.length,n=0;n<r;n++)e[n].window.next(t)},e.prototype._error=function(e){var r=this.contexts;if(this.contexts=null,r)for(var n=r.length,i=-1;++i<n;){var o=r[i];o.window.error(e),o.subscription.unsubscribe()}t.prototype._error.call(this,e)},e.prototype._complete=function(){var e=this.contexts;if(this.contexts=null,e)for(var r=e.length,n=-1;++n<r;){var i=e[n];i.window.complete(),i.subscription.unsubscribe()}t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.contexts;if(this.contexts=null,t)for(var e=t.length,r=-1;++r<e;){var n=t[r];n.window.unsubscribe(),n.subscription.unsubscribe()}},e.prototype.notifyNext=function(t,e,r,n,i){if(t===this.openings){var o=void 0;try{o=(0,this.closingSelector)(e)}catch(t){return this.error(t)}var s=new ir.a,a=new T.a,c={window:s,subscription:a};this.contexts.push(c);var u=Object(P.a)(this,o,c);u.closed?this.closeWindow(this.contexts.length-1):(u.context=c,a.add(u)),this.destination.next(s)}else this.closeWindow(this.contexts.indexOf(t))},e.prototype.notifyError=function(t){this.error(t)},e.prototype.notifyComplete=function(t){t!==this.openSubscription&&this.closeWindow(this.contexts.indexOf(t.context))},e.prototype.closeWindow=function(t){if(-1!==t){var e=this.contexts,r=e[t],n=r.window,i=r.subscription;e.splice(t,1),n.complete(),i.unsubscribe()}},e}(R.a);function ci(t){return function(e){return e.lift(new ui(t))}}var ui=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new fi(t,this.closingSelector))},t}(),fi=function(t){function e(e,r){var n=t.call(this,e)||this;return n.destination=e,n.closingSelector=r,n.openWindow(),n}return n.a(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.openWindow(i)},e.prototype.notifyError=function(t){this._error(t)},e.prototype.notifyComplete=function(t){this.openWindow(t)},e.prototype._next=function(t){this.window.next(t)},e.prototype._error=function(t){this.window.error(t),this.destination.error(t),this.unsubscribeClosingNotification()},e.prototype._complete=function(){this.window.complete(),this.destination.complete(),this.unsubscribeClosingNotification()},e.prototype.unsubscribeClosingNotification=function(){this.closingNotification&&this.closingNotification.unsubscribe()},e.prototype.openWindow=function(t){void 0===t&&(t=null),t&&(this.remove(t),t.unsubscribe());var e=this.window;e&&e.complete();var r,n=this.window=new ir.a;this.destination.next(n);try{r=(0,this.closingSelector)()}catch(t){return this.destination.error(t),void this.window.error(t)}this.add(this.closingNotification=Object(P.a)(this,r))},e}(R.a);function hi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){var r;"function"==typeof t[t.length-1]&&(r=t.pop());var n=t;return e.lift(new li(n,r))}}var li=function(){function t(t,e){this.observables=t,this.project=e}return t.prototype.call=function(t,e){return e.subscribe(new di(t,this.observables,this.project))},t}(),di=function(t){function e(e,r,n){var i=t.call(this,e)||this;i.observables=r,i.project=n,i.toRespond=[];var o=r.length;i.values=new Array(o);for(var s=0;s<o;s++)i.toRespond.push(s);for(s=0;s<o;s++){var a=r[s];i.add(Object(P.a)(i,a,void 0,s))}return i}return n.a(e,t),e.prototype.notifyNext=function(t,e,r){this.values[r]=e;var n=this.toRespond;if(n.length>0){var i=n.indexOf(r);-1!==i&&n.splice(i,1)}},e.prototype.notifyComplete=function(){},e.prototype._next=function(t){if(0===this.toRespond.length){var e=[t].concat(this.values);this.project?this._tryProject(e):this.destination.next(e)}},e.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(R.a),pi=r(71);function bi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(pi.b.apply(void 0,[e].concat(t)))}}function gi(t){return function(e){return e.lift(new pi.a(t))}}},function(t,e,r){"use strict";r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return a}));var n=r(0),i=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return n.a(e,t),e.prototype.schedule=function(e,r){return void 0===r&&(r=0),r>0?t.prototype.schedule.call(this,e,r):(this.delay=r,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,r){return r>0||this.closed?t.prototype.execute.call(this,e,r):this._execute(e,r)},e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0?t.prototype.requestAsyncId.call(this,e,r,n):e.flush(this)},e}(r(40).a),o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n.a(e,t),e}(r(38).a),s=new o(i),a=s},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));var n=function(){function t(e,r){void 0===r&&(r=t.now),this.SchedulerAction=e,this.now=r}return t.prototype.schedule=function(t,e,r){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(r,e)},t.now=function(){return Date.now()},t}()},function(t,e,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",f=u+"Number primitive has more than 15 significant digits: ",h=1e14,l=14,d=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],b=1e7,g=1e9;function m(t){var e=0|t;return t>0||t===e?e:e-1}function v(t){for(var e,r,n=1,i=t.length,o=t[0]+"";n<i;){for(e=t[n++]+"",r=l-e.length;r--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function y(t,e){var r,n,i=t.c,o=e.c,s=t.s,a=e.s,c=t.e,u=e.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=c==u,!i||!o)return n?0:!i^r?1:-1;if(!n)return c>u^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function w(t,e,r,n){if(t<e||t>r||t!==c(t))throw Error(u+(n||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function _(t){var e=t.c.length-1;return m(t.e/l)==e&&t.c[e]%2!=0}function E(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function S(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(++e>(n=t.length)){for(i=r,e-=n;--e;i+=r);t+=i}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}o=function t(e){var r,n,i,o,A,O,x,T,P,R,I=$.prototype={constructor:$,toString:null,valueOf:null},M=new $(1),N=20,k=4,C=-7,L=21,j=-1e7,D=1e7,U=!1,B=1,F=0,V={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",H=!0;function $(t,e){var r,o,a,u,h,p,b,g,m=this;if(!(m instanceof $))return new $(t,e);if(null==e){if(t&&!0===t._isBigNumber)return m.s=t.s,void(!t.c||t.e>D?m.c=m.e=null:t.e<j?m.c=[m.e=0]:(m.e=t.e,m.c=t.c.slice()));if((p="number"==typeof t)&&0*t==0){if(m.s=1/t<0?(t=-t,-1):1,t===~~t){for(u=0,h=t;h>=10;h/=10,u++);return void(u>D?m.c=m.e=null:(m.e=u,m.c=[t]))}g=String(t)}else{if(!s.test(g=String(t)))return i(m,g,p);m.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(h=g.search(/e/i))>0?(u<0&&(u=h),u+=+g.slice(h+1),g=g.substring(0,h)):u<0&&(u=g.length)}else{if(w(e,2,K.length,"Base"),10==e&&H)return W(m=new $(t),N+m.e+1,k);if(g=String(t),p="number"==typeof t){if(0*t!=0)return i(m,g,p,e);if(m.s=1/t<0?(g=g.slice(1),-1):1,$.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(f+t)}else m.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(r=K.slice(0,e),u=h=0,b=g.length;h<b;h++)if(r.indexOf(o=g.charAt(h))<0){if("."==o){if(h>u){u=b;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,h=-1,u=0;continue}return i(m,String(t),p,e)}p=!1,(u=(g=n(g,e,10,m.s)).indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(h=0;48===g.charCodeAt(h);h++);for(b=g.length;48===g.charCodeAt(--b););if(g=g.slice(h,++b)){if(b-=h,p&&$.DEBUG&&b>15&&(t>d||t!==c(t)))throw Error(f+m.s*t);if((u=u-h-1)>D)m.c=m.e=null;else if(u<j)m.c=[m.e=0];else{if(m.e=u,m.c=[],h=(u+1)%l,u<0&&(h+=l),h<b){for(h&&m.c.push(+g.slice(0,h)),b-=l;h<b;)m.c.push(+g.slice(h,h+=l));h=l-(g=g.slice(h)).length}else h-=b;for(;h--;g+="0");m.c.push(+g)}}else m.c=[m.e=0]}function G(t,e,r,n){var i,o,s,a,c;if(null==r?r=k:w(r,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==e)c=v(t.c),c=1==n||2==n&&(s<=C||s>=L)?E(c,s):S(c,s,"0");else if(o=(t=W(new $(t),e,r)).e,a=(c=v(t.c)).length,1==n||2==n&&(e<=o||o<=C)){for(;a<e;c+="0",a++);c=E(c,o)}else if(e-=s,c=S(c,o,"0"),o+1>a){if(--e>0)for(c+=".";e--;c+="0");}else if((e+=o-a)>0)for(o+1==a&&(c+=".");e--;c+="0");return t.s<0&&i?"-"+c:c}function z(t,e){for(var r,n=1,i=new $(t[0]);n<t.length;n++){if(!(r=new $(t[n])).s){i=r;break}e.call(i,r)&&(i=r)}return i}function q(t,e,r){for(var n=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,n++);return(r=n+r*l-1)>D?t.c=t.e=null:r<j?t.c=[t.e=0]:(t.e=r,t.c=e),t}function W(t,e,r,n){var i,o,s,u,f,d,b,g=t.c,m=p;if(g){t:{for(i=1,u=g[0];u>=10;u/=10,i++);if((o=e-i)<0)o+=l,s=e,b=(f=g[d=0])/m[i-s-1]%10|0;else if((d=a((o+1)/l))>=g.length){if(!n)break t;for(;g.length<=d;g.push(0));f=b=0,i=1,s=(o%=l)-l+1}else{for(f=u=g[d],i=1;u>=10;u/=10,i++);b=(s=(o%=l)-l+i)<0?0:f/m[i-s-1]%10|0}if(n=n||e<0||null!=g[d+1]||(s<0?f:f%m[i-s-1]),n=r<4?(b||n)&&(0==r||r==(t.s<0?3:2)):b>5||5==b&&(4==r||n||6==r&&(o>0?s>0?f/m[i-s]:0:g[d-1])%10&1||r==(t.s<0?8:7)),e<1||!g[0])return g.length=0,n?(e-=t.e+1,g[0]=m[(l-e%l)%l],t.e=-e||0):g[0]=t.e=0,t;if(0==o?(g.length=d,u=1,d--):(g.length=d+1,u=m[l-o],g[d]=s>0?c(f/m[i-s]%m[s])*u:0),n)for(;;){if(0==d){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(t.e++,g[0]==h&&(g[0]=1));break}if(g[d]+=u,g[d]!=h)break;g[d--]=0,u=1}for(o=g.length;0===g[--o];g.pop());}t.e>D?t.c=t.e=null:t.e<j&&(t.c=[t.e=0])}return t}function Y(t){var e,r=t.e;return null===r?t.toString():(e=v(t.c),e=r<=C||r>=L?E(e,r):S(e,r,"0"),t.s<0?"-"+e:e)}return $.clone=t,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(u+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(w(r=t[e],0,g,e),N=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(w(r=t[e],0,8,e),k=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(w(r[0],-g,0,e),w(r[1],0,g,e),C=r[0],L=r[1]):(w(r,-g,g,e),C=-(L=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)w(r[0],-g,-1,e),w(r[1],1,g,e),j=r[0],D=r[1];else{if(w(r,-g,g,e),!r)throw Error(u+e+" cannot be zero: "+r);j=-(D=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(u+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw U=!r,Error(u+"crypto unavailable");U=r}else U=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(w(r=t[e],0,9,e),B=r),t.hasOwnProperty(e="POW_PRECISION")&&(w(r=t[e],0,g,e),F=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(u+e+" not an object: "+r);V=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+e+" invalid: "+r);H="0123456789"==r.slice(0,10),K=r}}return{DECIMAL_PLACES:N,ROUNDING_MODE:k,EXPONENTIAL_AT:[C,L],RANGE:[j,D],CRYPTO:U,MODULO_MODE:B,POW_PRECISION:F,FORMAT:V,ALPHABET:K}},$.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!$.DEBUG)return!0;var e,r,n=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===c(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((e=(i+1)%l)<1&&(e+=l),String(n[0]).length==e){for(e=0;e<n.length;e++)if((r=n[e])<0||r>=h||r!==c(r))break t;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(u+"Invalid BigNumber: "+t)},$.maximum=$.max=function(){return z(arguments,I.lt)},$.minimum=$.min=function(){return z(arguments,I.gt)},$.random=(o=9007199254740992,A=Math.random()*o&2097151?function(){return c(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,n,i,o,s=0,f=[],h=new $(M);if(null==t?t=N:w(t,0,g),i=a(t/l),U)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)(o=131072*e[s]+(e[s+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[s]=r[0],e[s+1]=r[1]):(f.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw U=!1,Error(u+"crypto unavailable");for(e=crypto.randomBytes(i*=7);s<i;)(o=281474976710656*(31&e[s])+1099511627776*e[s+1]+4294967296*e[s+2]+16777216*e[s+3]+(e[s+4]<<16)+(e[s+5]<<8)+e[s+6])>=9e15?crypto.randomBytes(7).copy(e,s):(f.push(o%1e14),s+=7);s=i/7}if(!U)for(;s<i;)(o=A())<9e15&&(f[s++]=o%1e14);for(i=f[--s],t%=l,i&&t&&(o=p[l-t],f[s]=c(i/o)*o);0===f[s];f.pop(),s--);if(s<0)f=[n=0];else{for(n=-1;0===f[0];f.splice(0,1),n-=l);for(s=1,o=f[0];o>=10;o/=10,s++);s<l&&(n-=l-s)}return h.e=n,h.c=f,h}),$.sum=function(){for(var t=1,e=arguments,r=new $(e[0]);t<e.length;)r=r.plus(e[t++]);return r},n=function(){var t="0123456789";function e(t,e,r,n){for(var i,o,s=[0],a=0,c=t.length;a<c;){for(o=s.length;o--;s[o]*=e);for(s[0]+=n.indexOf(t.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 c,u,f,h,l,d,p,b,g=n.indexOf("."),m=N,y=k;for(g>=0&&(h=F,F=0,n=n.replace(".",""),d=(b=new $(i)).pow(n.length-g),F=h,b.c=e(S(v(d.c),d.e,"0"),10,o,t),b.e=b.c.length),f=h=(p=e(n,i,o,a?(c=K,t):(c=t,K))).length;0==p[--h];p.pop());if(!p[0])return c.charAt(0);if(g<0?--f:(d.c=p,d.e=f,d.s=s,p=(d=r(d,b,m,y,o)).c,l=d.r,f=d.e),g=p[u=f+m+1],h=o/2,l=l||u<0||null!=p[u+1],l=y<4?(null!=g||l)&&(0==y||y==(d.s<0?3:2)):g>h||g==h&&(4==y||l||6==y&&1&p[u-1]||y==(d.s<0?8:7)),u<1||!p[0])n=l?S(c.charAt(1),-m,c.charAt(0)):c.charAt(0);else{if(p.length=u,l)for(--o;++p[--u]>o;)p[u]=0,u||(++f,p=[1].concat(p));for(h=p.length;!p[--h];);for(g=0,n="";g<=h;n+=c.charAt(p[g++]));n=S(n,f,c.charAt(0))}return n}}(),r=function(){function t(t,e,r){var n,i,o,s,a=0,c=t.length,u=e%b,f=e/b|0;for(t=t.slice();c--;)a=((i=u*(o=t[c]%b)+(n=f*o+(s=t[c]/b|0)*u)%b*b+a)/r|0)+(n/b|0)+f*s,t[c]=i%r;return a&&(t=[a].concat(t)),t}function e(t,e,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,i,o,s,a){var u,f,d,p,b,g,v,y,w,_,E,S,A,O,x,T,P,R=n.s==i.s?1:-1,I=n.c,M=i.c;if(!(I&&I[0]&&M&&M[0]))return new $(n.s&&i.s&&(I?!M||I[0]!=M[0]:M)?I&&0==I[0]||!M?0*R:R/0:NaN);for(w=(y=new $(R)).c=[],R=o+(f=n.e-i.e)+1,a||(a=h,f=m(n.e/l)-m(i.e/l),R=R/l|0),d=0;M[d]==(I[d]||0);d++);if(M[d]>(I[d]||0)&&f--,R<0)w.push(1),p=!0;else{for(O=I.length,T=M.length,d=0,R+=2,(b=c(a/(M[0]+1)))>1&&(M=t(M,b,a),I=t(I,b,a),T=M.length,O=I.length),A=T,E=(_=I.slice(0,T)).length;E<T;_[E++]=0);P=M.slice(),P=[0].concat(P),x=M[0],M[1]>=a/2&&x++;do{if(b=0,(u=e(M,_,T,E))<0){if(S=_[0],T!=E&&(S=S*a+(_[1]||0)),(b=c(S/x))>1)for(b>=a&&(b=a-1),v=(g=t(M,b,a)).length,E=_.length;1==e(g,_,v,E);)b--,r(g,T<v?P:M,v,a),v=g.length,u=1;else 0==b&&(u=b=1),v=(g=M.slice()).length;if(v<E&&(g=[0].concat(g)),r(_,g,E,a),E=_.length,-1==u)for(;e(M,_,T,E)<1;)b++,r(_,T<E?P:M,E,a),E=_.length}else 0===u&&(b++,_=[0]);w[d++]=b,_[0]?_[E++]=I[A]||0:(_=[I[A]],E=1)}while((A++<O||null!=_[0])&&R--);p=null!=_[0],w[0]||w.splice(0,1)}if(a==h){for(d=1,R=w[0];R>=10;R/=10,d++);W(y,o+(y.e=d+f*l-1)+1,s,p)}else y.e=f,y.r=+p;return y}}(),O=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,T=/^\.([^.]+)$/,P=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,r,n){var i,o=r?e:e.replace(R,"");if(P.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(O,(function(t,e,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?t:e})),n&&(i=n,o=o.replace(x,"$1").replace(T,"0.$1")),e!=o))return new $(o,i);if($.DEBUG)throw Error(u+"Not a"+(n?" base "+n:"")+" number: "+e);t.s=null}t.c=t.e=null},I.absoluteValue=I.abs=function(){var t=new $(this);return t.s<0&&(t.s=1),t},I.comparedTo=function(t,e){return y(this,new $(t,e))},I.decimalPlaces=I.dp=function(t,e){var r,n,i,o=this;if(null!=t)return w(t,0,g),null==e?e=k:w(e,0,8),W(new $(o),t+o.e+1,e);if(!(r=o.c))return null;if(n=((i=r.length-1)-m(this.e/l))*l,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},I.dividedBy=I.div=function(t,e){return r(this,new $(t,e),N,k)},I.dividedToIntegerBy=I.idiv=function(t,e){return r(this,new $(t,e),0,1)},I.exponentiatedBy=I.pow=function(t,e){var r,n,i,o,s,f,h,d,p=this;if((t=new $(t)).c&&!t.isInteger())throw Error(u+"Exponent not an integer: "+Y(t));if(null!=e&&(e=new $(e)),s=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return d=new $(Math.pow(+Y(p),s?2-_(t):+Y(t))),e?d.mod(e):d;if(f=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new $(NaN);(n=!f&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&_(t)?-0:0,p.e>-1&&(o=1/o),new $(f?1/o:o);F&&(o=a(F/l+2))}for(s?(r=new $(.5),f&&(t.s=1),h=_(t)):h=(i=Math.abs(+Y(t)))%2,d=new $(M);;){if(h){if(!(d=d.times(p)).c)break;o?d.c.length>o&&(d.c.length=o):n&&(d=d.mod(e))}if(i){if(0===(i=c(i/2)))break;h=i%2}else if(W(t=t.times(r),t.e+1,1),t.e>14)h=_(t);else{if(0===(i=+Y(t)))break;h=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(e))}return n?d:(f&&(d=M.div(d)),e?d.mod(e):o?W(d,F,k,undefined):d)},I.integerValue=function(t){var e=new $(this);return null==t?t=k:w(t,0,8),W(e,e.e+1,t)},I.isEqualTo=I.eq=function(t,e){return 0===y(this,new $(t,e))},I.isFinite=function(){return!!this.c},I.isGreaterThan=I.gt=function(t,e){return y(this,new $(t,e))>0},I.isGreaterThanOrEqualTo=I.gte=function(t,e){return 1===(e=y(this,new $(t,e)))||0===e},I.isInteger=function(){return!!this.c&&m(this.e/l)>this.c.length-2},I.isLessThan=I.lt=function(t,e){return y(this,new $(t,e))<0},I.isLessThanOrEqualTo=I.lte=function(t,e){return-1===(e=y(this,new $(t,e)))||0===e},I.isNaN=function(){return!this.s},I.isNegative=function(){return this.s<0},I.isPositive=function(){return this.s>0},I.isZero=function(){return!!this.c&&0==this.c[0]},I.minus=function(t,e){var r,n,i,o,s=this,a=s.s;if(e=(t=new $(t,e)).s,!a||!e)return new $(NaN);if(a!=e)return t.s=-e,s.plus(t);var c=s.e/l,u=t.e/l,f=s.c,d=t.c;if(!c||!u){if(!f||!d)return f?(t.s=-e,t):new $(d?s:NaN);if(!f[0]||!d[0])return d[0]?(t.s=-e,t):new $(f[0]?s:3==k?-0:0)}if(c=m(c),u=m(u),f=f.slice(),a=c-u){for((o=a<0)?(a=-a,i=f):(u=c,i=d),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(n=(o=(a=f.length)<(e=d.length))?a:e,a=e=0;e<n;e++)if(f[e]!=d[e]){o=f[e]<d[e];break}if(o&&(i=f,f=d,d=i,t.s=-t.s),(e=(n=d.length)-(r=f.length))>0)for(;e--;f[r++]=0);for(e=h-1;n>a;){if(f[--n]<d[n]){for(r=n;r&&!f[--r];f[r]=e);--f[r],f[n]+=h}f[n]-=d[n]}for(;0==f[0];f.splice(0,1),--u);return f[0]?q(t,f,u):(t.s=3==k?-1:1,t.c=[t.e=0],t)},I.modulo=I.mod=function(t,e){var n,i,o=this;return t=new $(t,e),!o.c||!t.s||t.c&&!t.c[0]?new $(NaN):!t.c||o.c&&!o.c[0]?new $(o):(9==B?(i=t.s,t.s=1,n=r(o,t,0,3),t.s=i,n.s*=i):n=r(o,t,0,B),(t=o.minus(n.times(t))).c[0]||1!=B||(t.s=o.s),t)},I.multipliedBy=I.times=function(t,e){var r,n,i,o,s,a,c,u,f,d,p,g,v,y,w,_=this,E=_.c,S=(t=new $(t,e)).c;if(!(E&&S&&E[0]&&S[0]))return!_.s||!t.s||E&&!E[0]&&!S||S&&!S[0]&&!E?t.c=t.e=t.s=null:(t.s*=_.s,E&&S?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=m(_.e/l)+m(t.e/l),t.s*=_.s,(c=E.length)<(d=S.length)&&(v=E,E=S,S=v,i=c,c=d,d=i),i=c+d,v=[];i--;v.push(0));for(y=h,w=b,i=d;--i>=0;){for(r=0,p=S[i]%w,g=S[i]/w|0,o=i+(s=c);o>i;)r=((u=p*(u=E[--s]%w)+(a=g*u+(f=E[s]/w|0)*p)%w*w+v[o]+r)/y|0)+(a/w|0)+g*f,v[o--]=u%y;v[o]=r}return r?++n:v.splice(0,1),q(t,v,n)},I.negated=function(){var t=new $(this);return t.s=-t.s||null,t},I.plus=function(t,e){var r,n=this,i=n.s;if(e=(t=new $(t,e)).s,!i||!e)return new $(NaN);if(i!=e)return t.s=-e,n.minus(t);var o=n.e/l,s=t.e/l,a=n.c,c=t.c;if(!o||!s){if(!a||!c)return new $(i/0);if(!a[0]||!c[0])return c[0]?t:new $(a[0]?n:0*i)}if(o=m(o),s=m(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(e=c.length)<0&&(r=c,c=a,a=r,e=i),i=0;e;)i=(a[--e]=a[e]+c[e]+i)/h|0,a[e]=h===a[e]?0:a[e]%h;return i&&(a=[i].concat(a),++s),q(t,a,s)},I.precision=I.sd=function(t,e){var r,n,i,o=this;if(null!=t&&t!==!!t)return w(t,1,g),null==e?e=k:w(e,0,8),W(new $(o),t,e);if(!(r=o.c))return null;if(n=(i=r.length-1)*l+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return t&&o.e+1>n&&(n=o.e+1),n},I.shiftedBy=function(t){return w(t,-9007199254740991,d),this.times("1e"+t)},I.squareRoot=I.sqrt=function(){var t,e,n,i,o,s=this,a=s.c,c=s.s,u=s.e,f=N+4,h=new $("0.5");if(1!==c||!a||!a[0])return new $(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Y(s)))||c==1/0?(((e=v(a)).length+u)%2==0&&(e+="0"),c=Math.sqrt(+e),u=m((u+1)/2)-(u<0||u%2),n=new $(e=c==1/0?"5e"+u:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+u)):n=new $(c+""),n.c[0])for((c=(u=n.e)+f)<3&&(c=0);;)if(o=n,n=h.times(o.plus(r(s,o,f,1))),v(o.c).slice(0,c)===(e=v(n.c)).slice(0,c)){if(n.e<u&&--c,"9999"!=(e=e.slice(c-3,c+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(W(n,n.e+N+2,1),t=!n.times(n).eq(s));break}if(!i&&(W(o,o.e+N+2,0),o.times(o).eq(s))){n=o;break}f+=4,c+=4,i=1}return W(n,n.e+N+1,k,t)},I.toExponential=function(t,e){return null!=t&&(w(t,0,g),t++),G(this,t,e,1)},I.toFixed=function(t,e){return null!=t&&(w(t,0,g),t=t+this.e+1),G(this,t,e)},I.toFormat=function(t,e,r){var n,i=this;if(null==r)null!=t&&e&&"object"==typeof e?(r=e,e=null):t&&"object"==typeof t?(r=t,t=e=null):r=V;else if("object"!=typeof r)throw Error(u+"Argument not an object: "+r);if(n=i.toFixed(t,e),i.c){var o,s=n.split("."),a=+r.groupSize,c=+r.secondaryGroupSize,f=r.groupSeparator||"",h=s[0],l=s[1],d=i.s<0,p=d?h.slice(1):h,b=p.length;if(c&&(o=a,a=c,c=o,b-=o),a>0&&b>0){for(o=b%a||a,h=p.substr(0,o);o<b;o+=a)h+=f+p.substr(o,a);c>0&&(h+=f+p.slice(o)),d&&(h="-"+h)}n=l?h+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?l.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):l):h}return(r.prefix||"")+n+(r.suffix||"")},I.toFraction=function(t){var e,n,i,o,s,a,c,f,h,d,b,g,m=this,y=m.c;if(null!=t&&(!(c=new $(t)).isInteger()&&(c.c||1!==c.s)||c.lt(M)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Y(c));if(!y)return new $(m);for(e=new $(M),h=n=new $(M),i=f=new $(M),g=v(y),s=e.e=g.length-m.e-1,e.c[0]=p[(a=s%l)<0?l+a:a],t=!t||c.comparedTo(e)>0?s>0?e:h:c,a=D,D=1/0,c=new $(g),f.c[0]=0;d=r(c,e,0,1),1!=(o=n.plus(d.times(i))).comparedTo(t);)n=i,i=o,h=f.plus(d.times(o=h)),f=o,e=c.minus(d.times(o=e)),c=o;return o=r(t.minus(n),i,0,1),f=f.plus(o.times(h)),n=n.plus(o.times(i)),f.s=h.s=m.s,b=r(h,i,s*=2,k).minus(m).abs().comparedTo(r(f,n,s,k).minus(m).abs())<1?[h,i]:[f,n],D=a,b},I.toNumber=function(){return+Y(this)},I.toPrecision=function(t,e){return null!=t&&w(t,1,g),G(this,t,e,2)},I.toString=function(t){var e,r=this,i=r.s,o=r.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=C||o>=L?E(v(r.c),o):S(v(r.c),o,"0"):10===t&&H?e=S(v((r=W(new $(r),N+o+1,k)).c),r.e,"0"):(w(t,2,K.length,"Base"),e=n(S(v(r.c),o,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},I.valueOf=I.toJSON=function(){return Y(this)},I._isBigNumber=!0,null!=e&&$.set(e),$}(),o.default=o.BigNumber=o,void 0===(n=function(){return o}.call(e,r,e,t))||(t.exports=n)}()},function(t,e,r){"use strict";var n=r(212),i=r(243);t.exports=i((function(t){var e=n("sha256").update(t).digest();return n("sha256").update(e).digest()}))},function(t,e,r){"use strict";(function(e){var n=r(18),i=r(189),o=r(130),s={"Content-Type":"application/x-www-form-urlencoded"};function a(t,e){!n.isUndefined(t)&&n.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var c,u={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==e&&"[object process]"===Object.prototype.toString.call(e))&&(c=r(131)),c),transformRequest:[function(t,e){return i(e,"Accept"),i(e,"Content-Type"),n.isFormData(t)||n.isArrayBuffer(t)||n.isBuffer(t)||n.isStream(t)||n.isFile(t)||n.isBlob(t)?t:n.isArrayBufferView(t)?t.buffer:n.isURLSearchParams(t)?(a(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):n.isObject(t)||e&&"application/json"===e["Content-Type"]?(a(e,"application/json"),function(t,e,r){if(n.isString(t))try{return(e||JSON.parse)(t),n.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||u.transitional,r=e&&e.silentJSONParsing,i=e&&e.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||i&&n.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw o(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(t){u.headers[t]={}})),n.forEach(["post","put","patch"],(function(t){u.headers[t]=n.merge(s)})),t.exports=u}).call(this,r(33))},function(t,e,r){"use strict";function n(t){this.message=t}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,t.exports=n},function(t,e,r){"use strict";(function(e){void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,r,n,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,r)}));case 3:return e.nextTick((function(){t.call(null,r,n)}));case 4:return e.nextTick((function(){t.call(null,r,n,i)}));default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return e.nextTick((function(){t.apply(null,o)}))}}}:t.exports=e}).call(this,r(33))},function(t,e,r){"use strict";var n=r(43),i=r(27),o=i.getNAF,s=i.getJSF,a=i.assert;function c(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var s,c,u=[];for(s=0;s<n.length;s+=r.step){c=0;for(var f=s+r.step-1;f>=s;f--)c=(c<<1)+n[f];u.push(c)}for(var h=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s<u.length;s++)(c=u[s])===d?l=l.mixedAdd(r.points[s]):c===-d&&(l=l.mixedAdd(r.points[s].neg()));h=h.add(l)}return h.toP()},c.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,s=o(e,r,this._bitLength),c=this.jpoint(null,null,null),u=s.length-1;u>=0;u--){for(var f=0;u>=0&&0===s[u];u--)f++;if(u>=0&&f++,c=c.dblp(f),u<0)break;var h=s[u];a(0!==h),c="affine"===t.type?h>0?c.mixedAdd(i[h-1>>1]):c.mixedAdd(i[-h-1>>1].neg()):h>0?c.add(i[h-1>>1]):c.add(i[-h-1>>1].neg())}return"affine"===t.type?c.toP():c},c.prototype._wnafMulAdd=function(t,e,r,n,i){var a,c,u,f=this._wnafT1,h=this._wnafT2,l=this._wnafT3,d=0;for(a=0;a<n;a++){var p=(u=e[a])._getNAFPoints(t);f[a]=p.wnd,h[a]=p.points}for(a=n-1;a>=1;a-=2){var b=a-1,g=a;if(1===f[b]&&1===f[g]){var m=[e[b],null,null,e[g]];0===e[b].y.cmp(e[g].y)?(m[1]=e[b].add(e[g]),m[2]=e[b].toJ().mixedAdd(e[g].neg())):0===e[b].y.cmp(e[g].y.redNeg())?(m[1]=e[b].toJ().mixedAdd(e[g]),m[2]=e[b].add(e[g].neg())):(m[1]=e[b].toJ().mixedAdd(e[g]),m[2]=e[b].toJ().mixedAdd(e[g].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],y=s(r[b],r[g]);for(d=Math.max(y[0].length,d),l[b]=new Array(d),l[g]=new Array(d),c=0;c<d;c++){var w=0|y[0][c],_=0|y[1][c];l[b][c]=v[3*(w+1)+(_+1)],l[g][c]=0,h[b]=m}}else l[b]=o(r[b],f[b],this._bitLength),l[g]=o(r[g],f[g],this._bitLength),d=Math.max(l[b].length,d),d=Math.max(l[g].length,d)}var E=this.jpoint(null,null,null),S=this._wnafT4;for(a=d;a>=0;a--){for(var A=0;a>=0;){var O=!0;for(c=0;c<n;c++)S[c]=0|l[c][a],0!==S[c]&&(O=!1);if(!O)break;A++,a--}if(a>=0&&A++,E=E.dblp(A),a<0)break;for(c=0;c<n;c++){var x=S[c];0!==x&&(x>0?u=h[c][x-1>>1]:x<0&&(u=h[c][-x-1>>1].neg()),E="affine"===u.type?E.mixedAdd(u):E.add(u))}}for(a=0;a<n;a++)h[a]=null;return i?E:E.toP()},c.BasePoint=u,u.prototype.eq=function(){throw new Error("Not implemented")},u.prototype.validate=function(){return this.curve.validate(this)},c.prototype.decodePoint=function(t,e){t=i.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?a(t[t.length-1]%2==0):7===t[0]&&a(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},u.prototype.encodeCompressed=function(t){return this.encode(t,!0)},u.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},u.prototype.encode=function(t,e){return i.encode(this._encode(e),t)},u.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},u.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},u.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},u.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},u.prototype._getBeta=function(){return null},u.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}},function(t,e,r){"use strict";r.d(e,"b",(function(){return c})),r.d(e,"a",(function(){return l}));var n=r(0),i=r(1),o=r(5),s=r(4),a=r(6);function c(t,e,r,n){return function(i){return i.lift(new u(t,e,r,n))}}var u=function(){function t(t,e,r,n){this.keySelector=t,this.elementSelector=e,this.durationSelector=r,this.subjectSelector=n}return t.prototype.call=function(t,e){return e.subscribe(new f(t,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))},t}(),f=function(t){function e(e,r,n,i,o){var s=t.call(this,e)||this;return s.keySelector=r,s.elementSelector=n,s.durationSelector=i,s.subjectSelector=o,s.groups=null,s.attemptedToUnsubscribe=!1,s.count=0,s}return n.a(e,t),e.prototype._next=function(t){var e;try{e=this.keySelector(t)}catch(t){return void this.error(t)}this._group(t,e)},e.prototype._group=function(t,e){var r=this.groups;r||(r=this.groups=new Map);var n,i=r.get(e);if(this.elementSelector)try{n=this.elementSelector(t)}catch(t){this.error(t)}else n=t;if(!i){i=this.subjectSelector?this.subjectSelector():new a.a,r.set(e,i);var o=new l(e,i,this);if(this.destination.next(o),this.durationSelector){var s=void 0;try{s=this.durationSelector(new l(e,i))}catch(t){return void this.error(t)}this.add(s.subscribe(new h(e,i,this)))}}i.closed||i.next(n)},e.prototype._error=function(t){var e=this.groups;e&&(e.forEach((function(e,r){e.error(t)})),e.clear()),this.destination.error(t)},e.prototype._complete=function(){var t=this.groups;t&&(t.forEach((function(t,e){t.complete()})),t.clear()),this.destination.complete()},e.prototype.removeGroup=function(t){this.groups.delete(t)},e.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&t.prototype.unsubscribe.call(this))},e}(i.a),h=function(t){function e(e,r,n){var i=t.call(this,r)||this;return i.key=e,i.group=r,i.parent=n,i}return n.a(e,t),e.prototype._next=function(t){this.complete()},e.prototype._unsubscribe=function(){var t=this.parent,e=this.key;this.key=this.parent=null,t&&t.removeGroup(e)},e}(i.a),l=function(t){function e(e,r,n){var i=t.call(this)||this;return i.key=e,i.groupSubject=r,i.refCountSubscription=n,i}return n.a(e,t),e.prototype._subscribe=function(t){var e=new o.a,r=this.refCountSubscription,n=this.groupSubject;return r&&!r.closed&&e.add(new d(r)),e.add(n.subscribe(t)),e},e}(s.a),d=function(t){function e(e){var r=t.call(this)||this;return r.parent=e,e.count++,r}return n.a(e,t),e.prototype.unsubscribe=function(){var e=this.parent;e.closed||this.closed||(t.prototype.unsubscribe.call(this),e.count-=1,0===e.count&&e.attemptedToUnsubscribe&&e.unsubscribe())},e}(o.a)},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.createRegisterGlobalConstantOperation=e.createRevealOperation=e.createRegisterDelegateOperation=e.createSetDelegateOperation=e.createTransferOperation=e.createOriginationOperation=void 0;const i=r(62),o=r(22),s=r(84),a=r(160),c=r(51);e.createOriginationOperation=({code:t,init:e,balance:r="0",delegate:u,storage:f,fee:h=s.DEFAULT_FEE.ORIGINATION,gasLimit:l=s.DEFAULT_GAS_LIMIT.ORIGINATION,storageLimit:d=s.DEFAULT_STORAGE_LIMIT.ORIGINATION,mutez:p=!1})=>n(void 0,void 0,void 0,(function*(){if(void 0!==f&&void 0!==e)throw new Error("Storage and Init cannot be set a the same time. Please either use storage or init but not both.");if(!Array.isArray(t))throw new c.InvalidCodeParameter("Wrong code parameter type, expected an array",t);let n;if(void 0!==f){const e=t.find((t=>"prim"in t&&"storage"===t.prim));if(void 0===(null==e?void 0:e.args))throw new c.InvalidCodeParameter("The storage section is missing from the script",t);n=new i.Schema(e.args[0]).Encode(f)}else{if(void 0===e||"object"!=typeof e)throw new c.InvalidInitParameter("Wrong init parameter type, expected JSON Michelson",e);n=e}const s={code:t,storage:n},b={kind:o.OpKind.ORIGINATION,fee:h,gas_limit:l,storage_limit:d,balance:p?r.toString():a.format("tz","mutez",r).toString(),script:s};return u&&(b.delegate=u),b}));e.createTransferOperation=({to:t,amount:e,parameter:r,fee:i=s.DEFAULT_FEE.TRANSFER,gasLimit:c=s.DEFAULT_GAS_LIMIT.TRANSFER,storageLimit:u=s.DEFAULT_STORAGE_LIMIT.TRANSFER,mutez:f=!1})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.TRANSACTION,fee:i,gas_limit:c,storage_limit:u,amount:f?e.toString():a.format("tz","mutez",e).toString(),destination:t,parameters:r}}));e.createSetDelegateOperation=({delegate:t,source:e,fee:r=s.DEFAULT_FEE.DELEGATION,gasLimit:i=s.DEFAULT_GAS_LIMIT.DELEGATION,storageLimit:a=s.DEFAULT_STORAGE_LIMIT.DELEGATION})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.DELEGATION,source:e,fee:r,gas_limit:i,storage_limit:a,delegate:t}}));e.createRegisterDelegateOperation=({fee:t=s.DEFAULT_FEE.DELEGATION,gasLimit:e=s.DEFAULT_GAS_LIMIT.DELEGATION,storageLimit:r=s.DEFAULT_STORAGE_LIMIT.DELEGATION},i)=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.DELEGATION,fee:t,gas_limit:e,storage_limit:r,delegate:i}}));e.createRevealOperation=({fee:t=s.DEFAULT_FEE.REVEAL,gasLimit:e=s.DEFAULT_GAS_LIMIT.REVEAL,storageLimit:r=s.DEFAULT_STORAGE_LIMIT.REVEAL},i,a)=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.REVEAL,fee:t,public_key:a,source:i,gas_limit:e,storage_limit:r}}));e.createRegisterGlobalConstantOperation=({value:t,source:e,fee:r,gasLimit:i,storageLimit:s})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.REGISTER_GLOBAL_CONSTANT,value:t,fee:r,gas_limit:i,storage_limit:s,source:e}}))},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))},i=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r};Object.defineProperty(e,"__esModule",{value:!0}),e.OperationEmitter=void 0;const o=r(22),s=r(84),a=r(52),c=r(23);e.OperationEmitter=class{constructor(t){this.context=t}get rpc(){return this.context.rpc}get signer(){return this.context.signer}isRevealOpNeeded(t,e){return n(this,void 0,void 0,(function*(){return!(!(yield this.isAccountRevealRequired(e))||!this.isRevealRequiredForOpType(t))}))}isAccountRevealRequired(t){return n(this,void 0,void 0,(function*(){return!(yield this.context.readProvider.isAccountRevealed(t,"head"))}))}isRevealRequiredForOpType(t){let e=!1;for(const r of t)c.isOpRequireReveal(r)&&(e=!0);return e}prepareOperation({operation:t,source:e},r){return n(this,void 0,void 0,(function*(){const n={};let i=[];const a=this.context.readProvider.getBlockHash("head~2"),u=this.context.readProvider.getNextProtocol("head");i=Array.isArray(t)?[...t]:[t];const f=r||(yield this.signer.publicKeyHash());let h=Promise.resolve(void 0);for(let t=0;t<i.length;t++)if(c.isOpRequireReveal(i[t])||"reveal"===i[t].kind){h=this.context.readProvider.getCounter(f,"head");break}const[l,d,p]=yield Promise.all([a,u,h]),b=parseInt(p||"0",10);(!n[f]||n[f]<b)&&(n[f]=b);const g=t=>({counter:`${++n[f]}`,fee:void 0===t.fee?"0":`${t.fee}`,gas_limit:void 0===t.gas_limit?"0":`${t.gas_limit}`,storage_limit:void 0===t.storage_limit?"0":`${t.storage_limit}`}),m=t=>({source:void 0===t.source?e||f:t.source});return{opOb:{branch:l,contents:i.map((t=>{switch(t.kind){case o.OpKind.ACTIVATION:return Object.assign({},t);case o.OpKind.REVEAL:return Object.assign(Object.assign(Object.assign({},t),m(t)),g(t));case o.OpKind.ORIGINATION:return Object.assign(Object.assign(Object.assign(Object.assign({},t),{balance:void 0!==t.balance?`${t.balance}`:"0"}),m(t)),g(t));case o.OpKind.TRANSACTION:{const e=Object.assign(Object.assign(Object.assign(Object.assign({},t),{amount:void 0!==t.amount?`${t.amount}`:"0"}),m(t)),g(t));if(e.source.toLowerCase().startsWith("kt1"))throw new Error(`KT1 addresses are not supported as source since ${s.Protocols.PsBabyM1}`);return e}case o.OpKind.DELEGATION:case o.OpKind.REGISTER_GLOBAL_CONSTANT:return Object.assign(Object.assign(Object.assign({},t),m(t)),g(t));default:throw new Error("Unsupported operation")}})),protocol:d},counter:b}}))}forge({opOb:{branch:t,contents:e,protocol:r},counter:i}){return n(this,void 0,void 0,(function*(){return{opbytes:yield this.context.forger.forge({branch:t,contents:e}),opOb:{branch:t,contents:e,protocol:r},counter:i}}))}simulate(t){return n(this,void 0,void 0,(function*(){return{opResponse:yield this.rpc.runOperation(t),op:t,context:this.context.clone()}}))}estimate(t,e){var{fee:r,gasLimit:o,storageLimit:s}=t,a=i(t,["fee","gasLimit","storageLimit"]);return n(this,void 0,void 0,(function*(){let t=r,n=o,i=s;if(void 0===r||void 0===o||void 0===s){const c=yield e(Object.assign({fee:r,gasLimit:o,storageLimit:s},a));void 0===t&&(t=c.suggestedFeeMutez),void 0===n&&(n=c.gasLimit),void 0===i&&(i=c.storageLimit)}return{fee:t,gasLimit:n,storageLimit:i}}))}signAndInject(t){return n(this,void 0,void 0,(function*(){const e=yield this.signer.sign(t.opbytes,new Uint8Array([3]));t.opbytes=e.sbytes,t.opOb.signature=e.prefixSig;const r=[],n=yield this.rpc.preapplyOperations([t.opOb]);if(!Array.isArray(n))throw new a.TezosPreapplyFailureError(n);for(let t=0;t<n.length;t++)for(let e=0;e<n[t].contents.length;e++)r.push(n[t].contents[e]);const i=a.flattenErrors(n);if(i.length)throw new a.TezosOperationError(i);return{hash:yield this.context.injector.inject(t.opbytes),forgedBytes:t,opResponse:r,context:this.context.clone()}}))}}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.ContractAbstraction=e.ContractView=e.DEFAULT_SMART_CONTRACT_METHOD_NAME=void 0;const i=r(62),o=r(2),s=r(275),a=r(51);e.DEFAULT_SMART_CONTRACT_METHOD_NAME="default";class c{constructor(t,e,r,n,i,o,s){this.currentContract=t,this.name=e,this.callbackParametersSchema=r,this.parameterSchema=n,this.args=i,this.rpc=o,this.readProvider=s}read(t){return n(this,void 0,void 0,(function*(){if(o.validateContractAddress(t)==o.ValidationResult.VALID)throw new Error("Since version 12, the lambda view no longer depends on a lambda contract. The read method no longer accepts a contract address as a parameter.");if(t&&o.validateChain(t)!==o.ValidationResult.VALID)throw new Error("ChainId is invalid");const e=this.parameterSchema.Encode(...this.args),r=yield this.rpc.runView({contract:this.currentContract.address,entrypoint:this.name,input:e,chain_id:t||(yield this.readProvider.getChainId())});return this.callbackParametersSchema.Execute(r.data)}))}}e.ContractView=c;e.ContractAbstraction=class{constructor(t,e,r,n,o,a,c){this.address=t,this.script=e,this.storageProvider=n,this.entrypoints=o,this.rpc=a,this.readProvider=c,this.methods={},this.methodsObject={},this.views={},this.contractViews={},this.contractMethodFactory=new s.ContractMethodFactory(r,t),this.schema=i.Schema.fromRPCResponse({script:this.script}),this.parameterSchema=i.ParameterSchema.fromRPCResponse({script:this.script}),this.viewSchema=i.ViewSchema.fromRPCResponse({script:this.script}),0!==this.viewSchema.length&&this._initializeOnChainViews(this,a,this.readProvider,this.viewSchema),this._initializeMethods(this,this.entrypoints.entrypoints,this.rpc,this.readProvider)}_initializeMethods(t,r,n,o){const s=this.parameterSchema,u=Object.keys(r);if(s.isMultipleEntryPoint){u.forEach((e=>{const s=new i.ParameterSchema(r[e]);if(this.methods[e]=function(...r){return t.contractMethodFactory.createContractMethodFlatParams(s,e,r)},this.methodsObject[e]=function(r){return t.contractMethodFactory.createContractMethodObjectParam(s,e,r)},(t=>{let e=!1;if("prim"in t&&"pair"===t.prim&&t.args){const r=t.args[t.args.length-1];"prim"in r&&"contract"===r.prim&&(e=!0)}return e})(r[e])){const s=function(...s){const u=r[e].args[0],f=new i.ParameterSchema(u),h=r[e].args[1].args[0],l=new i.ParameterSchema(h);return((t,e,r)=>{const n=e.ExtractSignatures();if(!n.find((e=>e.length===t.length)))throw new a.InvalidParameterError(r,n,t)})(s,f,e),new c(t,e,l,f,s,n,o)};this.views[e]=s}}));Object.keys(s.ExtractSchema()).filter((t=>-1===Object.keys(r).indexOf(t))).forEach((e=>{this.methods[e]=function(...r){return t.contractMethodFactory.createContractMethodFlatParams(s,e,r,!1,!0)},this.methodsObject[e]=function(r){return t.contractMethodFactory.createContractMethodObjectParam(s,e,r,!1,!0)}}))}else{const r=this.parameterSchema;this.methods[e.DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(...n){return t.contractMethodFactory.createContractMethodFlatParams(r,e.DEFAULT_SMART_CONTRACT_METHOD_NAME,n,!1)},this.methodsObject[e.DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(n){return t.contractMethodFactory.createContractMethodObjectParam(r,e.DEFAULT_SMART_CONTRACT_METHOD_NAME,n,!1)}}}_initializeOnChainViews(t,e,r,n){const i=this.schema.val;n.forEach((n=>{this.contractViews[n.viewName]=function(o){return t.contractMethodFactory.createContractViewObjectParam(e,r,n,i,o)}}))}storage(){return this.storageProvider.getStorage(this.address,this.schema)}bigMap(t){return this.storageProvider.getBigMapKey(this.address,t,this.schema)}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return u})),r.d(e,"b",(function(){return f}));var n=r(0),i=r(6),o=r(4),s=r(1),a=r(5),c=r(65),u=function(t){function e(e,r){var n=t.call(this)||this;return n.source=e,n.subjectFactory=r,n._refCount=0,n._isComplete=!1,n}return n.a(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype.connect=function(){var t=this._connection;return t||(this._isComplete=!1,(t=this._connection=new a.a).add(this.source.subscribe(new h(this.getSubject(),this))),t.closed&&(this._connection=null,t=a.a.EMPTY)),t},e.prototype.refCount=function(){return Object(c.a)()(this)},e}(o.a),f=function(){var t=u.prototype;return{operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:t._subscribe},_isComplete:{value:t._isComplete,writable:!0},getSubject:{value:t.getSubject},connect:{value:t.connect},refCount:{value:t.refCount}}}(),h=function(t){function e(e,r){var n=t.call(this,e)||this;return n.connectable=r,n}return n.a(e,t),e.prototype._error=function(e){this._unsubscribe(),t.prototype._error.call(this,e)},e.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._connection;t._refCount=0,t._subject=null,t._connection=null,e&&e.unsubscribe()}},e}(i.b);s.a},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(0),i=r(6),o=r(29),s=function(t){function e(e){var r=t.call(this)||this;return r._value=e,r}return n.a(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return r&&!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new o.a;return this._value},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(i.a)},function(t,e,r){"use strict";r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return c}));var n=r(0),i=r(1),o=r(21);function s(t,e){return void 0===e&&(e=0),function(r){return r.lift(new a(t,e))}}var a=function(){function t(t,e){void 0===e&&(e=0),this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.scheduler,this.delay))},t}(),c=function(t){function e(e,r,n){void 0===n&&(n=0);var i=t.call(this,e)||this;return i.scheduler=r,i.delay=n,i}return n.a(e,t),e.dispatch=function(t){var e=t.notification,r=t.destination;e.observe(r),this.unsubscribe()},e.prototype.scheduleMessage=function(t){this.destination.add(this.scheduler.schedule(e.dispatch,this.delay,new u(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(o.a.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(o.a.createError(t)),this.unsubscribe()},e.prototype._complete=function(){this.scheduleMessage(o.a.createComplete()),this.unsubscribe()},e}(i.a),u=function(){return function(t,e){this.notification=t,this.destination=e}}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));var n=function(){function t(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(69);function i(){return Object(n.a)(1)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(4),i=r(10),o=r(69),s=r(37);function a(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Number.POSITIVE_INFINITY,a=null,c=t[t.length-1];return Object(i.a)(c)?(a=t.pop(),t.length>1&&"number"==typeof t[t.length-1]&&(r=t.pop())):"number"==typeof c&&(r=t.pop()),null===a&&1===t.length&&t[0]instanceof n.a?t[0]:Object(o.a)(r)(Object(s.a)(t,a))}},function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));var n=r(0),i=r(8),o=r(37),s=r(19),a=r(15);function c(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(1===t.length){if(!Object(i.a)(t[0]))return t[0];t=t[0]}return Object(o.a)(t,void 0).lift(new u)}var u=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new f(t))},t}(),f=function(t){function e(e){var r=t.call(this,e)||this;return r.hasFirst=!1,r.observables=[],r.subscriptions=[],r}return n.a(e,t),e.prototype._next=function(t){this.observables.push(t)},e.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{for(var r=0;r<e&&!this.hasFirst;r++){var n=t[r],i=Object(a.a)(this,n,void 0,r);this.subscriptions&&this.subscriptions.push(i),this.add(i)}this.observables=null}},e.prototype.notifyNext=function(t,e,r){if(!this.hasFirst){this.hasFirst=!0;for(var n=0;n<this.subscriptions.length;n++)if(n!==r){var i=this.subscriptions[n];i.unsubscribe(),this.remove(i)}this.subscriptions=null}this.destination.next(e)},e}(s.a)},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(4),i=r(7),o=r(41),s=r(10);function a(t,e,r){void 0===t&&(t=0);var a=-1;return Object(o.a)(e)?a=Number(e)<1?1:Number(e):Object(s.a)(e)&&(r=e),Object(s.a)(r)||(r=i.a),new n.a((function(e){var n=Object(o.a)(t)?t:+t-r.now();return r.schedule(c,n,{index:0,period:a,subscriber:e})}))}function c(t){var e=t.index,r=t.period,n=t.subscriber;if(n.next(e),!n.closed){if(-1===r)return n.complete();t.index=e+1,this.schedule(t,r)}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return f}));var n=r(4),i=r(5),o=r(28);var s=r(75),a=r(24);var c=r(111),u=r(110);function f(t,e){if(null!=t){if(function(t){return t&&"function"==typeof t[o.a]}(t))return function(t,e){return new n.a((function(r){var n=new i.a;return n.add(e.schedule((function(){var i=t[o.a]();n.add(i.subscribe({next:function(t){n.add(e.schedule((function(){return r.next(t)})))},error:function(t){n.add(e.schedule((function(){return r.error(t)})))},complete:function(){n.add(e.schedule((function(){return r.complete()})))}}))}))),n}))}(t,e);if(Object(c.a)(t))return function(t,e){return new n.a((function(r){var n=new i.a;return n.add(e.schedule((function(){return t.then((function(t){n.add(e.schedule((function(){r.next(t),n.add(e.schedule((function(){return r.complete()})))})))}),(function(t){n.add(e.schedule((function(){return r.error(t)})))}))}))),n}))}(t,e);if(Object(u.a)(t))return Object(s.a)(t,e);if(function(t){return t&&"function"==typeof t[a.a]}(t)||"string"==typeof t)return function(t,e){if(!t)throw new Error("Iterable cannot be null");return new n.a((function(r){var n,o=new i.a;return o.add((function(){n&&"function"==typeof n.return&&n.return()})),o.add(e.schedule((function(){n=t[a.a](),o.add(e.schedule((function(){if(!r.closed){var t,e;try{var i=n.next();t=i.value,e=i.done}catch(t){return void r.error(t)}e?r.complete():(r.next(t),this.schedule())}})))}))),o}))}(t,e)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0),i=function(t){function e(e,r){var n=t.call(this)||this;return n.subject=e,n.subscriber=r,n.closed=!1,n}return n.a(e,t),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var r=e.indexOf(this.subscriber);-1!==r&&e.splice(r,1)}}},e}(r(5).a)},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));var n=function(t){return function(e){for(var r=0,n=t.length;r<n&&!e.closed;r++)e.next(t[r]);e.complete()}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));var n=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t}},function(t,e,r){"use strict";function n(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";function n(t,e){function r(){return!r.pred.apply(r.thisArg,arguments)}return r.pred=t,r.thisArg=e,r}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(208);function i(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}function o(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}function s(t,e){return void 0===e&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function a(t,e){return void 0===e&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}function c(t,e){return void 0===e&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}function u(t,e){return void 0===e&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}function f(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}function h(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}function l(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),f(t/4294967296>>>0,e,r),f(t>>>0,e,r+4),e}function d(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),h(t>>>0,e,r),h(t/4294967296>>>0,e,r+4),e}e.readInt16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16},e.readUint16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])>>>0},e.readInt16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])<<16>>16},e.readUint16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])>>>0},e.writeUint16BE=i,e.writeInt16BE=i,e.writeUint16LE=o,e.writeInt16LE=o,e.readInt32BE=s,e.readUint32BE=a,e.readInt32LE=c,e.readUint32LE=u,e.writeUint32BE=f,e.writeInt32BE=f,e.writeUint32LE=h,e.writeInt32LE=h,e.readInt64BE=function(t,e){void 0===e&&(e=0);var r=s(t,e),n=s(t,e+4);return 4294967296*r+n-4294967296*(n>>31)},e.readUint64BE=function(t,e){return void 0===e&&(e=0),4294967296*a(t,e)+a(t,e+4)},e.readInt64LE=function(t,e){void 0===e&&(e=0);var r=c(t,e);return 4294967296*c(t,e+4)+r-4294967296*(r>>31)},e.readUint64LE=function(t,e){void 0===e&&(e=0);var r=u(t,e);return 4294967296*u(t,e+4)+r},e.writeUint64BE=l,e.writeInt64BE=l,e.writeUint64LE=d,e.writeInt64LE=d,e.readUintBE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=t/8+r-1;o>=r;o--)n+=e[o]*i,i*=256;return n},e.readUintLE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o<r+t/8;o++)n+=e[o]*i,i*=256;return n},e.writeUintBE=function(t,e,r,i){if(void 0===r&&(r=new Uint8Array(t/8)),void 0===i&&(i=0),t%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!n.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var o=1,s=t/8+i-1;s>=i;s--)r[s]=e/o&255,o*=256;return r},e.writeUintLE=function(t,e,r,i){if(void 0===r&&(r=new Uint8Array(t/8)),void 0===i&&(i=0),t%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var o=1,s=i;s<i+t/8;s++)r[s]=e/o&255,o*=256;return r},e.readFloat32BE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(e)},e.readFloat32LE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(e,!0)},e.readFloat64BE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(e)},e.readFloat64LE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(e,!0)},e.writeFloat32BE=function(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat32(r,t),e},e.writeFloat32LE=function(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat32(r,t,!0),e},e.writeFloat64BE=function(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat64(r,t),e},e.writeFloat64LE=function(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat64(r,t,!0),e}},function(t,e,r){"use strict";var n=r(58).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var s=r.readable||!1!==r.readable&&e.readable,a=r.writable||!1!==r.writable&&e.writable,c=function(){e.writable||f()},u=e._writableState&&e._writableState.finished,f=function(){a=!1,u=!0,s||o.call(e)},h=e._readableState&&e._readableState.endEmitted,l=function(){s=!1,h=!0,a||o.call(e)},d=function(t){o.call(e,t)},p=function(){var t;return s&&!h?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):a&&!u?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},b=function(){e.req.on("finish",f)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?a&&!e._writableState&&(e.on("end",c),e.on("close",c)):(e.on("complete",f),e.on("abort",p),e.req?b():e.on("request",b)),e.on("end",l),e.on("finish",f),!1!==r.error&&e.on("error",d),e.on("close",p),function(){e.removeListener("complete",f),e.removeListener("abort",p),e.removeListener("request",b),e.req&&e.req.removeListener("finish",f),e.removeListener("end",c),e.removeListener("close",c),e.removeListener("finish",f),e.removeListener("end",l),e.removeListener("error",d),e.removeListener("close",p)}}},function(t,e,r){(e=t.exports=r(147)).Stream=e,e.Readable=e,e.Writable=r(117),e.Duplex=r(49),e.Transform=r(150),e.PassThrough=r(238)},function(t,e,r){var n=r(14),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){"use strict";(function(e,n,i){var o=r(93);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=v;var a,c=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?n:o.nextTick;v.WritableState=m;var u=Object.create(r(81));u.inherits=r(61);var f={deprecate:r(237)},h=r(148),l=r(116).Buffer,d=i.Uint8Array||function(){};var p,b=r(149);function g(){}function m(t,e){a=a||r(49),t=t||{};var n=e instanceof a;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,u=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(u||0===u)?u:f,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===t.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(o.nextTick(i,n),o.nextTick(A,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),A(t,e))}(t,r,n,e,i);else{var s=E(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||_(t,r),n?c(w,t,r,s,i):w(t,r,s,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function v(t){if(a=a||r(49),!(p.call(v,this)||this instanceof a))return new v(t);this._writableState=new m(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),h.call(this)}function y(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function w(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),A(t,e)}function _(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var a=0,c=!0;r;)i[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;i.allBuffers=c,y(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new s(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,f=r.encoding,h=r.callback;if(y(t,e,!1,e.objectMode?1:u.length,u,f,h),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function E(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function S(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),A(t,e)}))}function A(t,e){var r=E(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(S,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}u.inherits(v,h),m.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(m.prototype,"buffer",{get:f.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(v,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===v&&(t&&t._writableState instanceof m)}})):p=function(t){return t instanceof this},v.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},v.prototype.write=function(t,e,r){var n,i=this._writableState,s=!1,a=!i.objectMode&&(n=t,l.isBuffer(n)||n instanceof d);return a&&!l.isBuffer(t)&&(t=function(t){return l.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=g),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),o.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),o.nextTick(n,s),i=!1),i}(this,i,t,r))&&(i.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=l.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var u=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},u?u.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else y(t,e,!1,a,n,i,o);return c}(this,i,a,t,e,r)),s},v.prototype.cork=function(){this._writableState.corked++},v.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||_(this,t))},v.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),v.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},v.prototype._writev=null,v.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,A(t,e),r&&(e.finished?o.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),v.prototype.destroy=b.destroy,v.prototype._undestroy=b.undestroy,v.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(33),r(235).setImmediate,r(42))},function(t,e,r){"use strict";var n,i=e,o=r(119),s=r(153),a=r(27).assert;function c(t){"short"===t.type?this.curve=new s.short(t):"edwards"===t.type?this.curve=new s.edwards(t):this.curve=new s.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new c(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(259)}catch(t){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},function(t,e,r){var n=e;n.utils=r(34),n.common=r(82),n.sha=r(253),n.ripemd=r(257),n.hmac=r(258),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Estimate=void 0;const n=100;class i{constructor(t,e,r,n,i=100){this._milligasLimit=t,this._storageLimit=e,this.opSize=r,this.minimalFeePerStorageByteMutez=n,this.baseFeeMutez=i}get burnFeeMutez(){return this.roundUp(Number(this.storageLimit)*Number(this.minimalFeePerStorageByteMutez))}get storageLimit(){const t=Math.max(Number(this._storageLimit),0);return t>0?t:0}get gasLimit(){return this.roundUp(Number(this._milligasLimit)/1e3+100)}get operationFeeMutez(){return.1*(Number(this._milligasLimit)/1e3+100)+1*Number(this.opSize)}roundUp(t){return Math.ceil(Number(t))}get minimalFeeMutez(){return this.roundUp(n+this.operationFeeMutez)}get suggestedFeeMutez(){return this.roundUp(this.operationFeeMutez+200)}get usingBaseFeeMutez(){return Math.max(Number(this.baseFeeMutez),n)+this.roundUp(this.operationFeeMutez)}get totalCost(){return this.minimalFeeMutez+this.burnFeeMutez}get consumedMilligas(){return Number(this._milligasLimit)}static createEstimateInstanceFromProperties(t){let e,r=0,n=0,o=0,s=0;return t.forEach((t=>{r+=t.milligasLimit,n+=t.storageLimit,o+=t.opSize,s=Math.max(t.minimalFeePerStorageByteMutez,s),t.baseFeeMutez&&(e=e?e+t.baseFeeMutez:t.baseFeeMutez)})),new i(r,n,o,s,e)}static createArrayEstimateInstancesFromProperties(t){return t.map((t=>new i(t.milligasLimit,t.storageLimit,t.opSize,t.minimalFeePerStorageByteMutez,t.baseFeeMutez)))}}e.Estimate=i},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RpcPacker=void 0;e.RpcPacker=class{constructor(t){this.context=t}packData(t){return n(this,void 0,void 0,(function*(){return this.context.rpc.packData(t)}))}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UnconfiguredGlobalConstantsProviderError=e.GlobalConstantNotFound=void 0;class n extends Error{constructor(t){super(`Please load the value associated with the constant ${t} using the loadGlobalConstant method of the DefaultGlobalConstantsProvider.`),this.hash=t,this.name="GlobalConstantNotFound"}}e.GlobalConstantNotFound=n;class i extends Error{constructor(){super("No global constants provider has been configured. Please configure one by calling setGlobalConstantsProvider({globalConstantsProvider}) on your TezosToolkit instance."),this.name="UnconfiguredGlobalConstantsProviderError"}}e.UnconfiguredGlobalConstantsProviderError=i},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RpcReadAdapter=void 0;e.RpcReadAdapter=class{constructor(t){this.context=t}getBalance(t,e){return n(this,void 0,void 0,(function*(){return this.context.rpc.getBalance(t,{block:String(e)})}))}getDelegate(t,e){return n(this,void 0,void 0,(function*(){return this.context.rpc.getDelegate(t,{block:String(e)})}))}getNextProtocol(t){return n(this,void 0,void 0,(function*(){return(yield this.context.rpc.getProtocols({block:String(t)})).next_protocol}))}getProtocolConstants(t){return n(this,void 0,void 0,(function*(){const{time_between_blocks:e,minimal_block_delay:r,hard_gas_limit_per_operation:n,hard_gas_limit_per_block:i,hard_storage_limit_per_operation:o,cost_per_byte:s}=yield this.context.rpc.getConstants({block:String(t)});return{time_between_blocks:e,minimal_block_delay:r,hard_gas_limit_per_operation:n,hard_gas_limit_per_block:i,hard_storage_limit_per_operation:o,cost_per_byte:s}}))}getScript(t,e){return n(this,void 0,void 0,(function*(){return this.context.rpc.getNormalizedScript(t,{unparsing_mode:"Readable"},{block:String(e)})}))}getStorage(t,e){return n(this,void 0,void 0,(function*(){return this.context.rpc.getStorage(t,{block:String(e)})}))}getBlockHash(t){return n(this,void 0,void 0,(function*(){const{hash:e}=yield this.context.rpc.getBlockHeader({block:String(t)});return e}))}getBlockLevel(t){return n(this,void 0,void 0,(function*(){const{level:e}=yield this.context.rpc.getBlockHeader({block:String(t)});return e}))}getCounter(t,e){return n(this,void 0,void 0,(function*(){const{counter:r}=yield this.context.rpc.getContract(t,{block:String(e)});return r||"0"}))}getBlockTimestamp(t){return n(this,void 0,void 0,(function*(){const{timestamp:e}=yield this.context.rpc.getBlockHeader({block:String(t)});return e}))}getBigMapValue(t,e){return n(this,void 0,void 0,(function*(){return this.context.rpc.getBigMapExpr(t.id,t.expr,{block:String(e)})}))}getSaplingDiffById(t,e){return n(this,void 0,void 0,(function*(){return this.context.rpc.getSaplingDiffById(t.id,{block:String(e)})}))}getEntrypoints(t){return n(this,void 0,void 0,(function*(){return this.context.rpc.getEntrypoints(t)}))}getChainId(){return n(this,void 0,void 0,(function*(){return this.context.rpc.getChainId()}))}isAccountRevealed(t,e){return n(this,void 0,void 0,(function*(){const r=yield this.context.rpc.getManagerKey(t,{block:String(e)});return r&&"object"==typeof r?!!r.key:!!r}))}getBlock(t){return n(this,void 0,void 0,(function*(){return this.context.rpc.getBlock({block:String(t)})}))}getLiveBlocks(t){return this.context.rpc.getLiveBlocks({block:String(t)})}}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.PollingSubscribeProvider=e.defaultConfigStreamer=void 0;const i=r(53),o=r(86),s=r(287),a=r(177),c=r(63);e.defaultConfigStreamer={shouldObservableSubscriptionRetry:!1,observableSubscriptionRetryFunction:o.retry()};e.PollingSubscribeProvider=class{constructor(t,r={}){this.context=t,this._config$=new i.BehaviorSubject(Object.assign(Object.assign({},e.defaultConfigStreamer),r)),this.timer$=this._config$.pipe(o.pluck("pollingIntervalMilliseconds"),o.switchMap((t=>t?i.timer(0,t):i.from(this.getConfirmationPollingInterval()).pipe(o.switchMap((t=>i.timer(0,t))))))),this.newBlock$=this.timer$.pipe(o.switchMap((()=>(t=>i.from(t.rpc.getBlock()).pipe(o.first()))(this.context))),o.distinctUntilKeyChanged("hash"),o.publish(),o.refCount())}get config(){return this._config$.getValue()}getConfirmationPollingInterval(){return n(this,void 0,void 0,(function*(){if(!this.config.pollingIntervalMilliseconds){const t=5e3,e=1e3;try{const r=yield this.context.readProvider.getProtocolConstants("head"),n=(r.minimal_block_delay?r.minimal_block_delay.multipliedBy(1e3):r.time_between_blocks?r.time_between_blocks[0].multipliedBy(1e3):new c.default(t)).dividedBy(3);this.config.pollingIntervalMilliseconds=0===n.toNumber()?e:n.toNumber()}catch(e){return t}}return this.config.pollingIntervalMilliseconds}))}subscribeBlock(t){return new a.ObservableSubscription(this.newBlock$,this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribe(t){return new a.ObservableSubscription(this.newBlock$.pipe(o.pluck("hash")),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeOperation(t){return new a.ObservableSubscription(this.newBlock$.pipe((t=>o.concatMap((e=>new i.Observable((r=>{for(const n of e.operations)for(const e of n)for(const n of e.contents)s.evaluateFilter(Object.assign({hash:e.hash},n),t)&&r.next(Object.assign({hash:e.hash},n));r.complete()})))))(t)),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(113),i=r(78);e.BLOCK_SIZE=128,e.DIGEST_LENGTH=64,e.KEY_LENGTH=64,e.PERSONALIZATION_LENGTH=16,e.SALT_LENGTH=16,e.MAX_LEAF_SIZE=Math.pow(2,32)-1,e.MAX_FANOUT=255,e.MAX_MAX_DEPTH=255;var o=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),s=[[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30],[28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6],[22,16,24,0,10,4,30,26,20,28,6,12,14,2,18,8],[14,18,6,2,26,24,22,28,4,12,10,20,8,0,30,16],[18,0,10,14,4,8,20,30,28,2,22,24,12,16,6,26],[4,24,12,20,0,22,16,6,8,26,14,10,30,28,2,18],[24,10,2,30,28,26,8,20,0,14,12,6,18,4,16,22],[26,22,14,28,24,2,6,18,10,0,30,8,16,12,4,20],[12,30,28,18,22,6,0,16,24,4,26,14,2,8,20,10],[20,4,16,8,14,12,2,10,30,22,18,28,6,24,26,0],[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30],[28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6]],a=function(){function t(t,r){if(void 0===t&&(t=64),this.digestLength=t,this.blockSize=e.BLOCK_SIZE,this._state=new Int32Array(o),this._buffer=new Uint8Array(e.BLOCK_SIZE),this._bufferLength=0,this._ctr=new Uint32Array(4),this._flag=new Uint32Array(4),this._lastNode=!1,this._finished=!1,this._vtmp=new Uint32Array(32),this._mtmp=new Uint32Array(32),t<1||t>e.DIGEST_LENGTH)throw new Error("blake2b: wrong digest length");r&&this.validateConfig(r);var i=0;r&&r.key&&(i=r.key.length);var s=1,a=1;r&&r.tree&&(s=r.tree.fanout,a=r.tree.maxDepth),this._state[0]^=t|i<<8|s<<16|a<<24,r&&r.tree&&(this._state[1]^=r.tree.leafSize,this._state[2]^=r.tree.nodeOffsetLowBits,this._state[3]^=r.tree.nodeOffsetHighBits,this._state[4]^=r.tree.nodeDepth|r.tree.innerDigestLength<<8,this._lastNode=r.tree.lastNode),r&&r.salt&&(this._state[8]^=n.readUint32LE(r.salt,0),this._state[9]^=n.readUint32LE(r.salt,4),this._state[10]^=n.readUint32LE(r.salt,8),this._state[11]^=n.readUint32LE(r.salt,12)),r&&r.personalization&&(this._state[12]^=n.readUint32LE(r.personalization,0),this._state[13]^=n.readUint32LE(r.personalization,4),this._state[14]^=n.readUint32LE(r.personalization,8),this._state[15]^=n.readUint32LE(r.personalization,12)),this._initialState=new Uint32Array(this._state),r&&r.key&&i>0&&(this._paddedKey=new Uint8Array(e.BLOCK_SIZE),this._paddedKey.set(r.key),this._buffer.set(this._paddedKey),this._bufferLength=e.BLOCK_SIZE)}return t.prototype.reset=function(){return this._state.set(this._initialState),this._paddedKey?(this._buffer.set(this._paddedKey),this._bufferLength=e.BLOCK_SIZE):this._bufferLength=0,i.wipe(this._ctr),i.wipe(this._flag),this._finished=!1,this},t.prototype.validateConfig=function(t){if(t.key&&t.key.length>e.KEY_LENGTH)throw new Error("blake2b: wrong key length");if(t.salt&&t.salt.length!==e.SALT_LENGTH)throw new Error("blake2b: wrong salt length");if(t.personalization&&t.personalization.length!==e.PERSONALIZATION_LENGTH)throw new Error("blake2b: wrong personalization length");if(t.tree){if(t.tree.fanout<0||t.tree.fanout>e.MAX_FANOUT)throw new Error("blake2b: wrong tree fanout");if(t.tree.maxDepth<0||t.tree.maxDepth>e.MAX_MAX_DEPTH)throw new Error("blake2b: wrong tree depth");if(t.tree.leafSize<0||t.tree.leafSize>e.MAX_LEAF_SIZE)throw new Error("blake2b: wrong leaf size");if(t.tree.innerDigestLength<0||t.tree.innerDigestLength>e.DIGEST_LENGTH)throw new Error("blake2b: wrong tree inner digest length")}},t.prototype.update=function(t,r){if(void 0===r&&(r=t.length),this._finished)throw new Error("blake2b: can't update because hash was finished.");var n=e.BLOCK_SIZE-this._bufferLength,i=0;if(0===r)return this;if(r>n){for(var o=0;o<n;o++)this._buffer[this._bufferLength+o]=t[i+o];this._processBlock(e.BLOCK_SIZE),i+=n,r-=n,this._bufferLength=0}for(;r>e.BLOCK_SIZE;){for(o=0;o<e.BLOCK_SIZE;o++)this._buffer[o]=t[i+o];this._processBlock(e.BLOCK_SIZE),i+=e.BLOCK_SIZE,r-=e.BLOCK_SIZE,this._bufferLength=0}for(o=0;o<r;o++)this._buffer[this._bufferLength+o]=t[i+o];return this._bufferLength+=r,this},t.prototype.finish=function(t){if(!this._finished){for(var r=this._bufferLength;r<e.BLOCK_SIZE;r++)this._buffer[r]=0;this._flag[0]=4294967295,this._flag[1]=4294967295,this._lastNode&&(this._flag[2]=4294967295,this._flag[3]=4294967295),this._processBlock(this._bufferLength),this._finished=!0}var i=this._buffer.subarray(0,64);for(r=0;r<16;r++)n.writeUint32LE(this._state[r],i,4*r);return t.set(i.subarray(0,t.length)),this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t.prototype.clean=function(){i.wipe(this._vtmp),i.wipe(this._mtmp),i.wipe(this._state),i.wipe(this._buffer),i.wipe(this._initialState),this._paddedKey&&i.wipe(this._paddedKey),this._bufferLength=0,i.wipe(this._ctr),i.wipe(this._flag),this._lastNode=!1,this._finished=!1},t.prototype.saveState=function(){if(this._finished)throw new Error("blake2b: cannot save finished state");return{state:new Uint32Array(this._state),buffer:new Uint8Array(this._buffer),bufferLength:this._bufferLength,ctr:new Uint32Array(this._ctr),flag:new Uint32Array(this._flag),lastNode:this._lastNode,paddedKey:this._paddedKey?new Uint8Array(this._paddedKey):void 0,initialState:new Uint32Array(this._initialState)}},t.prototype.restoreState=function(t){return this._state.set(t.state),this._buffer.set(t.buffer),this._bufferLength=t.bufferLength,this._ctr.set(t.ctr),this._flag.set(t.flag),this._lastNode=t.lastNode,this._paddedKey&&i.wipe(this._paddedKey),this._paddedKey=t.paddedKey?new Uint8Array(t.paddedKey):void 0,this._initialState.set(t.initialState),this},t.prototype.cleanSavedState=function(t){i.wipe(t.state),i.wipe(t.buffer),i.wipe(t.initialState),t.paddedKey&&i.wipe(t.paddedKey),t.bufferLength=0,i.wipe(t.ctr),i.wipe(t.flag),t.lastNode=!1},t.prototype._G=function(t,e,r,n,i,o,s,a,c,u,f,h,l){var d=t[e],p=t[o],b=t[r],g=t[s],m=t[n],v=t[a],y=t[i],w=t[c],_=65535&d,E=d>>>16,S=65535&p,A=p>>>16;E+=b>>>16,S+=65535&g,A+=g>>>16,S+=(E+=(_+=65535&b)>>>16)>>>16,_=65535&(d=65535&_|E<<16),E=d>>>16,S=65535&(p=65535&S|(A+=S>>>16)<<16),A=p>>>16,E+=u>>>16,S+=65535&f,A+=f>>>16,d=65535&(_+=65535&u)|(E+=_>>>16)<<16,_=w^=p=65535&(S+=E>>>16)|(A+=S>>>16)<<16,w=y^=d,y=_,_=65535&m,E=m>>>16,S=65535&v,A=v>>>16,E+=y>>>16,S+=65535&w,A+=w>>>16,_=(b^=m=65535&(_+=65535&y)|(E+=_>>>16)<<16)<<8|(g^=v=65535&(S+=E>>>16)|(A+=S>>>16)<<16)>>>24,b=g<<8|b>>>24,g=_,_=65535&d,E=d>>>16,S=65535&p,A=p>>>16,E+=b>>>16,S+=65535&g,A+=g>>>16,S+=(E+=(_+=65535&b)>>>16)>>>16,_=65535&(d=65535&_|E<<16),E=d>>>16,S=65535&(p=65535&S|(A+=S>>>16)<<16),A=p>>>16,E+=h>>>16,S+=65535&l,A+=l>>>16,_=(y^=d=65535&(_+=65535&h)|(E+=_>>>16)<<16)<<16|(w^=p=65535&(S+=E>>>16)|(A+=S>>>16)<<16)>>>16,y=w<<16|y>>>16,w=_,_=65535&m,E=m>>>16,S=65535&v,A=v>>>16,E+=y>>>16,S+=65535&w,A+=w>>>16,_=(g^=v=65535&(S+=(E+=(_+=65535&y)>>>16)>>>16)|(A+=S>>>16)<<16)<<1|(b^=m=65535&_|E<<16)>>>31,b=b<<1|g>>>31,g=_,t[e]=d,t[o]=p,t[r]=b,t[s]=g,t[n]=m,t[a]=v,t[i]=y,t[c]=w},t.prototype._incrementCounter=function(t){for(var e=0;e<3;e++){var r=this._ctr[e]+t;if(this._ctr[e]=r>>>0,this._ctr[e]===r)return;t=1}},t.prototype._processBlock=function(t){this._incrementCounter(t);var e=this._vtmp;e.set(this._state),e.set(o,16),e[24]^=this._ctr[0],e[25]^=this._ctr[1],e[26]^=this._ctr[2],e[27]^=this._ctr[3],e[28]^=this._flag[0],e[29]^=this._flag[1],e[30]^=this._flag[2],e[31]^=this._flag[3];for(var r=this._mtmp,i=0;i<32;i++)r[i]=n.readUint32LE(this._buffer,4*i);for(var a=0;a<12;a++)this._G(e,0,8,16,24,1,9,17,25,r[s[a][0]],r[s[a][0]+1],r[s[a][1]],r[s[a][1]+1]),this._G(e,2,10,18,26,3,11,19,27,r[s[a][2]],r[s[a][2]+1],r[s[a][3]],r[s[a][3]+1]),this._G(e,4,12,20,28,5,13,21,29,r[s[a][4]],r[s[a][4]+1],r[s[a][5]],r[s[a][5]+1]),this._G(e,6,14,22,30,7,15,23,31,r[s[a][6]],r[s[a][6]+1],r[s[a][7]],r[s[a][7]+1]),this._G(e,0,10,20,30,1,11,21,31,r[s[a][8]],r[s[a][8]+1],r[s[a][9]],r[s[a][9]+1]),this._G(e,2,12,22,24,3,13,23,25,r[s[a][10]],r[s[a][10]+1],r[s[a][11]],r[s[a][11]+1]),this._G(e,4,14,16,26,5,15,17,27,r[s[a][12]],r[s[a][12]+1],r[s[a][13]],r[s[a][13]+1]),this._G(e,6,8,18,28,7,9,19,29,r[s[a][14]],r[s[a][14]+1],r[s[a][15]],r[s[a][15]+1]);for(i=0;i<16;i++)this._state[i]^=e[i]^e[i+16]},t}();e.BLAKE2b=a,e.hash=function(t,r,n){void 0===r&&(r=e.DIGEST_LENGTH);var i=new a(r,n);i.update(t);var o=i.digest();return i.clean(),o}},function(t,e,r){const n=r(210),i=r(211);t.exports={blake2b:n.blake2b,blake2bHex:n.blake2bHex,blake2bInit:n.blake2bInit,blake2bUpdate:n.blake2bUpdate,blake2bFinal:n.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},function(t,e,r){"use strict";var n=e;n.version=r(246).version,n.utils=r(27),n.rand=r(152),n.curve=r(153),n.curves=r(118),n.ec=r(260),n.eddsa=r(264)},function(t,e,r){"use strict";t.exports=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}}},function(t,e,r){"use strict";var n=r(18);function i(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,r){if(!e)return t;var o;if(r)o=r(e);else if(n.isURLSearchParams(e))o=e.toString();else{var s=[];n.forEach(e,(function(t,e){null!=t&&(n.isArray(t)?e+="[]":t=[t],n.forEach(t,(function(t){n.isDate(t)?t=t.toISOString():n.isObject(t)&&(t=JSON.stringify(t)),s.push(i(e)+"="+i(t))})))})),o=s.join("&")}if(o){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}},function(t,e,r){"use strict";t.exports=function(t,e,r,n,i){return t.config=e,r&&(t.code=r),t.request=n,t.response=i,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t}},function(t,e,r){"use strict";var n=r(18),i=r(190),o=r(191),s=r(129),a=r(192),c=r(195),u=r(196),f=r(132),h=r(91),l=r(92);t.exports=function(t){return new Promise((function(e,r){var d,p=t.data,b=t.headers,g=t.responseType;function m(){t.cancelToken&&t.cancelToken.unsubscribe(d),t.signal&&t.signal.removeEventListener("abort",d)}n.isFormData(p)&&delete b["Content-Type"];var v=new XMLHttpRequest;if(t.auth){var y=t.auth.username||"",w=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";b.Authorization="Basic "+btoa(y+":"+w)}var _=a(t.baseURL,t.url);function E(){if(v){var n="getAllResponseHeaders"in v?c(v.getAllResponseHeaders()):null,o={data:g&&"text"!==g&&"json"!==g?v.response:v.responseText,status:v.status,statusText:v.statusText,headers:n,config:t,request:v};i((function(t){e(t),m()}),(function(t){r(t),m()}),o),v=null}}if(v.open(t.method.toUpperCase(),s(_,t.params,t.paramsSerializer),!0),v.timeout=t.timeout,"onloadend"in v?v.onloadend=E:v.onreadystatechange=function(){v&&4===v.readyState&&(0!==v.status||v.responseURL&&0===v.responseURL.indexOf("file:"))&&setTimeout(E)},v.onabort=function(){v&&(r(f("Request aborted",t,"ECONNABORTED",v)),v=null)},v.onerror=function(){r(f("Network Error",t,null,v)),v=null},v.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",n=t.transitional||h.transitional;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(f(e,t,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",v)),v=null},n.isStandardBrowserEnv()){var S=(t.withCredentials||u(_))&&t.xsrfCookieName?o.read(t.xsrfCookieName):void 0;S&&(b[t.xsrfHeaderName]=S)}"setRequestHeader"in v&&n.forEach(b,(function(t,e){void 0===p&&"content-type"===e.toLowerCase()?delete b[e]:v.setRequestHeader(e,t)})),n.isUndefined(t.withCredentials)||(v.withCredentials=!!t.withCredentials),g&&"json"!==g&&(v.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&v.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&v.upload&&v.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(d=function(t){v&&(r(!t||t&&t.type?new l("canceled"):t),v.abort(),v=null)},t.cancelToken&&t.cancelToken.subscribe(d),t.signal&&(t.signal.aborted?d():t.signal.addEventListener("abort",d))),p||(p=null),v.send(p)}))}},function(t,e,r){"use strict";var n=r(130);t.exports=function(t,e,r,i,o){var s=new Error(t);return n(s,e,r,i,o)}},function(t,e,r){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,r){"use strict";var n=r(18);t.exports=function(t,e){e=e||{};var r={};function i(t,e){return n.isPlainObject(t)&&n.isPlainObject(e)?n.merge(t,e):n.isPlainObject(e)?n.merge({},e):n.isArray(e)?e.slice():e}function o(r){return n.isUndefined(e[r])?n.isUndefined(t[r])?void 0:i(void 0,t[r]):i(t[r],e[r])}function s(t){if(!n.isUndefined(e[t]))return i(void 0,e[t])}function a(r){return n.isUndefined(e[r])?n.isUndefined(t[r])?void 0:i(void 0,t[r]):i(void 0,e[r])}function c(r){return r in e?i(t[r],e[r]):r in t?i(void 0,t[r]):void 0}var u={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return n.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||o,i=e(t);n.isUndefined(i)&&e!==c||(r[t]=i)})),r}},function(t,e){t.exports={version:"0.26.0"}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){(function(e){function r(t){return(4294967296+t).toString(16).substring(1)}t.exports={normalizeInput:function(t){let r;if(t instanceof Uint8Array)r=t;else if(t instanceof e)r=new Uint8Array(t);else{if("string"!=typeof t)throw new Error("Input must be an string, Buffer or Uint8Array");r=new Uint8Array(e.from(t,"utf8"))}return r},toHex:function(t){return Array.prototype.map.call(t,(function(t){return(t<16?"0":"")+t.toString(16)})).join("")},debugPrint:function(t,e,n){let i="\n"+t+" = ";for(let o=0;o<e.length;o+=2){if(32===n)i+=r(e[o]).toUpperCase(),i+=" ",i+=r(e[o+1]).toUpperCase();else{if(64!==n)throw new Error("Invalid size "+n);i+=r(e[o+1]).toUpperCase(),i+=r(e[o]).toUpperCase()}o%6==4?i+="\n"+new Array(t.length+4).join(" "):o<e.length-2&&(i+=" ")}console.log(i)},testSpeed:function(t,e,r){let n=(new Date).getTime();const i=new Uint8Array(e);for(let t=0;t<e;t++)i[t]=t%256;const o=(new Date).getTime();console.log("Generated random input in "+(o-n)+"ms"),n=o;for(let o=0;o<r;o++){const r=t(i),o=(new Date).getTime(),s=o-n;n=o,console.log("Hashed in "+s+"ms: "+r.substring(0,20)+"..."),console.log(Math.round(e/(1<<20)/(s/1e3)*100)/100+" MB PER SECOND")}}}}).call(this,r(14).Buffer)},function(t,e,r){"use strict";var n=r(26).Buffer,i=r(214).Transform;function o(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(12)(o,i),o.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!n.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");n.isBuffer(t)||(t=n.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=t[i++];this._update(),this._blockOffset=0}for(;i<t.length;)r[this._blockOffset++]=t[i++];for(var s=0,a=8*t.length;a>0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},function(t,e,r){"use strict";(function(e,n){var i;t.exports=O,O.ReadableState=A;r(79).EventEmitter;var o=function(t,e){return t.listeners(e).length},s=r(140),a=r(14).Buffer,c=e.Uint8Array||function(){};var u,f=r(215);u=f&&f.debuglog?f.debuglog("stream"):function(){};var h,l,d,p=r(216),b=r(141),g=r(142).getHighWaterMark,m=r(58).codes,v=m.ERR_INVALID_ARG_TYPE,y=m.ERR_STREAM_PUSH_AFTER_EOF,w=m.ERR_METHOD_NOT_IMPLEMENTED,_=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(12)(O,s);var E=b.errorOrDestroy,S=["error","close","destroy","pause","resume"];function A(t,e,n){i=i||r(59),t=t||{},"boolean"!=typeof n&&(n=e instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",n),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(h||(h=r(80).StringDecoder),this.decoder=new h(t.encoding),this.encoding=t.encoding)}function O(t){if(i=i||r(59),!(this instanceof O))return new O(t);var e=this instanceof i;this._readableState=new A(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),s.call(this)}function x(t,e,r,n,i){u("readableAddChunk",e);var o,s=t._readableState;if(null===e)s.reading=!1,function(t,e){if(u("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?I(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,M(t)))}(t,s);else if(i||(o=function(t,e){var r;n=e,a.isBuffer(n)||n instanceof c||"string"==typeof e||void 0===e||t.objectMode||(r=new v("chunk",["string","Buffer","Uint8Array"],e));var n;return r}(s,e)),o)E(t,o);else if(s.objectMode||e&&e.length>0)if("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),n)s.endEmitted?E(t,new _):T(t,s,e,!0);else if(s.ended)E(t,new y);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?T(t,s,e,!1):N(t,s)):T(t,s,e,!1)}else n||(s.reading=!1,N(t,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function T(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&I(t)),N(t,e)}Object.defineProperty(O.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),O.prototype.destroy=b.destroy,O.prototype._undestroy=b.undestroy,O.prototype._destroy=function(t,e){e(t)},O.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=a.from(t,e),e=""),r=!0),x(this,t,e,!1,r)},O.prototype.unshift=function(t){return x(this,t,null,!0,!1)},O.prototype.isPaused=function(){return!1===this._readableState.flowing},O.prototype.setEncoding=function(t){h||(h=r(80).StringDecoder);var e=new h(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=e.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var P=1073741824;function R(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=P?t=P:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function I(t){var e=t._readableState;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,n.nextTick(M,t))}function M(t){var e=t._readableState;u("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,D(t)}function N(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(k,t,e))}function k(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(u("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function C(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function L(t){u("readable nexttick read 0"),t.read(0)}function j(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),D(t),e.flowing&&!e.reading&&t.read(0)}function D(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function U(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function B(t){var e=t._readableState;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(F,e,t))}function F(t,e){if(u("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function V(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}O.prototype.read=function(t){u("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?B(this):I(this),null;if(0===(t=R(t,e))&&e.ended)return 0===e.length&&B(this),null;var n,i=e.needReadable;return u("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&u("length less than watermark",i=!0),e.ended||e.reading?u("reading or ended",i=!1):i&&(u("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=R(r,e))),null===(n=t>0?U(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&B(this)),null!==n&&this.emit("data",n),n},O.prototype._read=function(t){E(this,new w("_read()"))},O.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,u("pipe count=%d opts=%j",i.pipesCount,e);var s=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?c:g;function a(e,n){u("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,u("cleanup"),t.removeListener("close",p),t.removeListener("finish",b),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",a),r.removeListener("end",c),r.removeListener("end",g),r.removeListener("data",l),h=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function c(){u("onend"),t.end()}i.endEmitted?n.nextTick(s):r.once("end",s),t.on("unpipe",a);var f=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,D(t))}}(r);t.on("drain",f);var h=!1;function l(e){u("ondata");var n=t.write(e);u("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==V(i.pipes,t))&&!h&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function d(e){u("onerror",e),g(),t.removeListener("error",d),0===o(t,"error")&&E(t,e)}function p(){t.removeListener("finish",b),g()}function b(){u("onfinish"),t.removeListener("close",p),g()}function g(){u("unpipe"),r.unpipe(t)}return r.on("data",l),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",b),t.emit("pipe",r),i.flowing||(u("pipe resume"),r.resume()),t},O.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=V(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},O.prototype.on=function(t,e){var r=s.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?I(this):i.reading||n.nextTick(L,this))),r},O.prototype.addListener=O.prototype.on,O.prototype.removeListener=function(t,e){var r=s.prototype.removeListener.call(this,t,e);return"readable"===t&&n.nextTick(C,this),r},O.prototype.removeAllListeners=function(t){var e=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||n.nextTick(C,this),e},O.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n.nextTick(j,t,e))}(this,t)),t.paused=!1,this},O.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},O.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(u("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<S.length;o++)t.on(S[o],this.emit.bind(this,S[o]));return this._read=function(e){u("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(O.prototype[Symbol.asyncIterator]=function(){return void 0===l&&(l=r(220)),l(this)}),Object.defineProperty(O.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(O.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(O.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),O._fromList=U,Object.defineProperty(O.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(O.from=function(t,e){return void 0===d&&(d=r(221)),d(O,t,e)})}).call(this,r(42),r(33))},function(t,e,r){t.exports=r(79).EventEmitter},function(t,e,r){"use strict";(function(e){function r(t,e){i(t,e),n(t)}function n(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,o){var s=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(o?o(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!o&&t?s._writableState?s._writableState.errorEmitted?e.nextTick(n,s):(s._writableState.errorEmitted=!0,e.nextTick(r,s,t)):e.nextTick(r,s,t):o?(e.nextTick(n,s),o(t)):e.nextTick(n,s)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this,r(33))},function(t,e,r){"use strict";var n=r(58).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},function(t,e,r){"use strict";(function(e,n){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var o;t.exports=O,O.WritableState=A;var s={deprecate:r(218)},a=r(140),c=r(14).Buffer,u=e.Uint8Array||function(){};var f,h=r(141),l=r(142).getHighWaterMark,d=r(58).codes,p=d.ERR_INVALID_ARG_TYPE,b=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,m=d.ERR_STREAM_CANNOT_PIPE,v=d.ERR_STREAM_DESTROYED,y=d.ERR_STREAM_NULL_VALUES,w=d.ERR_STREAM_WRITE_AFTER_END,_=d.ERR_UNKNOWN_ENCODING,E=h.errorOrDestroy;function S(){}function A(t,e,s){o=o||r(59),t=t||{},"boolean"!=typeof s&&(s=e instanceof o),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=l(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,o=r.writecb;if("function"!=typeof o)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,o){--e.pendingcb,r?(n.nextTick(o,i),n.nextTick(M,t,e),t._writableState.errorEmitted=!0,E(t,i)):(o(i),t._writableState.errorEmitted=!0,E(t,i),M(t,e))}(t,r,i,e,o);else{var s=R(r)||t.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||P(t,r),i?n.nextTick(T,t,r,s,o):T(t,r,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function O(t){var e=this instanceof(o=o||r(59));if(!e&&!f.call(O,this))return new O(t);this._writableState=new A(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),a.call(this)}function x(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new v("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function T(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),M(t,e)}function P(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,o=new Array(n),s=e.corkedRequestsFree;s.entry=r;for(var a=0,c=!0;r;)o[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;o.allBuffers=c,x(t,e,!0,e.length,o,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,f=r.encoding,h=r.callback;if(x(t,e,!1,e.objectMode?1:u.length,u,f,h),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function R(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function I(t,e){t._final((function(r){e.pendingcb--,r&&E(t,r),e.prefinished=!0,t.emit("prefinish"),M(t,e)}))}function M(t,e){var r=R(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,n.nextTick(I,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}r(12)(O,a),A.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(A.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(O,Symbol.hasInstance,{value:function(t){return!!f.call(this,t)||this===O&&(t&&t._writableState instanceof A)}})):f=function(t){return t instanceof this},O.prototype.pipe=function(){E(this,new m)},O.prototype.write=function(t,e,r){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=t,c.isBuffer(i)||i instanceof u);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof r&&(r=S),o.ending?function(t,e){var r=new w;E(t,r),n.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var o;return null===r?o=new y:"string"==typeof r||e.objectMode||(o=new p("chunk",["string","Buffer"],r)),!o||(E(t,o),n.nextTick(i,o),!1)}(this,o,t,r))&&(o.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var f=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},f?f.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else x(t,e,!1,a,n,i,o);return u}(this,o,a,t,e,r)),s},O.prototype.cork=function(){this._writableState.corked++},O.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||P(this,t))},O.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(O.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(O.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),O.prototype._write=function(t,e,r){r(new b("_write()"))},O.prototype._writev=null,O.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,M(t,e),r&&(e.finished?n.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(O.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(O.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),O.prototype.destroy=h.destroy,O.prototype._undestroy=h.undestroy,O.prototype._destroy=function(t,e){e(t)}}).call(this,r(42),r(33))},function(t,e,r){"use strict";t.exports=f;var n=r(58).codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,c=r(59);function u(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function f(t){if(!(this instanceof f))return new f(t);c.call(this,t),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",h)}function h(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?l(this,null,null):this._flush((function(e,r){l(t,e,r)}))}function l(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new a;if(t._transformState.transforming)throw new s;return t.push(null)}r(12)(f,c),f.prototype.push=function(t,e){return this._transformState.needTransform=!1,c.prototype.push.call(this,t,e)},f.prototype._transform=function(t,e,r){r(new i("_transform()"))},f.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},f.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},f.prototype._destroy=function(t,e){c.prototype._destroy.call(this,t,(function(t){e(t)}))}},function(t,e,r){var n=r(12),i=r(60),o=r(26).Buffer,s=[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],a=new Array(64);function c(){this.init(),this._w=a,i.call(this,64,56)}function u(t,e,r){return r^t&(e^r)}function f(t,e,r){return t&e|r&(t|e)}function h(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function l(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function d(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}n(c,i),c.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},c.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,c=0|this._e,p=0|this._f,b=0|this._g,g=0|this._h,m=0;m<16;++m)r[m]=t.readInt32BE(4*m);for(;m<64;++m)r[m]=0|(((e=r[m-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[m-7]+d(r[m-15])+r[m-16];for(var v=0;v<64;++v){var y=g+l(c)+u(c,p,b)+s[v]+r[v]|0,w=h(n)+f(n,i,o)|0;g=b,b=p,p=c,c=a+y|0,a=o,o=i,i=n,n=y+w|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=c+this._e|0,this._f=p+this._f|0,this._g=b+this._g|0,this._h=g+this._h|0},c.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=c},function(t,e,r){var n=r(12),i=r(60),o=r(26).Buffer,s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function c(){this.init(),this._w=a,i.call(this,128,112)}function u(t,e,r){return r^t&(e^r)}function f(t,e,r){return t&e|r&(t|e)}function h(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function l(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function b(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function g(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function m(t,e){return t>>>0<e>>>0?1:0}n(c,i),c.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},c.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,c=0|this._fh,v=0|this._gh,y=0|this._hh,w=0|this._al,_=0|this._bl,E=0|this._cl,S=0|this._dl,A=0|this._el,O=0|this._fl,x=0|this._gl,T=0|this._hl,P=0;P<32;P+=2)e[P]=t.readInt32BE(4*P),e[P+1]=t.readInt32BE(4*P+4);for(;P<160;P+=2){var R=e[P-30],I=e[P-30+1],M=d(R,I),N=p(I,R),k=b(R=e[P-4],I=e[P-4+1]),C=g(I,R),L=e[P-14],j=e[P-14+1],D=e[P-32],U=e[P-32+1],B=N+j|0,F=M+L+m(B,N)|0;F=(F=F+k+m(B=B+C|0,C)|0)+D+m(B=B+U|0,U)|0,e[P]=F,e[P+1]=B}for(var V=0;V<160;V+=2){F=e[V],B=e[V+1];var K=f(r,n,i),H=f(w,_,E),$=h(r,w),G=h(w,r),z=l(a,A),q=l(A,a),W=s[V],Y=s[V+1],J=u(a,c,v),Z=u(A,O,x),X=T+q|0,Q=y+z+m(X,T)|0;Q=(Q=(Q=Q+J+m(X=X+Z|0,Z)|0)+W+m(X=X+Y|0,Y)|0)+F+m(X=X+B|0,B)|0;var tt=G+H|0,et=$+K+m(tt,G)|0;y=v,T=x,v=c,x=O,c=a,O=A,a=o+Q+m(A=S+X|0,S)|0,o=i,S=E,i=n,E=_,n=r,_=w,r=Q+et+m(w=X+tt|0,X)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+E|0,this._dl=this._dl+S|0,this._el=this._el+A|0,this._fl=this._fl+O|0,this._gl=this._gl+x|0,this._hl=this._hl+T|0,this._ah=this._ah+r+m(this._al,w)|0,this._bh=this._bh+n+m(this._bl,_)|0,this._ch=this._ch+i+m(this._cl,E)|0,this._dh=this._dh+o+m(this._dl,S)|0,this._eh=this._eh+a+m(this._el,A)|0,this._fh=this._fh+c+m(this._fl,O)|0,this._gh=this._gh+v+m(this._gl,x)|0,this._hh=this._hh+y+m(this._hl,T)|0},c.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=c},function(t,e,r){"use strict";(function(e,n){var i=r(93);t.exports=y;var o,s=r(136);y.ReadableState=v;r(79).EventEmitter;var a=function(t,e){return t.listeners(e).length},c=r(148),u=r(116).Buffer,f=e.Uint8Array||function(){};var h=Object.create(r(81));h.inherits=r(61);var l=r(232),d=void 0;d=l&&l.debuglog?l.debuglog("stream"):function(){};var p,b=r(233),g=r(149);h.inherits(y,c);var m=["error","close","destroy","pause","resume"];function v(t,e){t=t||{};var n=e instanceof(o=o||r(49));this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,s=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new b,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=r(80).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function y(t){if(o=o||r(49),!(this instanceof y))return new y(t);this._readableState=new v(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),c.call(this)}function w(t,e,r,n,i){var o,s=t._readableState;null===e?(s.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,A(t)}(t,s)):(i||(o=function(t,e){var r;n=e,u.isBuffer(n)||n instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(s,e)),o?t.emit("error",o):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),n?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?_(t,s,e,!1):x(t,s)):_(t,s,e,!1))):n||(s.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(s)}function _(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&A(t)),x(t,e)}Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),y.prototype.destroy=g.destroy,y.prototype._undestroy=g.undestroy,y.prototype._destroy=function(t,e){this.push(null),e(t)},y.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=u.from(t,e),e=""),r=!0),w(this,t,e,!1,r)},y.prototype.unshift=function(t){return w(this,t,null,!0,!1)},y.prototype.isPaused=function(){return!1===this._readableState.flowing},y.prototype.setEncoding=function(t){return p||(p=r(80).StringDecoder),this._readableState.decoder=new p(t),this._readableState.encoding=t,this};var E=8388608;function S(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function A(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(O,t):O(t))}function O(t){d("emit readable"),t.emit("readable"),I(t)}function x(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(T,t,e))}function T(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(d("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function P(t){d("readable nexttick read 0"),t.read(0)}function R(t,e){e.reading||(d("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),I(t),e.flowing&&!e.reading&&t.read(0)}function I(t){var e=t._readableState;for(d("flow",e.flowing);e.flowing&&null!==t.read(););}function M(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;t<e.head.data.length?(n=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):n=t===e.head.data.length?e.shift():r?function(t,e){var r=e.head,n=1,i=r.data;t-=i.length;for(;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=u.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,s),0===(t-=s)){s===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function N(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(k,e,t))}function k(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function C(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}y.prototype.read=function(t){d("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return d("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?N(this):A(this),null;if(0===(t=S(t,e))&&e.ended)return 0===e.length&&N(this),null;var n,i=e.needReadable;return d("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&d("length less than watermark",i=!0),e.ended||e.reading?d("reading or ended",i=!1):i&&(d("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=S(r,e))),null===(n=t>0?M(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&N(this)),null!==n&&this.emit("data",n),n},y.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},y.prototype.pipe=function(t,e){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,d("pipe count=%d opts=%j",o.pipesCount,e);var c=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?f:y;function u(e,n){d("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,d("cleanup"),t.removeListener("close",m),t.removeListener("finish",v),t.removeListener("drain",h),t.removeListener("error",g),t.removeListener("unpipe",u),r.removeListener("end",f),r.removeListener("end",y),r.removeListener("data",b),l=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function f(){d("onend"),t.end()}o.endEmitted?i.nextTick(c):r.once("end",c),t.on("unpipe",u);var h=function(t){return function(){var e=t._readableState;d("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,I(t))}}(r);t.on("drain",h);var l=!1;var p=!1;function b(e){d("ondata"),p=!1,!1!==t.write(e)||p||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==C(o.pipes,t))&&!l&&(d("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function g(e){d("onerror",e),y(),t.removeListener("error",g),0===a(t,"error")&&t.emit("error",e)}function m(){t.removeListener("finish",v),y()}function v(){d("onfinish"),t.removeListener("close",m),y()}function y(){d("unpipe"),r.unpipe(t)}return r.on("data",b),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?s(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",g),t.once("close",m),t.once("finish",v),t.emit("pipe",r),o.flowing||(d("pipe resume"),r.resume()),t},y.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,r);return this}var s=C(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},y.prototype.on=function(t,e){var r=c.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&A(this):i.nextTick(P,this))}return r},y.prototype.addListener=y.prototype.on,y.prototype.resume=function(){var t=this._readableState;return t.flowing||(d("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(R,t,e))}(this,t)),this},y.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this},y.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(d("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(d("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<m.length;o++)t.on(m[o],this.emit.bind(this,m[o]));return this._read=function(e){d("wrapped _read",e),n&&(n=!1,t.resume())},this},Object.defineProperty(y.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),y._fromList=M}).call(this,r(42),r(33))},function(t,e,r){t.exports=r(79).EventEmitter},function(t,e,r){"use strict";var n=r(93);function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(n.nextTick(i,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,r){"use strict";t.exports=s;var n=r(49),i=Object.create(r(81));function o(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function s(t){if(!(this instanceof s))return new s(t);n.call(this,t),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",a)}function a(){var t=this;"function"==typeof this._flush?this._flush((function(e,r){c(t,e,r)})):c(this,null,null)}function c(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}i.inherits=r(61),i.inherits(s,n),s.prototype.push=function(t,e){return this._transformState.needTransform=!1,n.prototype.push.call(this,t,e)},s.prototype._transform=function(t,e,r){throw new Error("_transform() is not implemented")},s.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},s.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},s.prototype._destroy=function(t,e){var r=this;n.prototype._destroy.call(this,t,(function(t){e(t),r.emit("close")}))}},function(t,e,r){"use strict";var n=e;function i(t){return 1===t.length?"0"+t:t}function o(t){for(var e="",r=0;r<t.length;r++)e+=i(t[r].toString(16));return e}n.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n<t.length;n++)r[n]=0|t[n];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(n=0;n<t.length;n++){var i=t.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r},n.zero2=i,n.toHex=o,n.encode=function(t,e){return"hex"===e?o(t):t}},function(t,e,r){var n;function i(t){this.rand=t}if(t.exports=function(t){return n||(n=new i(null)),n.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=r(249);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(t){return o.randomBytes(t)}}catch(t){}},function(t,e,r){"use strict";var n=e;n.base=r(94),n.short=r(250),n.mont=r(251),n.edwards=r(252)},function(t,e,r){"use strict";var n=r(34).rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function s(t,e,r){return t^e^r}e.ft_1=function(t,e,r,n){return 0===t?i(e,r,n):1===t||3===t?s(e,r,n):2===t?o(e,r,n):void 0},e.ch32=i,e.maj32=o,e.p32=s,e.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},e.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},e.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},e.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},function(t,e,r){"use strict";var n=r(34),i=r(82),o=r(154),s=r(50),a=n.sum32,c=n.sum32_4,u=n.sum32_5,f=o.ch32,h=o.maj32,l=o.s0_256,d=o.s1_256,p=o.g0_256,b=o.g1_256,g=i.BlockHash,m=[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];function v(){if(!(this instanceof v))return new v;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=m,this.W=new Array(64)}n.inherits(v,g),t.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=c(b(r[n-2]),r[n-7],p(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],g=this.h[2],m=this.h[3],v=this.h[4],y=this.h[5],w=this.h[6],_=this.h[7];for(s(this.k.length===r.length),n=0;n<r.length;n++){var E=u(_,d(v),f(v,y,w),this.k[n],r[n]),S=a(l(i),h(i,o,g));_=w,w=y,y=v,v=a(m,E),m=g,g=o,o=i,i=a(E,S)}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],g),this.h[3]=a(this.h[3],m),this.h[4]=a(this.h[4],v),this.h[5]=a(this.h[5],y),this.h[6]=a(this.h[6],w),this.h[7]=a(this.h[7],_)},v.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(t,e,r){"use strict";var n=r(34),i=r(82),o=r(50),s=n.rotr64_hi,a=n.rotr64_lo,c=n.shr64_hi,u=n.shr64_lo,f=n.sum64,h=n.sum64_hi,l=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,b=n.sum64_5_hi,g=n.sum64_5_lo,m=i.BlockHash,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function y(){if(!(this instanceof y))return new y;m.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}function w(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function _(t,e,r,n,i,o){var s=e&n^~e&o;return s<0&&(s+=4294967296),s}function E(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function S(t,e,r,n,i,o){var s=e&n^e&o^n&o;return s<0&&(s+=4294967296),s}function A(t,e){var r=s(t,e,28)^s(e,t,2)^s(e,t,7);return r<0&&(r+=4294967296),r}function O(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function x(t,e){var r=s(t,e,14)^s(t,e,18)^s(e,t,9);return r<0&&(r+=4294967296),r}function T(t,e){var r=a(t,e,14)^a(t,e,18)^a(e,t,9);return r<0&&(r+=4294967296),r}function P(t,e){var r=s(t,e,1)^s(t,e,8)^c(t,e,7);return r<0&&(r+=4294967296),r}function R(t,e){var r=a(t,e,1)^a(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function I(t,e){var r=s(t,e,19)^s(e,t,29)^c(t,e,6);return r<0&&(r+=4294967296),r}function M(t,e){var r=a(t,e,19)^a(e,t,29)^u(t,e,6);return r<0&&(r+=4294967296),r}n.inherits(y,m),t.exports=y,y.blockSize=1024,y.outSize=512,y.hmacStrength=192,y.padLength=128,y.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=I(r[n-4],r[n-3]),o=M(r[n-4],r[n-3]),s=r[n-14],a=r[n-13],c=P(r[n-30],r[n-29]),u=R(r[n-30],r[n-29]),f=r[n-32],h=r[n-31];r[n]=d(i,o,s,a,c,u,f,h),r[n+1]=p(i,o,s,a,c,u,f,h)}},y.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,n=this.h[0],i=this.h[1],s=this.h[2],a=this.h[3],c=this.h[4],u=this.h[5],d=this.h[6],p=this.h[7],m=this.h[8],v=this.h[9],y=this.h[10],P=this.h[11],R=this.h[12],I=this.h[13],M=this.h[14],N=this.h[15];o(this.k.length===r.length);for(var k=0;k<r.length;k+=2){var C=M,L=N,j=x(m,v),D=T(m,v),U=w(m,v,y,P,R),B=_(m,v,y,P,R,I),F=this.k[k],V=this.k[k+1],K=r[k],H=r[k+1],$=b(C,L,j,D,U,B,F,V,K,H),G=g(C,L,j,D,U,B,F,V,K,H);C=A(n,i),L=O(n,i),j=E(n,i,s,a,c),D=S(n,i,s,a,c,u);var z=h(C,L,j,D),q=l(C,L,j,D);M=R,N=I,R=y,I=P,y=m,P=v,m=h(d,p,$,G),v=l(p,p,$,G),d=c,p=u,c=s,u=a,s=n,a=i,n=h($,G,z,q),i=l($,G,z,q)}f(this.h,0,n,i),f(this.h,2,s,a),f(this.h,4,c,u),f(this.h,6,d,p),f(this.h,8,m,v),f(this.h,10,y,P),f(this.h,12,R,I),f(this.h,14,M,N)},y.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.Context=e.defaultConfigConfirmation=void 0;const i=r(22),o=r(267),s=r(158),a=r(268),c=r(271),u=r(165),f=r(272),h=r(83),l=r(85),d=r(174),p=r(121),b=r(53),g=r(176),m=r(123),v=r(124),y=r(178);e.defaultConfigConfirmation={defaultConfirmationCount:1,confirmationPollingTimeoutSecond:180};class w{constructor(t,r=new s.NoopSigner,n,w=new b.BehaviorSubject(Object.assign({},e.defaultConfigConfirmation)),_,E,S,A,O,x,T,P){this._rpc=t,this._signer=r,this._proto=n,this._config=w,this.providerDecorator=[],this.tz=new c.RpcTzProvider(this),this.estimate=new u.RPCEstimateProvider(this),this.contract=new f.RpcContractProvider(this,this.estimate),this.batch=new h.RPCBatchProvider(this,this.estimate),this.wallet=new l.Wallet(this),this.withExtensions=()=>{let t=this.clone();return this.providerDecorator.forEach((e=>{t=e(t)})),t},"string"==typeof this._rpc?this._rpcClient=new i.RpcClient(this._rpc):this._rpcClient=this._rpc,this._forger=_||new y.TaquitoLocalForger(this),this._injector=E||new o.RpcInjector(this),this.operationFactory=new a.OperationFactory(this),this._walletProvider=A||new l.LegacyWalletProvider(this),this._parser=O||new d.MichelCodecParser(this),this._packer=S||new p.RpcPacker(this),this._globalConstantsProvider=x||new g.NoopGlobalConstantsProvider,this._readProvider=T||new m.RpcReadAdapter(this),this._stream=P||new v.PollingSubscribeProvider(this)}get config(){return this._config.getValue()}set config(t){this._config.next(Object.assign({},t))}setPartialConfig(t){this._config.next(Object.assign(Object.assign({},this._config.getValue()),t))}get rpc(){return this._rpcClient}set rpc(t){this._rpcClient=t}get injector(){return this._injector}set injector(t){this._injector=t}get forger(){return this._forger}set forger(t){this._forger=t}get signer(){return this._signer}set signer(t){this._signer=t}get walletProvider(){return this._walletProvider}set walletProvider(t){this._walletProvider=t}set proto(t){this._proto=t}get proto(){return this._proto}get parser(){return this._parser}set parser(t){this._parser=t}get packer(){return this._packer}set packer(t){this._packer=t}get globalConstantsProvider(){return this._globalConstantsProvider}set globalConstantsProvider(t){this._globalConstantsProvider=t}get readProvider(){return this._readProvider}set readProvider(t){this._readProvider=t}get stream(){return this._stream}set stream(t){this._stream=t}isAnyProtocolActive(t=[]){return n(this,void 0,void 0,(function*(){if(this._proto)return t.includes(this._proto);{const e=yield this.readProvider.getNextProtocol("head");return t.includes(e)}}))}isAnySignerConfigured(){return!(this.signer instanceof s.NoopSigner)}clone(){return new w(this.rpc,this.signer,this.proto,this._config,this.forger,this._injector,this.packer,this._walletProvider,this._parser,this._globalConstantsProvider,this._readProvider,this._stream)}registerProviderDecorator(t){this.providerDecorator.push(t)}}e.Context=w},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.NoopSigner=e.UnconfiguredSignerError=void 0;class i extends Error{constructor(){super("No signer has been configured. Please configure one by calling setProvider({signer}) on your TezosToolkit instance."),this.name="UnconfiguredSignerError"}}e.UnconfiguredSignerError=i;e.NoopSigner=class{publicKey(){return n(this,void 0,void 0,(function*(){throw new i}))}publicKeyHash(){return n(this,void 0,void 0,(function*(){throw new i}))}secretKey(){return n(this,void 0,void 0,(function*(){throw new i}))}sign(t,e){return n(this,void 0,void 0,(function*(){throw new i}))}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createObservableFromSubscription=void 0;const n=r(53);e.createObservableFromSubscription=function(t){return new n.Observable((e=>(t.on("data",(t=>{e.next(t)})),t.on("error",(t=>{e.error(t)})),t.on("close",(()=>{e.complete()})),()=>{t.close()})))}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.format=void 0;const n=r(63);function i(t){switch(t){case"tz":return 6;case"mtz":return 3;default:return 0}}e.format=function(t="mutez",e="mutez",r){const o=new n.default(r);return o.isNaN()?r:o.multipliedBy(Math.pow(10,i(t))).dividedBy(Math.pow(10,i(e)))}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BatchOperation=void 0;const n=r(83),i=r(52),o=r(47),s=r(23);class a extends o.Operation{constructor(t,e,r,n,i,o){super(t,n,i,o),this.params=e,this.source=r}sumProp(t,e){return t.reduce(((t,r)=>e in r?Number(r[e])+t:t),0)}get status(){return this.results.filter((t=>-1!==n.BATCH_KINDS.indexOf(t.kind))).map((t=>s.hasMetadataWithResult(t)?t.metadata.operation_result.status:"unknown"))[0]||"unknown"}get fee(){return this.sumProp(this.params,"fee")}get gasLimit(){return this.sumProp(this.params,"gas_limit")}get storageLimit(){return this.sumProp(this.params,"storage_limit")}get consumedGas(){return String(this.sumProp(i.flattenOperationResult({contents:this.results}),"consumed_gas"))}get storageDiff(){return String(this.sumProp(i.flattenOperationResult({contents:this.results}),"paid_storage_size_diff"))}get errors(){return i.flattenErrors({contents:this.results})}}e.BatchOperation=a},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.DelegationWalletOperation=void 0;const i=r(22),o=r(64);class s extends o.WalletOperation{constructor(t,e,r){super(t,e,r),this.opHash=t,this.context=e}revealOperation(){return n(this,void 0,void 0,(function*(){return(yield this.operationResults()).find((t=>t.kind===i.OpKind.REVEAL))}))}delegationOperation(){return n(this,void 0,void 0,(function*(){return(yield this.operationResults()).find((t=>t.kind===i.OpKind.DELEGATION))}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const t=yield this.delegationOperation();return t?t.metadata.operation_result.status:"unknown"}))}}e.DelegationWalletOperation=s},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.OriginationWalletOperation=void 0;const i=r(22),o=r(23),s=r(64);class a extends s.WalletOperation{constructor(t,e,r){super(t,e,r),this.opHash=t,this.context=e}originationOperation(){return n(this,void 0,void 0,(function*(){const t=yield this.operationResults();return o.findWithKind(t,i.OpKind.ORIGINATION)}))}revealOperation(){return n(this,void 0,void 0,(function*(){const t=yield this.operationResults();return o.findWithKind(t,i.OpKind.REVEAL)}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const t=yield this.originationOperation();return t?t.metadata.operation_result.status:"unknown"}))}contract(){return n(this,void 0,void 0,(function*(){const t=yield this.originationOperation(),e=((null==t?void 0:t.metadata.operation_result.originated_contracts)||[])[0];return this.context.wallet.at(e)}))}}e.OriginationWalletOperation=a},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.TransactionWalletOperation=void 0;const i=r(64),o=r(22);class s extends i.WalletOperation{constructor(t,e,r){super(t,e,r),this.opHash=t,this.context=e}revealOperation(){return n(this,void 0,void 0,(function*(){return(yield this.operationResults()).find((t=>t.kind===o.OpKind.REVEAL))}))}transactionOperation(){return n(this,void 0,void 0,(function*(){return(yield this.operationResults()).find((t=>t.kind===o.OpKind.TRANSACTION))}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const t=yield this.transactionOperation();return t?t.metadata.operation_result.status:"unknown"}))}}e.TransactionWalletOperation=s},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))},i=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r};Object.defineProperty(e,"__esModule",{value:!0}),e.RPCEstimateProvider=void 0;const o=r(22),s=r(63),a=r(84),c=r(97),u=r(52),f=r(23),h=r(120),l=r(96),d=r(2),p=r(166),b=(t,e)=>({fee:void 0===t.fee?e.fee:t.fee,gasLimit:void 0===t.gasLimit?e.gasLimit:t.gasLimit,storageLimit:void 0===t.storageLimit?e.storageLimit:t.storageLimit});class g extends c.OperationEmitter{constructor(){super(...arguments),this.ALLOCATION_STORAGE=257,this.ORIGINATION_STORAGE=257,this.OP_SIZE_REVEAL=128}getKeys(){return n(this,void 0,void 0,(function*(){const t=this.context.isAnySignerConfigured();return{publicKeyHash:t?yield this.signer.publicKeyHash():yield this.context.walletProvider.getPKH(),publicKey:t?yield this.signer.publicKey():void 0}}))}getAccountLimits(t,e,r){return n(this,void 0,void 0,(function*(){const n=yield this.context.readProvider.getBalance(t,"head"),{hard_gas_limit_per_operation:i,hard_gas_limit_per_block:o,hard_storage_limit_per_operation:a,cost_per_byte:c}=e;return{fee:0,gasLimit:r?Math.floor(this.ajustGasForBatchOperation(o,i,r).toNumber()):i.toNumber(),storageLimit:Math.floor(s.default.min(n.dividedBy(c),a).toNumber())}}))}ajustGasForBatchOperation(t,e,r){return s.default.min(e,t.div(r+1))}getEstimationPropertiesFromOperationContent(t,e,r){const n=u.flattenOperationResult({contents:[t]});let i=0,o=0,s=0;return n.forEach((t=>{s+="originated_contracts"in t&&void 0!==t.originated_contracts?t.originated_contracts.length*this.ORIGINATION_STORAGE:0,s+="allocated_destination_contract"in t?this.ALLOCATION_STORAGE:0,i+=Number(t.consumed_gas)||0,o+=Number(t.consumed_milligas)||0,s+="paid_storage_size_diff"in t&&Number(t.paid_storage_size_diff)||0,s+="storage_size"in t&&"global_address"in t&&Number(t.storage_size)||0})),0!==i&&0===o&&(o=1e3*i),f.isOpWithFee(t)?{milligasLimit:o||0,storageLimit:Number(s||0),opSize:e,minimalFeePerStorageByteMutez:r.toNumber()}:{milligasLimit:0,storageLimit:0,opSize:e,minimalFeePerStorageByteMutez:r.toNumber(),baseFeeMutez:0}}prepareEstimate(t,e,r){return n(this,void 0,void 0,(function*(){const n=yield this.prepareOperation(t,r),{opbytes:i,opOb:{branch:o,contents:s}}=yield this.forge(n),a={operation:{branch:o,contents:s,signature:"edsigtkpiSSschcaCt9pUVrpNPf7TTcgvgDEDD6NCEHMy8NNQJCGnMfLZzYoQj74yLjo9wx6MPVV29CvVzgi7qEcEUok3k7AuMg"},chain_id:yield this.context.readProvider.getChainId()},{opResponse:c}=yield this.simulate(a),{cost_per_byte:f}=e,h=[...u.flattenErrors(c,"backtracked"),...u.flattenErrors(c)];if(h.length)throw new u.TezosOperationError(h);let l=1;return Array.isArray(t.operation)&&t.operation.length>1&&(l="reveal"===c.contents[0].kind?t.operation.length-1:t.operation.length),c.contents.map((t=>this.getEstimationPropertiesFromOperationContent(t,"reveal"===t.kind?this.OP_SIZE_REVEAL/2:i.length/2/l,f)))}))}originate(t){var{fee:e,storageLimit:r,gasLimit:o}=t,s=i(t,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const{publicKeyHash:t}=yield this.getKeys(),n=yield this.context.readProvider.getProtocolConstants("head"),i=yield this.getAccountLimits(t,n),a=yield l.createOriginationOperation(yield this.context.parser.prepareCodeOrigination(Object.assign(Object.assign({},s),b({fee:e,storageLimit:r,gasLimit:o},i)))),c=yield this.isRevealOpNeeded([a],t),u=c?yield this.addRevealOp([a],t):a,f=yield this.prepareEstimate({operation:u,source:t},n,t);return c&&f.shift(),h.Estimate.createEstimateInstanceFromProperties(f)}))}transfer(t){var{fee:e,storageLimit:r,gasLimit:o}=t,s=i(t,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){if(d.validateAddress(s.to)!==d.ValidationResult.VALID)throw new d.InvalidAddressError(`Invalid 'to' address: ${s.to}`);if(s.source&&d.validateAddress(s.source)!==d.ValidationResult.VALID)throw new d.InvalidAddressError(`Invalid 'source' address: ${s.source}`);const t=(yield this.getKeys()).publicKeyHash,n=yield this.context.readProvider.getProtocolConstants("head"),i=yield this.getAccountLimits(t,n),a=yield l.createTransferOperation(Object.assign(Object.assign({},s),b({fee:e,storageLimit:r,gasLimit:o},i))),c=yield this.isRevealOpNeeded([a],t),u=c?yield this.addRevealOp([a],t):a,f=yield this.prepareEstimate({operation:u,source:t},n,t);return c&&f.shift(),h.Estimate.createEstimateInstanceFromProperties(f)}))}setDelegate(t){var{fee:e,gasLimit:r,storageLimit:o}=t,s=i(t,["fee","gasLimit","storageLimit"]);return n(this,void 0,void 0,(function*(){if(s.source&&d.validateAddress(s.source)!==d.ValidationResult.VALID)throw new d.InvalidAddressError(`Invalid source address: ${s.source}`);if(s.delegate&&d.validateAddress(s.delegate)!==d.ValidationResult.VALID)throw new d.InvalidAddressError(`Invalid delegate address: ${s.delegate}`);const t=(yield this.getKeys()).publicKeyHash,n=s.source||t,i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(n,i),c=yield l.createSetDelegateOperation(Object.assign(Object.assign({},s),b({fee:e,storageLimit:o,gasLimit:r},a))),u=yield this.isRevealOpNeeded([c],t),f=u?yield this.addRevealOp([c],t):c,p=yield this.prepareEstimate({operation:f,source:t},i,t);return u&&p.shift(),h.Estimate.createEstimateInstanceFromProperties(p)}))}batch(t){return n(this,void 0,void 0,(function*(){const{publicKeyHash:e}=yield this.getKeys();let r=[];const n=yield this.context.readProvider.getProtocolConstants("head"),i=yield this.getAccountLimits(e,n,t.length);for(const e of t)switch(e.kind){case o.OpKind.TRANSACTION:r.push(yield l.createTransferOperation(Object.assign(Object.assign({},e),b(e,i))));break;case o.OpKind.ORIGINATION:r.push(yield l.createOriginationOperation(yield this.context.parser.prepareCodeOrigination(Object.assign(Object.assign({},e),b(e,i)))));break;case o.OpKind.DELEGATION:r.push(yield l.createSetDelegateOperation(Object.assign(Object.assign({},e),b(e,i))));break;case o.OpKind.ACTIVATION:r.push(Object.assign(Object.assign({},e),i));break;case o.OpKind.REGISTER_GLOBAL_CONSTANT:r.push(yield l.createRegisterGlobalConstantOperation(Object.assign(Object.assign({},e),b(e,i))));break;default:throw new Error(`Unsupported operation kind: ${e.kind}`)}r=(yield this.isRevealOpNeeded(r,e))?yield this.addRevealOp(r,e):r;const s=yield this.prepareEstimate({operation:r,source:e},n,e);return h.Estimate.createArrayEstimateInstancesFromProperties(s)}))}registerDelegate(t){return n(this,void 0,void 0,(function*(){const e=(yield this.getKeys()).publicKeyHash,r=yield this.context.readProvider.getProtocolConstants("head"),n=yield this.getAccountLimits(e,r),i=yield l.createRegisterDelegateOperation(Object.assign(Object.assign({},t),n),e),o=yield this.isRevealOpNeeded([i],e),s=o?yield this.addRevealOp([i],e):i,a=yield this.prepareEstimate({operation:s,source:e},r,e);return o&&a.shift(),h.Estimate.createEstimateInstanceFromProperties(a)}))}reveal(t){return n(this,void 0,void 0,(function*(){const{publicKeyHash:e,publicKey:r}=yield this.getKeys();if(!r)throw new p.RevealEstimateError;if(yield this.isAccountRevealRequired(e)){const n=yield this.context.readProvider.getProtocolConstants("head"),i=yield this.getAccountLimits(e,n),o=yield l.createRevealOperation(Object.assign(Object.assign({},t),i),e,r),s=yield this.prepareEstimate({operation:o,source:e},n,e);return h.Estimate.createEstimateInstanceFromProperties(s)}}))}registerGlobalConstant(t){var{fee:e,storageLimit:r,gasLimit:o}=t,s=i(t,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const t=(yield this.getKeys()).publicKeyHash,n=yield this.context.readProvider.getProtocolConstants("head"),i=yield this.getAccountLimits(t,n),a=yield l.createRegisterGlobalConstantOperation(Object.assign(Object.assign({},s),b({fee:e,storageLimit:r,gasLimit:o},i))),c=yield this.isRevealOpNeeded([a],t),u=c?yield this.addRevealOp([a],t):a,f=yield this.prepareEstimate({operation:u,source:t},n,t);return c&&f.shift(),h.Estimate.createEstimateInstanceFromProperties(f)}))}addRevealOp(t,e){return n(this,void 0,void 0,(function*(){const{publicKey:r}=yield this.getKeys();if(!r)throw new p.RevealEstimateError;return t.unshift(yield l.createRevealOperation(Object.assign({fee:a.DEFAULT_FEE.REVEAL,gasLimit:a.DEFAULT_GAS_LIMIT.REVEAL,storageLimit:a.DEFAULT_STORAGE_LIMIT.REVEAL}),e,yield this.signer.publicKey())),t}))}}e.RPCEstimateProvider=g},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RevealEstimateError=void 0;class n extends Error{constructor(){super("Unable to estimate the reveal operation, the public key is unknown"),this.name="Reveal Estimate Error"}}e.RevealEstimateError=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DelegateOperation=void 0;const n=r(47);class i extends n.Operation{constructor(t,e,r,n,i,o){super(t,n,i,o),this.params=e,this.source=r}get operationResults(){const t=Array.isArray(this.results)&&this.results.find((t=>"delegation"===t.kind)),e=t&&t.metadata&&t.metadata.operation_result;return e||void 0}get status(){const t=this.operationResults;return t?t.status:"unknown"}get delegate(){return this.delegate}get isRegisterOperation(){return this.delegate===this.source}get fee(){return this.params.fee}get gasLimit(){return this.params.gas_limit}get storageLimit(){return this.params.storage_limit}get consumedGas(){const t=this.operationResults&&this.operationResults.consumed_gas;return t||void 0}get errors(){return this.operationResults&&this.operationResults.errors}}e.DelegateOperation=i},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.OriginationOperation=void 0;const i=r(47),o=r(23);class s extends i.Operation{constructor(t,e,r,n,i,o){super(t,r,n,i),this.params=e,this.contractProvider=o;const s=this.operationResults&&this.operationResults.originated_contracts;Array.isArray(s)&&(this.contractAddress=s[0])}get status(){const t=this.operationResults;return t?t.status:"unknown"}get operationResults(){const t=Array.isArray(this.results)&&this.results.find((t=>"origination"===t.kind)),e=t&&o.hasMetadataWithResult(t)&&t.metadata.operation_result;return e||void 0}get fee(){return this.params.fee}get gasLimit(){return this.params.gas_limit}get storageLimit(){return this.params.storage_limit}get consumedGas(){const t=this.operationResults&&this.operationResults.consumed_gas;return t||void 0}get storageDiff(){const t=this.operationResults&&this.operationResults.paid_storage_size_diff;return t||void 0}get storageSize(){const t=this.operationResults&&this.operationResults.storage_size;return t||void 0}get errors(){return this.operationResults&&this.operationResults.errors}contract(t,e){return n(this,void 0,void 0,(function*(){if(!this.contractAddress)throw new Error("No contract was originated in this operation");return yield this.confirmation(t,e),this.contractProvider.at(this.contractAddress)}))}}e.OriginationOperation=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TransactionOperation=void 0;const n=r(63),i=r(52),o=r(47);class s extends o.Operation{constructor(t,e,r,n,i,o){super(t,n,i,o),this.params=e,this.source=r}get operationResults(){const t=Array.isArray(this.results)&&this.results.find((t=>"transaction"===t.kind));return t?[t]:[]}get status(){const t=this.operationResults[0];return t?t.metadata.operation_result.status:"unknown"}get amount(){return new n.default(this.params.amount)}get destination(){return this.params.destination}get fee(){return this.params.fee}get gasLimit(){return this.params.gas_limit}get storageLimit(){return this.params.storage_limit}sumProp(t,e){return t.reduce(((t,r)=>e in r?Number(r[e])+t:t),0)}get consumedGas(){return String(this.sumProp(i.flattenOperationResult({contents:this.operationResults}),"consumed_gas"))}get storageDiff(){return String(this.sumProp(i.flattenOperationResult({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp(i.flattenOperationResult({contents:this.operationResults}),"storage_size"))}get errors(){return i.flattenErrors({contents:this.operationResults})}}e.TransactionOperation=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ContractMethodObject=void 0;const n=r(85),i=r(98);e.ContractMethodObject=class{constructor(t,e,r,n,i="unit",o=!0,s=!1){this.provider=t,this.address=e,this.parameterSchema=r,this.name=n,this.args=i,this.isMultipleEntrypoint=o,this.isAnonymous=s}getSignature(){return this.isAnonymous?this.parameterSchema.ExtractSchema()[this.name]:this.parameterSchema.ExtractSchema()}send(t={}){return this.provider instanceof n.Wallet?this.provider.transfer(this.toTransferParams(t)).send():this.provider.transfer(this.toTransferParams(t))}toTransferParams({fee:t,gasLimit:e,storageLimit:r,source:n,amount:o=0,mutez:s=!1}={}){return{to:this.address,amount:o,fee:t,mutez:s,source:n,gasLimit:e,storageLimit:r,parameter:{entrypoint:this.isMultipleEntrypoint?this.name:i.DEFAULT_SMART_CONTRACT_METHOD_NAME,value:this.isAnonymous?this.parameterSchema.EncodeObject({[this.name]:this.args}):this.parameterSchema.EncodeObject(this.args)}}}}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.compose=void 0,i(r(98),e),i(r(51),e),i(r(277),e),i(r(278),e),i(r(96),e),i(r(279),e);var o=r(280);Object.defineProperty(e,"compose",{enumerable:!0,get:function(){return o.compose}}),i(r(281),e),i(r(172),e),i(r(170),e)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ContractMethod=void 0;const n=r(85),i=r(98),o=r(51);e.ContractMethod=class{constructor(t,e,r,n,i,o=!0,s=!1){this.provider=t,this.address=e,this.parameterSchema=r,this.name=n,this.args=i,this.isMultipleEntrypoint=o,this.isAnonymous=s}validateArgs(t,e,r){const n=e.ExtractSignatures();if(!n.find((e=>e.length===t.length)))throw new o.InvalidParameterError(r,n,t)}get schema(){return this.isAnonymous?this.parameterSchema.ExtractSchema()[this.name]:this.parameterSchema.ExtractSchema()}getSignature(){if(!this.isAnonymous){const t=this.parameterSchema.ExtractSignatures();return 1==t.length?t[0]:t}{const t=this.parameterSchema.ExtractSignatures().find((t=>t[0]===this.name));if(t)return t.shift(),t}}send(t={}){return this.provider instanceof n.Wallet?this.provider.transfer(this.toTransferParams(t)).send():this.provider.transfer(this.toTransferParams(t))}toTransferParams({fee:t,gasLimit:e,storageLimit:r,source:n,amount:o=0,mutez:s=!1}={}){return{to:this.address,amount:o,fee:t,mutez:s,source:n,gasLimit:e,storageLimit:r,parameter:{entrypoint:this.isMultipleEntrypoint?this.name:i.DEFAULT_SMART_CONTRACT_METHOD_NAME,value:this.isAnonymous?this.parameterSchema.Encode(this.name,...this.args):this.parameterSchema.Encode(...this.args)}}}}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.BigMapAbstraction=void 0;const i=r(72);e.BigMapAbstraction=class{constructor(t,e,r){this.id=t,this.schema=e,this.provider=r}get(t,e){return n(this,void 0,void 0,(function*(){try{return yield this.provider.getBigMapKeyByID(this.id.toString(),t,this.schema,e)}catch(t){if(t instanceof i.HttpResponseError&&t.status===i.STATUS_CODE.NOT_FOUND)return;throw t}}))}getMultipleValues(t,e,r=5){return n(this,void 0,void 0,(function*(){return this.provider.getBigMapKeysByID(this.id.toString(),t,this.schema,e,r)}))}toJSON(){return this.id.toString()}toString(){return this.id.toString()}}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.MichelCodecParser=void 0;const i=r(175),o=r(51),s=r(62);e.MichelCodecParser=class{constructor(t){this.context=t}getNextProto(){return n(this,void 0,void 0,(function*(){if(!this.context.proto){const t=yield this.context.readProvider.getNextProtocol("head");this.context.proto=t}return this.context.proto}))}parseScript(t){return n(this,void 0,void 0,(function*(){return new i.Parser({protocol:yield this.getNextProto()}).parseScript(t)}))}parseMichelineExpression(t){return n(this,void 0,void 0,(function*(){return new i.Parser({protocol:yield this.getNextProto()}).parseMichelineExpression(t)}))}parseJSON(t){return n(this,void 0,void 0,(function*(){return new i.Parser({protocol:yield this.getNextProto()}).parseJSON(t)}))}prepareCodeOrigination(t){return n(this,void 0,void 0,(function*(){const e=t;if(e.code=yield this.formatCodeParam(t.code),t.init)e.init=yield this.formatInitParam(t.init);else if(t.storage){const r=e.code.find((t=>"prim"in t&&"storage"===t.prim));if(!(null==r?void 0:r.args))throw new o.InvalidCodeParameter("The storage section is missing from the script",t.code);const n=new s.Schema(r.args[0]),a=yield this.findGlobalConstantsHashAndValue(n);if(0!==Object.keys(a).length){const n=new i.Parser({expandGlobalConstant:a}).parseJSON(r.args[0]),o=new s.Schema(n);e.init=o.Encode(t.storage)}else e.init=n.Encode(t.storage);delete e.storage}return e}))}formatCodeParam(t){return n(this,void 0,void 0,(function*(){let e;if("string"==typeof t){const r=yield this.parseScript(t);if(null===r)throw new o.InvalidCodeParameter("Invalid code parameter",t);e=r}else{const r=yield this.parseJSON(t),n=["parameter","storage","code"];e=r.sort(((t,e)=>n.indexOf(t.prim)-n.indexOf(e.prim)))}return e}))}formatInitParam(t){return n(this,void 0,void 0,(function*(){let e;if("string"==typeof t){const r=yield this.parseMichelineExpression(t);if(null===r)throw new o.InvalidInitParameter("Invalid init parameter",t);e=r}else e=yield this.parseJSON(t);return e}))}findGlobalConstantsHashAndValue(t){return n(this,void 0,void 0,(function*(){const e=t.findToken("constant"),r={};if(0!==e.length)for(const t of e){const e=t.tokenVal.args;if(e){const t=e[0].string,n=yield this.context.globalConstantsProvider.getGlobalConstantByHash(t);Object.assign(r,{[t]:n})}}return r}))}}},function(t,e,r){"use strict";r.r(e),r.d(e,"Contract",(function(){return qe})),r.d(e,"DefaultProtocol",(function(){return p})),r.d(e,"JSONParseError",(function(){return L})),r.d(e,"MacroError",(function(){return v})),r.d(e,"MichelineParseError",(function(){return C})),r.d(e,"MichelsonError",(function(){return tt})),r.d(e,"MichelsonInstructionError",(function(){return Oe})),r.d(e,"MichelsonTypeError",(function(){return rt})),r.d(e,"MichelsonValidationError",(function(){return Et})),r.d(e,"Parser",(function(){return F})),r.d(e,"ProtoGreaterOfEqual",(function(){return g})),r.d(e,"ProtoInferiorTo",(function(){return m})),r.d(e,"Protocol",(function(){return d})),r.d(e,"VERSION",(function(){return Xe})),r.d(e,"assertContractValid",(function(){return Be})),r.d(e,"assertDataListIfAny",(function(){return Yt})),r.d(e,"assertDataValid",(function(){return Fe})),r.d(e,"assertMichelsonBigMapStorableType",(function(){return Dt})),r.d(e,"assertMichelsonComparableType",(function(){return Nt})),r.d(e,"assertMichelsonContract",(function(){return Ht})),r.d(e,"assertMichelsonData",(function(){return Kt})),r.d(e,"assertMichelsonInstruction",(function(){return Mt})),r.d(e,"assertMichelsonPackableType",(function(){return kt})),r.d(e,"assertMichelsonPassableType",(function(){return jt})),r.d(e,"assertMichelsonPushableType",(function(){return Ct})),r.d(e,"assertMichelsonStorableType",(function(){return Lt})),r.d(e,"assertMichelsonType",(function(){return Ft})),r.d(e,"assertTypeAnnotationsValid",(function(){return Ie})),r.d(e,"assertTypesEqual",(function(){return Ke})),r.d(e,"assertViewNameValid",(function(){return Bt})),r.d(e,"contractEntryPoint",(function(){return De})),r.d(e,"contractEntryPoints",(function(){return Ue})),r.d(e,"contractSection",(function(){return Ce})),r.d(e,"contractViews",(function(){return Le})),r.d(e,"decodeAddressBytes",(function(){return Ee})),r.d(e,"decodePublicKeyBytes",(function(){return Ae})),r.d(e,"decodePublicKeyHashBytes",(function(){return Se})),r.d(e,"dummyContract",(function(){return We})),r.d(e,"emitMicheline",(function(){return G})),r.d(e,"formatError",(function(){return Ze})),r.d(e,"formatStack",(function(){return Ye})),r.d(e,"functionType",(function(){return Ve})),r.d(e,"instructionIDs",(function(){return yt})),r.d(e,"isContractValid",(function(){return $e})),r.d(e,"isDataValid",(function(){return Ge})),r.d(e,"isInstruction",(function(){return Wt})),r.d(e,"isMichelsonCode",(function(){return zt})),r.d(e,"isMichelsonData",(function(){return Gt})),r.d(e,"isMichelsonError",(function(){return et})),r.d(e,"isMichelsonScript",(function(){return $t})),r.d(e,"isMichelsonType",(function(){return qt})),r.d(e,"isTypeAnnotationsValid",(function(){return He})),r.d(e,"isTypeEqual",(function(){return ze})),r.d(e,"packData",(function(){return ge})),r.d(e,"packDataBytes",(function(){return me})),r.d(e,"refContract",(function(){return l})),r.d(e,"sourceReference",(function(){return n})),r.d(e,"traceDumpFunc",(function(){return Je})),r.d(e,"unpackData",(function(){return we})),r.d(e,"unpackDataBytes",(function(){return _e}));const n=Symbol("source_reference");class i extends Error{constructor(t,e,r){super(r),this.src=t,this.idx=e,Object.setPrototypeOf(this,i.prototype)}}var o;!function(t){t[t.Comment=0]="Comment",t[t.Number=1]="Number",t[t.String=2]="String",t[t.Bytes=3]="Bytes",t[t.Ident=4]="Ident"}(o||(o={}));const s=new RegExp("\\s"),a=new RegExp("[:@%_A-Za-z]"),c=new RegExp("[@%_\\.A-Za-z0-9]"),u=new RegExp("[0-9]"),f=new RegExp("[0-9a-fA-F]");function*h(t,e=!1){let r=0;for(;r<t.length;){for(;r<t.length&&s.test(t[r]);)r++;if(r===t.length)return;const n=t[r],h=r;if(a.test(n)){for(r++;r<t.length&&c.test(t[r]);)r++;yield{t:o.Ident,v:t.slice(h,r),first:h,last:r}}else if(t.length-r>1&&"0x"===t.substr(r,2)){for(r+=2;r<t.length&&f.test(t[r]);)r++;if(0!=(r-h&1))throw new i(t,r,"Bytes literal length is expected to be power of two");yield{t:o.Bytes,v:t.slice(h,r),first:h,last:r}}else if(u.test(n)||"-"===n){"-"===n&&r++;const e=r;for(;r<t.length&&u.test(t[r]);)r++;if(e===r)throw new i(t,r,"Number literal is too short");yield{t:o.Number,v:t.slice(h,r),first:h,last:r}}else if('"'===n){r++;let e=!1;for(;r<t.length&&(e||'"'!==t[r]);r++)e=!e&&"\\"===t[r];if(r===t.length)throw new i(t,r,"Unterminated string literal");r++,yield{t:o.String,v:t.slice(h,r),first:h,last:r}}else if("#"===n){for(r++;r<t.length&&"\n"!==t[r];)r++;e&&(yield{t:o.Comment,v:t.slice(h,r),first:h,last:r})}else if(t.length-r>1&&"/*"===t.substr(r,2)){for(r+=2;r<t.length&&!(t.length-r>1&&"*/"===t.substr(r,2));)r++;if(r===t.length)throw new i(t,r,"Unterminated C style comment");r+=2,e&&(yield{t:o.Comment,v:t.slice(h,r),first:h,last:r})}else{if("("!==n&&")"!==n&&"{"!==n&&"}"!==n&&";"!==n)throw new i(t,r,`Invalid character at offset ${r}: \`${n}'`);r++,yield{t:n,v:n,first:h,last:r}}}}const l=Symbol("ref_contract");var d;!function(t){t.Ps9mPmXa="Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P",t.PtCJ7pwo="PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY",t.PsYLVpVv="PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt",t.PsddFKi3="PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP",t.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",t.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",t.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",t.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",t.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",t.PtEdoTez="PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq",t.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",t.PsFLoren="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",t.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",t.PtGRANAD="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",t.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",t.PtHangzH="PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r",t.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",t.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",t.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",t.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"}(d||(d={}));const p=d.Psithaca2,b={Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P:0,PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY:1,PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt:2,PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP:3,Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd:4,PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU:5,PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS:5,PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb:6,PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo:7,PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq:8,PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA:8,PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i:9,PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV:10,PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r:11,PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx:11,PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP:12,Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A:13,ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK:14};function g(t,e){return b[t]>=b[e]}function m(t,e){return b[t]<b[e]}class v extends Error{constructor(t,e){super(e),this.prim=t,Object.setPrototypeOf(this,v.prototype)}}function y(t,e){var r,n;if(0===e&&void 0===t.args||(null===(r=t.args)||void 0===r?void 0:r.length)===e)return!0;throw new v(t,`macro ${t.prim} expects ${e} arguments, was given ${null===(n=t.args)||void 0===n?void 0:n.length}`)}function w(t){if(void 0===t.annots)return!0;throw new v(t,`unexpected annotation on macro ${t.prim}: ${t.annots}`)}function _(t,e){if("int"in e)return!0;throw new v(t,`macro ${t.prim} expects int argument`)}function E(t,e,r,n){let i=0,o=0;const s=[null,null];let a;if(i===e.length)throw new v(t,`unexpected end: ${t.prim}`);let c,u=e[i++];switch(u){case"P":{const{r:s,n:c,an:u}=E(t,e.slice(i),r.slice(o),n);a=s,i+=c,o+=u;break}case"A":o!==r.length&&(s[0]=r[o++]);break;default:throw new v(t,`${t.prim}: unexpected character: ${u}`)}if(i===e.length)throw new v(t,`unexpected end: ${t.prim}`);switch(u=e[i++],u){case"P":{const{r:s,n:a,an:u}=E(t,e.slice(i),r.slice(o),n);c=s.map((([t,e])=>[t+1,e])),i+=a,o+=u;break}case"I":o!==r.length&&(s[1]=r[o++]);break;default:throw new v(t,`${t.prim}: unexpected character: ${u}`)}return{r:n(a,c,[0,s]),n:i,an:o}}function S(t,e,r,n){const i=e[0];switch(i){case"A":return e.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CAR",annots:["@%%"]},S(t,e.slice(1),[],n)]]},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%@","%@",...r]}]:n.a;case"D":return e.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CDR",annots:["@%%"]},S(t,e.slice(1),[],n)]]},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%@",...r]}]:n.d;default:throw new v(t,`${t.prim}: unexpected character: ${i}`)}}function A(t,e){let r=t.length;for(;r>0&&t[r-1]===e;)r--;return t.slice(0,r)}function O(t){const e=[],r=[];if(void 0!==t)for(const n of t)(0!==n.length&&"%"===n[0]?e:r).push(n);return{fields:e,rest:r}}function x({prim:t,annots:e,args:r}){return Object.assign(Object.assign({prim:t},e&&{annots:e}),r&&{args:r})}const T=/^P[PAI]{3,}R$/,P=/^UNP[PAI]{2,}R$/,R=/^C[AD]{2,}R$/,I=/^SET_C[AD]+R$/,M=/^MAP_C[AD]+R$/,N=/^DI{2,}P$/,k=/^DU+P$/;class C extends Error{constructor(t,e){super(e),this.token=t,Object.setPrototypeOf(this,C.prototype)}}class L extends Error{constructor(t,e){super(e),this.node=t,Object.setPrototypeOf(this,L.prototype)}}const j=new C(null,"Unexpected EOF");function D(t){return t.t===o.Ident&&("@"===t.v[0]||"%"===t.v[0]||":"===t.v[0])}const U=new RegExp("^-?[0-9]+$"),B=new RegExp("^([0-9a-fA-F]{2})*$");class F{constructor(t){this.opt=t}expand(t){var e,r,i;if(void 0!==(null===(e=this.opt)||void 0===e?void 0:e.expandGlobalConstant)&&"constant"===t.prim){const e=function(t,e){return void 0!==t.args&&1===t.args.length&&"string"in t.args[0]&&t.args[0].string in e?e[t.args[0].string]:t}(t,this.opt.expandGlobalConstant);return e!==t&&(e[n]=Object.assign(Object.assign({},t[n]||{first:0,last:0}),{globalConstant:t})),e}if(void 0===(null===(r=this.opt)||void 0===r?void 0:r.expandMacros)||(null===(i=this.opt)||void 0===i?void 0:i.expandMacros)){const e=function(t,e){const r=(null==e?void 0:e.protocol)||p;function n(t){return void 0!==t?[{prim:"RENAME",annots:t}]:[]}switch(t.prim){case"CMPEQ":case"CMPNEQ":case"CMPLT":case"CMPGT":case"CMPLE":case"CMPGE":if(y(t,0))return[{prim:"COMPARE"},x({prim:t.prim.slice(3),annots:t.annots})];break;case"IFEQ":case"IFNEQ":case"IFLT":case"IFGT":case"IFLE":case"IFGE":if(y(t,2))return[{prim:t.prim.slice(2)},x({prim:"IF",annots:t.annots,args:t.args})];break;case"IFCMPEQ":case"IFCMPNEQ":case"IFCMPLT":case"IFCMPGT":case"IFCMPLE":case"IFCMPGE":if(y(t,2))return[{prim:"COMPARE"},{prim:t.prim.slice(5)},x({prim:"IF",annots:t.annots,args:t.args})];break;case"FAIL":if(y(t,0)&&w(t))return[{prim:"UNIT"},{prim:"FAILWITH"}];break;case"ASSERT":if(y(t,0)&&w(t))return[{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_EQ":case"ASSERT_NEQ":case"ASSERT_LT":case"ASSERT_GT":case"ASSERT_LE":case"ASSERT_GE":if(y(t,0)&&w(t))return[{prim:t.prim.slice(7)},{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_CMPEQ":case"ASSERT_CMPNEQ":case"ASSERT_CMPLT":case"ASSERT_CMPGT":case"ASSERT_CMPLE":case"ASSERT_CMPGE":if(y(t,0)&&w(t))return[[{prim:"COMPARE"},{prim:t.prim.slice(10)}],{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_NONE":if(y(t,0)&&w(t))return[{prim:"IF_NONE",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_SOME":if(y(t,0))return[{prim:"IF_NONE",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],n(t.annots)]}];break;case"ASSERT_LEFT":if(y(t,0))return[{prim:"IF_LEFT",args:[n(t.annots),[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_RIGHT":if(y(t,0))return[{prim:"IF_LEFT",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],n(t.annots)]}];break;case"IF_SOME":if(y(t,2))return[x({prim:"IF_NONE",annots:t.annots,args:[t.args[1],t.args[0]]})];break;case"IF_RIGHT":if(y(t,2))return[x({prim:"IF_LEFT",annots:t.annots,args:[t.args[1],t.args[0]]})];break;case"CAR":case"CDR":if(void 0===t.args)return t;if(y(t,1)&&_(t,t.args[0])){const e=parseInt(t.args[0].int,10);return x({prim:"GET",args:[{int:"CAR"===t.prim?String(2*e+1):String(2*e)}],annots:t.annots})}}if(T.test(t.prim)&&y(t,0)){const{fields:e,rest:r}=O(t.annots),{r:n}=E(t,t.prim.slice(1),e,((t,e,r)=>[...t||[],...e||[],r]));return n.map((([t,e],i)=>{const o=[...A(e,null).map((t=>null===t?"%":t)),...0===t&&i===n.length-1?r:[]],s=x({prim:"PAIR",annots:0!==o.length?o:void 0});return 0===t?s:{prim:"DIP",args:1===t?[[s]]:[{int:String(t)},[s]]}}))}if(P.test(t.prim)){if(m(r,d.PtEdo2Zk)&&y(t,0)){const{r:e}=E(t,t.prim.slice(3),t.annots||[],((t,e,r)=>[r,...e||[],...t||[]]));return e.map((([t,e])=>{const r=[{prim:"DUP"},x({prim:"CAR",annots:null!==e[0]?[e[0]]:void 0}),{prim:"DIP",args:[[x({prim:"CDR",annots:null!==e[1]?[e[1]]:void 0})]]}];return 0===t?r:{prim:"DIP",args:1===t?[[r]]:[{int:String(t)},[r]]}}))}if("UNPAIR"===t.prim)return t;if(y(t,0)){const{r:e}=E(t,t.prim.slice(3),[],((t,e,r)=>[r,...e||[],...t||[]]));return e.map((([t])=>{const e=x({prim:"UNPAIR"});return 0===t?e:{prim:"DIP",args:1===t?[[e]]:[{int:String(t)},[e]]}}))}}if(R.test(t.prim)&&y(t,0)){const e=[...t.prim.slice(1,t.prim.length-1)];return e.map(((r,n)=>{const i=n===e.length-1?t.annots:void 0;switch(r){case"A":return x({prim:"CAR",annots:i});case"D":return x({prim:"CDR",annots:i});default:throw new v(t,`unexpected character: ${r}`)}}))}if(I.test(t.prim)&&y(t,0)){const{fields:e,rest:r}=O(t.annots);if(e.length>1)throw new v(t,`unexpected annotation on macro ${t.prim}: ${e}`);const n=0!==e.length?{a:[{prim:"DUP"},{prim:"CAR",annots:e},{prim:"DROP"},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:[e[0],"%@"]}],d:[{prim:"DUP"},{prim:"CDR",annots:e},{prim:"DROP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",e[0]]}]}:{a:[{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%","%@"]}],d:[{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%"]}]};return S(t,t.prim.slice(5,t.prim.length-1),r,n)}if(M.test(t.prim)&&y(t,1)){const{fields:e}=O(t.annots);if(e.length>1)throw new v(t,`unexpected annotation on macro ${t.prim}: ${e}`);const r={a:[{prim:"DUP"},{prim:"CDR",annots:["@%%"]},{prim:"DIP",args:[[x({prim:"CAR",annots:0!==e.length?["@"+e[0].slice(1)]:void 0}),t.args[0]]]},{prim:"SWAP"},{prim:"PAIR",annots:[0!==e.length?e[0]:"%","%@"]}],d:[{prim:"DUP"},x({prim:"CDR",annots:0!==e.length?["@"+e[0].slice(1)]:void 0}),t.args[0],{prim:"SWAP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",0!==e.length?e[0]:"%"]}]};return S(t,t.prim.slice(5,t.prim.length-1),[],r)}if(N.test(t.prim)&&y(t,1)){let e=0;for(;"I"===t.prim[1+e];)e++;return x({prim:"DIP",args:[{int:String(e)},t.args[0]]})}if(k.test(t.prim)){let e=0;for(;"U"===t.prim[1+e];)e++;if(m(r,d.PtEdo2Zk)){if(1===e){if(void 0===t.args)return t;y(t,1)&&_(t,t.args[0])&&(e=parseInt(t.args[0].int,10))}else y(t,0);return 1===e?[x({prim:"DUP",annots:t.annots})]:2===e?[{prim:"DIP",args:[[x({prim:"DUP",annots:t.annots})]]},{prim:"SWAP"}]:[{prim:"DIP",args:[{int:String(e-1)},[x({prim:"DUP",annots:t.annots})]]},{prim:"DIG",args:[{int:String(e)}]}]}if(1===e)return t;if(y(t,0))return x({prim:"DUP",args:[{int:String(e)}],annots:t.annots})}return t}(t,this.opt);return e!==t&&(e[n]=Object.assign(Object.assign({},t[n]||{first:0,last:0}),{macro:t})),e}return t}parseListExpr(t,e){var r;const i={first:e.first,last:e.last},s="("===e.t;let a;if(s){if(a=t.next(),a.done)throw j;i.last=a.value.last}else a={value:e};if(a.value.t!==o.Ident)throw new C(a.value,`not an identifier: ${a.value.v}`);const c={prim:a.value.v,[n]:i};for(;;){const e=t.next();if(e.done){if(s)throw j;break}if(")"===e.value.t){if(!s)throw new C(e.value,"unexpected closing bracket");i.last=e.value.last;break}if(D(e.value))c.annots=c.annots||[],c.annots.push(e.value.v),i.last=e.value.last;else{c.args=c.args||[];const o=this.parseExpr(t,e.value);i.last=(null===(r=o[n])||void 0===r?void 0:r.last)||i.last,c.args.push(o)}}return this.expand(c)}parseArgs(t,e){var r;const i={first:e.first,last:e.last},o={prim:e.v,[n]:i};for(;;){const e=t.next();if(e.done||"}"===e.value.t||";"===e.value.t)return[o,e];if(D(e.value))i.last=e.value.last,o.annots=o.annots||[],o.annots.push(e.value.v);else{const s=this.parseExpr(t,e.value);i.last=(null===(r=s[n])||void 0===r?void 0:r.last)||i.last,o.args=o.args||[],o.args.push(s)}}}parseSequenceExpr(t,e){var r,i;const s={first:e.first,last:e.last},a=[];a[n]=s;const c="{"===e.t;let u="{"===e.t?null:{value:e};for(;;){if(null===u&&(u=t.next(),u.done||(s.last=u.value.last)),u.done){if(c)throw j;return a}if("}"===u.value.t){if(c)return a;throw new C(u.value,"unexpected closing bracket")}if(u.value.t===o.Ident){const[e,i]=this.parseArgs(t,u.value);s.last=(null===(r=e[n])||void 0===r?void 0:r.last)||s.last,a.push(this.expand(e)),u=i}else{const e=this.parseExpr(t,u.value);s.last=(null===(i=e[n])||void 0===i?void 0:i.last)||s.last,a.push(e),u=null}null===u&&(u=t.next(),u.done||(s.last=u.value.last)),u.done||";"!==u.value.t||(u=null)}}parseExpr(t,e){switch(e.t){case o.Ident:return this.expand({prim:e.v,[n]:{first:e.first,last:e.last}});case o.Number:return{int:e.v,[n]:{first:e.first,last:e.last}};case o.String:return{string:JSON.parse(e.v),[n]:{first:e.first,last:e.last}};case o.Bytes:return{bytes:e.v.slice(2),[n]:{first:e.first,last:e.last}};case"{":return this.parseSequenceExpr(t,e);default:return this.parseListExpr(t,e)}}parseSequence(t){if("string"!=typeof t)throw new TypeError(`string type was expected, got ${typeof t} instead`);const e=h(t),r=e.next();return r.done?null:this.parseSequenceExpr(e,r.value)}parseList(t){if("string"!=typeof t)throw new TypeError(`string type was expected, got ${typeof t} instead`);const e=h(t),r=e.next();return r.done?null:this.parseListExpr(e,r.value)}parseMichelineExpression(t){if("string"!=typeof t)throw new TypeError(`string type was expected, got ${typeof t} instead`);const e=h(t),r=e.next();return r.done?null:this.parseExpr(e,r.value)}parseScript(t){return this.parseSequence(t)}parseData(t){return this.parseList(t)}parseJSON(t){if("object"!=typeof t)throw new TypeError(`object type was expected, got ${typeof t} instead`);if(Array.isArray(t)){const e=[];for(const r of t){if(null===r||"object"!=typeof r)throw new L(r,`unexpected sequence element: ${r}`);e.push(this.parseJSON(r))}return e}if("prim"in t){const e=t;if("string"==typeof e.prim&&(void 0===e.annots||Array.isArray(e.annots))&&(void 0===e.args||Array.isArray(e.args))){const t={prim:e.prim};if(void 0!==e.annots){for(const t of e.annots)if("string"!=typeof t)throw new L(t,`string expected: ${t}`);t.annots=e.annots}if(void 0!==e.args){t.args=[];for(const r of e.args){if(null===r||"object"!=typeof r)throw new L(r,`unexpected argument: ${r}`);t.args.push(this.parseJSON(r))}}return this.expand(t)}throw new L(t,`malformed prim expression: ${t}`)}if("string"in t){if("string"==typeof t.string)return{string:t.string};throw new L(t,`malformed string literal: ${t}`)}if("int"in t){if("string"==typeof t.int&&U.test(t.int))return{int:t.int};throw new L(t,`malformed int literal: ${t}`)}if("bytes"in t){if("string"==typeof t.bytes&&B.test(t.bytes))return{bytes:t.bytes};throw new L(t,`malformed bytes literal: ${t}`)}throw new L(t,`unexpected object: ${t}`)}}class V{constructor(t,e=0){this.opt=t,this.lev=e}indent(t=0){var e;let r="";if(void 0!==(null===(e=this.opt)||void 0===e?void 0:e.indent))for(let e=this.lev+t;e>0;e--)r+=this.opt.indent;return r}get lf(){var t;return(null===(t=this.opt)||void 0===t?void 0:t.newline)||""}get lfsp(){var t;return(null===(t=this.opt)||void 0===t?void 0:t.newline)||" "}down(t){return new V(this.opt,this.lev+t)}}function K(t){return"prim"in t&&(void 0!==t.annots&&0!==t.annots.length||void 0!==t.args&&0!==t.args.length)}function H(t){if(void 0!==t.args)for(const e of t.args)if(Array.isArray(e)||K(e))return!0;return!1}function $(t,e,r){var i;const o=null===(i=t[n])||void 0===i?void 0:i.macro;if(r&&o)return $(o,e,r);if(Array.isArray(t))return function(t,e,r){let n="{"+e.lf,i=t.length;for(const o of t){if(n+=e.indent(1),"prim"in o){if(n+=o.prim,void 0!==o.annots)for(const t of o.annots)n+=" "+t;if(void 0!==o.args){const t=H(o);for(const i of o.args)n+=t?e.lfsp+e.indent(2)+$(i,e.down(2),r):" "+$(i,e,r)}}else n+=$(o,e.down(1),r);n+=i>1?";"+e.lfsp:e.lf,i--}return n+e.indent()+"}"}(t,e,r);if("string"in t)return JSON.stringify(t.string);if("int"in t)return t.int;if("bytes"in t)return"0x"+t.bytes;{if(!(void 0!==t.annots&&0!==t.annots.length||void 0!==t.args&&0!==t.args.length))return t.prim;let n="("+t.prim;if(void 0!==t.annots)for(const e of t.annots)n+=" "+e;if(void 0!==t.args){const i=H(t);for(const o of t.args)n+=i?e.lfsp+e.indent(1)+$(o,e.down(1),r):" "+$(o,e,r)}return n+")"}}function G(t,e,r=!1){if("object"!=typeof t)throw new TypeError(`object type was expected, got ${typeof t} instead`);return $(t,new V(e),r)}const z=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],q=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];function W(t){const e=(t.length+9)%64,r=0===e?0:64-e;if(t.length>268435455)throw new Error(`sha256: message length is too big: ${t.length}`);const n=t.length<<3,i=[...t,128,...new Array(r).fill(0),0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n];function o(t,e){return t>>>e|t<<32-e}const s=[...z],a=new Array(64),c=new Array(8);for(let t=0;t<i.length;t+=64){let e=t,r=0;for(;r<16;)a[r]=i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3],e+=4,r++;for(;r<64;){const t=o(a[r-15],7)^o(a[r-15],18)^a[r-15]>>>3,e=o(a[r-2],17)^o(a[r-2],19)^a[r-2]>>>10;a[r]=(0|e)+a[r-7]+t+a[r-16]|0,r++}for(let t=0;t<8;t++)c[t]=s[t];for(let t=0;t<64;t++){const e=o(c[0],2)^o(c[0],13)^o(c[0],22),r=o(c[4],6)^o(c[4],11)^o(c[4],25),n=c[7]+r+(c[4]&c[5]^~c[4]&c[6])+q[t]+a[t]|0,i=e+(c[0]&c[1]^c[0]&c[2]^c[1]&c[2])|0;c[7]=c[6],c[6]=c[5],c[5]=c[4],c[4]=c[3]+n|0,c[3]=c[2],c[2]=c[1],c[1]=c[0],c[0]=n+i|0}for(let t=0;t<8;t++)s[t]=s[t]+c[t]|0}const u=[];for(const t of s)u.push(t>>24&255),u.push(t>>16&255),u.push(t>>8&255),u.push(255&t);return u}const Y=[0,1,2,3,4,5,6,7,8,-1,-1,-1,-1,-1,-1,-1,9,10,11,12,13,14,15,16,-1,17,18,19,20,21,-1,22,23,24,25,26,27,28,29,30,31,32,-1,-1,-1,-1,-1,-1,33,34,35,36,37,38,39,40,41,42,43,-1,44,45,46,47,48,49,50,51,52,53,54,55,56,57],J=[0,1,2,3,4,5,6,7,8,16,17,18,19,20,21,22,23,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,41,48,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,72,73];function Z(t,e){const r=t.charCodeAt(e)-49;if(r>=Y.length||-1===Y[r])throw new Error(`Base58 decoding error: unexpected character at position ${e}: ${t[e]}`);return Y[r]}function X(t){const e=function(t){const e=[];let r=0;for(;r<t.length&&0===Z(t,r);)r++;let n=r;for(;r<t.length;){let n=Z(t,r++),i=0;for(;0!==n||i<e.length;){const t=58*(e[i]||0)+n;e[i++]=t%256,n=Math.floor(t/256)}}for(;n-- >0;)e.push(0);return e.reverse()}(t);if(e.length<4)throw new Error(`Base58Check decoding error: data is too short ${e.length}`);const r=e.slice(0,e.length-4),n=e.slice(e.length-4),i=W(W(r));if(n[0]!==i[0]||n[1]!==i[1]||n[2]!==i[2]||n[3]!==i[3])throw new Error("Base58Check decoding error: invalid checksum");return r}function Q(t){const e=W(W(t));return function(t){const e=[];let r=0;for(;r<t.length&&0===t[r];)r++;let n=r;for(;r<t.length;){let n=t[r++],i=0;for(;0!==n||i<e.length;){const t=256*(e[i]||0)+n;e[i++]=t%58,n=Math.floor(t/58)}}for(;n-- >0;)e.push(0);return e.reverse(),String.fromCharCode(...e.map((t=>J[t]+49)))}([...t,...e.slice(0,4)])}class tt extends Error{constructor(t,e){super(e),this.val=t,Object.setPrototypeOf(this,tt.prototype)}}function et(t){return t instanceof tt}class rt extends tt{constructor(t,e,r){super(t,r),void 0!==e&&(this.data=e),Object.setPrototypeOf(this,rt.prototype)}}class nt{constructor(t){if(this.neg=!1,this.buf=[],void 0!==t)if("string"==typeof t)for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(0===e&&45===r)this.neg=!0;else{if(r<48||r>57)throw new Error(`unexpected character in integer constant: ${t[e]}`);this.append(r-48)}}else t<0?(this.neg=!0,this.append(-t)):this.append(t)}append(t){let e=0;for(;0!==t||e<this.buf.length;){const r=10*(this.buf[e]||0)+t;this.buf[e++]=r%256,t=Math.floor(r/256)}}cmp(t){if(this.neg!==t.neg)return(t.neg?1:0)-(this.neg?1:0);{let e=0;if(this.buf.length!==t.buf.length)e=this.buf.length<t.buf.length?-1:1;else if(0!==this.buf.length){let r=t.buf.length-1;for(;r>=0&&this.buf[r]===t.buf[r];)r--;e=r<0?0:this.buf[r]<t.buf[r]?-1:1}return this.neg?0===e?0:-e:e}}get sign(){return 0===this.buf.length?0:this.neg?-1:1}}function it(t){const e=[];for(let r=0;r<t.length;r+=2){const n=parseInt(t.slice(r,r+2),16);if(Number.isNaN(n))return null;e.push(n)}return e}function ot(t){try{return new nt(t),!0}catch(t){return!1}}function st(t){try{return new nt(t).sign>=0}catch(t){return!1}}const at=/^(@%|@%%|%@|[@:%]([_0-9a-zA-Z][_0-9a-zA-Z.%@]*)?)$/;function ct(t,e){if(Array.isArray(t))return{};let r,n,i;if(void 0!==t.annots)for(const o of t.annots)if(0!==o.length){if(!at.test(o)||!(null==e?void 0:e.specialVar)&&("@%"===o||"@%%"===o)||!(null==e?void 0:e.specialFields)&&"%@"===o)throw new tt(t,`${t.prim}: unexpected annotation: ${o}`);switch(o[0]){case"%":((null==e?void 0:e.emptyFields)||o.length>1)&&(r=r||[],r.push(o));break;case":":o.length>1&&(n=n||[],n.push(o));break;case"@":((null==e?void 0:e.emptyVar)||o.length>1)&&(i=i||[],i.push(o))}}return{f:r,t:n,v:i}}const ut={BlockHash:[32,[1,52]],OperationHash:[32,[5,116]],OperationListHash:[32,[133,233]],OperationListListHash:[32,[29,159,109]],ProtocolHash:[32,[2,170]],ContextHash:[32,[79,199]],ED25519PublicKeyHash:[20,[6,161,159]],SECP256K1PublicKeyHash:[20,[6,161,161]],P256PublicKeyHash:[20,[6,161,164]],ContractHash:[20,[2,90,121]],CryptoboxPublicKeyHash:[16,[153,103]],ED25519Seed:[32,[13,15,58,7]],ED25519PublicKey:[32,[13,15,37,217]],SECP256K1SecretKey:[32,[17,162,224,201]],P256SecretKey:[32,[16,81,238,189]],ED25519EncryptedSeed:[56,[7,90,60,179,41]],SECP256K1EncryptedSecretKey:[56,[9,237,241,174,150]],P256EncryptedSecretKey:[56,[9,48,57,115,171]],SECP256K1PublicKey:[33,[3,254,226,86]],P256PublicKey:[33,[3,178,139,127]],SECP256K1Scalar:[33,[38,248,136]],SECP256K1Element:[33,[5,92,0]],ED25519SecretKey:[64,[43,246,78,7]],ED25519Signature:[64,[9,245,205,134,18]],SECP256K1Signature:[64,[13,115,101,19,63]],P256Signature:[64,[54,240,44,52]],GenericSignature:[64,[4,130,43]],ChainID:[4,[87,82,0]]};function ft(t,...e){const r=X(t);for(const t of e){const[e,n]=ut[t];if(r.length===e+n.length){let e=0;for(;e<n.length&&r[e]===n[e];)e++;if(e===n.length)return[t,r.slice(n.length)]}}return null}function ht(t,e){const[r,n]=ut[t];if(e.length!==r)throw new Error(`incorrect data length for ${t}: ${e.length}`);return Q([...n,...e])}function lt(t,e){const r=e,n=Array.isArray(r)?r:r.args;if(2===n.length){return"pair"===t?{prim:"pair",args:n}:{prim:"Pair",args:n}}return Object.assign(Object.assign({},Array.isArray(r)?{prim:t}:r),{args:[n[0],{prim:t,args:n.slice(1)}]})}function dt(t){return Array.isArray(t)||"pair"===t.prim}function pt(t){return Array.isArray(t)||"prim"in t&&"Pair"===t.prim}const bt=/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])[T ]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):([0-5][0-9]))$/;function gt(t){if("string"in t){if(st(t.string))return new Date(parseInt(t.string,10));if(bt.test(t.string)){const e=new Date(t.string);if(!Number.isNaN(e.valueOf))return e}}else if(ot(t.int))return new Date(parseInt(t.int,10));return null}function mt(t){return t.map((t=>(t>>4&15).toString(16)+(15&t).toString(16))).join("")}const vt={ABS:!0,ADD:!0,ADDRESS:!0,AMOUNT:!0,AND:!0,APPLY:!0,BALANCE:!0,BLAKE2B:!0,CAR:!0,CDR:!0,CHAIN_ID:!0,CHECK_SIGNATURE:!0,COMPARE:!0,CONCAT:!0,CONS:!0,EDIV:!0,EQ:!0,EXEC:!0,FAILWITH:!0,GE:!0,GET_AND_UPDATE:!0,GT:!0,HASH_KEY:!0,IMPLICIT_ACCOUNT:!0,INT:!0,ISNAT:!0,JOIN_TICKETS:!0,KECCAK:!0,LE:!0,LEVEL:!0,LSL:!0,LSR:!0,LT:!0,MEM:!0,MUL:!0,NEG:!0,NEQ:!0,NEVER:!0,NOT:!0,NOW:!0,OR:!0,PACK:!0,PAIRING_CHECK:!0,READ_TICKET:!0,SAPLING_VERIFY_UPDATE:!0,SELF:!0,SELF_ADDRESS:!0,SENDER:!0,SET_DELEGATE:!0,SHA256:!0,SHA3:!0,SHA512:!0,SIZE:!0,SLICE:!0,SOME:!0,SOURCE:!0,SPLIT_TICKET:!0,SUB:!0,SWAP:!0,TICKET:!0,TOTAL_VOTING_POWER:!0,TRANSFER_TOKENS:!0,UNIT:!0,VOTING_POWER:!0,XOR:!0,RENAME:!0,OPEN_CHEST:!0,SUB_MUTEZ:!0},yt=Object.assign({},vt,{CONTRACT:!0,CREATE_CONTRACT:!0,DIG:!0,DIP:!0,DROP:!0,DUG:!0,DUP:!0,EMPTY_BIG_MAP:!0,EMPTY_MAP:!0,EMPTY_SET:!0,GET:!0,IF:!0,IF_CONS:!0,IF_LEFT:!0,IF_NONE:!0,ITER:!0,LAMBDA:!0,LEFT:!0,LOOP:!0,LOOP_LEFT:!0,MAP:!0,NIL:!0,NONE:!0,PAIR:!0,PUSH:!0,RIGHT:!0,SAPLING_EMPTY_STATE:!0,UNPACK:!0,UNPAIR:!0,UPDATE:!0,CAST:!0,VIEW:!0}),wt={unit:!0,never:!0,bool:!0,int:!0,nat:!0,string:!0,chain_id:!0,bytes:!0,mutez:!0,key_hash:!0,key:!0,signature:!0,timestamp:!0,address:!0},_t=Object.assign({},wt,{or:!0,pair:!0,set:!0,big_map:!0,contract:!0,lambda:!0,list:!0,map:!0,operation:!0,option:!0,bls12_381_g1:!0,bls12_381_g2:!0,bls12_381_fr:!0,sapling_transaction:!0,sapling_state:!0,ticket:!0,chest_key:!0,chest:!0});class Et extends tt{constructor(t,e){super(t,e),this.val=t,Object.setPrototypeOf(this,Et.prototype)}}function St(t){return"prim"in t}function At(t){if(St(t))return!0;throw new Et(t,"prim expression expected")}function Ot(t){if(Array.isArray(t))return!0;throw new Et(t,"sequence expression expected")}function xt(t){if(function(t){return Array.isArray(t)||"prim"in t}(t))return!0;throw new Et(t,"prim or sequence expression expected")}function Tt(t){if("-"===t.int[0])throw new Et(t,"natural number expected")}function Pt(t){if("int"in t)return!0;throw new Et(t,"int literal expected")}function Rt(t){if("string"in t)return!0;throw new Et(t,"string literal expected")}function It(t,e){var r;if(0===e&&void 0===t.args||(null===(r=t.args)||void 0===r?void 0:r.length)===e)return!0;throw new Et(t,`${e} arguments expected`)}function Mt(t){var e,r;if(Array.isArray(t)){for(const e of t){if(!Array.isArray(e)&&!St(e))throw new Et(t,"sequence or prim expected");Mt(e)}return!0}if(At(t)){if(Object.prototype.hasOwnProperty.call(vt,t.prim))return It(t,0),!0;switch(t.prim){case"DROP":case"PAIR":case"UNPAIR":case"DUP":case"UPDATE":case"GET":void 0!==t.args&&It(t,1)&&Pt(t.args[0])&&Tt(t.args[0]);break;case"DIG":case"DUG":case"SAPLING_EMPTY_STATE":It(t,1)&&Pt(t.args[0])&&Tt(t.args[0]);break;case"NONE":case"LEFT":case"RIGHT":case"NIL":case"CAST":It(t,1)&&Ft(t.args[0]);break;case"UNPACK":It(t,1)&&kt(t.args[0]);break;case"CONTRACT":It(t,1)&&jt(t.args[0]);break;case"IF_NONE":case"IF_LEFT":case"IF_CONS":case"IF":It(t,2)&&(Ot(t.args[0])&&Mt(t.args[0]),Ot(t.args[1])&&Mt(t.args[1]));break;case"MAP":case"ITER":case"LOOP":case"LOOP_LEFT":It(t,1)&&Mt(t.args[0]);break;case"CREATE_CONTRACT":It(t,1)&&Ht(t.args[0]);break;case"DIP":if(2===(null===(e=t.args)||void 0===e?void 0:e.length))Pt(t.args[0])&&Tt(t.args[0]),Ot(t.args[1])&&Mt(t.args[1]);else{if(1!==(null===(r=t.args)||void 0===r?void 0:r.length))throw new Et(t,"1 or 2 arguments expected");Ot(t.args[0])&&Mt(t.args[0])}break;case"PUSH":It(t,2)&&(Ct(t.args[0]),Kt(t.args[1]));break;case"EMPTY_SET":It(t,1)&&Nt(t.args[0]);break;case"EMPTY_MAP":It(t,2)&&(Nt(t.args[0]),Ft(t.args[1]));break;case"EMPTY_BIG_MAP":It(t,2)&&(Nt(t.args[0]),Dt(t.args[1]));break;case"LAMBDA":It(t,3)&&(Ft(t.args[0]),Ft(t.args[1]),Ot(t.args[2])&&Mt(t.args[2]));break;case"VIEW":It(t,2)&&(Rt(t.args[0])&&Bt(t.args[0]),Ft(t.args[1])&&Ct(t.args[1]));break;default:throw new Et(t,"instruction expected")}}return!0}function Nt(t){if(xt(t))if(Array.isArray(t)||"pair"===t.prim||"or"===t.prim||"option"===t.prim)Vt(t,(t=>Nt(t)));else if(!Object.prototype.hasOwnProperty.call(wt,t.prim))throw new Et(t,`${t.prim}: type is not comparable`);return!0}function kt(t){if(xt(t)&&St(t)){if(!Object.prototype.hasOwnProperty.call(_t,t.prim)||"big_map"===t.prim||"operation"===t.prim||"sapling_state"===t.prim||"ticket"===t.prim)throw new Et(t,`${t.prim}: type can't be used inside PACK/UNPACK instructions`);Vt(t,(t=>kt(t)))}return!0}function Ct(t){if(xt(t)&&St(t)){if(!Object.prototype.hasOwnProperty.call(_t,t.prim)||"big_map"===t.prim||"operation"===t.prim||"sapling_state"===t.prim||"ticket"===t.prim||"contract"===t.prim)throw new Et(t,`${t.prim}: type can't be pushed`);Vt(t,(t=>Ct(t)))}return!0}function Lt(t){if(xt(t)&&St(t)){if(!Object.prototype.hasOwnProperty.call(_t,t.prim)||"operation"===t.prim||"contract"===t.prim)throw new Et(t,`${t.prim}: type can't be used as part of a storage`);Vt(t,(t=>Lt(t)))}return!0}function jt(t){if(xt(t)&&St(t)){if(!Object.prototype.hasOwnProperty.call(_t,t.prim)||"operation"===t.prim)throw new Et(t,`${t.prim}: type can't be used as part of a parameter`);Vt(t,(t=>jt(t)))}return!0}function Dt(t){if(xt(t)&&St(t)){if(!Object.prototype.hasOwnProperty.call(_t,t.prim)||"big_map"===t.prim||"operation"===t.prim||"sapling_state"===t.prim)throw new Et(t,`${t.prim}: type can't be used inside a big_map`);Vt(t,(t=>Dt(t)))}return!0}const Ut=new RegExp("^[a-zA-Z0-9_.%@]*$");function Bt(t){if(t.string.length>31)throw new Et(t,`view name too long: ${t.string}`);if(!Ut.test(t.string))throw new Et(t,`invalid character(s) in view name: ${t.string}`)}function Ft(t){if(xt(t)&&St(t)){if(!Object.prototype.hasOwnProperty.call(_t,t.prim))throw new Et(t,"type expected");Vt(t,(t=>Ft(t)))}return!0}function Vt(t,e){if(Array.isArray(t)||"pair"===t.prim){const r=Array.isArray(t)?t:t.args;if(void 0===r||r.length<2)throw new Et(t,"at least 2 arguments expected");return r.forEach((t=>{xt(t)&&e(t)})),!0}switch(t.prim){case"option":case"list":It(t,1)&&xt(t.args[0])&&e(t.args[0]);break;case"contract":It(t,1)&&jt(t.args[0]);break;case"or":It(t,2)&&xt(t.args[0])&&xt(t.args[1])&&(e(t.args[0]),e(t.args[1]));break;case"lambda":It(t,2)&&(Ft(t.args[0]),Ft(t.args[1]));break;case"set":It(t,1)&&Nt(t.args[0]);break;case"map":It(t,2)&&xt(t.args[0])&&xt(t.args[1])&&(Nt(t.args[0]),e(t.args[1]));break;case"big_map":It(t,2)&&xt(t.args[0])&&xt(t.args[1])&&(Nt(t.args[0]),Dt(t.args[1]),e(t.args[1]));break;case"ticket":It(t,1)&&xt(t.args[0])&&Nt(t.args[0]);break;case"sapling_state":case"sapling_transaction":It(t,1)&&Pt(t.args[0]);break;default:It(t,0)}return!0}function Kt(t){if("int"in t||"string"in t||"bytes"in t)return!0;if(Array.isArray(t)){let e=0;for(const r of t)St(r)&&"Elt"===r.prim?(It(r,2)&&(Kt(r.args[0]),Kt(r.args[1])),e++):Kt(r);if(0!==e&&e!==t.length)throw new Et(t,"data entries and map elements can't be intermixed");return!0}if(!St(t))throw new Et(t,"data entry expected");switch(t.prim){case"Unit":case"True":case"False":case"None":It(t,0);break;case"Pair":if(void 0===t.args||t.args.length<2)throw new Et(t,"at least 2 arguments expected");for(const e of t.args)Kt(e);break;case"Left":case"Right":case"Some":It(t,1)&&Kt(t.args[0]);break;default:if(!Object.prototype.hasOwnProperty.call(yt,t.prim))throw new Et(t,"data entry or instruction expected");Mt(t)}return!0}function Ht(t){if(Ot(t)){const e={},r={};for(const n of t)if(At(n)){if("view"!==n.prim){if(n.prim in e)throw new Et(t,`duplicate contract section: ${n.prim}`);e[n.prim]=!0}switch(n.prim){case"code":It(n,1)&&Ot(n.args[0])&&Mt(n.args[0]);break;case"parameter":It(n,1)&&jt(n.args[0]);break;case"storage":It(n,1)&&Lt(n.args[0]);break;case"view":if(It(n,4)){if(Rt(n.args[0])){const e=n.args[0];if(e.string in r)throw new Et(t,`duplicate view name: ${e.string}`);r[e.string]=!0,Bt(e)}Ct(n.args[1]),Ct(n.args[2]),Ot(n.args[3])&&Mt(n.args[3])}break;default:throw new Et(t,`unexpected contract section: ${n.prim}`)}}}return!0}function $t(t){try{return Ht(t),!0}catch(t){return!1}}function Gt(t){try{return Kt(t),!0}catch(t){return!1}}function zt(t){try{return Mt(t),!0}catch(t){return!1}}function qt(t){try{return Ft(t),!0}catch(t){return!1}}function Wt(t){return Object.prototype.hasOwnProperty.call(yt,t.prim)}function Yt(t){if(!Array.isArray(t))return!1;for(const e of t)if("prim"in e){if(Wt(e))throw new tt(t,`Instruction outside of a lambda: ${JSON.stringify(t)}`);if("Elt"===e.prim)throw new tt(t,`Elt item outside of a map literal: ${JSON.stringify(t)}`)}return!0}const Jt=["parameter","storage","code","False","Elt","Left","None","Pair","Right","Some","True","Unit","PACK","UNPACK","BLAKE2B","SHA256","SHA512","ABS","ADD","AMOUNT","AND","BALANCE","CAR","CDR","CHECK_SIGNATURE","COMPARE","CONCAT","CONS","CREATE_ACCOUNT","CREATE_CONTRACT","IMPLICIT_ACCOUNT","DIP","DROP","DUP","EDIV","EMPTY_MAP","EMPTY_SET","EQ","EXEC","FAILWITH","GE","GET","GT","HASH_KEY","IF","IF_CONS","IF_LEFT","IF_NONE","INT","LAMBDA","LE","LEFT","LOOP","LSL","LSR","LT","MAP","MEM","MUL","NEG","NEQ","NIL","NONE","NOT","NOW","OR","PAIR","PUSH","RIGHT","SIZE","SOME","SOURCE","SENDER","SELF","STEPS_TO_QUOTA","SUB","SWAP","TRANSFER_TOKENS","SET_DELEGATE","UNIT","UPDATE","XOR","ITER","LOOP_LEFT","ADDRESS","CONTRACT","ISNAT","CAST","RENAME","bool","contract","int","key","key_hash","lambda","list","map","big_map","nat","option","or","pair","set","signature","string","bytes","mutez","timestamp","unit","operation","address","SLICE","DIG","DUG","EMPTY_BIG_MAP","APPLY","chain_id","CHAIN_ID","LEVEL","SELF_ADDRESS","never","NEVER","UNPAIR","VOTING_POWER","TOTAL_VOTING_POWER","KECCAK","SHA3","PAIRING_CHECK","bls12_381_g1","bls12_381_g2","bls12_381_fr","sapling_state","sapling_transaction","SAPLING_EMPTY_STATE","SAPLING_VERIFY_UPDATE","ticket","TICKET","READ_TICKET","SPLIT_TICKET","JOIN_TICKETS","GET_AND_UPDATE","chest","chest_key","OPEN_CHEST","VIEW","view","constant","SUB_MUTEZ"],Zt=Object.assign({},...Jt.map(((t,e)=>({[t]:e}))));var Xt;!function(t){t[t.Int=0]="Int",t[t.String=1]="String",t[t.Sequence=2]="Sequence",t[t.Prim0=3]="Prim0",t[t.Prim0Annot=4]="Prim0Annot",t[t.Prim1=5]="Prim1",t[t.Prim1Annot=6]="Prim1Annot",t[t.Prim2=7]="Prim2",t[t.Prim2Annot=8]="Prim2Annot",t[t.Prim=9]="Prim",t[t.Bytes=10]="Bytes"}(Xt||(Xt={}));class Qt{constructor(){this.buffer=[]}get length(){return this.buffer.length}writeBytes(t){this.buffer.push(...t.map((t=>255&t)))}writeUint8(t){const e=0|t;this.buffer.push(255&e)}writeUint16(t){const e=0|t;this.buffer.push(e>>8&255),this.buffer.push(255&e)}writeUint32(t){const e=0|t;this.buffer.push(e>>24&255),this.buffer.push(e>>16&255),this.buffer.push(e>>8&255),this.buffer.push(255&e)}writeInt8(t){this.writeUint8(t)}writeInt16(t){this.writeUint16(t)}writeInt32(t){this.writeUint32(t)}}const te=new Error("bounds out of range");class ee{constructor(t,e=0,r=t.length){this.buffer=t,this.idx=e,this.cap=r}get length(){return this.cap-this.idx}readBytes(t){if(this.cap-this.idx<t)throw te;const e=this.buffer.slice(this.idx,this.idx+t);return this.idx+=t,e}reader(t){if(this.cap-this.idx<t)throw te;const e=new ee(this.buffer,this.idx,this.idx+t);return this.idx+=t,e}copy(){return new ee(this.buffer,this.idx,this.cap)}readUint8(){if(this.cap-this.idx<1)throw te;return this.buffer[this.idx++]>>>0}readUint16(){if(this.cap-this.idx<2)throw te;return(this.buffer[this.idx++]<<8|this.buffer[this.idx++])>>>0}readUint32(){if(this.cap-this.idx<4)throw te;return(this.buffer[this.idx++]<<24|this.buffer[this.idx++]<<16|this.buffer[this.idx++]<<8|this.buffer[this.idx++])>>>0}readInt8(){if(this.cap-this.idx<1)throw te;return this.buffer[this.idx++]<<24>>24}readInt16(){if(this.cap-this.idx<2)throw te;return(this.buffer[this.idx++]<<8|this.buffer[this.idx++])<<16>>16}readInt32(){if(this.cap-this.idx<4)throw te;return this.buffer[this.idx++]<<24|this.buffer[this.idx++]<<16|this.buffer[this.idx++]<<8|this.buffer[this.idx++]}}var re,ne,ie;function oe(t){let e;const r=t.readUint8();switch(r){case ne.ED25519:e="ED25519PublicKeyHash";break;case ne.SECP256K1:e="SECP256K1PublicKeyHash";break;case ne.P256:e="P256PublicKeyHash";break;default:throw new Error(`unknown public key hash tag: ${r}`)}return{type:e,hash:t.readBytes(20)}}function se(t){let e;const r=t.readUint8();switch(r){case re.Implicit:e=oe(t);break;case re.Originated:e={type:"ContractHash",hash:t.readBytes(20)},t.readBytes(1);break;default:throw new Error(`unknown address tag: ${r}`)}if(0!==t.length){const r=new TextDecoder;e.entryPoint=r.decode(new Uint8Array(t.readBytes(t.length)))}return e}function ae(t,e){let r;switch(t.type){case"ED25519PublicKeyHash":r=ne.ED25519;break;case"SECP256K1PublicKeyHash":r=ne.SECP256K1;break;case"P256PublicKeyHash":r=ne.P256;break;default:throw new Error(`unexpected address type: ${t.type}`)}e.writeUint8(r),e.writeBytes(Array.from(t.hash))}function ce(t){let e,r;const n=t.readUint8();switch(n){case ie.ED25519:r="ED25519PublicKey",e=32;break;case ie.SECP256K1:r="SECP256K1PublicKey",e=33;break;case ie.P256:r="P256PublicKey",e=33;break;default:throw new Error(`unknown public key tag: ${n}`)}return{type:r,publicKey:t.readBytes(e)}}function ue(t,e,r){var n,i;const[o,s]=r(t);if(Array.isArray(o)){const t=new Qt;for(const e of o){const r=s.next();if(r.done)throw new Error("REPORT ME: iterator is done");ue(e,t,r.value)}return e.writeUint8(Xt.Sequence),e.writeUint32(t.length),void e.writeBytes(t.buffer)}if("string"in o){const t=(new TextEncoder).encode(o.string);return e.writeUint8(Xt.String),e.writeUint32(t.length),void e.writeBytes(Array.from(t))}if("int"in o){e.writeUint8(Xt.Int);let t=BigInt(o.int);const r=t<0;r&&(t=-t);let n=0;do{const i=0===n?BigInt(6):BigInt(7);let o=t&(BigInt(1)<<i)-BigInt(1);t>>=i,t&&(o|=BigInt(128)),0===n&&r&&(o|=BigInt(64)),e.writeUint8(Number(o)),n++}while(t);return}if("bytes"in o){const t=function(t){const e=[];for(let r=0;r<t.length;r+=2){const n=t.slice(r,r+2),i=parseInt(n,16);if(Number.isNaN(i))throw new Error(`can't parse hex byte: ${n}`);e.push(i)}return e}(o.bytes);return e.writeUint8(Xt.Bytes),e.writeUint32(t.length),void e.writeBytes(t)}const a=Zt[o.prim];if(void 0===a)throw new TypeError(`Can't encode primary: ${o.prim}`);const c=((null===(n=o.args)||void 0===n?void 0:n.length)||0)<3?Xt.Prim0+2*((null===(i=o.args)||void 0===i?void 0:i.length)||0)+(void 0===o.annots||0===o.annots.length?0:1):Xt.Prim;if(e.writeUint8(c),e.writeUint8(a),void 0!==o.args)if(o.args.length<3)for(const t of o.args){const r=s.next();if(r.done)throw new Error("REPORT ME: iterator is done");ue(t,e,r.value)}else{const t=new Qt;for(const e of o.args){const r=s.next();if(r.done)throw new Error("REPORT ME: iterator is done");ue(e,t,r.value)}e.writeUint32(t.length),e.writeBytes(t.buffer)}if(void 0!==o.annots&&0!==o.annots.length){const t=(new TextEncoder).encode(o.annots.join(" "));e.writeUint32(t.length),e.writeBytes(Array.from(t))}else void 0!==o.args&&o.args.length>=3&&e.writeUint32(0)}function fe(t,e){function*r(){for(;;)yield ye}const[n,i]=e,o=t.readUint8();switch(o){case Xt.Int:{const e=[];let r;do{r=t.readInt8(),e.push(r)}while(0!=(128&r));let n=BigInt(0),o=!1;for(let t=e.length-1;t>=0;t--){const r=0===t?BigInt(6):BigInt(7),i=BigInt(e[t]);n<<=r,n|=i&(BigInt(1)<<r)-BigInt(1),0===t&&(o=!!(i&BigInt(64)))}return o&&(n=-n),i({int:String(n)})}case Xt.String:{const e=t.readUint32(),r=t.readBytes(e);return i({string:(new TextDecoder).decode(new Uint8Array(r))})}case Xt.Bytes:{const e=t.readUint32(),r=t.readBytes(e);return i({bytes:mt(Array.from(r))})}case Xt.Sequence:{const e=t.readUint32();let o=[],s=t.copy(),a=r();for(let r=0;r<2;r++){const r=s.reader(e);for(o=[];r.length>0;){const t=a.next();if(t.done)throw new Error("REPORT ME: iterator is done");o.push(fe(r,t.value))}a=n(o),s=t}return i(o)}default:{if(o>9)throw new Error(`Unknown tag: ${o}`);const e=t.readUint8();if(e>=Jt.length)throw new Error(`Unknown primitive tag: ${e}`);const s=Jt[e],a=o-3>>1;let c={prim:s},u=r(),f=t.copy();for(let e=0;e<2;e++){if(c={prim:s},a<3)for(let t=0;t<a;t++){const t=u.next();if(t.done)throw new Error("REPORT ME: iterator is done");c.args=c.args||[],c.args.push(fe(f,t.value))}else{c.args=c.args||[];const t=f.readUint32(),e=f.reader(t);for(;e.length>0;){const t=u.next();if(t.done)throw new Error("REPORT ME: iterator is done");c.args.push(fe(e,t.value))}}u=n(c),f=t}if(1==(o-3&1)||3===a){const e=t.readUint32();if(0!==e){const r=t.readBytes(e),n=new TextDecoder;c.annots=n.decode(new Uint8Array(r)).split(" ")}}return i(c)}}}!function(t){t[t.Implicit=0]="Implicit",t[t.Originated=1]="Originated"}(re||(re={})),function(t){t[t.ED25519=0]="ED25519",t[t.SECP256K1=1]="SECP256K1",t[t.P256=2]="P256"}(ne||(ne={})),function(t){t[t.ED25519=0]="ED25519",t[t.SECP256K1=1]="SECP256K1",t[t.P256=2]="P256"}(ie||(ie={}));const he=t=>"prim"in t&&("Left"===t.prim||"Right"===t.prim),le=t=>"prim"in t&&("Some"===t.prim||"None"===t.prim),de=t=>{if(dt(t))return e=>{if(!pt(e))throw new rt(t,e,`pair expected: ${JSON.stringify(e)}`);Yt(e);const r=lt("pair",t);return[lt("Pair",e),function*(){for(const t of r.args)yield de(t)}()]};switch(t.prim){case"or":return e=>{if(!he(e))throw new rt(t,e,`or expected: ${JSON.stringify(e)}`);return[e,function*(){yield de(t.args["Left"===e.prim?0:1])}()]};case"option":return e=>{if(!le(e))throw new rt(t,e,`option expected: ${JSON.stringify(e)}`);return[e,function*(){"Some"===e.prim&&(yield de(t.args[0]))}()]};case"list":case"set":return e=>{if(!Array.isArray(e))throw new rt(t,e,`${t.prim} expected: ${JSON.stringify(e)}`);return[e,function*(){for(const r of e)yield de(t.args[0])}()]};case"map":return e=>{if(!Array.isArray(e))throw new rt(t,e,`map expected: ${JSON.stringify(e)}`);return[e,function*(){for(const r of e)yield e=>{if(!("prim"in e)||"Elt"!==e.prim)throw new rt(t,e,`map element expected: ${JSON.stringify(e)}`);return[e,function*(){for(const e of t.args)yield de(e)}()]}}()]};case"chain_id":return e=>{if(!("bytes"in e)&&!("string"in e))throw new rt(t,e,`chain id expected: ${JSON.stringify(e)}`);let r;if("string"in e){const n=ft(e.string,"ChainID");if(null===n)throw new rt(t,e,`chain id base58 expected: ${e.string}`);r={bytes:mt(n[1])}}else r=e;return[r,[][Symbol.iterator]()]};case"signature":return e=>{if(!("bytes"in e)&&!("string"in e))throw new rt(t,e,`signature expected: ${JSON.stringify(e)}`);let r;if("string"in e){const n=ft(e.string,"ED25519Signature","SECP256K1Signature","P256Signature","GenericSignature");if(null===n)throw new rt(t,e,`signature base58 expected: ${e.string}`);r={bytes:mt(n[1])}}else r=e;return[r,[][Symbol.iterator]()]};case"key_hash":return e=>{if(!("bytes"in e)&&!("string"in e))throw new rt(t,e,`key hash expected: ${JSON.stringify(e)}`);let r;if("string"in e){const n=ft(e.string,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash");if(null===n)throw new rt(t,e,`key hash base58 expected: ${e.string}`);const i=new Qt;ae({type:n[0],hash:n[1]},i),r={bytes:mt(i.buffer)}}else r=e;return[r,[][Symbol.iterator]()]};case"key":return e=>{if(!("bytes"in e)&&!("string"in e))throw new rt(t,e,`public key expected: ${JSON.stringify(e)}`);let r;if("string"in e){const n=ft(e.string,"ED25519PublicKey","SECP256K1PublicKey","P256PublicKey");if(null===n)throw new rt(t,e,`public key base58 expected: ${e.string}`);const i=new Qt;!function(t,e){let r;switch(t.type){case"ED25519PublicKey":r=ie.ED25519;break;case"SECP256K1PublicKey":r=ie.SECP256K1;break;case"P256PublicKey":r=ie.P256;break;default:throw new Error(`unexpected public key type: ${t.type}`)}e.writeUint8(r),e.writeBytes(Array.from(t.publicKey))}({type:n[0],publicKey:n[1]},i),r={bytes:mt(i.buffer)}}else r=e;return[r,[][Symbol.iterator]()]};case"address":return e=>{if(!("bytes"in e)&&!("string"in e))throw new rt(t,e,`address expected: ${JSON.stringify(e)}`);let r;if("string"in e){const n=e.string.split("%"),i=ft(n[0],"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash","ContractHash");if(null===i)throw new rt(t,e,`address base58 expected: ${e.string}`);const o=new Qt;!function(t,e){if("ContractHash"===t.type?(e.writeUint8(re.Originated),e.writeBytes(Array.from(t.hash)),e.writeUint8(0)):(e.writeUint8(re.Implicit),ae(t,e)),void 0!==t.entryPoint&&""!==t.entryPoint&&"default"!==t.entryPoint){const r=(new TextEncoder).encode(t.entryPoint);e.writeBytes(Array.from(r))}}({type:i[0],hash:i[1],entryPoint:n.length>1?n[1]:void 0},o),r={bytes:mt(o.buffer)}}else r=e;return[r,[][Symbol.iterator]()]};case"timestamp":return e=>{if(!("string"in e)&&!("int"in e))throw new rt(t,e,`timestamp expected: ${JSON.stringify(e)}`);let r;if("string"in e){const n=gt(e);if(null===n)throw new rt(t,e,`can't parse date: ${e.string}`);r={int:String(Math.floor(n.getTime()/1e3))}}else r=e;return[r,[][Symbol.iterator]()]};default:return be}},pe=t=>"prim"in t&&"PUSH"===t.prim,be=t=>pe(t)?(Mt(t),[t,function*(){yield be,yield de(t.args[0])}()]):[t,function*(){for(;;)yield be}()];function ge(t,e){const r=new Qt;return r.writeUint8(5),ue(t,r,void 0!==e?de(e):be),r.buffer}function me(t,e){return{bytes:mt(ge(t,e))}}const ve=t=>{if(dt(t)){const e=Array.isArray(t)?t:t.args;return[r=>{if(!pt(r))throw new rt(t,r,`pair expected: ${JSON.stringify(r)}`);return function*(){for(const t of e)yield ve(t)}()},t=>t]}switch(t.prim){case"or":return[e=>{if(!he(e))throw new rt(t,e,`or expected: ${JSON.stringify(e)}`);return function*(){yield ve(t.args["Left"===e.prim?0:1])}()},t=>t];case"option":return[e=>{if(!le(e))throw new rt(t,e,`option expected: ${JSON.stringify(e)}`);return function*(){"Some"===e.prim&&(yield ve(t.args[0]))}()},t=>t];case"list":case"set":return[e=>{if(!Array.isArray(e))throw new rt(t,e,`${t.prim} expected: ${JSON.stringify(e)}`);return function*(){for(;;)yield ve(t.args[0])}()},t=>t];case"map":return[e=>{if(!Array.isArray(e))throw new rt(t,e,`map expected: ${JSON.stringify(e)}`);return function*(){for(;;)yield[e=>{if(!("prim"in e)||"Elt"!==e.prim)throw new rt(t,e,`map element expected: ${JSON.stringify(e)}`);return function*(){for(const e of t.args)yield ve(e)}()},t=>t]}()},t=>t];case"chain_id":return[()=>[][Symbol.iterator](),e=>{if(!("bytes"in e)&&!("string"in e))throw new rt(t,e,`chain id expected: ${JSON.stringify(e)}`);if("string"in e)return e;const r=it(e.bytes);if(null===r)throw new rt(t,e,`can't parse bytes: ${e.bytes}`);return{string:ht("ChainID",r)}}];case"signature":return[()=>[][Symbol.iterator](),e=>{if(!("bytes"in e)&&!("string"in e))throw new rt(t,e,`signature expected: ${JSON.stringify(e)}`);if("string"in e)return e;const r=it(e.bytes);if(null===r)throw new rt(t,e,`can't parse bytes: ${e.bytes}`);return{string:ht("GenericSignature",r)}}];case"key_hash":return[()=>[][Symbol.iterator](),e=>{if(!("bytes"in e)&&!("string"in e))throw new rt(t,e,`key hash expected: ${JSON.stringify(e)}`);if("string"in e)return e;const r=it(e.bytes);if(null===r)throw new rt(t,e,`can't parse bytes: ${e.bytes}`);const n=oe(new ee(new Uint8Array(r)));return{string:ht(n.type,n.hash)+(n.entryPoint?"%"+n.entryPoint:"")}}];case"key":return[()=>[][Symbol.iterator](),e=>{if(!("bytes"in e)&&!("string"in e))throw new rt(t,e,`public key expected: ${JSON.stringify(e)}`);if("string"in e)return e;const r=it(e.bytes);if(null===r)throw new rt(t,e,`can't parse bytes: ${e.bytes}`);const n=ce(new ee(new Uint8Array(r)));return{string:ht(n.type,n.publicKey)}}];case"address":return[()=>[][Symbol.iterator](),e=>{if(!("bytes"in e)&&!("string"in e))throw new rt(t,e,`address expected: ${JSON.stringify(e)}`);if("string"in e)return e;const r=it(e.bytes);if(null===r)throw new rt(t,e,`can't parse bytes: ${e.bytes}`);const n=se(new ee(new Uint8Array(r)));return{string:ht(n.type,n.hash)+(n.entryPoint?"%"+n.entryPoint:"")}}];case"timestamp":return[()=>[][Symbol.iterator](),e=>{if(!("int"in e)&&!("string"in e))throw new rt(t,e,`address expected: ${JSON.stringify(e)}`);if("string"in e)return e;return{string:new Date(1e3*parseInt(e.int,10)).toISOString().slice(0,19)+"Z"}}];default:return ye}},ye=[t=>pe(t)?(Mt(t),function*(){yield ye,yield ve(t.args[0])}()):function*(){for(;;)yield ye}(),t=>t];function we(t,e){const r=new ee(t);if(5!==r.readUint8())throw new Error("incorrect packed data magic number");const n=fe(r,void 0!==e?ve(e):ye);if(Kt(n))return n;throw new Error}function _e(t,e){const r=it(t.bytes);if(null===r)throw new Error(`can't parse bytes: "${t.bytes}"`);return we(r,e)}function Ee(t){const e=it(t.bytes);if(null===e)throw new Error(`can't parse bytes: "${t.bytes}"`);return se(new ee(new Uint8Array(e)))}function Se(t){const e=it(t.bytes);if(null===e)throw new Error(`can't parse bytes: "${t.bytes}"`);return oe(new ee(new Uint8Array(e)))}function Ae(t){const e=it(t.bytes);if(null===e)throw new Error(`can't parse bytes: "${t.bytes}"`);return ce(new ee(new Uint8Array(e)))}class Oe extends tt{constructor(t,e,r){super(t,r),this.stackState=e,Object.setPrototypeOf(this,Oe.prototype)}}function xe(t){return Array.isArray(t)?"pair":t.prim}function Te(t){return"prim"in t?t.args:t}function Pe(t,e,r=!1){if(xe(t)!==xe(e))throw new rt(t,void 0,`types mismatch: ${xe(t)} != ${xe(e)}`);const n=[ct(t),ct(e)];if(n[0].t&&n[1].t&&n[0].t[0]!==n[1].t[0])throw new rt(t,void 0,`${xe(t)}: type names mismatch: ${n[0].t[0]} != ${n[1].t[0]}`);if(r&&n[0].f&&n[1].f&&n[0].f[0]!==n[1].f[0])throw new rt(t,void 0,`${xe(t)}: field names mismatch: ${n[0].f[0]} != ${n[1].f}`);if(dt(t)){const r=lt("pair",t),n=lt("pair",e);return Pe(r.args[0],n.args[0],!0),void Pe(r.args[1],n.args[1],!0)}switch(t.prim){case"option":case"list":case"contract":case"set":case"ticket":Pe(t.args[0],e.args[0]);break;case"or":Pe(t.args[0],e.args[0],!0),Pe(t.args[1],e.args[1],!0);break;case"lambda":case"map":case"big_map":Pe(t.args[0],e.args[0]),Pe(t.args[1],e.args[1]);break;case"sapling_state":case"sapling_transaction":if(parseInt(t.args[0].int,10)!==parseInt(e.args[0].int,10))throw new rt(t,void 0,`${xe(t)}: type argument mismatch: ${t.args[0].int} != ${e.args[0].int}`)}}function Re(t,e){if(t.length!==e.length)throw new rt(t,void 0,`stack length mismatch: ${t.length} != ${e.length}`);for(let r=0;r<t.length;r++)Pe(t[r],e[r])}function Ie(t,e=!1){var r,n,i;if(!Array.isArray(t)){const o=ct(t);if(((null===(r=o.t)||void 0===r?void 0:r.length)||0)>1)throw new rt(t,void 0,`${t.prim}: at most one type annotation allowed: ${t.annots}`);if(e){if(((null===(n=o.f)||void 0===n?void 0:n.length)||0)>1)throw new rt(t,void 0,`${t.prim}: at most one field annotation allowed: ${t.annots}`)}else if(((null===(i=o.f)||void 0===i?void 0:i.length)||0)>0)throw new rt(t,void 0,`${t.prim}: field annotations aren't allowed: ${t.annots}`)}if(dt(t)){const e=Te(t);for(const t of e)Ie(t,!0)}else switch(t.prim){case"option":case"list":case"contract":case"set":Ie(t.args[0]);break;case"or":for(const e of t.args)Ie(e,!0);break;case"lambda":case"map":case"big_map":Ie(t.args[0]),Ie(t.args[1])}}function Me(t){if(!Array.isArray(t))return!1;for(const e of t)if(!(Array.isArray(e)&&Me(e)||"prim"in e&&Wt(e)))return!1;return!0}function Ne(t,e,r){if(dt(e)){if(pt(t)){Yt(t);const n=lt("Pair",t),i=lt("pair",e);return Ne(n.args[0],i.args[0],r),void Ne(n.args[1],i.args[1],r)}throw new rt(e,t,`pair expected: ${JSON.stringify(t)}`)}switch(e.prim){case"int":if("int"in t&&ot(t.int))return;throw new rt(e,t,`integer value expected: ${JSON.stringify(t)}`);case"nat":case"mutez":if("int"in t&&st(t.int))return;throw new rt(e,t,`natural value expected: ${JSON.stringify(t)}`);case"string":if("string"in t)return;throw new rt(e,t,`string value expected: ${JSON.stringify(t)}`);case"bytes":case"bls12_381_g1":case"bls12_381_g2":if("bytes"in t&&null!==it(t.bytes))return;throw new rt(e,t,`bytes value expected: ${JSON.stringify(t)}`);case"bool":if("prim"in t&&("True"===t.prim||"False"===t.prim))return;throw new rt(e,t,`boolean value expected: ${JSON.stringify(t)}`);case"key_hash":if("string"in t&&null!==ft(t.string,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash"))return;if("bytes"in t)try{return void Se(t)}catch(t){}throw new rt(e,t,`key hash expected: ${JSON.stringify(t)}`);case"timestamp":if(("string"in t||"int"in t)&&null!==gt(t))return;throw new rt(e,t,`timestamp expected: ${JSON.stringify(t)}`);case"address":if("string"in t){let e=t.string;const r=t.string.indexOf("%");if(r>=0&&(e=t.string.slice(0,r)),null!==ft(e,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash","ContractHash"))return}else if("bytes"in t)try{return void Ee(t)}catch(t){}throw new rt(e,t,`address expected: ${JSON.stringify(t)}`);case"key":if("string"in t&&null!==ft(t.string,"ED25519PublicKey","SECP256K1PublicKey","P256PublicKey"))return;if("bytes"in t)try{return void Ae(t)}catch(t){}throw new rt(e,t,`public key expected: ${JSON.stringify(t)}`);case"unit":if("prim"in t&&"Unit"===t.prim)return;throw new rt(e,t,`unit value expected: ${JSON.stringify(t)}`);case"signature":if("bytes"in t||"string"in t&&null!==ft(t.string,"ED25519Signature","SECP256K1Signature","P256Signature","GenericSignature"))return;throw new rt(e,t,`signature expected: ${JSON.stringify(t)}`);case"chain_id":if("bytes"in t||"string"in t){if(null!==("string"in t?X(t.string):it(t.bytes)))return}throw new rt(e,t,`chain id expected: ${JSON.stringify(t)}`);case"option":if("prim"in t){if("None"===t.prim)return;if("Some"===t.prim)return void Ne(t.args[0],e.args[0],r)}throw new rt(e,t,`option expected: ${JSON.stringify(t)}`);case"list":case"set":if(Yt(t)){for(const n of t)Ne(n,e.args[0],r);return}throw new rt(e,t,`${e.prim} expected: ${JSON.stringify(t)}`);case"or":if("prim"in t){if("Left"===t.prim)return void Ne(t.args[0],e.args[0],r);if("Right"===t.prim)return void Ne(t.args[0],e.args[1],r)}throw new rt(e,t,`union (or) expected: ${JSON.stringify(t)}`);case"lambda":if(Me(t)){const n=ke(t,[e.args[0]],r);if("failed"in n)throw new rt(e,t,`function is failed with error type: ${n.failed}`);if(1!==n.length)throw new rt(e,t,"function must return a value");return void Pe(e.args[1],n[0])}throw new rt(e,t,`function expected: ${JSON.stringify(t)}`);case"map":case"big_map":if(Array.isArray(t)){for(const n of t){if(!("prim"in n)||"Elt"!==n.prim)throw new rt(e,t,`map elements expected: ${JSON.stringify(t)}`);Ne(n.args[0],e.args[0],r),Ne(n.args[1],e.args[1],r)}return}throw new rt(e,t,`${e.prim} expected: ${JSON.stringify(t)}`);case"bls12_381_fr":if("int"in t&&ot(t.int)||"bytes"in t&&null!==it(t.bytes))return;throw new rt(e,t,`BLS12-381 element expected: ${JSON.stringify(t)}`);case"sapling_state":if(Array.isArray(t))return;throw new rt(e,t,`sapling state expected: ${JSON.stringify(t)}`);case"ticket":return void Ne(t,{prim:"pair",args:[{prim:"address"},e.args[0],{prim:"nat"}]},r);default:throw new rt(e,t,`type ${xe(e)} don't have Michelson literal representation`)}}function ke(t,e,r){const n=(null==r?void 0:r.protocol)||p;if(Array.isArray(t))return function(t,e,r){let n=e,i=e,o=0;for(const e of t){const t=ke(e,i,r);if(n=t,"failed"in t)break;i=t,o++}if("failed"in n&&0==n.level&&(!("prim"in n.failed)||"never"!==n.failed.prim)&&o!==t.length-1)throw new Oe(t,n,"FAIL must appear in a tail position");if(void 0!==(null==r?void 0:r.traceCallback)){const i={op:t,in:e,out:n};r.traceCallback(i)}return"failed"in n?{failed:n.failed,level:n.level+1}:n}(t,e,r);const i=t;function o(t,...r){if(e.length<r.length+t)throw new Oe(i,e,`${i.prim}: stack must have at least ${r.length} element(s)`);let n=t;for(const t of r){if(null!==t&&0!==t.length){let r=0;for(;r<t.length&&t[r]!==xe(e[n]);)r++;if(r===t.length)throw new Oe(i,e,`${i.prim}: stack type mismatch: [${n}] expected to be ${t}, got ${xe(e[n])} instead`)}n++}return e.slice(t,r.length+t)}function s(t){return(...r)=>{try{return t(...r)}catch(t){throw t instanceof tt?new Oe(i,e,t.message):t}}}function a(t){return r=>{try{return t(r)}catch(t){throw t instanceof tt?new Oe(i,e,t.message):t}}}const c=s(ct),u=s(Re),f=s(Pe),h=a(Nt),b=a(kt),g=a(Lt),v=a(Ct),y=a(Dt);function w(t,r){const n=c(i,Object.assign(Object.assign({},r),{emptyFields:void 0!==t.f&&t.f>1,emptyVar:void 0!==t.v&&t.v>1})),o=(t,r,n)=>{if(t&&t.length>(r||0))throw new Oe(i,e,`${i.prim}: at most ${r||0} ${n} annotations allowed`)};return o(n.f,t.f,"field"),o(n.t,t.t,"type"),o(n.v,t.v,"variable"),n}function _(t,e){const r=t,n=Array.isArray(r)?{prim:"pair",args:r}:r,i=c(n),o=void 0!==e.v||void 0!==e.t||void 0!==e.f?[...(null===e.v?i.v:e.v)||[],...(null===e.t?i.t:e.t)||[],...(null===e.f?i.f:e.f)||[]]:void 0,s=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(n,["annots"]);return Object.assign(Object.assign({},s),o&&0!==o.length&&{annots:o})}function E(t,e){const r=w({v:1});return _(t,{v:void 0!==r.v?r.v:void 0!==e?[e]:null,t:null})}function S(t,r,n,o,s){var a,u,f,h;const l=null===(a=c(r).f)||void 0===a?void 0:a[0],d=null===(u=n.f)||void 0===u?void 0:u[o];if(void 0!==d&&"%"!==d&&void 0!==l&&d!==l)throw new Oe(i,e,`${i.prim}: field names doesn't match: ${d} !== ${l}`);const p=null===(f=n.v)||void 0===f?void 0:f[o],b=null===(h=c(t).v)||void 0===h?void 0:h[0];return _(r,{t:null,v:p?"@%"===p?l?["@"+l.slice(1)]:void 0:"@%%"===p?b?["@"+b.slice(1)+"."+(l?l.slice(1):s)]:l?["@"+l.slice(1)]:void 0:[p]:null})}function A(t,r,n=r){const o=lt("pair",t);if(1===n)return[o.args[0]];if(2===n)return o.args;const s=o.args[1];if(dt(s))return[o.args[0],...A(s,r,n-1)];throw new Oe(i,e,`${i.prim}: at least ${r} fields are expected`)}function O(t,r,n=r){if(0===n)return t;const o=lt("pair",t);if(1===n)return o.args[0];const s=o.args[1];if(dt(s))return O(s,r,n-2);if(2===n)return s;throw new Oe(i,e,`${i.prim}: at least ${r+1} fields are expected`)}function x(t,r,n,o=n){if(0===o)return r;const s=lt("pair",t);if(1===o)return Object.assign(Object.assign({},s),{args:[r,s.args[1]]});const a=s.args[1];if(dt(a))return Object.assign(Object.assign({},s),{args:[s.args[0],x(a,r,n,o-2)]});if(2===o)return Object.assign(Object.assign({},s),{args:[s.args[0],r]});throw new Oe(i,e,`${i.prim}: at least ${n+1} fields are expected`)}const T=(t,e)=>["@"+(t.v?t.v[0].slice(1)+".":"")+e];function P(t,e){return"failed"in t||"failed"in e?"failed"in t?e:t:(u(t,e),t)}const R=(t=>{var i,s,a,p,R;switch(t.prim){case"DUP":{const r=t.args?parseInt(t.args[0].int,10):1;if(0===r)throw new Oe(t,e,"DUP 0 is forbidden");const n=o(r-1,null)[0];if("ticket"===xe(n))throw new Oe(t,e,"ticket can't be DUPed");return[n,...e]}case"SWAP":{const t=o(0,null,null);return w({}),[t[1],t[0],...e.slice(2)]}case"SOME":return[_({prim:"option",args:[o(0,null)[0]]},w({t:1,v:1})),...e.slice(1)];case"UNIT":return[_({prim:"unit"},w({v:1,t:1})),...e];case"PAIR":{const r=t.args?parseInt(t.args[0].int,10):2;if(r<2)throw new Oe(t,e,`PAIR ${r} is forbidden`);const n=o(0,...new Array(r).fill(null)),i=w({f:r,t:1,v:1},{specialFields:!0}),s=t=>{const e=t.lastIndexOf(".");return t.slice(e>0?e+1:1)},a=n.map(((t,e)=>{var r;const n=c(t);return _(t,{v:null,t:null,f:i.f&&i.f.length>e&&"%"!==i.f[e]?"%@"===i.f[e]?n.v?["%"+s((null===(r=n.v)||void 0===r?void 0:r[0])||"")]:void 0:[i.f[e]]:void 0})}));return[_({prim:"pair",args:a},{t:i.t,v:i.v}),...e.slice(r)]}case"UNPAIR":{const r=t.args?parseInt(t.args[0].int,10):2;if(r<2)throw new Oe(t,e,`UNPAIR ${r} is forbidden`);const n=o(0,["pair"])[0],i=w({f:2,v:2},{specialVar:!0});return[...A(n,r).map(((t,e)=>S(n,t,i,e,0===e?"car":"cdr"))),...e.slice(1)]}case"CAR":case"CDR":{const r=lt("pair",o(0,["pair"])[0]);return[S(r,r.args["CAR"===t.prim?0:1],w({f:1,v:1},{specialVar:!0}),0,t.prim.toLocaleLowerCase()),...e.slice(1)]}case"CONS":{const t=o(0,null,["list"]);return f(t[0],t[1].args[0]),[E({prim:"list",args:[t[1].args[0]]}),...e.slice(2)]}case"SIZE":return o(0,["string","list","set","map","bytes"]),[E({prim:"nat"}),...e.slice(1)];case"MEM":{const t=o(0,null,["set","map","big_map"]);return h(t[0]),f(t[0],t[1].args[0]),[E({prim:"bool"}),...e.slice(2)]}case"GET":if(t.args){const r=parseInt(t.args[0].int,10);return[E(O(o(0,["pair"])[0],r)),...e.slice(1)]}{const t=o(0,null,["map","big_map"]);return h(t[0]),f(t[0],t[1].args[0]),[E({prim:"option",args:[t[1].args[1]]}),...e.slice(2)]}case"UPDATE":if(t.args){const r=parseInt(t.args[0].int,10),n=o(0,null,["pair"]);return[E(x(n[1],n[0],r)),...e.slice(2)]}{const t=o(0,null,["bool","option"]);if(h(t[0]),"bool"===t[1].prim){const r=o(2,["set"]);return f(t[0],r[0].args[0]),[E({prim:"set",args:[_(t[0],{t:null})]}),...e.slice(3)]}const r=o(2,["map","big_map"]);return f(t[0],r[0].args[0]),"map"===r[0].prim?[E({prim:"map",args:[_(t[0],{t:null}),_(t[1].args[0],{t:null})]}),...e.slice(3)]:(y(t[1].args[0]),[E({prim:"big_map",args:[_(t[0],{t:null}),_(t[1].args[0],{t:null})]}),...e.slice(3)])}case"GET_AND_UPDATE":{const t=w({v:2}),r=o(0,null,["option"],["map","big_map"]);h(r[0]),f(r[0],r[2].args[0]),f(r[1].args[0],r[2].args[1]);const n=null===(i=t.v)||void 0===i?void 0:i.map((t=>"@"!==t?[t]:void 0));return"map"===r[2].prim?[_({prim:"option",args:[r[2].args[1]]},{v:null==n?void 0:n[0]}),_({prim:"map",args:[_(r[0],{t:null}),_(r[1].args[0],{t:null})]},{v:null==n?void 0:n[1]}),...e.slice(3)]:(y(r[1].args[0]),[_({prim:"option",args:[r[2].args[1]]},{v:null==n?void 0:n[0]}),_({prim:"big_map",args:[_(r[0],{t:null}),_(r[1].args[0],{t:null})]},{v:null==n?void 0:n[1]}),...e.slice(3)])}case"EXEC":{const t=o(0,null,["lambda"]);return f(t[0],t[1].args[0]),[E(t[1].args[1]),...e.slice(2)]}case"APPLY":{const r=o(0,null,["lambda"]);if(g(r[0]),v(r[0]),!dt(r[1].args[0]))throw new Oe(t,e,`${t.prim}: function's argument must be a pair: ${xe(r[1].args[0])}`);const n=r[1].args[0];return f(r[0],Te(n)[0]),[E({prim:"lambda",args:[Te(n)[1],r[1].args[1]]}),...e.slice(2)]}case"FAILWITH":{const t=o(0,null)[0];return m(n,d.PtEdo2Zk)||b(t),{failed:t,level:0}}case"NEVER":return o(0,["never"]),{failed:{prim:"never"},level:0};case"RENAME":return[E(o(0,null)[0]),...e.slice(1)];case"CONCAT":{const r=o(0,["string","list","bytes"]);if("list"===r[0].prim){if("string"!==xe(r[0].args[0])&&"bytes"!==xe(r[0].args[0]))throw new Oe(t,e,`${t.prim}: can't concatenate list of ${xe(r[0].args[0])}'s`);return[E(r[0].args[0]),...e.slice(1)]}const n=o(1,["string","bytes"]);if(r[0].prim!==n[0].prim)throw new Oe(t,e,`${t.prim}: can't concatenate ${r[0].prim} with ${n[0].prim}`);return[E(n[0]),...e.slice(2)]}case"SLICE":return[E({prim:"option",args:[o(0,["nat"],["nat"],["string","bytes"])[2]]},"@slice"),...e.slice(3)];case"PACK":{const t=o(0,null)[0];return b(t),[E({prim:"bytes"},"@packed"),...e.slice(1)]}case"ADD":{const r=o(0,["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if("nat"===r[0].prim&&"int"===r[1].prim||"int"===r[0].prim&&"nat"===r[1].prim)return[E({prim:"int"}),...e.slice(2)];if("int"===r[0].prim&&"timestamp"===r[1].prim||"timestamp"===r[0].prim&&"int"===r[1].prim)return[E({prim:"timestamp"}),...e.slice(2)];if(("int"===r[0].prim||"nat"===r[0].prim||"mutez"===r[0].prim||"bls12_381_g1"===r[0].prim||"bls12_381_g2"===r[0].prim||"bls12_381_fr"===r[0].prim)&&r[0].prim===r[1].prim)return[E(r[0]),...e.slice(2)];throw new Oe(t,e,`${t.prim}: can't add ${r[0].prim} to ${r[1].prim}`)}case"SUB":{const r=m(n,d.PsiThaCa)?o(0,["nat","int","timestamp","mutez"],["nat","int","timestamp","mutez"]):o(0,["nat","int","timestamp"],["nat","int","timestamp"]);if(("nat"===r[0].prim||"int"===r[0].prim)&&("nat"===r[1].prim||"int"===r[1].prim)||"timestamp"===r[0].prim&&"timestamp"===r[1].prim)return[E({prim:"int"}),...e.slice(2)];if("timestamp"===r[0].prim&&"int"===r[1].prim)return[E({prim:"timestamp"}),...e.slice(2)];if("mutez"===r[0].prim&&"mutez"===r[1].prim)return[E({prim:"mutez"}),...e.slice(2)];throw new Oe(t,e,`${t.prim}: can't subtract ${r[0].prim} from ${r[1].prim}`)}case"SUB_MUTEZ":return o(0,["mutez"],["mutez"]),[E({prim:"option",args:[{prim:"mutez"}]}),...e.slice(2)];case"MUL":{const r=o(0,["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if("nat"===r[0].prim&&"int"===r[1].prim||"int"===r[0].prim&&"nat"===r[1].prim)return[E({prim:"int"}),...e.slice(2)];if("nat"===r[0].prim&&"mutez"===r[1].prim||"mutez"===r[0].prim&&"nat"===r[1].prim)return[E({prim:"mutez"}),...e.slice(2)];if(("bls12_381_g1"===r[0].prim||"bls12_381_g2"===r[0].prim||"bls12_381_fr"===r[0].prim)&&"bls12_381_fr"===r[1].prim||("nat"===r[0].prim||"int"===r[0].prim)&&r[0].prim===r[1].prim)return[E(r[0]),...e.slice(2)];if(("nat"===r[0].prim||"int"===r[0].prim)&&"bls12_381_fr"===r[1].prim||("nat"===r[1].prim||"int"===r[1].prim)&&"bls12_381_fr"===r[0].prim)return[E({prim:"bls12_381_fr"}),...e.slice(2)];throw new Oe(t,e,`${t.prim}: can't multiply ${r[0].prim} by ${r[1].prim}`)}case"EDIV":{const r=(t,e)=>({prim:"option",args:[{prim:"pair",args:[{prim:t},{prim:e}]}]}),n=o(0,["nat","int","mutez"],["nat","int","mutez"]);if("nat"===n[0].prim&&"nat"===n[1].prim)return[E(r("nat","nat")),...e.slice(2)];if(!("nat"!==n[0].prim&&"int"!==n[0].prim||"nat"!==n[1].prim&&"int"!==n[1].prim))return[E(r("int","nat")),...e.slice(2)];if("mutez"===n[0].prim&&"nat"===n[1].prim)return[E(r("mutez","mutez")),...e.slice(2)];if("mutez"===n[0].prim&&"mutez"===n[1].prim)return[E(r("nat","mutez")),...e.slice(2)];throw new Oe(t,e,`${t.prim}: can't euclideally divide ${n[0].prim} by ${n[1].prim}`)}case"ABS":return o(0,["int"]),[E({prim:"nat"}),...e.slice(1)];case"ISNAT":return o(0,["int"]),[E({prim:"option",args:[{prim:"nat"}]}),...e.slice(1)];case"INT":return o(0,["nat","bls12_381_fr"]),[E({prim:"int"}),...e.slice(1)];case"NEG":{const t=o(0,["nat","int","bls12_381_g1","bls12_381_g2","bls12_381_fr"])[0];return"nat"===t.prim||"int"===t.prim?[E({prim:"int"}),...e.slice(1)]:[E(t),...e.slice(1)]}case"LSL":case"LSR":return o(0,["nat"],["nat"]),[E({prim:"nat"}),...e.slice(2)];case"OR":case"XOR":{const r=o(0,["nat","bool"],["nat","bool"]);if(r[0].prim!==r[1].prim)throw new Oe(t,e,`${t.prim}: both arguments must be of the same type: ${r[0].prim}, ${r[1].prim}`);return[E(r[1]),...e.slice(2)]}case"AND":{const r=o(0,["nat","bool","int"],["nat","bool"]);if(("int"!==r[0].prim||"nat"!==r[1].prim)&&r[0].prim!==r[1].prim)throw new Oe(t,e,`${t.prim}: both arguments must be of the same type: ${r[0].prim}, ${r[1].prim}`);return[E(r[1]),...e.slice(2)]}case"NOT":return"bool"===o(0,["nat","bool","int"])[0].prim?[E({prim:"bool"}),...e.slice(1)]:[E({prim:"int"}),...e.slice(1)];case"COMPARE":{const t=o(0,null,null);return h(t[0]),h(t[1]),[E({prim:"int"}),...e.slice(2)]}case"EQ":case"NEQ":case"LT":case"GT":case"LE":case"GE":return o(0,["int"]),[E({prim:"bool"}),...e.slice(1)];case"SELF":{if(void 0===(null==r?void 0:r.contract))throw new Oe(t,e,`${t.prim}: contract required`);const n=w({f:1,v:1}),i=De(r.contract,null===(s=n.f)||void 0===s?void 0:s[0]);if(null===i)throw new Oe(t,e,`${t.prim}: contract has no entrypoint ${i}`);return[_({prim:"contract",args:[i]},{v:n.v?n.v:["@self"]}),...e]}case"TRANSFER_TOKENS":{const t=o(0,null,["mutez"],["contract"]);return f(t[0],t[2].args[0]),[E({prim:"operation"}),...e.slice(3)]}case"SET_DELEGATE":{const r=o(0,["option"])[0];if("key_hash"!==xe(r.args[0]))throw new Oe(t,e,`${t.prim}: key hash expected: ${xe(r.args[0])}`);return[E({prim:"operation"}),...e.slice(1)]}case"IMPLICIT_ACCOUNT":return o(0,["key_hash"]),[E({prim:"contract",args:[{prim:"unit"}]}),...e.slice(1)];case"NOW":return[E({prim:"timestamp"},"@now"),...e];case"AMOUNT":return[E({prim:"mutez"},"@amount"),...e];case"BALANCE":return[E({prim:"mutez"},"@balance"),...e];case"CHECK_SIGNATURE":return o(0,["key"],["signature"],["bytes"]),[E({prim:"bool"}),...e.slice(3)];case"BLAKE2B":case"SHA256":case"SHA512":case"KECCAK":case"SHA3":return o(0,["bytes"]),[E({prim:"bytes"}),...e.slice(1)];case"HASH_KEY":return o(0,["key"]),[E({prim:"key_hash"}),...e.slice(1)];case"SOURCE":return[E({prim:"address"},"@source"),...e];case"SENDER":return[E({prim:"address"},"@sender"),...e];case"ADDRESS":{const t=o(0,["contract"])[0],r=w({v:1});return[_({prim:"address",[l]:t},{v:r.v?r.v:T(c(t),"address")}),...e.slice(1)]}case"SELF_ADDRESS":{const t={prim:"address"};return void 0!==(null==r?void 0:r.contract)&&(t[l]={prim:"contract",args:[Ce(r.contract,"parameter").args[0]]}),[E(t,"@address"),...e]}case"CHAIN_ID":return[E({prim:"chain_id"}),...e];case"DROP":{w({});const r=void 0!==t.args?parseInt(t.args[0].int,10):1;return o(r-1,null),e.slice(r)}case"DIG":{w({});const r=parseInt(t.args[0].int,10);return[o(r,null)[0],...e.slice(0,r),...e.slice(r+1)]}case"DUG":{w({});const r=parseInt(t.args[0].int,10);return[...e.slice(1,r+1),o(0,null)[0],...e.slice(r+1)]}case"NONE":return Ie(t.args[0]),[_({prim:"option",args:[t.args[0]]},w({t:1,v:1})),...e];case"LEFT":case"RIGHT":{const r=o(0,null)[0],n=w({f:2,t:1,v:1},{specialFields:!0}),i=c(r),s=[_(r,{t:null,v:null,f:n.f&&n.f.length>0&&"%"!==n.f[0]?"%@"===n.f[0]?i.v?["%"+i.v[0].slice(1)]:void 0:n.f:void 0}),_(t.args[0],{t:null,f:n.f&&n.f.length>1&&"%"!==n.f[1]?n.f:void 0})];return[_({prim:"or",args:"LEFT"===t.prim?s:[s[1],s[0]]},{t:n.t,v:n.v}),...e.slice(1)]}case"NIL":return Ie(t.args[0]),[_({prim:"list",args:[t.args[0]]},w({t:1,v:1})),...e];case"UNPACK":return o(0,["bytes"]),Ie(t.args[0]),[E({prim:"option",args:[t.args[0]]},"@unpacked"),...e.slice(1)];case"CONTRACT":{const r=o(0,["address"])[0];Ie(t.args[0]);const n=w({v:1,f:1}),i=r[l];if(void 0!==i){const r=De(i,null===(a=n.f)||void 0===a?void 0:a[0]);if(null===r)throw new Oe(t,e,`${t.prim}: contract has no entrypoint ${r}`);f(r,t.args[0])}return[_({prim:"option",args:[{prim:"contract",args:[t.args[0]]}]},{v:n.v?n.v:T(c(r),"contract")}),...e.slice(1)]}case"CAST":{w({});const r=o(0,null)[0];return Ie(t.args[0]),f(t.args[0],r),[t.args[0],...e.slice(1)]}case"IF_NONE":{w({});const n=o(0,["option"])[0],i=e.slice(1);return P(ke(t.args[0],i,r),ke(t.args[1],[_(n.args[0],{t:null,v:T(c(n),"some")}),...i],r))}case"IF_LEFT":{w({});const n=o(0,["or"])[0],i=c(n),s=c(n.args[0]),a=c(n.args[1]),u=e.slice(1);return P(ke(t.args[0],[_(n.args[0],{t:null,v:T(i,s.f?s.f[0].slice(1):"left")}),...u],r),ke(t.args[1],[_(n.args[1],{t:null,v:T(i,a.f?a.f[0].slice(1):"right")}),...u],r))}case"IF_CONS":{w({});const n=o(0,["list"])[0],i=c(n),s=e.slice(1);return P(ke(t.args[0],[_(n.args[0],{t:null,v:T(i,"hd")}),_(n,{t:null,v:T(i,"tl")}),...s],r),ke(t.args[1],s,r))}case"IF":{w({}),o(0,["bool"]);const n=e.slice(1);return P(ke(t.args[0],n,r),ke(t.args[1],n,r))}case"MAP":{const n=o(0,["list","map","option"])[0],i=e.slice(1),s="map"===n.prim?{prim:"pair",args:n.args}:n.args[0],a=ke(t.args[0],[_(s,{t:null,v:T(c(n),"elt")}),...i],r);if("failed"in a){if(!("prim"in a.failed)||"never"!==a.failed.prim)throw new Oe(t,e,`${t.prim}: FAIL is not allowed in MAP`);return{failed:a.failed,level:a.level+1}}if(a.length<1)throw new Oe(t,e,`${t.prim}: function must return a value`);return u(a.slice(1),i),"list"===n.prim?[E({prim:"list",args:[a[0]]}),...i]:"map"===n.prim?[E({prim:"map",args:[n.args[0],a[0]]}),...i]:[E({prim:"option",args:[a[0]]}),...i]}case"ITER":{w({});const n=o(0,["set","list","map"])[0],i=e.slice(1),s="map"===n.prim?{prim:"pair",args:n.args}:n.args[0],a=ke(t.args[0],[_(s,{t:null,v:T(c(n),"elt")}),...i],r);return"failed"in a?{failed:a.failed,level:a.level+1}:(u(a,i),i)}case"LOOP":{w({}),o(0,["bool"]);const n=e.slice(1),i=ke(t.args[0],n,r);return"failed"in i?{failed:i.failed,level:i.level+1}:(u(i,[{prim:"bool"},...n]),n)}case"LOOP_LEFT":{w({});const n=o(0,["or"])[0],i=e.slice(1),s=ke(t.args[0],[_(n.args[0],{t:null,v:T(c(n),"left")}),...i],r);return"failed"in s?{failed:s.failed,level:s.level+1}:(u(s,[n,...i]),[_(n.args[1],{t:null,v:w({v:1}).v}),...i])}case"DIP":{w({});const n=2===t.args.length?parseInt(t.args[0].int,10):1;o(n-1,null);const i=e.slice(0,n),s=e.slice(n),a=2===t.args.length?ke(t.args[1],s,r):ke(t.args[0],s,r);return"failed"in a?{failed:a.failed,level:a.level+1}:[...i,...a]}case"CREATE_CONTRACT":{const r=w({v:2}),n=o(0,["option"],["mutez"],null);if("key_hash"!==xe(n[0].args[0]))throw new Oe(t,e,`${t.prim}: key hash expected: ${xe(n[0].args[0])}`);g(n[2])&&(Be(t.args[0]),Pe(Ce(t.args[0],"storage").args[0],n[2]));const i=null===(p=r.v)||void 0===p?void 0:p.map((t=>"@"!==t?[t]:void 0));return[_({prim:"operation"},{v:null==i?void 0:i[0]}),_({prim:"address",[l]:{prim:"contract",args:[Ce(t.args[0],"parameter").args[0]]}},{v:null==i?void 0:i[1]}),...e.slice(3)]}case"PUSH":return Ie(t.args[0]),Ne(t.args[1],t.args[0],Object.assign(Object.assign({},r),{contract:void 0})),[E(t.args[0]),...e];case"EMPTY_SET":return Ie(t.args[0]),h(t.args[0]),[_({prim:"set",args:t.args},w({t:1,v:1})),...e];case"EMPTY_MAP":return Ie(t.args[0]),h(t.args[0]),Ie(t.args[1]),[_({prim:"map",args:t.args},w({t:1,v:1})),...e];case"EMPTY_BIG_MAP":return Ie(t.args[0]),h(t.args[0]),Ie(t.args[1]),y(t.args[0]),[_({prim:"big_map",args:t.args},w({t:1,v:1})),...e];case"LAMBDA":{Ie(t.args[0]),Ie(t.args[1]);const n=ke(t.args[2],[t.args[0]],Object.assign(Object.assign({},r),{contract:void 0}));if("failed"in n)return{failed:n.failed,level:n.level+1};if(1!==n.length)throw new Oe(t,e,`${t.prim}: function must return a value`);return f(t.args[1],n[0]),[E({prim:"lambda",args:[t.args[0],t.args[1]]}),...e]}case"LEVEL":return[E({prim:"nat"},"@level"),...e];case"TOTAL_VOTING_POWER":return[E({prim:"nat"}),...e];case"VOTING_POWER":return o(0,["key_hash"]),[E({prim:"nat"}),...e.slice(1)];case"TICKET":{const t=o(0,null,["nat"])[0];return h(t),[_({prim:"ticket",args:[t]},w({t:1,v:1})),...e.slice(2)]}case"JOIN_TICKETS":{const r=lt("pair",o(0,["pair"])[0]);if("ticket"!==xe(r.args[0]))throw new Oe(t,e,`${t.prim}: ticket expected: ${xe(r.args[0])}`);return f(r.args[0],r.args[1]),[E({prim:"option",args:[_(r.args[0],{t:null})]}),...e.slice(1)]}case"SPLIT_TICKET":{const r=o(0,["ticket"],["pair"]),n=lt("pair",r[1]);if("nat"!==xe(n.args[0]))throw new Oe(t,e,`${t.prim}: nat expected: ${xe(n.args[0])}`);return f(n.args[0],n.args[1]),[E({prim:"option",args:[{prim:"pair",args:[_(r[0],{t:null}),_(r[0],{t:null})]}]}),...e.slice(2)]}case"READ_TICKET":{const t=w({v:2}),r=o(0,["ticket"])[0],n=null===(R=t.v)||void 0===R?void 0:R.map((t=>"@"!==t?[t]:void 0));return[_({prim:"pair",args:[{prim:"address"},_(r.args[0],{t:null}),{prim:"nat"}]},{v:null==n?void 0:n[0]}),_(r,{v:null==n?void 0:n[1],t:null}),...e.slice(1)]}case"PAIRING_CHECK":{const r=o(0,["list"])[0].args[0];if(!dt(r))throw new Oe(t,e,`${t.prim}: pair expected: ${xe(r)}`);const n=lt("pair",r);if("bls12_381_g1"!==xe(n.args[0]))throw new Oe(t,e,`${t.prim}: bls12_381_g1 expected: ${xe(n.args[0])}`);if("bls12_381_g2"!==xe(n.args[1]))throw new Oe(t,e,`${t.prim}: bls12_381_g2 expected: ${xe(n.args[1])}`);return[E({prim:"bool"}),...e.slice(1)]}case"SAPLING_EMPTY_STATE":return[_({prim:"sapling_state",args:[t.args[0]]},w({v:1,t:1})),...e];case"SAPLING_VERIFY_UPDATE":{const r=o(0,["sapling_transaction"],["sapling_state"]);if(parseInt(r[0].args[0].int,10)!==parseInt(r[1].args[0].int,10))throw new Oe(t,e,`${t.prim}: sapling memo size mismatch: ${r[0].args[0].int} != ${r[1].args[0].int}`);return[E({prim:"option",args:[{prim:"pair",args:[{prim:"int"},_(r[1],{t:null})]}]}),...e.slice(2)]}case"OPEN_CHEST":return o(0,["chest_key"],["chest"],["nat"]),[E({prim:"or",args:[{prim:"bytes"},{prim:"bool"}]}),...e.slice(3)];case"VIEW":{const r=o(0,null,["address"]);return v(r[0]),[E({prim:"option",args:[t.args[1]]}),...e.slice(2)]}default:throw new tt(t,`unexpected instruction: ${t.prim}`)}})(i);if(void 0!==(null==r?void 0:r.traceCallback)){const t={op:i,in:e,out:R};r.traceCallback(t)}return R}function Ce(t,e){for(const r of t)if(r.prim===e)return r;throw new tt(t,`missing contract section: ${e}`)}function Le(t){const e={};for(const r of t)"view"===r.prim&&(e[r.args[0].string]=r);return e}function je(t){if(Array.isArray(t))for(const e of t)if("prim"in e&&("parameter"===e.prim||"storage"===e.prim||"code"===e.prim))return!0;return!1}function De(t,e){e=e||"%default";const r=Ue(t).find((t=>t[0]===e));return void 0!==r?r[1]:"%default"===e?je(t)?Ce(t,"parameter").args[0]:t:null}function Ue(t){if(je(t)){const e=Ce(t,"parameter"),r=Ue(e.args[0]),n=ct(e);return n.f?[[n.f[0],e.args[0]],...r]:r}if(e=t,Array.isArray(e)||"or"===e.prim){const e=Te(t),r=t=>{const r=ct(e[t]);if("or"===xe(e[t])){const n=Ue(e[t]);return r.f?[[r.f[0],e[t]],...n]:n}return r.f?[[r.f[0],e[t]]]:[]};return[...r(0),...r(1)]}var e;return[]}function Be(t,e){const r=(r,n,i,o)=>{Ie(r,!0),Ie(n);const s=ke(o,[{prim:"pair",args:[Object.assign(Object.assign({},r),{annots:["@parameter"]}),Object.assign(Object.assign({},n),{annots:["@storage"]})]}],Object.assign(Object.assign({},e),{contract:t}));if("failed"in s)return s;try{Re(s,[i])}catch(t){throw t instanceof tt?new Oe(o,s,t.message):t}return s},n=Ce(t,"parameter").args[0],i=Ce(t,"storage").args[0],o=r(n,i,{prim:"pair",args:[{prim:"list",args:[{prim:"operation"}]},i]},Ce(t,"code").args[0]);for(const e of Object.values(Le(t)))r(e.args[1],i,e.args[2],e.args[3]);return o}function Fe(t,e,r){Ie(e),Ne(t,e,r||null)}function Ve(t,e,r){for(const t of e)Ie(t);if(void 0!==(null==r?void 0:r.contract))for(const t of["parameter","storage"]){Ie(Ce(r.contract,t).args[0])}return ke(t,e,r||null)}function Ke(t,e,r=!1){if(Array.isArray(t)){for(const e of t)Ie(e);for(const t of e)Ie(t)}else Ie(t),Ie(e);Pe(t,e,r)}function He(t,e=!1){try{return Ie(t,e),!0}catch(t){return!1}}function $e(t,e){try{return Be(t,e)}catch(t){return null}}function Ge(t,e,r){try{return Fe(t,e,r),!0}catch(t){return!1}}function ze(t,e,r=!1){try{return Ke(t,e,r),!0}catch(t){return!1}}class qe{constructor(t,e){this.contract=t,this.ctx=Object.assign({contract:t},e),this.output=Be(t,this.ctx)}static parse(t,e){const r=new F(e),n="string"==typeof t?r.parseScript(t):r.parseJSON(t);if(null===n)throw new Error("empty contract");if(Ht(n))return new qe(n,e)}static parseTypeExpression(t,e){const r=new F(e),n="string"==typeof t?r.parseScript(t):r.parseJSON(t);if(null===n)throw new Error("empty type expression");if(Ft(n)&&Ie(n))return n;throw void 0}static parseDataExpression(t,e){const r=new F(e),n="string"==typeof t?r.parseScript(t):r.parseJSON(t);if(null===n)throw new Error("empty data expression");if(Kt(n))return n;throw void 0}section(t){return Ce(this.contract,t)}entryPoints(){return Ue(this.contract)}entryPoint(t){return De(this.contract,t)}assertDataValid(t,e){Fe(t,e,this.ctx)}isDataValid(t,e){return Ge(t,e,this.ctx)}assertParameterValid(t,e){const r=this.entryPoint(t||void 0);if(null===r)throw new Error(`contract has no entrypoint named ${t}`);this.assertDataValid(e,r)}isParameterValid(t,e){try{return this.assertParameterValid(t,e),!0}catch(t){return!1}}functionType(t,e){return Ve(t,e,this.ctx)}}const We=new qe([{prim:"parameter",args:[{prim:"unit"}]},{prim:"storage",args:[{prim:"unit"}]},{prim:"code",args:[[{prim:"CAR"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PAIR"}]]}]);function Ye(t){return"failed"in t?`[FAILED: ${G(t.failed)}]`:t.map(((t,e)=>{const r=ct(t);return`[${e}${r.v?"/"+r.v[0]:""}]: ${G(t)}`})).join("\n")}function Je(t,e){return r=>{var i;if(Array.isArray(r)&&!t)return;const o=null===(i=r.op[n])||void 0===i?void 0:i.macro,s=`${o?"Macro":"Op"}: ${o?G(o,void 0,!0)+" / ":""}${G(r.op)}\nInput:\n${Ye(r.in)}\nOutput:\n${Ye(r.out)}\n`;e(s)}}function Ze(t){var e;if(t instanceof Oe){const r=null===(e=t.val[n])||void 0===e?void 0:e.macro;return`${r?"Macro":"Op"}: ${r?G(r,void 0,!0)+" / ":""}${G(t.val)}\nStack:\n${Ye(t.stackState)}\n`}if(t instanceof rt){return`Type: ${Array.isArray(t.val)?"["+t.val.map(((t,e)=>`[${e}]: ${G(t)}`)).join("; ")+"]":G(t.val)}\n${t.data?`Data: ${G(t.data)}\n`:""}\n`}return`Value: ${G(t.val)}`}const Xe={commitHash:"5da8cec9c84c0ab7bc37c0eb09e68db1b3a8b1f0",version:"12.0.0-beta-RC.0"}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.NoopGlobalConstantsProvider=void 0;const i=r(122);e.NoopGlobalConstantsProvider=class{getGlobalConstantByHash(t){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredGlobalConstantsProviderError}))}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ObservableSubscription=void 0;const n=r(53),i=r(86);e.ObservableSubscription=class{constructor(t,e=!1,r=i.retry()){this.shouldRetry=e,this.operatorFunction=r,this.errorListeners=[],this.messageListeners=[],this.closeListeners=[],this.completed$=new n.Subject,t.pipe(i.takeUntil(this.completed$),i.tap((t=>{this.call(this.messageListeners,t)}),(t=>{this.call(this.errorListeners,t)}),(()=>{this.call(this.closeListeners)})),this.shouldRetry?r:i.tap(),i.catchError((()=>n.NEVER))).subscribe()}call(t,e){for(const r of t)try{r(e)}catch(t){console.error(t)}}remove(t,e){const r=t.indexOf(e);-1!==r&&t.splice(r,1)}on(t,e){switch(t){case"data":this.messageListeners.push(e);break;case"error":this.errorListeners.push(e);break;case"close":this.closeListeners.push(e);break;default:throw new Error(`Trying to register on an unsupported event: ${t}`)}}off(t,e){switch(t){case"data":this.remove(this.messageListeners,e);break;case"error":this.remove(this.errorListeners,e);break;case"close":this.remove(this.closeListeners,e);break;default:throw new Error(`Trying to unregister on an unsupported event: ${t}`)}}close(){this.completed$.next()}}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.TaquitoLocalForger=void 0;const i=r(288);e.TaquitoLocalForger=class{constructor(t){this.context=t}getNextProto(){return n(this,void 0,void 0,(function*(){if(!this.context.proto){const t=yield this.context.readProvider.getNextProtocol("head");this.context.proto=t}return this.context.proto}))}forge({branch:t,contents:e}){return n(this,void 0,void 0,(function*(){return new i.LocalForger(yield this.getNextProto()).forge({branch:t,contents:e})}))}}},function(t,e,r){t.exports=r(184)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(203),i=r(209),o=r(78);function s(t){var e=new Float64Array(16);if(t)for(var r=0;r<t.length;r++)e[r]=t[r];return e}e.SIGNATURE_LENGTH=64,e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=64,e.SEED_LENGTH=32,new Uint8Array(32)[0]=9;var a=s(),c=s([1]),u=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),f=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),l=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),d=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function p(t,e){for(var r=0;r<16;r++)t[r]=0|e[r]}function b(t){for(var e=1,r=0;r<16;r++){var n=t[r]+e+65535;e=Math.floor(n/65536),t[r]=n-65536*e}t[0]+=e-1+37*(e-1)}function g(t,e,r){for(var n=~(r-1),i=0;i<16;i++){var o=n&(t[i]^e[i]);t[i]^=o,e[i]^=o}}function m(t,e){for(var r=s(),n=s(),i=0;i<16;i++)n[i]=e[i];b(n),b(n),b(n);for(var o=0;o<2;o++){r[0]=n[0]-65517;for(i=1;i<15;i++)r[i]=n[i]-65535-(r[i-1]>>16&1),r[i-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);var a=r[15]>>16&1;r[14]&=65535,g(n,r,1-a)}for(i=0;i<16;i++)t[2*i]=255&n[i],t[2*i+1]=n[i]>>8}function v(t,e){for(var r=0,n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function y(t,e){var r=new Uint8Array(32),n=new Uint8Array(32);return m(r,t),m(n,e),v(r,n)}function w(t){var e=new Uint8Array(32);return m(e,t),1&e[0]}function _(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]+r[n]}function E(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]-r[n]}function S(t,e,r){var n,i,o=0,s=0,a=0,c=0,u=0,f=0,h=0,l=0,d=0,p=0,b=0,g=0,m=0,v=0,y=0,w=0,_=0,E=0,S=0,A=0,O=0,x=0,T=0,P=0,R=0,I=0,M=0,N=0,k=0,C=0,L=0,j=r[0],D=r[1],U=r[2],B=r[3],F=r[4],V=r[5],K=r[6],H=r[7],$=r[8],G=r[9],z=r[10],q=r[11],W=r[12],Y=r[13],J=r[14],Z=r[15];o+=(n=e[0])*j,s+=n*D,a+=n*U,c+=n*B,u+=n*F,f+=n*V,h+=n*K,l+=n*H,d+=n*$,p+=n*G,b+=n*z,g+=n*q,m+=n*W,v+=n*Y,y+=n*J,w+=n*Z,s+=(n=e[1])*j,a+=n*D,c+=n*U,u+=n*B,f+=n*F,h+=n*V,l+=n*K,d+=n*H,p+=n*$,b+=n*G,g+=n*z,m+=n*q,v+=n*W,y+=n*Y,w+=n*J,_+=n*Z,a+=(n=e[2])*j,c+=n*D,u+=n*U,f+=n*B,h+=n*F,l+=n*V,d+=n*K,p+=n*H,b+=n*$,g+=n*G,m+=n*z,v+=n*q,y+=n*W,w+=n*Y,_+=n*J,E+=n*Z,c+=(n=e[3])*j,u+=n*D,f+=n*U,h+=n*B,l+=n*F,d+=n*V,p+=n*K,b+=n*H,g+=n*$,m+=n*G,v+=n*z,y+=n*q,w+=n*W,_+=n*Y,E+=n*J,S+=n*Z,u+=(n=e[4])*j,f+=n*D,h+=n*U,l+=n*B,d+=n*F,p+=n*V,b+=n*K,g+=n*H,m+=n*$,v+=n*G,y+=n*z,w+=n*q,_+=n*W,E+=n*Y,S+=n*J,A+=n*Z,f+=(n=e[5])*j,h+=n*D,l+=n*U,d+=n*B,p+=n*F,b+=n*V,g+=n*K,m+=n*H,v+=n*$,y+=n*G,w+=n*z,_+=n*q,E+=n*W,S+=n*Y,A+=n*J,O+=n*Z,h+=(n=e[6])*j,l+=n*D,d+=n*U,p+=n*B,b+=n*F,g+=n*V,m+=n*K,v+=n*H,y+=n*$,w+=n*G,_+=n*z,E+=n*q,S+=n*W,A+=n*Y,O+=n*J,x+=n*Z,l+=(n=e[7])*j,d+=n*D,p+=n*U,b+=n*B,g+=n*F,m+=n*V,v+=n*K,y+=n*H,w+=n*$,_+=n*G,E+=n*z,S+=n*q,A+=n*W,O+=n*Y,x+=n*J,T+=n*Z,d+=(n=e[8])*j,p+=n*D,b+=n*U,g+=n*B,m+=n*F,v+=n*V,y+=n*K,w+=n*H,_+=n*$,E+=n*G,S+=n*z,A+=n*q,O+=n*W,x+=n*Y,T+=n*J,P+=n*Z,p+=(n=e[9])*j,b+=n*D,g+=n*U,m+=n*B,v+=n*F,y+=n*V,w+=n*K,_+=n*H,E+=n*$,S+=n*G,A+=n*z,O+=n*q,x+=n*W,T+=n*Y,P+=n*J,R+=n*Z,b+=(n=e[10])*j,g+=n*D,m+=n*U,v+=n*B,y+=n*F,w+=n*V,_+=n*K,E+=n*H,S+=n*$,A+=n*G,O+=n*z,x+=n*q,T+=n*W,P+=n*Y,R+=n*J,I+=n*Z,g+=(n=e[11])*j,m+=n*D,v+=n*U,y+=n*B,w+=n*F,_+=n*V,E+=n*K,S+=n*H,A+=n*$,O+=n*G,x+=n*z,T+=n*q,P+=n*W,R+=n*Y,I+=n*J,M+=n*Z,m+=(n=e[12])*j,v+=n*D,y+=n*U,w+=n*B,_+=n*F,E+=n*V,S+=n*K,A+=n*H,O+=n*$,x+=n*G,T+=n*z,P+=n*q,R+=n*W,I+=n*Y,M+=n*J,N+=n*Z,v+=(n=e[13])*j,y+=n*D,w+=n*U,_+=n*B,E+=n*F,S+=n*V,A+=n*K,O+=n*H,x+=n*$,T+=n*G,P+=n*z,R+=n*q,I+=n*W,M+=n*Y,N+=n*J,k+=n*Z,y+=(n=e[14])*j,w+=n*D,_+=n*U,E+=n*B,S+=n*F,A+=n*V,O+=n*K,x+=n*H,T+=n*$,P+=n*G,R+=n*z,I+=n*q,M+=n*W,N+=n*Y,k+=n*J,C+=n*Z,w+=(n=e[15])*j,s+=38*(E+=n*U),a+=38*(S+=n*B),c+=38*(A+=n*F),u+=38*(O+=n*V),f+=38*(x+=n*K),h+=38*(T+=n*H),l+=38*(P+=n*$),d+=38*(R+=n*G),p+=38*(I+=n*z),b+=38*(M+=n*q),g+=38*(N+=n*W),m+=38*(k+=n*Y),v+=38*(C+=n*J),y+=38*(L+=n*Z),o=(n=(o+=38*(_+=n*D))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),t[0]=o,t[1]=s,t[2]=a,t[3]=c,t[4]=u,t[5]=f,t[6]=h,t[7]=l,t[8]=d,t[9]=p,t[10]=b,t[11]=g,t[12]=m,t[13]=v,t[14]=y,t[15]=w}function A(t,e){S(t,e,e)}function O(t,e){var r,n=s();for(r=0;r<16;r++)n[r]=e[r];for(r=253;r>=0;r--)A(n,n),2!==r&&4!==r&&S(n,n,e);for(r=0;r<16;r++)t[r]=n[r]}function x(t,e){var r=s(),n=s(),i=s(),o=s(),a=s(),c=s(),u=s(),h=s(),l=s();E(r,t[1],t[0]),E(l,e[1],e[0]),S(r,r,l),_(n,t[0],t[1]),_(l,e[0],e[1]),S(n,n,l),S(i,t[3],e[3]),S(i,i,f),S(o,t[2],e[2]),_(o,o,o),E(a,n,r),E(c,o,i),_(u,o,i),_(h,n,r),S(t[0],a,c),S(t[1],h,u),S(t[2],u,c),S(t[3],a,h)}function T(t,e,r){for(var n=0;n<4;n++)g(t[n],e[n],r)}function P(t,e){var r=s(),n=s(),i=s();O(i,e[2]),S(r,e[0],i),S(n,e[1],i),m(t,n),t[31]^=w(r)<<7}function R(t,e,r){p(t[0],a),p(t[1],c),p(t[2],c),p(t[3],a);for(var n=255;n>=0;--n){var i=r[n/8|0]>>(7&n)&1;T(t,e,i),x(e,t),x(t,t),T(t,e,i)}}function I(t,e){var r=[s(),s(),s(),s()];p(r[0],h),p(r[1],l),p(r[2],c),S(r[3],h,l),R(t,r,e)}function M(t){if(t.length!==e.SEED_LENGTH)throw new Error("ed25519: seed must be "+e.SEED_LENGTH+" bytes");var r=i.hash(t);r[0]&=248,r[31]&=127,r[31]|=64;var n=new Uint8Array(32),o=[s(),s(),s(),s()];I(o,r),P(n,o);var a=new Uint8Array(64);return a.set(t),a.set(n,32),{publicKey:n,secretKey:a}}e.generateKeyPairFromSeed=M,e.generateKeyPair=function(t){var e=n.randomBytes(32,t),r=M(e);return o.wipe(e),r},e.extractPublicKeyFromSecretKey=function(t){if(t.length!==e.SECRET_KEY_LENGTH)throw new Error("ed25519: secret key must be "+e.SECRET_KEY_LENGTH+" bytes");return new Uint8Array(t.subarray(32))};var N=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function k(t,e){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i<o;++i)e[i]+=r-16*e[n]*N[i-(n-32)],r=Math.floor((e[i]+128)/256),e[i]-=256*r;e[i]+=r,e[n]=0}for(r=0,i=0;i<32;i++)e[i]+=r-(e[31]>>4)*N[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*N[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=255&e[n]}function C(t){for(var e=new Float64Array(64),r=0;r<64;r++)e[r]=t[r];for(r=0;r<64;r++)t[r]=0;k(t,e)}function L(t,e){var r=s(),n=s(),i=s(),o=s(),f=s(),h=s(),l=s();return p(t[2],c),function(t,e){for(var r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}(t[1],e),A(i,t[1]),S(o,i,u),E(i,i,t[2]),_(o,t[2],o),A(f,o),A(h,f),S(l,h,f),S(r,l,i),S(r,r,o),function(t,e){var r,n=s();for(r=0;r<16;r++)n[r]=e[r];for(r=250;r>=0;r--)A(n,n),1!==r&&S(n,n,e);for(r=0;r<16;r++)t[r]=n[r]}(r,r),S(r,r,i),S(r,r,o),S(r,r,o),S(t[0],r,o),A(n,t[0]),S(n,n,o),y(n,i)&&S(t[0],t[0],d),A(n,t[0]),S(n,n,o),y(n,i)?-1:(w(t[0])===e[31]>>7&&E(t[0],a,t[0]),S(t[3],t[0],t[1]),0)}e.sign=function(t,e){var r=new Float64Array(64),n=[s(),s(),s(),s()],o=i.hash(t.subarray(0,32));o[0]&=248,o[31]&=127,o[31]|=64;var a=new Uint8Array(64);a.set(o.subarray(32),32);var c=new i.SHA512;c.update(a.subarray(32)),c.update(e);var u=c.digest();c.clean(),C(u),I(n,u),P(a,n),c.reset(),c.update(a.subarray(0,32)),c.update(t.subarray(32)),c.update(e);var f=c.digest();C(f);for(var h=0;h<32;h++)r[h]=u[h];for(h=0;h<32;h++)for(var l=0;l<32;l++)r[h+l]+=f[h]*o[l];return k(a.subarray(32),r),a},e.verify=function(t,r,n){var o=new Uint8Array(32),a=[s(),s(),s(),s()],c=[s(),s(),s(),s()];if(n.length!==e.SIGNATURE_LENGTH)throw new Error("ed25519: signature must be "+e.SIGNATURE_LENGTH+" bytes");if(L(c,t))return!1;var u=new i.SHA512;u.update(n.subarray(0,32)),u.update(t),u.update(r);var f=u.digest();return C(f),R(a,c,f),I(c,n.subarray(32)),x(a,c),P(o,a),!v(n,o)},e.convertPublicKeyToX25519=function(t){var e=[s(),s(),s(),s()];if(L(e,t))throw new Error("Ed25519: invalid public key");var r=s(),n=s(),i=e[1];_(r,c,i),E(n,c,i),O(n,n),S(r,r,n);var o=new Uint8Array(32);return m(o,r),o},e.convertSecretKeyToX25519=function(t){var e=i.hash(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;var r=new Uint8Array(e.subarray(0,32));return o.wipe(e),r}},function(t,e,r){(function(e){t.exports=function(t){return ArrayBuffer.isView(t)?e.from(t.buffer,t.byteOffset,t.byteLength):e.from(t)}}).call(this,r(14).Buffer)},function(t,e,r){"use strict";t.exports=function(t,e){e||(e={}),"function"==typeof e&&(e={cmp:e});var r,n="boolean"==typeof e.cycles&&e.cycles,i=e.cmp&&(r=e.cmp,function(t){return function(e,n){var i={key:e,value:t[e]},o={key:n,value:t[n]};return r(i,o)}}),o=[];return function t(e){if(e&&e.toJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),void 0!==e){if("number"==typeof e)return isFinite(e)?""+e:"null";if("object"!=typeof e)return JSON.stringify(e);var r,s;if(Array.isArray(e)){for(s="[",r=0;r<e.length;r++)r&&(s+=","),s+=t(e[r])||"null";return s+"]"}if(null===e)return"null";if(-1!==o.indexOf(e)){if(n)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var a=o.push(e)-1,c=Object.keys(e).sort(i&&i(e));for(s="",r=0;r<c.length;r++){var u=c[r],f=t(e[u]);f&&(s&&(s+=","),s+=JSON.stringify(u)+":"+f)}return o.splice(a,1),"{"+s+"}"}}(t)}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.TezosToolkit=e.RpcReadAdapter=e.ObservableSubscription=e.PollingSubscribeProvider=e.OperationBatch=e.RpcForger=e.CompositeForger=e.UnitValue=e.MichelsonMap=void 0;const o=r(22),s=r(157),a=r(160),c=r(176),u=r(121),f=r(123),h=r(158),l=r(124),d=r(289),p=r(85),b=r(178);var g=r(62);Object.defineProperty(e,"MichelsonMap",{enumerable:!0,get:function(){return g.MichelsonMap}}),Object.defineProperty(e,"UnitValue",{enumerable:!0,get:function(){return g.UnitValue}}),i(r(84),e),i(r(157),e),i(r(171),e),i(r(173),e);var m=r(290);Object.defineProperty(e,"CompositeForger",{enumerable:!0,get:function(){return m.CompositeForger}});var v=r(291);Object.defineProperty(e,"RpcForger",{enumerable:!0,get:function(){return v.RpcForger}}),i(r(292),e);var y=r(83);Object.defineProperty(e,"OperationBatch",{enumerable:!0,get:function(){return y.OperationBatch}}),i(r(293),e),i(r(294),e);var w=r(124);Object.defineProperty(e,"PollingSubscribeProvider",{enumerable:!0,get:function(){return w.PollingSubscribeProvider}});var _=r(177);Object.defineProperty(e,"ObservableSubscription",{enumerable:!0,get:function(){return _.ObservableSubscription}}),i(r(295),e),i(r(85),e),i(r(296),e),i(r(174),e),i(r(297),e),i(r(298),e),i(r(299),e),i(r(121),e),i(r(300),e),i(r(122),e),i(r(301),e);var E=r(123);Object.defineProperty(e,"RpcReadAdapter",{enumerable:!0,get:function(){return E.RpcReadAdapter}}),i(r(302),e);e.TezosToolkit=class{constructor(t){this._rpc=t,this._options={},this.format=a.format,"string"==typeof this._rpc?this._rpcClient=new o.RpcClient(this._rpc):this._rpcClient=this._rpc,this._context=new s.Context(t),this._wallet=new p.Wallet(this._context),this.setProvider({rpc:this._rpcClient}),this.batch=this._context.batch.batch.bind(this._context.batch)}setProvider({rpc:t,stream:e,signer:r,protocol:n,config:i,forger:o,wallet:s,packer:a,globalConstantsProvider:c,readProvider:u}){this.setRpcProvider(t),this.setStreamProvider(e),this.setSignerProvider(r),this.setForgerProvider(o),this.setWalletProvider(s),this.setPackerProvider(a),this.setGlobalConstantsProvider(c),this.setReadProvider(u),this._context.proto=n,i&&this._context.setPartialConfig(i)}setSignerProvider(t){this._options.signer||void 0!==t?void 0!==t&&(this._context.signer=t,this._options.signer=t):(this._context.signer=new h.NoopSigner,this._options.signer=t)}setRpcProvider(t){"string"==typeof t?this._rpcClient=new o.RpcClient(t):void 0===t||(this._rpcClient=t),this._options.rpc=this._rpcClient,this._context.rpc=this._rpcClient}setForgerProvider(t){if(void 0!==t)this._options.forger=t,this._context.forger=t;else if(void 0===this._options.forger){const t=this.getFactory(b.TaquitoLocalForger)();this._options.forger=t,this._context.forger=t}}setStreamProvider(t){if("string"==typeof t){const e=new l.PollingSubscribeProvider(new s.Context(new o.RpcClient(t)));this._options.stream=e,this._context.stream=e}else if(void 0!==t)this._options.stream=t,this._context.stream=t;else if(void 0===this._options.stream){const t=this.getFactory(l.PollingSubscribeProvider)();this._options.stream=t,this._context.stream=t}}setWalletProvider(t){if(this._options.wallet||void 0!==t)void 0!==t&&(this._options.wallet=t,this._context.walletProvider=t);else{const t=this.getFactory(p.LegacyWalletProvider)();this._options.wallet=t,this._context.walletProvider=t}}setPackerProvider(t){if(this._options.packer||void 0!==t)void 0!==t&&(this._context.packer=t,this._options.packer=t);else{const t=this.getFactory(u.RpcPacker)();this._context.packer=t,this._options.packer=t}}setGlobalConstantsProvider(t){if(this._options.globalConstantsProvider||void 0!==t)void 0!==t&&(this._context.globalConstantsProvider=t,this._options.globalConstantsProvider=t);else{const t=new c.NoopGlobalConstantsProvider;this._context.globalConstantsProvider=t,this._options.globalConstantsProvider=t}}setReadProvider(t){const e=void 0===t?this.getFactory(f.RpcReadAdapter)():t;this._options.readProvider=e,this._context.readProvider=e}get tz(){return this._context.tz}get contract(){return this._context.contract}get wallet(){return this._wallet}get operation(){return this._context.operationFactory}get estimate(){return this._context.estimate}get stream(){return this._context.stream}get rpc(){return this._context.rpc}get signer(){return this._context.signer}get globalConstants(){return this._context.globalConstantsProvider}addExtension(t){Array.isArray(t)?t.forEach((t=>t.configureContext(this._context))):t.configureContext(this._context)}getFactory(t){return(...e)=>new t(this._context,...e)}getVersionInfo(){return d.VERSION}}},function(t,e,r){"use strict";var n=r(18),i=r(128),o=r(185),s=r(134);var a=function t(e){var r=new o(e),a=i(o.prototype.request,r);return n.extend(a,o.prototype,r),n.extend(a,r),a.create=function(r){return t(s(e,r))},a}(r(91));a.Axios=o,a.Cancel=r(92),a.CancelToken=r(198),a.isCancel=r(133),a.VERSION=r(135).version,a.all=function(t){return Promise.all(t)},a.spread=r(199),a.isAxiosError=r(200),t.exports=a,t.exports.default=a},function(t,e,r){"use strict";var n=r(18),i=r(129),o=r(186),s=r(187),a=r(134),c=r(197),u=c.validators;function f(t){this.defaults=t,this.interceptors={request:new o,response:new o}}f.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;void 0!==r&&c.assertOptions(r,{silentJSONParsing:u.transitional(u.boolean),forcedJSONParsing:u.transitional(u.boolean),clarifyTimeoutError:u.transitional(u.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(i=i&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var o,f=[];if(this.interceptors.response.forEach((function(t){f.push(t.fulfilled,t.rejected)})),!i){var h=[s,void 0];for(Array.prototype.unshift.apply(h,n),h=h.concat(f),o=Promise.resolve(e);h.length;)o=o.then(h.shift(),h.shift());return o}for(var l=e;n.length;){var d=n.shift(),p=n.shift();try{l=d(l)}catch(t){p(t);break}}try{o=s(l)}catch(t){return Promise.reject(t)}for(;f.length;)o=o.then(f.shift(),f.shift());return o},f.prototype.getUri=function(t){return t=a(this.defaults,t),i(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(t){f.prototype[t]=function(e,r){return this.request(a(r||{},{method:t,url:e,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(t){f.prototype[t]=function(e,r,n){return this.request(a(n||{},{method:t,url:e,data:r}))}})),t.exports=f},function(t,e,r){"use strict";var n=r(18);function i(){this.handlers=[]}i.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},i.prototype.forEach=function(t){n.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=i},function(t,e,r){"use strict";var n=r(18),i=r(188),o=r(133),s=r(91),a=r(92);function c(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new a("canceled")}t.exports=function(t){return c(t),t.headers=t.headers||{},t.data=i.call(t,t.data,t.headers,t.transformRequest),t.headers=n.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||s.adapter)(t).then((function(e){return c(t),e.data=i.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return o(e)||(c(t),e&&e.response&&(e.response.data=i.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))}},function(t,e,r){"use strict";var n=r(18),i=r(91);t.exports=function(t,e,r){var o=this||i;return n.forEach(r,(function(r){t=r.call(o,t,e)})),t}},function(t,e,r){"use strict";var n=r(18);t.exports=function(t,e){n.forEach(t,(function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])}))}},function(t,e,r){"use strict";var n=r(132);t.exports=function(t,e,r){var i=r.config.validateStatus;r.status&&i&&!i(r.status)?e(n("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)}},function(t,e,r){"use strict";var n=r(18);t.exports=n.isStandardBrowserEnv()?{write:function(t,e,r,i,o,s){var a=[];a.push(t+"="+encodeURIComponent(e)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(i)&&a.push("path="+i),n.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(t,e,r){"use strict";var n=r(193),i=r(194);t.exports=function(t,e){return t&&!n(e)?i(t,e):e}},function(t,e,r){"use strict";t.exports=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}},function(t,e,r){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},function(t,e,r){"use strict";var n=r(18),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,r,o,s={};return t?(n.forEach(t.split("\n"),(function(t){if(o=t.indexOf(":"),e=n.trim(t.substr(0,o)).toLowerCase(),r=n.trim(t.substr(o+1)),e){if(s[e]&&i.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([r]):s[e]?s[e]+", "+r:r}})),s):s}},function(t,e,r){"use strict";var n=r(18);t.exports=n.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(t){var n=t;return e&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=i(window.location.href),function(e){var r=n.isString(e)?i(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0}},function(t,e,r){"use strict";var n=r(135).version,i={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){i[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var o={};i.transitional=function(t,e,r){function i(t,e){return"[Axios v"+n+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,n,s){if(!1===t)throw new Error(i(n," has been removed"+(e?" in "+e:"")));return e&&!o[n]&&(o[n]=!0,console.warn(i(n," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,n,s)}},t.exports={assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var o=n[i],s=e[o];if(s){var a=t[o],c=void 0===a||s(a,o,t);if(!0!==c)throw new TypeError("option "+o+" must be "+c)}else if(!0!==r)throw Error("Unknown option "+o)}},validators:i}},function(t,e,r){"use strict";var n=r(92);function i(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;this.promise.then((function(t){if(r._listeners){var e,n=r._listeners.length;for(e=0;e<n;e++)r._listeners[e](t);r._listeners=null}})),this.promise.then=function(t){var e,n=new Promise((function(t){r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t){r.reason||(r.reason=new n(t),e(r.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},i.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},i.source=function(){var t;return{token:new i((function(e){t=e})),cancel:t}},t.exports=i},function(t,e,r){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,r){"use strict";var n=r(18);t.exports=function(t){return n.isObject(t)&&!0===t.isAxiosError}},function(t,e,r){"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=u(t),s=n[0],a=n[1],c=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),f=0,h=a>0?s-4:s;for(r=0;r<h;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],c[f++]=e>>16&255,c[f++]=e>>8&255,c[f++]=255&e;2===a&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,c[f++]=255&e);1===a&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,c[f++]=e>>8&255,c[f++]=255&e);return c},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,c=r-i;a<c;a+=s)o.push(f(t,a,a+s>c?c:a+s));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function f(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,f=-7,h=r?i-1:0,l=r?-1:1,d=t[e+h];for(h+=l,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+t[e+h],h+=l,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+t[e+h],h+=l,f-=8);if(0===o)o=1-u;else{if(o===c)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)},e.write=function(t,e,r,n,i,o){var s,a,c,u=8*o-i-1,f=(1<<u)-1,h=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,b=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?l/c:l*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[r+d]=255&s,d+=p,s/=256,u-=8);t[r+d-p]|=128*b}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(204),i=r(113),o=r(78);function s(t,r){return void 0===r&&(r=e.defaultRandomSource),r.randomBytes(t)}e.defaultRandomSource=new n.SystemRandomSource,e.randomBytes=s,e.randomUint32=function(t){void 0===t&&(t=e.defaultRandomSource);var r=s(4,t),n=i.readUint32LE(r);return o.wipe(r),n};var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(t,r,n){if(void 0===r&&(r=a),void 0===n&&(n=e.defaultRandomSource),r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");for(var i="",c=r.length,u=256-256%c;t>0;){for(var f=s(Math.ceil(256*t/u),n),h=0;h<f.length&&t>0;h++){var l=f[h];l<u&&(i+=r.charAt(l%c),t--)}o.wipe(f)}return i}e.randomString=c,e.randomStringForEntropy=function(t,r,n){return void 0===r&&(r=a),void 0===n&&(n=e.defaultRandomSource),c(Math.ceil(t/(Math.log(r.length)/Math.LN2)),r,n)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(205),i=r(206),o=function(){function t(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}return t.prototype.randomBytes=function(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)},t}();e.SystemRandomSource=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){this.isAvailable=!1,this.isInstantiated=!1;var t="undefined"!=typeof self?self.crypto||self.msCrypto:null;t&&t.getRandomValues&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}return t.prototype.randomBytes=function(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");for(var e=new Uint8Array(t),r=0;r<e.length;r+=65536)this._crypto.getRandomValues(e.subarray(r,r+Math.min(e.length-r,65536)));return e},t}();e.BrowserRandomSource=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(78),i=function(){function t(){this.isAvailable=!1,this.isInstantiated=!1;var t=r(207);t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}return t.prototype.randomBytes=function(t){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");var e=this._crypto.randomBytes(t);if(e.length!==t)throw new Error("NodeRandomSource: got fewer bytes than requested");for(var r=new Uint8Array(t),i=0;i<r.length;i++)r[i]=e[i];return n.wipe(e),r},t}();e.NodeRandomSource=i},function(t,e){},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.mul=Math.imul||function(t,e){var r=65535&t,n=65535&e;return r*n+((t>>>16&65535)*n+r*(e>>>16&65535)<<16>>>0)|0},e.add=function(t,e){return t+e|0},e.sub=function(t,e){return t-e|0},e.rotl=function(t,e){return t<<e|t>>>32-e},e.rotr=function(t,e){return t<<32-e|t>>>e},e.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(t){return e.isInteger(t)&&t>=-e.MAX_SAFE_INTEGER&&t<=e.MAX_SAFE_INTEGER}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(113),i=r(78);e.DIGEST_LENGTH=64,e.BLOCK_SIZE=128;var o=function(){function t(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._tempHi),i.wipe(this._tempLo),this.reset()},t.prototype.update=function(t,r){if(void 0===r&&(r=t.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength<e.BLOCK_SIZE&&r>0;)this._buffer[this._bufferLength++]=t[n++],r--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,t,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=t[n++],r--;return this},t.prototype.finish=function(t){if(!this._finished){var e=this._bytesHashed,r=this._bufferLength,i=e/536870912|0,o=e<<3,s=e%128<112?128:256;this._buffer[r]=128;for(var c=r+1;c<s-8;c++)this._buffer[c]=0;n.writeUint32BE(i,this._buffer,s-8),n.writeUint32BE(o,this._buffer,s-4),a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,s),this._finished=!0}for(c=0;c<this.digestLength/8;c++)n.writeUint32BE(this._stateHi[c],t,8*c),n.writeUint32BE(this._stateLo[c],t,8*c+4);return this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(t){return this._stateHi.set(t.stateHi),this._stateLo.set(t.stateLo),this._bufferLength=t.bufferLength,t.buffer&&this._buffer.set(t.buffer),this._bytesHashed=t.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(t){i.wipe(t.stateHi),i.wipe(t.stateLo),t.buffer&&i.wipe(t.buffer),t.bufferLength=0,t.bytesHashed=0},t}();e.SHA512=o;var s=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function a(t,e,r,i,o,a,c){for(var u,f,h,l,d,p,b,g,m=r[0],v=r[1],y=r[2],w=r[3],_=r[4],E=r[5],S=r[6],A=r[7],O=i[0],x=i[1],T=i[2],P=i[3],R=i[4],I=i[5],M=i[6],N=i[7];c>=128;){for(var k=0;k<16;k++){var C=8*k+a;t[k]=n.readUint32BE(o,C),e[k]=n.readUint32BE(o,C+4)}for(k=0;k<80;k++){var L,j,D=m,U=v,B=y,F=w,V=_,K=E,H=S,$=O,G=x,z=T,q=P,W=R,Y=I,J=M;if(d=65535&(f=N),p=f>>>16,b=65535&(u=A),g=u>>>16,d+=65535&(f=(R>>>14|_<<18)^(R>>>18|_<<14)^(_>>>9|R<<23)),p+=f>>>16,b+=65535&(u=(_>>>14|R<<18)^(_>>>18|R<<14)^(R>>>9|_<<23)),g+=u>>>16,d+=65535&(f=R&I^~R&M),p+=f>>>16,b+=65535&(u=_&E^~_&S),g+=u>>>16,u=s[2*k],d+=65535&(f=s[2*k+1]),p+=f>>>16,b+=65535&u,g+=u>>>16,u=t[k%16],p+=(f=e[k%16])>>>16,b+=65535&u,g+=u>>>16,b+=(p+=(d+=65535&f)>>>16)>>>16,d=65535&(f=l=65535&d|p<<16),p=f>>>16,b=65535&(u=h=65535&b|(g+=b>>>16)<<16),g=u>>>16,d+=65535&(f=(O>>>28|m<<4)^(m>>>2|O<<30)^(m>>>7|O<<25)),p+=f>>>16,b+=65535&(u=(m>>>28|O<<4)^(O>>>2|m<<30)^(O>>>7|m<<25)),g+=u>>>16,p+=(f=O&x^O&T^x&T)>>>16,b+=65535&(u=m&v^m&y^v&y),g+=u>>>16,L=65535&(b+=(p+=(d+=65535&f)>>>16)>>>16)|(g+=b>>>16)<<16,j=65535&d|p<<16,d=65535&(f=q),p=f>>>16,b=65535&(u=F),g=u>>>16,p+=(f=l)>>>16,b+=65535&(u=h),g+=u>>>16,v=D,y=U,w=B,_=F=65535&(b+=(p+=(d+=65535&f)>>>16)>>>16)|(g+=b>>>16)<<16,E=V,S=K,A=H,m=L,x=$,T=G,P=z,R=q=65535&d|p<<16,I=W,M=Y,N=J,O=j,k%16==15)for(C=0;C<16;C++)u=t[C],d=65535&(f=e[C]),p=f>>>16,b=65535&u,g=u>>>16,u=t[(C+9)%16],d+=65535&(f=e[(C+9)%16]),p+=f>>>16,b+=65535&u,g+=u>>>16,h=t[(C+1)%16],d+=65535&(f=((l=e[(C+1)%16])>>>1|h<<31)^(l>>>8|h<<24)^(l>>>7|h<<25)),p+=f>>>16,b+=65535&(u=(h>>>1|l<<31)^(h>>>8|l<<24)^h>>>7),g+=u>>>16,h=t[(C+14)%16],p+=(f=((l=e[(C+14)%16])>>>19|h<<13)^(h>>>29|l<<3)^(l>>>6|h<<26))>>>16,b+=65535&(u=(h>>>19|l<<13)^(l>>>29|h<<3)^h>>>6),g+=u>>>16,g+=(b+=(p+=(d+=65535&f)>>>16)>>>16)>>>16,t[C]=65535&b|g<<16,e[C]=65535&d|p<<16}d=65535&(f=O),p=f>>>16,b=65535&(u=m),g=u>>>16,u=r[0],p+=(f=i[0])>>>16,b+=65535&u,g+=u>>>16,g+=(b+=(p+=(d+=65535&f)>>>16)>>>16)>>>16,r[0]=m=65535&b|g<<16,i[0]=O=65535&d|p<<16,d=65535&(f=x),p=f>>>16,b=65535&(u=v),g=u>>>16,u=r[1],p+=(f=i[1])>>>16,b+=65535&u,g+=u>>>16,g+=(b+=(p+=(d+=65535&f)>>>16)>>>16)>>>16,r[1]=v=65535&b|g<<16,i[1]=x=65535&d|p<<16,d=65535&(f=T),p=f>>>16,b=65535&(u=y),g=u>>>16,u=r[2],p+=(f=i[2])>>>16,b+=65535&u,g+=u>>>16,g+=(b+=(p+=(d+=65535&f)>>>16)>>>16)>>>16,r[2]=y=65535&b|g<<16,i[2]=T=65535&d|p<<16,d=65535&(f=P),p=f>>>16,b=65535&(u=w),g=u>>>16,u=r[3],p+=(f=i[3])>>>16,b+=65535&u,g+=u>>>16,g+=(b+=(p+=(d+=65535&f)>>>16)>>>16)>>>16,r[3]=w=65535&b|g<<16,i[3]=P=65535&d|p<<16,d=65535&(f=R),p=f>>>16,b=65535&(u=_),g=u>>>16,u=r[4],p+=(f=i[4])>>>16,b+=65535&u,g+=u>>>16,g+=(b+=(p+=(d+=65535&f)>>>16)>>>16)>>>16,r[4]=_=65535&b|g<<16,i[4]=R=65535&d|p<<16,d=65535&(f=I),p=f>>>16,b=65535&(u=E),g=u>>>16,u=r[5],p+=(f=i[5])>>>16,b+=65535&u,g+=u>>>16,g+=(b+=(p+=(d+=65535&f)>>>16)>>>16)>>>16,r[5]=E=65535&b|g<<16,i[5]=I=65535&d|p<<16,d=65535&(f=M),p=f>>>16,b=65535&(u=S),g=u>>>16,u=r[6],p+=(f=i[6])>>>16,b+=65535&u,g+=u>>>16,g+=(b+=(p+=(d+=65535&f)>>>16)>>>16)>>>16,r[6]=S=65535&b|g<<16,i[6]=M=65535&d|p<<16,d=65535&(f=N),p=f>>>16,b=65535&(u=A),g=u>>>16,u=r[7],p+=(f=i[7])>>>16,b+=65535&u,g+=u>>>16,g+=(b+=(p+=(d+=65535&f)>>>16)>>>16)>>>16,r[7]=A=65535&b|g<<16,i[7]=N=65535&d|p<<16,a+=128,c-=128}return a}e.hash=function(t){var e=new o;e.update(t);var r=e.digest();return e.clean(),r}},function(t,e,r){const n=r(137);function i(t,e,r){const n=t[e]+t[r];let i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function o(t,e,r,n){let i=t[e]+r;r<0&&(i+=4294967296);let o=t[e+1]+n;i>=4294967296&&o++,t[e]=i,t[e+1]=o}function s(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function a(t,e,r,n,s,a){const c=h[s],u=h[s+1],l=h[a],d=h[a+1];i(f,t,e),o(f,t,c,u);let p=f[n]^f[t],b=f[n+1]^f[t+1];f[n]=b,f[n+1]=p,i(f,r,n),p=f[e]^f[r],b=f[e+1]^f[r+1],f[e]=p>>>24^b<<8,f[e+1]=b>>>24^p<<8,i(f,t,e),o(f,t,l,d),p=f[n]^f[t],b=f[n+1]^f[t+1],f[n]=p>>>16^b<<16,f[n+1]=b>>>16^p<<16,i(f,r,n),p=f[e]^f[r],b=f[e+1]^f[r+1],f[e]=b>>>31^p<<1,f[e+1]=p>>>31^b<<1}const c=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(t){return 2*t}))),f=new Uint32Array(32),h=new Uint32Array(32);function l(t,e){let r=0;for(r=0;r<16;r++)f[r]=t.h[r],f[r+16]=c[r];for(f[24]=f[24]^t.t,f[25]=f[25]^t.t/4294967296,e&&(f[28]=~f[28],f[29]=~f[29]),r=0;r<32;r++)h[r]=s(t.b,4*r);for(r=0;r<12;r++)a(0,8,16,24,u[16*r+0],u[16*r+1]),a(2,10,18,26,u[16*r+2],u[16*r+3]),a(4,12,20,28,u[16*r+4],u[16*r+5]),a(6,14,22,30,u[16*r+6],u[16*r+7]),a(0,10,20,30,u[16*r+8],u[16*r+9]),a(2,12,22,24,u[16*r+10],u[16*r+11]),a(4,14,16,26,u[16*r+12],u[16*r+13]),a(6,8,18,28,u[16*r+14],u[16*r+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^f[r]^f[r+16]}function d(t,e){if(0===t||t>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(e&&e.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");const r={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:t};for(let t=0;t<16;t++)r.h[t]=c[t];const n=e?e.length:0;return r.h[0]^=16842752^n<<8^t,e&&(p(r,e),r.c=128),r}function p(t,e){for(let r=0;r<e.length;r++)128===t.c&&(t.t+=t.c,l(t,!1),t.c=0),t.b[t.c++]=e[r]}function b(t){for(t.t+=t.c;t.c<128;)t.b[t.c++]=0;l(t,!0);const e=new Uint8Array(t.outlen);for(let r=0;r<t.outlen;r++)e[r]=t.h[r>>2]>>8*(3&r);return e}function g(t,e,r){r=r||64,t=n.normalizeInput(t);const i=d(r,e);return p(i,t),b(i)}t.exports={blake2b:g,blake2bHex:function(t,e,r){const i=g(t,e,r);return n.toHex(i)},blake2bInit:d,blake2bUpdate:p,blake2bFinal:b}},function(t,e,r){const n=r(137);function i(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function o(t,e,r,n,i,o){u[t]=u[t]+u[e]+i,u[n]=s(u[n]^u[t],16),u[r]=u[r]+u[n],u[e]=s(u[e]^u[r],12),u[t]=u[t]+u[e]+o,u[n]=s(u[n]^u[t],8),u[r]=u[r]+u[n],u[e]=s(u[e]^u[r],7)}function s(t,e){return t>>>e^t<<32-e}const a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),u=new Uint32Array(16),f=new Uint32Array(16);function h(t,e){let r=0;for(r=0;r<8;r++)u[r]=t.h[r],u[r+8]=a[r];for(u[12]^=t.t,u[13]^=t.t/4294967296,e&&(u[14]=~u[14]),r=0;r<16;r++)f[r]=i(t.b,4*r);for(r=0;r<10;r++)o(0,4,8,12,f[c[16*r+0]],f[c[16*r+1]]),o(1,5,9,13,f[c[16*r+2]],f[c[16*r+3]]),o(2,6,10,14,f[c[16*r+4]],f[c[16*r+5]]),o(3,7,11,15,f[c[16*r+6]],f[c[16*r+7]]),o(0,5,10,15,f[c[16*r+8]],f[c[16*r+9]]),o(1,6,11,12,f[c[16*r+10]],f[c[16*r+11]]),o(2,7,8,13,f[c[16*r+12]],f[c[16*r+13]]),o(3,4,9,14,f[c[16*r+14]],f[c[16*r+15]]);for(r=0;r<8;r++)t.h[r]^=u[r]^u[r+8]}function l(t,e){if(!(t>0&&t<=32))throw new Error("Incorrect output length, should be in [1, 32]");const r=e?e.length:0;if(e&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");const n={h:new Uint32Array(a),b:new Uint8Array(64),c:0,t:0,outlen:t};return n.h[0]^=16842752^r<<8^t,r>0&&(d(n,e),n.c=64),n}function d(t,e){for(let r=0;r<e.length;r++)64===t.c&&(t.t+=t.c,h(t,!1),t.c=0),t.b[t.c++]=e[r]}function p(t){for(t.t+=t.c;t.c<64;)t.b[t.c++]=0;h(t,!0);const e=new Uint8Array(t.outlen);for(let r=0;r<t.outlen;r++)e[r]=t.h[r>>2]>>8*(3&r)&255;return e}function b(t,e,r){r=r||32,t=n.normalizeInput(t);const i=l(r,e);return d(i,t),p(i)}t.exports={blake2s:b,blake2sHex:function(t,e,r){const i=b(t,e,r);return n.toHex(i)},blake2sInit:l,blake2sUpdate:d,blake2sFinal:p}},function(t,e,r){"use strict";var n=r(12),i=r(213),o=r(224),s=r(225),a=r(230);function c(t){a.call(this,"digest"),this._hash=t}n(c,a),c.prototype._update=function(t){this._hash.update(t)},c.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new c(s(t))}},function(t,e,r){"use strict";var n=r(12),i=r(138),o=r(26).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function c(t,e){return t<<e|t>>>32-e}function u(t,e,r,n,i,o,s){return c(t+(e&r|~e&n)+i+o|0,s)+e|0}function f(t,e,r,n,i,o,s){return c(t+(e&n|r&~n)+i+o|0,s)+e|0}function h(t,e,r,n,i,o,s){return c(t+(e^r^n)+i+o|0,s)+e|0}function l(t,e,r,n,i,o,s){return c(t+(r^(e|~n))+i+o|0,s)+e|0}n(a,i),a.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=u(r,n,i,o,t[0],3614090360,7),o=u(o,r,n,i,t[1],3905402710,12),i=u(i,o,r,n,t[2],606105819,17),n=u(n,i,o,r,t[3],3250441966,22),r=u(r,n,i,o,t[4],4118548399,7),o=u(o,r,n,i,t[5],1200080426,12),i=u(i,o,r,n,t[6],2821735955,17),n=u(n,i,o,r,t[7],4249261313,22),r=u(r,n,i,o,t[8],1770035416,7),o=u(o,r,n,i,t[9],2336552879,12),i=u(i,o,r,n,t[10],4294925233,17),n=u(n,i,o,r,t[11],2304563134,22),r=u(r,n,i,o,t[12],1804603682,7),o=u(o,r,n,i,t[13],4254626195,12),i=u(i,o,r,n,t[14],2792965006,17),r=f(r,n=u(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=f(o,r,n,i,t[6],3225465664,9),i=f(i,o,r,n,t[11],643717713,14),n=f(n,i,o,r,t[0],3921069994,20),r=f(r,n,i,o,t[5],3593408605,5),o=f(o,r,n,i,t[10],38016083,9),i=f(i,o,r,n,t[15],3634488961,14),n=f(n,i,o,r,t[4],3889429448,20),r=f(r,n,i,o,t[9],568446438,5),o=f(o,r,n,i,t[14],3275163606,9),i=f(i,o,r,n,t[3],4107603335,14),n=f(n,i,o,r,t[8],1163531501,20),r=f(r,n,i,o,t[13],2850285829,5),o=f(o,r,n,i,t[2],4243563512,9),i=f(i,o,r,n,t[7],1735328473,14),r=h(r,n=f(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=h(o,r,n,i,t[8],2272392833,11),i=h(i,o,r,n,t[11],1839030562,16),n=h(n,i,o,r,t[14],4259657740,23),r=h(r,n,i,o,t[1],2763975236,4),o=h(o,r,n,i,t[4],1272893353,11),i=h(i,o,r,n,t[7],4139469664,16),n=h(n,i,o,r,t[10],3200236656,23),r=h(r,n,i,o,t[13],681279174,4),o=h(o,r,n,i,t[0],3936430074,11),i=h(i,o,r,n,t[3],3572445317,16),n=h(n,i,o,r,t[6],76029189,23),r=h(r,n,i,o,t[9],3654602809,4),o=h(o,r,n,i,t[12],3873151461,11),i=h(i,o,r,n,t[15],530742520,16),r=l(r,n=h(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=l(o,r,n,i,t[7],1126891415,10),i=l(i,o,r,n,t[14],2878612391,15),n=l(n,i,o,r,t[5],4237533241,21),r=l(r,n,i,o,t[12],1700485571,6),o=l(o,r,n,i,t[3],2399980690,10),i=l(i,o,r,n,t[10],4293915773,15),n=l(n,i,o,r,t[1],2240044497,21),r=l(r,n,i,o,t[8],1873313359,6),o=l(o,r,n,i,t[15],4264355552,10),i=l(i,o,r,n,t[6],2734768916,15),n=l(n,i,o,r,t[13],1309151649,21),r=l(r,n,i,o,t[4],4149444226,6),o=l(o,r,n,i,t[11],3174756917,10),i=l(i,o,r,n,t[2],718787259,15),n=l(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},function(t,e,r){(e=t.exports=r(139)).Stream=e,e.Readable=e,e.Writable=r(143),e.Duplex=r(59),e.Transform=r(144),e.PassThrough=r(222),e.finished=r(114),e.pipeline=r(223)},function(t,e){},function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var s=r(14).Buffer,a=r(217).inspect,c=a&&a.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,r,u;return e=t,r=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e,r,n,i=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=i,n=a,s.prototype.copy.call(e,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:c,value:function(t,e){return a(this,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}],r&&o(e.prototype,r),u&&o(e,u),t}()},function(t,e){},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,r(42))},function(t,e,r){var n=r(14),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){"use strict";(function(e){var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=r(114),s=Symbol("lastResolve"),a=Symbol("lastReject"),c=Symbol("error"),u=Symbol("ended"),f=Symbol("lastPromise"),h=Symbol("handlePromise"),l=Symbol("stream");function d(t,e){return{value:t,done:e}}function p(t){var e=t[s];if(null!==e){var r=t[l].read();null!==r&&(t[f]=null,t[s]=null,t[a]=null,e(d(r,!1)))}}function b(t){e.nextTick(p,t)}var g=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((i(n={get stream(){return this[l]},next:function(){var t=this,r=this[c];if(null!==r)return Promise.reject(r);if(this[u])return Promise.resolve(d(void 0,!0));if(this[l].destroyed)return new Promise((function(r,n){e.nextTick((function(){t[c]?n(t[c]):r(d(void 0,!0))}))}));var n,i=this[f];if(i)n=new Promise(function(t,e){return function(r,n){t.then((function(){e[u]?r(d(void 0,!0)):e[h](r,n)}),n)}}(i,this));else{var o=this[l].read();if(null!==o)return Promise.resolve(d(o,!1));n=new Promise(this[h])}return this[f]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var t=this;return new Promise((function(e,r){t[l].destroy(null,(function(t){t?r(t):e(d(void 0,!0))}))}))})),n),g);t.exports=function(t){var e,r=Object.create(m,(i(e={},l,{value:t,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,c,{value:null,writable:!0}),i(e,u,{value:t._readableState.endEmitted,writable:!0}),i(e,h,{value:function(t,e){var n=r[l].read();n?(r[f]=null,r[s]=null,r[a]=null,t(d(n,!1))):(r[s]=t,r[a]=e)},writable:!0}),e));return r[f]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[a];return null!==e&&(r[f]=null,r[s]=null,r[a]=null,e(t)),void(r[c]=t)}var n=r[s];null!==n&&(r[f]=null,r[s]=null,r[a]=null,n(d(void 0,!0))),r[u]=!0})),t.on("readable",b.bind(null,r)),r}}).call(this,r(33))},function(t,e){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,e,r){"use strict";t.exports=i;var n=r(144);function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}r(12)(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){"use strict";var n;var i=r(58).codes,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function c(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var a=!1;t.on("close",(function(){a=!0})),void 0===n&&(n=r(114)),n(t,{readable:e,writable:i},(function(t){if(t)return o(t);a=!0,o()}));var c=!1;return function(e){if(!a&&!c)return c=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new s("pipe"))}}function u(t){t()}function f(t,e){return t.pipe(e)}function h(t){return t.length?"function"!=typeof t[t.length-1]?a:t.pop():a}t.exports=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,i=h(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var s=e.map((function(t,r){var o=r<e.length-1;return c(t,o,r>0,(function(t){n||(n=t),t&&s.forEach(u),o||(s.forEach(u),i(n))}))}));return e.reduce(f)}},function(t,e,r){"use strict";var n=r(14).Buffer,i=r(12),o=r(138),s=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],c=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],u=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],f=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],h=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<<e|t>>>32-e}function b(t,e,r,n,i,o,s,a){return p(t+(e^r^n)+o+s|0,a)+i|0}function g(t,e,r,n,i,o,s,a){return p(t+(e&r|~e&n)+o+s|0,a)+i|0}function m(t,e,r,n,i,o,s,a){return p(t+((e|~r)^n)+o+s|0,a)+i|0}function v(t,e,r,n,i,o,s,a){return p(t+(e&n|r&~n)+o+s|0,a)+i|0}function y(t,e,r,n,i,o,s,a){return p(t+(e^(r|~n))+o+s|0,a)+i|0}i(d,o),d.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,d=0|this._e,w=0|this._a,_=0|this._b,E=0|this._c,S=0|this._d,A=0|this._e,O=0;O<80;O+=1){var x,T;O<16?(x=b(r,n,i,o,d,t[a[O]],h[0],u[O]),T=y(w,_,E,S,A,t[c[O]],l[0],f[O])):O<32?(x=g(r,n,i,o,d,t[a[O]],h[1],u[O]),T=v(w,_,E,S,A,t[c[O]],l[1],f[O])):O<48?(x=m(r,n,i,o,d,t[a[O]],h[2],u[O]),T=m(w,_,E,S,A,t[c[O]],l[2],f[O])):O<64?(x=v(r,n,i,o,d,t[a[O]],h[3],u[O]),T=g(w,_,E,S,A,t[c[O]],l[3],f[O])):(x=y(r,n,i,o,d,t[a[O]],h[4],u[O]),T=b(w,_,E,S,A,t[c[O]],l[4],f[O])),r=d,d=o,o=p(i,10),i=n,n=x,w=A,A=S,S=p(E,10),E=_,_=T}var P=this._b+i+S|0;this._b=this._c+o+A|0,this._c=this._d+d+w|0,this._d=this._e+r+_|0,this._e=this._a+n+E|0,this._a=P},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=n.alloc?n.alloc(20):new n(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=d},function(t,e,r){(e=t.exports=function(t){t=t.toLowerCase();var r=e[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r}).sha=r(226),e.sha1=r(227),e.sha224=r(228),e.sha256=r(145),e.sha384=r(229),e.sha512=r(146)},function(t,e,r){var n=r(12),i=r(60),o=r(26).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function c(){this.init(),this._w=a,i.call(this,64,56)}function u(t){return t<<30|t>>>2}function f(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(c,i),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,c=0|this._e,h=0;h<16;++h)r[h]=t.readInt32BE(4*h);for(;h<80;++h)r[h]=r[h-3]^r[h-8]^r[h-14]^r[h-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((e=n)<<5|e>>>27)+f(d,i,o,a)+c+r[l]+s[d];c=a,a=o,o=u(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=c+this._e|0},c.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=c},function(t,e,r){var n=r(12),i=r(60),o=r(26).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function c(){this.init(),this._w=a,i.call(this,64,56)}function u(t){return t<<5|t>>>27}function f(t){return t<<30|t>>>2}function h(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(c,i),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,c=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=(e=r[l-3]^r[l-8]^r[l-14]^r[l-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),b=u(n)+h(p,i,o,a)+c+r[d]+s[p]|0;c=a,a=o,o=f(i),i=n,n=b}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=c+this._e|0},c.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=c},function(t,e,r){var n=r(12),i=r(145),o=r(60),s=r(26).Buffer,a=new Array(64);function c(){this.init(),this._w=a,o.call(this,64,56)}n(c,i),c.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},c.prototype._hash=function(){var t=s.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=c},function(t,e,r){var n=r(12),i=r(146),o=r(60),s=r(26).Buffer,a=new Array(160);function c(){this.init(),this._w=a,o.call(this,128,112)}n(c,i),c.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},c.prototype._hash=function(){var t=s.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=c},function(t,e,r){var n=r(26).Buffer,i=r(231).Transform,o=r(80).StringDecoder;function s(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(12)(s,i),s.prototype.update=function(t,e,r){"string"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},s.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},s.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},t.exports=s},function(t,e,r){t.exports=i;var n=r(79).EventEmitter;function i(){n.call(this)}r(61)(i,n),i.Readable=r(115),i.Writable=r(239),i.Duplex=r(240),i.Transform=r(241),i.PassThrough=r(242),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",c));var s=!1;function a(){s||(s=!0,t.end())}function c(){s||(s=!0,"function"==typeof t.destroy&&t.destroy())}function u(t){if(f(),0===n.listenerCount(this,"error"))throw t}function f(){r.removeListener("data",i),t.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",c),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",f),r.removeListener("close",f),t.removeListener("close",f)}return r.on("error",u),t.on("error",u),r.on("end",f),r.on("close",f),t.on("close",f),t.emit("pipe",r),t}},function(t,e){},function(t,e,r){"use strict";var n=r(116).Buffer,i=r(234);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,o=n.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,r=o,i=a,e.copy(r,i),a+=s.data.length,s=s.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,r){(function(t){var n=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,n,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,n,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(n,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(236),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(42))},function(t,e,r){(function(t,e){!function(t,r){"use strict";if(!t.setImmediate){var n,i,o,s,a,c=1,u={},f=!1,h=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick((function(){p(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){p(t.data)},n=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,n=function(t){var e=h.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):n=function(t){setTimeout(p,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),n=function(e){t.postMessage(s+e,"*")}),l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var i={callback:t,args:e};return u[c]=i,n(c),c++},l.clearImmediate=d}function d(t){delete u[t]}function p(t){if(f)setTimeout(p,0,t);else{var e=u[t];if(e){f=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(void 0,r)}}(e)}finally{d(t),f=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,r(42),r(33))},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,r(42))},function(t,e,r){"use strict";t.exports=o;var n=r(150),i=Object.create(r(81));function o(t){if(!(this instanceof o))return new o(t);n.call(this,t)}i.inherits=r(61),i.inherits(o,n),o.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){t.exports=r(117)},function(t,e,r){t.exports=r(49)},function(t,e,r){t.exports=r(115).Transform},function(t,e,r){t.exports=r(115).PassThrough},function(t,e,r){"use strict";var n=r(244),i=r(26).Buffer;t.exports=function(t){function e(e){var r=e.slice(0,-4),n=e.slice(-4),i=t(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(e){var r=t(e);return n.encode(i.concat([e,r],e.length+4))},decode:function(t){var r=e(n.decode(t));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(t){var r=n.decodeUnsafe(t);if(r)return e(r)}}}},function(t,e,r){var n=r(245);t.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(t,e,r){"use strict";var n=r(26).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(255!==e[s])throw new TypeError(o+" is ambiguous");e[s]=i}var a=t.length,c=t.charAt(0),u=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return n.alloc(0);for(var r=0,i=0,o=0;t[r]===c;)i++,r++;for(var s=(t.length-r)*u+1>>>0,f=new Uint8Array(s);t[r];){var h=e[t.charCodeAt(r)];if(255===h)return;for(var l=0,d=s-1;(0!==h||l<o)&&-1!==d;d--,l++)h+=a*f[d]>>>0,f[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");o=l,r++}for(var p=s-o;p!==s&&0===f[p];)p++;var b=n.allocUnsafe(i+(s-p));b.fill(0,0,i);for(var g=i;p!==s;)b[g++]=f[p++];return b}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,o=0,s=e.length;o!==s&&0===e[o];)o++,r++;for(var u=(s-o)*f+1>>>0,h=new Uint8Array(u);o!==s;){for(var l=e[o],d=0,p=u-1;(0!==l||d<i)&&-1!==p;p--,d++)l+=256*h[p]>>>0,h[p]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,o++}for(var b=u-i;b!==u&&0===h[b];)b++;for(var g=c.repeat(r);b<u;++b)g+=t.charAt(h[b]);return g},decodeUnsafe:h,decode:function(t){var e=h(t);if(e)return e;throw new Error("Non-base"+a+" character")}}}},function(t){t.exports=JSON.parse('{"name":"elliptic","version":"6.5.4","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny <fedor@indutny.com>","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}')},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){},function(t,e){},function(t,e,r){"use strict";var n=r(27),i=r(43),o=r(12),s=r(94),a=n.assert;function c(t){s.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(t,e,r,n){s.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(t,e,r,n){s.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(c,s),t.exports=c,c.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new i(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},c.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(t){for(var e,r,n,o,s,a,c,u,f,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=t,d=this.n.clone(),p=new i(1),b=new i(0),g=new i(0),m=new i(1),v=0;0!==l.cmpn(0);){var y=d.div(l);u=d.sub(y.mul(l)),f=g.sub(y.mul(p));var w=m.sub(y.mul(b));if(!n&&u.cmp(h)<0)e=c.neg(),r=p,n=u.neg(),o=f;else if(n&&2==++v)break;c=u,d=l,l=u,g=p,p=f,m=b,b=w}s=u.neg(),a=f;var _=n.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(_)>=0&&(s=e,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},c.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(n=n.redNeg()),this.point(t,n)},c.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],c=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),c=c.neg(!0)),n[2*o]=a,n[2*o+1]=c,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var u=this._wnafMulAdd(1,n,i,2*o,r),f=0;f<2*o;f++)n[f]=null,i[f]=null;return u},o(u,s.BasePoint),c.prototype.point=function(t,e,r){return new u(this,t,e,r)},c.prototype.pointFromJSON=function(t,e){return u.fromJSON(this,t,e)},u.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},u.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},u.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}var o=e[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},u.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},u.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},u.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},u.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(f,s.BasePoint),c.prototype.jpoint=function(t,e,r){return new f(this,t,e,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),f=u.redMul(a),h=n.redMul(u),l=c.redSqr().redIAdd(f).redISub(h).redISub(h),d=c.redMul(h.redISub(l)).redISub(o.redMul(f)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(l,d,p)},f.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),f=r.redMul(c),h=a.redSqr().redIAdd(u).redISub(f).redISub(f),l=a.redMul(f.redISub(h)).redISub(i.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(h,l,d)},f.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,c=a.redSqr().redSqr(),u=s.redAdd(s);for(e=0;e<t;e++){var f=o.redSqr(),h=u.redSqr(),l=h.redSqr(),d=f.redAdd(f).redIAdd(f).redIAdd(n.redMul(c)),p=o.redMul(h),b=d.redSqr().redISub(p.redAdd(p)),g=p.redISub(b),m=d.redMul(g);m=m.redIAdd(m).redISub(l);var v=u.redMul(a);e+1<t&&(c=c.redMul(l)),o=b,a=v,u=m}return this.curve.jpoint(o,u.redMul(i),a)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},f.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),c=a.redSqr().redISub(s).redISub(s),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=c,e=a.redMul(s.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),h=this.y.redSqr(),l=h.redSqr(),d=this.x.redAdd(h).redSqr().redISub(f).redISub(l);d=d.redIAdd(d);var p=f.redAdd(f).redIAdd(f),b=p.redSqr(),g=l.redIAdd(l);g=(g=g.redIAdd(g)).redIAdd(g),t=b.redISub(d).redISub(d),e=p.redMul(d.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},f.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),c=a.redSqr().redISub(s).redISub(s);t=c;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=a.redMul(s.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),h=this.y.redSqr(),l=this.x.redMul(h),d=this.x.redSub(f).redMul(this.x.redAdd(f));d=d.redAdd(d).redIAdd(d);var p=l.redIAdd(l),b=(p=p.redIAdd(p)).redAdd(p);t=d.redSqr().redISub(b),r=this.y.redAdd(this.z).redSqr().redISub(h).redISub(f);var g=h.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=d.redMul(p.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},f.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),c=e.redAdd(e),u=(c=c.redIAdd(c)).redMul(s),f=a.redSqr().redISub(u.redAdd(u)),h=u.redISub(f),l=s.redSqr();l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=a.redMul(h).redISub(l),p=r.redAdd(r).redMul(n);return this.curve.jpoint(f,d,p)},f.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(c),f=e.redMul(u);f=(f=f.redIAdd(f)).redIAdd(f);var h=this.x.redMul(a).redISub(f);h=(h=h.redIAdd(h)).redIAdd(h);var l=this.y.redMul(u.redMul(c.redISub(u)).redISub(s.redMul(a)));l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(h,l,d)},f.prototype.mul=function(t,e){return t=new i(t,e),this.curve._wnafMul(this,t)},f.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},f.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,r){"use strict";var n=r(43),i=r(12),o=r(94),s=r(27);function a(t){o.call(this,"mont",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(t,e,r){o.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(e,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},i(c,o.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},a.prototype.point=function(t,e){return new c(this,t,e)},a.prototype.pointFromJSON=function(t){return c.fromJSON(this,t)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(t,e){return new c(t,e[0],e[1]||t.one)},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),s=i.redMul(n),a=e.z.redMul(o.redAdd(s).redSqr()),c=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(t,e,r){"use strict";var n=r(27),i=r(43),o=r(12),s=r(94),a=n.assert;function c(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,s.call(this,"edwards",t),this.a=new i(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function u(t,e,r,n,o){s.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(e,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(c,s),t.exports=c,c.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},c.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},c.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},c.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=n.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var c=a.fromRed().isOdd();return(e&&!c||!e&&c)&&(a=a.redNeg()),this.point(t,a)},c.prototype.pointFromY=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),s=n.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},c.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},o(u,s.BasePoint),c.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},c.prototype.point=function(t,e,r,n){return new u(this,t,e,r,n)},u.fromJSON=function(t,e){return new u(t,e[0],e[1],e[2])},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),s=o.redSub(r),a=n.redSub(e),c=i.redMul(s),u=o.redMul(a),f=i.redMul(a),h=s.redMul(o);return this.curve.point(c,u,h,f)},u.prototype._projDbl=function(){var t,e,r,n,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(a)).redAdd(c);this.zOne?(t=s.redSub(a).redSub(c).redMul(u.redSub(this.curve.two)),e=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),t=s.redSub(a).redISub(c).redMul(o),e=u.redMul(n.redSub(c)),r=u.redMul(o))}else n=a.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(s.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(a.redISub(c)),r=n.redMul(o);return this.curve.point(t,e,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),s=i.redSub(n),a=i.redAdd(n),c=r.redAdd(e),u=o.redMul(s),f=a.redMul(c),h=o.redMul(c),l=s.redMul(a);return this.curve.point(u,f,l,h)},u.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),h=n.redMul(c).redMul(f);return this.curve.twisted?(e=n.redMul(u).redMul(s.redSub(this.curve._mulA(o))),r=c.redMul(u)):(e=n.redMul(u).redMul(s.redSub(o)),r=this.curve._mulC(c).redMul(u)),this.curve.point(h,e,r)},u.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},u.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},u.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},u.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},function(t,e,r){"use strict";e.sha1=r(254),e.sha224=r(255),e.sha256=r(155),e.sha384=r(256),e.sha512=r(156)},function(t,e,r){"use strict";var n=r(34),i=r(82),o=r(154),s=n.rotl32,a=n.sum32,c=n.sum32_5,u=o.ft_1,f=i.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(l,f),t.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=s(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],f=this.h[2],l=this.h[3],d=this.h[4];for(n=0;n<r.length;n++){var p=~~(n/20),b=c(s(i,5),u(p,o,f,l),d,r[n],h[p]);d=l,l=f,f=s(o,30),o=i,i=b}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],f),this.h[3]=a(this.h[3],l),this.h[4]=a(this.h[4],d)},l.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(t,e,r){"use strict";var n=r(34),i=r(155);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},function(t,e,r){"use strict";var n=r(34),i=r(156);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},function(t,e,r){"use strict";var n=r(34),i=r(82),o=n.rotl32,s=n.sum32,a=n.sum32_3,c=n.sum32_4,u=i.BlockHash;function f(){if(!(this instanceof f))return new f;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function h(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function l(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function d(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}n.inherits(f,u),e.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],u=this.h[3],f=this.h[4],v=r,y=n,w=i,_=u,E=f,S=0;S<80;S++){var A=s(o(c(r,h(S,n,i,u),t[p[S]+e],l(S)),g[S]),f);r=f,f=u,u=o(i,10),i=n,n=A,A=s(o(c(v,h(79-S,y,w,_),t[b[S]+e],d(S)),m[S]),E),v=E,E=_,_=o(w,10),w=y,y=A}A=a(this.h[1],i,_),this.h[1]=a(this.h[2],u,E),this.h[2]=a(this.h[3],f,v),this.h[3]=a(this.h[4],r,y),this.h[4]=a(this.h[0],n,w),this.h[0]=A},f.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],b=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],m=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},function(t,e,r){"use strict";var n=r(34),i=r(50);function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(e,r))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function(t,e){return this.inner.update(t,e),this},o.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},function(t,e){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(t,e,r){"use strict";var n=r(43),i=r(261),o=r(27),s=r(118),a=r(152),c=o.assert,u=r(262),f=r(263);function h(t){if(!(this instanceof h))return new h(t);"string"==typeof t&&(c(Object.prototype.hasOwnProperty.call(s,t),"Unknown curve "+t),t=s[t]),t instanceof s.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=h,h.prototype.keyPair=function(t){return new u(this,t)},h.prototype.keyFromPrivate=function(t,e){return u.fromPrivate(this,t,e)},h.prototype.keyFromPublic=function(t,e){return u.fromPublic(this,t,e)},h.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||a(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var s=new n(e.generate(r));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},h.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},h.prototype.sign=function(t,e,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var s=this.n.byteLength(),a=e.getPrivate().toArray("be",s),c=t.toArray("be",s),u=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),h=this.n.sub(new n(1)),l=0;;l++){var d=o.k?o.k(l):new n(u.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(h)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var b=p.getX(),g=b.umod(this.n);if(0!==g.cmpn(0)){var m=d.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var v=(p.getY().isOdd()?1:0)|(0!==b.cmp(g)?2:0);return o.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),v^=1),new f({r:g,s:m,recoveryParam:v})}}}}}},h.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var o=(e=new f(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(t).umod(this.n),h=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),h)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,r.getPublic(),h)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},h.prototype.recoverPubKey=function(t,e,r,i){c((3&r)===r,"The recovery param is more than two bits"),e=new f(e,i);var o=this.n,s=new n(t),a=e.r,u=e.s,h=1&r,l=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");a=l?this.curve.pointFromX(a.add(this.curve.n),h):this.curve.pointFromX(a,h);var d=e.r.invm(o),p=o.sub(s).mul(d).umod(o),b=u.mul(d).umod(o);return this.g.mulAdd(p,a,b)},h.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new f(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},function(t,e,r){"use strict";var n=r(119),i=r(151),o=r(50);function s(t){if(!(this instanceof s))return new s(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex"),n=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}t.exports=s,s.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},s.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},s.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},s.prototype.reseed=function(t,e,r,n){"string"!=typeof e&&(n=r,r=e,e=null),t=i.toArray(t,e),r=i.toArray(r,n),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},s.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<t;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var s=o.slice(0,t);return this._update(r),this._reseed++,i.encode(s,e)}},function(t,e,r){"use strict";var n=r(43),i=r(27).assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=o,o.fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(t,e,r){"use strict";var n=r(43),i=r(27),o=i.assert;function s(t,e){if(t instanceof s)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function c(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o<n;o++,s++)i<<=8,i|=t[s],i>>>=0;return!(i<=127)&&(e.place=s,i)}function u(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function f(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=s,s.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;var o=c(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var s=c(t,r);if(!1===s)return!1;var u=t.slice(r.place,s+r.place);if(r.place+=s,2!==t[r.place++])return!1;var f=c(t,r);if(!1===f)return!1;if(t.length!==f+r.place)return!1;var h=t.slice(r.place,f+r.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===h[0]){if(!(128&h[1]))return!1;h=h.slice(1)}return this.r=new n(u),this.s=new n(h),this.recoveryParam=null,!0},s.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=u(e),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,e.length),(n=n.concat(e)).push(2),f(n,r.length);var o=n.concat(r),s=[48];return f(s,o.length),s=s.concat(o),i.encode(s,t)}},function(t,e,r){"use strict";var n=r(119),i=r(118),o=r(27),s=o.assert,a=o.parseBytes,c=r(265),u=r(266);function f(t){if(s("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof f))return new f(t);t=i[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=n.sha512}t.exports=f,f.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),c=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},f.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},f.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return o.intFromLE(t.digest()).umod(this.curve.n)},f.prototype.keyFromPublic=function(t){return c.fromPublic(this,t)},f.prototype.keyFromSecret=function(t){return c.fromSecret(this,t)},f.prototype.makeSignature=function(t){return t instanceof u?t:new u(this,t)},f.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},f.prototype.decodePoint=function(t){var e=(t=o.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),n=0!=(128&t[e]),i=o.intFromLE(r);return this.curve.pointFromY(i,n)},f.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},f.prototype.decodeInt=function(t){return o.intFromLE(t)},f.prototype.isPoint=function(t){return t instanceof this.pointClass}},function(t,e,r){"use strict";var n=r(27),i=n.assert,o=n.parseBytes,s=n.cachedProperty;function a(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}a.fromPublic=function(t,e){return e instanceof a?e:new a(t,{pub:e})},a.fromSecret=function(t,e){return e instanceof a?e:new a(t,{secret:e})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),s(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),s(a,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,n=e.slice(0,t.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),s(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),s(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),s(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},a.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},a.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),t)},a.prototype.getPublic=function(t){return n.encode(this.pubBytes(),t)},t.exports=a},function(t,e,r){"use strict";var n=r(43),i=r(27),o=i.assert,s=i.cachedProperty,a=i.parseBytes;function c(t,e){this.eddsa=t,"object"!=typeof e&&(e=a(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof n&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}s(c,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),s(c,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),s(c,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),s(c,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),c.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},c.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=c},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RpcInjector=void 0;e.RpcInjector=class{constructor(t){this.context=t}inject(t){return this.context.rpc.injectOperation(t)}}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.OperationFactory=e.createNewPollingBasedHeadObservable=void 0;const i=r(53),o=r(86),s=r(159),a=r(269),c=r(162),u=r(64),f=r(163),h=r(164);e.createNewPollingBasedHeadObservable=(t,e,r)=>t.pipe(o.timeoutWith(1e3*e.config.confirmationPollingTimeoutSecond,i.throwError(new Error("Confirmation polling timed out")),r),o.shareReplay({refCount:!0,scheduler:r}));e.OperationFactory=class{constructor(t){this.context=t,this.sharedHeadObs=i.defer((()=>s.createObservableFromSubscription(this.context.stream.subscribeBlock("head"))))}createNewHeadObservable(){return n(this,void 0,void 0,(function*(){return e.createNewPollingBasedHeadObservable(this.sharedHeadObs,this.context)}))}createPastBlockWalker(t,e=1){return i.from(this.context.readProvider.getBlock(t)).pipe(o.switchMap((t=>1===e?i.of(t):i.range(t.header.level,e-1).pipe(o.startWith(t),o.concatMap((t=>n(this,void 0,void 0,(function*(){return this.context.readProvider.getBlock("number"==typeof t?t:t.header.level)}))))))))}createHeadObservableFromConfig({blockIdentifier:t}){return n(this,void 0,void 0,(function*(){const e=[];return t&&e.push(this.createPastBlockWalker(t)),e.push(yield this.createNewHeadObservable()),i.concat(...e)}))}createOperation(t,e={}){return n(this,void 0,void 0,(function*(){return new u.WalletOperation(t,this.context.clone(),yield this.createHeadObservableFromConfig(e))}))}createBatchOperation(t,e={}){return n(this,void 0,void 0,(function*(){return new a.BatchWalletOperation(t,this.context.clone(),yield this.createHeadObservableFromConfig(e))}))}createTransactionOperation(t,e={}){return n(this,void 0,void 0,(function*(){return new h.TransactionWalletOperation(t,this.context.clone(),yield this.createHeadObservableFromConfig(e))}))}createDelegationOperation(t,e={}){return n(this,void 0,void 0,(function*(){return new c.DelegationWalletOperation(t,this.context.clone(),yield this.createHeadObservableFromConfig(e))}))}createOriginationOperation(t,e={}){return n(this,void 0,void 0,(function*(){return new f.OriginationWalletOperation(t,this.context.clone(),yield this.createHeadObservableFromConfig(e))}))}}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.BatchWalletOperation=void 0;const i=r(22),o=r(83),s=r(23),a=r(64);class c extends a.WalletOperation{constructor(t,e,r){super(t,e,r),this.opHash=t,this.context=e}revealOperation(){return n(this,void 0,void 0,(function*(){return(yield this.operationResults()).find((t=>t.kind===i.OpKind.REVEAL))}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";return(yield this.operationResults()).filter((t=>-1!==o.BATCH_KINDS.indexOf(t.kind))).map((t=>s.hasMetadataWithResult(t)?t.metadata.operation_result.status:"unknown"))[0]||"unknown"}))}}e.BatchWalletOperation=c},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.receiptFromOperation=void 0;const n=r(63),i=r(52);e.receiptFromOperation=(t,{ALLOCATION_BURN:e,ORIGINATION_BURN:r}={ALLOCATION_BURN:257,ORIGINATION_BURN:257})=>{const o=i.flattenOperationResult({contents:t});let s=new n.default(0),a=new n.default(0),c=new n.default(0),u=new n.default(0),f=new n.default(0),h=new n.default(0);return o.forEach((t=>{c=c.plus(t.fee||0),u=u.plus(Array.isArray(t.originated_contracts)?t.originated_contracts.length*r:0),f=f.plus("allocated_destination_contract"in t?e:0),s=s.plus(t.consumed_gas||0),h=h.plus("paid_storage_size_diff"in t&&Number(t.paid_storage_size_diff)||0)})),a=a.plus(f).plus(u).plus(h),{totalFee:c,totalGas:s,totalStorage:a,totalAllocationBurn:f,totalOriginationBurn:u,totalPaidStorageDiff:h,totalStorageBurn:new n.default(a.multipliedBy(1e3))}}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RpcTzProvider=void 0;const i=r(97),o=r(47),s=r(22),a=r(2);class c extends i.OperationEmitter{constructor(t){super(t)}getBalance(t){return n(this,void 0,void 0,(function*(){if(a.validateAddress(t)!==a.ValidationResult.VALID)throw new a.InvalidAddressError(`Invalid address: ${t}`);return this.context.readProvider.getBalance(t,"head")}))}getDelegate(t){return n(this,void 0,void 0,(function*(){if(a.validateAddress(t)!==a.ValidationResult.VALID)throw new a.InvalidAddressError(`Invalid address: ${t}`);return this.context.readProvider.getDelegate(t,"head")}))}activate(t,e){return n(this,void 0,void 0,(function*(){if(a.validateKeyHash(t)!==a.ValidationResult.VALID)throw new a.InvalidKeyHashError(`Invalid Public Key Hash: ${t}`);const r={kind:s.OpKind.ACTIVATION,pkh:t,secret:e},n=yield this.prepareOperation({operation:[r],source:t}),i=yield this.forge(n),c=`${i.opbytes}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`;return new o.Operation(yield this.rpc.injectOperation(c),Object.assign(Object.assign({},i),{opbytes:c}),[],this.context.clone())}))}}e.RpcTzProvider=c},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.RpcContractProvider=void 0;const i=r(72),o=r(62),s=r(22),a=r(2),c=r(83),u=r(167),f=r(97),h=r(168),l=r(273),d=r(274),p=r(169),b=r(23),g=r(98),m=r(51),v=r(96),y=r(285),w=r(2);class _ extends f.OperationEmitter{constructor(t,e){super(t),this.estimator=e,this.contractProviderTypeSymbol=Symbol.for("taquito--provider-type-symbol")}getStorage(t,e){return n(this,void 0,void 0,(function*(){if(w.validateContractAddress(t)!==w.ValidationResult.VALID)throw new w.InvalidContractAddressError(`Invalid contract address: ${t}`);const r=yield this.context.readProvider.getScript(t,"head");let n;return e||(e=r),n=o.Schema.isSchema(e)?e:o.Schema.fromRPCResponse({script:e}),n.Execute(r.storage,y.smartContractAbstractionSemantic(this))}))}getBigMapKey(t,e,r){return n(this,void 0,void 0,(function*(){if(w.validateContractAddress(t)!==w.ValidationResult.VALID)throw new w.InvalidContractAddressError(`Invalid contract address: ${t}`);let n;r||(r=yield this.rpc.getNormalizedScript(t)),n=o.Schema.isSchema(r)?r:o.Schema.fromRPCResponse({script:r});const i=n.EncodeBigMapKey(e),s=yield this.rpc.getBigMapKey(t,i);return n.ExecuteOnBigMapValue(s)}))}getBigMapKeyByID(t,e,r,i){return n(this,void 0,void 0,(function*(){const{key:n,type:o}=r.EncodeBigMapKey(e),{packed:s}=yield this.context.packer.packData({data:n,type:o}),c=a.encodeExpr(s),u=i?yield this.context.readProvider.getBigMapValue({id:t.toString(),expr:c},i):yield this.context.readProvider.getBigMapValue({id:t.toString(),expr:c},"head");return r.ExecuteOnBigMapValue(u,y.smartContractAbstractionSemantic(this))}))}getBigMapKeysByID(t,e,r,i,s=5){return n(this,void 0,void 0,(function*(){const n=yield this.getBlockForRequest(e,i),a=new o.MichelsonMap;let c=0,u=[];for(;c<e.length;){const i=e.slice(c,c+s).map((e=>this.getBigMapValueOrUndefined(e,t,r,n)));u=[...u,...yield Promise.all(i)],c+=s}for(let t=0;t<u.length;t++)a.set(e[t],u[t]);return a}))}getBlockForRequest(t,e){return n(this,void 0,void 0,(function*(){return 1===t.length||void 0!==e?e:yield this.context.readProvider.getBlockLevel("head")}))}getBigMapValueOrUndefined(t,e,r,o){return n(this,void 0,void 0,(function*(){try{return yield this.getBigMapKeyByID(e,t,r,o)}catch(t){if(t instanceof i.HttpResponseError&&t.status===i.STATUS_CODE.NOT_FOUND)return;throw t}}))}getSaplingDiffByID(t,e){return n(this,void 0,void 0,(function*(){return e?yield this.context.readProvider.getSaplingDiffById({id:t.toString()},e):yield this.context.readProvider.getSaplingDiffById({id:t.toString()},"head")}))}addRevealOperationIfNeeded(t,e){return n(this,void 0,void 0,(function*(){if(b.isOpRequireReveal(t)){const r=[t],i=yield this.signer.publicKey(),o=yield this.estimator.reveal();if(o){const t={kind:s.OpKind.REVEAL},a=yield this.estimate(t,(()=>n(this,void 0,void 0,(function*(){return o}))));return r.unshift(yield v.createRevealOperation(Object.assign({},a),e,i)),r}}return t}))}originate(t){return n(this,void 0,void 0,(function*(){const e=yield this.estimate(t,this.estimator.originate.bind(this.estimator)),r=yield this.signer.publicKeyHash(),n=yield v.createOriginationOperation(yield this.context.parser.prepareCodeOrigination(Object.assign(Object.assign({},t),e))),i=yield this.addRevealOperationIfNeeded(n,r),o=yield this.prepareOperation({operation:i,source:r}),s=yield this.forge(o),{hash:a,context:c,forgedBytes:u,opResponse:f}=yield this.signAndInject(s);return new h.OriginationOperation(a,n,u,f,c,this)}))}setDelegate(t){return n(this,void 0,void 0,(function*(){if(t.source&&w.validateAddress(t.source)!==w.ValidationResult.VALID)throw new w.InvalidAddressError(`Invalid source Address: ${t.source}`);if(t.delegate&&w.validateAddress(t.delegate)!==w.ValidationResult.VALID)throw new w.InvalidAddressError(`Invalid delegate Address: ${t.delegate}`);if(/kt1/i.test(t.source))throw new m.InvalidDelegationSource(t.source);const e=yield this.estimate(t,this.estimator.setDelegate.bind(this.estimator)),r=yield this.signer.publicKeyHash(),n=yield v.createSetDelegateOperation(Object.assign(Object.assign({},t),e)),i=t.source||r,o=yield this.addRevealOperationIfNeeded(n,r),s=yield this.prepareOperation({operation:o,source:i}),a=yield this.forge(s),{hash:c,context:f,forgedBytes:h,opResponse:l}=yield this.signAndInject(a);return new u.DelegateOperation(c,n,i,h,l,f)}))}registerDelegate(t){return n(this,void 0,void 0,(function*(){const e=yield this.estimate(t,this.estimator.registerDelegate.bind(this.estimator)),r=yield this.signer.publicKeyHash(),n=yield v.createRegisterDelegateOperation(Object.assign(Object.assign({},t),e),r),i=yield this.addRevealOperationIfNeeded(n,r),o=yield this.prepareOperation({operation:i}),s=yield this.forge(o),{hash:a,context:c,forgedBytes:f,opResponse:h}=yield this.signAndInject(s);return new u.DelegateOperation(a,n,r,f,h,c)}))}transfer(t){return n(this,void 0,void 0,(function*(){if(w.validateAddress(t.to)!==w.ValidationResult.VALID)throw new w.InvalidAddressError(`Invalid address passed in 'to' parameter: ${t.to}`);if(t.source&&w.validateAddress(t.source)!==w.ValidationResult.VALID)throw new w.InvalidAddressError(`Invalid address passed in 'source' parameter: ${t.source}`);const e=yield this.signer.publicKeyHash(),r=yield this.estimate(t,this.estimator.transfer.bind(this.estimator)),n=yield v.createTransferOperation(Object.assign(Object.assign({},t),r)),i=t.source||e,o=yield this.addRevealOperationIfNeeded(n,e),s=yield this.prepareOperation({operation:o,source:t.source}),a=yield this.forge(s),{hash:c,context:u,forgedBytes:f,opResponse:h}=yield this.signAndInject(a);return new p.TransactionOperation(c,n,i,f,h,u)}))}reveal(t){return n(this,void 0,void 0,(function*(){const e=yield this.signer.publicKeyHash(),r=yield this.estimator.reveal(t);if(r){const i=yield this.estimate(t,(()=>n(this,void 0,void 0,(function*(){return r})))),o=yield v.createRevealOperation(Object.assign({},i),e,yield this.signer.publicKey()),s=yield this.prepareOperation({operation:o,source:e}),a=yield this.forge(s),{hash:c,context:u,forgedBytes:f,opResponse:h}=yield this.signAndInject(a);return new d.RevealOperation(c,o,e,f,h,u)}throw new Error("The current address is already revealed.")}))}registerGlobalConstant(t){return n(this,void 0,void 0,(function*(){const e=yield this.signer.publicKeyHash(),r=yield this.estimate(t,this.estimator.registerGlobalConstant.bind(this.estimator)),n=yield v.createRegisterGlobalConstantOperation(Object.assign(Object.assign({},t),r)),i=yield this.addRevealOperationIfNeeded(n,e),o=yield this.prepareOperation({operation:i,source:e}),s=yield this.forge(o),{hash:a,context:c,forgedBytes:u,opResponse:f}=yield this.signAndInject(s);return new l.RegisterGlobalConstantOperation(a,n,e,u,f,c)}))}at(t,e=(t=>t)){return n(this,void 0,void 0,(function*(){if(w.validateContractAddress(t)!==w.ValidationResult.VALID)throw new w.InvalidContractAddressError(`Invalid contract address: ${t}`);const r=this.context.withExtensions().rpc,n=this.context.withExtensions().readProvider,i=yield n.getScript(t,"head"),o=yield n.getEntrypoints(t),s=new g.ContractAbstraction(t,i,this,this,o,r,n);return e(s,this.context)}))}batch(t){const e=new c.OperationBatch(this.context,this.estimator);return Array.isArray(t)&&e.with(t),e}}e.RpcContractProvider=_},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RegisterGlobalConstantOperation=void 0;const n=r(47);class i extends n.Operation{constructor(t,e,r,n,i,o){super(t,n,i,o),this.params=e,this.source=r,this.globalConstantHash=this.operationResults&&this.operationResults.global_address}get operationResults(){const t=Array.isArray(this.results)&&this.results.find((t=>"register_global_constant"===t.kind)),e=t&&t.metadata&&t.metadata.operation_result;return e||void 0}get status(){const t=this.operationResults;return t?t.status:"unknown"}get registeredExpression(){return this.params.value}get fee(){return this.params.fee}get gasLimit(){return this.params.gas_limit}get storageLimit(){return this.params.storage_limit}get errors(){return this.operationResults&&this.operationResults.errors}}e.RegisterGlobalConstantOperation=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RevealOperation=void 0;const n=r(52),i=r(47);class o extends i.Operation{constructor(t,e,r,n,i,o){super(t,n,i,o),this.params=e,this.source=r}get operationResults(){const t=Array.isArray(this.results)&&this.results.find((t=>"reveal"===t.kind));return t?[t]:[]}get status(){const t=this.operationResults[0];return t?t.metadata.operation_result.status:"unknown"}get fee(){return this.params.fee}get gasLimit(){return this.params.gas_limit}get storageLimit(){return this.params.storage_limit}get publicKey(){return this.params.public_key}sumProp(t,e){return t.reduce(((t,r)=>e in r?Number(r[e])+t:t),0)}get consumedGas(){return String(this.sumProp(n.flattenOperationResult({contents:this.operationResults}),"consumed_gas"))}get storageDiff(){return String(this.sumProp(n.flattenOperationResult({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp(n.flattenOperationResult({contents:this.operationResults}),"storage_size"))}get errors(){return n.flattenErrors({contents:this.operationResults})}}e.RevealOperation=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ContractMethodFactory=void 0;const n=r(170),i=r(172),o=r(284);e.ContractMethodFactory=class{constructor(t,e){this.provider=t,this.contractAddress=e}createContractMethodFlatParams(t,e,r,n=!0,o=!1){return new i.ContractMethod(this.provider,this.contractAddress,t,e,r,n,o)}createContractMethodObjectParam(t,e,r,i=!0,o=!1){return new n.ContractMethodObject(this.provider,this.contractAddress,t,e,r,i,o)}createContractViewObjectParam(t,e,r,n,i){return new o.OnChainView(t,e,this.contractAddress,r,n,i)}}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.Wallet=e.WalletOperationBatch=void 0;const i=r(171),o=r(23),s=r(2);class a{constructor(t,e){this.walletProvider=t,this.context=e,this.operations=[]}withTransfer(t){if(s.validateAddress(t.to)!==s.ValidationResult.VALID)throw new s.InvalidAddressError(`Invalid 'to' address: ${t.to}`);return this.operations.push(Object.assign({kind:o.OpKind.TRANSACTION},t)),this}withContractCall(t){return this.withTransfer(t.toTransferParams())}withDelegation(t){if(t.delegate&&s.validateAddress(t.delegate)!==s.ValidationResult.VALID)throw new s.InvalidAddressError(`Invalid delegate address: ${t.delegate}`);return this.operations.push(Object.assign({kind:o.OpKind.DELEGATION},t)),this}withOrigination(t){return this.operations.push(Object.assign({kind:o.OpKind.ORIGINATION},t)),this}mapOperation(t){return n(this,void 0,void 0,(function*(){switch(t.kind){case o.OpKind.TRANSACTION:return this.walletProvider.mapTransferParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return t}))));case o.OpKind.ORIGINATION:return this.walletProvider.mapOriginateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return this.context.parser.prepareCodeOrigination(Object.assign({},t))}))));case o.OpKind.DELEGATION:return this.walletProvider.mapDelegateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return t}))));default:throw new Error(`Unsupported operation kind: ${t.kind}`)}}))}with(t){for(const e of t)switch(e.kind){case o.OpKind.TRANSACTION:this.withTransfer(e);break;case o.OpKind.ORIGINATION:this.withOrigination(e);break;case o.OpKind.DELEGATION:this.withDelegation(e);break;default:throw new Error(`Unsupported operation kind: ${e.kind}`)}return this}send(){return n(this,void 0,void 0,(function*(){const t=[];for(const e of this.operations)t.push(yield this.mapOperation(e));const e=yield this.walletProvider.sendOperations(t);return this.context.operationFactory.createBatchOperation(e)}))}}e.WalletOperationBatch=a;e.Wallet=class{constructor(t){this.context=t,this.walletCommand=t=>({send:t})}get walletProvider(){return this.context.walletProvider}pkh({forceRefetch:t}={}){return n(this,void 0,void 0,(function*(){return this._pkh&&!t||(this._pkh=yield this.walletProvider.getPKH()),this._pkh}))}originate(t){return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const e=yield this.walletProvider.mapOriginateParamsToWalletParams((()=>this.context.parser.prepareCodeOrigination(Object.assign({},t)))),r=yield this.walletProvider.sendOperations([e]);return this.context.operationFactory.createOriginationOperation(r)}))))}setDelegate(t){if(t.delegate&&s.validateAddress(t.delegate)!==s.ValidationResult.VALID)throw new s.InvalidAddressError(`Invalid address error: ${t.delegate}`);return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const e=yield this.walletProvider.mapDelegateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return t})))),r=yield this.walletProvider.sendOperations([e]);return this.context.operationFactory.createDelegationOperation(r)}))))}registerDelegate(){return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const t=yield this.walletProvider.mapDelegateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return{delegate:yield this.pkh()}})))),e=yield this.walletProvider.sendOperations([t]);return this.context.operationFactory.createDelegationOperation(e)}))))}transfer(t){if(s.validateAddress(t.to)!==s.ValidationResult.VALID)throw new s.InvalidAddressError(`Invalid 'to' address: ${t.to}`);return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const e=yield this.walletProvider.mapTransferParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return t})))),r=yield this.walletProvider.sendOperations([e]);return this.context.operationFactory.createTransactionOperation(r)}))))}batch(t){const e=new a(this.walletProvider,this.context);return Array.isArray(t)&&e.with(t),e}at(t,e=(t=>t)){return n(this,void 0,void 0,(function*(){if(s.validateContractAddress(t)!==s.ValidationResult.VALID)throw new s.InvalidContractAddressError(`Invalid contract address: ${t}`);const r=this.context.withExtensions().rpc,n=this.context.withExtensions().readProvider,o=yield n.getScript(t,"head"),a=yield n.getEntrypoints(t),c=new i.ContractAbstraction(t,o,this,this.context.contract,a,r,n);return e(c,this.context)}))}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MANAGER_LAMBDA=void 0;e.MANAGER_LAMBDA={setDelegate:t=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:t}]},{prim:"SOME"},{prim:"SET_DELEGATE"},{prim:"CONS"}],removeDelegate:()=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"NONE",args:[{prim:"key_hash"}]},{prim:"SET_DELEGATE"},{prim:"CONS"}],transferImplicit:(t,e)=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:t}]},{prim:"IMPLICIT_ACCOUNT"},{prim:"PUSH",args:[{prim:"mutez"},{int:`${e}`}]},{prim:"UNIT"},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}],transferToContract:(t,e)=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"address"},{string:t}]},{prim:"CONTRACT",args:[{prim:"unit"}]},[{prim:"IF_NONE",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],[]]}],{prim:"PUSH",args:[{prim:"mutez"},{int:`${e}`}]},{prim:"UNIT"},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}]}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VIEW_LAMBDA=void 0;e.VIEW_LAMBDA={code:[{prim:"parameter",args:[{prim:"lambda",args:[{prim:"unit"},{prim:"pair",args:[{prim:"list",args:[{prim:"operation"}]},{prim:"unit"}]}]}]},{prim:"storage",args:[{prim:"unit"}]},{prim:"code",args:[[{prim:"CAR"},{prim:"UNIT"},{prim:"EXEC"}]]}],storage:"Unit"}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.compose=void 0,e.compose=function(t,e){return(r,n)=>e(t(r,n),n)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.LegacyWalletProvider=void 0;const i=r(23);e.LegacyWalletProvider=class{constructor(t){this.context=t}getPKH(){return n(this,void 0,void 0,(function*(){return this.context.signer.publicKeyHash()}))}mapTransferParamsToWalletParams(t){return n(this,void 0,void 0,(function*(){return i.attachKind(yield t(),i.OpKind.TRANSACTION)}))}mapOriginateParamsToWalletParams(t){return n(this,void 0,void 0,(function*(){return i.attachKind(yield t(),i.OpKind.ORIGINATION)}))}mapDelegateParamsToWalletParams(t){return n(this,void 0,void 0,(function*(){return i.attachKind(yield t(),i.OpKind.DELEGATION)}))}sendOperations(t){return n(this,void 0,void 0,(function*(){return(yield this.context.batch.batch(t).send()).hash}))}}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.OnChainView=void 0;const i=r(2),o=r(51);e.OnChainView=class{constructor(t,e,r,n,i,o="Unit"){this._rpc=t,this._readProvider=e,this._contractAddress=r,this._smartContractViewSchema=n,this._contractStorageType=i,this._args=o}getSignature(){return{parameter:this._smartContractViewSchema.extractArgsSchema(),result:this._smartContractViewSchema.extractResultSchema()}}executeView(t){return n(this,void 0,void 0,(function*(){this.verifyContextExecution(t);const e=(yield this._readProvider.getBalance(this._contractAddress,"head")).toString(),r=yield this._readProvider.getChainId(),n=yield this._readProvider.getStorage(this._contractAddress,"head");return this.executeViewAndDecodeResult(((t,e,r,n,i,o,s,a,c,u="0")=>({script:[{prim:"parameter",args:[{prim:"pair",args:[t,r]}]},{prim:"storage",args:[{prim:"option",args:[e]}]},{prim:"code",args:[[{prim:"CAR"},n,{prim:"SOME"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PAIR"}]]}],storage:{prim:"None"},input:{prim:"Pair",args:[i,o]},amount:u,balance:s,chain_id:a,source:c}))(this._smartContractViewSchema.viewArgsType,this._smartContractViewSchema.viewReturnType,this._contractStorageType,this.adaptViewCodeToContext(this._smartContractViewSchema.instructions,t.viewCaller,e),this.transformArgsToMichelson(),n,e,r,t.source))}))}verifyContextExecution(t){if(t.source&&i.validateAddress(t.source)!==i.ValidationResult.VALID)throw new o.InvalidViewSimulationContext(`The source account who initialized the view execution is invalid: ${t.source}.`);if(!t.viewCaller||i.validateAddress(t.viewCaller)!==i.ValidationResult.VALID)throw new o.InvalidViewSimulationContext(`The contract which is the caller of view is invalid: ${t.viewCaller}.`)}transformArgsToMichelson(){try{return this._smartContractViewSchema.encodeViewArgs(this._args)}catch(t){throw new o.InvalidViewParameterError(this._smartContractViewSchema.viewName,this.getSignature(),this._args,t)}}adaptViewCodeToContext(t,e,r){const n={BALANCE:[{prim:"PUSH",args:[{prim:"mutez"},{int:r}]}],SENDER:[{prim:"PUSH",args:[{prim:"address"},{string:e}]}],SELF_ADDRESS:[{prim:"PUSH",args:[{prim:"address"},{string:this._contractAddress}]}],AMOUNT:[{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]}]};return t.forEach(((i,o)=>{i.prim in n&&(t[o]=Object(n)[i.prim]),i.args&&0!==i.args.length?this.adaptViewCodeToContext(i.args,e,r):Array.isArray(i)&&this.adaptViewCodeToContext(i,e,r)})),t}executeViewAndDecodeResult(t){return n(this,void 0,void 0,(function*(){let e;try{e=(yield this._rpc.runCode(t)).storage}catch(t){const e=o.validateAndExtractFailwith(t);throw e?new o.ViewSimulationError(`The simulation of the on-chain view named ${this._smartContractViewSchema.viewName} failed with: ${JSON.stringify(e)}`,this._smartContractViewSchema.viewName,e,t):t}if(!e.args)throw new o.ViewSimulationError(`View simulation failed with an invalid result: ${e}`,this._smartContractViewSchema.viewName);return this._smartContractViewSchema.decodeViewResult(e.args[0])}))}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.smartContractAbstractionSemantic=void 0;const n=r(62),i=r(173),o=r(63),s=r(286);e.smartContractAbstractionSemantic=t=>({big_map:(e,r)=>{if(e&&"int"in e&&void 0!==e.int){const s=new n.Schema(r);return new i.BigMapAbstraction(new o.default(e.int),s,t)}return{}},sapling_state:e=>e&&"int"in e&&void 0!==e.int?new s.SaplingStateAbstraction(new o.default(e.int),t):{}})},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.SaplingStateAbstraction=void 0;e.SaplingStateAbstraction=class{constructor(t,e){this.id=t,this.provider=e}getSaplingDiff(t){return n(this,void 0,void 0,(function*(){return this.provider.getSaplingDiffByID(this.id.toString(),t)}))}getId(){return this.id.toString()}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.evaluateFilter=e.evaluateExpression=e.evaluateOpFilter=void 0;e.evaluateOpFilter=(t,e)=>"opHash"in e?((t,e)=>t.hash===e.opHash)(t,e):"source"in e?((t,e)=>{switch(t.kind){case"endorsement":return"metadata"in t&&t.metadata.delegate===e.source;case"activate_account":return"metadata"in t&&t.pkh===e.source;default:return"source"in t&&t.source===e.source}})(t,e):"kind"in e?((t,e)=>"kind"in t&&t.kind===e.kind)(t,e):"destination"in e&&((t,e)=>{switch(t.kind){case"delegation":return t.delegate===e.destination;case"origination":if("metadata"in t&&"operation_result"in t.metadata&&"originated_contracts"in t.metadata.operation_result&&Array.isArray(t.metadata.operation_result.originated_contracts))return t.metadata.operation_result.originated_contracts.some((t=>t===e.destination));break;case"transaction":return t.destination===e.destination;default:return!1}})(t,e);e.evaluateExpression=(t,r)=>{if(Array.isArray(r.and))return r.and.every((r=>e.evaluateFilter(t,r)));if(Array.isArray(r.or))return r.or.some((r=>e.evaluateFilter(t,r)));throw new Error("Filter expression must contains either and/or property")};e.evaluateFilter=(t,r)=>{const n=[];return Array.isArray(r)?n.push(...r):n.push(r),n.every((r=>"and"in r||"or"in r?e.evaluateExpression(t,r):e.evaluateOpFilter(t,r)))}},function(t,e,r){"use strict";r.r(e),function(t){r.d(e,"CODEC",(function(){return c})),r.d(e,"LocalForger",(function(){return pt})),r.d(e,"ProtocolsHash",(function(){return b})),r.d(e,"Uint8ArrayConsumer",(function(){return g})),r.d(e,"VERSION",(function(){return lt})),r.d(e,"decoders",(function(){return rt})),r.d(e,"encoders",(function(){return nt})),r.d(e,"getCodec",(function(){return dt})),r.d(e,"localForger",(function(){return bt}));var n=r(2),i=r(77),o=r.n(i);const s=t=>t.reduce(((t,e)=>t+e.toString(16).padStart(2,"0")),""),a=(t,e=8)=>t.toString(16).padStart(e,"0");var c;!function(t){t.SECRET="secret",t.RAW="raw",t.TZ1="tz1",t.BRANCH="branch",t.ZARITH="zarith",t.PUBLIC_KEY="public_key",t.PKH="pkh",t.DELEGATE="delegate",t.SCRIPT="script",t.BALLOT_STATEMENT="ballotStmt",t.PROPOSAL="proposal",t.PROPOSAL_ARR="proposalArr",t.INT32="int32",t.INT16="int16",t.PARAMETERS="parameters",t.ADDRESS="address",t.OPERATION="operation",t.OP_ACTIVATE_ACCOUNT="activate_account",t.OP_DELEGATION="delegation",t.OP_TRANSACTION="transaction",t.OP_ORIGINATION="origination",t.OP_BALLOT="ballot",t.OP_ENDORSEMENT="endorsement",t.OP_SEED_NONCE_REVELATION="seed_nonce_revelation",t.OP_REVEAL="reveal",t.OP_PROPOSALS="proposals",t.OP_REGISTER_GLOBAL_CONSTANT="register_global_constant",t.VALUE="value",t.MANAGER="manager"}(c||(c={}));const u={"00":"parameter","01":"storage","02":"code","03":"False","04":"Elt","05":"Left","06":"None","07":"Pair","08":"Right","09":"Some","0a":"True","0b":"Unit","0c":"PACK","0d":"UNPACK","0e":"BLAKE2B","0f":"SHA256",10:"SHA512",11:"ABS",12:"ADD",13:"AMOUNT",14:"AND",15:"BALANCE",16:"CAR",17:"CDR",18:"CHECK_SIGNATURE",19:"COMPARE","1a":"CONCAT","1b":"CONS","1c":"CREATE_ACCOUNT","1d":"CREATE_CONTRACT","1e":"IMPLICIT_ACCOUNT","1f":"DIP",20:"DROP",21:"DUP",22:"EDIV",23:"EMPTY_MAP",24:"EMPTY_SET",25:"EQ",26:"EXEC",27:"FAILWITH",28:"GE",29:"GET","2a":"GT","2b":"HASH_KEY","2c":"IF","2d":"IF_CONS","2e":"IF_LEFT","2f":"IF_NONE",30:"INT",31:"LAMBDA",32:"LE",33:"LEFT",34:"LOOP",35:"LSL",36:"LSR",37:"LT",38:"MAP",39:"MEM","3a":"MUL","3b":"NEG","3c":"NEQ","3d":"NIL","3e":"NONE","3f":"NOT",40:"NOW",41:"OR",42:"PAIR",43:"PUSH",44:"RIGHT",45:"SIZE",46:"SOME",47:"SOURCE",48:"SENDER",49:"SELF","4a":"STEPS_TO_QUOTA","4b":"SUB","4c":"SWAP","4d":"TRANSFER_TOKENS","4e":"SET_DELEGATE","4f":"UNIT",50:"UPDATE",51:"XOR",52:"ITER",53:"LOOP_LEFT",54:"ADDRESS",55:"CONTRACT",56:"ISNAT",57:"CAST",58:"RENAME",59:"bool","5a":"contract","5b":"int","5c":"key","5d":"key_hash","5e":"lambda","5f":"list",60:"map",61:"big_map",62:"nat",63:"option",64:"or",65:"pair",66:"set",67:"signature",68:"string",69:"bytes","6a":"mutez","6b":"timestamp","6c":"unit","6d":"operation","6e":"address","6f":"SLICE",70:"DIG",71:"DUG",72:"EMPTY_BIG_MAP",73:"APPLY",74:"chain_id",75:"CHAIN_ID",76:"LEVEL",77:"SELF_ADDRESS",78:"never",79:"NEVER","7a":"UNPAIR","7b":"VOTING_POWER","7c":"TOTAL_VOTING_POWER","7d":"KECCAK","7e":"SHA3","7f":"PAIRING_CHECK",80:"bls12_381_g1",81:"bls12_381_g2",82:"bls12_381_fr",83:"sapling_state",84:"sapling_transaction",85:"SAPLING_EMPTY_STATE",86:"SAPLING_VERIFY_UPDATE",87:"ticket",88:"TICKET",89:"READ_TICKET","8a":"SPLIT_TICKET","8b":"JOIN_TICKETS","8c":"GET_AND_UPDATE","8d":"chest","8e":"chest_key","8f":"OPEN_CHEST",90:"VIEW",91:"view",92:"constant",93:"SUB_MUTEZ"},f=(()=>{const t={};return Object.keys(u).forEach((e=>{t[u[e]]=e})),t})(),h={4:"activate_account",107:"reveal",110:"delegation",108:"transaction",109:"origination",6:"ballot",0:"endorsement",1:"seed_nonce_revelation",5:"proposals",111:"register_global_constant"},l=(()=>{const t={};return Object.keys(h).forEach((e=>{const r="string"==typeof e?parseInt(e,10):e;t[h[r]]=a(r,2)})),t})(),d={"00":"default","01":"root","02":"do","03":"set_delegate","04":"remove_delegate"},p=(()=>{const t={};return Object.keys(d).forEach((e=>{t[d[e]]=e})),t})();var b;!function(t){t.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",t.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",t.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",t.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",t.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",t.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",t.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",t.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",t.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",t.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",t.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A"}(b||(b={}));class g{constructor(t,e=0){this.arr=t,this.offset=e}static fromHexString(t){const e=t.toLowerCase();if(/^(([a-f]|\d){2})*$/.test(e)){const t=new Uint8Array((e.match(/([a-z]|\d){2}/g)||[]).map((t=>parseInt(t,16))));return new g(t)}throw new Error("Invalid hex string")}consume(t){const e=this.arr.subarray(this.offset,this.offset+t);return this.offset+=t,e}get(t){return this.arr[this.offset+t]}length(){return this.arr.length-this.offset}}const m=t=>{if(Array.isArray(t)){const e=t.map((t=>m(t))).join(""),r=e.length/2;return`02${a(r)}${e}`}if((t=>"prim"in t)(t))return x(t);if((t=>"bytes"in t&&"string"==typeof t.bytes)(t))return w(t);if((t=>"string"in t&&"string"==typeof t.string)(t))return E(t);if((t=>"int"in t&&"string"==typeof t.int)(t))return A(t);throw new Error("Unexpected value")},v=t=>{const e=t.consume(1);switch(e[0]){case 10:return _(t);case 1:return S(t);case 0:return O(t);case 2:{const e=new g(y(t)),r=[];for(;e.length()>0;)r.push(v(e));return r}default:return T(t,e)}},y=(e,r=4)=>{const n=e.consume(r),i=parseInt(t.from(n).toString("hex"),16);return e.consume(i)},w=t=>{if(!/^([A-Fa-f0-9]{2})*$/.test(t.bytes))throw new Error(`Invalid hex string: ${t.bytes}`);const e=t.bytes.length/2;return`0a${a(e)}${t.bytes}`},_=e=>{const r=y(e);return{bytes:t.from(r).toString("hex")}},E=e=>{const r=t.from(e.string,"utf8").toString("hex"),n=r.length/2;return`01${a(n)}${r}`},S=e=>{const r=y(e);return{string:t.from(r).toString("utf8")}},A=({int:t})=>{const e=new i.BigNumber(t,10),r="-"===e.toString(2)[0]?"1":"0",n=e.toString(2).replace(/-/g,""),o=n.length<=6?6:(n.length-6)%7?n.length+7-(n.length-6)%7:n.length,s=n.padStart(o,"0").match(/\d{6,7}/g).reverse();s[0]=r+s[0];return`00${s.map(((t,e)=>parseInt((e===s.length-1?"0":"1")+t,2).toString(16).padStart(2,"0"))).join("")}`},O=t=>{let e=t.consume(1)[0];const r=[];for(;128&e;)r.push(e),e=t.consume(1)[0];r.push(e);const n=!!(64&r[0]);r[0]=127&r[0];const o=r.map(((t,e)=>t.toString(2).slice(0===e?-6:-7).padStart(0===e?6:7,"0"))).reverse();let s=new i.BigNumber(o.join(""),2);return n&&(s=s.times(-1)),{int:s.toFixed()}},x=t=>{const e=+Array.isArray(t.annots),r=Array.isArray(t.args)?t.args.length:0,n=a(Math.min(2*r+e+3,9),2),i=f[t.prim];let o=(t.args||[]).map((t=>m(t))).join("");const s=Array.isArray(t.annots)?I(t.annots):"";return"LAMBDA"===t.prim&&r&&(o=a(o.length/2)+o+a(0)),("pair"===t.prim||"Pair"===t.prim)&&r>2&&(o=""===s?a(o.length/2)+o+a(0):a(o.length/2)+o),"view"===t.prim&&t.args&&(o=a(o.length/2)+o+a(0)),`${n}${i}${o}${s}`},T=(t,e)=>{const r=(e[0]-3)%2==1;let n=Math.floor((e[0]-3)/2);const i=t.consume(1)[0].toString(16).padStart(2,"0"),o={prim:u[i]};if("LAMBDA"===u[i]&&t.consume(4),"view"===u[i])return 0!=n?P(t,o):o;let s,a;("pair"===u[i]||"Pair"===u[i])&&n>2&&(s=R(t),n=0,a=M(t));const c=new Array(n).fill(0).map((()=>v(t)));return"LAMBDA"===u[i]&&t.consume(4),s?o.args=s:c.length&&(o.args=c),a&&""!==a[0]?o.annots=a:r&&(o.annots=M(t)),o},P=(t,e)=>(t.consume(4),e.args=new Array(4).fill(0).map((()=>v(t))),t.consume(4),e),R=t=>{const e=new g(y(t)),r=[];for(;e.length()>0;)r.push(v(e));return r},I=e=>{const r=e.map((e=>t.from(e,"utf8").toString("hex"))).join("20"),n=r.length/2;return`${a(n)}${r}`},M=e=>{const r=e.consume(4),n=parseInt(t.from(r).toString("hex"),16),i=e.consume(n);return t.from(i).toString("hex").split("20").map((e=>t.from(e,"hex").toString("utf8")))},N=e=>r=>Object(n.buf2hex)(t.from(Object(n.b58cdecode)(r,n.prefix[e]))),k=t=>e=>{const r=e.consume(n.prefixLength[t]);return Object(n.b58cencode)(r,n.prefix[t])},C=k(n.Prefix.TZ1),L=k(n.Prefix.B),j=t=>{const e=t.consume(1);return 0===e[0]?k(n.Prefix.TZ1)(t):1===e[0]?k(n.Prefix.TZ2)(t):2===e[0]?k(n.Prefix.TZ3)(t):void 0},D=N(n.Prefix.B),U=N(n.Prefix.TZ1),B=t=>t?"ff":"00",F=t=>N(n.Prefix.P)(t),V=t=>k(n.Prefix.P)(t),K=t=>{switch(t.substr(0,3)){case n.Prefix.TZ1:return"00"+N(n.Prefix.TZ1)(t);case n.Prefix.TZ2:return"01"+N(n.Prefix.TZ2)(t);case n.Prefix.TZ3:return"02"+N(n.Prefix.TZ3)(t);default:throw new Error("Invalid public key hash")}},H={branch:"branch",contents:["operation"]},$={pkh:"tz1",secret:"secret"},G={source:"pkh",fee:"zarith",counter:"zarith",gas_limit:"zarith",storage_limit:"zarith",public_key:"public_key"},z={source:"pkh",fee:"zarith",counter:"zarith",gas_limit:"zarith",storage_limit:"zarith",delegate:"delegate"},q={source:"pkh",fee:"zarith",counter:"zarith",gas_limit:"zarith",storage_limit:"zarith",amount:"zarith",destination:"address",parameters:"parameters"},W={source:"pkh",fee:"zarith",counter:"zarith",gas_limit:"zarith",storage_limit:"zarith",balance:"zarith",delegate:"delegate",script:"script"},Y={source:"pkh",period:"int32",proposal:"proposal",ballot:"ballotStmt"},J={level:"int32"},Z={level:"int32",nonce:"raw"},X={source:"pkh",period:"int32",proposals:"proposalArr"},Q={source:"pkh",fee:"zarith",counter:"zarith",gas_limit:"zarith",storage_limit:"zarith",value:"value"},tt=t=>e=>r=>Object.keys(e).reduce(((n,i)=>{const o=e[i];if(Array.isArray(o)){const e=t[o[0]],s=r[i];if(!Array.isArray(s))throw new Error(`Exepected value to be Array ${JSON.stringify(s)}`);return n+s.reduce(((t,r)=>t+e(r)),"")}return n+(0,t[o])(r[i])}),""),et=t=>e=>r=>Object.keys(e).reduce(((n,i)=>{const o=e[i];if(Array.isArray(o)){const e=t[o[0]],s=[],a=r.length();for(;r.length()>0;)if(s.push(e(r)),a===r.length())throw new Error("Unable to decode value");return Object.assign(Object.assign({},n),{[i]:s})}{const e=(0,t[o])(r);return void 0!==e?Object.assign(Object.assign({},n),{[i]:e}):Object.assign({},n)}}),{}),rt={[c.SECRET]:t=>s(t.consume(20)),[c.RAW]:t=>s(t.consume(32)),[c.TZ1]:C,[c.BRANCH]:L,[c.ZARITH]:t=>{let e=0;for(;e<t.length()&&0!=(128&t.get(e));)e+=1;let r=new o.a(0);for(let n=e;n>=0;n-=1){const e=127&t.get(n);r=r.multipliedBy(128),r=r.plus(e)}return t.consume(e+1),new o.a(r).toString()},[c.PUBLIC_KEY]:t=>{switch(t.consume(1)[0]){case 0:return k(n.Prefix.EDPK)(t);case 1:return k(n.Prefix.SPPK)(t);case 2:return k(n.Prefix.P2PK)(t);default:throw new Error("Invalid PK")}},[c.PKH]:j,[c.DELEGATE]:t=>{const e=(t=>255===t.consume(1)[0])(t);if(e)return j(t)},[c.INT32]:t=>{const e=t.consume(4);let r=0;for(let t=0;t<e.length;t++)r|=e[t]<<8*(e.length-(t+1));return r},[c.SCRIPT]:t=>{const e=y(t),r=y(t);return{code:v(new g(e)),storage:v(new g(r))}},[c.BALLOT_STATEMENT]:t=>{const e=t.consume(1);switch(e[0]){case 0:return"yay";case 1:return"nay";case 2:return"pass";default:throw new Error(`Unable to decode ballot value ${e[0]}`)}},[c.PROPOSAL]:V,[c.PROPOSAL_ARR]:t=>{const e=[];for(t.consume(4);t.length()>0;)e.push(V(t));return e},[c.PARAMETERS]:e=>{if(0!==e.consume(1)[0]){const r=(e=>{const r=a(e.consume(1)[0],2);if(r in d)return d[r];{const r=y(e,1),n=t.from(r).toString("utf8");if(n.length>31)throw new Error(`Oversized entrypoint: ${n}. The maximum length of entrypoint is 31`);return n}})(e),n=y(e);return{entrypoint:r,value:v(new g(n))}}},[c.ADDRESS]:t=>{switch(t.consume(1)[0]){case 0:return j(t);case 1:{const e=k(n.Prefix.KT1)(t);return t.consume(1),e}default:throw new Error("Invalid Address")}},[c.VALUE]:t=>{const e=y(t);return v(new g(e))}};rt[c.OPERATION]=(t=>e=>{const r=e.consume(1),n=h[r[0]],i=t[n](e);if("object"!=typeof i)throw new Error("Decoded invalid operation");if(n)return Object.assign({kind:n},i);throw new Error(`Unsupported operation ${r[0]}`)})(rt),rt[c.OP_ACTIVATE_ACCOUNT]=t=>et(rt)($)(t),rt[c.OP_DELEGATION]=t=>et(rt)(z)(t),rt[c.OP_TRANSACTION]=t=>et(rt)(q)(t),rt[c.OP_ORIGINATION]=t=>et(rt)(W)(t),rt[c.OP_BALLOT]=t=>et(rt)(Y)(t),rt[c.OP_ENDORSEMENT]=t=>et(rt)(J)(t),rt[c.OP_SEED_NONCE_REVELATION]=t=>et(rt)(Z)(t),rt[c.OP_PROPOSALS]=t=>et(rt)(X)(t),rt[c.OP_REVEAL]=t=>et(rt)(G)(t),rt[c.OP_REGISTER_GLOBAL_CONSTANT]=t=>et(rt)(Q)(t),rt[c.MANAGER]=et(rt)(H);const nt={[c.SECRET]:t=>t,[c.RAW]:t=>t,[c.TZ1]:U,[c.BRANCH]:D,[c.ZARITH]:t=>{const e=[];let r=new o.a(t,10);if(r.isNaN())throw new TypeError(`Invalid zarith number ${t}`);for(;;){if(r.lt(128)){r.lt(16)&&e.push("0"),e.push(r.toString(16));break}{let t=r.mod(128);r=r.minus(t),r=r.dividedBy(128),t=t.plus(128),e.push(t.toString(16))}}return e.join("")},[c.PUBLIC_KEY]:t=>{switch(t.substr(0,4)){case n.Prefix.EDPK:return"00"+N(n.Prefix.EDPK)(t);case n.Prefix.SPPK:return"01"+N(n.Prefix.SPPK)(t);case n.Prefix.P2PK:return"02"+N(n.Prefix.P2PK)(t);default:throw new Error("Invalid PK")}},[c.PKH]:K,[c.DELEGATE]:t=>t?B(!0)+K(t):B(!1),[c.SCRIPT]:t=>{const e=m(t.code),r=m(t.storage);return`${a(e.length/2,8)}${e}${a(r.length/2,8)}${r}`},[c.BALLOT_STATEMENT]:t=>{switch(t){case"yay":return"00";case"nay":return"01";case"pass":return"02";default:throw new Error(`Invalid ballot value: ${t}`)}},[c.PROPOSAL]:F,[c.PROPOSAL_ARR]:t=>a(32*t.length)+t.map((t=>F(t))).join(""),[c.INT32]:e=>{const r=parseInt(String(e),10),n=[];for(let t=0;t<4;t++){const e=8*(4-(t+1));n.push((r&255<<e)>>e)}return t.from(n).toString("hex")},[c.PARAMETERS]:t=>{if(!t||"default"===t.entrypoint&&"prim"in t.value&&"Unit"===t.value.prim)return"00";const e=(t=>{if(t in p)return`${p[t]}`;if(t.length>31)throw new Error(`Oversized entrypoint: ${t}. The maximum length of entrypoint is 31`);return`ff${m({string:t}).slice(8)}`})(t.entrypoint),r=m(t.value);return`ff${e}${(r.length/2).toString(16).padStart(8,"0")}${r}`},[c.ADDRESS]:t=>{switch(t.substr(0,3)){case n.Prefix.TZ1:case n.Prefix.TZ2:case n.Prefix.TZ3:return"00"+K(t);case n.Prefix.KT1:return"01"+N(n.Prefix.KT1)(t)+"00";default:throw new Error("Invalid address")}},[c.VALUE]:t=>{const e=m(t);return`${a(e.length/2)}${e}`}};nt[c.OPERATION]=(t=>e=>{if(!(e.kind in t)||!(e.kind in l))throw new Error(`Unsupported operation kind: ${e.kind}`);return l[e.kind]+t[e.kind](e)})(nt),nt[c.OP_ACTIVATE_ACCOUNT]=t=>tt(nt)($)(t),nt[c.OP_DELEGATION]=t=>tt(nt)(z)(t),nt[c.OP_TRANSACTION]=t=>tt(nt)(q)(t),nt[c.OP_ORIGINATION]=t=>tt(nt)(W)(t),nt[c.OP_BALLOT]=t=>tt(nt)(Y)(t),nt[c.OP_ENDORSEMENT]=t=>tt(nt)(J)(t),nt[c.OP_SEED_NONCE_REVELATION]=t=>tt(nt)(Z)(t),nt[c.OP_PROPOSALS]=t=>tt(nt)(X)(t),nt[c.OP_REVEAL]=t=>tt(nt)(G)(t),nt[c.OP_REGISTER_GLOBAL_CONSTANT]=t=>tt(nt)(Q)(t),nt[c.MANAGER]=tt(nt)(H);const it=N(n.Prefix.VH),ot=k(n.Prefix.VH);const st=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(h,["0"]),at=Object.assign(Object.assign({},st),{21:"endorsement"}),ct=(()=>{const t={};return Object.keys(at).forEach((e=>{const r="string"==typeof e?parseInt(e,10):e;t[at[r]]=a(r,2)})),t})(),ut={slot:"int16",level:"int32",round:"int32",block_payload_hash:"blockPayloadHash"},ft=Object.assign(Object.assign({},rt),{[c.INT16]:t=>{const e=t.consume(2);let r=0;for(let t=0;t<e.length;t++)r|=e[t]<<8*(e.length-(t+1));return r},blockPayloadHash:ot});ft[c.OPERATION]=(t=>e=>{const r=e.consume(1),n=at[r[0]],i=t[n](e);if("object"!=typeof i)throw new Error("Decoded invalid operation");if(n)return Object.assign({kind:n},i);throw new Error(`Unsupported operation ${r[0]}`)})(ft),ft[c.OP_ACTIVATE_ACCOUNT]=t=>et(ft)($)(t),ft[c.OP_DELEGATION]=t=>et(ft)(z)(t),ft[c.OP_TRANSACTION]=t=>et(ft)(q)(t),ft[c.OP_ORIGINATION]=t=>et(ft)(W)(t),ft[c.OP_BALLOT]=t=>et(ft)(Y)(t),ft[c.OP_ENDORSEMENT]=t=>et(ft)(ut)(t),ft[c.OP_SEED_NONCE_REVELATION]=t=>et(ft)(Z)(t),ft[c.OP_PROPOSALS]=t=>et(ft)(X)(t),ft[c.OP_REVEAL]=t=>et(ft)(G)(t),ft[c.OP_REGISTER_GLOBAL_CONSTANT]=t=>et(ft)(Q)(t),ft[c.MANAGER]=et(ft)(H);const ht=Object.assign(Object.assign({},nt),{[c.INT16]:e=>{const r=parseInt(String(e),10),n=[];for(let t=0;t<2;t++){const e=8*(2-(t+1));n.push((r&255<<e)>>e)}return t.from(n).toString("hex")},blockPayloadHash:it});ht[c.OPERATION]=(t=>e=>{if(!(e.kind in t)||!(e.kind in ct))throw new Error(`Unsupported operation kind: ${e.kind}`);return ct[e.kind]+t[e.kind](e)})(ht),ht[c.OP_ACTIVATE_ACCOUNT]=t=>tt(ht)($)(t),ht[c.OP_DELEGATION]=t=>tt(ht)(z)(t),ht[c.OP_TRANSACTION]=t=>tt(ht)(q)(t),ht[c.OP_ORIGINATION]=t=>tt(ht)(W)(t),ht[c.OP_BALLOT]=t=>tt(ht)(Y)(t),ht[c.OP_ENDORSEMENT]=t=>tt(ht)(ut)(t),ht[c.OP_SEED_NONCE_REVELATION]=t=>tt(ht)(Z)(t),ht[c.OP_PROPOSALS]=t=>tt(ht)(X)(t),ht[c.OP_REVEAL]=t=>tt(ht)(G)(t),ht[c.OP_REGISTER_GLOBAL_CONSTANT]=t=>tt(ht)(Q)(t),ht[c.MANAGER]=tt(ht)(H);const lt={commitHash:"5da8cec9c84c0ab7bc37c0eb09e68db1b3a8b1f0",version:"12.0.0-beta-RC.0"};function dt(t,e){return e===b.Psithaca2?{encoder:ht[t],decoder:e=>{const r=g.fromHexString(e);return ft[t](r)}}:{encoder:nt[t],decoder:e=>{const r=g.fromHexString(e);return rt[t](r)}}}class pt{constructor(t=b.Psithaca2){this.protocolHash=t,this.codec=dt(c.MANAGER,this.protocolHash)}forge(t){return Promise.resolve(this.codec.encoder(t))}parse(t){return Promise.resolve(this.codec.decoder(t))}}const bt=new pt}.call(this,r(14).Buffer)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VERSION=void 0,e.VERSION={commitHash:"5da8cec9c84c0ab7bc37c0eb09e68db1b3a8b1f0",version:"12.0.0-beta-RC.0"}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.CompositeForger=e.ForgingMismatchError=void 0;class i extends Error{constructor(t){super("Forging mismatch error"),this.results=t,this.name="ForgingMismatchError"}}e.ForgingMismatchError=i;e.CompositeForger=class{constructor(t){if(this.forgers=t,0===t.length)throw new Error("At least one forger must be specified")}forge({branch:t,contents:e}){return n(this,void 0,void 0,(function*(){const r=yield Promise.all(this.forgers.map((r=>r.forge({branch:t,contents:e}))));if(0===r.length)throw new Error("At least one forger must be specified");let n=r.pop();for(;r.length;){const t=r.pop();if(t!==n)throw new i([n,t]);n=t}return n}))}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RpcForger=void 0;e.RpcForger=class{constructor(t){this.context=t}forge({branch:t,contents:e}){return this.context.rpc.forgeOperations({branch:t,contents:e})}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Operation=e.TransactionOperation=e.OriginationOperation=e.DelegateOperation=e.BatchOperation=e.TezosPreapplyFailureError=e.TezosOperationError=e.OpKind=void 0;var n=r(23);Object.defineProperty(e,"OpKind",{enumerable:!0,get:function(){return n.OpKind}});var i=r(52);Object.defineProperty(e,"TezosOperationError",{enumerable:!0,get:function(){return i.TezosOperationError}}),Object.defineProperty(e,"TezosPreapplyFailureError",{enumerable:!0,get:function(){return i.TezosPreapplyFailureError}});var o=r(161);Object.defineProperty(e,"BatchOperation",{enumerable:!0,get:function(){return o.BatchOperation}});var s=r(167);Object.defineProperty(e,"DelegateOperation",{enumerable:!0,get:function(){return s.DelegateOperation}});var a=r(168);Object.defineProperty(e,"OriginationOperation",{enumerable:!0,get:function(){return a.OriginationOperation}});var c=r(169);Object.defineProperty(e,"TransactionOperation",{enumerable:!0,get:function(){return c.TransactionOperation}});var u=r(47);Object.defineProperty(e,"Operation",{enumerable:!0,get:function(){return u.Operation}})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.NoopParser=void 0;e.NoopParser=class{prepareCodeOrigination(t){return n(this,void 0,void 0,(function*(){return t}))}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.MichelCodecPacker=void 0;const i=r(175);e.MichelCodecPacker=class{packData(t){return n(this,void 0,void 0,(function*(){const{bytes:e}=i.packDataBytes(t.data,t.type);return{packed:e}}))}}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultGlobalConstantsProvider=void 0;const i=r(122);e.DefaultGlobalConstantsProvider=class{constructor(){this._globalConstantsLibrary={}}loadGlobalConstant(t){for(const e in t)Object.assign(this._globalConstantsLibrary,{[e]:t[e]})}getGlobalConstantByHash(t){return n(this,void 0,void 0,(function*(){const e=this._globalConstantsLibrary[t];if(!e)throw new i.GlobalConstantNotFound(t);return e}))}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(120),e),i(r(303),e),i(r(304),e),i(r(165),e),i(r(166),e)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.NaiveEstimateProvider=void 0;const i=r(84),o=r(120);e.NaiveEstimateProvider=class{constructor(t){this.protocol=t,this._costPerByte=250}registerGlobalConstant(t){throw new Error(`Unsupported operation kind: ${t.kind}`)}originate({fee:t=i.DEFAULT_FEE.ORIGINATION,storageLimit:e=i.DEFAULT_STORAGE_LIMIT.ORIGINATION,gasLimit:r=1e3*i.DEFAULT_GAS_LIMIT.ORIGINATION}){return n(this,void 0,void 0,(function*(){return new o.Estimate(r,e,185,this._costPerByte,t)}))}transfer({fee:t=i.DEFAULT_FEE.TRANSFER,storageLimit:e=i.DEFAULT_STORAGE_LIMIT.TRANSFER,gasLimit:r=1e3*i.DEFAULT_GAS_LIMIT.TRANSFER}){return n(this,void 0,void 0,(function*(){return new o.Estimate(r,e,162,this._costPerByte,t)}))}setDelegate({fee:t=i.DEFAULT_FEE.DELEGATION,gasLimit:e=1e3*i.DEFAULT_GAS_LIMIT.DELEGATION}){return n(this,void 0,void 0,(function*(){return new o.Estimate(e,0,157,this._costPerByte,t)}))}registerDelegate({fee:t=i.DEFAULT_FEE.DELEGATION,gasLimit:e=1e3*i.DEFAULT_GAS_LIMIT.DELEGATION}){return n(this,void 0,void 0,(function*(){return new o.Estimate(e,0,157,this._costPerByte,t)}))}reveal(){return n(this,void 0,void 0,(function*(){return new o.Estimate(1e3*i.DEFAULT_GAS_LIMIT.REVEAL,i.DEFAULT_STORAGE_LIMIT.REVEAL,64,this._costPerByte,i.DEFAULT_FEE.REVEAL)}))}batch(t){return n(this,void 0,void 0,(function*(){const e=[];for(const r of t)switch(r.kind){case"transaction":e.push(yield this.transfer(r));break;case"origination":e.push(yield this.originate(r));break;case"delegation":e.push(yield this.setDelegate(r));break;case"activate_account":e.push(new o.Estimate(0,0,0,this._costPerByte,0));break;default:throw new Error(`Unsupported operation kind: ${r.kind}`)}return e}))}}}])}));