@vaxxnz/nzcp
Version:
A JavaScript implementation of the NZ COVID Pass verification
1 lines • 910 kB
JavaScript
var Jn=Object.create,rr=Object.defineProperty,Kn=Object.defineProperties,Zn=Object.getOwnPropertyDescriptor,Yn=Object.getOwnPropertyDescriptors,Gn=Object.getOwnPropertyNames,lf=Object.getOwnPropertySymbols,Qn=Object.getPrototypeOf,bf=Object.prototype.hasOwnProperty,es=Object.prototype.propertyIsEnumerable;var pf=(t,e,r)=>e in t?rr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,It=(t,e)=>{for(var r in e||(e={}))bf.call(e,r)&&pf(t,r,e[r]);if(lf)for(var r of lf(e))es.call(e,r)&&pf(t,r,e[r]);return t},ir=(t,e)=>Kn(t,Yn(e)),vf=t=>rr(t,"__esModule",{value:!0});var z=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ts=(t,e)=>{for(var r in e)rr(t,r,{get:e[r],enumerable:!0})},rs=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let f of Gn(e))!bf.call(t,f)&&f!=="default"&&rr(t,f,{get:()=>e[f],enumerable:!(r=Zn(e,f))||r.enumerable});return t},Dt=t=>rs(vf(rr(t!=null?Jn(Qn(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var yr=(t,e,r)=>new Promise((f,i)=>{var n=h=>{try{o(r.next(h))}catch(m){i(m)}},c=h=>{try{o(r.throw(h))}catch(m){i(m)}},o=h=>h.done?f(h.value):Promise.resolve(h.value).then(n,c);o((r=r.apply(t,e)).next())});var Mf=z(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});function kt(t,e,r){var f;if(r===void 0&&(r={}),!e.codes){e.codes={};for(var i=0;i<e.chars.length;++i)e.codes[e.chars[i]]=i}if(!r.loose&&t.length*e.bits&7)throw new SyntaxError("Invalid padding");for(var n=t.length;t[n-1]==="=";)if(--n,!r.loose&&!((t.length-n)*e.bits&7))throw new SyntaxError("Invalid padding");for(var c=new((f=r.out)!=null?f:Uint8Array)(n*e.bits/8|0),o=0,h=0,m=0,y=0;y<n;++y){var w=e.codes[t[y]];if(w===void 0)throw new SyntaxError("Invalid character "+t[y]);h=h<<e.bits|w,o+=e.bits,o>=8&&(o-=8,c[m++]=255&h>>o)}if(o>=e.bits||255&h<<8-o)throw new SyntaxError("Unexpected end of data");return c}function Ut(t,e,r){r===void 0&&(r={});for(var f=r,i=f.pad,n=i===void 0?!0:i,c=(1<<e.bits)-1,o="",h=0,m=0,y=0;y<t.length;++y)for(m=m<<8|255&t[y],h+=8;h>e.bits;)h-=e.bits,o+=e.chars[c&m>>h];if(h&&(o+=e.chars[c&m<<e.bits-h]),n)for(;o.length*e.bits&7;)o+="=";return o}var mf={chars:"0123456789ABCDEF",bits:4},yf={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bits:5},gf={chars:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bits:5},xf={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bits:6},wf={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bits:6},is={parse:function(e,r){return kt(e.toUpperCase(),mf,r)},stringify:function(e,r){return Ut(e,mf,r)}},fs={parse:function(e,r){return r===void 0&&(r={}),kt(r.loose?e.toUpperCase().replace(/0/g,"O").replace(/1/g,"L").replace(/8/g,"B"):e,yf,r)},stringify:function(e,r){return Ut(e,yf,r)}},as={parse:function(e,r){return kt(e,gf,r)},stringify:function(e,r){return Ut(e,gf,r)}},ns={parse:function(e,r){return kt(e,xf,r)},stringify:function(e,r){return Ut(e,xf,r)}},ss={parse:function(e,r){return kt(e,wf,r)},stringify:function(e,r){return Ut(e,wf,r)}},ds={parse:kt,stringify:Ut};mt.base16=is;mt.base32=fs;mt.base32hex=as;mt.base64=ns;mt.base64url=ss;mt.codec=ds});var Pf=z(Nt=>{function os(t,e){try{var r=t()}catch(f){return e(f)}return r&&r.then?r.then(void 0,e):r}function _f(){let t=new Map;return function(e,r){try{let n=function(o){if(i)return o;let h=t.get(e.didUrl);return h!==void 0?h:Promise.resolve(r()).then(function(m){var y;return((y=m.didResolutionMetadata)==null?void 0:y.error)!=="notFound"&&t.set(e.didUrl,m),m})};var f=n;let i,c=function(){if(e.params&&e.params["no-cache"]==="true")return i=1,Promise.resolve(r())}();return Promise.resolve(c&&c.then?c.then(n):n(c))}catch(i){return Promise.reject(i)}}}function Af(t,e){return e()}var cs="(?:%[0-9a-fA-F]{2})",Rf=`(?:[a-zA-Z0-9._-]|${cs})`,hs="([a-z0-9]+)",us=`((?:${Rf}*:)*(${Rf}+))`,If="[a-zA-Z0-9_.:%-]",ls=`;${If}+=${If}*`,bs=`((${ls})*)`,ps="(/[^#?]*)?",vs="([?][^#]*)?",ms="(#.*)?",ys=new RegExp(`^did:${hs}:${us}${bs}${ps}${vs}${ms}$`);function Ef(t){if(t===""||!t)return null;let e=t.match(ys);if(e){let r={did:`did:${e[1]}:${e[2]}`,method:e[1],id:e[2],didUrl:t};if(e[4]){let f=e[4].slice(1).split(";");r.params={};for(let i of f){let n=i.split("=");r.params[n[0]]=n[1]}}return e[6]&&(r.path=e[6]),e[7]&&(r.query=e[7].slice(1)),e[8]&&(r.fragment=e[8].slice(1)),r}return null}var gr={didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};function Cf(t){return function(e,r,f){try{return Promise.resolve(os(function(){return Promise.resolve(t(e,r,f)).then(function(i){return ir(It({},gr),{didResolutionMetadata:{contentType:"application/did+ld+json"},didDocument:i})})},function(i){return ir(It({},gr),{didResolutionMetadata:{error:"notFound",message:i.toString()}})}))}catch(i){return Promise.reject(i)}}}var Tf=class{constructor(e={},r={}){this.registry=void 0,this.cache=void 0,this.registry=e,this.cache=r.cache===!0?_f():r.cache||Af,r.legacyResolvers&&Object.keys(r.legacyResolvers).map(f=>{this.registry[f]||(this.registry[f]=Cf(r.legacyResolvers[f]))})}resolve(e,r={}){try{let f=this,i=Ef(e);if(i===null)return Promise.resolve(ir(It({},gr),{didResolutionMetadata:{error:"invalidDid"}}));let n=f.registry[i.method];return n?Promise.resolve(f.cache(i,()=>n(i.did,i,f,r))):Promise.resolve(ir(It({},gr),{didResolutionMetadata:{error:"unsupportedDidMethod"}}))}catch(f){return Promise.reject(f)}}};Nt.Resolver=Tf;Nt.inMemoryCache=_f;Nt.noCache=Af;Nt.parse=Ef;Nt.wrapLegacyResolver=Cf});var Lf=z((Qe,Nf)=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});function fr(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var Je=fr(require("stream")),zf=fr(require("http")),fi=fr(require("url")),gs=fr(require("https")),Ct=fr(require("zlib")),xs=Je.Readable,dt=Symbol("buffer"),ai=Symbol("type"),Tt=class{constructor(){this[ai]="";let e=arguments[0],r=arguments[1],f=[],i=0;if(e){let c=e,o=Number(c.length);for(let h=0;h<o;h++){let m=c[h],y;m instanceof Buffer?y=m:ArrayBuffer.isView(m)?y=Buffer.from(m.buffer,m.byteOffset,m.byteLength):m instanceof ArrayBuffer?y=Buffer.from(m):m instanceof Tt?y=m[dt]:y=Buffer.from(typeof m=="string"?m:String(m)),i+=y.length,f.push(y)}}this[dt]=Buffer.concat(f);let n=r&&r.type!==void 0&&String(r.type).toLowerCase();n&&!/[^\u0020-\u007E]/.test(n)&&(this[ai]=n)}get size(){return this[dt].length}get type(){return this[ai]}text(){return Promise.resolve(this[dt].toString())}arrayBuffer(){let e=this[dt],r=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return Promise.resolve(r)}stream(){let e=new xs;return e._read=function(){},e.push(this[dt]),e.push(null),e}toString(){return"[object Blob]"}slice(){let e=this.size,r=arguments[0],f=arguments[1],i,n;r===void 0?i=0:r<0?i=Math.max(e+r,0):i=Math.min(r,e),f===void 0?n=e:f<0?n=Math.max(e+f,0):n=Math.min(f,e);let c=Math.max(n-i,0),h=this[dt].slice(i,i+c),m=new Tt([],{type:arguments[2]});return m[dt]=h,m}};Object.defineProperties(Tt.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});Object.defineProperty(Tt.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0});function Fe(t,e,r){Error.call(this,t),this.message=t,this.type=e,r&&(this.code=this.errno=r.code),Error.captureStackTrace(this,this.constructor)}Fe.prototype=Object.create(Error.prototype);Fe.prototype.constructor=Fe;Fe.prototype.name="FetchError";var ni;try{ni=require("encoding").convert}catch(t){}var ot=Symbol("Body internals"),Hf=Je.PassThrough;function Ce(t){var e=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=r.size;let i=f===void 0?0:f;var n=r.timeout;let c=n===void 0?0:n;t==null?t=null:qf(t)?t=Buffer.from(t.toString()):ar(t)||Buffer.isBuffer(t)||(Object.prototype.toString.call(t)==="[object ArrayBuffer]"?t=Buffer.from(t):ArrayBuffer.isView(t)?t=Buffer.from(t.buffer,t.byteOffset,t.byteLength):t instanceof Je||(t=Buffer.from(String(t)))),this[ot]={body:t,disturbed:!1,error:null},this.size=i,this.timeout=c,t instanceof Je&&t.on("error",function(o){let h=o.name==="AbortError"?o:new Fe(`Invalid response body while trying to fetch ${e.url}: ${o.message}`,"system",o);e[ot].error=h})}Ce.prototype={get body(){return this[ot].body},get bodyUsed(){return this[ot].disturbed},arrayBuffer(){return Lt.call(this).then(function(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)})},blob(){let t=this.headers&&this.headers.get("content-type")||"";return Lt.call(this).then(function(e){return Object.assign(new Tt([],{type:t.toLowerCase()}),{[dt]:e})})},json(){var t=this;return Lt.call(this).then(function(e){try{return JSON.parse(e.toString())}catch(r){return Ce.Promise.reject(new Fe(`invalid json response body at ${t.url} reason: ${r.message}`,"invalid-json"))}})},text(){return Lt.call(this).then(function(t){return t.toString()})},buffer(){return Lt.call(this)},textConverted(){var t=this;return Lt.call(this).then(function(e){return ws(e,t.headers)})}};Object.defineProperties(Ce.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}});Ce.mixIn=function(t){for(let e of Object.getOwnPropertyNames(Ce.prototype))if(!(e in t)){let r=Object.getOwnPropertyDescriptor(Ce.prototype,e);Object.defineProperty(t,e,r)}};function Lt(){var t=this;if(this[ot].disturbed)return Ce.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[ot].disturbed=!0,this[ot].error)return Ce.Promise.reject(this[ot].error);let e=this.body;if(e===null)return Ce.Promise.resolve(Buffer.alloc(0));if(ar(e)&&(e=e.stream()),Buffer.isBuffer(e))return Ce.Promise.resolve(e);if(!(e instanceof Je))return Ce.Promise.resolve(Buffer.alloc(0));let r=[],f=0,i=!1;return new Ce.Promise(function(n,c){let o;t.timeout&&(o=setTimeout(function(){i=!0,c(new Fe(`Response timeout while trying to fetch ${t.url} (over ${t.timeout}ms)`,"body-timeout"))},t.timeout)),e.on("error",function(h){h.name==="AbortError"?(i=!0,c(h)):c(new Fe(`Invalid response body while trying to fetch ${t.url}: ${h.message}`,"system",h))}),e.on("data",function(h){if(!(i||h===null)){if(t.size&&f+h.length>t.size){i=!0,c(new Fe(`content size at ${t.url} over limit: ${t.size}`,"max-size"));return}f+=h.length,r.push(h)}}),e.on("end",function(){if(!i){clearTimeout(o);try{n(Buffer.concat(r,f))}catch(h){c(new Fe(`Could not create Buffer from response body for ${t.url}: ${h.message}`,"system",h))}}})})}function ws(t,e){if(typeof ni!="function")throw new Error("The package `encoding` must be installed to use the textConverted() function");let r=e.get("content-type"),f="utf-8",i,n;return r&&(i=/charset=([^;]*)/i.exec(r)),n=t.slice(0,1024).toString(),!i&&n&&(i=/<meta.+?charset=(['"])(.+?)\1/i.exec(n)),!i&&n&&(i=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(n),i||(i=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(n),i&&i.pop()),i&&(i=/charset=(.*)/i.exec(i.pop()))),!i&&n&&(i=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(n)),i&&(f=i.pop(),(f==="gb2312"||f==="gbk")&&(f="gb18030")),ni(t,"UTF-8",f).toString()}function qf(t){return typeof t!="object"||typeof t.append!="function"||typeof t.delete!="function"||typeof t.get!="function"||typeof t.getAll!="function"||typeof t.has!="function"||typeof t.set!="function"?!1:t.constructor.name==="URLSearchParams"||Object.prototype.toString.call(t)==="[object URLSearchParams]"||typeof t.sort=="function"}function ar(t){return typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.constructor=="function"&&typeof t.constructor.name=="string"&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag])}function Of(t){let e,r,f=t.body;if(t.bodyUsed)throw new Error("cannot clone body after it is used");return f instanceof Je&&typeof f.getBoundary!="function"&&(e=new Hf,r=new Hf,f.pipe(e),f.pipe(r),t[ot].body=e,f=r),f}function Ff(t){return t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":qf(t)?"application/x-www-form-urlencoded;charset=UTF-8":ar(t)?t.type||null:Buffer.isBuffer(t)||Object.prototype.toString.call(t)==="[object ArrayBuffer]"||ArrayBuffer.isView(t)?null:typeof t.getBoundary=="function"?`multipart/form-data;boundary=${t.getBoundary()}`:t instanceof Je?null:"text/plain;charset=UTF-8"}function Bf(t){let e=t.body;return e===null?0:ar(e)?e.size:Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&(e._lengthRetrievers&&e._lengthRetrievers.length==0||e.hasKnownLength&&e.hasKnownLength())?e.getLengthSync():null}function Ms(t,e){let r=e.body;r===null?t.end():ar(r)?r.stream().pipe(t):Buffer.isBuffer(r)?(t.write(r),t.end()):r.pipe(t)}Ce.Promise=global.Promise;var Df=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,si=/[^\t\x20-\x7e\x80-\xff]/;function nr(t){if(t=`${t}`,Df.test(t)||t==="")throw new TypeError(`${t} is not a legal HTTP header name`)}function kf(t){if(t=`${t}`,si.test(t))throw new TypeError(`${t} is not a legal HTTP header value`)}function jt(t,e){e=e.toLowerCase();for(let r in t)if(r.toLowerCase()===e)return r}var X=Symbol("map"),Ne=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;if(this[X]=Object.create(null),e instanceof Ne){let r=e.raw(),f=Object.keys(r);for(let i of f)for(let n of r[i])this.append(i,n);return}if(e!=null)if(typeof e=="object"){let r=e[Symbol.iterator];if(r!=null){if(typeof r!="function")throw new TypeError("Header pairs must be iterable");let f=[];for(let i of e){if(typeof i!="object"||typeof i[Symbol.iterator]!="function")throw new TypeError("Each header pair must be iterable");f.push(Array.from(i))}for(let i of f){if(i.length!==2)throw new TypeError("Each header pair must be a name/value tuple");this.append(i[0],i[1])}}else for(let f of Object.keys(e)){let i=e[f];this.append(f,i)}}else throw new TypeError("Provided initializer must be an object")}get(e){e=`${e}`,nr(e);let r=jt(this[X],e);return r===void 0?null:this[X][r].join(", ")}forEach(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,f=di(this),i=0;for(;i<f.length;){var n=f[i];let c=n[0],o=n[1];e.call(r,o,c,this),f=di(this),i++}}set(e,r){e=`${e}`,r=`${r}`,nr(e),kf(r);let f=jt(this[X],e);this[X][f!==void 0?f:e]=[r]}append(e,r){e=`${e}`,r=`${r}`,nr(e),kf(r);let f=jt(this[X],e);f!==void 0?this[X][f].push(r):this[X][e]=[r]}has(e){return e=`${e}`,nr(e),jt(this[X],e)!==void 0}delete(e){e=`${e}`,nr(e);let r=jt(this[X],e);r!==void 0&&delete this[X][r]}raw(){return this[X]}keys(){return ci(this,"key")}values(){return ci(this,"value")}[Symbol.iterator](){return ci(this,"key+value")}};Ne.prototype.entries=Ne.prototype[Symbol.iterator];Object.defineProperty(Ne.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(Ne.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});function di(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"key+value";return Object.keys(t[X]).sort().map(e==="key"?function(f){return f.toLowerCase()}:e==="value"?function(f){return t[X][f].join(", ")}:function(f){return[f.toLowerCase(),t[X][f].join(", ")]})}var oi=Symbol("internal");function ci(t,e){let r=Object.create(hi);return r[oi]={target:t,kind:e,index:0},r}var hi=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==hi)throw new TypeError("Value of `this` is not a HeadersIterator");var t=this[oi];let e=t.target,r=t.kind,f=t.index,i=di(e,r),n=i.length;return f>=n?{value:void 0,done:!0}:(this[oi].index=f+1,{value:i[f],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));Object.defineProperty(hi,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});function Ss(t){let e=Object.assign({__proto__:null},t[X]),r=jt(t[X],"Host");return r!==void 0&&(e[r]=e[r][0]),e}function _s(t){let e=new Ne;for(let r of Object.keys(t))if(!Df.test(r))if(Array.isArray(t[r]))for(let f of t[r])si.test(f)||(e[X][r]===void 0?e[X][r]=[f]:e[X][r].push(f));else si.test(t[r])||(e[X][r]=[t[r]]);return e}var yt=Symbol("Response internals"),As=zf.STATUS_CODES,Ve=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ce.call(this,e,r);let f=r.status||200,i=new Ne(r.headers);if(e!=null&&!i.has("Content-Type")){let n=Ff(e);n&&i.append("Content-Type",n)}this[yt]={url:r.url,status:f,statusText:r.statusText||As[f],headers:i,counter:r.counter}}get url(){return this[yt].url||""}get status(){return this[yt].status}get ok(){return this[yt].status>=200&&this[yt].status<300}get redirected(){return this[yt].counter>0}get statusText(){return this[yt].statusText}get headers(){return this[yt].headers}clone(){return new Ve(Of(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}};Ce.mixIn(Ve.prototype);Object.defineProperties(Ve.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});Object.defineProperty(Ve.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});var ct=Symbol("Request internals"),ui=fi.parse,Rs=fi.format,Is="destroy"in Je.Readable.prototype;function xr(t){return typeof t=="object"&&typeof t[ct]=="object"}function Es(t){let e=t&&typeof t=="object"&&Object.getPrototypeOf(t);return!!(e&&e.constructor.name==="AbortSignal")}var ht=class{constructor(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f;xr(e)?f=ui(e.url):(e&&e.href?f=ui(e.href):f=ui(`${e}`),e={});let i=r.method||e.method||"GET";if(i=i.toUpperCase(),(r.body!=null||xr(e)&&e.body!==null)&&(i==="GET"||i==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let n=r.body!=null?r.body:xr(e)&&e.body!==null?Of(e):null;Ce.call(this,n,{timeout:r.timeout||e.timeout||0,size:r.size||e.size||0});let c=new Ne(r.headers||e.headers||{});if(n!=null&&!c.has("Content-Type")){let h=Ff(n);h&&c.append("Content-Type",h)}let o=xr(e)?e.signal:null;if("signal"in r&&(o=r.signal),o!=null&&!Es(o))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[ct]={method:i,redirect:r.redirect||e.redirect||"follow",headers:c,parsedURL:f,signal:o},this.follow=r.follow!==void 0?r.follow:e.follow!==void 0?e.follow:20,this.compress=r.compress!==void 0?r.compress:e.compress!==void 0?e.compress:!0,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent}get method(){return this[ct].method}get url(){return Rs(this[ct].parsedURL)}get headers(){return this[ct].headers}get redirect(){return this[ct].redirect}get signal(){return this[ct].signal}clone(){return new ht(this)}};Ce.mixIn(ht.prototype);Object.defineProperty(ht.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(ht.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}});function Cs(t){let e=t[ct].parsedURL,r=new Ne(t[ct].headers);if(r.has("Accept")||r.set("Accept","*/*"),!e.protocol||!e.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(e.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(t.signal&&t.body instanceof Je.Readable&&!Is)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let f=null;if(t.body==null&&/^(POST|PUT)$/i.test(t.method)&&(f="0"),t.body!=null){let n=Bf(t);typeof n=="number"&&(f=String(n))}f&&r.set("Content-Length",f),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let i=t.agent;return typeof i=="function"&&(i=i(e)),!r.has("Connection")&&!i&&r.set("Connection","close"),Object.assign({},e,{method:t.method,headers:Ss(r),agent:i})}function sr(t){Error.call(this,t),this.type="aborted",this.message=t,Error.captureStackTrace(this,this.constructor)}sr.prototype=Object.create(Error.prototype);sr.prototype.constructor=sr;sr.prototype.name="AbortError";var Uf=Je.PassThrough,Ts=fi.resolve;function gt(t,e){if(!gt.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return Ce.Promise=gt.Promise,new gt.Promise(function(r,f){let i=new ht(t,e),n=Cs(i),c=(n.protocol==="https:"?gs:zf).request,o=i.signal,h=null,m=function(){let R=new sr("The user aborted a request.");f(R),i.body&&i.body instanceof Je.Readable&&i.body.destroy(R),!(!h||!h.body)&&h.body.emit("error",R)};if(o&&o.aborted){m();return}let y=function(){m(),S()},w=c(n),_;o&&o.addEventListener("abort",y);function S(){w.abort(),o&&o.removeEventListener("abort",y),clearTimeout(_)}i.timeout&&w.once("socket",function(A){_=setTimeout(function(){f(new Fe(`network timeout at: ${i.url}`,"request-timeout")),S()},i.timeout)}),w.on("error",function(A){f(new Fe(`request to ${i.url} failed, reason: ${A.message}`,"system",A)),S()}),w.on("response",function(A){clearTimeout(_);let R=_s(A.headers);if(gt.isRedirect(A.statusCode)){let Ie=R.get("Location"),U=Ie===null?null:Ts(i.url,Ie);switch(i.redirect){case"error":f(new Fe(`uri requested responds with a redirect, redirect mode is set to error: ${i.url}`,"no-redirect")),S();return;case"manual":if(U!==null)try{R.set("Location",U)}catch(De){f(De)}break;case"follow":if(U===null)break;if(i.counter>=i.follow){f(new Fe(`maximum redirect reached at: ${i.url}`,"max-redirect")),S();return}let Ee={headers:new Ne(i.headers),follow:i.follow,counter:i.counter+1,agent:i.agent,compress:i.compress,method:i.method,body:i.body,signal:i.signal,timeout:i.timeout,size:i.size};if(A.statusCode!==303&&i.body&&Bf(i)===null){f(new Fe("Cannot follow redirect with body being a readable stream","unsupported-redirect")),S();return}(A.statusCode===303||(A.statusCode===301||A.statusCode===302)&&i.method==="POST")&&(Ee.method="GET",Ee.body=void 0,Ee.headers.delete("content-length")),r(gt(new ht(U,Ee))),S();return}}A.once("end",function(){o&&o.removeEventListener("abort",y)});let P=A.pipe(new Uf),E={url:i.url,status:A.statusCode,statusText:A.statusMessage,headers:R,size:i.size,timeout:i.timeout,counter:i.counter},O=R.get("Content-Encoding");if(!i.compress||i.method==="HEAD"||O===null||A.statusCode===204||A.statusCode===304){h=new Ve(P,E),r(h);return}let F={flush:Ct.Z_SYNC_FLUSH,finishFlush:Ct.Z_SYNC_FLUSH};if(O=="gzip"||O=="x-gzip"){P=P.pipe(Ct.createGunzip(F)),h=new Ve(P,E),r(h);return}if(O=="deflate"||O=="x-deflate"){A.pipe(new Uf).once("data",function(U){(U[0]&15)==8?P=P.pipe(Ct.createInflate()):P=P.pipe(Ct.createInflateRaw()),h=new Ve(P,E),r(h)});return}if(O=="br"&&typeof Ct.createBrotliDecompress=="function"){P=P.pipe(Ct.createBrotliDecompress()),h=new Ve(P,E),r(h);return}h=new Ve(P,E),r(h)}),Ms(w,i)})}gt.isRedirect=function(t){return t===301||t===302||t===303||t===307||t===308};gt.Promise=global.Promise;Nf.exports=Qe=gt;Object.defineProperty(Qe,"__esModule",{value:!0});Qe.default=Qe;Qe.Headers=Ne;Qe.Request=ht;Qe.Response=Ve;Qe.FetchError=Fe});var Vf=z((Pt,jf)=>{var dr=Lf(),Ps=dr.default||dr,wr=function(t,e){return/^\/\//.test(t)&&(t="https:"+t),Ps.call(this,t,e)};wr.ponyfill=!0;jf.exports=Pt=wr;Pt.fetch=wr;Pt.Headers=dr.Headers;Pt.Request=dr.Request;Pt.Response=dr.Response;Pt.default=wr});var Xf=z(Wf=>{var zs=Vf();function Hs(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var qs=Hs(zs);function Os(t,e){try{var r=t()}catch(f){return e(f)}return r&&r.then?r.then(void 0,e):r}var Fs=function(t){try{return Promise.resolve(qs.default(t,{mode:"cors"})).then(function(e){if(e.status>=400)throw new Error(`Bad response ${e.statusText}`);return e.json()})}catch(e){return Promise.reject(e)}};function Le(t,e,r){if(!t.s){if(r instanceof li)if(r.s)e&1&&(e=r.s),r=r.v;else{r.o=Le.bind(null,t,e);return}if(r&&r.then){r.then(Le.bind(null,t,e),Le.bind(null,t,2));return}t.s=e,t.v=r;let f=t.o;f&&f(t)}}var Bs="/.well-known/did.json",li=function(){function t(){}return t.prototype.then=function(e,r){let f=new t,i=this.s;if(i){let n=i&1?e:r;if(n){try{Le(f,1,n(this.v))}catch(c){Le(f,2,c)}return f}else return this}return this.o=function(n){try{let c=n.v;n.s&1?Le(f,1,e?e(c):c):r?Le(f,1,r(c)):Le(f,2,c)}catch(c){Le(f,2,c)}},f},t}();function Vt(t){return t instanceof li&&t.s&1}function Ds(t,e){var r;do{var f=t();if(f&&f.then)if(Vt(f))f=f.v;else{r=!0;break}var i=e();if(Vt(i)&&(i=i.v),!i)return f}while(!i.then);let n=new li,c=Le.bind(null,n,2);return(r?f.then(o):i.then(h)).then(void 0,c),n;function o(m){for(f=m;i=e(),Vt(i)&&(i=i.v),!!i;){if(i.then){i.then(h).then(void 0,c);return}if(f=t(),f&&f.then)if(Vt(f))f=f.v;else{f.then(o).then(void 0,c);return}}Le(n,1,f)}function h(m){if(m){do{if(f=t(),f&&f.then)if(Vt(f))f=f.v;else{f.then(o).then(void 0,c);return}if(m=e(),Vt(m)&&(m=m.v),!m){Le(n,1,f);return}}while(!m.then);m.then(h).then(void 0,c)}else Le(n,1,f)}}function ks(){return{web:function(e,r){try{let n=function(){var S;let A=typeof((S=w)==null?void 0:S["@context"])!="undefined"?"application/did+ld+json":"application/did+json";return c?{didDocument:w,didDocumentMetadata:y,didResolutionMetadata:{error:"notFound",message:c}}:{didDocument:w,didDocumentMetadata:y,didResolutionMetadata:{contentType:A}}};var f=n;let i,c=null,o=decodeURIComponent(r.id)+Bs,h=r.id.split(":");h.length>1&&(o=h.map(decodeURIComponent).join("/")+"/did.json");let m=`https://${o}`,y={},w=null,_=Ds(function(){function S(){if(!i){var R;((R=w)==null?void 0:R.id)===e||(c="resolver_error: DID document id does not match requested did")}}let A=Os(function(){return Promise.resolve(Fs(m)).then(function(R){w=R})},function(R){c=`resolver_error: DID must resolve to a valid https URL containing a JSON document: ${R}`,i=1});return A&&A.then?A.then(S):S(A)},function(){return!i&&!1});return Promise.resolve(_&&_.then?_.then(n):n(_))}catch(i){return Promise.reject(i)}}}}Wf.getResolver=ks});var Yf=z((exports,module)=>{(function(){"use strict";var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&typeof module=="object"&&module.exports,AMD=typeof define=="function"&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[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],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return Object.prototype.toString.call(t)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return typeof t=="object"&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t,e){return function(r){return new Sha256(e,!0).update(r)[t]()}},createMethod=function(t){var e=createOutputMethod("hex",t);NODE_JS&&(e=nodeWrap(e,t)),e.create=function(){return new Sha256(t)},e.update=function(i){return e.create().update(i)};for(var r=0;r<OUTPUT_TYPES.length;++r){var f=OUTPUT_TYPES[r];e[f]=createOutputMethod(f,t)}return e},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(t){if(typeof t=="string")return crypto.createHash(algorithm).update(t,"utf8").digest("hex");if(t==null)throw new Error(ERROR);return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(t)).digest("hex"):method(t)};return nodeMethod},createHmacOutputMethod=function(t,e){return function(r,f){return new HmacSha256(r,e,!0).update(f)[t]()}},createHmacMethod=function(t){var e=createHmacOutputMethod("hex",t);e.create=function(i){return new HmacSha256(i,t)},e.update=function(i,n){return e.create(i).update(n)};for(var r=0;r<OUTPUT_TYPES.length;++r){var f=OUTPUT_TYPES[r];e[f]=createHmacOutputMethod(f,t)}return e};function Sha256(t,e){e?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}Sha256.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if(r!=="string"){if(r==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);e=!0}for(var f,i=0,n,c=t.length,o=this.blocks;i<c;){if(this.hashed&&(this.hashed=!1,o[0]=this.block,o[16]=o[1]=o[2]=o[3]=o[4]=o[5]=o[6]=o[7]=o[8]=o[9]=o[10]=o[11]=o[12]=o[13]=o[14]=o[15]=0),e)for(n=this.start;i<c&&n<64;++i)o[n>>2]|=t[i]<<SHIFT[n++&3];else for(n=this.start;i<c&&n<64;++i)f=t.charCodeAt(i),f<128?o[n>>2]|=f<<SHIFT[n++&3]:f<2048?(o[n>>2]|=(192|f>>6)<<SHIFT[n++&3],o[n>>2]|=(128|f&63)<<SHIFT[n++&3]):f<55296||f>=57344?(o[n>>2]|=(224|f>>12)<<SHIFT[n++&3],o[n>>2]|=(128|f>>6&63)<<SHIFT[n++&3],o[n>>2]|=(128|f&63)<<SHIFT[n++&3]):(f=65536+((f&1023)<<10|t.charCodeAt(++i)&1023),o[n>>2]|=(240|f>>18)<<SHIFT[n++&3],o[n>>2]|=(128|f>>12&63)<<SHIFT[n++&3],o[n>>2]|=(128|f>>6&63)<<SHIFT[n++&3],o[n>>2]|=(128|f&63)<<SHIFT[n++&3]);this.lastByteIndex=n,this.bytes+=n-this.start,n>=64?(this.block=o[16],this.start=n-64,this.hash(),this.hashed=!0):this.start=n}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=EXTRA[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,f=this.h3,i=this.h4,n=this.h5,c=this.h6,o=this.h7,h=this.blocks,m,y,w,_,S,A,R,P,E,O,F;for(m=16;m<64;++m)S=h[m-15],y=(S>>>7|S<<25)^(S>>>18|S<<14)^S>>>3,S=h[m-2],w=(S>>>17|S<<15)^(S>>>19|S<<13)^S>>>10,h[m]=h[m-16]+y+h[m-7]+w<<0;for(F=e&r,m=0;m<64;m+=4)this.first?(this.is224?(P=300032,S=h[0]-1413257819,o=S-150054599<<0,f=S+24177077<<0):(P=704751109,S=h[0]-210244248,o=S-1521486534<<0,f=S+143694565<<0),this.first=!1):(y=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),w=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),P=t&e,_=P^t&r^F,R=i&n^~i&c,S=o+w+R+K[m]+h[m],A=y+_,o=f+S<<0,f=S+A<<0),y=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),w=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),E=f&t,_=E^f&e^P,R=o&i^~o&n,S=c+w+R+K[m+1]+h[m+1],A=y+_,c=r+S<<0,r=S+A<<0,y=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),w=(c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7),O=r&f,_=O^r&t^E,R=c&o^~c&i,S=n+w+R+K[m+2]+h[m+2],A=y+_,n=e+S<<0,e=S+A<<0,y=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),w=(n>>>6|n<<26)^(n>>>11|n<<21)^(n>>>25|n<<7),F=e&r,_=F^e&f^O,R=n&c^~n&o,S=i+w+R+K[m+3]+h[m+3],A=y+_,i=t+S<<0,t=S+A<<0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+f<<0,this.h4=this.h4+i<<0,this.h5=this.h5+n<<0,this.h6=this.h6+c<<0,this.h7=this.h7+o<<0},Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,f=this.h3,i=this.h4,n=this.h5,c=this.h6,o=this.h7,h=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[f>>28&15]+HEX_CHARS[f>>24&15]+HEX_CHARS[f>>20&15]+HEX_CHARS[f>>16&15]+HEX_CHARS[f>>12&15]+HEX_CHARS[f>>8&15]+HEX_CHARS[f>>4&15]+HEX_CHARS[f&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[c>>28&15]+HEX_CHARS[c>>24&15]+HEX_CHARS[c>>20&15]+HEX_CHARS[c>>16&15]+HEX_CHARS[c>>12&15]+HEX_CHARS[c>>8&15]+HEX_CHARS[c>>4&15]+HEX_CHARS[c&15];return this.is224||(h+=HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15]),h},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,f=this.h3,i=this.h4,n=this.h5,c=this.h6,o=this.h7,h=[t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,r>>24&255,r>>16&255,r>>8&255,r&255,f>>24&255,f>>16&255,f>>8&255,f&255,i>>24&255,i>>16&255,i>>8&255,i&255,n>>24&255,n>>16&255,n>>8&255,n&255,c>>24&255,c>>16&255,c>>8&255,c&255];return this.is224||h.push(o>>24&255,o>>16&255,o>>8&255,o&255),h},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};function HmacSha256(t,e,r){var f,i=typeof t;if(i==="string"){var n=[],c=t.length,o=0,h;for(f=0;f<c;++f)h=t.charCodeAt(f),h<128?n[o++]=h:h<2048?(n[o++]=192|h>>6,n[o++]=128|h&63):h<55296||h>=57344?(n[o++]=224|h>>12,n[o++]=128|h>>6&63,n[o++]=128|h&63):(h=65536+((h&1023)<<10|t.charCodeAt(++f)&1023),n[o++]=240|h>>18,n[o++]=128|h>>12&63,n[o++]=128|h>>6&63,n[o++]=128|h&63);t=n}else if(i==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);t.length>64&&(t=new Sha256(e,!0).update(t).array());var m=[],y=[];for(f=0;f<64;++f){var w=t[f]||0;m[f]=92^w,y[f]=54^w}Sha256.call(this,e,r),this.update(y),this.oKeyPad=m,this.inner=!0,this.sharedMemory=r}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))})()});var Gf=z((ho,js)=>{js.exports={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}});var et=z((Qf,pi)=>{(function(t,e){"use strict";function r(g,a){if(!g)throw new Error(a||"Assertion failed")}function f(g,a){g.super_=a;var d=function(){};d.prototype=a.prototype,g.prototype=new d,g.prototype.constructor=g}function i(g,a,d){if(i.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((a==="le"||a==="be")&&(d=a,a=10),this._init(g||0,a||10,d||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var n;try{typeof window!="undefined"&&typeof window.Buffer!="undefined"?n=window.Buffer:n=require("buffer").Buffer}catch(g){}i.isBN=function(a){return a instanceof i?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===i.wordSize&&Array.isArray(a.words)},i.max=function(a,d){return a.cmp(d)>0?a:d},i.min=function(a,d){return a.cmp(d)<0?a:d},i.prototype._init=function(a,d,u){if(typeof a=="number")return this._initNumber(a,d,u);if(typeof a=="object")return this._initArray(a,d,u);d==="hex"&&(d=16),r(d===(d|0)&&d>=2&&d<=36),a=a.toString().replace(/\s+/g,"");var l=0;a[0]==="-"&&(l++,this.negative=1),l<a.length&&(d===16?this._parseHex(a,l,u):(this._parseBase(a,d,l),u==="le"&&this._initArray(this.toArray(),d,u)))},i.prototype._initNumber=function(a,d,u){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(r(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),u==="le"&&this._initArray(this.toArray(),d,u)},i.prototype._initArray=function(a,d,u){if(r(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var v,x,M=0;if(u==="be")for(l=a.length-1,v=0;l>=0;l-=3)x=a[l]|a[l-1]<<8|a[l-2]<<16,this.words[v]|=x<<M&67108863,this.words[v+1]=x>>>26-M&67108863,M+=24,M>=26&&(M-=26,v++);else if(u==="le")for(l=0,v=0;l<a.length;l+=3)x=a[l]|a[l+1]<<8|a[l+2]<<16,this.words[v]|=x<<M&67108863,this.words[v+1]=x>>>26-M&67108863,M+=24,M>=26&&(M-=26,v++);return this.strip()};function c(g,a){var d=g.charCodeAt(a);return d>=65&&d<=70?d-55:d>=97&&d<=102?d-87:d-48&15}function o(g,a,d){var u=c(g,d);return d-1>=a&&(u|=c(g,d-1)<<4),u}i.prototype._parseHex=function(a,d,u){this.length=Math.ceil((a.length-d)/6),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var v=0,x=0,M;if(u==="be")for(l=a.length-1;l>=d;l-=2)M=o(a,d,l)<<v,this.words[x]|=M&67108863,v>=18?(v-=18,x+=1,this.words[x]|=M>>>26):v+=8;else{var b=a.length-d;for(l=b%2==0?d+1:d;l<a.length;l+=2)M=o(a,d,l)<<v,this.words[x]|=M&67108863,v>=18?(v-=18,x+=1,this.words[x]|=M>>>26):v+=8}this.strip()};function h(g,a,d,u){for(var l=0,v=Math.min(g.length,d),x=a;x<v;x++){var M=g.charCodeAt(x)-48;l*=u,M>=49?l+=M-49+10:M>=17?l+=M-17+10:l+=M}return l}i.prototype._parseBase=function(a,d,u){this.words=[0],this.length=1;for(var l=0,v=1;v<=67108863;v*=d)l++;l--,v=v/d|0;for(var x=a.length-u,M=x%l,b=Math.min(x,x-M)+u,s=0,p=u;p<b;p+=l)s=h(a,p,p+l,d),this.imuln(v),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s);if(M!==0){var I=1;for(s=h(a,p,a.length,d),p=0;p<M;p++)I*=d;this.imuln(I),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s)}this.strip()},i.prototype.copy=function(a){a.words=new Array(this.length);for(var d=0;d<this.length;d++)a.words[d]=this.words[d];a.length=this.length,a.negative=this.negative,a.red=this.red},i.prototype.clone=function(){var a=new i(null);return this.copy(a),a},i.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var m=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],y=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(a,d){a=a||10,d=d|0||1;var u;if(a===16||a==="hex"){u="";for(var l=0,v=0,x=0;x<this.length;x++){var M=this.words[x],b=((M<<l|v)&16777215).toString(16);v=M>>>24-l&16777215,v!==0||x!==this.length-1?u=m[6-b.length]+b+u:u=b+u,l+=2,l>=26&&(l-=26,x--)}for(v!==0&&(u=v.toString(16)+u);u.length%d!=0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}if(a===(a|0)&&a>=2&&a<=36){var s=y[a],p=w[a];u="";var I=this.clone();for(I.negative=0;!I.isZero();){var C=I.modn(p).toString(a);I=I.idivn(p),I.isZero()?u=C+u:u=m[s-C.length]+C+u}for(this.isZero()&&(u="0"+u);u.length%d!=0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(a,d){return r(typeof n!="undefined"),this.toArrayLike(n,a,d)},i.prototype.toArray=function(a,d){return this.toArrayLike(Array,a,d)},i.prototype.toArrayLike=function(a,d,u){var l=this.byteLength(),v=u||Math.max(1,l);r(l<=v,"byte array longer than desired length"),r(v>0,"Requested array length <= 0"),this.strip();var x=d==="le",M=new a(v),b,s,p=this.clone();if(x){for(s=0;!p.isZero();s++)b=p.andln(255),p.iushrn(8),M[s]=b;for(;s<v;s++)M[s]=0}else{for(s=0;s<v-l;s++)M[s]=0;for(s=0;!p.isZero();s++)b=p.andln(255),p.iushrn(8),M[v-s-1]=b}return M},Math.clz32?i.prototype._countBits=function(a){return 32-Math.clz32(a)}:i.prototype._countBits=function(a){var d=a,u=0;return d>=4096&&(u+=13,d>>>=13),d>=64&&(u+=7,d>>>=7),d>=8&&(u+=4,d>>>=4),d>=2&&(u+=2,d>>>=2),u+d},i.prototype._zeroBits=function(a){if(a===0)return 26;var d=a,u=0;return(d&8191)==0&&(u+=13,d>>>=13),(d&127)==0&&(u+=7,d>>>=7),(d&15)==0&&(u+=4,d>>>=4),(d&3)==0&&(u+=2,d>>>=2),(d&1)==0&&u++,u},i.prototype.bitLength=function(){var a=this.words[this.length-1],d=this._countBits(a);return(this.length-1)*26+d};function _(g){for(var a=new Array(g.bitLength()),d=0;d<a.length;d++){var u=d/26|0,l=d%26;a[d]=(g.words[u]&1<<l)>>>l}return a}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,d=0;d<this.length;d++){var u=this._zeroBits(this.words[d]);if(a+=u,u!==26)break}return a},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},i.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var d=0;d<a.length;d++)this.words[d]=this.words[d]|a.words[d];return this.strip()},i.prototype.ior=function(a){return r((this.negative|a.negative)==0),this.iuor(a)},i.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},i.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},i.prototype.iuand=function(a){var d;this.length>a.length?d=a:d=this;for(var u=0;u<d.length;u++)this.words[u]=this.words[u]&a.words[u];return this.length=d.length,this.strip()},i.prototype.iand=function(a){return r((this.negative|a.negative)==0),this.iuand(a)},i.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},i.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},i.prototype.iuxor=function(a){var d,u;this.length>a.length?(d=this,u=a):(d=a,u=this);for(var l=0;l<u.length;l++)this.words[l]=d.words[l]^u.words[l];if(this!==d)for(;l<d.length;l++)this.words[l]=d.words[l];return this.length=d.length,this.strip()},i.prototype.ixor=function(a){return r((this.negative|a.negative)==0),this.iuxor(a)},i.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},i.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},i.prototype.inotn=function(a){r(typeof a=="number"&&a>=0);var d=Math.ceil(a/26)|0,u=a%26;this._expand(d),u>0&&d--;for(var l=0;l<d;l++)this.words[l]=~this.words[l]&67108863;return u>0&&(this.words[l]=~this.words[l]&67108863>>26-u),this.strip()},i.prototype.notn=function(a){return this.clone().inotn(a)},i.prototype.setn=function(a,d){r(typeof a=="number"&&a>=0);var u=a/26|0,l=a%26;return this._expand(u+1),d?this.words[u]=this.words[u]|1<<l:this.words[u]=this.words[u]&~(1<<l),this.strip()},i.prototype.iadd=function(a){var d;if(this.negative!==0&&a.negative===0)return this.negative=0,d=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,d=this.isub(a),a.negative=1,d._normSign();var u,l;this.length>a.length?(u=this,l=a):(u=a,l=this);for(var v=0,x=0;x<l.length;x++)d=(u.words[x]|0)+(l.words[x]|0)+v,this.words[x]=d&67108863,v=d>>>26;for(;v!==0&&x<u.length;x++)d=(u.words[x]|0)+v,this.words[x]=d&67108863,v=d>>>26;if(this.length=u.length,v!==0)this.words[this.length]=v,this.length++;else if(u!==this)for(;x<u.length;x++)this.words[x]=u.words[x];return this},i.prototype.add=function(a){var d;return a.negative!==0&&this.negative===0?(a.negative=0,d=this.sub(a),a.negative^=1,d):a.negative===0&&this.negative!==0?(this.negative=0,d=a.sub(this),this.negative=1,d):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},i.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var d=this.iadd(a);return a.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var u=this.cmp(a);if(u===0)return this.negative=0,this.length=1,this.words[0]=0,this;var l,v;u>0?(l=this,v=a):(l=a,v=this);for(var x=0,M=0;M<v.length;M++)d=(l.words[M]|0)-(v.words[M]|0)+x,x=d>>26,this.words[M]=d&67108863;for(;x!==0&&M<l.length;M++)d=(l.words[M]|0)+x,x=d>>26,this.words[M]=d&67108863;if(x===0&&M<l.length&&l!==this)for(;M<l.length;M++)this.words[M]=l.words[M];return this.length=Math.max(this.length,M),l!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(a){return this.clone().isub(a)};function S(g,a,d){d.negative=a.negative^g.negative;var u=g.length+a.length|0;d.length=u,u=u-1|0;var l=g.words[0]|0,v=a.words[0]|0,x=l*v,M=x&67108863,b=x/67108864|0;d.words[0]=M;for(var s=1;s<u;s++){for(var p=b>>>26,I=b&67108863,C=Math.min(s,a.length-1),T=Math.max(0,s-g.length+1);T<=C;T++){var H=s-T|0;l=g.words[H]|0,v=a.words[T]|0,x=l*v+I,p+=x/67108864|0,I=x&67108863}d.words[s]=I|0,b=p|0}return b!==0?d.words[s]=b|0:d.length--,d.strip()}var A=function(a,d,u){var l=a.words,v=d.words,x=u.words,M=0,b,s,p,I=l[0]|0,C=I&8191,T=I>>>13,H=l[1]|0,D=H&8191,N=H>>>13,vt=l[2]|0,L=vt&8191,V=vt>>>13,Ki=l[3]|0,$=Ki&8191,J=Ki>>>13,Zi=l[4]|0,K=Zi&8191,Z=Zi>>>13,Yi=l[5]|0,Y=Yi&8191,G=Yi>>>13,Gi=l[6]|0,Q=Gi&8191,ee=Gi>>>13,Qi=l[7]|0,te=Qi&8191,re=Qi>>>13,ef=l[8]|0,ie=ef&8191,fe=ef>>>13,tf=l[9]|0,ae=tf&8191,ne=tf>>>13,rf=v[0]|0,se=rf&8191,de=rf>>>13,ff=v[1]|0,oe=ff&8191,ce=ff>>>13,af=v[2]|0,he=af&8191,ue=af>>>13,nf=v[3]|0,le=nf&8191,be=nf>>>13,sf=v[4]|0,pe=sf&8191,ve=sf>>>13,df=v[5]|0,me=df&8191,ye=df>>>13,of=v[6]|0,ge=of&8191,xe=of>>>13,cf=v[7]|0,we=cf&8191,Me=cf>>>13,hf=v[8]|0,Se=hf&8191,_e=hf>>>13,uf=v[9]|0,Ae=uf&8191,Re=uf>>>13;u.negative=a.negative^d.negative,u.length=19,b=Math.imul(C,se),s=Math.imul(C,de),s=s+Math.imul(T,se)|0,p=Math.imul(T,de);var kr=(M+b|0)+((s&8191)<<13)|0;M=(p+(s>>>13)|0)+(kr>>>26)|0,kr&=67108863,b=Math.imul(D,se),s=Math.imul(D,de),s=s+Math.imul