UNPKG

@ew-did-registry/did-s3-store

Version:

S3-based implementation of IDidStore

2 lines 459 kB
/*! For license information please see index.esm.js.LICENSE.txt */ (()=>{var e={43:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Hasher:()=>s,from:()=>i});var r=n(756);const i=({name:e,code:t,encode:n})=>new s(e,t,n);class s{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?r.create(this.code,t):t.then((e=>r.create(this.code,e)))}throw Error("Unknown type, must be binary type")}}},63:(e,t)=>{const n={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}};t.buildOptions=function(e){return Object.assign({},n,e)},t.defaultOptions=n},97:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){!function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}(r,i,(t=e[n](t)).done,t.value)}))}}};Object.defineProperty(t,"__esModule",{value:!0}),t.DidStore=void 0;const s=n(619),o=n(292),a=n(301);t.DidStore=class{constructor(e,t){this.s3=new s.S3Client(t),this.bucket=e}computeCid(e){return r(this,void 0,void 0,(function*(){const t=(new TextEncoder).encode(e),n=yield a.sha256.digest(t);return o.CID.create(1,85,n)}))}save(e){return r(this,void 0,void 0,(function*(){const t=(yield this.computeCid(e)).toString();return yield this.s3.send(new s.PutObjectCommand({Bucket:this.bucket,Key:t,Body:e,ContentType:"text/plain"})),t}))}get(e){var t,n,o,a;return r(this,void 0,void 0,(function*(){const r=yield this.s3.send(new s.GetObjectCommand({Bucket:this.bucket,Key:e})),c=[];try{for(var u,l=!0,d=i(r.Body);u=yield d.next(),!(t=u.done);){a=u.value,l=!1;try{const e=a;c.push(e instanceof Uint8Array?e:Uint8Array.from(e))}finally{l=!0}}}catch(e){n={error:e}}finally{try{l||t||!(o=d.return)||(yield o.call(d))}finally{if(n)throw n.error}}return(new TextDecoder).decode(Uint8Array.from(c.flatMap((e=>Array.from(e)))))}))}delete(e){return r(this,void 0,void 0,(function*(){try{return yield this.s3.send(new s.DeleteObjectCommand({Bucket:this.bucket,Key:e})),!0}catch(e){if("NoSuchKey"===e.name)return!1;throw e}}))}}},121:e=>{"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},139:(e,t,n)=>{"use strict";const r=n(209),i=n(381),s=n(233),o=n(262);function a(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function c(e,t,n,r,i,s,o){if(void 0!==e&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));const r=this.options.tagValueProcessor(t,e,n,i,s);return null==r?e:typeof r!=typeof e||r!==e?r:this.options.trimValues||e.trim()===e?S(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function u(e){if(this.options.removeNSPrefix){const t=e.split(":"),n="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=n+t[1])}return e}const l=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function d(e,t,n){if(!this.options.ignoreAttributes&&"string"==typeof e){const n=r.getAllMatches(e,l),i=n.length,s={};for(let e=0;e<i;e++){const r=this.resolveNameSpace(n[e][1]);let i=n[e][4],o=this.options.attributeNamePrefix+r;if(r.length)if(this.options.transformAttributeName&&(o=this.options.transformAttributeName(o)),"__proto__"===o&&(o="#__proto__"),void 0!==i){this.options.trimValues&&(i=i.trim()),i=this.replaceEntitiesValue(i);const e=this.options.attributeValueProcessor(r,i,t);s[o]=null==e?i:typeof e!=typeof i||e!==i?e:S(i,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[o]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=s,e}return s}}const p=function(e){e=e.replace(/\r\n?/g,"\n");const t=new i("!xml");let n=t,r="",o="";for(let a=0;a<e.length;a++)if("<"===e[a])if("/"===e[a+1]){const t=y(e,">",a,"Closing Tag is not closed.");let i=e.substring(a+2,t).trim();if(this.options.removeNSPrefix){const e=i.indexOf(":");-1!==e&&(i=i.substr(e+1))}this.options.transformTagName&&(i=this.options.transformTagName(i)),n&&(r=this.saveTextToParentTag(r,n,o));const s=o.substring(o.lastIndexOf(".")+1);if(i&&-1!==this.options.unpairedTags.indexOf(i))throw new Error(`Unpaired tag can not be used as closing tag: </${i}>`);let c=0;s&&-1!==this.options.unpairedTags.indexOf(s)?(c=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=o.lastIndexOf("."),o=o.substring(0,c),n=this.tagsNodeStack.pop(),r="",a=t}else if("?"===e[a+1]){let t=b(e,a,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,o),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new i(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,o,t.tagName)),this.addChild(n,e,o)}a=t.closeIndex+1}else if("!--"===e.substr(a+1,3)){const t=y(e,"--\x3e",a+4,"Comment is not closed.");if(this.options.commentPropName){const i=e.substring(a+4,t-2);r=this.saveTextToParentTag(r,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:i}])}a=t}else if("!D"===e.substr(a+1,2)){const t=s(e,a);this.docTypeEntities=t.entities,a=t.i}else if("!["===e.substr(a+1,2)){const t=y(e,"]]>",a,"CDATA is not closed.")-2,i=e.substring(a+9,t);r=this.saveTextToParentTag(r,n,o);let s=this.parseTextData(i,n.tagname,o,!0,!1,!0,!0);null==s&&(s=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:i}]):n.add(this.options.textNodeName,s),a=t+2}else{let s=b(e,a,this.options.removeNSPrefix),c=s.tagName;const u=s.rawTagName;let l=s.tagExp,d=s.attrExpPresent,p=s.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&r&&"!xml"!==n.tagname&&(r=this.saveTextToParentTag(r,n,o,!1));const f=n;if(f&&-1!==this.options.unpairedTags.indexOf(f.tagname)&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),c!==t.tagname&&(o+=o?"."+c:c),this.isItStopNode(this.options.stopNodes,o,c)){let t="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)"/"===c[c.length-1]?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),l=c):l=l.substr(0,l.length-1),a=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(c))a=s.closeIndex;else{const n=this.readStopNodeData(e,u,p+1);if(!n)throw new Error(`Unexpected end of ${u}`);a=n.i,t=n.tagContent}const r=new i(c);c!==l&&d&&(r[":@"]=this.buildAttributesMap(l,o,c)),t&&(t=this.parseTextData(t,c,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),r.add(this.options.textNodeName,t),this.addChild(n,r,o)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===c[c.length-1]?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),l=c):l=l.substr(0,l.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const e=new i(c);c!==l&&d&&(e[":@"]=this.buildAttributesMap(l,o,c)),this.addChild(n,e,o),o=o.substr(0,o.lastIndexOf("."))}else{const e=new i(c);this.tagsNodeStack.push(n),c!==l&&d&&(e[":@"]=this.buildAttributesMap(l,o,c)),this.addChild(n,e,o),n=e}r="",a=p}}else r+=e[a];return t.child};function f(e,t,n){const r=this.options.updateTag(t.tagname,n,t[":@"]);!1===r||("string"==typeof r?(t.tagname=r,e.addChild(t)):e.addChild(t))}const h=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function m(e,t,n,r){return e&&(void 0===r&&(r=0===Object.keys(t.child).length),void 0!==(e=this.parseTextData(e,t.tagname,n,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,r))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function g(e,t,n){const r="*."+n;for(const n in e){const i=e[n];if(r===i||t===i)return!0}return!1}function y(e,t,n,r){const i=e.indexOf(t,n);if(-1===i)throw new Error(r);return i+t.length-1}function b(e,t,n,r=">"){const i=function(e,t,n=">"){let r,i="";for(let s=t;s<e.length;s++){let t=e[s];if(r)t===r&&(r="");else if('"'===t||"'"===t)r=t;else if(t===n[0]){if(!n[1])return{data:i,index:s};if(e[s+1]===n[1])return{data:i,index:s}}else"\t"===t&&(t=" ");i+=t}}(e,t+1,r);if(!i)return;let s=i.data;const o=i.index,a=s.search(/\s/);let c=s,u=!0;-1!==a&&(c=s.substring(0,a),s=s.substring(a+1).trimStart());const l=c;if(n){const e=c.indexOf(":");-1!==e&&(c=c.substr(e+1),u=c!==i.data.substr(e+1))}return{tagName:c,tagExp:s,closeIndex:o,attrExpPresent:u,rawTagName:l}}function w(e,t,n){const r=n;let i=1;for(;n<e.length;n++)if("<"===e[n])if("/"===e[n+1]){const s=y(e,">",n,`${t} is not closed`);if(e.substring(n+2,s).trim()===t&&(i--,0===i))return{tagContent:e.substring(r,n),i:s};n=s}else if("?"===e[n+1])n=y(e,"?>",n+1,"StopNode is not closed.");else if("!--"===e.substr(n+1,3))n=y(e,"--\x3e",n+3,"StopNode is not closed.");else if("!["===e.substr(n+1,2))n=y(e,"]]>",n,"StopNode is not closed.")-2;else{const r=b(e,n,">");r&&((r&&r.tagName)===t&&"/"!==r.tagExp[r.tagExp.length-1]&&i++,n=r.closeIndex)}}function S(e,t,n){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&o(e,n)}return r.isExist(e)?e:""}e.exports=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=a,this.parseXml=p,this.parseTextData=c,this.resolveNameSpace=u,this.buildAttributesMap=d,this.isItStopNode=g,this.replaceEntitiesValue=h,this.readStopNodeData=w,this.saveTextToParentTag=m,this.addChild=f}}},166:e=>{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},181:(e,t,n)=>{"use strict";const r=n(655),i={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function s(e){this.options=Object.assign({},i,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=c),this.processTextOrObjNode=o,this.options.format?(this.indentate=a,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function o(e,t,n){const r=this.j2x(e,n+1);return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,r.attrStr,n):this.buildObjectNode(r.val,t,r.attrStr,n)}function a(e){return this.options.indentBy.repeat(e)}function c(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}s.prototype.build=function(e){return this.options.preserveOrder?r(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)},s.prototype.j2x=function(e,t){let n="",r="";for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i))if(void 0===e[i])this.isAttribute(i)&&(r+="");else if(null===e[i])this.isAttribute(i)?r+="":"?"===i[0]?r+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if(e[i]instanceof Date)r+=this.buildTextValNode(e[i],i,"",t);else if("object"!=typeof e[i]){const s=this.isAttribute(i);if(s)n+=this.buildAttrPairStr(s,""+e[i]);else if(i===this.options.textNodeName){let t=this.options.tagValueProcessor(i,""+e[i]);r+=this.replaceEntitiesValue(t)}else r+=this.buildTextValNode(e[i],i,"",t)}else if(Array.isArray(e[i])){const n=e[i].length;let s="",o="";for(let a=0;a<n;a++){const n=e[i][a];if(void 0===n);else if(null===n)"?"===i[0]?r+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if("object"==typeof n)if(this.options.oneListGroup){const e=this.j2x(n,t+1);s+=e.val,this.options.attributesGroupName&&n.hasOwnProperty(this.options.attributesGroupName)&&(o+=e.attrStr)}else s+=this.processTextOrObjNode(n,i,t);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(i,n);e=this.replaceEntitiesValue(e),s+=e}else s+=this.buildTextValNode(n,i,"",t)}this.options.oneListGroup&&(s=this.buildObjectNode(s,i,o,t)),r+=s}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const t=Object.keys(e[i]),r=t.length;for(let s=0;s<r;s++)n+=this.buildAttrPairStr(t[s],""+e[i][t[s]])}else r+=this.processTextOrObjNode(e[i],i,t);return{attrStr:n,val:r}},s.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},s.prototype.buildObjectNode=function(e,t,n,r){if(""===e)return"?"===t[0]?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let i="</"+t+this.tagEndChar,s="";return"?"===t[0]&&(s="?",i=""),!n&&""!==n||-1!==e.indexOf("<")?!1!==this.options.commentPropName&&t===this.options.commentPropName&&0===s.length?this.indentate(r)+`\x3c!--${e}--\x3e`+this.newLine:this.indentate(r)+"<"+t+n+s+this.tagEndChar+e+this.indentate(r)+i:this.indentate(r)+"<"+t+n+s+">"+e+i}},s.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},s.prototype.buildTextValNode=function(e,t,n,r){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(r)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),""===i?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+i+"</"+t+this.tagEndChar}},s.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e},e.exports=s},208:(e,t,n)=>{var r=n(907),i=n(364),s=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(c(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(s,(function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n<i;a=r[++n])g(a)||!C(a)?o+=" "+a:o+=" "+c(a);return o},t.deprecate=function(e,s){if(w(n.g.process))return function(){return t.deprecate(e,s).apply(this,arguments)};if(!0===r.noDeprecation)return e;var o=!1;return function(){if(!o){if(r.throwDeprecation)throw new Error(s);r.traceDeprecation?i.trace(s):i.error(s),o=!0}return e.apply(this,arguments)}};var o,a={};function c(e,n){var r={seen:[],stylize:l};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(n)?r.showHidden=n:n&&t._extend(r,n),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),d(r,e,r.depth)}function u(e,t){var n=c.styles[t];return n?"["+c.colors[n][0]+"m"+e+"["+c.colors[n][1]+"m":e}function l(e,t){return e}function d(e,n,r){if(e.customInspect&&n&&k(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return b(i)||(i=d(e,i,r)),i}var s=function(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return y(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}(e,n);if(s)return s;var o=Object.keys(n),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(n)),E(n)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return p(n);if(0===o.length){if(k(n)){var c=n.name?": "+n.name:"";return e.stylize("[Function"+c+"]","special")}if(S(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(v(n))return e.stylize(Date.prototype.toString.call(n),"date");if(E(n))return p(n)}var u,l="",C=!1,x=["{","}"];return h(n)&&(C=!0,x=["[","]"]),k(n)&&(l=" [Function"+(n.name?": "+n.name:"")+"]"),S(n)&&(l=" "+RegExp.prototype.toString.call(n)),v(n)&&(l=" "+Date.prototype.toUTCString.call(n)),E(n)&&(l=" "+p(n)),0!==o.length||C&&0!=n.length?r<0?S(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),u=C?function(e,t,n,r,i){for(var s=[],o=0,a=t.length;o<a;++o)P(t,String(o))?s.push(f(e,t,n,r,String(o),!0)):s.push("");return i.forEach((function(i){i.match(/^\d+$/)||s.push(f(e,t,n,r,i,!0))})),s}(e,n,r,a,o):o.map((function(t){return f(e,n,r,a,t,C)})),e.seen.pop(),function(e,t,n){return e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(u,l,x)):x[0]+l+x[1]}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,i,s){var o,a,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),P(r,i)||(o="["+i+"]"),a||(e.seen.indexOf(c.value)<0?(a=g(n)?d(e,c.value,null):d(e,c.value,n-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),w(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function h(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function g(e){return null===e}function y(e){return"number"==typeof e}function b(e){return"string"==typeof e}function w(e){return void 0===e}function S(e){return C(e)&&"[object RegExp]"===x(e)}function C(e){return"object"==typeof e&&null!==e}function v(e){return C(e)&&"[object Date]"===x(e)}function E(e){return C(e)&&("[object Error]"===x(e)||e instanceof Error)}function k(e){return"function"==typeof e}function x(e){return Object.prototype.toString.call(e)}function A(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(w(o)&&(o=r.env.NODE_DEBUG||""),e=e.toUpperCase(),!a[e])if(new RegExp("\\b"+e+"\\b","i").test(o)){var n=r.pid;a[e]=function(){var r=t.format.apply(t,arguments);i.error("%s %d: %s",e,n,r)}}else a[e]=function(){};return a[e]},t.inspect=c,c.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},c.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=h,t.isBoolean=m,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=y,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=w,t.isRegExp=S,t.isObject=C,t.isDate=v,t.isError=E,t.isFunction=k,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(272);var B=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,n;i.log("%s - %s",(n=[A((e=new Date).getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":"),[e.getDate(),B[e.getMonth()],n].join(" ")),t.format.apply(t,arguments))},t.inherits=n(835),t._extend=function(e,t){if(!t||!C(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}},209:(e,t)=>{"use strict";const n=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",r="["+n+"]["+n+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",i=new RegExp("^"+r+"$");t.isExist=function(e){return void 0!==e},t.isEmptyObject=function(e){return 0===Object.keys(e).length},t.merge=function(e,t,n){if(t){const r=Object.keys(t),i=r.length;for(let s=0;s<i;s++)e[r[s]]="strict"===n?[t[r[s]]]:t[r[s]]}},t.getValue=function(e){return t.isExist(e)?e:""},t.isName=function(e){return!(null==i.exec(e))},t.getAllMatches=function(e,t){const n=[];let r=t.exec(e);for(;r;){const i=[];i.startIndex=t.lastIndex-r[0].length;const s=r.length;for(let e=0;e<s;e++)i.push(r[e]);n.push(i),r=t.exec(e)}return n},t.nameRegexp=r},226:(e,t,n)=>{const{buildOptions:r}=n(63),i=n(139),{prettify:s}=n(896),o=n(919);e.exports=class{constructor(e){this.externalEntities={},this.options=r(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const n=o.validate(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new i(this.options);n.addExternalEntities(this.externalEntities);const r=n.parseXml(e);return this.options.preserveOrder||void 0===r?r:s(r,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}}},233:(e,t,n)=>{const r=n(209);function i(e,t){let n="";for(;t<e.length&&"'"!==e[t]&&'"'!==e[t];t++)n+=e[t];if(n=n.trim(),-1!==n.indexOf(" "))throw new Error("External entites are not supported");const r=e[t++];let i="";for(;t<e.length&&e[t]!==r;t++)i+=e[t];return[n,i,t]}function s(e,t){return"!"===e[t+1]&&"-"===e[t+2]&&"-"===e[t+3]}function o(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"N"===e[t+3]&&"T"===e[t+4]&&"I"===e[t+5]&&"T"===e[t+6]&&"Y"===e[t+7]}function a(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"L"===e[t+3]&&"E"===e[t+4]&&"M"===e[t+5]&&"E"===e[t+6]&&"N"===e[t+7]&&"T"===e[t+8]}function c(e,t){return"!"===e[t+1]&&"A"===e[t+2]&&"T"===e[t+3]&&"T"===e[t+4]&&"L"===e[t+5]&&"I"===e[t+6]&&"S"===e[t+7]&&"T"===e[t+8]}function u(e,t){return"!"===e[t+1]&&"N"===e[t+2]&&"O"===e[t+3]&&"T"===e[t+4]&&"A"===e[t+5]&&"T"===e[t+6]&&"I"===e[t+7]&&"O"===e[t+8]&&"N"===e[t+9]}function l(e){if(r.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}e.exports=function(e,t){const n={};if("O"!==e[t+3]||"C"!==e[t+4]||"T"!==e[t+5]||"Y"!==e[t+6]||"P"!==e[t+7]||"E"!==e[t+8])throw new Error("Invalid Tag instead of DOCTYPE");{t+=9;let r=1,d=!1,p=!1,f="";for(;t<e.length;t++)if("<"!==e[t]||p)if(">"===e[t]){if(p?"-"===e[t-1]&&"-"===e[t-2]&&(p=!1,r--):r--,0===r)break}else"["===e[t]?d=!0:f+=e[t];else{if(d&&o(e,t))t+=7,[entityName,val,t]=i(e,t+1),-1===val.indexOf("&")&&(n[l(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(d&&a(e,t))t+=8;else if(d&&c(e,t))t+=8;else if(d&&u(e,t))t+=9;else{if(!s)throw new Error("Invalid DOCTYPE");p=!0}r++,f=""}if(0!==r)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:t}}},262:e=>{const t=/^[-+]?0x[a-fA-F0-9]+$/,n=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,r={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};e.exports=function(e,i={}){if(i=Object.assign({},r,i),!e||"string"!=typeof e)return e;let s=e.trim();if(void 0!==i.skipLike&&i.skipLike.test(s))return e;if("0"===e)return 0;if(i.hex&&t.test(s))return function(e){if(parseInt)return parseInt(e,16);if(Number.parseInt)return Number.parseInt(e,16);if(window&&window.parseInt)return window.parseInt(e,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(s);if(-1!==s.search(/[eE]/)){const t=s.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);if(t){if(i.leadingZeros)s=(t[1]||"")+t[3];else if("0"!==t[2]||"."!==t[3][0])return e;return i.eNotation?Number(s):e}return e}{const t=n.exec(s);if(t){const n=t[1],r=t[2];let a=(o=t[3])&&-1!==o.indexOf(".")?("."===(o=o.replace(/0+$/,""))?o="0":"."===o[0]?o="0"+o:"."===o[o.length-1]&&(o=o.substr(0,o.length-1)),o):o;if(!i.leadingZeros&&r.length>0&&n&&"."!==s[2])return e;if(!i.leadingZeros&&r.length>0&&!n&&"."!==s[1])return e;if(i.leadingZeros&&r===e)return 0;{const t=Number(s),o=""+t;return-1!==o.search(/[eE]/)?i.eNotation?t:e:-1!==s.indexOf(".")?"0"===o&&""===a||o===a||n&&o==="-"+a?t:e:r?a===o||n+a===o?t:e:s===o||s===n+o?t:e}}return e}var o}},272:e=>{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},292:(e,t,n)=>{"use strict";n.r(t),n.d(t,{CID:()=>y,bytes:()=>s,digest:()=>i,hasher:()=>R,varint:()=>r});var r=n(535),i=n(756);var s=n(614);class o{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class a{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return u(this,e)}}class c{constructor(e){this.decoders=e}or(e){return u(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const u=(e,t)=>new c({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class l{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new o(e,t,n),this.decoder=new a(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const d=({name:e,prefix:t,encode:n,decode:r})=>new l(e,t,n,r),p=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:i}=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(255!==n[o])throw new TypeError(s+" is ambiguous");n[o]=i}var a=e.length,c=e.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function d(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var r=0,i=0;e[t]===c;)r++,t++;for(var s=(e.length-t)*u+1>>>0,o=new Uint8Array(s);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var d=0,p=s-1;(0!==l||d<i)&&-1!==p;p--,d++)l+=a*o[p]>>>0,o[p]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,t++}if(" "!==e[t]){for(var f=s-i;f!==s&&0===o[f];)f++;for(var h=new Uint8Array(r+(s-f)),m=r;f!==s;)h[m++]=o[f++];return h}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,s=t.length;i!==s&&0===t[i];)i++,n++;for(var o=(s-i)*l+1>>>0,u=new Uint8Array(o);i!==s;){for(var d=t[i],p=0,f=o-1;(0!==d||p<r)&&-1!==f;f--,p++)d+=256*u[f]>>>0,u[f]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");r=p,i++}for(var h=o-r;h!==o&&0===u[h];)h++;for(var m=c.repeat(n);h<o;++h)m+=e.charAt(u[h]);return m},decodeUnsafe:d,decode:function(e){var n=d(e);if(n)return n;throw new Error(`Non-${t} character`)}}}(n,t);return d({prefix:e,name:t,encode:r,decode:e=>(0,s.coerce)(i(e))})},f=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>d({prefix:t,name:e,encode:e=>((e,t,n)=>{const r="="===t[t.length-1],i=(1<<n)-1;let s="",o=0,a=0;for(let r=0;r<e.length;++r)for(a=a<<8|e[r],o+=8;o>n;)o-=n,s+=t[i&a>>o];if(o&&(s+=t[i&a<<n-o]),r)for(;s.length*n&7;)s+="=";return s})(e,r,n),decode:t=>((e,t,n,r)=>{const i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;const o=new Uint8Array(s*n/8|0);let a=0,c=0,u=0;for(let t=0;t<s;++t){const s=i[e[t]];if(void 0===s)throw new SyntaxError(`Non-${r} character`);c=c<<n|s,a+=n,a>=8&&(a-=8,o[u++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o})(t,r,n,e)}),h=p({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),m=(p({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),f({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}));f({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),f({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),f({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),f({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),f({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),f({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),f({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),f({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var g=n(364);class y{constructor(e,t,n,r){this.code=t,this.version=e,this.multihash=n,this.bytes=r,this.byteOffset=r.byteOffset,this.byteLength=r.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:A,byteLength:A,code:x,version:x,multihash:x,bytes:x,_baseCache:A,asCID:A})}toV0(){if(0===this.version)return this;{const{code:e,multihash:t}=this;if(e!==C)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==v)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return y.createV0(t)}}toV1(){switch(this.version){case 0:{const{code:e,digest:t}=this.multihash,n=i.create(e,t);return y.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&i.equals(this.multihash,e.multihash)}toString(e){const{bytes:t,version:n,_baseCache:r}=this;return 0===n?w(t,r,e||h.encoder):S(t,r,e||m.encoder)}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return B(/^0\.0/,P),!(!e||!e[k]&&e.asCID!==e)}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof y)return e;if(null!=e&&e.asCID===e){const{version:t,code:n,multihash:r,bytes:i}=e;return new y(t,n,r,i||E(t,n,r.bytes))}if(null!=e&&!0===e[k]){const{version:t,multihash:n,code:r}=e,s=i.decode(n);return y.create(t,r,s)}return null}static create(e,t,n){if("number"!=typeof t)throw new Error("String codecs are no longer supported");switch(e){case 0:if(t!==C)throw new Error(`Version 0 CID must use dag-pb (code: ${C}) block encoding`);return new y(e,t,n,n.bytes);case 1:{const r=E(e,t,n.bytes);return new y(e,t,n,r)}default:throw new Error("Invalid version")}}static createV0(e){return y.create(0,C,e)}static createV1(e,t){return y.create(1,e,t)}static decode(e){const[t,n]=y.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=y.inspectBytes(e),n=t.size-t.multihashSize,r=(0,s.coerce)(e.subarray(n,n+t.multihashSize));if(r.byteLength!==t.multihashSize)throw new Error("Incorrect length");const o=r.subarray(t.multihashSize-t.digestSize),a=new i.Digest(t.multihashCode,t.digestSize,o,r);return[0===t.version?y.createV0(a):y.createV1(t.codec,a),e.subarray(t.size)]}static inspectBytes(e){let t=0;const n=()=>{const[n,i]=r.decode(e.subarray(t));return t+=i,n};let i=n(),s=C;if(18===i?(i=0,t=0):1===i&&(s=n()),0!==i&&1!==i)throw new RangeError(`Invalid CID version ${i}`);const o=t,a=n(),c=n(),u=t+c;return{version:i,codec:s,multihashCode:a,digestSize:c,multihashSize:u-o,size:u}}static parse(e,t){const[n,r]=b(e,t),i=y.decode(r);return i._baseCache.set(n,e),i}}const b=(e,t)=>{switch(e[0]){case"Q":{const n=t||h;return[h.prefix,n.decode(`${h.prefix}${e}`)]}case h.prefix:{const n=t||h;return[h.prefix,n.decode(e)]}case m.prefix:{const n=t||m;return[m.prefix,n.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}},w=(e,t,n)=>{const{prefix:r}=n;if(r!==h.prefix)throw Error(`Cannot string encode V0 in ${n.name} encoding`);const i=t.get(r);if(null==i){const i=n.encode(e).slice(1);return t.set(r,i),i}return i},S=(e,t,n)=>{const{prefix:r}=n,i=t.get(r);if(null==i){const i=n.encode(e);return t.set(r,i),i}return i},C=112,v=18,E=(e,t,n)=>{const i=r.encodingLength(e),s=i+r.encodingLength(t),o=new Uint8Array(s+n.byteLength);return r.encodeTo(e,o,0),r.encodeTo(t,o,i),o.set(n,s),o},k=Symbol.for("@ipld/js-cid/CID"),x={writable:!1,configurable:!1,enumerable:!0},A={writable:!1,enumerable:!1,configurable:!1},B=(e,t)=>{if(!e.test("0.0.0-dev"))throw new Error(t);g.warn(t)},P="CID.isCID(v) is deprecated and will be removed in the next major release.\nFollowing code pattern:\n\nif (CID.isCID(value)) {\n doSomethingWithCID(value)\n}\n\nIs replaced with:\n\nconst cid = CID.asCID(value)\nif (cid) {\n // Make sure to use cid instead of value\n doSomethingWithCID(cid)\n}\n";var R=n(43)},300:(e,t,n)=>{"use strict";var r=n(513);function i(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,s=Math.min(n,r);i<s;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0}function s(e){return n.g.Buffer&&"function"==typeof n.g.Buffer.isBuffer?n.g.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var o=n(966),a=Object.prototype.hasOwnProperty,c=Array.prototype.slice,u="foo"===function(){}.name;function l(e){return Object.prototype.toString.call(e)}function d(e){return!s(e)&&"function"==typeof n.g.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer)))}var p=e.exports=b,f=/\s*function\s+([^\(\s]*)\s*/;function h(e){if(o.isFunction(e)){if(u)return e.name;var t=e.toString().match(f);return t&&t[1]}}function m(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function g(e){if(u||!o.isFunction(e))return o.inspect(e);var t=h(e);return"[Function"+(t?": "+t:"")+"]"}function y(e,t,n,r,i){throw new p.AssertionError({message:n,actual:e,expected:t,operator:r,stackStartFunction:i})}function b(e,t){e||y(e,!0,t,"==",p.ok)}function w(e,t,n,r){if(e===t)return!0;if(s(e)&&s(t))return 0===i(e,t);if(o.isDate(e)&&o.isDate(t))return e.getTime()===t.getTime();if(o.isRegExp(e)&&o.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(d(e)&&d(t)&&l(e)===l(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===i(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(s(e)!==s(t))return!1;var a=(r=r||{actual:[],expected:[]}).actual.indexOf(e);return-1!==a&&a===r.expected.indexOf(t)||(r.actual.push(e),r.expected.push(t),function(e,t,n,r){if(null==e||null==t)return!1;if(o.isPrimitive(e)||o.isPrimitive(t))return e===t;if(n&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=S(e),s=S(t);if(i&&!s||!i&&s)return!1;if(i)return w(e=c.call(e),t=c.call(t),n);var a,u,l=E(e),d=E(t);if(l.length!==d.length)return!1;for(l.sort(),d.sort(),u=l.length-1;u>=0;u--)if(l[u]!==d[u])return!1;for(u=l.length-1;u>=0;u--)if(!w(e[a=l[u]],t[a],n,r))return!1;return!0}(e,t,n,r))}return n?e===t:e==t}function S(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function C(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function v(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&y(i,n,"Missing expected exception"+r);var s="string"==typeof r,a=!e&&i&&!n;if((!e&&o.isError(i)&&s&&C(i,n)||a)&&y(i,n,"Got unwanted exception"+r),e&&i&&n&&!C(i,n)||!e&&i)throw i}p.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return m(g(e.actual),128)+" "+e.operator+" "+m(g(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,i=h(t),s=r.indexOf("\n"+i);if(s>=0){var o=r.indexOf("\n",s+1);r=r.substring(o+1)}this.stack=r}}},o.inherits(p.AssertionError,Error),p.fail=y,p.ok=b,p.equal=function(e,t,n){e!=t&&y(e,t,n,"==",p.equal)},p.notEqual=function(e,t,n){e==t&&y(e,t,n,"!=",p.notEqual)},p.deepEqual=function(e,t,n){w(e,t,!1)||y(e,t,n,"deepEqual",p.deepEqual)},p.deepStrictEqual=function(e,t,n){w(e,t,!0)||y(e,t,n,"deepStrictEqual",p.deepStrictEqual)},p.notDeepEqual=function(e,t,n){w(e,t,!1)&&y(e,t,n,"notDeepEqual",p.notDeepEqual)},p.notDeepStrictEqual=function e(t,n,r){w(t,n,!0)&&y(t,n,r,"notDeepStrictEqual",e)},p.strictEqual=function(e,t,n){e!==t&&y(e,t,n,"===",p.strictEqual)},p.notStrictEqual=function(e,t,n){e===t&&y(e,t,n,"!==",p.notStrictEqual)},p.throws=function(e,t,n){v(!0,e,t,n)},p.doesNotThrow=function(e,t,n){v(!1,e,t,n)},p.ifError=function(e){if(e)throw e},p.strict=r((function e(t,n){t||y(t,!0,n,"==",e)}),p,{equal:p.strictEqual,deepEqual:p.deepStrictEqual,notEqual:p.notStrictEqual,notDeepEqual:p.notDeepStrictEqual}),p.strict.strict=p.strict;var E=Object.keys||function(e){var t=[];for(var n in e)a.call(e,n)&&t.push(n);return t}},301:(e,t,n)=>{"use strict";n.r(t),n.d(t,{sha256:()=>s,sha512:()=>o});var r=n(43);const i=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),s=(0,r.from)({name:"sha2-256",code:18,encode:i("SHA-256")}),o=(0,r.from)({name:"sha2-512",code:19,encode:i("SHA-512")})},318:(e,t)=>{t.read=function(e,t,n,r,i){var s,o,a=8*i-r-1,c=(1<<a)-1,u=c>>1,l=-7,d=n?i-1:0,p=n?-1:1,f=e[t+d];for(d+=p,s=f&(1<<-l)-1,f>>=-l,l+=a;l>0;s=256*s+e[t+d],d+=p,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+e[t+d],d+=p,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),s-=u}return(f?-1:1)*o*Math.pow(2,s-r)},t.write=function(e,t,n,r,i,s){var o,a,c,u=8*s-i-1,l=(1<<u)-1,d=l>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:s-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?p/c:p*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=l?(a=0,o=l):o+d>=1?(a=(t*c-1)*Math.pow(2,i),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[n+f]=255&a,f+=h,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[n+f]=255&o,f+=h,o/=256,u-=8);e[n+f-h]|=128*m}},364:(e,t,n)=>{var r=n(208),i=n(300);function s(){return(new Date).getTime()}var o,a=Array.prototype.slice,c={};o=void 0!==n.g&&n.g.console?n.g.console:"undefined"!=typeof window&&window.console?window.console:{};for(var u=[[function(){},"log"],[function(){o.log.apply(o,arguments)},"info"],[function(){o.log.apply(o,arguments)},"warn"],[function(){o.warn.apply(o,arguments)},"error"],[function(e){c[e]=s()},"time"],[function(e){var t=c[e];if(!t)throw new Error("No such label: "+e);delete c[e];var n=s()-t;o.log(e+": "+n+"ms")},"timeEnd"],[function(){var e=new Error;e.name="Trace",e.message=r.format.apply(null,arguments),o.error(e.stack)},"trace"],[function(e){o.log(r.inspect(e)+"\n")},"dir"],[function(e){if(!e){var t=a.call(arguments,1);i.ok(!1,r.format.apply(null,t))}},"assert"]],l=0;l<u.length;l++){var d=u[l],p=d[0],f=d[1];o[f]||(o[f]=p)}e.exports=o},381:e=>{"use strict";e.exports=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}},486:(e,t,n)=>{"use strict";var r=n(364);const i=n(991),s=n(318),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=u,t.IS=50;const a=2147483647;function c(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return p(e)}return l(e,t,n)}function l(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=c(n);const i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return u.from(r,t,n);const i=function(e){if(u.isBuffer(e)){const t=0|m(e.length),n=c(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||J(e.length)?c(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function d(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function p(e){return d(e),c(e<0?0:0|m(e))}function f(e){const t=e.length<0?0:0|m(e.length),n=c(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function h(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,u.prototype),r}function m(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function g(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return W(e).length;default:if(i)return r?-1:V(e).length;t=(""+t).toLowerCase(),i=!0}}function y(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,n);case"utf8":case"utf-8":return B(this,t,n);case"ascii":return R(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:S(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):S(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function S(e,t,n,r,i){let s,o=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let r=-1;for(s=n;s<a;s++)if(u(e,s)===u(t,-1===r?0:s-r)){if(-1===r&&(r=s),s-r+1===c)return r*o}else-1!==r&&(s-=s-r),r=-1}else for(n+c>a&&(n=a-c),s=n;s>=0;s--){let n=!0;for(let r=0;r<c;r++)if(u(e,s+r)!==u(t,r)){n=!1;break}if(n)return s}return-1}function C(e,t,n,r){n=Number(n)||0;const i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;const s=t.length;let o;for(r>s/2&&(r=s/2),o=0;o<r;++o){const r=parseInt(t.substr(2*o,2),16);if(J(r))return o;e[n+o]=r}return o}function v(e,t,n,r){return Z(V(t,e.length-n),e,n,r)}function E(e,t,n,r){return Z(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function k(e,t,n,r){return Z(W(t),e,n,r)}function x(e,t,n,r){return Z(function(e,t){let n,r,i;const s=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,s.push(i),s.push(r);return s}(t,e.length-n),e,n,r)}function A(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function B(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(