@blockcerts/blockcerts-verifier 1.57.4 → 1.58.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 (35) hide show
  1. package/bundle-stats.html +1 -1
  2. package/dist/{EcdsaSecp256k1Signature2019-01e33e56-6efe219a.js → EcdsaSecp256k1Signature2019-01e33e56-_kD7OEMM.js} +1 -1
  3. package/dist/{Ed25519Signature2020-722d8d24-df100275.js → Ed25519Signature2020-722d8d24-52XGswpx.js} +1 -1
  4. package/dist/{HashlinkVerifier-40818bdd-2156022a.js → HashlinkVerifier-40818bdd-tYZmELFg.js} +1 -1
  5. package/dist/{MerkleProof2017-MZJbBTpc-1274faf2.js → MerkleProof2017-MZJbBTpc-NVfw6WgB.js} +1 -1
  6. package/dist/{MerkleProof2017-ac8d147b-dd9968ca.js → MerkleProof2017-ac8d147b-6wk-NtfB.js} +1 -1
  7. package/dist/{MerkleProof2019-6596bc5f-6920f4ea.js → MerkleProof2019-6596bc5f-AOhD0MU2.js} +1 -1
  8. package/dist/{checkRevocationStatusList2021-904b13ff-ca07e61e.js → checkRevocationStatusList2021-904b13ff-HXtw_2Lc.js} +2 -2
  9. package/dist/{controlVerificationMethod-80d0e7f0-27e88021.js → controlVerificationMethod-80d0e7f0-8ug9g49U.js} +1 -1
  10. package/dist/{did-key-common.esm-2e9ab4e3-8e1d8d48.js → did-key-common.esm-2e9ab4e3-X4avzjKx.js} +1 -1
  11. package/dist/{did-key-ed25519.esm-54d2cbca-52ecc5b1.js → did-key-ed25519.esm-54d2cbca-E7NBXv8_.js} +1 -1
  12. package/dist/{did-key-secp256k1.esm-8a01b23c-75ec86fd.js → did-key-secp256k1.esm-8a01b23c-iRA0puBs.js} +1 -1
  13. package/dist/{downloadPDF-e769d8ac.js → downloadPDF-5Pw6AlBs.js} +2 -2
  14. package/dist/{ensureNotRevoked-gui-UMnE-b8cc28d9.js → ensureNotRevoked-gui-UMnE-9nObicUP.js} +1 -1
  15. package/dist/{index-6d4132ca-27a349f3.js → index-6d4132ca-BtAgIaHS.js} +1 -1
  16. package/dist/{index-94883c71.js → index-WX6J-tsk.js} +1 -1
  17. package/dist/{index.es-6cb605d5.js → index.es-YP2tdnLj.js} +1 -1
  18. package/dist/{jsonld-signatures-8ecbbaa2-fff3092d.js → jsonld-signatures-8ecbbaa2-MztjIc1c.js} +1 -1
  19. package/dist/main.js +78 -98
  20. package/dist/{purify-7feb8159.js → purify-xGHUwWlQ.js} +1 -1
  21. package/dist/{x25519-08f432f1-3fdac820.js → x25519-08f432f1-4TKeGPT6.js} +1 -1
  22. package/package.json +4 -4
  23. /package/dist/{Suite-e65d26ad-9eb797e9.js → Suite-e65d26ad-e2QgHGhx.js} +0 -0
  24. /package/dist/{_commonjs-dynamic-modules-1e49c0dd-3e972b61.js → _commonjs-dynamic-modules-1e49c0dd-fkA6S-_a.js} +0 -0
  25. /package/dist/{elliptic-a9d84078-bc51730e.js → elliptic-a9d84078-BGmaMzNc.js} +0 -0
  26. /package/dist/{ensureNotRevoked-2dc26afb-7b9df556.js → ensureNotRevoked-2dc26afb-U5ByLE-t.js} +0 -0
  27. /package/dist/{ensureValidIssuingKey-b950fb8b-b8fdc4d0.js → ensureValidIssuingKey-b950fb8b-oM__XftS.js} +0 -0
  28. /package/dist/{index-0469d008-3e0eb763.js → index-0469d008-LwXIiw03.js} +0 -0
  29. /package/dist/{index-85f56501-cfd39fda.js → index-85f56501-xkysxAxC.js} +0 -0
  30. /package/dist/{index-69ba64e7.js → index-F1HqK0qm.js} +0 -0
  31. /package/dist/{index-a93e1e88-967d29f5.js → index-a93e1e88-w6XCMY1g.js} +0 -0
  32. /package/dist/{jsonld-6909fb49-1ef9cd75.js → jsonld-6909fb49-vaWL2Y4h.js} +0 -0
  33. /package/dist/{pako.esm-7a9981ef-ce496ef7.js → pako.esm-7a9981ef-RAILONW0.js} +0 -0
  34. /package/dist/{sha256-71400caa-e7398231.js → sha256-71400caa-o9J6pXuo.js} +0 -0
  35. /package/dist/{tslib.es6-28b6776b-35eb20e3.js → tslib.es6-28b6776b-qWIKDnpX.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{f as e,A as t,p as r,c as n,h as i,o,n as s,l as a,D as u,E as c,F as h,d as l}from"./main.js";import{j as d}from"./jsonld-signatures-8ecbbaa2-fff3092d.js";import{j as f}from"./jsonld-6909fb49-1ef9cd75.js";import{s as p,b as y,d as b,r as w,a as g,k as _,e as v}from"./index-6d4132ca-27a349f3.js";import{r as m,i as E,e as k}from"./elliptic-a9d84078-bc51730e.js";import{d as S,e as R}from"./index-85f56501-cfd39fda.js";import{S as T}from"./Suite-e65d26ad-9eb797e9.js";import"./pako.esm-7a9981ef-ce496ef7.js";import"./sha256-71400caa-e7398231.js";import"./index-0469d008-3e0eb763.js";var A,x,K={exports:{}},M={},P=u(c),L=P.EventEmitter;function I(e,t){C(e,t),O(e)}function O(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function C(e,t){e.emit("error",t)}var D={destroy:function(e,r){var n=this,i=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return i||o?(r?r(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t(C,this,e)):t(C,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!r&&e?n._writableState?n._writableState.errorEmitted?t(O,n):(n._writableState.errorEmitted=!0,t(I,n,e)):t(I,n,e):r?(t(O,n),r(e)):t(O,n)})),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(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}},N={};var B={};function j(e,t,r){r||(r=Error);var n=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);n.prototype.name=r.name,n.prototype.code=e,B[e]=n}function U(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}j("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),j("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,o,s;if("string"==typeof t&&(i="not ",t.substr(!o||o<0?0:+o,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))s="The ".concat(e," ").concat(n," ").concat(U(t,"type"));else{var a=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(U(t,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),j("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),j("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),j("ERR_STREAM_PREMATURE_CLOSE","Premature close"),j("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),j("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),j("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),j("ERR_STREAM_WRITE_AFTER_END","write after end"),j("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),j("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),j("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),N.codes=B;var V=N.codes.ERR_INVALID_OPT_VALUE;var q,W={getHighWaterMark:function(e,t,r,n){var i=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new V(n?r:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}},F={};function z(){if(q)return F;q=1;var e=p.Buffer,t=e.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var n;switch(this.encoding=function(r){var n=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(r);if("string"!=typeof n&&(e.isEncoding===t||!t(r)))throw new Error("Unknown encoding: "+r);return n||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,n=4;break;case"utf8":this.fillLast=i,n=4;break;case"base64":this.text=a,this.end=u,n=3;break;default:return this.write=c,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(n)}function n(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function s(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function a(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function u(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function c(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}return F.StringDecoder=r,r.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},r.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},r.prototype.text=function(e,t){var r=function(e,t,r){var i=t.length-1;if(i<r)return 0;var o=n(t[i]);if(o>=0)return o>0&&(e.lastNeed=o-1),o;if(--i<r||-2===o)return 0;if(o=n(t[i]),o>=0)return o>0&&(e.lastNeed=o-2),o;if(--i<r||-2===o)return 0;if(o=n(t[i]),o>=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},r.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},F}var H=N.codes.ERR_STREAM_PREMATURE_CLOSE;function $(){}var Z,X,G,Y,J=function e(t,r,n){if("function"==typeof r)return e(t,null,r);r||(r={}),n=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(n||$);var i=r.readable||!1!==r.readable&&t.readable,o=r.writable||!1!==r.writable&&t.writable,s=function(){t.writable||u()},a=t._writableState&&t._writableState.finished,u=function(){o=!1,a=!0,i||n.call(t)},c=t._readableState&&t._readableState.endEmitted,h=function(){i=!1,c=!0,o||n.call(t)},l=function(e){n.call(t,e)},d=function(){var e;return i&&!c?(t._readableState&&t._readableState.ended||(e=new H),n.call(t,e)):o&&!a?(t._writableState&&t._writableState.ended||(e=new H),n.call(t,e)):void 0},f=function(){t.req.on("finish",u)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?o&&!t._writableState&&(t.on("end",s),t.on("close",s)):(t.on("complete",u),t.on("abort",d),t.req?f():t.on("request",f)),t.on("end",h),t.on("finish",u),!1!==r.error&&t.on("error",l),t.on("close",d),function(){t.removeListener("complete",u),t.removeListener("abort",d),t.removeListener("request",f),t.req&&t.req.removeListener("finish",u),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",u),t.removeListener("end",h),t.removeListener("error",l),t.removeListener("close",d)}};function Q(){if(X)return Z;var e;function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}X=1;var n=J,i=Symbol("lastResolve"),o=Symbol("lastReject"),s=Symbol("error"),a=Symbol("ended"),u=Symbol("lastPromise"),c=Symbol("handlePromise"),h=Symbol("stream");function l(e,t){return{value:e,done:t}}function d(e){var t=e[i];if(null!==t){var r=e[h].read();null!==r&&(e[u]=null,e[i]=null,e[o]=null,t(l(r,!1)))}}function f(e){t(d,e)}var p=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((r(e={get stream(){return this[h]},next:function(){var e=this,r=this[s];if(null!==r)return Promise.reject(r);if(this[a])return Promise.resolve(l(void 0,!0));if(this[h].destroyed)return new Promise((function(r,n){t((function(){e[s]?n(e[s]):r(l(void 0,!0))}))}));var n,i=this[u];if(i)n=new Promise(function(e,t){return function(r,n){e.then((function(){t[a]?r(l(void 0,!0)):t[c](r,n)}),n)}}(i,this));else{var o=this[h].read();if(null!==o)return Promise.resolve(l(o,!1));n=new Promise(this[c])}return this[u]=n,n}},Symbol.asyncIterator,(function(){return this})),r(e,"return",(function(){var e=this;return new Promise((function(t,r){e[h].destroy(null,(function(e){e?r(e):t(l(void 0,!0))}))}))})),e),p);return Z=function(e){var t,d=Object.create(y,(r(t={},h,{value:e,writable:!0}),r(t,i,{value:null,writable:!0}),r(t,o,{value:null,writable:!0}),r(t,s,{value:null,writable:!0}),r(t,a,{value:e._readableState.endEmitted,writable:!0}),r(t,c,{value:function(e,t){var r=d[h].read();r?(d[u]=null,d[i]=null,d[o]=null,e(l(r,!1))):(d[i]=e,d[o]=t)},writable:!0}),t));return d[u]=null,n(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=d[o];return null!==t&&(d[u]=null,d[i]=null,d[o]=null,t(e)),void(d[s]=e)}var r=d[i];null!==r&&(d[u]=null,d[i]=null,d[o]=null,r(l(void 0,!0))),d[a]=!0})),e.on("readable",f.bind(null,d)),d}}const ee=M;ee.Readable=me,me.ReadableState=ve,P.EventEmitter;var te=function(e,t){return e.listeners(t).length},re=L,ne=m.Buffer,ie=e.Uint8Array||function(){};var oe,se=g;oe=se&&se.debuglog?se.debuglog("stream"):function(){};var ae,ue,ce,he=function(){if(x)return A;function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}x=1;var n=m.Buffer,i=g.inspect,o=i&&i.custom||"inspect";return A=function(){function s(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),this.head=null,this.tail=null,this.length=0}var a,u,c;return a=s,u=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return n.alloc(0);for(var t,r,i,o=n.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=o,i=a,n.prototype.copy.call(t,r,i),a+=s.data.length,s=s.next;return o}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=n.allocUnsafe(e),r=this.head,i=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,s),0==(e-=s)){s===o.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(s));break}++i}return this.length-=i,t}},{key:o,value:function(r,n){return i(this,function(r){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){t(r,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))}))}return r}({},n,{depth:0,customInspect:!1}))}}],u&&r(a.prototype,u),c&&r(a,c),s}(),A}(),le=D,de=W.getHighWaterMark,fe=N.codes,pe=fe.ERR_INVALID_ARG_TYPE,ye=fe.ERR_STREAM_PUSH_AFTER_EOF,be=fe.ERR_METHOD_NOT_IMPLEMENTED,we=fe.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;E(me,re);var ge=le.errorOrDestroy,_e=["error","close","destroy","pause","resume"];function ve(e,t,r){e=e||{},"boolean"!=typeof r&&(r=t instanceof ee.Duplex),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=de(this,e,"readableHighWaterMark",r),this.buffer=new he,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!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(ae||(ae=z().StringDecoder),this.decoder=new ae(e.encoding),this.encoding=e.encoding)}function me(e){if(!(this instanceof me))return new me(e);var t=this instanceof ee.Duplex;this._readableState=new ve(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),re.call(this)}function Ee(e,t,r,n,i){oe("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(oe("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?Te(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,Ae(e)))}(e,s);else if(i||(o=function(e,t){var r;n=t,ne.isBuffer(n)||n instanceof ie||"string"==typeof t||void 0===t||e.objectMode||(r=new pe("chunk",["string","Buffer","Uint8Array"],t));var n;return r}(s,t)),o)ge(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===ne.prototype||(t=function(e){return ne.from(e)}(t)),n)s.endEmitted?ge(e,new we):ke(e,s,t,!0);else if(s.ended)ge(e,new ye);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?ke(e,s,t,!1):xe(e,s)):ke(e,s,t,!1)}else n||(s.reading=!1,xe(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function ke(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Te(e)),xe(e,t)}Object.defineProperty(me.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),me.prototype.destroy=le.destroy,me.prototype._undestroy=le.undestroy,me.prototype._destroy=function(e,t){t(e)},me.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=ne.from(e,t),t=""),r=!0),Ee(this,e,t,!1,r)},me.prototype.unshift=function(e){return Ee(this,e,null,!0,!1)},me.prototype.isPaused=function(){return!1===this._readableState.flowing},me.prototype.setEncoding=function(e){ae||(ae=z().StringDecoder);var t=new ae(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";null!==r;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var Se=1073741824;function Re(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=Se?e=Se:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Te(e){var r=e._readableState;oe("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(oe("emitReadable",r.flowing),r.emittedReadable=!0,t(Ae,e))}function Ae(e){var t=e._readableState;oe("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Ie(e)}function xe(e,r){r.readingMore||(r.readingMore=!0,t(Ke,e,r))}function Ke(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(oe("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function Me(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function Pe(e){oe("readable nexttick read 0"),e.read(0)}function Le(e,t){oe("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),Ie(e),t.flowing&&!t.reading&&e.read(0)}function Ie(e){var t=e._readableState;for(oe("flow",t.flowing);t.flowing&&null!==e.read(););}function Oe(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function Ce(e){var r=e._readableState;oe("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,t(De,r,e))}function De(e,t){if(oe("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function Ne(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}me.prototype.read=function(e){oe("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return oe("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Ce(this):Te(this),null;if(0===(e=Re(e,t))&&t.ended)return 0===t.length&&Ce(this),null;var n,i=t.needReadable;return oe("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&oe("length less than watermark",i=!0),t.ended||t.reading?oe("reading or ended",i=!1):i&&(oe("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=Re(r,t))),null===(n=e>0?Oe(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&Ce(this)),null!==n&&this.emit("data",n),n},me.prototype._read=function(e){ge(this,new be("_read()"))},me.prototype.pipe=function(e,n){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,oe("pipe count=%d opts=%j",o.pipesCount,n);var s=(!n||!1!==n.end)&&e!==r.stdout&&e!==r.stderr?u:y;function a(t,r){oe("onunpipe"),t===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,oe("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",a),i.removeListener("end",u),i.removeListener("end",y),i.removeListener("data",l),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function u(){oe("onend"),e.end()}o.endEmitted?t(s):i.once("end",s),e.on("unpipe",a);var c=function(e){return function(){var t=e._readableState;oe("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&te(e,"data")&&(t.flowing=!0,Ie(e))}}(i);e.on("drain",c);var h=!1;function l(t){oe("ondata");var r=e.write(t);oe("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==Ne(o.pipes,e))&&!h&&(oe("false write response, pause",o.awaitDrain),o.awaitDrain++),i.pause())}function d(t){oe("onerror",t),y(),e.removeListener("error",d),0===te(e,"error")&&ge(e,t)}function f(){e.removeListener("finish",p),y()}function p(){oe("onfinish"),e.removeListener("close",f),y()}function y(){oe("unpipe"),i.unpipe(e)}return i.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",i),o.flowing||(oe("pipe resume"),i.resume()),e},me.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=Ne(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},me.prototype.on=function(e,r){var n=re.prototype.on.call(this,e,r),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,oe("on readable",i.length,i.reading),i.length?Te(this):i.reading||t(Pe,this))),n},me.prototype.addListener=me.prototype.on,me.prototype.removeListener=function(e,r){var n=re.prototype.removeListener.call(this,e,r);return"readable"===e&&t(Me,this),n},me.prototype.removeAllListeners=function(e){var r=re.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||t(Me,this),r},me.prototype.resume=function(){var e=this._readableState;return e.flowing||(oe("resume"),e.flowing=!e.readableListening,function(e,r){r.resumeScheduled||(r.resumeScheduled=!0,t(Le,e,r))}(this,e)),e.paused=!1,this},me.prototype.pause=function(){return oe("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(oe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},me.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(oe("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(oe("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<_e.length;o++)e.on(_e[o],this.emit.bind(this,_e[o]));return this._read=function(t){oe("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(me.prototype[Symbol.asyncIterator]=function(){return void 0===ue&&(ue=Q()),ue(this)}),Object.defineProperty(me.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(me.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(me.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),me._fromList=Oe,Object.defineProperty(me.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(me.from=function(e,t){return void 0===ce&&(ce=Y?G:(Y=1,G=function(){throw new Error("Readable.from is not available in the browser")})),ce(me,e,t)});var Be=function(e,t){if(je("noDeprecation"))return e;var r=!1;return function(){if(!r){if(je("throwDeprecation"))throw new Error(t);je("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}};function je(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}const Ue=M;function Ve(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}Ue.Writable=at,at.WritableState=st;var qe={deprecate:Be},We=L,Fe=m.Buffer,ze=e.Uint8Array||function(){};var He,$e=D,Ze=W.getHighWaterMark,Xe=N.codes,Ge=Xe.ERR_INVALID_ARG_TYPE,Ye=Xe.ERR_METHOD_NOT_IMPLEMENTED,Je=Xe.ERR_MULTIPLE_CALLBACK,Qe=Xe.ERR_STREAM_CANNOT_PIPE,et=Xe.ERR_STREAM_DESTROYED,tt=Xe.ERR_STREAM_NULL_VALUES,rt=Xe.ERR_STREAM_WRITE_AFTER_END,nt=Xe.ERR_UNKNOWN_ENCODING,it=$e.errorOrDestroy;function ot(){}function st(e,r,n){e=e||{},"boolean"!=typeof n&&(n=r instanceof Ue.Duplex),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=Ze(this,e,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,r){var n=e._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new Je;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),r)!function(e,r,n,i,o){--r.pendingcb,n?(t(o,i),t(ft,e,r),e._writableState.errorEmitted=!0,it(e,i)):(o(i),e._writableState.errorEmitted=!0,it(e,i),ft(e,r))}(e,n,i,r,o);else{var s=lt(n)||e.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||ht(e,n),i?t(ct,e,n,s,o):ct(e,n,s,o)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Ve(this)}function at(e){var t=this instanceof Ue.Duplex;if(!t&&!He.call(at,this))return new at(e);this._writableState=new st(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),We.call(this)}function ut(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new et("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function ct(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),ft(e,t)}function ht(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var s=0,a=!0;r;)i[s]=r,r.isBuf||(a=!1),r=r.next,s+=1;i.allBuffers=a,ut(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new Ve(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,c=r.encoding,h=r.callback;if(ut(e,t,!1,t.objectMode?1:u.length,u,c,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function lt(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function dt(e,t){e._final((function(r){t.pendingcb--,r&&it(e,r),t.prefinished=!0,e.emit("prefinish"),ft(e,t)}))}function ft(e,r){var n=lt(r);if(n&&(function(e,r){r.prefinished||r.finalCalled||("function"!=typeof e._final||r.destroyed?(r.prefinished=!0,e.emit("prefinish")):(r.pendingcb++,r.finalCalled=!0,t(dt,e,r)))}(e,r),0===r.pendingcb&&(r.finished=!0,e.emit("finish"),r.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return n}E(at,We),st.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(st.prototype,"buffer",{get:qe.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(He=Function.prototype[Symbol.hasInstance],Object.defineProperty(at,Symbol.hasInstance,{value:function(e){return!!He.call(this,e)||this===at&&(e&&e._writableState instanceof st)}})):He=function(e){return e instanceof this},at.prototype.pipe=function(){it(this,new Qe)},at.prototype.write=function(e,r,n){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=e,Fe.isBuffer(i)||i instanceof ze);return a&&!Fe.isBuffer(e)&&(e=function(e){return Fe.from(e)}(e)),"function"==typeof r&&(n=r,r=null),a?r="buffer":r||(r=o.defaultEncoding),"function"!=typeof n&&(n=ot),o.ending?function(e,r){var n=new rt;it(e,n),t(r,n)}(this,n):(a||function(e,r,n,i){var o;return null===n?o=new tt:"string"==typeof n||r.objectMode||(o=new Ge("chunk",["string","Buffer"],n)),!o||(it(e,o),t(i,o),!1)}(this,o,e,n))&&(o.pendingcb++,s=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=Fe.from(t,r));return t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else ut(e,t,!1,a,n,i,o);return u}(this,o,a,e,r,n)),s},at.prototype.cork=function(){this._writableState.corked++},at.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||ht(this,e))},at.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new nt(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(at.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(at.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),at.prototype._write=function(e,t,r){r(new Ye("_write()"))},at.prototype._writev=null,at.prototype.end=function(e,r,n){var i=this._writableState;return"function"==typeof e?(n=e,e=null,r=null):"function"==typeof r&&(n=r,r=null),null!=e&&this.write(e,r),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,r,n){r.ending=!0,ft(e,r),n&&(r.finished?t(n):e.once("finish",n));r.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(at.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(at.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),at.prototype.destroy=$e.destroy,at.prototype._undestroy=$e.undestroy,at.prototype._destroy=function(e,t){t(e)};var pt=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};const yt=M;yt.Duplex=_t,E(_t,yt.Readable);for(var bt=pt(yt.Writable.prototype),wt=0;wt<bt.length;wt++){var gt=bt[wt];_t.prototype[gt]||(_t.prototype[gt]=yt.Writable.prototype[gt])}function _t(e){if(!(this instanceof _t))return new _t(e);yt.Readable.call(this,e),yt.Writable.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",vt)))}function vt(){this._writableState.ended||t(mt,this)}function mt(e){e.end()}Object.defineProperty(_t.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(_t.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(_t.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(_t.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}});const Et=M;Et.Transform=Kt;var kt=N.codes,St=kt.ERR_METHOD_NOT_IMPLEMENTED,Rt=kt.ERR_MULTIPLE_CALLBACK,Tt=kt.ERR_TRANSFORM_ALREADY_TRANSFORMING,At=kt.ERR_TRANSFORM_WITH_LENGTH_0;function xt(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new Rt);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Kt(e){if(!(this instanceof Kt))return new Kt(e);Et.Duplex.call(this,e),this._transformState={afterTransform:xt.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",Mt)}function Mt(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?Pt(this,null,null):this._flush((function(t,r){Pt(e,t,r)}))}function Pt(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new At;if(e._transformState.transforming)throw new Tt;return e.push(null)}E(Kt,Et.Duplex),Kt.prototype.push=function(e,t){return this._transformState.needTransform=!1,Et.Duplex.prototype.push.call(this,e,t)},Kt.prototype._transform=function(e,t,r){r(new St("_transform()"))},Kt.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Kt.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},Kt.prototype._destroy=function(e,t){Et.Duplex.prototype._destroy.call(this,e,(function(e){t(e)}))};const Lt=M;function It(e){if(!(this instanceof It))return new It(e);Transform.call(this,e)}var Ot;Lt.PassThrough=It,E(It,Lt.Transform),It.prototype._transform=function(e,t,r){r(null,e)};var Ct=N.codes,Dt=Ct.ERR_MISSING_ARGS,Nt=Ct.ERR_STREAM_DESTROYED;function Bt(e){if(e)throw e}function jt(e){e()}function Ut(e,t){return e.pipe(t)}var Vt=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,i=function(e){return e.length?"function"!=typeof e[e.length-1]?Bt:e.pop():Bt}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Dt("streams");var o=t.map((function(e,r){var s=r<t.length-1;return function(e,t,r,n){n=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(n);var i=!1;e.on("close",(function(){i=!0})),void 0===Ot&&(Ot=J),Ot(e,{readable:t,writable:r},(function(e){if(e)return n(e);i=!0,n()}));var o=!1;return function(t){if(!i&&!o)return o=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void n(t||new Nt("pipe"))}}(e,s,r>0,(function(e){n||(n=e),e&&o.forEach(jt),s||(o.forEach(jt),i(n))}))}));return t.reduce(Ut)};!function(e,t){const r=M;(t=K.exports=r.Readable).Stream=r.Readable,t.Readable=r.Readable,t.Writable=r.Writable,t.Duplex=r.Duplex,t.Transform=r.Transform,t.PassThrough=r.PassThrough,t.finished=J,t.pipeline=Vt}(0,K.exports);var qt=K.exports,Wt=p.Buffer,Ft=qt;function zt(e){Ft.Stream.Transform.call(this),this._block=Wt.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}E(zt,Ft.Stream.Transform),zt.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},zt.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},zt.prototype.update=function(e,t){if(function(e,t){if(!Wt.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");Wt.isBuffer(e)||(e=Wt.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)r[i++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var o=0,s=8*e.length;s>0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},zt.prototype._update=function(){throw new Error("_update is not implemented")},zt.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},zt.prototype._digest=function(){throw new Error("_digest is not implemented")};var Ht=zt,$t=E,Zt=Ht,Xt=p.Buffer,Gt=new Array(16);function Yt(){Zt.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function Jt(e,t){return e<<t|e>>>32-t}function Qt(e,t,r,n,i,o,s){return Jt(e+(t&r|~t&n)+i+o|0,s)+t|0}function er(e,t,r,n,i,o,s){return Jt(e+(t&n|r&~n)+i+o|0,s)+t|0}function tr(e,t,r,n,i,o,s){return Jt(e+(t^r^n)+i+o|0,s)+t|0}function rr(e,t,r,n,i,o,s){return Jt(e+(r^(t|~n))+i+o|0,s)+t|0}$t(Yt,Zt),Yt.prototype._update=function(){for(var e=Gt,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;r=Qt(r,n,i,o,e[0],3614090360,7),o=Qt(o,r,n,i,e[1],3905402710,12),i=Qt(i,o,r,n,e[2],606105819,17),n=Qt(n,i,o,r,e[3],3250441966,22),r=Qt(r,n,i,o,e[4],4118548399,7),o=Qt(o,r,n,i,e[5],1200080426,12),i=Qt(i,o,r,n,e[6],2821735955,17),n=Qt(n,i,o,r,e[7],4249261313,22),r=Qt(r,n,i,o,e[8],1770035416,7),o=Qt(o,r,n,i,e[9],2336552879,12),i=Qt(i,o,r,n,e[10],4294925233,17),n=Qt(n,i,o,r,e[11],2304563134,22),r=Qt(r,n,i,o,e[12],1804603682,7),o=Qt(o,r,n,i,e[13],4254626195,12),i=Qt(i,o,r,n,e[14],2792965006,17),r=er(r,n=Qt(n,i,o,r,e[15],1236535329,22),i,o,e[1],4129170786,5),o=er(o,r,n,i,e[6],3225465664,9),i=er(i,o,r,n,e[11],643717713,14),n=er(n,i,o,r,e[0],3921069994,20),r=er(r,n,i,o,e[5],3593408605,5),o=er(o,r,n,i,e[10],38016083,9),i=er(i,o,r,n,e[15],3634488961,14),n=er(n,i,o,r,e[4],3889429448,20),r=er(r,n,i,o,e[9],568446438,5),o=er(o,r,n,i,e[14],3275163606,9),i=er(i,o,r,n,e[3],4107603335,14),n=er(n,i,o,r,e[8],1163531501,20),r=er(r,n,i,o,e[13],2850285829,5),o=er(o,r,n,i,e[2],4243563512,9),i=er(i,o,r,n,e[7],1735328473,14),r=tr(r,n=er(n,i,o,r,e[12],2368359562,20),i,o,e[5],4294588738,4),o=tr(o,r,n,i,e[8],2272392833,11),i=tr(i,o,r,n,e[11],1839030562,16),n=tr(n,i,o,r,e[14],4259657740,23),r=tr(r,n,i,o,e[1],2763975236,4),o=tr(o,r,n,i,e[4],1272893353,11),i=tr(i,o,r,n,e[7],4139469664,16),n=tr(n,i,o,r,e[10],3200236656,23),r=tr(r,n,i,o,e[13],681279174,4),o=tr(o,r,n,i,e[0],3936430074,11),i=tr(i,o,r,n,e[3],3572445317,16),n=tr(n,i,o,r,e[6],76029189,23),r=tr(r,n,i,o,e[9],3654602809,4),o=tr(o,r,n,i,e[12],3873151461,11),i=tr(i,o,r,n,e[15],530742520,16),r=rr(r,n=tr(n,i,o,r,e[2],3299628645,23),i,o,e[0],4096336452,6),o=rr(o,r,n,i,e[7],1126891415,10),i=rr(i,o,r,n,e[14],2878612391,15),n=rr(n,i,o,r,e[5],4237533241,21),r=rr(r,n,i,o,e[12],1700485571,6),o=rr(o,r,n,i,e[3],2399980690,10),i=rr(i,o,r,n,e[10],4293915773,15),n=rr(n,i,o,r,e[1],2240044497,21),r=rr(r,n,i,o,e[8],1873313359,6),o=rr(o,r,n,i,e[15],4264355552,10),i=rr(i,o,r,n,e[6],2734768916,15),n=rr(n,i,o,r,e[13],1309151649,21),r=rr(r,n,i,o,e[4],4149444226,6),o=rr(o,r,n,i,e[11],3174756917,10),i=rr(i,o,r,n,e[2],718787259,15),n=rr(n,i,o,r,e[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},Yt.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 e=Xt.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var nr=Yt,ir=m.Buffer,or=E,sr=Ht,ar=new Array(16),ur=[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],cr=[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],hr=[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],lr=[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],dr=[0,1518500249,1859775393,2400959708,2840853838],fr=[1352829926,1548603684,1836072691,2053994217,0];function pr(){sr.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function yr(e,t){return e<<t|e>>>32-t}function br(e,t,r,n,i,o,s,a){return yr(e+(t^r^n)+o+s|0,a)+i|0}function wr(e,t,r,n,i,o,s,a){return yr(e+(t&r|~t&n)+o+s|0,a)+i|0}function gr(e,t,r,n,i,o,s,a){return yr(e+((t|~r)^n)+o+s|0,a)+i|0}function _r(e,t,r,n,i,o,s,a){return yr(e+(t&n|r&~n)+o+s|0,a)+i|0}function vr(e,t,r,n,i,o,s,a){return yr(e+(t^(r|~n))+o+s|0,a)+i|0}or(pr,sr),pr.prototype._update=function(){for(var e=ar,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,a=0|this._a,u=0|this._b,c=0|this._c,h=0|this._d,l=0|this._e,d=0;d<80;d+=1){var f,p;d<16?(f=br(r,n,i,o,s,e[ur[d]],dr[0],hr[d]),p=vr(a,u,c,h,l,e[cr[d]],fr[0],lr[d])):d<32?(f=wr(r,n,i,o,s,e[ur[d]],dr[1],hr[d]),p=_r(a,u,c,h,l,e[cr[d]],fr[1],lr[d])):d<48?(f=gr(r,n,i,o,s,e[ur[d]],dr[2],hr[d]),p=gr(a,u,c,h,l,e[cr[d]],fr[2],lr[d])):d<64?(f=_r(r,n,i,o,s,e[ur[d]],dr[3],hr[d]),p=wr(a,u,c,h,l,e[cr[d]],fr[3],lr[d])):(f=vr(r,n,i,o,s,e[ur[d]],dr[4],hr[d]),p=br(a,u,c,h,l,e[cr[d]],fr[4],lr[d])),r=s,s=o,o=yr(i,10),i=n,n=f,a=l,l=h,h=yr(c,10),c=u,u=p}var y=this._b+i+h|0;this._b=this._c+o+l|0,this._c=this._d+s+a|0,this._d=this._e+r+u|0,this._e=this._a+n+c|0,this._a=y},pr.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 e=ir.alloc?ir.alloc(20):new ir(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var mr=pr,Er={exports:{}},kr=p.Buffer;function Sr(e,t){this._block=kr.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Sr.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=kr.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,o=this._len,s=0;s<i;){for(var a=o%n,u=Math.min(i-s,n-a),c=0;c<u;c++)r[a+c]=e[s+c];s+=u,(o+=u)%n==0&&this._update(r)}return this._len+=i,this},Sr.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=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 e?o.toString(e):o},Sr.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Rr=Sr,Tr=E,Ar=Rr,xr=p.Buffer,Kr=[1518500249,1859775393,-1894007588,-899497514],Mr=new Array(80);function Pr(){this.init(),this._w=Mr,Ar.call(this,64,56)}function Lr(e){return e<<30|e>>>2}function Ir(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}Tr(Pr,Ar),Pr.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Pr.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0;u<16;++u)r[u]=e.readInt32BE(4*u);for(;u<80;++u)r[u]=r[u-3]^r[u-8]^r[u-14]^r[u-16];for(var c=0;c<80;++c){var h=~~(c/20),l=0|((t=n)<<5|t>>>27)+Ir(h,i,o,s)+a+r[c]+Kr[h];a=s,s=o,o=Lr(i),i=n,n=l}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},Pr.prototype._hash=function(){var e=xr.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Or=Pr,Cr=E,Dr=Rr,Nr=p.Buffer,Br=[1518500249,1859775393,-1894007588,-899497514],jr=new Array(80);function Ur(){this.init(),this._w=jr,Dr.call(this,64,56)}function Vr(e){return e<<5|e>>>27}function qr(e){return e<<30|e>>>2}function Wr(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}Cr(Ur,Dr),Ur.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Ur.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0;u<16;++u)r[u]=e.readInt32BE(4*u);for(;u<80;++u)r[u]=(t=r[u-3]^r[u-8]^r[u-14]^r[u-16])<<1|t>>>31;for(var c=0;c<80;++c){var h=~~(c/20),l=Vr(n)+Wr(h,i,o,s)+a+r[c]+Br[h]|0;a=s,s=o,o=qr(i),i=n,n=l}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},Ur.prototype._hash=function(){var e=Nr.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Fr=Ur,zr=E,Hr=Rr,$r=p.Buffer,Zr=[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],Xr=new Array(64);function Gr(){this.init(),this._w=Xr,Hr.call(this,64,56)}function Yr(e,t,r){return r^e&(t^r)}function Jr(e,t,r){return e&t|r&(e|t)}function Qr(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function en(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function tn(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}zr(Gr,Hr),Gr.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},Gr.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0|this._f,c=0|this._g,h=0|this._h,l=0;l<16;++l)r[l]=e.readInt32BE(4*l);for(;l<64;++l)r[l]=0|(((t=r[l-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[l-7]+tn(r[l-15])+r[l-16];for(var d=0;d<64;++d){var f=h+en(a)+Yr(a,u,c)+Zr[d]+r[d]|0,p=Qr(n)+Jr(n,i,o)|0;h=c,c=u,u=a,a=s+f|0,s=o,o=i,i=n,n=f+p|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=u+this._f|0,this._g=c+this._g|0,this._h=h+this._h|0},Gr.prototype._hash=function(){var e=$r.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var rn=Gr,nn=E,on=rn,sn=Rr,an=p.Buffer,un=new Array(64);function cn(){this.init(),this._w=un,sn.call(this,64,56)}nn(cn,on),cn.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},cn.prototype._hash=function(){var e=an.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var hn=cn,ln=E,dn=Rr,fn=p.Buffer,pn=[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],yn=new Array(160);function bn(){this.init(),this._w=yn,dn.call(this,128,112)}function wn(e,t,r){return r^e&(t^r)}function gn(e,t,r){return e&t|r&(e|t)}function _n(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function vn(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function mn(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function En(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function kn(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Sn(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function Rn(e,t){return e>>>0<t>>>0?1:0}ln(bn,dn),bn.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},bn.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,a=0|this._fh,u=0|this._gh,c=0|this._hh,h=0|this._al,l=0|this._bl,d=0|this._cl,f=0|this._dl,p=0|this._el,y=0|this._fl,b=0|this._gl,w=0|this._hl,g=0;g<32;g+=2)t[g]=e.readInt32BE(4*g),t[g+1]=e.readInt32BE(4*g+4);for(;g<160;g+=2){var _=t[g-30],v=t[g-30+1],m=mn(_,v),E=En(v,_),k=kn(_=t[g-4],v=t[g-4+1]),S=Sn(v,_),R=t[g-14],T=t[g-14+1],A=t[g-32],x=t[g-32+1],K=E+T|0,M=m+R+Rn(K,E)|0;M=(M=M+k+Rn(K=K+S|0,S)|0)+A+Rn(K=K+x|0,x)|0,t[g]=M,t[g+1]=K}for(var P=0;P<160;P+=2){M=t[P],K=t[P+1];var L=gn(r,n,i),I=gn(h,l,d),O=_n(r,h),C=_n(h,r),D=vn(s,p),N=vn(p,s),B=pn[P],j=pn[P+1],U=wn(s,a,u),V=wn(p,y,b),q=w+N|0,W=c+D+Rn(q,w)|0;W=(W=(W=W+U+Rn(q=q+V|0,V)|0)+B+Rn(q=q+j|0,j)|0)+M+Rn(q=q+K|0,K)|0;var F=C+I|0,z=O+L+Rn(F,C)|0;c=u,w=b,u=a,b=y,a=s,y=p,s=o+W+Rn(p=f+q|0,f)|0,o=i,f=d,i=n,d=l,n=r,l=h,r=W+z+Rn(h=q+F|0,q)|0}this._al=this._al+h|0,this._bl=this._bl+l|0,this._cl=this._cl+d|0,this._dl=this._dl+f|0,this._el=this._el+p|0,this._fl=this._fl+y|0,this._gl=this._gl+b|0,this._hl=this._hl+w|0,this._ah=this._ah+r+Rn(this._al,h)|0,this._bh=this._bh+n+Rn(this._bl,l)|0,this._ch=this._ch+i+Rn(this._cl,d)|0,this._dh=this._dh+o+Rn(this._dl,f)|0,this._eh=this._eh+s+Rn(this._el,p)|0,this._fh=this._fh+a+Rn(this._fl,y)|0,this._gh=this._gh+u+Rn(this._gl,b)|0,this._hh=this._hh+c+Rn(this._hl,w)|0},bn.prototype._hash=function(){var e=fn.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Tn=bn,An=E,xn=Tn,Kn=Rr,Mn=p.Buffer,Pn=new Array(160);function Ln(){this.init(),this._w=Pn,Kn.call(this,128,112)}An(Ln,xn),Ln.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},Ln.prototype._hash=function(){var e=Mn.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var In=Ln;const On={};Er.exports=function(e){e=e.toLowerCase();var t=On[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t},Er.exports.sha=On.sha=Or,Er.exports.sha1=On.sha1=Fr,Er.exports.sha224=On.sha224=hn,Er.exports.sha256=On.sha256=rn,Er.exports.sha384=On.sha384=In,Er.exports.sha512=On.sha512=Tn;var Cn=Er.exports,Dn=u(h),Nn=p.Buffer,Bn=y.Transform,jn=Dn.StringDecoder;function Un(e){Bn.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}E(Un,Bn),Un.prototype.update=function(e,t,r){"string"==typeof e&&(e=Nn.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},Un.prototype.setAutoPadding=function(){},Un.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},Un.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},Un.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},Un.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},Un.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},Un.prototype._finalOrDigest=function(e){var t=this.__final()||Nn.alloc(0);return e&&(t=this._toString(t,e,!0)),t},Un.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new jn(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n};var Vn=nr,qn=mr,Wn=Cn,Fn=Un;function zn(e){Fn.call(this,"digest"),this._hash=e}E(zn,Fn),zn.prototype._update=function(e){this._hash.update(e)},zn.prototype._final=function(){return this._hash.digest()};var Hn=l((function(e){return"md5"===(e=e.toLowerCase())?new Vn:"rmd160"===e||"ripemd160"===e?new qn:new zn(Wn(e))}));const $n="Impossible case. Please create issue.",Zn="The tweak was out of range or the resulted private key is invalid",Xn="The tweak was out of range or equal to zero",Gn="Unknow error on context randomization",Yn="Private Key is invalid",Jn="Public Key could not be parsed",Qn="Public Key serialization error",ei="The sum of the public keys is not valid",ti="Signature could not be parsed",ri="The nonce generation function failed, or the private key was invalid",ni="Public key could not be recover",ii="Scalar was invalid (zero or overflow)";function oi(e,t){if(!e)throw new Error(t)}function si(e,t,r){if(oi(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;oi(r.includes(t.length),n)}else{const n=`Expected ${e} to be an Uint8Array with length ${r}`;oi(t.length===r,n)}}function ai(e){oi("Boolean"===ci(e),"Expected compressed to be a Boolean")}function ui(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),si("output",e,t),e}function ci(e){return Object.prototype.toString.call(e).slice(8,-1)}const hi=new(0,k.ec)("secp256k1"),li=hi.curve,di=li.n.constructor;function fi(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new di(t);if(r.cmp(li.p)>=0)return null;r=r.toRed(li.red);let n=r.redSqr().redIMul(r).redIAdd(li.b).redSqrt();return 3===e!==n.isOdd()&&(n=n.redNeg()),hi.keyPair({pub:{x:r,y:n}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let n=new di(t),i=new di(r);if(n.cmp(li.p)>=0||i.cmp(li.p)>=0)return null;if(n=n.toRed(li.red),i=i.toRed(li.red),(6===e||7===e)&&i.isOdd()!==(7===e))return null;const o=n.redSqr().redIMul(n);return i.redSqr().redISub(o.redIAdd(li.b)).isZero()?hi.keyPair({pub:{x:n,y:i}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function pi(e,t){const r=t.encode(null,33===e.length);for(let t=0;t<e.length;++t)e[t]=r[t]}var yi={contextRandomize:()=>0,privateKeyVerify(e){const t=new di(e);return t.cmp(li.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new di(e),r=li.n.sub(t).umod(li.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new di(t);if(r.cmp(li.n)>=0)return 1;if(r.iadd(new di(e)),r.cmp(li.n)>=0&&r.isub(li.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakMul(e,t){let r=new di(t);if(r.cmp(li.n)>=0||r.isZero())return 1;r.imul(new di(e)),r.cmp(li.n)>=0&&(r=r.umod(li.n));const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},publicKeyVerify:e=>null===fi(e)?1:0,publicKeyCreate(e,t){const r=new di(t);if(r.cmp(li.n)>=0||r.isZero())return 1;return pi(e,hi.keyFromPrivate(t).getPublic()),0},publicKeyConvert(e,t){const r=fi(t);if(null===r)return 1;return pi(e,r.getPublic()),0},publicKeyNegate(e,t){const r=fi(t);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),pi(e,n),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e<t.length;++e)if(r[e]=fi(t[e]),null===r[e])return 1;let n=r[0].getPublic();for(let e=1;e<r.length;++e)n=n.add(r[e].pub);return n.isInfinity()?2:(pi(e,n),0)},publicKeyTweakAdd(e,t,r){const n=fi(t);if(null===n)return 1;if((r=new di(r)).cmp(li.n)>=0)return 2;const i=n.getPublic().add(li.g.mul(r));return i.isInfinity()?2:(pi(e,i),0)},publicKeyTweakMul(e,t,r){const n=fi(t);if(null===n)return 1;if((r=new di(r)).cmp(li.n)>=0||r.isZero())return 2;return pi(e,n.getPublic().mul(r)),0},signatureNormalize(e){const t=new di(e.subarray(0,32)),r=new di(e.subarray(32,64));return t.cmp(li.n)>=0||r.cmp(li.n)>=0?1:(1===r.cmp(hi.nh)&&e.set(li.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),n=t.subarray(32,64);if(new di(r).cmp(li.n)>=0)return 1;if(new di(n).cmp(li.n)>=0)return 1;const{output:i}=e;let o=i.subarray(4,37);o[0]=0,o.set(r,1);let s=33,a=0;for(;s>1&&0===o[a]&&!(128&o[a+1]);--s,++a);if(o=o.subarray(a),128&o[0])return 1;if(s>1&&0===o[0]&&!(128&o[1]))return 1;let u=i.subarray(39,72);u[0]=0,u.set(n,1);let c=33,h=0;for(;c>1&&0===u[h]&&!(128&u[h+1]);--c,++h);return u=u.subarray(h),128&u[0]||c>1&&0===u[0]&&!(128&u[1])?1:(e.outputlen=6+s+c,i[0]=48,i[1]=e.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+s]=2,i[5+s]=u.length,i.set(u,6+s),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const n=t[5+r];if(0===n)return 1;if(6+r+n!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(n>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let i=t.subarray(4,4+r);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=t.subarray(6+r);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let s=new di(i);s.cmp(li.n)>=0&&(s=new di(0));let a=new di(t.subarray(6+r));return a.cmp(li.n)>=0&&(a=new di(0)),e.set(s.toArrayLike(Uint8Array,"be",32),0),e.set(a.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,n,i){if(i){const e=i;i=i=>{const o=e(t,r,null,n,i);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new di(o)}}const o=new di(r);if(o.cmp(li.n)>=0||o.isZero())return 1;let s;try{s=hi.sign(t,r,{canonical:!0,k:i,pers:n})}catch(e){return 1}return e.signature.set(s.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(s.s.toArrayLike(Uint8Array,"be",32),32),e.recid=s.recoveryParam,0},ecdsaVerify(e,t,r){const n={r:e.subarray(0,32),s:e.subarray(32,64)},i=new di(n.r),o=new di(n.s);if(i.cmp(li.n)>=0||o.cmp(li.n)>=0)return 1;if(1===o.cmp(hi.nh)||i.isZero()||o.isZero())return 3;const s=fi(r);if(null===s)return 2;const a=s.getPublic();return hi.verify(t,n,a)?0:3},ecdsaRecover(e,t,r,n){const i={r:t.slice(0,32),s:t.slice(32,64)},o=new di(i.r),s=new di(i.s);if(o.cmp(li.n)>=0||s.cmp(li.n)>=0)return 1;if(o.isZero()||s.isZero())return 2;let a;try{a=hi.recoverPubKey(n,i,r)}catch(e){return 2}return pi(e,a),0},ecdh(e,t,r,n,i,o,s){const a=fi(t);if(null===a)return 1;const u=new di(r);if(u.cmp(li.n)>=0||u.isZero())return 2;const c=a.getPublic().mul(u);if(void 0===i){const t=c.encode(null,!0),r=hi.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{o||(o=new Uint8Array(32));const t=c.getX().toArray("be",32);for(let e=0;e<32;++e)o[e]=t[e];s||(s=new Uint8Array(32));const r=c.getY().toArray("be",32);for(let e=0;e<32;++e)s[e]=r[e];const a=i(o,s,n);if(!(a instanceof Uint8Array&&a.length===e.length))return 2;e.set(a)}return 0}},bi=(e=>({contextRandomize(t){if(oi(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&si("seed",t,32),1===e.contextRandomize(t))throw new Error(Gn)},privateKeyVerify:t=>(si("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(si("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error($n)}},privateKeyTweakAdd(t,r){switch(si("private key",t,32),si("tweak",r,32),e.privateKeyTweakAdd(t,r)){case 0:return t;case 1:throw new Error(Zn)}},privateKeyTweakMul(t,r){switch(si("private key",t,32),si("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(Xn)}},publicKeyVerify:t=>(si("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,n){switch(si("private key",t,32),ai(r),n=ui(n,r?33:65),e.publicKeyCreate(n,t)){case 0:return n;case 1:throw new Error(Yn);case 2:throw new Error(Qn)}},publicKeyConvert(t,r=!0,n){switch(si("public key",t,[33,65]),ai(r),n=ui(n,r?33:65),e.publicKeyConvert(n,t)){case 0:return n;case 1:throw new Error(Jn);case 2:throw new Error(Qn)}},publicKeyNegate(t,r=!0,n){switch(si("public key",t,[33,65]),ai(r),n=ui(n,r?33:65),e.publicKeyNegate(n,t)){case 0:return n;case 1:throw new Error(Jn);case 2:throw new Error($n);case 3:throw new Error(Qn)}},publicKeyCombine(t,r=!0,n){oi(Array.isArray(t),"Expected public keys to be an Array"),oi(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)si("public key",e,[33,65]);switch(ai(r),n=ui(n,r?33:65),e.publicKeyCombine(n,t)){case 0:return n;case 1:throw new Error(Jn);case 2:throw new Error(ei);case 3:throw new Error(Qn)}},publicKeyTweakAdd(t,r,n=!0,i){switch(si("public key",t,[33,65]),si("tweak",r,32),ai(n),i=ui(i,n?33:65),e.publicKeyTweakAdd(i,t,r)){case 0:return i;case 1:throw new Error(Jn);case 2:throw new Error(Zn)}},publicKeyTweakMul(t,r,n=!0,i){switch(si("public key",t,[33,65]),si("tweak",r,32),ai(n),i=ui(i,n?33:65),e.publicKeyTweakMul(i,t,r)){case 0:return i;case 1:throw new Error(Jn);case 2:throw new Error(Xn)}},signatureNormalize(t){switch(si("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(ti)}},signatureExport(t,r){si("signature",t,64);const n={output:r=ui(r,72),outputlen:72};switch(e.signatureExport(n,t)){case 0:return r.slice(0,n.outputlen);case 1:throw new Error(ti);case 2:throw new Error($n)}},signatureImport(t,r){switch(si("signature",t),r=ui(r,64),e.signatureImport(r,t)){case 0:return r;case 1:throw new Error(ti);case 2:throw new Error($n)}},ecdsaSign(t,r,n={},i){si("message",t,32),si("private key",r,32),oi("Object"===ci(n),"Expected options to be an Object"),void 0!==n.data&&si("options.data",n.data),void 0!==n.noncefn&&oi("Function"===ci(n.noncefn),"Expected options.noncefn to be a Function");const o={signature:i=ui(i,64),recid:null};switch(e.ecdsaSign(o,t,r,n.data,n.noncefn)){case 0:return o;case 1:throw new Error(ri);case 2:throw new Error($n)}},ecdsaVerify(t,r,n){switch(si("signature",t,64),si("message",r,32),si("public key",n,[33,65]),e.ecdsaVerify(t,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(ti);case 2:throw new Error(Jn)}},ecdsaRecover(t,r,n,i=!0,o){switch(si("signature",t,64),oi("Number"===ci(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),si("message",n,32),ai(i),o=ui(o,i?33:65),e.ecdsaRecover(o,t,r,n)){case 0:return o;case 1:throw new Error(ti);case 2:throw new Error(ni);case 3:throw new Error($n)}},ecdh(t,r,n={},i){switch(si("public key",t,[33,65]),si("private key",r,32),oi("Object"===ci(n),"Expected options to be an Object"),void 0!==n.data&&si("options.data",n.data),void 0!==n.hashfn?(oi("Function"===ci(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&si("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&si("options.ybuf",n.ybuf,32),si("output",i)):i=ui(i,32),e.ecdh(i,t,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return i;case 1:throw new Error(Jn);case 2:throw new Error(ii)}}}))(yi),wi={exports:{}},gi=65536,_i=4294967295;var vi=p.Buffer,mi=e.crypto||e.msCrypto;mi&&mi.getRandomValues?wi.exports=function(e,r){if(e>_i)throw new RangeError("requested too many random bytes");var n=vi.allocUnsafe(e);if(e>0)if(e>gi)for(var i=0;i<e;i+=gi)mi.getRandomValues(n.slice(i,i+gi));else mi.getRandomValues(n);if("function"==typeof r)return t((function(){r(null,n)}));return n}:wi.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};var Ei=l(wi.exports);var ki={CryptoLD:class{constructor({suites:e}={}){this.suites=e||new Map}use(e){this.suites.set(e.suite,e)}async generate(e={}){return this._suiteForType(e).generate(e)}async from(e={}){const t=this._suiteForType(e);return e["@context"]?t.fromKeyDocument({document:e}):t.from(e)}async fromKeyDocument({document:e,checkContext:t=!0,checkRevoked:r=!0}={}){if(!e)throw new TypeError('The "document" parameter is required.');return this._suiteForType(e).fromKeyDocument({document:e,checkContext:t,checkRevoked:r})}async fromKeyId({id:e,documentLoader:t,checkContext:r=!0,checkRevoked:n=!0}={}){if(!e)throw new TypeError('The "id" parameter is required.');if(!t)throw new TypeError('The "documentLoader" parameter is required.');let i;try{if(({document:i}=await t(e)),!i)throw new Error('The "documentLoader" function must return a "document" object.')}catch(e){const t=new Error("Error fetching document: "+e.message);throw t.cause=e,t}const o=i.type;if(!o)throw new Error("Key suite type not found in fetched document.");const s=this.suites.get(o);if(!s)throw new Error(`Support for suite "${o}" is not installed.`);return s.fromKeyDocument({document:i,checkContext:r,checkRevoked:n})}_installed({type:e}){return this.suites.has(e)}_suiteForType(e){const t=e&&e.type;if(!t)throw new TypeError("Missing key type.");if(!this._installed({type:t}))throw new Error(`Support for key type "${t}" is not installed.`);return this.suites.get(t)}}};
1
+ import{f as e,A as t,p as r,c as n,h as i,o,n as s,l as a,D as u,E as c,F as h,d as l}from"./main.js";import{j as d}from"./jsonld-signatures-8ecbbaa2-MztjIc1c.js";import{j as f}from"./jsonld-6909fb49-vaWL2Y4h.js";import{s as p,b as y,d as b,r as w,a as g,k as _,e as v}from"./index-6d4132ca-BtAgIaHS.js";import{r as m,i as E,e as k}from"./elliptic-a9d84078-BGmaMzNc.js";import{d as S,e as R}from"./index-85f56501-xkysxAxC.js";import{S as T}from"./Suite-e65d26ad-e2QgHGhx.js";import"./pako.esm-7a9981ef-RAILONW0.js";import"./sha256-71400caa-o9J6pXuo.js";import"./index-0469d008-LwXIiw03.js";var A,x,K={exports:{}},M={},P=u(c),L=P.EventEmitter;function I(e,t){C(e,t),O(e)}function O(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function C(e,t){e.emit("error",t)}var D={destroy:function(e,r){var n=this,i=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return i||o?(r?r(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t(C,this,e)):t(C,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!r&&e?n._writableState?n._writableState.errorEmitted?t(O,n):(n._writableState.errorEmitted=!0,t(I,n,e)):t(I,n,e):r?(t(O,n),r(e)):t(O,n)})),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(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}},N={};var B={};function j(e,t,r){r||(r=Error);var n=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);n.prototype.name=r.name,n.prototype.code=e,B[e]=n}function U(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}j("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),j("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,o,s;if("string"==typeof t&&(i="not ",t.substr(!o||o<0?0:+o,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))s="The ".concat(e," ").concat(n," ").concat(U(t,"type"));else{var a=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(U(t,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),j("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),j("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),j("ERR_STREAM_PREMATURE_CLOSE","Premature close"),j("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),j("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),j("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),j("ERR_STREAM_WRITE_AFTER_END","write after end"),j("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),j("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),j("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),N.codes=B;var V=N.codes.ERR_INVALID_OPT_VALUE;var q,W={getHighWaterMark:function(e,t,r,n){var i=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new V(n?r:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}},F={};function z(){if(q)return F;q=1;var e=p.Buffer,t=e.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var n;switch(this.encoding=function(r){var n=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(r);if("string"!=typeof n&&(e.isEncoding===t||!t(r)))throw new Error("Unknown encoding: "+r);return n||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,n=4;break;case"utf8":this.fillLast=i,n=4;break;case"base64":this.text=a,this.end=u,n=3;break;default:return this.write=c,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(n)}function n(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function s(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function a(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function u(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function c(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}return F.StringDecoder=r,r.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},r.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},r.prototype.text=function(e,t){var r=function(e,t,r){var i=t.length-1;if(i<r)return 0;var o=n(t[i]);if(o>=0)return o>0&&(e.lastNeed=o-1),o;if(--i<r||-2===o)return 0;if(o=n(t[i]),o>=0)return o>0&&(e.lastNeed=o-2),o;if(--i<r||-2===o)return 0;if(o=n(t[i]),o>=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},r.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},F}var H=N.codes.ERR_STREAM_PREMATURE_CLOSE;function $(){}var Z,X,G,Y,J=function e(t,r,n){if("function"==typeof r)return e(t,null,r);r||(r={}),n=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(n||$);var i=r.readable||!1!==r.readable&&t.readable,o=r.writable||!1!==r.writable&&t.writable,s=function(){t.writable||u()},a=t._writableState&&t._writableState.finished,u=function(){o=!1,a=!0,i||n.call(t)},c=t._readableState&&t._readableState.endEmitted,h=function(){i=!1,c=!0,o||n.call(t)},l=function(e){n.call(t,e)},d=function(){var e;return i&&!c?(t._readableState&&t._readableState.ended||(e=new H),n.call(t,e)):o&&!a?(t._writableState&&t._writableState.ended||(e=new H),n.call(t,e)):void 0},f=function(){t.req.on("finish",u)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?o&&!t._writableState&&(t.on("end",s),t.on("close",s)):(t.on("complete",u),t.on("abort",d),t.req?f():t.on("request",f)),t.on("end",h),t.on("finish",u),!1!==r.error&&t.on("error",l),t.on("close",d),function(){t.removeListener("complete",u),t.removeListener("abort",d),t.removeListener("request",f),t.req&&t.req.removeListener("finish",u),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",u),t.removeListener("end",h),t.removeListener("error",l),t.removeListener("close",d)}};function Q(){if(X)return Z;var e;function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}X=1;var n=J,i=Symbol("lastResolve"),o=Symbol("lastReject"),s=Symbol("error"),a=Symbol("ended"),u=Symbol("lastPromise"),c=Symbol("handlePromise"),h=Symbol("stream");function l(e,t){return{value:e,done:t}}function d(e){var t=e[i];if(null!==t){var r=e[h].read();null!==r&&(e[u]=null,e[i]=null,e[o]=null,t(l(r,!1)))}}function f(e){t(d,e)}var p=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((r(e={get stream(){return this[h]},next:function(){var e=this,r=this[s];if(null!==r)return Promise.reject(r);if(this[a])return Promise.resolve(l(void 0,!0));if(this[h].destroyed)return new Promise((function(r,n){t((function(){e[s]?n(e[s]):r(l(void 0,!0))}))}));var n,i=this[u];if(i)n=new Promise(function(e,t){return function(r,n){e.then((function(){t[a]?r(l(void 0,!0)):t[c](r,n)}),n)}}(i,this));else{var o=this[h].read();if(null!==o)return Promise.resolve(l(o,!1));n=new Promise(this[c])}return this[u]=n,n}},Symbol.asyncIterator,(function(){return this})),r(e,"return",(function(){var e=this;return new Promise((function(t,r){e[h].destroy(null,(function(e){e?r(e):t(l(void 0,!0))}))}))})),e),p);return Z=function(e){var t,d=Object.create(y,(r(t={},h,{value:e,writable:!0}),r(t,i,{value:null,writable:!0}),r(t,o,{value:null,writable:!0}),r(t,s,{value:null,writable:!0}),r(t,a,{value:e._readableState.endEmitted,writable:!0}),r(t,c,{value:function(e,t){var r=d[h].read();r?(d[u]=null,d[i]=null,d[o]=null,e(l(r,!1))):(d[i]=e,d[o]=t)},writable:!0}),t));return d[u]=null,n(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=d[o];return null!==t&&(d[u]=null,d[i]=null,d[o]=null,t(e)),void(d[s]=e)}var r=d[i];null!==r&&(d[u]=null,d[i]=null,d[o]=null,r(l(void 0,!0))),d[a]=!0})),e.on("readable",f.bind(null,d)),d}}const ee=M;ee.Readable=me,me.ReadableState=ve,P.EventEmitter;var te=function(e,t){return e.listeners(t).length},re=L,ne=m.Buffer,ie=e.Uint8Array||function(){};var oe,se=g;oe=se&&se.debuglog?se.debuglog("stream"):function(){};var ae,ue,ce,he=function(){if(x)return A;function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}x=1;var n=m.Buffer,i=g.inspect,o=i&&i.custom||"inspect";return A=function(){function s(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),this.head=null,this.tail=null,this.length=0}var a,u,c;return a=s,u=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return n.alloc(0);for(var t,r,i,o=n.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=o,i=a,n.prototype.copy.call(t,r,i),a+=s.data.length,s=s.next;return o}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=n.allocUnsafe(e),r=this.head,i=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,s),0==(e-=s)){s===o.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(s));break}++i}return this.length-=i,t}},{key:o,value:function(r,n){return i(this,function(r){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){t(r,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))}))}return r}({},n,{depth:0,customInspect:!1}))}}],u&&r(a.prototype,u),c&&r(a,c),s}(),A}(),le=D,de=W.getHighWaterMark,fe=N.codes,pe=fe.ERR_INVALID_ARG_TYPE,ye=fe.ERR_STREAM_PUSH_AFTER_EOF,be=fe.ERR_METHOD_NOT_IMPLEMENTED,we=fe.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;E(me,re);var ge=le.errorOrDestroy,_e=["error","close","destroy","pause","resume"];function ve(e,t,r){e=e||{},"boolean"!=typeof r&&(r=t instanceof ee.Duplex),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=de(this,e,"readableHighWaterMark",r),this.buffer=new he,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!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(ae||(ae=z().StringDecoder),this.decoder=new ae(e.encoding),this.encoding=e.encoding)}function me(e){if(!(this instanceof me))return new me(e);var t=this instanceof ee.Duplex;this._readableState=new ve(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),re.call(this)}function Ee(e,t,r,n,i){oe("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(oe("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?Te(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,Ae(e)))}(e,s);else if(i||(o=function(e,t){var r;n=t,ne.isBuffer(n)||n instanceof ie||"string"==typeof t||void 0===t||e.objectMode||(r=new pe("chunk",["string","Buffer","Uint8Array"],t));var n;return r}(s,t)),o)ge(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===ne.prototype||(t=function(e){return ne.from(e)}(t)),n)s.endEmitted?ge(e,new we):ke(e,s,t,!0);else if(s.ended)ge(e,new ye);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?ke(e,s,t,!1):xe(e,s)):ke(e,s,t,!1)}else n||(s.reading=!1,xe(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function ke(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Te(e)),xe(e,t)}Object.defineProperty(me.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),me.prototype.destroy=le.destroy,me.prototype._undestroy=le.undestroy,me.prototype._destroy=function(e,t){t(e)},me.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=ne.from(e,t),t=""),r=!0),Ee(this,e,t,!1,r)},me.prototype.unshift=function(e){return Ee(this,e,null,!0,!1)},me.prototype.isPaused=function(){return!1===this._readableState.flowing},me.prototype.setEncoding=function(e){ae||(ae=z().StringDecoder);var t=new ae(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";null!==r;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var Se=1073741824;function Re(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=Se?e=Se:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Te(e){var r=e._readableState;oe("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(oe("emitReadable",r.flowing),r.emittedReadable=!0,t(Ae,e))}function Ae(e){var t=e._readableState;oe("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Ie(e)}function xe(e,r){r.readingMore||(r.readingMore=!0,t(Ke,e,r))}function Ke(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(oe("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function Me(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function Pe(e){oe("readable nexttick read 0"),e.read(0)}function Le(e,t){oe("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),Ie(e),t.flowing&&!t.reading&&e.read(0)}function Ie(e){var t=e._readableState;for(oe("flow",t.flowing);t.flowing&&null!==e.read(););}function Oe(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function Ce(e){var r=e._readableState;oe("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,t(De,r,e))}function De(e,t){if(oe("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function Ne(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}me.prototype.read=function(e){oe("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return oe("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Ce(this):Te(this),null;if(0===(e=Re(e,t))&&t.ended)return 0===t.length&&Ce(this),null;var n,i=t.needReadable;return oe("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&oe("length less than watermark",i=!0),t.ended||t.reading?oe("reading or ended",i=!1):i&&(oe("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=Re(r,t))),null===(n=e>0?Oe(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&Ce(this)),null!==n&&this.emit("data",n),n},me.prototype._read=function(e){ge(this,new be("_read()"))},me.prototype.pipe=function(e,n){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,oe("pipe count=%d opts=%j",o.pipesCount,n);var s=(!n||!1!==n.end)&&e!==r.stdout&&e!==r.stderr?u:y;function a(t,r){oe("onunpipe"),t===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,oe("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",a),i.removeListener("end",u),i.removeListener("end",y),i.removeListener("data",l),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function u(){oe("onend"),e.end()}o.endEmitted?t(s):i.once("end",s),e.on("unpipe",a);var c=function(e){return function(){var t=e._readableState;oe("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&te(e,"data")&&(t.flowing=!0,Ie(e))}}(i);e.on("drain",c);var h=!1;function l(t){oe("ondata");var r=e.write(t);oe("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==Ne(o.pipes,e))&&!h&&(oe("false write response, pause",o.awaitDrain),o.awaitDrain++),i.pause())}function d(t){oe("onerror",t),y(),e.removeListener("error",d),0===te(e,"error")&&ge(e,t)}function f(){e.removeListener("finish",p),y()}function p(){oe("onfinish"),e.removeListener("close",f),y()}function y(){oe("unpipe"),i.unpipe(e)}return i.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",i),o.flowing||(oe("pipe resume"),i.resume()),e},me.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=Ne(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},me.prototype.on=function(e,r){var n=re.prototype.on.call(this,e,r),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,oe("on readable",i.length,i.reading),i.length?Te(this):i.reading||t(Pe,this))),n},me.prototype.addListener=me.prototype.on,me.prototype.removeListener=function(e,r){var n=re.prototype.removeListener.call(this,e,r);return"readable"===e&&t(Me,this),n},me.prototype.removeAllListeners=function(e){var r=re.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||t(Me,this),r},me.prototype.resume=function(){var e=this._readableState;return e.flowing||(oe("resume"),e.flowing=!e.readableListening,function(e,r){r.resumeScheduled||(r.resumeScheduled=!0,t(Le,e,r))}(this,e)),e.paused=!1,this},me.prototype.pause=function(){return oe("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(oe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},me.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(oe("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(oe("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<_e.length;o++)e.on(_e[o],this.emit.bind(this,_e[o]));return this._read=function(t){oe("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(me.prototype[Symbol.asyncIterator]=function(){return void 0===ue&&(ue=Q()),ue(this)}),Object.defineProperty(me.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(me.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(me.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),me._fromList=Oe,Object.defineProperty(me.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(me.from=function(e,t){return void 0===ce&&(ce=Y?G:(Y=1,G=function(){throw new Error("Readable.from is not available in the browser")})),ce(me,e,t)});var Be=function(e,t){if(je("noDeprecation"))return e;var r=!1;return function(){if(!r){if(je("throwDeprecation"))throw new Error(t);je("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}};function je(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}const Ue=M;function Ve(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}Ue.Writable=at,at.WritableState=st;var qe={deprecate:Be},We=L,Fe=m.Buffer,ze=e.Uint8Array||function(){};var He,$e=D,Ze=W.getHighWaterMark,Xe=N.codes,Ge=Xe.ERR_INVALID_ARG_TYPE,Ye=Xe.ERR_METHOD_NOT_IMPLEMENTED,Je=Xe.ERR_MULTIPLE_CALLBACK,Qe=Xe.ERR_STREAM_CANNOT_PIPE,et=Xe.ERR_STREAM_DESTROYED,tt=Xe.ERR_STREAM_NULL_VALUES,rt=Xe.ERR_STREAM_WRITE_AFTER_END,nt=Xe.ERR_UNKNOWN_ENCODING,it=$e.errorOrDestroy;function ot(){}function st(e,r,n){e=e||{},"boolean"!=typeof n&&(n=r instanceof Ue.Duplex),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=Ze(this,e,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,r){var n=e._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new Je;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),r)!function(e,r,n,i,o){--r.pendingcb,n?(t(o,i),t(ft,e,r),e._writableState.errorEmitted=!0,it(e,i)):(o(i),e._writableState.errorEmitted=!0,it(e,i),ft(e,r))}(e,n,i,r,o);else{var s=lt(n)||e.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||ht(e,n),i?t(ct,e,n,s,o):ct(e,n,s,o)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Ve(this)}function at(e){var t=this instanceof Ue.Duplex;if(!t&&!He.call(at,this))return new at(e);this._writableState=new st(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),We.call(this)}function ut(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new et("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function ct(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),ft(e,t)}function ht(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var s=0,a=!0;r;)i[s]=r,r.isBuf||(a=!1),r=r.next,s+=1;i.allBuffers=a,ut(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new Ve(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,c=r.encoding,h=r.callback;if(ut(e,t,!1,t.objectMode?1:u.length,u,c,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function lt(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function dt(e,t){e._final((function(r){t.pendingcb--,r&&it(e,r),t.prefinished=!0,e.emit("prefinish"),ft(e,t)}))}function ft(e,r){var n=lt(r);if(n&&(function(e,r){r.prefinished||r.finalCalled||("function"!=typeof e._final||r.destroyed?(r.prefinished=!0,e.emit("prefinish")):(r.pendingcb++,r.finalCalled=!0,t(dt,e,r)))}(e,r),0===r.pendingcb&&(r.finished=!0,e.emit("finish"),r.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return n}E(at,We),st.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(st.prototype,"buffer",{get:qe.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(He=Function.prototype[Symbol.hasInstance],Object.defineProperty(at,Symbol.hasInstance,{value:function(e){return!!He.call(this,e)||this===at&&(e&&e._writableState instanceof st)}})):He=function(e){return e instanceof this},at.prototype.pipe=function(){it(this,new Qe)},at.prototype.write=function(e,r,n){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=e,Fe.isBuffer(i)||i instanceof ze);return a&&!Fe.isBuffer(e)&&(e=function(e){return Fe.from(e)}(e)),"function"==typeof r&&(n=r,r=null),a?r="buffer":r||(r=o.defaultEncoding),"function"!=typeof n&&(n=ot),o.ending?function(e,r){var n=new rt;it(e,n),t(r,n)}(this,n):(a||function(e,r,n,i){var o;return null===n?o=new tt:"string"==typeof n||r.objectMode||(o=new Ge("chunk",["string","Buffer"],n)),!o||(it(e,o),t(i,o),!1)}(this,o,e,n))&&(o.pendingcb++,s=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=Fe.from(t,r));return t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else ut(e,t,!1,a,n,i,o);return u}(this,o,a,e,r,n)),s},at.prototype.cork=function(){this._writableState.corked++},at.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||ht(this,e))},at.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new nt(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(at.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(at.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),at.prototype._write=function(e,t,r){r(new Ye("_write()"))},at.prototype._writev=null,at.prototype.end=function(e,r,n){var i=this._writableState;return"function"==typeof e?(n=e,e=null,r=null):"function"==typeof r&&(n=r,r=null),null!=e&&this.write(e,r),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,r,n){r.ending=!0,ft(e,r),n&&(r.finished?t(n):e.once("finish",n));r.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(at.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(at.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),at.prototype.destroy=$e.destroy,at.prototype._undestroy=$e.undestroy,at.prototype._destroy=function(e,t){t(e)};var pt=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};const yt=M;yt.Duplex=_t,E(_t,yt.Readable);for(var bt=pt(yt.Writable.prototype),wt=0;wt<bt.length;wt++){var gt=bt[wt];_t.prototype[gt]||(_t.prototype[gt]=yt.Writable.prototype[gt])}function _t(e){if(!(this instanceof _t))return new _t(e);yt.Readable.call(this,e),yt.Writable.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",vt)))}function vt(){this._writableState.ended||t(mt,this)}function mt(e){e.end()}Object.defineProperty(_t.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(_t.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(_t.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(_t.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}});const Et=M;Et.Transform=Kt;var kt=N.codes,St=kt.ERR_METHOD_NOT_IMPLEMENTED,Rt=kt.ERR_MULTIPLE_CALLBACK,Tt=kt.ERR_TRANSFORM_ALREADY_TRANSFORMING,At=kt.ERR_TRANSFORM_WITH_LENGTH_0;function xt(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new Rt);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Kt(e){if(!(this instanceof Kt))return new Kt(e);Et.Duplex.call(this,e),this._transformState={afterTransform:xt.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",Mt)}function Mt(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?Pt(this,null,null):this._flush((function(t,r){Pt(e,t,r)}))}function Pt(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new At;if(e._transformState.transforming)throw new Tt;return e.push(null)}E(Kt,Et.Duplex),Kt.prototype.push=function(e,t){return this._transformState.needTransform=!1,Et.Duplex.prototype.push.call(this,e,t)},Kt.prototype._transform=function(e,t,r){r(new St("_transform()"))},Kt.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Kt.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},Kt.prototype._destroy=function(e,t){Et.Duplex.prototype._destroy.call(this,e,(function(e){t(e)}))};const Lt=M;function It(e){if(!(this instanceof It))return new It(e);Transform.call(this,e)}var Ot;Lt.PassThrough=It,E(It,Lt.Transform),It.prototype._transform=function(e,t,r){r(null,e)};var Ct=N.codes,Dt=Ct.ERR_MISSING_ARGS,Nt=Ct.ERR_STREAM_DESTROYED;function Bt(e){if(e)throw e}function jt(e){e()}function Ut(e,t){return e.pipe(t)}var Vt=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,i=function(e){return e.length?"function"!=typeof e[e.length-1]?Bt:e.pop():Bt}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Dt("streams");var o=t.map((function(e,r){var s=r<t.length-1;return function(e,t,r,n){n=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(n);var i=!1;e.on("close",(function(){i=!0})),void 0===Ot&&(Ot=J),Ot(e,{readable:t,writable:r},(function(e){if(e)return n(e);i=!0,n()}));var o=!1;return function(t){if(!i&&!o)return o=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void n(t||new Nt("pipe"))}}(e,s,r>0,(function(e){n||(n=e),e&&o.forEach(jt),s||(o.forEach(jt),i(n))}))}));return t.reduce(Ut)};!function(e,t){const r=M;(t=K.exports=r.Readable).Stream=r.Readable,t.Readable=r.Readable,t.Writable=r.Writable,t.Duplex=r.Duplex,t.Transform=r.Transform,t.PassThrough=r.PassThrough,t.finished=J,t.pipeline=Vt}(0,K.exports);var qt=K.exports,Wt=p.Buffer,Ft=qt;function zt(e){Ft.Stream.Transform.call(this),this._block=Wt.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}E(zt,Ft.Stream.Transform),zt.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},zt.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},zt.prototype.update=function(e,t){if(function(e,t){if(!Wt.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");Wt.isBuffer(e)||(e=Wt.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)r[i++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var o=0,s=8*e.length;s>0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},zt.prototype._update=function(){throw new Error("_update is not implemented")},zt.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},zt.prototype._digest=function(){throw new Error("_digest is not implemented")};var Ht=zt,$t=E,Zt=Ht,Xt=p.Buffer,Gt=new Array(16);function Yt(){Zt.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function Jt(e,t){return e<<t|e>>>32-t}function Qt(e,t,r,n,i,o,s){return Jt(e+(t&r|~t&n)+i+o|0,s)+t|0}function er(e,t,r,n,i,o,s){return Jt(e+(t&n|r&~n)+i+o|0,s)+t|0}function tr(e,t,r,n,i,o,s){return Jt(e+(t^r^n)+i+o|0,s)+t|0}function rr(e,t,r,n,i,o,s){return Jt(e+(r^(t|~n))+i+o|0,s)+t|0}$t(Yt,Zt),Yt.prototype._update=function(){for(var e=Gt,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;r=Qt(r,n,i,o,e[0],3614090360,7),o=Qt(o,r,n,i,e[1],3905402710,12),i=Qt(i,o,r,n,e[2],606105819,17),n=Qt(n,i,o,r,e[3],3250441966,22),r=Qt(r,n,i,o,e[4],4118548399,7),o=Qt(o,r,n,i,e[5],1200080426,12),i=Qt(i,o,r,n,e[6],2821735955,17),n=Qt(n,i,o,r,e[7],4249261313,22),r=Qt(r,n,i,o,e[8],1770035416,7),o=Qt(o,r,n,i,e[9],2336552879,12),i=Qt(i,o,r,n,e[10],4294925233,17),n=Qt(n,i,o,r,e[11],2304563134,22),r=Qt(r,n,i,o,e[12],1804603682,7),o=Qt(o,r,n,i,e[13],4254626195,12),i=Qt(i,o,r,n,e[14],2792965006,17),r=er(r,n=Qt(n,i,o,r,e[15],1236535329,22),i,o,e[1],4129170786,5),o=er(o,r,n,i,e[6],3225465664,9),i=er(i,o,r,n,e[11],643717713,14),n=er(n,i,o,r,e[0],3921069994,20),r=er(r,n,i,o,e[5],3593408605,5),o=er(o,r,n,i,e[10],38016083,9),i=er(i,o,r,n,e[15],3634488961,14),n=er(n,i,o,r,e[4],3889429448,20),r=er(r,n,i,o,e[9],568446438,5),o=er(o,r,n,i,e[14],3275163606,9),i=er(i,o,r,n,e[3],4107603335,14),n=er(n,i,o,r,e[8],1163531501,20),r=er(r,n,i,o,e[13],2850285829,5),o=er(o,r,n,i,e[2],4243563512,9),i=er(i,o,r,n,e[7],1735328473,14),r=tr(r,n=er(n,i,o,r,e[12],2368359562,20),i,o,e[5],4294588738,4),o=tr(o,r,n,i,e[8],2272392833,11),i=tr(i,o,r,n,e[11],1839030562,16),n=tr(n,i,o,r,e[14],4259657740,23),r=tr(r,n,i,o,e[1],2763975236,4),o=tr(o,r,n,i,e[4],1272893353,11),i=tr(i,o,r,n,e[7],4139469664,16),n=tr(n,i,o,r,e[10],3200236656,23),r=tr(r,n,i,o,e[13],681279174,4),o=tr(o,r,n,i,e[0],3936430074,11),i=tr(i,o,r,n,e[3],3572445317,16),n=tr(n,i,o,r,e[6],76029189,23),r=tr(r,n,i,o,e[9],3654602809,4),o=tr(o,r,n,i,e[12],3873151461,11),i=tr(i,o,r,n,e[15],530742520,16),r=rr(r,n=tr(n,i,o,r,e[2],3299628645,23),i,o,e[0],4096336452,6),o=rr(o,r,n,i,e[7],1126891415,10),i=rr(i,o,r,n,e[14],2878612391,15),n=rr(n,i,o,r,e[5],4237533241,21),r=rr(r,n,i,o,e[12],1700485571,6),o=rr(o,r,n,i,e[3],2399980690,10),i=rr(i,o,r,n,e[10],4293915773,15),n=rr(n,i,o,r,e[1],2240044497,21),r=rr(r,n,i,o,e[8],1873313359,6),o=rr(o,r,n,i,e[15],4264355552,10),i=rr(i,o,r,n,e[6],2734768916,15),n=rr(n,i,o,r,e[13],1309151649,21),r=rr(r,n,i,o,e[4],4149444226,6),o=rr(o,r,n,i,e[11],3174756917,10),i=rr(i,o,r,n,e[2],718787259,15),n=rr(n,i,o,r,e[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},Yt.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 e=Xt.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var nr=Yt,ir=m.Buffer,or=E,sr=Ht,ar=new Array(16),ur=[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],cr=[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],hr=[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],lr=[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],dr=[0,1518500249,1859775393,2400959708,2840853838],fr=[1352829926,1548603684,1836072691,2053994217,0];function pr(){sr.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function yr(e,t){return e<<t|e>>>32-t}function br(e,t,r,n,i,o,s,a){return yr(e+(t^r^n)+o+s|0,a)+i|0}function wr(e,t,r,n,i,o,s,a){return yr(e+(t&r|~t&n)+o+s|0,a)+i|0}function gr(e,t,r,n,i,o,s,a){return yr(e+((t|~r)^n)+o+s|0,a)+i|0}function _r(e,t,r,n,i,o,s,a){return yr(e+(t&n|r&~n)+o+s|0,a)+i|0}function vr(e,t,r,n,i,o,s,a){return yr(e+(t^(r|~n))+o+s|0,a)+i|0}or(pr,sr),pr.prototype._update=function(){for(var e=ar,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,a=0|this._a,u=0|this._b,c=0|this._c,h=0|this._d,l=0|this._e,d=0;d<80;d+=1){var f,p;d<16?(f=br(r,n,i,o,s,e[ur[d]],dr[0],hr[d]),p=vr(a,u,c,h,l,e[cr[d]],fr[0],lr[d])):d<32?(f=wr(r,n,i,o,s,e[ur[d]],dr[1],hr[d]),p=_r(a,u,c,h,l,e[cr[d]],fr[1],lr[d])):d<48?(f=gr(r,n,i,o,s,e[ur[d]],dr[2],hr[d]),p=gr(a,u,c,h,l,e[cr[d]],fr[2],lr[d])):d<64?(f=_r(r,n,i,o,s,e[ur[d]],dr[3],hr[d]),p=wr(a,u,c,h,l,e[cr[d]],fr[3],lr[d])):(f=vr(r,n,i,o,s,e[ur[d]],dr[4],hr[d]),p=br(a,u,c,h,l,e[cr[d]],fr[4],lr[d])),r=s,s=o,o=yr(i,10),i=n,n=f,a=l,l=h,h=yr(c,10),c=u,u=p}var y=this._b+i+h|0;this._b=this._c+o+l|0,this._c=this._d+s+a|0,this._d=this._e+r+u|0,this._e=this._a+n+c|0,this._a=y},pr.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 e=ir.alloc?ir.alloc(20):new ir(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var mr=pr,Er={exports:{}},kr=p.Buffer;function Sr(e,t){this._block=kr.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Sr.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=kr.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,o=this._len,s=0;s<i;){for(var a=o%n,u=Math.min(i-s,n-a),c=0;c<u;c++)r[a+c]=e[s+c];s+=u,(o+=u)%n==0&&this._update(r)}return this._len+=i,this},Sr.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=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 e?o.toString(e):o},Sr.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Rr=Sr,Tr=E,Ar=Rr,xr=p.Buffer,Kr=[1518500249,1859775393,-1894007588,-899497514],Mr=new Array(80);function Pr(){this.init(),this._w=Mr,Ar.call(this,64,56)}function Lr(e){return e<<30|e>>>2}function Ir(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}Tr(Pr,Ar),Pr.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Pr.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0;u<16;++u)r[u]=e.readInt32BE(4*u);for(;u<80;++u)r[u]=r[u-3]^r[u-8]^r[u-14]^r[u-16];for(var c=0;c<80;++c){var h=~~(c/20),l=0|((t=n)<<5|t>>>27)+Ir(h,i,o,s)+a+r[c]+Kr[h];a=s,s=o,o=Lr(i),i=n,n=l}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},Pr.prototype._hash=function(){var e=xr.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Or=Pr,Cr=E,Dr=Rr,Nr=p.Buffer,Br=[1518500249,1859775393,-1894007588,-899497514],jr=new Array(80);function Ur(){this.init(),this._w=jr,Dr.call(this,64,56)}function Vr(e){return e<<5|e>>>27}function qr(e){return e<<30|e>>>2}function Wr(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}Cr(Ur,Dr),Ur.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Ur.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0;u<16;++u)r[u]=e.readInt32BE(4*u);for(;u<80;++u)r[u]=(t=r[u-3]^r[u-8]^r[u-14]^r[u-16])<<1|t>>>31;for(var c=0;c<80;++c){var h=~~(c/20),l=Vr(n)+Wr(h,i,o,s)+a+r[c]+Br[h]|0;a=s,s=o,o=qr(i),i=n,n=l}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},Ur.prototype._hash=function(){var e=Nr.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Fr=Ur,zr=E,Hr=Rr,$r=p.Buffer,Zr=[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],Xr=new Array(64);function Gr(){this.init(),this._w=Xr,Hr.call(this,64,56)}function Yr(e,t,r){return r^e&(t^r)}function Jr(e,t,r){return e&t|r&(e|t)}function Qr(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function en(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function tn(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}zr(Gr,Hr),Gr.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},Gr.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0|this._f,c=0|this._g,h=0|this._h,l=0;l<16;++l)r[l]=e.readInt32BE(4*l);for(;l<64;++l)r[l]=0|(((t=r[l-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[l-7]+tn(r[l-15])+r[l-16];for(var d=0;d<64;++d){var f=h+en(a)+Yr(a,u,c)+Zr[d]+r[d]|0,p=Qr(n)+Jr(n,i,o)|0;h=c,c=u,u=a,a=s+f|0,s=o,o=i,i=n,n=f+p|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=u+this._f|0,this._g=c+this._g|0,this._h=h+this._h|0},Gr.prototype._hash=function(){var e=$r.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var rn=Gr,nn=E,on=rn,sn=Rr,an=p.Buffer,un=new Array(64);function cn(){this.init(),this._w=un,sn.call(this,64,56)}nn(cn,on),cn.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},cn.prototype._hash=function(){var e=an.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var hn=cn,ln=E,dn=Rr,fn=p.Buffer,pn=[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],yn=new Array(160);function bn(){this.init(),this._w=yn,dn.call(this,128,112)}function wn(e,t,r){return r^e&(t^r)}function gn(e,t,r){return e&t|r&(e|t)}function _n(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function vn(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function mn(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function En(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function kn(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Sn(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function Rn(e,t){return e>>>0<t>>>0?1:0}ln(bn,dn),bn.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},bn.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,a=0|this._fh,u=0|this._gh,c=0|this._hh,h=0|this._al,l=0|this._bl,d=0|this._cl,f=0|this._dl,p=0|this._el,y=0|this._fl,b=0|this._gl,w=0|this._hl,g=0;g<32;g+=2)t[g]=e.readInt32BE(4*g),t[g+1]=e.readInt32BE(4*g+4);for(;g<160;g+=2){var _=t[g-30],v=t[g-30+1],m=mn(_,v),E=En(v,_),k=kn(_=t[g-4],v=t[g-4+1]),S=Sn(v,_),R=t[g-14],T=t[g-14+1],A=t[g-32],x=t[g-32+1],K=E+T|0,M=m+R+Rn(K,E)|0;M=(M=M+k+Rn(K=K+S|0,S)|0)+A+Rn(K=K+x|0,x)|0,t[g]=M,t[g+1]=K}for(var P=0;P<160;P+=2){M=t[P],K=t[P+1];var L=gn(r,n,i),I=gn(h,l,d),O=_n(r,h),C=_n(h,r),D=vn(s,p),N=vn(p,s),B=pn[P],j=pn[P+1],U=wn(s,a,u),V=wn(p,y,b),q=w+N|0,W=c+D+Rn(q,w)|0;W=(W=(W=W+U+Rn(q=q+V|0,V)|0)+B+Rn(q=q+j|0,j)|0)+M+Rn(q=q+K|0,K)|0;var F=C+I|0,z=O+L+Rn(F,C)|0;c=u,w=b,u=a,b=y,a=s,y=p,s=o+W+Rn(p=f+q|0,f)|0,o=i,f=d,i=n,d=l,n=r,l=h,r=W+z+Rn(h=q+F|0,q)|0}this._al=this._al+h|0,this._bl=this._bl+l|0,this._cl=this._cl+d|0,this._dl=this._dl+f|0,this._el=this._el+p|0,this._fl=this._fl+y|0,this._gl=this._gl+b|0,this._hl=this._hl+w|0,this._ah=this._ah+r+Rn(this._al,h)|0,this._bh=this._bh+n+Rn(this._bl,l)|0,this._ch=this._ch+i+Rn(this._cl,d)|0,this._dh=this._dh+o+Rn(this._dl,f)|0,this._eh=this._eh+s+Rn(this._el,p)|0,this._fh=this._fh+a+Rn(this._fl,y)|0,this._gh=this._gh+u+Rn(this._gl,b)|0,this._hh=this._hh+c+Rn(this._hl,w)|0},bn.prototype._hash=function(){var e=fn.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Tn=bn,An=E,xn=Tn,Kn=Rr,Mn=p.Buffer,Pn=new Array(160);function Ln(){this.init(),this._w=Pn,Kn.call(this,128,112)}An(Ln,xn),Ln.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},Ln.prototype._hash=function(){var e=Mn.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var In=Ln;const On={};Er.exports=function(e){e=e.toLowerCase();var t=On[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t},Er.exports.sha=On.sha=Or,Er.exports.sha1=On.sha1=Fr,Er.exports.sha224=On.sha224=hn,Er.exports.sha256=On.sha256=rn,Er.exports.sha384=On.sha384=In,Er.exports.sha512=On.sha512=Tn;var Cn=Er.exports,Dn=u(h),Nn=p.Buffer,Bn=y.Transform,jn=Dn.StringDecoder;function Un(e){Bn.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}E(Un,Bn),Un.prototype.update=function(e,t,r){"string"==typeof e&&(e=Nn.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},Un.prototype.setAutoPadding=function(){},Un.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},Un.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},Un.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},Un.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},Un.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},Un.prototype._finalOrDigest=function(e){var t=this.__final()||Nn.alloc(0);return e&&(t=this._toString(t,e,!0)),t},Un.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new jn(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n};var Vn=nr,qn=mr,Wn=Cn,Fn=Un;function zn(e){Fn.call(this,"digest"),this._hash=e}E(zn,Fn),zn.prototype._update=function(e){this._hash.update(e)},zn.prototype._final=function(){return this._hash.digest()};var Hn=l((function(e){return"md5"===(e=e.toLowerCase())?new Vn:"rmd160"===e||"ripemd160"===e?new qn:new zn(Wn(e))}));const $n="Impossible case. Please create issue.",Zn="The tweak was out of range or the resulted private key is invalid",Xn="The tweak was out of range or equal to zero",Gn="Unknow error on context randomization",Yn="Private Key is invalid",Jn="Public Key could not be parsed",Qn="Public Key serialization error",ei="The sum of the public keys is not valid",ti="Signature could not be parsed",ri="The nonce generation function failed, or the private key was invalid",ni="Public key could not be recover",ii="Scalar was invalid (zero or overflow)";function oi(e,t){if(!e)throw new Error(t)}function si(e,t,r){if(oi(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;oi(r.includes(t.length),n)}else{const n=`Expected ${e} to be an Uint8Array with length ${r}`;oi(t.length===r,n)}}function ai(e){oi("Boolean"===ci(e),"Expected compressed to be a Boolean")}function ui(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),si("output",e,t),e}function ci(e){return Object.prototype.toString.call(e).slice(8,-1)}const hi=new(0,k.ec)("secp256k1"),li=hi.curve,di=li.n.constructor;function fi(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new di(t);if(r.cmp(li.p)>=0)return null;r=r.toRed(li.red);let n=r.redSqr().redIMul(r).redIAdd(li.b).redSqrt();return 3===e!==n.isOdd()&&(n=n.redNeg()),hi.keyPair({pub:{x:r,y:n}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let n=new di(t),i=new di(r);if(n.cmp(li.p)>=0||i.cmp(li.p)>=0)return null;if(n=n.toRed(li.red),i=i.toRed(li.red),(6===e||7===e)&&i.isOdd()!==(7===e))return null;const o=n.redSqr().redIMul(n);return i.redSqr().redISub(o.redIAdd(li.b)).isZero()?hi.keyPair({pub:{x:n,y:i}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function pi(e,t){const r=t.encode(null,33===e.length);for(let t=0;t<e.length;++t)e[t]=r[t]}var yi={contextRandomize:()=>0,privateKeyVerify(e){const t=new di(e);return t.cmp(li.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new di(e),r=li.n.sub(t).umod(li.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new di(t);if(r.cmp(li.n)>=0)return 1;if(r.iadd(new di(e)),r.cmp(li.n)>=0&&r.isub(li.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakMul(e,t){let r=new di(t);if(r.cmp(li.n)>=0||r.isZero())return 1;r.imul(new di(e)),r.cmp(li.n)>=0&&(r=r.umod(li.n));const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},publicKeyVerify:e=>null===fi(e)?1:0,publicKeyCreate(e,t){const r=new di(t);if(r.cmp(li.n)>=0||r.isZero())return 1;return pi(e,hi.keyFromPrivate(t).getPublic()),0},publicKeyConvert(e,t){const r=fi(t);if(null===r)return 1;return pi(e,r.getPublic()),0},publicKeyNegate(e,t){const r=fi(t);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),pi(e,n),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e<t.length;++e)if(r[e]=fi(t[e]),null===r[e])return 1;let n=r[0].getPublic();for(let e=1;e<r.length;++e)n=n.add(r[e].pub);return n.isInfinity()?2:(pi(e,n),0)},publicKeyTweakAdd(e,t,r){const n=fi(t);if(null===n)return 1;if((r=new di(r)).cmp(li.n)>=0)return 2;const i=n.getPublic().add(li.g.mul(r));return i.isInfinity()?2:(pi(e,i),0)},publicKeyTweakMul(e,t,r){const n=fi(t);if(null===n)return 1;if((r=new di(r)).cmp(li.n)>=0||r.isZero())return 2;return pi(e,n.getPublic().mul(r)),0},signatureNormalize(e){const t=new di(e.subarray(0,32)),r=new di(e.subarray(32,64));return t.cmp(li.n)>=0||r.cmp(li.n)>=0?1:(1===r.cmp(hi.nh)&&e.set(li.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),n=t.subarray(32,64);if(new di(r).cmp(li.n)>=0)return 1;if(new di(n).cmp(li.n)>=0)return 1;const{output:i}=e;let o=i.subarray(4,37);o[0]=0,o.set(r,1);let s=33,a=0;for(;s>1&&0===o[a]&&!(128&o[a+1]);--s,++a);if(o=o.subarray(a),128&o[0])return 1;if(s>1&&0===o[0]&&!(128&o[1]))return 1;let u=i.subarray(39,72);u[0]=0,u.set(n,1);let c=33,h=0;for(;c>1&&0===u[h]&&!(128&u[h+1]);--c,++h);return u=u.subarray(h),128&u[0]||c>1&&0===u[0]&&!(128&u[1])?1:(e.outputlen=6+s+c,i[0]=48,i[1]=e.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+s]=2,i[5+s]=u.length,i.set(u,6+s),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const n=t[5+r];if(0===n)return 1;if(6+r+n!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(n>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let i=t.subarray(4,4+r);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=t.subarray(6+r);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let s=new di(i);s.cmp(li.n)>=0&&(s=new di(0));let a=new di(t.subarray(6+r));return a.cmp(li.n)>=0&&(a=new di(0)),e.set(s.toArrayLike(Uint8Array,"be",32),0),e.set(a.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,n,i){if(i){const e=i;i=i=>{const o=e(t,r,null,n,i);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new di(o)}}const o=new di(r);if(o.cmp(li.n)>=0||o.isZero())return 1;let s;try{s=hi.sign(t,r,{canonical:!0,k:i,pers:n})}catch(e){return 1}return e.signature.set(s.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(s.s.toArrayLike(Uint8Array,"be",32),32),e.recid=s.recoveryParam,0},ecdsaVerify(e,t,r){const n={r:e.subarray(0,32),s:e.subarray(32,64)},i=new di(n.r),o=new di(n.s);if(i.cmp(li.n)>=0||o.cmp(li.n)>=0)return 1;if(1===o.cmp(hi.nh)||i.isZero()||o.isZero())return 3;const s=fi(r);if(null===s)return 2;const a=s.getPublic();return hi.verify(t,n,a)?0:3},ecdsaRecover(e,t,r,n){const i={r:t.slice(0,32),s:t.slice(32,64)},o=new di(i.r),s=new di(i.s);if(o.cmp(li.n)>=0||s.cmp(li.n)>=0)return 1;if(o.isZero()||s.isZero())return 2;let a;try{a=hi.recoverPubKey(n,i,r)}catch(e){return 2}return pi(e,a),0},ecdh(e,t,r,n,i,o,s){const a=fi(t);if(null===a)return 1;const u=new di(r);if(u.cmp(li.n)>=0||u.isZero())return 2;const c=a.getPublic().mul(u);if(void 0===i){const t=c.encode(null,!0),r=hi.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{o||(o=new Uint8Array(32));const t=c.getX().toArray("be",32);for(let e=0;e<32;++e)o[e]=t[e];s||(s=new Uint8Array(32));const r=c.getY().toArray("be",32);for(let e=0;e<32;++e)s[e]=r[e];const a=i(o,s,n);if(!(a instanceof Uint8Array&&a.length===e.length))return 2;e.set(a)}return 0}},bi=(e=>({contextRandomize(t){if(oi(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&si("seed",t,32),1===e.contextRandomize(t))throw new Error(Gn)},privateKeyVerify:t=>(si("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(si("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error($n)}},privateKeyTweakAdd(t,r){switch(si("private key",t,32),si("tweak",r,32),e.privateKeyTweakAdd(t,r)){case 0:return t;case 1:throw new Error(Zn)}},privateKeyTweakMul(t,r){switch(si("private key",t,32),si("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(Xn)}},publicKeyVerify:t=>(si("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,n){switch(si("private key",t,32),ai(r),n=ui(n,r?33:65),e.publicKeyCreate(n,t)){case 0:return n;case 1:throw new Error(Yn);case 2:throw new Error(Qn)}},publicKeyConvert(t,r=!0,n){switch(si("public key",t,[33,65]),ai(r),n=ui(n,r?33:65),e.publicKeyConvert(n,t)){case 0:return n;case 1:throw new Error(Jn);case 2:throw new Error(Qn)}},publicKeyNegate(t,r=!0,n){switch(si("public key",t,[33,65]),ai(r),n=ui(n,r?33:65),e.publicKeyNegate(n,t)){case 0:return n;case 1:throw new Error(Jn);case 2:throw new Error($n);case 3:throw new Error(Qn)}},publicKeyCombine(t,r=!0,n){oi(Array.isArray(t),"Expected public keys to be an Array"),oi(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)si("public key",e,[33,65]);switch(ai(r),n=ui(n,r?33:65),e.publicKeyCombine(n,t)){case 0:return n;case 1:throw new Error(Jn);case 2:throw new Error(ei);case 3:throw new Error(Qn)}},publicKeyTweakAdd(t,r,n=!0,i){switch(si("public key",t,[33,65]),si("tweak",r,32),ai(n),i=ui(i,n?33:65),e.publicKeyTweakAdd(i,t,r)){case 0:return i;case 1:throw new Error(Jn);case 2:throw new Error(Zn)}},publicKeyTweakMul(t,r,n=!0,i){switch(si("public key",t,[33,65]),si("tweak",r,32),ai(n),i=ui(i,n?33:65),e.publicKeyTweakMul(i,t,r)){case 0:return i;case 1:throw new Error(Jn);case 2:throw new Error(Xn)}},signatureNormalize(t){switch(si("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(ti)}},signatureExport(t,r){si("signature",t,64);const n={output:r=ui(r,72),outputlen:72};switch(e.signatureExport(n,t)){case 0:return r.slice(0,n.outputlen);case 1:throw new Error(ti);case 2:throw new Error($n)}},signatureImport(t,r){switch(si("signature",t),r=ui(r,64),e.signatureImport(r,t)){case 0:return r;case 1:throw new Error(ti);case 2:throw new Error($n)}},ecdsaSign(t,r,n={},i){si("message",t,32),si("private key",r,32),oi("Object"===ci(n),"Expected options to be an Object"),void 0!==n.data&&si("options.data",n.data),void 0!==n.noncefn&&oi("Function"===ci(n.noncefn),"Expected options.noncefn to be a Function");const o={signature:i=ui(i,64),recid:null};switch(e.ecdsaSign(o,t,r,n.data,n.noncefn)){case 0:return o;case 1:throw new Error(ri);case 2:throw new Error($n)}},ecdsaVerify(t,r,n){switch(si("signature",t,64),si("message",r,32),si("public key",n,[33,65]),e.ecdsaVerify(t,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(ti);case 2:throw new Error(Jn)}},ecdsaRecover(t,r,n,i=!0,o){switch(si("signature",t,64),oi("Number"===ci(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),si("message",n,32),ai(i),o=ui(o,i?33:65),e.ecdsaRecover(o,t,r,n)){case 0:return o;case 1:throw new Error(ti);case 2:throw new Error(ni);case 3:throw new Error($n)}},ecdh(t,r,n={},i){switch(si("public key",t,[33,65]),si("private key",r,32),oi("Object"===ci(n),"Expected options to be an Object"),void 0!==n.data&&si("options.data",n.data),void 0!==n.hashfn?(oi("Function"===ci(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&si("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&si("options.ybuf",n.ybuf,32),si("output",i)):i=ui(i,32),e.ecdh(i,t,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return i;case 1:throw new Error(Jn);case 2:throw new Error(ii)}}}))(yi),wi={exports:{}},gi=65536,_i=4294967295;var vi=p.Buffer,mi=e.crypto||e.msCrypto;mi&&mi.getRandomValues?wi.exports=function(e,r){if(e>_i)throw new RangeError("requested too many random bytes");var n=vi.allocUnsafe(e);if(e>0)if(e>gi)for(var i=0;i<e;i+=gi)mi.getRandomValues(n.slice(i,i+gi));else mi.getRandomValues(n);if("function"==typeof r)return t((function(){r(null,n)}));return n}:wi.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};var Ei=l(wi.exports);var ki={CryptoLD:class{constructor({suites:e}={}){this.suites=e||new Map}use(e){this.suites.set(e.suite,e)}async generate(e={}){return this._suiteForType(e).generate(e)}async from(e={}){const t=this._suiteForType(e);return e["@context"]?t.fromKeyDocument({document:e}):t.from(e)}async fromKeyDocument({document:e,checkContext:t=!0,checkRevoked:r=!0}={}){if(!e)throw new TypeError('The "document" parameter is required.');return this._suiteForType(e).fromKeyDocument({document:e,checkContext:t,checkRevoked:r})}async fromKeyId({id:e,documentLoader:t,checkContext:r=!0,checkRevoked:n=!0}={}){if(!e)throw new TypeError('The "id" parameter is required.');if(!t)throw new TypeError('The "documentLoader" parameter is required.');let i;try{if(({document:i}=await t(e)),!i)throw new Error('The "documentLoader" function must return a "document" object.')}catch(e){const t=new Error("Error fetching document: "+e.message);throw t.cause=e,t}const o=i.type;if(!o)throw new Error("Key suite type not found in fetched document.");const s=this.suites.get(o);if(!s)throw new Error(`Support for suite "${o}" is not installed.`);return s.fromKeyDocument({document:i,checkContext:r,checkRevoked:n})}_installed({type:e}){return this.suites.has(e)}_suiteForType(e){const t=e&&e.type;if(!t)throw new TypeError("Missing key type.");if(!this._installed({type:t}))throw new Error(`Support for key type "${t}" is not installed.`);return this.suites.get(t)}}};
2
2
  /*!
3
3
  * Copyright (c) 2018-2021 Digital Bazaar, Inc. All rights reserved.
4
4
  */let Si=class{constructor({id:e,controller:t,revoked:r}={}){this.id=e,this.controller=t,this.revoked=r}static async generate(){throw new Error("Abstract method, must be implemented in subclass.")}static async fromKeyDocument({document:e,checkContext:t=!0,checkRevoked:r=!0}={}){if(!e)throw new TypeError('The "document" parameter is required.');if(t){if(![].concat(e["@context"]).includes(this.SUITE_CONTEXT))throw new Error('Key document does not contain required context "'+this.SUITE_CONTEXT+'".')}if(r&&e.revoked)throw new Error(`Key has been revoked since: "${e.revoked}".`);return this.from(e)}static async from(){throw new Error("Abstract method from() must be implemented in subclass.")}export({publicKey:e=!1,privateKey:t=!1}={}){if(!e&&!t)throw new Error('Export requires specifying either "publicKey" or "privateKey".');const r={id:this.id,type:this.type,controller:this.controller};return this.revoked&&(r.revoked=this.revoked),r}fingerprint(){throw new Error("Abstract method, must be implemented in subclass.")}verifyFingerprint(){throw new Error("Abstract method, must be implemented in subclass.")}signer(){return{async sign({}){throw new Error("Abstract method, must be implemented in subclass.")}}}verifier(){return{async verify({}){throw new Error("Abstract method, must be implemented in subclass.")}}}};Si.SUITE_CONTEXT="INVALID LDKeyPair CONTEXT";var Ri={LDKeyPair:Si};const{CryptoLD:Ti}=ki,{LDKeyPair:Ai}=Ri;var xi=l({CryptoLD:Ti,LDKeyPair:Ai});const Ki="EcdsaSecp256k1VerificationKey2019",Mi=e=>Hn("sha256").update(e).digest();class Pi extends xi.LDKeyPair{constructor({publicKeyBase58:e,privateKeyBase58:t,...r}){if(super(r),this.type=void 0,this.publicKeyBase58=void 0,this.privateKeyBase58=void 0,t&&!e){const e=bi.publicKeyCreate(S(t));this.publicKeyBase58=R(e)}else this.publicKeyBase58=e;if(this.type=Ki,this.privateKeyBase58=t,!this.publicKeyBase58)throw new TypeError('The "publicKeyBase58" property is required.')}static from(e){if(e.publicKeyHex||e.privateKeyHex){const{publicKeyHex:t,privateKeyHex:r,...i}=e;return new Pi({...i,publicKeyBase58:t?R(n.from(t,"hex")):void 0,privateKeyBase58:r?R(n.from(r,"hex")):void 0})}return new Pi(e)}static async generate({seed:e,compressed:t,...r}){if(e&&!bi.privateKeyVerify(e))throw new Error("Provided seed is not a valid private key");let n=e;for(;void 0===n||!bi.privateKeyVerify(n);)n=new Uint8Array(Ei(32));const i=bi.publicKeyCreate(n,t);return new Pi({publicKeyBase58:R(i),privateKeyBase58:R(n),...r})}export({publicKey:e=!1,privateKey:t=!1,includeContext:r=!1}={}){if(!e&&!t)throw new TypeError('export requires specifying either "publicKey" or "privateKey".');if(t&&!this.privateKeyBase58)throw new TypeError("No privateKey to export.");if(e&&!this.publicKeyBase58)throw new TypeError("No publicKey to export.");const n={type:this.type,id:this.id,controller:this.controller,revoked:this.revoked};return r&&(n["@context"]=Pi.SUITE_CONTEXT),t&&(n.privateKeyBase58=this.privateKeyBase58),e&&(n.publicKeyBase58=this.publicKeyBase58),n}signer(){const{privateKeyBase58:e}=this;return e?{async sign({data:t}){const r=b.encode(JSON.stringify({alg:"ES256K",b64:!1,crit:["b64"]})),i=n.from(t.buffer,t.byteOffset,t.length),o=Mi(n.from(n.concat([n.from(`${r}.`,"utf8"),n.from(i.buffer,i.byteOffset,i.length)]))),{signature:s}=bi.ecdsaSign(o,S(e));return`${r}..${b.encode(n.from(s))}`},id:this.id}:{async sign(){throw new Error("No private key to sign with.")},id:this.id}}verifier(){const{publicKeyBase58:e}=this;return e?{async verify({data:t,signature:r}){if(r.indexOf("..")<0)return!1;const[i,o]=r.split(".."),s=JSON.parse(b.decode(i));if("ES256K"!==s.alg||!1!==s.b64||!s.crit||!s.crit.length||"b64"!==s.crit[0])return!1;const a=n.from(t.buffer,t.byteOffset,t.length),u=Mi(n.from(n.concat([n.from(`${i}.`,"utf8"),n.from(a.buffer,a.byteOffset,a.length)])));let c;try{c=bi.ecdsaVerify(n.from(b.decode(o,"hex"),"hex"),u,S(e))}catch(e){c=!1}return c},id:this.id}:{async verify(){throw new Error("No public key to verify against")},id:this.id}}}Pi.suite=Ki,Pi.SUITE_CONTEXT="https://ns.did.ai/suites/secp256k1-2019/v1";const Li="https://ns.did.ai/suites/secp256k1-2019/v1",Ii=({document:e,contextUrl:t})=>{const r=e["@context"];return r===t||Array.isArray(r)&&r.includes(t)},Oi=({document:e})=>{const t=Ii({document:e,contextUrl:Li}),r=Ii({document:e,contextUrl:"https://www.w3.org/2018/credentials/v1"}),n=Ii({document:e,contextUrl:"https://w3id.org/security/v2"});return t&&r?(console.warn("Warning: The secp256k1-2019/v1 and credentials/v1 contexts are incompatible."),console.warn("For VCs using EcdsaSecp256k1Signature2019 suite, using the credentials/v1 context is sufficient."),!1):t&&n?(console.warn("Warning: The secp256k1-2019/v1 and security/v2 contexts are incompatible."),console.warn("For VCs using EcdsaSecp256k1Signature2019 suite, using the security/v2 context is sufficient."),!1):t||r||n};let Ci=class extends d.suites.LinkedDataSignature{constructor(e={}){super({type:"EcdsaSecp256k1Signature2019",LDKeyClass:Pi,contextUrl:Li,...e}),this.requiredKeyType=void 0,this.requiredKeyType="EcdsaSecp256k1VerificationKey2019"}async sign({verifyData:e,proof:t}){if(!this.signer||"function"!=typeof this.signer.sign)throw new Error("A signer API has not been specified.");return{...t,jws:await this.signer.sign({data:e})}}async verifySignature({verifyData:e,verificationMethod:t,proof:r}){const{jws:n}=r;if(!n||"string"!=typeof n)throw new TypeError('The proof does not include a valid "jws" property.');let{verifier:i}=this;if(!i){i=(await this.LDKeyClass.from(t)).verifier()}return i.verify({data:e,signature:n})}async assertVerificationMethod({verificationMethod:e}){if(!Oi({document:e}))throw new TypeError(`The verification method (key) must contain "${this.contextUrl}".`);if(!f.hasValue(e,"type",this.requiredKeyType))throw new Error(`Invalid key type. Key type must be "${this.requiredKeyType}".`);if(void 0!==e.revoked)throw new Error("The verification method has been revoked.")}async getVerificationMethod({proof:e,documentLoader:t}){if(this.key)return this.key.export({publicKey:!0});const r="object"==typeof e.verificationMethod?e.verificationMethod.id:e.verificationMethod;if(!r)throw new Error('No "verificationMethod" found in proof.');const n=await f.frame(r,{"@context":this.contextUrl,"@embed":"@always",id:r},{documentLoader:t,compactToRelative:!1});if(!n)throw new Error(`Verification method ${r} not found.`);if(void 0!==n.revoked)throw new Error("The verification method has been revoked.");return await this.assertVerificationMethod({verificationMethod:n}),n}async matchProof({proof:e,document:t,purpose:r,documentLoader:n,expansionMap:i}){if(!Oi({document:t}))return!1;if(!await super.matchProof({proof:e,document:t,purpose:r,documentLoader:n,expansionMap:i}))return!1;if(!this.key)return!0;const{verificationMethod:o}=e,s="object"==typeof o?o.id:o;return this.isVerificationMethodMatchingKeyId(s)}ensureSuiteContext({document:e,addSuiteContext:t}){Oi({document:e})||super.ensureSuiteContext({document:e,addSuiteContext:t})}isVerificationMethodMatchingKeyId(e){return e===this.key.id||e===`${this.key.controller}${this.key.id}`}};Ci.CONTEXT_URL=Li,Ci.CONTEXT={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},EcdsaSecp256k1VerificationKey2019:{"@id":"https://w3id.org/security#EcdsaSecp256k1VerificationKey2019","@context":{"@protected":!0,id:"@id",type:"@type",controller:{"@id":"https://w3id.org/security#controller","@type":"@id"},revoked:{"@id":"https://w3id.org/security#revoked","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},blockchainAccountId:{"@id":"https://w3id.org/security#blockchainAccountId"},publicKeyJwk:{"@id":"https://w3id.org/security#publicKeyJwk","@type":"@json"},publicKeyBase58:{"@id":"https://w3id.org/security#publicKeyBase58"},publicKeyMultibase:{"@id":"https://w3id.org/security#publicKeyMultibase","@type":"https://w3id.org/security#multibase"}}},EcdsaSecp256k1Signature2019:{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},jws:{"@id":"https://w3id.org/security#jws"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}};const Di="Impossible case. Please create issue.",Ni="The tweak was out of range or the resulted private key is invalid",Bi="The tweak was out of range or equal to zero",ji="Unknow error on context randomization",Ui="Private Key is invalid",Vi="Public Key could not be parsed",qi="Public Key serialization error",Wi="The sum of the public keys is not valid",Fi="Signature could not be parsed",zi="The nonce generation function failed, or the private key was invalid",Hi="Public key could not be recover",$i="Scalar was invalid (zero or overflow)";function Zi(e,t){if(!e)throw new Error(t)}function Xi(e,t,r){if(Zi(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;Zi(r.includes(t.length),n)}else{const n=`Expected ${e} to be an Uint8Array with length ${r}`;Zi(t.length===r,n)}}function Gi(e){Zi("Boolean"===Ji(e),"Expected compressed to be a Boolean")}function Yi(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),Xi("output",e,t),e}function Ji(e){return Object.prototype.toString.call(e).slice(8,-1)}const Qi=new(0,k.ec)("secp256k1"),eo=Qi.curve,to=eo.n.constructor;function ro(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new to(t);if(r.cmp(eo.p)>=0)return null;r=r.toRed(eo.red);let n=r.redSqr().redIMul(r).redIAdd(eo.b).redSqrt();return 3===e!==n.isOdd()&&(n=n.redNeg()),Qi.keyPair({pub:{x:r,y:n}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let n=new to(t),i=new to(r);if(n.cmp(eo.p)>=0||i.cmp(eo.p)>=0)return null;if(n=n.toRed(eo.red),i=i.toRed(eo.red),(6===e||7===e)&&i.isOdd()!==(7===e))return null;const o=n.redSqr().redIMul(n);return i.redSqr().redISub(o.redIAdd(eo.b)).isZero()?Qi.keyPair({pub:{x:n,y:i}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function no(e,t){const r=t.encode(null,33===e.length);for(let t=0;t<e.length;++t)e[t]=r[t]}var io={contextRandomize:()=>0,privateKeyVerify(e){const t=new to(e);return t.cmp(eo.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new to(e),r=eo.n.sub(t).umod(eo.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new to(t);if(r.cmp(eo.n)>=0)return 1;if(r.iadd(new to(e)),r.cmp(eo.n)>=0&&r.isub(eo.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakMul(e,t){let r=new to(t);if(r.cmp(eo.n)>=0||r.isZero())return 1;r.imul(new to(e)),r.cmp(eo.n)>=0&&(r=r.umod(eo.n));const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},publicKeyVerify:e=>null===ro(e)?1:0,publicKeyCreate(e,t){const r=new to(t);if(r.cmp(eo.n)>=0||r.isZero())return 1;return no(e,Qi.keyFromPrivate(t).getPublic()),0},publicKeyConvert(e,t){const r=ro(t);if(null===r)return 1;return no(e,r.getPublic()),0},publicKeyNegate(e,t){const r=ro(t);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),no(e,n),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e<t.length;++e)if(r[e]=ro(t[e]),null===r[e])return 1;let n=r[0].getPublic();for(let e=1;e<r.length;++e)n=n.add(r[e].pub);return n.isInfinity()?2:(no(e,n),0)},publicKeyTweakAdd(e,t,r){const n=ro(t);if(null===n)return 1;if((r=new to(r)).cmp(eo.n)>=0)return 2;const i=n.getPublic().add(eo.g.mul(r));return i.isInfinity()?2:(no(e,i),0)},publicKeyTweakMul(e,t,r){const n=ro(t);if(null===n)return 1;if((r=new to(r)).cmp(eo.n)>=0||r.isZero())return 2;return no(e,n.getPublic().mul(r)),0},signatureNormalize(e){const t=new to(e.subarray(0,32)),r=new to(e.subarray(32,64));return t.cmp(eo.n)>=0||r.cmp(eo.n)>=0?1:(1===r.cmp(Qi.nh)&&e.set(eo.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),n=t.subarray(32,64);if(new to(r).cmp(eo.n)>=0)return 1;if(new to(n).cmp(eo.n)>=0)return 1;const{output:i}=e;let o=i.subarray(4,37);o[0]=0,o.set(r,1);let s=33,a=0;for(;s>1&&0===o[a]&&!(128&o[a+1]);--s,++a);if(o=o.subarray(a),128&o[0])return 1;if(s>1&&0===o[0]&&!(128&o[1]))return 1;let u=i.subarray(39,72);u[0]=0,u.set(n,1);let c=33,h=0;for(;c>1&&0===u[h]&&!(128&u[h+1]);--c,++h);return u=u.subarray(h),128&u[0]||c>1&&0===u[0]&&!(128&u[1])?1:(e.outputlen=6+s+c,i[0]=48,i[1]=e.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+s]=2,i[5+s]=u.length,i.set(u,6+s),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const n=t[5+r];if(0===n)return 1;if(6+r+n!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(n>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let i=t.subarray(4,4+r);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=t.subarray(6+r);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let s=new to(i);s.cmp(eo.n)>=0&&(s=new to(0));let a=new to(t.subarray(6+r));return a.cmp(eo.n)>=0&&(a=new to(0)),e.set(s.toArrayLike(Uint8Array,"be",32),0),e.set(a.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,n,i){if(i){const e=i;i=i=>{const o=e(t,r,null,n,i);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new to(o)}}const o=new to(r);if(o.cmp(eo.n)>=0||o.isZero())return 1;let s;try{s=Qi.sign(t,r,{canonical:!0,k:i,pers:n})}catch(e){return 1}return e.signature.set(s.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(s.s.toArrayLike(Uint8Array,"be",32),32),e.recid=s.recoveryParam,0},ecdsaVerify(e,t,r){const n={r:e.subarray(0,32),s:e.subarray(32,64)},i=new to(n.r),o=new to(n.s);if(i.cmp(eo.n)>=0||o.cmp(eo.n)>=0)return 1;if(1===o.cmp(Qi.nh)||i.isZero()||o.isZero())return 3;const s=ro(r);if(null===s)return 2;const a=s.getPublic();return Qi.verify(t,n,a)?0:3},ecdsaRecover(e,t,r,n){const i={r:t.slice(0,32),s:t.slice(32,64)},o=new to(i.r),s=new to(i.s);if(o.cmp(eo.n)>=0||s.cmp(eo.n)>=0)return 1;if(o.isZero()||s.isZero())return 2;let a;try{a=Qi.recoverPubKey(n,i,r)}catch(e){return 2}return no(e,a),0},ecdh(e,t,r,n,i,o,s){const a=ro(t);if(null===a)return 1;const u=new to(r);if(u.cmp(eo.n)>=0||u.isZero())return 2;const c=a.getPublic().mul(u);if(void 0===i){const t=c.encode(null,!0),r=Qi.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{o||(o=new Uint8Array(32));const t=c.getX().toArray("be",32);for(let e=0;e<32;++e)o[e]=t[e];s||(s=new Uint8Array(32));const r=c.getY().toArray("be",32);for(let e=0;e<32;++e)s[e]=r[e];const a=i(o,s,n);if(!(a instanceof Uint8Array&&a.length===e.length))return 2;e.set(a)}return 0}},oo=(e=>({contextRandomize(t){if(Zi(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&Xi("seed",t,32),1===e.contextRandomize(t))throw new Error(ji)},privateKeyVerify:t=>(Xi("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(Xi("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(Di)}},privateKeyTweakAdd(t,r){switch(Xi("private key",t,32),Xi("tweak",r,32),e.privateKeyTweakAdd(t,r)){case 0:return t;case 1:throw new Error(Ni)}},privateKeyTweakMul(t,r){switch(Xi("private key",t,32),Xi("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(Bi)}},publicKeyVerify:t=>(Xi("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,n){switch(Xi("private key",t,32),Gi(r),n=Yi(n,r?33:65),e.publicKeyCreate(n,t)){case 0:return n;case 1:throw new Error(Ui);case 2:throw new Error(qi)}},publicKeyConvert(t,r=!0,n){switch(Xi("public key",t,[33,65]),Gi(r),n=Yi(n,r?33:65),e.publicKeyConvert(n,t)){case 0:return n;case 1:throw new Error(Vi);case 2:throw new Error(qi)}},publicKeyNegate(t,r=!0,n){switch(Xi("public key",t,[33,65]),Gi(r),n=Yi(n,r?33:65),e.publicKeyNegate(n,t)){case 0:return n;case 1:throw new Error(Vi);case 2:throw new Error(Di);case 3:throw new Error(qi)}},publicKeyCombine(t,r=!0,n){Zi(Array.isArray(t),"Expected public keys to be an Array"),Zi(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)Xi("public key",e,[33,65]);switch(Gi(r),n=Yi(n,r?33:65),e.publicKeyCombine(n,t)){case 0:return n;case 1:throw new Error(Vi);case 2:throw new Error(Wi);case 3:throw new Error(qi)}},publicKeyTweakAdd(t,r,n=!0,i){switch(Xi("public key",t,[33,65]),Xi("tweak",r,32),Gi(n),i=Yi(i,n?33:65),e.publicKeyTweakAdd(i,t,r)){case 0:return i;case 1:throw new Error(Vi);case 2:throw new Error(Ni)}},publicKeyTweakMul(t,r,n=!0,i){switch(Xi("public key",t,[33,65]),Xi("tweak",r,32),Gi(n),i=Yi(i,n?33:65),e.publicKeyTweakMul(i,t,r)){case 0:return i;case 1:throw new Error(Vi);case 2:throw new Error(Bi)}},signatureNormalize(t){switch(Xi("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(Fi)}},signatureExport(t,r){Xi("signature",t,64);const n={output:r=Yi(r,72),outputlen:72};switch(e.signatureExport(n,t)){case 0:return r.slice(0,n.outputlen);case 1:throw new Error(Fi);case 2:throw new Error(Di)}},signatureImport(t,r){switch(Xi("signature",t),r=Yi(r,64),e.signatureImport(r,t)){case 0:return r;case 1:throw new Error(Fi);case 2:throw new Error(Di)}},ecdsaSign(t,r,n={},i){Xi("message",t,32),Xi("private key",r,32),Zi("Object"===Ji(n),"Expected options to be an Object"),void 0!==n.data&&Xi("options.data",n.data),void 0!==n.noncefn&&Zi("Function"===Ji(n.noncefn),"Expected options.noncefn to be a Function");const o={signature:i=Yi(i,64),recid:null};switch(e.ecdsaSign(o,t,r,n.data,n.noncefn)){case 0:return o;case 1:throw new Error(zi);case 2:throw new Error(Di)}},ecdsaVerify(t,r,n){switch(Xi("signature",t,64),Xi("message",r,32),Xi("public key",n,[33,65]),e.ecdsaVerify(t,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(Fi);case 2:throw new Error(Vi)}},ecdsaRecover(t,r,n,i=!0,o){switch(Xi("signature",t,64),Zi("Number"===Ji(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),Xi("message",n,32),Gi(i),o=Yi(o,i?33:65),e.ecdsaRecover(o,t,r,n)){case 0:return o;case 1:throw new Error(Fi);case 2:throw new Error(Hi);case 3:throw new Error(Di)}},ecdh(t,r,n={},i){switch(Xi("public key",t,[33,65]),Xi("private key",r,32),Zi("Object"===Ji(n),"Expected options to be an Object"),void 0!==n.data&&Xi("options.data",n.data),void 0!==n.hashfn?(Zi("Function"===Ji(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&Xi("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&Xi("options.ybuf",n.ybuf,32),Xi("output",i)):i=Yi(i,32),e.ecdh(i,t,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return i;case 1:throw new Error(Vi);case 2:throw new Error($i)}}}))(io),so=l(oo);const ao="undefined"==typeof Buffer?n:Buffer,{purposes:{AssertionProofPurpose:uo}}=d;var co;!function(e){e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.checkDocumentSignature="checkDocumentSignature"}(co||(co={}));class ho extends T{verificationProcess=[co.retrieveVerificationMethodPublicKey,co.checkDocumentSignature];documentToVerify;issuer;proof;type="EcdsaSecp256k1Signature2019";verificationKey;publicKey;constructor(e){super(e),e.executeStep&&(this.executeStep=e.executeStep),this.documentToVerify=e.document,this.issuer=e.issuer,this.proof=e.proof,this.validateProofType()}async init(){}async verifyProof(){for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}}async verifyIdentity(){}getProofVerificationSteps(e){return this.verificationProcess.map((t=>i.verifier.convertToVerificationSubsteps(e,t)))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return this.publicKey}getIssuerName(){return this.issuer.name??""}getIssuerProfileDomain(){try{return new URL(this.getIssuerProfileUrl()).hostname??""}catch(e){return""}}getIssuerProfileUrl(){return this.issuer.id??""}getSigningDate(){return this.proof.created}async executeStep(e,t,r){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}validateProofType(){const e=this.isProofChain()?this.proof.chainedProofType:this.proof.type;if(e!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${e}`)}isProofChain(){return"ChainedProof2021"===this.proof.type}generateDocumentLoader(){o[this.documentToVerify.issuer]=this.getTargetVerificationMethodContainer();return function(e){return e in o?{contextUrl:null,document:o[e],documentUrl:e}:f.documentLoader(e)}}retrieveInitialDocument(){const e=s(this.documentToVerify);if(Array.isArray(e.proof)){const t=e.proof.find((e=>e.type===this.type));delete e.proof,e.proof=t}return e}getTargetVerificationMethodContainer(){return this.issuer.didDocument??this.issuer}async retrieveVerificationMethodPublicKey(){this.verificationKey=await this.executeStep(co.retrieveVerificationMethodPublicKey,(async()=>{const e=await w(this.getTargetVerificationMethodContainer(),this.proof.verificationMethod);if(e.publicKeyJwk&&!e.publicKeyBase58){const r=(e=>{const t=_.from({...e,crv:"K-256"},"jwk").toString("blk","public"),r=so.publicKeyConvert(ao.from(t,"hex"),!0);return ao.from(r).toString("hex")})(e.publicKeyJwk);e.publicKeyBase58=(t=r,v.encode(ao.from(t,"hex")))}var t;this.publicKey=e.publicKeyBase58;const r=await Pi.from({...e});if(!r)throw new a(co.retrieveVerificationMethodPublicKey,"Could not derive the verification key");if(r.revoked)throw new a(co.retrieveVerificationMethodPublicKey,"The verification key has been revoked");return r}),this.type)}async checkDocumentSignature(){await this.executeStep(co.checkDocumentSignature,(async()=>{const e=new Ci({key:this.verificationKey});e.date=new Date(Date.now()).toISOString();const t=await d.verify(this.retrieveInitialDocument(),{suite:e,purpose:new uo,documentLoader:this.generateDocumentLoader()});if(!t.verified)throw console.error(JSON.stringify(t,null,2)),new a(co.checkDocumentSignature,`The document's ${this.type} signature could not be confirmed`);console.log("Credential Secp256k1 signature successfully verified")}),this.type)}}export{ho as default};
@@ -1,4 +1,4 @@
1
- import{h as e,o as t,n as r,l as n,y as i,c as o,i as a}from"./main.js";import{j as s}from"./jsonld-signatures-8ecbbaa2-fff3092d.js";import{j as c}from"./jsonld-6909fb49-1ef9cd75.js";import{d as u,e as f}from"./index-85f56501-cfd39fda.js";import{_ as p}from"./tslib.es6-28b6776b-35eb20e3.js";import{x as l,e as y}from"./x25519-08f432f1-3fdac820.js";import{d as h}from"./index-a93e1e88-967d29f5.js";import{S as d}from"./Suite-e65d26ad-9eb797e9.js";import"./_commonjs-dynamic-modules-1e49c0dd-3e972b61.js";
1
+ import{h as e,o as t,n as r,l as n,y as i,c as o,i as a}from"./main.js";import{j as s}from"./jsonld-signatures-8ecbbaa2-MztjIc1c.js";import{j as c}from"./jsonld-6909fb49-vaWL2Y4h.js";import{d as u,e as f}from"./index-85f56501-xkysxAxC.js";import{_ as p}from"./tslib.es6-28b6776b-qWIKDnpX.js";import{x as l,e as y}from"./x25519-08f432f1-4TKeGPT6.js";import{d as h}from"./index-a93e1e88-w6XCMY1g.js";import{S as d}from"./Suite-e65d26ad-e2QgHGhx.js";import"./_commonjs-dynamic-modules-1e49c0dd-fkA6S-_a.js";
2
2
  /*!
3
3
  * Copyright (c) 2018-2022 Digital Bazaar, Inc. All rights reserved.
4
4
  */const w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",v=[62,-1,-1,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,63,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];function g(e){if(!(e instanceof Uint8Array||"string"==typeof e))throw new TypeError('"input" be a string or Uint8Array.');"string"==typeof e&&(e=(new TextEncoder).encode(e));let t,r,n,i="",o=0;for(;o<e.byteLength;)t=e[o++],r=e[o++],n=e[o++],i+=w.charAt(t>>2),i+=w.charAt((3&t)<<4|r>>4),isNaN(r)||(i+=w.charAt((15&r)<<2|n>>6),isNaN(n)||(i+=w.charAt(63&n)));return i}