@blockcerts/blockcerts-verifier 1.72.4 → 1.74.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 (52) hide show
  1. package/README.md +8 -0
  2. package/bundle-stats.html +1 -1
  3. package/codecov +0 -0
  4. package/codecov.SHA256SUM +1 -0
  5. package/codecov.SHA256SUM.sig +16 -0
  6. package/coverage/lcov.info +469 -466
  7. package/dist/{DataIntegrityProof-x-pKdBCc-B_YUlE0Z.js → DataIntegrityProof-DRK-bLb_-CItV0ZXY.js} +1 -1
  8. package/dist/EcdsaSd2023-CdilbQE4-BlaeM9K_.js +26 -0
  9. package/dist/EcdsaSecp256k1Signature2019-rfxWS2XE-C73WHAtH.js +1 -0
  10. package/dist/{Ed25519Signature2020-B6yblwC5-BRlzT2Yc.js → Ed25519Signature2020-CDbX0d2Z-Dc1L-exZ.js} +7 -7
  11. package/dist/{EddsaRdfc2022-Csk9U_qt-B798omlR.js → EddsaRdfc2022-Do0HFpDb-BcV_n8Fk.js} +4 -4
  12. package/dist/{HashlinkVerifier-Bi7nn19S-DMjUYzMR.js → HashlinkVerifier-Cdnza1Dw-A9htzw7A.js} +1 -1
  13. package/dist/MerkleProof2017-5uQFQKSe-dtmePIpg.js +1 -0
  14. package/dist/MerkleProof2019-DraC60XD-B9XV8wNx.js +5 -0
  15. package/dist/Suite-BmP2Qu19-D1ucdMDB.js +1 -0
  16. package/dist/_polyfill-node.path-hKwMKLNw-B7aPtphV.js +1 -0
  17. package/dist/checkBitStringStatusList-CKk6xxUL-D99R7EXK.js +1 -0
  18. package/dist/checkCredentialSchemaConformity-U2NlIuJZ-swOY09NS.js +1 -0
  19. package/dist/controlVerificationMethod-Blm4pE1t-BYBRLxNP.js +1 -0
  20. package/dist/{downloadPDF-UAsY-nU_.js → downloadPDF-C-y2U2YC.js} +3 -3
  21. package/dist/ensureValidIssuingKey-D7OT4D35--HN0afRq.js +1 -0
  22. package/dist/index-BNsIYV4r-BnYxKy2f.js +14 -0
  23. package/dist/{index-D7PA_QcD-CyttRwCk.js → index-C4ZZHHRx-BOdwDnYa.js} +1 -1
  24. package/dist/index-CVS5Gn9h-DNgvq6Wk.js +7 -0
  25. package/dist/index-D2bS6rRi-D_ppNIsb.js +66 -0
  26. package/dist/index-Dr7MpiEc-D5LHgMik.js +30 -0
  27. package/dist/{index-DNlz8u7B-CYTlxhyY.js → index-uKBVup0_-Dh4-8Ruv.js} +1 -1
  28. package/dist/{index.es-CnYWLNZV.js → index.es-BmC2s_4v.js} +1 -1
  29. package/dist/{Suite-CBLHluYK-Dmvbh142.js → jsonld-DOUjwF6J-dtl20tiV.js} +1 -1
  30. package/dist/{jsonld-signatures-BtZPa7MV-DTekMXP5.js → jsonld-signatures-BJXipuab-CB799Kkm.js} +7 -7
  31. package/dist/main.js +122 -122
  32. package/dist/purify.es-C6IIzwyE.js +2 -0
  33. package/dist/retrieveVerificationMethodPublicKey-CT9YA_Wr-Djl8Ri41.js +1 -0
  34. package/dist/verifyIssuerProfile-BG-odQrl-0JjZhiiC.js +1 -0
  35. package/package.json +9 -9
  36. package/dist/EcdsaSd2023-CU35O_1w-CISk0lEt.js +0 -30
  37. package/dist/EcdsaSecp256k1Signature2019-DiXIv8yq-B2kEN_Qo.js +0 -1
  38. package/dist/MerkleProof2017-BIJKwMk5-CLYAJK4G.js +0 -1
  39. package/dist/MerkleProof2019-CeAt2OGM-DOuISx_E.js +0 -5
  40. package/dist/checkCredentialSchemaConformity-CECtM4WI-C1vg05zb.js +0 -1
  41. package/dist/checkRevocationStatusList2021-B7NFlV-5-C3Zng1tA.js +0 -13
  42. package/dist/controlVerificationMethod-Cuyek_Vk-C_Uq2iA5.js +0 -1
  43. package/dist/ensureValidIssuingKey-DN2kpCwj-DY8BTObG.js +0 -1
  44. package/dist/index-DFOHyoZq-BCuOIg2Z.js +0 -29
  45. package/dist/pako.esm-BGRKTPxS-Bodm4Eha.js +0 -2
  46. package/dist/purify.es-Om653OSQ.js +0 -2
  47. package/dist/retrieveVerificationMethodPublicKey-DcEGtx_h-D1zuvtQB.js +0 -1
  48. package/dist/sha2-JcCWfgvE-By1_saxP.js +0 -2
  49. package/dist/verifyIssuerProfile-DQji41Fc-l31-7imR.js +0 -1
  50. /package/dist/{ensureNotRevoked-CNUfpW4F-BheL-ZKZ.js → ensureNotRevoked-DrQAPfcJ-BheL-ZKZ.js} +0 -0
  51. /package/dist/{index-6G1g4ypj-Dgus2xdV.js → index-yOIIz7AL-Dgus2xdV.js} +0 -0
  52. /package/dist/{webcrypto.es-aoUxIxUm-gGk5JRJH.js → webcrypto.es-FKUHCUj--gGk5JRJH.js} +0 -0
@@ -1,5 +0,0 @@
1
- import{r as e}from"./index-DNlz8u7B-CYTlxhyY.js";import{d as t,b as r,r as n,c as i,l as o,e as s,B as a,f as c,S as u,h,p as f,P as l,j as d,k as p,m as y,n as g,o as E}from"./main.js";import{j as m}from"./jsonld-signatures-BtZPa7MV-DTekMXP5.js";import{S as _,j as w}from"./Suite-CBLHluYK-Dmvbh142.js";import{s as b}from"./sha2-JcCWfgvE-By1_saxP.js";import{t as P,a as I}from"./index-DFOHyoZq-BCuOIg2Z.js";import"./pako.esm-BGRKTPxS-Bodm4Eha.js";import{e as A}from"./ensureValidIssuingKey-DN2kpCwj-DY8BTObG.js";import"./index-6G1g4ypj-Dgus2xdV.js";import{r as T}from"./retrieveVerificationMethodPublicKey-DcEGtx_h-D1zuvtQB.js";var O,v,S,N,U,R,k={type:"object",required:["merkleRoot","targetHash","anchors"],properties:{merkleRoot:{type:"string",minLength:64,maxLength:64},targetHash:{type:"string",minLength:64,maxLength:64},anchors:{type:"array",minItems:1,contains:{type:"string"}}}};!function(){if(N)return S;N=1;const t=function(){if(v)return O;v=1;const t=k,{validator:r}=e(),n=r(t);return O=n}();S={validate:t}}();var B,M,L=h(R?U:(R=1,U={root:{merkleRoot:0,targetHash:1,anchors:2,path:3},path:{left:0,right:1},chain:{btc:{id:0,networks:{mainnet:1,testnet:3}},eth:{id:1,networks:{mainnet:1,ropsten:3,rinkeby:4,goerli:5,sepolia:11155111}},mtc:{id:2,networks:{mainnet:137,mumbai:80001}},mocknet:{id:-1,networks:{mocknet:-1}}}})),x={};function D(){if(M)return B;M=1;const e=p,{Buffer:t}=d,r=new TextDecoder("utf8",{fatal:!0,ignoreBOM:!0});class n extends e.Transform{constructor(e,r,n={}){let i=null,o=null;switch(typeof e){case"object":t.isBuffer(e)?i=e:e&&(n=e);break;case"string":i=e;break;case"undefined":break;default:throw new TypeError("Invalid input")}switch(typeof r){case"object":r&&(n=r);break;case"string":o=r;break;case"undefined":break;default:throw new TypeError("Invalid inputEncoding")}if(!n||"object"!=typeof n)throw new TypeError("Invalid options");null==i&&(i=n.input),null==o&&(o=n.inputEncoding),delete n.input,delete n.inputEncoding;const s=null==n.watchPipe||n.watchPipe;delete n.watchPipe;const a=Boolean(n.readError);delete n.readError,super(n),this.readError=a,s&&this.on("pipe",e=>{const t=e._readableState.objectMode;if(this.length>0&&t!==this._readableState.objectMode)throw new Error("Do not switch objectMode in the middle of the stream");this._readableState.objectMode=t,this._writableState.objectMode=t}),null!=i&&this.end(i,o)}static isNoFilter(e){return e instanceof this}static compare(e,t){if(!(e instanceof this))throw new TypeError("Arguments must be NoFilters");return e===t?0:e.compare(t)}static concat(e,r){if(!Array.isArray(e))throw new TypeError("list argument must be an Array of NoFilters");if(0===e.length||0===r)return t.alloc(0);null==r&&(r=e.reduce((e,t)=>{if(!(t instanceof n))throw new TypeError("list argument must be an Array of NoFilters");return e+t.length},0));let i=!0,o=!0;const s=e.map(e=>{if(!(e instanceof n))throw new TypeError("list argument must be an Array of NoFilters");const r=e.slice();return t.isBuffer(r)?o=!1:i=!1,r});if(i)return t.concat(s,r);if(o)return[].concat(...s).slice(0,r);throw new Error("Concatenating mixed object and byte streams not supported")}_transform(e,r,n){this._readableState.objectMode||t.isBuffer(e)||(e=t.from(e,r)),this.push(e),n()}_bufArray(){let e=this._readableState.buffer;if(!Array.isArray(e)){let t=e.head;for(e=[];null!=t;)e.push(t.data),t=t.next}return e}read(e){const t=super.read(e);if(null!=t){if(this.emit("read",t),this.readError&&t.length<e)throw new Error(`Read ${t.length}, wanted ${e}`)}else if(this.readError)throw new Error(`No data available, wanted ${e}`);return t}readFull(e){let t=null,r=null,n=null;return new Promise((i,o)=>{this.length>=e?i(this.read(e)):this.writableFinished?o(new Error(`Stream finished before ${e} bytes were available`)):(t=t=>{this.length>=e&&i(this.read(e))},r=()=>{o(new Error(`Stream finished before ${e} bytes were available`))},n=o,this.on("readable",t),this.on("error",n),this.on("finish",r))}).finally(()=>{t&&(this.removeListener("readable",t),this.removeListener("error",n),this.removeListener("finish",r))})}promise(e){let t=!1;return new Promise((r,n)=>{this.on("finish",()=>{const n=this.read();null==e||t||(t=!0,e(null,n)),r(n)}),this.on("error",r=>{null==e||t||(t=!0,e(r)),n(r)})})}compare(e){if(!(e instanceof n))throw new TypeError("Arguments must be NoFilters");if(this===e)return 0;const r=this.slice(),i=e.slice();if(t.isBuffer(r)&&t.isBuffer(i))return r.compare(i);throw new Error("Cannot compare streams in object mode")}equals(e){return 0===this.compare(e)}slice(e,r){if(this._readableState.objectMode)return this._bufArray().slice(e,r);const n=this._bufArray();switch(n.length){case 0:return t.alloc(0);case 1:return n[0].slice(e,r);default:return t.concat(n).slice(e,r)}}get(e){return this.slice()[e]}toJSON(){const e=this.slice();return t.isBuffer(e)?e.toJSON():e}toString(e,n,i){const o=this.slice(n,i);return t.isBuffer(o)?e&&"utf8"!==e?o.toString(e):r.decode(o):JSON.stringify(o)}[Symbol.for("nodejs.util.inspect.custom")](e,r){const n=this._bufArray().map(e=>t.isBuffer(e)?r.stylize(e.toString("hex"),"string"):JSON.stringify(e)).join(", ");return`${this.constructor.name} [${n}]`}get length(){return this._readableState.length}writeBigInt(e){let r=e.toString(16);if(e<0){const t=BigInt(Math.floor(r.length/2));r=(e=(BigInt(1)<<t*BigInt(8))+e).toString(16)}return r.length%2&&(r=`0${r}`),this.push(t.from(r,"hex"))}readUBigInt(e){const r=this.read(e);return t.isBuffer(r)?BigInt(`0x${r.toString("hex")}`):null}readBigInt(e){const r=this.read(e);if(!t.isBuffer(r))return null;let n=BigInt(`0x${r.toString("hex")}`);if(128&r[0]){n-=BigInt(1)<<BigInt(r.length)*BigInt(8)}return n}writeUInt8(e){const r=t.from([e]);return this.push(r)}writeUInt16LE(e){const r=t.alloc(2);return r.writeUInt16LE(e),this.push(r)}writeUInt16BE(e){const r=t.alloc(2);return r.writeUInt16BE(e),this.push(r)}writeUInt32LE(e){const r=t.alloc(4);return r.writeUInt32LE(e),this.push(r)}writeUInt32BE(e){const r=t.alloc(4);return r.writeUInt32BE(e),this.push(r)}writeInt8(e){const r=t.from([e]);return this.push(r)}writeInt16LE(e){const r=t.alloc(2);return r.writeUInt16LE(e),this.push(r)}writeInt16BE(e){const r=t.alloc(2);return r.writeUInt16BE(e),this.push(r)}writeInt32LE(e){const r=t.alloc(4);return r.writeUInt32LE(e),this.push(r)}writeInt32BE(e){const r=t.alloc(4);return r.writeUInt32BE(e),this.push(r)}writeFloatLE(e){const r=t.alloc(4);return r.writeFloatLE(e),this.push(r)}writeFloatBE(e){const r=t.alloc(4);return r.writeFloatBE(e),this.push(r)}writeDoubleLE(e){const r=t.alloc(8);return r.writeDoubleLE(e),this.push(r)}writeDoubleBE(e){const r=t.alloc(8);return r.writeDoubleBE(e),this.push(r)}writeBigInt64LE(e){const r=t.alloc(8);return r.writeBigInt64LE(e),this.push(r)}writeBigInt64BE(e){const r=t.alloc(8);return r.writeBigInt64BE(e),this.push(r)}writeBigUInt64LE(e){const r=t.alloc(8);return r.writeBigUInt64LE(e),this.push(r)}writeBigUInt64BE(e){const r=t.alloc(8);return r.writeBigUInt64BE(e),this.push(r)}readUInt8(){const e=this.read(1);return t.isBuffer(e)?e.readUInt8():null}readUInt16LE(){const e=this.read(2);return t.isBuffer(e)?e.readUInt16LE():null}readUInt16BE(){const e=this.read(2);return t.isBuffer(e)?e.readUInt16BE():null}readUInt32LE(){const e=this.read(4);return t.isBuffer(e)?e.readUInt32LE():null}readUInt32BE(){const e=this.read(4);return t.isBuffer(e)?e.readUInt32BE():null}readInt8(){const e=this.read(1);return t.isBuffer(e)?e.readInt8():null}readInt16LE(){const e=this.read(2);return t.isBuffer(e)?e.readInt16LE():null}readInt16BE(){const e=this.read(2);return t.isBuffer(e)?e.readInt16BE():null}readInt32LE(){const e=this.read(4);return t.isBuffer(e)?e.readInt32LE():null}readInt32BE(){const e=this.read(4);return t.isBuffer(e)?e.readInt32BE():null}readFloatLE(){const e=this.read(4);return t.isBuffer(e)?e.readFloatLE():null}readFloatBE(){const e=this.read(4);return t.isBuffer(e)?e.readFloatBE():null}readDoubleLE(){const e=this.read(8);return t.isBuffer(e)?e.readDoubleLE():null}readDoubleBE(){const e=this.read(8);return t.isBuffer(e)?e.readDoubleBE():null}readBigInt64LE(){const e=this.read(8);return t.isBuffer(e)?e.readBigInt64LE():null}readBigInt64BE(){const e=this.read(8);return t.isBuffer(e)?e.readBigInt64BE():null}readBigUInt64LE(){const e=this.read(8);return t.isBuffer(e)?e.readBigUInt64LE():null}readBigUInt64BE(){const e=this.read(8);return t.isBuffer(e)?e.readBigUInt64BE():null}}return B=n}var C,V,F,H,j,G,K,$,z,Y,W,J,q,X,Q,Z,ee,te,re,ne,ie,oe,se,ae,ce={};function ue(){return C||(C=1,(e=ce).MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},e.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36,SET:258},e.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},e.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},e.SYMS={NULL:Symbol.for("github.com/hildjj/node-cbor/null"),UNDEFINED:Symbol.for("github.com/hildjj/node-cbor/undef"),PARENT:Symbol.for("github.com/hildjj/node-cbor/parent"),BREAK:Symbol.for("github.com/hildjj/node-cbor/break"),STREAM:Symbol.for("github.com/hildjj/node-cbor/stream")},e.SHIFT32=4294967296,e.BI={MINUS_ONE:BigInt(-1),NEG_MAX:BigInt(-1)-BigInt(Number.MAX_SAFE_INTEGER),MAXINT32:BigInt("0xffffffff"),MAXINT64:BigInt("0xffffffffffffffff"),SHIFT32:BigInt(e.SHIFT32)}),ce;var e}function he(){return V||(V=1,function(e){const{Buffer:t}=d,r=D(),n=p,i=ue(),{NUMBYTES:o,SHIFT32:s,BI:a,SYMS:c}=i,u=new TextDecoder("utf8",{fatal:!0,ignoreBOM:!0});e.utf8=e=>u.decode(e),e.utf8.checksUTF8=!0,e.isBufferish=function(e){return e&&"object"==typeof e&&(t.isBuffer(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof ArrayBuffer||e instanceof DataView)},e.bufferishToBuffer=function(e){return t.isBuffer(e)?e:ArrayBuffer.isView(e)?t.from(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?t.from(e):null},e.parseCBORint=function(e,t){switch(e){case o.ONE:return t.readUInt8(0);case o.TWO:return t.readUInt16BE(0);case o.FOUR:return t.readUInt32BE(0);case o.EIGHT:{const e=t.readUInt32BE(0),r=t.readUInt32BE(4);return e>2097151?BigInt(e)*a.SHIFT32+BigInt(r):e*s+r}default:throw new Error(`Invalid additional info for int: ${e}`)}},e.writeHalf=function(e,r){const n=t.allocUnsafe(4);n.writeFloatBE(r,0);const i=n.readUInt32BE(0);if(8191&i)return!1;let o=i>>16&32768;const s=i>>23&255,a=8388607&i;if(s>=113&&s<=142)o+=(s-112<<10)+(a>>13);else{if(!(s>=103&&s<113))return!1;if(a&(1<<126-s)-1)return!1;o+=a+8388608>>126-s}return e.writeUInt16BE(o),!0},e.parseHalf=function(e){const t=128&e[0]?-1:1,r=(124&e[0])>>2,n=(3&e[0])<<8|e[1];return r?31===r?t*(n?NaN:1/0):t*2**(r-25)*(1024+n):5.960464477539063e-8*t*n},e.parseCBORfloat=function(t){switch(t.length){case 2:return e.parseHalf(t);case 4:return t.readFloatBE(0);case 8:return t.readDoubleBE(0);default:throw new Error(`Invalid float size: ${t.length}`)}},e.hex=function(e){return t.from(e.replace(/^0x/,""),"hex")},e.bin=function(e){let r=0,n=(e=e.replace(/\s/g,"")).length%8||8;const i=[];for(;n<=e.length;)i.push(parseInt(e.slice(r,n),2)),r=n,n+=8;return t.from(i)},e.arrayEqual=function(e,t){return null==e&&null==t||null!=e&&null!=t&&(e.length===t.length&&e.every((e,r)=>e===t[r]))},e.bufferToBigInt=function(e){return BigInt(`0x${e.toString("hex")}`)},e.cborValueToString=function(t,r=-1){switch(typeof t){case"symbol":{switch(t){case c.NULL:return"null";case c.UNDEFINED:return"undefined";case c.BREAK:return"BREAK"}if(t.description)return t.description;const e=t.toString().match(/^Symbol\((?<name>.*)\)/);return e&&e.groups.name?e.groups.name:"Symbol"}case"string":return JSON.stringify(t);case"bigint":return t.toString();case"number":{const e=Object.is(t,-0)?"-0":String(t);return r>0?`${e}_${r}`:e}case"object":{if(!t)return"null";const n=e.bufferishToBuffer(t);if(n){const e=n.toString("hex");return r===-1/0?e:`h'${e}'`}return t&&"function"==typeof t[Symbol.for("nodejs.util.inspect.custom")]?t[Symbol.for("nodejs.util.inspect.custom")]():Array.isArray(t)?"[]":"{}"}}return String(t)},e.guessEncoding=function(t,i){if("string"==typeof t)return new r(t,null==i?"hex":i);const o=e.bufferishToBuffer(t);if(o)return new r(o);if((s=t)instanceof n.Readable||["read","on","pipe"].every(e=>"function"==typeof s[e]))return t;var s;throw new Error("Unknown input type")};const h={"=":"","+":"-","/":"_"};e.base64url=function(t){return e.bufferishToBuffer(t).toString("base64").replace(/[=+/]/g,e=>h[e])},e.base64=function(t){return e.bufferishToBuffer(t).toString("base64")},e.isBigEndian=function(){const e=new Uint8Array(4);return!((new Uint32Array(e.buffer)[0]=1)&e[0])}}(x)),x}function fe(){if(G)return j;G=1;const e=ue(),t=he(),r=Symbol("INTERNAL_JSON");function n(e,r){if(t.isBufferish(e))e.toJSON=r;else if(Array.isArray(e))for(const t of e)n(t,r);else if(e&&"object"==typeof e&&(!(e instanceof f)||e.tag<21||e.tag>23))for(const t of Object.values(e))n(t,r)}function i(){return t.base64(this)}function o(){return t.base64url(this)}function s(){return this.toString("hex")}const a={0:e=>new Date(e),1:e=>new Date(1e3*e),2:e=>t.bufferToBigInt(e),3:r=>e.BI.MINUS_ONE-t.bufferToBigInt(r),21:(e,i)=>(t.isBufferish(e)?i[r]=o:n(e,o),i),22:(e,o)=>(t.isBufferish(e)?o[r]=i:n(e,i),o),23:(e,i)=>(t.isBufferish(e)?i[r]=s:n(e,s),i),32:e=>new URL(e),33:(e,t)=>{if(!e.match(/^[a-zA-Z0-9_-]+$/))throw new Error("Invalid base64url characters");const r=e.length%4;if(1===r)throw new Error("Invalid base64url length");if(2===r){if(-1==="AQgw".indexOf(e[e.length-1]))throw new Error("Invalid base64 padding")}else if(3===r&&-1==="AEIMQUYcgkosw048".indexOf(e[e.length-1]))throw new Error("Invalid base64 padding");return t},34:(e,t)=>{const r=e.match(/^[a-zA-Z0-9+/]+(?<padding>={0,2})$/);if(!r)throw new Error("Invalid base64 characters");if(e.length%4!=0)throw new Error("Invalid base64 length");if("="===r.groups.padding){if(-1==="AQgw".indexOf(e[e.length-2]))throw new Error("Invalid base64 padding")}else if("=="===r.groups.padding&&-1==="AEIMQUYcgkosw048".indexOf(e[e.length-3]))throw new Error("Invalid base64 padding");return t},35:e=>new RegExp(e),258:e=>new Set(e)},c={64:Uint8Array,65:Uint16Array,66:Uint32Array,68:Uint8ClampedArray,69:Uint16Array,70:Uint32Array,72:Int8Array,73:Int16Array,74:Int32Array,77:Int16Array,78:Int32Array,81:Float32Array,82:Float64Array,85:Float32Array,86:Float64Array};function u(e,r){if(!t.isBufferish(e))throw new TypeError("val not a buffer");const{tag:n}=r,i=c[n];if(!i)throw new Error(`Invalid typed array tag: ${n}`);const o=2**(((16&n)>>4)+(3&n));!(4&n)!==t.isBigEndian()&&o>1&&function(e,t,r,n){const i=new DataView(e),[o,s]={2:[i.getUint16,i.setUint16],4:[i.getUint32,i.setUint32],8:[i.getBigUint64,i.setBigUint64]}[t],a=r+n;for(let e=r;e<a;e+=t)s.call(i,e,o.call(i,e,!0))}(e.buffer,o,e.byteOffset,e.byteLength);return new i(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength))}"undefined"!=typeof BigUint64Array&&(c[67]=BigUint64Array,c[71]=BigUint64Array),"undefined"!=typeof BigInt64Array&&(c[75]=BigInt64Array,c[79]=BigInt64Array);for(const e of Object.keys(c))a[e]=u;let h={};class f{constructor(e,t,r){if(this.tag=e,this.value=t,this.err=r,"number"!=typeof this.tag)throw new Error(`Invalid tag type (${typeof this.tag})`);if(this.tag<0||(0|this.tag)!==this.tag)throw new Error(`Tag must be a positive integer: ${this.tag}`)}toJSON(){if(this[r])return this[r].call(this.value);const e={tag:this.tag,value:this.value};return this.err&&(e.err=this.err),e}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){let t=null==e?void 0:e[this.tag];if(null===t)return this;if("function"!=typeof t&&(t=f.TAGS[this.tag],"function"!=typeof t))return this;try{return t.call(this,this.value,this)}catch(e){return e&&e.message&&e.message.length>0?this.err=e.message:this.err=e,this}}static get TAGS(){return h}static set TAGS(e){h=e}static reset(){f.TAGS={...a}}}return f.INTERNAL_JSON=r,f.reset(),j=f}function le(){if($)return K;$=1;const{MT:e,SIMPLE:t,SYMS:r}=ue();class n{constructor(e){if("number"!=typeof e)throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(0|e)!==e)throw new Error(`value must be a small positive integer: ${e}`);this.value=e}toString(){return`simple(${this.value})`}[Symbol.for("nodejs.util.inspect.custom")](e,t){return`simple(${this.value})`}encodeCBOR(t){return t._pushInt(this.value,e.SIMPLE_FLOAT)}static isSimple(e){return e instanceof n}static decode(e,i=!0,o=!1){switch(e){case t.FALSE:return!1;case t.TRUE:return!0;case t.NULL:return i?null:r.NULL;case t.UNDEFINED:if(i)return;return r.UNDEFINED;case-1:if(!i||!o)throw new Error("Invalid BREAK");return r.BREAK;default:return new n(e)}}}return K=n}function de(){if(Y)return z;Y=1;const e=function(){if(H)return F;H=1;const e=p,t=D();class r extends e.Transform{constructor(e){super(e),this._writableState.objectMode=!1,this._readableState.objectMode=!0,this.bs=new t,this.__restart()}_transform(e,t,r){for(this.bs.write(e);this.bs.length>=this.__needed;){let e=null;const t=null===this.__needed?void 0:this.bs.read(this.__needed);try{e=this.__parser.next(t)}catch(e){return r(e)}this.__needed&&(this.__fresh=!1),e.done?(this.push(e.value),this.__restart()):this.__needed=e.value||1/0}return r()}*_parse(){throw new Error("Must be implemented in subclass")}__restart(){this.__needed=null,this.__parser=this._parse(),this.__fresh=!0}_flush(e){e(this.__fresh?null:new Error("unexpected end of input"))}}return F=r}(),t=fe(),r=le(),n=he(),i=D(),o=ue(),{MT:s,NUMBYTES:a,SYMS:c,BI:u}=o,{Buffer:h}=d,f=Symbol("count"),l=Symbol("major type"),y=Symbol("error"),g=Symbol("not found");function E(e,t,r){const n=[];return n[f]=r,n[c.PARENT]=e,n[l]=t,n}function m(e,t){const r=new i;return r[f]=-1,r[c.PARENT]=e,r[l]=t,r}class _ extends Error{constructor(e,t){super(`Unexpected data: 0x${e.toString(16)}`),this.name="UnexpectedDataError",this.byte=e,this.value=t}}function w(e,t){switch(typeof e){case"function":return{options:{},cb:e};case"string":return{options:{encoding:e},cb:t};case"object":return{options:e||{},cb:t};default:throw new TypeError("Unknown option type")}}class b extends e{constructor(e={}){const{tags:t={},max_depth:r=-1,preferMap:n=!1,preferWeb:o=!1,required:s=!1,encoding:a="hex",extendedResults:c=!1,preventDuplicateKeys:u=!1,...h}=e;super({defaultEncoding:a,...h}),this.running=!0,this.max_depth=r,this.tags=t,this.preferMap=n,this.preferWeb=o,this.extendedResults=c,this.required=s,this.preventDuplicateKeys=u,c&&(this.bs.on("read",this._onRead.bind(this)),this.valueBytes=new i)}static nullcheck(e){switch(e){case c.NULL:return null;case c.UNDEFINED:return;case g:throw new Error("Value not found");default:return e}}static decodeFirstSync(e,t={}){if(null==e)throw new TypeError("input required");({options:t}=w(t));const{encoding:r="hex",...i}=t,o=new b(i),s=n.guessEncoding(e,r),a=o._parse();let c=a.next();for(;!c.done;){const e=s.read(c.value);if(null==e||e.length!==c.value)throw new Error("Insufficient data");o.extendedResults&&o.valueBytes.write(e),c=a.next(e)}let u=null;if(o.extendedResults)u=c.value,u.unused=s.read();else if(u=b.nullcheck(c.value),s.length>0){const e=s.read(1);throw s.unshift(e),new _(e[0],u)}return u}static decodeAllSync(e,t={}){if(null==e)throw new TypeError("input required");({options:t}=w(t));const{encoding:r="hex",...i}=t,o=new b(i),s=n.guessEncoding(e,r),a=[];for(;s.length>0;){const e=o._parse();let t=e.next();for(;!t.done;){const r=s.read(t.value);if(null==r||r.length!==t.value)throw new Error("Insufficient data");o.extendedResults&&o.valueBytes.write(r),t=e.next(r)}a.push(b.nullcheck(t.value))}return a}static decodeFirst(e,t={},r=null){if(null==e)throw new TypeError("input required");({options:t,cb:r}=w(t,r));const{encoding:i="hex",required:o=!1,...s}=t,a=new b(s);let c=g;const u=n.guessEncoding(e,i),h=new Promise((e,t)=>{a.on("data",e=>{c=b.nullcheck(e),a.close()}),a.once("error",r=>a.extendedResults&&r instanceof _?(c.unused=a.bs.slice(),e(c)):(c!==g&&(r.value=c),c=y,a.close(),t(r))),a.once("end",()=>{switch(c){case g:return o?t(new Error("No CBOR found")):e(c);case y:return;default:return e(c)}})});return"function"==typeof r&&h.then(e=>r(null,e),r),u.pipe(a),h}static decodeAll(e,t={},r=null){if(null==e)throw new TypeError("input required");({options:t,cb:r}=w(t,r));const{encoding:i="hex",...o}=t,s=new b(o),a=[];s.on("data",e=>a.push(b.nullcheck(e)));const c=new Promise((e,t)=>{s.on("error",t),s.on("end",()=>e(a))});return"function"==typeof r&&c.then(e=>r(void 0,e),e=>r(e,void 0)),n.guessEncoding(e,i).pipe(s),c}close(){this.running=!1,this.__fresh=!0}_onRead(e){this.valueBytes.write(e)}*_parse(){let e=null,o=0,d=null;for(;;){if(this.max_depth>=0&&o>this.max_depth)throw new Error(`Maximum depth ${this.max_depth} exceeded`);const[p]=yield 1;if(!this.running)throw this.bs.unshift(h.from([p])),new _(p);const y=p>>5,g=31&p,w=null==e?void 0:e[l],P=null==e?void 0:e.length;switch(g){case a.ONE:this.emit("more-bytes",y,1,w,P),[d]=yield 1;break;case a.TWO:case a.FOUR:case a.EIGHT:{const e=1<<g-24;this.emit("more-bytes",y,e,w,P);const t=yield e;d=y===s.SIMPLE_FLOAT?t:n.parseCBORint(g,t);break}case 28:case 29:case 30:throw this.running=!1,new Error(`Additional info not implemented: ${g}`);case a.INDEFINITE:switch(y){case s.POS_INT:case s.NEG_INT:case s.TAG:throw new Error(`Invalid indefinite encoding for MT ${y}`)}d=-1;break;default:d=g}switch(y){case s.POS_INT:break;case s.NEG_INT:d=d===Number.MAX_SAFE_INTEGER?u.NEG_MAX:"bigint"==typeof d?u.MINUS_ONE-d:-1-d;break;case s.BYTE_STRING:case s.UTF8_STRING:switch(d){case 0:this.emit("start-string",y,d,w,P),d=y===s.UTF8_STRING?"":this.preferWeb?new Uint8Array(0):h.allocUnsafe(0);break;case-1:this.emit("start",y,c.STREAM,w,P),e=m(e,y),o++;continue;default:this.emit("start-string",y,d,w,P),d=yield d,y===s.UTF8_STRING?d=n.utf8(d):this.preferWeb&&(d=new Uint8Array(d.buffer,d.byteOffset,d.length))}break;case s.ARRAY:case s.MAP:switch(d){case 0:d=y===s.MAP?this.preferMap?new Map:{}:[];break;case-1:this.emit("start",y,c.STREAM,w,P),e=E(e,y,-1),o++;continue;default:this.emit("start",y,d,w,P),e=E(e,y,d*(y-3)),o++;continue}break;case s.TAG:this.emit("start",y,d,w,P),e=E(e,y,1),e.push(d),o++;continue;case s.SIMPLE_FLOAT:if("number"==typeof d){if(g===a.ONE&&d<32)throw new Error(`Invalid two-byte encoding of simple value ${d}`);const t=null!=e;d=r.decode(d,t,t&&e[f]<0)}else d=n.parseCBORfloat(d)}this.emit("value",d,w,P,g);let I=!1;for(;null!=e;){if(d===c.BREAK)e[f]=1;else if(Array.isArray(e))e.push(d);else{const t=e[l];if(null!=t&&t!==y)throw this.running=!1,new Error("Invalid major type in indefinite encoding");e.write(d)}if(0!==--e[f]){I=!0;break}if(--o,delete e[f],Array.isArray(e))switch(e[l]){case s.ARRAY:d=e;break;case s.MAP:{let t=!this.preferMap;if(e.length%2!=0)throw new Error(`Invalid map length: ${e.length}`);for(let r=0,n=e.length;t&&r<n;r+=2)if("string"!=typeof e[r]||"__proto__"===e[r]){t=!1;break}if(t){d={};for(let t=0,r=e.length;t<r;t+=2){if(this.preventDuplicateKeys&&Object.prototype.hasOwnProperty.call(d,e[t]))throw new Error("Duplicate keys in a map");d[e[t]]=e[t+1]}}else{d=new Map;for(let t=0,r=e.length;t<r;t+=2){if(this.preventDuplicateKeys&&d.has(e[t]))throw new Error("Duplicate keys in a map");d.set(e[t],e[t+1])}}break}case s.TAG:d=new t(e[0],e[1]).convert(this.tags);break}else if(e instanceof i)switch(e[l]){case s.BYTE_STRING:d=e.slice(),this.preferWeb&&(d=new Uint8Array(d.buffer,d.byteOffset,d.length));break;case s.UTF8_STRING:d=e.toString("utf-8")}this.emit("stop",e[l]);const r=e;e=e[c.PARENT],delete r[c.PARENT],delete r[l]}if(!I){if(this.extendedResults){const e=this.valueBytes.slice(),t={value:b.nullcheck(d),bytes:e,length:e.length};return this.valueBytes=new i,t}return d}}}}return b.NOT_FOUND=g,z=b}function pe(){if(J)return W;J=1;const e=p,t=he(),r=de(),n=D(),{MT:i,NUMBYTES:o,SYMS:s}=ue(),{Buffer:a}=d;function c(e){return e>1?"s":""}class u extends e.Transform{constructor(e={}){const{depth:t=1,max_depth:i=10,no_summary:o=!1,tags:s={},preferWeb:a,encoding:c,...u}=e;super({...u,readableObjectMode:!1,writableObjectMode:!1}),this.depth=t,this.max_depth=i,this.all=new n,s[24]||(s[24]=this._tag_24.bind(this)),this.parser=new r({tags:s,max_depth:i,preferWeb:a,encoding:c}),this.parser.on("value",this._on_value.bind(this)),this.parser.on("start",this._on_start.bind(this)),this.parser.on("start-string",this._on_start_string.bind(this)),this.parser.on("stop",this._on_stop.bind(this)),this.parser.on("more-bytes",this._on_more.bind(this)),this.parser.on("error",this._on_error.bind(this)),o||this.parser.on("data",this._on_data.bind(this)),this.parser.bs.on("read",this._on_read.bind(this))}_tag_24(e){const t=new u({depth:this.depth+1,no_summary:!0});t.on("data",e=>this.push(e)),t.on("error",e=>this.emit("error",e)),t.end(e)}_transform(e,t,r){this.parser.write(e,t,r)}_flush(e){return this.parser._flush(e)}static comment(e,r={},i=null){if(null==e)throw new Error("input required");({options:r,cb:i}=function(e,t){switch(typeof e){case"function":return{options:{},cb:e};case"string":return{options:{encoding:e},cb:t};case"number":return{options:{max_depth:e},cb:t};case"object":return{options:e||{},cb:t};default:throw new TypeError("Unknown option type")}}(r,i));const o=new n,{encoding:s="hex",...a}=r,c=new u(a);let h=null;return"function"==typeof i?(c.on("end",()=>{i(null,o.toString("utf8"))}),c.on("error",i)):h=new Promise((e,t)=>{c.on("end",()=>{e(o.toString("utf8"))}),c.on("error",t)}),c.pipe(o),t.guessEncoding(e,s).pipe(c),h}_on_error(e){this.push("ERROR: "),this.push(e.toString()),this.push("\n")}_on_read(e){this.all.write(e);const t=e.toString("hex");this.push(new Array(this.depth+1).join(" ")),this.push(t);let r=2*(this.max_depth-this.depth)-t.length;r<1&&(r=1),this.push(new Array(r+1).join(" ")),this.push("-- ")}_on_more(e,t,r,n){let o="";switch(this.depth++,e){case i.POS_INT:o="Positive number,";break;case i.NEG_INT:o="Negative number,";break;case i.ARRAY:o="Array, length";break;case i.MAP:o="Map, count";break;case i.BYTE_STRING:o="Bytes, length";break;case i.UTF8_STRING:o="String, length";break;case i.SIMPLE_FLOAT:o=1===t?"Simple value,":"Float,"}this.push(`${o} next ${t} byte${c(t)}\n`)}_on_start_string(e,t,r,n){let o="";switch(this.depth++,e){case i.BYTE_STRING:o=`Bytes, length: ${t}`;break;case i.UTF8_STRING:o=`String, length: ${t.toString()}`}this.push(`${o}\n`)}_on_start(e,t,r,n){switch(this.depth++,r){case i.ARRAY:this.push(`[${n}], `);break;case i.MAP:n%2?this.push(`{Val:${Math.floor(n/2)}}, `):this.push(`{Key:${Math.floor(n/2)}}, `)}switch(e){case i.TAG:this.push(`Tag #${t}`),24===t&&this.push(" Encoded CBOR data item");break;case i.ARRAY:t===s.STREAM?this.push("Array (streaming)"):this.push(`Array, ${t} item${c(t)}`);break;case i.MAP:t===s.STREAM?this.push("Map (streaming)"):this.push(`Map, ${t} pair${c(t)}`);break;case i.BYTE_STRING:this.push("Bytes (streaming)");break;case i.UTF8_STRING:this.push("String (streaming)")}this.push("\n")}_on_stop(e){this.depth--}_on_value(e,r,n,c){if(e!==s.BREAK)switch(r){case i.ARRAY:this.push(`[${n}], `);break;case i.MAP:n%2?this.push(`{Val:${Math.floor(n/2)}}, `):this.push(`{Key:${Math.floor(n/2)}}, `)}const u=t.cborValueToString(e,-1/0);switch("string"==typeof e||a.isBuffer(e)?(e.length>0&&(this.push(u),this.push("\n")),this.depth--):(this.push(u),this.push("\n")),c){case o.ONE:case o.TWO:case o.FOUR:case o.EIGHT:this.depth--}}_on_data(){this.push("0x"),this.push(this.all.read().toString("hex")),this.push("\n")}}return W=u}function ye(){if(X)return q;X=1;const e=p,t=de(),r=he(),n=D(),{MT:i,SYMS:o}=ue();class s extends e.Transform{constructor(e={}){const{separator:r="\n",stream_errors:n=!1,tags:i,max_depth:o,preferWeb:s,encoding:a,...c}=e;super({...c,readableObjectMode:!1,writableObjectMode:!1}),this.float_bytes=-1,this.separator=r,this.stream_errors=n,this.parser=new t({tags:i,max_depth:o,preferWeb:s,encoding:a}),this.parser.on("more-bytes",this._on_more.bind(this)),this.parser.on("value",this._on_value.bind(this)),this.parser.on("start",this._on_start.bind(this)),this.parser.on("stop",this._on_stop.bind(this)),this.parser.on("data",this._on_data.bind(this)),this.parser.on("error",this._on_error.bind(this))}_transform(e,t,r){this.parser.write(e,t,r)}_flush(e){this.parser._flush(t=>this.stream_errors?(t&&this._on_error(t),e()):e(t))}static diagnose(e,t={},i=null){if(null==e)throw new TypeError("input required");({options:t,cb:i}=function(e,t){switch(typeof e){case"function":return{options:{},cb:e};case"string":return{options:{encoding:e},cb:t};case"object":return{options:e||{},cb:t};default:throw new TypeError("Unknown option type")}}(t,i));const{encoding:o="hex",...a}=t,c=new n,u=new s(a);let h=null;return"function"==typeof i?(u.on("end",()=>i(null,c.toString("utf8"))),u.on("error",i)):h=new Promise((e,t)=>{u.on("end",()=>e(c.toString("utf8"))),u.on("error",t)}),u.pipe(c),r.guessEncoding(e,o).pipe(u),h}_on_error(e){this.stream_errors?this.push(e.toString()):this.emit("error",e)}_on_more(e,t,r,n){e===i.SIMPLE_FLOAT&&(this.float_bytes={2:1,4:2,8:3}[t])}_fore(e,t){switch(e){case i.BYTE_STRING:case i.UTF8_STRING:case i.ARRAY:t>0&&this.push(", ");break;case i.MAP:t>0&&(t%2?this.push(": "):this.push(", "))}}_on_value(e,t,n){if(e===o.BREAK)return;this._fore(t,n);const i=this.float_bytes;this.float_bytes=-1,this.push(r.cborValueToString(e,i))}_on_start(e,t,r,n){switch(this._fore(r,n),e){case i.TAG:this.push(`${t}(`);break;case i.ARRAY:this.push("[");break;case i.MAP:this.push("{");break;case i.BYTE_STRING:case i.UTF8_STRING:this.push("(")}t===o.STREAM&&this.push("_ ")}_on_stop(e){switch(e){case i.TAG:this.push(")");break;case i.ARRAY:this.push("]");break;case i.MAP:this.push("}");break;case i.BYTE_STRING:case i.UTF8_STRING:this.push(")")}}_on_data(){this.push(this.separator)}}return q=s}function ge(){if(Z)return Q;Z=1;const e=p,t=D(),r=he(),n=ue(),{MT:i,NUMBYTES:o,SHIFT32:s,SIMPLE:a,SYMS:c,TAG:u,BI:h}=n,{Buffer:f}=d,l=i.SIMPLE_FLOAT<<5|o.TWO,y=i.SIMPLE_FLOAT<<5|o.FOUR,g=i.SIMPLE_FLOAT<<5|o.EIGHT,E=i.SIMPLE_FLOAT<<5|a.TRUE,m=i.SIMPLE_FLOAT<<5|a.FALSE,_=i.SIMPLE_FLOAT<<5|a.UNDEFINED,w=i.SIMPLE_FLOAT<<5|a.NULL,b=f.from([255]),P=f.from("f97e00","hex"),I=f.from("f9fc00","hex"),A=f.from("f97c00","hex"),T=f.from("f98000","hex"),O={};let v={};class S extends e.Transform{constructor(e={}){const{canonical:t=!1,encodeUndefined:r,disallowUndefinedKeys:n=!1,dateType:i="number",collapseBigIntegers:o=!1,detectLoops:s=!1,omitUndefinedProperties:a=!1,genTypes:c=[],...u}=e;if(super({...u,readableObjectMode:!1,writableObjectMode:!0}),this.canonical=t,this.encodeUndefined=r,this.disallowUndefinedKeys=n,this.dateType=function(e){if(!e)return"number";switch(e.toLowerCase()){case"number":return"number";case"float":return"float";case"int":case"integer":return"int";case"string":return"string"}throw new TypeError(`dateType invalid, got "${e}"`)}(i),this.collapseBigIntegers=!!this.canonical||o,this.detectLoops=void 0,"boolean"==typeof s)s&&(this.detectLoops=new WeakSet);else{if(!(s instanceof WeakSet))throw new TypeError("detectLoops must be boolean or WeakSet");this.detectLoops=s}if(this.omitUndefinedProperties=a,this.semanticTypes={...S.SEMANTIC_TYPES},Array.isArray(c))for(let e=0,t=c.length;e<t;e+=2)this.addSemanticType(c[e],c[e+1]);else for(const[e,t]of Object.entries(c))this.addSemanticType(e,t)}_transform(e,t,r){r(!1===this.pushAny(e)?new Error("Push Error"):void 0)}_flush(e){e()}_pushUInt8(e){const t=f.allocUnsafe(1);return t.writeUInt8(e,0),this.push(t)}_pushUInt16BE(e){const t=f.allocUnsafe(2);return t.writeUInt16BE(e,0),this.push(t)}_pushUInt32BE(e){const t=f.allocUnsafe(4);return t.writeUInt32BE(e,0),this.push(t)}_pushFloatBE(e){const t=f.allocUnsafe(4);return t.writeFloatBE(e,0),this.push(t)}_pushDoubleBE(e){const t=f.allocUnsafe(8);return t.writeDoubleBE(e,0),this.push(t)}_pushNaN(){return this.push(P)}_pushInfinity(e){const t=e<0?I:A;return this.push(t)}_pushFloat(e){if(this.canonical){const t=f.allocUnsafe(2);if(r.writeHalf(t,e))return this._pushUInt8(l)&&this.push(t)}return Math.fround(e)===e?this._pushUInt8(y)&&this._pushFloatBE(e):this._pushUInt8(g)&&this._pushDoubleBE(e)}_pushInt(e,t,r){const n=t<<5;if(e<24)return this._pushUInt8(n|e);if(e<=255)return this._pushUInt8(n|o.ONE)&&this._pushUInt8(e);if(e<=65535)return this._pushUInt8(n|o.TWO)&&this._pushUInt16BE(e);if(e<=4294967295)return this._pushUInt8(n|o.FOUR)&&this._pushUInt32BE(e);let a=Number.MAX_SAFE_INTEGER;return t===i.NEG_INT&&a--,e<=a?this._pushUInt8(n|o.EIGHT)&&this._pushUInt32BE(Math.floor(e/s))&&this._pushUInt32BE(e%s):t===i.NEG_INT?this._pushFloat(r):this._pushFloat(e)}_pushIntNum(e){return Object.is(e,-0)?this.push(T):e<0?this._pushInt(-e-1,i.NEG_INT,e):this._pushInt(e,i.POS_INT)}_pushNumber(e){return isNaN(e)?this._pushNaN():isFinite(e)?Math.round(e)===e?this._pushIntNum(e):this._pushFloat(e):this._pushInfinity(e)}_pushString(e){const t=f.byteLength(e,"utf8");return this._pushInt(t,i.UTF8_STRING)&&this.push(e,"utf8")}_pushBoolean(e){return this._pushUInt8(e?E:m)}_pushUndefined(e){switch(typeof this.encodeUndefined){case"undefined":return this._pushUInt8(_);case"function":return this.pushAny(this.encodeUndefined(e));case"object":{const e=r.bufferishToBuffer(this.encodeUndefined);if(e)return this.push(e)}}return this.pushAny(this.encodeUndefined)}_pushNull(e){return this._pushUInt8(w)}_pushTag(e){return this._pushInt(e,i.TAG)}_pushJSBigint(e){let t=i.POS_INT,r=u.POS_BIGINT;if(e<0&&(e=-e+h.MINUS_ONE,t=i.NEG_INT,r=u.NEG_BIGINT),this.collapseBigIntegers&&e<=h.MAXINT64)return e<=4294967295?this._pushInt(Number(e),t):this._pushUInt8(t<<5|o.EIGHT)&&this._pushUInt32BE(Number(e/h.SHIFT32))&&this._pushUInt32BE(Number(e%h.SHIFT32));let n=e.toString(16);n.length%2&&(n=`0${n}`);const s=f.from(n,"hex");return this._pushTag(r)&&S._pushBuffer(this,s)}_pushObject(e,t){if(!e)return this._pushNull(e);if(!(t={indefinite:!1,skipTypes:!1,...t}).indefinite&&this.detectLoops){if(this.detectLoops.has(e))throw new Error("Loop detected while CBOR encoding.\nCall removeLoopDetectors before resuming.");this.detectLoops.add(e)}if(!t.skipTypes){const t=e.encodeCBOR;if("function"==typeof t)return t.call(e,this);const r=this.semanticTypes[e.constructor.name];if(r)return r.call(e,this,e)}const r=Object.keys(e).filter(t=>{const r=typeof e[t];return"function"!==r&&(!this.omitUndefinedProperties||"undefined"!==r)}),n={};if(this.canonical&&r.sort((e,t)=>{const r=n[e]||(n[e]=S.encode(e)),i=n[t]||(n[t]=S.encode(t));return r.compare(i)}),t.indefinite){if(!this._pushUInt8(i.MAP<<5|o.INDEFINITE))return!1}else if(!this._pushInt(r.length,i.MAP))return!1;let s=null;for(let t=0,i=r.length;t<i;t++){const i=r[t];if(this.canonical&&(s=n[i])){if(!this.push(s))return!1}else if(!this._pushString(i))return!1;if(!this.pushAny(e[i]))return!1}if(t.indefinite){if(!this.push(b))return!1}else this.detectLoops&&this.detectLoops.delete(e);return!0}_encodeAll(e){const r=new t({highWaterMark:this.readableHighWaterMark});this.pipe(r);for(const t of e)this.pushAny(t);return this.end(),r.read()}addSemanticType(e,t){const r="string"==typeof e?e:e.name,n=this.semanticTypes[r];if(t){if("function"!=typeof t)throw new TypeError("fun must be of type function");this.semanticTypes[r]=t}else n&&delete this.semanticTypes[r];return n}pushAny(e){switch(typeof e){case"number":return this._pushNumber(e);case"bigint":return this._pushJSBigint(e);case"string":return this._pushString(e);case"boolean":return this._pushBoolean(e);case"undefined":return this._pushUndefined(e);case"object":return this._pushObject(e);case"symbol":switch(e){case c.NULL:return this._pushNull(null);case c.UNDEFINED:return this._pushUndefined(void 0);default:throw new TypeError(`Unknown symbol: ${e.toString()}`)}default:throw new TypeError(`Unknown type: ${typeof e}, ${"function"==typeof e.toString?e.toString():""}`)}}static pushArray(e,t,r){r={indefinite:!1,...r};const n=t.length;if(r.indefinite){if(!e._pushUInt8(i.ARRAY<<5|o.INDEFINITE))return!1}else if(!e._pushInt(n,i.ARRAY))return!1;for(let r=0;r<n;r++)if(!e.pushAny(t[r]))return!1;return!(r.indefinite&&!e.push(b))}removeLoopDetectors(){return!!this.detectLoops&&(this.detectLoops=new WeakSet,!0)}static _pushDate(e,t){switch(e.dateType){case"string":return e._pushTag(u.DATE_STRING)&&e._pushString(t.toISOString());case"int":return e._pushTag(u.DATE_EPOCH)&&e._pushIntNum(Math.round(t.getTime()/1e3));case"float":return e._pushTag(u.DATE_EPOCH)&&e._pushFloat(t.getTime()/1e3);default:return e._pushTag(u.DATE_EPOCH)&&e.pushAny(t.getTime()/1e3)}}static _pushBuffer(e,t){return e._pushInt(t.length,i.BYTE_STRING)&&e.push(t)}static _pushNoFilter(e,t){return S._pushBuffer(e,t.slice())}static _pushRegexp(e,t){return e._pushTag(u.REGEXP)&&e.pushAny(t.source)}static _pushSet(e,t){if(!e._pushTag(u.SET))return!1;if(!e._pushInt(t.size,i.ARRAY))return!1;for(const r of t)if(!e.pushAny(r))return!1;return!0}static _pushURL(e,t){return e._pushTag(u.URI)&&e.pushAny(t.toString())}static _pushBoxed(e,t){return e.pushAny(t.valueOf())}static _pushMap(e,r,n){n={indefinite:!1,...n};let s=[...r.entries()];if(e.omitUndefinedProperties&&(s=s.filter(([e,t])=>void 0!==t)),n.indefinite){if(!e._pushUInt8(i.MAP<<5|o.INDEFINITE))return!1}else if(!e._pushInt(s.length,i.MAP))return!1;if(e.canonical){const r=new S({genTypes:e.semanticTypes,canonical:e.canonical,detectLoops:Boolean(e.detectLoops),dateType:e.dateType,disallowUndefinedKeys:e.disallowUndefinedKeys,collapseBigIntegers:e.collapseBigIntegers}),n=new t({highWaterMark:e.readableHighWaterMark});r.pipe(n),s.sort(([e],[t])=>{r.pushAny(e);const i=n.read();r.pushAny(t);const o=n.read();return i.compare(o)});for(const[t,r]of s){if(e.disallowUndefinedKeys&&void 0===t)throw new Error("Invalid Map key: undefined");if(!e.pushAny(t)||!e.pushAny(r))return!1}}else for(const[t,r]of s){if(e.disallowUndefinedKeys&&void 0===t)throw new Error("Invalid Map key: undefined");if(!e.pushAny(t)||!e.pushAny(r))return!1}return!(n.indefinite&&!e.push(b))}static _pushTypedArray(e,t){let n=64,i=t.BYTES_PER_ELEMENT;const{name:o}=t.constructor;return o.startsWith("Float")?(n|=16,i/=2):o.includes("U")||(n|=8),(o.includes("Clamped")||1!==i&&!r.isBigEndian())&&(n|=4),n|={1:0,2:1,4:2,8:3}[i],!!e._pushTag(n)&&S._pushBuffer(e,f.from(t.buffer,t.byteOffset,t.byteLength))}static _pushArrayBuffer(e,t){return S._pushBuffer(e,f.from(t))}static encodeIndefinite(e,t,n={}){if(null==t){if(null==this)throw new Error("No object to encode");t=this}const{chunkSize:s=4096}=n;let a=!0;const c=typeof t;let u=null;if("string"===c){a=a&&e._pushUInt8(i.UTF8_STRING<<5|o.INDEFINITE);let r=0;for(;r<t.length;){const n=r+s;a=a&&e._pushString(t.slice(r,n)),r=n}a=a&&e.push(b)}else if(u=r.bufferishToBuffer(t)){a=a&&e._pushUInt8(i.BYTE_STRING<<5|o.INDEFINITE);let t=0;for(;t<u.length;){const r=t+s;a=a&&S._pushBuffer(e,u.slice(t,r)),t=r}a=a&&e.push(b)}else if(Array.isArray(t))a=a&&S.pushArray(e,t,{indefinite:!0});else if(t instanceof Map)a=a&&S._pushMap(e,t,{indefinite:!0});else{if("object"!==c)throw new Error("Invalid indefinite encoding");a=a&&e._pushObject(t,{indefinite:!0,skipTypes:!0})}return a}static encode(...e){return(new S)._encodeAll(e)}static encodeCanonical(...e){return new S({canonical:!0})._encodeAll(e)}static encodeOne(e,t){return new S(t)._encodeAll([e])}static encodeAsync(e,t){return new Promise((r,n)=>{const i=[],o=new S(t);o.on("data",e=>i.push(e)),o.on("error",n),o.on("finish",()=>r(f.concat(i))),o.pushAny(e),o.end()})}static get SEMANTIC_TYPES(){return v}static set SEMANTIC_TYPES(e){v=e}static reset(){S.SEMANTIC_TYPES={...O}}}return Object.assign(O,{Array:S.pushArray,Date:S._pushDate,Buffer:S._pushBuffer,[f.name]:S._pushBuffer,Map:S._pushMap,NoFilter:S._pushNoFilter,[t.name]:S._pushNoFilter,RegExp:S._pushRegexp,Set:S._pushSet,ArrayBuffer:S._pushArrayBuffer,Uint8ClampedArray:S._pushTypedArray,Uint8Array:S._pushTypedArray,Uint16Array:S._pushTypedArray,Uint32Array:S._pushTypedArray,Int8Array:S._pushTypedArray,Int16Array:S._pushTypedArray,Int32Array:S._pushTypedArray,Float32Array:S._pushTypedArray,Float64Array:S._pushTypedArray,URL:S._pushURL,Boolean:S._pushBoxed,Number:S._pushBoxed,String:S._pushBoxed}),"undefined"!=typeof BigUint64Array&&(O[BigUint64Array.name]=S._pushTypedArray),"undefined"!=typeof BigInt64Array&&(O[BigInt64Array.name]=S._pushTypedArray),S.reset(),Q=S}function Ee(){if(te)return ee;te=1;const{Buffer:e}=d,t=ge(),r=de(),{MT:n}=ue();class i extends Map{constructor(e){super(e)}static _encode(e){return t.encodeCanonical(e).toString("base64")}static _decode(e){return r.decodeFirstSync(e,"base64")}get(e){return super.get(i._encode(e))}set(e,t){return super.set(i._encode(e),t)}delete(e){return super.delete(i._encode(e))}has(e){return super.has(i._encode(e))}*keys(){for(const e of super.keys())yield i._decode(e)}*entries(){for(const e of super.entries())yield[i._decode(e[0]),e[1]]}[Symbol.iterator](){return this.entries()}forEach(e,t=this){if("function"!=typeof e)throw new TypeError("Must be function");for(const r of super.entries())e.call(t,r[1],i._decode(r[0]),this)}encodeCBOR(t){if(!t._pushInt(this.size,n.MAP))return!1;if(t.canonical){const r=Array.from(super.entries()).map(t=>[e.from(t[0],"base64"),t[1]]);r.sort((e,t)=>e[0].compare(t[0]));for(const e of r)if(!t.push(e[0])||!t.pushAny(e[1]))return!1}else for(const r of super.entries())if(!t.push(e.from(r[0],"base64"))||!t.pushAny(r[1]))return!1;return!0}}return ee=i}function me(){if(oe)return ie;oe=1;const e=ge(),t=function(){if(ne)return re;ne=1;class e{constructor(){this.clear()}clear(){this.map=new WeakMap,this.count=0,this.recording=!0}stop(){this.recording=!1}check(t){const r=this.map.get(t);if(r)return r.length>1?r[0]||this.recording?r[1]:(r[0]=!0,e.FIRST):this.recording?(r.push(this.count++),r[1]):e.NEVER;if(!this.recording)throw new Error("New object detected when not recording");return this.map.set(t,[!1]),e.NEVER}}return e.NEVER=-1,e.FIRST=-2,re=e}(),{Buffer:r}=d;class n extends e{constructor(e){super(e),this.valueSharing=new t}_pushObject(e,r){if(null!==e){const r=this.valueSharing.check(e);switch(r){case t.FIRST:this._pushTag(28);break;case t.NEVER:break;default:return this._pushTag(29)&&this._pushIntNum(r)}}return super._pushObject(e,r)}stopRecording(){this.valueSharing.stop()}clearRecording(){this.valueSharing.clear()}static encode(...e){const t=new n;t.on("data",()=>{});for(const r of e)t.pushAny(r);return t.stopRecording(),t.removeAllListeners("data"),t._encodeAll(e)}static encodeCanonical(...e){throw new Error("Cannot encode canonically in a SharedValueEncoder, which serializes objects multiple times.")}static encodeOne(e,t){const r=new n(t);return r.on("data",()=>{}),r.pushAny(e),r.stopRecording(),r.removeAllListeners("data"),r._encodeAll([e])}static encodeAsync(e,t){return new Promise((i,o)=>{const s=[],a=new n(t);a.on("data",()=>{}),a.on("error",o),a.on("finish",()=>i(r.concat(s))),a.pushAny(e),a.stopRecording(),a.removeAllListeners("data"),a.on("data",e=>s.push(e)),a.pushAny(e),a.end()})}}return ie=n}var _e=function(){if(ae)return se;ae=1;const e=pe(),t=ye(),r=de(),n=ge(),i=le(),o=fe(),s=Ee(),a=me();return se={Commented:e,Diagnose:t,Decoder:r,Encoder:n,Simple:i,Tagged:o,Map:s,SharedValueEncoder:a,comment:e.comment,decodeAll:r.decodeAll,decodeFirst:r.decodeFirst,decodeAllSync:r.decodeAllSync,decodeFirstSync:r.decodeFirstSync,diagnose:t.diagnose,encode:n.encode,encodeCanonical:n.encodeCanonical,encodeOne:n.encodeOne,encodeAsync:n.encodeAsync,decode:r.decodeFirstSync,leveldb:{decode:r.decodeFirstSync,encode:n.encode,buffer:!0,name:"cbor"},reset(){n.reset(),o.reset()}}}(),we=h(_e);function be(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[t,e]))}class Pe{constructor(e){if(!function(e){if("string"!=typeof e)return!1;if(e.length<=1)return!1;if("z"!==e[0])return!1;const t=e.slice(1);return/^[1-9A-HJ-NP-Za-km-z]+$/.test(t)}(e))throw new Error("Base58 string is invalid. Cannot construct Decoder.");this.base58=e}constructRootJSON(e){const t=be(L.root);return e.reduce((e,r)=>{const n=t[r[0]];let i=r[1];return i instanceof Array&&("anchors"===n&&(i=this.constructAnchorsJSON(i)),"path"===n&&(i=this.constructPathJSON(i))),(i instanceof a||i instanceof Uint8Array)&&(i=we.decode(i).toString("hex")),e[n]=i,e},{})}constructAnchorsJSON(e){const t=(r=L.chain,n=e=>e.id,Object.entries(r).reduce((e,[t,r])=>{const i=n(r);return(e[i]||=[]).push(t),e},{}));var r,n;return e.map(e=>e.reduce((e,r)=>{if(0===r[0])return`${e}:${t[r[1]]}`;if(1===r[0]){const t=e.split(":").pop();return`${e}:${be(L.chain[t].networks)[r[1]]}`}return`${e}:${we.decode(r[1]).toString("hex")}`},"blink"))}constructPathJSON(e){const t=be(L.path);return e.map(e=>({[t[e[0]]]:we.decode(e[1]).toString("hex")}))}decode(){const e=c(this.base58.slice(1)),t=we.decode(a.from(e));return this.constructRootJSON(t)}}function Ie(e){return Object.keys(s).map(e=>s[e]).find(t=>t.signatureValue===e)}function Ae(e=null){if(e?.anchors){const{anchors:t}=e,r=t[0];if("string"==typeof r)return function(e){const t=e.split(":");let r;switch(t[1]){case s.mocknet.blinkCode:return Ie(s.mocknet.signatureValue);case s.bitcoin.blinkCode:r=s.bitcoin.name;break;case s.ethmain.blinkCode:r=s.ethmain.name;break;default:throw new Error("Could not retrieve chain.")}const n=t[2],i=r.toLowerCase()+function(e){const t=e.substr(0,1),r=e.substr(1,e.length-1);return t.toUpperCase()+r.toLowerCase()}(n);return Ie(i)}(r)}return null}function Te(e,t){const r=e.findIndex(e=>e===t);r>-1&&e.splice(r,1)}class Oe extends Error{stepCode;constructor(e,t){super(t),this.stepCode=e}}var ve="en-US",Se={"en-US":{errors:{assertProofValidityPurposeVerifier:"Invalid proof purpose. Expected ${expectedProofPurpose} but received ${proof.proofPurpose}",assertProofValidityPurposeIssuerKey:"The verification method ${proof.verificationMethod} is not allowed for the proof purpose ${expectedProofPurpose}",assertProofValidityDomainVerifier:"The proof is not authorized for this domain",assertProofValidityInvalidChallenge:"The proof's challenge does not match the verifier's challenge",assertProofValidityNoProofPurpose:"`proofPurpose` property is missing from proof",assertProofValidityNoCreated:"`created` property is missing from proof",ensureHashesEqual:"Computed hash does not match remote hash",ensureMerkleRootEqual:"Merkle root does not match remote hash.",ensureValidReceipt:"The receipt is malformed. There was a problem navigating the merkle tree in the receipt.",failedJsonLdNormalization:"Failed JSON-LD normalization",foundUnmappedFields:"Found unmapped fields during JSON-LD normalization",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Cannot verify this certificate without a transaction ID to compare against.",invalidMerkleReceipt:"Invalid Merkle Receipt. Proof hash did not match Merkle root",isTransactionIdValid:"Cannot verify this certificate without a transaction ID to compare against.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},fr:{errors:{assertProofValidityPurposeVerifier:"Objectif de la signature invalide. Attendu: ${expectedProofPurpose} mais la signature a un objectif de ${proof.proofPurpose}",assertProofValidityPurposeIssuerKey:"La méthode de vérification ${proof.verificationMethod} n'est pas autorisée pour l'objectif de verification: ${expectedProofPurpose}",assertProofValidityDomainVerifier:"La signature n'est pas autorisée pour ce domaine",assertProofValidityInvalidChallenge:"Le challenge de la signature ne correspond pas au challenge de vérification",assertProofValidityNoProofPurpose:"La propriété `proofPurpose` est manquante dans la signature",assertProofValidityNoCreated:"La propriété `created` est manquante dans la signature",ensureHashesEqual:"Calcul du hash local différent du hash distant",ensureMerkleRootEqual:"Le Merkle root ne correspond pas au hash distant",ensureValidReceipt:"Erreur d'écriture du reçu. Un problème est survenu lors de la navigation de l'arbre Merkle du reçu.",failedJsonLdNormalization:"Erreur de normalisation JSON-LD",foundUnmappedFields:"Champs non liés découverts durant la normalisation JSON-LD",identityErrorBaseMessage:"Identité de l'émetteur invalide",deriveIssuingAddressFromPublicKey:"Cette blockchain n'est pas supportée pour la vérification de l'identité décentralisée.",compareIssuingAddress:"La méthode de vérification n'a pas permis d'établir l'identité de l'émetteur.",getTransactionId:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",invalidMerkleReceipt:"Reçu Merkle invalide. Hash de preuve différent du Merkle root",isTransactionIdValid:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",noProofSpecified:"La propriété 'proof' du document est un tableau mais aucune preuve n'a été passée pour savoir ce qu'il faut vérifier"}},es:{errors:{assertProofValidityPurposeVerifier:"Objectivo de verificación invalido. Se esperaba ${expectedProofPurpose} pero recibió ${proof.proofPurpose}",assertProofValidityPurposeIssuerKey:"El método de verificación ${proof.verificationMethod} no está permitido para el objectivo de verificación ${expectedProofPurpose}",assertProofValidityDomainVerifier:"La prueba no está autorizada para este dominio",assertProofValidityInvalidChallenge:"El reto de la prueba no coincide con el reto de verificación",assertProofValidityNoProofPurpose:"Falta propiedad `proofPurpose` en la prueba",assertProofValidityNoCreated:"Falta propiedad `created` en la prueba",ensureHashesEqual:"La cadena binaria calculada no corresponde con la cadena binaria remota",ensureMerkleRootEqual:"La raíz Merkle no corresponde con la cadena binaria remota",ensureValidReceipt:"El recibo está malformado. Hubo un problema navegando el árbol Merkle en el recibo",failedJsonLdNormalization:"La normalización del JSON-LD ha fallado",foundUnmappedFields:"Se han encontrado campos no mapeados durante la normalización de JSON-LD",identityErrorBaseMessage:"Identitad del emisor inválida",deriveIssuingAddressFromPublicKey:"No se puede validar la identitad decentalisada con esta cadena binaria.",compareIssuingAddress:"El metodo de verificación no corresponde a la identitad del emisor.",getTransactionId:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",invalidMerkleReceipt:"Recibo Merkle inválido. La cadena binaria de prueba no corresponde con la raíz Merkle",isTransactionIdValid:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",noProofSpecified:"La propiedad 'proof' del documento es una lista, pero no prueba especifica ha sido declarada para conocer el punto de verificación"}},mt:{errors:{assertProofValidityPurposeVerifier:"Invalid proof purpose. Expected ${expectedProofPurpose} but received ${proof.proofPurpose}",assertProofValidityPurposeIssuerKey:"The verification method ${proof.verificationMethod} is not allowed for the proof purpose ${expectedProofPurpose}",assertProofValidityDomainVerifier:"The proof is not authorized for this domain",assertProofValidityInvalidChallenge:"The proof's challenge does not match the verifier's challenge",assertProofValidityNoProofPurpose:"`proofPurpose` property is missing from proof",assertProofValidityNoCreated:"`created` property is missing from proof",ensureHashesEqual:"Il-hash ikkalkulat ma jikkorrispondix mar-remote hash",ensureMerkleRootEqual:"Merkle root ma taqbilx mar-remote hash",ensureValidReceipt:"L-irċevuta hija malformata. Kien hemm problema fin-navigazzjoni tal-merkle tree fl-irċevuta",failedJsonLdNormalization:"In-normalizzazzjoni ta' JSON-LD ma rnexxietx",foundUnmappedFields:"Instabu unmapped fields matul in-normalizzazzjoni JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",invalidMerkleReceipt:"Irċevuta Merkle invalida. Il-proof hash ma kienx jaqbel mal-Merkle root",isTransactionIdValid:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},"it-IT":{errors:{assertProofValidityPurposeVerifier:"Invalid proof purpose. Expected ${expectedProofPurpose} but received ${proof.proofPurpose}",assertProofValidityPurposeIssuerKey:"The verification method ${proof.verificationMethod} is not allowed for the proof purpose ${expectedProofPurpose}",assertProofValidityDomainVerifier:"The proof is not authorized for this domain",assertProofValidityInvalidChallenge:"The proof's challenge does not match the verifier's challenge",assertProofValidityNoProofPurpose:"`proofPurpose` property is missing from proof",assertProofValidityNoCreated:"`created` property is missing from proof",ensureHashesEqual:"L'hash calcolato non corrisponde all'hash remoto",ensureMerkleRootEqual:"La radice di Merkle non corrisponde all'hash remoto.",ensureValidReceipt:"La ricevuta è malformata. C'è stato un problema nella navigazione dell'albero di Merkle nella ricevuta.",failedJsonLdNormalization:"Normalizzazione JSON-LD fallita",foundUnmappedFields:"Campi non mappati trovati durante la normalizzazione JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",invalidMerkleReceipt:"Ricevuta Merkle non valida. L'hash di prova non corrisponde alla radice di Merkle",isTransactionIdValid:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},ja:{errors:{assertProofValidityPurposeVerifier:"Invalid proof purpose. Expected ${expectedProofPurpose} but received ${proof.proofPurpose}",assertProofValidityPurposeIssuerKey:"The verification method ${proof.verificationMethod} is not allowed for the proof purpose ${expectedProofPurpose}",assertProofValidityDomainVerifier:"The proof is not authorized for this domain",assertProofValidityInvalidChallenge:"The proof's challenge does not match the verifier's challenge",assertProofValidityNoProofPurpose:"`proofPurpose` property is missing from proof",assertProofValidityNoCreated:"`created` property is missing from proof",ensureHashesEqual:"算出されたハッシュがリモートハッシュと一致しませんでした",ensureMerkleRootEqual:"Merkle rootがリモートハッシュと一致しませんでした",ensureValidReceipt:"レシートが異常です。レシート内のMerkle treeを辿る際に問題が発生しました。",failedJsonLdNormalization:"JSON-LDの正規化に失敗しました",foundUnmappedFields:"JSON-LDの正規化時にマップされていないフィールドを検出しました",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"照合のための取引IDがないため、この証明書を認証できません。",invalidMerkleReceipt:"Merkleレシートが無効です。証明ハッシュがMerkle rootと一致しませんでした。",isTransactionIdValid:"照合するための取引IDがないため、この証明書を認証できません。",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}}};function Ne(e,t){return t?Se[ve]?Se[ve][e]?Se[ve][e][t]?Se[ve][e][t]||"":"[missing locale item data]":"[missing locale group data]":"[missing locale data]":""}function Ue({expectedProofPurpose:e,expectedDomain:t,expectedChallenge:r,proof:n,issuer:i}){if(!n.proofPurpose)throw new Oe("assertProofValidity",Ne("errors","assertProofValidityNoProofPurpose"));if(!n.created)throw new Oe("assertProofValidity",Ne("errors","assertProofValidityNoCreated"));return n.proofPurpose&&function({expectedProofPurpose:e,proof:t,issuer:r}){if(t.proofPurpose!==e)throw new Oe("assertProofValidity",Ne("errors","assertProofValidityPurposeVerifier").replace("${expectedProofPurpose}",e).replace("${proof.proofPurpose}",t.proofPurpose));if(r&&!r[e]?.includes(t.verificationMethod))throw new Oe("assertProofValidity",Ne("errors","assertProofValidityPurposeIssuerKey").replace("${proof.verificationMethod}",t.verificationMethod).replace("${expectedProofPurpose}",e));"authentication"!==e||t.domain||console.warn("No domain found in proof, but it is recommended for authentication purposes")}({expectedProofPurpose:e,proof:n,issuer:i}),n.domain&&function({expectedDomain:e,proof:t,expectedChallenge:r}){if(!e.includes(t.domain))throw new Oe("assertProofValidity",Ne("errors","assertProofValidityDomainVerifier").replace("${expectedDomain}",e.join(", ")).replace("${proof.domain}",t.domain));if(t.domain&&!t.challenge&&console.warn("No challenge found in proof, but it is recommended for domain verification"),t.challenge&&t.challenge!==r)throw new Oe("assertProofValidity",Ne("errors","assertProofValidityInvalidChallenge"))}({expectedDomain:t,proof:n,expectedChallenge:r}),!0}var Re={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",creator:{"@id":"dc:creator","@type":"@id"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"sec:expiration","@type":"xsd:dateTime"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:"bc:verification",publicKeys:"bc:publicKeys",ChainpointSHA256v2:"cp:ChainpointSHA256v2",BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/merkleProof2017Schema.json"}]},ke={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"bc:created","@type":"xsd:dateTime"},name:{"@id":"schema:name"}}},Be={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType","@type":"@id"},contentEncoding:{"@id":"bc:contentEncoding","@type":"@id"},content:{"@id":"bc:content","@type":"@id"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey","@type":"@id"},url:{"@id":"schema:url","@type":"@id"},image:{"@id":"schema:image","@type":"@id"}}},Me={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},Ed25519VerificationKey2020:{"@id":"https://w3id.org/security#Ed25519VerificationKey2020","@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"},publicKeyMultibase:{"@id":"https://w3id.org/security#publicKeyMultibase","@type":"https://w3id.org/security#multibase"}}},Ed25519Signature2020:{"@id":"https://w3id.org/security#Ed25519Signature2020","@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"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}};function Le(e){e=e.trim();const t=[];for(let r=0;r<e.length;r+=2)t.push(parseInt(e.substring(r,r+2),16));return t}async function xe(e,t=null,r=async e=>Promise){e["@context"].find(e=>{return(t=e)===Object(t)&&"@vocab"in e;var t})||e["@context"].push({"@vocab":"http://fallback.org/"});const n=JSON.parse(JSON.stringify(e));if(Array.isArray(n.proof)){if(!t)throw new Oe("computeLocalHash",Ne("errors","noProofSpecified"));const e=n.proof.findIndex(e=>e.proofValue===t.proofValue);n.proof=n.proof.slice(0,e)}else delete n.proof;const i={algorithm:"URDNA2015",format:"application/nquads",documentLoader:async function(e){return null!=r&&await r(e),e in f?{contextUrl:null,document:f[e],documentUrl:e}:w.documentLoader(e)},safe:!1};let o;try{o=await w.normalize(n,i)}catch(e){throw console.error(e),new Oe("computeLocalHash",Ne("errors","failedJsonLdNormalization"))}const s=function(e){const t=e.split("\n"),r=/<http:\/\/fallback\.org\/(.*)>/,n=t.map(e=>r.exec(e)).filter(e=>null!=e);if(n.length>0){const e=n.map(e=>e[1]).sort();return Array.from(new Set(e))}return null}(o);if(s)throw new Oe("computeLocalHash",`${Ne("errors","foundUnmappedFields")}: ${s.join(", ")}`);return a.from(b(Uint8Array.from(function(e){const t=[];for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<55296||n>=57344?t.push(224|n>>12,128|n>>6&63,128|63&n):(r++,n=65536+((1023&n)<<10|1023&e.charCodeAt(r)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return t}(o)))).toString("hex")}f["https://w3id.org/blockcerts/schema/2.0-alpha/context.json"]=Re,f["https://www.blockcerts.org/schema/2.0-alpha/context.json"]=Re,f["https://www.blockcerts.org/schema/3.0-alpha/context.json"]=ke,f["https://w3id.org/blockcerts/schema/3.0-alpha/context.json"]=ke,f["https://w3id.org/blockcerts/v3.0-alpha"]=ke,f["https://www.blockcerts.org/schema/3.0-beta/context.json"]=Be,f["https://w3id.org/blockcerts/schema/3.0-beta/context.json"]=Be,f["https://w3id.org/blockcerts/v3.0-beta"]=Be,f["https://w3id.org/security/suites/ed25519-2020/v1"]=Me;const De=a,Ce=e=>{const t=(e=>{e={...e,crv:"K-256"};const t=I({jwk:e});return De.from(t).toString("hex")})(e);let r=De.from(t,"hex"),n=32-r.length;for(;n>0;)r=De.concat([De.from("00","hex"),r]),n--;return r},Ve={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128};var Fe,He=Object.freeze({__proto__:null,bitcoin:Ve,regtest:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},testnet:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}});!function(e){e[e.OP_FALSE=0]="OP_FALSE",e[e.OP_0=0]="OP_0",e[e.OP_PUSHDATA1=76]="OP_PUSHDATA1",e[e.OP_PUSHDATA2=77]="OP_PUSHDATA2",e[e.OP_PUSHDATA4=78]="OP_PUSHDATA4",e[e.OP_1NEGATE=79]="OP_1NEGATE",e[e.OP_RESERVED=80]="OP_RESERVED",e[e.OP_TRUE=81]="OP_TRUE",e[e.OP_1=81]="OP_1",e[e.OP_2=82]="OP_2",e[e.OP_3=83]="OP_3",e[e.OP_4=84]="OP_4",e[e.OP_5=85]="OP_5",e[e.OP_6=86]="OP_6",e[e.OP_7=87]="OP_7",e[e.OP_8=88]="OP_8",e[e.OP_9=89]="OP_9",e[e.OP_10=90]="OP_10",e[e.OP_11=91]="OP_11",e[e.OP_12=92]="OP_12",e[e.OP_13=93]="OP_13",e[e.OP_14=94]="OP_14",e[e.OP_15=95]="OP_15",e[e.OP_16=96]="OP_16",e[e.OP_NOP=97]="OP_NOP",e[e.OP_VER=98]="OP_VER",e[e.OP_IF=99]="OP_IF",e[e.OP_NOTIF=100]="OP_NOTIF",e[e.OP_VERIF=101]="OP_VERIF",e[e.OP_VERNOTIF=102]="OP_VERNOTIF",e[e.OP_ELSE=103]="OP_ELSE",e[e.OP_ENDIF=104]="OP_ENDIF",e[e.OP_VERIFY=105]="OP_VERIFY",e[e.OP_RETURN=106]="OP_RETURN",e[e.OP_TOALTSTACK=107]="OP_TOALTSTACK",e[e.OP_FROMALTSTACK=108]="OP_FROMALTSTACK",e[e.OP_2DROP=109]="OP_2DROP",e[e.OP_2DUP=110]="OP_2DUP",e[e.OP_3DUP=111]="OP_3DUP",e[e.OP_2OVER=112]="OP_2OVER",e[e.OP_2ROT=113]="OP_2ROT",e[e.OP_2SWAP=114]="OP_2SWAP",e[e.OP_IFDUP=115]="OP_IFDUP",e[e.OP_DEPTH=116]="OP_DEPTH",e[e.OP_DROP=117]="OP_DROP",e[e.OP_DUP=118]="OP_DUP",e[e.OP_NIP=119]="OP_NIP",e[e.OP_OVER=120]="OP_OVER",e[e.OP_PICK=121]="OP_PICK",e[e.OP_ROLL=122]="OP_ROLL",e[e.OP_ROT=123]="OP_ROT",e[e.OP_SWAP=124]="OP_SWAP",e[e.OP_TUCK=125]="OP_TUCK",e[e.OP_CAT=126]="OP_CAT",e[e.OP_SUBSTR=127]="OP_SUBSTR",e[e.OP_LEFT=128]="OP_LEFT",e[e.OP_RIGHT=129]="OP_RIGHT",e[e.OP_SIZE=130]="OP_SIZE",e[e.OP_INVERT=131]="OP_INVERT",e[e.OP_AND=132]="OP_AND",e[e.OP_OR=133]="OP_OR",e[e.OP_XOR=134]="OP_XOR",e[e.OP_EQUAL=135]="OP_EQUAL",e[e.OP_EQUALVERIFY=136]="OP_EQUALVERIFY",e[e.OP_RESERVED1=137]="OP_RESERVED1",e[e.OP_RESERVED2=138]="OP_RESERVED2",e[e.OP_1ADD=139]="OP_1ADD",e[e.OP_1SUB=140]="OP_1SUB",e[e.OP_2MUL=141]="OP_2MUL",e[e.OP_2DIV=142]="OP_2DIV",e[e.OP_NEGATE=143]="OP_NEGATE",e[e.OP_ABS=144]="OP_ABS",e[e.OP_NOT=145]="OP_NOT",e[e.OP_0NOTEQUAL=146]="OP_0NOTEQUAL",e[e.OP_ADD=147]="OP_ADD",e[e.OP_SUB=148]="OP_SUB",e[e.OP_MUL=149]="OP_MUL",e[e.OP_DIV=150]="OP_DIV",e[e.OP_MOD=151]="OP_MOD",e[e.OP_LSHIFT=152]="OP_LSHIFT",e[e.OP_RSHIFT=153]="OP_RSHIFT",e[e.OP_BOOLAND=154]="OP_BOOLAND",e[e.OP_BOOLOR=155]="OP_BOOLOR",e[e.OP_NUMEQUAL=156]="OP_NUMEQUAL",e[e.OP_NUMEQUALVERIFY=157]="OP_NUMEQUALVERIFY",e[e.OP_NUMNOTEQUAL=158]="OP_NUMNOTEQUAL",e[e.OP_LESSTHAN=159]="OP_LESSTHAN",e[e.OP_GREATERTHAN=160]="OP_GREATERTHAN",e[e.OP_LESSTHANOREQUAL=161]="OP_LESSTHANOREQUAL",e[e.OP_GREATERTHANOREQUAL=162]="OP_GREATERTHANOREQUAL",e[e.OP_MIN=163]="OP_MIN",e[e.OP_MAX=164]="OP_MAX",e[e.OP_WITHIN=165]="OP_WITHIN",e[e.OP_RIPEMD160=166]="OP_RIPEMD160",e[e.OP_SHA1=167]="OP_SHA1",e[e.OP_SHA256=168]="OP_SHA256",e[e.OP_HASH160=169]="OP_HASH160",e[e.OP_HASH256=170]="OP_HASH256",e[e.OP_CODESEPARATOR=171]="OP_CODESEPARATOR",e[e.OP_CHECKSIG=172]="OP_CHECKSIG",e[e.OP_CHECKSIGVERIFY=173]="OP_CHECKSIGVERIFY",e[e.OP_CHECKMULTISIG=174]="OP_CHECKMULTISIG",e[e.OP_CHECKMULTISIGVERIFY=175]="OP_CHECKMULTISIGVERIFY",e[e.OP_NOP1=176]="OP_NOP1",e[e.OP_CHECKLOCKTIMEVERIFY=177]="OP_CHECKLOCKTIMEVERIFY",e[e.OP_NOP2=177]="OP_NOP2",e[e.OP_CHECKSEQUENCEVERIFY=178]="OP_CHECKSEQUENCEVERIFY",e[e.OP_NOP3=178]="OP_NOP3",e[e.OP_NOP4=179]="OP_NOP4",e[e.OP_NOP5=180]="OP_NOP5",e[e.OP_NOP6=181]="OP_NOP6",e[e.OP_NOP7=182]="OP_NOP7",e[e.OP_NOP8=183]="OP_NOP8",e[e.OP_NOP9=184]="OP_NOP9",e[e.OP_NOP10=185]="OP_NOP10",e[e.OP_CHECKSIGADD=186]="OP_CHECKSIGADD",e[e.OP_PUBKEYHASH=253]="OP_PUBKEYHASH",e[e.OP_PUBKEY=254]="OP_PUBKEY",e[e.OP_INVALIDOPCODE=255]="OP_INVALIDOPCODE"}(Fe||(Fe={}));const je="0123456789abcdefABCDEF",Ge=je.split("").map(e=>e.codePointAt(0)),Ke=Array(256).fill(!0).map((e,t)=>{const r=String.fromCodePoint(t),n=je.indexOf(r);return n<0?void 0:n<16?n:n-6}),$e=new TextEncoder,ze=new TextDecoder;function Ye(e){const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}function We(e){const t=e||new Uint8Array;return t.length>512?function(e){const t=new Uint8Array(2*e.length);for(let r=0;r<e.length;++r)t[2*r]=Ge[e[r]>>4],t[2*r+1]=Ge[15&e[r]];return ze.decode(t)}(t):function(e){let t="";for(let r=0;r<e.length;++r)t+=je[Ke[Ge[e[r]>>4]]],t+=je[Ke[Ge[15&e[r]]]];return t}(t)}function Je(e){const t=$e.encode(e||""),r=new Uint8Array(Math.floor(t.length/2));let n;for(n=0;n<r.length;n++){const e=Ke[t[2*n]],i=Ke[t[2*n+1]];if(void 0===e||void 0===i)break;r[n]=e<<4|i}return n===r.length?r:r.slice(0,n)}function qe(e,t){const r=Math.min(e.length,t.length);for(let n=0;n<r;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return e.length===t.length?0:e.length>t.length?1:-1}function Xe(e,t,r){if(t+1>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if(r>255)throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 255. Received ${r}`);return e[t]=r,t+1}function Qe(e,t,r,n){if(t+4>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if(n=n.toUpperCase(),r>4294967295)throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 4294967295. Received ${r}`);return"LE"===n?(e[t]=255&r,e[t+1]=r>>8&255,e[t+2]=r>>16&255,e[t+3]=r>>24&255):(e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r),t+4}function Ze(e,t){if(t+1>e.length)throw new Error("Offset is outside the bounds of Uint8Array");return e[t]}function et(e,t,r){if(t+4>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if("LE"===(r=r.toUpperCase())){let r=0;return r=(r<<8)+e[t+3]>>>0,r=(r<<8)+e[t+2]>>>0,r=(r<<8)+e[t+1]>>>0,r=(r<<8)+e[t]>>>0,r}{let r=0;return r=(r<<8)+e[t]>>>0,r=(r<<8)+e[t+1]>>>0,r=(r<<8)+e[t+2]>>>0,r=(r<<8)+e[t+3]>>>0,r}}function tt(e){return e<Fe.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}function rt(e,t,r){const n=tt(t);return 1===n?Xe(e,r,t):2===n?(Xe(e,r,Fe.OP_PUSHDATA1),Xe(e,r+1,t)):3===n?(Xe(e,r,Fe.OP_PUSHDATA2),function(e,t,r,n){if(t+2>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if(n=n.toUpperCase(),r>65535)throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 65535. Received ${r}`);"LE"===n?(e[t]=255&r,e[t+1]=r>>8&255):(e[t]=r>>8&255,e[t+1]=255&r)}(e,r+1,t,"LE")):(Xe(e,r,Fe.OP_PUSHDATA4),Qe(e,r+1,t,"LE")),n}function nt(e,t){const r=Ze(e,t);let n,i;if(r<Fe.OP_PUSHDATA1)n=r,i=1;else if(r===Fe.OP_PUSHDATA1){if(t+2>e.length)return null;n=Ze(e,t+1),i=2}else if(r===Fe.OP_PUSHDATA2){if(t+3>e.length)return null;n=function(e,t,r){if(t+2>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if("LE"===(r=r.toUpperCase())){let r=0;return r=(r<<8)+e[t+1],r=(r<<8)+e[t],r}{let r=0;return r=(r<<8)+e[t],r=(r<<8)+e[t+1],r}}(e,t+1,"LE"),i=3}else{if(t+5>e.length)return null;if(r!==Fe.OP_PUSHDATA4)throw new Error("Unexpected opcode");n=et(e,t+1,"LE"),i=5}return{opcode:r,number:n,size:i}}function it(e){return{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}}function ot(e){const t=typeof e;return"string"===t?`"${e}"`:"number"===t||"bigint"===t||"boolean"===t?`${e}`:"object"===t||"function"===t?(e&&Object.getPrototypeOf(e)?.constructor?.name)??"null":t}function st(e,t,r,n,i){const o=i&&"input"in i?i.input:r.value,s=i?.expected??e.expects??null,a=i?.received??ot(o),c={kind:e.kind,type:e.type,input:o,expected:s,received:a,message:`Invalid ${t}: ${s?`Expected ${s} but r`:"R"}eceived ${a}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:n.lang,abortEarly:n.abortEarly,abortPipeEarly:n.abortPipeEarly},u="schema"===e.kind,h=i?.message??e.message??(e.reference,void c.lang)??(u?void c.lang:null)??n.message??void c.lang;void 0!==h&&(c.message="function"==typeof h?h(c):h),u&&(r.typed=!1),r.issues?r.issues.push(c):r.issues=[c]}function at(e){return{version:1,vendor:"valibot",validate:t=>e["~run"]({value:t},it())}}function ct(e,t){const r=[...new Set(e)];return r.length>1?`(${r.join(` ${t} `)})`:r[0]??"never"}var ut=class extends Error{constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function ht(e,t){return{kind:"validation",type:"length",reference:ht,async:!1,expects:`${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&e.value.length!==this.requirement&&st(this,"length",e,t,{received:`${e.value.length}`}),e}}}function ft(e,t,r){return"function"==typeof e.fallback?e.fallback(t,r):e.fallback}function lt(e,t,r){return"function"==typeof e.default?e.default(t,r):e.default}function dt(e,t){return{kind:"schema",type:"custom",reference:dt,expects:"unknown",async:!1,check:e,message:t,get"~standard"(){return at(this)},"~run"(e,t){return this.check(e.value)?e.typed=!0:st(this,"type",e,t),e}}}function pt(e,t){return{kind:"schema",type:"instance",reference:pt,expects:e.name,async:!1,class:e,message:t,get"~standard"(){return at(this)},"~run"(e,t){return e.value instanceof this.class?e.typed=!0:st(this,"type",e,t),e}}}function yt(e,t){return{kind:"schema",type:"object",reference:yt,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return at(this)},"~run"(e,t){const r=e.value;if(r&&"object"==typeof r){e.typed=!0,e.value={};for(const n in this.entries){const i=this.entries[n];if(n in r||("exact_optional"===i.type||"optional"===i.type||"nullish"===i.type)&&void 0!==i.default){const o=n in r?r[n]:lt(i),s=i["~run"]({value:o},t);if(s.issues){const i={type:"object",origin:"value",input:r,key:n,value:o};for(const t of s.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||(e.issues=s.issues),t.abortEarly){e.typed=!1;break}}s.typed||(e.typed=!1),e.value[n]=s.value}else if(void 0!==i.fallback)e.value[n]=ft(i);else if("exact_optional"!==i.type&&"optional"!==i.type&&"nullish"!==i.type&&(st(this,"key",e,t,{input:void 0,expected:`"${n}"`,path:[{type:"object",origin:"key",input:r,key:n,value:r[n]}]}),t.abortEarly))break}}else st(this,"type",e,t);return e}}}function gt(e,t){return{kind:"schema",type:"optional",reference:gt,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return at(this)},"~run"(e,t){return void 0===e.value&&(void 0!==this.default&&(e.value=lt(this,e,t)),void 0===e.value)?(e.typed=!0,e):this.wrapped["~run"](e,t)}}}function Et(e){return{kind:"schema",type:"string",reference:Et,expects:"string",async:!1,message:e,get"~standard"(){return at(this)},"~run"(e,t){return"string"==typeof e.value?e.typed=!0:st(this,"type",e,t),e}}}function mt(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function _t(e,t,r){const n=e["~run"]({value:t},it(r));if(n.issues)throw new ut(n.issues);return n.value}const wt=new Uint8Array(32),bt=Je("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Pt=e=>function(...e){return{...e[0],pipe:e,get"~standard"(){return at(this)},"~run"(t,r){for(const n of e)if("metadata"!==n.kind){if(t.issues&&("schema"===n.kind||"transformation"===n.kind)){t.typed=!1;break}t.issues&&(r.abortEarly||r.abortPipeEarly)||(t=n["~run"](t,r))}return t}}}(pt(Uint8Array),ht(e));function It(e){if(!(e instanceof Uint8Array))return!1;if(e.length<33)return!1;const t=e[0],r=e.slice(1,33);if(0===qe(wt,r))return!1;if(qe(r,bt)>=0)return!1;if((2===t||3===t)&&33===e.length)return!0;const n=e.slice(33);return 0!==qe(wt,n)&&(!(qe(n,bt)>=0)&&(4===t&&65===e.length))}const At=Pt(20),Tt=pt(Uint8Array),Ot=Fe.OP_RESERVED,vt=function e(t,r){return{kind:"schema",type:"array",reference:e,expects:"Array",async:!1,item:t,message:r,get"~standard"(){return at(this)},"~run"(e,t){const r=e.value;if(Array.isArray(r)){e.typed=!0,e.value=[];for(let n=0;n<r.length;n++){const i=r[n],o=this.item["~run"]({value:i},t);if(o.issues){const s={type:"array",origin:"value",input:r,key:n,value:i};for(const t of o.issues)t.path?t.path.unshift(s):t.path=[s],e.issues?.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value.push(o.value)}}else st(this,"type",e,t);return e}}}(function e(t,r){return{kind:"schema",type:"union",reference:e,expects:ct(t.map(e=>e.expects),"|"),async:!1,options:t,message:r,get"~standard"(){return at(this)},"~run"(e,t){let r,n,i;for(const o of this.options){const s=o["~run"]({value:e.value},t);if(s.typed){if(!s.issues){r=s;break}n?n.push(s):n=[s]}else i?i.push(s):i=[s]}if(r)return r;if(n){if(1===n.length)return n[0];st(this,"type",e,t,{issues:mt(n)}),e.typed=!0}else{if(1===i?.length)return i[0];st(this,"type",e,t,{issues:mt(i)})}return e}}}([pt(Uint8Array),function e(t){return{kind:"schema",type:"number",reference:e,expects:"number",async:!1,message:t,get"~standard"(){return at(this)},"~run"(e,t){return"number"!=typeof e.value||isNaN(e.value)?st(this,"type",e,t):e.typed=!0,e}}}()]));function St(e){return 0===e.length?Fe.OP_0:1===e.length?e[0]>=1&&e[0]<=16?Ot+e[0]:129===e[0]?Fe.OP_1NEGATE:void 0:void 0}function Nt(e){return e instanceof Uint8Array}function Ut(e){if(e instanceof Uint8Array)return e;_t(vt,e);const t=e.reduce((e,t)=>Nt(t)?1===t.length&&void 0!==St(t)?e+1:e+tt(t.length)+t.length:e+1,0),r=new Uint8Array(t);let n=0;if(e.forEach(e=>{if(Nt(e)){const t=St(e);if(void 0!==t)return Xe(r,n,t),void(n+=1);n+=rt(r,e.length,n),r.set(e,n),n+=e.length}else Xe(r,n,e),n+=1}),n!==r.length)throw new Error("Could not decode chunks");return r}function Rt(e){if(t=e,!vt["~run"]({value:t},{abortEarly:!0}).issues)return e;var t;_t(Tt,e);const r=[];let n=0;for(;n<e.length;){const t=e[n];if(t>Fe.OP_0&&t<=Fe.OP_PUSHDATA4){const t=nt(e,n);if(null===t)return null;if(n+=t.size,n+t.number>e.length)return null;const i=e.slice(n,n+t.number);n+=t.number;const o=St(i);void 0!==o?r.push(o):r.push(i)}else r.push(t),n+=1}return r}function kt(e){return e instanceof Uint8Array&&(!!function(e){const t=-129&e;return t>0&&t<4}(e[e.length-1])&&function(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;const t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;const r=e[5+t];return!(0===r||6+t+r!==e.length||128&e[4]||t>1&&0===e[4]&&!(128&e[5])||128&e[t+6]||r>1&&0===e[t+6]&&!(128&e[t+7]))}(e.slice(0,-1)))}function Bt(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){const e=r.call(this);return this[t]=e,e},set(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})}function Mt(e){let t;return()=>(void 0!==t||(t=e()),t)}function Lt(e,...t){if(!((r=e)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");
2
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
- var r;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function xt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Dt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ct(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Vt(e,t){return e<<32-t|e>>>t}function Ft(e,t){return e<<t|e>>>32-t>>>0}function Ht(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}(e)),Lt(e),e}Fe.OP_RESERVED;let jt=class{};function Gt(e){const t=t=>e().update(Ht(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Kt(e,t,r){return e&t^~e&r}function $t(e,t,r){return e&t^e&r^t&r}let zt=class extends jt{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=Ct(this.buffer)}update(e){xt(this),Lt(e=Ht(e));const{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s===n){const t=Ct(e);for(;n<=i-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){xt(this),function(e,t){Lt(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,Dt(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=Ct(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)s.setUint32(4*e,u[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=n,e.pos=s,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}};const Yt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Wt=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Jt=(()=>Uint8Array.from(new Array(16).fill(0).map((e,t)=>t)))(),qt=(()=>Jt.map(e=>(9*e+5)%16))(),Xt=(()=>{const e=[[Jt],[qt]];for(let t=0;t<4;t++)for(let r of e)r.push(r[t].map(e=>Wt[e]));return e})(),Qt=(()=>Xt[0])(),Zt=(()=>Xt[1])(),er=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),tr=Qt.map((e,t)=>e.map(e=>er[t][e])),rr=Zt.map((e,t)=>e.map(e=>er[t][e])),nr=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),ir=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function or(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const sr=new Uint32Array(16);class ar extends zt{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:i}=this;return[e,t,r,n,i]}set(e,t,r,n,i){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|i}process(e,t){for(let r=0;r<16;r++,t+=4)sr[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,i=0|this.h1,o=i,s=0|this.h2,a=s,c=0|this.h3,u=c,h=0|this.h4,f=h;for(let e=0;e<5;e++){const t=4-e,l=nr[e],d=ir[e],p=Qt[e],y=Zt[e],g=tr[e],E=rr[e];for(let t=0;t<16;t++){const n=Ft(r+or(e,i,s,c)+sr[p[t]]+l,g[t])+h|0;r=h,h=c,c=0|Ft(s,10),s=i,i=n}for(let e=0;e<16;e++){const r=Ft(n+or(t,o,a,u)+sr[y[e]]+d,E[e])+f|0;n=f,f=u,u=0|Ft(a,10),a=o,o=r}}this.set(this.h1+s+u|0,this.h2+c+f|0,this.h3+h+n|0,this.h4+r+o|0,this.h0+i+a|0)}roundClean(){Dt(sr)}destroy(){this.destroyed=!0,Dt(this.buffer),this.set(0,0,0,0,0)}}const cr=Gt(()=>new ar),ur=Uint32Array.from([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]),hr=new Uint32Array(64);let fr=class extends zt{constructor(e=32){super(64,e,8,!1),this.A=0|Yt[0],this.B=0|Yt[1],this.C=0|Yt[2],this.D=0|Yt[3],this.E=0|Yt[4],this.F=0|Yt[5],this.G=0|Yt[6],this.H=0|Yt[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)hr[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=hr[e-15],r=hr[e-2],n=Vt(t,7)^Vt(t,18)^t>>>3,i=Vt(r,17)^Vt(r,19)^r>>>10;hr[e]=i+hr[e-7]+n+hr[e-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(Vt(s,6)^Vt(s,11)^Vt(s,25))+Kt(s,a,c)+ur[e]+hr[e]|0,h=(Vt(r,2)^Vt(r,13)^Vt(r,22))+$t(r,n,i)|0;u=c,c=a,a=s,s=o+t|0,o=i,i=n,n=r,r=t+h|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,i,o,s,a,c,u)}roundClean(){Dt(hr)}destroy(){this.set(0,0,0,0,0,0,0,0),Dt(this.buffer)}};const lr=Gt(()=>new fr);function dr(e){return cr(lr(e))}function pr(e,...t){if(!((r=e)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");
4
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5
- var r;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function yr(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function gr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Er(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function mr(e,t){return e<<32-t|e>>>t}function _r(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}(e)),pr(e),e}Uint8Array.from([123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124,123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124]),Uint8Array.from([241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144,241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144]),Uint8Array.from([7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47,7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47]),Uint8Array.from([174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238,174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238]),Uint8Array.from([25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21,25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21]),Uint8Array.from([244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49,244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49]),Uint8Array.from([232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233,232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233]),Uint8Array.from([72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240,72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240]),Uint8Array.from([191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129,191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129]);class wr{}function br(e){const t=t=>e().update(_r(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Pr(e,t,r){return e&t^~e&r}function Ir(e,t,r){return e&t^e&r^t&r}class Ar extends wr{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=Er(this.buffer)}update(e){yr(this),pr(e=_r(e));const{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s===n){const t=Er(e);for(;n<=i-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){yr(this),function(e,t){pr(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,gr(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=Er(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)s.setUint32(4*e,u[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=n,e.pos=s,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const Tr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Or=Uint32Array.from([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]),vr=new Uint32Array(64);class Sr extends Ar{constructor(e=32){super(64,e,8,!1),this.A=0|Tr[0],this.B=0|Tr[1],this.C=0|Tr[2],this.D=0|Tr[3],this.E=0|Tr[4],this.F=0|Tr[5],this.G=0|Tr[6],this.H=0|Tr[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)vr[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=vr[e-15],r=vr[e-2],n=mr(t,7)^mr(t,18)^t>>>3,i=mr(r,17)^mr(r,19)^r>>>10;vr[e]=i+vr[e-7]+n+vr[e-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(mr(s,6)^mr(s,11)^mr(s,25))+Pr(s,a,c)+Or[e]+vr[e]|0,h=(mr(r,2)^mr(r,13)^mr(r,22))+Ir(r,n,i)|0;u=c,c=a,a=s,s=o+t|0,o=i,i=n,n=r,r=t+h|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,i,o,s,a,c,u)}roundClean(){gr(vr)}destroy(){this.set(0,0,0,0,0,0,0,0),gr(this.buffer)}}const Nr=br(()=>new Sr);var Ur=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=Uint8Array.from(t),n=e(r),i=r.length+4,o=new Uint8Array(i);return o.set(r,0),o.set(n.subarray(0,4),r.length),E.encode(o)},decode:function(e){var r=t(E.decode(e));if(null==r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=E.decodeUnsafe(e);if(null!=r)return t(r)}}}(function(e){return Nr(Nr(e))});const Rr=Fe;function kr(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),_t(function(e){const t={};for(const r in e.entries)t[r]=gt(e.entries[r]);return{...e,entries:t,get"~standard"(){return at(this)}}}(yt({network:yt({}),address:Et(),hash:At,output:Pt(25),pubkey:dt(It),signature:dt(kt),input:Tt})),e);const r=Mt(()=>{const t=Ur.decode(e.address);return{version:Ze(t,0),hash:t.slice(1)}}),n=Mt(()=>Rt(e.input)),i=e.network||Ve,o={name:"p2pkh",network:i};if(Bt(o,"address",()=>{if(!o.hash)return;const e=new Uint8Array(21);return Xe(e,0,i.pubKeyHash),e.set(o.hash,1),Ur.encode(e)}),Bt(o,"hash",()=>e.output?e.output.slice(3,23):e.address?r().hash:e.pubkey||o.pubkey?dr(e.pubkey||o.pubkey):void 0),Bt(o,"output",()=>{if(o.hash)return Ut([Rr.OP_DUP,Rr.OP_HASH160,o.hash,Rr.OP_EQUALVERIFY,Rr.OP_CHECKSIG])}),Bt(o,"pubkey",()=>{if(e.input)return n()[1]}),Bt(o,"signature",()=>{if(e.input)return n()[0]}),Bt(o,"input",()=>{if(e.pubkey&&e.signature)return Ut([e.signature,e.pubkey])}),Bt(o,"witness",()=>{if(o.input)return[]}),t.validate){let t=Uint8Array.from([]);if(e.address){if(r().version!==i.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==r().hash.length)throw new TypeError("Invalid address");t=r().hash}if(e.hash){if(t.length>0&&0!==qe(t,e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(25!==e.output.length||e.output[0]!==Rr.OP_DUP||e.output[1]!==Rr.OP_HASH160||20!==e.output[2]||e.output[23]!==Rr.OP_EQUALVERIFY||e.output[24]!==Rr.OP_CHECKSIG)throw new TypeError("Output is invalid");const r=e.output.slice(3,23);if(t.length>0&&0!==qe(t,r))throw new TypeError("Hash mismatch");t=r}if(e.pubkey){const r=dr(e.pubkey);if(t.length>0&&0!==qe(t,r))throw new TypeError("Hash mismatch");t=r}if(e.input){const r=n();if(2!==r.length)throw new TypeError("Input is invalid");if(!kt(r[0]))throw new TypeError("Input has invalid signature");if(!It(r[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&0!==qe(e.signature,r[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&0!==qe(e.pubkey,r[1]))throw new TypeError("Pubkey mismatch");const i=dr(r[1]);if(t.length>0&&0!==qe(t,i))throw new TypeError("Hash mismatch")}}return Object.assign(o,e)}var Br,Mr={};!function(){if(Br)return Mr;Br=1,Object.defineProperty(Mr,"__esModule",{value:!0}),Mr.bech32m=Mr.bech32=void 0;const e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",t={};for(let r=0;r<32;r++){const n=e.charAt(r);t[n]=r}function r(e){const t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function n(e){let t=1;for(let n=0;n<e.length;++n){const i=e.charCodeAt(n);if(i<33||i>126)return"Invalid prefix ("+e+")";t=r(t)^i>>5}t=r(t);for(let n=0;n<e.length;++n){const i=e.charCodeAt(n);t=r(t)^31&i}return t}function i(e,t,r,n){let i=0,o=0;const s=(1<<r)-1,a=[];for(let n=0;n<e.length;++n)for(i=i<<t|e[n],o+=t;o>=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<<r-o&s);else{if(o>=t)return"Excess padding";if(i<<r-o&s)return"Non-zero padding"}return a}function o(e){return i(e,8,5,!0)}function s(e){const t=i(e,5,8,!1);if(Array.isArray(t))return t}function a(e){const t=i(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function c(i){let c;function u(e,i){if(i=i||90,e.length<8)return e+" too short";if(e.length>i)return"Exceeds length limit";const o=e.toLowerCase(),s=e.toUpperCase();if(e!==o&&e!==s)return"Mixed-case string "+e;const a=(e=o).lastIndexOf("1");if(-1===a)return"No separator character for "+e;if(0===a)return"Missing prefix for "+e;const u=e.slice(0,a),h=e.slice(a+1);if(h.length<6)return"Data too short";let f=n(u);if("string"==typeof f)return f;const l=[];for(let e=0;e<h.length;++e){const n=h.charAt(e),i=t[n];if(void 0===i)return"Unknown character "+n;f=r(f)^i,e+6>=h.length||l.push(i)}return f!==c?"Invalid checksum for "+e:{prefix:u,words:l}}return c="bech32"===i?1:734539939,{decodeUnsafe:function(e,t){const r=u(e,t);if("object"==typeof r)return r},decode:function(e,t){const r=u(e,t);if("object"==typeof r)return r;throw new Error(r)},encode:function(t,i,o){if(o=o||90,t.length+7+i.length>o)throw new TypeError("Exceeds length limit");let s=n(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let a=t+"1";for(let t=0;t<i.length;++t){const n=i[t];if(n>>5)throw new Error("Non 5-bit word");s=r(s)^n,a+=e.charAt(n)}for(let e=0;e<6;++e)s=r(s);s^=c;for(let t=0;t<6;++t){a+=e.charAt(s>>5*(5-t)&31)}return a},toWords:o,fromWordsUnsafe:s,fromWords:a}}Mr.bech32=c("bech32"),Mr.bech32m=c("bech32m")}();const Lr="0123456789abcdefABCDEF";Lr.split("").map(e=>e.codePointAt(0)),Array(256).fill(!0).map((e,t)=>{const r=String.fromCodePoint(t),n=Lr.indexOf(r);return n<0?void 0:n<16?n:n-6}),new TextEncoder,new TextDecoder;function xr(e){"number"==typeof e?function(e){if(e<0||e>Number.MAX_SAFE_INTEGER||e%1!=0)throw new RangeError("value out of range")}(e):(e=>{if(e<0||e>0xffffffffffffffffn)throw new RangeError("value out of range")})(e)}function Dr(e,t,r){xr(e),void 0===r&&(r=0),void 0===t&&(t=new Uint8Array(Vr(e)));let n=0;return e<253?(t.set([Number(e)],r),n=1):e<=65535?(t.set([253],r),function(e,t,r,n){if(t+2>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if(n=n.toUpperCase(),r>65535)throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 65535. Received ${r}`);"LE"===n?(e[t]=255&r,e[t+1]=r>>8&255):(e[t]=r>>8&255,e[t+1]=255&r)}(t,r+1,Number(e),"LE"),n=3):e<=4294967295?(t.set([254],r),function(e,t,r,n){if(t+4>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if(n=n.toUpperCase(),r>4294967295)throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 4294967295. Received ${r}`);"LE"===n?(e[t]=255&r,e[t+1]=r>>8&255,e[t+2]=r>>16&255,e[t+3]=r>>24&255):(e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r)}(t,r+1,Number(e),"LE"),n=5):(t.set([255],r),function(e,t,r,n){if(t+8>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if(n=n.toUpperCase(),r>0xffffffffffffffffn)throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 18446744073709551615. Received ${r}`);"LE"===n?(e[t]=Number(0xffn&r),e[t+1]=Number(r>>8n&0xffn),e[t+2]=Number(r>>16n&0xffn),e[t+3]=Number(r>>24n&0xffn),e[t+4]=Number(r>>32n&0xffn),e[t+5]=Number(r>>40n&0xffn),e[t+6]=Number(r>>48n&0xffn),e[t+7]=Number(r>>56n&0xffn)):(e[t]=Number(r>>56n&0xffn),e[t+1]=Number(r>>48n&0xffn),e[t+2]=Number(r>>40n&0xffn),e[t+3]=Number(r>>32n&0xffn),e[t+4]=Number(r>>24n&0xffn),e[t+5]=Number(r>>16n&0xffn),e[t+6]=Number(r>>8n&0xffn),e[t+7]=Number(0xffn&r))}(t,r+1,BigInt(e),"LE"),n=9),{buffer:t,bytes:n}}function Cr(e,t){void 0===t&&(t=0);const r=e.at(t);if(void 0===r)throw new Error("buffer too small");if(r<253)return{numberValue:r,bigintValue:BigInt(r),bytes:1};if(253===r){const r=function(e,t,r){if(t+2>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if("LE"===(r=r.toUpperCase())){let r=0;return r=(r<<8)+e[t+1],r=(r<<8)+e[t],r}{let r=0;return r=(r<<8)+e[t],r=(r<<8)+e[t+1],r}}(e,t+1,"LE");return{numberValue:r,bigintValue:BigInt(r),bytes:3}}if(254===r){const r=function(e,t,r){if(t+4>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if("LE"===(r=r.toUpperCase())){let r=0;return r=(r<<8)+e[t+3]>>>0,r=(r<<8)+e[t+2]>>>0,r=(r<<8)+e[t+1]>>>0,r=(r<<8)+e[t]>>>0,r}{let r=0;return r=(r<<8)+e[t]>>>0,r=(r<<8)+e[t+1]>>>0,r=(r<<8)+e[t+2]>>>0,r=(r<<8)+e[t+3]>>>0,r}}(e,t+1,"LE");return{numberValue:r,bigintValue:BigInt(r),bytes:5}}{const r=function(e,t,r){if(t+8>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if("LE"===(r=r.toUpperCase())){let r=0n;return r=(r<<8n)+BigInt(e[t+7]),r=(r<<8n)+BigInt(e[t+6]),r=(r<<8n)+BigInt(e[t+5]),r=(r<<8n)+BigInt(e[t+4]),r=(r<<8n)+BigInt(e[t+3]),r=(r<<8n)+BigInt(e[t+2]),r=(r<<8n)+BigInt(e[t+1]),r=(r<<8n)+BigInt(e[t]),r}{let r=0n;return r=(r<<8n)+BigInt(e[t]),r=(r<<8n)+BigInt(e[t+1]),r=(r<<8n)+BigInt(e[t+2]),r=(r<<8n)+BigInt(e[t+3]),r=(r<<8n)+BigInt(e[t+4]),r=(r<<8n)+BigInt(e[t+5]),r=(r<<8n)+BigInt(e[t+6]),r=(r<<8n)+BigInt(e[t+7]),r}}(e,t+1,"LE");return{numberValue:r<=Number.MAX_SAFE_INTEGER?Number(r):null,bigintValue:r,bytes:9}}}function Vr(e){return xr(e),e<253?1:e<=65535?3:e<=4294967295?5:9}var Fr,Hr,jr;Je("0000000000000000000000000000000000000000000000000000000000000000"),Je("0000000000000000000000000000000000000000000000000000000000000001"),Je("ffffffffffffffff"),function(e){e[e.UNSIGNED_TX=0]="UNSIGNED_TX",e[e.GLOBAL_XPUB=1]="GLOBAL_XPUB"}(Fr||(Fr={})),function(e){e[e.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",e[e.WITNESS_UTXO=1]="WITNESS_UTXO",e[e.PARTIAL_SIG=2]="PARTIAL_SIG",e[e.SIGHASH_TYPE=3]="SIGHASH_TYPE",e[e.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",e[e.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",e[e.BIP32_DERIVATION=6]="BIP32_DERIVATION",e[e.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",e[e.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",e[e.POR_COMMITMENT=9]="POR_COMMITMENT",e[e.TAP_KEY_SIG=19]="TAP_KEY_SIG",e[e.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",e[e.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",e[e.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",e[e.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",e[e.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT"}(Hr||(Hr={})),function(e){e[e.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",e[e.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",e[e.BIP32_DERIVATION=2]="BIP32_DERIVATION",e[e.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",e[e.TAP_TREE=6]="TAP_TREE",e[e.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION"}(jr||(jr={}));const Gr=e=>33===e.length&&[2,3].includes(e[0])||65===e.length&&4===e[0];function Kr(e,t=Gr){return{decode:function(r){if(r.key[0]!==e)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+We(r.key));const n=r.key.slice(1);if(!t(n))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+We(r.key));if(r.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const i={masterFingerprint:r.value.slice(0,4),pubkey:n,path:"m"};for(const e of(o=r.value.length/4-1,[...Array(o).keys()])){const t=et(r.value,4*e+4,"LE"),n=!!(2147483648&t),o=2147483647&t;i.path+="/"+o.toString(10)+(n?"'":"")}var o;return i},encode:function(t){const r=Ye([Uint8Array.from([e]),t.pubkey]),n=t.path.split("/"),i=new Uint8Array(4*n.length);i.set(t.masterFingerprint,0);let o=4;return n.slice(1).forEach(e=>{const t="'"===e.slice(-1);let r=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(r+=2147483648),Qe(i,o,r,"LE"),o+=4}),{key:r,value:i}},check:function(e){return e.pubkey instanceof Uint8Array&&e.masterFingerprint instanceof Uint8Array&&"string"==typeof e.path&&t(e.pubkey)&&4===e.masterFingerprint.length},expected:"{ masterFingerprint: Uint8Array; pubkey: Uint8Array; path: string; }",canAddToArray:function(e,t,r){const n=We(t.pubkey);return!r.has(n)&&(r.add(n),0===e.filter(e=>0===qe(e.pubkey,t.pubkey)).length)}}}function $r(e){return function(t){let r;if(e.includes(t.key[0])&&(r=t.key.slice(1),33!==r.length&&65!==r.length||![2,3,4].includes(r[0])))throw new Error("Format Error: invalid pubkey in key 0x"+We(t.key));return r}}function zr(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode redeemScript with key 0x"+We(t.key));return t.value},encode:function(t){return{key:Uint8Array.from([e]),value:t}},check:function(e){return e instanceof Uint8Array},expected:"Uint8Array",canAdd:function(e,t){return!!e&&!!t&&void 0===e.redeemScript}}}const Yr=e=>32===e.length;function Wr(e){const t=Kr(e,Yr);return{decode:function(e){const{numberValue:r,bytes:n}=Cr(e.value),i=t.decode({key:e.key,value:e.value.slice(n+32*Number(r))}),o=new Array(Number(r));for(let t=0,i=n;t<r;t++,i+=32)o[t]=e.value.slice(i,i+32);return{...i,leafHashes:o}},encode:function(e){const r=t.encode(e),n=Vr(e.leafHashes.length),i=new Uint8Array(n);Dr(e.leafHashes.length,i);const o=Ye([i,...e.leafHashes,r.value]);return{...r,value:o}},check:function(e){return Array.isArray(e.leafHashes)&&e.leafHashes.every(e=>e instanceof Uint8Array&&32===e.length)&&t.check(e)},expected:"{ masterFingerprint: Uint8Array; pubkey: Uint8Array; path: string; leafHashes: Uint8Array[]; }",canAddToArray:t.canAddToArray}}function Jr(e){return{decode:function(t){if(t.key[0]!==e||1!==t.key.length)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+We(t.key));if(32!==t.value.length)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return t.value},encode:function(t){return{key:Uint8Array.from([e]),value:t}},check:function(e){return e instanceof Uint8Array&&32===e.length},expected:"Uint8Array",canAdd:function(e,t){return!!e&&!!t&&void 0===e.tapInternalKey}}}function qr(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode witnessScript with key 0x"+We(t.key));return t.value},encode:function(t){return{key:Uint8Array.from([e]),value:t}},check:function(e){return e instanceof Uint8Array},expected:"Uint8Array",canAdd:function(e,t){return!!e&&!!t&&void 0===e.witnessScript}}}Kr(Hr.BIP32_DERIVATION),zr(Hr.REDEEM_SCRIPT),qr(Hr.WITNESS_SCRIPT),$r([Hr.PARTIAL_SIG,Hr.BIP32_DERIVATION]),Wr(Hr.TAP_BIP32_DERIVATION),Jr(Hr.TAP_INTERNAL_KEY),Kr(jr.BIP32_DERIVATION),zr(jr.REDEEM_SCRIPT),qr(jr.WITNESS_SCRIPT),$r([jr.BIP32_DERIVATION]),Wr(jr.TAP_BIP32_DERIVATION),Jr(jr.TAP_INTERNAL_KEY);var Xr,Qr={exports:{}};var Zr,en=(Xr||(Xr=1,Zr=Qr,function(){var e="input is invalid type",t="object"==typeof window,r=t?window:{};r.JS_SHA3_NO_WINDOW&&(t=!1);var n=!t&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof y&&y.versions&&y.versions.node?r=g:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&Zr.exports,o=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),a=[4,1024,262144,67108864],c=[0,8,16,24],u=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],h=[224,256,384,512],f=[128,256],l=["hex","buffer","arrayBuffer","array","digest"],d={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!o||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var p=function(e,t,r){return function(n){return new R(e,t,e).update(n)[r]()}},E=function(e,t,r){return function(n,i){return new R(e,t,i).update(n)[r]()}},m=function(e,t,r){return function(t,n,i,o){return I["cshake"+e].update(t,n,i,o)[r]()}},_=function(e,t,r){return function(t,n,i,o){return I["kmac"+e].update(t,n,i,o)[r]()}},w=function(e,t,r,n){for(var i=0;i<l.length;++i){var o=l[i];e[o]=t(r,n,o)}return e},b=function(e,t){var r=p(e,t,"hex");return r.create=function(){return new R(e,t,e)},r.update=function(e){return r.create().update(e)},w(r,p,e,t)},P=[{name:"keccak",padding:[1,256,65536,16777216],bits:h,createMethod:b},{name:"sha3",padding:[6,1536,393216,100663296],bits:h,createMethod:b},{name:"shake",padding:[31,7936,2031616,520093696],bits:f,createMethod:function(e,t){var r=E(e,t,"hex");return r.create=function(r){return new R(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},w(r,E,e,t)}},{name:"cshake",padding:a,bits:f,createMethod:function(e,t){var r=d[e],n=m(e,0,"hex");return n.create=function(n,i,o){return i||o?new R(e,t,n).bytepad([i,o],r):I["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},w(n,m,e,t)}},{name:"kmac",padding:a,bits:f,createMethod:function(e,t){var r=d[e],n=_(e,0,"hex");return n.create=function(n,i,o){return new k(e,t,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},w(n,_,e,t)}}],I={},A=[],T=0;T<P.length;++T)for(var O=P[T],v=O.bits,S=0;S<v.length;++S){var N=O.name+"_"+v[S];if(A.push(N),I[N]=O.createMethod(v[S],O.padding),"sha3"!==O.name){var U=O.name+v[S];A.push(U),I[U]=I[N]}}function R(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function k(e,t,r){R.call(this,e,t,r)}R.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(o&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||o&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var i,s,a=this.blocks,u=this.byteCount,h=t.length,f=this.blockCount,l=0,d=this.s;l<h;){if(this.reset)for(this.reset=!1,a[0]=this.block,i=1;i<f+1;++i)a[i]=0;if(r)for(i=this.start;l<h&&i<u;++l)a[i>>2]|=t[l]<<c[3&i++];else for(i=this.start;l<h&&i<u;++l)(s=t.charCodeAt(l))<128?a[i>>2]|=s<<c[3&i++]:s<2048?(a[i>>2]|=(192|s>>6)<<c[3&i++],a[i>>2]|=(128|63&s)<<c[3&i++]):s<55296||s>=57344?(a[i>>2]|=(224|s>>12)<<c[3&i++],a[i>>2]|=(128|s>>6&63)<<c[3&i++],a[i>>2]|=(128|63&s)<<c[3&i++]):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++l)),a[i>>2]|=(240|s>>18)<<c[3&i++],a[i>>2]|=(128|s>>12&63)<<c[3&i++],a[i>>2]|=(128|s>>6&63)<<c[3&i++],a[i>>2]|=(128|63&s)<<c[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=a[f],i=0;i<f;++i)d[i]^=a[i];B(d),this.reset=!0}else this.start=i}return this},R.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},R.prototype.encodeString=function(t){var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(o&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||o&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}var i=0,s=t.length;if(r)i=s;else for(var a=0;a<t.length;++a){var c=t.charCodeAt(a);c<128?i+=1:c<2048?i+=2:c<55296||c>=57344?i+=3:(c=65536+((1023&c)<<10|1023&t.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(t),i},R.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,o=[];return o.length=i,this.update(o),this},R.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];B(n)}},R.prototype.toString=R.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,c="";a<n;){for(o=0;o<t&&a<n;++o,++a)e=r[o],c+=s[e>>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];a%t===0&&(B(r),o=0)}return i&&(e=r[o],c+=s[e>>4&15]+s[15&e],i>1&&(c+=s[e>>12&15]+s[e>>8&15]),i>2&&(c+=s[e>>20&15]+s[e>>16&15])),c},R.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);s<n;){for(o=0;o<t&&s<n;++o,++s)c[s]=r[o];s%t===0&&B(r)}return i&&(c[o]=r[o],e=e.slice(0,a)),e},R.prototype.buffer=R.prototype.arrayBuffer,R.prototype.digest=R.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,c=[];a<i;){for(s=0;s<r&&a<i;++s,++a)e=a<<2,t=n[s],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;a%r===0&&B(n)}return o&&(e=a<<2,t=n[s],c[e]=255&t,o>1&&(c[e+1]=t>>8&255),o>2&&(c[e+2]=t>>16&255)),c},k.prototype=new R,k.prototype.finalize=function(){return this.encode(this.outputBits,!0),R.prototype.finalize.call(this)};var B=function(e){var t,r,n,i,o,s,a,c,h,f,l,d,p,y,g,E,m,_,w,b,P,I,A,T,O,v,S,N,U,R,k,B,M,L,x,D,C,V,F,H,j,G,K,$,z,Y,W,J,q,X,Q,Z,ee,te,re,ne,ie,oe,se,ae,ce,ue,he;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],h=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|h>>>31),r=o^(h<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=s^(f<<1|l>>>31),r=a^(l<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(d<<1|p>>>31),r=h^(p<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=l^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,y=e[0],g=e[1],Y=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,N=e[20]<<3|e[21]>>>29,U=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,G=e[40]<<18|e[41]>>>14,K=e[41]<<18|e[40]>>>14,L=e[2]<<1|e[3]>>>31,x=e[3]<<1|e[2]>>>31,E=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,q=e[23]<<10|e[22]>>>22,R=e[33]<<13|e[32]>>>19,k=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,he=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,C=e[15]<<6|e[14]>>>26,_=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,B=e[45]<<29|e[44]>>>3,M=e[44]<<29|e[45]>>>3,T=e[6]<<28|e[7]>>>4,O=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,V=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,b=e[36]<<21|e[37]>>>11,P=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,$=e[8]<<27|e[9]>>>5,z=e[9]<<27|e[8]>>>5,v=e[18]<<20|e[19]>>>12,S=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,H=e[38]<<8|e[39]>>>24,j=e[39]<<8|e[38]>>>24,I=e[48]<<14|e[49]>>>18,A=e[49]<<14|e[48]>>>18,e[0]=y^~E&_,e[1]=g^~m&w,e[10]=T^~v&N,e[11]=O^~S&U,e[20]=L^~D&V,e[21]=x^~C&F,e[30]=$^~Y&J,e[31]=z^~W&q,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=E^~_&b,e[3]=m^~w&P,e[12]=v^~N&R,e[13]=S^~U&k,e[22]=D^~V&H,e[23]=C^~F&j,e[32]=Y^~J&X,e[33]=W^~q&Q,e[42]=ne^~oe&ae,e[43]=ie^~se&ce,e[4]=_^~b&I,e[5]=w^~P&A,e[14]=N^~R&B,e[15]=U^~k&M,e[24]=V^~H&G,e[25]=F^~j&K,e[34]=J^~X&Z,e[35]=q^~Q&ee,e[44]=oe^~ae&ue,e[45]=se^~ce&he,e[6]=b^~I&y,e[7]=P^~A&g,e[16]=R^~B&T,e[17]=k^~M&O,e[26]=H^~G&L,e[27]=j^~K&x,e[36]=X^~Z&$,e[37]=Q^~ee&z,e[46]=ae^~ue&te,e[47]=ce^~he&re,e[8]=I^~y&E,e[9]=A^~g&m,e[18]=B^~T&v,e[19]=M^~O&S,e[28]=G^~L&D,e[29]=K^~x&C,e[38]=Z^~$&Y,e[39]=ee^~z&W,e[48]=ue^~te&ne,e[49]=he^~re&ie,e[0]^=u[n],e[1]^=u[n+1]};if(i)Zr.exports=I;else for(T=0;T<A.length;++T)r[A[T]]=I[A[T]]}()),Qr.exports),tn=h(en);let rn=!1,nn=!1;const on={debug:1,default:2,info:2,warning:3,error:4,off:5};let sn=on.default,an=null;const cn=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}}),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var un,hn;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(un||(un={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(hn||(hn={}));const fn="0123456789abcdef";class ln{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==on[r]&&this.throwArgumentError("invalid log level name","logLevel",e),sn>on[r]||console.log.apply(console,t)}debug(...e){this._log(ln.levels.DEBUG,e)}info(...e){this._log(ln.levels.INFO,e)}warn(...e){this._log(ln.levels.WARNING,e)}makeError(e,t,r){if(nn)return this.makeError("censored error",t,{});t||(t=ln.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach(e=>{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=fn[t[e]>>4],r+=fn[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch(t){n.push(e+"="+JSON.stringify(r[e].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const i=e;let o="";switch(t){case hn.NUMERIC_FAULT:{o="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":o+="-"+t;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case hn.CALL_EXCEPTION:case hn.INSUFFICIENT_FUNDS:case hn.MISSING_NEW:case hn.NONCE_EXPIRED:case hn.REPLACEMENT_UNDERPRICED:case hn.TRANSACTION_REPLACED:case hn.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const s=new Error(e);return s.reason=i,s.code=t,Object.keys(r).forEach(function(e){s[e]=r[e]}),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,ln.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){cn&&this.throwError("platform missing String.prototype.normalize",ln.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:cn})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,ln.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,ln.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",e<t&&this.throwError("missing argument"+r,ln.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,ln.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",ln.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",ln.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",ln.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return an||(an=new ln("logger/5.8.0")),an}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",ln.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),rn){if(!e)return;this.globalLogger().throwError("error censorship permanent",ln.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}nn=!!e,rn=!!t}static setLogLevel(e){const t=on[e.toLowerCase()];null!=t?sn=t:ln.globalLogger().warn("invalid log level - "+e)}static from(e){return new ln(e)}}ln.errors=hn,ln.levels=un;const dn=new ln("bytes/5.8.0");function pn(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return pn(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function yn(e){return"number"==typeof e&&e==e&&e%1==0}function gn(e,t){if(t||(t={}),"number"==typeof e){dn.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),pn(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),function(e){return!!e.toHexString}(e)&&(e=e.toHexString()),function(e){if("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))return!1;return!0}(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":dn.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return pn(new Uint8Array(n))}return function(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!yn(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!yn(r)||r<0||r>=256)return!1}return!0}(e)?pn(new Uint8Array(e)):dn.throwArgumentError("invalid arrayify value","value",e)}function En(e,t){const r=a,n=e.toString("hex"),i=r.from(l.fromHex(n).toBytes(!1)).toString("hex").slice(2);var o;return`0x${(o=r.from(i,"hex"),"0x"+tn.keccak_256(gn(o))).slice(26).toString()}`}async function mn(e,t){let r;"publicKeyJwk"in e?r=Ce(e.publicKeyJwk):void 0!==e.publicKeyMultibase&&(r=await(async({publicKeyMultibase:e})=>{const t=await P({keyPair:{publicKeyMultibase:e}});return Ce(t)})(e));const n=Ne("errors","identityErrorBaseMessage");let i="";switch(t.code){case u.Bitcoin:case u.Mocknet:case u.Testnet:i=function(e,t){return kr({pubkey:e,network:He[t.code]}).address}(r,t);break;case u.Ethmain:case u.Ethropst:case u.Ethrinkeby:case u.Ethgoerli:case u.Ethsepolia:i=En(r);break;default:throw new Oe("deriveIssuingAddressFromPublicKey",`${n} - ${Ne("errors","deriveIssuingAddressFromPublicKey")}`)}return i}function _n(e){if(e){const t="string"==typeof e?e:e.code;return!!Object.keys(s).some(e=>e===t)&&!!s[t].test}return!1}const{LinkedDataProof:wn}=m.suites;class bn extends wn{challenge;domain;type="MerkleProof2019";issuer=null;issuerEndpoint="";verificationMethod=null;externalProof=null;proof=null;proofValue=null;proofPurpose;document=null;explorerAPIs=[];chain;txData;localDocumentHash;derivedIssuingAddress;documentLoader=null;proofVerificationProcess=["assertProofValidity","getTransactionId","computeLocalHash","fetchRemoteHash","compareHashes","checkMerkleRoot","checkReceipt"];identityVerificationProcess=["deriveIssuingAddressFromPublicKey","ensureVerificationMethodValidity","compareIssuingAddress"];transactionId="";constructor({issuer:e=null,verificationMethod:t=null,document:r=null,proof:n=null,options:i={},proofPurpose:o="assertionMethod",domain:s=[],challenge:a=""}){super({type:"MerkleProof2019"}),this.issuer=e,this.verificationMethod=t,this.document=r,this.proofPurpose=o,this.domain=Array.isArray(s)?s:[s],this.challenge=a,this.externalProof=n,this.setOptions(i),(this.externalProof||this.document)&&(this.setProof(this.externalProof),this.getChain(),_n(this.chain)&&(this.adaptProofVerificationProcessToMocknet(),this.adaptIdentityVerificationProcessToMocknet()))}static decodeMerkleProof2019(e){return new Pe(e.proofValue).decode()}createVerifier(){}createVerifyData(){}setProof(e=null){const t=e??this.document.proof;if(!t)throw new Error("The passed document is not signed.");this.proof=t,this.proofValue=bn.decodeMerkleProof2019(this.proof)}async verifyProof({documentLoader:e,verifyIdentity:t,document:r,proof:n}={documentLoader:e=>{},verifyIdentity:!0}){let i;this.documentLoader=e;let o="";if(r&&(this.document=r),n&&this.setProof(n),this.getChain(),_n(this.chain)&&(this.adaptProofVerificationProcessToMocknet(),this.adaptIdentityVerificationProcessToMocknet()),!this.document)throw new Error("A document signed by MerkleProof2019 is required for the verification process.");try{await this.verifyProcess(this.proofVerificationProcess),t&&await this.verifyIdentity(),i=!0}catch(e){console.error(e),i=!1,o=e.message}return{verificationMethod:this.verificationMethod,verified:i,error:o}}async createProof({document:e,purpose:t="assertionMethod"}){if(!this.issuerEndpoint)throw new Error("No issuer endpoint provided. Please set the issuerEndpoint option when instantiating the suite.");const r=await fetch(this.issuerEndpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({credential:e})}).then(e=>e.json()).catch(e=>{console.error(e)});if(r.verifiableCredential)return r.verifiableCredential.proof;console.error("An error occurred while creating the proof:",r)}async createProofValue({document:e}){const t=await this.createProof({document:e});return t?t.proofValue:"error creating proof"}ensureSuiteContext(){}async verifyIdentity(){if(null!=this.verificationMethod)try{await this.verifyProcess(this.identityVerificationProcess)}catch(e){throw new Error(e)}}getProofVerificationProcess(){return this.proofVerificationProcess}getIdentityVerificationProcess(){return this.identityVerificationProcess}getIssuerPublicKey(){return _n(this.chain)?"This mock chain does not support issuing addresses":this.getTxData()?.issuingAddress??""}getIssuanceTime(){return this.getTxData()?.time??""}getChain(){return this.chain||(this.chain=Ae(this.proofValue)),this.chain}getTxData(){return this.txData?this.txData:(console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?"),null)}adaptProofVerificationProcessToMocknet(){Te(this.proofVerificationProcess,"getTransactionId"),Te(this.proofVerificationProcess,"fetchRemoteHash"),Te(this.proofVerificationProcess,"checkMerkleRoot")}adaptIdentityVerificationProcessToMocknet(){this.identityVerificationProcess=["ensureVerificationMethodValidity"]}setOptions(e){this.explorerAPIs=e.explorerAPIs??[],e.executeStepMethod&&"function"==typeof e.executeStepMethod&&(this.executeStep=e.executeStepMethod),this.issuerEndpoint=e.issuerEndpoint??""}async executeStep(e,t,r=""){return await t()}async verifyProcess(e){for(const t of e){if(!this[t])return void console.error("verification logic for",t,"not implemented");await this[t]()}}async assertProofValidity(){await this.executeStep("assertProofValidity",()=>Ue({expectedProofPurpose:this.proofPurpose,expectedDomain:this.domain,expectedChallenge:this.challenge,proof:this.proof,issuer:this.issuer}),this.type)}async checkMerkleRoot(){await this.executeStep("checkMerkleRoot",()=>function(e,t){if(e!==t)throw new Oe("checkMerkleRoot",Ne("errors","ensureMerkleRootEqual"));return!0}(this.proofValue.merkleRoot,this.txData.remoteHash),this.type)}async compareHashes(){await this.executeStep("compareHashes",()=>function(e,t){if(e!==t)throw new Oe("compareHashes",Ne("errors","ensureHashesEqual"));return!0}(this.localDocumentHash,this.proofValue.targetHash),this.type)}async computeLocalHash(){this.localDocumentHash=await this.executeStep("computeLocalHash",async()=>await xe(this.document,this.proof,this.documentLoader),this.type)}async checkReceipt(){await this.executeStep("checkReceipt",()=>{!function(e){let t=e.targetHash;const r=e.merkleRoot;try{const r=e.path;if(r&&t)for(const e in r){const n=r[e];let i;if(void 0!==n.left)i=Le(`${n.left}${t}`),t=a.from(b(Uint8Array.from(i))).toString("hex");else{if(void 0===n.right)throw new Oe("checkReceipt","Trigger catch error.");i=Le(`${t}${n.right}`),t=a.from(b(Uint8Array.from(i))).toString("hex")}}}catch(e){throw new Oe("checkReceipt",Ne("errors","ensureValidReceipt"))}if(t!==r)throw new Oe("checkReceipt",Ne("errors","invalidMerkleReceipt"))}(this.proofValue)},this.type)}async getTransactionId(){this.transactionId=function(e=null){if(!e)throw new Error("DecodedProof is not set");const{anchors:t}=e,r=t[0];if("string"==typeof r)return r.split(":").pop();throw new Error("Could not retrieve transaction id as was provided an unexpected format")}(this.proofValue);return await this.executeStep("getTransactionId",()=>function(e){if("string"==typeof e&&e.length>0)return e;throw new Oe("getTransactionId",Ne("errors","isTransactionIdValid"))}(this.transactionId),this.type)}async fetchRemoteHash(){this.txData=await this.executeStep("fetchRemoteHash",async()=>await o({transactionId:this.transactionId,chain:this.chain?.code,explorerAPIs:this.explorerAPIs}),this.type)}async deriveIssuingAddressFromPublicKey(){this.derivedIssuingAddress=await this.executeStep("deriveIssuingAddressFromPublicKey",async()=>await mn(this.verificationMethod,this.chain),this.type)}async ensureVerificationMethodValidity(){await this.executeStep("ensureVerificationMethodValidity",async()=>{if(this.verificationMethod.expires){if(new Date(this.verificationMethod.expires).getTime()<Date.now())throw new Oe("ensureVerificationMethodValidity","The verification key has expired")}if(this.verificationMethod.revoked)throw new Oe("ensureVerificationMethodValidity","The verification key has been revoked")},this.type)}async compareIssuingAddress(){await this.executeStep("compareIssuingAddress",()=>{!function(e,t){const r=Ne("errors","identityErrorBaseMessage");if(e.toLowerCase()!==t.toLowerCase())throw new Oe("compareIssuingAddress",`${r} - ${Ne("errors","compareIssuingAddress")}`)}(this.getIssuerPublicKey(),this.derivedIssuingAddress)},this.type)}}var Pn;function In(e){return bn.decodeMerkleProof2019(e)}!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkImagesIntegrity="checkImagesIntegrity",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.ensureVerificationMethodValidity="ensureVerificationMethodValidity",e.deriveIssuingAddressFromPublicKey="deriveIssuingAddressFromPublicKey",e.compareIssuingAddress="compareIssuingAddress",e.checkAuthenticity="checkAuthenticity"}(Pn||(Pn={}));class An extends _{proofVerificationProcess=[Pn.parseIssuerKeys,Pn.checkAuthenticity];transactionId;localHash;documentToVerify;txData;chain;explorerAPIs;receipt;issuerPublicKeyList;issuer;verificationMethod;derivedIssuingAddress;hasDid;proof;type="MerkleProof2019";cryptosuite="merkle-proof-2019";suite;proofPurpose;proofDomain;proofChallenge;constructor(e){super(e),this.executeStep=e.executeStep,this.documentToVerify=e.document,this.explorerAPIs=e.explorerAPIs,this.proof=e.proof,this.issuer=e.issuer,this.proofPurpose=e.proofPurpose,this.proofDomain=e.proofDomain,this.proofChallenge=e.proofChallenge,this.validateProofType(),this.receipt=In(this.proof),this.transactionId=t.certificates.getTransactionId(this.receipt),this.setHasDid()}async init(){await this.setVerificationSuite(),this.chain=this.suite.getChain(),this.adaptVerificationProcessToChain()}async verifyProof(){await this.suite.verifyProof({verifyIdentity:!1}),await this.verifyProcess(this.proofVerificationProcess)}async verifyIdentity(){await this.suite.verifyIdentity()}getProofVerificationSteps(e){return[...this.suite.getProofVerificationProcess(),...this.proofVerificationProcess].map(r=>t.verifier.convertToVerificationSubsteps(e,r))}getIdentityVerificationSteps(e){return this.hasDid?this.suite.getIdentityVerificationProcess().map(r=>t.verifier.convertToVerificationSubsteps(e,r)):[]}getIssuerPublicKey(){return this.suite.getIssuerPublicKey()}getIssuanceTime(){return this.suite.getIssuanceTime()}getIssuerName(){return this.issuer.name}getIssuerProfileDomain(){const e=new URL(this.getIssuerProfileUrl());return e?.hostname}getIssuerProfileUrl(){return this.issuer.id}getSigningDate(){return this.proof.created}getChain(){return this.suite.getChain()}getReceipt(){return this.receipt}getTransactionIdString(){return t.certificates.getTransactionId(this.getReceipt())}getTransactionLink(){return t.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}getRawTransactionLink(){return t.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}async executeStep(e,t,r){throw new Error("executeStep method needs to be overwritten by injecting from Verifier")}async setVerificationSuite(){await this.setIssuerFromProofVerificationMethod(),this.verificationMethod=T(this.getTargetVerificationMethodContainer(),r(this.proof)),this.suite=new bn({document:this.documentToVerify,proof:this.proof,verificationMethod:this.verificationMethod,proofPurpose:this.proofPurpose,domain:this.proofDomain,challenge:this.proofChallenge,options:{explorerAPIs:this.explorerAPIs,executeStepMethod:this.executeStep}})}adaptVerificationProcessToChain(){t.chains.isMockChain(this.chain)&&(n(this.proofVerificationProcess,Pn.parseIssuerKeys),n(this.proofVerificationProcess,Pn.checkAuthenticity))}getTargetVerificationMethodContainer(){if(this.issuer.didDocument)return this.issuer.didDocument;const e={...this.issuer};return delete e.didDocument,e}findVerificationMethod(e,t){return e?.find(e=>e.id===this.proof.verificationMethod||t+e.id===this.proof.verificationMethod)??null}isProofChain(){return"ChainedProof2021"===this.proof.type}isMultipleProof(){return Array.isArray(this.documentToVerify.proof)}getProofIndex(){return this.isMultipleProof()?this.documentToVerify.proof.findIndex(e=>e.proofValue===this.proof.proofValue):-1}async setIssuerFromProofVerificationMethod(){if(this.getProofIndex()>0){const e=this.proof.verificationMethod.split("#")[0];this.issuer=await t.verifier.getIssuerProfile(e)}}setHasDid(){if(this.getProofIndex()>0){const e=this.proof.verificationMethod.split("#")[0];return void(this.hasDid=i(e))}this.hasDid=!!this.issuer.didDocument}validateProofType(){const e=this.isProofChain()?this.proof.chainedProofType:this.proof.type;if("DataIntegrityProof"===e){const e=this.proof.cryptosuite;if(!e)throw new Error(`Malformed proof passed. With DataIntegrityProof a cryptosuite must be defined. Expected: ${this.cryptosuite}`);if(e!==this.cryptosuite)throw new Error(`Incompatible proof cryptosuite passed. Expected: ${this.cryptosuite}, Got: ${e}`);return}if(e!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${e}`)}async verifyProcess(e){for(const t of e){if(!this[t])return void console.error("verification logic for",t,"not implemented");await this[t]()}}async parseIssuerKeys(){this.issuerPublicKeyList=await this.executeStep(Pn.parseIssuerKeys,()=>t.verifier.parseIssuerKeys(this.issuer),this.type)}async checkAuthenticity(){await this.executeStep(Pn.checkAuthenticity,()=>{A(this.issuerPublicKeyList,this.getIssuerPublicKey(),this.getIssuanceTime())},this.type)}}export{An as default,In as parseReceipt};
@@ -1 +0,0 @@
1
- import{r}from"./index-DNlz8u7B-CYTlxhyY.js";import{A as o,V as a,z as e,g as t}from"./main.js";var s=r();async function c(r,c){Array.isArray(c)||(c=[c]),Array.isArray(r)||(r=[r]);for(const i of c){const c=await o({url:i.id});let n;try{n=JSON.parse(c)}catch(r){throw console.error(r),new Error(`Specified schema at url: ${i.id} could not be parsed`)}const f=s.validator(n);for(const o of r){if(!f(o))throw new a(e.checkCredentialSchemaConformity,t("errors","checkCredentialSchemaConformity"))}}}export{c as default};
@@ -1,13 +0,0 @@
1
- import{V as t,z as e,d as n,C as i,A as o,D as s,F as r,u as a,t as c}from"./main.js";import{g as u,u as d}from"./pako.esm-BGRKTPxS-Bodm4Eha.js";
2
- /*!
3
- * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved.
4
- */function h(t,e){if("number"!=typeof t)throw new TypeError(`"${e}" must be number.`)}function f(t,e){if(!(Number.isInteger(t)&&t>0))throw new TypeError(`"${e}" must be a positive integer.`)}function g(t,e){if("boolean"!=typeof t)throw new TypeError(`"${e}" must be a boolean.`)}function l(t,e){if(!(t instanceof Uint8Array))throw new TypeError(`"${e}" must be a Uint8Array.`)}
5
- /*!
6
- * Copyright (c) 2020-2023 Digital Bazaar, Inc. All rights reserved.
7
- */class w{constructor({length:t,buffer:e,leftToRightIndexing:n,littleEndianBits:i}={}){if(t&&e)throw new Error('Only one of "length" or "buffer" must be given.');if(void 0!==t?f(t,"length"):l(e,"buffer"),void 0!==i){if(void 0!==n)throw new Error('Using both "littleEndianBits" and "leftToRightIndexing" is not allowed.');g(i,"littleEndianBits"),n=i}void 0===n?n=!0:g(n,"leftToRightIndexing"),t?(this.bits=new Uint8Array(Math.ceil(t/8)),this.length=t):(this.bits=new Uint8Array(e.buffer),this.length=8*e.length),this.leftToRightIndexing=n}set(t,e){h(t,"position"),g(e,"on");const{length:n,leftToRightIndexing:i}=this,{index:o,bit:s}=b(t,n,i);e?this.bits[o]|=s:this.bits[o]&=255^s}get(t){h(t,"position");const{length:e,leftToRightIndexing:n}=this,{index:i,bit:o}=b(t,e,n);return!!(this.bits[i]&o)}async encodeBits(){return a(u(this.bits))}static async decodeBits({encoded:t}){return function(t,e){if("string"!=typeof t)throw new TypeError(`"${e}" must be a string.`)}(t,"encoded"),d(c(t))}async compressBits(){return u(this.bits)}static async uncompressBits({compressed:t}){return l(t,"compressed"),d(t)}}function b(t,e,n){if(function(t,e){if(!(Number.isInteger(t)&&t>=0))throw new TypeError(`"${e}" must be a non-negative integer.`)}(t,"position"),f(e,"length"),g(n,"leftToRightIndexing"),t>=e)throw new Error(`Position "${t}" is out of range "0-${e-1}".`);const i=t%8;return{index:Math.floor(t/8),bit:1<<(n?7-i:i)}}
8
- /*!
9
- * Copyright (c) 2020-2022 Digital Bazaar, Inc. All rights reserved.
10
- */class y{constructor({length:t,buffer:e}={}){this.bitstring=new w({length:t,buffer:e}),this.length=this.bitstring.length}setRevoked(t,e){if("boolean"!=typeof e)throw new TypeError('"revoked" must be a boolean.');return this.bitstring.set(t,e)}isRevoked(t){return this.bitstring.get(t)}async encode(){return this.bitstring.encodeBits()}static async decode({encodedList:t}){const e=await w.decodeBits({encoded:t});return new y({buffer:e})}}
11
- /*!
12
- * Copyright (c) 2020-2022 Digital Bazaar, Inc. All rights reserved.
13
- */async function v({encodedList:t}){return y.decode({encodedList:t})}async function p(i){const s=await o({url:i}).catch(o=>{throw console.error(o),new t(e.checkRevokedStatus,`${n.i18n.getText("revocation","noRevocationStatusList2021Found")} ${i}.`)});if(s)try{return JSON.parse(s)}catch(o){throw console.error(o),new t(e.checkRevokedStatus,`${n.i18n.getText("revocation","noRevocationStatusList2021Found")} ${i}.`)}return s}async function R(i){const o=new s(i);await o.init();if((await o.verify()).status===r.FAILURE)throw new t(e.checkRevokedStatus,n.i18n.getText("revocation","revocationListAuthenticityFailure"))}async function m(o){Array.isArray(o)||(o=[o]);for(const s of o){const o=parseInt(s.statusListIndex,10),r=await p(s.statusListCredential);if(!r)throw new t(e.checkRevokedStatus,`${n.i18n.getText("revocation","noRevocationStatusList2021Found")} ${s.statusListCredential}.`);await R(r);const{encodedList:a}=r.credentialSubject;if((await v({encodedList:a})).isRevoked(o)){const o="revocation"===s.statusPurpose?i.REVOKED:i.SUSPENDED;throw new t(e.checkRevokedStatus,n.certificates.generateRevocationReason("",o))}}}export{m as default};
@@ -1 +0,0 @@
1
- import{V as o,z as t,d as i}from"./main.js";import{b as r}from"./index-6G1g4ypj-Dgus2xdV.js";function n(n,e=""){const s=function(o){return o.id}(n);if(s!==e.split("#")[0])throw new o(t.controlVerificationMethod,`${r} - ${i.i18n.getText("errors","controlVerificationMethod")}`)}export{n as default};
@@ -1 +0,0 @@
1
- import{q as e,V as s,g as r}from"./main.js";function i(i,n,o){let t="";const d=function(e,s){let r=null;for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&i.toLowerCase()===s.toLowerCase()&&(r=i);return e[r]}(i,n),a=e(o);if(d?(d.created&&a<=d.created&&(t="invalidIssuingAddressCreationTime"),d.revoked&&a>=d.revoked&&(t="invalidIssuingAddressRevoked"),d.expires&&a>=d.expires&&(t="invalidIssuingAddressExpired")):t="invalidIssuingAddressUnknown",t)throw new s("checkAuthenticity",r("errors",t))}export{i as e};
@@ -1,29 +0,0 @@
1
- import{t as e,f as t,v as r}from"./main.js";import{a as n,r as i,b as o,c as s,h as c,d as u,i as a,e as f,f as l,g as d,s as y}from"./sha2-JcCWfgvE-By1_saxP.js";
2
- /*!
3
- * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
4
- */
5
- const h="ECDSA",p=!0,w="https://w3id.org/security/suites/ecdsa-2019/v1",b="https://w3id.org/security/multikey/v1",g="z",m=new Uint8Array([231,1]),E=new Uint8Array([128,36]),v=new Uint8Array([129,36]),B=new Uint8Array([130,36]),x=new Uint8Array([129,38]),k=new Uint8Array([134,38]),K=new Uint8Array([135,38]),R=new Uint8Array([136,38]),O="P-256",A="P-384",U="P-521",S="K-256",I="SHA-256",q="SHA-384",C="SHA-512",M=globalThis.crypto,N=globalThis.CryptoKey??M.CryptoKey;function j({curve:e}){if(e===O||e===S)return I;if(e===A)return q;if(e===U)return C;throw new TypeError(`Unsupported curve "${e}".`)}
6
- /*!
7
- * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
8
- */function T({publicMultikey:e}){if(e[0]===E[0]&&e[1]===E[1])return O;if(e[0]===v[0]&&e[1]===v[1])return A;if(e[0]===B[0]&&e[1]===B[1])return U;if(e[0]===m[0]&&e[1]===m[1])return S;throw new TypeError("Unsupported public multikey header.")}function F({secretMultikey:e}){if(e[0]===k[0]&&e[1]===k[1])return O;if(e[0]===K[0]&&e[1]===K[1])return A;if(e[0]===R[0]&&e[1]===R[1])return U;if(e[0]===x[0]&&e[1]===x[1])return S;throw new TypeError("Unsupported secret multikey header.")}function P({curve:e}){if(e===O||e===S)return 32;if(e===A)return 48;if(e===U)return 66;throw new TypeError(`Unsupported curve "${e}".`)}
9
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
10
- const H=BigInt(0),Z=BigInt(1);function V(e,t=""){if("boolean"!=typeof e){throw new Error((t&&`"${t}" `)+"expected boolean, got type="+typeof e)}return e}function D(e){if("bigint"==typeof e){if(!G(e))throw new Error("positive bigint expected, got "+e)}else d(e);return e}function L(e){const t=D(e).toString(16);return 1&t.length?"0"+t:t}function _(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?H:BigInt("0x"+e)}function $(e){return _(o(e))}function Y(e){return _(o(function(e){return Uint8Array.from(e)}(s(e)).reverse()))}function z(e,t){d(t),e=D(e);const r=c(e.toString(16).padStart(2*t,"0"));if(r.length!==t)throw new Error("number too large");return r}function X(e,t){return z(e,t).reverse()}const G=e=>"bigint"==typeof e&&H<=e;function W(e,t,r,n){if(!function(e,t,r){return G(e)&&G(t)&&G(r)&&t<=e&&e<r}(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}const J=e=>(Z<<BigInt(e))-Z;function Q(e,t={},r={}){if(!e||"object"!=typeof e)throw new Error("expected valid options object");const n=(t,r)=>Object.entries(t).forEach(([t,n])=>function(t,r,n){const i=e[t];if(n&&void 0===i)return;const o=typeof i;if(o!==r||null===i)throw new Error(`param "${t}" is invalid: expected ${r}, got ${o}`)}(t,n,r));n(t,!1),n(r,!0)}function ee(e){const t=new WeakMap;return(r,...n)=>{const i=t.get(r);if(void 0!==i)return i;const o=e(r,...n);return t.set(r,o),o}}
11
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const te=BigInt(0),re=BigInt(1),ne=BigInt(2),ie=BigInt(3),oe=BigInt(4),se=BigInt(5),ce=BigInt(7),ue=BigInt(8),ae=BigInt(9),fe=BigInt(16);function le(e,t){const r=e%t;return r>=te?r:t+r}function de(e,t,r){let n=e;for(;t-- >te;)n*=n,n%=r;return n}function ye(e,t){if(e===te)throw new Error("invert: expected non-zero number");if(t<=te)throw new Error("invert: expected positive modulus, got "+t);let r=le(e,t),n=t,i=te,o=re;for(;r!==te;){const e=n%r,t=i-o*(n/r);n=r,r=e,i=o,o=t}if(n!==re)throw new Error("invert: does not exist");return le(i,t)}function he(e,t,r){if(!e.eql(e.sqr(t),r))throw new Error("Cannot find square root")}function pe(e,t){const r=(e.ORDER+re)/oe,n=e.pow(t,r);return he(e,n,t),n}function we(e,t){const r=(e.ORDER-se)/ue,n=e.mul(t,ne),i=e.pow(n,r),o=e.mul(t,i),s=e.mul(e.mul(o,ne),i),c=e.mul(o,e.sub(s,e.ONE));return he(e,c,t),c}function be(e){if(e<ie)throw new Error("sqrt is not defined for small field");let t=e-re,r=0;for(;t%ne===te;)t/=ne,r++;let n=ne;const i=xe(e);for(;1===ve(i,n);)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===r)return pe;let o=i.pow(n,t);const s=(t+re)/ne;return function(e,n){if(e.is0(n))return n;if(1!==ve(e,n))throw new Error("Cannot find square root");let i=r,c=e.mul(e.ONE,o),u=e.pow(n,t),a=e.pow(n,s);for(;!e.eql(u,e.ONE);){if(e.is0(u))return e.ZERO;let t=1,r=e.sqr(u);for(;!e.eql(r,e.ONE);)if(t++,r=e.sqr(r),t===i)throw new Error("Cannot find square root");const n=re<<BigInt(i-t-1),o=e.pow(c,n);i=t,c=e.sqr(o),u=e.mul(u,c),a=e.mul(a,o)}return a}}function ge(e){return e%oe===ie?pe:e%ue===se?we:e%fe===ae?function(e){const t=xe(e),r=be(e),n=r(t,t.neg(t.ONE)),i=r(t,n),o=r(t,t.neg(n)),s=(e+ce)/fe;return(e,t)=>{let r=e.pow(t,s),c=e.mul(r,n);const u=e.mul(r,i),a=e.mul(r,o),f=e.eql(e.sqr(c),t),l=e.eql(e.sqr(u),t);r=e.cmov(r,c,f),c=e.cmov(a,u,l);const d=e.eql(e.sqr(c),t),y=e.cmov(r,c,d);return he(e,y,t),y}}(e):be(e)}const me=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ee(e,t,r=!1){const n=new Array(t.length).fill(r?e.ZERO:void 0),i=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),o=e.inv(i);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),o),n}function ve(e,t){const r=(e.ORDER-re)/ne,n=e.pow(t,r),i=e.eql(n,e.ONE),o=e.eql(n,e.ZERO),s=e.eql(n,e.neg(e.ONE));if(!i&&!o&&!s)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}class Be{ORDER;BITS;BYTES;isLE;ZERO=te;ONE=re;_lengths;_sqrt;_mod;constructor(e,t={}){if(e<=te)throw new Error("invalid field: expected ORDER > 0, got "+e);let r;this.isLE=!1,null!=t&&"object"==typeof t&&("number"==typeof t.BITS&&(r=t.BITS),"function"==typeof t.sqrt&&(this.sqrt=t.sqrt),"boolean"==typeof t.isLE&&(this.isLE=t.isLE),t.allowedLengths&&(this._lengths=t.allowedLengths?.slice()),"boolean"==typeof t.modFromBytes&&(this._mod=t.modFromBytes));const{nBitLength:n,nByteLength:i}=function(e,t){void 0!==t&&d(t);const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}(e,r);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=n,this.BYTES=i,this._sqrt=void 0,Object.preventExtensions(this)}create(e){return le(e,this.ORDER)}isValid(e){if("bigint"!=typeof e)throw new Error("invalid field element: expected bigint, got "+typeof e);return te<=e&&e<this.ORDER}is0(e){return e===te}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&re)===re}neg(e){return le(-e,this.ORDER)}eql(e,t){return e===t}sqr(e){return le(e*e,this.ORDER)}add(e,t){return le(e+t,this.ORDER)}sub(e,t){return le(e-t,this.ORDER)}mul(e,t){return le(e*t,this.ORDER)}pow(e,t){return function(e,t,r){if(r<te)throw new Error("invalid exponent, negatives unsupported");if(r===te)return e.ONE;if(r===re)return t;let n=e.ONE,i=t;for(;r>te;)r&re&&(n=e.mul(n,i)),i=e.sqr(i),r>>=re;return n}(this,e,t)}div(e,t){return le(e*ye(t,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,t){return e+t}subN(e,t){return e-t}mulN(e,t){return e*t}inv(e){return ye(e,this.ORDER)}sqrt(e){return this._sqrt||(this._sqrt=ge(this.ORDER)),this._sqrt(this,e)}toBytes(e){return this.isLE?X(e,this.BYTES):z(e,this.BYTES)}fromBytes(e,t=!1){s(e);const{_lengths:r,BYTES:n,isLE:i,ORDER:o,_mod:c}=this;if(r){if(!r.includes(e.length)||e.length>n)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+e.length);const t=new Uint8Array(n);t.set(e,i?0:t.length-e.length),e=t}if(e.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+e.length);let u=i?Y(e):$(e);if(c&&(u=le(u,o)),!t&&!this.isValid(u))throw new Error("invalid field element: outside of range 0..ORDER");return u}invertBatch(e){return Ee(this,e)}cmov(e,t,r){return r?t:e}}function xe(e,t={}){return new Be(e,t)}function ke(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Ke(e){const t=ke(e);return t+Math.ceil(t/2)}
12
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
13
- const Re=BigInt(0),Oe=BigInt(1);function Ae(e,t){const r=t.negate();return e?r:t}function Ue(e,t){const r=Ee(e.Fp,t.map(e=>e.Z));return t.map((t,n)=>e.fromAffine(t.toAffine(r[n])))}function Se(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Ie(e,t){Se(e,t);const r=2**e;return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1),mask:J(e),maxNumber:r,shiftBy:BigInt(e)}}function qe(e,t,r){const{windowSize:n,mask:i,maxNumber:o,shiftBy:s}=r;let c=Number(e&i),u=e>>s;c>n&&(c-=o,u+=Oe);const a=t*n;return{nextN:u,offset:a+Math.abs(c)-1,isZero:0===c,isNeg:c<0,isNegF:t%2!=0,offsetF:a}}const Ce=new WeakMap,Me=new WeakMap;function Ne(e){return Me.get(e)||1}function je(e){if(e!==Re)throw new Error("invalid wNAF")}class Te{BASE;ZERO;Fn;bits;constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let n=e;for(;t>Re;)t&Oe&&(r=r.add(n)),n=n.double(),t>>=Oe;return r}precomputeWindow(e,t){const{windows:r,windowSize:n}=Ie(t,this.bits),i=[];let o=e,s=o;for(let e=0;e<r;e++){s=o,i.push(s);for(let e=1;e<n;e++)s=s.add(o),i.push(s);o=s.double()}return i}wNAF(e,t,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let n=this.ZERO,i=this.BASE;const o=Ie(e,this.bits);for(let e=0;e<o.windows;e++){const{nextN:s,offset:c,isZero:u,isNeg:a,isNegF:f,offsetF:l}=qe(r,e,o);r=s,u?i=i.add(Ae(f,t[l])):n=n.add(Ae(a,t[c]))}return je(r),{p:n,f:i}}wNAFUnsafe(e,t,r,n=this.ZERO){const i=Ie(e,this.bits);for(let e=0;e<i.windows&&r!==Re;e++){const{nextN:o,offset:s,isZero:c,isNeg:u}=qe(r,e,i);if(r=o,!c){const e=t[s];n=n.add(u?e.negate():e)}}return je(r),n}getPrecomputes(e,t,r){let n=Ce.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&("function"==typeof r&&(n=r(n)),Ce.set(t,n))),n}cached(e,t,r){const n=Ne(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)}unsafe(e,t,r,n){const i=Ne(e);return 1===i?this._unsafeLadder(e,t,n):this.wNAFUnsafe(i,this.getPrecomputes(i,e,r),t,n)}createCache(e,t){Se(t,this.bits),Me.set(e,t),Ce.delete(e)}hasCache(e){return 1!==Ne(e)}}function Fe(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return function(e){Q(e,me.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",BYTES:"number",BITS:"number"}))}(t),t}return xe(e,{isLE:r})}class Pe{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,t){if(n(e),s(t,void 0,"key"),this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(t.length>r?e.create().update(t).digest():t);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),f(i)}update(e){return l(this),this.iHash.update(e),this}digestInto(e){l(this),s(e,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});const{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=n,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const He=(e,t,r)=>new Pe(e,t).update(r).digest();He.create=(e,t)=>new Pe(e,t);
14
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
15
- const Ze=(e,t)=>(e+(e>=0?t:-t)/Xe)/t;function Ve(e,t,r){const[[n,i],[o,s]]=t,c=Ze(s*e,r),u=Ze(-i*e,r);let a=e-c*n-u*o,f=-c*i-u*s;const l=a<Ye,d=f<Ye;l&&(a=-a),d&&(f=-f);const y=J(Math.ceil(function(e){let t;for(t=0;e>H;e>>=Z,t+=1);return t}(r)/2))+ze;if(a<Ye||a>=y||f<Ye||f>=y)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:l,k1:a,k2neg:d,k2:f}}function De(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Le(e,t){const r={};for(let n of Object.keys(t))r[n]=void 0===e[n]?t[n]:e[n];return V(r.lowS,"lowS"),V(r.prehash,"prehash"),void 0!==r.format&&De(r.format),r}class _e extends Error{constructor(e=""){super(e)}}const $e={Err:_e,_tlv:{encode:(e,t)=>{const{Err:r}=$e;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");const n=t.length/2,i=L(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const o=n>127?L(i.length/2|128):"";return L(e)+o+i+t},decode(e,t){const{Err:r}=$e;let n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");const i=t[n++];let o=0;if(!!(128&i)){const e=127&i;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");const s=t.subarray(n,n+e);if(s.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===s[0])throw new r("tlv.decode(long): zero leftmost byte");for(const e of s)o=o<<8|e;if(n+=e,o<128)throw new r("tlv.decode(long): not minimal encoding")}else o=i;const s=t.subarray(n,n+o);if(s.length!==o)throw new r("tlv.decode: wrong value length");return{v:s,l:t.subarray(n+o)}}},_int:{encode(e){const{Err:t}=$e;if(e<Ye)throw new t("integer: negative integers are not allowed");let r=L(e);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){const{Err:t}=$e;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return $(e)}},toSig(e){const{Err:t,_int:r,_tlv:n}=$e,i=s(e,void 0,"signature"),{v:o,l:c}=n.decode(48,i);if(c.length)throw new t("invalid signature: left bytes after parsing");const{v:u,l:a}=n.decode(2,o),{v:f,l:l}=n.decode(2,a);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(u),s:r.decode(f)}},hexFromSig(e){const{_tlv:t,_int:r}=$e,n=t.encode(2,r.encode(e.r))+t.encode(2,r.encode(e.s));return t.encode(48,n)}},Ye=BigInt(0),ze=BigInt(1),Xe=BigInt(2),Ge=BigInt(3),We=BigInt(4);function Je(e,t={}){const r=function(e,t,r={},n){if(void 0===n&&(n="edwards"===e),!t||"object"!=typeof t)throw new Error(`expected valid ${e} CURVE object`);for(const e of["p","n","h"]){const r=t[e];if(!("bigint"==typeof r&&r>Re))throw new Error(`CURVE.${e} must be positive bigint`)}const i=Fe(t.p,r.Fp,n),o=Fe(t.n,r.Fn,n),s=["Gx","Gy","a","b"];for(const e of s)if(!i.isValid(t[e]))throw new Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:i,Fn:o}}("weierstrass",e,t),{Fp:n,Fn:i}=r;let a=r.CURVE;const{h:f,n:l}=a;Q(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:d}=t;if(d&&(!n.is0(a.a)||"bigint"!=typeof d.beta||!Array.isArray(d.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const y=et(n,i);function h(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}const p=t.toBytes||function(e,t,r){const{x:i,y:o}=t.toAffine(),s=n.toBytes(i);if(V(r,"isCompressed"),r){h();const e=!n.isOdd(o);return u(Qe(e),s)}return u(Uint8Array.of(4),s,n.toBytes(o))},w=t.fromBytes||function(e){s(e,void 0,"Point");const{publicKey:t,publicKeyUncompressed:r}=y,i=e.length,o=e[0],c=e.subarray(1);if(i!==t||2!==o&&3!==o){if(i===r&&4===o){const e=n.BYTES,t=n.fromBytes(c.subarray(0,e)),r=n.fromBytes(c.subarray(e,2*e));if(!g(t,r))throw new Error("bad point: is not on curve");return{x:t,y:r}}throw new Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${r}`)}{const e=n.fromBytes(c);if(!n.isValid(e))throw new Error("bad point: is not on curve, wrong x");const t=b(e);let r;try{r=n.sqrt(t)}catch(e){const t=e instanceof Error?": "+e.message:"";throw new Error("bad point: is not on curve, sqrt error"+t)}h();return!(1&~o)!==n.isOdd(r)&&(r=n.neg(r)),{x:e,y:r}}};function b(e){const t=n.sqr(e),r=n.mul(t,e);return n.add(n.add(r,n.mul(e,a.a)),a.b)}function g(e,t){const r=n.sqr(t),i=b(e);return n.eql(r,i)}if(!g(a.Gx,a.Gy))throw new Error("bad curve params: generator point");const m=n.mul(n.pow(a.a,Ge),We),E=n.mul(n.sqr(a.b),BigInt(27));if(n.is0(n.add(m,E)))throw new Error("bad curve params: a or b");function v(e,t,r=!1){if(!n.isValid(t)||r&&n.is0(t))throw new Error(`bad point coordinate ${e}`);return t}function B(e){if(!(e instanceof O))throw new Error("Weierstrass Point expected")}function x(e){if(!d||!d.basises)throw new Error("no endo");return Ve(e,d.basises,i.ORDER)}const k=ee((e,t)=>{const{X:r,Y:i,Z:o}=e;if(n.eql(o,n.ONE))return{x:r,y:i};const s=e.is0();null==t&&(t=s?n.ONE:n.inv(o));const c=n.mul(r,t),u=n.mul(i,t),a=n.mul(o,t);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(a,n.ONE))throw new Error("invZ was invalid");return{x:c,y:u}}),K=ee(e=>{if(e.is0()){if(t.allowInfinityPoint&&!n.is0(e.Y))return;throw new Error("bad point: ZERO")}const{x:r,y:i}=e.toAffine();if(!n.isValid(r)||!n.isValid(i))throw new Error("bad point: x or y not field elements");if(!g(r,i))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function R(e,t,r,i,o){return r=new O(n.mul(r.X,e),r.Y,r.Z),t=Ae(i,t),r=Ae(o,r),t.add(r)}class O{static BASE=new O(a.Gx,a.Gy,n.ONE);static ZERO=new O(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=i;X;Y;Z;constructor(e,t,r){this.X=v("x",e),this.Y=v("y",t,!0),this.Z=v("z",r),Object.freeze(this)}static CURVE(){return a}static fromAffine(e){const{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw new Error("invalid affine point");if(e instanceof O)throw new Error("projective point not allowed");return n.is0(t)&&n.is0(r)?O.ZERO:new O(t,r,n.ONE)}static fromBytes(e){const t=O.fromAffine(w(s(e,void 0,"point")));return t.assertValidity(),t}static fromHex(e){return O.fromBytes(c(e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return U.createCache(this,e),t||this.multiply(Ge),this}assertValidity(){K(this)}hasEvenY(){const{y:e}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(e)}equals(e){B(e);const{X:t,Y:r,Z:i}=this,{X:o,Y:s,Z:c}=e,u=n.eql(n.mul(t,c),n.mul(o,i)),a=n.eql(n.mul(r,c),n.mul(s,i));return u&&a}negate(){return new O(this.X,n.neg(this.Y),this.Z)}double(){const{a:e,b:t}=a,r=n.mul(t,Ge),{X:i,Y:o,Z:s}=this;let c=n.ZERO,u=n.ZERO,f=n.ZERO,l=n.mul(i,i),d=n.mul(o,o),y=n.mul(s,s),h=n.mul(i,o);return h=n.add(h,h),f=n.mul(i,s),f=n.add(f,f),c=n.mul(e,f),u=n.mul(r,y),u=n.add(c,u),c=n.sub(d,u),u=n.add(d,u),u=n.mul(c,u),c=n.mul(h,c),f=n.mul(r,f),y=n.mul(e,y),h=n.sub(l,y),h=n.mul(e,h),h=n.add(h,f),f=n.add(l,l),l=n.add(f,l),l=n.add(l,y),l=n.mul(l,h),u=n.add(u,l),y=n.mul(o,s),y=n.add(y,y),l=n.mul(y,h),c=n.sub(c,l),f=n.mul(y,d),f=n.add(f,f),f=n.add(f,f),new O(c,u,f)}add(e){B(e);const{X:t,Y:r,Z:i}=this,{X:o,Y:s,Z:c}=e;let u=n.ZERO,f=n.ZERO,l=n.ZERO;const d=a.a,y=n.mul(a.b,Ge);let h=n.mul(t,o),p=n.mul(r,s),w=n.mul(i,c),b=n.add(t,r),g=n.add(o,s);b=n.mul(b,g),g=n.add(h,p),b=n.sub(b,g),g=n.add(t,i);let m=n.add(o,c);return g=n.mul(g,m),m=n.add(h,w),g=n.sub(g,m),m=n.add(r,i),u=n.add(s,c),m=n.mul(m,u),u=n.add(p,w),m=n.sub(m,u),l=n.mul(d,g),u=n.mul(y,w),l=n.add(u,l),u=n.sub(p,l),l=n.add(p,l),f=n.mul(u,l),p=n.add(h,h),p=n.add(p,h),w=n.mul(d,w),g=n.mul(y,g),p=n.add(p,w),w=n.sub(h,w),w=n.mul(d,w),g=n.add(g,w),h=n.mul(p,g),f=n.add(f,h),h=n.mul(m,g),u=n.mul(b,u),u=n.sub(u,h),h=n.mul(b,p),l=n.mul(m,l),l=n.add(l,h),new O(u,f,l)}subtract(e){return this.add(e.negate())}is0(){return this.equals(O.ZERO)}multiply(e){const{endo:r}=t;if(!i.isValidNot0(e))throw new Error("invalid scalar: out of range");let n,o;const s=e=>U.cached(this,e,e=>Ue(O,e));if(r){const{k1neg:t,k1:i,k2neg:c,k2:u}=x(e),{p:a,f:f}=s(i),{p:l,f:d}=s(u);o=f.add(d),n=R(r.beta,a,l,t,c)}else{const{p:t,f:r}=s(e);n=t,o=r}return Ue(O,[n,o])[0]}multiplyUnsafe(e){const{endo:r}=t,n=this;if(!i.isValid(e))throw new Error("invalid scalar: out of range");if(e===Ye||n.is0())return O.ZERO;if(e===ze)return n;if(U.hasCache(this))return this.multiply(e);if(r){const{k1neg:t,k1:i,k2neg:o,k2:s}=x(e),{p1:c,p2:u}=function(e,t,r,n){let i=t,o=e.ZERO,s=e.ZERO;for(;r>Re||n>Re;)r&Oe&&(o=o.add(i)),n&Oe&&(s=s.add(i)),i=i.double(),r>>=Oe,n>>=Oe;return{p1:o,p2:s}}(O,n,i,s);return R(r.beta,c,u,t,o)}return U.unsafe(n,e)}toAffine(e){return k(this,e)}isTorsionFree(){const{isTorsionFree:e}=t;return f===ze||(e?e(O,this):U.unsafe(this,l).is0())}clearCofactor(){const{clearCofactor:e}=t;return f===ze?this:e?e(O,this):this.multiplyUnsafe(f)}isSmallOrder(){return this.multiplyUnsafe(f).is0()}toBytes(e=!0){return V(e,"isCompressed"),this.assertValidity(),p(O,this,e)}toHex(e=!0){return o(this.toBytes(e))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const A=i.BITS,U=new Te(O,t.endo?Math.ceil(A/2):A);return O.BASE.precompute(8),O}function Qe(e){return Uint8Array.of(e?2:3)}function et(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function tt(e,t={}){const{Fn:r}=e,n=t.randomBytes||i,o=Object.assign(et(e.Fp,r),{seed:Ke(r.ORDER)});function c(e=n(o.seed)){return function(e,t,r=!1){s(e);const n=e.length,i=ke(t),o=Ke(t);if(n<16||n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);const c=le(r?Y(e):$(e),t-re)+re;return r?X(c,i):z(c,i)}(s(e,o.seed,"seed"),r.ORDER)}function u(t,n=!0){return e.BASE.multiply(r.fromBytes(t)).toBytes(n)}function f(e){const{secretKey:t,publicKey:n,publicKeyUncompressed:i}=o;if(!a(e))return;if("_lengths"in r&&r._lengths||t===n)return;const c=s(e,void 0,"key").length;return c===n||c===i}const l={isValidSecretKey:function(e){try{const t=r.fromBytes(e);return r.isValidNot0(t)}catch(e){return!1}},isValidPublicKey:function(t,r){const{publicKey:n,publicKeyUncompressed:i}=o;try{const o=t.length;return(!0!==r||o===n)&&((!1!==r||o===i)&&!!e.fromBytes(t))}catch(e){return!1}},randomSecretKey:c},d=function(e,t){return function(r){const n=e(r);return{secretKey:n,publicKey:t(n)}}}(c,u);return Object.freeze({getPublicKey:u,getSharedSecret:function(t,n,i=!0){if(!0===f(t))throw new Error("first arg must be private key");if(!1===f(n))throw new Error("second arg must be public key");const o=r.fromBytes(t);return e.fromBytes(n).multiply(o).toBytes(i)},keygen:d,Point:e,utils:l,lengths:o})}function rt(e,t,r={}){n(t),Q(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const f=(r=Object.assign({},r)).randomBytes||i,l=r.hmac||((e,r)=>He(t,e,r)),{Fp:y,Fn:h}=e,{ORDER:p,BITS:w}=h,{keygen:b,getPublicKey:g,getSharedSecret:m,utils:E,lengths:v}=tt(e,r),B={prehash:!0,lowS:"boolean"!=typeof r.lowS||r.lowS,format:"compact",extraEntropy:!1},x=p*Xe<y.ORDER;function k(e){return e>p>>ze}function K(e,t){if(!h.isValidNot0(t))throw new Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}function R(){if(x)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function O(e,t){De(t);const r=v.signature;return s(e,"compact"===t?r:"recovered"===t?r+1:void 0)}class A{r;s;recovery;constructor(e,t,r){if(this.r=K("r",e),this.s=K("s",t),null!=r){if(R(),![0,1,2,3].includes(r))throw new Error("invalid recovery id");this.recovery=r}Object.freeze(this)}static fromBytes(e,t=B.format){let r;if(O(e,t),"der"===t){const{r:t,s:r}=$e.toSig(s(e));return new A(t,r)}"recovered"===t&&(r=e[0],t="compact",e=e.subarray(1));const n=v.signature/2,i=e.subarray(0,n),o=e.subarray(n,2*n);return new A(h.fromBytes(i),h.fromBytes(o),r)}static fromHex(e,t){return this.fromBytes(c(e),t)}assertRecovery(){const{recovery:e}=this;if(null==e)throw new Error("invalid recovery id: must be present");return e}addRecoveryBit(e){return new A(this.r,this.s,e)}recoverPublicKey(t){const{r:r,s:n}=this,i=this.assertRecovery(),o=2===i||3===i?r+p:r;if(!y.isValid(o))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const c=y.toBytes(o),a=e.fromBytes(u(Qe(!(1&i)),c)),f=h.inv(o),l=S(s(t,void 0,"msgHash")),d=h.create(-l*f),w=h.create(n*f),b=e.BASE.multiplyUnsafe(d).add(a.multiplyUnsafe(w));if(b.is0())throw new Error("invalid recovery: point at infinify");return b.assertValidity(),b}hasHighS(){return k(this.s)}toBytes(e=B.format){if(De(e),"der"===e)return c($e.hexFromSig(this));const{r:t,s:r}=this,n=h.toBytes(t),i=h.toBytes(r);return"recovered"===e?(R(),u(Uint8Array.of(this.assertRecovery()),n,i)):u(n,i)}toHex(e){return o(this.toBytes(e))}}const U=r.bits2int||function(e){if(e.length>8192)throw new Error("input is too large");const t=$(e),r=8*e.length-w;return r>0?t>>BigInt(r):t},S=r.bits2int_modN||function(e){return h.create(U(e))},I=J(w);function q(e){return W("num < 2^"+w,e,Ye,I),h.toBytes(e)}function C(e,r){return s(e,void 0,"message"),r?s(t(e),void 0,"prehashed message"):e}return Object.freeze({keygen:b,getPublicKey:g,getSharedSecret:m,utils:E,lengths:v,Point:e,sign:function(r,n,i={}){const{seed:o,k2sig:c}=function(t,r,n){const{lowS:i,prehash:o,extraEntropy:c}=Le(n,B);t=C(t,o);const a=S(t),l=h.fromBytes(r);if(!h.isValidNot0(l))throw new Error("invalid private key");const d=[q(l),q(a)];if(null!=c&&!1!==c){const e=!0===c?f(v.secretKey):c;d.push(s(e,void 0,"extraEntropy"))}const y=u(...d),p=a;return{seed:y,k2sig:function(t){const r=U(t);if(!h.isValidNot0(r))return;const n=h.inv(r),o=e.BASE.multiply(r).toAffine(),s=h.create(o.x);if(s===Ye)return;const c=h.create(n*h.create(p+s*l));if(c===Ye)return;let u=(o.x===s?0:2)|Number(o.y&ze),a=c;return i&&k(c)&&(a=h.neg(c),u^=1),new A(s,a,x?void 0:u)}}}(r,n,i);return function(e,t,r){if(d(e,"hashLen"),d(t,"qByteLen"),"function"!=typeof r)throw new Error("hmacFn must be a function");const n=e=>new Uint8Array(e),i=Uint8Array.of(),o=Uint8Array.of(0),s=Uint8Array.of(1);let c=n(e),a=n(e),f=0;const l=()=>{c.fill(1),a.fill(0),f=0},y=(...e)=>r(a,u(c,...e)),h=(e=i)=>{a=y(o,e),c=y(),0!==e.length&&(a=y(s,e),c=y())},p=()=>{if(f++>=1e3)throw new Error("drbg: tried max amount of iterations");let e=0;const r=[];for(;e<t;){c=y();const t=c.slice();r.push(t),e+=c.length}return u(...r)};return(e,t)=>{let r;for(l(),h(e);!(r=t(p()));)h();return l(),r}}(t.outputLen,h.BYTES,l)(o,c).toBytes(i.format)},verify:function(t,r,n,i={}){const{lowS:o,prehash:c,format:u}=Le(i,B);if(n=s(n,void 0,"publicKey"),r=C(r,c),!a(t)){throw new Error("verify expects Uint8Array signature"+(t instanceof A?", use sig.toBytes()":""))}O(t,u);try{const i=A.fromBytes(t,u),s=e.fromBytes(n);if(o&&i.hasHighS())return!1;const{r:c,s:a}=i,f=S(r),l=h.inv(a),d=h.create(f*l),y=h.create(c*l),p=e.BASE.multiplyUnsafe(d).add(s.multiplyUnsafe(y));if(p.is0())return!1;return h.create(p.x)===c}catch(e){return!1}},recoverPublicKey:function(e,t,r={}){const{prehash:n}=Le(r,B);return t=C(t,n),A.fromBytes(e,"recovered").recoverPublicKey(t).toBytes()},Signature:A,hash:t})}
16
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const nt={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},it={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},ot=BigInt(2);const st=xe(nt.p,{sqrt:function(e){const t=nt.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),c=BigInt(44),u=BigInt(88),a=e*e*e%t,f=a*a*e%t,l=de(f,r,t)*f%t,d=de(l,r,t)*f%t,y=de(d,ot,t)*a%t,h=de(y,i,t)*y%t,p=de(h,o,t)*h%t,w=de(p,c,t)*p%t,b=de(w,u,t)*w%t,g=de(b,c,t)*p%t,m=de(g,r,t)*f%t,E=de(m,s,t)*h%t,v=de(E,n,t)*a%t,B=de(v,ot,t);if(!st.eql(st.sqr(B),e))throw new Error("Cannot find square root");return B}}),ct=rt(Je(nt,{Fp:st,endo:it}),y);class ut{constructor(e){this.ec={...ct},null!=e.priv&&(this.priv=e.priv),null!=e.pub&&(this.pub=e.pub)}static hexToBytes(e){if("string"!=typeof e)throw new Error("hex string expected");if(e.length%2)throw new Error("hex string must have even length");const t=e.length/2,r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=parseInt(e.substr(2*n,2),16);return r}static bytesToHex(e){return Array.from(e||[]).map(e=>e.toString(16).padStart(2,"0")).join("")}static keyFromPublic(e,t="hex"){const r="hex"===t?ut.hexToBytes(e):e;return new ut({pub:r})}getPublic(e=!0,t="hex"){this.pub||(this.pub=this.ec.getPublicKey(this.priv,!1));let r=this.pub;const n=this.ec.Point.fromHex(ut.bytesToHex(r)).toHex(e);return r=ut.hexToBytes(n),"hex"===t?ut.bytesToHex(r):r}}
17
- /*!
18
- * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
19
- */const at=new Map([[O,{secret:new Uint8Array([48,103,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,77,48,75,2,1,1,4,32]),public:new Uint8Array([161,36,3,34,0])}],[A,{secret:new Uint8Array([48,129,132,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,109,48,107,2,1,1,4,48]),public:new Uint8Array([161,52,3,50,0])}],[U,{secret:new Uint8Array([48,129,170,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,129,146,48,129,143,2,1,1,4,66]),public:new Uint8Array([161,70,3,68,0])}],[S,{secret:new Uint8Array([48,129,132,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10,4,109,48,107,2,1,1,4,32]),public:new Uint8Array([161,68,3,66,0])}]]),ft=new Map([[O,new Uint8Array([48,57,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,34,0])],[A,new Uint8Array([48,70,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,3,50,0])],[U,new Uint8Array([48,88,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,3,68,0])],[S,new Uint8Array([48,86,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10,3,66,0])]]);function lt(e){return Uint8Array.from(ut.keyFromPublic(e,"bytes").getPublic(!1,"array"))}async function dt({id:e,controller:r,secretKeyMultibase:n,publicKeyMultibase:i,keyAgreement:o=!1}){if(!i)throw new TypeError('The "publicKeyMultibase" property is required.');const s={id:e,controller:r};if(!i||"string"!=typeof i||i[0]!==g)throw new TypeError('"publicKeyMultibase" must be a multibase, base58-encoded string.');const c=t(i.slice(1)),u={name:o?"ECDH":h,namedCurve:T({publicMultikey:c})},a=function({publicMultikey:e}){const t=T({publicMultikey:e});let r=e.subarray(2);t===S&&(r=lt(r));return function({curve:e,publicKey:t}){const r=ft.get(e),n=new Uint8Array(r.length+t.length);let i=0;return n.set(r,i),i+=r.length,n.set(t,i),n}
20
- /*!
21
- * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
22
- */({curve:t,publicKey:r})}({publicMultikey:c}),f=o?[]:["verify"];if(u.namedCurve===S){const{Crypto:e}=await import("./webcrypto.es-aoUxIxUm-gGk5JRJH.js"),t=new e;s.publicKey=await t.subtle.importKey("spki",a,u,p,f)}else s.publicKey=await M.subtle.importKey("spki",a,u,p,f);if(n){if("string"!=typeof n||n[0]!==g)throw new TypeError('"secretKeyMultibase" must be a multibase, base58-encoded string.');const e=t(n.slice(1));!function({secretMultikey:e,publicMultikey:t}){const r=T({publicMultikey:t}),n=F({secretMultikey:e});if(r!==n)throw new Error(`Public key curve ('${r}') does not match secret key curve ('${n}').`)}({secretMultikey:e,publicMultikey:c});const r=function({secretMultikey:e,publicMultikey:t}){const r=F({secretMultikey:e}),n=e.subarray(2),i=t.subarray(2);return function({curve:e,secretKey:t,publicKey:r}){const n=at.get(e);if(!n)throw new Error(`Unsupported curve "${e}".`);e===S&&(r=lt(r));const i=new Uint8Array(n.secret.length+t.length+n.public.length+r.length);let o=0;return i.set(n.secret,o),o+=n.secret.length,i.set(t,o),o+=t.length,i.set(n.public,o),o+=n.public.length,i.set(r,o),i}({curve:r,secretKey:n,publicKey:i})}({secretMultikey:e,publicMultikey:c}),i=o?["deriveBits"]:["sign"];if(u.namedCurve===S){const{Crypto:e}=await import("./webcrypto.es-aoUxIxUm-gGk5JRJH.js"),t=new e;s.secretKey=await t.subtle.importKey("pkcs8",r,u,p,i)}else s.secretKey=await M.subtle.importKey("pkcs8",r,u,p,i)}return s}function yt({jwk:t}={}){if("EC"!==t?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:r}=t,n=P({curve:r}),i=e(t.x),o=e(t.y),s=new Uint8Array(n+1),c=o[o.length-1]%2==0;return s[0]=c?2:3,s.set(i,s.length-i.length),s}function ht({jwk:t}={}){if("EC"!==t?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:n}=t,i=P({curve:n}),o=e(t.x),s=e(t.y),c=new Uint8Array(2+(i+1));!function({curve:e,buffer:t}){if(e===O)t[0]=E[0],t[1]=E[1];else if(e===A)t[0]=v[0],t[1]=v[1];else if(e===U)t[0]=B[0],t[1]=B[1];else{if(e!==S)throw new TypeError(`Unsupported curve "${e}".`);t[0]=m[0],t[1]=m[1]}}({curve:n,buffer:c});const u=s[s.length-1]%2==0;c[2]=u?2:3,c.set(o,c.length-o.length);return g+r(c)}function pt({jwk:t}={}){if("EC"!==t?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:n}=t,i=P({curve:n}),o=e(t.d),s=new Uint8Array(2+i);!function({curve:e,buffer:t}){if(e===O)t[0]=k[0],t[1]=k[1];else if(e===A)t[0]=K[0],t[1]=K[1];else if(e===U)t[0]=R[0],t[1]=R[1];else{if(e!==S)throw new TypeError(`Unsupported curve "${e}".`);t[0]=x[0],t[1]=x[1]}}({curve:t.crv,buffer:s}),s.set(o,s.length-o.length);return g+r(s)}const wt=new Set(["EcdsaSecp256r1VerificationKey2019","EcdsaSecp384r1VerificationKey2019","EcdsaSecp521r1VerificationKey2019","EcdsaSecp256k1VerificationKey2019"]);async function bt({keyPair:e}){if(!wt.has(e.type))throw new TypeError(`Unsupported key type "${e.type}".`);if(e["@context"]||(e["@context"]=w),!function({document:e,contextUrl:t}){const r=e["@context"];return r===t||Array.isArray(r)&&r.includes(t)}
23
- /*!
24
- * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
25
- */({document:e,contextUrl:w}))throw new TypeError(`Context not supported "${e["@context"]}".`);return{"@context":b,id:e.id,type:"Multikey",controller:e.controller,publicKeyMultibase:e.publicKeyMultibase,secretKeyMultibase:e.secretKeyMultibase}}async function gt(e,t={}){"boolean"==typeof t&&(t={keyAgreement:t});const{keyAgreement:r}=t;let n={...e};if("Multikey"!==n.type){if(n.publicKeyJwk)return async function({jwk:e,secretKey:t=!1}={}){const r={"@context":b,type:"Multikey",publicKeyMultibase:ht({jwk:e})};t&&e.d&&(r.secretKeyMultibase=pt({jwk:e}));const n=!e.key_ops||e.key_ops.includes("deriveBits");return gt(r,n)}({jwk:n.publicKeyJwk,secretKey:!1});if(n.type)return n=await bt({keyPair:n}),Et({keyPair:n,keyAgreement:r})}return n.type||(n.type="Multikey"),n["@context"]||(n["@context"]=b),n.controller&&!n.id&&(n.id=`${e.controller}#${e.publicKeyMultibase}`),function(e){if(!e||"object"!=typeof e)throw new TypeError('"key" must be an object.');if("Multikey"!==e.type)throw new TypeError('"key" must be a Multikey with type "Multikey".');if(!(e["@context"]===b||Array.isArray(e["@context"])&&e["@context"].includes(b)))throw new TypeError(`"key" must be a Multikey with context "${b}".`)}(n),Et({keyPair:n,keyAgreement:r})}async function mt({keyPair:e,secretKey:t=!1}={}){e?.publicKey instanceof N||(e=await dt(e));const r=t&&!!e.secretKey?e.secretKey:e.publicKey;let n;if(e.publicKey.algorithm.namedCurve===S){const{Crypto:e}=await import("./webcrypto.es-aoUxIxUm-gGk5JRJH.js"),t=new e;n=await t.subtle.exportKey("jwk",r)}else n=await M.subtle.exportKey("jwk",r);return n}async function Et({keyPair:t,keyAgreement:r=!1}){t?.publicKey instanceof N||t.publicKey?.algorithm.namedCurve===S||(t=await dt(t));const n=async({publicKey:r=!0,secretKey:n=!1,includeContext:i=!0,raw:o=!1}={})=>{if(o){const i=await mt({keyPair:t,secretKey:n}),o={};return r&&(o.publicKey=yt({jwk:i})),n&&(o.secretKey=function({jwk:t}={}){if("EC"!==t?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:r}=t,n=P({curve:r}),i=e(t.d),o=new Uint8Array(n);return o.set(i,o.length-i.length),o}({jwk:i})),o}return async function({keyPair:e,secretKey:t,publicKey:r,includeContext:n}={}){if(!r&&!t)throw new TypeError('Export requires specifying either "publicKey" or "secretKey".');const i=t&&!!e.secretKey,o=i?e.secretKey:e.publicKey;let s;if(o.algorithm.namedCurve===S){const{Crypto:e}=await import("./webcrypto.es-aoUxIxUm-gGk5JRJH.js"),t=new e;s=await t.subtle.exportKey("jwk",o)}else s=await M.subtle.exportKey("jwk",o);const c={};return n&&(c["@context"]=b),c.id=e.id,c.type="Multikey",c.controller=e.controller,r&&(c.publicKeyMultibase=ht({jwk:s})),i&&(c.secretKeyMultibase=pt({jwk:s})),c}({keyPair:t,publicKey:r,secretKey:n,includeContext:i})},{publicKeyMultibase:i,secretKeyMultibase:o}=await n({publicKey:!0,secretKey:!0,includeContext:!0});return t={...t,publicKeyMultibase:i,secretKeyMultibase:o,keyAgreement:r,export:n,signer(){const{id:e,secretKey:r}=t;
26
- /*!
27
- * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
28
- */
29
- return function({id:e,secretKey:t}){if(!t)throw new Error('"secretKey" is required for signing.');const{namedCurve:r}=t.algorithm,n={name:h,hash:{name:j({curve:r})}};return{algorithm:r,id:e,async sign({data:e}={}){if(r===S){const{Crypto:r}=await import("./webcrypto.es-aoUxIxUm-gGk5JRJH.js"),i=new r;return new Uint8Array(await i.subtle.sign(n,t,e))}return new Uint8Array(await M.subtle.sign(n,t,e))}}}({id:e,secretKey:r})},verifier(){const{id:e,publicKey:r}=t;return function({id:e,publicKey:t}){if(!t)throw new Error('"publicKey" is required for verifying.');const{namedCurve:r}=t.algorithm,n={name:h,hash:{name:j({curve:r})}};return{algorithm:r,id:e,async verify({data:e,signature:i}={}){if(r===S){const{Crypto:r}=await import("./webcrypto.es-aoUxIxUm-gGk5JRJH.js");return(new r).subtle.verify(n,t,i,e)}return M.subtle.verify(n,t,i,e)}}}({id:e,publicKey:r})},async deriveSecret({publicKey:e,remotePublicKey:r}={}){if(r&&e)throw new Error('Only one of "remotePublicKey" and "publicKey" must be given.');if(!t.keyAgreement){const e=Error('"keyAgreement" is not supported by this keypair.');throw e.name="NotSupportedError",e}return async function({localKeyPair:e,remoteKeyPair:t}){if(!e.secretKey){const e=Error('"secretKey" required to derive secret.');throw e.name="NotSupportedError",e}e=await dt({...e,keyAgreement:!0}),t=await dt({...t,keyAgreement:!0});const{namedCurve:r}=e.secretKey.algorithm,n=P({curve:r});if(r===S){const{Crypto:i}=await import("./webcrypto.es-aoUxIxUm-gGk5JRJH.js"),o=new i,s=await o.subtle.deriveBits({name:"ECDH",namedCurve:r,public:t.publicKey},e.secretKey,8*n);return new Uint8Array(s,0,n)}const i=await M.subtle.deriveBits({name:"ECDH",namedCurve:r,public:t.publicKey},e.secretKey,8*n);return new Uint8Array(i,0,n)}({localKeyPair:this,remoteKeyPair:r||e})}}}export{yt as a,gt as f,mt as t};