@blockcerts/blockcerts-verifier 1.68.0 → 1.69.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 (33) hide show
  1. package/bundle-stats.html +1 -1
  2. package/dist/{EcdsaSd2023-CJsktwwK-COovFO-E.js → EcdsaSd2023-Bf8oG6yE-DXSfendb.js} +8 -8
  3. package/dist/{EcdsaSecp256k1Signature2019-hg62McNW-DMCKToe3.js → EcdsaSecp256k1Signature2019-BALmC57B-DCQW1A4n.js} +1 -1
  4. package/dist/{Ed25519Signature2020-D3owGts_-BB1fBq0Z.js → Ed25519Signature2020-B6Av-H9i-Bi3NyI0E.js} +5 -5
  5. package/dist/{MerkleProof2017-BrDGNMx2-Ct7-Dmh5.js → MerkleProof2017-Dy-NSqLc-DHQ59Wvo.js} +1 -1
  6. package/dist/{MerkleProof2019-D70TTI_--BhNFm4-a.js → MerkleProof2019-0fhn8kLR-C2H_q6nV.js} +2 -2
  7. package/dist/{checkCredentialSchemaConformity-D7h9tZ1Y-B0tA00kY.js → checkCredentialSchemaConformity-D70pJ-aV-ziU-1LIq.js} +1 -1
  8. package/dist/controlVerificationMethod-suRC0MnA-D4JcJT1N.js +1 -0
  9. package/dist/{did-key-common.esm-D_08iodm-FY3lD1HA.js → did-key-common.esm-C8HA3Pjo-CSneo-V8.js} +3 -3
  10. package/dist/{did-key-ed25519.esm-Cah33z_9-CXstsY-H.js → did-key-ed25519.esm-DysNS-Zl-DSKpuDIg.js} +1 -1
  11. package/dist/{did-key-secp256k1.esm-C27OwLgS-C9mjnb5S.js → did-key-secp256k1.esm-CLndQyAu-BYDTpSgR.js} +1 -1
  12. package/dist/{downloadPDF-XZlmMePj.js → downloadPDF-DzV0Jwr0.js} +3 -3
  13. package/dist/{index-Br-3L8ut-BI4gpx_q.js → index-BC_5sEeg-CEsb2-mf.js} +1 -1
  14. package/dist/{index-Bxtpkwnp-BkEvuYc3.js → index-BEHg4rC3-AHOWkvj-.js} +15 -15
  15. package/dist/{index-PZL1xHXK-CH1Nkb1O.js → index-CKc12B0M-CY2IlTam.js} +7 -7
  16. package/dist/{index.es-B13oYDrC.js → index.es-D_fMtNlx.js} +1 -1
  17. package/dist/main.js +111 -111
  18. package/dist/{purify-hA3K4SAZ.js → purify-mEiDmpQD.js} +1 -1
  19. package/dist/{retrieveVerificationMethodPublicKey-DMLSSemm-uQidviAv.js → retrieveVerificationMethodPublicKey-CogYoUma-CqFMEtDL.js} +1 -1
  20. package/dist/verifyIssuerProfile-2DvLibZC-DDE-mATS.js +1 -0
  21. package/dist/{webcrypto.es-CjDwtULr-D7dA51Yn.js → webcrypto.es-CGaF2VaX-TCzLuarM.js} +1 -1
  22. package/package.json +2 -2
  23. package/dist/controlVerificationMethod-DPnoI09o-D_Ktjb-C.js +0 -1
  24. /package/dist/{HashlinkVerifier-BE8mYTIj-dg5WNZnc.js → HashlinkVerifier-CUj0d9D3-dg5WNZnc.js} +0 -0
  25. /package/dist/{checkRevocationStatusList2021-CtVHNZ7k-XCu3zkCJ.js → checkRevocationStatusList2021-u7qIPszJ-XCu3zkCJ.js} +0 -0
  26. /package/dist/{elliptic-D7vAoLbk-DQmYEk-8.js → elliptic-e2d4_kYF-DQmYEk-8.js} +0 -0
  27. /package/dist/{ensureNotRevoked-BEtBmERU-DvMIgM4L.js → ensureNotRevoked-D2jnsCd0-DvMIgM4L.js} +0 -0
  28. /package/dist/{ensureValidIssuingKey-BrJmJb4L-wu9SdYxL.js → ensureValidIssuingKey-LBboe5mO-wu9SdYxL.js} +0 -0
  29. /package/dist/{index-CQB1Suna-Dgus2xdV.js → index-DuuEF8T4-Dgus2xdV.js} +0 -0
  30. /package/dist/{index-BeIcTgye-C0eXpZGn.js → index-qLsUsSDH-C0eXpZGn.js} +0 -0
  31. /package/dist/{jsonld-D-rUqx_B-CQeQQNYP.js → jsonld-Cuz6c95c-CQeQQNYP.js} +0 -0
  32. /package/dist/{sha256-BIbQVOZh-C1PUWFZm.js → sha256-mf0I6iCn-C1PUWFZm.js} +0 -0
  33. /package/dist/{x25519-C5Qlh_Lh-NSl6svWQ.js → x25519-DrRZ9GHv-NSl6svWQ.js} +0 -0
@@ -1 +1 @@
1
- import{B as t,d as e,f as r,e as i,V as n,k as o,t as s,g as a,u as h,v as u,p as c,w as l}from"./main.js";import{d as f,e as d,j as p}from"./index-Bxtpkwnp-BkEvuYc3.js";import{j as _}from"./jsonld-D-rUqx_B-CQeQQNYP.js";import{e as y,d as b,a as g,r as w,k as v,s as m,c as S,b as E}from"./index-Br-3L8ut-BI4gpx_q.js";import{a as k,b as R}from"./elliptic-D7vAoLbk-DQmYEk-8.js";import{S as T}from"./Suite-B7Vy9AuU-D1ucdMDB.js";import"./pako.esm-DnD5dZGi-Bw1vqMku.js";import"./sha256-BIbQVOZh-C1PUWFZm.js";import"./index-CQB1Suna-Dgus2xdV.js";import{r as M}from"./retrieveVerificationMethodPublicKey-DMLSSemm-uQidviAv.js";var x,D,L={exports:{}};function O(){return D?x:(D=1,x={})}var B,I,P,C,A,K,j={},N=h(l);function U(){return I?B:(I=1,B=N.EventEmitter)}function V(){if(C)return P;function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function r(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}(t.prototype,e),t}C=1;var i=k.Buffer,n=E.inspect,o=n&&n.custom||"inspect";return P=function(){function s(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),this.head=null,this.tail=null,this.length=0}return r(s,[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return i.alloc(0);for(var e,r,n,o=i.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,r=o,n=a,i.prototype.copy.call(e,r,n),a+=s.data.length,s=s.next;return o}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,i=e.data;for(t-=i.length;e=e.next;){var n=e.data,o=t>n.length?n.length:t;if(o===n.length?i+=n:i+=n.slice(0,t),0===(t-=o)){o===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=i.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(o.copy(e,e.length-t,0,s),0===(t-=s)){s===o.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(s));break}++n}return this.length-=n,e}},{key:o,value:function(r,i){return n(this,function(r){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?t(Object(n),!0).forEach((function(t){e(r,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))}))}return r}({},i,{depth:0,customInspect:!1}))}}]),s}(),P}function q(){if(K)return A;function t(t,i){r(t,i),e(t)}function e(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function r(t,e){t.emit("error",e)}return K=1,A={destroy:function(i,n){var o=this,a=this._readableState&&this._readableState.destroyed,h=this._writableState&&this._writableState.destroyed;return a||h?(n?n(i):i&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,s(r,this,i)):s(r,this,i)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(i||null,(function(r){!n&&r?o._writableState?o._writableState.errorEmitted?s(e,o):(o._writableState.errorEmitted=!0,s(t,o,r)):s(t,o,r):n?(s(e,o),n(r)):s(e,o)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}}}var W,F,H,$={};function z(){if(W)return $;W=1;var t={};function e(e,r,i){i||(i=Error);var n=function(t){var e,i;function n(e,i,n){return t.call(this,function(t,e,i){return"string"==typeof r?r:r(t,e,i)}(e,i,n))||this}return i=t,(e=n).prototype=Object.create(i.prototype),e.prototype.constructor=e,e.__proto__=i,n}(i);n.prototype.name=i.name,n.prototype.code=e,t[e]=n}function r(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}return e("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),e("ERR_INVALID_ARG_TYPE",(function(t,e,i){var n,o,s;if("string"==typeof e&&(o="not ",e.substr(0,o.length)===o)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(n," ").concat(r(e,"type"));else{var a=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(a," ").concat(n," ").concat(r(e,"type"))}return s+=". Received type ".concat(typeof i)}),TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),$.codes=t,$}function G(){if(H)return F;H=1;var t=z().codes.ERR_INVALID_OPT_VALUE;return F={getHighWaterMark:function(e,r,i,n){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(r,n,i);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new t(n?i:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}}var X,J,Y,Q,Z,tt,et,rt,it={};function nt(){if(X)return it;X=1;var t=w().Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var i;switch(this.encoding=function(r){var i=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof i&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return i||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,i=4;break;case"utf8":this.fillLast=n,i=4;break;case"base64":this.text=a,this.end=h,i=3;break;default:return this.write=u,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(i)}function i(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function n(t){var e=this.lastTotal-this.lastNeed,r=function(t,e){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function o(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function s(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function a(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function u(t){return t.toString(this.encoding)}function c(t){return t&&t.length?this.write(t):""}return it.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var o=i(e[n]);if(o>=0)return o>0&&(t.lastNeed=o-1),o;if(--n<r||-2===o)return 0;if(o=i(e[n]),o>=0)return o>0&&(t.lastNeed=o-2),o;if(--n<r||-2===o)return 0;if(o=i(e[n]),o>=0)return o>0&&(2===o?o=0:t.lastNeed=o-3),o;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},it}function ot(){if(Y)return J;Y=1;var t=z().codes.ERR_STREAM_PREMATURE_CLOSE;function e(){}return J=function r(i,n,o){if("function"==typeof n)return r(i,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}(o||e);var s=n.readable||!1!==n.readable&&i.readable,a=n.writable||!1!==n.writable&&i.writable,h=function(){i.writable||c()},u=i._writableState&&i._writableState.finished,c=function(){a=!1,u=!0,s||o.call(i)},l=i._readableState&&i._readableState.endEmitted,f=function(){s=!1,l=!0,a||o.call(i)},d=function(t){o.call(i,t)},p=function(){var e;return s&&!l?(i._readableState&&i._readableState.ended||(e=new t),o.call(i,e)):a&&!u?(i._writableState&&i._writableState.ended||(e=new t),o.call(i,e)):void 0},_=function(){i.req.on("finish",c)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(i)?a&&!i._writableState&&(i.on("end",h),i.on("close",h)):(i.on("complete",c),i.on("abort",p),i.req?_():i.on("request",_)),i.on("end",f),i.on("finish",c),!1!==n.error&&i.on("error",d),i.on("close",p),function(){i.removeListener("complete",c),i.removeListener("abort",p),i.removeListener("request",_),i.req&&i.req.removeListener("finish",c),i.removeListener("end",h),i.removeListener("close",h),i.removeListener("finish",c),i.removeListener("end",f),i.removeListener("error",d),i.removeListener("close",p)}},J}function st(){if(Z)return Q;var t;function e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Z=1;var r=ot(),i=Symbol("lastResolve"),n=Symbol("lastReject"),o=Symbol("error"),a=Symbol("ended"),h=Symbol("lastPromise"),u=Symbol("handlePromise"),c=Symbol("stream");function l(t,e){return{value:t,done:e}}function f(t){var e=t[i];if(null!==e){var r=t[c].read();null!==r&&(t[h]=null,t[i]=null,t[n]=null,e(l(r,!1)))}}function d(t){s(f,t)}var p=Object.getPrototypeOf((function(){})),_=Object.setPrototypeOf((e(t={get stream(){return this[c]},next:function(){var t=this,e=this[o];if(null!==e)return Promise.reject(e);if(this[a])return Promise.resolve(l(void 0,!0));if(this[c].destroyed)return new Promise((function(e,r){s((function(){t[o]?r(t[o]):e(l(void 0,!0))}))}));var r,i=this[h];if(i)r=new Promise(function(t,e){return function(r,i){t.then((function(){e[a]?r(l(void 0,!0)):e[u](r,i)}),i)}}(i,this));else{var n=this[c].read();if(null!==n)return Promise.resolve(l(n,!1));r=new Promise(this[u])}return this[h]=r,r}},Symbol.asyncIterator,(function(){return this})),e(t,"return",(function(){var t=this;return new Promise((function(e,r){t[c].destroy(null,(function(t){t?r(t):e(l(void 0,!0))}))}))})),t),p);return Q=function(t){var s,f=Object.create(_,(e(s={},c,{value:t,writable:!0}),e(s,i,{value:null,writable:!0}),e(s,n,{value:null,writable:!0}),e(s,o,{value:null,writable:!0}),e(s,a,{value:t._readableState.endEmitted,writable:!0}),e(s,u,{value:function(t,e){var r=f[c].read();r?(f[h]=null,f[i]=null,f[n]=null,t(l(r,!1))):(f[i]=t,f[n]=e)},writable:!0}),s));return f[h]=null,r(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=f[n];return null!==e&&(f[h]=null,f[i]=null,f[n]=null,e(t)),void(f[o]=t)}var r=f[i];null!==r&&(f[h]=null,f[i]=null,f[n]=null,r(l(void 0,!0))),f[a]=!0})),t.on("readable",d.bind(null,f)),f}}function at(){if(rt)return j;rt=1;const t=O();t.Readable=M,M.ReadableState=T,N.EventEmitter;var e=function(t,e){return t.listeners(e).length},r=U(),i=k.Buffer,n=o.Uint8Array||function(){};var a,h=E;a=h&&h.debuglog?h.debuglog("stream"):function(){};var u,l,f,d=V(),p=q(),_=G().getHighWaterMark,y=z().codes,b=y.ERR_INVALID_ARG_TYPE,g=y.ERR_STREAM_PUSH_AFTER_EOF,w=y.ERR_METHOD_NOT_IMPLEMENTED,v=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;R()(M,r);var m=p.errorOrDestroy,S=["error","close","destroy","pause","resume"];function T(e,r,i){e=e||{},"boolean"!=typeof i&&(i=r instanceof t.Duplex),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=_(this,e,"readableHighWaterMark",i),this.buffer=new d,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&&(u||(u=nt().StringDecoder),this.decoder=new u(e.encoding),this.encoding=e.encoding)}function M(e){if(!(this instanceof M))return new M(e);var i=this instanceof t.Duplex;this._readableState=new T(e,this,i),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),r.call(this)}function x(t,e,r,o,s){a("readableAddChunk",e);var h,u=t._readableState;if(null===e)u.reading=!1,function(t,e){if(a("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?I(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,P(t)))}(t,u);else if(s||(h=function(t,e){var r;o=e,i.isBuffer(o)||o instanceof n||"string"==typeof e||void 0===e||t.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],e));var o;return r}(u,e)),h)m(t,h);else if(u.objectMode||e&&e.length>0)if("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===i.prototype||(e=function(t){return i.from(t)}(e)),o)u.endEmitted?m(t,new v):D(t,u,e,!0);else if(u.ended)m(t,new g);else{if(u.destroyed)return!1;u.reading=!1,u.decoder&&!r?(e=u.decoder.write(e),u.objectMode||0!==e.length?D(t,u,e,!1):C(t,u)):D(t,u,e,!1)}else o||(u.reading=!1,C(t,u));return!u.ended&&(u.length<u.highWaterMark||0===u.length)}function D(t,e,r,i){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&I(t)),C(t,e)}Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),M.prototype.destroy=p.destroy,M.prototype._undestroy=p.undestroy,M.prototype._destroy=function(t,e){e(t)},M.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=i.from(t,e),e=""),r=!0),x(this,t,e,!1,r)},M.prototype.unshift=function(t){return x(this,t,null,!0,!1)},M.prototype.isPaused=function(){return!1===this._readableState.flowing},M.prototype.setEncoding=function(t){u||(u=nt().StringDecoder);var e=new u(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var L=1073741824;function B(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=L?t=L:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function I(t){var e=t._readableState;a("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(a("emitReadable",e.flowing),e.emittedReadable=!0,s(P,t))}function P(t){var e=t._readableState;a("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,H(t)}function C(t,e){e.readingMore||(e.readingMore=!0,s(A,t,e))}function A(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(a("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function K(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function W(t){a("readable nexttick read 0"),t.read(0)}function F(t,e){a("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),H(t),e.flowing&&!e.reading&&t.read(0)}function H(t){var e=t._readableState;for(a("flow",e.flowing);e.flowing&&null!==t.read(););}function $(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function X(t){var e=t._readableState;a("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,s(J,e,t))}function J(t,e){if(a("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function Y(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}return M.prototype.read=function(t){a("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return a("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?X(this):I(this),null;if(0===(t=B(t,e))&&e.ended)return 0===e.length&&X(this),null;var i,n=e.needReadable;return a("need readable",n),(0===e.length||e.length-t<e.highWaterMark)&&a("length less than watermark",n=!0),e.ended||e.reading?a("reading or ended",n=!1):n&&(a("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=B(r,e))),null===(i=t>0?$(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&X(this)),null!==i&&this.emit("data",i),i},M.prototype._read=function(t){m(this,new w("_read()"))},M.prototype.pipe=function(t,r){var i=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,a("pipe count=%d opts=%j",n.pipesCount,r);var o=(!r||!1!==r.end)&&t!==c.stdout&&t!==c.stderr?u:b;function h(e,r){a("onunpipe"),e===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,a("cleanup"),t.removeListener("close",_),t.removeListener("finish",y),t.removeListener("drain",l),t.removeListener("error",p),t.removeListener("unpipe",h),i.removeListener("end",u),i.removeListener("end",b),i.removeListener("data",d),f=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function u(){a("onend"),t.end()}n.endEmitted?s(o):i.once("end",o),t.on("unpipe",h);var l=function(t){return function(){var r=t._readableState;a("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&e(t,"data")&&(r.flowing=!0,H(t))}}(i);t.on("drain",l);var f=!1;function d(e){a("ondata");var r=t.write(e);a("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==Y(n.pipes,t))&&!f&&(a("false write response, pause",n.awaitDrain),n.awaitDrain++),i.pause())}function p(r){a("onerror",r),b(),t.removeListener("error",p),0===e(t,"error")&&m(t,r)}function _(){t.removeListener("finish",y),b()}function y(){a("onfinish"),t.removeListener("close",_),b()}function b(){a("unpipe"),i.unpipe(t)}return i.on("data",d),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",p),t.once("close",_),t.once("finish",y),t.emit("pipe",i),n.flowing||(a("pipe resume"),i.resume()),t},M.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=Y(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},M.prototype.on=function(t,e){var i=r.prototype.on.call(this,t,e),n=this._readableState;return"data"===t?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,a("on readable",n.length,n.reading),n.length?I(this):n.reading||s(W,this))),i},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(t,e){var i=r.prototype.removeListener.call(this,t,e);return"readable"===t&&s(K,this),i},M.prototype.removeAllListeners=function(t){var e=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||s(K,this),e},M.prototype.resume=function(){var t=this._readableState;return t.flowing||(a("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,s(F,t,e))}(this,t)),t.paused=!1,this},M.prototype.pause=function(){return a("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(a("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},M.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(a("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(a("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var o=0;o<S.length;o++)t.on(S[o],this.emit.bind(this,S[o]));return this._read=function(e){a("wrapped _read",e),i&&(i=!1,t.resume())},this},"function"==typeof Symbol&&(M.prototype[Symbol.asyncIterator]=function(){return void 0===l&&(l=st()),l(this)}),Object.defineProperty(M.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(M.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(M.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),M._fromList=$,Object.defineProperty(M.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(M.from=function(t,e){return void 0===f&&(f=et?tt:(et=1,tt=function(){throw new Error("Readable.from is not available in the browser")})),f(M,t,e)}),j}var ht,ut,ct,lt={};function ft(){if(ut)return ht;function t(t){try{if(!o.localStorage)return!1}catch(t){return!1}var e=o.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}return ut=1,ht=function(e,r){if(t("noDeprecation"))return e;var i=!1;return function(){if(!i){if(t("throwDeprecation"))throw new Error(r);t("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return e.apply(this,arguments)}},ht}function dt(){if(ct)return lt;ct=1;const t=O();function e(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}t.Writable=E,E.WritableState=S;var r={deprecate:ft()},i=U(),n=k.Buffer,a=o.Uint8Array||function(){};var h,u=q(),c=G().getHighWaterMark,l=z().codes,f=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,p=l.ERR_MULTIPLE_CALLBACK,_=l.ERR_STREAM_CANNOT_PIPE,y=l.ERR_STREAM_DESTROYED,b=l.ERR_STREAM_NULL_VALUES,g=l.ERR_STREAM_WRITE_AFTER_END,w=l.ERR_UNKNOWN_ENCODING,v=u.errorOrDestroy;function m(){}function S(r,i,n){r=r||{},"boolean"!=typeof n&&(n=i instanceof t.Duplex),this.objectMode=!!r.objectMode,n&&(this.objectMode=this.objectMode||!!r.writableObjectMode),this.highWaterMark=c(this,r,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===r.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=r.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if("function"!=typeof n)throw new p;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(s(n,i),s(B,t,e),t._writableState.errorEmitted=!0,v(t,i)):(n(i),t._writableState.errorEmitted=!0,v(t,i),B(t,e))}(t,r,i,e,n);else{var o=D(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||x(t,r),i?s(M,t,r,o,n):M(t,r,o,n)}}(i,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==r.emitClose,this.autoDestroy=!!r.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function E(e){var r=this instanceof t.Duplex;if(!r&&!h.call(E,this))return new E(e);this._writableState=new S(e,this,r),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)),i.call(this)}function T(t,e,r,i,n,o,s){e.writelen=i,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new y("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function M(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),B(t,e)}function x(t,r){r.bufferProcessing=!0;var i=r.bufferedRequest;if(t._writev&&i&&i.next){var n=r.bufferedRequestCount,o=new Array(n),s=r.corkedRequestsFree;s.entry=i;for(var a=0,h=!0;i;)o[a]=i,i.isBuf||(h=!1),i=i.next,a+=1;o.allBuffers=h,T(t,r,!0,r.length,o,"",s.finish),r.pendingcb++,r.lastBufferedRequest=null,s.next?(r.corkedRequestsFree=s.next,s.next=null):r.corkedRequestsFree=new e(r),r.bufferedRequestCount=0}else{for(;i;){var u=i.chunk,c=i.encoding,l=i.callback;if(T(t,r,!1,r.objectMode?1:u.length,u,c,l),i=i.next,r.bufferedRequestCount--,r.writing)break}null===i&&(r.lastBufferedRequest=null)}r.bufferedRequest=i,r.bufferProcessing=!1}function D(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function L(t,e){t._final((function(r){e.pendingcb--,r&&v(t,r),e.prefinished=!0,t.emit("prefinish"),B(t,e)}))}function B(t,e){var r=D(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,s(L,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}return R()(E,i),S.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(S.prototype,"buffer",{get:r.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(E,Symbol.hasInstance,{value:function(t){return!!h.call(this,t)||this===E&&(t&&t._writableState instanceof S)}})):h=function(t){return t instanceof this},E.prototype.pipe=function(){v(this,new _)},E.prototype.write=function(t,e,r){var i,o=this._writableState,h=!1,u=!o.objectMode&&(i=t,n.isBuffer(i)||i instanceof a);return u&&!n.isBuffer(t)&&(t=function(t){return n.from(t)}(t)),"function"==typeof e&&(r=e,e=null),u?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof r&&(r=m),o.ending?function(t,e){var r=new g;v(t,r),s(e,r)}(this,r):(u||function(t,e,r,i){var n;return null===r?n=new b:"string"==typeof r||e.objectMode||(n=new f("chunk",["string","Buffer"],r)),!n||(v(t,n),s(i,n),!1)}(this,o,t,r))&&(o.pendingcb++,h=function(t,e,r,i,o,s){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=n.from(e,r));return e}(e,i,o);i!==a&&(r=!0,o="buffer",i=a)}var h=e.objectMode?1:i.length;e.length+=h;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:o,isBuf:r,callback:s,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else T(t,e,!1,h,i,o,s);return u}(this,o,u,t,e,r)),h},E.prototype.cork=function(){this._writableState.corked++},E.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||x(this,t))},E.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new w(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(t,e,r){r(new d("_write()"))},E.prototype._writev=null,E.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,B(t,e),r&&(e.finished?s(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),E.prototype.destroy=u.destroy,E.prototype._undestroy=u.undestroy,E.prototype._destroy=function(t,e){e(t)},lt}var pt,_t={};var yt,bt={};var gt,wt,vt,mt,St,Et,kt,Rt,Tt,Mt,xt={};function Dt(){if(vt)return wt;var t;vt=1;var e=z().codes,r=e.ERR_MISSING_ARGS,i=e.ERR_STREAM_DESTROYED;function n(t){if(t)throw t}function o(t){t()}function s(t,e){return t.pipe(e)}return wt=function(){for(var e=arguments.length,a=new Array(e),h=0;h<e;h++)a[h]=arguments[h];var u,c=function(t){return t.length?"function"!=typeof t[t.length-1]?n:t.pop():n}(a);if(Array.isArray(a[0])&&(a=a[0]),a.length<2)throw new r("streams");var l=a.map((function(e,r){var n=r<a.length-1;return function(e,r,n,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;e.on("close",(function(){s=!0})),void 0===t&&(t=ot()),t(e,{readable:r,writable:n},(function(t){if(t)return o(t);s=!0,o()}));var a=!1;return function(t){if(!s&&!a)return a=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new i("pipe"))}}(e,n,r>0,(function(t){u||(u=t),t&&l.forEach(o),n||(l.forEach(o),c(u))}))}));return a.reduce(s)},wt}function Lt(){return mt||(mt=1,function(t,e){const r=O();at(),dt(),function(){if(pt)return _t;pt=1;var t=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};const e=O();e.Duplex=o,R()(o,e.Readable);for(var r=t(e.Writable.prototype),i=0;i<r.length;i++){var n=r[i];o.prototype[n]||(o.prototype[n]=e.Writable.prototype[n])}function o(t){if(!(this instanceof o))return new o(t);e.Readable.call(this,t),e.Writable.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||s(h,this)}function h(t){t.end()}Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}(),function(){if(yt)return bt;yt=1;const t=O();t.Transform=a;var e=z().codes,r=e.ERR_METHOD_NOT_IMPLEMENTED,i=e.ERR_MULTIPLE_CALLBACK,n=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=e.ERR_TRANSFORM_WITH_LENGTH_0;function s(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new i);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function a(e){if(!(this instanceof a))return new a(e);t.Duplex.call(this,e),this._transformState={afterTransform:s.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",h)}function h(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?u(this,null,null):this._flush((function(e,r){u(t,e,r)}))}function u(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new o;if(t._transformState.transforming)throw new n;return t.push(null)}R()(a,t.Duplex),a.prototype.push=function(e,r){return this._transformState.needTransform=!1,t.Duplex.prototype.push.call(this,e,r)},a.prototype._transform=function(t,e,i){i(new r("_transform()"))},a.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},a.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},a.prototype._destroy=function(e,r){t.Duplex.prototype._destroy.call(this,e,(function(t){r(t)}))}}(),function(){if(gt)return xt;gt=1;const t=O();function e(t){if(!(this instanceof e))return new e(t);Transform.call(this,t)}t.PassThrough=e,R()(e,t.Transform),e.prototype._transform=function(t,e,r){r(null,t)}}(),(e=t.exports=r.Readable).Stream=r.Readable,e.Readable=r.Readable,e.Writable=r.Writable,e.Duplex=r.Duplex,e.Transform=r.Transform,e.PassThrough=r.PassThrough,e.finished=ot(),e.pipeline=Dt()}(L,L.exports)),L.exports}function Ot(){if(Et)return St;Et=1;var t=w().Buffer,e=Lt();function r(r){e.Stream.Transform.call(this),this._block=t.allocUnsafe(r),this._blockSize=r,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return R()(r,e.Stream.Transform),r.prototype._transform=function(t,e,r){var i=null;try{this.update(t,e)}catch(t){i=t}r(i)},r.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},r.prototype.update=function(e,r){if(function(e,r){if(!t.isBuffer(e)&&"string"!=typeof e)throw new TypeError(r+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");t.isBuffer(e)||(e=t.from(e,r));for(var i=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)i[o++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)i[this._blockOffset++]=e[n++];for(var s=0,a=8*e.length;a>0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},r.prototype._update=function(){throw new Error("_update is not implemented")},r.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},r.prototype._digest=function(){throw new Error("_digest is not implemented")},St=r}var Bt,It,Pt,Ct,At,Kt,jt,Nt,Ut,Vt,qt,Wt,Ft,Ht,$t,zt={exports:{}};function Gt(){if(It)return Bt;It=1;var t=w().Buffer;function e(e,r){this._block=t.alloc(e),this._finalSize=r,this._blockSize=e,this._len=0}return e.prototype.update=function(e,r){"string"==typeof e&&(r=r||"utf8",e=t.from(e,r));for(var i=this._block,n=this._blockSize,o=e.length,s=this._len,a=0;a<o;){for(var h=s%n,u=Math.min(o-a,n-h),c=0;c<u;c++)i[h+c]=e[a+c];a+=u,(s+=u)%n==0&&this._update(i)}return this._len+=o,this},e.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},e.prototype._update=function(){throw new Error("_update must be implemented by subclass")},Bt=e}function Xt(){if(Nt)return jt;Nt=1;var t=R(),e=Gt(),r=w().Buffer,i=[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],n=new Array(64);function o(){this.init(),this._w=n,e.call(this,64,56)}function s(t,e,r){return r^t&(e^r)}function a(t,e,r){return t&e|r&(t|e)}function h(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function u(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function c(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}return t(o,e),o.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},o.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,o=0|this._b,l=0|this._c,f=0|this._d,d=0|this._e,p=0|this._f,_=0|this._g,y=0|this._h,b=0;b<16;++b)r[b]=t.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((e=r[b-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[b-7]+c(r[b-15])+r[b-16];for(var g=0;g<64;++g){var w=y+u(d)+s(d,p,_)+i[g]+r[g]|0,v=h(n)+a(n,o,l)|0;y=_,_=p,p=d,d=f+w|0,f=l,l=o,o=n,n=w+v|0}this._a=n+this._a|0,this._b=o+this._b|0,this._c=l+this._c|0,this._d=f+this._d|0,this._e=d+this._e|0,this._f=p+this._f|0,this._g=_+this._g|0,this._h=y+this._h|0},o.prototype._hash=function(){var t=r.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},jt=o}function Jt(){if(Wt)return qt;Wt=1;var t=R(),e=Gt(),r=w().Buffer,i=[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],n=new Array(160);function o(){this.init(),this._w=n,e.call(this,128,112)}function s(t,e,r){return r^t&(e^r)}function a(t,e,r){return t&e|r&(t|e)}function h(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function u(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function c(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function l(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function f(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function d(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function p(t,e){return t>>>0<e>>>0?1:0}return t(o,e),o.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},o.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,o=0|this._ch,_=0|this._dh,y=0|this._eh,b=0|this._fh,g=0|this._gh,w=0|this._hh,v=0|this._al,m=0|this._bl,S=0|this._cl,E=0|this._dl,k=0|this._el,R=0|this._fl,T=0|this._gl,M=0|this._hl,x=0;x<32;x+=2)e[x]=t.readInt32BE(4*x),e[x+1]=t.readInt32BE(4*x+4);for(;x<160;x+=2){var D=e[x-30],L=e[x-30+1],O=c(D,L),B=l(L,D),I=f(D=e[x-4],L=e[x-4+1]),P=d(L,D),C=e[x-14],A=e[x-14+1],K=e[x-32],j=e[x-32+1],N=B+A|0,U=O+C+p(N,B)|0;U=(U=U+I+p(N=N+P|0,P)|0)+K+p(N=N+j|0,j)|0,e[x]=U,e[x+1]=N}for(var V=0;V<160;V+=2){U=e[V],N=e[V+1];var q=a(r,n,o),W=a(v,m,S),F=h(r,v),H=h(v,r),$=u(y,k),z=u(k,y),G=i[V],X=i[V+1],J=s(y,b,g),Y=s(k,R,T),Q=M+z|0,Z=w+$+p(Q,M)|0;Z=(Z=(Z=Z+J+p(Q=Q+Y|0,Y)|0)+G+p(Q=Q+X|0,X)|0)+U+p(Q=Q+N|0,N)|0;var tt=H+W|0,et=F+q+p(tt,H)|0;w=g,M=T,g=b,T=R,b=y,R=k,y=_+Z+p(k=E+Q|0,E)|0,_=o,E=S,o=n,S=m,n=r,m=v,r=Z+et+p(v=Q+tt|0,Q)|0}this._al=this._al+v|0,this._bl=this._bl+m|0,this._cl=this._cl+S|0,this._dl=this._dl+E|0,this._el=this._el+k|0,this._fl=this._fl+R|0,this._gl=this._gl+T|0,this._hl=this._hl+M|0,this._ah=this._ah+r+p(this._al,v)|0,this._bh=this._bh+n+p(this._bl,m)|0,this._ch=this._ch+o+p(this._cl,S)|0,this._dh=this._dh+_+p(this._dl,E)|0,this._eh=this._eh+y+p(this._el,k)|0,this._fh=this._fh+b+p(this._fl,R)|0,this._gh=this._gh+g+p(this._gl,T)|0,this._hh=this._hh+w+p(this._hl,M)|0},o.prototype._hash=function(){var t=r.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},qt=o}function Yt(){if($t)return zt.exports;$t=1;var t=zt.exports=function(e){e=e.toLowerCase();var r=t[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r};return t.sha=function(){if(Ct)return Pt;Ct=1;var t=R(),e=Gt(),r=w().Buffer,i=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function o(){this.init(),this._w=n,e.call(this,64,56)}function s(t){return t<<30|t>>>2}function a(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}return t(o,e),o.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},o.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,o=0|this._b,h=0|this._c,u=0|this._d,c=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=r[l-3]^r[l-8]^r[l-14]^r[l-16];for(var f=0;f<80;++f){var d=~~(f/20),p=0|((e=n)<<5|e>>>27)+a(d,o,h,u)+c+r[f]+i[d];c=u,u=h,h=s(o),o=n,n=p}this._a=n+this._a|0,this._b=o+this._b|0,this._c=h+this._c|0,this._d=u+this._d|0,this._e=c+this._e|0},o.prototype._hash=function(){var t=r.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},Pt=o}(),t.sha1=function(){if(Kt)return At;Kt=1;var t=R(),e=Gt(),r=w().Buffer,i=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function o(){this.init(),this._w=n,e.call(this,64,56)}function s(t){return t<<5|t>>>27}function a(t){return t<<30|t>>>2}function h(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}return t(o,e),o.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},o.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,o=0|this._b,u=0|this._c,c=0|this._d,l=0|this._e,f=0;f<16;++f)r[f]=t.readInt32BE(4*f);for(;f<80;++f)r[f]=(e=r[f-3]^r[f-8]^r[f-14]^r[f-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),_=s(n)+h(p,o,u,c)+l+r[d]+i[p]|0;l=c,c=u,u=a(o),o=n,n=_}this._a=n+this._a|0,this._b=o+this._b|0,this._c=u+this._c|0,this._d=c+this._d|0,this._e=l+this._e|0},o.prototype._hash=function(){var t=r.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},At=o}(),t.sha224=function(){if(Vt)return Ut;Vt=1;var t=R(),e=Xt(),r=Gt(),i=w().Buffer,n=new Array(64);function o(){this.init(),this._w=n,r.call(this,64,56)}return t(o,e),o.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},o.prototype._hash=function(){var t=i.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},Ut=o}(),t.sha256=Xt(),t.sha384=function(){if(Ht)return Ft;Ht=1;var t=R(),e=Jt(),r=Gt(),i=w().Buffer,n=new Array(160);function o(){this.init(),this._w=n,r.call(this,128,112)}return t(o,e),o.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},o.prototype._hash=function(){var t=i.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},Ft=o}(),t.sha512=Jt(),zt.exports}var Qt,Zt,te,ee,re=h(u);var ie,ne=function(){if(ee)return te;ee=1;var t=R(),e=function(){if(Rt)return kt;Rt=1;var t=R(),e=Ot(),r=w().Buffer,i=new Array(16);function n(){e.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function o(t,e){return t<<e|t>>>32-e}function s(t,e,r,i,n,s,a){return o(t+(e&r|~e&i)+n+s|0,a)+e|0}function a(t,e,r,i,n,s,a){return o(t+(e&i|r&~i)+n+s|0,a)+e|0}function h(t,e,r,i,n,s,a){return o(t+(e^r^i)+n+s|0,a)+e|0}function u(t,e,r,i,n,s,a){return o(t+(r^(e|~i))+n+s|0,a)+e|0}return t(n,e),n.prototype._update=function(){for(var t=i,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,o=this._c,c=this._d;r=s(r,n,o,c,t[0],3614090360,7),c=s(c,r,n,o,t[1],3905402710,12),o=s(o,c,r,n,t[2],606105819,17),n=s(n,o,c,r,t[3],3250441966,22),r=s(r,n,o,c,t[4],4118548399,7),c=s(c,r,n,o,t[5],1200080426,12),o=s(o,c,r,n,t[6],2821735955,17),n=s(n,o,c,r,t[7],4249261313,22),r=s(r,n,o,c,t[8],1770035416,7),c=s(c,r,n,o,t[9],2336552879,12),o=s(o,c,r,n,t[10],4294925233,17),n=s(n,o,c,r,t[11],2304563134,22),r=s(r,n,o,c,t[12],1804603682,7),c=s(c,r,n,o,t[13],4254626195,12),o=s(o,c,r,n,t[14],2792965006,17),r=a(r,n=s(n,o,c,r,t[15],1236535329,22),o,c,t[1],4129170786,5),c=a(c,r,n,o,t[6],3225465664,9),o=a(o,c,r,n,t[11],643717713,14),n=a(n,o,c,r,t[0],3921069994,20),r=a(r,n,o,c,t[5],3593408605,5),c=a(c,r,n,o,t[10],38016083,9),o=a(o,c,r,n,t[15],3634488961,14),n=a(n,o,c,r,t[4],3889429448,20),r=a(r,n,o,c,t[9],568446438,5),c=a(c,r,n,o,t[14],3275163606,9),o=a(o,c,r,n,t[3],4107603335,14),n=a(n,o,c,r,t[8],1163531501,20),r=a(r,n,o,c,t[13],2850285829,5),c=a(c,r,n,o,t[2],4243563512,9),o=a(o,c,r,n,t[7],1735328473,14),r=h(r,n=a(n,o,c,r,t[12],2368359562,20),o,c,t[5],4294588738,4),c=h(c,r,n,o,t[8],2272392833,11),o=h(o,c,r,n,t[11],1839030562,16),n=h(n,o,c,r,t[14],4259657740,23),r=h(r,n,o,c,t[1],2763975236,4),c=h(c,r,n,o,t[4],1272893353,11),o=h(o,c,r,n,t[7],4139469664,16),n=h(n,o,c,r,t[10],3200236656,23),r=h(r,n,o,c,t[13],681279174,4),c=h(c,r,n,o,t[0],3936430074,11),o=h(o,c,r,n,t[3],3572445317,16),n=h(n,o,c,r,t[6],76029189,23),r=h(r,n,o,c,t[9],3654602809,4),c=h(c,r,n,o,t[12],3873151461,11),o=h(o,c,r,n,t[15],530742520,16),r=u(r,n=h(n,o,c,r,t[2],3299628645,23),o,c,t[0],4096336452,6),c=u(c,r,n,o,t[7],1126891415,10),o=u(o,c,r,n,t[14],2878612391,15),n=u(n,o,c,r,t[5],4237533241,21),r=u(r,n,o,c,t[12],1700485571,6),c=u(c,r,n,o,t[3],2399980690,10),o=u(o,c,r,n,t[10],4293915773,15),n=u(n,o,c,r,t[1],2240044497,21),r=u(r,n,o,c,t[8],1873313359,6),c=u(c,r,n,o,t[15],4264355552,10),o=u(o,c,r,n,t[6],2734768916,15),n=u(n,o,c,r,t[13],1309151649,21),r=u(r,n,o,c,t[4],4149444226,6),c=u(c,r,n,o,t[11],3174756917,10),o=u(o,c,r,n,t[2],718787259,15),n=u(n,o,c,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+o|0,this._d=this._d+c|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=r.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},kt=n}(),r=function(){if(Mt)return Tt;Mt=1;var t=k.Buffer,e=R(),r=Ot(),i=new Array(16),n=[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],o=[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],s=[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],a=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],h=[0,1518500249,1859775393,2400959708,2840853838],u=[1352829926,1548603684,1836072691,2053994217,0];function c(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function l(t,e){return t<<e|t>>>32-e}function f(t,e,r,i,n,o,s,a){return l(t+(e^r^i)+o+s|0,a)+n|0}function d(t,e,r,i,n,o,s,a){return l(t+(e&r|~e&i)+o+s|0,a)+n|0}function p(t,e,r,i,n,o,s,a){return l(t+((e|~r)^i)+o+s|0,a)+n|0}function _(t,e,r,i,n,o,s,a){return l(t+(e&i|r&~i)+o+s|0,a)+n|0}function y(t,e,r,i,n,o,s,a){return l(t+(e^(r|~i))+o+s|0,a)+n|0}return e(c,r),c.prototype._update=function(){for(var t=i,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,c=0|this._b,b=0|this._c,g=0|this._d,w=0|this._e,v=0|this._a,m=0|this._b,S=0|this._c,E=0|this._d,k=0|this._e,R=0;R<80;R+=1){var T,M;R<16?(T=f(r,c,b,g,w,t[n[R]],h[0],s[R]),M=y(v,m,S,E,k,t[o[R]],u[0],a[R])):R<32?(T=d(r,c,b,g,w,t[n[R]],h[1],s[R]),M=_(v,m,S,E,k,t[o[R]],u[1],a[R])):R<48?(T=p(r,c,b,g,w,t[n[R]],h[2],s[R]),M=p(v,m,S,E,k,t[o[R]],u[2],a[R])):R<64?(T=_(r,c,b,g,w,t[n[R]],h[3],s[R]),M=d(v,m,S,E,k,t[o[R]],u[3],a[R])):(T=y(r,c,b,g,w,t[n[R]],h[4],s[R]),M=f(v,m,S,E,k,t[o[R]],u[4],a[R])),r=w,w=g,g=l(b,10),b=c,c=T,v=k,k=E,E=l(S,10),S=m,m=M}var x=this._b+b+E|0;this._b=this._c+g+k|0,this._c=this._d+w+v|0,this._d=this._e+r+m|0,this._e=this._a+c+S|0,this._a=x},c.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=t.alloc?t.alloc(20):new t(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},Tt=c}(),i=Yt(),n=function(){if(Zt)return Qt;Zt=1;var t=w().Buffer,e=S.Transform,r=re.StringDecoder;function i(t){e.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}return R()(i,e),i.prototype.update=function(e,r,i){"string"==typeof e&&(e=t.from(e,r));var n=this._update(e);return this.hashMode?this:(i&&(n=this._toString(n,i)),n)},i.prototype.setAutoPadding=function(){},i.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},i.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},i.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},i.prototype._transform=function(t,e,r){var i;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){i=t}finally{r(i)}},i.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},i.prototype._finalOrDigest=function(e){var r=this.__final()||t.alloc(0);return e&&(r=this._toString(r,e,!0)),r},i.prototype._toString=function(t,e,i){if(this._decoder||(this._decoder=new r(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return i&&(n+=this._decoder.end()),n},Qt=i}();function o(t){n.call(this,"digest"),this._hash=t}return t(o,n),o.prototype._update=function(t){this._hash.update(t)},o.prototype._final=function(){return this._hash.digest()},te=function(t){return"md5"===(t=t.toLowerCase())?new e:"rmd160"===t||"ripemd160"===t?new r:new o(i(t))}}(),oe=a(ne),se={exports:{}};var ae,he,ue,ce,le,fe,de=a(function(){if(ie)return se.exports;ie=1;var t=65536,e=4294967295,r=w().Buffer,i=o.crypto||o.msCrypto;return i&&i.getRandomValues?se.exports=function(n,o){if(n>e)throw new RangeError("requested too many random bytes");var a=r.allocUnsafe(n);if(n>0)if(n>t)for(var h=0;h<n;h+=t)i.getRandomValues(a.slice(h,h+t));else i.getRandomValues(a);if("function"==typeof o)return s((function(){o(null,a)}));return a}:se.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")},se.exports}());var pe=function(){if(fe)return le;fe=1;const{CryptoLD:t}=(he||(he=1,ae={CryptoLD:class{constructor({suites:t}={}){this.suites=t||new Map}use(t){this.suites.set(t.suite,t)}async generate(t={}){return this._suiteForType(t).generate(t)}async from(t={}){const e=this._suiteForType(t);return t["@context"]?e.fromKeyDocument({document:t}):e.from(t)}async fromKeyDocument({document:t,checkContext:e=!0,checkRevoked:r=!0}={}){if(!t)throw new TypeError('The "document" parameter is required.');return this._suiteForType(t).fromKeyDocument({document:t,checkContext:e,checkRevoked:r})}async fromKeyId({id:t,documentLoader:e,checkContext:r=!0,checkRevoked:i=!0}={}){if(!t)throw new TypeError('The "id" parameter is required.');if(!e)throw new TypeError('The "documentLoader" parameter is required.');let n;try{if(({document:n}=await e(t)),!n)throw new Error('The "documentLoader" function must return a "document" object.')}catch(t){const e=new Error("Error fetching document: "+t.message);throw e.cause=t,e}const o=n.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:n,checkContext:r,checkRevoked:i})}_installed({type:t}){return this.suites.has(t)}_suiteForType(t){const e=t&&t.type;if(!e)throw new TypeError("Missing key type.");if(!this._installed({type:e}))throw new Error(`Support for key type "${e}" is not installed.`);return this.suites.get(e)}}}),ae),{LDKeyPair:e}=function(){if(ce)return ue;ce=1;class t{constructor({id:t,controller:e,revoked:r}={}){this.id=t,this.controller=e,this.revoked=r}static async generate(){throw new Error("Abstract method, must be implemented in subclass.")}static async fromKeyDocument({document:t,checkContext:e=!0,checkRevoked:r=!0}={}){if(!t)throw new TypeError('The "document" parameter is required.');if(e&&![].concat(t["@context"]).includes(this.SUITE_CONTEXT))throw new Error('Key document does not contain required context "'+this.SUITE_CONTEXT+'".');if(r&&t.revoked)throw new Error(`Key has been revoked since: "${t.revoked}".`);return this.from(t)}static async from(){throw new Error("Abstract method from() must be implemented in subclass.")}export({publicKey:t=!1,privateKey:e=!1}={}){if(!t&&!e)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.")}}}}return t.SUITE_CONTEXT="INVALID LDKeyPair CONTEXT",ue={LDKeyPair:t}}();return le={CryptoLD:t,LDKeyPair:e}}(),_e=a(pe);const ye="EcdsaSecp256k1VerificationKey2019",be=t=>oe("sha256").update(t).digest();class ge extends _e.LDKeyPair{constructor({publicKeyBase58:t,privateKeyBase58:e,...r}){if(super(r),this.type=void 0,this.publicKeyBase58=void 0,this.privateKeyBase58=void 0,e&&!t){const t=y.publicKeyCreate(f(e));this.publicKeyBase58=d(t)}else this.publicKeyBase58=t;if(this.type=ye,this.privateKeyBase58=e,!this.publicKeyBase58)throw new TypeError('The "publicKeyBase58" property is required.')}static from(e){if(e.publicKeyHex||e.privateKeyHex){const{publicKeyHex:r,privateKeyHex:i,...n}=e;return new ge({...n,publicKeyBase58:r?d(t.from(r,"hex")):void 0,privateKeyBase58:i?d(t.from(i,"hex")):void 0})}return new ge(e)}static async generate({seed:t,compressed:e,...r}){if(t&&!y.privateKeyVerify(t))throw new Error("Provided seed is not a valid private key");let i=t;for(;void 0===i||!y.privateKeyVerify(i);)i=new Uint8Array(de(32));const n=y.publicKeyCreate(i,e);return new ge({publicKeyBase58:d(n),privateKeyBase58:d(i),...r})}export({publicKey:t=!1,privateKey:e=!1,includeContext:r=!1}={}){if(!t&&!e)throw new TypeError('export requires specifying either "publicKey" or "privateKey".');if(e&&!this.privateKeyBase58)throw new TypeError("No privateKey to export.");if(t&&!this.publicKeyBase58)throw new TypeError("No publicKey to export.");const i={type:this.type,id:this.id,controller:this.controller,revoked:this.revoked};return r&&(i["@context"]=ge.SUITE_CONTEXT),e&&(i.privateKeyBase58=this.privateKeyBase58),t&&(i.publicKeyBase58=this.publicKeyBase58),i}signer(){const{privateKeyBase58:e}=this;return e?{async sign({data:r}){const i=b.encode(JSON.stringify({alg:"ES256K",b64:!1,crit:["b64"]})),n=t.from(r.buffer,r.byteOffset,r.length),o=be(t.from(t.concat([t.from(`${i}.`,"utf8"),t.from(n.buffer,n.byteOffset,n.length)]))),{signature:s}=y.ecdsaSign(o,f(e));return`${i}..${b.encode(t.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:r,signature:i}){if(i.indexOf("..")<0)return!1;const[n,o]=i.split(".."),s=JSON.parse(b.decode(n));if("ES256K"!==s.alg||!1!==s.b64||!s.crit||!s.crit.length||"b64"!==s.crit[0])return!1;const a=t.from(r.buffer,r.byteOffset,r.length),h=be(t.from(t.concat([t.from(`${n}.`,"utf8"),t.from(a.buffer,a.byteOffset,a.length)])));let u;try{u=y.ecdsaVerify(t.from(b.decode(o,"hex"),"hex"),h,f(e))}catch(t){u=!1}return u},id:this.id}:{async verify(){throw new Error("No public key to verify against")},id:this.id}}}ge.suite=ye,ge.SUITE_CONTEXT="https://ns.did.ai/suites/secp256k1-2019/v1";const we="https://ns.did.ai/suites/secp256k1-2019/v1",ve=({document:t,contextUrl:e})=>{const r=t["@context"];return r===e||Array.isArray(r)&&r.includes(e)},me=({document:t})=>{const e=ve({document:t,contextUrl:we}),r=ve({document:t,contextUrl:"https://www.w3.org/2018/credentials/v1"}),i=ve({document:t,contextUrl:"https://w3id.org/security/v2"});return e&&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):e&&i?(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):e||r||i};let Se=class extends p.suites.LinkedDataSignature{constructor(t={}){super({type:"EcdsaSecp256k1Signature2019",LDKeyClass:ge,contextUrl:we,...t}),this.requiredKeyType=void 0,this.requiredKeyType="EcdsaSecp256k1VerificationKey2019"}async sign({verifyData:t,proof:e}){if(!this.signer||"function"!=typeof this.signer.sign)throw new Error("A signer API has not been specified.");return{...e,jws:await this.signer.sign({data:t})}}async verifySignature({verifyData:t,verificationMethod:e,proof:r}){const{jws:i}=r;if(!i||"string"!=typeof i)throw new TypeError('The proof does not include a valid "jws" property.');let{verifier:n}=this;if(!n){n=(await this.LDKeyClass.from(e)).verifier()}return n.verify({data:t,signature:i})}async assertVerificationMethod({verificationMethod:t}){if(!me({document:t}))throw new TypeError(`The verification method (key) must contain "${this.contextUrl}".`);if(!_.hasValue(t,"type",this.requiredKeyType))throw new Error(`Invalid key type. Key type must be "${this.requiredKeyType}".`);if(void 0!==t.revoked)throw new Error("The verification method has been revoked.")}async getVerificationMethod({proof:t,documentLoader:e}){if(this.key)return this.key.export({publicKey:!0});const r="object"==typeof t.verificationMethod?t.verificationMethod.id:t.verificationMethod;if(!r)throw new Error('No "verificationMethod" found in proof.');const i=await _.frame(r,{"@context":this.contextUrl,"@embed":"@always",id:r},{documentLoader:e,compactToRelative:!1});if(!i)throw new Error(`Verification method ${r} not found.`);if(void 0!==i.revoked)throw new Error("The verification method has been revoked.");return await this.assertVerificationMethod({verificationMethod:i}),i}async matchProof({proof:t,document:e,purpose:r,documentLoader:i,expansionMap:n}){if(!me({document:e}))return!1;if(!await super.matchProof({proof:t,document:e,purpose:r,documentLoader:i,expansionMap:n}))return!1;if(!this.key)return!0;const{verificationMethod:o}=t,s="object"==typeof o?o.id:o;return this.isVerificationMethodMatchingKeyId(s)}ensureSuiteContext({document:t,addSuiteContext:e}){me({document:t})||super.ensureSuiteContext({document:t,addSuiteContext:e})}isVerificationMethodMatchingKeyId(t){return t===this.key.id||t===`${this.key.controller}${this.key.id}`}};Se.CONTEXT_URL=we,Se.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"}}}}};var Ee=a(g());const ke="undefined"==typeof Buffer?t:Buffer,{purposes:{AssertionProofPurpose:Re,AuthenticationProofPurpose:Te}}=p;var Me;!function(t){t.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",t.checkDocumentSignature="checkDocumentSignature"}(Me||(Me={}));class xe extends T{verificationProcess=[Me.retrieveVerificationMethodPublicKey,Me.checkDocumentSignature];documentToVerify;issuer;proof;type="EcdsaSecp256k1Signature2019";verificationKey;publicKey;proofPurpose;challenge;domain;proofPurposeMap;constructor(t){super(t),t.executeStep&&(this.executeStep=t.executeStep),this.documentToVerify=t.document,this.issuer=t.issuer,this.proof=t.proof,this.proofPurpose=t.proofPurpose??"assertionMethod",this.challenge=t.proofChallenge??"",this.domain=t.proofDomain,this.proofPurposeMap={authentication:Te,assertionMethod:Re},this.validateProofType()}async init(){}async verifyProof(){for(const t of this.verificationProcess){if(!this[t])return void console.error("verification logic for",t,"not implemented");await this[t]()}}async verifyIdentity(){}getProofVerificationSteps(t){return this.verificationProcess.map((r=>e.verifier.convertToVerificationSubsteps(t,r)))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return this.publicKey}getIssuerName(){return this.issuer.name??""}getIssuerProfileDomain(){try{return new URL(this.getIssuerProfileUrl()).hostname??""}catch(t){return""}}getIssuerProfileUrl(){return this.issuer.id??""}getSigningDate(){return this.proof.created}async executeStep(t,e,r){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}validateProofType(){const t=this.isProofChain()?this.proof.chainedProofType:this.proof.type;if(t!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${t}`)}isProofChain(){return"ChainedProof2021"===this.proof.type}generateDocumentLoader(){r[this.documentToVerify.issuer]=this.getTargetVerificationMethodContainer();return function(t){return t in r?{contextUrl:null,document:r[t],documentUrl:t}:_.documentLoader(t)}}retrieveInitialDocument(){const t=i(this.documentToVerify);if(Array.isArray(t.proof)){const e=t.proof.find((t=>t.type===this.type));delete t.proof,t.proof=e}return t}getTargetVerificationMethodContainer(){return this.issuer.didDocument??this.issuer}getErrorMessage(t){return t.error.errors[0].message}async retrieveVerificationMethodPublicKey(){this.verificationKey=await this.executeStep(Me.retrieveVerificationMethodPublicKey,(async()=>{const t=M(this.getTargetVerificationMethodContainer(),this.proof.verificationMethod);if(t.publicKeyJwk&&!t.publicKeyBase58){const r=(t=>{const e=v.from({...t,crv:"K-256"},"jwk").toString("blk","public"),r=m.publicKeyConvert(ke.from(e,"hex"),!0);return ke.from(r).toString("hex")})(t.publicKeyJwk);t.publicKeyBase58=(e=r,Ee.encode(ke.from(e,"hex")))}var e;this.publicKey=t.publicKeyBase58;const r=ge.from({...t});if(!r)throw new n(Me.retrieveVerificationMethodPublicKey,"Could not derive the verification key");if(r.revoked)throw new n(Me.retrieveVerificationMethodPublicKey,"The verification key has been revoked");return r}),this.type)}async checkDocumentSignature(){await this.executeStep(Me.checkDocumentSignature,(async()=>{const t=new Se({key:this.verificationKey});t.date=new Date(Date.now()).toISOString(),"authentication"!==this.proofPurpose||this.proof.challenge||(this.proof.challenge="");const e=await p.verify(this.retrieveInitialDocument(),{suite:t,purpose:new this.proofPurposeMap[this.proofPurpose]({challenge:this.challenge,domain:this.domain}),documentLoader:this.generateDocumentLoader()});if(!e.verified)throw console.error(JSON.stringify(e,null,2)),new n(Me.checkDocumentSignature,`The document's ${this.type} signature could not be confirmed: ${this.getErrorMessage(e)}`);console.log("Credential Secp256k1 signature successfully verified")}),this.type)}}export{xe as default};
1
+ import{B as t,d as e,f as r,e as i,V as n,k as o,t as s,g as a,u as h,v as u,p as c,w as l}from"./main.js";import{d as f,e as d,j as p}from"./index-BEHg4rC3-AHOWkvj-.js";import{j as _}from"./jsonld-Cuz6c95c-CQeQQNYP.js";import{e as y,d as b,a as g,r as w,k as v,s as m,c as E,b as S}from"./index-BC_5sEeg-CEsb2-mf.js";import{a as k,b as R}from"./elliptic-e2d4_kYF-DQmYEk-8.js";import{S as T}from"./Suite-B7Vy9AuU-D1ucdMDB.js";import"./pako.esm-DnD5dZGi-Bw1vqMku.js";import"./sha256-mf0I6iCn-C1PUWFZm.js";import"./index-DuuEF8T4-Dgus2xdV.js";import{r as M}from"./retrieveVerificationMethodPublicKey-CogYoUma-CqFMEtDL.js";var x,D,L={exports:{}};function C(){return D?x:(D=1,x={})}var O,I,P,B,A,K,j={},N=h(l);function U(){return I?O:(I=1,O=N.EventEmitter)}function V(){if(B)return P;function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function r(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}(t.prototype,e),t}B=1;var i=k.Buffer,n=S.inspect,o=n&&n.custom||"inspect";return P=function(){function s(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),this.head=null,this.tail=null,this.length=0}return r(s,[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return i.alloc(0);for(var e,r,n,o=i.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,r=o,n=a,i.prototype.copy.call(e,r,n),a+=s.data.length,s=s.next;return o}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,i=e.data;for(t-=i.length;e=e.next;){var n=e.data,o=t>n.length?n.length:t;if(o===n.length?i+=n:i+=n.slice(0,t),0===(t-=o)){o===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=i.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(o.copy(e,e.length-t,0,s),0===(t-=s)){s===o.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(s));break}++n}return this.length-=n,e}},{key:o,value:function(r,i){return n(this,function(r){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?t(Object(n),!0).forEach((function(t){e(r,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))}))}return r}({},i,{depth:0,customInspect:!1}))}}]),s}(),P}function q(){if(K)return A;function t(t,i){r(t,i),e(t)}function e(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function r(t,e){t.emit("error",e)}return K=1,A={destroy:function(i,n){var o=this,a=this._readableState&&this._readableState.destroyed,h=this._writableState&&this._writableState.destroyed;return a||h?(n?n(i):i&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,s(r,this,i)):s(r,this,i)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(i||null,(function(r){!n&&r?o._writableState?o._writableState.errorEmitted?s(e,o):(o._writableState.errorEmitted=!0,s(t,o,r)):s(t,o,r):n?(s(e,o),n(r)):s(e,o)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}}}var W,F,H,z={};function $(){if(W)return z;W=1;var t={};function e(e,r,i){i||(i=Error);var n=function(t){var e,i;function n(e,i,n){return t.call(this,function(t,e,i){return"string"==typeof r?r:r(t,e,i)}(e,i,n))||this}return i=t,(e=n).prototype=Object.create(i.prototype),e.prototype.constructor=e,e.__proto__=i,n}(i);n.prototype.name=i.name,n.prototype.code=e,t[e]=n}function r(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}return e("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),e("ERR_INVALID_ARG_TYPE",(function(t,e,i){var n,o,s;if("string"==typeof e&&(o="not ",e.substr(0,o.length)===o)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(n," ").concat(r(e,"type"));else{var a=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(a," ").concat(n," ").concat(r(e,"type"))}return s+=". Received type ".concat(typeof i)}),TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),z.codes=t,z}function G(){if(H)return F;H=1;var t=$().codes.ERR_INVALID_OPT_VALUE;return F={getHighWaterMark:function(e,r,i,n){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(r,n,i);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new t(n?i:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}}var X,Y,J,Z,Q,tt,et,rt,it={};function nt(){if(X)return it;X=1;var t=w().Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var i;switch(this.encoding=function(r){var i=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof i&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return i||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,i=4;break;case"utf8":this.fillLast=n,i=4;break;case"base64":this.text=a,this.end=h,i=3;break;default:return this.write=u,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(i)}function i(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function n(t){var e=this.lastTotal-this.lastNeed,r=function(t,e){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function o(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function s(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function a(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function u(t){return t.toString(this.encoding)}function c(t){return t&&t.length?this.write(t):""}return it.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var o=i(e[n]);if(o>=0)return o>0&&(t.lastNeed=o-1),o;if(--n<r||-2===o)return 0;if(o=i(e[n]),o>=0)return o>0&&(t.lastNeed=o-2),o;if(--n<r||-2===o)return 0;if(o=i(e[n]),o>=0)return o>0&&(2===o?o=0:t.lastNeed=o-3),o;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},it}function ot(){if(J)return Y;J=1;var t=$().codes.ERR_STREAM_PREMATURE_CLOSE;function e(){}return Y=function r(i,n,o){if("function"==typeof n)return r(i,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}(o||e);var s=n.readable||!1!==n.readable&&i.readable,a=n.writable||!1!==n.writable&&i.writable,h=function(){i.writable||c()},u=i._writableState&&i._writableState.finished,c=function(){a=!1,u=!0,s||o.call(i)},l=i._readableState&&i._readableState.endEmitted,f=function(){s=!1,l=!0,a||o.call(i)},d=function(t){o.call(i,t)},p=function(){var e;return s&&!l?(i._readableState&&i._readableState.ended||(e=new t),o.call(i,e)):a&&!u?(i._writableState&&i._writableState.ended||(e=new t),o.call(i,e)):void 0},_=function(){i.req.on("finish",c)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(i)?a&&!i._writableState&&(i.on("end",h),i.on("close",h)):(i.on("complete",c),i.on("abort",p),i.req?_():i.on("request",_)),i.on("end",f),i.on("finish",c),!1!==n.error&&i.on("error",d),i.on("close",p),function(){i.removeListener("complete",c),i.removeListener("abort",p),i.removeListener("request",_),i.req&&i.req.removeListener("finish",c),i.removeListener("end",h),i.removeListener("close",h),i.removeListener("finish",c),i.removeListener("end",f),i.removeListener("error",d),i.removeListener("close",p)}},Y}function st(){if(Q)return Z;var t;function e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Q=1;var r=ot(),i=Symbol("lastResolve"),n=Symbol("lastReject"),o=Symbol("error"),a=Symbol("ended"),h=Symbol("lastPromise"),u=Symbol("handlePromise"),c=Symbol("stream");function l(t,e){return{value:t,done:e}}function f(t){var e=t[i];if(null!==e){var r=t[c].read();null!==r&&(t[h]=null,t[i]=null,t[n]=null,e(l(r,!1)))}}function d(t){s(f,t)}var p=Object.getPrototypeOf((function(){})),_=Object.setPrototypeOf((e(t={get stream(){return this[c]},next:function(){var t=this,e=this[o];if(null!==e)return Promise.reject(e);if(this[a])return Promise.resolve(l(void 0,!0));if(this[c].destroyed)return new Promise((function(e,r){s((function(){t[o]?r(t[o]):e(l(void 0,!0))}))}));var r,i=this[h];if(i)r=new Promise(function(t,e){return function(r,i){t.then((function(){e[a]?r(l(void 0,!0)):e[u](r,i)}),i)}}(i,this));else{var n=this[c].read();if(null!==n)return Promise.resolve(l(n,!1));r=new Promise(this[u])}return this[h]=r,r}},Symbol.asyncIterator,(function(){return this})),e(t,"return",(function(){var t=this;return new Promise((function(e,r){t[c].destroy(null,(function(t){t?r(t):e(l(void 0,!0))}))}))})),t),p);return Z=function(t){var s,f=Object.create(_,(e(s={},c,{value:t,writable:!0}),e(s,i,{value:null,writable:!0}),e(s,n,{value:null,writable:!0}),e(s,o,{value:null,writable:!0}),e(s,a,{value:t._readableState.endEmitted,writable:!0}),e(s,u,{value:function(t,e){var r=f[c].read();r?(f[h]=null,f[i]=null,f[n]=null,t(l(r,!1))):(f[i]=t,f[n]=e)},writable:!0}),s));return f[h]=null,r(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=f[n];return null!==e&&(f[h]=null,f[i]=null,f[n]=null,e(t)),void(f[o]=t)}var r=f[i];null!==r&&(f[h]=null,f[i]=null,f[n]=null,r(l(void 0,!0))),f[a]=!0})),t.on("readable",d.bind(null,f)),f}}function at(){if(rt)return j;rt=1;const t=C();t.Readable=M,M.ReadableState=T,N.EventEmitter;var e=function(t,e){return t.listeners(e).length},r=U(),i=k.Buffer,n=o.Uint8Array||function(){};var a,h=S;a=h&&h.debuglog?h.debuglog("stream"):function(){};var u,l,f,d=V(),p=q(),_=G().getHighWaterMark,y=$().codes,b=y.ERR_INVALID_ARG_TYPE,g=y.ERR_STREAM_PUSH_AFTER_EOF,w=y.ERR_METHOD_NOT_IMPLEMENTED,v=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;R()(M,r);var m=p.errorOrDestroy,E=["error","close","destroy","pause","resume"];function T(e,r,i){e=e||{},"boolean"!=typeof i&&(i=r instanceof t.Duplex),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=_(this,e,"readableHighWaterMark",i),this.buffer=new d,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&&(u||(u=nt().StringDecoder),this.decoder=new u(e.encoding),this.encoding=e.encoding)}function M(e){if(!(this instanceof M))return new M(e);var i=this instanceof t.Duplex;this._readableState=new T(e,this,i),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),r.call(this)}function x(t,e,r,o,s){a("readableAddChunk",e);var h,u=t._readableState;if(null===e)u.reading=!1,function(t,e){if(a("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?I(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,P(t)))}(t,u);else if(s||(h=function(t,e){var r;o=e,i.isBuffer(o)||o instanceof n||"string"==typeof e||void 0===e||t.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],e));var o;return r}(u,e)),h)m(t,h);else if(u.objectMode||e&&e.length>0)if("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===i.prototype||(e=function(t){return i.from(t)}(e)),o)u.endEmitted?m(t,new v):D(t,u,e,!0);else if(u.ended)m(t,new g);else{if(u.destroyed)return!1;u.reading=!1,u.decoder&&!r?(e=u.decoder.write(e),u.objectMode||0!==e.length?D(t,u,e,!1):B(t,u)):D(t,u,e,!1)}else o||(u.reading=!1,B(t,u));return!u.ended&&(u.length<u.highWaterMark||0===u.length)}function D(t,e,r,i){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&I(t)),B(t,e)}Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),M.prototype.destroy=p.destroy,M.prototype._undestroy=p.undestroy,M.prototype._destroy=function(t,e){e(t)},M.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=i.from(t,e),e=""),r=!0),x(this,t,e,!1,r)},M.prototype.unshift=function(t){return x(this,t,null,!0,!1)},M.prototype.isPaused=function(){return!1===this._readableState.flowing},M.prototype.setEncoding=function(t){u||(u=nt().StringDecoder);var e=new u(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var L=1073741824;function O(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=L?t=L:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function I(t){var e=t._readableState;a("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(a("emitReadable",e.flowing),e.emittedReadable=!0,s(P,t))}function P(t){var e=t._readableState;a("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,H(t)}function B(t,e){e.readingMore||(e.readingMore=!0,s(A,t,e))}function A(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(a("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function K(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function W(t){a("readable nexttick read 0"),t.read(0)}function F(t,e){a("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),H(t),e.flowing&&!e.reading&&t.read(0)}function H(t){var e=t._readableState;for(a("flow",e.flowing);e.flowing&&null!==t.read(););}function z(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function X(t){var e=t._readableState;a("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,s(Y,e,t))}function Y(t,e){if(a("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function J(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}return M.prototype.read=function(t){a("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return a("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?X(this):I(this),null;if(0===(t=O(t,e))&&e.ended)return 0===e.length&&X(this),null;var i,n=e.needReadable;return a("need readable",n),(0===e.length||e.length-t<e.highWaterMark)&&a("length less than watermark",n=!0),e.ended||e.reading?a("reading or ended",n=!1):n&&(a("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=O(r,e))),null===(i=t>0?z(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&X(this)),null!==i&&this.emit("data",i),i},M.prototype._read=function(t){m(this,new w("_read()"))},M.prototype.pipe=function(t,r){var i=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,a("pipe count=%d opts=%j",n.pipesCount,r);var o=(!r||!1!==r.end)&&t!==c.stdout&&t!==c.stderr?u:b;function h(e,r){a("onunpipe"),e===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,a("cleanup"),t.removeListener("close",_),t.removeListener("finish",y),t.removeListener("drain",l),t.removeListener("error",p),t.removeListener("unpipe",h),i.removeListener("end",u),i.removeListener("end",b),i.removeListener("data",d),f=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function u(){a("onend"),t.end()}n.endEmitted?s(o):i.once("end",o),t.on("unpipe",h);var l=function(t){return function(){var r=t._readableState;a("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&e(t,"data")&&(r.flowing=!0,H(t))}}(i);t.on("drain",l);var f=!1;function d(e){a("ondata");var r=t.write(e);a("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==J(n.pipes,t))&&!f&&(a("false write response, pause",n.awaitDrain),n.awaitDrain++),i.pause())}function p(r){a("onerror",r),b(),t.removeListener("error",p),0===e(t,"error")&&m(t,r)}function _(){t.removeListener("finish",y),b()}function y(){a("onfinish"),t.removeListener("close",_),b()}function b(){a("unpipe"),i.unpipe(t)}return i.on("data",d),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",p),t.once("close",_),t.once("finish",y),t.emit("pipe",i),n.flowing||(a("pipe resume"),i.resume()),t},M.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=J(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},M.prototype.on=function(t,e){var i=r.prototype.on.call(this,t,e),n=this._readableState;return"data"===t?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,a("on readable",n.length,n.reading),n.length?I(this):n.reading||s(W,this))),i},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(t,e){var i=r.prototype.removeListener.call(this,t,e);return"readable"===t&&s(K,this),i},M.prototype.removeAllListeners=function(t){var e=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||s(K,this),e},M.prototype.resume=function(){var t=this._readableState;return t.flowing||(a("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,s(F,t,e))}(this,t)),t.paused=!1,this},M.prototype.pause=function(){return a("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(a("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},M.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(a("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(a("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var o=0;o<E.length;o++)t.on(E[o],this.emit.bind(this,E[o]));return this._read=function(e){a("wrapped _read",e),i&&(i=!1,t.resume())},this},"function"==typeof Symbol&&(M.prototype[Symbol.asyncIterator]=function(){return void 0===l&&(l=st()),l(this)}),Object.defineProperty(M.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(M.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(M.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),M._fromList=z,Object.defineProperty(M.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(M.from=function(t,e){return void 0===f&&(f=et?tt:(et=1,tt=function(){throw new Error("Readable.from is not available in the browser")})),f(M,t,e)}),j}var ht,ut,ct,lt={};function ft(){if(ut)return ht;function t(t){try{if(!o.localStorage)return!1}catch(t){return!1}var e=o.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}return ut=1,ht=function(e,r){if(t("noDeprecation"))return e;var i=!1;return function(){if(!i){if(t("throwDeprecation"))throw new Error(r);t("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return e.apply(this,arguments)}},ht}function dt(){if(ct)return lt;ct=1;const t=C();function e(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}t.Writable=S,S.WritableState=E;var r={deprecate:ft()},i=U(),n=k.Buffer,a=o.Uint8Array||function(){};var h,u=q(),c=G().getHighWaterMark,l=$().codes,f=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,p=l.ERR_MULTIPLE_CALLBACK,_=l.ERR_STREAM_CANNOT_PIPE,y=l.ERR_STREAM_DESTROYED,b=l.ERR_STREAM_NULL_VALUES,g=l.ERR_STREAM_WRITE_AFTER_END,w=l.ERR_UNKNOWN_ENCODING,v=u.errorOrDestroy;function m(){}function E(r,i,n){r=r||{},"boolean"!=typeof n&&(n=i instanceof t.Duplex),this.objectMode=!!r.objectMode,n&&(this.objectMode=this.objectMode||!!r.writableObjectMode),this.highWaterMark=c(this,r,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===r.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=r.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if("function"!=typeof n)throw new p;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(s(n,i),s(O,t,e),t._writableState.errorEmitted=!0,v(t,i)):(n(i),t._writableState.errorEmitted=!0,v(t,i),O(t,e))}(t,r,i,e,n);else{var o=D(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||x(t,r),i?s(M,t,r,o,n):M(t,r,o,n)}}(i,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==r.emitClose,this.autoDestroy=!!r.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function S(e){var r=this instanceof t.Duplex;if(!r&&!h.call(S,this))return new S(e);this._writableState=new E(e,this,r),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)),i.call(this)}function T(t,e,r,i,n,o,s){e.writelen=i,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new y("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function M(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),O(t,e)}function x(t,r){r.bufferProcessing=!0;var i=r.bufferedRequest;if(t._writev&&i&&i.next){var n=r.bufferedRequestCount,o=new Array(n),s=r.corkedRequestsFree;s.entry=i;for(var a=0,h=!0;i;)o[a]=i,i.isBuf||(h=!1),i=i.next,a+=1;o.allBuffers=h,T(t,r,!0,r.length,o,"",s.finish),r.pendingcb++,r.lastBufferedRequest=null,s.next?(r.corkedRequestsFree=s.next,s.next=null):r.corkedRequestsFree=new e(r),r.bufferedRequestCount=0}else{for(;i;){var u=i.chunk,c=i.encoding,l=i.callback;if(T(t,r,!1,r.objectMode?1:u.length,u,c,l),i=i.next,r.bufferedRequestCount--,r.writing)break}null===i&&(r.lastBufferedRequest=null)}r.bufferedRequest=i,r.bufferProcessing=!1}function D(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function L(t,e){t._final((function(r){e.pendingcb--,r&&v(t,r),e.prefinished=!0,t.emit("prefinish"),O(t,e)}))}function O(t,e){var r=D(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,s(L,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}return R()(S,i),E.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(E.prototype,"buffer",{get:r.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(t){return!!h.call(this,t)||this===S&&(t&&t._writableState instanceof E)}})):h=function(t){return t instanceof this},S.prototype.pipe=function(){v(this,new _)},S.prototype.write=function(t,e,r){var i,o=this._writableState,h=!1,u=!o.objectMode&&(i=t,n.isBuffer(i)||i instanceof a);return u&&!n.isBuffer(t)&&(t=function(t){return n.from(t)}(t)),"function"==typeof e&&(r=e,e=null),u?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof r&&(r=m),o.ending?function(t,e){var r=new g;v(t,r),s(e,r)}(this,r):(u||function(t,e,r,i){var n;return null===r?n=new b:"string"==typeof r||e.objectMode||(n=new f("chunk",["string","Buffer"],r)),!n||(v(t,n),s(i,n),!1)}(this,o,t,r))&&(o.pendingcb++,h=function(t,e,r,i,o,s){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=n.from(e,r));return e}(e,i,o);i!==a&&(r=!0,o="buffer",i=a)}var h=e.objectMode?1:i.length;e.length+=h;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:o,isBuf:r,callback:s,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else T(t,e,!1,h,i,o,s);return u}(this,o,u,t,e,r)),h},S.prototype.cork=function(){this._writableState.corked++},S.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||x(this,t))},S.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new w(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(t,e,r){r(new d("_write()"))},S.prototype._writev=null,S.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,O(t,e),r&&(e.finished?s(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),S.prototype.destroy=u.destroy,S.prototype._undestroy=u.undestroy,S.prototype._destroy=function(t,e){e(t)},lt}var pt,_t={};var yt,bt={};var gt,wt,vt,mt,Et,St,kt,Rt,Tt,Mt,xt={};function Dt(){if(vt)return wt;var t;vt=1;var e=$().codes,r=e.ERR_MISSING_ARGS,i=e.ERR_STREAM_DESTROYED;function n(t){if(t)throw t}function o(t){t()}function s(t,e){return t.pipe(e)}return wt=function(){for(var e=arguments.length,a=new Array(e),h=0;h<e;h++)a[h]=arguments[h];var u,c=function(t){return t.length?"function"!=typeof t[t.length-1]?n:t.pop():n}(a);if(Array.isArray(a[0])&&(a=a[0]),a.length<2)throw new r("streams");var l=a.map((function(e,r){var n=r<a.length-1;return function(e,r,n,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;e.on("close",(function(){s=!0})),void 0===t&&(t=ot()),t(e,{readable:r,writable:n},(function(t){if(t)return o(t);s=!0,o()}));var a=!1;return function(t){if(!s&&!a)return a=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new i("pipe"))}}(e,n,r>0,(function(t){u||(u=t),t&&l.forEach(o),n||(l.forEach(o),c(u))}))}));return a.reduce(s)},wt}function Lt(){return mt||(mt=1,function(t,e){const r=C();at(),dt(),function(){if(pt)return _t;pt=1;var t=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};const e=C();e.Duplex=o,R()(o,e.Readable);for(var r=t(e.Writable.prototype),i=0;i<r.length;i++){var n=r[i];o.prototype[n]||(o.prototype[n]=e.Writable.prototype[n])}function o(t){if(!(this instanceof o))return new o(t);e.Readable.call(this,t),e.Writable.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||s(h,this)}function h(t){t.end()}Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}(),function(){if(yt)return bt;yt=1;const t=C();t.Transform=a;var e=$().codes,r=e.ERR_METHOD_NOT_IMPLEMENTED,i=e.ERR_MULTIPLE_CALLBACK,n=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=e.ERR_TRANSFORM_WITH_LENGTH_0;function s(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new i);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function a(e){if(!(this instanceof a))return new a(e);t.Duplex.call(this,e),this._transformState={afterTransform:s.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",h)}function h(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?u(this,null,null):this._flush((function(e,r){u(t,e,r)}))}function u(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new o;if(t._transformState.transforming)throw new n;return t.push(null)}R()(a,t.Duplex),a.prototype.push=function(e,r){return this._transformState.needTransform=!1,t.Duplex.prototype.push.call(this,e,r)},a.prototype._transform=function(t,e,i){i(new r("_transform()"))},a.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},a.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},a.prototype._destroy=function(e,r){t.Duplex.prototype._destroy.call(this,e,(function(t){r(t)}))}}(),function(){if(gt)return xt;gt=1;const t=C();function e(t){if(!(this instanceof e))return new e(t);Transform.call(this,t)}t.PassThrough=e,R()(e,t.Transform),e.prototype._transform=function(t,e,r){r(null,t)}}(),(e=t.exports=r.Readable).Stream=r.Readable,e.Readable=r.Readable,e.Writable=r.Writable,e.Duplex=r.Duplex,e.Transform=r.Transform,e.PassThrough=r.PassThrough,e.finished=ot(),e.pipeline=Dt()}(L,L.exports)),L.exports}function Ct(){if(St)return Et;St=1;var t=w().Buffer,e=Lt();function r(r){e.Stream.Transform.call(this),this._block=t.allocUnsafe(r),this._blockSize=r,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return R()(r,e.Stream.Transform),r.prototype._transform=function(t,e,r){var i=null;try{this.update(t,e)}catch(t){i=t}r(i)},r.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},r.prototype.update=function(e,r){if(function(e,r){if(!t.isBuffer(e)&&"string"!=typeof e)throw new TypeError(r+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");t.isBuffer(e)||(e=t.from(e,r));for(var i=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)i[o++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)i[this._blockOffset++]=e[n++];for(var s=0,a=8*e.length;a>0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},r.prototype._update=function(){throw new Error("_update is not implemented")},r.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},r.prototype._digest=function(){throw new Error("_digest is not implemented")},Et=r}var Ot,It,Pt,Bt,At,Kt,jt,Nt,Ut,Vt,qt,Wt,Ft,Ht,zt,$t={exports:{}};function Gt(){if(It)return Ot;It=1;var t=w().Buffer;function e(e,r){this._block=t.alloc(e),this._finalSize=r,this._blockSize=e,this._len=0}return e.prototype.update=function(e,r){"string"==typeof e&&(r=r||"utf8",e=t.from(e,r));for(var i=this._block,n=this._blockSize,o=e.length,s=this._len,a=0;a<o;){for(var h=s%n,u=Math.min(o-a,n-h),c=0;c<u;c++)i[h+c]=e[a+c];a+=u,(s+=u)%n==0&&this._update(i)}return this._len+=o,this},e.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},e.prototype._update=function(){throw new Error("_update must be implemented by subclass")},Ot=e}function Xt(){if(Nt)return jt;Nt=1;var t=R(),e=Gt(),r=w().Buffer,i=[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],n=new Array(64);function o(){this.init(),this._w=n,e.call(this,64,56)}function s(t,e,r){return r^t&(e^r)}function a(t,e,r){return t&e|r&(t|e)}function h(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function u(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function c(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}return t(o,e),o.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},o.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,o=0|this._b,l=0|this._c,f=0|this._d,d=0|this._e,p=0|this._f,_=0|this._g,y=0|this._h,b=0;b<16;++b)r[b]=t.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((e=r[b-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[b-7]+c(r[b-15])+r[b-16];for(var g=0;g<64;++g){var w=y+u(d)+s(d,p,_)+i[g]+r[g]|0,v=h(n)+a(n,o,l)|0;y=_,_=p,p=d,d=f+w|0,f=l,l=o,o=n,n=w+v|0}this._a=n+this._a|0,this._b=o+this._b|0,this._c=l+this._c|0,this._d=f+this._d|0,this._e=d+this._e|0,this._f=p+this._f|0,this._g=_+this._g|0,this._h=y+this._h|0},o.prototype._hash=function(){var t=r.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},jt=o}function Yt(){if(Wt)return qt;Wt=1;var t=R(),e=Gt(),r=w().Buffer,i=[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],n=new Array(160);function o(){this.init(),this._w=n,e.call(this,128,112)}function s(t,e,r){return r^t&(e^r)}function a(t,e,r){return t&e|r&(t|e)}function h(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function u(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function c(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function l(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function f(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function d(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function p(t,e){return t>>>0<e>>>0?1:0}return t(o,e),o.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},o.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,o=0|this._ch,_=0|this._dh,y=0|this._eh,b=0|this._fh,g=0|this._gh,w=0|this._hh,v=0|this._al,m=0|this._bl,E=0|this._cl,S=0|this._dl,k=0|this._el,R=0|this._fl,T=0|this._gl,M=0|this._hl,x=0;x<32;x+=2)e[x]=t.readInt32BE(4*x),e[x+1]=t.readInt32BE(4*x+4);for(;x<160;x+=2){var D=e[x-30],L=e[x-30+1],C=c(D,L),O=l(L,D),I=f(D=e[x-4],L=e[x-4+1]),P=d(L,D),B=e[x-14],A=e[x-14+1],K=e[x-32],j=e[x-32+1],N=O+A|0,U=C+B+p(N,O)|0;U=(U=U+I+p(N=N+P|0,P)|0)+K+p(N=N+j|0,j)|0,e[x]=U,e[x+1]=N}for(var V=0;V<160;V+=2){U=e[V],N=e[V+1];var q=a(r,n,o),W=a(v,m,E),F=h(r,v),H=h(v,r),z=u(y,k),$=u(k,y),G=i[V],X=i[V+1],Y=s(y,b,g),J=s(k,R,T),Z=M+$|0,Q=w+z+p(Z,M)|0;Q=(Q=(Q=Q+Y+p(Z=Z+J|0,J)|0)+G+p(Z=Z+X|0,X)|0)+U+p(Z=Z+N|0,N)|0;var tt=H+W|0,et=F+q+p(tt,H)|0;w=g,M=T,g=b,T=R,b=y,R=k,y=_+Q+p(k=S+Z|0,S)|0,_=o,S=E,o=n,E=m,n=r,m=v,r=Q+et+p(v=Z+tt|0,Z)|0}this._al=this._al+v|0,this._bl=this._bl+m|0,this._cl=this._cl+E|0,this._dl=this._dl+S|0,this._el=this._el+k|0,this._fl=this._fl+R|0,this._gl=this._gl+T|0,this._hl=this._hl+M|0,this._ah=this._ah+r+p(this._al,v)|0,this._bh=this._bh+n+p(this._bl,m)|0,this._ch=this._ch+o+p(this._cl,E)|0,this._dh=this._dh+_+p(this._dl,S)|0,this._eh=this._eh+y+p(this._el,k)|0,this._fh=this._fh+b+p(this._fl,R)|0,this._gh=this._gh+g+p(this._gl,T)|0,this._hh=this._hh+w+p(this._hl,M)|0},o.prototype._hash=function(){var t=r.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},qt=o}function Jt(){if(zt)return $t.exports;zt=1;var t=$t.exports=function(e){e=e.toLowerCase();var r=t[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r};return t.sha=function(){if(Bt)return Pt;Bt=1;var t=R(),e=Gt(),r=w().Buffer,i=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function o(){this.init(),this._w=n,e.call(this,64,56)}function s(t){return t<<30|t>>>2}function a(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}return t(o,e),o.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},o.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,o=0|this._b,h=0|this._c,u=0|this._d,c=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=r[l-3]^r[l-8]^r[l-14]^r[l-16];for(var f=0;f<80;++f){var d=~~(f/20),p=0|((e=n)<<5|e>>>27)+a(d,o,h,u)+c+r[f]+i[d];c=u,u=h,h=s(o),o=n,n=p}this._a=n+this._a|0,this._b=o+this._b|0,this._c=h+this._c|0,this._d=u+this._d|0,this._e=c+this._e|0},o.prototype._hash=function(){var t=r.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},Pt=o}(),t.sha1=function(){if(Kt)return At;Kt=1;var t=R(),e=Gt(),r=w().Buffer,i=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function o(){this.init(),this._w=n,e.call(this,64,56)}function s(t){return t<<5|t>>>27}function a(t){return t<<30|t>>>2}function h(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}return t(o,e),o.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},o.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,o=0|this._b,u=0|this._c,c=0|this._d,l=0|this._e,f=0;f<16;++f)r[f]=t.readInt32BE(4*f);for(;f<80;++f)r[f]=(e=r[f-3]^r[f-8]^r[f-14]^r[f-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),_=s(n)+h(p,o,u,c)+l+r[d]+i[p]|0;l=c,c=u,u=a(o),o=n,n=_}this._a=n+this._a|0,this._b=o+this._b|0,this._c=u+this._c|0,this._d=c+this._d|0,this._e=l+this._e|0},o.prototype._hash=function(){var t=r.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},At=o}(),t.sha224=function(){if(Vt)return Ut;Vt=1;var t=R(),e=Xt(),r=Gt(),i=w().Buffer,n=new Array(64);function o(){this.init(),this._w=n,r.call(this,64,56)}return t(o,e),o.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},o.prototype._hash=function(){var t=i.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},Ut=o}(),t.sha256=Xt(),t.sha384=function(){if(Ht)return Ft;Ht=1;var t=R(),e=Yt(),r=Gt(),i=w().Buffer,n=new Array(160);function o(){this.init(),this._w=n,r.call(this,128,112)}return t(o,e),o.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},o.prototype._hash=function(){var t=i.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},Ft=o}(),t.sha512=Yt(),$t.exports}var Zt,Qt,te,ee,re=h(u);var ie,ne=function(){if(ee)return te;ee=1;var t=R(),e=function(){if(Rt)return kt;Rt=1;var t=R(),e=Ct(),r=w().Buffer,i=new Array(16);function n(){e.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function o(t,e){return t<<e|t>>>32-e}function s(t,e,r,i,n,s,a){return o(t+(e&r|~e&i)+n+s|0,a)+e|0}function a(t,e,r,i,n,s,a){return o(t+(e&i|r&~i)+n+s|0,a)+e|0}function h(t,e,r,i,n,s,a){return o(t+(e^r^i)+n+s|0,a)+e|0}function u(t,e,r,i,n,s,a){return o(t+(r^(e|~i))+n+s|0,a)+e|0}return t(n,e),n.prototype._update=function(){for(var t=i,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,o=this._c,c=this._d;r=s(r,n,o,c,t[0],3614090360,7),c=s(c,r,n,o,t[1],3905402710,12),o=s(o,c,r,n,t[2],606105819,17),n=s(n,o,c,r,t[3],3250441966,22),r=s(r,n,o,c,t[4],4118548399,7),c=s(c,r,n,o,t[5],1200080426,12),o=s(o,c,r,n,t[6],2821735955,17),n=s(n,o,c,r,t[7],4249261313,22),r=s(r,n,o,c,t[8],1770035416,7),c=s(c,r,n,o,t[9],2336552879,12),o=s(o,c,r,n,t[10],4294925233,17),n=s(n,o,c,r,t[11],2304563134,22),r=s(r,n,o,c,t[12],1804603682,7),c=s(c,r,n,o,t[13],4254626195,12),o=s(o,c,r,n,t[14],2792965006,17),r=a(r,n=s(n,o,c,r,t[15],1236535329,22),o,c,t[1],4129170786,5),c=a(c,r,n,o,t[6],3225465664,9),o=a(o,c,r,n,t[11],643717713,14),n=a(n,o,c,r,t[0],3921069994,20),r=a(r,n,o,c,t[5],3593408605,5),c=a(c,r,n,o,t[10],38016083,9),o=a(o,c,r,n,t[15],3634488961,14),n=a(n,o,c,r,t[4],3889429448,20),r=a(r,n,o,c,t[9],568446438,5),c=a(c,r,n,o,t[14],3275163606,9),o=a(o,c,r,n,t[3],4107603335,14),n=a(n,o,c,r,t[8],1163531501,20),r=a(r,n,o,c,t[13],2850285829,5),c=a(c,r,n,o,t[2],4243563512,9),o=a(o,c,r,n,t[7],1735328473,14),r=h(r,n=a(n,o,c,r,t[12],2368359562,20),o,c,t[5],4294588738,4),c=h(c,r,n,o,t[8],2272392833,11),o=h(o,c,r,n,t[11],1839030562,16),n=h(n,o,c,r,t[14],4259657740,23),r=h(r,n,o,c,t[1],2763975236,4),c=h(c,r,n,o,t[4],1272893353,11),o=h(o,c,r,n,t[7],4139469664,16),n=h(n,o,c,r,t[10],3200236656,23),r=h(r,n,o,c,t[13],681279174,4),c=h(c,r,n,o,t[0],3936430074,11),o=h(o,c,r,n,t[3],3572445317,16),n=h(n,o,c,r,t[6],76029189,23),r=h(r,n,o,c,t[9],3654602809,4),c=h(c,r,n,o,t[12],3873151461,11),o=h(o,c,r,n,t[15],530742520,16),r=u(r,n=h(n,o,c,r,t[2],3299628645,23),o,c,t[0],4096336452,6),c=u(c,r,n,o,t[7],1126891415,10),o=u(o,c,r,n,t[14],2878612391,15),n=u(n,o,c,r,t[5],4237533241,21),r=u(r,n,o,c,t[12],1700485571,6),c=u(c,r,n,o,t[3],2399980690,10),o=u(o,c,r,n,t[10],4293915773,15),n=u(n,o,c,r,t[1],2240044497,21),r=u(r,n,o,c,t[8],1873313359,6),c=u(c,r,n,o,t[15],4264355552,10),o=u(o,c,r,n,t[6],2734768916,15),n=u(n,o,c,r,t[13],1309151649,21),r=u(r,n,o,c,t[4],4149444226,6),c=u(c,r,n,o,t[11],3174756917,10),o=u(o,c,r,n,t[2],718787259,15),n=u(n,o,c,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+o|0,this._d=this._d+c|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=r.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},kt=n}(),r=function(){if(Mt)return Tt;Mt=1;var t=k.Buffer,e=R(),r=Ct(),i=new Array(16),n=[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],o=[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],s=[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],a=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],h=[0,1518500249,1859775393,2400959708,2840853838],u=[1352829926,1548603684,1836072691,2053994217,0];function c(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function l(t,e){return t<<e|t>>>32-e}function f(t,e,r,i,n,o,s,a){return l(t+(e^r^i)+o+s|0,a)+n|0}function d(t,e,r,i,n,o,s,a){return l(t+(e&r|~e&i)+o+s|0,a)+n|0}function p(t,e,r,i,n,o,s,a){return l(t+((e|~r)^i)+o+s|0,a)+n|0}function _(t,e,r,i,n,o,s,a){return l(t+(e&i|r&~i)+o+s|0,a)+n|0}function y(t,e,r,i,n,o,s,a){return l(t+(e^(r|~i))+o+s|0,a)+n|0}return e(c,r),c.prototype._update=function(){for(var t=i,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,c=0|this._b,b=0|this._c,g=0|this._d,w=0|this._e,v=0|this._a,m=0|this._b,E=0|this._c,S=0|this._d,k=0|this._e,R=0;R<80;R+=1){var T,M;R<16?(T=f(r,c,b,g,w,t[n[R]],h[0],s[R]),M=y(v,m,E,S,k,t[o[R]],u[0],a[R])):R<32?(T=d(r,c,b,g,w,t[n[R]],h[1],s[R]),M=_(v,m,E,S,k,t[o[R]],u[1],a[R])):R<48?(T=p(r,c,b,g,w,t[n[R]],h[2],s[R]),M=p(v,m,E,S,k,t[o[R]],u[2],a[R])):R<64?(T=_(r,c,b,g,w,t[n[R]],h[3],s[R]),M=d(v,m,E,S,k,t[o[R]],u[3],a[R])):(T=y(r,c,b,g,w,t[n[R]],h[4],s[R]),M=f(v,m,E,S,k,t[o[R]],u[4],a[R])),r=w,w=g,g=l(b,10),b=c,c=T,v=k,k=S,S=l(E,10),E=m,m=M}var x=this._b+b+S|0;this._b=this._c+g+k|0,this._c=this._d+w+v|0,this._d=this._e+r+m|0,this._e=this._a+c+E|0,this._a=x},c.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=t.alloc?t.alloc(20):new t(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},Tt=c}(),i=Jt(),n=function(){if(Qt)return Zt;Qt=1;var t=w().Buffer,e=E.Transform,r=re.StringDecoder;function i(t){e.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}return R()(i,e),i.prototype.update=function(e,r,i){"string"==typeof e&&(e=t.from(e,r));var n=this._update(e);return this.hashMode?this:(i&&(n=this._toString(n,i)),n)},i.prototype.setAutoPadding=function(){},i.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},i.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},i.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},i.prototype._transform=function(t,e,r){var i;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){i=t}finally{r(i)}},i.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},i.prototype._finalOrDigest=function(e){var r=this.__final()||t.alloc(0);return e&&(r=this._toString(r,e,!0)),r},i.prototype._toString=function(t,e,i){if(this._decoder||(this._decoder=new r(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return i&&(n+=this._decoder.end()),n},Zt=i}();function o(t){n.call(this,"digest"),this._hash=t}return t(o,n),o.prototype._update=function(t){this._hash.update(t)},o.prototype._final=function(){return this._hash.digest()},te=function(t){return"md5"===(t=t.toLowerCase())?new e:"rmd160"===t||"ripemd160"===t?new r:new o(i(t))}}(),oe=a(ne),se={exports:{}};var ae,he,ue,ce,le,fe,de=a(function(){if(ie)return se.exports;ie=1;var t=65536,e=4294967295,r=w().Buffer,i=o.crypto||o.msCrypto;return i&&i.getRandomValues?se.exports=function(n,o){if(n>e)throw new RangeError("requested too many random bytes");var a=r.allocUnsafe(n);if(n>0)if(n>t)for(var h=0;h<n;h+=t)i.getRandomValues(a.slice(h,h+t));else i.getRandomValues(a);if("function"==typeof o)return s((function(){o(null,a)}));return a}:se.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")},se.exports}());var pe=function(){if(fe)return le;fe=1;const{CryptoLD:t}=(he||(he=1,ae={CryptoLD:class{constructor({suites:t}={}){this.suites=t||new Map}use(t){this.suites.set(t.suite,t)}async generate(t={}){return this._suiteForType(t).generate(t)}async from(t={}){const e=this._suiteForType(t);return t["@context"]?e.fromKeyDocument({document:t}):e.from(t)}async fromKeyDocument({document:t,checkContext:e=!0,checkRevoked:r=!0}={}){if(!t)throw new TypeError('The "document" parameter is required.');return this._suiteForType(t).fromKeyDocument({document:t,checkContext:e,checkRevoked:r})}async fromKeyId({id:t,documentLoader:e,checkContext:r=!0,checkRevoked:i=!0}={}){if(!t)throw new TypeError('The "id" parameter is required.');if(!e)throw new TypeError('The "documentLoader" parameter is required.');let n;try{if(({document:n}=await e(t)),!n)throw new Error('The "documentLoader" function must return a "document" object.')}catch(t){const e=new Error("Error fetching document: "+t.message);throw e.cause=t,e}const o=n.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:n,checkContext:r,checkRevoked:i})}_installed({type:t}){return this.suites.has(t)}_suiteForType(t){const e=t&&t.type;if(!e)throw new TypeError("Missing key type.");if(!this._installed({type:e}))throw new Error(`Support for key type "${e}" is not installed.`);return this.suites.get(e)}}}),ae),{LDKeyPair:e}=function(){if(ce)return ue;ce=1;class t{constructor({id:t,controller:e,revoked:r}={}){this.id=t,this.controller=e,this.revoked=r}static async generate(){throw new Error("Abstract method, must be implemented in subclass.")}static async fromKeyDocument({document:t,checkContext:e=!0,checkRevoked:r=!0}={}){if(!t)throw new TypeError('The "document" parameter is required.');if(e&&![].concat(t["@context"]).includes(this.SUITE_CONTEXT))throw new Error('Key document does not contain required context "'+this.SUITE_CONTEXT+'".');if(r&&t.revoked)throw new Error(`Key has been revoked since: "${t.revoked}".`);return this.from(t)}static async from(){throw new Error("Abstract method from() must be implemented in subclass.")}export({publicKey:t=!1,privateKey:e=!1}={}){if(!t&&!e)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.")}}}}return t.SUITE_CONTEXT="INVALID LDKeyPair CONTEXT",ue={LDKeyPair:t}}();return le={CryptoLD:t,LDKeyPair:e}}(),_e=a(pe);const ye="EcdsaSecp256k1VerificationKey2019",be=t=>oe("sha256").update(t).digest();class ge extends _e.LDKeyPair{constructor({publicKeyBase58:t,privateKeyBase58:e,...r}){if(super(r),this.type=void 0,this.publicKeyBase58=void 0,this.privateKeyBase58=void 0,e&&!t){const t=y.publicKeyCreate(f(e));this.publicKeyBase58=d(t)}else this.publicKeyBase58=t;if(this.type=ye,this.privateKeyBase58=e,!this.publicKeyBase58)throw new TypeError('The "publicKeyBase58" property is required.')}static from(e){if(e.publicKeyHex||e.privateKeyHex){const{publicKeyHex:r,privateKeyHex:i,...n}=e;return new ge({...n,publicKeyBase58:r?d(t.from(r,"hex")):void 0,privateKeyBase58:i?d(t.from(i,"hex")):void 0})}return new ge(e)}static async generate({seed:t,compressed:e,...r}){if(t&&!y.privateKeyVerify(t))throw new Error("Provided seed is not a valid private key");let i=t;for(;void 0===i||!y.privateKeyVerify(i);)i=new Uint8Array(de(32));const n=y.publicKeyCreate(i,e);return new ge({publicKeyBase58:d(n),privateKeyBase58:d(i),...r})}export({publicKey:t=!1,privateKey:e=!1,includeContext:r=!1}={}){if(!t&&!e)throw new TypeError('export requires specifying either "publicKey" or "privateKey".');if(e&&!this.privateKeyBase58)throw new TypeError("No privateKey to export.");if(t&&!this.publicKeyBase58)throw new TypeError("No publicKey to export.");const i={type:this.type,id:this.id,controller:this.controller,revoked:this.revoked};return r&&(i["@context"]=ge.SUITE_CONTEXT),e&&(i.privateKeyBase58=this.privateKeyBase58),t&&(i.publicKeyBase58=this.publicKeyBase58),i}signer(){const{privateKeyBase58:e}=this;return e?{async sign({data:r}){const i=b.encode(JSON.stringify({alg:"ES256K",b64:!1,crit:["b64"]})),n=t.from(r.buffer,r.byteOffset,r.length),o=be(t.from(t.concat([t.from(`${i}.`,"utf8"),t.from(n.buffer,n.byteOffset,n.length)]))),{signature:s}=y.ecdsaSign(o,f(e));return`${i}..${b.encode(t.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:r,signature:i}){if(i.indexOf("..")<0)return!1;const[n,o]=i.split(".."),s=JSON.parse(b.decode(n));if("ES256K"!==s.alg||!1!==s.b64||!s.crit||!s.crit.length||"b64"!==s.crit[0])return!1;const a=t.from(r.buffer,r.byteOffset,r.length),h=be(t.from(t.concat([t.from(`${n}.`,"utf8"),t.from(a.buffer,a.byteOffset,a.length)])));let u;try{u=y.ecdsaVerify(t.from(b.decode(o,"hex"),"hex"),h,f(e))}catch(t){u=!1}return u},id:this.id}:{async verify(){throw new Error("No public key to verify against")},id:this.id}}}ge.suite=ye,ge.SUITE_CONTEXT="https://ns.did.ai/suites/secp256k1-2019/v1";const we="https://ns.did.ai/suites/secp256k1-2019/v1",ve=({document:t,contextUrl:e})=>{const r=t["@context"];return r===e||Array.isArray(r)&&r.includes(e)},me=({document:t})=>{const e=ve({document:t,contextUrl:we}),r=ve({document:t,contextUrl:"https://www.w3.org/2018/credentials/v1"}),i=ve({document:t,contextUrl:"https://w3id.org/security/v2"});return e&&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):e&&i?(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):e||r||i};let Ee=class extends p.suites.LinkedDataSignature{constructor(t={}){super({type:"EcdsaSecp256k1Signature2019",LDKeyClass:ge,contextUrl:we,...t}),this.requiredKeyType=void 0,this.requiredKeyType="EcdsaSecp256k1VerificationKey2019"}async sign({verifyData:t,proof:e}){if(!this.signer||"function"!=typeof this.signer.sign)throw new Error("A signer API has not been specified.");return{...e,jws:await this.signer.sign({data:t})}}async verifySignature({verifyData:t,verificationMethod:e,proof:r}){const{jws:i}=r;if(!i||"string"!=typeof i)throw new TypeError('The proof does not include a valid "jws" property.');let{verifier:n}=this;if(!n){n=(await this.LDKeyClass.from(e)).verifier()}return n.verify({data:t,signature:i})}async assertVerificationMethod({verificationMethod:t}){if(!me({document:t}))throw new TypeError(`The verification method (key) must contain "${this.contextUrl}".`);if(!_.hasValue(t,"type",this.requiredKeyType))throw new Error(`Invalid key type. Key type must be "${this.requiredKeyType}".`);if(void 0!==t.revoked)throw new Error("The verification method has been revoked.")}async getVerificationMethod({proof:t,documentLoader:e}){if(this.key)return this.key.export({publicKey:!0});const r="object"==typeof t.verificationMethod?t.verificationMethod.id:t.verificationMethod;if(!r)throw new Error('No "verificationMethod" found in proof.');const i=await _.frame(r,{"@context":this.contextUrl,"@embed":"@always",id:r},{documentLoader:e,compactToRelative:!1});if(!i)throw new Error(`Verification method ${r} not found.`);if(void 0!==i.revoked)throw new Error("The verification method has been revoked.");return await this.assertVerificationMethod({verificationMethod:i}),i}async matchProof({proof:t,document:e,purpose:r,documentLoader:i,expansionMap:n}){if(!me({document:e}))return!1;if(!await super.matchProof({proof:t,document:e,purpose:r,documentLoader:i,expansionMap:n}))return!1;if(!this.key)return!0;const{verificationMethod:o}=t,s="object"==typeof o?o.id:o;return this.isVerificationMethodMatchingKeyId(s)}ensureSuiteContext({document:t,addSuiteContext:e}){me({document:t})||super.ensureSuiteContext({document:t,addSuiteContext:e})}isVerificationMethodMatchingKeyId(t){return t===this.key.id||t===`${this.key.controller}${this.key.id}`}};Ee.CONTEXT_URL=we,Ee.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"}}}}};var Se=a(g());const ke="undefined"==typeof Buffer?t:Buffer,{purposes:{AssertionProofPurpose:Re,AuthenticationProofPurpose:Te}}=p;var Me;!function(t){t.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",t.checkDocumentSignature="checkDocumentSignature"}(Me||(Me={}));class xe extends T{verificationProcess=[Me.retrieveVerificationMethodPublicKey,Me.checkDocumentSignature];documentToVerify;issuer;proof;type="EcdsaSecp256k1Signature2019";verificationKey;publicKey;proofPurpose;challenge;domain;proofPurposeMap;constructor(t){super(t),t.executeStep&&(this.executeStep=t.executeStep),this.documentToVerify=t.document,this.issuer=t.issuer,this.proof=t.proof,this.proofPurpose=t.proofPurpose??"assertionMethod",this.challenge=t.proofChallenge??"",this.domain=t.proofDomain,this.proofPurposeMap={authentication:Te,assertionMethod:Re},this.validateProofType()}async init(){}async verifyProof(){for(const t of this.verificationProcess){if(!this[t])return void console.error("verification logic for",t,"not implemented");await this[t]()}}async verifyIdentity(){}getProofVerificationSteps(t){return this.verificationProcess.map((r=>e.verifier.convertToVerificationSubsteps(t,r)))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return this.publicKey}getIssuerName(){return this.issuer.name??""}getIssuerProfileDomain(){try{return new URL(this.getIssuerProfileUrl()).hostname??""}catch(t){return""}}getIssuerProfileUrl(){return this.issuer.id??""}getSigningDate(){return this.proof.created}async executeStep(t,e,r){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}validateProofType(){const t=this.isProofChain()?this.proof.chainedProofType:this.proof.type;if(t!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${t}`)}isProofChain(){return"ChainedProof2021"===this.proof.type}generateDocumentLoader(){r[this.documentToVerify.issuer]=this.getTargetVerificationMethodContainer();return function(t){return t in r?{contextUrl:null,document:r[t],documentUrl:t}:_.documentLoader(t)}}retrieveInitialDocument(){const t=i(this.documentToVerify);if(Array.isArray(t.proof)){const e=t.proof.find((t=>t.type===this.type));delete t.proof,t.proof=e}return t}getTargetVerificationMethodContainer(){return this.issuer.didDocument??this.issuer}getErrorMessage(t){return t.error.errors[0].message}async retrieveVerificationMethodPublicKey(){this.verificationKey=await this.executeStep(Me.retrieveVerificationMethodPublicKey,(async()=>{const t=M(this.getTargetVerificationMethodContainer(),this.proof.verificationMethod);if(t.publicKeyJwk&&!t.publicKeyBase58){const r=(t=>{const e=v.from({...t,crv:"K-256"},"jwk").toString("blk","public"),r=m.publicKeyConvert(ke.from(e,"hex"),!0);return ke.from(r).toString("hex")})(t.publicKeyJwk);t.publicKeyBase58=(e=r,Se.encode(ke.from(e,"hex"))),this.documentToVerify["@context"].includes("https://w3id.org/security/suites/secp256k1-2019/v1")||this.documentToVerify["@context"].push("https://w3id.org/security/suites/secp256k1-2019/v1")}var e;this.publicKey=t.publicKeyBase58;const r=ge.from({...t});if(!r)throw new n(Me.retrieveVerificationMethodPublicKey,"Could not derive the verification key");if(r.revoked)throw new n(Me.retrieveVerificationMethodPublicKey,"The verification key has been revoked");return r}),this.type)}async checkDocumentSignature(){await this.executeStep(Me.checkDocumentSignature,(async()=>{const t=new Ee({key:this.verificationKey});t.date=new Date(Date.now()).toISOString(),"authentication"!==this.proofPurpose||this.proof.challenge||(this.proof.challenge="");const e=await p.verify(this.retrieveInitialDocument(),{suite:t,purpose:new this.proofPurposeMap[this.proofPurpose]({controller:this.getTargetVerificationMethodContainer(),challenge:this.challenge,domain:this.domain}),documentLoader:this.generateDocumentLoader()});if(!e.verified)throw console.error(JSON.stringify(e,null,2)),new n(Me.checkDocumentSignature,`The document's ${this.type} signature could not be confirmed: ${this.getErrorMessage(e)}`);console.log("Credential Secp256k1 signature successfully verified")}),this.type)}}export{xe as default};