HLS-over-IPFS-video-player/index.ed2f3c79.js
Joshua Seigler 29ba54a401 publish: fix: bugs
generated from commit c853faf3ca
2021-11-30 10:44:55 -05:00

35 lines
2.1 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(e,t,r,i,n){var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o="function"==typeof s.parcelRequire6d65&&s.parcelRequire6d65,a=o.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,r){if(!a[t]){if(!e[t]){var i="function"==typeof s.parcelRequire6d65&&s.parcelRequire6d65;if(!r&&i)return i(t,!0);if(o)return o(t,!0);if(c&&"string"==typeof t)return c(t);var n=new Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}d.resolve=function(r){return e[t][1][r]||r},d.cache={};var l=a[t]=new u.Module(t);e[t][0].call(l.exports,d,l,l.exports,this)}return a[t].exports;function d(e){return u(d.resolve(e))}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=a,u.parent=o,u.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return s.parcelRequire6d65}}),s.parcelRequire6d65=u;for(var l=0;l<t.length;l++)u(t[l]);var d=u(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define&&define.amd&&define((function(){return d}))}({fsddd:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js"),n=e("ipfs-core"),s=e("hls.js"),o=i.interopDefault(s),a=e("hlsjs-ipfs-loader"),c=i.interopDefault(a);function u(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===t?null:decodeURIComponent(t[1].replace(/\+/g," "))}function l(e,t=!1){const r=document.getElementById("status");r.classList.toggle("is-hiding",t),r.innerText=e}function d(){document.body.style.height=window.innerHeight+"px"}document.addEventListener("DOMContentLoaded",(async()=>{const e=u("hash"),t=u("source"),r=u("title"),i=u("time");if(function(){const i=document.getElementById("video"),n=document.getElementById("contextBackground"),s=document.getElementById("contextMenu");i.oncontextmenu=e=>{n.classList.toggle("is-hidden"),s.style.left=e.pageX+"px",s.style.top=e.pageY+"px",e.preventDefault()},n.onclick=e=>{e.stopPropagation(),n.classList.toggle("is-hidden")};const o=`http://ipfsvideo.cc?hash=${e}${r&&"&title="+encodeURIComponent(r)||""}${t&&"&source="+encodeURIComponent(t)||""}`;document.getElementById("contextMenu-url").onclick=e=>{navigator.clipboard.writeText(o)},document.getElementById("contextMenu-urlWithTime").onclick=e=>{navigator.clipboard.writeText(`${o}&time=${Math.round(i.currentTime)}`)}}(),r&&(document.title=r),e){document.getElementById("help").style.display="none";const r=document.getElementById("video");r.style.display="block";const s="ipfs-"+Math.random();l("Connecting to IPFS");const a=await n.create({repo:s});if(l("Connected"),o.default.DefaultConfig.loader=c.default,o.default.DefaultConfig.debug=!1,o.default.isSupported()){const n=new o.default;n.config.ipfs=a,n.config.ipfsHash=e,l("Video loading"),n.loadSource(t||"master.m3u8"),n.attachMedia(r),n.on(o.default.Events.MANIFEST_PARSED,(()=>{l("Video loaded",!0),i&&(r.currentTime=i),r.play()}))}}d(),window.addEventListener("resize",d)}))},{"ipfs-core":"iJfvU","hls.js":"juo1D","hlsjs-ipfs-loader":"1xTo6","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],iJfvU:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./components/index.js"),n=e("libp2p-crypto"),s=e("is-ipfs"),o=e("multiformats/cid"),a=e("multiaddr"),c=e("peer-id"),u=e("ipfs-utils/src/files/glob-source.js"),l=e("ipfs-utils/src/files/url-source.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=d(n),h=d(s),p=d(c),g=d(u),y=d(l);const m=i.create,b=f.default,v=h.default,w=o.CID,_=a.Multiaddr,E=p.default,S=g.default,T=y.default;r.CID=w,r.PeerId=E,r.create=m,r.crypto=b,r.globSource=S,r.isIPFS=v,r.multiaddr=_,r.urlSource=T},{"./components/index.js":"RQOpu","libp2p-crypto":"bb1cb","is-ipfs":"40iuV","multiformats/cid":"9ooAY",multiaddr:"8Mu1u","peer-id":"8Bdb3","ipfs-utils/src/files/glob-source.js":"lHksA","ipfs-utils/src/files/url-source.js":"jQSIS"}],RQOpu:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("merge-options"),n=e("ipfs-utils/src/env.js"),s=e("debug"),o=e("err-code"),a=e("ipfs-unixfs"),c=e("@ipld/dag-pb"),u=e("@ipld/dag-cbor"),l=e("multiformats/hashes/identity"),d=e("multiformats/basics"),f=e("ipfs-core-config/init-assets"),h=e("../errors.js"),p=e("uint8arrays/from-string"),g=e("./start.js"),y=e("./stop.js"),m=e("./dns.js"),b=e("./is-online.js"),v=e("./resolve.js"),w=e("./pin/index.js"),_=e("./ipns.js"),E=e("./name/index.js"),S=e("./refs/index.js"),T=e("./refs/local.js"),A=e("./bitswap/index.js"),k=e("./bootstrap/index.js"),I=e("./block/index.js"),R=e("./root.js"),P=e("./version.js"),O=e("./id.js"),C=e("./config/index.js"),j=e("./dag/index.js"),D=e("../preload.js"),M=e("../mfs-preload.js"),x=e("./files/index.js"),B=e("./key/index.js"),L=e("./object/index.js"),N=e("./repo/index.js"),U=e("./stats/index.js"),F=e("./storage.js"),K=e("./network.js"),z=e("../utils/service.js"),V=e("./swarm/index.js"),q=e("./ping.js"),G=e("./dht.js"),H=e("./pubsub.js"),$=e("ipfs-core-utils/multicodecs"),W=e("ipfs-core-utils/multihashes"),Y=e("ipfs-core-utils/multibases");function X(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function Z(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var Q=X(i),J=X(s),ee=X(o),te=Z(c),re=Z(u);const ie=Q.default.bind({ignoreUndefined:!0}),ne=J.default("ipfs");class se{constructor({print:e,storage:t,codecs:r,options:i}){const{peerId:n,repo:s,keychain:o}=t,a=z.Service.create(K.Network),c=D.createPreloader(i.preload),u=m.createDns(),l=b.createIsOnline({network:a}),f=new _.IPNSAPI(i),h=Object.values(d.hashes);(i.ipld&&i.ipld.hashers?i.ipld.hashers:[]).forEach((e=>h.push(e))),this.hashers=new W.Multihashes({hashers:h,loadHasher:i.ipld&&i.ipld.loadHasher});const p=Object.values(d.bases);(i.ipld&&i.ipld.bases?i.ipld.bases:[]).forEach((e=>p.push(e))),this.bases=new Y.Multibases({bases:p,loadBase:i.ipld&&i.ipld.loadBase});const F=new w.PinAPI({repo:s,codecs:r}),$=new I.BlockAPI({codecs:r,hashers:this.hashers,preload:c,repo:s}),X=new E.NameAPI({dns:u,ipns:f,repo:s,codecs:r,peerId:n,isOnline:l,keychain:o,options:i}),Z=v.createResolve({repo:s,codecs:r,bases:this.bases,name:X}),Q=new j.DagAPI({repo:s,codecs:r,hashers:this.hashers,preload:c}),J=Object.assign(S.createRefs({repo:s,codecs:r,resolve:Z,preload:c}),{local:T.createLocal({repo:t.repo})}),{add:te,addAll:re,cat:ie,get:ne,ls:se}=new R.RootAPI({preload:c,repo:s,options:i.EXPERIMENTAL}),oe=x.createFiles({repo:s,preload:c,hashers:this.hashers,options:i}),ae=M.createMfsPreloader({files:oe,preload:c,options:i.preload});this.preload=c,this.name=X,this.ipns=f,this.pin=F,this.resolve=Z,this.block=$,this.refs=J,this.start=g.createStart({network:a,peerId:n,repo:s,preload:c,ipns:f,mfsPreload:ae,print:e,keychain:o,options:i}),this.stop=y.createStop({network:a,preload:c,mfsPreload:ae,ipns:f,repo:s}),this.dht=G.createDht({network:a,repo:s}),this.pubsub=H.createPubsub({network:a,config:i.config}),this.dns=u,this.isOnline=l,this.id=O.createId({network:a,peerId:n}),this.version=P.createVersion({repo:s}),this.bitswap=new A.BitswapAPI({network:a}),this.bootstrap=new k.BootstrapAPI({repo:s}),this.config=C.createConfig({repo:s}),this.ping=q.createPing({network:a}),this.add=te,this.addAll=re,this.cat=ie,this.get=ne,this.ls=se,this.dag=Q,this.files=oe,this.key=new B.KeyAPI({keychain:o}),this.object=new L.ObjectAPI({preload:c,codecs:r,repo:s}),this.repo=new N.RepoAPI({repo:s,hashers:this.hashers}),this.stats=new U.StatsAPI({repo:s,network:a}),this.swarm=new V.SwarmAPI({network:a}),Object.defineProperty(this,"libp2p",{get(){const e=a.try();return e?e.libp2p:void 0}});const ce=()=>Promise.reject(ee.default(new Error("Not implemented"),"ERR_NOT_IMPLEMENTED"));this.commands=ce,this.diag={cmds:ce,net:ce,sys:ce},this.log={level:ce,ls:ce,tail:async function*(){throw ee.default(new Error("Not implemented"),"ERR_NOT_IMPLEMENTED")}},this.mount=ce,this.codecs=r}async init(){throw new h.AlreadyInitializedError}}r.create=async function(e={}){const t=(e=ie({start:!0,EXPERIMENTAL:{},preload:{enabled:!n.isTest,addresses:["/dns4/node0.preload.ipfs.io/https","/dns4/node1.preload.ipfs.io/https","/dns4/node2.preload.ipfs.io/https","/dns4/node3.preload.ipfs.io/https"]}},e)).init||{},r={name:l.identity.name,code:l.identity.code,encode:e=>e,decode:e=>e},i=Object.values(d.codecs);[te,re,r].concat(e.ipld&&e.ipld.codecs||[]).forEach((e=>i.push(e)));const s=new $.Multicodecs({codecs:i,loadCodec:e.ipld&&e.ipld.loadCodec}),o=e.silent?ne:console.log,c=await F.Storage.start(o,s,e),u=await c.repo.config.getAll(),h=new se({storage:c,print:o,codecs:s,options:{...e,config:u}});if(await h.preload.start(),h.ipns.startOffline(c),c.isNew&&!t.emptyRepo){const e=await(async e=>{const t=te.encode({Data:new a.UnixFS({type:"directory"}).marshal(),Links:[]}),r=await e.block.put(t,{mhtype:"sha2-256",format:"dag-pb"});return await e.pin.add(r),r})(h);ne("adding default assets"),await f.initAssets({addAll:h.addAll,print:o}),ne("initializing IPNS keyspace"),await h.ipns.initializeKeyspace(c.peerId.privKey,p.fromString(`/ipfs/${e}`))}return!1!==e.start&&await h.start(),h}},{"merge-options":"fupyv","ipfs-utils/src/env.js":"flyHr",debug:"bO5wM","err-code":"chZjB","ipfs-unixfs":"dF9VO","@ipld/dag-pb":"i2cdx","@ipld/dag-cbor":"3498i","multiformats/hashes/identity":"eYCZn","multiformats/basics":"lPcQG","ipfs-core-config/init-assets":"d1lP3","../errors.js":"j69o8","uint8arrays/from-string":"dF7Y4","./start.js":"93XEg","./stop.js":"kkxN3","./dns.js":"4N8JT","./is-online.js":"2KSm7","./resolve.js":"faFUb","./pin/index.js":"hDUM1","./ipns.js":"fTgTV","./name/index.js":"u6g6o","./refs/index.js":"9Y9Id","./refs/local.js":"lEaxs","./bitswap/index.js":"lGDjO","./bootstrap/index.js":"dh9oy","./block/index.js":"jcbA3","./root.js":"3wOOx","./version.js":"8mBfq","./id.js":"bQa6q","./config/index.js":"3uMSz","./dag/index.js":"9rLzF","../preload.js":"kBOEV","../mfs-preload.js":"7arhH","./files/index.js":"1yxa2","./key/index.js":"aJXOU","./object/index.js":"kwMxL","./repo/index.js":"1qDVo","./stats/index.js":"1NkyG","./storage.js":"bI63q","./network.js":"1MCQb","../utils/service.js":"ethcf","./swarm/index.js":"cGDFf","./ping.js":"dHQEh","./dht.js":"kOgiu","./pubsub.js":"7IJgU","ipfs-core-utils/multicodecs":"4I7TQ","ipfs-core-utils/multihashes":"febSG","ipfs-core-utils/multibases":"lr7wI"}],fupyv:[function(e,t,r){"use strict";const i=e("is-plain-obj"),{hasOwnProperty:n}=Object.prototype,{propertyIsEnumerable:s}=Object,o=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,c={concatArrays:!1,ignoreUndefined:!1},u=e=>{const t=[];for(const r in e)n.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const i of r)s.call(e,i)&&t.push(i)}return t};function l(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return u(e).forEach((r=>{o(t,r,l(e[r]))})),t}(e):i(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return u(e).forEach((r=>{o(t,r,l(e[r]))})),t}(e):e}const d=(e,t,r,i)=>(r.forEach((r=>{void 0===t[r]&&i.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?o(e,r,f(e[r],t[r],i)):o(e,r,l(t[r])))})),e);function f(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let i=e.slice(0,0),s=0;return[e,t].forEach((t=>{const a=[];for(let r=0;r<t.length;r++)n.call(t,r)&&(a.push(String(r)),o(i,s++,t===e?t[r]:l(t[r])));i=d(i,t,u(t).filter((e=>!a.includes(e))),r)})),i})(e,t,r):i(t)&&i(e)?d(e,t,u(t),r):l(t)}t.exports=function(...e){const t=f(l(c),this!==a&&this||{},c);let r={_:{}};for(const n of e)if(void 0!==n){if(!i(n))throw new TypeError("`"+n+"` is not an Option Object");r=f(r,{_:n},t)}return r._}},{"is-plain-obj":"jGt65"}],jGt65:[function(e,t,r){"use strict";t.exports=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},{}],flyHr:[function(e,t,r){var i=e("process");const n=e("is-electron"),s="object"==typeof window&&"object"==typeof document&&9===document.nodeType,o=n(),a=s&&!o,c=o&&!s,u=o&&s,l="function"==typeof e&&void 0!==i&&void 0!==i.release&&"node"===i.release.name&&!o,d="function"==typeof importScripts&&"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,f=void 0!==i&&void 0!==i.env&&!1,h="undefined"!=typeof navigator&&"ReactNative"===navigator.product;t.exports={isTest:f,isElectron:o,isElectronMain:c,isElectronRenderer:u,isNode:l,isBrowser:a,isWebWorker:d,isEnvWithDom:s,isReactNative:h}},{process:"bjUAi","is-electron":"e6ybt"}],bjUAi:[function(e,t,r){var i,n,s=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(e){if(i===setTimeout)return setTimeout(e,0);if((i===o||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:o}catch(e){i=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var u,l=[],d=!1,f=-1;function h(){d&&u&&(d=!1,u.length?l=u.concat(l):f=-1,l.length&&p())}function p(){if(!d){var e=c(h);d=!0;for(var t=l.length;t;){for(u=l,l=[];++f<t;)u&&u[f].run();f=-1,t=l.length}u=null,d=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function g(e,t){this.fun=e,this.array=t}function y(){}s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new g(e,t)),1!==l.length||d||c(p)},g.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=y,s.addListener=y,s.once=y,s.off=y,s.removeListener=y,s.removeAllListeners=y,s.emit=y,s.prependListener=y,s.prependOnceListener=y,s.listeners=function(e){return[]},s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],e6ybt:[function(e,t,r){var i=e("process");t.exports=function(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!(void 0===i||"object"!=typeof i.versions||!i.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}},{process:"bjUAi"}],bO5wM:[function(e,t,r){var i=e("process");r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let i=0,n=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(i++,"%c"===e&&(n=i))})),e.splice(n,0,r)},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){let e;try{e=r.storage.getItem("debug")}catch(e){}!e&&void 0!==i&&"env"in i&&(e=void 0);return e},r.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},r.storage=function(){try{return localStorage}catch(e){}}(),r.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(r);const{formatters:n}=t.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},{process:"bjUAi","./common":"5mxUS"}],"5mxUS":[function(e,t,r){t.exports=function(t){function r(e){let t,n,s,o=null;function a(...e){if(!a.enabled)return;const i=a,n=Number(new Date),s=n-(t||n);i.diff=s,i.prev=t,i.curr=n,t=n,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,n)=>{if("%%"===t)return"%";o++;const s=r.formatters[n];if("function"==typeof s){const r=e[o];t=s.call(i,r),e.splice(o,1),o--}return t})),r.formatArgs.call(i,e);(i.log||r.log).apply(i,e)}return a.namespace=e,a.useColors=r.useColors(),a.color=r.selectColor(e),a.extend=i,a.destroy=r.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(n!==r.namespaces&&(n=r.namespaces,s=r.enabled(e)),s),set:e=>{o=e}}),"function"==typeof r.init&&r.init(a),a}function i(e,t){const i=r(this.namespace+(void 0===t?":":t)+e);return i.log=this.log,i}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(e){return e instanceof Error?e.stack||e.message:e},r.disable=function(){const e=[...r.names.map(n),...r.skips.map(n).map((e=>"-"+e))].join(",");return r.enable(""),e},r.enable=function(e){let t;r.save(e),r.namespaces=e,r.names=[],r.skips=[];const i=("string"==typeof e?e:"").split(/[\s,]+/),n=i.length;for(t=0;t<n;t++)i[t]&&("-"===(e=i[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))},r.enabled=function(e){if("*"===e[e.length-1])return!0;let t,i;for(t=0,i=r.skips.length;t<i;t++)if(r.skips[t].test(e))return!1;for(t=0,i=r.names.length;t<i;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=e("ms"),r.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((e=>{r[e]=t[e]})),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r.colors[Math.abs(t)%r.colors.length]},r.enable(r.load()),r}},{ms:"1TJQP"}],"1TJQP":[function(e,t,r){var i=1e3,n=60*i,s=60*n,o=24*s,a=7*o,c=365.25*o;function u(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}t.exports=function(e,t){t=t||{};var r,l,d=typeof e;if("string"===d&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*c;case"weeks":case"week":case"w":return r*a;case"days":case"day":case"d":return r*o;case"hours":case"hour":case"hrs":case"hr":case"h":return r*s;case"minutes":case"minute":case"mins":case"min":case"m":return r*n;case"seconds":case"second":case"secs":case"sec":case"s":return r*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===d&&isFinite(e))return t.long?(r=e,(l=Math.abs(r))>=o?u(r,l,o,"day"):l>=s?u(r,l,s,"hour"):l>=n?u(r,l,n,"minute"):l>=i?u(r,l,i,"second"):r+" ms"):function(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=s?Math.round(e/s)+"h":t>=n?Math.round(e/n)+"m":t>=i?Math.round(e/i)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],chZjB:[function(e,t,r){"use strict";function i(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}t.exports=function(e,t,r){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");r||(r={}),"object"==typeof t&&(r=t,t=""),t&&(r.code=t);try{return i(e,r)}catch(t){r.message=e.message,r.stack=e.stack;const n=function(){};n.prototype=Object.create(Object.getPrototypeOf(e));return i(new n,r)}}},{}],dF9VO:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("err-code"),n=e("./unixfs.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(i);const a=n.Data,c=["raw","directory","file","metadata","symlink","hamt-sharded-directory"],u=["directory","hamt-sharded-directory"],l=parseInt("0644",8),d=parseInt("0755",8);function f(e){if(null!=e)return"number"==typeof e?4095&e:"0"===(e=e.toString()).substring(0,1)?4095&parseInt(e,8):4095&parseInt(e,10)}function h(e){if(null==e)return;let t;if(null!=e.secs&&(t={secs:e.secs,nsecs:e.nsecs}),null!=e.Seconds&&(t={secs:e.Seconds,nsecs:e.FractionalNanoseconds}),Array.isArray(e)&&(t={secs:e[0],nsecs:e[1]}),e instanceof Date){const r=e.getTime(),i=Math.floor(r/1e3);t={secs:i,nsecs:1e3*(r-1e3*i)}}if(Object.prototype.hasOwnProperty.call(t,"secs")){if(null!=t&&null!=t.nsecs&&(t.nsecs<0||t.nsecs>999999999))throw o.default(new Error("mtime-nsecs must be within the range [0,999999999]"),"ERR_INVALID_MTIME_NSECS");return t}}class p{static unmarshal(e){const t=a.decode(e),r=a.toObject(t,{defaults:!1,arrays:!0,longs:Number,objects:!1}),i=new p({type:c[r.Type],data:r.Data,blockSizes:r.blocksizes,mode:r.mode,mtime:r.mtime?{secs:r.mtime.Seconds,nsecs:r.mtime.FractionalNanoseconds}:void 0});return i._originalMode=r.mode||0,i}constructor(e={type:"file"}){const{type:t,data:r,blockSizes:i,hashType:n,fanout:s,mtime:a,mode:u}=e;if(t&&!c.includes(t))throw o.default(new Error("Type: "+t+" is not valid"),"ERR_INVALID_TYPE");this.type=t||"file",this.data=r,this.hashType=n,this.fanout=s,this.blockSizes=i||[],this._originalMode=0,this.mode=f(u),a&&(this.mtime=h(a),this.mtime&&!this.mtime.nsecs&&(this.mtime.nsecs=0))}set mode(e){this._mode=this.isDirectory()?d:l;const t=f(e);void 0!==t&&(this._mode=t)}get mode(){return this._mode}isDirectory(){return Boolean(this.type&&u.includes(this.type))}addBlockSize(e){this.blockSizes.push(e)}removeBlockSize(e){this.blockSizes.splice(e,1)}fileSize(){if(this.isDirectory())return 0;let e=0;return this.blockSizes.forEach((t=>{e+=t})),this.data&&(e+=this.data.length),e}marshal(){let e;switch(this.type){case"raw":e=a.DataType.Raw;break;case"directory":e=a.DataType.Directory;break;case"file":e=a.DataType.File;break;case"metadata":e=a.DataType.Metadata;break;case"symlink":e=a.DataType.Symlink;break;case"hamt-sharded-directory":e=a.DataType.HAMTShard;break;default:throw o.default(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE")}let t,r,i=this.data;if(this.data&&this.data.length||(i=void 0),null!=this.mode&&(t=4294963200&this._originalMode|(f(this.mode)||0),t!==l||this.isDirectory()||(t=void 0),t===d&&this.isDirectory()&&(t=void 0)),null!=this.mtime){const e=h(this.mtime);e&&(r={Seconds:e.secs,FractionalNanoseconds:e.nsecs},0===r.FractionalNanoseconds&&delete r.FractionalNanoseconds)}const n={Type:e,Data:i,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:t,mtime:r};return a.encode(n).finish()}}r.UnixFS=p,r.parseMode=f,r.parseMtime=h},{"err-code":"chZjB","./unixfs.js":"l2F50"}],l2F50:[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("protobufjs/minimal.js"));const s=n.default.Reader,o=n.default.Writer,a=n.default.util,c=n.default.roots["ipfs-unixfs"]||(n.default.roots["ipfs-unixfs"]={}),u=c.Data=(()=>{function e(e){if(this.blocksizes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.Type=0,e.prototype.Data=a.newBuffer([]),e.prototype.filesize=a.Long?a.Long.fromBits(0,0,!0):0,e.prototype.blocksizes=a.emptyArray,e.prototype.hashType=a.Long?a.Long.fromBits(0,0,!0):0,e.prototype.fanout=a.Long?a.Long.fromBits(0,0,!0):0,e.prototype.mode=0,e.prototype.mtime=null,e.encode=function(e,t){if(t||(t=o.create()),t.uint32(8).int32(e.Type),null!=e.Data&&Object.hasOwnProperty.call(e,"Data")&&t.uint32(18).bytes(e.Data),null!=e.filesize&&Object.hasOwnProperty.call(e,"filesize")&&t.uint32(24).uint64(e.filesize),null!=e.blocksizes&&e.blocksizes.length)for(var r=0;r<e.blocksizes.length;++r)t.uint32(32).uint64(e.blocksizes[r]);return null!=e.hashType&&Object.hasOwnProperty.call(e,"hashType")&&t.uint32(40).uint64(e.hashType),null!=e.fanout&&Object.hasOwnProperty.call(e,"fanout")&&t.uint32(48).uint64(e.fanout),null!=e.mode&&Object.hasOwnProperty.call(e,"mode")&&t.uint32(56).uint32(e.mode),null!=e.mtime&&Object.hasOwnProperty.call(e,"mtime")&&c.UnixTime.encode(e.mtime,t.uint32(66).fork()).ldelim(),t},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new c.Data;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.Type=e.int32();break;case 2:i.Data=e.bytes();break;case 3:i.filesize=e.uint64();break;case 4:if(i.blocksizes&&i.blocksizes.length||(i.blocksizes=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)i.blocksizes.push(e.uint64());else i.blocksizes.push(e.uint64());break;case 5:i.hashType=e.uint64();break;case 6:i.fanout=e.uint64();break;case 7:i.mode=e.uint32();break;case 8:i.mtime=c.UnixTime.decode(e,e.uint32());break;default:e.skipType(7&n)}}if(!i.hasOwnProperty("Type"))throw a.ProtocolError("missing required 'Type'",{instance:i});return i},e.fromObject=function(e){if(e instanceof c.Data)return e;var t=new c.Data;switch(e.Type){case"Raw":case 0:t.Type=0;break;case"Directory":case 1:t.Type=1;break;case"File":case 2:t.Type=2;break;case"Metadata":case 3:t.Type=3;break;case"Symlink":case 4:t.Type=4;break;case"HAMTShard":case 5:t.Type=5}if(null!=e.Data&&("string"==typeof e.Data?a.base64.decode(e.Data,t.Data=a.newBuffer(a.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),null!=e.filesize&&(a.Long?(t.filesize=a.Long.fromValue(e.filesize)).unsigned=!0:"string"==typeof e.filesize?t.filesize=parseInt(e.filesize,10):"number"==typeof e.filesize?t.filesize=e.filesize:"object"==typeof e.filesize&&(t.filesize=new a.LongBits(e.filesize.low>>>0,e.filesize.high>>>0).toNumber(!0))),e.blocksizes){if(!Array.isArray(e.blocksizes))throw TypeError(".Data.blocksizes: array expected");t.blocksizes=[];for(var r=0;r<e.blocksizes.length;++r)a.Long?(t.blocksizes[r]=a.Long.fromValue(e.blocksizes[r])).unsigned=!0:"string"==typeof e.blocksizes[r]?t.blocksizes[r]=parseInt(e.blocksizes[r],10):"number"==typeof e.blocksizes[r]?t.blocksizes[r]=e.blocksizes[r]:"object"==typeof e.blocksizes[r]&&(t.blocksizes[r]=new a.LongBits(e.blocksizes[r].low>>>0,e.blocksizes[r].high>>>0).toNumber(!0))}if(null!=e.hashType&&(a.Long?(t.hashType=a.Long.fromValue(e.hashType)).unsigned=!0:"string"==typeof e.hashType?t.hashType=parseInt(e.hashType,10):"number"==typeof e.hashType?t.hashType=e.hashType:"object"==typeof e.hashType&&(t.hashType=new a.LongBits(e.hashType.low>>>0,e.hashType.high>>>0).toNumber(!0))),null!=e.fanout&&(a.Long?(t.fanout=a.Long.fromValue(e.fanout)).unsigned=!0:"string"==typeof e.fanout?t.fanout=parseInt(e.fanout,10):"number"==typeof e.fanout?t.fanout=e.fanout:"object"==typeof e.fanout&&(t.fanout=new a.LongBits(e.fanout.low>>>0,e.fanout.high>>>0).toNumber(!0))),null!=e.mode&&(t.mode=e.mode>>>0),null!=e.mtime){if("object"!=typeof e.mtime)throw TypeError(".Data.mtime: object expected");t.mtime=c.UnixTime.fromObject(e.mtime)}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.blocksizes=[]),t.defaults){if(r.Type=t.enums===String?"Raw":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=a.newBuffer(r.Data))),a.Long){var i=new a.Long(0,0,!0);r.filesize=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.filesize=t.longs===String?"0":0;if(a.Long){i=new a.Long(0,0,!0);r.hashType=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.hashType=t.longs===String?"0":0;if(a.Long){i=new a.Long(0,0,!0);r.fanout=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.fanout=t.longs===String?"0":0;r.mode=0,r.mtime=null}if(null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?c.Data.DataType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?a.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),null!=e.filesize&&e.hasOwnProperty("filesize")&&("number"==typeof e.filesize?r.filesize=t.longs===String?String(e.filesize):e.filesize:r.filesize=t.longs===String?a.Long.prototype.toString.call(e.filesize):t.longs===Number?new a.LongBits(e.filesize.low>>>0,e.filesize.high>>>0).toNumber(!0):e.filesize),e.blocksizes&&e.blocksizes.length){r.blocksizes=[];for(var n=0;n<e.blocksizes.length;++n)"number"==typeof e.blocksizes[n]?r.blocksizes[n]=t.longs===String?String(e.blocksizes[n]):e.blocksizes[n]:r.blocksizes[n]=t.longs===String?a.Long.prototype.toString.call(e.blocksizes[n]):t.longs===Number?new a.LongBits(e.blocksizes[n].low>>>0,e.blocksizes[n].high>>>0).toNumber(!0):e.blocksizes[n]}return null!=e.hashType&&e.hasOwnProperty("hashType")&&("number"==typeof e.hashType?r.hashType=t.longs===String?String(e.hashType):e.hashType:r.hashType=t.longs===String?a.Long.prototype.toString.call(e.hashType):t.longs===Number?new a.LongBits(e.hashType.low>>>0,e.hashType.high>>>0).toNumber(!0):e.hashType),null!=e.fanout&&e.hasOwnProperty("fanout")&&("number"==typeof e.fanout?r.fanout=t.longs===String?String(e.fanout):e.fanout:r.fanout=t.longs===String?a.Long.prototype.toString.call(e.fanout):t.longs===Number?new a.LongBits(e.fanout.low>>>0,e.fanout.high>>>0).toNumber(!0):e.fanout),null!=e.mode&&e.hasOwnProperty("mode")&&(r.mode=e.mode),null!=e.mtime&&e.hasOwnProperty("mtime")&&(r.mtime=c.UnixTime.toObject(e.mtime,t)),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.default.util.toJSONOptions)},e.DataType=function(){const e={},t=Object.create(e);return t[e[0]="Raw"]=0,t[e[1]="Directory"]=1,t[e[2]="File"]=2,t[e[3]="Metadata"]=3,t[e[4]="Symlink"]=4,t[e[5]="HAMTShard"]=5,t}(),e})(),l=c.UnixTime=(()=>{function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.Seconds=a.Long?a.Long.fromBits(0,0,!1):0,e.prototype.FractionalNanoseconds=0,e.encode=function(e,t){return t||(t=o.create()),t.uint32(8).int64(e.Seconds),null!=e.FractionalNanoseconds&&Object.hasOwnProperty.call(e,"FractionalNanoseconds")&&t.uint32(21).fixed32(e.FractionalNanoseconds),t},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new c.UnixTime;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.Seconds=e.int64();break;case 2:i.FractionalNanoseconds=e.fixed32();break;default:e.skipType(7&n)}}if(!i.hasOwnProperty("Seconds"))throw a.ProtocolError("missing required 'Seconds'",{instance:i});return i},e.fromObject=function(e){if(e instanceof c.UnixTime)return e;var t=new c.UnixTime;return null!=e.Seconds&&(a.Long?(t.Seconds=a.Long.fromValue(e.Seconds)).unsigned=!1:"string"==typeof e.Seconds?t.Seconds=parseInt(e.Seconds,10):"number"==typeof e.Seconds?t.Seconds=e.Seconds:"object"==typeof e.Seconds&&(t.Seconds=new a.LongBits(e.Seconds.low>>>0,e.Seconds.high>>>0).toNumber())),null!=e.FractionalNanoseconds&&(t.FractionalNanoseconds=e.FractionalNanoseconds>>>0),t},e.toObject=function(e,t){t||(t={});var r={};if(t.defaults){if(a.Long){var i=new a.Long(0,0,!1);r.Seconds=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.Seconds=t.longs===String?"0":0;r.FractionalNanoseconds=0}return null!=e.Seconds&&e.hasOwnProperty("Seconds")&&("number"==typeof e.Seconds?r.Seconds=t.longs===String?String(e.Seconds):e.Seconds:r.Seconds=t.longs===String?a.Long.prototype.toString.call(e.Seconds):t.longs===Number?new a.LongBits(e.Seconds.low>>>0,e.Seconds.high>>>0).toNumber():e.Seconds),null!=e.FractionalNanoseconds&&e.hasOwnProperty("FractionalNanoseconds")&&(r.FractionalNanoseconds=e.FractionalNanoseconds),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.default.util.toJSONOptions)},e})(),d=c.Metadata=(()=>{function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.MimeType="",e.encode=function(e,t){return t||(t=o.create()),null!=e.MimeType&&Object.hasOwnProperty.call(e,"MimeType")&&t.uint32(10).string(e.MimeType),t},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new c.Metadata;e.pos<r;){var n=e.uint32();if(n>>>3==1)i.MimeType=e.string();else e.skipType(7&n)}return i},e.fromObject=function(e){if(e instanceof c.Metadata)return e;var t=new c.Metadata;return null!=e.MimeType&&(t.MimeType=String(e.MimeType)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.MimeType=""),null!=e.MimeType&&e.hasOwnProperty("MimeType")&&(r.MimeType=e.MimeType),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.default.util.toJSONOptions)},e})();r.Data=u,r.Metadata=d,r.UnixTime=l,r.default=c},{"protobufjs/minimal.js":"grAXL"}],grAXL:[function(e,t,r){"use strict";t.exports=e("./src/index-minimal")},{"./src/index-minimal":"3OMTL"}],"3OMTL":[function(e,t,r){"use strict";var i=r;function n(){i.util._configure(),i.Writer._configure(i.BufferWriter),i.Reader._configure(i.BufferReader)}i.build="minimal",i.Writer=e("./writer"),i.BufferWriter=e("./writer_buffer"),i.Reader=e("./reader"),i.BufferReader=e("./reader_buffer"),i.util=e("./util/minimal"),i.rpc=e("./rpc"),i.roots=e("./roots"),i.configure=n,n()},{"./writer":"eDEax","./writer_buffer":"a3zLo","./reader":"hwSZz","./reader_buffer":"51B7L","./util/minimal":"kCaEH","./rpc":"flYC1","./roots":"aq70a"}],eDEax:[function(e,t,r){"use strict";t.exports=d;var i,n=e("./util/minimal"),s=n.LongBits,o=n.base64,a=n.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function u(){}function l(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function d(){this.len=0,this.head=new c(u,0,0),this.tail=this.head,this.states=null}var f=function(){return n.Buffer?function(){return(d.create=function(){return new i})()}:function(){return new d}};function h(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}d.create=f(),d.alloc=function(e){return new n.Array(e)},n.Array!==Array&&(d.alloc=n.pool(d.alloc,n.Array.prototype.subarray)),d.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},d.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},d.prototype.int32=function(e){return e<0?this._push(g,10,s.fromNumber(e)):this.uint32(e)},d.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},d.prototype.uint64=function(e){var t=s.from(e);return this._push(g,t.length(),t)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(g,t.length(),t)},d.prototype.bool=function(e){return this._push(h,1,e?1:0)},d.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(e){var t=s.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(e){return this._push(n.float.writeFloatLE,4,e)},d.prototype.double=function(e){return this._push(n.float.writeDoubleLE,8,e)};var m=n.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var i=0;i<e.length;++i)t[r+i]=e[i]};d.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(h,1,0);if(n.isString(e)){var r=d.alloc(t=o.length(e));o.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},d.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(h,1,0)},d.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new c(u,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(u,0,0),this.len=0),this},d.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},d.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},d._configure=function(e){i=e,d.create=f(),i._configure()}},{"./util/minimal":"kCaEH"}],kCaEH:[function(e,t,r){var i=arguments[3],n=r;function s(e,t,r){for(var i=Object.keys(t),n=0;n<i.length;++n)void 0!==e[i[n]]&&r||(e[i[n]]=t[i[n]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&s(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}n.asPromise=e("@protobufjs/aspromise"),n.base64=e("@protobufjs/base64"),n.EventEmitter=e("@protobufjs/eventemitter"),n.float=e("@protobufjs/float"),n.inquire=e("@protobufjs/inquire"),n.utf8=e("@protobufjs/utf8"),n.pool=e("@protobufjs/pool"),n.LongBits=e("./longbits"),n.isNode=Boolean(void 0!==i&&i&&i.process&&i.process.versions&&i.process.versions.node),n.global=n.isNode&&i||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isObject=function(e){return e&&"object"==typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=s,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},{"@protobufjs/aspromise":"3qbBA","@protobufjs/base64":"8pFfG","@protobufjs/eventemitter":"8QYdM","@protobufjs/float":"3NURP","@protobufjs/inquire":"3GHL4","@protobufjs/utf8":"ergn2","@protobufjs/pool":"lRkSe","./longbits":"kTtk9"}],"3qbBA":[function(e,t,r){"use strict";t.exports=function(e,t){var r=new Array(arguments.length-1),i=0,n=2,s=!0;for(;n<arguments.length;)r[i++]=arguments[n++];return new Promise((function(n,o){r[i]=function(e){if(s)if(s=!1,e)o(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];n.apply(null,t)}};try{e.apply(t||null,r)}catch(e){s&&(s=!1,o(e))}}))}},{}],"8pFfG":[function(e,t,r){"use strict";var i=r;i.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),s=new Array(123),o=0;o<64;)s[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;i.encode=function(e,t,r){for(var i,s=null,o=[],a=0,c=0;t<r;){var u=e[t++];switch(c){case 0:o[a++]=n[u>>2],i=(3&u)<<4,c=1;break;case 1:o[a++]=n[i|u>>4],i=(15&u)<<2,c=2;break;case 2:o[a++]=n[i|u>>6],o[a++]=n[63&u],c=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return c&&(o[a++]=n[i],o[a++]=61,1===c&&(o[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var a="invalid encoding";i.decode=function(e,t,r){for(var i,n=r,o=0,c=0;c<e.length;){var u=e.charCodeAt(c++);if(61===u&&o>1)break;if(void 0===(u=s[u]))throw Error(a);switch(o){case 0:i=u,o=1;break;case 1:t[r++]=i<<2|(48&u)>>4,i=u,o=2;break;case 2:t[r++]=(15&i)<<4|(60&u)>>2,i=u,o=3;break;case 3:t[r++]=(3&i)<<6|u,o=0}}if(1===o)throw Error(a);return r-n},i.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},{}],"8QYdM":[function(e,t,r){"use strict";function i(){this._listeners={}}t.exports=i,i.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},i.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],i=0;i<r.length;)r[i].fn===t?r.splice(i,1):++i;return this},i.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],i=1;i<arguments.length;)r.push(arguments[i++]);for(i=0;i<t.length;)t[i].fn.apply(t[i++].ctx,r)}return this}},{}],"3NURP":[function(e,t,r){"use strict";function i(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),i=128===r[3];function n(e,i,n){t[0]=e,i[n]=r[0],i[n+1]=r[1],i[n+2]=r[2],i[n+3]=r[3]}function s(e,i,n){t[0]=e,i[n]=r[3],i[n+1]=r[2],i[n+2]=r[1],i[n+3]=r[0]}function o(e,i){return r[0]=e[i],r[1]=e[i+1],r[2]=e[i+2],r[3]=e[i+3],t[0]}function a(e,i){return r[3]=e[i],r[2]=e[i+1],r[1]=e[i+2],r[0]=e[i+3],t[0]}e.writeFloatLE=i?n:s,e.writeFloatBE=i?s:n,e.readFloatLE=i?o:a,e.readFloatBE=i?a:o}():function(){function t(e,t,r,i){var n=t<0?1:0;if(n&&(t=-t),0===t)e(1/t>0?0:2147483648,r,i);else if(isNaN(t))e(2143289344,r,i);else if(t>34028234663852886e22)e((n<<31|2139095040)>>>0,r,i);else if(t<11754943508222875e-54)e((n<<31|Math.round(t/1401298464324817e-60))>>>0,r,i);else{var s=Math.floor(Math.log(t)/Math.LN2);e((n<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,r,i)}}function r(e,t,r){var i=e(t,r),n=2*(i>>31)+1,s=i>>>23&255,o=8388607&i;return 255===s?o?NaN:n*(1/0):0===s?1401298464324817e-60*n*o:n*Math.pow(2,s-150)*(o+8388608)}e.writeFloatLE=t.bind(null,n),e.writeFloatBE=t.bind(null,s),e.readFloatLE=r.bind(null,o),e.readFloatBE=r.bind(null,a)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),i=128===r[7];function n(e,i,n){t[0]=e,i[n]=r[0],i[n+1]=r[1],i[n+2]=r[2],i[n+3]=r[3],i[n+4]=r[4],i[n+5]=r[5],i[n+6]=r[6],i[n+7]=r[7]}function s(e,i,n){t[0]=e,i[n]=r[7],i[n+1]=r[6],i[n+2]=r[5],i[n+3]=r[4],i[n+4]=r[3],i[n+5]=r[2],i[n+6]=r[1],i[n+7]=r[0]}function o(e,i){return r[0]=e[i],r[1]=e[i+1],r[2]=e[i+2],r[3]=e[i+3],r[4]=e[i+4],r[5]=e[i+5],r[6]=e[i+6],r[7]=e[i+7],t[0]}function a(e,i){return r[7]=e[i],r[6]=e[i+1],r[5]=e[i+2],r[4]=e[i+3],r[3]=e[i+4],r[2]=e[i+5],r[1]=e[i+6],r[0]=e[i+7],t[0]}e.writeDoubleLE=i?n:s,e.writeDoubleBE=i?s:n,e.readDoubleLE=i?o:a,e.readDoubleBE=i?a:o}():function(){function t(e,t,r,i,n,s){var o=i<0?1:0;if(o&&(i=-i),0===i)e(0,n,s+t),e(1/i>0?0:2147483648,n,s+r);else if(isNaN(i))e(0,n,s+t),e(2146959360,n,s+r);else if(i>17976931348623157e292)e(0,n,s+t),e((o<<31|2146435072)>>>0,n,s+r);else{var a;if(i<22250738585072014e-324)e((a=i/5e-324)>>>0,n,s+t),e((o<<31|a/4294967296)>>>0,n,s+r);else{var c=Math.floor(Math.log(i)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=i*Math.pow(2,-c))>>>0,n,s+t),e((o<<31|c+1023<<20|1048576*a&1048575)>>>0,n,s+r)}}}function r(e,t,r,i,n){var s=e(i,n+t),o=e(i,n+r),a=2*(o>>31)+1,c=o>>>20&2047,u=4294967296*(1048575&o)+s;return 2047===c?u?NaN:a*(1/0):0===c?5e-324*a*u:a*Math.pow(2,c-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,n,0,4),e.writeDoubleBE=t.bind(null,s,4,0),e.readDoubleLE=r.bind(null,o,0,4),e.readDoubleBE=r.bind(null,a,4,0)}(),e}function n(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function s(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function o(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function a(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}t.exports=i(i)},{}],"3GHL4":[function(require,module,exports){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},{}],ergn2:[function(e,t,r){"use strict";var i=r;i.length=function(e){for(var t=0,r=0,i=0;i<e.length;++i)(r=e.charCodeAt(i))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(i+1))?(++i,t+=4):t+=3;return t},i.read=function(e,t,r){if(r-t<1)return"";for(var i,n=null,s=[],o=0;t<r;)(i=e[t++])<128?s[o++]=i:i>191&&i<224?s[o++]=(31&i)<<6|63&e[t++]:i>239&&i<365?(i=((7&i)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[o++]=55296+(i>>10),s[o++]=56320+(1023&i)):s[o++]=(15&i)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),o=0);return n?(o&&n.push(String.fromCharCode.apply(String,s.slice(0,o))),n.join("")):String.fromCharCode.apply(String,s.slice(0,o))},i.write=function(e,t,r){for(var i,n,s=r,o=0;o<e.length;++o)(i=e.charCodeAt(o))<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&56320==(64512&(n=e.charCodeAt(o+1)))?(i=65536+((1023&i)<<10)+(1023&n),++o,t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128);return r-s}},{}],lRkSe:[function(e,t,r){"use strict";t.exports=function(e,t,r){var i=r||8192,n=i>>>1,s=null,o=i;return function(r){if(r<1||r>n)return e(r);o+r>i&&(s=e(i),o=0);var a=t.call(s,o,o+=r);return 7&o&&(o=1+(7|o)),a}}},{}],kTtk9:[function(e,t,r){"use strict";t.exports=n;var i=e("../util/minimal");function n(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=n.zero=new n(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var r=e>>>0,i=(e-r)/4294967296>>>0;return t&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new n(r,i)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if(i.isString(e)){if(!i.Long)return n.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):s},n.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},n.prototype.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;n.fromHash=function(e){return e===o?s:new n((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},n.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},n.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},n.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},n.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},{"../util/minimal":"kCaEH"}],a3zLo:[function(e,t,r){"use strict";t.exports=s;var i=e("./writer");(s.prototype=Object.create(i.prototype)).constructor=s;var n=e("./util/minimal");function s(){i.call(this)}function o(e,t,r){e.length<40?n.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}s._configure=function(){s.alloc=n._Buffer_allocUnsafe,s.writeBytesBuffer=n.Buffer&&n.Buffer.prototype instanceof Uint8Array&&"set"===n.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var i=0;i<e.length;)t[r++]=e[i++]}},s.prototype.bytes=function(e){n.isString(e)&&(e=n._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=n.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},s._configure()},{"./writer":"eDEax","./util/minimal":"kCaEH"}],hwSZz:[function(e,t,r){"use strict";t.exports=c;var i,n=e("./util/minimal"),s=n.LongBits,o=n.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var u,l="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},d=function(){return n.Buffer?function(e){return(c.create=function(e){return n.Buffer.isBuffer(e)?new i(e):l(e)})(e)}:l};function f(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function h(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw a(this,8);return new s(h(this.buf,this.pos+=4),h(this.buf,this.pos+=4))}c.create=d(),c.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,c.prototype.uint32=(u=4294967295,function(){if(u=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return u;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return u}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return h(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|h(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},c.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){i=e,c.create=d(),i._configure();var t=n.Long?"toLong":"toNumber";n.merge(c.prototype,{int64:function(){return f.call(this)[t](!1)},uint64:function(){return f.call(this)[t](!0)},sint64:function(){return f.call(this).zzDecode()[t](!1)},fixed64:function(){return p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},{"./util/minimal":"kCaEH"}],"51B7L":[function(e,t,r){"use strict";t.exports=s;var i=e("./reader");(s.prototype=Object.create(i.prototype)).constructor=s;var n=e("./util/minimal");function s(e){i.call(this,e)}s._configure=function(){n.Buffer&&(s.prototype._slice=n.Buffer.prototype.slice)},s.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},s._configure()},{"./reader":"hwSZz","./util/minimal":"kCaEH"}],flYC1:[function(e,t,r){"use strict";r.Service=e("./rpc/service")},{"./rpc/service":"cl9qf"}],cl9qf:[function(e,t,r){"use strict";t.exports=n;var i=e("../util/minimal");function n(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(n.prototype=Object.create(i.EventEmitter.prototype)).constructor=n,n.prototype.rpcCall=function e(t,r,n,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return i.asPromise(e,a,t,r,n,s);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),(function(e,r){if(e)return a.emit("error",e,t),o(e);if(null!==r){if(!(r instanceof n))try{r=n[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",r,t),o(null,r)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){o(e)}),0)}else setTimeout((function(){o(Error("already ended"))}),0)},n.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{"../util/minimal":"kCaEH"}],aq70a:[function(e,t,r){"use strict";t.exports={}},{}],i2cdx:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("./pb-decode.js"),s=e("./pb-encode.js"),o=e("./util.js");r.createLink=o.createLink,r.createNode=o.createNode,r.prepare=o.prepare,r.validate=o.validate,r.code=112,r.decode=function(e){const t=n.decodeNode(e),r={};return t.Data&&(r.Data=t.Data),t.Links&&(r.Links=t.Links.map((e=>{const t={};try{t.Hash=i.CID.decode(e.Hash)}catch(e){}if(!t.Hash)throw new Error("Invalid Hash field found in link, expected CID");return void 0!==e.Name&&(t.Name=e.Name),void 0!==e.Tsize&&(t.Tsize=e.Tsize),t}))),r},r.encode=function(e){o.validate(e);const t={};return e.Links&&(t.Links=e.Links.map((e=>{const t={};return e.Hash&&(t.Hash=e.Hash.bytes),void 0!==e.Name&&(t.Name=e.Name),void 0!==e.Tsize&&(t.Tsize=e.Tsize),t}))),e.Data&&(t.Data=e.Data),s.encodeNode(t)},r.name="dag-pb"},{"multiformats/cid":"9ooAY","./pb-decode.js":"ld3PU","./pb-encode.js":"5nPbE","./util.js":"1YHGP"}],"9ooAY":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./varint.js"),n=e("./hashes/digest.js"),s=e("./bases/base58.js"),o=e("./bases/base32.js"),a=e("./bytes.js");class c{constructor(e,t,r,i){this.code=t,this.version=e,this.multihash=r,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:m,byteLength:m,code:y,version:y,multihash:y,bytes:y,_baseCache:m,asCID:m})}toV0(){if(0===this.version)return this;{const{code:e,multihash:t}=this;if(e!==f)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==h)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return c.createV0(t)}}toV1(){switch(this.version){case 0:{const{code:e,digest:t}=this.multihash,r=n.create(e,t);return c.createV1(this.code,r)}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&&n.equals(this.multihash,e.multihash)}toString(e){const{bytes:t,version:r,_baseCache:i}=this;return 0===r?l(t,i,e||s.base58btc.encoder):d(t,i,e||o.base32.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/,v),!(!e||!e[g]&&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 c)return e;if(null!=e&&e.asCID===e){const{version:t,code:r,multihash:i,bytes:n}=e;return new c(t,r,i,n||p(t,r,i.bytes))}if(null!=e&&!0===e[g]){const{version:t,multihash:r,code:i}=e,s=n.decode(r);return c.create(t,i,s)}return null}static create(e,t,r){if("number"!=typeof t)throw new Error("String codecs are no longer supported");switch(e){case 0:if(t!==f)throw new Error(`Version 0 CID must use dag-pb (code: ${f}) block encoding`);return new c(e,t,r,r.bytes);case 1:{const i=p(e,t,r.bytes);return new c(e,t,r,i)}default:throw new Error("Invalid version")}}static createV0(e){return c.create(0,f,e)}static createV1(e,t){return c.create(1,e,t)}static decode(e){const[t,r]=c.decodeFirst(e);if(r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=c.inspectBytes(e),r=t.size-t.multihashSize,i=a.coerce(e.subarray(r,r+t.multihashSize));if(i.byteLength!==t.multihashSize)throw new Error("Incorrect length");const s=i.subarray(t.multihashSize-t.digestSize),o=new n.Digest(t.multihashCode,t.digestSize,s,i);return[0===t.version?c.createV0(o):c.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0;const r=()=>{const[r,n]=i.decode(e.subarray(t));return t+=n,r};let n=r(),s=f;if(18===n?(n=0,t=0):1===n&&(s=r()),0!==n&&1!==n)throw new RangeError(`Invalid CID version ${n}`);const o=t,a=r(),c=r(),u=t+c;return{version:n,codec:s,multihashCode:a,digestSize:c,multihashSize:u-o,size:u}}static parse(e,t){const[r,i]=u(e,t),n=c.decode(i);return n._baseCache.set(r,e),n}}const u=(e,t)=>{switch(e[0]){case"Q":{const r=t||s.base58btc;return[s.base58btc.prefix,r.decode(`${s.base58btc.prefix}${e}`)]}case s.base58btc.prefix:{const r=t||s.base58btc;return[s.base58btc.prefix,r.decode(e)]}case o.base32.prefix:{const r=t||o.base32;return[o.base32.prefix,r.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)]}},l=(e,t,r)=>{const{prefix:i}=r;if(i!==s.base58btc.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);const n=t.get(i);if(null==n){const n=r.encode(e).slice(1);return t.set(i,n),n}return n},d=(e,t,r)=>{const{prefix:i}=r,n=t.get(i);if(null==n){const n=r.encode(e);return t.set(i,n),n}return n},f=112,h=18,p=(e,t,r)=>{const n=i.encodingLength(e),s=n+i.encodingLength(t),o=new Uint8Array(s+r.byteLength);return i.encodeTo(e,o,0),i.encodeTo(t,o,n),o.set(r,s),o},g=Symbol.for("@ipld/js-cid/CID"),y={writable:!1,configurable:!1,enumerable:!0},m={writable:!1,enumerable:!1,configurable:!1},b=(e,t)=>{if(!e.test("0.0.0-dev"))throw new Error(t);console.warn(t)},v="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";r.CID=c},{"./varint.js":"ivDPm","./hashes/digest.js":"kpRBg","./bases/base58.js":"4n7mA","./bases/base32.js":"5k9Tu","./bytes.js":"6I0Ku"}],ivDPm:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../vendor/varint.js");r.decode=e=>[i.decode(e),i.decode.bytes],r.encodeTo=(e,t,r=0)=>(i.encode(e,t,r),t),r.encodingLength=e=>i.encodingLength(e)},{"../vendor/varint.js":"h72ss"}],h72ss:[function(e,t,r){"use strict";var i=function e(t,r,i){r=r||[];var s=i=i||0;for(;t>=n;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-s+1,r},n=Math.pow(2,31);var s=function e(t,r){var i,n=0,s=0,o=r=r||0,a=t.length;do{if(o>=a)throw e.bytes=0,new RangeError("Could not decode varint");i=t[o++],n+=s<28?(127&i)<<s:(127&i)*Math.pow(2,s),s+=7}while(i>=128);return e.bytes=o-r,n};var o=Math.pow(2,7),a=Math.pow(2,14),c=Math.pow(2,21),u=Math.pow(2,28),l=Math.pow(2,35),d=Math.pow(2,42),f=Math.pow(2,49),h=Math.pow(2,56),p=Math.pow(2,63),g={encode:i,decode:s,encodingLength:function(e){return e<o?1:e<a?2:e<c?3:e<u?4:e<l?5:e<d?6:e<f?7:e<h?8:e<p?9:10}};t.exports=g},{}],kpRBg:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../bytes.js"),n=e("../varint.js");class s{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}r.Digest=s,r.create=(e,t)=>{const r=t.byteLength,i=n.encodingLength(e),o=i+n.encodingLength(r),a=new Uint8Array(o+r);return n.encodeTo(e,a,0),n.encodeTo(r,a,i),a.set(t,o),new s(e,r,t,a)},r.decode=e=>{const t=i.coerce(e),[r,o]=n.decode(t),[a,c]=n.decode(t.subarray(o)),u=t.subarray(o+c);if(u.byteLength!==a)throw new Error("Incorrect length");return new s(r,a,u,t)},r.equals=(e,t)=>e===t||e.code===t.code&&e.size===t.size&&i.equals(e.bytes,t.bytes)},{"../bytes.js":"6I0Ku","../varint.js":"ivDPm"}],"6I0Ku":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=new Uint8Array(0);r.coerce=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},r.empty=i,r.equals=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},r.fromHex=e=>{const t=e.match(/../g);return t?new Uint8Array(t.map((e=>parseInt(e,16)))):i},r.fromString=e=>(new TextEncoder).encode(e),r.isBinary=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),r.toHex=e=>e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),""),r.toString=e=>(new TextDecoder).decode(e)},{}],"4n7mA":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./base.js");const n=i.baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),s=i.baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});r.base58btc=n,r.base58flickr=s},{"./base.js":"6uTk1"}],"6uTk1":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../vendor/base-x.js"),n=e("../bytes.js");class s{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class o{constructor(e,t,r){this.name=e,this.prefix=t,this.baseDecode=r}decode(e){if("string"==typeof e){if(e[0]===this.prefix)return this.baseDecode(e.slice(1));throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)}throw Error("Can only multibase decode strings")}or(e){return c(this,e)}}class a{constructor(e){this.decoders=e}or(e){return c(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const c=(e,t)=>new a({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class u{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new s(e,t,r),this.decoder=new o(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const l=({name:e,prefix:t,encode:r,decode:i})=>new u(e,t,r,i);r.Codec=u,r.baseX=({prefix:e,name:t,alphabet:r})=>{const{encode:s,decode:o}=i(r,t);return l({prefix:e,name:t,encode:s,decode:e=>n.coerce(o(e))})},r.from=l,r.or=c,r.rfc4648=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>l({prefix:t,name:e,encode:e=>((e,t,r)=>{const i="="===t[t.length-1],n=(1<<r)-1;let s="",o=0,a=0;for(let i=0;i<e.length;++i)for(a=a<<8|e[i],o+=8;o>r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s})(e,i,r),decode:t=>((e,t,r,i)=>{const n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;const o=new Uint8Array(s*r/8|0);let a=0,c=0,u=0;for(let t=0;t<s;++t){const s=n[e[t]];if(void 0===s)throw new SyntaxError(`Non-${i} character`);c=c<<r|s,a+=r,a>=8&&(a-=8,o[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o})(t,i,r,e)})},{"../../vendor/base-x.js":"bImXU","../bytes.js":"6I0Ku"}],bImXU:[function(e,t,r){"use strict";var i=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw new TypeError(s+" is ambiguous");r[o]=n}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 i=0,n=0;e[t]===c;)i++,t++;for(var s=(e.length-t)*u+1>>>0,o=new Uint8Array(s);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var d=0,f=s-1;(0!==l||d<n)&&-1!==f;f--,d++)l+=a*o[f]>>>0,o[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");n=d,t++}if(" "!==e[t]){for(var h=s-n;h!==s&&0===o[h];)h++;for(var p=new Uint8Array(i+(s-h)),g=i;h!==s;)p[g++]=o[h++];return p}}}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 r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*l+1>>>0,u=new Uint8Array(o);n!==s;){for(var d=t[n],f=0,h=o-1;(0!==d||f<i)&&-1!==h;h--,f++)d+=256*u[h]>>>0,u[h]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");i=f,n++}for(var p=o-i;p!==o&&0===u[p];)p++;for(var g=c.repeat(r);p<o;++p)g+=e.charAt(u[p]);return g},decodeUnsafe:d,decode:function(e){var r=d(e);if(r)return r;throw new Error(`Non-${t} character`)}}};t.exports=i},{}],"5k9Tu":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./base.js");const n=i.rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),s=i.rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),o=i.rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),a=i.rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),c=i.rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),u=i.rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),l=i.rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),d=i.rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),f=i.rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});r.base32=n,r.base32hex=c,r.base32hexpad=l,r.base32hexpadupper=d,r.base32hexupper=u,r.base32pad=o,r.base32padupper=a,r.base32upper=s,r.base32z=f},{"./base.js":"6uTk1"}],ld3PU:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=new TextDecoder;function n(e,t){let r=0;for(let i=0;;i+=7){if(i>=64)throw new Error("protobuf: varint overflow");if(t>=e.length)throw new Error("protobuf: unexpected end of data");const n=e[t++];if(r+=i<28?(127&n)<<i:(127&n)*2**i,n<128)break}return[r,t]}function s(e,t){let r;[r,t]=n(e,t);const i=t+r;if(r<0||i<0)throw new Error("protobuf: invalid length");if(i>e.length)throw new Error("protobuf: unexpected end of data");return[e.subarray(t,i),i]}function o(e,t){let r;return[r,t]=n(e,t),[7&r,r>>3,t]}function a(e){const t={},r=e.length;let a=0;for(;a<r;){let r,c;if([r,c,a]=o(e,a),1===c){if(t.Hash)throw new Error("protobuf: (PBLink) duplicate Hash section");if(2!==r)throw new Error(`protobuf: (PBLink) wrong wireType (${r}) for Hash`);if(void 0!==t.Name)throw new Error("protobuf: (PBLink) invalid order, found Name before Hash");if(void 0!==t.Tsize)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Hash");[t.Hash,a]=s(e,a)}else if(2===c){if(void 0!==t.Name)throw new Error("protobuf: (PBLink) duplicate Name section");if(2!==r)throw new Error(`protobuf: (PBLink) wrong wireType (${r}) for Name`);if(void 0!==t.Tsize)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Name");let n;[n,a]=s(e,a),t.Name=i.decode(n)}else{if(3!==c)throw new Error(`protobuf: (PBLink) invalid fieldNumber, expected 1, 2 or 3, got ${c}`);if(void 0!==t.Tsize)throw new Error("protobuf: (PBLink) duplicate Tsize section");if(0!==r)throw new Error(`protobuf: (PBLink) wrong wireType (${r}) for Tsize`);[t.Tsize,a]=n(e,a)}}if(a>r)throw new Error("protobuf: (PBLink) unexpected end of data");return t}r.decodeNode=function(e){const t=e.length;let r,i,n=0,c=!1;for(;n<t;){let t,u;if([t,u,n]=o(e,n),2!==t)throw new Error(`protobuf: (PBNode) invalid wireType, expected 2, got ${t}`);if(1===u){if(i)throw new Error("protobuf: (PBNode) duplicate Data section");[i,n]=s(e,n),r&&(c=!0)}else{if(2!==u)throw new Error(`protobuf: (PBNode) invalid fieldNumber, expected 1 or 2, got ${u}`);{if(c)throw new Error("protobuf: (PBNode) duplicate Links section");let t;r||(r=[]),[t,n]=s(e,n),r.push(a(t))}}}if(n>t)throw new Error("protobuf: (PBNode) unexpected end of data");const u={};return i&&(u.Data=i),u.Links=r||[],u}},{}],"5nPbE":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=new TextEncoder,n=2**32;function s(e,t){let r=t.length;if("number"==typeof e.Tsize){if(e.Tsize<0)throw new Error("Tsize cannot be negative");if(!Number.isSafeInteger(e.Tsize))throw new Error("Tsize too large for encoding");r=a(t,r,e.Tsize)-1,t[r]=24}if("string"==typeof e.Name){const n=i.encode(e.Name);r-=n.length,t.set(n,r),r=a(t,r,n.length)-1,t[r]=18}return e.Hash&&(r-=e.Hash.length,t.set(e.Hash,r),r=a(t,r,e.Hash.length)-1,t[r]=10),t.length-r}function o(e){let t=0;if(e.Hash){const r=e.Hash.length;t+=1+r+c(r)}if("string"==typeof e.Name){const r=i.encode(e.Name).length;t+=1+r+c(r)}return"number"==typeof e.Tsize&&(t+=1+c(e.Tsize)),t}function a(e,t,r){const i=t-=c(r);for(;r>=2147483648;)e[t++]=127&r|128,r/=128;for(;r>=128;)e[t++]=127&r|128,r>>>=7;return e[t]=r,i}function c(e){return e%2==0&&e++,Math.floor((function(e){let t=0;e>=n&&(e=Math.floor(e/n),t=32);e>=65536&&(e>>>=16,t+=16);e>=256&&(e>>>=8,t+=8);return t+u[e]}(e)+6)/7)}const u=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8];r.encodeNode=function(e){const t=function(e){let t=0;if(e.Data){const r=e.Data.length;t+=1+r+c(r)}if(e.Links)for(const r of e.Links){const e=o(r);t+=1+e+c(e)}return t}(e),r=new Uint8Array(t);let i=t;if(e.Data&&(i-=e.Data.length,r.set(e.Data,i),i=a(r,i,e.Data.length)-1,r[i]=10),e.Links)for(let t=e.Links.length-1;t>=0;t--){const n=s(e.Links[t],r.subarray(0,i));i-=n,i=a(r,i,n)-1,r[i]=18}return r}},{}],"1YHGP":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid");const n=["Data","Links"],s=["Hash","Name","Tsize"],o=new TextEncoder;function a(e,t){if(e===t)return 0;const r=e.Name?o.encode(e.Name):[],i=t.Name?o.encode(t.Name):[];let n=r.length,s=i.length;for(let e=0,t=Math.min(n,s);e<t;++e)if(r[e]!==i[e]){n=r[e],s=i[e];break}return n<s?-1:s<n?1:0}function c(e,t){return!Object.keys(e).some((e=>!t.includes(e)))}function u(e){if("object"==typeof e.asCID){const t=i.CID.asCID(e);if(!t)throw new TypeError("Invalid DAG-PB form");return{Hash:t}}if("object"!=typeof e||Array.isArray(e))throw new TypeError("Invalid DAG-PB form");const t={};if(e.Hash){let r=i.CID.asCID(e.Hash);try{r||("string"==typeof e.Hash?r=i.CID.parse(e.Hash):e.Hash instanceof Uint8Array&&(r=i.CID.decode(e.Hash)))}catch(e){throw new TypeError(`Invalid DAG-PB form: ${e.message}`)}r&&(t.Hash=r)}if(!t.Hash)throw new TypeError("Invalid DAG-PB form");return"string"==typeof e.Name&&(t.Name=e.Name),"number"==typeof e.Tsize&&(t.Tsize=e.Tsize),t}function l(e){if((e instanceof Uint8Array||"string"==typeof e)&&(e={Data:e}),"object"!=typeof e||Array.isArray(e))throw new TypeError("Invalid DAG-PB form");const t={};if(void 0!==e.Data)if("string"==typeof e.Data)t.Data=o.encode(e.Data);else{if(!(e.Data instanceof Uint8Array))throw new TypeError("Invalid DAG-PB form");t.Data=e.Data}if(void 0!==e.Links){if(!Array.isArray(e.Links))throw new TypeError("Invalid DAG-PB form");t.Links=e.Links.map(u),t.Links.sort(a)}else t.Links=[];return t}r.createLink=function(e,t,r){return u({Hash:r,Name:e,Tsize:t})},r.createNode=function(e,t=[]){return l({Data:e,Links:t})},r.prepare=l,r.validate=function(e){if(!e||"object"!=typeof e||Array.isArray(e))throw new TypeError("Invalid DAG-PB form");if(!c(e,n))throw new TypeError("Invalid DAG-PB form (extraneous properties)");if(void 0!==e.Data&&!(e.Data instanceof Uint8Array))throw new TypeError("Invalid DAG-PB form (Data must be a Uint8Array)");if(!Array.isArray(e.Links))throw new TypeError("Invalid DAG-PB form (Links must be an array)");for(let t=0;t<e.Links.length;t++){const r=e.Links[t];if(!r||"object"!=typeof r||Array.isArray(r))throw new TypeError("Invalid DAG-PB form (bad link object)");if(!c(r,s))throw new TypeError("Invalid DAG-PB form (extraneous properties on link object)");if(!r.Hash)throw new TypeError("Invalid DAG-PB form (link must have a Hash)");if(r.Hash.asCID!==r.Hash)throw new TypeError("Invalid DAG-PB form (link Hash must be a CID)");if(void 0!==r.Name&&"string"!=typeof r.Name)throw new TypeError("Invalid DAG-PB form (link Name must be a string)");if(void 0!==r.Tsize&&("number"!=typeof r.Tsize||r.Tsize%1!=0))throw new TypeError("Invalid DAG-PB form (link Tsize must be an integer)");if(t>0&&-1===a(r,e.Links[t-1]))throw new TypeError("Invalid DAG-PB form (links must be sorted by Name bytes)")}}},{"multiformats/cid":"9ooAY"}],"3498i":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("cborg"),n=e("multiformats/cid");function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=s(i);const a={float64:!0,typeEncoders:{Object:function(e){if(e.asCID!==e)return null;const t=n.CID.asCID(e);if(!t)return null;const r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new o.Token(o.Type.tag,42),new o.Token(o.Type.bytes,r)]},undefined:function(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")},number:function(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}}};const c={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};c.tags[42]=function(e){if(0!==e[0])throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return n.CID.decode(e.subarray(1))};r.code=113,r.decode=e=>o.decode(e,c),r.encode=e=>o.encode(e,a),r.name="dag-cbor"},{cborg:"iZrkE","multiformats/cid":"9ooAY"}],iZrkE:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./lib/encode.js"),n=e("./lib/decode.js"),s=e("./lib/token.js");r.encode=i.encode,r.decode=n.decode,r.Token=s.Token,r.Type=s.Type},{"./lib/encode.js":"72LuQ","./lib/decode.js":"dbDwZ","./lib/token.js":"jVUGz"}],"72LuQ":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./is.js"),n=e("./token.js"),s=e("./bl.js"),o=e("./common.js"),a=e("./jump.js"),c=e("./byte-utils.js"),u=e("./0uint.js"),l=e("./1negint.js"),d=e("./2bytes.js"),f=e("./3string.js"),h=e("./4array.js"),p=e("./5map.js"),g=e("./6tag.js"),y=e("./7float.js");const m={float64:!1,mapSorter:function(e,t){const r=Array.isArray(e[0])?e[0][0]:e[0],i=Array.isArray(t[0])?t[0][0]:t[0];if(r.type!==i.type)return r.type.compare(i.type);const n=r.type.major,s=b[n].compareTokens(r,i);0===s&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone");return s},quickEncodeToken:a.quickEncodeToken},b=[];b[n.Type.uint.major]=u.encodeUint,b[n.Type.negint.major]=l.encodeNegint,b[n.Type.bytes.major]=d.encodeBytes,b[n.Type.string.major]=f.encodeString,b[n.Type.array.major]=h.encodeArray,b[n.Type.map.major]=p.encodeMap,b[n.Type.tag.major]=g.encodeTag,b[n.Type.float.major]=y.encodeFloat;const v=new s.Bl;class w{constructor(e,t){this.obj=e,this.parent=t}includes(e){let t=this;do{if(t.obj===e)return!0}while(t=t.parent);return!1}static createCheck(e,t){if(e&&e.includes(t))throw new Error(`${o.encodeErrPrefix} object contains circular references`);return new w(t,e)}}const _={null:new n.Token(n.Type.null,null),undefined:new n.Token(n.Type.undefined,void 0),true:new n.Token(n.Type.true,!0),false:new n.Token(n.Type.false,!1),emptyArray:new n.Token(n.Type.array,0),emptyMap:new n.Token(n.Type.map,0)},E={number:(e,t,r,i)=>Number.isInteger(e)&&Number.isSafeInteger(e)?e>=0?new n.Token(n.Type.uint,e):new n.Token(n.Type.negint,e):new n.Token(n.Type.float,e),bigint:(e,t,r,i)=>e>=BigInt(0)?new n.Token(n.Type.uint,e):new n.Token(n.Type.negint,e),Uint8Array:(e,t,r,i)=>new n.Token(n.Type.bytes,e),string:(e,t,r,i)=>new n.Token(n.Type.string,e),boolean:(e,t,r,i)=>e?_.true:_.false,null:(e,t,r,i)=>_.null,undefined:(e,t,r,i)=>_.undefined,ArrayBuffer:(e,t,r,i)=>new n.Token(n.Type.bytes,new Uint8Array(e)),DataView:(e,t,r,i)=>new n.Token(n.Type.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),Array(e,t,r,i){if(!e.length)return!0===r.addBreakTokens?[_.emptyArray,new n.Token(n.Type.break)]:_.emptyArray;i=w.createCheck(i,e);const s=[];let o=0;for(const t of e)s[o++]=S(t,r,i);return r.addBreakTokens?[new n.Token(n.Type.array,e.length),s,new n.Token(n.Type.break)]:[new n.Token(n.Type.array,e.length),s]},Object(e,t,r,i){const s="Object"!==t,o=s?e.keys():Object.keys(e),a=s?e.size:o.length;if(!a)return!0===r.addBreakTokens?[_.emptyMap,new n.Token(n.Type.break)]:_.emptyMap;i=w.createCheck(i,e);const c=[];let u=0;for(const t of o)c[u++]=[S(t,r,i),S(s?e.get(t):e[t],r,i)];return function(e,t){t.mapSorter&&e.sort(t.mapSorter)}(c,r),r.addBreakTokens?[new n.Token(n.Type.map,a),c,new n.Token(n.Type.break)]:[new n.Token(n.Type.map,a),c]}};E.Map=E.Object,E.Buffer=E.Uint8Array;for(const e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))E[`${e}Array`]=E.DataView;function S(e,t={},r){const n=i.is(e),s=t&&t.typeEncoders&&t.typeEncoders[n]||E[n];if("function"==typeof s){const i=s(e,n,t,r);if(null!=i)return i}const a=E[n];if(!a)throw new Error(`${o.encodeErrPrefix} unsupported type: ${n}`);return a(e,n,t,r)}function T(e,t,r,i){if(Array.isArray(t))for(const n of t)T(e,n,r,i);else r[t.type.major](e,t,i)}function A(e,t,r){const i=S(e,r);if(!Array.isArray(i)&&r.quickEncodeToken){const e=r.quickEncodeToken(i);if(e)return e;const n=t[i.type.major];if(n.encodedSize){const e=n.encodedSize(i,r),t=new s.Bl(e);if(n(t,i,r),1!==t.chunks.length)throw new Error(`Unexpected error: pre-calculated length for ${i} was wrong`);return c.asU8A(t.chunks[0])}}return T(v,i,t,r),v.toBytes(!0)}r.Ref=w,r.encode=function(e,t){return t=Object.assign({},m,t),A(e,b,t)},r.encodeCustom=A,r.objectToTokens=S},{"./is.js":"bPQoh","./token.js":"jVUGz","./bl.js":"25Ozo","./common.js":"aoxj4","./jump.js":"FaFBb","./byte-utils.js":"9dmLv","./0uint.js":"9zilL","./1negint.js":"2sjxL","./2bytes.js":"8Tv7U","./3string.js":"56Ua8","./4array.js":"4ePxQ","./5map.js":"28THk","./6tag.js":"5TCWp","./7float.js":"5T30n"}],bPQoh:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=["string","number","bigint","symbol"],n=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];r.is=function(e){if(null===e)return"null";if(void 0===e)return"undefined";if(!0===e||!1===e)return"boolean";const t=typeof e;if(i.includes(t))return t;if("function"===t)return"Function";if(Array.isArray(e))return"Array";if(function(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}(e))return"Buffer";const r=function(e){const t=Object.prototype.toString.call(e).slice(8,-1);return n.includes(t)?t:void 0}(e);return r||"Object"}},{}],jVUGz:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});class i{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}}i.uint=new i(0,"uint",!0),i.negint=new i(1,"negint",!0),i.bytes=new i(2,"bytes",!0),i.string=new i(3,"string",!0),i.array=new i(4,"array",!1),i.map=new i(5,"map",!1),i.tag=new i(6,"tag",!1),i.float=new i(7,"float",!0),i.false=new i(7,"false",!0),i.true=new i(7,"true",!0),i.null=new i(7,"null",!0),i.undefined=new i(7,"undefined",!0),i.break=new i(7,"break",!0);r.Token=class{constructor(e,t,r){this.type=e,this.value=t,this.encodedLength=r,this.encodedBytes=void 0}toString(){return`Token[${this.type}].${this.value}`}},r.Type=i},{}],"25Ozo":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./byte-utils.js");r.Bl=class{constructor(e=256){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.chunks=[],this.cursor=0,this.maxCursor=-1,null!==this._initReuseChunk&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){const r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){const e=t.length-(this.maxCursor-this.cursor)-1;e<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,e),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=i.alloc(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,null===this._initReuseChunk&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(1===this.chunks.length){const r=this.chunks[0];e&&this.cursor>r.length/2?(t=this.cursor===r.length?r:r.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=i.slice(r,0,this.cursor)}else t=i.concat(this.chunks,this.cursor);return e&&this.reset(),t}}},{"./byte-utils.js":"9dmLv"}],"9dmLv":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&"function"==typeof globalThis.Buffer.isBuffer,n=new TextDecoder,s=new TextEncoder;function o(e){return i&&globalThis.Buffer.isBuffer(e)}function a(e){return e instanceof Uint8Array?o(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}const c=i?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):m(e,t,r):(e,t,r)=>r-t>64?n.decode(e.subarray(t,r)):m(e,t,r),u=i?e=>e.length>64?globalThis.Buffer.from(e):y(e):e=>e.length>64?s.encode(e):y(e),l=i?(e,t,r)=>o(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),d=i?(e,t)=>(e=e.map((e=>e instanceof Uint8Array?e:globalThis.Buffer.from(e))),a(globalThis.Buffer.concat(e,t))):(e,t)=>{const r=new Uint8Array(t);let i=0;for(let t of e)i+t.length>r.length&&(t=t.subarray(0,r.length-i)),r.set(t,i),i+=t.length;return r},f=i?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e),h=i?e=>"string"==typeof e?e:globalThis.Buffer.from(g(e)).toString("hex"):e=>"string"==typeof e?e:Array.prototype.reduce.call(g(e),((e,t)=>`${e}${t.toString(16).padStart(2,"0")}`),""),p=i?e=>e instanceof Uint8Array?e:globalThis.Buffer.from(e,"hex"):e=>e instanceof Uint8Array?e:e.length?new Uint8Array(e.split("").map(((e,t,r)=>t%2==0?`0x${e}${r[t+1]}`:"")).filter(Boolean).map((e=>parseInt(e,16)))):new Uint8Array(0);function g(e){if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function y(e,t=1/0){let r;const i=e.length;let n=null;const s=[];for(let o=0;o<i;++o){if(r=e.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function m(e,t,r){const i=[];for(;t<r;){const n=e[t];let s=null,o=n>239?4:n>223?3:n>191?2:1;if(t+o<=r){let r,i,a,c;switch(o){case 1:n<128&&(s=n);break;case 2:r=e[t+1],128==(192&r)&&(c=(31&n)<<6|63&r,c>127&&(s=c));break;case 3:r=e[t+1],i=e[t+2],128==(192&r)&&128==(192&i)&&(c=(15&n)<<12|(63&r)<<6|63&i,c>2047&&(c<55296||c>57343)&&(s=c));break;case 4:r=e[t+1],i=e[t+2],a=e[t+3],128==(192&r)&&128==(192&i)&&128==(192&a)&&(c=(15&n)<<18|(63&r)<<12|(63&i)<<6|63&a,c>65535&&c<1114112&&(s=c))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),t+=o}return b(i)}function b(e){const t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);let r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=4096));return r}r.alloc=f,r.asU8A=a,r.compare=function(e,t){if(o(e)&&o(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0},r.concat=d,r.decodeCodePointsArray=b,r.fromArray=e=>Uint8Array.from(e),r.fromHex=p,r.fromString=u,r.slice=l,r.toHex=h,r.toString=c,r.useBuffer=i},{}],aoxj4:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i="CBOR decode error:",n=[];n[23]=1,n[24]=2,n[25]=3,n[26]=5,n[27]=9,r.assertEnoughData=function(e,t,r){if(e.length-t<r)throw new Error("CBOR decode error: not enough data for type")},r.decodeErrPrefix=i,r.encodeErrPrefix="CBOR encode error:",r.uintMinorPrefixBytes=n},{}],FaFBb:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./token.js"),n=e("./0uint.js"),s=e("./1negint.js"),o=e("./2bytes.js"),a=e("./3string.js"),c=e("./4array.js"),u=e("./5map.js"),l=e("./6tag.js"),d=e("./7float.js"),f=e("./common.js"),h=e("./byte-utils.js");function p(e,t,r){throw new Error(`${f.decodeErrPrefix} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function g(e){return()=>{throw new Error(`${f.decodeErrPrefix} ${e}`)}}const y=[];for(let e=0;e<=23;e++)y[e]=p;y[24]=n.decodeUint8,y[25]=n.decodeUint16,y[26]=n.decodeUint32,y[27]=n.decodeUint64,y[28]=p,y[29]=p,y[30]=p,y[31]=p;for(let e=32;e<=55;e++)y[e]=p;y[56]=s.decodeNegint8,y[57]=s.decodeNegint16,y[58]=s.decodeNegint32,y[59]=s.decodeNegint64,y[60]=p,y[61]=p,y[62]=p,y[63]=p;for(let e=64;e<=87;e++)y[e]=o.decodeBytesCompact;y[88]=o.decodeBytes8,y[89]=o.decodeBytes16,y[90]=o.decodeBytes32,y[91]=o.decodeBytes64,y[92]=p,y[93]=p,y[94]=p,y[95]=g("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)y[e]=a.decodeStringCompact;y[120]=a.decodeString8,y[121]=a.decodeString16,y[122]=a.decodeString32,y[123]=a.decodeString64,y[124]=p,y[125]=p,y[126]=p,y[127]=g("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)y[e]=c.decodeArrayCompact;y[152]=c.decodeArray8,y[153]=c.decodeArray16,y[154]=c.decodeArray32,y[155]=c.decodeArray64,y[156]=p,y[157]=p,y[158]=p,y[159]=c.decodeArrayIndefinite;for(let e=160;e<=183;e++)y[e]=u.decodeMapCompact;y[184]=u.decodeMap8,y[185]=u.decodeMap16,y[186]=u.decodeMap32,y[187]=u.decodeMap64,y[188]=p,y[189]=p,y[190]=p,y[191]=u.decodeMapIndefinite;for(let e=192;e<=215;e++)y[e]=l.decodeTagCompact;y[216]=l.decodeTag8,y[217]=l.decodeTag16,y[218]=l.decodeTag32,y[219]=l.decodeTag64,y[220]=p,y[221]=p,y[222]=p,y[223]=p;for(let e=224;e<=243;e++)y[e]=g("simple values are not supported");y[244]=p,y[245]=p,y[246]=p,y[247]=d.decodeUndefined,y[248]=g("simple values are not supported"),y[249]=d.decodeFloat16,y[250]=d.decodeFloat32,y[251]=d.decodeFloat64,y[252]=p,y[253]=p,y[254]=p,y[255]=d.decodeBreak;const m=[];for(let e=0;e<24;e++)m[e]=new i.Token(i.Type.uint,e,1);for(let e=-1;e>=-24;e--)m[31-e]=new i.Token(i.Type.negint,e,1);m[64]=new i.Token(i.Type.bytes,new Uint8Array(0),1),m[96]=new i.Token(i.Type.string,"",1),m[128]=new i.Token(i.Type.array,0,1),m[160]=new i.Token(i.Type.map,0,1),m[244]=new i.Token(i.Type.false,!1,1),m[245]=new i.Token(i.Type.true,!0,1),m[246]=new i.Token(i.Type.null,null,1),r.jump=y,r.quick=m,r.quickEncodeToken=function(e){switch(e.type){case i.Type.false:return h.fromArray([244]);case i.Type.true:return h.fromArray([245]);case i.Type.null:return h.fromArray([246]);case i.Type.bytes:return e.value.length?void 0:h.fromArray([64]);case i.Type.string:return""===e.value?h.fromArray([96]):void 0;case i.Type.array:return 0===e.value?h.fromArray([128]):void 0;case i.Type.map:return 0===e.value?h.fromArray([160]):void 0;case i.Type.uint:return e.value<24?h.fromArray([Number(e.value)]):void 0;case i.Type.negint:if(e.value>=-24)return h.fromArray([31-Number(e.value)])}}},{"./token.js":"jVUGz","./0uint.js":"9zilL","./1negint.js":"2sjxL","./2bytes.js":"8Tv7U","./3string.js":"56Ua8","./4array.js":"4ePxQ","./5map.js":"28THk","./6tag.js":"5TCWp","./7float.js":"5T30n","./common.js":"aoxj4","./byte-utils.js":"9dmLv"}],"9zilL":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./token.js"),n=e("./common.js");const s=[24,256,65536,4294967296,BigInt("18446744073709551616")];function o(e,t,r){n.assertEnoughData(e,t,1);const i=e[t];if(!0===r.strict&&i<s[0])throw new Error(`${n.decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);return i}function a(e,t,r){n.assertEnoughData(e,t,2);const i=e[t]<<8|e[t+1];if(!0===r.strict&&i<s[1])throw new Error(`${n.decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);return i}function c(e,t,r){n.assertEnoughData(e,t,4);const i=16777216*e[t]+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(!0===r.strict&&i<s[2])throw new Error(`${n.decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);return i}function u(e,t,r){n.assertEnoughData(e,t,8);const i=16777216*e[t]+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],o=16777216*e[t+4]+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],a=(BigInt(i)<<BigInt(32))+BigInt(o);if(!0===r.strict&&a<s[3])throw new Error(`${n.decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);if(a<=Number.MAX_SAFE_INTEGER)return Number(a);if(!0===r.allowBigInt)return a;throw new Error(`${n.decodeErrPrefix} integers outside of the safe integer range are not supported`)}function l(e,t){return d(e,0,t.value)}function d(e,t,r){if(r<s[0]){const i=Number(r);e.push([t|i])}else if(r<s[1]){const i=Number(r);e.push([24|t,i])}else if(r<s[2]){const i=Number(r);e.push([25|t,i>>>8,255&i])}else if(r<s[3]){const i=Number(r);e.push([26|t,i>>>24&255,i>>>16&255,i>>>8&255,255&i])}else{const i=BigInt(r);if(!(i<s[4]))throw new Error(`${n.decodeErrPrefix} encountered BigInt larger than allowable range`);{const r=[27|t,0,0,0,0,0,0,0];let n=Number(i&BigInt(4294967295)),s=Number(i>>BigInt(32)&BigInt(4294967295));r[8]=255&n,n>>=8,r[7]=255&n,n>>=8,r[6]=255&n,n>>=8,r[5]=255&n,r[4]=255&s,s>>=8,r[3]=255&s,s>>=8,r[2]=255&s,s>>=8,r[1]=255&s,e.push(r)}}}l.encodedSize=function(e){return d.encodedSize(e.value)},d.encodedSize=function(e){return e<s[0]?1:e<s[1]?2:e<s[2]?3:e<s[3]?5:9},l.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0},r.decodeUint16=function(e,t,r,n){return new i.Token(i.Type.uint,a(e,t+1,n),3)},r.decodeUint32=function(e,t,r,n){return new i.Token(i.Type.uint,c(e,t+1,n),5)},r.decodeUint64=function(e,t,r,n){return new i.Token(i.Type.uint,u(e,t+1,n),9)},r.decodeUint8=function(e,t,r,n){return new i.Token(i.Type.uint,o(e,t+1,n),2)},r.encodeUint=l,r.encodeUintValue=d,r.readUint16=a,r.readUint32=c,r.readUint64=u,r.readUint8=o,r.uintBoundaries=s},{"./token.js":"jVUGz","./common.js":"aoxj4"}],"2sjxL":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./token.js"),n=e("./0uint.js"),s=e("./common.js");const o=BigInt(-1),a=BigInt(1);function c(e,t){const r=t.value,i="bigint"==typeof r?r*o-a:-1*r-1;n.encodeUintValue(e,t.type.majorEncoded,i)}c.encodedSize=function(e){const t=e.value,r="bigint"==typeof t?t*o-a:-1*t-1;return r<n.uintBoundaries[0]?1:r<n.uintBoundaries[1]?2:r<n.uintBoundaries[2]?3:r<n.uintBoundaries[3]?5:9},c.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0},r.decodeNegint16=function(e,t,r,s){return new i.Token(i.Type.negint,-1-n.readUint16(e,t+1,s),3)},r.decodeNegint32=function(e,t,r,s){return new i.Token(i.Type.negint,-1-n.readUint32(e,t+1,s),5)},r.decodeNegint64=function(e,t,r,a){const c=n.readUint64(e,t+1,a);if("bigint"!=typeof c){const e=-1-c;if(e>=Number.MIN_SAFE_INTEGER)return new i.Token(i.Type.negint,e,9)}if(!0!==a.allowBigInt)throw new Error(`${s.decodeErrPrefix} integers outside of the safe integer range are not supported`);return new i.Token(i.Type.negint,o-BigInt(c),9)},r.decodeNegint8=function(e,t,r,s){return new i.Token(i.Type.negint,-1-n.readUint8(e,t+1,s),2)},r.encodeNegint=c},{"./token.js":"jVUGz","./0uint.js":"9zilL","./common.js":"aoxj4"}],"8Tv7U":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./token.js"),n=e("./common.js"),s=e("./0uint.js"),o=e("./byte-utils.js");function a(e,t,r,s){n.assertEnoughData(e,t,r+s);const a=o.slice(e,t+r,t+r+s);return new i.Token(i.Type.bytes,a,r+s)}function c(e){return void 0===e.encodedBytes&&(e.encodedBytes=e.type===i.Type.string?o.fromString(e.value):e.value),e.encodedBytes}function u(e,t){const r=c(t);s.encodeUintValue(e,t.type.majorEncoded,r.length),e.push(r)}function l(e,t){return e.length<t.length?-1:e.length>t.length?1:o.compare(e,t)}u.encodedSize=function(e){const t=c(e);return s.encodeUintValue.encodedSize(t.length)+t.length},u.compareTokens=function(e,t){return l(c(e),c(t))},r.compareBytes=l,r.decodeBytes16=function(e,t,r,i){return a(e,t,3,s.readUint16(e,t+1,i))},r.decodeBytes32=function(e,t,r,i){return a(e,t,5,s.readUint32(e,t+1,i))},r.decodeBytes64=function(e,t,r,i){const o=s.readUint64(e,t+1,i);if("bigint"==typeof o)throw new Error(`${n.decodeErrPrefix} 64-bit integer bytes lengths not supported`);return a(e,t,9,o)},r.decodeBytes8=function(e,t,r,i){return a(e,t,2,s.readUint8(e,t+1,i))},r.decodeBytesCompact=function(e,t,r,i){return a(e,t,1,r)},r.encodeBytes=u},{"./token.js":"jVUGz","./common.js":"aoxj4","./0uint.js":"9zilL","./byte-utils.js":"9dmLv"}],"56Ua8":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./token.js"),n=e("./common.js"),s=e("./0uint.js"),o=e("./2bytes.js"),a=e("./byte-utils.js");function c(e,t,r,s){const o=r+s;return n.assertEnoughData(e,t,o),new i.Token(i.Type.string,a.toString(e,t+r,t+o),o)}const u=o.encodeBytes;r.decodeString16=function(e,t,r,i){return c(e,t,3,s.readUint16(e,t+1,i))},r.decodeString32=function(e,t,r,i){return c(e,t,5,s.readUint32(e,t+1,i))},r.decodeString64=function(e,t,r,i){const o=s.readUint64(e,t+1,i);if("bigint"==typeof o)throw new Error(`${n.decodeErrPrefix} 64-bit integer string lengths not supported`);return c(e,t,9,o)},r.decodeString8=function(e,t,r,i){return c(e,t,2,s.readUint8(e,t+1,i))},r.decodeStringCompact=function(e,t,r,i){return c(e,t,1,r)},r.encodeString=u},{"./token.js":"jVUGz","./common.js":"aoxj4","./0uint.js":"9zilL","./2bytes.js":"8Tv7U","./byte-utils.js":"9dmLv"}],"4ePxQ":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./token.js"),n=e("./0uint.js"),s=e("./common.js");function o(e,t,r,n){return new i.Token(i.Type.array,n,r)}function a(e,t){n.encodeUintValue(e,i.Type.array.majorEncoded,t.value)}a.compareTokens=n.encodeUint.compareTokens,r.decodeArray16=function(e,t,r,i){return o(0,0,3,n.readUint16(e,t+1,i))},r.decodeArray32=function(e,t,r,i){return o(0,0,5,n.readUint32(e,t+1,i))},r.decodeArray64=function(e,t,r,i){const a=n.readUint64(e,t+1,i);if("bigint"==typeof a)throw new Error(`${s.decodeErrPrefix} 64-bit integer array lengths not supported`);return o(0,0,9,a)},r.decodeArray8=function(e,t,r,i){return o(0,0,2,n.readUint8(e,t+1,i))},r.decodeArrayCompact=function(e,t,r,i){return o(0,0,1,r)},r.decodeArrayIndefinite=function(e,t,r,i){if(!1===i.allowIndefinite)throw new Error(`${s.decodeErrPrefix} indefinite length items not allowed`);return o(0,0,1,1/0)},r.encodeArray=a},{"./token.js":"jVUGz","./0uint.js":"9zilL","./common.js":"aoxj4"}],"28THk":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./token.js"),n=e("./0uint.js"),s=e("./common.js");function o(e,t,r,n){return new i.Token(i.Type.map,n,r)}function a(e,t){n.encodeUintValue(e,i.Type.map.majorEncoded,t.value)}a.compareTokens=n.encodeUint.compareTokens,r.decodeMap16=function(e,t,r,i){return o(0,0,3,n.readUint16(e,t+1,i))},r.decodeMap32=function(e,t,r,i){return o(0,0,5,n.readUint32(e,t+1,i))},r.decodeMap64=function(e,t,r,i){const a=n.readUint64(e,t+1,i);if("bigint"==typeof a)throw new Error(`${s.decodeErrPrefix} 64-bit integer map lengths not supported`);return o(0,0,9,a)},r.decodeMap8=function(e,t,r,i){return o(0,0,2,n.readUint8(e,t+1,i))},r.decodeMapCompact=function(e,t,r,i){return o(0,0,1,r)},r.decodeMapIndefinite=function(e,t,r,i){if(!1===i.allowIndefinite)throw new Error(`${s.decodeErrPrefix} indefinite length items not allowed`);return o(0,0,1,1/0)},r.encodeMap=a},{"./token.js":"jVUGz","./0uint.js":"9zilL","./common.js":"aoxj4"}],"5TCWp":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./token.js"),n=e("./0uint.js");function s(e,t){n.encodeUintValue(e,i.Type.tag.majorEncoded,t.value)}s.compareTokens=n.encodeUint.compareTokens,r.decodeTag16=function(e,t,r,s){return new i.Token(i.Type.tag,n.readUint16(e,t+1,s),3)},r.decodeTag32=function(e,t,r,s){return new i.Token(i.Type.tag,n.readUint32(e,t+1,s),5)},r.decodeTag64=function(e,t,r,s){return new i.Token(i.Type.tag,n.readUint64(e,t+1,s),9)},r.decodeTag8=function(e,t,r,s){return new i.Token(i.Type.tag,n.readUint8(e,t+1,s),2)},r.decodeTagCompact=function(e,t,r,n){return new i.Token(i.Type.tag,r,1)},r.encodeTag=s},{"./token.js":"jVUGz","./0uint.js":"9zilL"}],"5T30n":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./token.js"),n=e("./common.js"),s=e("./0uint.js");function o(e,t,r){if(r){if(!1===r.allowNaN&&Number.isNaN(e))throw new Error(`${n.decodeErrPrefix} NaN values are not supported`);if(!1===r.allowInfinity&&(e===1/0||e===-1/0))throw new Error(`${n.decodeErrPrefix} Infinity values are not supported`)}return new i.Token(i.Type.float,e,t)}function a(e,t,r){const n=t.value;if(!1===n)e.push([20|i.Type.float.majorEncoded]);else if(!0===n)e.push([21|i.Type.float.majorEncoded]);else if(null===n)e.push([22|i.Type.float.majorEncoded]);else if(void 0===n)e.push([23|i.Type.float.majorEncoded]);else{let t,i=!1;r&&!0===r.float64||(d(n),t=f(l,1),n===t||Number.isNaN(n)?(l[0]=249,e.push(l.slice(0,3)),i=!0):(h(n),t=p(l,1),n===t&&(l[0]=250,e.push(l.slice(0,5)),i=!0))),i||(s=n,u.setFloat64(0,s,!1),t=g(l,1),l[0]=251,e.push(l.slice(0,9)))}var s}a.encodedSize=function(e,t){const r=e.value;if(!1===r||!0===r||null==r)return 1;let i;if(!t||!0!==t.float64){if(d(r),i=f(l,1),r===i||Number.isNaN(r))return 3;if(h(r),i=p(l,1),r===i)return 5}return 9};const c=new ArrayBuffer(9),u=new DataView(c,1),l=new Uint8Array(c,0);function d(e){if(e===1/0)u.setUint16(0,31744,!1);else if(e===-1/0)u.setUint16(0,64512,!1);else if(Number.isNaN(e))u.setUint16(0,32256,!1);else{u.setFloat32(0,e);const t=u.getUint32(0),r=(2139095040&t)>>23,i=8388607&t;if(255===r)u.setUint16(0,31744,!1);else if(0===r)u.setUint16(0,(2147483648&e)>>16|i>>13,!1);else{const e=r-127;e<-24?u.setUint16(0,0):e<-14?u.setUint16(0,(2147483648&t)>>16|1<<24+e,!1):u.setUint16(0,(2147483648&t)>>16|e+15<<10|i>>13,!1)}}}function f(e,t){if(e.length-t<2)throw new Error(`${n.decodeErrPrefix} not enough data for float16`);const r=(e[t]<<8)+e[t+1];if(31744===r)return 1/0;if(64512===r)return-1/0;if(32256===r)return NaN;const i=r>>10&31,s=1023&r;let o;return o=0===i?s*2**-24:31!==i?(s+1024)*2**(i-25):0===s?1/0:NaN,32768&r?-o:o}function h(e){u.setFloat32(0,e,!1)}function p(e,t){if(e.length-t<4)throw new Error(`${n.decodeErrPrefix} not enough data for float32`);const r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function g(e,t){if(e.length-t<8)throw new Error(`${n.decodeErrPrefix} not enough data for float64`);const r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}a.compareTokens=s.encodeUint.compareTokens,r.decodeBreak=function(e,t,r,s){if(!1===s.allowIndefinite)throw new Error(`${n.decodeErrPrefix} indefinite length items not allowed`);return new i.Token(i.Type.break,void 0,1)},r.decodeFloat16=function(e,t,r,i){return o(f(e,t+1),3,i)},r.decodeFloat32=function(e,t,r,i){return o(p(e,t+1),5,i)},r.decodeFloat64=function(e,t,r,i){return o(g(e,t+1),9,i)},r.decodeUndefined=function(e,t,r,s){if(!1===s.allowUndefined)throw new Error(`${n.decodeErrPrefix} undefined values are not supported`);return new i.Token(i.Type.undefined,void 0,1)},r.encodeFloat=a},{"./token.js":"jVUGz","./common.js":"aoxj4","./0uint.js":"9zilL"}],dbDwZ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./common.js"),n=e("./token.js"),s=e("./jump.js");const o={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0};class a{constructor(e,t={}){this.pos=0,this.data=e,this.options=t}done(){return this.pos>=this.data.length}next(){const e=this.data[this.pos];let t=s.quick[e];if(void 0===t){const r=s.jump[e];if(!r)throw new Error(`${i.decodeErrPrefix} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);const n=31&e;t=r(this.data,this.pos,n,this.options)}return this.pos+=t.encodedLength,t}}const c=Symbol.for("DONE"),u=Symbol.for("BREAK");function l(e,t){if(e.done())return c;const r=e.next();if(r.type===n.Type.break)return u;if(r.type.terminal)return r.value;if(r.type===n.Type.array)return function(e,t,r){const n=[];for(let s=0;s<e.value;s++){const o=l(t,r);if(o===u){if(e.value===1/0)break;throw new Error(`${i.decodeErrPrefix} got unexpected break to lengthed array`)}if(o===c)throw new Error(`${i.decodeErrPrefix} found array but not enough entries (got ${s}, expected ${e.value})`);n[s]=o}return n}(r,e,t);if(r.type===n.Type.map)return function(e,t,r){const n=!0===r.useMaps,s=n?void 0:{},o=n?new Map:void 0;for(let a=0;a<e.value;a++){const d=l(t,r);if(d===u){if(e.value===1/0)break;throw new Error(`${i.decodeErrPrefix} got unexpected break to lengthed map`)}if(d===c)throw new Error(`${i.decodeErrPrefix} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(!0!==n&&"string"!=typeof d)throw new Error(`${i.decodeErrPrefix} non-string keys not supported (got ${typeof d})`);const f=l(t,r);if(f===c)throw new Error(`${i.decodeErrPrefix} found map but not enough entries (got ${a} [no value], expected ${e.value})`);n?o.set(d,f):s[d]=f}return n?o:s}(r,e,t);if(r.type===n.Type.tag){if(t.tags&&"function"==typeof t.tags[r.value]){const i=l(e,t);return t.tags[r.value](i)}throw new Error(`${i.decodeErrPrefix} tag not supported (${r.value})`)}throw new Error("unsupported")}r.Tokeniser=a,r.decode=function(e,t){if(!(e instanceof Uint8Array))throw new Error(`${i.decodeErrPrefix} data to decode must be a Uint8Array`);const r=(t=Object.assign({},o,t)).tokenizer||new a(e,t),n=l(r,t);if(n===c)throw new Error(`${i.decodeErrPrefix} did not find any content to decode`);if(n===u)throw new Error(`${i.decodeErrPrefix} got unexpected break`);if(!r.done())throw new Error(`${i.decodeErrPrefix} too many terminals, data makes no sense`);return n},r.tokensToObject=l},{"./common.js":"aoxj4","./token.js":"jVUGz","./jump.js":"FaFBb"}],eYCZn:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./hasher.js"),n=e("../bytes.js");const s=i.from({name:"identity",code:0,encode:e=>n.coerce(e)});r.identity=s},{"./hasher.js":"5z3Qi","../bytes.js":"6I0Ku"}],"5z3Qi":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./digest.js");class n{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}async digest(e){if(e instanceof Uint8Array){const t=await this.encode(e);return i.create(this.code,t)}throw Error("Unknown type, must be binary type")}}r.Hasher=n,r.from=({name:e,code:t,encode:r})=>new n(e,t,r)},{"./digest.js":"kpRBg"}],lPcQG:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./bases/identity.js"),n=e("./bases/base2.js"),s=e("./bases/base8.js"),o=e("./bases/base10.js"),a=e("./bases/base16.js"),c=e("./bases/base32.js"),u=e("./bases/base36.js"),l=e("./bases/base58.js"),d=e("./bases/base64.js"),f=e("./hashes/sha2.js"),h=e("./hashes/identity.js"),p=e("./codecs/raw.js"),g=e("./codecs/json.js");e("./index.js");var y=e("./cid.js"),m=e("./hashes/hasher.js"),b=e("./hashes/digest.js"),v=e("./varint.js"),w=e("./bytes.js");const _={...i,...n,...s,...o,...a,...c,...u,...l,...d},E={...f,...h},S={raw:p,json:g};r.CID=y.CID,r.hasher=m,r.digest=b,r.varint=v,r.bytes=w,r.bases=_,r.codecs=S,r.hashes=E},{"./bases/identity.js":"4EVux","./bases/base2.js":"5EiC2","./bases/base8.js":"bGEV7","./bases/base10.js":"esjPe","./bases/base16.js":"iQzgO","./bases/base32.js":"5k9Tu","./bases/base36.js":"7VmDr","./bases/base58.js":"4n7mA","./bases/base64.js":"gaFBW","./hashes/sha2.js":"7i9MT","./hashes/identity.js":"eYCZn","./codecs/raw.js":"fdfgp","./codecs/json.js":"cRmep","./index.js":"3ANyW","./cid.js":"9ooAY","./hashes/hasher.js":"5z3Qi","./hashes/digest.js":"kpRBg","./varint.js":"ivDPm","./bytes.js":"6I0Ku"}],"4EVux":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./base.js"),n=e("../bytes.js");const s=i.from({prefix:"\0",name:"identity",encode:e=>n.toString(e),decode:e=>n.fromString(e)});r.identity=s},{"./base.js":"6uTk1","../bytes.js":"6I0Ku"}],"5EiC2":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=e("./base.js").rfc4648({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});r.base2=i},{"./base.js":"6uTk1"}],bGEV7:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=e("./base.js").rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});r.base8=i},{"./base.js":"6uTk1"}],esjPe:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=e("./base.js").baseX({prefix:"9",name:"base10",alphabet:"0123456789"});r.base10=i},{"./base.js":"6uTk1"}],iQzgO:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./base.js");const n=i.rfc4648({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),s=i.rfc4648({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});r.base16=n,r.base16upper=s},{"./base.js":"6uTk1"}],"7VmDr":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./base.js");const n=i.baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),s=i.baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});r.base36=n,r.base36upper=s},{"./base.js":"6uTk1"}],gaFBW:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./base.js");const n=i.rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),s=i.rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),o=i.rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),a=i.rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});r.base64=n,r.base64pad=s,r.base64url=o,r.base64urlpad=a},{"./base.js":"6uTk1"}],"7i9MT":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./hasher.js");const n=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),s=i.from({name:"sha2-256",code:18,encode:n("SHA-256")}),o=i.from({name:"sha2-512",code:19,encode:n("SHA-512")});r.sha256=s,r.sha512=o},{"./hasher.js":"5z3Qi"}],fdfgp:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../bytes.js");r.code=85,r.decode=e=>i.coerce(e),r.encode=e=>i.coerce(e),r.name="raw"},{"../bytes.js":"6I0Ku"}],cRmep:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=new TextEncoder,n=new TextDecoder;r.code=512,r.decode=e=>JSON.parse(n.decode(e)),r.encode=e=>i.encode(JSON.stringify(e)),r.name="json"},{}],"3ANyW":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./cid.js"),n=e("./varint.js"),s=e("./bytes.js"),o=e("./hashes/hasher.js"),a=e("./hashes/digest.js");r.CID=i.CID,r.varint=n,r.bytes=s,r.hasher=o,r.digest=a},{"./cid.js":"9ooAY","./varint.js":"ivDPm","./bytes.js":"6I0Ku","./hashes/hasher.js":"5z3Qi","./hashes/digest.js":"kpRBg"}],d1lP3:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.initAssets=function(){}},{}],j69o8:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});class i extends Error{constructor(e="not initialized"){super(e),this.name="NotInitializedError",this.code=i.code}}i.code="ERR_NOT_INITIALIZED";class n extends Error{constructor(e="cannot initialize an initializing node"){super(e),this.name="AlreadyInitializingError",this.code=s.code}}n.code="ERR_ALREADY_INITIALIZING";class s extends Error{constructor(e="cannot re-initialize an initialized node"){super(e),this.name="AlreadyInitializedError",this.code=s.code}}s.code="ERR_ALREADY_INITIALIZED";class o extends Error{constructor(e="not started"){super(e),this.name="NotStartedError",this.code=o.code}}o.code="ERR_NOT_STARTED";class a extends Error{constructor(e="cannot start, already startin"){super(e),this.name="AlreadyStartingError",this.code=a.code}}a.code="ERR_ALREADY_STARTING";class c extends Error{constructor(e="cannot start, already started"){super(e),this.name="AlreadyStartedError",this.code=c.code}}c.code="ERR_ALREADY_STARTED";class u extends Error{constructor(e="not enabled"){super(e),this.name="NotEnabledError",this.code=u.code}}u.code="ERR_NOT_ENABLED",r.AlreadyInitializedError=s,r.AlreadyInitializingError=n,r.AlreadyStartedError=c,r.AlreadyStartingError=a,r.NotEnabledError=u,r.NotInitializedError=i,r.NotStartedError=o},{}],dF7Y4:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./util/bases.js");r.fromString=function(e,t="utf8"){const r=i[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return r.decoder.decode(`${r.prefix}${e}`)}},{"./util/bases.js":"6UNPX"}],"6UNPX":[function(e,t,r){"use strict";var i=e("multiformats/basics");function n(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}const s=n("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),o=n("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{e=e.substring(1);const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),a={utf8:s,"utf-8":s,hex:i.bases.base16,latin1:o,ascii:o,binary:o,...i.bases};t.exports=a},{"multiformats/basics":"lPcQG"}],"93XEg":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../utils/service.js");r.createStart=function({network:e,preload:t,peerId:r,keychain:n,repo:s,ipns:o,mfsPreload:a,print:c,options:u}){return async()=>{const{libp2p:l}=await i.Service.start(e,{peerId:r,repo:s,print:c,options:u});await Promise.all([o.startOnline({keychain:n,libp2p:l,peerId:r,repo:s}),t.start(),a.start()])}}},{"../utils/service.js":"ethcf"}],ethcf:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../errors.js"),n=e("../utils.js");class s{static create({start:e,stop:t}){return new s(e,t)}static async start(e,t){const{state:r,activate:n}=e;switch(r.status){case"stopped":try{const r=n(t);e.state={status:"starting",ready:r};const i=await r;return e.state={status:"started",value:i},i}catch(t){throw e.state={status:"stopped"},t}case"starting":throw new i.AlreadyStartingError;case"started":throw new i.AlreadyStartedError;case"stopping":return await r.ready,await s.start(e,t);default:return s.panic(e)}}static async stop(e){const{state:t,deactivate:r}=e;switch(t.status){case"stopped":break;case"starting":try{await t.ready}catch(e){}return await s.stop(e);case"stopping":return await t.ready;case"started":r&&await r(t.value),e.state={status:"stopped"};break;default:s.panic(t)}}static try({state:e}){return"started"===e.status?e.value:null}static async use({state:e},t){switch(e.status){case"started":return e.value;case"starting":return await n.withTimeout(e.ready,t);default:throw new i.NotStartedError}}static panic({state:e}){const t=JSON.stringify({status:e.status});throw RangeError(`Service in invalid state ${t}, should never happen if you see this please report a bug`)}constructor(e,t){this.activate=e,this.deactivate=t,this.state={status:"stopped"}}async use(e){return await s.use(this,e)}try(){return s.try(this)}}r.Service=s},{"../errors.js":"j69o8","../utils.js":"cT4uN"}],cT4uN:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("is-ipfs"),n=e("multiformats/cid"),s=e("interface-datastore/key"),o=e("err-code"),a=e("ipfs-core-utils/with-timeout-option"),c=e("ipfs-core-utils/to-cid-and-path"),u=e("@ipld/dag-pb");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var f=l(i),h=l(o),p=d(u);const g=new s.Key("/local/filesroot"),y=a.withTimeoutOption((async(e,t)=>await e)),m=async function*(e,t,r,i,s){const o=async e=>{const t=await r.getCodec(e.code),n=await i.blocks.get(e,s);return t.decode(n)},a=t.split("/").filter(Boolean);let c=await o(e),u=e;for(a.length||(yield{value:c,remainderPath:""});a.length;){const r=a.shift();if(!r)throw h.default(new Error(`Could not resolve path "${t}"`),"ERR_INVALID_PATH");if(e.code===p.code&&Array.isArray(c.Links)){const e=c.Links.find((e=>e.Name===r));if(e){yield{value:e.Hash,remainderPath:a.join("/")},c=await o(e.Hash),u=e.Hash;continue}}if(!Object.prototype.hasOwnProperty.call(c,r))throw h.default(new Error(`no link named "${r}" under ${u}`),"ERR_NO_LINK");c=c[r],yield{value:c,remainderPath:a.join("/")},n.CID.asCID(c)&&(u=c,c=await o(c))}};r.MFS_MAX_CHUNK_SIZE=262144,r.MFS_MAX_LINKS=174,r.MFS_ROOT_KEY=g,r.OFFLINE_ERROR="This command must be run in online mode. Try running 'ipfs daemon' first.",r.mapFile=e=>{if("file"!==e.type&&"directory"!==e.type&&"raw"!==e.type)throw new Error(`Unknown node type '${e.type}'`);const t={cid:e.cid,path:e.path,name:e.name,size:e.size,type:"file"};return"directory"===e.type&&(t.type="dir"),"file"===e.type&&(t.size=e.unixfs.fileSize()),"file"!==e.type&&"directory"!==e.type||(t.mode=e.unixfs.mode,void 0!==e.unixfs.mtime&&(t.mtime=e.unixfs.mtime)),t},r.normalizeCidPath=e=>e instanceof Uint8Array?n.CID.decode(e).toString():(0===(e=e.toString()).indexOf("/ipfs/")&&(e=e.substring(6)),"/"===e.charAt(e.length-1)&&(e=e.substring(0,e.length-1)),e),r.normalizePath=e=>{if(n.CID.asCID(e))return`/ipfs/${e}`;const t=e.toString();try{return`/ipfs/${n.CID.parse(t)}`}catch{}if(f.default.path(t))return t;throw h.default(new Error(`invalid path: ${e}`),"ERR_BAD_PATH")},r.resolve=m,r.resolvePath=async function(e,t,r,i={}){const{cid:s,path:o}=c.toCidAndPath(r);o&&(i.path=o);let a=s,u=i.path||"";if(u.startsWith("/")&&(u=u.substring(1)),i.path)try{for await(const{value:r,remainderPath:o}of m(s,i.path,t,e,{signal:i.signal})){if(!n.CID.asCID(r))break;u=o,a=r}}catch(e){throw e.message.startsWith("Object has no property")&&(e.message=`no link named "${u.split("/")[0]}" under ${a}`,e.code="ERR_NO_LINK"),e}return{cid:a,remainderPath:u||""}},r.withTimeout=y},{"is-ipfs":"40iuV","multiformats/cid":"9ooAY","interface-datastore/key":"9hGOz","err-code":"chZjB","ipfs-core-utils/with-timeout-option":"j29MK","ipfs-core-utils/to-cid-and-path":"jN5CZ","@ipld/dag-pb":"i2cdx"}],"40iuV":[function(e,t,r){"use strict";const{base58btc:i}=e("multiformats/bases/base58"),{base32:n}=e("multiformats/bases/base32"),s=e("multiformats/hashes/digest"),{Multiaddr:o}=e("multiaddr"),a=e("mafmt"),{CID:c}=e("multiformats/cid"),{URL:u}=e("iso-url"),{toString:l}=e("uint8arrays/to-string"),d=/^https?:\/\/[^/]+\/(ip[fn]s)\/([^/?#]+)/,f=/^\/(ip[fn]s)\/([^/?#]+)/,h=/^https?:\/\/([^/]+)\.(ip[fn]s)\.[^/?]+/,p=/^(([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])\.)+([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])$/;function g(e){try{return"string"==typeof e?Boolean(c.parse(e)):e instanceof Uint8Array?Boolean(c.decode(e)):Boolean(c.asCID(e))}catch(e){return!1}}function y(e){if(!e)return!1;if(o.isMultiaddr(e))return!0;try{return new o(e),!0}catch(e){return!1}}function m(e,t,r=1,i=2){const n=w(e);if(!n)return!1;const s=n.match(t);if(!s)return!1;if("ipfs"!==s[r])return!1;let o=s[i];return o&&t===h&&(o=o.toLowerCase()),g(o)}function b(e,t,r=1,i=2){const n=w(e);if(!n)return!1;const s=n.match(t);if(!s)return!1;if("ipns"!==s[r])return!1;let o=s[i];if(o&&t===h){if(o=o.toLowerCase(),g(o))return!0;try{!o.includes(".")&&o.includes("-")&&(o=o.replace(/--/g,"@").replace(/-/g,".").replace(/@/g,"-"));const{hostname:e}=new u(`http://${o}`);return p.test(e)}catch(e){return!1}}return!0}function v(e){return"string"==typeof e}function w(e){return e instanceof Uint8Array?l(e,"base58btc"):!!v(e)&&e}const _=e=>m(e,h,2,1),E=e=>b(e,h,2,1),S=e=>_(e)||E(e),T=e=>m(e,d)||_(e),A=e=>b(e,d)||E(e),k=e=>T(e)||A(e)||S(e),I=e=>m(e,f)||b(e,f);t.exports={multihash:function(e){const t=w(e);try{s.decode(i.decode("z"+t))}catch{return!1}return!0},multiaddr:y,peerMultiaddr:function(e){return y(e)&&a.P2P.matches(e)},cid:g,base32cid:e=>function(e){try{n.decode(e)}catch{return!1}return!0}(e)&&g(e),ipfsSubdomain:_,ipnsSubdomain:E,subdomain:S,subdomainGatewayPattern:h,ipfsUrl:T,ipnsUrl:A,url:k,pathGatewayPattern:d,ipfsPath:e=>m(e,f),ipnsPath:e=>b(e,f),path:I,pathPattern:f,urlOrPath:e=>k(e)||I(e),cidPath:e=>v(e)&&!g(e)&&m(`/ipfs/${e}`,f)}},{"multiformats/bases/base58":"4n7mA","multiformats/bases/base32":"5k9Tu","multiformats/hashes/digest":"kpRBg",multiaddr:"8Mu1u",mafmt:"l1lok","multiformats/cid":"9ooAY","iso-url":"86VPZ","uint8arrays/to-string":"hC8JB"}],"8Mu1u":[function(e,t,r){"use strict";const i=e("./codec"),n=e("./protocols-table"),s=e("varint"),{CID:o}=e("multiformats/cid"),{base58btc:a}=e("multiformats/bases/base58"),c=e("err-code"),u=Symbol.for("nodejs.util.inspect.custom"),{toString:l}=e("uint8arrays/to-string"),{equals:d}=e("uint8arrays/equals"),f=new Map,h=Symbol.for("@multiformats/js-multiaddr/multiaddr");class p{constructor(e){if(null==e&&(e=""),Object.defineProperty(this,h,{value:!0}),e instanceof Uint8Array)this.bytes=i.fromBytes(e);else if("string"==typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=i.fromString(e)}else{if(!p.isMultiaddr(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=i.fromBytes(e.bytes)}}toString(){return i.bytesToString(this.bytes)}toJSON(){return this.toString()}toOptions(){const e={},t=this.toString().split("/");return e.family="ip4"===t[1]?4:6,e.host=t[2],e.transport=t[3],e.port=parseInt(t[4]),e}protos(){return this.protoCodes().map((e=>Object.assign({},n(e))))}protoCodes(){const e=[],t=this.bytes;let r=0;for(;r<t.length;){const o=s.decode(t,r),a=s.decode.bytes,c=n(o);r+=i.sizeForAddr(c,t.slice(r+a))+a,e.push(o)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return i.bytesToTuples(this.bytes)}stringTuples(){const e=i.bytesToTuples(this.bytes);return i.tuplesToStringTuples(e)}encapsulate(e){return e=new p(e),new p(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),r=this.toString(),i=r.lastIndexOf(t);if(i<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return new p(r.slice(0,i))}decapsulateCode(e){const t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return new p(i.tuplesToBytes(t.slice(0,r)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===n.names.ipfs.code)).pop();if(e&&e[1]){const t=e[1];return"Q"===t[0]||"1"===t[0]?l(a.decode(`z${t}`),"base58btc"):l(o.parse(t).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){let e=null;try{e=this.stringTuples().filter((e=>!!n(e[0]).path))[0][1],e||(e=null)}catch(t){e=null}return e}equals(e){return d(this.bytes,e.bytes)}async resolve(){const e=this.protos().find((e=>e.resolvable));if(!e)return[this];const t=f.get(e.name);if(!t)throw c(new Error(`no available resolver for ${e.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await t(this)).map((e=>new p(e)))}nodeAddress(){const e=this.protoCodes(),t=this.protoNames(),r=this.toString().split("/").slice(1);if(r.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==e[0]&&41!==e[0]&&54!==e[0]&&55!==e[0])throw new Error(`no protocol with name: "'${t[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==r[2]&&"udp"!==r[2])throw new Error(`no protocol with name: "'${t[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===e[0]||55===e[0]?6:4,address:r[1],port:parseInt(r[3])}}isThinWaistAddress(e){const t=(e||this).protos();return 2===t.length&&((4===t[0].code||41===t[0].code)&&(6===t[1].code||273===t[1].code))}static fromNodeAddress(e,t){if(!e)throw new Error("requires node address object");if(!t)throw new Error("requires transport protocol");let r;switch(e.family){case 4:r="ip4";break;case 6:r="ip6";break;default:throw Error(`Invalid addr family. Got '${e.family}' instead of 4 or 6`)}return new p("/"+[r,e.address,t,e.port].join("/"))}static isName(e){return!!p.isMultiaddr(e)&&e.protos().some((e=>e.resolvable))}static isMultiaddr(e){return e instanceof p||Boolean(e&&e[h])}[u](){return"<Multiaddr "+l(this.bytes,"base16")+" - "+i.bytesToString(this.bytes)+">"}inspect(){return"<Multiaddr "+l(this.bytes,"base16")+" - "+i.bytesToString(this.bytes)+">"}}p.protocols=n,p.resolvers=f,t.exports={Multiaddr:p,multiaddr:function(e){return new p(e)},protocols:n,resolvers:f}},{"./codec":"heFUu","./protocols-table":"5Z4cQ",varint:"aN1CO","multiformats/cid":"9ooAY","multiformats/bases/base58":"4n7mA","err-code":"chZjB","uint8arrays/to-string":"hC8JB","uint8arrays/equals":"eY3cX"}],heFUu:[function(e,t,r){"use strict";const i=e("./convert"),n=e("./protocols-table"),s=e("varint"),{concat:o}=e("uint8arrays/concat"),{toString:a}=e("uint8arrays/to-string");function c(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let i=0;i<r.length;i++){const s=r[i],o=n(s);if(0!==o.size){if(i++,i>=r.length)throw v("invalid address: "+e);if(o.path){t.push([s,b(r.slice(i).join("/"))]);break}t.push([s,r[i]])}else t.push([s])}return t}function u(e){const t=[];return e.map((e=>{const r=w(e);return t.push(r.name),e.length>1&&t.push(e[1]),null})),b(t.join("/"))}function l(e){return e.map((e=>{Array.isArray(e)||(e=[e]);const t=w(e);return e.length>1?[t.code,i.toBytes(t.code,e[1])]:[t.code]}))}function d(e){return e.map((e=>{const t=w(e);return e[1]?[t.code,i.toString(t.code,e[1])]:[t.code]}))}function f(e){return y(o(e.map((e=>{const t=w(e);let r=Uint8Array.from(s.encode(t.code));return e.length>1&&(r=o([r,e[1]])),r}))))}function h(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;return s.decode(t)+s.decode.bytes}function p(e){const t=[];let r=0;for(;r<e.length;){const i=s.decode(e,r),o=s.decode.bytes,c=h(n(i),e.slice(r+o));if(0===c){t.push([i]),r+=o;continue}const u=e.slice(r+o,r+o+c);if(r+=c+o,r>e.length)throw v("Invalid address Uint8Array: "+a(e,"base16"));t.push([i,u])}return t}function g(e){return f(l(c(e=b(e))))}function y(e){const t=m(e);if(t)throw t;return Uint8Array.from(e)}function m(e){try{p(e)}catch(e){return e}}function b(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function v(e){return new Error("Error parsing address: "+e)}function w(e){return n(e[0])}t.exports={stringToStringTuples:c,stringTuplesToString:u,tuplesToStringTuples:d,stringTuplesToTuples:l,bytesToTuples:p,tuplesToBytes:f,bytesToString:function(e){const t=p(e);return u(d(t))},stringToBytes:g,fromString:function(e){return g(e)},fromBytes:y,validateBytes:m,isValidBytes:function(e){return void 0===m(e)},cleanPath:b,ParseError:v,protoFromTuple:w,sizeForAddr:h}},{"./convert":"gfu3m","./protocols-table":"5Z4cQ",varint:"aN1CO","uint8arrays/concat":"4EBjG","uint8arrays/to-string":"hC8JB"}],gfu3m:[function(e,t,r){"use strict";const i=e("./ip"),n=e("./protocols-table"),{CID:s}=e("multiformats/cid"),{base32:o}=e("multiformats/bases/base32"),{base58btc:a}=e("multiformats/bases/base58"),c=e("multiformats/hashes/digest"),u=e("varint"),{toString:l}=e("uint8arrays/to-string"),{fromString:d}=e("uint8arrays/from-string"),{concat:f}=e("uint8arrays/concat");function h(e,t){return t instanceof Uint8Array?h.toString(e,t):h.toBytes(e,t)}function p(e){if(!i.isIP(e))throw new Error("invalid ip address");return i.toBytes(e)}function g(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function y(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function m(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2);return l(t,"base32")+":"+y(r)}t.exports=h,h.toString=function(e,t){switch(n(e).code){case 4:case 41:return function(e){const t=i.toString(e);if(!t||!i.isIP(t))throw new Error("invalid ip address");return t}(t);case 6:case 273:case 33:case 132:return y(t).toString();case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=u.decode(e);if((e=e.slice(u.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return l(e)}(t);case 421:return function(e){const t=u.decode(e),r=e.slice(u.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return l(r,"base58btc")}(t);case 444:case 445:return m(t);default:return l(t,"base16")}},h.toBytes=function(e,t){switch(n(e).code){case 4:case 41:return p(t);case 6:case 273:case 33:case 132:return g(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=d(e),r=Uint8Array.from(u.encode(t.length));return f([r,t],r.length+t.length)}(t);case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?c.decode(a.decode(`z${e}`)).bytes:s.parse(e).multihash.bytes;const r=Uint8Array.from(u.encode(t.length));return f([r,t],r.length+t.length)}(t);case 444:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: "+t+" does not contain a port number");if(16!==t[0].length)throw new Error("failed to parse onion addr: "+t[0]+" not a Tor onion address.");const r=o.decode("b"+t[0]),i=parseInt(t[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");const n=g(i);return f([r,n],r.length+n.length)}(t);case 445:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: "+t+" does not contain a port number");if(56!==t[0].length)throw new Error("failed to parse onion addr: "+t[0]+" not a Tor onion3 address.");const r=o.decode("b"+t[0]),i=parseInt(t[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");const n=g(i);return f([r,n],r.length+n.length)}(t);default:return d(t,"base16")}}},{"./ip":"dqiuc","./protocols-table":"5Z4cQ","multiformats/cid":"9ooAY","multiformats/bases/base32":"5k9Tu","multiformats/bases/base58":"4n7mA","multiformats/hashes/digest":"kpRBg",varint:"aN1CO","uint8arrays/to-string":"hC8JB","uint8arrays/from-string":"dF7Y4","uint8arrays/concat":"4EBjG"}],dqiuc:[function(e,t,r){"use strict";const i=e("is-ip"),{toString:n}=e("uint8arrays/to-string"),s=i,o=i.v4,a=i.v6,c=function(e,t,r){let i;if(r=~~r,o(e))i=t||new Uint8Array(r+4),e.split(/\./g).map((function(e){i[r++]=255&parseInt(e,10)}));else if(a(e)){const s=e.split(":",8);let a;for(a=0;a<s.length;a++){let e;o(s[a])&&(e=c(s[a]),s[a]=n(e.slice(0,2),"base16")),e&&++a<8&&s.splice(a,0,n(e.slice(2,4),"base16"))}if(""===s[0])for(;s.length<8;)s.unshift("0");else if(""===s[s.length-1])for(;s.length<8;)s.push("0");else if(s.length<8){for(a=0;a<s.length&&""!==s[a];a++);const e=[a,"1"];for(a=9-s.length;a>0;a--)e.push("0");s.splice.apply(s,e)}for(i=t||new Uint8Array(r+16),a=0;a<s.length;a++){const e=parseInt(s[a],16);i[r++]=e>>8&255,i[r++]=255&e}}if(!i)throw Error("Invalid ip address: "+e);return i};t.exports={isIP:s,isV4:o,isV6:a,toBytes:c,toString:function(e,t,r){t=~~t,r=r||e.length-t;const i=[];let n;const s=new DataView(e.buffer);if(4===r){for(let n=0;n<r;n++)i.push(e[t+n]);n=i.join(".")}else if(16===r){for(let e=0;e<r;e+=2)i.push(s.getUint16(t+e).toString(16));n=i.join(":"),n=n.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3"),n=n.replace(/:{3,4}/,"::")}return n}}},{"is-ip":"arQx3","uint8arrays/to-string":"hC8JB"}],arQx3:[function(e,t,r){"use strict";const i=e("ip-regex"),n=e=>i({exact:!0}).test(e);n.v4=e=>i.v4({exact:!0}).test(e),n.v6=e=>i.v6({exact:!0}).test(e),n.version=e=>n(e)?n.v4(e)?4:6:void 0,t.exports=n},{"ip-regex":"foGrp"}],foGrp:[function(e,t,r){"use strict";const i="[a-fA-F\\d:]",n=e=>e&&e.includeBoundaries?`(?:(?<=\\s|^)(?=${i})|(?<=${i})(?=\\s|$))`:"",s="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",o="[a-fA-F\\d]{1,4}",a=`\n(?:\n(?:${o}:){7}(?:${o}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${o}:){6}(?:${s}|:${o}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${o}:){5}(?::${s}|(?::${o}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${o}:){4}(?:(?::${o}){0,1}:${s}|(?::${o}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${o}:){3}(?:(?::${o}){0,2}:${s}|(?::${o}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${o}:){2}(?:(?::${o}){0,3}:${s}|(?::${o}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${o}:){1}(?:(?::${o}){0,4}:${s}|(?::${o}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${o}){0,5}:${s}|(?::${o}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),c=new RegExp(`(?:^${s}$)|(?:^${a}$)`),u=new RegExp(`^${s}$`),l=new RegExp(`^${a}$`),d=e=>e&&e.exact?c:new RegExp(`(?:${n(e)}${s}${n(e)})|(?:${n(e)}${a}${n(e)})`,"g");d.v4=e=>e&&e.exact?u:new RegExp(`${n(e)}${s}${n(e)}`,"g"),d.v6=e=>e&&e.exact?l:new RegExp(`${n(e)}${a}${n(e)}`,"g"),t.exports=d},{}],hC8JB:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./util/bases.js");r.toString=function(e,t="utf8"){const r=i[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return r.encoder.encode(e).substring(1)}},{"./util/bases.js":"6UNPX"}],"5Z4cQ":[function(e,t,r){"use strict";function i(e){if("number"==typeof e){if(i.codes[e])return i.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e){if(i.names[e])return i.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const n=-1;function s(e,t,r,i,n){return{code:e,size:t,name:r,resolvable:Boolean(i),path:Boolean(n)}}i.lengthPrefixedVarSize=n,i.V=n,i.table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,n,"ip6zone"],[53,n,"dns","resolvable"],[54,n,"dns4","resolvable"],[55,n,"dns6","resolvable"],[56,n,"dnsaddr","resolvable"],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,n,"unix",!1,"path"],[421,n,"ipfs"],[421,n,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,n,"garlic64"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,n,"memory"]],i.names={},i.codes={},i.table.map((e=>{const t=s.apply(null,e);return i.codes[t.code]=t,i.names[t.name]=t,null})),i.object=s,t.exports=i},{}],aN1CO:[function(e,t,r){t.exports={encode:e("./encode.js"),decode:e("./decode.js"),encodingLength:e("./length.js")}},{"./encode.js":"j1gSN","./decode.js":"9agvx","./length.js":"3Fbt5"}],j1gSN:[function(e,t,r){t.exports=function e(t,r,n){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");r=r||[];var s=n=n||0;for(;t>=i;)r[n++]=255&t|128,t/=128;for(;-128&t;)r[n++]=255&t|128,t>>>=7;return r[n]=0|t,e.bytes=n-s+1,r};var i=Math.pow(2,31)},{}],"9agvx":[function(e,t,r){t.exports=function e(t,r){var i,n=0,s=0,o=r=r||0,a=t.length;do{if(o>=a||s>49)throw e.bytes=0,new RangeError("Could not decode varint");i=t[o++],n+=s<28?(127&i)<<s:(127&i)*Math.pow(2,s),s+=7}while(i>=128);return e.bytes=o-r,n}},{}],"3Fbt5":[function(e,t,r){var i=Math.pow(2,7),n=Math.pow(2,14),s=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),c=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),d=Math.pow(2,63);t.exports=function(e){return e<i?1:e<n?2:e<s?3:e<o?4:e<a?5:e<c?6:e<u?7:e<l?8:e<d?9:10}},{}],"4EBjG":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.concat=function(e,t){t||(t=e.reduce(((e,t)=>e+t.length),0));const r=new Uint8Array(t);let i=0;for(const t of e)r.set(t,i),i+=t.length;return r}},{}],eY3cX:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.equals=function(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}},{}],l1lok:[function(e,t,r){"use strict";const{Multiaddr:i}=e("multiaddr"),n=O("dns4"),s=O("dns6"),o=O("dnsaddr"),a=P(O("dns"),o,n,s),c=P(O("ip4"),O("ip6")),u=P(R(c,O("tcp")),R(a,O("tcp"))),l=R(c,O("udp")),d=R(l,O("utp")),f=R(l,O("quic")),h=P(R(u,O("ws")),R(a,O("ws"))),p=P(R(u,O("wss")),R(a,O("wss"))),g=P(R(u,O("http")),R(c,O("http")),R(a,O("http"))),y=P(R(u,O("https")),R(c,O("https")),R(a,O("https"))),m=P(R(h,O("p2p-webrtc-star"),O("p2p")),R(p,O("p2p-webrtc-star"),O("p2p")),R(h,O("p2p-webrtc-star")),R(p,O("p2p-webrtc-star"))),b=P(R(h,O("p2p-websocket-star"),O("p2p")),R(p,O("p2p-websocket-star"),O("p2p")),R(h,O("p2p-websocket-star")),R(p,O("p2p-websocket-star"))),v=P(R(g,O("p2p-webrtc-direct"),O("p2p")),R(y,O("p2p-webrtc-direct"),O("p2p")),R(g,O("p2p-webrtc-direct")),R(y,O("p2p-webrtc-direct"))),w=P(h,p,g,y,m,v,u,d,f,a),_=P(R(w,O("p2p-stardust"),O("p2p")),R(w,O("p2p-stardust"))),E=P(R(w,O("p2p")),m,v,O("p2p")),S=P(R(E,O("p2p-circuit"),E),R(E,O("p2p-circuit")),R(O("p2p-circuit"),E),R(w,O("p2p-circuit")),R(O("p2p-circuit"),w),O("p2p-circuit")),T=()=>P(R(S,T),S),A=T(),k=P(R(A,E,A),R(E,A),R(A,E),A,E);function I(e){return function(t){if(!i.isMultiaddr(t))try{t=new i(t)}catch(e){return!1}const r=e(t.protoNames());return null!==r&&(!0===r||!1===r?r:0===r.length)}}function R(...e){function t(t){if(t.length<e.length)return null;let r=t;return e.some((e=>(r="function"==typeof e?e().partialMatch(t):e.partialMatch(t),Array.isArray(r)&&(t=r),null===r))),r}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:I(t),partialMatch:t}}function P(...e){function t(t){let r=null;return e.some((e=>{const i="function"==typeof e?e().partialMatch(t):e.partialMatch(t);return!!i&&(r=i,!0)})),r}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:I(t),partialMatch:t}}function O(e){const t=e;return{toString:function(){return t},matches:function(e){let r;if("string"==typeof e||e instanceof Uint8Array)try{r=new i(e)}catch(e){return!1}else r=e;const n=r.protoNames();return 1===n.length&&n[0]===t},partialMatch:function(e){return 0===e.length?null:e[0]===t?e.slice(1):null}}}t.exports={DNS:a,DNS4:n,DNS6:s,DNSADDR:o,IP:c,TCP:u,UDP:l,QUIC:f,UTP:d,HTTP:g,HTTPS:y,WebSockets:h,WebSocketsSecure:p,WebSocketStar:b,WebRTCStar:m,WebRTCDirect:v,Reliable:w,Stardust:_,Circuit:A,P2P:k,IPFS:k}},{multiaddr:"8Mu1u"}],"86VPZ":[function(e,t,r){"use strict";const{URLWithLegacySupport:i,format:n,URLSearchParams:s,defaultBase:o}=e("./src/url"),a=e("./src/relative");t.exports={URL:i,URLSearchParams:s,format:n,relative:a,defaultBase:o}},{"./src/url":"86S6m","./src/relative":"ki4KM"}],"86S6m":[function(e,t,r){"use strict";const i="undefined"!=typeof navigator&&"ReactNative"===navigator.product;const n=self.URL,s=i?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:"";t.exports={URLWithLegacySupport:class{constructor(e="",t=s){this.super=new n(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set username(e){this.super.username=e}static createObjectURL(e){return n.createObjectURL(e)}static revokeObjectURL(e){n.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}},URLSearchParams:self.URLSearchParams,defaultBase:s,format:function(e){if("string"==typeof e){return new n(e).toString()}if(!(e instanceof n)){const t=e.username&&e.password?`${e.username}:${e.password}@`:"",r=e.auth?e.auth+"@":"",i=e.port?":"+e.port:"",n=e.protocol?e.protocol+"//":"",s=e.host||"",o=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),c=e.hash||"",u=e.pathname||"";return`${n}${t||r}${s||o+i}${e.path||u+a}${c}`}}}},{}],ki4KM:[function(e,t,r){"use strict";const{URLWithLegacySupport:i,format:n}=e("./url");t.exports=(e,t={},r={},s)=>{let o,a=t.protocol?t.protocol.replace(":",""):"http";a=(r[a]||s||a)+":";try{o=new i(e)}catch(e){o={}}const c=Object.assign({},t,{protocol:a||o.protocol,host:t.host||o.host});return new i(e,n(c)).toString()}},{"./url":"86S6m"}],"9hGOz":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("nanoid"),n=e("uint8arrays/to-string"),s=e("uint8arrays/from-string");const o="/",a=(new TextEncoder).encode(o),c=a[0];class u{constructor(e,t){if("string"==typeof e)this._buf=s.fromString(e);else{if(!(e instanceof Uint8Array))throw new Error("Invalid key, should be String of Uint8Array");this._buf=e}if(null==t&&(t=!0),t&&this.clean(),0===this._buf.byteLength||this._buf[0]!==c)throw new Error("Invalid key")}toString(e="utf8"){return n.toString(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(e){return new u(e.join(o))}static random(){return new u(i.nanoid().replace(/-/g,""))}static asKey(e){return e instanceof Uint8Array||"string"==typeof e?new u(e):e.uint8Array?new u(e.uint8Array()):null}clean(){if(this._buf&&0!==this._buf.byteLength||(this._buf=a),this._buf[0]!==c){const e=new Uint8Array(this._buf.byteLength+1);e.fill(c,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===c;)this._buf=this._buf.subarray(0,-1)}less(e){const t=this.list(),r=e.list();for(let e=0;e<t.length;e++){if(r.length<e+1)return!1;const i=t[e],n=r[e];if(i<n)return!0;if(i>n)return!1}return t.length<r.length}reverse(){return u.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){const e=this.namespaces();return e[e.length-1]}list(){return this.toString().split(o).slice(1)}type(){return function(e){const t=e.split(":");return t.length<2?"":t.slice(0,-1).join(":")}(this.baseNamespace())}name(){return function(e){const t=e.split(":");return t[t.length-1]}(this.baseNamespace())}instance(e){return new u(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith(o)||(e+=o),e+=this.type(),new u(e)}parent(){const e=this.list();return 1===e.length?new u(o):new u(e.slice(0,-1).join(o))}child(e){return this.toString()===o?e:e.toString()===o?this:new u(this.toString()+e.toString(),!1)}isAncestorOf(e){return e.toString()!==this.toString()&&e.toString().startsWith(this.toString())}isDecendantOf(e){return e.toString()!==this.toString()&&this.toString().startsWith(e.toString())}isTopLevel(){return 1===this.list().length}concat(...e){return u.withNamespaces([...this.namespaces(),...(t=e.map((e=>e.namespaces())),[].concat(...t))]);var t}}r.Key=u},{nanoid:"dmVhu","uint8arrays/to-string":"hC8JB","uint8arrays/from-string":"dF7Y4"}],dmVhu:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"nanoid",(()=>c)),i.export(r,"customAlphabet",(()=>a)),i.export(r,"customRandom",(()=>o)),i.export(r,"urlAlphabet",(()=>n.urlAlphabet)),i.export(r,"random",(()=>s));var n=e("./url-alphabet/index.js");let s=e=>crypto.getRandomValues(new Uint8Array(e)),o=(e,t,r)=>{let i=(2<<Math.log(e.length-1)/Math.LN2)-1,n=-~(1.6*i*t/e.length);return()=>{let s="";for(;;){let o=r(n),a=n;for(;a--;)if(s+=e[o[a]&i]||"",s.length===t)return s}}},a=(e,t)=>o(e,t,s),c=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e));for(;e--;){let i=63&r[e];t+=i<36?i.toString(36):i<62?(i-26).toString(36).toUpperCase():i<63?"_":"-"}return t}},{"./url-alphabet/index.js":"lbsD0","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],lbsD0:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"urlAlphabet",(()=>n));let n="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"},{"@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],h08wk:[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach((function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})})),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}],j29MK:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("timeout-abort-controller"),n=e("any-signal"),s=e("parse-duration"),o=e("./errors.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(i),u=a(s);r.withTimeoutOption=function(e,t){return(...r)=>{const i=r[null==t?r.length-1:t];if(!i||!i.timeout)return e(...r);const s="string"==typeof i.timeout?u.default(i.timeout):i.timeout,a=new c.default(s);i.signal=n.anySignal([i.signal,a.signal]);const l=e(...r),d=new Promise(((e,t)=>{a.signal.addEventListener("abort",(()=>{t(new o.TimeoutError)}))})),f=Date.now(),h=()=>{if(a.signal.aborted)throw new o.TimeoutError;if(Date.now()-f>s)throw a.abort(),new o.TimeoutError};return l[Symbol.asyncIterator]?async function*(){const e=l[Symbol.asyncIterator]();try{for(;;){const{value:t,done:r}=await Promise.race([e.next(),d]);if(r)break;h(),yield t}}catch(e){throw h(),e}finally{a.clear(),e.return&&e.return()}}():(async()=>{try{const e=await Promise.race([l,d]);return h(),e}catch(e){throw h(),e}finally{a.clear()}})()}}},{"timeout-abort-controller":"hzClg","any-signal":"kXgRR","parse-duration":"fGYtw","./errors.js":"2ffCq"}],hzClg:[function(e,t,r){"use strict";const{AbortController:i}="undefined"!=typeof self?self:"undefined"!=typeof window?window:e("abort-controller"),n=e("retimer");class s extends i{constructor(e){super(),this._ms=e,this._timer=n((()=>this.abort()),e),Object.setPrototypeOf(this,s.prototype)}abort(){return this._timer.clear(),super.abort()}clear(){this._timer.clear()}reset(){this._timer.clear(),this._timer=n((()=>this.abort()),this._ms)}}t.exports=s,t.exports.TimeoutController=s},{"abort-controller":"lNJ7z",retimer:"gJ6S6"}],lNJ7z:[function(e,t,r){"use strict";const{AbortController:i,AbortSignal:n}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;t.exports=i,t.exports.AbortSignal=n,t.exports.default=i},{}],gJ6S6:[function(e,t,r){"use strict";var i=e("./time");function n(e,t,r){var n=this;this._started=i(),this._rescheduled=0,this._scheduled=t,this._args=r,this._timer=setTimeout((function t(){n._rescheduled>0?(n._scheduled=n._rescheduled-(i()-n._started),n._timer=setTimeout(t,n._scheduled),n._rescheduled=0):e.apply(null,n._args)}),t)}n.prototype.reschedule=function(e){var t=i();return!(t+e-(this._started+this._scheduled)<0)&&(this._started=t,this._rescheduled=e,!0)},n.prototype.clear=function(){clearTimeout(this._timer)},t.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("timeout needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t<e.length;t++)e[t]=arguments[t+2]}return new n(arguments[0],arguments[1],e)}},{"./time":"2ZUJ1"}],"2ZUJ1":[function(e,t,r){"use strict";t.exports=function(){return Date.now()}},{}],kXgRR:[function(e,t,r){const{AbortController:i}=e("native-abort-controller");function n(e){const t=new i;function r(){t.abort();for(const t of e)t&&t.removeEventListener&&t.removeEventListener("abort",r)}for(const t of e)if(t&&t.addEventListener){if(t.aborted){r();break}t.addEventListener("abort",r)}return t.signal}t.exports=n,t.exports.anySignal=n},{"native-abort-controller":"6zwoZ"}],"6zwoZ":[function(e,t,r){"use strict";let i;i=globalThis.AbortController&&globalThis.AbortSignal?globalThis:e("abort-controller"),t.exports.AbortSignal=i.AbortSignal,t.exports.AbortController=i.AbortController},{"abort-controller":"lNJ7z"}],fGYtw:[function(e,t,r){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(r);let i=/(-?(?:\d+\.?\d*|\d*\.?\d+)(?:e[-+]?\d+)?)\s*([\p{L}]*)/giu;function n(e="",t="ms"){var r=null;return(e=(e+"").replace(/(\d)[,_](\d)/g,"$1$2")).replace(i,(function(e,t,i){(i=s(i))&&(r=(r||0)+parseFloat(t,10)*i)})),r&&r/(s(t)||1)}function s(e){return n[e]||n[e.toLowerCase().replace(/s$/,"")]}n.nanosecond=n.ns=1e-6,n["µs"]=n["μs"]=n.us=n.microsecond=.001,n.millisecond=n.ms=n[""]=1,n.second=n.sec=n.s=1e3*n.ms,n.minute=n.min=n.m=60*n.s,n.hour=n.hr=n.h=60*n.m,n.day=n.d=24*n.h,n.week=n.wk=n.w=7*n.d,n.month=n.b=30.4375*n.d,n.year=n.yr=n.y=365.25*n.d,r.default=n},{"@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],"2ffCq":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});class i extends Error{constructor(e="request timed out"){super(e),this.name="TimeoutError",this.code=i.code}}i.code="ERR_TIMEOUT",r.TimeoutError=i},{}],jN5CZ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e("err-code"));const o="/ipfs/";r.toCidAndPath=function(e){if(e instanceof Uint8Array)try{e=i.CID.decode(e)}catch(e){throw s.default(e,"ERR_INVALID_CID")}let t=i.CID.asCID(e);if(t)return{cid:t,path:void 0};(e=e.toString()).startsWith(o)&&(e=e.substring(o.length));const r=e.split("/");let n;try{t=i.CID.parse(r.shift()||"")}catch(e){throw s.default(e,"ERR_INVALID_CID")}return r.length&&(n=`/${r.join("/")}`),{cid:t,path:n}}},{"multiformats/cid":"9ooAY","err-code":"chZjB"}],kkxN3:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../utils/service.js");r.createStop=function({network:e,preload:t,ipns:r,repo:n,mfsPreload:s}){return async()=>{await Promise.all([t.stop(),r.stop(),s.stop(),i.Service.stop(e),n.close()])}}},{"../utils/service.js":"ethcf"}],"4N8JT":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-config/dns"),n=e("ipfs-core-utils/with-timeout-option");r.createDns=function(){return n.withTimeoutOption((async(e,t={recursive:!0})=>{if("string"!=typeof e)throw new Error("Invalid arguments, domain must be a string");return e=function(e){return e.endsWith(".eth")&&(e=e.replace(/.eth$/,".eth.link")),e}(e),i.resolveDnslink(e,t)}))}},{"ipfs-core-config/dns":"HOLZZ","ipfs-core-utils/with-timeout-option":"j29MK"}],HOLZZ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils/tlru.js"),n=e("p-queue"),s=e("ipfs-utils/src/http.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(n),c=o(s);const u=new i.TLRU(1e3),l=new(a.default.default?a.default.default:a.default)({concurrency:4}),d=e=>{if(e.Path)return e.Path;throw new Error(e.Message)};r.resolveDnslink=async function(e,t){return(async(e,t={})=>{const r=new URLSearchParams(t);r.set("arg",e);const i=r.toString();if(!t.nocache&&u.has(i)){const e=u.get(i);return d(e)}const n=await l.add((async()=>{const e=await c.default.get("https://ipfs.io/api/v0/dns",{searchParams:r}),t=new URL(e.url).search.slice(1),i=await e.json();return u.set(t,i,6e4),i}));return d(n)})(e,t)}},{"./utils/tlru.js":"2qTdj","p-queue":"biPlv","ipfs-utils/src/http.js":"ifXXn"}],"2qTdj":[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("hashlru"));r.TLRU=class{constructor(e){this.lru=n.default(e)}get(e){const t=this.lru.get(e);if(t)return t.expire&&t.expire<Date.now()?void this.lru.remove(e):t.value}set(e,t,r){this.lru.set(e,{value:t,expire:Date.now()+r})}has(e){return!!this.get(e)}remove(e){this.lru.remove(e)}clear(){this.lru.clear()}}},{hashlru:"kBj5c"}],kBj5c:[function(e,t,r){t.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,r=Object.create(null),i=Object.create(null);function n(n,s){r[n]=s,++t>=e&&(t=0,i=r,r=Object.create(null))}return{has:function(e){return void 0!==r[e]||void 0!==i[e]},remove:function(e){void 0!==r[e]&&(r[e]=void 0),void 0!==i[e]&&(i[e]=void 0)},get:function(e){var t=r[e];return void 0!==t?t:void 0!==(t=i[e])?(n(e,t),t):void 0},set:function(e,t){void 0!==r[e]?r[e]=t:n(e,t)},clear:function(){r=Object.create(null),i=Object.create(null)}}}},{}],biPlv:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=e("eventemitter3"),n=e("p-timeout"),s=e("./priority-queue"),o=()=>{},a=new n.TimeoutError;r.default=class extends i{constructor(e){var t,r,i,n;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=o,this._resolveIdle=o,!("number"==typeof(e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:s.default},e)).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${null!==(r=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==r?r:""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${null!==(n=null===(i=e.interval)||void 0===i?void 0:i.toString())&&void 0!==n?n:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||0===e.interval,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=!0===e.throwOnTimeout,this._isPaused=!1===e.autoStart}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=o,0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=o,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){const e=Date.now();if(void 0===this._intervalId){const t=this._intervalEnd-e;if(!(t<0))return void 0===this._timeoutId&&(this._timeoutId=setTimeout((()=>{this._onResumeInterval()}),t)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}_tryToStartAnother(){if(0===this._queue.size)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){const e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){const t=this._queue.dequeue();return!!t&&(this.emit("active"),t(),e&&this._initializeIntervalIfNeeded(),!0)}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||void 0!==this._intervalId||(this._intervalId=setInterval((()=>{this._onInterval()}),this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){0===this._intervalCount&&0===this._pendingCount&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,t={}){return new Promise(((r,i)=>{this._queue.enqueue((async()=>{this._pendingCount++,this._intervalCount++;try{const s=void 0===this._timeout&&void 0===t.timeout?e():n.default(Promise.resolve(e()),void 0===t.timeout?this._timeout:t.timeout,(()=>{(void 0===t.throwOnTimeout?this._throwOnTimeout:t.throwOnTimeout)&&i(a)}));r(await s)}catch(e){i(e)}this._next()}),t),this._tryToStartAnother(),this.emit("add")}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(0!==this._queue.size)return new Promise((e=>{const t=this._resolveEmpty;this._resolveEmpty=()=>{t(),e()}}))}async onIdle(){if(0!==this._pendingCount||0!==this._queue.size)return new Promise((e=>{const t=this._resolveIdle;this._resolveIdle=()=>{t(),e()}}))}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}}},{eventemitter3:"btRgg","p-timeout":"2SalH","./priority-queue":"hkJNA"}],btRgg:[function(e,t,r){"use strict";var i=Object.prototype.hasOwnProperty,n="~";function s(){}function o(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,r,i,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,i||e,s),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function c(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function u(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(n=!1)),u.prototype.eventNames=function(){var e,t,r=[];if(0===this._eventsCount)return r;for(t in e=this._events)i.call(e,t)&&r.push(n?t.slice(1):t);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},u.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,s=r.length,o=new Array(s);i<s;i++)o[i]=r[i].fn;return o},u.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},u.prototype.emit=function(e,t,r,i,s,o){var a=n?n+e:e;if(!this._events[a])return!1;var c,u,l=this._events[a],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,i),!0;case 5:return l.fn.call(l.context,t,r,i,s),!0;case 6:return l.fn.call(l.context,t,r,i,s,o),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var f,h=l.length;for(u=0;u<h;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,r);break;case 4:l[u].fn.call(l[u].context,t,r,i);break;default:if(!c)for(f=1,c=new Array(d-1);f<d;f++)c[f-1]=arguments[f];l[u].fn.apply(l[u].context,c)}}return!0},u.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},u.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},u.prototype.removeListener=function(e,t,r,i){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return c(this,s),this;var o=this._events[s];if(o.fn)o.fn!==t||i&&!o.once||r&&o.context!==r||c(this,s);else{for(var a=0,u=[],l=o.length;a<l;a++)(o[a].fn!==t||i&&!o[a].once||r&&o[a].context!==r)&&u.push(o[a]);u.length?this._events[s]=1===u.length?u[0]:u:c(this,s)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&c(this,t)):(this._events=new s,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=n,u.EventEmitter=u,void 0!==t&&(t.exports=u)},{}],"2SalH":[function(e,t,r){"use strict";const i=e("p-finally");class n extends Error{constructor(e){super(e),this.name="TimeoutError"}}const s=(e,t,r)=>new Promise(((s,o)=>{if("number"!=typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0)return void s(e);const a=setTimeout((()=>{if("function"==typeof r){try{s(r())}catch(e){o(e)}return}const i=r instanceof Error?r:new n("string"==typeof r?r:`Promise timed out after ${t} milliseconds`);"function"==typeof e.cancel&&e.cancel(),o(i)}),t);i(e.then(s,o),(()=>{clearTimeout(a)}))}));t.exports=s,t.exports.default=s,t.exports.TimeoutError=n},{"p-finally":"4tkVQ"}],"4tkVQ":[function(e,t,r){"use strict";t.exports=(e,t)=>(t=t||(()=>{}),e.then((e=>new Promise((e=>{e(t())})).then((()=>e))),(e=>new Promise((e=>{e(t())})).then((()=>{throw e})))))},{}],hkJNA:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=e("./lower-bound");r.default=class{constructor(){this._queue=[]}enqueue(e,t){const r={priority:(t=Object.assign({priority:0},t)).priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority)return void this._queue.push(r);const n=i.default(this._queue,r,((e,t)=>t.priority-e.priority));this._queue.splice(n,0,r)}dequeue(){const e=this._queue.shift();return null==e?void 0:e.run}filter(e){return this._queue.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this._queue.length}}},{"./lower-bound":"9Swn9"}],"9Swn9":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t,r){let i=0,n=e.length;for(;n>0;){const s=n/2|0;let o=i+s;r(e[o],t)<=0?(i=++o,n-=s+1):n=s}return i}},{}],ifXXn:[function(e,t,r){"use strict";const{fetch:i,Request:n,Headers:s}=e("./http/fetch"),{TimeoutError:o,HTTPError:a}=e("./http/error"),c=e("merge-options").bind({ignoreUndefined:!0}),{URL:u,URLSearchParams:l}=e("iso-url"),{AbortController:d}=e("native-abort-controller"),f=e("any-signal"),h={throwHttpErrors:!0,credentials:"same-origin"};class p{constructor(e={}){this.opts=c(h,e)}async fetch(e,t={}){const r=c(this.opts,t),h=new s(r.headers);if("string"!=typeof e&&!(e instanceof u||e instanceof n))throw new TypeError("`resource` must be a string, URL, or Request");const p=new u(e.toString(),r.base),{searchParams:m,transformSearchParams:b,json:v}=r;m&&(p.search="function"==typeof b?b(new l(r.searchParams)):new l(r.searchParams)),v&&(r.body=JSON.stringify(r.json),h.set("content-type","application/json"));const w=new d,_=f([w.signal,r.signal]),E=await((e,t,r)=>{if(void 0===t)return e;const i=Date.now(),n=()=>Date.now()-i>=t;return new Promise(((i,s)=>{const a=setTimeout((()=>{n()&&(s(new o),r.abort())}),t),c=e=>t=>{clearTimeout(a),n()?s(new o):e(t)};e.then(c(i),c(s))}))})(i(p.toString(),{...r,signal:_,timeout:void 0,headers:h}),r.timeout,w);if(!E.ok&&r.throwHttpErrors)throw r.handleError&&await r.handleError(E),new a(E);return E.iterator=function(){return y(E.body)},E.ndjson=async function*(){for await(const e of g(E.iterator()))t.transform?yield t.transform(e):yield e},E}post(e,t={}){return this.fetch(e,{...t,method:"POST"})}get(e,t={}){return this.fetch(e,{...t,method:"GET"})}put(e,t={}){return this.fetch(e,{...t,method:"PUT"})}delete(e,t={}){return this.fetch(e,{...t,method:"DELETE"})}options(e,t={}){return this.fetch(e,{...t,method:"OPTIONS"})}}const g=async function*(e){const t=new TextDecoder;let r="";for await(const i of e){r+=t.decode(i,{stream:!0});const e=r.split(/\r?\n/);for(let t=0;t<e.length-1;t++){const r=e[t].trim();r.length>0&&(yield JSON.parse(r))}r=e[e.length-1]}r+=t.decode(),r=r.trim(),0!==r.length&&(yield JSON.parse(r))},y=e=>{if(v(e)){const t=e[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:t.next.bind(t),return:r=>(e.destroy(),"function"==typeof t.return?t.return():Promise.resolve({done:!0,value:r}))})}}if(b(e)){const t=e.getReader();return async function*(){try{for(;;){const{done:e,value:r}=await t.read();if(e)return;r&&(yield r)}}finally{t.releaseLock()}}()}if(m(e))return e;throw new TypeError("Body can't be converted to AsyncIterable")},m=e=>"object"==typeof e&&null!==e&&"function"==typeof e[Symbol.asyncIterator],b=e=>e&&"function"==typeof e.getReader,v=e=>Object.prototype.hasOwnProperty.call(e,"readable")&&Object.prototype.hasOwnProperty.call(e,"writable");p.HTTPError=a,p.TimeoutError=o,p.streamToAsyncIterator=y,p.post=(e,t)=>new p(t).post(e,t),p.get=(e,t)=>new p(t).get(e,t),p.put=(e,t)=>new p(t).put(e,t),p.delete=(e,t)=>new p(t).delete(e,t),p.options=(e,t)=>new p(t).options(e,t),t.exports=p},{"./http/fetch":"8A13C","./http/error":"7OuWB","merge-options":"fupyv","iso-url":"86VPZ","native-abort-controller":"6zwoZ","any-signal":"kXgRR"}],"8A13C":[function(e,t,r){"use strict";const{TimeoutError:i,AbortError:n}=e("./error"),{Response:s,Request:o,Headers:a,default:c}=e("../fetch"),u=c,l=e=>{const t=new a;for(const r of e.trim().split(/[\r\n]+/)){const e=r.indexOf(": ");e>0&&t.set(r.slice(0,e),r.slice(e+1))}return t};class d extends s{constructor(e,t,r){super(t,r),Object.defineProperty(this,"url",{value:e})}}t.exports={fetch:(e,t={})=>null!=t.onUploadProgress?((e,t={})=>{const r=new XMLHttpRequest;r.open(t.method||"GET",e.toString(),!0);const{timeout:o,headers:c}=t;if(o&&o>0&&o<1/0&&(r.timeout=o),null!=t.overrideMimeType&&r.overrideMimeType(t.overrideMimeType),c)for(const[e,t]of new a(c))r.setRequestHeader(e,t);return t.signal&&(t.signal.onabort=()=>r.abort()),t.onUploadProgress&&(r.upload.onprogress=t.onUploadProgress),r.responseType="arraybuffer",new Promise(((e,o)=>{const a=t=>{switch(t.type){case"error":e(s.error());break;case"load":e(new d(r.responseURL,r.response,{status:r.status,statusText:r.statusText,headers:l(r.getAllResponseHeaders())}));break;case"timeout":o(new i);break;case"abort":o(new n)}};r.onerror=a,r.onload=a,r.ontimeout=a,r.onabort=a,r.send(t.body)}))})(e,t):u(e,t),Request:o,Headers:a}},{"./error":"7OuWB","../fetch":"6Y5cD"}],"7OuWB":[function(e,t,r){"use strict";class i extends Error{constructor(e="Request timed out"){super(e),this.name="TimeoutError"}}r.TimeoutError=i;class n extends Error{constructor(e="The operation was aborted."){super(e),this.name="AbortError"}}r.AbortError=n;class s extends Error{constructor(e){super(e.statusText),this.name="HTTPError",this.response=e}}r.HTTPError=s},{}],"6Y5cD":[function(e,t,r){"use strict";const{isElectronMain:i}=e("./env");t.exports=e(i?"electron-fetch":"native-fetch")},{"./env":"flyHr","electron-fetch":"lHksA","native-fetch":"kdks4"}],lHksA:[function(e,t,r){},{}],kdks4:[function(e,t,r){"use strict";globalThis.fetch&&globalThis.Headers&&globalThis.Request&&globalThis.Response?t.exports={default:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response}:t.exports={default:e("node-fetch").default,Headers:e("node-fetch").Headers,Request:e("node-fetch").Request,Response:e("node-fetch").Response}},{"node-fetch":"1F7gr"}],"1F7gr":[function(e,t,r){"use strict";var i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==i)return i;throw new Error("unable to locate global object")}();t.exports=r=i.fetch,i.fetch&&(r.default=i.fetch.bind(i)),r.Headers=i.Headers,r.Request=i.Request,r.Response=i.Response},{}],"2KSm7":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.createIsOnline=function({network:e}){return()=>{const t=e.try();return null!=t&&Boolean(t.libp2p.isStarted())}}},{}],faFUb:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("is-ipfs"),n=e("multiformats/cid"),s=e("peer-id"),o=e("ipfs-core-utils/with-timeout-option"),a=e("../utils.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(i),l=c(s);r.createResolve=function({repo:e,codecs:t,bases:r,name:i}){return o.withTimeoutOption((async function(s,o={}){if(!u.default.path(s))throw new Error("invalid argument "+s);if(u.default.ipnsPath(s))for await(const e of i.resolve(s,o))s=e;const[,c,d,...f]=s.split("/"),h=o.cidBase?await r.getBase(o.cidBase):void 0,p=function(e){try{return l.default.parse(e).toBytes()}catch{return n.CID.parse(e).bytes}}(d);if(0===f.length){return`/${c}/${h?h.encoder.encode(p):d}`}const g=n.CID.decode(p);s=f.join("/");const y=a.resolve(g,s,t,e,o);let m=g,b=s;for await(const e of y)n.CID.asCID(e.value)&&(m=e.value,b=e.remainderPath);return`/ipfs/${m.toString(h&&h.encoder)}${b?"/"+b:""}`}))}},{"is-ipfs":"40iuV","multiformats/cid":"9ooAY","peer-id":"8Bdb3","ipfs-core-utils/with-timeout-option":"j29MK","../utils.js":"cT4uN"}],"8Bdb3":[function(e,t,r){"use strict";const{CID:i}=e("multiformats/cid"),n=e("multiformats/bases/base32"),s=e("multiformats/bases/base36"),o=e("multiformats/bases/base58"),a=e("multiformats/bases/base64"),{base58btc:c}=e("multiformats/bases/base58"),{base32:u}=e("multiformats/bases/base32"),{base16:l}=e("multiformats/bases/base16"),d=e("multiformats/hashes/digest"),f=e("libp2p-crypto/src/keys"),h=e("class-is"),{PeerIdProto:p}=e("./proto"),{equals:g}=e("uint8arrays/equals"),{fromString:y}=e("uint8arrays/from-string"),{toString:m}=e("uint8arrays/to-string"),{identity:b}=e("multiformats/hashes/identity"),v={...n,...s,...o,...a},w=Object.keys(v).reduce(((e,t)=>e.or(v[t])),u.decoder);const _=h(class{constructor(e,t,r){if(!(e instanceof Uint8Array))throw new Error("invalid id provided");if(t&&r&&!g(t.public.bytes,r.bytes))throw new Error("inconsistent arguments");this._id=e,this._idB58String=c.encode(this.id).substring(1),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){if(this._pubKey)return this._pubKey;if(this._privKey)return this._privKey.public;try{const e=d.decode(this.id);e.code===b.code&&(this._pubKey=f.unmarshalPublicKey(e.digest))}catch(e){}return this._pubKey}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return f.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return f.marshalPrivateKey(this.privKey)}marshal(e){return p.encode({id:this.toBytes(),pubKey:this.marshalPubKey(),privKey:e?null:this.marshalPrivKey()}).finish()}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let t=6;return e.length<t&&(t=e.length),"<peer.ID "+e.substr(0,t)+">"}toJSON(){return{id:this.toB58String(),privKey:A(this.marshalPrivKey()),pubKey:A(this.marshalPubKey())}}toHexString(){return l.encode(this.id).substring(1)}toBytes(){return this.id}toB58String(){return this._idB58String}toString(){if(!this._idCIDString){const e=i.createV1(114,d.decode(this.id));Object.defineProperty(this,"_idCIDString",{value:e.toString(),enumerable:!1})}return this._idCIDString}equals(e){if(e instanceof Uint8Array)return g(this.id,e);if(e.id)return g(this.id,e.id);throw new Error("not valid Id")}isEqual(e){return this.equals(e)}isValid(){return Boolean(this.privKey&&this.privKey.public&&this.privKey.public.bytes&&this.pubKey.bytes instanceof Uint8Array&&g(this.privKey.public.bytes,this.pubKey.bytes))}hasInlinePublicKey(){try{if(d.decode(this.id).code===b.code)return!0}catch(e){}return!1}},{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});r=t.exports=_;const E=e=>e.bytes.length<=42?d.create(b.code,e.bytes).bytes:e.hash(),S=async(e,t)=>{const r=await E(t);return new _(r,e,t)};r.create=async e=>{(e=e||{}).bits=e.bits||2048,e.keyType=e.keyType||"RSA";const t=await f.generateKeyPair(e.keyType,e.bits);return S(t,t.public)},r.createFromHexString=e=>new _(l.decode("f"+e)),r.createFromBytes=e=>{try{const t=i.decode(e);if(!T(t))throw new Error("Supplied PeerID CID is invalid");return r.createFromCID(t)}catch{if(d.decode(e).code!==b.code)throw new Error("Supplied PeerID CID is invalid");return new _(e)}},r.createFromB58String=e=>r.createFromBytes(c.decode("z"+e));const T=e=>114===e.code||112===e.code;function A(e){if(e)return m(e,"base64pad")}r.createFromCID=e=>{if(!(e=i.asCID(e))||!T(e))throw new Error("Supplied PeerID CID is invalid");return new _(e.multihash.bytes)},r.createFromPubKey=async e=>{let t=e;if("string"==typeof t&&(t=y(e,"base64pad")),!(t instanceof Uint8Array))throw new Error("Supplied key is neither a base64 string nor a Uint8Array");const r=await f.unmarshalPublicKey(t);return S(void 0,r)},r.createFromPrivKey=async e=>{if("string"==typeof e&&(e=y(e,"base64pad")),!(e instanceof Uint8Array))throw new Error("Supplied key is neither a base64 string nor a Uint8Array");const t=await f.unmarshalPrivateKey(e);return S(t,t.public)},r.createFromJSON=async e=>{const t=c.decode("z"+e.id),r=e.privKey&&y(e.privKey,"base64pad"),i=e.pubKey&&y(e.pubKey,"base64pad"),n=i&&await f.unmarshalPublicKey(i);if(!r)return new _(t,void 0,n);const s=await f.unmarshalPrivateKey(r),o=await E(s.public);let a;if(n&&(a=await E(n)),n&&!g(o,a))throw new Error("Public and private key do not match");if(t&&!g(o,t))throw new Error("Id and private key do not match");return new _(t,s,n)},r.createFromProtobuf=async e=>{"string"==typeof e&&(e=y(e,"base16"));let t,r,{id:i,privKey:n,pubKey:s}=p.decode(e);if(n=!!n&&await f.unmarshalPrivateKey(n),s=!!s&&await f.unmarshalPublicKey(s),n&&(r=await E(n.public)),s&&(t=await E(s)),n){if(s&&!g(r,t))throw new Error("Public and private key do not match");return new _(r,n,n.public)}if(s)return new _(t,void 0,s);if(i)return new _(i);throw new Error("Protobuf did not contain any usable key material")},r.parse=e=>("1"!==e.charAt(0)&&"Q"!==e.charAt(0)||(e=`z${e}`),r.createFromBytes(w.decode(e))),r.isPeerId=e=>Boolean("object"==typeof e&&e._id&&e._idB58String)},{"multiformats/cid":"9ooAY","multiformats/bases/base32":"5k9Tu","multiformats/bases/base36":"7VmDr","multiformats/bases/base58":"4n7mA","multiformats/bases/base64":"gaFBW","multiformats/bases/base16":"iQzgO","multiformats/hashes/digest":"kpRBg","libp2p-crypto/src/keys":"kWJWg","class-is":"gx31A","./proto":"c0IJt","uint8arrays/equals":"eY3cX","uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB","multiformats/hashes/identity":"eYCZn"}],kWJWg:[function(e,t,r){"use strict";const i=e("./keys");e("node-forge/lib/asn1"),e("node-forge/lib/pbe");const n=e("node-forge/lib/forge"),s=e("err-code"),{fromString:o}=e("uint8arrays/from-string"),a=e("./importer"),c={rsa:e("./rsa-class"),ed25519:e("./ed25519-class"),secp256k1:e("./secp256k1-class")(i,e("../random-bytes"))},u="secp256k1 support requires libp2p-crypto-secp256k1 package",l="ERR_MISSING_PACKAGE";function d(e){const t=c[e.toLowerCase()];if(!t){const t=Object.keys(c).join(" / ");throw s(new Error(`invalid or unsupported key type ${e}. Must be ${t}`),"ERR_UNSUPPORTED_KEY_TYPE")}return t}const f=async e=>{const t=i.PrivateKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return c.rsa.unmarshalRsaPrivateKey(r);case i.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PrivateKey(r);case i.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PrivateKey(r);throw s(new Error(u),l);default:d(t.Type)}};t.exports={supportedKeys:c,keysPBM:i,keyStretcher:e("./key-stretcher"),generateEphemeralKeyPair:e("./ephemeral-keys"),generateKeyPair:async(e,t)=>d(e).generateKeyPair(t),generateKeyPairFromSeed:async(e,t,r)=>{const i=d(e);if("ed25519"!==e.toLowerCase())throw s(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");return i.generateKeyPairFromSeed(t,r)},unmarshalPublicKey:e=>{const t=i.PublicKey.decode(e),r=t.Data;switch(t.Type){case i.KeyType.RSA:return c.rsa.unmarshalRsaPublicKey(r);case i.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PublicKey(r);case i.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PublicKey(r);throw s(new Error(u),l);default:d(t.Type)}},marshalPublicKey:(e,t)=>(d(t=(t||"rsa").toLowerCase()),e.bytes),unmarshalPrivateKey:f,marshalPrivateKey:(e,t)=>(d(t=(t||"rsa").toLowerCase()),e.bytes),import:async(e,t)=>{try{const r=await a.import(e,t);return f(r)}catch(e){}const r=n.pki.decryptRsaPrivateKey(e,t);if(null===r)throw s(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let i=n.asn1.toDer(n.pki.privateKeyToAsn1(r));return i=o(i.getBytes(),"ascii"),c.rsa.unmarshalRsaPrivateKey(i)}}},{"./keys":"jWSTZ","node-forge/lib/asn1":"bcsXQ","node-forge/lib/pbe":"gUP8s","node-forge/lib/forge":"4OuPD","err-code":"chZjB","uint8arrays/from-string":"dF7Y4","./importer":"jyqjk","./rsa-class":"1sbpX","./ed25519-class":"dh3ng","./secp256k1-class":"jXCAP","../random-bytes":"gsnuW","./key-stretcher":"kdBuU","./ephemeral-keys":"ds3K5"}],jWSTZ:[function(e,t,r){"use strict";var i,n,s=e("protobufjs/minimal"),o=s.Reader,a=s.Writer,c=s.util,u=s.roots["libp2p-crypto-keys"]||(s.roots["libp2p-crypto-keys"]={});u.KeyType=(i={},(n=Object.create(i))[i[0]="RSA"]=0,n[i[1]="Ed25519"]=1,n[i[2]="Secp256k1"]=2,n),u.PublicKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.Type=0,e.prototype.Data=c.newBuffer([]),e.encode=function(e,t){return t||(t=a.create()),t.uint32(8).int32(e.Type),t.uint32(18).bytes(e.Data),t},e.decode=function(e,t){e instanceof o||(e=o.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new u.PublicKey;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.Type=e.int32();break;case 2:i.Data=e.bytes();break;default:e.skipType(7&n)}}if(!i.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:i});if(!i.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:i});return i},e.fromObject=function(e){if(e instanceof u.PublicKey)return e;var t=new u.PublicKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),u.PrivateKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.Type=0,e.prototype.Data=c.newBuffer([]),e.encode=function(e,t){return t||(t=a.create()),t.uint32(8).int32(e.Type),t.uint32(18).bytes(e.Data),t},e.decode=function(e,t){e instanceof o||(e=o.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new u.PrivateKey;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.Type=e.int32();break;case 2:i.Data=e.bytes();break;default:e.skipType(7&n)}}if(!i.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:i});if(!i.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:i});return i},e.fromObject=function(e){if(e instanceof u.PrivateKey)return e;var t=new u.PrivateKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),t.exports=u},{"protobufjs/minimal":"grAXL"}],bcsXQ:[function(e,t,r){var i=e("./forge");e("./util"),e("./oids");var n=t.exports=i.asn1=i.asn1||{};function s(e,t,r){if(r>t){var i=new Error("Too few bytes to parse DER.");throw i.available=e.length(),i.remaining=t,i.requested=r,i}}n.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},n.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},n.create=function(e,t,r,s,o){if(i.util.isArray(s)){for(var a=[],c=0;c<s.length;++c)void 0!==s[c]&&a.push(s[c]);s=a}var u={tagClass:e,type:t,constructed:r,composed:r||i.util.isArray(s),value:s};return o&&"bitStringContents"in o&&(u.bitStringContents=o.bitStringContents,u.original=n.copy(u)),u},n.copy=function(e,t){var r;if(i.util.isArray(e)){r=[];for(var s=0;s<e.length;++s)r.push(n.copy(e[s],t));return r}return"string"==typeof e?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:n.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)},n.equals=function(e,t,r){if(i.util.isArray(e)){if(!i.util.isArray(t))return!1;if(e.length!==t.length)return!1;for(var s=0;s<e.length;++s)if(!n.equals(e[s],t[s]))return!1;return!0}if(typeof e!=typeof t)return!1;if("string"==typeof e)return e===t;var o=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&n.equals(e.value,t.value);return r&&r.includeBitStringContents&&(o=o&&e.bitStringContents===t.bitStringContents),o},n.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};function o(e,t,r,i){var a;s(e,t,2);var c=e.getByte();t--;var u=192&c,l=31&c;a=e.length();var d,f,h=function(e,t){var r=e.getByte();if(t--,128!==r){var i;if(128&r){var n=127&r;s(e,t,n),i=e.getInt(n<<3)}else i=r;if(i<0)throw new Error("Negative length: "+i);return i}}(e,t);if(t-=a-e.length(),void 0!==h&&h>t){if(i.strict){var p=new Error("Too few bytes to read ASN.1 value.");throw p.available=e.length(),p.remaining=t,p.requested=h,p}h=t}var g=32==(32&c);if(g)if(d=[],void 0===h)for(;;){if(s(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}a=e.length(),d.push(o(e,t,r+1,i)),t-=a-e.length()}else for(;h>0;)a=e.length(),d.push(o(e,h,r+1,i)),t-=a-e.length(),h-=a-e.length();if(void 0===d&&u===n.Class.UNIVERSAL&&l===n.Type.BITSTRING&&(f=e.bytes(h)),void 0===d&&i.decodeBitStrings&&u===n.Class.UNIVERSAL&&l===n.Type.BITSTRING&&h>1){var y=e.read,m=t,b=0;if(l===n.Type.BITSTRING&&(s(e,t,1),b=e.getByte(),t--),0===b)try{a=e.length();var v=o(e,t,r+1,{verbose:i.verbose,strict:!0,decodeBitStrings:!0}),w=a-e.length();t-=w,l==n.Type.BITSTRING&&w++;var _=v.tagClass;w!==h||_!==n.Class.UNIVERSAL&&_!==n.Class.CONTEXT_SPECIFIC||(d=[v])}catch(e){}void 0===d&&(e.read=y,t=m)}if(void 0===d){if(void 0===h){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=t}if(l===n.Type.BMPSTRING)for(d="";h>0;h-=2)s(e,t,2),d+=String.fromCharCode(e.getInt16()),t-=2;else d=e.getBytes(h)}var E=void 0===f?null:{bitStringContents:f};return n.create(u,l,g,d,E)}n.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=i.util.createBuffer(e)),o(e,e.length(),0,t)},n.toDer=function(e){var t=i.util.createBuffer(),r=e.tagClass|e.type,s=i.util.createBuffer(),o=!1;if("bitStringContents"in e&&(o=!0,e.original&&(o=n.equals(e,e.original))),o)s.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:s.putByte(0);for(var a=0;a<e.value.length;++a)void 0!==e.value[a]&&s.putBuffer(n.toDer(e.value[a]))}else if(e.type===n.Type.BMPSTRING)for(a=0;a<e.value.length;++a)s.putInt16(e.value.charCodeAt(a));else e.type===n.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?s.putBytes(e.value.substr(1)):s.putBytes(e.value);if(t.putByte(r),s.length()<=127)t.putByte(127&s.length());else{var c=s.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|u.length);for(a=u.length-1;a>=0;--a)t.putByte(u.charCodeAt(a))}return t.putBuffer(s),t},n.oidToDer=function(e){var t,r,n,s,o=e.split("."),a=i.util.createBuffer();a.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var c=2;c<o.length;++c){t=!0,r=[],n=parseInt(o[c],10);do{s=127&n,n>>>=7,t||(s|=128),r.push(s),t=!1}while(n>0);for(var u=r.length-1;u>=0;--u)a.putByte(r[u])}return a},n.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)n<<=7,128&(r=e.getByte())?n+=127&r:(t+="."+(n+r),n=0);return t},n.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var i=parseInt(e.substr(2,2),10)-1,n=parseInt(e.substr(4,2),10),s=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var c=e.charAt(10),u=10;"+"!==c&&"-"!==c&&(a=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(r,i,n),t.setUTCHours(s,o,a,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var l=60*parseInt(e.substr(u+1,2),10)+parseInt(e.substr(u+4,2),10);l*=6e4,"+"===c?t.setTime(+t-l):t.setTime(+t+l)}return t},n.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),i=parseInt(e.substr(4,2),10)-1,n=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),c=0,u=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var d=e.length-5,f=e.charAt(d);"+"!==f&&"-"!==f||(u=60*parseInt(e.substr(d+1,2),10)+parseInt(e.substr(d+4,2),10),u*=6e4,"+"===f&&(u*=-1),l=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,i,n),t.setUTCHours(s,o,a,c),t.setTime(+t+u)):(t.setFullYear(r,i,n),t.setHours(s,o,a,c)),t},n.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var i=0;i<r.length;++i)r[i].length<2&&(t+="0"),t+=r[i];return t+="Z"},n.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var i=0;i<r.length;++i)r[i].length<2&&(t+="0"),t+=r[i];return t+="Z"},n.integerToDer=function(e){var t=i.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},n.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},n.validate=function(e,t,r,s){var o=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)s&&(e.tagClass!==t.tagClass&&s.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&s.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(o=!0,t.value&&i.util.isArray(t.value))for(var a=0,c=0;o&&c<t.value.length;++c)o=t.value[c].optional||!1,e.value[a]&&((o=n.validate(e.value[a],t.value[c],r,s))?++a:t.value[c].optional&&(o=!0)),!o&&s&&s.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(o&&r)if(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}else s&&s.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return o};var a=/[^\\u0000-\\u00ff]/;n.prettyPrint=function(e,t,r){var s="";r=r||2,(t=t||0)>0&&(s+="\n");for(var o="",c=0;c<t*r;++c)o+=" ";switch(s+=o+"Tag: ",e.tagClass){case n.Class.UNIVERSAL:s+="Universal:";break;case n.Class.APPLICATION:s+="Application:";break;case n.Class.CONTEXT_SPECIFIC:s+="Context-Specific:";break;case n.Class.PRIVATE:s+="Private:"}if(e.tagClass===n.Class.UNIVERSAL)switch(s+=e.type,e.type){case n.Type.NONE:s+=" (None)";break;case n.Type.BOOLEAN:s+=" (Boolean)";break;case n.Type.INTEGER:s+=" (Integer)";break;case n.Type.BITSTRING:s+=" (Bit string)";break;case n.Type.OCTETSTRING:s+=" (Octet string)";break;case n.Type.NULL:s+=" (Null)";break;case n.Type.OID:s+=" (Object Identifier)";break;case n.Type.ODESC:s+=" (Object Descriptor)";break;case n.Type.EXTERNAL:s+=" (External or Instance of)";break;case n.Type.REAL:s+=" (Real)";break;case n.Type.ENUMERATED:s+=" (Enumerated)";break;case n.Type.EMBEDDED:s+=" (Embedded PDV)";break;case n.Type.UTF8:s+=" (UTF8)";break;case n.Type.ROID:s+=" (Relative Object Identifier)";break;case n.Type.SEQUENCE:s+=" (Sequence)";break;case n.Type.SET:s+=" (Set)";break;case n.Type.PRINTABLESTRING:s+=" (Printable String)";break;case n.Type.IA5String:s+=" (IA5String (ASCII))";break;case n.Type.UTCTIME:s+=" (UTC time)";break;case n.Type.GENERALIZEDTIME:s+=" (Generalized time)";break;case n.Type.BMPSTRING:s+=" (BMP String)"}else s+=e.type;if(s+="\n",s+=o+"Constructed: "+e.constructed+"\n",e.composed){var u=0,l="";for(c=0;c<e.value.length;++c)void 0!==e.value[c]&&(u+=1,l+=n.prettyPrint(e.value[c],t+1,r),c+1<e.value.length&&(l+=","));s+=o+"Sub values: "+u+l}else{if(s+=o+"Value: ",e.type===n.Type.OID){var d=n.derToOid(e.value);s+=d,i.pki&&i.pki.oids&&d in i.pki.oids&&(s+=" ("+i.pki.oids[d]+") ")}if(e.type===n.Type.INTEGER)try{s+=n.derToInteger(e.value)}catch(t){s+="0x"+i.util.bytesToHex(e.value)}else if(e.type===n.Type.BITSTRING){if(e.value.length>1?s+="0x"+i.util.bytesToHex(e.value.slice(1)):s+="(none)",e.value.length>0){var f=e.value.charCodeAt(0);1==f?s+=" (1 unused bit shown)":f>1&&(s+=" ("+f+" unused bits shown)")}}else e.type===n.Type.OCTETSTRING?(a.test(e.value)||(s+="("+e.value+") "),s+="0x"+i.util.bytesToHex(e.value)):e.type===n.Type.UTF8?s+=i.util.decodeUtf8(e.value):e.type===n.Type.PRINTABLESTRING||e.type===n.Type.IA5String?s+=e.value:a.test(e.value)?s+="0x"+i.util.bytesToHex(e.value):0===e.value.length?s+="[null]":s+=e.value}return s}},{"./forge":"4OuPD","./util":"df43p","./oids":"7VPL4"}],"4OuPD":[function(e,t,r){t.exports={options:{usePureJavaScript:!1}}},{}],df43p:[function(e,t,r){var i=arguments[3],n=e("process"),s=e("buffer").Buffer,o=e("./forge"),a=e("./baseN"),c=t.exports=o.util=o.util||{};function u(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function l(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(c.isArrayBuffer(e)||c.isArrayBufferView(e))if(void 0!==s&&e instanceof s)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof l||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if(void 0!==n&&n.nextTick,"function"==typeof setImmediate)return c.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(c.nextTick=function(e){return setImmediate(e)});if(c.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",t=[];c.setImmediate=function(r){t.push(r),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(r){if(r.source===window&&r.data===e){r.stopPropagation();var i=t.slice();t.length=0,i.forEach((function(e){e()}))}}),!0)}if("undefined"!=typeof MutationObserver){var r=Date.now(),i=!0,s=document.createElement("div");t=[];new MutationObserver((function(){var e=t.slice();t.length=0,e.forEach((function(e){e()}))})).observe(s,{attributes:!0});var o=c.setImmediate;c.setImmediate=function(e){Date.now()-r>15?(r=Date.now(),o(e)):(t.push(e),1===t.length&&s.setAttribute("a",i=!i))}}c.nextTick=c.setImmediate}(),c.isNodejs=void 0!==n&&n.versions&&n.versions.node,c.globalScope=c.isNodejs?i:"undefined"==typeof self?window:self,c.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},c.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},c.isArrayBufferView=function(e){return e&&c.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},c.ByteBuffer=l,c.ByteStringBuffer=l;var d=4096;function f(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=c.isArrayBuffer(e),i=c.isArrayBufferView(e);if(r||i)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}c.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>d&&(this.data.substr(0,1),this._constructedStringLength=0)},c.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},c.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},c.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},c.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},c.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},c.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(c.encodeUtf8(e))},c.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},c.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},c.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},c.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},c.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},c.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},c.ByteStringBuffer.prototype.putInt=function(e,t){u(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},c.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},c.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},c.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},c.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},c.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},c.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},c.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},c.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},c.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},c.ByteStringBuffer.prototype.getInt=function(e){u(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},c.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},c.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},c.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},c.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},c.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},c.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},c.ByteStringBuffer.prototype.copy=function(){var e=c.createBuffer(this.data);return e.read=this.read,e},c.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},c.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},c.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},c.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},c.ByteStringBuffer.prototype.toString=function(){return c.decodeUtf8(this.bytes())},c.DataBuffer=f,c.DataBuffer.prototype.length=function(){return this.write-this.read},c.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},c.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),i=new Uint8Array(this.length()+t);return i.set(r),this.data=new DataView(i.buffer),this},c.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},c.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},c.DataBuffer.prototype.putBytes=function(e,t){if(c.isArrayBufferView(e)){var r=(i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-i.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(i),this.write+=r,this}if(c.isArrayBuffer(e)){var i=new Uint8Array(e);return this.accommodate(i.byteLength),new Uint8Array(this.data.buffer).set(i,this.write),this.write+=i.byteLength,this}if(e instanceof c.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&c.isArrayBufferView(e.data)){i=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(i.byteLength),new Uint8Array(e.data.byteLength,this.write).set(i),this.write+=i.byteLength,this}if(e instanceof c.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var n;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),n=new Uint8Array(this.data.buffer,this.write),this.write+=c.binary.hex.decode(e,n,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),n=new Uint8Array(this.data.buffer,this.write),this.write+=c.binary.base64.decode(e,n,this.write),this;if("utf8"===t&&(e=c.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),n=new Uint8Array(this.data.buffer,this.write),this.write+=c.binary.raw.decode(n),this;if("utf16"===t)return this.accommodate(2*e.length),n=new Uint16Array(this.data.buffer,this.write),this.write+=c.text.utf16.encode(n),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},c.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},c.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},c.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},c.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},c.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},c.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},c.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},c.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},c.DataBuffer.prototype.putInt=function(e,t){u(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},c.DataBuffer.prototype.putSignedInt=function(e,t){return u(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},c.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},c.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},c.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},c.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},c.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},c.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},c.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},c.DataBuffer.prototype.getInt=function(e){u(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},c.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},c.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},c.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},c.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},c.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},c.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},c.DataBuffer.prototype.copy=function(){return new c.DataBuffer(this)},c.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},c.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},c.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},c.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},c.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return c.binary.raw.encode(t);if("hex"===e)return c.binary.hex.encode(t);if("base64"===e)return c.binary.base64.encode(t);if("utf8"===e)return c.text.utf8.decode(t);if("utf16"===e)return c.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},c.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=c.encodeUtf8(e)),new c.ByteBuffer(e)},c.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},c.xorBytes=function(e,t,r){for(var i="",n="",s="",o=0,a=0;r>0;--r,++o)n=e.charCodeAt(o)^t.charCodeAt(o),a>=10&&(i+=s,s="",a=0),s+=String.fromCharCode(n),++a;return i+=s},c.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},c.bytesToHex=function(e){return c.createBuffer(e).toHex()},c.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",p=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],g="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";c.encode64=function(e,t){for(var r,i,n,s="",o="",a=0;a<e.length;)r=e.charCodeAt(a++),i=e.charCodeAt(a++),n=e.charCodeAt(a++),s+=h.charAt(r>>2),s+=h.charAt((3&r)<<4|i>>4),isNaN(i)?s+="==":(s+=h.charAt((15&i)<<2|n>>6),s+=isNaN(n)?"=":h.charAt(63&n)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s},c.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,i,n,s="",o=0;o<e.length;)t=p[e.charCodeAt(o++)-43],r=p[e.charCodeAt(o++)-43],i=p[e.charCodeAt(o++)-43],n=p[e.charCodeAt(o++)-43],s+=String.fromCharCode(t<<2|r>>4),64!==i&&(s+=String.fromCharCode((15&r)<<4|i>>2),64!==n&&(s+=String.fromCharCode((3&i)<<6|n)));return s},c.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},c.decodeUtf8=function(e){return decodeURIComponent(escape(e))},c.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:a.encode,decode:a.decode}},c.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},c.binary.raw.decode=function(e,t,r){var i=t;i||(i=new Uint8Array(e.length));for(var n=r=r||0,s=0;s<e.length;++s)i[n++]=e.charCodeAt(s);return t?n-r:i},c.binary.hex.encode=c.bytesToHex,c.binary.hex.decode=function(e,t,r){var i=t;i||(i=new Uint8Array(Math.ceil(e.length/2)));var n=0,s=r=r||0;for(1&e.length&&(n=1,i[s++]=parseInt(e[0],16));n<e.length;n+=2)i[s++]=parseInt(e.substr(n,2),16);return t?s-r:i},c.binary.base64.encode=function(e,t){for(var r,i,n,s="",o="",a=0;a<e.byteLength;)r=e[a++],i=e[a++],n=e[a++],s+=h.charAt(r>>2),s+=h.charAt((3&r)<<4|i>>4),isNaN(i)?s+="==":(s+=h.charAt((15&i)<<2|n>>6),s+=isNaN(n)?"=":h.charAt(63&n)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s},c.binary.base64.decode=function(e,t,r){var i,n,s,o,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c<e.length;)i=p[e.charCodeAt(c++)-43],n=p[e.charCodeAt(c++)-43],s=p[e.charCodeAt(c++)-43],o=p[e.charCodeAt(c++)-43],a[u++]=i<<2|n>>4,64!==s&&(a[u++]=(15&n)<<4|s>>2,64!==o&&(a[u++]=(3&s)<<6|o));return t?u-r:a.subarray(0,u)},c.binary.base58.encode=function(e,t){return c.binary.baseN.encode(e,g,t)},c.binary.base58.decode=function(e,t){return c.binary.baseN.decode(e,g,t)},c.text={utf8:{},utf16:{}},c.text.utf8.encode=function(e,t,r){e=c.encodeUtf8(e);var i=t;i||(i=new Uint8Array(e.length));for(var n=r=r||0,s=0;s<e.length;++s)i[n++]=e.charCodeAt(s);return t?n-r:i},c.text.utf8.decode=function(e){return c.decodeUtf8(String.fromCharCode.apply(null,e))},c.text.utf16.encode=function(e,t,r){var i=t;i||(i=new Uint8Array(2*e.length));for(var n=new Uint16Array(i.buffer),s=r=r||0,o=r,a=0;a<e.length;++a)n[o++]=e.charCodeAt(a),s+=2;return t?s-r:i},c.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},c.deflate=function(e,t,r){if(t=c.decode64(e.deflate(c.encode64(t)).rval),r){var i=2;32&t.charCodeAt(1)&&(i=6),t=t.substring(i,t.length-4)}return t},c.inflate=function(e,t,r){var i=e.inflate(c.encode64(t)).rval;return null===i?null:c.decode64(i)};var y=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var i;if(null===r?i=e.removeItem(t):(r=c.encode64(JSON.stringify(r)),i=e.setItem(t,r)),void 0!==i&&!0!==i.rval){var n=new Error(i.error.message);throw n.id=i.error.id,n.name=i.error.name,n}},m=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var i=new Error(r.error.message);throw i.id=r.error.id,i.name=r.error.name,i}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(c.decode64(r))),r},b=function(e,t,r,i){var n=m(e,t);null===n&&(n={}),n[r]=i,y(e,t,n)},v=function(e,t,r){var i=m(e,t);return null!==i&&(i=r in i?i[r]:null),i},w=function(e,t,r){var i=m(e,t);if(null!==i&&r in i){delete i[r];var n=!0;for(var s in i){n=!1;break}n&&(i=null),y(e,t,i)}},_=function(e,t){y(e,t,null)},E=function(e,t,r){var i,n=null;void 0===r&&(r=["web","flash"]);var s=!1,o=null;for(var a in r){i=r[a];try{if("flash"===i||"both"===i){if(null===t[0])throw new Error("Flash local storage not available.");n=e.apply(this,t),s="flash"===i}"web"!==i&&"both"!==i||(t[0]=localStorage,n=e.apply(this,t),s=!0)}catch(e){o=e}if(s)break}if(!s)throw o;return n};c.setItem=function(e,t,r,i,n){E(b,arguments,n)},c.getItem=function(e,t,r,i){return E(v,arguments,i)},c.removeItem=function(e,t,r,i){E(w,arguments,i)},c.clearItems=function(e,t,r){E(_,arguments,r)},c.parseUrl=function(e){var t=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;t.lastIndex=0;var r=t.exec(e),i=null===r?null:{full:e,scheme:r[1],host:r[2],port:r[3],path:r[4]};return i&&(i.fullHost=i.host,i.port?(80!==i.port&&"http"===i.scheme||443!==i.port&&"https"===i.scheme)&&(i.fullHost+=":"+i.port):"http"===i.scheme?i.port=80:"https"===i.scheme&&(i.port=443),i.full=i.scheme+"://"+i.fullHost),i};var S=null;c.getQueryVariables=function(e){var t,r=function(e){for(var t={},r=e.split("&"),i=0;i<r.length;i++){var n,s,o=r[i].indexOf("=");o>0?(n=r[i].substring(0,o),s=r[i].substring(o+1)):(n=r[i],s=null),n in t||(t[n]=[]),n in Object.prototype||null===s||t[n].push(unescape(s))}return t};return void 0===e?(null===S&&(S="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=S):t=r(e),t},c.parseFragment=function(e){var t=e,r="",i=e.indexOf("?");i>0&&(t=e.substring(0,i),r=e.substring(i+1));var n=t.split("/");return n.length>0&&""===n[0]&&n.shift(),{pathString:t,queryString:r,path:n,query:""===r?{}:c.getQueryVariables(r)}},c.makeRequest=function(e){var t=c.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var i;return void 0===e?i=t.query:(i=t.query[e])&&void 0!==r&&(i=i[r]),i},getQueryLast:function(e,t){var i=r.getQuery(e);return i?i[i.length-1]:t}};return r},c.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var i=jQuery.param(t||{});return r=r||"",e+(i.length>0?"?"+i:"")+(r.length>0?"#"+r:"")},c.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},c.format=function(e){for(var t,r,i=/%./g,n=0,s=[],o=0;t=i.exec(e);){(r=e.substring(o,i.lastIndex-2)).length>0&&s.push(r),o=i.lastIndex;var a=t[0][1];switch(a){case"s":case"o":n<arguments.length?s.push(arguments[1+n++]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+a+"?>")}}return s.push(e.substring(o)),s.join("")},c.formatNumber=function(e,t,r,i){var n=e,s=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,a=void 0===i?".":i,c=n<0?"-":"",u=parseInt(n=Math.abs(+n||0).toFixed(s),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+a:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+a)+(s?o+Math.abs(n-u).toFixed(s).slice(2):"")},c.formatSize=function(e){return e=e>=1073741824?c.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?c.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?c.formatNumber(e/1024,0)+" KiB":c.formatNumber(e,0)+" bytes"},c.bytesFromIP=function(e){return-1!==e.indexOf(".")?c.bytesFromIPv4(e):-1!==e.indexOf(":")?c.bytesFromIPv6(e):null},c.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=c.createBuffer(),r=0;r<e.length;++r){var i=parseInt(e[r],10);if(isNaN(i))return null;t.putByte(i)}return t.getBytes()},c.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++t,!0}))).length+t),i=c.createBuffer(),n=0;n<8;++n)if(e[n]&&0!==e[n].length){var s=c.hexToBytes(e[n]);s.length<2&&i.putByte(0),i.putBytes(s)}else i.fillWithByte(0,r),r=0;return i.getBytes()},c.bytesToIP=function(e){return 4===e.length?c.bytesToIPv4(e):16===e.length?c.bytesToIPv6(e):null},c.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},c.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],i=0,n=0;n<e.length;n+=2){for(var s=c.bytesToHex(e[n]+e[n+1]);"0"===s[0]&&"0"!==s;)s=s.substr(1);if("0"===s){var o=r[r.length-1],a=t.length;o&&a===o.end+1?(o.end=a,o.end-o.start>r[i].end-r[i].start&&(i=r.length-1)):r.push({start:a,end:a})}t.push(s)}if(r.length>0){var u=r[i];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},c.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in c&&!e.update)return t(null,c.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return c.cores=navigator.hardwareConcurrency,t(null,c.cores);if("undefined"==typeof Worker)return c.cores=1,t(null,c.cores);if("undefined"==typeof Blob)return c.cores=2,t(null,c.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()<r;);self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(i,n,s){if(0===n){var o=Math.floor(i.reduce((function(e,t){return e+t}),0)/i.length);return c.cores=Math.max(1,o),URL.revokeObjectURL(r),t(null,c.cores)}!function(e,t){for(var i=[],n=[],s=0;s<e;++s){var o=new Worker(r);o.addEventListener("message",(function(r){if(n.push(r.data),n.length===e){for(var s=0;s<e;++s)i[s].terminate();t(null,n)}})),i.push(o)}for(s=0;s<e;++s)i[s].postMessage(s)}(s,(function(t,r){i.push(function(e,t){for(var r=[],i=0;i<e;++i)for(var n=t[i],s=r[i]=[],o=0;o<e;++o)if(i!==o){var a=t[o];(n.st>a.st&&n.st<a.et||a.st>n.st&&a.st<n.et)&&s.push(o)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(s,r)),e(i,n-1,s)}))}([],5,16)}},{process:"lHksA",buffer:"lHksA","./forge":"4OuPD","./baseN":"bdz56"}],bdz56:[function(e,t,r){var i=e("buffer").Buffer,n={};t.exports=n;var s={};n.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var i="";if(e instanceof Uint8Array){var n=0,s=t.length,o=t.charAt(0),a=[0];for(n=0;n<e.length;++n){for(var c=0,u=e[n];c<a.length;++c)u+=a[c]<<8,a[c]=u%s,u=u/s|0;for(;u>0;)a.push(u%s),u=u/s|0}for(n=0;0===e[n]&&n<e.length-1;++n)i+=o;for(n=a.length-1;n>=0;--n)i+=t[a[n]]}else i=function(e,t){var r=0,i=t.length,n=t.charAt(0),s=[0];for(r=0;r<e.length();++r){for(var o=0,a=e.at(r);o<s.length;++o)a+=s[o]<<8,s[o]=a%i,a=a/i|0;for(;a>0;)s.push(a%i),a=a/i|0}var c="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)c+=n;for(r=s.length-1;r>=0;--r)c+=t[s[r]];return c}(e,t);if(r){var l=new RegExp(".{1,"+r+"}","g");i=i.match(l).join("\r\n")}return i},n.decode=function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');var r=s[t];if(!r){r=s[t]=[];for(var n=0;n<t.length;++n)r[t.charCodeAt(n)]=n}e=e.replace(/\s/g,"");var o=t.length,a=t.charAt(0),c=[0];for(n=0;n<e.length;n++){var u=r[e.charCodeAt(n)];if(void 0===u)return;for(var l=0,d=u;l<c.length;++l)d+=c[l]*o,c[l]=255&d,d>>=8;for(;d>0;)c.push(255&d),d>>=8}for(var f=0;e[f]===a&&f<e.length-1;++f)c.push(0);return void 0!==i?i.from(c.reverse()):new Uint8Array(c.reverse())}},{buffer:"lHksA"}],"7VPL4":[function(e,t,r){var i=e("./forge");i.pki=i.pki||{};var n=t.exports=i.pki.oids=i.oids=i.oids||{};function s(e,t){n[e]=t,n[t]=e}function o(e,t){n[e]=t}s("1.2.840.113549.1.1.1","rsaEncryption"),s("1.2.840.113549.1.1.4","md5WithRSAEncryption"),s("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),s("1.2.840.113549.1.1.7","RSAES-OAEP"),s("1.2.840.113549.1.1.8","mgf1"),s("1.2.840.113549.1.1.9","pSpecified"),s("1.2.840.113549.1.1.10","RSASSA-PSS"),s("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),s("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),s("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),s("1.3.101.112","EdDSA25519"),s("1.2.840.10040.4.3","dsa-with-sha1"),s("1.3.14.3.2.7","desCBC"),s("1.3.14.3.2.26","sha1"),s("2.16.840.1.101.3.4.2.1","sha256"),s("2.16.840.1.101.3.4.2.2","sha384"),s("2.16.840.1.101.3.4.2.3","sha512"),s("1.2.840.113549.2.5","md5"),s("1.2.840.113549.1.7.1","data"),s("1.2.840.113549.1.7.2","signedData"),s("1.2.840.113549.1.7.3","envelopedData"),s("1.2.840.113549.1.7.4","signedAndEnvelopedData"),s("1.2.840.113549.1.7.5","digestedData"),s("1.2.840.113549.1.7.6","encryptedData"),s("1.2.840.113549.1.9.1","emailAddress"),s("1.2.840.113549.1.9.2","unstructuredName"),s("1.2.840.113549.1.9.3","contentType"),s("1.2.840.113549.1.9.4","messageDigest"),s("1.2.840.113549.1.9.5","signingTime"),s("1.2.840.113549.1.9.6","counterSignature"),s("1.2.840.113549.1.9.7","challengePassword"),s("1.2.840.113549.1.9.8","unstructuredAddress"),s("1.2.840.113549.1.9.14","extensionRequest"),s("1.2.840.113549.1.9.20","friendlyName"),s("1.2.840.113549.1.9.21","localKeyId"),s("1.2.840.113549.1.9.22.1","x509Certificate"),s("1.2.840.113549.1.12.10.1.1","keyBag"),s("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),s("1.2.840.113549.1.12.10.1.3","certBag"),s("1.2.840.113549.1.12.10.1.4","crlBag"),s("1.2.840.113549.1.12.10.1.5","secretBag"),s("1.2.840.113549.1.12.10.1.6","safeContentsBag"),s("1.2.840.113549.1.5.13","pkcs5PBES2"),s("1.2.840.113549.1.5.12","pkcs5PBKDF2"),s("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),s("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),s("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),s("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),s("1.2.840.113549.2.7","hmacWithSHA1"),s("1.2.840.113549.2.8","hmacWithSHA224"),s("1.2.840.113549.2.9","hmacWithSHA256"),s("1.2.840.113549.2.10","hmacWithSHA384"),s("1.2.840.113549.2.11","hmacWithSHA512"),s("1.2.840.113549.3.7","des-EDE3-CBC"),s("2.16.840.1.101.3.4.1.2","aes128-CBC"),s("2.16.840.1.101.3.4.1.22","aes192-CBC"),s("2.16.840.1.101.3.4.1.42","aes256-CBC"),s("2.5.4.3","commonName"),s("2.5.4.5","serialName"),s("2.5.4.6","countryName"),s("2.5.4.7","localityName"),s("2.5.4.8","stateOrProvinceName"),s("2.5.4.9","streetAddress"),s("2.5.4.10","organizationName"),s("2.5.4.11","organizationalUnitName"),s("2.5.4.13","description"),s("2.5.4.15","businessCategory"),s("2.5.4.17","postalCode"),s("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),s("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),s("2.16.840.1.113730.1.1","nsCertType"),s("2.16.840.1.113730.1.13","nsComment"),o("2.5.29.1","authorityKeyIdentifier"),o("2.5.29.2","keyAttributes"),o("2.5.29.3","certificatePolicies"),o("2.5.29.4","keyUsageRestriction"),o("2.5.29.5","policyMapping"),o("2.5.29.6","subtreesConstraint"),o("2.5.29.7","subjectAltName"),o("2.5.29.8","issuerAltName"),o("2.5.29.9","subjectDirectoryAttributes"),o("2.5.29.10","basicConstraints"),o("2.5.29.11","nameConstraints"),o("2.5.29.12","policyConstraints"),o("2.5.29.13","basicConstraints"),s("2.5.29.14","subjectKeyIdentifier"),s("2.5.29.15","keyUsage"),o("2.5.29.16","privateKeyUsagePeriod"),s("2.5.29.17","subjectAltName"),s("2.5.29.18","issuerAltName"),s("2.5.29.19","basicConstraints"),o("2.5.29.20","cRLNumber"),o("2.5.29.21","cRLReason"),o("2.5.29.22","expirationDate"),o("2.5.29.23","instructionCode"),o("2.5.29.24","invalidityDate"),o("2.5.29.25","cRLDistributionPoints"),o("2.5.29.26","issuingDistributionPoint"),o("2.5.29.27","deltaCRLIndicator"),o("2.5.29.28","issuingDistributionPoint"),o("2.5.29.29","certificateIssuer"),o("2.5.29.30","nameConstraints"),s("2.5.29.31","cRLDistributionPoints"),s("2.5.29.32","certificatePolicies"),o("2.5.29.33","policyMappings"),o("2.5.29.34","policyConstraints"),s("2.5.29.35","authorityKeyIdentifier"),o("2.5.29.36","policyConstraints"),s("2.5.29.37","extKeyUsage"),o("2.5.29.46","freshestCRL"),o("2.5.29.54","inhibitAnyPolicy"),s("1.3.6.1.4.1.11129.2.4.2","timestampList"),s("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),s("1.3.6.1.5.5.7.3.1","serverAuth"),s("1.3.6.1.5.5.7.3.2","clientAuth"),s("1.3.6.1.5.5.7.3.3","codeSigning"),s("1.3.6.1.5.5.7.3.4","emailProtection"),s("1.3.6.1.5.5.7.3.8","timeStamping")},{"./forge":"4OuPD"}],gUP8s:[function(e,t,r){var i=e("./forge");if(e("./aes"),e("./asn1"),e("./des"),e("./md"),e("./oids"),e("./pbkdf2"),e("./pem"),e("./random"),e("./rc2"),e("./rsa"),e("./util"),void 0===n)var n=i.jsbn.BigInteger;var s=i.asn1,o=i.pki=i.pki||{};t.exports=o.pbe=i.pbe=i.pbe||{};var a=o.oids,c={name:"EncryptedPrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},u={name:"PBES2Algorithms",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},l={name:"pkcs-12PbeParams",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"iterations"}]};function d(e,t){return e.start().update(t).digest().getBytes()}function f(e){var t;if(e){if(!(t=o.oids[s.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return h(t)}function h(e){var t=i.md;switch(e){case"hmacWithSHA224":t=i.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}o.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n,c,u,l=i.random.getBytesSync(r.saltSize),d=r.count,f=s.integerToDer(d);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var p,g,y;switch(r.algorithm){case"aes128":n=16,p=16,g=a["aes128-CBC"],y=i.aes.createEncryptionCipher;break;case"aes192":n=24,p=16,g=a["aes192-CBC"],y=i.aes.createEncryptionCipher;break;case"aes256":n=32,p=16,g=a["aes256-CBC"],y=i.aes.createEncryptionCipher;break;case"des":n=8,p=8,g=a.desCBC,y=i.des.createEncryptionCipher;break;default:throw(E=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,E}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),b=h(m),v=i.pkcs5.pbkdf2(t,l,d,n,b),w=i.random.getBytesSync(p);(S=y(v)).start(w),S.update(s.toDer(e)),S.finish(),u=S.output.getBytes();var _=function(e,t,r,n){var a=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,t.getBytes())]);"hmacWithSHA1"!==n&&a.value.push(s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,i.util.hexToBytes(r.toString(16))),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(o.oids[n]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]));return a}(l,f,n,m);c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a.pkcs5PBES2).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a.pkcs5PBKDF2).getBytes()),_]),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(g).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,w)])])])}else{var E;if("3des"!==r.algorithm)throw(E=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,E;n=24;var S,T=new i.util.ByteBuffer(l);v=o.pbe.generatePkcs12Key(t,T,1,d,n),w=o.pbe.generatePkcs12Key(t,T,2,d,n);(S=i.des.createEncryptionCipher(v)).start(w),S.update(s.toDer(e)),S.finish(),u=S.output.getBytes(),c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,l),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,f.getBytes())])])}return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[c,s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,u)])},o.decryptPrivateKeyInfo=function(e,t){var r=null,n={},a=[];if(!s.validate(e,c,n,a)){var u=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}var l=s.derToOid(n.encryptionOid),d=o.pbe.getCipher(l,n.encryptionParams,t),f=i.util.createBuffer(n.encryptedData);return d.update(f),d.finish()&&(r=s.fromDer(d.output)),r},o.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:s.toDer(e).getBytes()};return i.pem.encode(r,{maxline:t})},o.encryptedPrivateKeyFromPem=function(e){var t=i.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return s.fromDer(t.body)},o.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var n=o.wrapRsaPrivateKey(o.privateKeyToAsn1(e));return n=o.encryptPrivateKeyInfo(n,t,r),o.encryptedPrivateKeyToPem(n)}var a,c,u,l;switch(r.algorithm){case"aes128":a="AES-128-CBC",u=16,c=i.random.getBytesSync(16),l=i.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",u=24,c=i.random.getBytesSync(16),l=i.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",u=32,c=i.random.getBytesSync(16),l=i.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",u=24,c=i.random.getBytesSync(8),l=i.des.createEncryptionCipher;break;case"des":a="DES-CBC",u=8,c=i.random.getBytesSync(8),l=i.des.createEncryptionCipher;break;default:var d=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw d.algorithm=r.algorithm,d}var f=l(i.pbe.opensslDeriveBytes(t,c.substr(0,8),u));f.start(c),f.update(s.toDer(o.privateKeyToAsn1(e))),f.finish();var h={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:i.util.bytesToHex(c).toUpperCase()},body:f.output.getBytes()};return i.pem.encode(h)},o.decryptRsaPrivateKey=function(e,t){var r=null,n=i.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==n.type&&"PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type)throw(u=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=u,u;if(n.procType&&"ENCRYPTED"===n.procType.type){var a,c;switch(n.dekInfo.algorithm){case"DES-CBC":a=8,c=i.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,c=i.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,c=i.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,c=i.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,c=i.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,c=function(e){return i.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":a=8,c=function(e){return i.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":a=16,c=function(e){return i.rc2.createDecryptionCipher(e,128)};break;default:var u;throw(u=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".')).algorithm=n.dekInfo.algorithm,u}var l=i.util.hexToBytes(n.dekInfo.parameters),d=c(i.pbe.opensslDeriveBytes(t,l.substr(0,8),a));if(d.start(l),d.update(i.util.createBuffer(n.body)),!d.finish())return r;r=d.output.getBytes()}else r=n.body;return null!==(r="ENCRYPTED PRIVATE KEY"===n.type?o.decryptPrivateKeyInfo(s.fromDer(r),t):s.fromDer(r))&&(r=o.privateKeyFromAsn1(r)),r},o.pbe.generatePkcs12Key=function(e,t,r,n,s,o){var a,c;if(null==o){if(!("sha1"in i.md))throw new Error('"sha1" hash algorithm unavailable.');o=i.md.sha1.create()}var u=o.digestLength,l=o.blockLength,d=new i.util.ByteBuffer,f=new i.util.ByteBuffer;if(null!=e){for(c=0;c<e.length;c++)f.putInt16(e.charCodeAt(c));f.putInt16(0)}var h=f.length(),p=t.length(),g=new i.util.ByteBuffer;g.fillWithByte(r,l);var y=l*Math.ceil(p/l),m=new i.util.ByteBuffer;for(c=0;c<y;c++)m.putByte(t.at(c%p));var b=l*Math.ceil(h/l),v=new i.util.ByteBuffer;for(c=0;c<b;c++)v.putByte(f.at(c%h));var w=m;w.putBuffer(v);for(var _=Math.ceil(s/u),E=1;E<=_;E++){var S=new i.util.ByteBuffer;S.putBytes(g.bytes()),S.putBytes(w.bytes());for(var T=0;T<n;T++)o.start(),o.update(S.getBytes()),S=o.digest();var A=new i.util.ByteBuffer;for(c=0;c<l;c++)A.putByte(S.at(c%u));var k=Math.ceil(p/l)+Math.ceil(h/l),I=new i.util.ByteBuffer;for(a=0;a<k;a++){var R=new i.util.ByteBuffer(w.getBytes(l)),P=511;for(c=A.length()-1;c>=0;c--)P>>=8,P+=A.at(c)+R.at(c),R.setAt(c,255&P);I.putBuffer(R)}w=I,d.putBuffer(S)}return d.truncate(d.length()-s),d},o.pbe.getCipher=function(e,t,r){switch(e){case o.oids.pkcs5PBES2:return o.pbe.getCipherForPBES2(e,t,r);case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case o.oids["pbewithSHAAnd40BitRC2-CBC"]:return o.pbe.getCipherForPKCS12PBE(e,t,r);default:var i=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw i.oid=e,i.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],i}},o.pbe.getCipherForPBES2=function(e,t,r){var n,a={},c=[];if(!s.validate(t,u,a,c))throw(n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,n;if((e=s.derToOid(a.kdfOid))!==o.oids.pkcs5PBKDF2)throw(n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,n.supportedOids=["pkcs5PBKDF2"],n;if((e=s.derToOid(a.encOid))!==o.oids["aes128-CBC"]&&e!==o.oids["aes192-CBC"]&&e!==o.oids["aes256-CBC"]&&e!==o.oids["des-EDE3-CBC"]&&e!==o.oids.desCBC)throw(n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n;var l,d,h=a.kdfSalt,p=i.util.createBuffer(a.kdfIterationCount);switch(p=p.getInt(p.length()<<3),o.oids[e]){case"aes128-CBC":l=16,d=i.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,d=i.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,d=i.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,d=i.des.createDecryptionCipher;break;case"desCBC":l=8,d=i.des.createDecryptionCipher}var g=f(a.prfOid),y=i.pkcs5.pbkdf2(r,h,p,l,g),m=a.encIv,b=d(y);return b.start(m),b},o.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},a=[];if(!s.validate(t,l,n,a))throw(g=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=a,g;var c,u,d,h=i.util.createBuffer(n.salt),p=i.util.createBuffer(n.iterations);switch(p=p.getInt(p.length()<<3),e){case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,d=i.des.startDecrypting;break;case o.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,d=function(e,t){var r=i.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var g;throw(g=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,g}var y=f(n.prfOid),m=o.pbe.generatePkcs12Key(r,h,1,p,c,y);return y.start(),d(m,o.pbe.generatePkcs12Key(r,h,2,p,u,y))},o.pbe.opensslDeriveBytes=function(e,t,r,n){if(null==n){if(!("md5"in i.md))throw new Error('"md5" hash algorithm unavailable.');n=i.md.md5.create()}null===t&&(t="");for(var s=[d(n,e+t)],o=16,a=1;o<r;++a,o+=16)s.push(d(n,s[a-1]+e+t));return s.join("").substr(0,r)}},{"./forge":"4OuPD","./aes":"1SAd7","./asn1":"bcsXQ","./des":"6e2qD","./md":"fYbz5","./oids":"7VPL4","./pbkdf2":"j1TyX","./pem":"9qqi9","./random":"3tULm","./rc2":"k5bWr","./rsa":"9ROH2","./util":"df43p"}],"1SAd7":[function(e,t,r){var i=e("./forge");function n(e,t){i.cipher.registerAlgorithm(e,(function(){return new i.aes.Algorithm(e,t)}))}e("./cipher"),e("./cipherModes"),e("./util"),t.exports=i.aes=i.aes||{},i.aes.startEncrypting=function(e,t,r,i){var n=p({key:e,output:r,decrypt:!1,mode:i});return n.start(t),n},i.aes.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},i.aes.startDecrypting=function(e,t,r,i){var n=p({key:e,output:r,decrypt:!0,mode:i});return n.start(t),n},i.aes.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},i.aes.Algorithm=function(e,t){l||d();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return h(r._w,e,t,!1)},decrypt:function(e,t){return h(r._w,e,t,!0)}}}),r._init=!1},i.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(i.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=i.util.createBuffer();for(var n=0;n<t.length;++n)r.putByte(t[n])}}else r=i.util.createBuffer(r);if(!i.util.isArray(r)){t=r,r=[];var s=t.length();if(16===s||24===s||32===s){s>>>=2;for(n=0;n<s;++n)r.push(t.getInt32())}}if(!i.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var o=this.mode.name,a=-1!==["CFB","OFB","CTR","GCM"].indexOf(o);this._w=f(r,e.decrypt&&!a),this._init=!0}},i.aes._expandKey=function(e,t){return l||d(),f(e,t)},i.aes._updateBlock=h,n("AES-ECB",i.cipher.modes.ecb),n("AES-CBC",i.cipher.modes.cbc),n("AES-CFB",i.cipher.modes.cfb),n("AES-OFB",i.cipher.modes.ofb),n("AES-CTR",i.cipher.modes.ctr),n("AES-GCM",i.cipher.modes.gcm);var s,o,a,c,u,l=!1;function d(){l=!0,a=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;s=new Array(256),o=new Array(256),c=new Array(4),u=new Array(4);for(t=0;t<4;++t)c[t]=new Array(256),u[t]=new Array(256);var r,i,n,d,f,h,p,g=0,y=0;for(t=0;t<256;++t){d=(d=y^y<<1^y<<2^y<<3^y<<4)>>8^255&d^99,s[g]=d,o[d]=g,h=(f=e[d])<<24^d<<16^d<<8^d^f,p=((r=e[g])^(i=e[r])^(n=e[i]))<<24^(g^n)<<16^(g^i^n)<<8^g^r^n;for(var m=0;m<4;++m)c[m][g]=h,u[m][d]=p,h=h<<24|h>>>8,p=p<<24|p>>>8;0===g?g=y=1:(g=r^e[e[e[r^n]]],y^=e[e[y]])}}function f(e,t){for(var r,i=e.slice(0),n=1,o=i.length,c=4*(o+6+1),l=o;l<c;++l)r=i[l-1],l%o==0?(r=s[r>>>16&255]<<24^s[r>>>8&255]<<16^s[255&r]<<8^s[r>>>24]^a[n]<<24,n++):o>6&&l%o==4&&(r=s[r>>>24]<<24^s[r>>>16&255]<<16^s[r>>>8&255]<<8^s[255&r]),i[l]=i[l-o]^r;if(t){for(var d,f=u[0],h=u[1],p=u[2],g=u[3],y=i.slice(0),m=(l=0,(c=i.length)-4);l<c;l+=4,m-=4)if(0===l||l===c-4)y[l]=i[m],y[l+1]=i[m+3],y[l+2]=i[m+2],y[l+3]=i[m+1];else for(var b=0;b<4;++b)d=i[m+b],y[l+(3&-b)]=f[s[d>>>24]]^h[s[d>>>16&255]]^p[s[d>>>8&255]]^g[s[255&d]];i=y}return i}function h(e,t,r,i){var n,a,l,d,f,h,p,g,y,m,b,v,w=e.length/4-1;i?(n=u[0],a=u[1],l=u[2],d=u[3],f=o):(n=c[0],a=c[1],l=c[2],d=c[3],f=s),h=t[0]^e[0],p=t[i?3:1]^e[1],g=t[2]^e[2],y=t[i?1:3]^e[3];for(var _=3,E=1;E<w;++E)m=n[h>>>24]^a[p>>>16&255]^l[g>>>8&255]^d[255&y]^e[++_],b=n[p>>>24]^a[g>>>16&255]^l[y>>>8&255]^d[255&h]^e[++_],v=n[g>>>24]^a[y>>>16&255]^l[h>>>8&255]^d[255&p]^e[++_],y=n[y>>>24]^a[h>>>16&255]^l[p>>>8&255]^d[255&g]^e[++_],h=m,p=b,g=v;r[0]=f[h>>>24]<<24^f[p>>>16&255]<<16^f[g>>>8&255]<<8^f[255&y]^e[++_],r[i?3:1]=f[p>>>24]<<24^f[g>>>16&255]<<16^f[y>>>8&255]<<8^f[255&h]^e[++_],r[2]=f[g>>>24]<<24^f[y>>>16&255]<<16^f[h>>>8&255]<<8^f[255&p]^e[++_],r[i?1:3]=f[y>>>24]<<24^f[h>>>16&255]<<16^f[p>>>8&255]<<8^f[255&g]^e[++_]}function p(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?i.cipher.createDecipher(r,e.key):i.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var s=null;r instanceof i.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=e,n.call(t,r)},t}},{"./forge":"4OuPD","./cipher":"jMIHu","./cipherModes":"9MNR1","./util":"df43p"}],jMIHu:[function(e,t,r){var i=e("./forge");e("./util"),t.exports=i.cipher=i.cipher||{},i.cipher.algorithms=i.cipher.algorithms||{},i.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=i.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new i.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},i.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=i.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new i.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},i.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),i.cipher.algorithms[e]=t},i.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in i.cipher.algorithms?i.cipher.algorithms[e]:null};var n=i.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};n.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=i.util.createBuffer(),this.output=e.output||i.util.createBuffer(),this.mode.start(t)},n.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},n.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},{"./forge":"4OuPD","./util":"df43p"}],"9MNR1":[function(e,t,r){var i=e("./forge");e("./util"),i.cipher=i.cipher||{};var n=t.exports=i.cipher.modes=i.cipher.modes||{};function s(e,t){if("string"==typeof e&&(e=i.util.createBuffer(e)),i.util.isArray(e)&&e.length>4){var r=e;e=i.util.createBuffer();for(var n=0;n<r.length;++n)e.putByte(r[n])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!i.util.isArray(e)){var s=[],o=t/4;for(n=0;n<o;++n)s.push(e.getInt32());e=s}return e}function o(e){e[e.length-1]=e[e.length-1]+1&4294967295}function a(e){return[e/4294967296|0,4294967295&e]}n.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},n.ecb.prototype.start=function(e){},n.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(i=0;i<this._ints;++i)t.putInt32(this._outBlock[i])},n.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(i=0;i<this._ints;++i)t.putInt32(this._outBlock[i])},n.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},n.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),i=e.at(r-1);return!(i>this.blockSize<<2)&&(e.truncate(i),!0)},n.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},n.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},n.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var i=0;i<this._ints;++i)this._inBlock[i]=this._prev[i]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]);this._prev=this._outBlock},n.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(i=0;i<this._ints;++i)t.putInt32(this._prev[i]^this._outBlock[i]);this._prev=this._inBlock.slice(0)},n.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},n.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),i=e.at(r-1);return!(i>this.blockSize<<2)&&(e.truncate(i),!0)},n.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.cfb.prototype.encrypt=function(e,t,r){var i=e.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32()^this._outBlock[n],t.putInt32(this._inBlock[n]);else{var s=(this.blockSize-i)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32()^this._outBlock[n],this._partialOutput.putInt32(this._partialBlock[n]);if(s>0)e.read-=this.blockSize;else for(n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.cfb.prototype.decrypt=function(e,t,r){var i=e.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32(),t.putInt32(this._inBlock[n]^this._outBlock[n]);else{var s=(this.blockSize-i)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[n]^this._outBlock[n]);if(s>0)e.read-=this.blockSize;else for(n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ofb.prototype.encrypt=function(e,t,r){var i=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]),this._inBlock[n]=this._outBlock[n];else{var s=(this.blockSize-i)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s>0)e.read-=this.blockSize;else for(n=0;n<this._ints;++n)this._inBlock[n]=this._outBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.ofb.prototype.decrypt=n.ofb.prototype.encrypt,n.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ctr.prototype.encrypt=function(e,t,r){var i=e.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]);else{var s=(this.blockSize-i)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},n.ctr.prototype.decrypt=n.ctr.prototype.encrypt,n.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0,this._R=3774873600},n.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=i.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?i.util.createBuffer(e.additionalData):i.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=i.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=r.length();if(12===n)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*n)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,t=i.util.createBuffer(t),this._aDataLength=a(8*t.length());var s=t.length()%this.blockSize;for(s&&t.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},n.gcm.prototype.encrypt=function(e,t,r){var i=e.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize){for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^=e.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-i)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s<=0||r){if(r){var a=i%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(n=0;n<this._ints;++n)this._outBlock[n]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},n.gcm.prototype.decrypt=function(e,t,r){var i=e.length();if(i<this.blockSize&&!(r&&i>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^this._hashBlock[n]);i<this.blockSize?this._cipherLength+=i%this.blockSize:this._cipherLength+=this.blockSize},n.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=i.util.createBuffer();var n=this._aDataLength.concat(a(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,n);var s=[];this.cipher.encrypt(this._j0,s);for(var o=0;o<this._ints;++o)this.tag.putInt32(this._s[o]^s[o]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},n.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],i=t.slice(0),n=0;n<128;++n){e[n/32|0]&1<<31-n%32&&(r[0]^=i[0],r[1]^=i[1],r[2]^=i[2],r[3]^=i[3]),this.pow(i,i)}return r},n.gcm.prototype.pow=function(e,t){for(var r=1&e[3],i=3;i>0;--i)t[i]=e[i]>>>1|(1&e[i-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},n.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var i=e[r/8|0]>>>4*(7-r%8)&15,n=this._m[r][i];t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3]}return t},n.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},n.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,i=4*r,n=16*r,s=new Array(n),o=0;o<n;++o){var a=[0,0,0,0],c=(i-1-o%i)*t;a[o/i|0]=1<<t-1<<c,s[o]=this.generateSubHashTable(this.multiply(a,e),t)}return s},n.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,i=r>>>1,n=new Array(r);n[i]=e.slice(0);for(var s=i>>>1;s>0;)this.pow(n[2*s],n[s]=[]),s>>=1;for(s=2;s<i;){for(var o=1;o<s;++o){var a=n[s],c=n[o];n[s+o]=[a[0]^c[0],a[1]^c[1],a[2]^c[2],a[3]^c[3]]}s*=2}for(n[0]=[0,0,0,0],s=i+1;s<r;++s){var u=n[s^i];n[s]=[e[0]^u[0],e[1]^u[1],e[2]^u[2],e[3]^u[3]]}return n}},{"./forge":"4OuPD","./util":"df43p"}],"6e2qD":[function(e,t,r){var i=e("./forge");function n(e,t){i.cipher.registerAlgorithm(e,(function(){return new i.des.Algorithm(e,t)}))}e("./cipher"),e("./cipherModes"),e("./util"),t.exports=i.des=i.des||{},i.des.startEncrypting=function(e,t,r,i){var n=p({key:e,output:r,decrypt:!1,mode:i||(null===t?"ECB":"CBC")});return n.start(t),n},i.des.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},i.des.startDecrypting=function(e,t,r,i){var n=p({key:e,output:r,decrypt:!0,mode:i||(null===t?"ECB":"CBC")});return n.start(t),n},i.des.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},i.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return h(r._keys,e,t,!1)},decrypt:function(e,t){return h(r._keys,e,t,!0)}}}),r._init=!1},i.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=i.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],i=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],d=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],h=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],g=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length()>8?3:1,m=[],b=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],v=0,w=0;w<y;w++){var _=e.getInt32(),E=e.getInt32();_^=(t=252645135&(_>>>4^E))<<4,_^=t=65535&((E^=t)>>>-16^_),_^=(t=858993459&(_>>>2^(E^=t<<-16)))<<2,_^=t=65535&((E^=t)>>>-16^_),_^=(t=1431655765&(_>>>1^(E^=t<<-16)))<<1,_^=t=16711935&((E^=t)>>>8^_),t=(_^=(t=1431655765&(_>>>1^(E^=t<<8)))<<1)<<8|(E^=t)>>>20&240,_=E<<24|E<<8&16711680|E>>>8&65280|E>>>24&240,E=t;for(var S=0;S<b.length;++S){b[S]?(_=_<<2|_>>>26,E=E<<2|E>>>26):(_=_<<1|_>>>27,E=E<<1|E>>>27),E&=-15;var T=r[(_&=-15)>>>28]|i[_>>>24&15]|n[_>>>20&15]|s[_>>>16&15]|o[_>>>12&15]|a[_>>>8&15]|c[_>>>4&15],A=u[E>>>28]|l[E>>>24&15]|d[E>>>20&15]|f[E>>>16&15]|h[E>>>12&15]|p[E>>>8&15]|g[E>>>4&15];t=65535&(A>>>16^T),m[v++]=T^t,m[v++]=A^t<<16}}return m}(t),this._init=!0}},n("DES-ECB",i.cipher.modes.ecb),n("DES-CBC",i.cipher.modes.cbc),n("DES-CFB",i.cipher.modes.cfb),n("DES-OFB",i.cipher.modes.ofb),n("DES-CTR",i.cipher.modes.ctr),n("3DES-ECB",i.cipher.modes.ecb),n("3DES-CBC",i.cipher.modes.cbc),n("3DES-CFB",i.cipher.modes.cfb),n("3DES-OFB",i.cipher.modes.ofb),n("3DES-CTR",i.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],o=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],a=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],l=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],d=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],f=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function h(e,t,r,i){var n,h,p=32===e.length?3:9;n=3===p?i?[30,-2,-2]:[0,32,2]:i?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var g=t[0],y=t[1];g^=(h=252645135&(g>>>4^y))<<4,g^=(h=65535&(g>>>16^(y^=h)))<<16,g^=h=858993459&((y^=h)>>>2^g),g^=h=16711935&((y^=h<<2)>>>8^g),g=(g^=(h=1431655765&(g>>>1^(y^=h<<8)))<<1)<<1|g>>>31,y=(y^=h)<<1|y>>>31;for(var m=0;m<p;m+=3){for(var b=n[m+1],v=n[m+2],w=n[m];w!=b;w+=v){var _=y^e[w],E=(y>>>4|y<<28)^e[w+1];h=g,g=y,y=h^(o[_>>>24&63]|c[_>>>16&63]|l[_>>>8&63]|f[63&_]|s[E>>>24&63]|a[E>>>16&63]|u[E>>>8&63]|d[63&E])}h=g,g=y,y=h}y=y>>>1|y<<31,y^=h=1431655765&((g=g>>>1|g<<31)>>>1^y),y^=(h=16711935&(y>>>8^(g^=h<<1)))<<8,y^=(h=858993459&(y>>>2^(g^=h)))<<2,y^=h=65535&((g^=h)>>>16^y),y^=h=252645135&((g^=h<<16)>>>4^y),g^=h<<4,r[0]=g,r[1]=y}function p(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?i.cipher.createDecipher(r,e.key):i.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var s=null;r instanceof i.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=e,n.call(t,r)},t}},{"./forge":"4OuPD","./cipher":"jMIHu","./cipherModes":"9MNR1","./util":"df43p"}],fYbz5:[function(e,t,r){var i=e("./forge");t.exports=i.md=i.md||{},i.md.algorithms=i.md.algorithms||{}},{"./forge":"4OuPD"}],j1TyX:[function(e,t,r){var i=e("buffer").Buffer,n=e("./forge");e("./hmac"),e("./md"),e("./util");var s,o=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(s=e("crypto")),t.exports=n.pbkdf2=o.pbkdf2=function(e,t,r,o,a,c){if("function"==typeof a&&(c=a,a=null),n.util.isNodejs&&!n.options.usePureJavaScript&&s.pbkdf2&&(null===a||"object"!=typeof a)&&(s.pbkdf2Sync.length>4||!a||"sha1"===a))return"string"!=typeof a&&(a="sha1"),e=i.from(e,"binary"),t=i.from(t,"binary"),c?4===s.pbkdf2Sync.length?s.pbkdf2(e,t,r,o,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):s.pbkdf2(e,t,r,o,a,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):4===s.pbkdf2Sync.length?s.pbkdf2Sync(e,t,r,o).toString("binary"):s.pbkdf2Sync(e,t,r,o,a).toString("binary");if(null==a&&(a="sha1"),"string"==typeof a){if(!(a in n.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=n.md[a].create()}var u=a.digestLength;if(o>4294967295*u){var l=new Error("Derived key is too long.");if(c)return c(l);throw l}var d=Math.ceil(o/u),f=o-(d-1)*u,h=n.hmac.create();h.start(a,e);var p,g,y,m="";if(!c){for(var b=1;b<=d;++b){h.start(null,null),h.update(t),h.update(n.util.int32ToBytes(b)),p=y=h.digest().getBytes();for(var v=2;v<=r;++v)h.start(null,null),h.update(y),g=h.digest().getBytes(),p=n.util.xorBytes(p,g,u),y=g;m+=b<d?p:p.substr(0,f)}return m}b=1;function w(){if(b>d)return c(null,m);h.start(null,null),h.update(t),h.update(n.util.int32ToBytes(b)),p=y=h.digest().getBytes(),v=2,_()}function _(){if(v<=r)return h.start(null,null),h.update(y),g=h.digest().getBytes(),p=n.util.xorBytes(p,g,u),y=g,++v,n.util.setImmediate(_);m+=b<d?p:p.substr(0,f),++b,w()}w()}},{buffer:"lHksA","./forge":"4OuPD","./hmac":"2Wjua","./md":"fYbz5","./util":"df43p",crypto:"lHksA"}],"2Wjua":[function(e,t,r){var i=e("./forge");e("./md"),e("./util"),(t.exports=i.hmac=i.hmac||{}).create=function(){var e=null,t=null,r=null,n=null,s={start:function(s,o){if(null!==s)if("string"==typeof s){if(!((s=s.toLowerCase())in i.md.algorithms))throw new Error('Unknown hash algorithm "'+s+'"');t=i.md.algorithms[s].create()}else t=s;if(null===o)o=e;else{if("string"==typeof o)o=i.util.createBuffer(o);else if(i.util.isArray(o)){var a=o;o=i.util.createBuffer();for(var c=0;c<a.length;++c)o.putByte(a[c])}var u=o.length();u>t.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=i.util.createBuffer(),n=i.util.createBuffer(),u=o.length();for(c=0;c<u;++c){a=o.at(c);r.putByte(54^a),n.putByte(92^a)}if(u<t.blockLength)for(a=t.blockLength-u,c=0;c<a;++c)r.putByte(54),n.putByte(92);e=o,r=r.bytes(),n=n.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(n),t.update(e),t.digest()}};return s.digest=s.getMac,s}},{"./forge":"4OuPD","./md":"fYbz5","./util":"df43p"}],"9qqi9":[function(e,t,r){var i=e("./forge");e("./util");var n=t.exports=i.pem=i.pem||{};function s(e){for(var t=e.name+": ",r=[],i=function(e,t){return" "+t},n=0;n<e.values.length;++n)r.push(e.values[n].replace(/^(\S+\r\n)/,i));t+=r.join(",")+"\r\n";var s=0,o=-1;for(n=0;n<t.length;++n,++s)if(s>65&&-1!==o){var a=t[o];","===a?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+a+t.substr(o+1),s=n-o-1,o=-1,++n}else" "!==t[n]&&"\t"!==t[n]&&","!==t[n]||(o=n);return t}function o(e){return e.replace(/^\s+/,"")}n.encode=function(e,t){t=t||{};var r,n="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(n+=s(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(n+=s(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),n+=s(r)),e.headers)for(var o=0;o<e.headers.length;++o)n+=s(e.headers[o]);return e.procType&&(n+="\r\n"),n+=i.util.encode64(e.body,t.maxline||64)+"\r\n",n+="-----END "+e.type+"-----\r\n"},n.decode=function(e){for(var t,r=[],n=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,s=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,a=/\r?\n/;t=n.exec(e);){var c={type:t[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:i.util.decode64(t[3])};if(r.push(c),t[2]){for(var u=t[2].split(a),l=0;t&&l<u.length;){for(var d=u[l].replace(/\s+$/,""),f=l+1;f<u.length;++f){var h=u[f];if(!/\s/.test(h[0]))break;d+=h,l=f}if(t=d.match(s)){for(var p={name:t[1],values:[]},g=t[2].split(","),y=0;y<g.length;++y)p.values.push(o(g[y]));if(c.procType)if(c.contentDomain||"Content-Domain"!==p.name)if(c.dekInfo||"DEK-Info"!==p.name)c.headers.push(p);else{if(0===p.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');c.dekInfo={algorithm:g[0],parameters:g[1]||null}}else c.contentDomain=g[0]||"";else{if("Proc-Type"!==p.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==p.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');c.procType={version:g[0],type:g[1]}}}++l}if("ENCRYPTED"===c.procType&&!c.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}},{"./forge":"4OuPD","./util":"df43p"}],"3tULm":[function(e,t,r){var i=e("./forge");e("./aes"),e("./sha256"),e("./prng"),e("./util"),i.random&&i.random.getBytes?t.exports=i.random:function(e){var r={},n=new Array(4),s=i.util.createBuffer();function o(){var e=i.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=i.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),i.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=i.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return i.aes._updateBlock(e,t,n,!1),s.putInt32(n[0]),s.putInt32(n[1]),s.putInt32(n[2]),s.putInt32(n[3]),s.getBytes()},r.increment=function(e){return++e[3],e},r.md=i.md.sha256;var a=o(),c=null,u=i.util.globalScope,l=u.crypto||u.msCrypto;if(l&&l.getRandomValues&&(c=function(e){return l.getRandomValues(e)}),i.options.usePureJavaScript||!i.util.isNodejs&&!c){if("undefined"==typeof window||window.document,a.collectInt(+new Date,32),"undefined"!=typeof navigator){var d="";for(var f in navigator)try{"string"==typeof navigator[f]&&(d+=navigator[f])}catch(e){}a.collect(d),d=null}e&&(e().mousemove((function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)})),e().keypress((function(e){a.collectInt(e.charCode,8)})))}if(i.random)for(var f in a)i.random[f]=a[f];else i.random=a;i.random.createInstance=o,t.exports=i.random}("undefined"!=typeof jQuery?jQuery:null)},{"./forge":"4OuPD","./aes":"1SAd7","./sha256":"gaK8u","./prng":"5YtEX","./util":"df43p"}],gaK8u:[function(e,t,r){var i=e("./forge");e("./md"),e("./util");var n=t.exports=i.sha256=i.sha256||{};i.md.sha256=i.md.algorithms.sha256=n,n.create=function(){o||(s=String.fromCharCode(128),s+=i.util.fillString(String.fromCharCode(0),64),a=[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],o=!0);var e=null,t=i.util.createBuffer(),r=new Array(64),n={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var r=n.messageLengthSize/4,s=0;s<r;++s)n.fullMessageLength.push(0);return t=i.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},n}};return n.start(),n.update=function(s,o){"utf8"===o&&(s=i.util.encodeUtf8(s));var a=s.length;n.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=a[1],a[1]=a[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(s),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),n},n.digest=function(){var o=i.util.createBuffer();o.putBytes(t.bytes());var a,u=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;o.putBytes(s.substr(0,n.blockLength-u));for(var l=8*n.fullMessageLength[0],d=0;d<n.fullMessageLength.length-1;++d)l+=(a=8*n.fullMessageLength[d+1])/4294967296>>>0,o.putInt32(l>>>0),l=a>>>0;o.putInt32(l);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(f,r,o);var h=i.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h.putInt32(f.h5),h.putInt32(f.h6),h.putInt32(f.h7),h},n};var s=null,o=!1,a=null;function c(e,t,r){for(var i,n,s,o,c,u,l,d,f,h,p,g,y,m=r.length();m>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)i=((i=t[c-2])>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,n=((n=t[c-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,t[c]=i+t[c-7]+n+t[c-16]|0;for(u=e.h0,l=e.h1,d=e.h2,f=e.h3,h=e.h4,p=e.h5,g=e.h6,y=e.h7,c=0;c<64;++c)s=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),o=u&l|d&(u^l),i=y+((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(g^h&(p^g))+a[c]+t[c],y=g,g=p,p=h,h=f+i>>>0,f=d,d=l,l=u,u=i+(n=s+o)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+l|0,e.h2=e.h2+d|0,e.h3=e.h3+f|0,e.h4=e.h4+h|0,e.h5=e.h5+p|0,e.h6=e.h6+g|0,e.h7=e.h7+y|0,m-=64}}},{"./forge":"4OuPD","./md":"fYbz5","./util":"df43p"}],"5YtEX":[function(e,t,r){var i=e("process"),n=e("./forge");e("./util");var s=null;!n.util.isNodejs||n.options.usePureJavaScript||i.versions["node-webkit"]||(s=e("crypto")),(t.exports=n.prng=n.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,i=new Array(32),o=0;o<32;++o)i[o]=r.create();function a(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,i=0;i<32;++i)t.reseeds%r==0&&(e.update(t.pools[i].digest().getBytes()),t.pools[i].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var n=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(n),t.generated=0}function u(e){var t=null,r=n.util.globalScope,i=r.crypto||r.msCrypto;i&&i.getRandomValues&&(t=function(e){return i.getRandomValues(e)});var s=n.util.createBuffer();if(t)for(;s.length()<e;){var o=Math.max(1,Math.min(e-s.length(),65536)/4),a=new Uint32Array(Math.floor(o));try{t(a);for(var c=0;c<a.length;++c)s.putInt32(a[c])}catch(e){if(!("undefined"!=typeof QuotaExceededError&&e instanceof QuotaExceededError))throw e}}if(s.length()<e)for(var u,l,d,f=Math.floor(65536*Math.random());s.length()<e;){l=16807*(65535&f),l+=(32767&(u=16807*(f>>16)))<<16,f=4294967295&(l=(2147483647&(l+=u>>15))+(l>>31));for(c=0;c<3;++c)d=f>>>(c<<3),d^=Math.floor(256*Math.random()),s.putByte(String.fromCharCode(255&d))}return s.getBytes(e)}return t.pools=i,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var i=t.plugin.cipher,s=t.plugin.increment,o=t.plugin.formatKey,a=t.plugin.formatSeed,u=n.util.createBuffer();t.key=null,function l(d){if(d)return r(d);if(u.length()>=e)return r(null,u.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return n.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,i){if(r)return e(r);t.collect(i),c(),e()}))}(l)}));var f=i(t.key,t.seed);t.generated+=f.length,u.putBytes(f),t.key=o(i(t.key,s(t.seed))),t.seed=a(i(t.key,t.seed)),n.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,i=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed;t.key=null;for(var c=n.util.createBuffer();c.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&a();var u=r(t.key,t.seed);t.generated+=u.length,c.putBytes(u),t.key=s(r(t.key,i(t.seed))),t.seed=o(r(t.key,t.seed))}return c.getBytes(e)},s?(t.seedFile=function(e,t){s.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return s.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,u(e))}catch(e){t(e)}},t.seedFileSync=u),t.collect=function(e){for(var r=e.length,i=0;i<r;++i)t.pools[t.pool].update(e.substr(i,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,r){for(var i="",n=0;n<r;n+=8)i+=String.fromCharCode(e>>n&255);t.collect(i)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var i=r.data;i.forge&&i.forge.prng&&(self.removeEventListener("message",e),t(i.forge.prng.err,i.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(r){var i=r.data;i.forge&&i.forge.prng&&t.seedFile(i.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))}},t}},{process:"lHksA","./forge":"4OuPD","./util":"df43p",crypto:"lHksA"}],k5bWr:[function(e,t,r){var i=e("./forge");e("./util");var n=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],s=[1,2,3,5],o=function(e,t){return e<<t&65535|(65535&e)>>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};t.exports=i.rc2=i.rc2||{},i.rc2.expandKey=function(e,t){"string"==typeof e&&(e=i.util.createBuffer(e)),t=t||128;var r,s=e,o=e.length(),a=t,c=Math.ceil(a/8),u=255>>(7&a);for(r=o;r<128;r++)s.putByte(n[s.at(r-1)+s.at(r-o)&255]);for(s.setAt(128-c,n[s.at(128-c)&u]),r=127-c;r>=0;r--)s.setAt(r,n[s.at(r+1)^s.at(r+c)]);return s};var c=function(e,t,r){var n,c,u,l,d=!1,f=null,h=null,p=null,g=[];for(e=i.rc2.expandKey(e,t),u=0;u<64;u++)g.push(e.getInt16Le());r?(n=function(e){for(u=0;u<4;u++)e[u]+=g[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=o(e[u],s[u]),l++},c=function(e){for(u=0;u<4;u++)e[u]+=g[63&e[(u+3)%4]]}):(n=function(e){for(u=3;u>=0;u--)e[u]=a(e[u],s[u]),e[u]-=g[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),l--},c=function(e){for(u=3;u>=0;u--)e[u]-=g[63&e[(u+3)%4]]});var y=function(e){var t=[];for(u=0;u<4;u++){var i=f.getInt16Le();null!==p&&(r?i^=p.getInt16Le():p.putInt16Le(i)),t.push(65535&i)}l=r?0:63;for(var n=0;n<e.length;n++)for(var s=0;s<e[n][0];s++)e[n][1](t);for(u=0;u<4;u++)null!==p&&(r?p.putInt16Le(t[u]):t[u]^=p.getInt16Le()),h.putInt16Le(t[u])},m=null;return m={start:function(e,t){e&&"string"==typeof e&&(e=i.util.createBuffer(e)),d=!1,f=i.util.createBuffer(),h=t||new i.util.createBuffer,p=e,m.output=h},update:function(e){for(d||f.putBuffer(e);f.length()>=8;)y([[5,n],[1,c],[6,n],[1,c],[5,n]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,f,!r);else{var i=8===f.length()?8:8-f.length();f.fillWithByte(i,i)}if(t&&(d=!0,m.update()),!r&&(t=0===f.length()))if(e)t=e(8,h,!r);else{var n=h.length(),s=h.at(n-1);s>n?t=!1:h.truncate(s)}return t}}};i.rc2.startEncrypting=function(e,t,r){var n=i.rc2.createEncryptionCipher(e,128);return n.start(t,r),n},i.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},i.rc2.startDecrypting=function(e,t,r){var n=i.rc2.createDecryptionCipher(e,128);return n.start(t,r),n},i.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},{"./forge":"4OuPD","./util":"df43p"}],"9ROH2":[function(e,t,r){var i=e("./forge");if(e("./asn1"),e("./jsbn"),e("./oids"),e("./pkcs1"),e("./prime"),e("./random"),e("./util"),void 0===n)var n=i.jsbn.BigInteger;var s=i.util.isNodejs?e("crypto"):null,o=i.asn1,a=i.util;i.pki=i.pki||{},t.exports=i.pki.rsa=i.rsa=i.rsa||{};var c=i.pki,u=[6,4,2,4,2,4,6,2],l={name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},d={name:"RSAPrivateKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},h=i.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},p=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var i=o.oidToDer(t).getBytes(),n=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),s=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]);s.value.push(o.create(o.Class.UNIVERSAL,o.Type.OID,!1,i)),s.value.push(o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,""));var a=o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e.digest().getBytes());return n.value.push(s),n.value.push(a),o.toDer(n).getBytes()},g=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var s;t.dP||(t.dP=t.d.mod(t.p.subtract(n.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(n.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{s=new n(i.util.bytesToHex(i.random.getBytes(t.n.bitLength()/8)),16)}while(s.compareTo(t.n)>=0||!s.gcd(t.n).equals(n.ONE));for(var o=(e=e.multiply(s.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);o.compareTo(a)<0;)o=o.add(t.p);var c=o.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return c=c.multiply(s.modInverse(t.n)).mod(t.n)};function y(e,t,r){var n=i.util.createBuffer(),s=Math.ceil(t.n.bitLength()/8);if(e.length>s-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=e.length,o.max=s-11,o}n.putByte(0),n.putByte(r);var a,c=s-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var u=0;u<c;++u)n.putByte(a)}else for(;c>0;){var l=0,d=i.random.getBytes(c);for(u=0;u<c;++u)0===(a=d.charCodeAt(u))?++l:n.putByte(a);c=l}return n.putByte(0),n.putBytes(e),n}function m(e,t,r,n){var s=Math.ceil(t.n.bitLength()/8),o=i.util.createBuffer(e),a=o.getByte(),c=o.getByte();if(0!==a||r&&0!==c&&1!==c||!r&&2!=c||r&&0===c&&void 0===n)throw new Error("Encryption block is invalid.");var u=0;if(0===c){u=s-3-n;for(var l=0;l<u;++l)if(0!==o.getByte())throw new Error("Encryption block is invalid.")}else if(1===c)for(u=0;o.length()>1;){if(255!==o.getByte()){--o.read;break}++u}else if(2===c)for(u=0;o.length()>1;){if(0===o.getByte()){--o.read;break}++u}if(0!==o.getByte()||u!==s-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function b(e,t,r){"function"==typeof t&&(r=t,t={});var s={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function o(){a(e.pBits,(function(t,i){return t?r(t):(e.p=i,null!==e.q?u(t,e.q):void a(e.qBits,u))}))}function a(e,t){i.prime.generateProbablePrime(e,s,t)}function u(t,i){if(t)return r(t);if(e.q=i,e.p.compareTo(e.q)<0){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(n.ONE).gcd(e.e).compareTo(n.ONE))return e.p=null,void o();if(0!==e.q.subtract(n.ONE).gcd(e.e).compareTo(n.ONE))return e.q=null,void a(e.qBits,u);if(e.p1=e.p.subtract(n.ONE),e.q1=e.q.subtract(n.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(n.ONE))return e.p=e.q=null,void o();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,u);var l=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(s.prng=t.prng),o()}function v(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=i.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function w(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function _(e){return i.util.isNodejs&&"function"==typeof s[e]}function E(e){return void 0!==a.globalScope&&"object"==typeof a.globalScope.crypto&&"object"==typeof a.globalScope.crypto.subtle&&"function"==typeof a.globalScope.crypto.subtle[e]}function S(e){return void 0!==a.globalScope&&"object"==typeof a.globalScope.msCrypto&&"object"==typeof a.globalScope.msCrypto.subtle&&"function"==typeof a.globalScope.msCrypto.subtle[e]}function T(e){for(var t=i.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}c.rsa.encrypt=function(e,t,r){var s,o=r,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(o=2===r,s=y(e,t,r)):(s=i.util.createBuffer()).putBytes(e);for(var c=new n(s.toHex(),16),u=g(c,t,o).toString(16),l=i.util.createBuffer(),d=a-Math.ceil(u.length/2);d>0;)l.putByte(0),--d;return l.putBytes(i.util.hexToBytes(u)),l.getBytes()},c.rsa.decrypt=function(e,t,r,s){var o=Math.ceil(t.n.bitLength()/8);if(e.length!==o){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=o,a}var c=new n(i.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=g(c,t,r).toString(16),l=i.util.createBuffer(),d=o-Math.ceil(u.length/2);d>0;)l.putByte(0),--d;return l.putBytes(i.util.hexToBytes(u)),!1!==s?m(l.getBytes(),t,r):l.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var s,o=(r=r||{}).prng||i.random,a={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},c=r.algorithm||"PRIMEINC";if("PRIMEINC"!==c)throw new Error("Invalid key generation algorithm: "+c);return(s={algorithm:c,state:0,bits:e,rng:a,eInt:t||65537,e:new n(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(s.eInt),s},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new n(null);r.fromInt(30);for(var i,s=0,o=function(e,t){return e|t},a=+new Date,l=0;null===e.keys&&(t<=0||l<t);){if(0===e.state){var d=null===e.p?e.pBits:e.qBits,f=d-1;0===e.pqState?(e.num=new n(d,e.rng),e.num.testBit(f)||e.num.bitwiseTo(n.ONE.shiftLeft(f),o,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),s=0,++e.pqState):1===e.pqState?e.num.bitLength()>d?e.pqState=0:e.num.isProbablePrime(w(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(u[s++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(n.ONE).gcd(e.e).compareTo(n.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(n.ONE),e.q1=e.q.subtract(n.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(n.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var h=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,h,e.p,e.q,h.mod(e.p1),h.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}l+=(i=+new Date)-a,a=i}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!i.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(n){if(_("generateKeyPair"))return s.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return n(e);n(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(E("generateKey")&&E("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:T(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return a.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){n(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(o.fromDer(i.util.createBuffer(e)));n(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(S("generateKey")&&S("exportKey")){var u=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:T(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,r=a.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(o.fromDer(i.util.createBuffer(t)));n(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(u.onerror=function(e){n(e)})}}else if(_("generateKeyPairSync")){var l=s.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(l.privateKey),publicKey:c.publicKeyFromPem(l.publicKey)}}var d=c.rsa.createKeyPairGenerationState(e,t,r);if(!n)return c.rsa.stepKeyPairGenerationState(d,0),d.keys;b(d,r,n)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,n){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return y(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return i.pkcs1.encode_rsa_oaep(t,e,n)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var s=t.encode(e,r,!0);return c.rsa.encrypt(s,r,!0)},verify:function(e,t,i){"string"==typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===i?i={verify:function(e,t){return t=m(t,r,!0),e===o.fromDer(t).value[1].value}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===(t=m(t,r,!0))}});var n=c.rsa.decrypt(t,r,!0,!1);return i.verify(e,n,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,n,s,o,a,u){var l={n:e,e:t,d:r,p:n,q:s,dP:o,dQ:a,qInv:u,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=c.rsa.decrypt(e,l,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return i.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,l,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:p},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var i=t.encode(e,l.n.bitLength());return c.rsa.encrypt(i,l,r)}};return l},c.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(c.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,s,a,u,f,h,p,g={},y=[];if(o.validate(e,l,g,y)&&(e=o.fromDer(i.util.createBuffer(g.privateKey))),g={},y=[],!o.validate(e,d,g,y)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=y,m}return t=i.util.createBuffer(g.privateKeyModulus).toHex(),r=i.util.createBuffer(g.privateKeyPublicExponent).toHex(),s=i.util.createBuffer(g.privateKeyPrivateExponent).toHex(),a=i.util.createBuffer(g.privateKeyPrime1).toHex(),u=i.util.createBuffer(g.privateKeyPrime2).toHex(),f=i.util.createBuffer(g.privateKeyExponent1).toHex(),h=i.util.createBuffer(g.privateKeyExponent2).toHex(),p=i.util.createBuffer(g.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new n(t,16),new n(r,16),new n(s,16),new n(a,16),new n(u,16),new n(f,16),new n(h,16),new n(p,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(o.validate(e,h,t,r)){var s,a=o.derToOid(t.publicKeyOid);if(a!==c.oids.rsaEncryption)throw(s=new Error("Cannot read public key. Unknown OID.")).oid=a,s;e=t.rsaPublicKey}if(r=[],!o.validate(e,f,t,r))throw(s=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,s;var u=i.util.createBuffer(t.publicKeyModulus).toHex(),l=i.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new n(u,16),new n(l,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(c.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.e))])}},{"./forge":"4OuPD","./asn1":"bcsXQ","./jsbn":"eeS3U","./oids":"7VPL4","./pkcs1":"2vXck","./prime":"ZaXlg","./random":"3tULm","./util":"df43p",crypto:"lHksA"}],eeS3U:[function(e,t,r){var i,n=e("./forge");t.exports=n.jsbn=n.jsbn||{};function s(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function o(){return new s(null)}function a(e,t,r,i,n,s){for(var o=16383&t,a=t>>14;--s>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,l=a*c+u*o;n=((c=o*c+((16383&l)<<14)+r.data[i]+n)>>28)+(l>>14)+a*u,r.data[i++]=268435455&c}return n}n.jsbn.BigInteger=s,"undefined"==typeof navigator?(s.prototype.am=a,i=28):"Microsoft Internet Explorer"==navigator.appName?(s.prototype.am=function(e,t,r,i,n,s){for(var o=32767&t,a=t>>15;--s>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,l=a*c+u*o;n=((c=o*c+((32767&l)<<15)+r.data[i]+(1073741823&n))>>>30)+(l>>>15)+a*u+(n>>>30),r.data[i++]=1073741823&c}return n},i=30):"Netscape"!=navigator.appName?(s.prototype.am=function(e,t,r,i,n,s){for(;--s>=0;){var o=t*this.data[e++]+r.data[i]+n;n=Math.floor(o/67108864),r.data[i++]=67108863&o}return n},i=26):(s.prototype.am=a,i=28),s.prototype.DB=i,s.prototype.DM=(1<<i)-1,s.prototype.DV=1<<i;s.prototype.FV=Math.pow(2,52),s.prototype.F1=52-i,s.prototype.F2=2*i-52;var c,u,l=new Array;for(c="0".charCodeAt(0),u=0;u<=9;++u)l[c++]=u;for(c="a".charCodeAt(0),u=10;u<36;++u)l[c++]=u;for(c="A".charCodeAt(0),u=10;u<36;++u)l[c++]=u;function d(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function f(e,t){var r=l[e.charCodeAt(t)];return null==r?-1:r}function h(e){var t=o();return t.fromInt(e),t}function p(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function g(e){this.m=e}function y(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function m(e,t){return e&t}function b(e,t){return e|t}function v(e,t){return e^t}function w(e,t){return e&~t}function _(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function E(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function S(){}function T(e){return e}function A(e){this.r2=o(),this.q3=o(),s.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}g.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},g.prototype.revert=function(e){return e},g.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},y.prototype.convert=function(e){var t=o();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(s.ZERO)>0&&this.m.subTo(t,t),t},y.prototype.revert=function(e){var t=o();return e.copyTo(t),this.reduce(t),t},y.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],i=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,i,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},s.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},s.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},s.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var i=e.length,n=!1,o=0;--i>=0;){var a=8==r?255&e[i]:f(e,i);a<0?"-"==e.charAt(i)&&(n=!0):(n=!1,0==o?this.data[this.t++]=a:o+r>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this.data[this.t++]=a>>this.DB-o):this.data[this.t-1]|=a<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),n&&s.ZERO.subTo(this,this)},s.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},s.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},s.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},s.prototype.lShiftTo=function(e,t){var r,i=e%this.DB,n=this.DB-i,s=(1<<n)-1,o=Math.floor(e/this.DB),a=this.s<<i&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+o+1]=this.data[r]>>n|a,a=(this.data[r]&s)<<i;for(r=o-1;r>=0;--r)t.data[r]=0;t.data[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()},s.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var i=e%this.DB,n=this.DB-i,s=(1<<i)-1;t.data[0]=this.data[r]>>i;for(var o=r+1;o<this.t;++o)t.data[o-r-1]|=(this.data[o]&s)<<n,t.data[o-r]=this.data[o]>>i;i>0&&(t.data[this.t-r-1]|=(this.s&s)<<n),t.t=this.t-r,t.clamp()}},s.prototype.subTo=function(e,t){for(var r=0,i=0,n=Math.min(e.t,this.t);r<n;)i+=this.data[r]-e.data[r],t.data[r++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;r<this.t;)i+=this.data[r],t.data[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<e.t;)i-=e.data[r],t.data[r++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t.data[r++]=this.DV+i:i>0&&(t.data[r++]=i),t.t=r,t.clamp()},s.prototype.multiplyTo=function(e,t){var r=this.abs(),i=e.abs(),n=r.t;for(t.t=n+i.t;--n>=0;)t.data[n]=0;for(n=0;n<i.t;++n)t.data[n+r.t]=r.am(0,i.data[n],t,n,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&s.ZERO.subTo(t,t)},s.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var i=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,i,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},s.prototype.divRemTo=function(e,t,r){var i=e.abs();if(!(i.t<=0)){var n=this.abs();if(n.t<i.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=o());var a=o(),c=this.s,u=e.s,l=this.DB-p(i.data[i.t-1]);l>0?(i.lShiftTo(l,a),n.lShiftTo(l,r)):(i.copyTo(a),n.copyTo(r));var d=a.t,f=a.data[d-1];if(0!=f){var h=f*(1<<this.F1)+(d>1?a.data[d-2]>>this.F2:0),g=this.FV/h,y=(1<<this.F1)/h,m=1<<this.F2,b=r.t,v=b-d,w=null==t?o():t;for(a.dlShiftTo(v,w),r.compareTo(w)>=0&&(r.data[r.t++]=1,r.subTo(w,r)),s.ONE.dlShiftTo(d,w),w.subTo(a,a);a.t<d;)a.data[a.t++]=0;for(;--v>=0;){var _=r.data[--b]==f?this.DM:Math.floor(r.data[b]*g+(r.data[b-1]+m)*y);if((r.data[b]+=a.am(0,_,r,v,0,d))<_)for(a.dlShiftTo(v,w),r.subTo(w,r);r.data[b]<--_;)r.subTo(w,r)}null!=t&&(r.drShiftTo(d,t),c!=u&&s.ZERO.subTo(t,t)),r.t=d,r.clamp(),l>0&&r.rShiftTo(l,r),c<0&&s.ZERO.subTo(r,r)}}},s.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},s.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},s.prototype.exp=function(e,t){if(e>4294967295||e<1)return s.ONE;var r=o(),i=o(),n=t.convert(this),a=p(e)-1;for(n.copyTo(r);--a>=0;)if(t.sqrTo(r,i),(e&1<<a)>0)t.mulTo(i,n,r);else{var c=r;r=i,i=c}return t.revert(r)},s.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,i=(1<<t)-1,n=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(r=this.data[o]>>a)>0&&(n=!0,s=d(r));o>=0;)a<t?(r=(this.data[o]&(1<<a)-1)<<t-a,r|=this.data[--o]>>(a+=this.DB-t)):(r=this.data[o]>>(a-=t)&i,a<=0&&(a+=this.DB,--o)),r>0&&(n=!0),n&&(s+=d(r));return n?s:"0"},s.prototype.negate=function(){var e=o();return s.ZERO.subTo(this,e),e},s.prototype.abs=function(){return this.s<0?this.negate():this},s.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},s.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)},s.prototype.mod=function(e){var t=o();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(s.ZERO)>0&&e.subTo(t,t),t},s.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new g(t):new y(t),this.exp(e,r)},s.ZERO=h(0),s.ONE=h(1),S.prototype.convert=T,S.prototype.revert=T,S.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},S.prototype.sqrTo=function(e,t){e.squareTo(t)},A.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=o();return e.copyTo(t),this.reduce(t),t},A.prototype.revert=function(e){return e},A.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var k=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],I=67108864/k[k.length-1];s.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},s.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=h(r),n=o(),s=o(),a="";for(this.divRemTo(i,n,s);n.signum()>0;)a=(r+s.intValue()).toString(e).substr(1)+a,n.divRemTo(i,n,s);return s.intValue().toString(e)+a},s.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),i=Math.pow(t,r),n=!1,o=0,a=0,c=0;c<e.length;++c){var u=f(e,c);u<0?"-"==e.charAt(c)&&0==this.signum()&&(n=!0):(a=t*a+u,++o>=r&&(this.dMultiply(i),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),n&&s.ZERO.subTo(this,this)},s.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(s.ONE.shiftLeft(e-1),b,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(s.ONE.shiftLeft(e-1),this);else{var i=new Array,n=7&e;i.length=1+(e>>3),t.nextBytes(i),n>0?i[0]&=(1<<n)-1:i[0]=0,this.fromString(i,256)}},s.prototype.bitwiseTo=function(e,t,r){var i,n,s=Math.min(e.t,this.t);for(i=0;i<s;++i)r.data[i]=t(this.data[i],e.data[i]);if(e.t<this.t){for(n=e.s&this.DM,i=s;i<this.t;++i)r.data[i]=t(this.data[i],n);r.t=this.t}else{for(n=this.s&this.DM,i=s;i<e.t;++i)r.data[i]=t(n,e.data[i]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},s.prototype.changeBit=function(e,t){var r=s.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},s.prototype.addTo=function(e,t){for(var r=0,i=0,n=Math.min(e.t,this.t);r<n;)i+=this.data[r]+e.data[r],t.data[r++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i+=e.s;r<this.t;)i+=this.data[r],t.data[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<e.t;)i+=e.data[r],t.data[r++]=i&this.DM,i>>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t.data[r++]=i:i<-1&&(t.data[r++]=this.DV+i),t.t=r,t.clamp()},s.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},s.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},s.prototype.multiplyLowerTo=function(e,t,r){var i,n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;for(i=r.t-this.t;n<i;++n)r.data[n+this.t]=this.am(0,e.data[n],r,n,0,this.t);for(i=Math.min(e.t,t);n<i;++n)this.am(0,e.data[n],r,n,0,t-n);r.clamp()},s.prototype.multiplyUpperTo=function(e,t,r){--t;var i=r.t=this.t+e.t-t;for(r.s=0;--i>=0;)r.data[i]=0;for(i=Math.max(t-this.t,0);i<e.t;++i)r.data[this.t+i-t]=this.am(t-i,e.data[i],r,0,0,this.t+i-t);r.clamp(),r.drShiftTo(1,r)},s.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var i=this.t-1;i>=0;--i)r=(t*r+this.data[i])%e;return r},s.prototype.millerRabin=function(e){var t=this.subtract(s.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var i,n=t.shiftRight(r),o={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},a=0;a<e;++a){do{i=new s(this.bitLength(),o)}while(i.compareTo(s.ONE)<=0||i.compareTo(t)>=0);var c=i.modPow(n,this);if(0!=c.compareTo(s.ONE)&&0!=c.compareTo(t)){for(var u=1;u++<r&&0!=c.compareTo(t);)if(0==(c=c.modPowInt(2,this)).compareTo(s.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0},s.prototype.clone=function(){var e=o();return this.copyTo(e),e},s.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},s.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},s.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},s.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},s.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,i=this.DB-e*this.DB%8,n=0;if(e-- >0)for(i<this.DB&&(r=this.data[e]>>i)!=(this.s&this.DM)>>i&&(t[n++]=r|this.s<<this.DB-i);e>=0;)i<8?(r=(this.data[e]&(1<<i)-1)<<8-i,r|=this.data[--e]>>(i+=this.DB-8)):(r=this.data[e]>>(i-=8)&255,i<=0&&(i+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t},s.prototype.equals=function(e){return 0==this.compareTo(e)},s.prototype.min=function(e){return this.compareTo(e)<0?this:e},s.prototype.max=function(e){return this.compareTo(e)>0?this:e},s.prototype.and=function(e){var t=o();return this.bitwiseTo(e,m,t),t},s.prototype.or=function(e){var t=o();return this.bitwiseTo(e,b,t),t},s.prototype.xor=function(e){var t=o();return this.bitwiseTo(e,v,t),t},s.prototype.andNot=function(e){var t=o();return this.bitwiseTo(e,w,t),t},s.prototype.not=function(){for(var e=o(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},s.prototype.shiftLeft=function(e){var t=o();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},s.prototype.shiftRight=function(e){var t=o();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},s.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+_(this.data[e]);return this.s<0?this.t*this.DB:-1},s.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=E(this.data[r]^t);return e},s.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},s.prototype.setBit=function(e){return this.changeBit(e,b)},s.prototype.clearBit=function(e){return this.changeBit(e,w)},s.prototype.flipBit=function(e){return this.changeBit(e,v)},s.prototype.add=function(e){var t=o();return this.addTo(e,t),t},s.prototype.subtract=function(e){var t=o();return this.subTo(e,t),t},s.prototype.multiply=function(e){var t=o();return this.multiplyTo(e,t),t},s.prototype.divide=function(e){var t=o();return this.divRemTo(e,t,null),t},s.prototype.remainder=function(e){var t=o();return this.divRemTo(e,null,t),t},s.prototype.divideAndRemainder=function(e){var t=o(),r=o();return this.divRemTo(e,t,r),new Array(t,r)},s.prototype.modPow=function(e,t){var r,i,n=e.bitLength(),s=h(1);if(n<=0)return s;r=n<18?1:n<48?3:n<144?4:n<768?5:6,i=n<8?new g(t):t.isEven()?new A(t):new y(t);var a=new Array,c=3,u=r-1,l=(1<<r)-1;if(a[1]=i.convert(this),r>1){var d=o();for(i.sqrTo(a[1],d);c<=l;)a[c]=o(),i.mulTo(d,a[c-2],a[c]),c+=2}var f,m,b=e.t-1,v=!0,w=o();for(n=p(e.data[b])-1;b>=0;){for(n>=u?f=e.data[b]>>n-u&l:(f=(e.data[b]&(1<<n+1)-1)<<u-n,b>0&&(f|=e.data[b-1]>>this.DB+n-u)),c=r;0==(1&f);)f>>=1,--c;if((n-=c)<0&&(n+=this.DB,--b),v)a[f].copyTo(s),v=!1;else{for(;c>1;)i.sqrTo(s,w),i.sqrTo(w,s),c-=2;c>0?i.sqrTo(s,w):(m=s,s=w,w=m),i.mulTo(w,a[f],s)}for(;b>=0&&0==(e.data[b]&1<<n);)i.sqrTo(s,w),m=s,s=w,w=m,--n<0&&(n=this.DB-1,--b)}return i.revert(s)},s.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return s.ZERO;for(var r=e.clone(),i=this.clone(),n=h(1),o=h(0),a=h(0),c=h(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(n.isEven()&&o.isEven()||(n.addTo(this,n),o.subTo(e,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),t?(a.isEven()&&c.isEven()||(a.addTo(this,a),c.subTo(e,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(e,c),c.rShiftTo(1,c);r.compareTo(i)>=0?(r.subTo(i,r),t&&n.subTo(a,n),o.subTo(c,o)):(i.subTo(r,i),t&&a.subTo(n,a),c.subTo(o,c))}return 0!=i.compareTo(s.ONE)?s.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},s.prototype.pow=function(e){return this.exp(e,new S)},s.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var i=t;t=r,r=i}var n=t.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return t;for(n<s&&(s=n),s>0&&(t.rShiftTo(s,t),r.rShiftTo(s,r));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r},s.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=k[k.length-1]){for(t=0;t<k.length;++t)if(r.data[0]==k[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<k.length;){for(var i=k[t],n=t+1;n<k.length&&i<I;)i*=k[n++];for(i=r.modInt(i);t<n;)if(i%k[t++]==0)return!1}return r.millerRabin(e)}},{"./forge":"4OuPD"}],"2vXck":[function(e,t,r){var i=e("./forge");e("./util"),e("./random"),e("./sha1");var n=t.exports=i.pkcs1=i.pkcs1||{};function s(e,t,r){r||(r=i.md.sha1.create());for(var n="",s=Math.ceil(t/r.digestLength),o=0;o<s;++o){var a=String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+a),n+=r.digest().getBytes()}return n.substring(0,t)}n.encode_rsa_oaep=function(e,t,r){var n,o,a,c;"string"==typeof r?(n=r,o=arguments[3]||void 0,a=arguments[4]||void 0):r&&(n=r.label||void 0,o=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),a?a.start():a=i.md.sha1.create(),c||(c=a);var u=Math.ceil(e.n.bitLength()/8),l=u-2*a.digestLength-2;if(t.length>l)throw(y=new Error("RSAES-OAEP input message length is too long.")).length=t.length,y.maxLength=l,y;n||(n=""),a.update(n,"raw");for(var d=a.digest(),f="",h=l-t.length,p=0;p<h;p++)f+="\0";var g=d.getBytes()+f+""+t;if(o){if(o.length!==a.digestLength){var y;throw(y=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=o.length,y.digestLength=a.digestLength,y}}else o=i.random.getBytes(a.digestLength);var m=s(o,u-a.digestLength-1,c),b=i.util.xorBytes(g,m,g.length),v=s(b,a.digestLength,c),w=i.util.xorBytes(o,v,o.length);return"\0"+w+b},n.decode_rsa_oaep=function(e,t,r){var n,o,a;"string"==typeof r?(n=r,o=arguments[3]||void 0):r&&(n=r.label||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(a=r.mgf1.md));var c=Math.ceil(e.n.bitLength()/8);if(t.length!==c)throw(b=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,b.expectedLength=c,b;if(void 0===o?o=i.md.sha1.create():o.start(),a||(a=o),c<2*o.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");n||(n=""),o.update(n,"raw");for(var u=o.digest().getBytes(),l=t.charAt(0),d=t.substring(1,o.digestLength+1),f=t.substring(1+o.digestLength),h=s(f,o.digestLength,a),p=i.util.xorBytes(d,h,d.length),g=s(p,c-o.digestLength-1,a),y=i.util.xorBytes(f,g,f.length),m=y.substring(0,o.digestLength),b="\0"!==l,v=0;v<o.digestLength;++v)b|=u.charAt(v)!==m.charAt(v);for(var w=1,_=o.digestLength,E=o.digestLength;E<y.length;E++){var S=y.charCodeAt(E),T=1&S^1,A=w?65534:0;b|=S&A,_+=w&=T}if(b||1!==y.charCodeAt(_))throw new Error("Invalid RSAES-OAEP padding.");return y.substring(_+1)}},{"./forge":"4OuPD","./util":"df43p","./random":"3tULm","./sha1":"coXBV"}],coXBV:[function(e,t,r){var i=e("./forge");e("./md"),e("./util");var n=t.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=n,n.create=function(){o||(s=String.fromCharCode(128),s+=i.util.fillString(String.fromCharCode(0),64),o=!0);var e=null,t=i.util.createBuffer(),r=new Array(80),n={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var r=n.messageLengthSize/4,s=0;s<r;++s)n.fullMessageLength.push(0);return t=i.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n}};return n.start(),n.update=function(s,o){"utf8"===o&&(s=i.util.encodeUtf8(s));var c=s.length;n.messageLength+=c,c=[c/4294967296>>>0,c>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=c[1],c[1]=c[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(s),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),n},n.digest=function(){var o=i.util.createBuffer();o.putBytes(t.bytes());var c,u=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;o.putBytes(s.substr(0,n.blockLength-u));for(var l=8*n.fullMessageLength[0],d=0;d<n.fullMessageLength.length-1;++d)l+=(c=8*n.fullMessageLength[d+1])/4294967296>>>0,o.putInt32(l>>>0),l=c>>>0;o.putInt32(l);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(f,r,o);var h=i.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h},n};var s=null,o=!1;function a(e,t,r){for(var i,n,s,o,a,c,u,l=r.length();l>=64;){for(n=e.h0,s=e.h1,o=e.h2,a=e.h3,c=e.h4,u=0;u<16;++u)i=r.getInt32(),t[u]=i,i=(n<<5|n>>>27)+(a^s&(o^a))+c+1518500249+i,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=n,n=i;for(;u<20;++u)i=(i=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|i>>>31,t[u]=i,i=(n<<5|n>>>27)+(a^s&(o^a))+c+1518500249+i,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=n,n=i;for(;u<32;++u)i=(i=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|i>>>31,t[u]=i,i=(n<<5|n>>>27)+(s^o^a)+c+1859775393+i,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=n,n=i;for(;u<40;++u)i=(i=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|i>>>30,t[u]=i,i=(n<<5|n>>>27)+(s^o^a)+c+1859775393+i,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=n,n=i;for(;u<60;++u)i=(i=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|i>>>30,t[u]=i,i=(n<<5|n>>>27)+(s&o|a&(s^o))+c+2400959708+i,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=n,n=i;for(;u<80;++u)i=(i=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|i>>>30,t[u]=i,i=(n<<5|n>>>27)+(s^o^a)+c+3395469782+i,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=n,n=i;e.h0=e.h0+n|0,e.h1=e.h1+s|0,e.h2=e.h2+o|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,l-=64}}},{"./forge":"4OuPD","./md":"fYbz5","./util":"df43p"}],ZaXlg:[function(e,t,r){var i=e("./forge");e("./util"),e("./jsbn"),e("./random"),function(){if(i.prime)t.exports=i.prime;else{var e=t.exports=i.prime=i.prime||{},r=i.jsbn.BigInteger,n=[6,4,2,4,2,4,6,2],s=new r(null);s.fromInt(30);var o=function(e,t){return e|t};e.generateProbablePrime=function(e,t,n){"function"==typeof t&&(n=t,t={});var s=(t=t||{}).algorithm||"PRIMEINC";"string"==typeof s&&(s={name:s}),s.options=s.options||{};var o=t.prng||i.random,c={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===s.name)return function(e,t,n,s){return"workers"in n?function(e,t,n,s){if("undefined"==typeof Worker)return a(e,t,n,s);var o=u(e,t),c=n.workers,l=n.workLoad||100,d=30*l/8,f=n.workerScript||"forge/prime.worker.js";if(-1===c)return i.util.estimateCores((function(e,t){e&&(t=2),c=t-1,h()}));function h(){c=Math.max(1,c);for(var i=[],n=0;n<c;++n)i[n]=new Worker(f);for(n=0;n<c;++n)i[n].addEventListener("message",h);var a=!1;function h(n){if(!a){0;var c=n.data;if(c.found){for(var f=0;f<i.length;++f)i[f].terminate();return a=!0,s(null,new r(c.prime,16))}o.bitLength()>e&&(o=u(e,t));var h=o.toString(16);n.target.postMessage({hex:h,workLoad:l}),o.dAddOffset(d,0)}}}h()}(e,t,n,s):a(e,t,n,s)}(e,c,s.options,n);throw new Error("Invalid prime generation algorithm: "+s.name)}}function a(e,t,r,i){var n=u(e,t),s=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(n.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var o=10;"maxBlockTime"in r&&(o=r.maxBlockTime),c(n,e,t,0,s,o,i)}function c(e,t,r,s,o,a,l){var d=+new Date;do{if(e.bitLength()>t&&(e=u(t,r)),e.isProbablePrime(o))return l(null,e);e.dAddOffset(n[s++%8],0)}while(a<0||+new Date-d<a);i.util.setImmediate((function(){c(e,t,r,s,o,a,l)}))}function u(e,t){var i=new r(e,t),n=e-1;return i.testBit(n)||i.bitwiseTo(r.ONE.shiftLeft(n),o,i),i.dAddOffset(31-i.mod(s).byteValue(),0),i}}()},{"./forge":"4OuPD","./util":"df43p","./jsbn":"eeS3U","./random":"3tULm"}],jyqjk:[function(e,t,r){"use strict";const{base64:i}=e("multiformats/bases/base64"),n=e("../ciphers/aes-gcm");t.exports={import:async function(e,t){const r=i.decode(e),s=n.create();return await s.decrypt(r,t)}}},{"multiformats/bases/base64":"gaFBW","../ciphers/aes-gcm":"92UH6"}],"92UH6":[function(e,t,r){"use strict";const{concat:i}=e("uint8arrays/concat"),{fromString:n}=e("uint8arrays/from-string"),s=e("../webcrypto");t.exports={create:function({algorithm:e="AES-GCM",nonceLength:t=12,keyLength:r=16,digest:o="SHA-256",saltLength:a=16,iterations:c=32767}={}){const u=s.get();return r*=8,{encrypt:async function(s,l){const d=u.getRandomValues(new Uint8Array(a)),f=u.getRandomValues(new Uint8Array(t)),h={name:e,iv:f},p={name:"PBKDF2",salt:d,iterations:c,hash:{name:o}},g=await u.subtle.importKey("raw",n(l),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),y=await u.subtle.deriveKey(p,g,{name:e,length:r},!0,["encrypt"]),m=await u.subtle.encrypt(h,y,s);return i([d,h.iv,new Uint8Array(m)])},decrypt:async function(i,s){const l=i.slice(0,a),d=i.slice(a,a+t),f=i.slice(a+t),h={name:e,iv:d},p={name:"PBKDF2",salt:l,iterations:c,hash:{name:o}},g=await u.subtle.importKey("raw",n(s),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),y=await u.subtle.deriveKey(p,g,{name:e,length:r},!0,["decrypt"]),m=await u.subtle.decrypt(h,y,f);return new Uint8Array(m)}}}}},{"uint8arrays/concat":"4EBjG","uint8arrays/from-string":"dF7Y4","../webcrypto":"i99ng"}],i99ng:[function(e,t,r){"use strict";r.get=(e=self)=>{const t=e.crypto||e.msCrypto;if(!t||!t.subtle)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p-crypto/blob/master/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return t}},{}],"1sbpX":[function(e,t,r){"use strict";const{sha256:i}=e("multiformats/hashes/sha2"),n=e("err-code"),{equals:s}=e("uint8arrays/equals"),{toString:o}=e("uint8arrays/to-string");e("node-forge/lib/sha512"),e("node-forge/lib/ed25519");const a=e("node-forge/lib/forge"),c=e("./rsa"),u=e("./keys"),l=e("./exporter");class d{constructor(e){this._key=e}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.utils.jwkToPkix(this._key)}get bytes(){return u.PublicKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}encrypt(e){return c.encrypt(this._key,e)}equals(e){return s(this.bytes,e.bytes)}async hash(){const{bytes:e}=await i.digest(this.bytes);return e}}class f{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return c.getRandomValues(16)}async sign(e){return c.hashAndSign(this._key,e)}get public(){if(!this._publicKey)throw n(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new d(this._publicKey)}decrypt(e){return c.decrypt(this._key,e)}marshal(){return c.utils.jwkToPkcs1(this._key)}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}equals(e){return s(this.bytes,e.bytes)}async hash(){const{bytes:e}=await i.digest(this.bytes);return e}async id(){const e=await this.public.hash();return o(e,"base58btc")}async export(e,t="pkcs-8"){if("pkcs-8"===t){const t=new a.util.ByteBuffer(this.marshal()),r=a.asn1.fromDer(t),i=a.pki.privateKeyFromAsn1(r),n={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};return a.pki.encryptRsaPrivateKey(i,e,n)}if("libp2p-key"===t)return l.export(this.bytes,e);throw n(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}t.exports={RsaPublicKey:d,RsaPrivateKey:f,unmarshalRsaPublicKey:function(e){const t=c.utils.pkixToJwk(e);return new d(t)},unmarshalRsaPrivateKey:async function(e){const t=c.utils.pkcs1ToJwk(e),r=await c.unmarshalPrivateKey(t);return new f(r.privateKey,r.publicKey)},generateKeyPair:async function(e){const t=await c.generateKey(e);return new f(t.privateKey,t.publicKey)},fromJwk:async function(e){const t=await c.unmarshalPrivateKey(e);return new f(t.privateKey,t.publicKey)}}},{"multiformats/hashes/sha2":"7i9MT","err-code":"chZjB","uint8arrays/equals":"eY3cX","uint8arrays/to-string":"hC8JB","node-forge/lib/sha512":"9XKJ9","node-forge/lib/ed25519":"9HAE7","node-forge/lib/forge":"4OuPD","./rsa":"5a3He","./keys":"jWSTZ","./exporter":"8qVel"}],"9XKJ9":[function(e,t,r){var i=e("./forge");e("./md"),e("./util");var n=t.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=n;var s=i.sha384=i.sha512.sha384=i.sha512.sha384||{};s.create=function(){return n.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=s,i.sha512.sha256=i.sha512.sha256||{create:function(){return n.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return n.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,n.create=function(e){if(a||(o=String.fromCharCode(128),o+=i.util.fillString(String.fromCharCode(0),128),c=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(u={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],u["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],u["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],u["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0),void 0===e&&(e="SHA-512"),!(e in u))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=u[e],r=null,n=i.util.createBuffer(),s=new Array(80),d=0;d<80;++d)s[d]=new Array(2);var f=64;switch(e){case"SHA-384":f=48;break;case"SHA-512/256":f=32;break;case"SHA-512/224":f=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:f,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,s=0;s<e;++s)h.fullMessageLength.push(0);n=i.util.createBuffer(),r=new Array(t.length);for(s=0;s<t.length;++s)r[s]=t[s].slice(0);return h}};return h.start(),h.update=function(e,t){"utf8"===t&&(e=i.util.encodeUtf8(e));var o=e.length;h.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=h.fullMessageLength.length-1;a>=0;--a)h.fullMessageLength[a]+=o[1],o[1]=o[0]+(h.fullMessageLength[a]/4294967296>>>0),h.fullMessageLength[a]=h.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return n.putBytes(e),l(r,s,n),(n.read>2048||0===n.length())&&n.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(n.bytes());var a,c=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize&h.blockLength-1;t.putBytes(o.substr(0,h.blockLength-c));for(var u=8*h.fullMessageLength[0],d=0;d<h.fullMessageLength.length-1;++d)u+=(a=8*h.fullMessageLength[d+1])/4294967296>>>0,t.putInt32(u>>>0),u=a>>>0;t.putInt32(u);var f=new Array(r.length);for(d=0;d<r.length;++d)f[d]=r[d].slice(0);l(f,s,t);var p,g=i.util.createBuffer();p="SHA-512"===e?f.length:"SHA-384"===e?f.length-2:f.length-4;for(d=0;d<p;++d)g.putInt32(f[d][0]),d===p-1&&"SHA-512/224"===e||g.putInt32(f[d][1]);return g},h};var o=null,a=!1,c=null,u=null;function l(e,t,r){for(var i,n,s,o,a,u,l,d,f,h,p,g,y,m,b,v,w,_,E,S,T,A,k,I,R,P,O,C,j,D,M,x,B,L=r.length();L>=128;){for(O=0;O<16;++O)t[O][0]=r.getInt32()>>>0,t[O][1]=r.getInt32()>>>0;for(;O<80;++O)i=(((C=(D=t[O-2])[0])>>>19|(j=D[1])<<13)^(j>>>29|C<<3)^C>>>6)>>>0,n=((C<<13|j>>>19)^(j<<3|C>>>29)^(C<<26|j>>>6))>>>0,s=(((C=(x=t[O-15])[0])>>>1|(j=x[1])<<31)^(C>>>8|j<<24)^C>>>7)>>>0,o=((C<<31|j>>>1)^(C<<24|j>>>8)^(C<<25|j>>>7))>>>0,M=t[O-7],B=t[O-16],j=n+M[1]+o+B[1],t[O][0]=i+M[0]+s+B[0]+(j/4294967296>>>0)>>>0,t[O][1]=j>>>0;for(p=e[0][0],g=e[0][1],y=e[1][0],m=e[1][1],b=e[2][0],v=e[2][1],w=e[3][0],_=e[3][1],E=e[4][0],S=e[4][1],T=e[5][0],A=e[5][1],k=e[6][0],I=e[6][1],R=e[7][0],P=e[7][1],O=0;O<80;++O)l=((E>>>14|S<<18)^(E>>>18|S<<14)^(S>>>9|E<<23))>>>0,d=(k^E&(T^k))>>>0,a=((p>>>28|g<<4)^(g>>>2|p<<30)^(g>>>7|p<<25))>>>0,u=((p<<4|g>>>28)^(g<<30|p>>>2)^(g<<25|p>>>7))>>>0,f=(p&y|b&(p^y))>>>0,h=(g&m|v&(g^m))>>>0,j=P+(((E<<18|S>>>14)^(E<<14|S>>>18)^(S<<23|E>>>9))>>>0)+((I^S&(A^I))>>>0)+c[O][1]+t[O][1],i=R+l+d+c[O][0]+t[O][0]+(j/4294967296>>>0)>>>0,n=j>>>0,s=a+f+((j=u+h)/4294967296>>>0)>>>0,o=j>>>0,R=k,P=I,k=T,I=A,T=E,A=S,E=w+i+((j=_+n)/4294967296>>>0)>>>0,S=j>>>0,w=b,_=v,b=y,v=m,y=p,m=g,p=i+s+((j=n+o)/4294967296>>>0)>>>0,g=j>>>0;j=e[0][1]+g,e[0][0]=e[0][0]+p+(j/4294967296>>>0)>>>0,e[0][1]=j>>>0,j=e[1][1]+m,e[1][0]=e[1][0]+y+(j/4294967296>>>0)>>>0,e[1][1]=j>>>0,j=e[2][1]+v,e[2][0]=e[2][0]+b+(j/4294967296>>>0)>>>0,e[2][1]=j>>>0,j=e[3][1]+_,e[3][0]=e[3][0]+w+(j/4294967296>>>0)>>>0,e[3][1]=j>>>0,j=e[4][1]+S,e[4][0]=e[4][0]+E+(j/4294967296>>>0)>>>0,e[4][1]=j>>>0,j=e[5][1]+A,e[5][0]=e[5][0]+T+(j/4294967296>>>0)>>>0,e[5][1]=j>>>0,j=e[6][1]+I,e[6][0]=e[6][0]+k+(j/4294967296>>>0)>>>0,e[6][1]=j>>>0,j=e[7][1]+P,e[7][0]=e[7][0]+R+(j/4294967296>>>0)>>>0,e[7][1]=j>>>0,L-=128}}},{"./forge":"4OuPD","./md":"fYbz5","./util":"df43p"}],"9HAE7":[function(e,t,r){var i=e("buffer").Buffer,n=e("./forge");e("./jsbn"),e("./random"),e("./sha512"),e("./util");var s=e("./asn1-validator"),o=s.publicKeyValidator,a=s.privateKeyValidator;if(void 0===c)var c=n.jsbn.BigInteger;var u=n.util.ByteBuffer,l=void 0===i?Uint8Array:i;n.pki=n.pki||{},t.exports=n.pki.ed25519=n.ed25519=n.ed25519||{};var d=n.ed25519;function f(e){var t=e.message;if(t instanceof Uint8Array||t instanceof l)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if(void 0!==i)return i.from(t,r);t=new u(t,r)}else if(!(t instanceof u))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new l(t.length()),s=0;s<n.length;++s)n[s]=t.at(s);return n}d.constants={},d.constants.PUBLIC_KEY_BYTE_LENGTH=32,d.constants.PRIVATE_KEY_BYTE_LENGTH=64,d.constants.SEED_BYTE_LENGTH=32,d.constants.SIGN_BYTE_LENGTH=64,d.constants.HASH_BYTE_LENGTH=64,d.generateKeyPair=function(e){var t=(e=e||{}).seed;if(void 0===t)t=n.random.getBytesSync(d.constants.SEED_BYTE_LENGTH);else if("string"==typeof t){if(t.length!==d.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+d.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=f({message:t,encoding:"binary"});for(var r=new l(d.constants.PUBLIC_KEY_BYTE_LENGTH),i=new l(d.constants.PRIVATE_KEY_BYTE_LENGTH),s=0;s<32;++s)i[s]=t[s];return function(e,t){var r,i=[B(),B(),B(),B()],n=_(t,32);for(n[0]&=248,n[31]&=127,n[31]|=64,j(i,n),k(e,i),r=0;r<32;++r)t[r+32]=e[r]}(r,i),{publicKey:r,privateKey:i}},d.privateKeyFromAsn1=function(e){var t={},r=[];if(!n.asn1.validate(e,a,t,r)){var i=new Error("Invalid Key.");throw i.errors=r,i}var s=n.asn1.derToOid(t.privateKeyOid),o=n.oids.EdDSA25519;if(s!==o)throw new Error('Invalid OID "'+s+'"; OID must be "'+o+'".');var c=t.privateKey;return{privateKeyBytes:f({message:n.asn1.fromDer(c).value,encoding:"binary"})}},d.publicKeyFromAsn1=function(e){var t={},r=[];if(!n.asn1.validate(e,o,t,r)){var i=new Error("Invalid Key.");throw i.errors=r,i}var s=n.asn1.derToOid(t.publicKeyOid),a=n.oids.EdDSA25519;if(s!==a)throw new Error('Invalid OID "'+s+'"; OID must be "'+a+'".');var c=t.ed25519PublicKey;if(c.length!==d.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return f({message:c,encoding:"binary"})},d.publicKeyFromPrivateKey=function(e){var t=f({message:(e=e||{}).privateKey,encoding:"binary"});if(t.length!==d.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+d.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new l(d.constants.PUBLIC_KEY_BYTE_LENGTH),i=0;i<r.length;++i)r[i]=t[32+i];return r},d.sign=function(e){var t=f(e=e||{}),r=f({message:e.privateKey,encoding:"binary"});if(r.length===d.constants.SEED_BYTE_LENGTH)r=d.generateKeyPair({seed:r}).privateKey;else if(r.length!==d.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+d.constants.SEED_BYTE_LENGTH+" or "+d.constants.PRIVATE_KEY_BYTE_LENGTH);var i=new l(d.constants.SIGN_BYTE_LENGTH+t.length);!function(e,t,r,i){var n,s,o=new Float64Array(64),a=[B(),B(),B(),B()],c=_(i,32);c[0]&=248,c[31]&=127,c[31]|=64;var u=r+64;for(n=0;n<r;++n)e[64+n]=t[n];for(n=0;n<32;++n)e[32+n]=c[32+n];var l=_(e.subarray(32),r+32);for(S(l),j(a,l),k(e,a),n=32;n<64;++n)e[n]=i[n];var d=_(e,r+64);for(S(d),n=32;n<64;++n)o[n]=0;for(n=0;n<32;++n)o[n]=l[n];for(n=0;n<32;++n)for(s=0;s<32;s++)o[n+s]+=d[n]*c[s];E(e.subarray(32),o)}(i,t,t.length,r);for(var n=new l(d.constants.SIGN_BYTE_LENGTH),s=0;s<n.length;++s)n[s]=i[s];return n},d.verify=function(e){var t=f(e=e||{});if(void 0===e.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=f({message:e.signature,encoding:"binary"});if(r.length!==d.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+d.constants.SIGN_BYTE_LENGTH);var i=f({message:e.publicKey,encoding:"binary"});if(i.length!==d.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+d.constants.PUBLIC_KEY_BYTE_LENGTH);var n,s=new l(d.constants.SIGN_BYTE_LENGTH+t.length),o=new l(d.constants.SIGN_BYTE_LENGTH+t.length);for(n=0;n<d.constants.SIGN_BYTE_LENGTH;++n)s[n]=r[n];for(n=0;n<t.length;++n)s[n+d.constants.SIGN_BYTE_LENGTH]=t[n];return function(e,t,r,i){var n,s=new l(32),o=[B(),B(),B(),B()],a=[B(),B(),B(),B()];if(-1,r<64)return-1;if(function(e,t){var r=B(),i=B(),n=B(),s=B(),o=B(),a=B(),c=B();D(e[2],p),function(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),U(n,e[1]),F(s,n,g),N(n,n,e[2]),L(s,e[2],s),U(o,s),U(a,o),F(c,a,o),F(r,c,n),F(r,r,s),function(e,t){var r,i=B();for(r=0;r<16;++r)i[r]=t[r];for(r=250;r>=0;--r)U(i,i),1!==r&&F(i,i,t);for(r=0;r<16;++r)e[r]=i[r]}(r,r),F(r,r,n),F(r,r,s),F(r,r,s),F(e[0],r,s),U(i,e[0]),F(i,i,s),R(i,n)&&F(e[0],e[0],w);if(U(i,e[0]),F(i,i,s),R(i,n))return-1;O(e[0])===t[31]>>7&&N(e[0],h,e[0]);return F(e[3],e[0],e[1]),0}(a,i))return-1;for(n=0;n<r;++n)e[n]=t[n];for(n=0;n<32;++n)e[n+32]=i[n];var c=_(e,r);if(S(c),C(o,a,c),j(a,t.subarray(32)),T(o,a),k(s,o),r-=64,P(t,0,s,0)){for(n=0;n<r;++n)e[n]=0;return-1}for(n=0;n<r;++n)e[n]=t[n+64];return r}(o,s,s.length,i)>=0};var h=B(),p=B([1]),g=B([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=B([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),m=B([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),b=B([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),w=B([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function _(e,t){var r=n.md.sha512.create(),s=new u(e);r.update(s.getBytes(t),"binary");var o=r.digest().getBytes();if(void 0!==i)return i.from(o,"binary");for(var a=new l(d.constants.HASH_BYTE_LENGTH),c=0;c<64;++c)a[c]=o.charCodeAt(c);return a}function E(e,t){var r,i,n,s;for(i=63;i>=32;--i){for(r=0,n=i-32,s=i-12;n<s;++n)t[n]+=r-16*t[i]*v[n-(i-32)],r=t[n]+128>>8,t[n]-=256*r;t[n]+=r,t[i]=0}for(r=0,n=0;n<32;++n)t[n]+=r-(t[31]>>4)*v[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;++n)t[n]-=r*v[n];for(i=0;i<32;++i)t[i+1]+=t[i]>>8,e[i]=255&t[i]}function S(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;E(e,t)}function T(e,t){var r=B(),i=B(),n=B(),s=B(),o=B(),a=B(),c=B(),u=B(),l=B();N(r,e[1],e[0]),N(l,t[1],t[0]),F(r,r,l),L(i,e[0],e[1]),L(l,t[0],t[1]),F(i,i,l),F(n,e[3],t[3]),F(n,n,y),F(s,e[2],t[2]),L(s,s,s),N(o,i,r),N(a,s,n),L(c,s,n),L(u,i,r),F(e[0],o,a),F(e[1],u,c),F(e[2],c,a),F(e[3],o,u)}function A(e,t,r){for(var i=0;i<4;++i)x(e[i],t[i],r)}function k(e,t){var r=B(),i=B(),n=B();!function(e,t){var r,i=B();for(r=0;r<16;++r)i[r]=t[r];for(r=253;r>=0;--r)U(i,i),2!==r&&4!==r&&F(i,i,t);for(r=0;r<16;++r)e[r]=i[r]}(n,t[2]),F(r,t[0],n),F(i,t[1],n),I(e,i),e[31]^=O(r)<<7}function I(e,t){var r,i,n,s=B(),o=B();for(r=0;r<16;++r)o[r]=t[r];for(M(o),M(o),M(o),i=0;i<2;++i){for(s[0]=o[0]-65517,r=1;r<15;++r)s[r]=o[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=o[15]-32767-(s[14]>>16&1),n=s[15]>>16&1,s[14]&=65535,x(o,s,1-n)}for(r=0;r<16;r++)e[2*r]=255&o[r],e[2*r+1]=o[r]>>8}function R(e,t){var r=new l(32),i=new l(32);return I(r,e),I(i,t),P(r,0,i,0)}function P(e,t,r,i){return function(e,t,r,i,n){var s,o=0;for(s=0;s<n;++s)o|=e[t+s]^r[i+s];return(1&o-1>>>8)-1}(e,t,r,i,32)}function O(e){var t=new l(32);return I(t,e),1&t[0]}function C(e,t,r){var i,n;for(D(e[0],h),D(e[1],p),D(e[2],p),D(e[3],h),n=255;n>=0;--n)A(e,t,i=r[n/8|0]>>(7&n)&1),T(t,e),T(e,e),A(e,t,i)}function j(e,t){var r=[B(),B(),B(),B()];D(r[0],m),D(r[1],b),D(r[2],p),F(r[3],m,b),C(e,r,t)}function D(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function M(e){var t,r,i=1;for(t=0;t<16;++t)r=e[t]+i+65535,i=Math.floor(r/65536),e[t]=r-65536*i;e[0]+=i-1+37*(i-1)}function x(e,t,r){for(var i,n=~(r-1),s=0;s<16;++s)i=n&(e[s]^t[s]),e[s]^=i,t[s]^=i}function B(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function L(e,t,r){for(var i=0;i<16;++i)e[i]=t[i]+r[i]}function N(e,t,r){for(var i=0;i<16;++i)e[i]=t[i]-r[i]}function U(e,t){F(e,t,t)}function F(e,t,r){var i,n,s=0,o=0,a=0,c=0,u=0,l=0,d=0,f=0,h=0,p=0,g=0,y=0,m=0,b=0,v=0,w=0,_=0,E=0,S=0,T=0,A=0,k=0,I=0,R=0,P=0,O=0,C=0,j=0,D=0,M=0,x=0,B=r[0],L=r[1],N=r[2],U=r[3],F=r[4],K=r[5],z=r[6],V=r[7],q=r[8],G=r[9],H=r[10],$=r[11],W=r[12],Y=r[13],X=r[14],Z=r[15];s+=(i=t[0])*B,o+=i*L,a+=i*N,c+=i*U,u+=i*F,l+=i*K,d+=i*z,f+=i*V,h+=i*q,p+=i*G,g+=i*H,y+=i*$,m+=i*W,b+=i*Y,v+=i*X,w+=i*Z,o+=(i=t[1])*B,a+=i*L,c+=i*N,u+=i*U,l+=i*F,d+=i*K,f+=i*z,h+=i*V,p+=i*q,g+=i*G,y+=i*H,m+=i*$,b+=i*W,v+=i*Y,w+=i*X,_+=i*Z,a+=(i=t[2])*B,c+=i*L,u+=i*N,l+=i*U,d+=i*F,f+=i*K,h+=i*z,p+=i*V,g+=i*q,y+=i*G,m+=i*H,b+=i*$,v+=i*W,w+=i*Y,_+=i*X,E+=i*Z,c+=(i=t[3])*B,u+=i*L,l+=i*N,d+=i*U,f+=i*F,h+=i*K,p+=i*z,g+=i*V,y+=i*q,m+=i*G,b+=i*H,v+=i*$,w+=i*W,_+=i*Y,E+=i*X,S+=i*Z,u+=(i=t[4])*B,l+=i*L,d+=i*N,f+=i*U,h+=i*F,p+=i*K,g+=i*z,y+=i*V,m+=i*q,b+=i*G,v+=i*H,w+=i*$,_+=i*W,E+=i*Y,S+=i*X,T+=i*Z,l+=(i=t[5])*B,d+=i*L,f+=i*N,h+=i*U,p+=i*F,g+=i*K,y+=i*z,m+=i*V,b+=i*q,v+=i*G,w+=i*H,_+=i*$,E+=i*W,S+=i*Y,T+=i*X,A+=i*Z,d+=(i=t[6])*B,f+=i*L,h+=i*N,p+=i*U,g+=i*F,y+=i*K,m+=i*z,b+=i*V,v+=i*q,w+=i*G,_+=i*H,E+=i*$,S+=i*W,T+=i*Y,A+=i*X,k+=i*Z,f+=(i=t[7])*B,h+=i*L,p+=i*N,g+=i*U,y+=i*F,m+=i*K,b+=i*z,v+=i*V,w+=i*q,_+=i*G,E+=i*H,S+=i*$,T+=i*W,A+=i*Y,k+=i*X,I+=i*Z,h+=(i=t[8])*B,p+=i*L,g+=i*N,y+=i*U,m+=i*F,b+=i*K,v+=i*z,w+=i*V,_+=i*q,E+=i*G,S+=i*H,T+=i*$,A+=i*W,k+=i*Y,I+=i*X,R+=i*Z,p+=(i=t[9])*B,g+=i*L,y+=i*N,m+=i*U,b+=i*F,v+=i*K,w+=i*z,_+=i*V,E+=i*q,S+=i*G,T+=i*H,A+=i*$,k+=i*W,I+=i*Y,R+=i*X,P+=i*Z,g+=(i=t[10])*B,y+=i*L,m+=i*N,b+=i*U,v+=i*F,w+=i*K,_+=i*z,E+=i*V,S+=i*q,T+=i*G,A+=i*H,k+=i*$,I+=i*W,R+=i*Y,P+=i*X,O+=i*Z,y+=(i=t[11])*B,m+=i*L,b+=i*N,v+=i*U,w+=i*F,_+=i*K,E+=i*z,S+=i*V,T+=i*q,A+=i*G,k+=i*H,I+=i*$,R+=i*W,P+=i*Y,O+=i*X,C+=i*Z,m+=(i=t[12])*B,b+=i*L,v+=i*N,w+=i*U,_+=i*F,E+=i*K,S+=i*z,T+=i*V,A+=i*q,k+=i*G,I+=i*H,R+=i*$,P+=i*W,O+=i*Y,C+=i*X,j+=i*Z,b+=(i=t[13])*B,v+=i*L,w+=i*N,_+=i*U,E+=i*F,S+=i*K,T+=i*z,A+=i*V,k+=i*q,I+=i*G,R+=i*H,P+=i*$,O+=i*W,C+=i*Y,j+=i*X,D+=i*Z,v+=(i=t[14])*B,w+=i*L,_+=i*N,E+=i*U,S+=i*F,T+=i*K,A+=i*z,k+=i*V,I+=i*q,R+=i*G,P+=i*H,O+=i*$,C+=i*W,j+=i*Y,D+=i*X,M+=i*Z,w+=(i=t[15])*B,o+=38*(E+=i*N),a+=38*(S+=i*U),c+=38*(T+=i*F),u+=38*(A+=i*K),l+=38*(k+=i*z),d+=38*(I+=i*V),f+=38*(R+=i*q),h+=38*(P+=i*G),p+=38*(O+=i*H),g+=38*(C+=i*$),y+=38*(j+=i*W),m+=38*(D+=i*Y),b+=38*(M+=i*X),v+=38*(x+=i*Z),s=(i=(s+=38*(_+=i*L))+(n=1)+65535)-65536*(n=Math.floor(i/65536)),o=(i=o+n+65535)-65536*(n=Math.floor(i/65536)),a=(i=a+n+65535)-65536*(n=Math.floor(i/65536)),c=(i=c+n+65535)-65536*(n=Math.floor(i/65536)),u=(i=u+n+65535)-65536*(n=Math.floor(i/65536)),l=(i=l+n+65535)-65536*(n=Math.floor(i/65536)),d=(i=d+n+65535)-65536*(n=Math.floor(i/65536)),f=(i=f+n+65535)-65536*(n=Math.floor(i/65536)),h=(i=h+n+65535)-65536*(n=Math.floor(i/65536)),p=(i=p+n+65535)-65536*(n=Math.floor(i/65536)),g=(i=g+n+65535)-65536*(n=Math.floor(i/65536)),y=(i=y+n+65535)-65536*(n=Math.floor(i/65536)),m=(i=m+n+65535)-65536*(n=Math.floor(i/65536)),b=(i=b+n+65535)-65536*(n=Math.floor(i/65536)),v=(i=v+n+65535)-65536*(n=Math.floor(i/65536)),w=(i=w+n+65535)-65536*(n=Math.floor(i/65536)),s=(i=(s+=n-1+37*(n-1))+(n=1)+65535)-65536*(n=Math.floor(i/65536)),o=(i=o+n+65535)-65536*(n=Math.floor(i/65536)),a=(i=a+n+65535)-65536*(n=Math.floor(i/65536)),c=(i=c+n+65535)-65536*(n=Math.floor(i/65536)),u=(i=u+n+65535)-65536*(n=Math.floor(i/65536)),l=(i=l+n+65535)-65536*(n=Math.floor(i/65536)),d=(i=d+n+65535)-65536*(n=Math.floor(i/65536)),f=(i=f+n+65535)-65536*(n=Math.floor(i/65536)),h=(i=h+n+65535)-65536*(n=Math.floor(i/65536)),p=(i=p+n+65535)-65536*(n=Math.floor(i/65536)),g=(i=g+n+65535)-65536*(n=Math.floor(i/65536)),y=(i=y+n+65535)-65536*(n=Math.floor(i/65536)),m=(i=m+n+65535)-65536*(n=Math.floor(i/65536)),b=(i=b+n+65535)-65536*(n=Math.floor(i/65536)),v=(i=v+n+65535)-65536*(n=Math.floor(i/65536)),w=(i=w+n+65535)-65536*(n=Math.floor(i/65536)),s+=n-1+37*(n-1),e[0]=s,e[1]=o,e[2]=a,e[3]=c,e[4]=u,e[5]=l,e[6]=d,e[7]=f,e[8]=h,e[9]=p,e[10]=g,e[11]=y,e[12]=m,e[13]=b,e[14]=v,e[15]=w}},{buffer:"lHksA","./forge":"4OuPD","./jsbn":"eeS3U","./random":"3tULm","./sha512":"9XKJ9","./util":"df43p","./asn1-validator":"5bkfe"}],"5bkfe":[function(e,t,r){var i=e("./forge");e("./asn1");var n=i.asn1;r.privateKeyValidator={name:"PrivateKeyInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},r.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}},{"./forge":"4OuPD","./asn1":"bcsXQ"}],"5a3He":[function(e,t,r){"use strict";const i=e("../webcrypto"),n=e("../random-bytes"),{toString:s}=e("uint8arrays/to-string"),{fromString:o}=e("uint8arrays/from-string");function a(e){return Promise.all([i.get().subtle.exportKey("jwk",e.privateKey),i.get().subtle.exportKey("jwk",e.publicKey)])}r.utils=e("./rsa-utils"),r.generateKey=async function(e){const t=await i.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await a(t);return{privateKey:r[0],publicKey:r[1]}},r.unmarshalPrivateKey=async function(e){const t=[await i.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await(r=e,i.get().subtle.importKey("jwk",{kty:r.kty,n:r.n,e:r.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"]))];var r;const n=await a({privateKey:t[0],publicKey:t[1]});return{privateKey:n[0],publicKey:n[1]}},r.getRandomValues=n,r.hashAndSign=async function(e,t){const r=await i.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await i.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(t));return new Uint8Array(n,n.byteOffset,n.byteLength)},r.hashAndVerify=async function(e,t,r){const n=await i.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return i.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,t,r)};const{jwk2pub:c,jwk2priv:u}=e("./jwk2pem");function l(e,t,r,i){const n=t?c(e):u(e),a=i(s(Uint8Array.from(r),"ascii"),n);return o(a,"ascii")}r.encrypt=function(e,t){return l(e,!0,t,((e,t)=>t.encrypt(e)))},r.decrypt=function(e,t){return l(e,!1,t,((e,t)=>t.decrypt(e)))}},{"../webcrypto":"i99ng","../random-bytes":"gsnuW","uint8arrays/to-string":"hC8JB","uint8arrays/from-string":"dF7Y4","./rsa-utils":"3gF4s","./jwk2pem":"4kPkh"}],gsnuW:[function(e,t,r){"use strict";const i=e("iso-random-stream/src/random"),n=e("err-code");t.exports=function(e){if(isNaN(e)||e<=0)throw n(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return i(e)}},{"iso-random-stream/src/random":"bIbEo","err-code":"chZjB"}],bIbEo:[function(e,t,r){"use strict";const i=65536;t.exports=function(e){const t=new Uint8Array(e);let r=0;if(e>0)if(e>i)for(;r<e;)r+i>e?(crypto.getRandomValues(t.subarray(r,r+(e-r))),r+=e-r):(crypto.getRandomValues(t.subarray(r,r+i)),r+=i);else crypto.getRandomValues(t);return t}},{}],"3gF4s":[function(e,t,r){"use strict";e("node-forge/lib/asn1"),e("node-forge/lib/rsa");const i=e("node-forge/lib/forge"),{bigIntegerToUintBase64url:n,base64urlToBigInteger:s}=e("./../util"),{fromString:o}=e("uint8arrays/from-string"),{toString:a}=e("uint8arrays/to-string");r.pkcs1ToJwk=function(e){const t=i.asn1.fromDer(a(e,"ascii")),r=i.pki.privateKeyFromAsn1(t);return{kty:"RSA",n:n(r.n),e:n(r.e),d:n(r.d),p:n(r.p),q:n(r.q),dp:n(r.dP),dq:n(r.dQ),qi:n(r.qInv),alg:"RS256",kid:"2011-04-29"}},r.jwkToPkcs1=function(e){const t=i.pki.privateKeyToAsn1({n:s(e.n),e:s(e.e),d:s(e.d),p:s(e.p),q:s(e.q),dP:s(e.dp),dQ:s(e.dq),qInv:s(e.qi)});return o(i.asn1.toDer(t).getBytes(),"ascii")},r.pkixToJwk=function(e){const t=i.asn1.fromDer(a(e,"ascii")),r=i.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:n(r.n),e:n(r.e),alg:"RS256",kid:"2011-04-29"}},r.jwkToPkix=function(e){const t=i.pki.publicKeyToAsn1({n:s(e.n),e:s(e.e)});return o(i.asn1.toDer(t).getBytes(),"ascii")}},{"node-forge/lib/asn1":"bcsXQ","node-forge/lib/rsa":"9ROH2","node-forge/lib/forge":"4OuPD","./../util":"ffmp6","uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB"}],ffmp6:[function(e,t,r){"use strict";e("node-forge/lib/util"),e("node-forge/lib/jsbn");const i=e("node-forge/lib/forge"),{fromString:n}=e("uint8arrays/from-string"),{toString:s}=e("uint8arrays/to-string"),{concat:o}=e("uint8arrays/concat");r.bigIntegerToUintBase64url=(e,t)=>{let r=Uint8Array.from(e.abs().toByteArray());if(r=0===r[0]?r.slice(1):r,null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=o([new Uint8Array(t-r.length),r])}return s(r,"base64url")},r.base64urlToBigInteger=e=>{const t=r.base64urlToBuffer(e);return new i.jsbn.BigInteger(s(t,"base16"),16)},r.base64urlToBuffer=(e,t)=>{let r=n(e,"base64urlpad");if(null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=o([new Uint8Array(t-r.length),r])}return r}},{"node-forge/lib/util":"df43p","node-forge/lib/jsbn":"eeS3U","node-forge/lib/forge":"4OuPD","uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB","uint8arrays/concat":"4EBjG"}],"4kPkh":[function(e,t,r){"use strict";e("node-forge/lib/rsa");const i=e("node-forge/lib/forge"),{base64urlToBigInteger:n}=e("../util");function s(e,t){return t.map((t=>n(e[t])))}t.exports={jwk2pub:function(e){return i.pki.setRsaPublicKey(...s(e,["n","e"]))},jwk2priv:function(e){return i.pki.setRsaPrivateKey(...s(e,["n","e","d","p","q","dp","dq","qi"]))}}},{"node-forge/lib/rsa":"9ROH2","node-forge/lib/forge":"4OuPD","../util":"ffmp6"}],"8qVel":[function(e,t,r){"use strict";const{base64:i}=e("multiformats/bases/base64"),n=e("../ciphers/aes-gcm");t.exports={export:async function(e,t){const r=n.create(),s=await r.encrypt(e,t);return i.encode(s)}}},{"multiformats/bases/base64":"gaFBW","../ciphers/aes-gcm":"92UH6"}],dh3ng:[function(e,t,r){"use strict";const i=e("err-code"),{equals:n}=e("uint8arrays/equals"),{sha256:s}=e("multiformats/hashes/sha2"),{base58btc:o}=e("multiformats/bases/base58"),{identity:a}=e("multiformats/hashes/identity"),c=e("./ed25519"),u=e("./keys"),l=e("./exporter");class d{constructor(e){this._key=h(e,c.publicKeyLength)}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return this._key}get bytes(){return u.PublicKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return n(this.bytes,e.bytes)}async hash(){const{bytes:e}=await s.digest(this.bytes);return e}}class f{constructor(e,t){this._key=h(e,c.privateKeyLength),this._publicKey=h(t,c.publicKeyLength)}async sign(e){return c.hashAndSign(this._key,e)}get public(){return new d(this._publicKey)}marshal(){return this._key}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return n(this.bytes,e.bytes)}async hash(){const{bytes:e}=await s.digest(this.bytes);return e}async id(){const e=await a.digest(this.public.bytes);return o.encode(e.bytes).substring(1)}async export(e,t="libp2p-key"){if("libp2p-key"===t)return l.export(this.bytes,e);throw i(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}function h(e,t){if((e=Uint8Array.from(e||[])).length!==t)throw i(new Error(`Key must be a Uint8Array of length ${t}, got ${e.length}`),"ERR_INVALID_KEY_TYPE");return e}t.exports={Ed25519PublicKey:d,Ed25519PrivateKey:f,unmarshalEd25519PrivateKey:function(e){if(e.length>c.privateKeyLength){const t=(e=h(e,c.privateKeyLength+c.publicKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.privateKeyLength,e.length);return new f(t,r)}const t=(e=h(e,c.privateKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.publicKeyLength);return new f(t,r)},unmarshalEd25519PublicKey:function(e){return e=h(e,c.publicKeyLength),new d(e)},generateKeyPair:async function(){const{privateKey:e,publicKey:t}=await c.generateKey();return new f(e,t)},generateKeyPairFromSeed:async function(e){const{privateKey:t,publicKey:r}=await c.generateKeyFromSeed(e);return new f(t,r)}}},{"err-code":"chZjB","uint8arrays/equals":"eY3cX","multiformats/hashes/sha2":"7i9MT","multiformats/bases/base58":"4n7mA","multiformats/hashes/identity":"eYCZn","./ed25519":"8jlvB","./keys":"jWSTZ","./exporter":"8qVel"}],"8jlvB":[function(e,t,r){"use strict";e("node-forge/lib/ed25519");const i=e("node-forge/lib/forge");r.publicKeyLength=i.pki.ed25519.constants.PUBLIC_KEY_BYTE_LENGTH,r.privateKeyLength=i.pki.ed25519.constants.PRIVATE_KEY_BYTE_LENGTH,r.generateKey=async function(){return i.pki.ed25519.generateKeyPair()},r.generateKeyFromSeed=async function(e){return i.pki.ed25519.generateKeyPair({seed:e})},r.hashAndSign=async function(e,t){return i.pki.ed25519.sign({message:t,privateKey:e})},r.hashAndVerify=async function(e,t,r){return i.pki.ed25519.verify({signature:t,message:r,publicKey:e})}},{"node-forge/lib/ed25519":"9HAE7","node-forge/lib/forge":"4OuPD"}],jXCAP:[function(e,t,r){"use strict";const{sha256:i}=e("multiformats/hashes/sha2"),n=e("err-code"),{equals:s}=e("uint8arrays/equals"),{toString:o}=e("uint8arrays/to-string"),a=e("./exporter");t.exports=(t,r,c)=>{c=c||e("./secp256k1")(r);class u{constructor(e){c.validatePublicKey(e),this._key=e}verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.compressPublicKey(this._key)}get bytes(){return t.PublicKey.encode({Type:t.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return s(this.bytes,e.bytes)}async hash(){const{bytes:e}=await i.digest(this.bytes);return e}}class l{constructor(e,t){this._key=e,this._publicKey=t||c.computePublicKey(e),c.validatePrivateKey(this._key),c.validatePublicKey(this._publicKey)}sign(e){return c.hashAndSign(this._key,e)}get public(){return new u(this._publicKey)}marshal(){return this._key}get bytes(){return t.PrivateKey.encode({Type:t.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return s(this.bytes,e.bytes)}async hash(){const{bytes:e}=await i.digest(this.bytes);return e}async id(){const e=await this.public.hash();return o(e,"base58btc")}async export(e,t="libp2p-key"){if("libp2p-key"===t)return a.export(this.bytes,e);throw n(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}return{Secp256k1PublicKey:u,Secp256k1PrivateKey:l,unmarshalSecp256k1PrivateKey:function(e){return new l(e)},unmarshalSecp256k1PublicKey:function(e){return new u(e)},generateKeyPair:async function(){const e=await c.generateKey();return new l(e)}}}},{"multiformats/hashes/sha2":"7i9MT","err-code":"chZjB","uint8arrays/equals":"eY3cX","uint8arrays/to-string":"hC8JB","./exporter":"8qVel","./secp256k1":"e9sAH"}],e9sAH:[function(e,t,r){"use strict";const i=e("secp256k1"),{sha256:n}=e("multiformats/hashes/sha2");t.exports=e=>{function t(e){if(!i.privateKeyVerify(e))throw new Error("Invalid private key")}return{generateKey:function(){let t;do{t=e(32)}while(!i.privateKeyVerify(t));return t},privateKeyLength:32,hashAndSign:async function(e,t){const{digest:r}=await n.digest(t),s=i.ecdsaSign(r,e);return i.signatureExport(s.signature)},hashAndVerify:async function(e,t,r){const{digest:s}=await n.digest(r);return t=i.signatureImport(t),i.ecdsaVerify(t,s,e)},compressPublicKey:function(e){if(!i.publicKeyVerify(e))throw new Error("Invalid public key");return i.publicKeyConvert(e,!0)},decompressPublicKey:function(e){return i.publicKeyConvert(e,!1)},validatePrivateKey:t,validatePublicKey:function(e){if(!i.publicKeyVerify(e))throw new Error("Invalid public key")},computePublicKey:function(e){return t(e),i.publicKeyCreate(e)}}}},{secp256k1:"5e78P","multiformats/hashes/sha2":"7i9MT"}],"5e78P":[function(e,t,r){t.exports=e("./lib")(e("./lib/elliptic"))},{"./lib":"f9Aan","./lib/elliptic":"7HHQM"}],f9Aan:[function(e,t,r){const i="Impossible case. Please create issue.",n="The tweak was out of range or the resulted private key is invalid",s="The tweak was out of range or equal to zero",o="Unknow error on context randomization",a="Private Key is invalid",c="Public Key could not be parsed",u="Public Key serialization error",l="The sum of the public keys is not valid",d="Signature could not be parsed",f="The nonce generation function failed, or the private key was invalid",h="Public key could not be recover",p="Scalar was invalid (zero or overflow)";function g(e,t){if(!e)throw new Error(t)}function y(e,t,r){if(g(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const i=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;g(r.includes(t.length),i)}else{const i=`Expected ${e} to be an Uint8Array with length ${r}`;g(t.length===r,i)}}function m(e){g("Boolean"===v(e),"Expected compressed to be a Boolean")}function b(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),y("output",e,t),e}function v(e){return Object.prototype.toString.call(e).slice(8,-1)}t.exports=e=>({contextRandomize(t){if(g(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&y("seed",t,32),1===e.contextRandomize(t))throw new Error(o)},privateKeyVerify:t=>(y("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(y("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(i)}},privateKeyTweakAdd(t,r){switch(y("private key",t,32),y("tweak",r,32),e.privateKeyTweakAdd(t,r)){case 0:return t;case 1:throw new Error(n)}},privateKeyTweakMul(t,r){switch(y("private key",t,32),y("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(s)}},publicKeyVerify:t=>(y("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,i){switch(y("private key",t,32),m(r),i=b(i,r?33:65),e.publicKeyCreate(i,t)){case 0:return i;case 1:throw new Error(a);case 2:throw new Error(u)}},publicKeyConvert(t,r=!0,i){switch(y("public key",t,[33,65]),m(r),i=b(i,r?33:65),e.publicKeyConvert(i,t)){case 0:return i;case 1:throw new Error(c);case 2:throw new Error(u)}},publicKeyNegate(t,r=!0,n){switch(y("public key",t,[33,65]),m(r),n=b(n,r?33:65),e.publicKeyNegate(n,t)){case 0:return n;case 1:throw new Error(c);case 2:throw new Error(i);case 3:throw new Error(u)}},publicKeyCombine(t,r=!0,i){g(Array.isArray(t),"Expected public keys to be an Array"),g(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)y("public key",e,[33,65]);switch(m(r),i=b(i,r?33:65),e.publicKeyCombine(i,t)){case 0:return i;case 1:throw new Error(c);case 2:throw new Error(l);case 3:throw new Error(u)}},publicKeyTweakAdd(t,r,i=!0,s){switch(y("public key",t,[33,65]),y("tweak",r,32),m(i),s=b(s,i?33:65),e.publicKeyTweakAdd(s,t,r)){case 0:return s;case 1:throw new Error(c);case 2:throw new Error(n)}},publicKeyTweakMul(t,r,i=!0,n){switch(y("public key",t,[33,65]),y("tweak",r,32),m(i),n=b(n,i?33:65),e.publicKeyTweakMul(n,t,r)){case 0:return n;case 1:throw new Error(c);case 2:throw new Error(s)}},signatureNormalize(t){switch(y("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(d)}},signatureExport(t,r){y("signature",t,64);const n={output:r=b(r,72),outputlen:72};switch(e.signatureExport(n,t)){case 0:return r.slice(0,n.outputlen);case 1:throw new Error(d);case 2:throw new Error(i)}},signatureImport(t,r){switch(y("signature",t),r=b(r,64),e.signatureImport(r,t)){case 0:return r;case 1:throw new Error(d);case 2:throw new Error(i)}},ecdsaSign(t,r,n={},s){y("message",t,32),y("private key",r,32),g("Object"===v(n),"Expected options to be an Object"),void 0!==n.data&&y("options.data",n.data),void 0!==n.noncefn&&g("Function"===v(n.noncefn),"Expected options.noncefn to be a Function");const o={signature:s=b(s,64),recid:null};switch(e.ecdsaSign(o,t,r,n.data,n.noncefn)){case 0:return o;case 1:throw new Error(f);case 2:throw new Error(i)}},ecdsaVerify(t,r,i){switch(y("signature",t,64),y("message",r,32),y("public key",i,[33,65]),e.ecdsaVerify(t,r,i)){case 0:return!0;case 3:return!1;case 1:throw new Error(d);case 2:throw new Error(c)}},ecdsaRecover(t,r,n,s=!0,o){switch(y("signature",t,64),g("Number"===v(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),y("message",n,32),m(s),o=b(o,s?33:65),e.ecdsaRecover(o,t,r,n)){case 0:return o;case 1:throw new Error(d);case 2:throw new Error(h);case 3:throw new Error(i)}},ecdh(t,r,i={},n){switch(y("public key",t,[33,65]),y("private key",r,32),g("Object"===v(i),"Expected options to be an Object"),void 0!==i.data&&y("options.data",i.data),void 0!==i.hashfn?(g("Function"===v(i.hashfn),"Expected options.hashfn to be a Function"),void 0!==i.xbuf&&y("options.xbuf",i.xbuf,32),void 0!==i.ybuf&&y("options.ybuf",i.ybuf,32),y("output",n)):n=b(n,32),e.ecdh(n,t,r,i.data,i.hashfn,i.xbuf,i.ybuf)){case 0:return n;case 1:throw new Error(c);case 2:throw new Error(p)}}})},{}],"7HHQM":[function(e,t,r){const i=new(0,e("elliptic").ec)("secp256k1"),n=i.curve,s=n.n.constructor;function o(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new s(t);if(r.cmp(n.p)>=0)return null;r=r.toRed(n.red);let o=r.redSqr().redIMul(r).redIAdd(n.b).redSqrt();return 3===e!==o.isOdd()&&(o=o.redNeg()),i.keyPair({pub:{x:r,y:o}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let o=new s(t),a=new s(r);if(o.cmp(n.p)>=0||a.cmp(n.p)>=0)return null;if(o=o.toRed(n.red),a=a.toRed(n.red),(6===e||7===e)&&a.isOdd()!==(7===e))return null;const c=o.redSqr().redIMul(o);return a.redSqr().redISub(c.redIAdd(n.b)).isZero()?i.keyPair({pub:{x:o,y:a}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function a(e,t){const r=t.encode(null,33===e.length);for(let t=0;t<e.length;++t)e[t]=r[t]}t.exports={contextRandomize:()=>0,privateKeyVerify(e){const t=new s(e);return t.cmp(n.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new s(e),r=n.n.sub(t).umod(n.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new s(t);if(r.cmp(n.n)>=0)return 1;if(r.iadd(new s(e)),r.cmp(n.n)>=0&&r.isub(n.n),r.isZero())return 1;const i=r.toArrayLike(Uint8Array,"be",32);return e.set(i),0},privateKeyTweakMul(e,t){let r=new s(t);if(r.cmp(n.n)>=0||r.isZero())return 1;r.imul(new s(e)),r.cmp(n.n)>=0&&(r=r.umod(n.n));const i=r.toArrayLike(Uint8Array,"be",32);return e.set(i),0},publicKeyVerify:e=>null===o(e)?1:0,publicKeyCreate(e,t){const r=new s(t);if(r.cmp(n.n)>=0||r.isZero())return 1;return a(e,i.keyFromPrivate(t).getPublic()),0},publicKeyConvert(e,t){const r=o(t);if(null===r)return 1;return a(e,r.getPublic()),0},publicKeyNegate(e,t){const r=o(t);if(null===r)return 1;const i=r.getPublic();return i.y=i.y.redNeg(),a(e,i),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e<t.length;++e)if(r[e]=o(t[e]),null===r[e])return 1;let i=r[0].getPublic();for(let e=1;e<r.length;++e)i=i.add(r[e].pub);return i.isInfinity()?2:(a(e,i),0)},publicKeyTweakAdd(e,t,r){const i=o(t);if(null===i)return 1;if((r=new s(r)).cmp(n.n)>=0)return 2;const c=i.getPublic().add(n.g.mul(r));return c.isInfinity()?2:(a(e,c),0)},publicKeyTweakMul(e,t,r){const i=o(t);if(null===i)return 1;if((r=new s(r)).cmp(n.n)>=0||r.isZero())return 2;return a(e,i.getPublic().mul(r)),0},signatureNormalize(e){const t=new s(e.subarray(0,32)),r=new s(e.subarray(32,64));return t.cmp(n.n)>=0||r.cmp(n.n)>=0?1:(1===r.cmp(i.nh)&&e.set(n.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),i=t.subarray(32,64);if(new s(r).cmp(n.n)>=0)return 1;if(new s(i).cmp(n.n)>=0)return 1;const{output:o}=e;let a=o.subarray(4,37);a[0]=0,a.set(r,1);let c=33,u=0;for(;c>1&&0===a[u]&&!(128&a[u+1]);--c,++u);if(a=a.subarray(u),128&a[0])return 1;if(c>1&&0===a[0]&&!(128&a[1]))return 1;let l=o.subarray(39,72);l[0]=0,l.set(i,1);let d=33,f=0;for(;d>1&&0===l[f]&&!(128&l[f+1]);--d,++f);return l=l.subarray(f),128&l[0]||d>1&&0===l[0]&&!(128&l[1])?1:(e.outputlen=6+c+d,o[0]=48,o[1]=e.outputlen-2,o[2]=2,o[3]=a.length,o.set(a,4),o[4+c]=2,o[5+c]=l.length,o.set(l,6+c),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const i=t[5+r];if(0===i)return 1;if(6+r+i!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(i>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let o=t.subarray(4,4+r);if(33===o.length&&0===o[0]&&(o=o.subarray(1)),o.length>32)return 1;let a=t.subarray(6+r);if(33===a.length&&0===a[0]&&(a=a.slice(1)),a.length>32)throw new Error("S length is too long");let c=new s(o);c.cmp(n.n)>=0&&(c=new s(0));let u=new s(t.subarray(6+r));return u.cmp(n.n)>=0&&(u=new s(0)),e.set(c.toArrayLike(Uint8Array,"be",32),0),e.set(u.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,o,a){if(a){const e=a;a=i=>{const n=e(t,r,null,o,i);if(!(n instanceof Uint8Array&&32===n.length))throw new Error("This is the way");return new s(n)}}const c=new s(r);if(c.cmp(n.n)>=0||c.isZero())return 1;let u;try{u=i.sign(t,r,{canonical:!0,k:a,pers:o})}catch(e){return 1}return e.signature.set(u.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(u.s.toArrayLike(Uint8Array,"be",32),32),e.recid=u.recoveryParam,0},ecdsaVerify(e,t,r){const a={r:e.subarray(0,32),s:e.subarray(32,64)},c=new s(a.r),u=new s(a.s);if(c.cmp(n.n)>=0||u.cmp(n.n)>=0)return 1;if(1===u.cmp(i.nh)||c.isZero()||u.isZero())return 3;const l=o(r);if(null===l)return 2;const d=l.getPublic();return i.verify(t,a,d)?0:3},ecdsaRecover(e,t,r,o){const c={r:t.slice(0,32),s:t.slice(32,64)},u=new s(c.r),l=new s(c.s);if(u.cmp(n.n)>=0||l.cmp(n.n)>=0)return 1;if(u.isZero()||l.isZero())return 2;let d;try{d=i.recoverPubKey(o,c,r)}catch(e){return 2}return a(e,d),0},ecdh(e,t,r,a,c,u,l){const d=o(t);if(null===d)return 1;const f=new s(r);if(f.cmp(n.n)>=0||f.isZero())return 2;const h=d.getPublic().mul(f);if(void 0===c){const t=h.encode(null,!0),r=i.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{u||(u=new Uint8Array(32));const t=h.getX().toArray("be",32);for(let e=0;e<32;++e)u[e]=t[e];l||(l=new Uint8Array(32));const r=h.getY().toArray("be",32);for(let e=0;e<32;++e)l[e]=r[e];const i=c(u,l,a);if(!(i instanceof Uint8Array&&i.length===e.length))return 2;e.set(i)}return 0}}},{elliptic:"g2Vtb"}],g2Vtb:[function(e,t,r){"use strict";var i=r;i.version=e("../package.json").version,i.utils=e("./elliptic/utils"),i.rand=e("brorand"),i.curve=e("./elliptic/curve"),i.curves=e("./elliptic/curves"),i.ec=e("./elliptic/ec"),i.eddsa=e("./elliptic/eddsa")},{"../package.json":"ejBaf","./elliptic/utils":"959xT",brorand:"P54o1","./elliptic/curve":"byDyH","./elliptic/curves":"4unkA","./elliptic/ec":"5AnhI","./elliptic/eddsa":"j2H5w"}],ejBaf:[function(e,t,r){t.exports=JSON.parse('{"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"}}')},{}],"959xT":[function(e,t,r){"use strict";var i=r,n=e("bn.js"),s=e("minimalistic-assert"),o=e("minimalistic-crypto-utils");i.assert=s,i.toArray=o.toArray,i.zero2=o.zero2,i.toHex=o.toHex,i.encode=o.encode,i.getNAF=function(e,t,r){var i=new Array(Math.max(e.bitLength(),r)+1);i.fill(0);for(var n=1<<t+1,s=e.clone(),o=0;o<i.length;o++){var a,c=s.andln(n-1);s.isOdd()?(a=c>(n>>1)-1?(n>>1)-c:c,s.isubn(a)):a=0,i[o]=a,s.iushrn(1)}return i},i.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var i,n=0,s=0;e.cmpn(-n)>0||t.cmpn(-s)>0;){var o,a,c=e.andln(3)+n&3,u=t.andln(3)+s&3;3===c&&(c=-1),3===u&&(u=-1),o=0==(1&c)?0:3!==(i=e.andln(7)+n&7)&&5!==i||2!==u?c:-c,r[0].push(o),a=0==(1&u)?0:3!==(i=t.andln(7)+s&7)&&5!==i||2!==c?u:-u,r[1].push(a),2*n===o+1&&(n=1-n),2*s===a+1&&(s=1-s),e.iushrn(1),t.iushrn(1)}return r},i.cachedProperty=function(e,t,r){var i="_"+t;e.prototype[t]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(e){return"string"==typeof e?i.toArray(e,"hex"):e},i.intFromLE=function(e){return new n(e,"hex","le")}},{"bn.js":"c8Lvi","minimalistic-assert":"1GrVu","minimalistic-crypto-utils":"3MGAl"}],c8Lvi:[function(e,t,r){!function(t,r){function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function s(e,t,r){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof t?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:e("buffer").Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function c(e,t,r){var i=a(e,r);return r-1>=t&&(i|=a(e,r-1)<<4),i}function u(e,t,r,i){for(var n=0,s=Math.min(e.length,r),o=t;o<s;o++){var a=e.charCodeAt(o)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}s.isBN=function(e){return e instanceof s||null!==e&&"object"==typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return e.cmp(t)<0?e:t},s.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},s.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},s.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var s,o,a=0;if("be"===r)for(n=e.length-1,s=0;n>=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===r)for(n=0,s=0;n<e.length;n+=3)o=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,s=0,o=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=c(e,t,i)<<s,this.words[o]|=67108863&n,s>=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=c(e,t,i)<<s,this.words[o]|=67108863&n,s>=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this.strip()},s.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var s=e.length-r,o=s%i,a=Math.min(s,s-o)+r,c=0,l=r;l<a;l+=i)c=u(e,l,l+i,t),this.imuln(n),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==o){var d=1;for(c=u(e,l,e.length,t),l=0;l<o;l++)d*=t;this.imuln(d),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},s.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},s.prototype.clone=function(){var e=new s(null);return this.copy(e),e},s.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","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"],d=[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],f=[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];function h(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],s=0|t.words[0],o=n*s,a=67108863&o,c=o/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=c>>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(o=(n=0|e.words[p])*(s=0|t.words[h])+d)/67108864|0,d=67108863&o}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}s.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],c=(16777215&(a<<n|s)).toString(16);r=0!==(s=a>>>24-n&16777215)||o!==this.length-1?l[6-c.length]+c+r:c+r,(n+=2)>=26&&(n-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var u=d[e],h=f[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?g+r:l[u-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(e,t){return i(void 0!==o),this.toArrayLike(o,e,t)},s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,r){var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,"byte array longer than desired length"),i(s>0,"Requested array length <= 0"),this.strip();var o,a,c="le"===t,u=new e(s),l=this.clone();if(c){for(a=0;!l.isZero();a++)o=l.andln(255),l.iushrn(8),u[a]=o;for(;a<s;a++)u[a]=0}else{for(a=0;a<s-n;a++)u[a]=0;for(a=0;!l.isZero();a++)o=l.andln(255),l.iushrn(8),u[s-a-1]=o}return u},Math.clz32?s.prototype._countBits=function(e){return 32-Math.clz32(e)}:s.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},s.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},s.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},s.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},s.prototype.ior=function(e){return i(0==(this.negative|e.negative)),this.iuor(e)},s.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},s.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},s.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},s.prototype.iand=function(e){return i(0==(this.negative|e.negative)),this.iuand(e)},s.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},s.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},s.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this.strip()},s.prototype.ixor=function(e){return i(0==(this.negative|e.negative)),this.iuxor(e)},s.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},s.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},s.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},s.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,s=0;s<i.length;s++)t=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=67108863&t,n=t>>>26;for(;0!==n&&s<r.length;s++)t=(0|r.words[s])+n,this.words[s]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},s.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var s=0,o=0;o<i.length;o++)s=(t=(0|r.words[o])-(0|i.words[o])+s)>>26,this.words[o]=67108863&t;for(;0!==s&&o<r.length;o++)s=(t=(0|r.words[o])+s)>>26,this.words[o]=67108863&t;if(0===s&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(e){return this.clone().isub(e)};var p=function(e,t,r){var i,n,s,o=e.words,a=t.words,c=r.words,u=0,l=0|o[0],d=8191&l,f=l>>>13,h=0|o[1],p=8191&h,g=h>>>13,y=0|o[2],m=8191&y,b=y>>>13,v=0|o[3],w=8191&v,_=v>>>13,E=0|o[4],S=8191&E,T=E>>>13,A=0|o[5],k=8191&A,I=A>>>13,R=0|o[6],P=8191&R,O=R>>>13,C=0|o[7],j=8191&C,D=C>>>13,M=0|o[8],x=8191&M,B=M>>>13,L=0|o[9],N=8191&L,U=L>>>13,F=0|a[0],K=8191&F,z=F>>>13,V=0|a[1],q=8191&V,G=V>>>13,H=0|a[2],$=8191&H,W=H>>>13,Y=0|a[3],X=8191&Y,Z=Y>>>13,Q=0|a[4],J=8191&Q,ee=Q>>>13,te=0|a[5],re=8191&te,ie=te>>>13,ne=0|a[6],se=8191&ne,oe=ne>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,fe=le>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(i=Math.imul(d,K))|0)+((8191&(n=(n=Math.imul(d,z))+Math.imul(f,K)|0))<<13)|0;u=((s=Math.imul(f,z))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(p,K),n=(n=Math.imul(p,z))+Math.imul(g,K)|0,s=Math.imul(g,z);var me=(u+(i=i+Math.imul(d,q)|0)|0)+((8191&(n=(n=n+Math.imul(d,G)|0)+Math.imul(f,q)|0))<<13)|0;u=((s=s+Math.imul(f,G)|0)+(n>>>13)|0)+(me>>>26)|0,me&=67108863,i=Math.imul(m,K),n=(n=Math.imul(m,z))+Math.imul(b,K)|0,s=Math.imul(b,z),i=i+Math.imul(p,q)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(g,q)|0,s=s+Math.imul(g,G)|0;var be=(u+(i=i+Math.imul(d,$)|0)|0)+((8191&(n=(n=n+Math.imul(d,W)|0)+Math.imul(f,$)|0))<<13)|0;u=((s=s+Math.imul(f,W)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(w,K),n=(n=Math.imul(w,z))+Math.imul(_,K)|0,s=Math.imul(_,z),i=i+Math.imul(m,q)|0,n=(n=n+Math.imul(m,G)|0)+Math.imul(b,q)|0,s=s+Math.imul(b,G)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(g,$)|0,s=s+Math.imul(g,W)|0;var ve=(u+(i=i+Math.imul(d,X)|0)|0)+((8191&(n=(n=n+Math.imul(d,Z)|0)+Math.imul(f,X)|0))<<13)|0;u=((s=s+Math.imul(f,Z)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(S,K),n=(n=Math.imul(S,z))+Math.imul(T,K)|0,s=Math.imul(T,z),i=i+Math.imul(w,q)|0,n=(n=n+Math.imul(w,G)|0)+Math.imul(_,q)|0,s=s+Math.imul(_,G)|0,i=i+Math.imul(m,$)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(g,X)|0,s=s+Math.imul(g,Z)|0;var we=(u+(i=i+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(f,J)|0))<<13)|0;u=((s=s+Math.imul(f,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(k,K),n=(n=Math.imul(k,z))+Math.imul(I,K)|0,s=Math.imul(I,z),i=i+Math.imul(S,q)|0,n=(n=n+Math.imul(S,G)|0)+Math.imul(T,q)|0,s=s+Math.imul(T,G)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,Z)|0)+Math.imul(b,X)|0,s=s+Math.imul(b,Z)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(g,J)|0,s=s+Math.imul(g,ee)|0;var _e=(u+(i=i+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,ie)|0)+Math.imul(f,re)|0))<<13)|0;u=((s=s+Math.imul(f,ie)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(P,K),n=(n=Math.imul(P,z))+Math.imul(O,K)|0,s=Math.imul(O,z),i=i+Math.imul(k,q)|0,n=(n=n+Math.imul(k,G)|0)+Math.imul(I,q)|0,s=s+Math.imul(I,G)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,W)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(_,X)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(m,J)|0,n=(n=n+Math.imul(m,ee)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(g,re)|0,s=s+Math.imul(g,ie)|0;var Ee=(u+(i=i+Math.imul(d,se)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(f,se)|0))<<13)|0;u=((s=s+Math.imul(f,oe)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(j,K),n=(n=Math.imul(j,z))+Math.imul(D,K)|0,s=Math.imul(D,z),i=i+Math.imul(P,q)|0,n=(n=n+Math.imul(P,G)|0)+Math.imul(O,q)|0,s=s+Math.imul(O,G)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(I,$)|0,s=s+Math.imul(I,W)|0,i=i+Math.imul(S,X)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(T,X)|0,s=s+Math.imul(T,Z)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul(_,J)|0,s=s+Math.imul(_,ee)|0,i=i+Math.imul(m,re)|0,n=(n=n+Math.imul(m,ie)|0)+Math.imul(b,re)|0,s=s+Math.imul(b,ie)|0,i=i+Math.imul(p,se)|0,n=(n=n+Math.imul(p,oe)|0)+Math.imul(g,se)|0,s=s+Math.imul(g,oe)|0;var Se=(u+(i=i+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((s=s+Math.imul(f,ue)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(x,K),n=(n=Math.imul(x,z))+Math.imul(B,K)|0,s=Math.imul(B,z),i=i+Math.imul(j,q)|0,n=(n=n+Math.imul(j,G)|0)+Math.imul(D,q)|0,s=s+Math.imul(D,G)|0,i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,i=i+Math.imul(k,X)|0,n=(n=n+Math.imul(k,Z)|0)+Math.imul(I,X)|0,s=s+Math.imul(I,Z)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,ee)|0,i=i+Math.imul(w,re)|0,n=(n=n+Math.imul(w,ie)|0)+Math.imul(_,re)|0,s=s+Math.imul(_,ie)|0,i=i+Math.imul(m,se)|0,n=(n=n+Math.imul(m,oe)|0)+Math.imul(b,se)|0,s=s+Math.imul(b,oe)|0,i=i+Math.imul(p,ce)|0,n=(n=n+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,s=s+Math.imul(g,ue)|0;var Te=(u+(i=i+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((s=s+Math.imul(f,fe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,z))+Math.imul(U,K)|0,s=Math.imul(U,z),i=i+Math.imul(x,q)|0,n=(n=n+Math.imul(x,G)|0)+Math.imul(B,q)|0,s=s+Math.imul(B,G)|0,i=i+Math.imul(j,$)|0,n=(n=n+Math.imul(j,W)|0)+Math.imul(D,$)|0,s=s+Math.imul(D,W)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(O,X)|0,s=s+Math.imul(O,Z)|0,i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,ee)|0)+Math.imul(I,J)|0,s=s+Math.imul(I,ee)|0,i=i+Math.imul(S,re)|0,n=(n=n+Math.imul(S,ie)|0)+Math.imul(T,re)|0,s=s+Math.imul(T,ie)|0,i=i+Math.imul(w,se)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul(_,se)|0,s=s+Math.imul(_,oe)|0,i=i+Math.imul(m,ce)|0,n=(n=n+Math.imul(m,ue)|0)+Math.imul(b,ce)|0,s=s+Math.imul(b,ue)|0,i=i+Math.imul(p,de)|0,n=(n=n+Math.imul(p,fe)|0)+Math.imul(g,de)|0,s=s+Math.imul(g,fe)|0;var Ae=(u+(i=i+Math.imul(d,pe)|0)|0)+((8191&(n=(n=n+Math.imul(d,ge)|0)+Math.imul(f,pe)|0))<<13)|0;u=((s=s+Math.imul(f,ge)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(N,q),n=(n=Math.imul(N,G))+Math.imul(U,q)|0,s=Math.imul(U,G),i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(B,$)|0,s=s+Math.imul(B,W)|0,i=i+Math.imul(j,X)|0,n=(n=n+Math.imul(j,Z)|0)+Math.imul(D,X)|0,s=s+Math.imul(D,Z)|0,i=i+Math.imul(P,J)|0,n=(n=n+Math.imul(P,ee)|0)+Math.imul(O,J)|0,s=s+Math.imul(O,ee)|0,i=i+Math.imul(k,re)|0,n=(n=n+Math.imul(k,ie)|0)+Math.imul(I,re)|0,s=s+Math.imul(I,ie)|0,i=i+Math.imul(S,se)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(T,se)|0,s=s+Math.imul(T,oe)|0,i=i+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul(_,ce)|0,s=s+Math.imul(_,ue)|0,i=i+Math.imul(m,de)|0,n=(n=n+Math.imul(m,fe)|0)+Math.imul(b,de)|0,s=s+Math.imul(b,fe)|0;var ke=(u+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((s=s+Math.imul(g,ge)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(N,$),n=(n=Math.imul(N,W))+Math.imul(U,$)|0,s=Math.imul(U,W),i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(B,X)|0,s=s+Math.imul(B,Z)|0,i=i+Math.imul(j,J)|0,n=(n=n+Math.imul(j,ee)|0)+Math.imul(D,J)|0,s=s+Math.imul(D,ee)|0,i=i+Math.imul(P,re)|0,n=(n=n+Math.imul(P,ie)|0)+Math.imul(O,re)|0,s=s+Math.imul(O,ie)|0,i=i+Math.imul(k,se)|0,n=(n=n+Math.imul(k,oe)|0)+Math.imul(I,se)|0,s=s+Math.imul(I,oe)|0,i=i+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(T,ce)|0,s=s+Math.imul(T,ue)|0,i=i+Math.imul(w,de)|0,n=(n=n+Math.imul(w,fe)|0)+Math.imul(_,de)|0,s=s+Math.imul(_,fe)|0;var Ie=(u+(i=i+Math.imul(m,pe)|0)|0)+((8191&(n=(n=n+Math.imul(m,ge)|0)+Math.imul(b,pe)|0))<<13)|0;u=((s=s+Math.imul(b,ge)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(N,X),n=(n=Math.imul(N,Z))+Math.imul(U,X)|0,s=Math.imul(U,Z),i=i+Math.imul(x,J)|0,n=(n=n+Math.imul(x,ee)|0)+Math.imul(B,J)|0,s=s+Math.imul(B,ee)|0,i=i+Math.imul(j,re)|0,n=(n=n+Math.imul(j,ie)|0)+Math.imul(D,re)|0,s=s+Math.imul(D,ie)|0,i=i+Math.imul(P,se)|0,n=(n=n+Math.imul(P,oe)|0)+Math.imul(O,se)|0,s=s+Math.imul(O,oe)|0,i=i+Math.imul(k,ce)|0,n=(n=n+Math.imul(k,ue)|0)+Math.imul(I,ce)|0,s=s+Math.imul(I,ue)|0,i=i+Math.imul(S,de)|0,n=(n=n+Math.imul(S,fe)|0)+Math.imul(T,de)|0,s=s+Math.imul(T,fe)|0;var Re=(u+(i=i+Math.imul(w,pe)|0)|0)+((8191&(n=(n=n+Math.imul(w,ge)|0)+Math.imul(_,pe)|0))<<13)|0;u=((s=s+Math.imul(_,ge)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(N,J),n=(n=Math.imul(N,ee))+Math.imul(U,J)|0,s=Math.imul(U,ee),i=i+Math.imul(x,re)|0,n=(n=n+Math.imul(x,ie)|0)+Math.imul(B,re)|0,s=s+Math.imul(B,ie)|0,i=i+Math.imul(j,se)|0,n=(n=n+Math.imul(j,oe)|0)+Math.imul(D,se)|0,s=s+Math.imul(D,oe)|0,i=i+Math.imul(P,ce)|0,n=(n=n+Math.imul(P,ue)|0)+Math.imul(O,ce)|0,s=s+Math.imul(O,ue)|0,i=i+Math.imul(k,de)|0,n=(n=n+Math.imul(k,fe)|0)+Math.imul(I,de)|0,s=s+Math.imul(I,fe)|0;var Pe=(u+(i=i+Math.imul(S,pe)|0)|0)+((8191&(n=(n=n+Math.imul(S,ge)|0)+Math.imul(T,pe)|0))<<13)|0;u=((s=s+Math.imul(T,ge)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(N,re),n=(n=Math.imul(N,ie))+Math.imul(U,re)|0,s=Math.imul(U,ie),i=i+Math.imul(x,se)|0,n=(n=n+Math.imul(x,oe)|0)+Math.imul(B,se)|0,s=s+Math.imul(B,oe)|0,i=i+Math.imul(j,ce)|0,n=(n=n+Math.imul(j,ue)|0)+Math.imul(D,ce)|0,s=s+Math.imul(D,ue)|0,i=i+Math.imul(P,de)|0,n=(n=n+Math.imul(P,fe)|0)+Math.imul(O,de)|0,s=s+Math.imul(O,fe)|0;var Oe=(u+(i=i+Math.imul(k,pe)|0)|0)+((8191&(n=(n=n+Math.imul(k,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((s=s+Math.imul(I,ge)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,i=Math.imul(N,se),n=(n=Math.imul(N,oe))+Math.imul(U,se)|0,s=Math.imul(U,oe),i=i+Math.imul(x,ce)|0,n=(n=n+Math.imul(x,ue)|0)+Math.imul(B,ce)|0,s=s+Math.imul(B,ue)|0,i=i+Math.imul(j,de)|0,n=(n=n+Math.imul(j,fe)|0)+Math.imul(D,de)|0,s=s+Math.imul(D,fe)|0;var Ce=(u+(i=i+Math.imul(P,pe)|0)|0)+((8191&(n=(n=n+Math.imul(P,ge)|0)+Math.imul(O,pe)|0))<<13)|0;u=((s=s+Math.imul(O,ge)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,i=Math.imul(N,ce),n=(n=Math.imul(N,ue))+Math.imul(U,ce)|0,s=Math.imul(U,ue),i=i+Math.imul(x,de)|0,n=(n=n+Math.imul(x,fe)|0)+Math.imul(B,de)|0,s=s+Math.imul(B,fe)|0;var je=(u+(i=i+Math.imul(j,pe)|0)|0)+((8191&(n=(n=n+Math.imul(j,ge)|0)+Math.imul(D,pe)|0))<<13)|0;u=((s=s+Math.imul(D,ge)|0)+(n>>>13)|0)+(je>>>26)|0,je&=67108863,i=Math.imul(N,de),n=(n=Math.imul(N,fe))+Math.imul(U,de)|0,s=Math.imul(U,fe);var De=(u+(i=i+Math.imul(x,pe)|0)|0)+((8191&(n=(n=n+Math.imul(x,ge)|0)+Math.imul(B,pe)|0))<<13)|0;u=((s=s+Math.imul(B,ge)|0)+(n>>>13)|0)+(De>>>26)|0,De&=67108863;var Me=(u+(i=Math.imul(N,pe))|0)+((8191&(n=(n=Math.imul(N,ge))+Math.imul(U,pe)|0))<<13)|0;return u=((s=Math.imul(U,ge))+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,c[0]=ye,c[1]=me,c[2]=be,c[3]=ve,c[4]=we,c[5]=_e,c[6]=Ee,c[7]=Se,c[8]=Te,c[9]=Ae,c[10]=ke,c[11]=Ie,c[12]=Re,c[13]=Pe,c[14]=Oe,c[15]=Ce,c[16]=je,c[17]=De,c[18]=Me,0!==u&&(c[19]=u,r.length++),r};function g(e,t,r){return(new y).mulp(e,t,r)}function y(e,t){this.x=e,this.y=t}Math.imul||(p=h),s.prototype.mulTo=function(e,t){var r,i=this.length+e.length;return r=10===this.length&&10===e.length?p(this,e,t):i<63?h(this,e,t):i<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=67108863&i,c=Math.min(s,t.length-1),u=Math.max(0,s-e.length+1);u<=c;u++){var l=s-u,d=(0|e.words[l])*(0|t.words[u]),f=67108863&d;a=67108863&(f=f+a|0),n+=(o=(o=o+(d/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r.strip()}(this,e,t):g(this,e,t),r},y.prototype.makeRBT=function(e){for(var t=new Array(e),r=s.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},y.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},y.prototype.permute=function(e,t,r,i,n,s){for(var o=0;o<s;o++)i[o]=t[e[o]],n[o]=r[e[o]]},y.prototype.transform=function(e,t,r,i,n,s){this.permute(s,e,t,r,i,n);for(var o=1;o<n;o<<=1)for(var a=o<<1,c=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var d=c,f=u,h=0;h<o;h++){var p=r[l+h],g=i[l+h],y=r[l+h+o],m=i[l+h+o],b=d*y-f*m;m=d*m+f*y,y=b,r[l+h]=p+y,i[l+h]=g+m,r[l+h+o]=p-y,i[l+h+o]=g-m,h!==a&&(b=c*d-u*f,f=c*f+u*d,d=b)}},y.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},y.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},y.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},y.prototype.convert13b=function(e,t,r,n){for(var s=0,o=0;o<t;o++)s+=0|e[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*t;o<n;++o)r[o]=0;i(0===s),i(0==(-8192&s))},y.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},y.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),s=this.stub(i),o=new Array(i),a=new Array(i),c=new Array(i),u=new Array(i),l=new Array(i),d=new Array(i),f=r.words;f.length=i,this.convert13b(e.words,e.length,o,i),this.convert13b(t.words,t.length,u,i),this.transform(o,s,a,c,i,n),this.transform(u,s,l,d,i,n);for(var h=0;h<i;h++){var p=a[h]*l[h]-c[h]*d[h];c[h]=a[h]*d[h]+c[h]*l[h],a[h]=p}return this.conjugate(a,c,i),this.transform(a,c,f,s,i,n),this.conjugate(f,s,i),this.normalize13b(f,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},s.prototype.mul=function(e){var t=new s(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},s.prototype.mulf=function(e){var t=new s(null);return t.words=new Array(this.length+e.length),g(this,e,t)},s.prototype.imul=function(e){return this.clone().mulTo(e,this)},s.prototype.imuln=function(e){i("number"==typeof e),i(e<67108864);for(var t=0,r=0;r<this.length;r++){var n=(0|this.words[r])*e,s=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=s>>>26,this.words[r]=67108863&s}return 0!==t&&(this.words[r]=t,this.length++),this},s.prototype.muln=function(e){return this.clone().imuln(e)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=(e.words[i]&1<<n)>>>n}return t}(e);if(0===t.length)return new s(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},s.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var a=this.words[t]&s,c=(0|this.words[t])-a<<r;this.words[t]=c|o,o=a>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this.strip()},s.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},s.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var s=e%26,o=Math.min((e-s)/26,this.length),a=67108863^67108863>>>s<<s,c=r;if(n-=o,n=Math.max(0,n),c){for(var u=0;u<o;u++)c.words[u]=this.words[u];c.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-s|d>>>s,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},s.prototype.shln=function(e){return this.clone().ishln(e)},s.prototype.ushln=function(e){return this.clone().iushln(e)},s.prototype.shrn=function(e){return this.clone().ishrn(e)},s.prototype.ushrn=function(e){return this.clone().iushrn(e)},s.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},s.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},s.prototype.maskn=function(e){return this.clone().imaskn(e)},s.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},s.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},s.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},s.prototype.addn=function(e){return this.clone().iaddn(e)},s.prototype.subn=function(e){return this.clone().isubn(e)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(e,t,r){var n,s,o=e.length+r;this._expand(o);var a=0;for(n=0;n<e.length;n++){s=(0|this.words[n+r])+a;var c=(0|e.words[n])*t;a=((s-=67108863&c)>>26)-(c/67108864|0),this.words[n+r]=67108863&s}for(;n<this.length-r;n++)a=(s=(0|this.words[n+r])+a)>>26,this.words[n+r]=67108863&s;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(s=-(0|this.words[n])+a)>>26,this.words[n]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,c=i.length-n.length;if("mod"!==t){(a=new s(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(n,1,c);0===l.negative&&(i=l,a&&(a.words[c]=1));for(var d=c-1;d>=0;d--){var f=67108864*(0|i.words[n.length+d])+(0|i.words[n.length+d-1]);for(f=Math.min(f/o|0,67108863),i._ishlnsubmul(n,f,d);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(n,1,d),i.isZero()||(i.negative^=1);a&&(a.words[d]=f)}return a&&a.strip(),i.strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(n=a.div.neg()),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:n,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new s(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new s(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new s(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,o,a},s.prototype.div=function(e){return this.divmod(e,"div",!1).div},s.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},s.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},s.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},s.prototype.modn=function(e){i(e<=67108863);for(var t=67108864%e,r=0,n=this.length-1;n>=0;n--)r=(t*r+(0|this.words[n]))%e;return r},s.prototype.idivn=function(e){i(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},s.prototype.divn=function(e){return this.clone().idivn(e)},s.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new s(1),o=new s(0),a=new s(0),c=new s(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var l=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(l),o.isub(d)),n.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(a),o.isub(c)):(r.isub(t),a.isub(n),c.isub(o))}return{a:a,b:c,gcd:r.iushln(u)}},s.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,o=new s(1),a=new s(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,l=1;0==(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a)):(r.isub(t),a.isub(o))}return(n=0===t.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(e),n},s.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var s=t;t=r,r=s}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},s.prototype.invm=function(e){return this.egcd(e).a.umod(e)},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.andln=function(e){return this.words[0]&e},s.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var s=n,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];s=(a+=s)>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},s.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},s.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},s.prototype.gtn=function(e){return 1===this.cmpn(e)},s.prototype.gt=function(e){return 1===this.cmp(e)},s.prototype.gten=function(e){return this.cmpn(e)>=0},s.prototype.gte=function(e){return this.cmp(e)>=0},s.prototype.ltn=function(e){return-1===this.cmpn(e)},s.prototype.lt=function(e){return-1===this.cmp(e)},s.prototype.lten=function(e){return this.cmpn(e)<=0},s.prototype.lte=function(e){return this.cmp(e)<=0},s.prototype.eqn=function(e){return 0===this.cmpn(e)},s.prototype.eq=function(e){return 0===this.cmp(e)},s.red=function(e){return new S(e)},s.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(e){return this.red=e,this},s.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new s(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},n(v,b),v.prototype.split=function(e,t){for(var r=4194303,i=Math.min(e.length,9),n=0;n<i;n++)t.words[n]=e.words[n];if(t.length=i,e.length<=9)return e.words[0]=0,void(e.length=1);var s=e.words[9];for(t.words[t.length++]=s&r,n=10;n<e.length;n++){var o=0|e.words[n];e.words[n-10]=(o&r)<<4|s>>>22,s=o}s>>>=22,e.words[n-10]=s,0===s&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(w,b),n(_,b),n(E,b),E.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new w;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return m[e]=t,t},S.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new s(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new s(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,n),f=this.pow(e,n.addn(1).iushrn(1)),h=this.pow(e,n),p=o;0!==h.cmp(a);){for(var g=h,y=0;0!==g.cmp(a);y++)g=g.redSqr();i(y<p);var m=this.pow(d,new s(1).iushln(p-y-1));f=f.redMul(m),d=m.redSqr(),h=h.redMul(d),p=y}return f},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new s(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new s(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],o=0,a=0,c=t.bitLength()%26;for(0===c&&(c=26),i=t.length-1;i>=0;i--){for(var u=t.words[i],l=c-1;l>=0;l--){var d=u>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==d||0!==o?(o<<=1,o|=d,(4===++a||0===i&&0===l)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}c=26}return n},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new T(e)},n(T,S),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:"lHksA"}],"1GrVu":[function(e,t,r){function i(e,t){if(!e)throw new Error(t||"Assertion failed")}t.exports=i,i.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},{}],"3MGAl":[function(e,t,r){"use strict";var i=r;function n(e){return 1===e.length?"0"+e:e}function s(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}i.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var i=0;i<e.length;i++)r[i]=0|e[i];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(i=0;i<e.length;i++){var n=e.charCodeAt(i),s=n>>8,o=255&n;s?r.push(s,o):r.push(o)}return r},i.zero2=n,i.toHex=s,i.encode=function(e,t){return"hex"===t?s(e):e}},{}],P54o1:[function(e,t,r){var i;function n(e){this.rand=e}if(t.exports=function(e){return i||(i=new n(null)),i.generate(e)},t.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(n.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var s=e("crypto");if("function"!=typeof s.randomBytes)throw new Error("Not supported");n.prototype._rand=function(e){return s.randomBytes(e)}}catch(e){}},{crypto:"lHksA"}],byDyH:[function(e,t,r){"use strict";var i=r;i.base=e("./base"),i.short=e("./short"),i.mont=e("./mont"),i.edwards=e("./edwards")},{"./base":"joYZE","./short":"kfe4L","./mont":"exiKb","./edwards":"d2B4t"}],joYZE:[function(e,t,r){"use strict";var i=e("bn.js"),n=e("../utils"),s=n.getNAF,o=n.getJSF,a=n.assert;function c(e,t){this.type=e,this.p=new i(t.p,16),this.red=t.prime?i.red(t.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=t.n&&new i(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}t.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var r=e._getDoubles(),i=s(t,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var o,c,u=[];for(o=0;o<i.length;o+=r.step){c=0;for(var l=o+r.step-1;l>=o;l--)c=(c<<1)+i[l];u.push(c)}for(var d=this.jpoint(null,null,null),f=this.jpoint(null,null,null),h=n;h>0;h--){for(o=0;o<u.length;o++)(c=u[o])===h?f=f.mixedAdd(r.points[o]):c===-h&&(f=f.mixedAdd(r.points[o].neg()));d=d.add(f)}return d.toP()},c.prototype._wnafMul=function(e,t){var r=4,i=e._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=s(t,r,this._bitLength),c=this.jpoint(null,null,null),u=o.length-1;u>=0;u--){for(var l=0;u>=0&&0===o[u];u--)l++;if(u>=0&&l++,c=c.dblp(l),u<0)break;var d=o[u];a(0!==d),c="affine"===e.type?d>0?c.mixedAdd(n[d-1>>1]):c.mixedAdd(n[-d-1>>1].neg()):d>0?c.add(n[d-1>>1]):c.add(n[-d-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,r,i,n){var a,c,u,l=this._wnafT1,d=this._wnafT2,f=this._wnafT3,h=0;for(a=0;a<i;a++){var p=(u=t[a])._getNAFPoints(e);l[a]=p.wnd,d[a]=p.points}for(a=i-1;a>=1;a-=2){var g=a-1,y=a;if(1===l[g]&&1===l[y]){var m=[t[g],null,null,t[y]];0===t[g].y.cmp(t[y].y)?(m[1]=t[g].add(t[y]),m[2]=t[g].toJ().mixedAdd(t[y].neg())):0===t[g].y.cmp(t[y].y.redNeg())?(m[1]=t[g].toJ().mixedAdd(t[y]),m[2]=t[g].add(t[y].neg())):(m[1]=t[g].toJ().mixedAdd(t[y]),m[2]=t[g].toJ().mixedAdd(t[y].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],v=o(r[g],r[y]);for(h=Math.max(v[0].length,h),f[g]=new Array(h),f[y]=new Array(h),c=0;c<h;c++){var w=0|v[0][c],_=0|v[1][c];f[g][c]=b[3*(w+1)+(_+1)],f[y][c]=0,d[g]=m}}else f[g]=s(r[g],l[g],this._bitLength),f[y]=s(r[y],l[y],this._bitLength),h=Math.max(f[g].length,h),h=Math.max(f[y].length,h)}var E=this.jpoint(null,null,null),S=this._wnafT4;for(a=h;a>=0;a--){for(var T=0;a>=0;){var A=!0;for(c=0;c<i;c++)S[c]=0|f[c][a],0!==S[c]&&(A=!1);if(!A)break;T++,a--}if(a>=0&&T++,E=E.dblp(T),a<0)break;for(c=0;c<i;c++){var k=S[c];0!==k&&(k>0?u=d[c][k-1>>1]:k<0&&(u=d[c][-k-1>>1].neg()),E="affine"===u.type?E.mixedAdd(u):E.add(u))}}for(a=0;a<i;a++)d[a]=null;return n?E:E.toP()},c.BasePoint=u,u.prototype.eq=function(){throw new Error("Not implemented")},u.prototype.validate=function(){return this.curve.validate(this)},c.prototype.decodePoint=function(e,t){e=n.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?a(e[e.length-1]%2==0):7===e[0]&&a(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},u.prototype.encodeCompressed=function(e){return this.encode(e,!0)},u.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},u.prototype.encode=function(e,t){return n.encode(this._encode(t),e)},u.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},u.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<t;n+=e){for(var s=0;s<e;s++)i=i.dbl();r.push(i)}return{step:e,points:r}},u.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)t[n]=t[n-1].add(i);return{wnd:e,points:t}},u.prototype._getBeta=function(){return null},u.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},{"bn.js":"c8Lvi","../utils":"959xT"}],kfe4L:[function(e,t,r){"use strict";var i=e("../utils"),n=e("bn.js"),s=e("inherits"),o=e("./base"),a=i.assert;function c(e){o.call(this,"short",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,r,i){o.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(t,16),this.y=new n(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,r,i){o.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(t,16),this.y=new n(r,16),this.z=new n(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(c,o),t.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new n(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=(t=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(e.lambda)r=new n(e.lambda,16);else{var s=this._getEndoRoots(this.n);0===this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))?r=s[0]:(r=s[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new n(e.a,16),b:new n(e.b,16)}})):this._getEndoBasis(r)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:n.mont(e),r=new n(2).toRed(t).redInvm(),i=r.redNeg(),s=new n(3).toRed(t).redNeg().redSqrt().redMul(r);return[i.redAdd(s).fromRed(),i.redSub(s).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,r,i,s,o,a,c,u,l,d=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=e,h=this.n.clone(),p=new n(1),g=new n(0),y=new n(0),m=new n(1),b=0;0!==f.cmpn(0);){var v=h.div(f);u=h.sub(v.mul(f)),l=y.sub(v.mul(p));var w=m.sub(v.mul(g));if(!i&&u.cmp(d)<0)t=c.neg(),r=p,i=u.neg(),s=l;else if(i&&2==++b)break;c=u,h=f,f=u,y=p,p=l,m=g,g=w}o=u.neg(),a=l;var _=i.sqr().add(s.sqr());return o.sqr().add(a.sqr()).cmp(_)>=0&&(o=t,a=r),i.negative&&(i=i.neg(),s=s.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:i,b:s},{a:o,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],n=i.b.mul(e).divRound(this.n),s=r.b.neg().mul(e).divRound(this.n),o=n.mul(r.a),a=s.mul(i.a),c=n.mul(r.b),u=s.mul(i.b);return{k1:e.sub(o).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,s=0;s<e.length;s++){var o=this._endoSplit(t[s]),a=e[s],c=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),c=c.neg(!0)),i[2*s]=a,i[2*s+1]=c,n[2*s]=o.k1,n[2*s+1]=o.k2}for(var u=this._wnafMulAdd(1,i,n,2*s,r),l=0;l<2*s;l++)i[l]=null,n[l]=null;return u},s(u,o.BasePoint),c.prototype.point=function(e,t,r){return new u(this,e,t,r)},c.prototype.pointFromJSON=function(e,t){return u.fromJSON(this,e,t)},u.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,i=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},u.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},u.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var i=e.point(t[0],t[1],r);if(!t[2])return i;function n(t){return e.point(t[0],t[1],r)}var s=t[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(n))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(n))}},i},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),s=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new n(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},u.prototype.jmulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(l,o.BasePoint),c.prototype.jpoint=function(e,t,r){return new l(this,e,t,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),n=e.x.redMul(r),s=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),a=i.redSub(n),c=s.redSub(o);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),d=i.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(s.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(f,h,p)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),n=this.y,s=e.y.redMul(t).redMul(this.z),o=r.redSub(i),a=n.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=o.redSqr(),u=c.redMul(o),l=r.redMul(c),d=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(d)).redISub(n.redMul(u)),h=this.z.redMul(o);return this.curve.jpoint(d,f,h)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,s=this.x,o=this.y,a=this.z,c=a.redSqr().redSqr(),u=o.redAdd(o);for(t=0;t<e;t++){var l=s.redSqr(),d=u.redSqr(),f=d.redSqr(),h=l.redAdd(l).redIAdd(l).redIAdd(i.redMul(c)),p=s.redMul(d),g=h.redSqr().redISub(p.redAdd(p)),y=p.redISub(g),m=h.redMul(y);m=m.redIAdd(m).redISub(f);var b=u.redMul(a);t+1<e&&(c=c.redMul(f)),s=g,a=b,u=m}return this.curve.jpoint(s,u.redMul(n),a)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i),c=a.redSqr().redISub(o).redISub(o),u=s.redIAdd(s);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=a.redMul(o.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),f=d.redSqr(),h=this.x.redAdd(d).redSqr().redISub(l).redISub(f);h=h.redIAdd(h);var p=l.redAdd(l).redIAdd(l),g=p.redSqr(),y=f.redIAdd(f);y=(y=y.redIAdd(y)).redIAdd(y),e=g.redISub(h).redISub(h),t=p.redMul(h.redISub(e)).redISub(y),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},l.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),c=a.redSqr().redISub(o).redISub(o);e=c;var u=s.redIAdd(s);u=(u=u.redIAdd(u)).redIAdd(u),t=a.redMul(o.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),f=this.x.redMul(d),h=this.x.redSub(l).redMul(this.x.redAdd(l));h=h.redAdd(h).redIAdd(h);var p=f.redIAdd(f),g=(p=p.redIAdd(p)).redAdd(p);e=h.redSqr().redISub(g),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var y=d.redSqr();y=(y=(y=y.redIAdd(y)).redIAdd(y)).redIAdd(y),t=h.redMul(p.redISub(e)).redISub(y)}return this.curve.jpoint(e,t,r)},l.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),s=t.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(n)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(o),l=a.redSqr().redISub(u.redAdd(u)),d=u.redISub(l),f=o.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=a.redMul(d).redISub(f),p=r.redAdd(r).redMul(i);return this.curve.jpoint(l,h,p)},l.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),i=t.redSqr(),n=e.redAdd(e).redIAdd(e),s=n.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(i),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),c=i.redIAdd(i);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=n.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(a).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var f=this.y.redMul(u.redMul(c.redISub(u)).redISub(o.redMul(a)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(d,f,h)},l.prototype.mul=function(e,t){return e=new n(e,t),this.curve._wnafMul(this,e)},l.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var i=t.redMul(this.z),n=r.redMul(e.z);return 0===this.y.redMul(n).redISub(e.y.redMul(i)).cmpn(0)},l.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var i=e.clone(),n=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":"959xT","bn.js":"c8Lvi",inherits:"j5plK","./base":"joYZE"}],j5plK:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},{}],exiKb:[function(e,t,r){"use strict";var i=e("bn.js"),n=e("inherits"),s=e("./base"),o=e("../utils");function a(e){s.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,r){s.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(a,s),t.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),i=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===i.redSqrt().redSqr().cmp(i)},n(c,s.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(o.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),i=e.redMul(t),n=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=e.x.redAdd(e.z),s=e.x.redSub(e.z).redMul(r),o=n.redMul(i),a=t.z.redMul(s.redAdd(o).redSqr()),c=t.x.redMul(s.redISub(o).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),r=this,i=this.curve.point(null,null),n=[];0!==t.cmpn(0);t.iushrn(1))n.push(t.andln(1));for(var s=n.length-1;s>=0;s--)0===n[s]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"bn.js":"c8Lvi",inherits:"j5plK","./base":"joYZE","../utils":"959xT"}],d2B4t:[function(e,t,r){"use strict";var i=e("../utils"),n=e("bn.js"),s=e("inherits"),o=e("./base"),a=i.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,o.call(this,"edwards",e),this.a=new n(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function u(e,t,r,i,s){o.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(t,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=s&&new n(s,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(c,o),t.exports=c,c.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},c.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},c.prototype.jpoint=function(e,t,r,i){return this.point(e,t,r,i)},c.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=this.c2.redSub(this.a.redMul(r)),s=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var c=a.fromRed().isOdd();return(t&&!c||!t&&c)&&(a=a.redNeg()),this.point(e,a)},c.prototype.pointFromY=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=r.redSub(this.c2),s=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},c.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),i=t.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===i.cmp(n)},s(u,o.BasePoint),c.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},c.prototype.point=function(e,t,r,i){return new u(this,e,t,r,i)},u.fromJSON=function(e,t){return new u(e,t[0],t[1],t[2])},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),s=i.redAdd(t),o=s.redSub(r),a=i.redSub(t),c=n.redMul(o),u=s.redMul(a),l=n.redMul(a),d=o.redMul(s);return this.curve.point(c,u,d,l)},u.prototype._projDbl=function(){var e,t,r,i,n,s,o=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(i=this.curve._mulA(a)).redAdd(c);this.zOne?(e=o.redSub(a).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(i.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(n=this.z.redSqr(),s=u.redSub(n).redISub(n),e=o.redSub(a).redISub(c).redMul(s),t=u.redMul(i.redSub(c)),r=u.redMul(s))}else i=a.redAdd(c),n=this.curve._mulC(this.z).redSqr(),s=i.redSub(n).redSub(n),e=this.curve._mulC(o.redISub(i)).redMul(s),t=this.curve._mulC(i).redMul(a.redISub(c)),r=i.redMul(s);return this.curve.point(e,t,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),s=r.redSub(t),o=n.redSub(i),a=n.redAdd(i),c=r.redAdd(t),u=s.redMul(o),l=a.redMul(c),d=s.redMul(c),f=o.redMul(a);return this.curve.point(u,l,f,d)},u.prototype._projAdd=function(e){var t,r,i=this.z.redMul(e.z),n=i.redSqr(),s=this.x.redMul(e.x),o=this.y.redMul(e.y),a=this.curve.d.redMul(s).redMul(o),c=n.redSub(a),u=n.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(s).redISub(o),d=i.redMul(c).redMul(l);return this.curve.twisted?(t=i.redMul(u).redMul(o.redSub(this.curve._mulA(s))),r=c.redMul(u)):(t=i.redMul(u).redMul(o.redSub(s)),r=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,r)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},u.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},{"../utils":"959xT","bn.js":"c8Lvi",inherits:"j5plK","./base":"joYZE"}],"4unkA":[function(e,t,r){"use strict";var i,n=r,s=e("hash.js"),o=e("./curve"),a=e("./utils").assert;function c(e){"short"===e.type?this.curve=new o.short(e):"edwards"===e.type?this.curve=new o.edwards(e):this.curve=new o.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new c(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:s.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:s.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:s.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:s.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:s.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=e("./precomputed/secp256k1")}catch(e){i=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:s.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},{"hash.js":"8UgFw","./curve":"byDyH","./utils":"959xT","./precomputed/secp256k1":"0oQdV"}],"8UgFw":[function(e,t,r){var i=r;i.utils=e("./hash/utils"),i.common=e("./hash/common"),i.sha=e("./hash/sha"),i.ripemd=e("./hash/ripemd"),i.hmac=e("./hash/hmac"),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},{"./hash/utils":"fs59i","./hash/common":"bUDg4","./hash/sha":"allnM","./hash/ripemd":"11wsf","./hash/hmac":"7ZuTN"}],fs59i:[function(e,t,r){"use strict";var i=e("minimalistic-assert"),n=e("inherits");function s(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}r.inherits=n,r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var i=0,n=0;n<e.length;n++){var o=e.charCodeAt(n);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=63&o|128):s(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},r.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=a(e[r].toString(16));return t},r.htonl=o,r.toHex32=function(e,t){for(var r="",i=0;i<e.length;i++){var n=e[i];"little"===t&&(n=o(n)),r+=c(n.toString(16))}return r},r.zero2=a,r.zero8=c,r.join32=function(e,t,r,n){var s=r-t;i(s%4==0);for(var o=new Array(s/4),a=0,c=t;a<o.length;a++,c+=4){var u;u="big"===n?e[c]<<24|e[c+1]<<16|e[c+2]<<8|e[c+3]:e[c+3]<<24|e[c+2]<<16|e[c+1]<<8|e[c],o[a]=u>>>0}return o},r.split32=function(e,t){for(var r=new Array(4*e.length),i=0,n=0;i<e.length;i++,n+=4){var s=e[i];"big"===t?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=255&s):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=255&s)}return r},r.rotr32=function(e,t){return e>>>t|e<<32-t},r.rotl32=function(e,t){return e<<t|e>>>32-t},r.sum32=function(e,t){return e+t>>>0},r.sum32_3=function(e,t,r){return e+t+r>>>0},r.sum32_4=function(e,t,r,i){return e+t+r+i>>>0},r.sum32_5=function(e,t,r,i,n){return e+t+r+i+n>>>0},r.sum64=function(e,t,r,i){var n=e[t],s=i+e[t+1]>>>0,o=(s<i?1:0)+r+n;e[t]=o>>>0,e[t+1]=s},r.sum64_hi=function(e,t,r,i){return(t+i>>>0<t?1:0)+e+r>>>0},r.sum64_lo=function(e,t,r,i){return t+i>>>0},r.sum64_4_hi=function(e,t,r,i,n,s,o,a){var c=0,u=t;return c+=(u=u+i>>>0)<t?1:0,c+=(u=u+s>>>0)<s?1:0,e+r+n+o+(c+=(u=u+a>>>0)<a?1:0)>>>0},r.sum64_4_lo=function(e,t,r,i,n,s,o,a){return t+i+s+a>>>0},r.sum64_5_hi=function(e,t,r,i,n,s,o,a,c,u){var l=0,d=t;return l+=(d=d+i>>>0)<t?1:0,l+=(d=d+s>>>0)<s?1:0,l+=(d=d+a>>>0)<a?1:0,e+r+n+o+c+(l+=(d=d+u>>>0)<u?1:0)>>>0},r.sum64_5_lo=function(e,t,r,i,n,s,o,a,c,u){return t+i+s+a+u>>>0},r.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},r.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},r.shr64_hi=function(e,t,r){return e>>>r},r.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},{"minimalistic-assert":"1GrVu",inherits:"j5plK"}],bUDg4:[function(e,t,r){"use strict";var i=e("./utils"),n=e("minimalistic-assert");function s(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}r.BlockHash=s,s.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},s.prototype.digest=function(e){return this.update(this._pad()),n(null===this.pending),this._digest(e)},s.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(e<<=3,"big"===this.endian){for(var s=8;s<this.padLength;s++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=e>>>24&255,i[n++]=e>>>16&255,i[n++]=e>>>8&255,i[n++]=255&e}else for(i[n++]=255&e,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,s=8;s<this.padLength;s++)i[n++]=0;return i}},{"./utils":"fs59i","minimalistic-assert":"1GrVu"}],allnM:[function(e,t,r){"use strict";r.sha1=e("./sha/1"),r.sha224=e("./sha/224"),r.sha256=e("./sha/256"),r.sha384=e("./sha/384"),r.sha512=e("./sha/512")},{"./sha/1":"kPRgf","./sha/224":"5p3po","./sha/256":"kwXkv","./sha/384":"lFtnI","./sha/512":"k4hdY"}],kPRgf:[function(e,t,r){"use strict";var i=e("../utils"),n=e("../common"),s=e("./common"),o=i.rotl32,a=i.sum32,c=i.sum32_5,u=s.ft_1,l=n.BlockHash,d=[1518500249,1859775393,2400959708,3395469782];function f(){if(!(this instanceof f))return new f;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(f,l),t.exports=f,f.blockSize=512,f.outSize=160,f.hmacStrength=80,f.padLength=64,f.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=o(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],s=this.h[1],l=this.h[2],f=this.h[3],h=this.h[4];for(i=0;i<r.length;i++){var p=~~(i/20),g=c(o(n,5),u(p,s,l,f),h,r[i],d[p]);h=f,f=l,l=o(s,30),s=n,n=g}this.h[0]=a(this.h[0],n),this.h[1]=a(this.h[1],s),this.h[2]=a(this.h[2],l),this.h[3]=a(this.h[3],f),this.h[4]=a(this.h[4],h)},f.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},{"../utils":"fs59i","../common":"bUDg4","./common":"cNSPF"}],cNSPF:[function(e,t,r){"use strict";var i=e("../utils").rotr32;function n(e,t,r){return e&t^~e&r}function s(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}r.ft_1=function(e,t,r,i){return 0===e?n(t,r,i):1===e||3===e?o(t,r,i):2===e?s(t,r,i):void 0},r.ch32=n,r.maj32=s,r.p32=o,r.s0_256=function(e){return i(e,2)^i(e,13)^i(e,22)},r.s1_256=function(e){return i(e,6)^i(e,11)^i(e,25)},r.g0_256=function(e){return i(e,7)^i(e,18)^e>>>3},r.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},{"../utils":"fs59i"}],"5p3po":[function(e,t,r){"use strict";var i=e("../utils"),n=e("./256");function s(){if(!(this instanceof s))return new s;n.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}i.inherits(s,n),t.exports=s,s.blockSize=512,s.outSize=224,s.hmacStrength=192,s.padLength=64,s.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},{"../utils":"fs59i","./256":"kwXkv"}],kwXkv:[function(e,t,r){"use strict";var i=e("../utils"),n=e("../common"),s=e("./common"),o=e("minimalistic-assert"),a=i.sum32,c=i.sum32_4,u=i.sum32_5,l=s.ch32,d=s.maj32,f=s.s0_256,h=s.s1_256,p=s.g0_256,g=s.g1_256,y=n.BlockHash,m=[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];function b(){if(!(this instanceof b))return new b;y.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=m,this.W=new Array(64)}i.inherits(b,y),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=c(g(r[i-2]),r[i-7],p(r[i-15]),r[i-16]);var n=this.h[0],s=this.h[1],y=this.h[2],m=this.h[3],b=this.h[4],v=this.h[5],w=this.h[6],_=this.h[7];for(o(this.k.length===r.length),i=0;i<r.length;i++){var E=u(_,h(b),l(b,v,w),this.k[i],r[i]),S=a(f(n),d(n,s,y));_=w,w=v,v=b,b=a(m,E),m=y,y=s,s=n,n=a(E,S)}this.h[0]=a(this.h[0],n),this.h[1]=a(this.h[1],s),this.h[2]=a(this.h[2],y),this.h[3]=a(this.h[3],m),this.h[4]=a(this.h[4],b),this.h[5]=a(this.h[5],v),this.h[6]=a(this.h[6],w),this.h[7]=a(this.h[7],_)},b.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},{"../utils":"fs59i","../common":"bUDg4","./common":"cNSPF","minimalistic-assert":"1GrVu"}],lFtnI:[function(e,t,r){"use strict";var i=e("../utils"),n=e("./512");function s(){if(!(this instanceof s))return new s;n.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}i.inherits(s,n),t.exports=s,s.blockSize=1024,s.outSize=384,s.hmacStrength=192,s.padLength=128,s.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},{"../utils":"fs59i","./512":"k4hdY"}],k4hdY:[function(e,t,r){"use strict";var i=e("../utils"),n=e("../common"),s=e("minimalistic-assert"),o=i.rotr64_hi,a=i.rotr64_lo,c=i.shr64_hi,u=i.shr64_lo,l=i.sum64,d=i.sum64_hi,f=i.sum64_lo,h=i.sum64_4_hi,p=i.sum64_4_lo,g=i.sum64_5_hi,y=i.sum64_5_lo,m=n.BlockHash,b=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;m.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=b,this.W=new Array(160)}function w(e,t,r,i,n){var s=e&r^~e&n;return s<0&&(s+=4294967296),s}function _(e,t,r,i,n,s){var o=t&i^~t&s;return o<0&&(o+=4294967296),o}function E(e,t,r,i,n){var s=e&r^e&n^r&n;return s<0&&(s+=4294967296),s}function S(e,t,r,i,n,s){var o=t&i^t&s^i&s;return o<0&&(o+=4294967296),o}function T(e,t){var r=o(e,t,28)^o(t,e,2)^o(t,e,7);return r<0&&(r+=4294967296),r}function A(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function k(e,t){var r=o(e,t,14)^o(e,t,18)^o(t,e,9);return r<0&&(r+=4294967296),r}function I(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function R(e,t){var r=o(e,t,1)^o(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function P(e,t){var r=a(e,t,1)^a(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function O(e,t){var r=o(e,t,19)^o(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}function C(e,t){var r=a(e,t,19)^a(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}i.inherits(v,m),t.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(e,t){for(var r=this.W,i=0;i<32;i++)r[i]=e[t+i];for(;i<r.length;i+=2){var n=O(r[i-4],r[i-3]),s=C(r[i-4],r[i-3]),o=r[i-14],a=r[i-13],c=R(r[i-30],r[i-29]),u=P(r[i-30],r[i-29]),l=r[i-32],d=r[i-31];r[i]=h(n,s,o,a,c,u,l,d),r[i+1]=p(n,s,o,a,c,u,l,d)}},v.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,i=this.h[0],n=this.h[1],o=this.h[2],a=this.h[3],c=this.h[4],u=this.h[5],h=this.h[6],p=this.h[7],m=this.h[8],b=this.h[9],v=this.h[10],R=this.h[11],P=this.h[12],O=this.h[13],C=this.h[14],j=this.h[15];s(this.k.length===r.length);for(var D=0;D<r.length;D+=2){var M=C,x=j,B=k(m,b),L=I(m,b),N=w(m,b,v,R,P),U=_(m,b,v,R,P,O),F=this.k[D],K=this.k[D+1],z=r[D],V=r[D+1],q=g(M,x,B,L,N,U,F,K,z,V),G=y(M,x,B,L,N,U,F,K,z,V);M=T(i,n),x=A(i,n),B=E(i,n,o,a,c),L=S(i,n,o,a,c,u);var H=d(M,x,B,L),$=f(M,x,B,L);C=P,j=O,P=v,O=R,v=m,R=b,m=d(h,p,q,G),b=f(p,p,q,G),h=c,p=u,c=o,u=a,o=i,a=n,i=d(q,G,H,$),n=f(q,G,H,$)}l(this.h,0,i,n),l(this.h,2,o,a),l(this.h,4,c,u),l(this.h,6,h,p),l(this.h,8,m,b),l(this.h,10,v,R),l(this.h,12,P,O),l(this.h,14,C,j)},v.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},{"../utils":"fs59i","../common":"bUDg4","minimalistic-assert":"1GrVu"}],"11wsf":[function(e,t,r){"use strict";var i=e("./utils"),n=e("./common"),s=i.rotl32,o=i.sum32,a=i.sum32_3,c=i.sum32_4,u=n.BlockHash;function l(){if(!(this instanceof l))return new l;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function d(e,t,r,i){return e<=15?t^r^i:e<=31?t&r|~t&i:e<=47?(t|~r)^i:e<=63?t&i|r&~i:t^(r|~i)}function f(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function h(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}i.inherits(l,u),r.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(e,t){for(var r=this.h[0],i=this.h[1],n=this.h[2],u=this.h[3],l=this.h[4],b=r,v=i,w=n,_=u,E=l,S=0;S<80;S++){var T=o(s(c(r,d(S,i,n,u),e[p[S]+t],f(S)),y[S]),l);r=l,l=u,u=s(n,10),n=i,i=T,T=o(s(c(b,d(79-S,v,w,_),e[g[S]+t],h(S)),m[S]),E),b=E,E=_,_=s(w,10),w=v,v=T}T=a(this.h[1],n,_),this.h[1]=a(this.h[2],u,E),this.h[2]=a(this.h[3],l,b),this.h[3]=a(this.h[4],r,v),this.h[4]=a(this.h[0],i,w),this.h[0]=T},l.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"little"):i.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],g=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],y=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],m=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"./utils":"fs59i","./common":"bUDg4"}],"7ZuTN":[function(e,t,r){"use strict";var i=e("./utils"),n=e("minimalistic-assert");function s(e,t,r){if(!(this instanceof s))return new s(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(t,r))}t.exports=s,s.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),n(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},s.prototype.update=function(e,t){return this.inner.update(e,t),this},s.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},{"./utils":"fs59i","minimalistic-assert":"1GrVu"}],"0oQdV":[function(e,t,r){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},{}],"5AnhI":[function(e,t,r){"use strict";var i=e("bn.js"),n=e("hmac-drbg"),s=e("../utils"),o=e("../curves"),a=e("brorand"),c=s.assert,u=e("./key"),l=e("./signature");function d(e){if(!(this instanceof d))return new d(e);"string"==typeof e&&(c(Object.prototype.hasOwnProperty.call(o,e),"Unknown curve "+e),e=o[e]),e instanceof o.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}t.exports=d,d.prototype.keyPair=function(e){return new u(this,e)},d.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},d.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},d.prototype.genKeyPair=function(e){e||(e={});for(var t=new n({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),s=this.n.sub(new i(2));;){var o=new i(t.generate(r));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}},d.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},d.prototype.sign=function(e,t,r,s){"object"==typeof r&&(s=r,r=null),s||(s={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new i(e,16));for(var o=this.n.byteLength(),a=t.getPrivate().toArray("be",o),c=e.toArray("be",o),u=new n({hash:this.hash,entropy:a,nonce:c,pers:s.pers,persEnc:s.persEnc||"utf8"}),d=this.n.sub(new i(1)),f=0;;f++){var h=s.k?s.k(f):new i(u.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(d)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var g=p.getX(),y=g.umod(this.n);if(0!==y.cmpn(0)){var m=h.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e));if(0!==(m=m.umod(this.n)).cmpn(0)){var b=(p.getY().isOdd()?1:0)|(0!==g.cmp(y)?2:0);return s.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),b^=1),new l({r:y,s:m,recoveryParam:b})}}}}}},d.prototype.verify=function(e,t,r,n){e=this._truncateToN(new i(e,16)),r=this.keyFromPublic(r,n);var s=(t=new l(t,"hex")).r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,c=o.invm(this.n),u=c.mul(e).umod(this.n),d=c.mul(s).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),d)).isInfinity()&&a.eqXToP(s):!(a=this.g.mulAdd(u,r.getPublic(),d)).isInfinity()&&0===a.getX().umod(this.n).cmp(s)},d.prototype.recoverPubKey=function(e,t,r,n){c((3&r)===r,"The recovery param is more than two bits"),t=new l(t,n);var s=this.n,o=new i(e),a=t.r,u=t.s,d=1&r,f=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");a=f?this.curve.pointFromX(a.add(this.curve.n),d):this.curve.pointFromX(a,d);var h=t.r.invm(s),p=s.sub(o).mul(h).umod(s),g=u.mul(h).umod(s);return this.g.mulAdd(p,a,g)},d.prototype.getKeyRecoveryParam=function(e,t,r,i){if(null!==(t=new l(t,i)).recoveryParam)return t.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(e,t,n)}catch(e){continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")}},{"bn.js":"c8Lvi","hmac-drbg":"iPkoP","../utils":"959xT","../curves":"4unkA",brorand:"P54o1","./key":"9sGQ9","./signature":"hmVaw"}],iPkoP:[function(e,t,r){"use strict";var i=e("hash.js"),n=e("minimalistic-crypto-utils"),s=e("minimalistic-assert");function o(e){if(!(this instanceof o))return new o(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=n.toArray(e.entropy,e.entropyEnc||"hex"),r=n.toArray(e.nonce,e.nonceEnc||"hex"),i=n.toArray(e.pers,e.persEnc||"hex");s(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,i)}t.exports=o,o.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},o.prototype._hmac=function(){return new i.hmac(this.hash,this.K)},o.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},o.prototype.reseed=function(e,t,r,i){"string"!=typeof t&&(i=r,r=t,t=null),e=n.toArray(e,t),r=n.toArray(r,i),s(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(i=r,r=t,t=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var o=s.slice(0,e);return this._update(r),this._reseed++,n.encode(o,t)}},{"hash.js":"8UgFw","minimalistic-crypto-utils":"3MGAl","minimalistic-assert":"1GrVu"}],"9sGQ9":[function(e,t,r){"use strict";var i=e("bn.js"),n=e("../utils").assert;function s(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}t.exports=s,s.fromPublic=function(e,t,r){return t instanceof s?t:new s(e,{pub:t,pubEnc:r})},s.fromPrivate=function(e,t,r){return t instanceof s?t:new s(e,{priv:t,privEnc:r})},s.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},s.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},s.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},s.prototype._importPrivate=function(e,t){this.priv=new i(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},s.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?n(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||n(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},s.prototype.derive=function(e){return e.validate()||n(e.validate(),"public point not validated"),e.mul(this.priv).getX()},s.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},s.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},s.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},{"bn.js":"c8Lvi","../utils":"959xT"}],hmVaw:[function(e,t,r){"use strict";var i=e("bn.js"),n=e("../utils"),s=n.assert;function o(e,t){if(e instanceof o)return e;this._importDER(e,t)||(s(e.r&&e.s,"Signature without r or s"),this.r=new i(e.r,16),this.s=new i(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,s=0,o=t.place;s<i;s++,o++)n<<=8,n|=e[o],n>>>=0;return!(n<=127)&&(t.place=o,n)}function u(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function l(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}t.exports=o,o.prototype._importDER=function(e,t){e=n.toArray(e,t);var r=new a;if(48!==e[r.place++])return!1;var s=c(e,r);if(!1===s)return!1;if(s+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=c(e,r);if(!1===o)return!1;var u=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var l=c(e,r);if(!1===l)return!1;if(e.length!==l+r.place)return!1;var d=e.slice(r.place,l+r.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===d[0]){if(!(128&d[1]))return!1;d=d.slice(1)}return this.r=new i(u),this.s=new i(d),this.recoveryParam=null,!0},o.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=u(t),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];l(i,t.length),(i=i.concat(t)).push(2),l(i,r.length);var s=i.concat(r),o=[48];return l(o,s.length),o=o.concat(s),n.encode(o,e)}},{"bn.js":"c8Lvi","../utils":"959xT"}],j2H5w:[function(e,t,r){"use strict";var i=e("hash.js"),n=e("../curves"),s=e("../utils"),o=s.assert,a=s.parseBytes,c=e("./key"),u=e("./signature");function l(e){if(o("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=n[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=i.sha512}t.exports=l,l.prototype.sign=function(e,t){e=a(e);var r=this.keyFromSecret(t),i=this.hashInt(r.messagePrefix(),e),n=this.g.mul(i),s=this.encodePoint(n),o=this.hashInt(s,r.pubBytes(),e).mul(r.priv()),c=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:c,Rencoded:s})},l.prototype.verify=function(e,t,r){e=a(e),t=this.makeSignature(t);var i=this.keyFromPublic(r),n=this.hashInt(t.Rencoded(),i.pubBytes(),e),s=this.g.mul(t.S());return t.R().add(i.pub().mul(n)).eq(s)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return s.intFromLE(e.digest()).umod(this.curve.n)},l.prototype.keyFromPublic=function(e){return c.fromPublic(this,e)},l.prototype.keyFromSecret=function(e){return c.fromSecret(this,e)},l.prototype.makeSignature=function(e){return e instanceof u?e:new u(this,e)},l.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},l.prototype.decodePoint=function(e){var t=(e=s.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),i=0!=(128&e[t]),n=s.intFromLE(r);return this.curve.pointFromY(n,i)},l.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},l.prototype.decodeInt=function(e){return s.intFromLE(e)},l.prototype.isPoint=function(e){return e instanceof this.pointClass}},{"hash.js":"8UgFw","../curves":"4unkA","../utils":"959xT","./key":"8PrWd","./signature":"8yfJh"}],"8PrWd":[function(e,t,r){"use strict";var i=e("../utils"),n=i.assert,s=i.parseBytes,o=i.cachedProperty;function a(e,t){this.eddsa=e,this._secret=s(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=s(t.pub)}a.fromPublic=function(e,t){return t instanceof a?t:new a(e,{pub:t})},a.fromSecret=function(e,t){return t instanceof a?t:new a(e,{secret:t})},a.prototype.secret=function(){return this._secret},o(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),o(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),o(a,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,i=t.slice(0,e.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),o(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),o(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),o(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(e){return n(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},a.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},a.prototype.getSecret=function(e){return n(this._secret,"KeyPair is public only"),i.encode(this.secret(),e)},a.prototype.getPublic=function(e){return i.encode(this.pubBytes(),e)},t.exports=a},{"../utils":"959xT"}],"8yfJh":[function(e,t,r){"use strict";var i=e("bn.js"),n=e("../utils"),s=n.assert,o=n.cachedProperty,a=n.parseBytes;function c(e,t){this.eddsa=e,"object"!=typeof t&&(t=a(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),s(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof i&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}o(c,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),o(c,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),o(c,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),o(c,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),c.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},c.prototype.toHex=function(){return n.encode(this.toBytes(),"hex").toUpperCase()},t.exports=c},{"bn.js":"c8Lvi","../utils":"959xT"}],kdBuU:[function(e,t,r){"use strict";const i=e("err-code"),{concat:n}=e("uint8arrays/concat"),{fromString:s}=e("uint8arrays/from-string"),o=e("../hmac"),a={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};t.exports=async(e,t,r)=>{const c=a[e];if(!c){const t=Object.keys(a).join(" / ");throw i(new Error(`unknown cipher type '${e}'. Must be ${t}`),"ERR_INVALID_CIPHER_TYPE")}if(!t)throw i(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");const u=c.keySize,l=c.ivSize,d=s("key expansion"),f=2*(l+u+20),h=await o.create(t,r);let p=await h.digest(d);const g=[];let y=0;for(;y<f;){const e=await h.digest(n([p,d]));let t=e.length;y+t>f&&(t=f-y),g.push(e),y+=t,p=await h.digest(p)}const m=f/2,b=n(g),v=b.slice(0,m),w=b.slice(m,f),_=e=>({iv:e.slice(0,l),cipherKey:e.slice(l,l+u),macKey:e.slice(l+u)});return{k1:_(v),k2:_(w)}}},{"err-code":"chZjB","uint8arrays/concat":"4EBjG","uint8arrays/from-string":"dF7Y4","../hmac":"JUsR3"}],JUsR3:[function(e,t,r){"use strict";const i=e("../webcrypto"),n=e("./lengths"),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"};r.create=async function(e,t){const r=s[e],o=await i.get().subtle.importKey("raw",t,{name:"HMAC",hash:{name:r}},!1,["sign"]);return{digest:async e=>(async(e,t)=>{const r=await i.get().subtle.sign({name:"HMAC"},e,t);return new Uint8Array(r,r.byteOffset,r.byteLength)})(o,e),length:n[e]}}},{"../webcrypto":"i99ng","./lengths":"8g8ed"}],"8g8ed":[function(e,t,r){"use strict";t.exports={SHA1:20,SHA256:32,SHA512:64}},{}],ds3K5:[function(e,t,r){"use strict";const i=e("./ecdh");t.exports=async e=>i.generateEphmeralKeyPair(e)},{"./ecdh":"bSsHl"}],bSsHl:[function(e,t,r){"use strict";const i=e("err-code"),n=e("../webcrypto"),{base64urlToBuffer:s}=e("../util"),o=e("./validate-curve-type"),{toString:a}=e("uint8arrays/to-string"),{concat:c}=e("uint8arrays/concat"),{equals:u}=e("uint8arrays/equals"),l={"P-256":256,"P-384":384,"P-521":521};r.generateEphmeralKeyPair=async function(e){o(Object.keys(l),e);const t=await n.get().subtle.generateKey({name:"ECDH",namedCurve:e},!0,["deriveBits"]);return{key:f(await n.get().subtle.exportKey("jwk",t.publicKey)),genSharedKey:async(r,i)=>{let s;s=i?await n.get().subtle.importKey("jwk",p(e,i),{name:"ECDH",namedCurve:e},!1,["deriveBits"]):t.privateKey;const o=[await n.get().subtle.importKey("jwk",h(e,r),{name:"ECDH",namedCurve:e},!1,[]),s],a=await n.get().subtle.deriveBits({name:"ECDH",namedCurve:e,public:o[0]},o[1],l[e]);return new Uint8Array(a,a.byteOffset,a.byteLength)}}};const d={"P-256":32,"P-384":48,"P-521":66};function f(e){const t=d[e.crv];return c([Uint8Array.from([4]),s(e.x,t),s(e.y,t)],1+2*t)}function h(e,t){const r=d[e];if(u(!t.slice(0,1),Uint8Array.from([4])))throw i(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:e,x:a(t.slice(1,r+1),"base64url"),y:a(t.slice(1+r),"base64url"),ext:!0}}const p=(e,t)=>({...h(e,t.public),d:a(t.private,"base64url")})},{"err-code":"chZjB","../webcrypto":"i99ng","../util":"ffmp6","./validate-curve-type":"8CFUR","uint8arrays/to-string":"hC8JB","uint8arrays/concat":"4EBjG","uint8arrays/equals":"eY3cX"}],"8CFUR":[function(e,t,r){"use strict";const i=e("err-code");t.exports=function(e,t){if(!e.includes(t)){const r=e.join(" / ");throw i(new Error(`Unknown curve: ${t}. Must be ${r}`),"ERR_INVALID_CURVE")}}},{"err-code":"chZjB"}],gx31A:[function(e,t,r){"use strict";t.exports=function(e,{className:t,symbolName:r}){const i=Symbol.for(r),n={[t]:class extends e{constructor(...e){super(...e),Object.defineProperty(this,i,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return n[`is${t}`]=e=>!(!e||!e[i]),n},t.exports.proto=function(e,{className:t,symbolName:r,withoutNew:i}){const n=Symbol.for(r),s={[t]:function(...t){if(i&&!(this instanceof s))return new s(...t);const r=e.call(this,...t)||this;return r&&!r[n]&&Object.defineProperty(r,n,{value:!0}),r}}[t];return s.prototype=Object.create(e.prototype),s.prototype.constructor=s,Object.defineProperty(s.prototype,Symbol.toStringTag,{get:()=>t}),s[`is${t}`]=e=>!(!e||!e[n]),s}},{}],c0IJt:[function(e,t,r){"use strict";var i=e("protobufjs/minimal"),n=i.Reader,s=i.Writer,o=i.util,a=i.roots["libp2p-peer-id"]||(i.roots["libp2p-peer-id"]={});a.PeerIdProto=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.id=o.newBuffer([]),e.prototype.pubKey=o.newBuffer([]),e.prototype.privKey=o.newBuffer([]),e.encode=function(e,t){return t||(t=s.create()),t.uint32(10).bytes(e.id),null!=e.pubKey&&Object.hasOwnProperty.call(e,"pubKey")&&t.uint32(18).bytes(e.pubKey),null!=e.privKey&&Object.hasOwnProperty.call(e,"privKey")&&t.uint32(26).bytes(e.privKey),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.PeerIdProto;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.id=e.bytes();break;case 2:i.pubKey=e.bytes();break;case 3:i.privKey=e.bytes();break;default:e.skipType(7&s)}}if(!i.hasOwnProperty("id"))throw o.ProtocolError("missing required 'id'",{instance:i});return i},e.fromObject=function(e){if(e instanceof a.PeerIdProto)return e;var t=new a.PeerIdProto;return null!=e.id&&("string"==typeof e.id?o.base64.decode(e.id,t.id=o.newBuffer(o.base64.length(e.id)),0):e.id.length&&(t.id=e.id)),null!=e.pubKey&&("string"==typeof e.pubKey?o.base64.decode(e.pubKey,t.pubKey=o.newBuffer(o.base64.length(e.pubKey)),0):e.pubKey.length&&(t.pubKey=e.pubKey)),null!=e.privKey&&("string"==typeof e.privKey?o.base64.decode(e.privKey,t.privKey=o.newBuffer(o.base64.length(e.privKey)),0):e.privKey.length&&(t.privKey=e.privKey)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.id="":(r.id=[],t.bytes!==Array&&(r.id=o.newBuffer(r.id))),t.bytes===String?r.pubKey="":(r.pubKey=[],t.bytes!==Array&&(r.pubKey=o.newBuffer(r.pubKey))),t.bytes===String?r.privKey="":(r.privKey=[],t.bytes!==Array&&(r.privKey=o.newBuffer(r.privKey)))),null!=e.id&&e.hasOwnProperty("id")&&(r.id=t.bytes===String?o.base64.encode(e.id,0,e.id.length):t.bytes===Array?Array.prototype.slice.call(e.id):e.id),null!=e.pubKey&&e.hasOwnProperty("pubKey")&&(r.pubKey=t.bytes===String?o.base64.encode(e.pubKey,0,e.pubKey.length):t.bytes===Array?Array.prototype.slice.call(e.pubKey):e.pubKey),null!=e.privKey&&e.hasOwnProperty("privKey")&&(r.privKey=t.bytes===String?o.base64.encode(e.privKey,0,e.privKey.length):t.bytes===Array?Array.prototype.slice.call(e.privKey):e.privKey),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),t.exports=a},{"protobufjs/minimal":"grAXL"}],hDUM1:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./add.js"),n=e("./add-all.js"),s=e("./ls.js"),o=e("./rm.js"),a=e("./rm-all.js");r.PinAPI=class{constructor({codecs:e,repo:t}){const r=n.createAddAll({codecs:e,repo:t});this.addAll=r,this.add=i.createAdd({addAll:r});const c=a.createRmAll({codecs:e,repo:t});this.rmAll=c,this.rm=o.createRm({rmAll:c}),this.ls=s.createLs({codecs:e,repo:t}),this.remote={add:(e,t={})=>Promise.reject(new Error("Not implemented")),ls:async function*(e,t={}){return Promise.reject(new Error("Not implemented"))},rm:(e,t={})=>Promise.reject(new Error("Not implemented")),rmAll:(e,t={})=>Promise.reject(new Error("Not implemented")),service:{add:(e,t)=>Promise.reject(new Error("Not implemented")),rm:(e,t={})=>Promise.reject(new Error("Not implemented")),ls:(e={})=>Promise.reject(new Error("Not implemented"))}}}}},{"./add.js":"lM2k0","./add-all.js":"5qgaX","./ls.js":"hVzUN","./rm.js":"khHqn","./rm-all.js":"5GWqa"}],lM2k0:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("it-last"),n=e("multiformats/cid");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(i);r.createAdd=function({addAll:e}){return(t,r={})=>{let i;const s=n.CID.asCID(t);return i=e(s?[{cid:s,...r}]:[{path:t.toString(),...r}],r),o.default(i)}}},{"it-last":"cSXX9","multiformats/cid":"9ooAY"}],cSXX9:[function(e,t,r){"use strict";t.exports=async e=>{let t;for await(const r of e)t=r;return t}},{}],"5qgaX":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../utils.js"),n=e("ipfs-core-utils/with-timeout-option"),s=e("ipfs-core-utils/pins/normalise-input"),o=e("ipfs-repo/pin-types");r.createAddAll=function({repo:e,codecs:t}){return n.withTimeoutOption((async function*(r,n={}){const a=async function*(){for await(const{path:n,recursive:a,metadata:c}of s.normaliseInput(r)){const{cid:r}=await i.resolvePath(e,t,n),{reason:s}=await e.pins.isPinnedWithType(r,[o.PinTypes.recursive,o.PinTypes.direct]);if("recursive"===s&&!a)throw new Error(`${r} already pinned recursively`);a?await e.pins.pinRecursively(r,{metadata:c}):await e.pins.pinDirectly(r,{metadata:c}),yield r}};if(!Boolean(n.lock))return void(yield*a());const c=await e.gcLock.readLock();try{yield*a()}finally{c()}}))}},{"../../utils.js":"cT4uN","ipfs-core-utils/with-timeout-option":"j29MK","ipfs-core-utils/pins/normalise-input":"4NDJq","ipfs-repo/pin-types":"uek22"}],"4NDJq":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("err-code"),n=e("multiformats/cid");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(i);function a(e){const t=e.cid||`${e.path}`;if(!t)throw o.default(new Error("Unexpected input: Please path either a CID or an IPFS path"),"ERR_UNEXPECTED_INPUT");const r={path:t,recursive:!1!==e.recursive};return null!=e.metadata&&(r.metadata=e.metadata),r}r.normaliseInput=async function*(e){if(null==e)throw o.default(new Error(`Unexpected input: ${e}`),"ERR_UNEXPECTED_INPUT");const t=n.CID.asCID(e);if(t)yield a({cid:t});else{if(!(e instanceof String||"string"==typeof e)){if(null!=e.cid||null!=e.path)return yield a(e);if(Symbol.iterator in e){const t=e[Symbol.iterator](),r=t.next();if(r.done)return t;if(n.CID.asCID(r.value)||r.value instanceof String||"string"==typeof r.value){yield a({cid:r.value});for(const e of t)yield a({cid:e});return}if(null!=r.value.cid||null!=r.value.path){yield a(r.value);for(const e of t)yield a(e);return}throw o.default(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT")}if(Symbol.asyncIterator in e){const t=e[Symbol.asyncIterator](),r=await t.next();if(r.done)return t;if(n.CID.asCID(r.value)||r.value instanceof String||"string"==typeof r.value){yield a({cid:r.value});for await(const e of t)yield a({cid:e});return}if(null!=r.value.cid||null!=r.value.path){yield a(r.value);for await(const e of t)yield a(e);return}throw o.default(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT")}throw o.default(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT")}yield a({path:e})}}},{"err-code":"chZjB","multiformats/cid":"9ooAY"}],uek22:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PinTypes={direct:"direct",recursive:"recursive",indirect:"indirect",all:"all"}},{}],hVzUN:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/pins/normalise-input"),n=e("../../utils.js"),s=e("ipfs-core-utils/with-timeout-option"),o=e("err-code"),a=e("ipfs-repo/pin-types");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(o);function l(e,t,r){const i={type:e,cid:t};return r&&(i.metadata=r),i}r.createLs=function({repo:e,codecs:t}){return s.withTimeoutOption((async function*(r={}){let s=a.PinTypes.all;if(r.type&&(s=r.type,!Object.keys(a.PinTypes).includes(s)))throw u.default(new Error("Invalid pin type"),"ERR_INVALID_PIN_TYPE");if(r.paths){let o=!1;for await(const{path:c}of i.normaliseInput(r.paths)){const{cid:r}=await n.resolvePath(e,t,c),{reason:i,pinned:d,parent:f,metadata:h}=await e.pins.isPinnedWithType(r,s);if(!d)throw u.default(new Error(`path '${c}' is not pinned`),"ERR_NOT_PINNED");switch(i){case a.PinTypes.direct:case a.PinTypes.recursive:o=!0,yield l(i,r,h);break;default:o=!0,yield l(`${a.PinTypes.indirect} through ${f}`,r,h)}}if(!o)throw new Error("No match found")}else{if(s===a.PinTypes.recursive||s===a.PinTypes.all)for await(const{cid:t,metadata:r}of e.pins.recursiveKeys())yield l(a.PinTypes.recursive,t,r);if(s===a.PinTypes.indirect||s===a.PinTypes.all)for await(const t of e.pins.indirectKeys(r))yield l(a.PinTypes.indirect,t);if(s===a.PinTypes.direct||s===a.PinTypes.all)for await(const{cid:t,metadata:r}of e.pins.directKeys())yield l(a.PinTypes.direct,t,r)}}))}},{"ipfs-core-utils/pins/normalise-input":"4NDJq","../../utils.js":"cT4uN","ipfs-core-utils/with-timeout-option":"j29MK","err-code":"chZjB","ipfs-repo/pin-types":"uek22"}],khHqn:[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("it-last"));r.createRm=function({rmAll:e}){return async function(t,r={}){const i=await n.default(e([{path:t,...r}],r));if(!i)throw new Error("CID expected");return i}}},{"it-last":"cSXX9"}],"5GWqa":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/pins/normalise-input"),n=e("../../utils.js"),s=e("ipfs-core-utils/with-timeout-option"),o=e("ipfs-repo/pin-types");r.createRmAll=function({repo:e,codecs:t}){return s.withTimeoutOption((async function*(r,s={}){const a=await e.gcLock.readLock();try{for await(const{path:s,recursive:a}of i.normaliseInput(r)){const{cid:r}=await n.resolvePath(e,t,s),{pinned:i,reason:c}=await e.pins.isPinnedWithType(r,o.PinTypes.all);if(!i)throw new Error(`${r} is not pinned`);switch(c){case o.PinTypes.recursive:if(!a)throw new Error(`${r} is pinned recursively`);await e.pins.unpin(r),yield r;break;case o.PinTypes.direct:await e.pins.unpin(r),yield r;break;default:throw new Error(`${r} is pinned indirectly under ${c}`)}}}finally{a()}}))}},{"ipfs-core-utils/pins/normalise-input":"4NDJq","../../utils.js":"cT4uN","ipfs-core-utils/with-timeout-option":"j29MK","ipfs-repo/pin-types":"uek22"}],fTgTV:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../ipns/index.js"),n=e("../ipns/routing/config.js"),s=e("../ipns/routing/offline-datastore.js"),o=e("../errors.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const c=a(e("debug")).default("ipfs:components:ipns");r.IPNSAPI=class{constructor(e={pass:""}){this.options=e,this.offline=null,this.online=null}getIPNS(){const e=this.online||this.offline;if(e)return e;throw new o.NotInitializedError}get routing(){return this.getIPNS().routing}startOffline({repo:e,peerId:t,keychain:r}){if(null!=this.offline)throw new o.AlreadyInitializedError;c("initializing IPNS keyspace");const n=new s.OfflineDatastore(e),a=new i.IPNS(n,e.datastore,t,r,this.options);this.offline=a}async startOnline({libp2p:e,repo:t,peerId:r,keychain:s}){if(null!=this.online)throw new o.AlreadyInitializedError;const a=n.createRouting({libp2p:e,repo:t,peerId:r,options:this.options}),c=new i.IPNS(a,t.datastore,r,s,this.options);await c.republisher.start(),this.online=c}async stop(){const e=this.online;e&&(await e.republisher.stop(),this.online=null)}publish(e,t,r){return this.getIPNS().publish(e,t,r)}resolve(e,t){return this.getIPNS().resolve(e,t)}initializeKeyspace(e,t){return this.getIPNS().initializeKeyspace(e,t)}}},{"../ipns/index.js":"KNAGK","../ipns/routing/config.js":"bU4x4","../ipns/routing/offline-datastore.js":"a4pYc","../errors.js":"j69o8",debug:"bO5wM"}],KNAGK:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("peer-id"),n=e("err-code"),s=e("debug"),o=e("./publisher.js"),a=e("./republisher.js"),c=e("./resolver.js"),u=e("../utils/tlru.js"),l=e("uint8arrays/to-string");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=d(n),h=d(s);const p=Object.assign(h.default("ipfs:ipns"),{error:h.default("ipfs:ipns:error")});r.IPNS=class{constructor(e,t,r,i,n){this.publisher=new o.IpnsPublisher(e,t),this.republisher=new a.IpnsRepublisher(this.publisher,t,r,i,n),this.resolver=new c.IpnsResolver(e),this.cache=new u.TLRU(1e3),this.routing=e}async publish(e,t,r=o.IpnsPublisher.defaultRecordLifetime){try{const n=await i.createFromPrivKey(e.bytes);await this.publisher.publishWithEOL(e,t,r),p(`IPNS value ${l.toString(t,"base32")} was published correctly`);const s=n.toB58String(),o=parseFloat(r),a=o<6e4?o:6e4;return this.cache.set(s,t,a),p(`IPNS value ${l.toString(t,"base32")} was cached correctly`),{name:s,value:t}}catch(e){throw p.error(e),e}}async resolve(e,t={}){if("string"!=typeof e)throw f.default(new Error("name received is not valid"),"ERR_INVALID_NAME");if(!t.nocache&&!t.recursive){const t=e.split("/")[2],r=this.cache.get(t);if(r)return r}try{const r=await this.resolver.resolve(e,t);return p(`IPNS record from ${e} was resolved correctly`),r}catch(e){throw p.error(e),e}}async initializeKeyspace(e,t){return this.publish(e,t,o.IpnsPublisher.defaultRecordLifetime)}}},{"peer-id":"8Bdb3","err-code":"chZjB",debug:"bO5wM","./publisher.js":"5jkXx","./republisher.js":"hoedq","./resolver.js":"gifOE","../utils/tlru.js":"lQE1u","uint8arrays/to-string":"hC8JB"}],"5jkXx":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("peer-id"),n=e("interface-datastore/key"),s=e("datastore-core/errors"),o=e("err-code"),a=e("debug"),c=e("uint8arrays/to-string"),u=e("uint8arrays/equals"),l=e("ipns");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function f(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var h=d(i),p=d(o),g=d(a),y=f(l);const m=Object.assign(g.default("ipfs:ipns:publisher"),{error:g.default("ipfs:ipns:publisher:error")}),b=s.notFoundError().code,v=36e5;class w{constructor(e,t){this._routing=e,this._datastore=t}async publishWithEOL(e,t,r){if(!e||!e.bytes)throw p.default(new Error("invalid private key"),"ERR_INVALID_PRIVATE_KEY");const i=await h.default.createFromPrivKey(e.bytes),n=await this._updateOrCreateRecord(e,t,r,i);return this._putRecordToRouting(n,i)}publish(e,t){return this.publishWithEOL(e,t,v)}async _putRecordToRouting(e,t){if(!h.default.isPeerId(t)){const e="peerId received is not valid";throw m.error(e),p.default(new Error(e),"ERR_INVALID_PEER_ID")}const r=t._pubKey,i=await y.embedPublicKey(r,e),n=y.getIdKeys(t.toBytes());return await this._publishEntry(n.routingKey,i||e),await this._publishPublicKey(n.routingPubKey,r),i||e}async _publishEntry(e,t){const r=n.Key.asKey(e);if(!r){const e="datastore key does not have a valid format";throw m.error(e),p.default(new Error(e),"ERR_INVALID_DATASTORE_KEY")}let i;try{i=y.marshal(t)}catch(e){throw m.error(e),e}try{const e=await this._routing.put(r.uint8Array(),i);return m(`ipns record for ${c.toString(r.uint8Array(),"base64")} was stored in the routing`),e}catch(e){const t=`ipns record for ${c.toString(r.uint8Array(),"base64")} could not be stored in the routing`;throw m.error(t),m.error(e),p.default(new Error(t),"ERR_PUTTING_TO_ROUTING")}}async _publishPublicKey(e,t){const r=n.Key.asKey(e);if(!r){const e="datastore key does not have a valid format";throw m.error(e),p.default(new Error(e),"ERR_INVALID_DATASTORE_KEY")}if(!t||!t.bytes){const e="one or more of the provided parameters are not defined";throw m.error(e),p.default(new Error(e),"ERR_UNDEFINED_PARAMETER")}try{const e=await this._routing.put(r.uint8Array(),t.bytes);return m(`public key for ${c.toString(r.uint8Array(),"base64")} was stored in the routing`),e}catch(e){const t=`public key for ${c.toString(r.uint8Array(),"base64")} could not be stored in the routing`;throw m.error(t),m.error(e),p.default(new Error(t),"ERR_PUTTING_TO_ROUTING")}}async _getPublished(e,t={}){if(!h.default.isPeerId(e)){const e="peerId received is not valid";throw m.error(e),p.default(new Error(e),"ERR_INVALID_PEER_ID")}const r=!1!==t.checkRouting;try{const t=await this._datastore.get(y.getLocalKey(e.id));return this._unmarshalData(t)}catch(t){if(t.code!==b){const t=`unexpected error getting the ipns record ${e.id} from datastore`;throw m.error(t),p.default(new Error(t),"ERR_UNEXPECTED_DATASTORE_RESPONSE")}if(!r)throw p.default(t,"ERR_NOT_FOUND_AND_CHECK_ROUTING_NOT_ENABLED");try{const t=y.getIdKeys(e.toBytes()),r=await this._routing.get(t.routingKey.uint8Array());return this._unmarshalData(r)}catch(e){throw m.error(e),e}}}_unmarshalData(e){try{return y.unmarshal(e)}catch(e){throw p.default(e,"ERR_INVALID_RECORD_DATA")}}async _updateOrCreateRecord(e,t,r,i){if(!h.default.isPeerId(i)){const e="peerId received is not valid";throw m.error(e),p.default(new Error(e),"ERR_INVALID_PEER_ID")}const n={checkRouting:!0};let s;try{s=await this._getPublished(i,n)}catch(e){if(e.code!==b){const t=`unexpected error when determining the last published IPNS record for ${i.id} ${e.stack}`;throw m.error(t),p.default(new Error(t),"ERR_DETERMINING_PUBLISHED_RECORD")}}let o,a=0;s&&void 0!==s.sequence&&(a=u.equals(s.value,t)?BigInt(s.sequence):BigInt(s.sequence)+BigInt(1));try{o=await y.create(e,t,a,r)}catch(e){const r=`ipns record for ${t} could not be created`;throw m.error(e),p.default(new Error(r),"ERR_CREATING_IPNS_RECORD")}try{const e=y.marshal(o);return await this._datastore.put(y.getLocalKey(i.id),e),m(`ipns record for ${c.toString(t,"base32")} was stored in the datastore`),o}catch(e){const r=`ipns record for ${t} could not be stored in the datastore`;throw m.error(r),p.default(new Error(r),"ERR_STORING_IN_DATASTORE")}}}w.defaultRecordLifetime=v,r.IpnsPublisher=w},{"peer-id":"8Bdb3","interface-datastore/key":"9hGOz","datastore-core/errors":"65M4b","err-code":"chZjB",debug:"bO5wM","uint8arrays/to-string":"hC8JB","uint8arrays/equals":"eY3cX",ipns:"7rNAT"}],"65M4b":[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("err-code"));r.abortedError=function(e){return e=e||new Error("Aborted"),n.default(e,"ERR_ABORTED")},r.dbDeleteFailedError=function(e){return e=e||new Error("Delete failed"),n.default(e,"ERR_DB_DELETE_FAILED")},r.dbOpenFailedError=function(e){return e=e||new Error("Cannot open database"),n.default(e,"ERR_DB_OPEN_FAILED")},r.dbWriteFailedError=function(e){return e=e||new Error("Write failed"),n.default(e,"ERR_DB_WRITE_FAILED")},r.notFoundError=function(e){return e=e||new Error("Not Found"),n.default(e,"ERR_NOT_FOUND")}},{"err-code":"chZjB"}],"7rNAT":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("timestamp-nano"),n=e("interface-datastore/key"),s=e("libp2p-crypto"),o=e("peer-id"),a=e("multiformats/hashes/digest"),c=e("multiformats/hashes/identity"),u=e("err-code"),l=e("multiformats/bases/base32"),d=e("uint8arrays/from-string"),f=e("uint8arrays/to-string"),h=e("uint8arrays/concat"),p=e("uint8arrays/equals"),g=e("cborg"),y=e("long"),m=e("debug"),b=e("./pb/ipns.js"),v=e("./utils.js"),w=e("./errors.js");function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function E(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var S=_(i),T=_(s),A=_(o),k=E(a),I=_(u),R=E(g),P=_(y),O=_(m);const C=Object.assign(O.default("jsipns"),{error:O.default("jsipns:error")}),j=c.identity.code,D=d.fromString("/ipns/"),M="/ipns/",x=M.length,B=async(e,t,r,i,n,s)=>{r=BigInt(r);const o=d.fromString(n.toString()),a=await z(e,t,i,o),c=L(t,o,i,r,s),u=q(c),l={value:t,signature:a,validityType:i,validity:o,sequence:r,ttl:s,signatureV2:await e.sign(u),data:c};return C(`ipns entry for ${t} created`),l},L=(e,t,r,i,n)=>{const s={Value:e,Validity:t,ValidityType:r,Sequence:i,TTL:n};return R.encode(s)},N=async(e,t)=>{const{value:r,validityType:i,validity:n}=t;let s,o,a;t.signatureV2&&t.data?(o=t.signatureV2,s=q(t.data),U(t)):(o=t.signature,s=V(r,i,n));try{a=await e.verify(s,o)}catch(e){a=!1}if(!a)throw C.error("record signature verification failed"),I.default(new Error("record signature verification failed"),w.ERR_SIGNATURE_VERIFICATION);if(i===b.IpnsEntry.ValidityType.EOL){let e;try{e=v.parseRFC3339(f.toString(n))}catch(e){throw C.error("unrecognized validity format (not an rfc3339 format)"),I.default(new Error("unrecognized validity format (not an rfc3339 format)"),w.ERR_UNRECOGNIZED_FORMAT)}if(e.getTime()<Date.now())throw C.error("record has expired"),I.default(new Error("record has expired"),w.ERR_IPNS_EXPIRED_RECORD)}else if(i)throw C.error("unrecognized validity type"),I.default(new Error("unrecognized validity type"),w.ERR_UNRECOGNIZED_VALIDITY);C(`ipns entry for ${r} is valid`)},U=e=>{if(!e.data)throw I.default(new Error("Record data is missing"),w.ERR_INVALID_RECORD_DATA);const t=R.decode(e.data);if(Number.isInteger(t.Sequence)&&(t.Sequence=BigInt(t.Sequence)),Number.isInteger(t.TTL)&&(t.TTL=BigInt(t.TTL)),!p.equals(t.Value,e.value))throw I.default(new Error('Field "value" did not match between protobuf and CBOR'),w.ERR_SIGNATURE_VERIFICATION);if(!p.equals(t.Validity,e.validity))throw I.default(new Error('Field "validity" did not match between protobuf and CBOR'),w.ERR_SIGNATURE_VERIFICATION);if(t.ValidityType!==e.validityType)throw I.default(new Error('Field "validityType" did not match between protobuf and CBOR'),w.ERR_SIGNATURE_VERIFICATION);if(t.Sequence!==e.sequence)throw I.default(new Error('Field "sequence" did not match between protobuf and CBOR'),w.ERR_SIGNATURE_VERIFICATION);if(t.TTL!==e.ttl)throw I.default(new Error('Field "ttl" did not match between protobuf and CBOR'),w.ERR_SIGNATURE_VERIFICATION)},F=async(e,t)=>{if(!t||!e){const e=new Error("one or more of the provided parameters are not defined");throw C.error(e),I.default(e,w.ERR_UNDEFINED_PARAMETER)}let r;if(t.pubKey){try{r=T.default.keys.unmarshalPublicKey(t.pubKey)}catch(e){throw C.error(e),e}if(!(await A.default.createFromPubKey(t.pubKey)).equals(e))throw I.default(new Error("Embedded public key did not match PeerID"),w.ERR_INVALID_EMBEDDED_KEY)}else e.pubKey&&(r=e.pubKey);if(r)return r;throw I.default(new Error("no public key is available"),w.ERR_UNDEFINED_PARAMETER)},K=e=>l.base32upper.encode(e).slice(1),z=(e,t,r,i)=>{try{const n=V(t,r,i);return e.sign(n)}catch(e){throw C.error("record signature creation failed"),I.default(new Error("record signature creation failed: "+e.message),w.ERR_SIGNATURE_CREATION)}},V=(e,t,r)=>{const i=d.fromString((e=>{if("0"===e.toString())return"EOL";const t=new Error(`unrecognized validity type ${e.toString()}`);throw C.error(t),I.default(t,w.ERR_UNRECOGNIZED_VALIDITY)})(t));return h.concat([e,r,i])},q=e=>{const t=d.fromString("ipns-signature:");return h.concat([t,e])},G=e=>{const t=k.decode(e.id);return t.code!==j?null:T.default.keys.unmarshalPublicKey(t.digest)},H=e=>{const t=b.IpnsEntry.decode(e),r=b.IpnsEntry.toObject(t,{defaults:!1,arrays:!0,objects:!1});return{value:r.value,signature:r.signature,validityType:r.validityType,validity:r.validity,sequence:Object.hasOwnProperty.call(r,"sequence")?BigInt(`${r.sequence}`):0,pubKey:r.pubKey,ttl:Object.hasOwnProperty.call(r,"ttl")?BigInt(`${r.ttl}`):void 0,signatureV2:r.signatureV2,data:r.data}},$={validate:async(e,t)=>{const r=H(e),i=t.slice(D.length),n=A.default.createFromBytes(i),s=await F(n,r);await N(s,r)},select:(e,t)=>{const r=H(e),i=H(t);if(r.signatureV2&&!i.signatureV2)return 0;if(i.signatureV2&&!r.signatureV2)return 1;if(r.sequence>i.sequence)return 0;if(r.sequence<i.sequence)return 1;const n=v.parseRFC3339(f.toString(r.validity));return v.parseRFC3339(f.toString(i.validity)).getTime()>n.getTime()?1:0}};r.create=(e,t,r,i)=>{const n=new S.default(Date.now()+Number(i)),s=b.IpnsEntry.ValidityType.EOL,[o,a]=i.toString().split("."),c=BigInt(o)*BigInt(1e5)+BigInt(a||0);return B(e,t,r,s,n,c)},r.createWithExpiration=(e,t,r,i)=>{const n=S.default.fromString(i),s=b.IpnsEntry.ValidityType.EOL,o=n.toDate().getTime()-Date.now(),a=BigInt(o)*BigInt(1e5)+BigInt(n.getNano());return B(e,t,r,s,n,a)},r.embedPublicKey=async(e,t)=>{if(!e||!e.bytes||!t){const e=new Error("one or more of the provided parameters are not defined");throw C.error(e),I.default(e,w.ERR_UNDEFINED_PARAMETER)}let r,i;try{r=await A.default.createFromPubKey(e.bytes)}catch(e){throw I.default(e,w.ERR_PEER_ID_FROM_PUBLIC_KEY)}try{i=G(r)}catch(e){throw C.error(e),I.default(e,w.ERR_PUBLIC_KEY_FROM_ID)}if(i)return null;try{t.pubKey=T.default.keys.marshalPublicKey(e)}catch(e){throw C.error(e),e}return t},r.extractPublicKey=F,r.getIdKeys=e=>{const t=d.fromString("/pk/"),r=d.fromString("/ipns/");return{routingPubKey:new n.Key(h.concat([t,e]),!1),pkKey:new n.Key(K(h.concat([t,e]))),routingKey:new n.Key(h.concat([r,e]),!1),ipnsKey:new n.Key(K(h.concat([r,e])))}},r.getLocalKey=e=>new n.Key(`/ipns/${K(e)}`),r.marshal=e=>b.IpnsEntry.encode({...e,sequence:P.default.fromString(e.sequence.toString()),ttl:null==e.ttl?void 0:P.default.fromString(e.ttl.toString())}).finish(),r.namespace=M,r.namespaceLength=x,r.unmarshal=H,r.validate=N,r.validator=$},{"timestamp-nano":"7gA2O","interface-datastore/key":"9hGOz","libp2p-crypto":"bb1cb","peer-id":"8Bdb3","multiformats/hashes/digest":"kpRBg","multiformats/hashes/identity":"eYCZn","err-code":"chZjB","multiformats/bases/base32":"5k9Tu","uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB","uint8arrays/concat":"4EBjG","uint8arrays/equals":"eY3cX",cborg:"iZrkE",long:"lyrB6",debug:"bO5wM","./pb/ipns.js":"ayx1q","./utils.js":"kYcWW","./errors.js":"jtlhd"}],"7gA2O":[function(e,t,r){
/**
* Timestamp for 64-bit time_t, nanosecond precision and strftime
*
* @author Yusuke Kawasaki
* @license MIT
* @see https://github.com/kawanet/timestamp-nano
*/
!function(){void 0!==t&&(t.exports=y);var e=86400,r=3200,i=1168776,n=100982246400,s=1e3*n,o=864e13,a=4294967296,c=1e6,u=1e9,l="000000000",d=Math.trunc||function(e){var t=e-e%1;return 0===t&&(e<0||0===e&&1/e!=1/0)?-0:t},f=y.prototype;y.fromDate=function(e){return new y(+e)},y.fromInt64BE=_(0,1,2,3,0,4),y.fromInt64LE=_(3,2,1,0,4,0),y.fromString=function(e){var t,r=new y,i=(e+="").replace(/^\s*[+\-]?\d+/,(function(e){var t=+e,i=1970+(t-1970)%400;return r.year=t-i,i})).replace(/(?:Z|([+\-]\d{2}):?(\d{2}))$/,(function(e,r,i){return r<0&&(i*=-1),t=6e4*(60*+r+ +i),""})).replace(/\.\d+$/,(function(e){return r.nano=+(e+l).substr(1,9),""})).split(/\D+/);i.length>1?i[1]--:i[1]=0;if(r.time=t=Date.UTC.apply(Date,i)-(t||0),isNaN(t))throw new TypeError("Invalid Date");return m(r)},y.fromTimeT=function(e){return v(e,0)},f.year=0,f.time=0,f.nano=0,f.addNano=function(e){return this.nano+=+e||0,this},f.getNano=function(){var e=m(this);return(e.time%1e3*c+ +e.nano+u)%u},f.getTimeT=function(){var t=m(this),n=Math.floor(t.time/1e3),s=t.year;s&&(n+=s*i*e/r);return n},f.getYear=function(){return this.toDate().getUTCFullYear()+this.year},f.toDate=function(){return b(m(this).time)},f.toJSON=function(){return this.toString().replace(/0{1,6}Z$/,"Z")},f.toString=function(e){var t=this,r=t.toDate(),i={H:function(){return S(r.getUTCHours())},L:function(){return T(r.getUTCMilliseconds(),3)},M:function(){return S(r.getUTCMinutes())},N:function(){return T(t.getNano(),9)},S:function(){return S(r.getUTCSeconds())},Y:function(){var e=t.getYear();return e>999999?"+"+e:e>9999?"+"+T(e,6):e>=0?T(e,4):e>=-999999?"-"+T(-e,6):e},a:function(){return p[r.getUTCDay()]},b:function(){return h[r.getUTCMonth()]},d:function(){return S(r.getUTCDate())},e:function(){return e=r.getUTCDate(),(e>9?"":" ")+(0|e);var e},m:function(){return S(r.getUTCMonth()+1)}};return function e(t){return t.replace(/%./g,(function(t){var r=t[1],n=g[r],s=i[r];return n?e(n):s?s():t}))}(e||"%Y-%m-%dT%H:%M:%S.%NZ")},f.writeInt64BE=w(0,1,2,3,0,4),f.writeInt64LE=w(3,2,1,0,4,0);var h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],p=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],g={"%":"%",F:"%Y-%m-%d",n:"\n",R:"%H:%M",T:"%H:%M:%S",t:"\t",X:"%T",Z:"GMT",z:"+0000"};function y(e,t,r){var i=this;if(!(i instanceof y))return new y(e,t,r);i.time=+e||0,i.nano=+t||0,i.year=+r||0,m(i)}function m(e){var t,i,n=e.year,a=e.time,u=e.nano;if(u<0||c<=u){var l=Math.floor(u/c);u-=l*c,a+=l,t=1}var f=n%r;if(a<-o||o<a||f){(i=d(a/s))&&(n+=i*r,a-=i*s);var h=b(a);h.setUTCFullYear(f+h.getUTCFullYear());var p=(a=+h)+(i=d((n-=f)/r))*s;i&&-o<=p&&p<=o&&(n-=i*r,a=p),t=1}return t&&(e.year=n,e.time=a,e.nano=u),e}function b(e){var t=new Date(0);return t.setTime(e),t}function v(e,t){t|=0,e=+e||0;var i=d((t*=a)/n)+d(e/n),s=t%n+e%n,o=d(s/n);return o&&(i+=o,s-=o*n),new y(1e3*s,0,i*r)}function w(e,t,r,i,n,s){return function(e,t){var r=m(this);e||(e=new Array(8));E(e,t|=0);var i=Math.floor(r.time/1e3),c=31556952*r.year,u=d(c/a)+d(i/a),l=c%a+i%a,f=Math.floor(l/a);f&&(u+=f,l-=f*a);return o(e,t+n,u),o(e,t+s,l),e};function o(n,s,o){n[s+e]=o>>24&255,n[s+t]=o>>16&255,n[s+r]=o>>8&255,n[s+i]=255&o}}function _(e,t,r,i,n,s){return function(e,t){E(e,t|=0);var r=o(e,t+n);return v(o(e,t+s),r)};function o(n,s){return 16777216*n[s+e]+(n[s+t]<<16|n[s+r]<<8|n[s+i])}}function E(e,t){var r=e&&e.length;if(null==r)throw new TypeError("Invalid Buffer");if(r<t+8)throw new RangeError("Out of range")}function S(e){return(e>9?"":"0")+(0|e)}function T(e,t){return(l+(0|e)).substr(-t)}}()},{}],bb1cb:[function(e,t,r){"use strict";const i=e("./hmac"),n=e("./aes"),s=e("./keys");r.aes=n,r.hmac=i,r.keys=s,r.randomBytes=e("./random-bytes"),r.pbkdf2=e("./pbkdf2")},{"./hmac":"JUsR3","./aes":"haaCU","./keys":"kWJWg","./random-bytes":"gsnuW","./pbkdf2":"jWCQX"}],haaCU:[function(e,t,r){"use strict";const i=e("./ciphers"),n=e("./cipher-mode");r.create=async function(e,t){const r=n(e),s=i.createCipheriv(r,e,t),o=i.createDecipheriv(r,e,t);return{encrypt:async e=>s.update(e),decrypt:async e=>o.update(e)}}},{"./ciphers":"dBWnA","./cipher-mode":"aT0PA"}],dBWnA:[function(e,t,r){"use strict";e("node-forge/lib/aes");const i=e("node-forge/lib/forge"),{toString:n}=e("uint8arrays/to-string"),{fromString:s}=e("uint8arrays/from-string");t.exports={createCipheriv:(e,t,r)=>{const o=i.cipher.createCipher("AES-CTR",n(t,"ascii"));return o.start({iv:n(r,"ascii")}),{update:e=>(o.update(i.util.createBuffer(n(e,"ascii"))),s(o.output.getBytes(),"ascii"))}},createDecipheriv:(e,t,r)=>{const o=i.cipher.createDecipher("AES-CTR",n(t,"ascii"));return o.start({iv:n(r,"ascii")}),{update:e=>(o.update(i.util.createBuffer(n(e,"ascii"))),s(o.output.getBytes(),"ascii"))}}}},{"node-forge/lib/aes":"1SAd7","node-forge/lib/forge":"4OuPD","uint8arrays/to-string":"hC8JB","uint8arrays/from-string":"dF7Y4"}],aT0PA:[function(e,t,r){"use strict";const i=e("err-code"),n={16:"aes-128-ctr",32:"aes-256-ctr"};t.exports=function(e){const t=n[e.length];if(!t){const t=Object.entries(n).map((([e,t])=>`${e} (${t})`)).join(" / ");throw i(new Error(`Invalid key length ${e.length} bytes. Must be ${t}`),"ERR_INVALID_KEY_LENGTH")}return t}},{"err-code":"chZjB"}],jWCQX:[function(e,t,r){"use strict";const i=e("node-forge/lib/pbkdf2"),n=e("node-forge/lib/util"),s=e("err-code"),o={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};t.exports=function(e,t,r,a,c){const u=o[c];if(!u){const e=Object.keys(o).join(" / ");throw s(new Error(`Hash '${c}' is unknown or not supported. Must be ${e}`),"ERR_UNSUPPORTED_HASH_TYPE")}const l=i(e,t,r,a,u);return n.encode64(l)}},{"node-forge/lib/pbkdf2":"j1TyX","node-forge/lib/util":"df43p","err-code":"chZjB"}],lyrB6:[function(e,t,r){t.exports=n;var i=null;try{i=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function s(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=s;var o={},a={};function c(e,t){var r,i,n;return t?(n=0<=(e>>>=0)&&e<256)&&(i=a[e])?i:(r=l(e,(0|e)<0?-1:0,!0),n&&(a[e]=r),r):(n=-128<=(e|=0)&&e<128)&&(i=o[e])?i:(r=l(e,e<0?-1:0,!1),n&&(o[e]=r),r)}function u(e,t){if(isNaN(e))return t?v:b;if(t){if(e<0)return v;if(e>=g)return T}else{if(e<=-y)return A;if(e+1>=y)return S}return e<0?u(-e,t).neg():l(e%p|0,e/p|0,t)}function l(e,t,r){return new n(e,t,r)}n.fromInt=c,n.fromNumber=u,n.fromBits=l;var d=Math.pow;function f(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return b;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return f(e.substring(1),t,r).neg();for(var n=u(d(r,8)),s=b,o=0;o<e.length;o+=8){var a=Math.min(8,e.length-o),c=parseInt(e.substring(o,o+a),r);if(a<8){var l=u(d(r,a));s=s.mul(l).add(u(c))}else s=(s=s.mul(n)).add(u(c))}return s.unsigned=t,s}function h(e,t){return"number"==typeof e?u(e,t):"string"==typeof e?f(e,t):l(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=f,n.fromValue=h;var p=4294967296,g=p*p,y=g/2,m=c(16777216),b=c(0);n.ZERO=b;var v=c(0,!0);n.UZERO=v;var w=c(1);n.ONE=w;var _=c(1,!0);n.UONE=_;var E=c(-1);n.NEG_ONE=E;var S=l(-1,2147483647,!1);n.MAX_VALUE=S;var T=l(-1,-1,!0);n.MAX_UNSIGNED_VALUE=T;var A=l(0,-2147483648,!1);n.MIN_VALUE=A;var k=n.prototype;k.toInt=function(){return this.unsigned?this.low>>>0:this.low},k.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},k.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(A)){var t=u(e),r=this.div(t),i=r.mul(t).sub(this);return r.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var n=u(d(e,6),this.unsigned),s=this,o="";;){var a=s.div(n),c=(s.sub(a.mul(n)).toInt()>>>0).toString(e);if((s=a).isZero())return c+o;for(;c.length<6;)c="0"+c;o=""+c+o}},k.getHighBits=function(){return this.high},k.getHighBitsUnsigned=function(){return this.high>>>0},k.getLowBits=function(){return this.low},k.getLowBitsUnsigned=function(){return this.low>>>0},k.getNumBitsAbs=function(){if(this.isNegative())return this.eq(A)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},k.isZero=function(){return 0===this.high&&0===this.low},k.eqz=k.isZero,k.isNegative=function(){return!this.unsigned&&this.high<0},k.isPositive=function(){return this.unsigned||this.high>=0},k.isOdd=function(){return 1==(1&this.low)},k.isEven=function(){return 0==(1&this.low)},k.equals=function(e){return s(e)||(e=h(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},k.eq=k.equals,k.notEquals=function(e){return!this.eq(e)},k.neq=k.notEquals,k.ne=k.notEquals,k.lessThan=function(e){return this.comp(e)<0},k.lt=k.lessThan,k.lessThanOrEqual=function(e){return this.comp(e)<=0},k.lte=k.lessThanOrEqual,k.le=k.lessThanOrEqual,k.greaterThan=function(e){return this.comp(e)>0},k.gt=k.greaterThan,k.greaterThanOrEqual=function(e){return this.comp(e)>=0},k.gte=k.greaterThanOrEqual,k.ge=k.greaterThanOrEqual,k.compare=function(e){if(s(e)||(e=h(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},k.comp=k.compare,k.negate=function(){return!this.unsigned&&this.eq(A)?A:this.not().add(w)},k.neg=k.negate,k.add=function(e){s(e)||(e=h(e));var t=this.high>>>16,r=65535&this.high,i=this.low>>>16,n=65535&this.low,o=e.high>>>16,a=65535&e.high,c=e.low>>>16,u=0,d=0,f=0,p=0;return f+=(p+=n+(65535&e.low))>>>16,d+=(f+=i+c)>>>16,u+=(d+=r+a)>>>16,u+=t+o,l((f&=65535)<<16|(p&=65535),(u&=65535)<<16|(d&=65535),this.unsigned)},k.subtract=function(e){return s(e)||(e=h(e)),this.add(e.neg())},k.sub=k.subtract,k.multiply=function(e){if(this.isZero())return b;if(s(e)||(e=h(e)),i)return l(i.mul(this.low,this.high,e.low,e.high),i.get_high(),this.unsigned);if(e.isZero())return b;if(this.eq(A))return e.isOdd()?A:b;if(e.eq(A))return this.isOdd()?A:b;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(m)&&e.lt(m))return u(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,a=e.high>>>16,c=65535&e.high,d=e.low>>>16,f=65535&e.low,p=0,g=0,y=0,v=0;return y+=(v+=o*f)>>>16,g+=(y+=n*f)>>>16,y&=65535,g+=(y+=o*d)>>>16,p+=(g+=r*f)>>>16,g&=65535,p+=(g+=n*d)>>>16,g&=65535,p+=(g+=o*c)>>>16,p+=t*f+r*d+n*c+o*a,l((y&=65535)<<16|(v&=65535),(p&=65535)<<16|(g&=65535),this.unsigned)},k.mul=k.multiply,k.divide=function(e){if(s(e)||(e=h(e)),e.isZero())throw Error("division by zero");var t,r,n;if(i)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?l((this.unsigned?i.div_u:i.div_s)(this.low,this.high,e.low,e.high),i.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?v:b;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return v;if(e.gt(this.shru(1)))return _;n=v}else{if(this.eq(A))return e.eq(w)||e.eq(E)?A:e.eq(A)?w:(t=this.shr(1).div(e).shl(1)).eq(b)?e.isNegative()?w:E:(r=this.sub(e.mul(t)),n=t.add(r.div(e)));if(e.eq(A))return this.unsigned?v:b;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();n=b}for(r=this;r.gte(e);){t=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(t)/Math.LN2),a=o<=48?1:d(2,o-48),c=u(t),f=c.mul(e);f.isNegative()||f.gt(r);)f=(c=u(t-=a,this.unsigned)).mul(e);c.isZero()&&(c=w),n=n.add(c),r=r.sub(f)}return n},k.div=k.divide,k.modulo=function(e){return s(e)||(e=h(e)),i?l((this.unsigned?i.rem_u:i.rem_s)(this.low,this.high,e.low,e.high),i.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},k.mod=k.modulo,k.rem=k.modulo,k.not=function(){return l(~this.low,~this.high,this.unsigned)},k.and=function(e){return s(e)||(e=h(e)),l(this.low&e.low,this.high&e.high,this.unsigned)},k.or=function(e){return s(e)||(e=h(e)),l(this.low|e.low,this.high|e.high,this.unsigned)},k.xor=function(e){return s(e)||(e=h(e)),l(this.low^e.low,this.high^e.high,this.unsigned)},k.shiftLeft=function(e){return s(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):l(0,this.low<<e-32,this.unsigned)},k.shl=k.shiftLeft,k.shiftRight=function(e){return s(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):l(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},k.shr=k.shiftRight,k.shiftRightUnsigned=function(e){if(s(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?l(this.low>>>e|t<<32-e,t>>>e,this.unsigned):l(32===e?t:t>>>e-32,0,this.unsigned)},k.shru=k.shiftRightUnsigned,k.shr_u=k.shiftRightUnsigned,k.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},k.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},k.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},k.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},k.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},{}],ayx1q:[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("protobufjs/minimal.js"));const s=n.default.Reader,o=n.default.Writer,a=n.default.util,c=n.default.roots["ipfs-ipns"]||(n.default.roots["ipfs-ipns"]={}),u=c.IpnsEntry=(()=>{function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.value=a.newBuffer([]),e.prototype.signature=a.newBuffer([]),e.prototype.validityType=0,e.prototype.validity=a.newBuffer([]),e.prototype.sequence=a.Long?a.Long.fromBits(0,0,!0):0,e.prototype.ttl=a.Long?a.Long.fromBits(0,0,!0):0,e.prototype.pubKey=a.newBuffer([]),e.prototype.signatureV2=a.newBuffer([]),e.prototype.data=a.newBuffer([]),e.encode=function(e,t){return t||(t=o.create()),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&t.uint32(10).bytes(e.value),null!=e.signature&&Object.hasOwnProperty.call(e,"signature")&&t.uint32(18).bytes(e.signature),null!=e.validityType&&Object.hasOwnProperty.call(e,"validityType")&&t.uint32(24).int32(e.validityType),null!=e.validity&&Object.hasOwnProperty.call(e,"validity")&&t.uint32(34).bytes(e.validity),null!=e.sequence&&Object.hasOwnProperty.call(e,"sequence")&&t.uint32(40).uint64(e.sequence),null!=e.ttl&&Object.hasOwnProperty.call(e,"ttl")&&t.uint32(48).uint64(e.ttl),null!=e.pubKey&&Object.hasOwnProperty.call(e,"pubKey")&&t.uint32(58).bytes(e.pubKey),null!=e.signatureV2&&Object.hasOwnProperty.call(e,"signatureV2")&&t.uint32(66).bytes(e.signatureV2),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(74).bytes(e.data),t},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new c.IpnsEntry;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.value=e.bytes();break;case 2:i.signature=e.bytes();break;case 3:i.validityType=e.int32();break;case 4:i.validity=e.bytes();break;case 5:i.sequence=e.uint64();break;case 6:i.ttl=e.uint64();break;case 7:i.pubKey=e.bytes();break;case 8:i.signatureV2=e.bytes();break;case 9:i.data=e.bytes();break;default:e.skipType(7&n)}}return i},e.fromObject=function(e){if(e instanceof c.IpnsEntry)return e;var t=new c.IpnsEntry;switch(null!=e.value&&("string"==typeof e.value?a.base64.decode(e.value,t.value=a.newBuffer(a.base64.length(e.value)),0):e.value.length&&(t.value=e.value)),null!=e.signature&&("string"==typeof e.signature?a.base64.decode(e.signature,t.signature=a.newBuffer(a.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),e.validityType){case"EOL":case 0:t.validityType=0}return null!=e.validity&&("string"==typeof e.validity?a.base64.decode(e.validity,t.validity=a.newBuffer(a.base64.length(e.validity)),0):e.validity.length&&(t.validity=e.validity)),null!=e.sequence&&(a.Long?(t.sequence=a.Long.fromValue(e.sequence)).unsigned=!0:"string"==typeof e.sequence?t.sequence=parseInt(e.sequence,10):"number"==typeof e.sequence?t.sequence=e.sequence:"object"==typeof e.sequence&&(t.sequence=new a.LongBits(e.sequence.low>>>0,e.sequence.high>>>0).toNumber(!0))),null!=e.ttl&&(a.Long?(t.ttl=a.Long.fromValue(e.ttl)).unsigned=!0:"string"==typeof e.ttl?t.ttl=parseInt(e.ttl,10):"number"==typeof e.ttl?t.ttl=e.ttl:"object"==typeof e.ttl&&(t.ttl=new a.LongBits(e.ttl.low>>>0,e.ttl.high>>>0).toNumber(!0))),null!=e.pubKey&&("string"==typeof e.pubKey?a.base64.decode(e.pubKey,t.pubKey=a.newBuffer(a.base64.length(e.pubKey)),0):e.pubKey.length&&(t.pubKey=e.pubKey)),null!=e.signatureV2&&("string"==typeof e.signatureV2?a.base64.decode(e.signatureV2,t.signatureV2=a.newBuffer(a.base64.length(e.signatureV2)),0):e.signatureV2.length&&(t.signatureV2=e.signatureV2)),null!=e.data&&("string"==typeof e.data?a.base64.decode(e.data,t.data=a.newBuffer(a.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),t},e.toObject=function(e,t){t||(t={});var r={};if(t.defaults){if(t.bytes===String?r.value="":(r.value=[],t.bytes!==Array&&(r.value=a.newBuffer(r.value))),t.bytes===String?r.signature="":(r.signature=[],t.bytes!==Array&&(r.signature=a.newBuffer(r.signature))),r.validityType=t.enums===String?"EOL":0,t.bytes===String?r.validity="":(r.validity=[],t.bytes!==Array&&(r.validity=a.newBuffer(r.validity))),a.Long){var i=new a.Long(0,0,!0);r.sequence=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.sequence=t.longs===String?"0":0;if(a.Long){i=new a.Long(0,0,!0);r.ttl=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.ttl=t.longs===String?"0":0;t.bytes===String?r.pubKey="":(r.pubKey=[],t.bytes!==Array&&(r.pubKey=a.newBuffer(r.pubKey))),t.bytes===String?r.signatureV2="":(r.signatureV2=[],t.bytes!==Array&&(r.signatureV2=a.newBuffer(r.signatureV2))),t.bytes===String?r.data="":(r.data=[],t.bytes!==Array&&(r.data=a.newBuffer(r.data)))}return null!=e.value&&e.hasOwnProperty("value")&&(r.value=t.bytes===String?a.base64.encode(e.value,0,e.value.length):t.bytes===Array?Array.prototype.slice.call(e.value):e.value),null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?a.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature),null!=e.validityType&&e.hasOwnProperty("validityType")&&(r.validityType=t.enums===String?c.IpnsEntry.ValidityType[e.validityType]:e.validityType),null!=e.validity&&e.hasOwnProperty("validity")&&(r.validity=t.bytes===String?a.base64.encode(e.validity,0,e.validity.length):t.bytes===Array?Array.prototype.slice.call(e.validity):e.validity),null!=e.sequence&&e.hasOwnProperty("sequence")&&("number"==typeof e.sequence?r.sequence=t.longs===String?String(e.sequence):e.sequence:r.sequence=t.longs===String?a.Long.prototype.toString.call(e.sequence):t.longs===Number?new a.LongBits(e.sequence.low>>>0,e.sequence.high>>>0).toNumber(!0):e.sequence),null!=e.ttl&&e.hasOwnProperty("ttl")&&("number"==typeof e.ttl?r.ttl=t.longs===String?String(e.ttl):e.ttl:r.ttl=t.longs===String?a.Long.prototype.toString.call(e.ttl):t.longs===Number?new a.LongBits(e.ttl.low>>>0,e.ttl.high>>>0).toNumber(!0):e.ttl),null!=e.pubKey&&e.hasOwnProperty("pubKey")&&(r.pubKey=t.bytes===String?a.base64.encode(e.pubKey,0,e.pubKey.length):t.bytes===Array?Array.prototype.slice.call(e.pubKey):e.pubKey),null!=e.signatureV2&&e.hasOwnProperty("signatureV2")&&(r.signatureV2=t.bytes===String?a.base64.encode(e.signatureV2,0,e.signatureV2.length):t.bytes===Array?Array.prototype.slice.call(e.signatureV2):e.signatureV2),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?a.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.default.util.toJSONOptions)},e.ValidityType=function(){const e={},t=Object.create(e);return t[e[0]="EOL"]=0,t}(),e})();r.IpnsEntry=u,r.default=c},{"protobufjs/minimal.js":"grAXL"}],kYcWW:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.parseRFC3339=function(e){const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),r=String(e).trim().match(t);if(!r)throw new Error("Invalid format");const i=parseInt(r[1],10),n=parseInt(r[2],10)-1,s=parseInt(r[3],10),o=parseInt(r[4],10),a=parseInt(r[5],10),c=parseInt(r[6],10),u=parseInt(r[7].slice(0,-6),10);return new Date(Date.UTC(i,n,s,o,a,c,u))},r.toRFC3339=function(e){return`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,"0")}-${String(e.getUTCDate()).padStart(2,"0")}T${String(e.getUTCHours()).padStart(2,"0")}:${String(e.getUTCMinutes()).padStart(2,"0")}:${String(e.getUTCSeconds()).padStart(2,"0")}.${1e6*e.getUTCMilliseconds()}Z`}},{}],jtlhd:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.ERR_INVALID_EMBEDDED_KEY="ERR_INVALID_EMBEDDED_KEY",r.ERR_INVALID_RECORD_DATA="ERR_INVALID_RECORD_DATA",r.ERR_IPNS_EXPIRED_RECORD="ERR_IPNS_EXPIRED_RECORD",r.ERR_PEER_ID_FROM_PUBLIC_KEY="ERR_PEER_ID_FROM_PUBLIC_KEY",r.ERR_PUBLIC_KEY_FROM_ID="ERR_PUBLIC_KEY_FROM_ID",r.ERR_SIGNATURE_CREATION="ERR_SIGNATURE_CREATION",r.ERR_SIGNATURE_VERIFICATION="ERR_SIGNATURE_VERIFICATION",r.ERR_UNDEFINED_PARAMETER="ERR_UNDEFINED_PARAMETER",r.ERR_UNRECOGNIZED_FORMAT="ERR_UNRECOGNIZED_FORMAT",r.ERR_UNRECOGNIZED_VALIDITY="ERR_UNRECOGNIZED_VALIDITY"},{}],hoedq:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipns"),n=e("libp2p-crypto"),s=e("peer-id"),o=e("err-code"),a=e("debug");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var l=u(i),d=c(n),f=c(s),h=c(o),p=c(a);const g=Object.assign(p.default("ipfs:ipns:republisher"),{error:p.default("ipfs:ipns:republisher:error")});r.IpnsRepublisher=class{constructor(e,t,r,i,n={pass:""}){this._publisher=e,this._datastore=t,this._peerId=r,this._keychain=i,this._options=n,this._republishHandle=null}async start(){if(this._republishHandle)throw h.default(new Error("republisher is already running"),"ERR_REPUBLISH_ALREADY_RUNNING");const e={_task:null,_inflightTask:null,_timeoutId:null,runPeriodically:t=>{e._timeoutId=setTimeout((async()=>{e._timeoutId=null;try{e._inflightTask=e._task(),await e._inflightTask,e._task&&e.runPeriodically(t)}catch(e){g.error(e)}}),t())},cancel:async()=>{null!=e._timeoutId&&clearTimeout(e._timeoutId),e._task=null,await e._inflightTask}},{privKey:t}=this._peerId,{pass:r}=this._options;let i=!0;e._task=()=>this._republishEntries(t,r),e.runPeriodically((()=>i?(i=!1,this._options.initialBroadcastInterval||6e4):this._options.broadcastInterval||144e5)),this._republishHandle=e}async stop(){const e=this._republishHandle;if(!e)throw h.default(new Error("republisher is not running"),"ERR_REPUBLISH_NOT_RUNNING");this._republishHandle=null,await e.cancel()}async _republishEntries(e,t){try{await this._republishEntry(e)}catch(e){const t="cannot republish entry for the node's private key";return void g.error(t)}if(t)try{const e=await this._keychain.listKeys();for(const r of e){if("self"===r.name)continue;const e=await this._keychain.exportKey(r.name,t),i=await d.default.keys.import(e,t);await this._republishEntry(i)}}catch(e){g.error(e)}}async _republishEntry(e){if(!e||!e.bytes)throw h.default(new Error("invalid private key"),"ERR_INVALID_PRIVATE_KEY");try{const t=await f.default.createFromPrivKey(e.bytes),r=await this._getPreviousValue(t);await this._publisher.publishWithEOL(e,r,864e5)}catch(e){if("ERR_NO_ENTRY_FOUND"===e.code)return;throw e}}async _getPreviousValue(e){if(!f.default.isPeerId(e))throw h.default(new Error("invalid peer ID"),"ERR_INVALID_PEER_ID");try{const t=await this._datastore.get(l.getLocalKey(e.id));if(!(t instanceof Uint8Array))throw h.default(new Error("found ipns record that we couldn't process"),"ERR_INVALID_IPNS_RECORD");try{return l.unmarshal(t).value}catch(e){throw g.error(e),h.default(new Error("found ipns record that we couldn't convert to a value"),"ERR_INVALID_IPNS_RECORD")}}catch(t){if(t&&t.notFound)throw h.default(new Error(`no previous entry for record with id: ${e.id}`),"ERR_NO_ENTRY_FOUND");throw t}}}},{ipns:"7rNAT","libp2p-crypto":"bb1cb","peer-id":"8Bdb3","err-code":"chZjB",debug:"bO5wM"}],gifOE:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipns"),n=e("peer-id"),s=e("err-code"),o=e("debug"),a=e("uint8arrays/to-string"),c=e("datastore-core/errors");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var d=l(i),f=u(n),h=u(s),p=u(o),g=l(c);const y=Object.assign(p.default("ipfs:ipns:resolver"),{error:p.default("ipfs:ipns:resolver:error")}),m=g.notFoundError().code;r.IpnsResolver=class{constructor(e){this._routing=e}async resolve(e,t={}){if("string"!=typeof e)throw h.default(new Error("invalid name"),"ERR_INVALID_NAME");const r=t.recursive&&"true"===t.recursive.toString(),i=e.split("/");if(3!==i.length||""!==i[0])throw h.default(new Error("invalid name"),"ERR_INVALID_NAME");const n=i[2];let s=1/0;r&&(s=32);const o=await this.resolver(n,s);return y(`${e} was locally resolved correctly`),o}async resolver(e,t){if(0===t){const e="could not resolve name (recursion limit of 32 exceeded)";throw y.error(e),h.default(new Error(e),"ERR_RESOLVE_RECURSION_LIMIT")}const r=await this._resolveName(e),i=r.split("/");return"ipfs"!==i[1]&&t?this.resolver(i[2],t-1):r}async _resolveName(e){const t=f.default.parse(e),{routingKey:r}=d.getIdKeys(t.toBytes());let i,n;try{i=await this._routing.get(r.uint8Array())}catch(r){if(y.error("could not get record from routing",r),r.code===m)throw h.default(new Error(`record requested for ${e} was not found in the network`),"ERR_NO_RECORD_FOUND");throw h.default(new Error(`unexpected error getting the ipns record ${t.toString()}`),"ERR_UNEXPECTED_ERROR_GETTING_RECORD")}try{n=d.unmarshal(i)}catch(e){throw y.error("could not unmarshal record",e),h.default(new Error("found ipns record that we couldn't convert to a value"),"ERR_INVALID_RECORD_RECEIVED")}return this._validateRecord(t,n)}async _validateRecord(e,t){const r=await d.extractPublicKey(e,t);return await d.validate(r,t),a.toString(t.value)}}},{ipns:"7rNAT","peer-id":"8Bdb3","err-code":"chZjB",debug:"bO5wM","uint8arrays/to-string":"hC8JB","datastore-core/errors":"65M4b"}],lQE1u:[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("hashlru"));r.TLRU=class{constructor(e){this.lru=n.default(e)}get(e){const t=this.lru.get(e);if(t)return t.expire&&t.expire<Date.now()?void this.lru.remove(e):t.value}set(e,t,r){this.lru.set(e,{value:t,expire:Date.now()+r})}has(e){return!!this.get(e)}remove(e){this.lru.remove(e)}clear(){this.lru.clear()}}},{hashlru:"kBj5c"}],bU4x4:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("datastore-core/tiered"),n=e("dlv"),s=e("./pubsub-datastore.js"),o=e("./offline-datastore.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(n);r.createRouting=function({libp2p:e,repo:t,peerId:r,options:n}){const a=[];let u;if(c.default(n,"EXPERIMENTAL.ipnsPubsub",!1)){const i=e.pubsub,n=t.datastore;u=new s.IpnsPubsubDatastore(i,n,r),a.push(u)}if(c.default(n,"offline")||!c.default(n,"libp2p.config.dht.enabled",!1)){const e=new o.OfflineDatastore(t);a.push(e)}else a.push(e._dht);return new i.TieredDatastore(a)}},{"datastore-core/tiered":"5GeC7",dlv:"hp0pQ","./pubsub-datastore.js":"3XRQz","./offline-datastore.js":"a4pYc"}],"5GeC7":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./base.js"),n=e("./errors.js"),s=e("debug"),o=e("it-pushable"),a=e("it-drain");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(s),l=c(o),d=c(a);const f=u.default("datastore:core:tiered");class h extends i.BaseDatastore{constructor(e){super(),this.stores=e.slice()}async open(){try{await Promise.all(this.stores.map((e=>e.open())))}catch(e){throw n.dbOpenFailedError()}}async put(e,t){try{await Promise.all(this.stores.map((r=>r.put(e,t))))}catch(e){throw n.dbWriteFailedError()}}async get(e,t){for(const r of this.stores)try{const i=await r.get(e,t);if(i)return i}catch(e){f(e)}throw n.notFoundError()}async has(e,t){for(const r of this.stores)if(await r.has(e,t))return!0;return!1}async delete(e,t){try{await Promise.all(this.stores.map((r=>r.delete(e,t))))}catch(e){throw n.dbDeleteFailedError()}}async*putMany(e,t={}){let r;const i=this.stores.map((e=>{const i=l.default();return d.default(e.putMany(i,t)).catch((e=>{r=e})),i}));try{for await(const t of e){if(r)throw r;i.forEach((e=>e.push(t))),yield t}}finally{i.forEach((e=>e.end()))}}async*deleteMany(e,t={}){let r;const i=this.stores.map((e=>{const i=l.default();return d.default(e.deleteMany(i,t)).catch((e=>{r=e})),i}));try{for await(const t of e){if(r)throw r;i.forEach((e=>e.push(t))),yield t}}finally{i.forEach((e=>e.end()))}}async close(){await Promise.all(this.stores.map((e=>e.close())))}batch(){const e=this.stores.map((e=>e.batch()));return{put:(t,r)=>{e.forEach((e=>e.put(t,r)))},delete:t=>{e.forEach((e=>e.delete(t)))},commit:async t=>{for(const r of e)await r.commit(t)}}}query(e,t){return this.stores[this.stores.length-1].query(e,t)}queryKeys(e,t){return this.stores[this.stores.length-1].queryKeys(e,t)}}r.TieredDatastore=h},{"./base.js":"b5lsk","./errors.js":"65M4b",debug:"bO5wM","it-pushable":"bnpei","it-drain":"dKYhO"}],b5lsk:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils.js"),n=e("it-drain"),s=e("it-filter"),o=e("it-take");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(n),u=a(s),l=a(o);r.BaseDatastore=class{open(){return Promise.reject(new Error(".open is not implemented"))}close(){return Promise.reject(new Error(".close is not implemented"))}put(e,t,r){return Promise.reject(new Error(".put is not implemented"))}get(e,t){return Promise.reject(new Error(".get is not implemented"))}has(e,t){return Promise.reject(new Error(".has is not implemented"))}delete(e,t){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(e,t={}){for await(const{key:r,value:i}of e)await this.put(r,i,t),yield{key:r,value:i}}async*getMany(e,t={}){for await(const r of e)yield this.get(r,t)}async*deleteMany(e,t={}){for await(const r of e)await this.delete(r,t),yield r}batch(){let e=[],t=[];return{put(t,r){e.push({key:t,value:r})},delete(e){t.push(e)},commit:async r=>{await c.default(this.putMany(e,r)),e=[],await c.default(this.deleteMany(t,r)),t=[]}}}async*_all(e,t){throw new Error("._all is not implemented")}async*_allKeys(e,t){throw new Error("._allKeys is not implemented")}query(e,t){let r=this._all(e,t);if(null!=e.prefix&&(r=u.default(r,(t=>t.key.toString().startsWith(e.prefix)))),Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>u.default(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>i.sortAll(e,t)),r)),null!=e.offset){let t=0;r=u.default(r,(()=>t++>=e.offset))}return null!=e.limit&&(r=l.default(r,e.limit)),r}queryKeys(e,t){let r=this._allKeys(e,t);if(null!=e.prefix&&(r=u.default(r,(t=>t.toString().startsWith(e.prefix)))),Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>u.default(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>i.sortAll(e,t)),r)),null!=e.offset){let t=0;r=u.default(r,(()=>t++>=e.offset))}return null!=e.limit&&(r=l.default(r,e.limit)),r}}},{"./utils.js":"hJ8tG","it-drain":"dKYhO","it-filter":"5LCTL","it-take":"gxr1t"}],hJ8tG:[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("it-all"));r.replaceStartWith=(e,t)=>{const r=new RegExp("^"+t);return e.replace(r,"")},r.sortAll=(e,t)=>async function*(){const r=await n.default(e);yield*r.sort(t)}()},{"it-all":"iCXBu"}],iCXBu:[function(e,t,r){"use strict";t.exports=async e=>{const t=[];for await(const r of e)t.push(r);return t}},{}],dKYhO:[function(e,t,r){"use strict";t.exports=async e=>{for await(const t of e);}},{}],"5LCTL":[function(e,t,r){"use strict";t.exports=async function*(e,t){for await(const r of e)await t(r)&&(yield r)}},{}],gxr1t:[function(e,t,r){"use strict";t.exports=async function*(e,t){let r=0;if(!(t<1))for await(const i of e)if(yield i,r++,r===t)return}},{}],bnpei:[function(e,t,r){const i=e("fast-fifo");t.exports=e=>{let t;"function"==typeof(e=e||{})?(t=e,e={}):t=e.onEnd;let r,n,s,o=new i;const a=e=>n?n(e):(o.push(e),r),c=e=>s?r:a({done:!1,value:e}),u=e=>s?r:(s=!0,e?(e=>(o=new i,n?n({error:e}):(o.push({error:e}),r)))(e):a({done:!0}));if(r={[Symbol.asyncIterator](){return this},next:()=>{if(!o.isEmpty()){if(e.writev){let e;const t=[];for(;!o.isEmpty();){if(e=o.shift(),e.error)throw e.error;t.push(e.value)}return{done:e.done,value:t}}const t=o.shift();if(t.error)throw t.error;return t}return s?{done:!0}:new Promise(((t,i)=>{n=s=>(n=null,s.error?i(s.error):e.writev&&!s.done?t({done:s.done,value:[s.value]}):t(s),r)}))},return:()=>(o=new i,u(),{done:!0}),throw:e=>(u(e),{done:!0}),push:c,end:u},!t)return r;const l=r;return r={[Symbol.asyncIterator](){return this},next:()=>l.next(),throw:e=>(l.throw(e),t&&(t(e),t=null),{done:!0}),return:()=>(l.return(),t&&(t(),t=null),{done:!0}),push:c,end:e=>(l.end(e),t&&(t(e),t=null),r)},r}},{"fast-fifo":"8Ws5O"}],"8Ws5O":[function(e,t,r){const i=e("./fixed-size");t.exports=class{constructor(e){this.hwm=e||16,this.head=new i(this.hwm),this.tail=this.head}push(e){if(!this.head.push(e)){const t=this.head;this.head=t.next=new i(2*this.head.buffer.length),this.head.push(e)}}shift(){const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}isEmpty(){return this.head.isEmpty()}}},{"./fixed-size":"2lgNg"}],"2lgNg":[function(e,t,r){t.exports=class{constructor(e){if(!(e>0)||0!=(e-1&e))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return void 0===this.buffer[this.btm]}}},{}],hp0pQ:[function(e,t,r){var i;i=this,"object"==typeof r&&void 0!==t?t.exports=function(e,t,r,i,n){for(t=t.split?t.split("."):t,i=0;i<t.length;i++)e=e?e[t[i]]:n;return e===n?r:e}:"function"==typeof define&&define.amd?define((function(){return function(e,t,r,i,n){for(t=t.split?t.split("."):t,i=0;i<t.length;i++)e=e?e[t[i]]:n;return e===n?r:e}})):i.dlv=function(e,t,r,i,n){for(t=t.split?t.split("."):t,i=0;i<t.length;i++)e=e?e[t[i]]:n;return e===n?r:e}},{}],"3XRQz":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipns"),n=e("multiformats/bases/base58"),s=e("datastore-pubsub"),o=e("uint8arrays/from-string"),a=e("uint8arrays/to-string"),c=e("err-code"),u=e("debug");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var f=d(i),h=l(c),p=l(u);const g=Object.assign(p.default("ipfs:ipns:pubsub"),{error:p.default("ipfs:ipns:pubsub:error")});r.IpnsPubsubDatastore=class{constructor(e,t,r){this._subscriptions={},this._handleSubscriptionKey=this._handleSubscriptionKey.bind(this),this._pubsubDs=new s.PubsubDatastore(e,t,r,f.validator,this._handleSubscriptionKey)}put(e,t){return this._pubsubDs.put(e,t)}async get(e){let t,r;try{t=await this._pubsubDs.get(e)}catch(e){r=e}const i=e.slice(0,f.namespaceLength);if(a.toString(i)===f.namespace){const t=n.base58btc.encode(e).substring(1),r=n.base58btc.encode(e.slice(f.namespaceLength)).substring(1);this._subscriptions[t]=r,g(`subscribed to pubsub topic ${t}, id ${r}`)}if(r)throw r;return t}_handleSubscriptionKey(e){e instanceof Uint8Array&&(e=a.toString(e,"base58btc"));const t=this._subscriptions[e];if(!t)throw h.default(new Error(`key ${e} does not correspond to a subscription`),"ERR_INVALID_KEY");let r;try{r=f.getIdKeys(o.fromString(t,"base58btc"))}catch(e){throw g.error(e),e}return r.routingKey.uint8Array()}getSubscriptions(){return Object.values(this._subscriptions).filter(Boolean).map((e=>`${f.namespace}${e}`))}async cancel(e){if("string"!=typeof e)throw h.default(new Error("invalid subscription name"),"ERR_INVALID_SUBSCRIPTION_NAME");e.startsWith(f.namespace)&&(e=e.substring(f.namespaceLength));const t=Object.keys(this._subscriptions).find((t=>this._subscriptions[t]===e));if(!t)return{canceled:!1};const r=o.fromString(t);return this._pubsubDs.unsubscribe(r),delete this._subscriptions[t],g(`unsubscribed pubsub ${t}: ${e}`),{canceled:!0}}}},{ipns:"7rNAT","multiformats/bases/base58":"4n7mA","datastore-pubsub":"12I4Q","uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB","err-code":"chZjB",debug:"bO5wM"}],"12I4Q":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("interface-datastore"),n=e("datastore-core"),s=e("./utils.js"),o=e("uint8arrays/equals"),a=e("err-code"),c=e("debug");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(a),d=u(c);const f=Object.assign(d.default("datastore-pubsub:publisher"),{error:d.default("datastore-pubsub:publisher:error")});class h extends n.BaseDatastore{constructor(e,t,r,i,n){if(super(),!i)throw l.default(new TypeError("missing validator"),"ERR_INVALID_PARAMETERS");if("function"!=typeof i.validate)throw l.default(new TypeError("missing validate function"),"ERR_INVALID_PARAMETERS");if("function"!=typeof i.select)throw l.default(new TypeError("missing select function"),"ERR_INVALID_PARAMETERS");if(n&&"function"!=typeof n)throw l.default(new TypeError("invalid subscriptionKeyFn received"),"ERR_INVALID_PARAMETERS");this._pubsub=e,this._datastore=t,this._peerId=r,this._validator=i,this._handleSubscriptionKeyFn=n,this._onMessage=this._onMessage.bind(this)}async put(e,t){if(!(e instanceof Uint8Array)){const e="datastore key does not have a valid format";throw f.error(e),l.default(new Error(e),"ERR_INVALID_DATASTORE_KEY")}if(!(t instanceof Uint8Array)){const e="received value is not a Uint8Array";throw f.error(e),l.default(new Error(e),"ERR_INVALID_VALUE_RECEIVED")}const r=s.keyToTopic(e);f(`publish value for topic ${r}`),await this._pubsub.publish(r,t)}async get(e){if(!(e instanceof Uint8Array)){const e="datastore key does not have a valid format";throw f.error(e),l.default(new Error(e),"ERR_INVALID_DATASTORE_KEY")}const t=s.keyToTopic(e),r=await this._pubsub.getTopics();if(r&&Array.isArray(r)&&r.indexOf(t)>-1)return this._getLocal(e);try{this._pubsub.on(t,this._onMessage),await this._pubsub.subscribe(t)}catch(e){const r=`cannot subscribe topic ${t}`;throw f.error(r),l.default(new Error(r),"ERR_SUBSCRIBING_TOPIC")}return f(`subscribed values for key ${t}`),this._getLocal(e)}unsubscribe(e){const t=s.keyToTopic(e);return this._pubsub.removeListener(t,this._onMessage),this._pubsub.unsubscribe(t)}async _getLocal(e){const t=new i.Key("/"+s.encodeBase32(e),!1);let r;try{r=await this._datastore.get(t)}catch(e){if("ERR_NOT_FOUND"!==e.code){const e=`unexpected error getting the ipns record for ${t.toString()}`;throw f.error(e),l.default(new Error(e),"ERR_UNEXPECTED_ERROR_GETTING_RECORD")}const r=`local record requested was not found for ${t.toString()}`;throw f.error(r),l.default(new Error(r),"ERR_NOT_FOUND")}if(!(r instanceof Uint8Array)){const e="found record that we couldn't convert to a value";throw f.error(e),l.default(new Error(e),"ERR_INVALID_RECORD_RECEIVED")}return r}async _onMessage(e){const{data:t,from:r,topicIDs:i}=e;let n;try{n=s.topicToKey(i[0])}catch(e){return void f.error(e)}if(f(`message received for topic ${i[0]}`),r!==this._peerId.toB58String()){if(this._handleSubscriptionKeyFn){let e;try{e=await this._handleSubscriptionKeyFn(n)}catch(e){return void f.error("message discarded by the subscriptionKeyFn")}n=e}try{await this._storeIfSubscriptionIsBetter(n,t)}catch(e){f.error(e)}}else f("message discarded as it is from the same peer")}async _storeIfSubscriptionIsBetter(e,t){let r=!1;try{r=await this._isBetter(e,t)}catch(e){if("ERR_NOT_VALID_RECORD"!==e.code)throw e}r&&await this._storeRecord(e,t)}async _validateRecord(e,t){return this._validator.validate(e,t)}async _selectRecord(e,t){return 0===await this._validator.select(e,t)}async _isBetter(e,t){try{await this._validateRecord(t,e)}catch(e){const t="record received through pubsub is not valid";throw f.error(t),l.default(new Error(t),"ERR_NOT_VALID_RECORD")}const r=new i.Key(e);let n;try{n=await this._getLocal(r.uint8Array())}catch(e){return!0}return!o.equals(n,t)&&this._selectRecord(e,[n,t])}async _storeRecord(e,t){const r=new i.Key("/"+s.encodeBase32(e),!1);await this._datastore.put(r,t),f(`record for ${s.keyToTopic(e)} was stored in the datastore`)}}r.PubsubDatastore=h},{"interface-datastore":"1Ax6d","datastore-core":"bBniO","./utils.js":"gknfF","uint8arrays/equals":"eY3cX","err-code":"chZjB",debug:"bO5wM"}],"1Ax6d":[function(e,t,r){t.exports=e("./cjs/src/index.js")},{"./cjs/src/index.js":"Pvsek"}],Pvsek:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./key.js");r.Key=i.Key},{"./key.js":"9hGOz"}],bBniO:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./errors.js"),n=e("./shard.js"),s=e("./base.js"),o=e("./memory.js"),a=e("./keytransform.js"),c=e("./sharding.js"),u=e("./mount.js"),l=e("./tiered.js"),d=e("./namespace.js");const f={...i},h={...n};r.BaseDatastore=s.BaseDatastore,r.MemoryDatastore=o.MemoryDatastore,r.KeyTransformDatastore=a.KeyTransformDatastore,r.ShardingDatastore=c.ShardingDatastore,r.MountDatastore=u.MountDatastore,r.TieredDatastore=l.TieredDatastore,r.NamespaceDatastore=d.NamespaceDatastore,r.Errors=f,r.shard=h},{"./errors.js":"65M4b","./shard.js":"8UhNG","./base.js":"b5lsk","./memory.js":"farQr","./keytransform.js":"ipyDT","./sharding.js":"4n2YO","./mount.js":"bR1T2","./tiered.js":"5GeC7","./namespace.js":"ehQtO"}],"8UhNG":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("interface-datastore/key"),n=e("./shard-readme.js");const s="/repo/flatfs/shard/",o="SHARDING";class a{constructor(e){this.param=e,this.name="base",this._padding=""}fun(e){return"implement me"}toString(){return`${s}v1/${this.name}/${this.param}`}}class c extends a{constructor(e){super(e),this._padding="".padStart(e,"_"),this.name="prefix"}fun(e){return(e+this._padding).slice(0,this.param)}}class u extends a{constructor(e){super(e),this._padding="".padStart(e,"_"),this.name="suffix"}fun(e){const t=this._padding+e;return t.slice(t.length-this.param)}}class l extends a{constructor(e){super(e),this._padding="".padStart(e+1,"_"),this.name="next-to-last"}fun(e){const t=this._padding+e,r=t.length-this.param-1;return t.slice(r,r+this.param)}}function d(e){if(0===(e=e.trim()).length)throw new Error("empty shard string");if(!e.startsWith(s))throw new Error(`invalid or no path prefix: ${e}`);const t=e.slice(s.length).split("/"),r=t[0];if("v1"!==r)throw new Error(`expect 'v1' version, got '${r}'`);const i=t[1];if(!t[2])throw new Error("missing param");const n=parseInt(t[2],10);switch(i){case"prefix":return new c(n);case"suffix":return new u(n);case"next-to-last":return new l(n);default:throw new Error(`unkown sharding function: ${i}`)}}r.readme=n,r.NextToLast=l,r.PREFIX=s,r.Prefix=c,r.README_FN="_README",r.SHARDING_FN=o,r.ShardBase=a,r.Suffix=u,r.parseShardFun=d,r.readShardFun=async(e,t)=>{const r=new i.Key(e).child(new i.Key(o)),n="function"==typeof t.getRaw?t.getRaw.bind(t):t.get.bind(t),s=await n(r);return d((new TextDecoder).decode(s||"").trim())}},{"interface-datastore/key":"9hGOz","./shard-readme.js":"hm1kE"}],hm1kE:[function(e,t,r){"use strict";t.exports="This is a repository of IPLD objects. Each IPLD object is in a single file,\nnamed <base32 encoding of cid>.data. Where <base32 encoding of cid> is the\n\"base32\" encoding of the CID (as specified in\nhttps://github.com/multiformats/multibase) without the 'B' prefix.\nAll the object files are placed in a tree of directories, based on a\nfunction of the CID. This is a form of sharding similar to\nthe objects directory in git repositories. Previously, we used\nprefixes, we now use the next-to-last two charters.\n func NextToLast(base32cid string) {\n nextToLastLen := 2\n offset := len(base32cid) - nextToLastLen - 1\n return str[offset : offset+nextToLastLen]\n }\nFor example, an object with a base58 CIDv1 of\n zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f\nhas a base32 CIDv1 of\n BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA\nand will be placed at\n SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data\nwith 'SC' being the last-to-next two characters and the 'B' at the\nbeginning of the CIDv1 string is the multibase prefix that is not\nstored in the filename.\n"},{}],farQr:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./base.js"),n=e("interface-datastore/key"),s=e("./errors.js");class o extends i.BaseDatastore{constructor(){super(),this.data={}}open(){return Promise.resolve()}close(){return Promise.resolve()}async put(e,t){this.data[e.toString()]=t}async get(e){if(!await this.has(e))throw s.notFoundError();return this.data[e.toString()]}async has(e){return void 0!==this.data[e.toString()]}async delete(e){delete this.data[e.toString()]}async*_all(){yield*Object.entries(this.data).map((([e,t])=>({key:new n.Key(e),value:t})))}async*_allKeys(){yield*Object.entries(this.data).map((([e])=>new n.Key(e)))}}r.MemoryDatastore=o},{"./base.js":"b5lsk","interface-datastore/key":"9hGOz","./errors.js":"65M4b"}],ipyDT:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./base.js"),n=e("it-map"),s=e("it-pipe");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(n);class c extends i.BaseDatastore{constructor(e,t){super(),this.child=e,this.transform=t}open(){return this.child.open()}put(e,t,r){return this.child.put(this.transform.convert(e),t,r)}get(e,t){return this.child.get(this.transform.convert(e),t)}has(e,t){return this.child.has(this.transform.convert(e),t)}delete(e,t){return this.child.delete(this.transform.convert(e),t)}async*putMany(e,t={}){const r=this.transform,i=this.child;yield*s.pipe(e,(async function*(e){yield*a.default(e,(({key:e,value:t})=>({key:r.convert(e),value:t})))}),(async function*(e){yield*i.putMany(e,t)}),(async function*(e){yield*a.default(e,(({key:e,value:t})=>({key:r.invert(e),value:t})))}))}async*getMany(e,t={}){const r=this.transform,i=this.child;yield*s.pipe(e,(async function*(e){yield*a.default(e,(e=>r.convert(e)))}),(async function*(e){yield*i.getMany(e,t)}))}async*deleteMany(e,t={}){const r=this.transform,i=this.child;yield*s.pipe(e,(async function*(e){yield*a.default(e,(e=>r.convert(e)))}),(async function*(e){yield*i.deleteMany(e,t)}),(async function*(e){yield*a.default(e,(e=>r.invert(e)))}))}batch(){const e=this.child.batch();return{put:(t,r)=>{e.put(this.transform.convert(t),r)},delete:t=>{e.delete(this.transform.convert(t))},commit:t=>e.commit(t)}}query(e,t){return a.default(this.child.query(e,t),(({key:e,value:t})=>({key:this.transform.invert(e),value:t})))}queryKeys(e,t){return a.default(this.child.queryKeys(e,t),(e=>this.transform.invert(e)))}close(){return this.child.close()}}r.KeyTransformDatastore=c},{"./base.js":"b5lsk","it-map":"eeqPk","it-pipe":"giKBQ"}],eeqPk:[function(e,t,r){"use strict";t.exports=async function*(e,t){for await(const r of e)yield t(r)}},{}],giKBQ:[function(e,t,r){const i=(...e)=>{let t;for(;e.length;)t=e.shift()(t);return t},n=e=>e&&("function"==typeof e[Symbol.asyncIterator]||"function"==typeof e[Symbol.iterator]||"function"==typeof e.next),s=e=>e&&"function"==typeof e.sink&&n(e.source),o=e=>t=>(e.sink(t),e.source),a=(...e)=>{if(s(e[0])){const t=e[0];e[0]=()=>t.source}else if(n(e[0])){const t=e[0];e[0]=()=>t}if(e.length>1&&s(e[e.length-1])&&(e[e.length-1]=e[e.length-1].sink),e.length>2)for(let t=1;t<e.length-1;t++)s(e[t])&&(e[t]=o(e[t]));return i(...e)};t.exports=a,t.exports.pipe=a,t.exports.rawPipe=i,t.exports.isIterable=n,t.exports.isDuplex=s},{}],"4n2YO":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("interface-datastore"),n=e("./shard.js"),s=e("./base.js"),o=e("./keytransform.js"),a=e("./errors.js"),c=e("./shard-readme.js");const u=new i.Key(n.SHARDING_FN),l=new i.Key(n.README_FN);class d extends s.BaseDatastore{constructor(e,t){super(),this.child=new o.KeyTransformDatastore(e,{convert:this._convertKey.bind(this),invert:this._invertKey.bind(this)}),this.shard=t}async open(){await this.child.open(),this.shard=await d.create(this.child,this.shard)}_convertKey(e){const t=e.toString();if(t===u.toString()||t===l.toString())return e;return new i.Key(this.shard.fun(t)).child(e)}_invertKey(e){const t=e.toString();return t===u.toString()||t===l.toString()?e:i.Key.withNamespaces(e.list().slice(1))}static async createOrOpen(e,t){try{await d.create(e,t)}catch(e){if(e&&"datastore exists"!==e.message)throw e}return d.open(e)}static async open(e){const t=await n.readShardFun("/",e);return new d(e,t)}static async create(e,t){const r=await e.has(u);if(!r&&!t)throw a.dbOpenFailedError(Error("Shard is required when datastore doesn't have a shard key already."));if(!r){const r="function"==typeof e.putRaw?e.putRaw.bind(e):e.put.bind(e);return await Promise.all([r(u,(new TextEncoder).encode(t.toString()+"\n")),r(l,(new TextEncoder).encode(c))]),t}const i=await n.readShardFun("/",e),s=(i||"").toString(),o=t.toString();if(s!==o)throw new Error(`specified fun ${o} does not match repo shard fun ${s}`);return i}put(e,t,r){return this.child.put(e,t,r)}get(e,t){return this.child.get(e,t)}has(e,t){return this.child.has(e,t)}delete(e,t){return this.child.delete(e,t)}async*putMany(e,t={}){yield*this.child.putMany(e,t)}async*getMany(e,t={}){yield*this.child.getMany(e,t)}async*deleteMany(e,t={}){yield*this.child.deleteMany(e,t)}batch(){return this.child.batch()}query(e,t){const r={offset:e.offset,limit:e.limit,orders:[],filters:[e=>e.key.toString()!==u.toString(),e=>e.key.toString()!==l.toString()]},{prefix:i}=e;if(null!=i&&r.filters.push((e=>this._invertKey(e.key).toString().startsWith(i))),null!=e.filters){const t=e.filters.map((e=>({key:t,value:r})=>e({key:this._invertKey(t),value:r})));r.filters=r.filters.concat(t)}return null!=e.orders&&(r.orders=e.orders.map((e=>(t,r)=>e({key:this._invertKey(t.key),value:t.value},{key:this._invertKey(r.key),value:r.value})))),this.child.query(r,t)}queryKeys(e,t){const r={offset:e.offset,limit:e.limit,orders:[],filters:[e=>e.toString()!==u.toString(),e=>e.toString()!==l.toString()]},{prefix:i}=e;if(null!=i&&r.filters.push((e=>this._invertKey(e).toString().startsWith(i))),null!=e.filters){const t=e.filters.map((e=>t=>e(this._invertKey(t))));r.filters=r.filters.concat(t)}return null!=e.orders&&(r.orders=e.orders.map((e=>(t,r)=>e(this._invertKey(t),this._invertKey(r))))),this.child.queryKeys(r,t)}close(){return this.child.close()}}r.ShardingDatastore=d},{"interface-datastore":"1Ax6d","./shard.js":"8UhNG","./base.js":"b5lsk","./keytransform.js":"ipyDT","./errors.js":"65M4b","./shard-readme.js":"hm1kE"}],bR1T2:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("it-filter"),n=e("it-take"),s=e("it-merge"),o=e("./base.js"),a=e("./keytransform.js"),c=e("./errors.js"),u=e("./utils.js"),l=e("interface-datastore/key");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=d(i),h=d(n),p=d(s);class g extends o.BaseDatastore{constructor(e){super(),this.mounts=e.slice()}async open(){await Promise.all(this.mounts.map((e=>e.datastore.open())))}_lookup(e){for(const t of this.mounts)if(t.prefix.toString()===e.toString()||t.prefix.isAncestorOf(e)){const r=u.replaceStartWith(e.toString(),t.prefix.toString());return{datastore:t.datastore,mountpoint:t.prefix,rest:new l.Key(r)}}}put(e,t,r){const i=this._lookup(e);if(null==i)throw c.dbWriteFailedError(new Error("No datastore mounted for this key"));return i.datastore.put(i.rest,t,r)}get(e,t){const r=this._lookup(e);if(null==r)throw c.notFoundError(new Error("No datastore mounted for this key"));return r.datastore.get(r.rest,t)}has(e,t){const r=this._lookup(e);return null==r?Promise.resolve(!1):r.datastore.has(r.rest,t)}delete(e,t){const r=this._lookup(e);if(null==r)throw c.dbDeleteFailedError(new Error("No datastore mounted for this key"));return r.datastore.delete(r.rest,t)}async close(){await Promise.all(this.mounts.map((e=>e.datastore.close())))}batch(){const e={},t=t=>{const r=this._lookup(t);if(null==r)throw new Error("No datastore mounted for this key");const i=r.mountpoint.toString();return null==e[i]&&(e[i]=r.datastore.batch()),{batch:e[i],rest:r.rest}};return{put:(e,r)=>{const i=t(e);i.batch.put(i.rest,r)},delete:e=>{const r=t(e);r.batch.delete(r.rest)},commit:async t=>{await Promise.all(Object.keys(e).map((r=>e[r].commit(t))))}}}query(e,t){const r=this.mounts.map((r=>{const i=new a.KeyTransformDatastore(r.datastore,{convert:e=>{throw new Error("should never be called")},invert:e=>r.prefix.child(e)});let n;return null!=e.prefix&&(n=u.replaceStartWith(e.prefix,r.prefix.toString())),i.query({prefix:n,filters:e.filters},t)}));let i=p.default(...r);if(e.filters&&e.filters.forEach((e=>{i=f.default(i,e)})),e.orders&&e.orders.forEach((e=>{i=u.sortAll(i,e)})),null!=e.offset){let t=0;i=f.default(i,(()=>t++>=e.offset))}return null!=e.limit&&(i=h.default(i,e.limit)),i}queryKeys(e,t){const r=this.mounts.map((r=>{const i=new a.KeyTransformDatastore(r.datastore,{convert:e=>{throw new Error("should never be called")},invert:e=>r.prefix.child(e)});let n;return null!=e.prefix&&(n=u.replaceStartWith(e.prefix,r.prefix.toString())),i.queryKeys({prefix:n,filters:e.filters},t)}));let i=p.default(...r);if(e.filters&&e.filters.forEach((e=>{i=f.default(i,e)})),e.orders&&e.orders.forEach((e=>{i=u.sortAll(i,e)})),null!=e.offset){let t=0;i=f.default(i,(()=>t++>=e.offset))}return null!=e.limit&&(i=h.default(i,e.limit)),i}}r.MountDatastore=g},{"it-filter":"5LCTL","it-take":"gxr1t","it-merge":"cPFu3","./base.js":"b5lsk","./keytransform.js":"ipyDT","./errors.js":"65M4b","./utils.js":"hJ8tG","interface-datastore/key":"9hGOz"}],cPFu3:[function(e,t,r){"use strict";const i=e("it-pushable");t.exports=async function*(...e){const t=i();setTimeout((async()=>{try{await Promise.all(e.map((async e=>{for await(const r of e)t.push(r)}))),t.end()}catch(e){t.end(e)}}),0),yield*t}},{"it-pushable":"bnpei"}],ehQtO:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("interface-datastore"),n=e("./keytransform.js");class s extends n.KeyTransformDatastore{constructor(e,t){super(e,{convert:e=>t.child(e),invert(e){if("/"===t.toString())return e;if(!t.isAncestorOf(e))throw new Error(`Expected prefix: (${t.toString()}) in key: ${e.toString()}`);return new i.Key(e.toString().slice(t.toString().length),!1)}}),this.prefix=t}query(e,t){return e.prefix&&"/"!==this.prefix.toString()?super.query(Object.assign({},e,{prefix:this.prefix.child(new i.Key(e.prefix)).toString()})):super.query(e,t)}queryKeys(e,t){return e.prefix&&"/"!==this.prefix.toString()?super.queryKeys(Object.assign({},e,{prefix:this.prefix.child(new i.Key(e.prefix)).toString()})):super.queryKeys(e,t)}}r.NamespaceDatastore=s},{"interface-datastore":"1Ax6d","./keytransform.js":"ipyDT"}],gknfF:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("err-code"),n=e("uint8arrays/to-string"),s=e("uint8arrays/from-string");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(i);const c="/record/";r.encodeBase32=function(e){return n.toString(e,"base32")},r.keyToTopic=function(e){return("string"==typeof e||e instanceof String)&&(e=s.fromString(e.toString())),`/record/${n.toString(e,"base64url")}`},r.topicToKey=function(e){if(e.substring(0,c.length)!==c)throw a.default(new Error("topic received is not from a record"),"ERR_TOPIC_IS_NOT_FROM_RECORD_NAMESPACE");const t=e.substring(c.length);return s.fromString(t,"base64url")}},{"err-code":"chZjB","uint8arrays/to-string":"hC8JB","uint8arrays/from-string":"dF7Y4"}],a4pYc:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("interface-datastore/key"),n=e("libp2p-record"),s=e("err-code"),o=e("debug"),a=e("uint8arrays/to-string");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(s),l=c(o);const d=Object.assign(l.default("ipfs:ipns:offline-datastore"),{error:l.default("ipfs:ipns:offline-datastore:error")});r.OfflineDatastore=class{constructor(e){this._repo=e,this.stores=[]}async put(e,t){if(!(e instanceof Uint8Array))throw u.default(new Error("Offline datastore key must be a Uint8Array"),"ERR_INVALID_KEY");if(!(t instanceof Uint8Array))throw u.default(new Error("Offline datastore value must be a Uint8Array"),"ERR_INVALID_VALUE");let r;try{r=this._routingKey(e)}catch(e){throw d.error(e),u.default(new Error("Not possible to generate the routing key"),"ERR_GENERATING_ROUTING_KEY")}const i=new n.Record(e,t);return this._repo.datastore.put(r,i.serialize())}async get(e){if(!(e instanceof Uint8Array))throw u.default(new Error("Offline datastore key must be a Uint8Array"),"ERR_INVALID_KEY");let t;try{t=this._routingKey(e)}catch(e){throw d.error(e),u.default(new Error("Not possible to generate the routing key"),"ERR_GENERATING_ROUTING_KEY")}const r=await this._repo.datastore.get(t);let i;try{i=n.Record.deserialize(r)}catch(e){throw d.error(e),e}return i.value}_routingKey(e){return new i.Key("/"+a.toString(e,"base32upper"),!1)}}},{"interface-datastore/key":"9hGOz","libp2p-record":"h5gPS","err-code":"chZjB",debug:"bO5wM","uint8arrays/to-string":"hC8JB"}],h5gPS:[function(e,t,r){"use strict";t.exports={Record:e("./record"),validator:e("./validator"),selection:e("./selection")}},{"./record":"f8iqI","./validator":"kylm1","./selection":"3s68T"}],f8iqI:[function(e,t,r){"use strict";const{Record:i}=e("./record"),n=e("../utils");class s{constructor(e,t,r){if(!(e instanceof Uint8Array))throw new Error("key must be a Uint8Array");if(!(t instanceof Uint8Array))throw new Error("value must be a Uint8Array");this.key=e,this.value=t,this.timeReceived=r}serialize(){return i.encode(this.prepareSerialize()).finish()}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:this.timeReceived&&n.toRFC3339(this.timeReceived)}}static deserialize(e){const t=i.decode(e);return s.fromDeserialized(i.toObject(t,{defaults:!1,arrays:!0,longs:Number,objects:!1}))}static fromDeserialized(e){let t;e.timeReceived&&(t=n.parseRFC3339(e.timeReceived));return new s(e.key,e.value,t)}}t.exports=s},{"./record":"gqFCN","../utils":"fHufu"}],gqFCN:[function(e,t,r){"use strict";var i=e("protobufjs/minimal"),n=i.Reader,s=i.Writer,o=i.util,a=i.roots["libp2p-record"]||(i.roots["libp2p-record"]={});a.Record=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.key=o.newBuffer([]),e.prototype.value=o.newBuffer([]),e.prototype.timeReceived="",e.encode=function(e,t){return t||(t=s.create()),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(10).bytes(e.key),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&t.uint32(18).bytes(e.value),null!=e.timeReceived&&Object.hasOwnProperty.call(e,"timeReceived")&&t.uint32(42).string(e.timeReceived),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.Record;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.key=e.bytes();break;case 2:i.value=e.bytes();break;case 5:i.timeReceived=e.string();break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.Record)return e;var t=new a.Record;return null!=e.key&&("string"==typeof e.key?o.base64.decode(e.key,t.key=o.newBuffer(o.base64.length(e.key)),0):e.key.length&&(t.key=e.key)),null!=e.value&&("string"==typeof e.value?o.base64.decode(e.value,t.value=o.newBuffer(o.base64.length(e.value)),0):e.value.length&&(t.value=e.value)),null!=e.timeReceived&&(t.timeReceived=String(e.timeReceived)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.key="":(r.key=[],t.bytes!==Array&&(r.key=o.newBuffer(r.key))),t.bytes===String?r.value="":(r.value=[],t.bytes!==Array&&(r.value=o.newBuffer(r.value))),r.timeReceived=""),null!=e.key&&e.hasOwnProperty("key")&&(r.key=t.bytes===String?o.base64.encode(e.key,0,e.key.length):t.bytes===Array?Array.prototype.slice.call(e.key):e.key),null!=e.value&&e.hasOwnProperty("value")&&(r.value=t.bytes===String?o.base64.encode(e.value,0,e.value.length):t.bytes===Array?Array.prototype.slice.call(e.value):e.value),null!=e.timeReceived&&e.hasOwnProperty("timeReceived")&&(r.timeReceived=e.timeReceived),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),t.exports=a},{"protobufjs/minimal":"grAXL"}],fHufu:[function(e,t,r){"use strict";t.exports.toRFC3339=e=>`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,"0")}-${String(e.getUTCDate()).padStart(2,"0")}T${String(e.getUTCHours()).padStart(2,"0")}:${String(e.getUTCMinutes()).padStart(2,"0")}:${String(e.getUTCSeconds()).padStart(2,"0")}.${1e6*e.getUTCMilliseconds()}Z`,t.exports.parseRFC3339=e=>{const t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),r=String(e).trim().match(t);if(!r)throw new Error("Invalid format");const i=parseInt(r[1],10),n=parseInt(r[2],10)-1,s=parseInt(r[3],10),o=parseInt(r[4],10),a=parseInt(r[5],10),c=parseInt(r[6],10),u=parseInt(r[7].slice(0,-6),10);return new Date(Date.UTC(i,n,s,o,a,c,u))}},{}],kylm1:[function(e,t,r){"use strict";const i=e("err-code"),{toString:n}=e("uint8arrays/to-string");t.exports={verifyRecord:(e,t)=>{const r=t.key,s=n(r).split("/");if(s.length<3)return;const o=e[s[1].toString()];if(!o){throw i(new Error("Invalid record keytype"),"ERR_INVALID_RECORD_KEY_TYPE")}return o.func(r,t.value)},validators:e("./validators")}},{"err-code":"chZjB","uint8arrays/to-string":"hC8JB","./validators":"ga6xf"}],ga6xf:[function(e,t,r){"use strict";t.exports={pk:e("./public-key")}},{"./public-key":"dJySP"}],dJySP:[function(e,t,r){"use strict";const{sha256:i}=e("multiformats/hashes/sha2"),n=e("err-code"),{toString:s}=e("uint8arrays/to-string"),{equals:o}=e("uint8arrays/equals");t.exports={func:async(e,t)=>{if(!(e instanceof Uint8Array))throw n(new Error('"key" must be a Uint8Array'),"ERR_INVALID_RECORD_KEY_NOT_BUFFER");if(e.byteLength<5)throw n(new Error("invalid public key record"),"ERR_INVALID_RECORD_KEY_TOO_SHORT");if("/pk/"!==s(e.subarray(0,4)))throw n(new Error("key was not prefixed with /pk/"),"ERR_INVALID_RECORD_KEY_BAD_PREFIX");const r=e.slice(4),a=await i.digest(t);if(!o(r,a.bytes))throw n(new Error("public key does not match passed in key"),"ERR_INVALID_RECORD_HASH_MISMATCH")},sign:!1}},{"multiformats/hashes/sha2":"7i9MT","err-code":"chZjB","uint8arrays/to-string":"hC8JB","uint8arrays/equals":"eY3cX"}],"3s68T":[function(e,t,r){"use strict";const i=e("err-code"),{toString:n}=e("uint8arrays/to-string");t.exports={bestRecord:(e,t,r)=>{if(0===r.length){throw i(new Error("No records given"),"ERR_NO_RECORDS_RECEIVED")}const s=n(t).split("/");if(s.length<3){throw i(new Error("Record key does not have a selector function"),"ERR_NO_SELECTOR_FUNCTION_FOR_RECORD_KEY")}const o=e[s[1].toString()];if(!o){const e=`Unrecognized key prefix: ${s[1]}`;throw i(new Error(e),"ERR_UNRECOGNIZED_KEY_PREFIX")}return 1===r.length?0:o(t,r)},selectors:e("./selectors")}},{"err-code":"chZjB","uint8arrays/to-string":"hC8JB","./selectors":"haGf8"}],haGf8:[function(e,t,r){"use strict";t.exports={pk:e("./public-key")}},{"./public-key":"19IEy"}],"19IEy":[function(e,t,r){"use strict";t.exports=(e,t)=>0},{}],u6g6o:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./publish.js"),n=e("./resolve.js"),s=e("./pubsub/index.js");r.NameAPI=class{constructor({dns:e,ipns:t,repo:r,codecs:o,peerId:a,isOnline:c,keychain:u,options:l}){this.publish=i.createPublish({ipns:t,repo:r,codecs:o,peerId:a,isOnline:c,keychain:u}),this.resolve=n.createResolve({dns:e,ipns:t,peerId:a,isOnline:c,options:l}),this.pubsub=new s.PubSubAPI({ipns:t,options:l})}}},{"./publish.js":"dpWDc","./resolve.js":"cm25d","./pubsub/index.js":"bgTzj"}],dpWDc:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("debug"),n=e("parse-duration"),s=e("libp2p-crypto"),o=e("err-code"),a=e("uint8arrays/from-string"),c=e("uint8arrays/to-string"),u=e("../../utils.js"),l=e("ipfs-core-utils/with-timeout-option"),d=e("./utils.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=f(i),p=f(n),g=f(s),y=f(o);const m=Object.assign(h.default("ipfs:name:publish"),{error:h.default("ipfs:name:publish:error")});r.createPublish=function({ipns:e,repo:t,codecs:r,peerId:i,isOnline:n,keychain:s}){const o=async e=>{if("self"===e)return i.privKey;try{const t=await s.exportKey(e,"temp");return await g.default.keys.import(t,"temp")}catch(e){throw m.error(e),y.default(e,"ERR_CANNOT_GET_KEY")}};return l.withTimeoutOption((async function(i,s={}){const l=!(!1===s.resolve),f=s.lifetime||"24h",h=s.key||"self";if(!n())throw y.default(new Error(u.OFFLINE_ERROR),"OFFLINE_ERROR");try{i=u.normalizePath(i)}catch(e){throw m.error(e),e}let g=0;try{g=p.default(f)||0,g=parseFloat(g.toFixed(6))}catch(e){throw m.error(e),e}const b=await Promise.all([o(h),l?d.resolvePath({ipns:e,repo:t,codecs:r},i):Promise.resolve()]),v=a.fromString(i),w=await e.publish(b[0],v,g);return{name:w.name,value:c.toString(w.value)}}))}},{debug:"bO5wM","parse-duration":"fGYtw","libp2p-crypto":"bb1cb","err-code":"chZjB","uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB","../../utils.js":"cT4uN","ipfs-core-utils/with-timeout-option":"j29MK","./utils.js":"3TaO8"}],"3TaO8":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("is-ipfs"),n=e("ipfs-core-utils/to-cid-and-path"),s=e("it-drain"),o=e("../../utils.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(i),u=a(s);r.resolvePath=async function({ipns:e,repo:t,codecs:r},i,s){if(c.default.ipnsPath(i))return e.resolve(i);const{cid:a,path:l}=n.toCidAndPath(i);await u.default(o.resolve(a,l||"",r,t,s))}},{"is-ipfs":"40iuV","ipfs-core-utils/to-cid-and-path":"jN5CZ","it-drain":"dKYhO","../../utils.js":"cT4uN"}],cm25d:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("debug"),n=e("err-code"),s=e("merge-options"),o=e("multiformats/cid"),a=e("peer-id"),c=e("is-domain-name"),u=e("uint8arrays/to-string"),l=e("../../utils.js"),d=e("ipfs-core-utils/with-timeout-option");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=f(i),p=f(n),g=f(s),y=f(a),m=f(c);const b=g.default.bind({ignoreUndefined:!0}),v=Object.assign(h.default("ipfs:name:resolve"),{error:h.default("ipfs:name:resolve:error")}),w=(e,t)=>t.length>0?e+"/"+t.join("/"):e;r.createResolve=function({dns:e,ipns:t,peerId:r,isOnline:i,options:{offline:n}}){return d.withTimeoutOption((async function*(s,a={}){if(a=b({nocache:!1,recursive:!0},a),n&&a&&a.nocache)throw p.default(new Error("cannot specify both offline and nocache"),"ERR_NOCACHE_AND_OFFLINE");s||(s=r.toB58String()),s.startsWith("/ipns/")||(s=`/ipns/${s}`);const[c,d,...f]=s.slice(1).split("/");try{"1"===d.substring(0,1)?y.default.parse(d):o.CID.parse(d)}catch(t){if(m.default(d))return void(yield w(await e(d,a),f));throw v.error(t),p.default(new Error("Invalid IPNS name"),"ERR_IPNS_INVALID_NAME")}if(!i()&&!n)throw p.default(new Error(l.OFFLINE_ERROR),"OFFLINE_ERROR");const h=await t.resolve(`/${c}/${d}`,a);yield w(h instanceof Uint8Array?u.toString(h):h,f)}))}},{debug:"bO5wM","err-code":"chZjB","merge-options":"fupyv","multiformats/cid":"9ooAY","peer-id":"8Bdb3","is-domain-name":"4dpQa","uint8arrays/to-string":"hC8JB","../../utils.js":"cT4uN","ipfs-core-utils/with-timeout-option":"j29MK"}],"4dpQa":[function(e,t,r){"use strict";var i=/^(?:[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?\.){0,126}(?:[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9]))\.?$/i;t.exports=function(e,t){if(null==t&&(t=!1),e.length<2)return!1;if(e.length>255)return!1;var r=e[e.length-1];if(t){if("."!==r)return!1}else if("."===r)return!1;return i.test(e)}},{}],bgTzj:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./cancel.js"),n=e("./state.js"),s=e("./subs.js");r.PubSubAPI=class{constructor({ipns:e,options:t}){this.cancel=i.createCancel({ipns:e,options:t}),this.state=n.createState({ipns:e,options:t}),this.subs=s.createSubs({ipns:e,options:t})}}},{"./cancel.js":"hASEG","./state.js":"fAkSl","./subs.js":"ctElw"}],hASEG:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils.js"),n=e("ipfs-core-utils/with-timeout-option");r.createCancel=function({ipns:e,options:t}){const r=t.EXPERIMENTAL;return n.withTimeoutOption((async function(t,n={}){return i.getPubsubRouting(e,r).cancel(t,n)}))}},{"./utils.js":"aACl9","ipfs-core-utils/with-timeout-option":"j29MK"}],aACl9:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../../ipns/routing/pubsub-datastore.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e("err-code"));r.getPubsubRouting=function(e,t){if(!e||!t||!t.ipnsPubsub)throw s.default(new Error("IPNS pubsub subsystem is not enabled"),"ERR_IPNS_PUBSUB_NOT_ENABLED");if(e.routing instanceof i.IpnsPubsubDatastore)return e.routing;const r=(e.routing.stores||[]).find((e=>e instanceof i.IpnsPubsubDatastore));if(!r)throw s.default(new Error("IPNS pubsub datastore not found"),"ERR_PUBSUB_DATASTORE_NOT_FOUND");return r}},{"../../../ipns/routing/pubsub-datastore.js":"3XRQz","err-code":"chZjB"}],fAkSl:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils.js"),n=e("ipfs-core-utils/with-timeout-option");r.createState=function({ipns:e,options:t}){const r=t.EXPERIMENTAL;return n.withTimeoutOption((async function(t={}){try{return{enabled:Boolean(i.getPubsubRouting(e,r))}}catch(e){return{enabled:!1}}}))}},{"./utils.js":"aACl9","ipfs-core-utils/with-timeout-option":"j29MK"}],ctElw:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils.js"),n=e("ipfs-core-utils/with-timeout-option");r.createSubs=function({ipns:e,options:t}){const r=t.EXPERIMENTAL;return n.withTimeoutOption((async function(t={}){return i.getPubsubRouting(e,r).getSubscriptions(t)}))}},{"./utils.js":"aACl9","ipfs-core-utils/with-timeout-option":"j29MK"}],"9Y9Id":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@ipld/dag-pb"),n=e("datastore-core/errors"),s=e("ipfs-core-utils/to-cid-and-path"),o=e("multiformats/cid"),a=e("timeout-abort-controller"),c=e("any-signal");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var d=l(i),f=u(a);const h=n.notFoundError().code,p={default:"<dst>",edges:"<src> -> <dst>"};async function*g(e,t,r,i,n){const o=await e(i,n),{cid:a}=s.toCidAndPath(o),c=null!=n.maxDepth?n.maxDepth:1/0,u=n.unique||!1;for await(const e of async function*(e,t,r,i,n,s){const o=new Set;async function*a(r,c){const u=c+1;if(!(u>i))try{for await(const i of async function*(e,t,r,i){const n=await e.blocks.get(r,i),s=(await t.getCodec(r.code)).decode(n),o=r.code===d.code,a=[];for(const[e,t]of m(s,a)){if(o){const r=e.match(/^Links\/(\d+)\/Hash$/);if(r){const e=Number(r[1]);if(e<s.Links.length){yield{name:s.Links[e].Name,cid:t};continue}}}yield{name:e,cid:t}}}(e,t,r.cid,s))yield{parent:r,node:i,isDuplicate:n&&o.has(i.cid.toString())},n&&o.add(i.cid.toString()),yield*a(i,u)}catch(e){throw e.code===h&&(e.message=`Could not find object with CID: ${r.cid}`),e}}yield*a({cid:r},0)}(t,r,a,c,u,n))e.parent&&(e.isDuplicate||(yield{ref:y(e.parent.cid,e.node.cid,e.node.name,n.format)}))}function y(e,t,r="",i=p.default){let n=i.replace(/<src>/g,e.toString());return n=n.replace(/<dst>/g,t.toString()),n=n.replace(/<linkname>/g,r),n}const m=function*(e,t){if(null!=e&&!(e instanceof Uint8Array)){for(const[r,i]of Object.entries(e)){const e=[...t,r];if(null!=i&&"object"==typeof i)if(Array.isArray(i))for(const[t,r]of i.entries()){const i=[...e,t],n=o.CID.asCID(r);n?yield[i.join("/"),n]:"object"==typeof r&&(yield*m(r,i))}else{const t=o.CID.asCID(i);t?yield[e.join("/"),t]:yield*m(i,e)}}return[]}};r.Format=p,r.createRefs=function({repo:e,codecs:t,resolve:r,preload:i}){return async function*(n,o={}){if(0===o.maxDepth)return;if(o.edges&&o.format&&o.format!==p.default)throw new Error("Cannot set edges to true and also specify format");if(o.format=o.edges?p.edges:o.format,"number"!=typeof o.maxDepth&&(o.maxDepth=o.recursive?1/0:1),o.timeout){const e=new f.default(o.timeout);o.signal=c.anySignal([o.signal,e.signal])}const a=(Array.isArray(n)?n:[n]).map((e=>function(e,t,r){const{cid:i,path:n}=s.toCidAndPath(t);!1!==r.preload&&e(i);return`/ipfs/${i}${n||""}`}(i,e,o)));for(const i of a)try{yield*g(r,e,t,i,o)}catch(e){yield{ref:"",err:e.message}}}}},{"@ipld/dag-pb":"i2cdx","datastore-core/errors":"65M4b","ipfs-core-utils/to-cid-and-path":"jN5CZ","multiformats/cid":"9ooAY","timeout-abort-controller":"hzClg","any-signal":"kXgRR"}],lEaxs:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createLocal=function({repo:e}){return i.withTimeoutOption((async function*(t={}){for await(const r of e.blocks.queryKeys({},{signal:t.signal}))yield{ref:r.toString()}}))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],lGDjO:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./wantlist.js"),n=e("./wantlist-for-peer.js"),s=e("./unwant.js"),o=e("./stat.js");r.BitswapAPI=class{constructor({network:e}){this.wantlist=i.createWantlist({network:e}),this.wantlistForPeer=n.createWantlistForPeer({network:e}),this.unwant=s.createUnwant({network:e}),this.stat=o.createStat({network:e})}}},{"./wantlist.js":"1ob69","./wantlist-for-peer.js":"7Z7Yb","./unwant.js":"iRgR3","./stat.js":"aHPBA"}],"1ob69":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createWantlist=function({network:e}){return i.withTimeoutOption((async function(t={}){const{bitswap:r}=await e.use(t),i=r.getWantlist();return Array.from(i).map((e=>e[1].cid))}))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],"7Z7Yb":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("peer-id"),n=e("ipfs-core-utils/with-timeout-option");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(i);r.createWantlistForPeer=function({network:e}){return n.withTimeoutOption((async function(t,r={}){const{bitswap:i}=await e.use(r),n=i.wantlistForPeer(o.default.createFromB58String(t));return Array.from(n).map((e=>e[1].cid))}))}},{"peer-id":"8Bdb3","ipfs-core-utils/with-timeout-option":"j29MK"}],iRgR3:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createUnwant=function({network:e}){return i.withTimeoutOption((async function(t,r={}){const{bitswap:i}=await e.use(r);return Array.isArray(t)||(t=[t]),i.unwant(t)}))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],aHPBA:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createStat=function({network:e}){return i.withTimeoutOption((async function(t={}){const r=(await e.use(t)).bitswap,i=r.stat().snapshot;return{provideBufLen:parseInt(i.providesBufferLength.toString()),blocksReceived:BigInt(i.blocksReceived.toString()),wantlist:Array.from(r.getWantlist()).map((e=>e[1].cid)),peers:r.peers().map((e=>e.toB58String())),dupBlksReceived:BigInt(i.dupBlksReceived.toString()),dupDataReceived:BigInt(i.dupDataReceived.toString()),dataReceived:BigInt(i.dataReceived.toString()),blocksSent:BigInt(i.blocksSent.toString()),dataSent:BigInt(i.dataSent.toString())}}))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],dh9oy:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./add.js"),n=e("./clear.js"),s=e("./list.js"),o=e("./reset.js"),a=e("./rm.js");r.BootstrapAPI=class{constructor({repo:e}){this.add=i.createAdd({repo:e}),this.list=s.createList({repo:e}),this.rm=a.createRm({repo:e}),this.clear=n.createClear({repo:e}),this.reset=o.createReset({repo:e})}}},{"./add.js":"8FDCZ","./clear.js":"jEuP0","./list.js":"gZN1y","./reset.js":"1bIlT","./rm.js":"kncM8"}],"8FDCZ":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils.js"),n=e("ipfs-core-utils/with-timeout-option");r.createAdd=function({repo:e}){return n.withTimeoutOption((async function(t,r={}){if(!i.isValidMultiaddr(t))throw new Error(`${t} is not a valid Multiaddr`);const n=await e.config.getAll(r),s=n.Bootstrap||[];return s.push(t.toString()),n.Bootstrap=Array.from(new Set(s)).sort(((e,t)=>e.localeCompare(t))),await e.config.replace(n),{Peers:[t]}}))}},{"./utils.js":"60F3o","ipfs-core-utils/with-timeout-option":"j29MK"}],"60F3o":[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("mafmt"));r.isValidMultiaddr=function(e){try{return n.default.IPFS.matches(e)}catch(e){return!1}}},{mafmt:"l1lok"}],jEuP0:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option"),n=e("multiaddr");r.createClear=function({repo:e}){return i.withTimeoutOption((async function(t={}){const r=await e.config.getAll(t),i=r.Bootstrap||[];return r.Bootstrap=[],await e.config.replace(r),{Peers:i.map((e=>new n.Multiaddr(e)))}}))}},{"ipfs-core-utils/with-timeout-option":"j29MK",multiaddr:"8Mu1u"}],gZN1y:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option"),n=e("multiaddr");r.createList=function({repo:e}){return i.withTimeoutOption((async function(t={}){return{Peers:(await e.config.get("Bootstrap",t)||[]).map((e=>new n.Multiaddr(e)))}}))}},{"ipfs-core-utils/with-timeout-option":"j29MK",multiaddr:"8Mu1u"}],"1bIlT":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-config/config"),n=e("ipfs-core-utils/with-timeout-option"),s=e("multiaddr");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(i);r.createReset=function({repo:e}){return n.withTimeoutOption((async function(t={}){const r=await e.config.getAll(t);return r.Bootstrap=a.default().Bootstrap,await e.config.replace(r),{Peers:a.default().Bootstrap.map((e=>new s.Multiaddr(e)))}}))}},{"ipfs-core-config/config":"ejWbz","ipfs-core-utils/with-timeout-option":"j29MK",multiaddr:"8Mu1u"}],ejWbz:[function(e,t,r){"use strict";t.exports=()=>({Addresses:{Swarm:[],Announce:[],NoAnnounce:[],API:"",Gateway:"",RPC:"",Delegates:["/dns4/node0.delegate.ipfs.io/tcp/443/https","/dns4/node1.delegate.ipfs.io/tcp/443/https","/dns4/node2.delegate.ipfs.io/tcp/443/https","/dns4/node3.delegate.ipfs.io/tcp/443/https"]},Discovery:{MDNS:{Enabled:!1,Interval:10},webRTCStar:{Enabled:!0}},Bootstrap:["/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN","/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb","/dnsaddr/bootstrap.libp2p.io/p2p/QmZa1sAxajnQjVM8WjWXoMbmPd7NsWhfKsPkErzpm9wGkp","/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa","/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt","/dns4/node0.preload.ipfs.io/tcp/443/wss/p2p/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic","/dns4/node1.preload.ipfs.io/tcp/443/wss/p2p/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6","/dns4/node2.preload.ipfs.io/tcp/443/wss/p2p/QmV7gnbW5VTcJ3oyM2Xk1rdFBJ3kTkvxc87UFGsun29STS","/dns4/node3.preload.ipfs.io/tcp/443/wss/p2p/QmY7JB6MQXhxHvq7dBDh4HpbH29v4yE9JRadAVpndvzySN"],Pubsub:{Enabled:!0},Swarm:{ConnMgr:{LowWater:200,HighWater:500},DisableNatPortMap:!0},Routing:{Type:"none"}})},{}],kncM8:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils.js"),n=e("ipfs-core-utils/with-timeout-option");r.createRm=function({repo:e}){return n.withTimeoutOption((async function(t,r={}){if(!i.isValidMultiaddr(t))throw new Error(`${t} is not a valid Multiaddr`);const n=await e.config.getAll(r);return n.Bootstrap=(n.Bootstrap||[]).filter((e=>e.toString()!==t.toString())),await e.config.replace(n),{Peers:[t]}}))}},{"./utils.js":"60F3o","ipfs-core-utils/with-timeout-option":"j29MK"}],jcbA3:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./get.js"),n=e("./put.js"),s=e("./rm.js"),o=e("./stat.js");r.BlockAPI=class{constructor({codecs:e,hashers:t,preload:r,repo:a}){this.get=i.createGet({preload:r,repo:a}),this.put=n.createPut({codecs:e,hashers:t,preload:r,repo:a}),this.rm=s.createRm({repo:a}),this.stat=o.createStat({preload:r,repo:a})}}},{"./get.js":"3sAXc","./put.js":"3xSKb","./rm.js":"eTPrA","./stat.js":"ij9fZ"}],"3sAXc":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createGet=function({preload:e,repo:t}){return i.withTimeoutOption((async function(r,i={}){return!1!==i.preload&&e(r),t.blocks.get(r,i)}))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],"3xSKb":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("ipfs-core-utils/with-timeout-option");r.createPut=function({codecs:e,hashers:t,repo:r,preload:s}){return n.withTimeoutOption((async function(n,o={}){const a=o.pin?await r.gcLock.readLock():null;try{const c=null!=o.version?o.version:0,u=o.format||(0===c?"dag-pb":"raw"),l=await t.getHasher(o.mhtype||"sha2-256"),d=await l.digest(n),f=await e.getCodec(u),h=i.CID.create(c,f.code,d);return await r.blocks.put(h,n,{signal:o.signal}),!1!==o.preload&&s(h),!0===o.pin&&await r.pins.pinRecursively(h,{signal:o.signal}),h}finally{a&&a()}}))}},{"multiformats/cid":"9ooAY","ipfs-core-utils/with-timeout-option":"j29MK"}],eTPrA:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("err-code"),n=e("it-parallel"),s=e("it-map"),o=e("it-filter"),a=e("it-pipe"),c=e("./utils.js"),u=e("ipfs-core-utils/with-timeout-option");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=l(i),f=l(n),h=l(s),p=l(o);r.createRm=function({repo:e}){return u.withTimeoutOption((async function*(t,r={}){Array.isArray(t)||(t=[t]);const i=await e.gcLock.writeLock();try{yield*a.pipe(t,(t=>h.default(t,(t=>async()=>{const i={cid:t=c.cleanCid(t)};try{if(!await e.blocks.has(t))throw d.default(new Error("block not found"),"ERR_BLOCK_NOT_FOUND");await e.blocks.delete(t)}catch(e){r.force||(e.message=`cannot remove ${t}: ${e.message}`,i.error=e)}return i}))),(e=>f.default(e,8)),(e=>p.default(e,(()=>!r.quiet))))}finally{i()}}))}},{"err-code":"chZjB","it-parallel":"fNsT1","it-map":"eeqPk","it-filter":"5LCTL","it-pipe":"giKBQ","./utils.js":"iASYn","ipfs-core-utils/with-timeout-option":"j29MK"}],fNsT1:[function(e,t,r){"use strict";const i=e("p-defer"),n=e("events").EventEmitter;t.exports=async function*(e,t=1){t<1&&(t=1);const r=new n,s=[];let o=i(),a=!1,c=i();for(r.on("task-complete",(()=>{c.resolve(),c=i()})),Promise.resolve().then((async()=>{try{for await(const i of e){s.length===t&&await o.promise;const e={done:!1};s.push(e),i().then((t=>{e.done=!0,e.ok=!0,e.value=t,r.emit("task-complete")}),(t=>{e.done=!0,e.err=t,r.emit("task-complete")}))}a=!0}catch(e){r.emit("task-complete")}}));;){for(await c.promise;s.length&&s[0].done;){const e=s[0];if(s.shift(),!e.ok)throw e.err;yield e.value,o.resolve(),o=i()}if(a&&0===s.length)break}}},{"p-defer":"5rKSv",events:"g82pp"}],"5rKSv":[function(e,t,r){"use strict";t.exports=()=>{const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}},{}],g82pp:[function(e,t,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,s=n&&"function"==typeof n.apply?n.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,s),i(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}m(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&m(e,"error",t,r)}(e,n,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function d(e,t,r,i){var n,s,o,a;if(u(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=l(e))>0&&o.length>n&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,console&&console.warn&&console.warn(a)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=f.bind(i);return n.listener=r,i.wrapFn=n,n}function p(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):y(n,n.length)}function g(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function y(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function m(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(s){i.once&&e.removeEventListener(t,n),r(s)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,n=this._events;if(void 0!==n)i=i&&void 0===n.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=n[e];if(void 0===c)return!1;if("function"==typeof c)s(c,this,t);else{var u=c.length,l=y(c,u);for(r=0;r<u;++r)s(l[r],this,t)}return!0},a.prototype.addListener=function(e,t){return d(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return d(this,e,t,!0)},a.prototype.once=function(e,t){return u(t),this.on(e,h(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,h(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,i,n,s,o;if(u(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},{}],iASYn:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid");r.cleanCid=function(e){return e instanceof Uint8Array?i.CID.decode(e):i.CID.parse(e.toString())}},{"multiformats/cid":"9ooAY"}],ij9fZ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils.js"),n=e("ipfs-core-utils/with-timeout-option");r.createStat=function({repo:e,preload:t}){return n.withTimeoutOption((async function(r,n={}){return r=i.cleanCid(r),!1!==n.preload&&t(r),{cid:r,size:(await e.blocks.get(r)).length}}))}},{"./utils.js":"iASYn","ipfs-core-utils/with-timeout-option":"j29MK"}],"3wOOx":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./add.js"),n=e("./add-all/index.js"),s=e("./cat.js"),o=e("./get.js"),a=e("./ls.js");r.RootAPI=class{constructor({preload:e,repo:t,options:r}){const c=n.createAddAll({preload:e,repo:t,options:r});this.addAll=c,this.add=i.createAdd({addAll:c}),this.cat=s.createCat({repo:t,preload:e}),this.get=o.createGet({repo:t,preload:e}),this.ls=a.createLs({repo:t,preload:e})}}},{"./add.js":"b7djo","./add-all/index.js":"g1OzM","./cat.js":"dOhzw","./get.js":"3pEGl","./ls.js":"lCq4W"}],b7djo:[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("it-last"));r.createAdd=function({addAll:e}){return async function(t,r={}){const i=await n.default(e(t,r));if(null==i)throw Error("Failed to add a file, if you see this please report a bug");return i}}},{"it-last":"cSXX9"}],g1OzM:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-unixfs-importer"),n=e("ipfs-core-utils/files/normalise-input"),s=e("./utils.js"),o=e("it-pipe"),a=e("ipfs-core-utils/with-timeout-option");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const u=c(e("merge-options")).default.bind({ignoreUndefined:!0});r.createAddAll=function({repo:e,preload:t,options:r}){const c=r&&r.sharding;return a.withTimeoutOption((async function*(r,a={}){const l=u({shardSplitThreshold:c?1e3:1/0,strategy:"balanced"},a,{...s.parseChunkerString(a.chunker)});l.hashAlg&&"sha2-256"!==l.hashAlg&&1!==l.cidVersion&&(l.cidVersion=1),l.trickle&&(l.strategy="trickle"),"trickle"===l.strategy&&(l.leafType="raw",l.reduceSingleLeafToSelf=!1),l.cidVersion>0&&void 0===l.rawLeaves&&(l.rawLeaves=!0),void 0!==l.hashAlg&&void 0===l.rawLeaves&&(l.rawLeaves=!0),delete l.trickle;const d={};if(l.progress){const e=l.progress;l.progress=(t,r)=>{d[r]||(d[r]=0),d[r]+=t,e(d[r],r)}}const f=o.pipe(n.normaliseInput(r),(t=>i.importer(t,e.blocks,{...l,pin:!1})),function(e){async function*t(t){for await(const r of t){let t=r.cid;1===e.cidVersion&&(t=t.toV1());let i=r.path?r.path:t.toString();e.wrapWithDirectory&&!r.path&&(i=""),yield{path:i,cid:t,size:r.size,mode:r.unixfs&&r.unixfs.mode,mtime:r.unixfs&&r.unixfs.mtime}}}return t}(l),function(e,t){async function*r(r){for await(const i of r){(!i.path||t.wrapWithDirectory?""===i.path:!i.path.includes("/"))&&!t.onlyHash&&!1!==t.preload&&e(i.cid),yield i}}return r}(t,l),function(e,t){async function*r(r){for await(const i of r){const r=!(i.path&&i.path.includes("/"));(null==t.pin||t.pin)&&r&&!t.onlyHash&&await e.pins.pinRecursively(i.cid),yield i}}return r}(e,l)),h=await e.gcLock.readLock();try{for await(const e of f)delete d[e.path],yield e}finally{h()}}))}},{"ipfs-unixfs-importer":"i61x3","ipfs-core-utils/files/normalise-input":"cda37","./utils.js":"1Nm8o","it-pipe":"giKBQ","ipfs-core-utils/with-timeout-option":"j29MK","merge-options":"fupyv"}],i61x3:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("it-parallel-batch"),n=e("./options.js"),s=e("./dag-builder/index.js"),o=e("./tree-builder.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(i);r.importer=async function*(e,t,r={}){const i=n(r);let a,u,l;a="function"==typeof r.dagBuilder?r.dagBuilder:s,u="function"==typeof r.treeBuilder?r.treeBuilder:o,l=Symbol.asyncIterator in e||Symbol.iterator in e?e:[e];for await(const e of u(c.default(a(l,t,i),i.fileImportConcurrency),t,i))yield{cid:e.cid,path:e.path,unixfs:e.unixfs,size:e.size}}},{"it-parallel-batch":"lPBqc","./options.js":"3mq8g","./dag-builder/index.js":"adT9a","./tree-builder.js":"3sIHL"}],lPBqc:[function(e,t,r){"use strict";const i=e("it-batch");t.exports=async function*(e,t=1){for await(const r of i(e,t)){const e=r.map((e=>e().then((e=>({ok:!0,value:e})),(e=>({ok:!1,err:e})))));for(let t=0;t<e.length;t++){const r=await e[t];if(!r.ok)throw r.err;yield r.value}}}},{"it-batch":"97xIF"}],"97xIF":[function(e,t,r){"use strict";t.exports=async function*(e,t=1){let r=[];t<1&&(t=1);for await(const i of e)for(r.push(i);r.length>=t;)yield r.slice(0,t),r=r.slice(t);for(;r.length;)yield r.slice(0,t),r=r.slice(t)}},{}],"3mq8g":[function(e,t,r){"use strict";var i=e("merge-options"),n=e("multiformats/hashes/sha2"),s=e("@multiformats/murmur3");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(i);const c={chunker:"fixed",strategy:"balanced",rawLeaves:!1,onlyHash:!1,reduceSingleLeafToSelf:!0,hasher:n.sha256,leafType:"file",cidVersion:0,progress:()=>()=>{},shardSplitThreshold:1e3,fileImportConcurrency:50,blockWriteConcurrency:10,minChunkSize:262144,maxChunkSize:262144,avgChunkSize:262144,window:16,polynomial:0x3df305dfb2a804,maxChildrenPerNode:174,layerRepeat:4,wrapWithDirectory:!1,recursive:!1,hidden:!1,timeout:void 0,hamtHashFn:async function(e){return(await s.murmur3128.encode(e)).slice(0,8).reverse()},hamtHashCode:34,hamtBucketBits:8};t.exports=(e={})=>a.default.bind({ignoreUndefined:!0})(c,e)},{"merge-options":"fupyv","multiformats/hashes/sha2":"7i9MT","@multiformats/murmur3":"5DFrl"}],"5DFrl":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/hashes/hasher"),n=e("multiformats");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(e("murmurhash3js-revisited"));const a=i.from({name:"murmur3-32",code:35,encode:e=>function(e){const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return new Uint8Array(t)}(o.default.x86.hash32(e))}),c=i.from({name:"murmur3-128",code:34,encode:e=>n.bytes.fromHex(o.default.x64.hash128(e))});r.murmur3128=c,r.murmur332=a},{"multiformats/hashes/hasher":"5z3Qi",multiformats:"3ANyW","murmurhash3js-revisited":"bbEKq"}],bbEKq:[function(e,t,r){t.exports=e("./lib/murmurHash3js")},{"./lib/murmurHash3js":"3dhTD"}],"3dhTD":[function(e,t,r){!function(e,i){var n={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function s(e){if(!Array.isArray(e)&&!ArrayBuffer.isView(e))return!1;for(var t=0;t<e.length;t++)if(!Number.isInteger(e[t])||e[t]<0||e[t]>255)return!1;return!0}function o(e,t){return(65535&e)*t+(((e>>>16)*t&65535)<<16)}function a(e,t){return e<<t|e>>>32-t}function c(e){return e=o(e^=e>>>16,2246822507),e=o(e^=e>>>13,3266489909),e^=e>>>16}function u(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]+t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]+t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]+t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]+t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function l(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]*t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]*t[3],r[1]+=r[2]>>>16,r[2]&=65535,r[2]+=e[3]*t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]*t[3],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[2]*t[2],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[3]*t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function d(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])}function f(e,t){return 0===(t%=64)?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]}function h(e,t){return[e[0]^t[0],e[1]^t[1]]}function p(e){return e=h(e,[0,e[0]>>>1]),e=h(e=l(e,[4283543511,3981806797]),[0,e[0]>>>1]),e=h(e=l(e,[3301882366,444984403]),[0,e[0]>>>1])}n.x86.hash32=function(e,t){if(n.inputValidation&&!s(e))return i;t=t||0;for(var r=e.length%4,u=e.length-r,l=t,d=0,f=3432918353,h=461845907,p=0;p<u;p+=4)d=o(d=e[p]|e[p+1]<<8|e[p+2]<<16|e[p+3]<<24,f),d=o(d=a(d,15),h),l=o(l=a(l^=d,13),5)+3864292196;switch(d=0,r){case 3:d^=e[p+2]<<16;case 2:d^=e[p+1]<<8;case 1:d=o(d^=e[p],f),l^=d=o(d=a(d,15),h)}return(l=c(l^=e.length))>>>0},n.x86.hash128=function(e,t){if(n.inputValidation&&!s(e))return i;t=t||0;for(var r=e.length%16,u=e.length-r,l=t,d=t,f=t,h=t,p=0,g=0,y=0,m=0,b=597399067,v=2869860233,w=951274213,_=2716044179,E=0;E<u;E+=16)p=e[E]|e[E+1]<<8|e[E+2]<<16|e[E+3]<<24,g=e[E+4]|e[E+5]<<8|e[E+6]<<16|e[E+7]<<24,y=e[E+8]|e[E+9]<<8|e[E+10]<<16|e[E+11]<<24,m=e[E+12]|e[E+13]<<8|e[E+14]<<16|e[E+15]<<24,p=a(p=o(p,b),15),l=a(l^=p=o(p,v),19),l=o(l+=d,5)+1444728091,g=a(g=o(g,v),16),d=a(d^=g=o(g,w),17),d=o(d+=f,5)+197830471,y=a(y=o(y,w),17),f=a(f^=y=o(y,_),15),f=o(f+=h,5)+2530024501,m=a(m=o(m,_),18),h=a(h^=m=o(m,b),13),h=o(h+=l,5)+850148119;switch(p=0,g=0,y=0,m=0,r){case 15:m^=e[E+14]<<16;case 14:m^=e[E+13]<<8;case 13:m=o(m^=e[E+12],_),h^=m=o(m=a(m,18),b);case 12:y^=e[E+11]<<24;case 11:y^=e[E+10]<<16;case 10:y^=e[E+9]<<8;case 9:y=o(y^=e[E+8],w),f^=y=o(y=a(y,17),_);case 8:g^=e[E+7]<<24;case 7:g^=e[E+6]<<16;case 6:g^=e[E+5]<<8;case 5:g=o(g^=e[E+4],v),d^=g=o(g=a(g,16),w);case 4:p^=e[E+3]<<24;case 3:p^=e[E+2]<<16;case 2:p^=e[E+1]<<8;case 1:p=o(p^=e[E],b),l^=p=o(p=a(p,15),v)}return l^=e.length,l+=d^=e.length,l+=f^=e.length,d+=l+=h^=e.length,f+=l,h+=l,l=c(l),l+=d=c(d),l+=f=c(f),d+=l+=h=c(h),f+=l,h+=l,("00000000"+(l>>>0).toString(16)).slice(-8)+("00000000"+(d>>>0).toString(16)).slice(-8)+("00000000"+(f>>>0).toString(16)).slice(-8)+("00000000"+(h>>>0).toString(16)).slice(-8)},n.x64.hash128=function(e,t){if(n.inputValidation&&!s(e))return i;t=t||0;for(var r=e.length%16,o=e.length-r,a=[0,t],c=[0,t],g=[0,0],y=[0,0],m=[2277735313,289559509],b=[1291169091,658871167],v=0;v<o;v+=16)g=[e[v+4]|e[v+5]<<8|e[v+6]<<16|e[v+7]<<24,e[v]|e[v+1]<<8|e[v+2]<<16|e[v+3]<<24],y=[e[v+12]|e[v+13]<<8|e[v+14]<<16|e[v+15]<<24,e[v+8]|e[v+9]<<8|e[v+10]<<16|e[v+11]<<24],g=d(g=l(g,m),31),a=u(a=d(a=h(a,g=l(g,b)),27),c),a=u(l(a,[0,5]),[0,1390208809]),y=d(y=l(y,b),33),c=u(c=d(c=h(c,y=l(y,m)),31),a),c=u(l(c,[0,5]),[0,944331445]);switch(g=[0,0],y=[0,0],r){case 15:y=h(y,f([0,e[v+14]],48));case 14:y=h(y,f([0,e[v+13]],40));case 13:y=h(y,f([0,e[v+12]],32));case 12:y=h(y,f([0,e[v+11]],24));case 11:y=h(y,f([0,e[v+10]],16));case 10:y=h(y,f([0,e[v+9]],8));case 9:y=l(y=h(y,[0,e[v+8]]),b),c=h(c,y=l(y=d(y,33),m));case 8:g=h(g,f([0,e[v+7]],56));case 7:g=h(g,f([0,e[v+6]],48));case 6:g=h(g,f([0,e[v+5]],40));case 5:g=h(g,f([0,e[v+4]],32));case 4:g=h(g,f([0,e[v+3]],24));case 3:g=h(g,f([0,e[v+2]],16));case 2:g=h(g,f([0,e[v+1]],8));case 1:g=l(g=h(g,[0,e[v]]),m),a=h(a,g=l(g=d(g,31),b))}return a=u(a=h(a,[0,e.length]),c=h(c,[0,e.length])),c=u(c,a),a=u(a=p(a),c=p(c)),c=u(c,a),("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)+("00000000"+(c[0]>>>0).toString(16)).slice(-8)+("00000000"+(c[1]>>>0).toString(16)).slice(-8)},void 0!==r?(void 0!==t&&t.exports&&(r=t.exports=n),r.murmurHash3=n):"function"==typeof define&&define.amd?define([],(function(){return n})):(n._murmurHash3=e.murmurHash3,n.noConflict=function(){return e.murmurHash3=n._murmurHash3,n._murmurHash3=i,n.noConflict=i,n},e.murmurHash3=n)}(this)},{}],adT9a:[function(e,t,r){"use strict";var i=e("./dir.js"),n=e("./file/index.js"),s=e("err-code"),o=e("../chunker/rabin.js"),a=e("../chunker/fixed-size.js"),c=e("./validate-chunks.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(s);function d(e){try{if(e instanceof Uint8Array)return async function*(){yield e}();if(t=e,Symbol.iterator in t)return async function*(){yield*e}();if(function(e){return Symbol.asyncIterator in e}(e))return e}catch{throw l.default(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}var t;throw l.default(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}t.exports=async function*(e,t,r){for await(const s of e)if(s.path&&("./"===s.path.substring(0,2)&&(r.wrapWithDirectory=!0),s.path=s.path.split("/").filter((e=>e&&"."!==e)).join("/")),s.content){let e,i;e="function"==typeof r.chunker?r.chunker:"rabin"===r.chunker?o:a,i="function"==typeof r.chunkValidator?r.chunkValidator:c;const u={path:s.path,mtime:s.mtime,mode:s.mode,content:e(i(d(s.content),r),r)};yield()=>n(u,t,r)}else{if(!s.path)throw new Error("Import candidate must have content or path or both");{const e={path:s.path,mtime:s.mtime,mode:s.mode};yield()=>i(e,t,r)}}}},{"./dir.js":"hHI2W","./file/index.js":"cYjOH","err-code":"chZjB","../chunker/rabin.js":"i876B","../chunker/fixed-size.js":"hCl8p","./validate-chunks.js":"aCNgw"}],hHI2W:[function(e,t,r){"use strict";var i=e("ipfs-unixfs"),n=e("../utils/persist.js"),s=e("@ipld/dag-pb");t.exports=async(e,t,r)=>{const o=new i.UnixFS({type:"directory",mtime:e.mtime,mode:e.mode}),a=s.encode(s.prepare({Data:o.marshal()}));return{cid:await n(a,t,r),path:e.path,unixfs:o,size:a.length}}},{"ipfs-unixfs":"dF9VO","../utils/persist.js":"9mA89","@ipld/dag-pb":"i2cdx"}],"9mA89":[function(e,t,r){"use strict";var i=e("multiformats/cid"),n=e("@ipld/dag-pb"),s=e("multiformats/hashes/sha2");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=o(n);t.exports=async(e,t,r)=>{r.codec||(r.codec=a),r.hasher||(r.hasher=s.sha256),void 0===r.cidVersion&&(r.cidVersion=1),r.codec===a&&r.hasher!==s.sha256&&(r.cidVersion=1);const n=await r.hasher.digest(e),o=i.CID.create(r.cidVersion,r.codec.code,n);return r.onlyHash||await t.put(o,e,{signal:r.signal}),o}},{"multiformats/cid":"9ooAY","@ipld/dag-pb":"i2cdx","multiformats/hashes/sha2":"7i9MT"}],cYjOH:[function(e,t,r){"use strict";var i=e("err-code"),n=e("ipfs-unixfs"),s=e("../../utils/persist.js"),o=e("@ipld/dag-pb"),a=e("it-parallel-batch"),c=e("multiformats/codecs/raw"),u=e("./flat.js"),l=e("./balanced.js"),d=e("./trickle.js"),f=e("./buffer-importer.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var g=h(i),y=p(o),m=h(a),b=p(c);const v={flat:u,balanced:l,trickle:d};t.exports=function(e,t,r){const i=v[r.strategy];if(!i)throw g.default(new Error(`Unknown importer build strategy name: ${r.strategy}`),"ERR_BAD_STRATEGY");return i(async function*(e,t,r){let i,n,s=-1;n="function"==typeof r.bufferImporter?r.bufferImporter:f;for await(const o of m.default(n(e,t,r),r.blockWriteConcurrency))s++,0!==s?(1===s&&i&&(yield i,i=null),yield o):i=o;i&&(i.single=!0,yield i)}(e,t,r),((e,t,r)=>async function(i){if(1===i.length&&i[0].single&&r.reduceSingleLeafToSelf){const a=i[0];if(a.cid.code===b.code&&(void 0!==e.mtime||void 0!==e.mode)){let i=await t.get(a.cid);a.unixfs=new n.UnixFS({type:"file",mtime:e.mtime,mode:e.mode,data:i}),i=o.encode(o.prepare({Data:a.unixfs.marshal()})),a.cid=await s(i,t,{...r,codec:y,hasher:r.hasher,cidVersion:r.cidVersion}),a.size=i.length}return{cid:a.cid,path:e.path,unixfs:a.unixfs,size:a.size}}const a=new n.UnixFS({type:"file",mtime:e.mtime,mode:e.mode}),c=i.filter((e=>!(e.cid.code!==b.code||!e.size)||!(!e.unixfs||e.unixfs.data||!e.unixfs.fileSize())||Boolean(e.unixfs&&e.unixfs.data&&e.unixfs.data.length))).map((e=>e.cid.code===b.code?(a.addBlockSize(e.size),{Name:"",Tsize:e.size,Hash:e.cid}):(e.unixfs&&e.unixfs.data?a.addBlockSize(e.unixfs.data.length):a.addBlockSize(e.unixfs&&e.unixfs.fileSize()||0),{Name:"",Tsize:e.size,Hash:e.cid}))),u={Data:a.marshal(),Links:c},l=o.encode(o.prepare(u));return{cid:await s(l,t,r),path:e.path,unixfs:a,size:l.length+u.Links.reduce(((e,t)=>e+t.Tsize),0)}})(e,t,r),r)}},{"err-code":"chZjB","ipfs-unixfs":"dF9VO","../../utils/persist.js":"9mA89","@ipld/dag-pb":"i2cdx","it-parallel-batch":"lPBqc","multiformats/codecs/raw":"fdfgp","./flat.js":"4ZIt7","./balanced.js":"15x1A","./trickle.js":"6UQnz","./buffer-importer.js":"duyTY"}],"4ZIt7":[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=i(e("it-all"));t.exports=async function(e,t){return t(await n.default(e))}},{"it-all":"iCXBu"}],"15x1A":[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=i(e("it-batch"));async function s(e,t,r){const i=[];for await(const s of n.default(e,r.maxChildrenPerNode))i.push(await t(s));return i.length>1?s(i,t,r):i[0]}t.exports=function(e,t,r){return s(e,t,r)}},{"it-batch":"97xIF"}],"6UQnz":[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=i(e("it-batch"));class s{constructor(e,t,r=0){this.maxDepth=e,this.layerRepeat=t,this.currentDepth=1,this.iteration=r,this.root=this.node=this.parent={children:[],depth:this.currentDepth,maxDepth:e,maxChildren:(this.maxDepth-this.currentDepth)*this.layerRepeat}}isFull(){if(!this.root.data)return!1;if(this.currentDepth<this.maxDepth&&this.node.maxChildren)return this._addNextNodeToParent(this.node),!1;const e=this._findParent(this.node,this.currentDepth);return!e||(this._addNextNodeToParent(e),!1)}_addNextNodeToParent(e){this.parent=e;const t={children:[],depth:e.depth+1,parent:e,maxDepth:this.maxDepth,maxChildren:Math.floor(e.children.length/this.layerRepeat)*this.layerRepeat};e.children.push(t),this.currentDepth=t.depth,this.node=t}append(e){this.node.data=e}reduce(e){return this._reduce(this.root,e)}async _reduce(e,t){let r=[];return e.children.length&&(r=await Promise.all(e.children.filter((e=>e.data)).map((e=>this._reduce(e,t))))),t((e.data||[]).concat(r))}_findParent(e,t){const r=e.parent;if(r&&0!==r.depth)return r.children.length!==r.maxChildren&&r.maxChildren?r:this._findParent(r,t)}}class o extends s{constructor(e){super(0,e),this.root.depth=0,this.currentDepth=1}addChild(e){this.root.children.push(e)}reduce(e){return e((this.root.data||[]).concat(this.root.children))}}t.exports=async function(e,t,r){const i=new o(r.layerRepeat);let a=0,c=1,u=i;for await(const o of n.default(e,r.maxChildrenPerNode))u.isFull()&&(u!==i&&i.addChild(await u.reduce(t)),a&&a%r.layerRepeat==0&&c++,u=new s(c,r.layerRepeat,a),a++),u.append(o);return u&&u!==i&&i.addChild(await u.reduce(t)),i.reduce(t)}},{"it-batch":"97xIF"}],duyTY:[function(e,t,r){"use strict";var i=e("ipfs-unixfs"),n=e("../../utils/persist.js"),s=e("@ipld/dag-pb"),o=e("multiformats/codecs/raw");function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var c=a(s),u=a(o);t.exports=async function*(e,t,r){for await(let s of e.content)yield async()=>{let o;r.progress(s.length,e.path);const a={codec:c,cidVersion:r.cidVersion,hasher:r.hasher,onlyHash:r.onlyHash};return r.rawLeaves?(a.codec=u,a.cidVersion=1):(o=new i.UnixFS({type:r.leafType,data:s,mtime:e.mtime,mode:e.mode}),s=c.encode({Data:o.marshal(),Links:[]})),{cid:await n(s,t,a),unixfs:o,size:s.length}}}},{"ipfs-unixfs":"dF9VO","../../utils/persist.js":"9mA89","@ipld/dag-pb":"i2cdx","multiformats/codecs/raw":"fdfgp"}],i876B:[function(e,t,r){"use strict";var i=e("bl/BufferList.js"),n=e("rabin-wasm"),s=e("err-code");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(i),c=o(s);t.exports=async function*(e,t){let r,i,s;if(t.minChunkSize&&t.maxChunkSize&&t.avgChunkSize)s=t.avgChunkSize,r=t.minChunkSize,i=t.maxChunkSize;else{if(!t.avgChunkSize)throw c.default(new Error("please specify an average chunk size"),"ERR_INVALID_AVG_CHUNK_SIZE");s=t.avgChunkSize,r=s/3,i=s+s/2}if(r<16)throw c.default(new Error("rabin min must be greater than 16"),"ERR_INVALID_MIN_CHUNK_SIZE");i<r&&(i=r),s<r&&(s=r);const o=Math.floor(Math.log2(s));for await(const s of async function*(e,t){const r=await n.create(t.bits,t.min,t.max,t.window),i=new a.default;for await(const t of e){i.append(t);const e=r.fingerprint(t);for(let t=0;t<e.length;t++){const r=e[t],n=i.slice(0,r);i.consume(r),yield n}}i.length&&(yield i.slice(0))}(e,{min:r,max:i,bits:o,window:t.window,polynomial:t.polynomial}))yield s}},{"bl/BufferList.js":"im7j6","rabin-wasm":"6Q8Fq","err-code":"chZjB"}],im7j6:[function(e,t,r){"use strict";const{Buffer:i}=e("buffer"),n=Symbol.for("BufferList");function s(e){if(!(this instanceof s))return new s(e);s._init.call(this,e)}s._init=function(e){Object.defineProperty(this,n,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},s.prototype._new=function(e){return new s(e)},s.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;r<this._bufs.length;r++){const i=t+this._bufs[r].length;if(e<i||r===this._bufs.length-1)return[r,e-t];t=i}},s.prototype._reverseOffset=function(e){const t=e[0];let r=e[1];for(let e=0;e<t;e++)r+=this._bufs[e].length;return r},s.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},s.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},s.prototype.copy=function(e,t,r,n){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof n||n>this.length)&&(n=this.length),r>=this.length)return e||i.alloc(0);if(n<=0)return e||i.alloc(0);const s=!!e,o=this._offset(r),a=n-r;let c=a,u=s&&t||0,l=o[1];if(0===r&&n===this.length){if(!s)return 1===this._bufs.length?this._bufs[0]:i.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,u),u+=this._bufs[t].length;return e}if(c<=this._bufs[o[0]].length-l)return s?this._bufs[o[0]].copy(e,t,l,l+c):this._bufs[o[0]].slice(l,l+c);s||(e=i.allocUnsafe(a));for(let t=o[0];t<this._bufs.length;t++){const r=this._bufs[t].length-l;if(!(c>r)){this._bufs[t].copy(e,u,l,l+c),u+=r;break}this._bufs[t].copy(e,u,l),u+=r,c-=r,l&&(l=0)}return e.length>u?e.slice(0,u):e},s.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),i=this._offset(t),n=this._bufs.slice(r[0],i[0]+1);return 0===i[1]?n.pop():n[n.length-1]=n[n.length-1].slice(0,i[1]),0!==r[1]&&(n[0]=n[0].slice(r[1])),this._new(n)},s.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},s.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},s.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(i.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(i.from(e));return this},s.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},s.prototype.indexOf=function(e,t,r){if(void 0===r&&"string"==typeof t&&(r=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=i.from([e]):"string"==typeof e?e=i.from(e,r):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=i.from(e.buffer,e.byteOffset,e.byteLength):i.isBuffer(e)||(e=i.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const n=this._offset(t);let s=n[0],o=n[1];for(;s<this._bufs.length;s++){const t=this._bufs[s];for(;o<t.length;){if(t.length-o>=e.length){const r=t.indexOf(e,o);if(-1!==r)return this._reverseOffset([s,r]);o=t.length-e.length+1}else{const t=this._reverseOffset([s,o]);if(this._match(t,e))return t;o++}}o=0}return-1},s.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let r=0;r<t.length;r++)if(this.get(e+r)!==t[r])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)!function(t){s.prototype[t]=null===e[t]?function(e,r){return this.slice(e,e+r)[t](0,r)}:function(r=0){return this.slice(r,r+e[t])[t](0)}}(t)}(),s.prototype._isBufferList=function(e){return e instanceof s||s.isBufferList(e)},s.isBufferList=function(e){return null!=e&&e[n]},t.exports=s},{buffer:"etowf"}],etowf:[function(e,t,r){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/"use strict";var i=e("base64-js"),n=e("ieee754"),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=c,r.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},r.INSPECT_MAX_BYTES=50;var o=2147483647;function a(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|g(e,t),i=a(r),n=i.write(e,t);n!==r&&(i=i.slice(0,n));return i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){var 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(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return c.from(i,t,r);var n=function(e){if(c.isBuffer(e)){var t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||z(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(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 d(e){return l(e),a(e<0?0:0|p(e))}function f(e){for(var t=e.length<0?0:0|p(e.length),r=a(t),i=0;i<t;i+=1)r[i]=255&e[i];return r}function h(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var i;return i=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(i,c.prototype),i}function p(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(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);var r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return N(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(e).length;default:if(n)return i?-1:N(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return P(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function m(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function b(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=c.from(t,i)),c.isBuffer(t))return 0===t.length?-1:v(e,t,r,i,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,i,n){var s,o=1,a=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){var l=-1;for(s=r;s<a;s++)if(u(e,s)===u(t,-1===l?0:s-l)){if(-1===l&&(l=s),s-l+1===c)return l*o}else-1!==l&&(s-=s-l),l=-1}else for(r+c>a&&(r=a-c),s=r;s>=0;s--){for(var d=!0,f=0;f<c;f++)if(u(e,s+f)!==u(t,f)){d=!1;break}if(d)return s}return-1}function w(e,t,r,i){r=Number(r)||0;var n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;var s=t.length;i>s/2&&(i=s/2);for(var o=0;o<i;++o){var a=parseInt(t.substr(2*o,2),16);if(z(a))return o;e[r+o]=a}return o}function _(e,t,r,i){return F(N(t,e.length-r),e,r,i)}function E(e,t,r,i){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function S(e,t,r,i){return F(U(t),e,r,i)}function T(e,t,r,i){return F(function(e,t){for(var r,i,n,s=[],o=0;o<e.length&&!((t-=2)<0);++o)i=(r=e.charCodeAt(o))>>8,n=r%256,s.push(n),s.push(i);return s}(t,e.length-r),e,r,i)}function A(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function k(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n<r;){var s,o,a,c,u=e[n],l=null,d=u>239?4:u>223?3:u>191?2:1;if(n+d<=r)switch(d){case 1:u<128&&(l=u);break;case 2:128==(192&(s=e[n+1]))&&(c=(31&u)<<6|63&s)>127&&(l=c);break;case 3:s=e[n+1],o=e[n+2],128==(192&s)&&128==(192&o)&&(c=(15&u)<<12|(63&s)<<6|63&o)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:s=e[n+1],o=e[n+2],a=e[n+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(c=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,d=1):l>65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l),n+=d}return function(e){var t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=I));return r}(i)}r.kMaxLength=o,c.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},c.allocUnsafe=function(e){return d(e)},c.allocUnsafeSlow=function(e){return d(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(K(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,i=t.length,n=0,s=Math.min(r,i);n<s;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var i=c.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var s=e[r];if(K(s,Uint8Array))n+s.length>i.length?c.from(s).copy(i,n):Uint8Array.prototype.set.call(i,s,n);else{if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,n)}n+=s.length}return i},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},c.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?k(this,0,e):y.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(c.prototype[s]=c.prototype.inspect),c.prototype.compare=function(e,t,r,i,n){if(K(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var s=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(t>>>=0),a=Math.min(s,o),u=this.slice(i,n),l=e.slice(t,r),d=0;d<a;++d)if(u[d]!==l[d]){s=u[d],o=l[d];break}return s<o?-1:o<s?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},c.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function R(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function P(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function O(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var n="",s=t;s<r;++s)n+=V[e[s]];return n}function C(e,t,r){for(var i=e.slice(t,r),n="",s=0;s<i.length-1;s+=2)n+=String.fromCharCode(i[s]+256*i[s+1]);return n}function j(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,r,i,n,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<s)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function M(e,t,r,i,n,s){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function x(e,t,r,i,s){return t=+t,r>>>=0,s||M(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function B(e,t,r,i,s){return t=+t,r>>>=0,s||M(e,0,r,8),n.write(e,t,r,i,52,8),r+8}c.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var i=this.subarray(e,t);return Object.setPrototypeOf(i,c.prototype),i},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||j(e,t,this.length);for(var i=this[e],n=1,s=0;++s<t&&(n*=256);)i+=this[e+s]*n;return i},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||j(e,t,this.length);for(var i=this[e+--t],n=1;t>0&&(n*=256);)i+=this[e+--t]*n;return i},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||j(e,t,this.length);for(var i=this[e],n=1,s=0;++s<t&&(n*=256);)i+=this[e+s]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||j(e,t,this.length);for(var i=t,n=1,s=this[e+--i];i>0&&(n*=256);)s+=this[e+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||j(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||j(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||j(e,4,this.length),n.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||j(e,4,this.length),n.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||j(e,8,this.length),n.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||j(e,8,this.length),n.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t>>>=0,r>>>=0,i)||D(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[t]=255&e;++s<r&&(n*=256);)this[t+s]=e/n&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,i){(e=+e,t>>>=0,r>>>=0,i)||D(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,s=1;for(this[t+n]=255&e;--n>=0&&(s*=256);)this[t+n]=e/s&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t>>>=0,!i){var n=Math.pow(2,8*r-1);D(this,e,t,r,n-1,-n)}var s=0,o=1,a=0;for(this[t]=255&e;++s<r&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+r},c.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t>>>=0,!i){var n=Math.pow(2,8*r-1);D(this,e,t,r,n-1,-n)}var s=r-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeFloatLE=function(e,t,r){return x(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return x(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return B(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return B(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,i){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);var n=i-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,i):Uint8Array.prototype.set.call(e,this.subarray(r,i),t),n},c.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){var n=e.charCodeAt(0);("utf8"===i&&n<128||"latin1"===i)&&(e=n)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var s;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{var o=c.isBuffer(e)?e:c.from(e,i),a=o.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<r-t;++s)this[s+t]=o[s%a]}return this};var L=/[^+/0-9A-Za-z-_]/g;function N(e,t){var r;t=t||1/0;for(var i=e.length,n=null,s=[],o=0;o<i;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function U(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(L,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,i){for(var n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}var V=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var i=16*r,n=0;n<16;++n)t[i+n]=e[r]+e[n];return t}()},{"base64-js":"9DJbh",ieee754:"7sDZQ"}],"9DJbh":[function(e,t,r){"use strict";r.byteLength=function(e){var t=u(e),r=t[0],i=t[1];return 3*(r+i)/4-i},r.toByteArray=function(e){var t,r,i=u(e),o=i[0],a=i[1],c=new s(function(e,t,r){return 3*(t+r)/4-r}(0,o,a)),l=0,d=a>0?o-4:o;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[l++]=255&t);1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,s=[],o=16383,a=0,c=r-n;a<c;a+=o)s.push(l(e,a,a+o>c?c:a+o));1===n?(t=e[r-1],s.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],s.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return s.join("")};for(var i=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=o.length;a<c;++a)i[a]=o[a],n[o.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var n,s,o=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(i[(s=n)>>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},{}],"7sDZQ":[function(e,t,r){
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */r.read=function(e,t,r,i,n){var s,o,a=8*n-i-1,c=(1<<a)-1,u=c>>1,l=-7,d=r?n-1:0,f=r?-1:1,h=e[t+d];for(d+=f,s=h&(1<<-l)-1,h>>=-l,l+=a;l>0;s=256*s+e[t+d],d+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=i;l>0;o=256*o+e[t+d],d+=f,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,i),s-=u}return(h?-1:1)*o*Math.pow(2,s-i)},r.write=function(e,t,r,i,n,s){var o,a,c,u=8*s-n-1,l=(1<<u)-1,d=l>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,p=i?1:-1,g=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?f/c:f*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,n),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,n),o=0));n>=8;e[r+h]=255&a,h+=p,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;e[r+h]=255&o,h+=p,o/=256,u-=8);e[r+h-p]|=128*g}},{}],"6Q8Fq":[function(e,t,r){const i=e("./rabin"),n=e("../dist/rabin-wasm.node.js");t.exports={Rabin:i,create:async(e,t,r,s,o)=>{const a=await n();return new i(a,e,t,r,s,o)}}},{"./rabin":"eVeCF","../dist/rabin-wasm.node.js":"bOJoE"}],eVeCF:[function(e,t,r){t.exports=class{constructor(e,t=12,r=8192,i=32768,n=64,s){this.bits=t,this.min=r,this.max=i,this.asModule=e,this.rabin=new e.Rabin(t,r,i,n,s),this.polynomial=s}fingerprint(e){const{__retain:t,__release:r,__allocArray:i,__getInt32Array:n,Int32Array_ID:s,Uint8Array_ID:o}=this.asModule,a=t(i(s,new Int32Array(Math.ceil(e.length/this.min)))),c=t(i(o,e)),u=n(this.rabin.fingerprint(c,a));r(c),r(a);const l=u.indexOf(0);return l>=0?u.subarray(0,l):u}}},{}],bOJoE:[function(e,t,r){const{instantiate:i}=e("@assemblyscript/loader");function n(e={}){if(!n.supported)return null;var t=new Uint8Array([0,97,115,109,1,0,0,0,1,78,14,96,2,127,126,0,96,1,127,1,126,96,2,127,127,0,96,1,127,1,127,96,1,127,0,96,2,127,127,1,127,96,3,127,127,127,1,127,96,0,0,96,3,127,127,127,0,96,0,1,127,96,4,127,127,127,127,0,96,5,127,127,127,127,127,1,127,96,1,126,1,127,96,2,126,126,1,126,2,13,1,3,101,110,118,5,97,98,111,114,116,0,10,3,54,53,2,2,8,9,3,5,2,8,6,5,3,4,2,6,9,12,13,2,5,11,3,2,3,2,3,2,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,6,7,7,4,4,5,3,1,0,1,6,47,9,127,1,65,0,11,127,1,65,0,11,127,0,65,3,11,127,0,65,4,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,0,65,240,2,11,127,0,65,6,11,7,240,5,41,6,109,101,109,111,114,121,2,0,7,95,95,97,108,108,111,99,0,10,8,95,95,114,101,116,97,105,110,0,11,9,95,95,114,101,108,101,97,115,101,0,12,9,95,95,99,111,108,108,101,99,116,0,51,11,95,95,114,116,116,105,95,98,97,115,101,3,7,13,73,110,116,51,50,65,114,114,97,121,95,73,68,3,2,13,85,105,110,116,56,65,114,114,97,121,95,73,68,3,3,6,100,101,103,114,101,101,0,16,3,109,111,100,0,17,5,82,97,98,105,110,3,8,16,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,0,21,16,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,0,22,21,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,23,21,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,24,14,82,97,98,105,110,35,103,101,116,58,119,112,111,115,0,25,14,82,97,98,105,110,35,115,101,116,58,119,112,111,115,0,26,15,82,97,98,105,110,35,103,101,116,58,99,111,117,110,116,0,27,15,82,97,98,105,110,35,115,101,116,58,99,111,117,110,116,0,28,13,82,97,98,105,110,35,103,101,116,58,112,111,115,0,29,13,82,97,98,105,110,35,115,101,116,58,112,111,115,0,30,15,82,97,98,105,110,35,103,101,116,58,115,116,97,114,116,0,31,15,82,97,98,105,110,35,115,101,116,58,115,116,97,114,116,0,32,16,82,97,98,105,110,35,103,101,116,58,100,105,103,101,115,116,0,33,16,82,97,98,105,110,35,115,101,116,58,100,105,103,101,115,116,0,34,21,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,35,21,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,36,22,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,37,22,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,38,31,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,39,31,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,40,20,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,0,41,20,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,0,42,17,82,97,98,105,110,35,103,101,116,58,109,105,110,115,105,122,101,0,43,17,82,97,98,105,110,35,115,101,116,58,109,105,110,115,105,122,101,0,44,17,82,97,98,105,110,35,103,101,116,58,109,97,120,115,105,122,101,0,45,17,82,97,98,105,110,35,115,101,116,58,109,97,120,115,105,122,101,0,46,14,82,97,98,105,110,35,103,101,116,58,109,97,115,107,0,47,14,82,97,98,105,110,35,115,101,116,58,109,97,115,107,0,48,17,82,97,98,105,110,35,99,111,110,115,116,114,117,99,116,111,114,0,20,17,82,97,98,105,110,35,102,105,110,103,101,114,112,114,105,110,116,0,49,8,1,50,10,165,31,53,199,1,1,4,127,32,1,40,2,0,65,124,113,34,2,65,128,2,73,4,127,32,2,65,4,118,33,4,65,0,5,32,2,65,31,32,2,103,107,34,3,65,4,107,118,65,16,115,33,4,32,3,65,7,107,11,33,3,32,1,40,2,20,33,2,32,1,40,2,16,34,5,4,64,32,5,32,2,54,2,20,11,32,2,4,64,32,2,32,5,54,2,16,11,32,1,32,0,32,4,32,3,65,4,116,106,65,2,116,106,40,2,96,70,4,64,32,0,32,4,32,3,65,4,116,106,65,2,116,106,32,2,54,2,96,32,2,69,4,64,32,0,32,3,65,2,116,106,32,0,32,3,65,2,116,106,40,2,4,65,1,32,4,116,65,127,115,113,34,1,54,2,4,32,1,69,4,64,32,0,32,0,40,2,0,65,1,32,3,116,65,127,115,113,54,2,0,11,11,11,11,226,2,1,6,127,32,1,40,2,0,33,3,32,1,65,16,106,32,1,40,2,0,65,124,113,106,34,4,40,2,0,34,5,65,1,113,4,64,32,3,65,124,113,65,16,106,32,5,65,124,113,106,34,2,65,240,255,255,255,3,73,4,64,32,0,32,4,16,1,32,1,32,2,32,3,65,3,113,114,34,3,54,2,0,32,1,65,16,106,32,1,40,2,0,65,124,113,106,34,4,40,2,0,33,5,11,11,32,3,65,2,113,4,64,32,1,65,4,107,40,2,0,34,2,40,2,0,34,6,65,124,113,65,16,106,32,3,65,124,113,106,34,7,65,240,255,255,255,3,73,4,64,32,0,32,2,16,1,32,2,32,7,32,6,65,3,113,114,34,3,54,2,0,32,2,33,1,11,11,32,4,32,5,65,2,114,54,2,0,32,4,65,4,107,32,1,54,2,0,32,0,32,3,65,124,113,34,2,65,128,2,73,4,127,32,2,65,4,118,33,4,65,0,5,32,2,65,31,32,2,103,107,34,2,65,4,107,118,65,16,115,33,4,32,2,65,7,107,11,34,3,65,4,116,32,4,106,65,2,116,106,40,2,96,33,2,32,1,65,0,54,2,16,32,1,32,2,54,2,20,32,2,4,64,32,2,32,1,54,2,16,11,32,0,32,4,32,3,65,4,116,106,65,2,116,106,32,1,54,2,96,32,0,32,0,40,2,0,65,1,32,3,116,114,54,2,0,32,0,32,3,65,2,116,106,32,0,32,3,65,2,116,106,40,2,4,65,1,32,4,116,114,54,2,4,11,119,1,1,127,32,2,2,127,32,0,40,2,160,12,34,2,4,64,32,2,32,1,65,16,107,70,4,64,32,2,40,2,0,33,3,32,1,65,16,107,33,1,11,11,32,1,11,107,34,2,65,48,73,4,64,15,11,32,1,32,3,65,2,113,32,2,65,32,107,65,1,114,114,54,2,0,32,1,65,0,54,2,16,32,1,65,0,54,2,20,32,1,32,2,106,65,16,107,34,2,65,2,54,2,0,32,0,32,2,54,2,160,12,32,0,32,1,16,2,11,155,1,1,3,127,35,0,34,0,69,4,64,65,1,63,0,34,0,74,4,127,65,1,32,0,107,64,0,65,0,72,5,65,0,11,4,64,0,11,65,176,3,34,0,65,0,54,2,0,65,208,15,65,0,54,2,0,3,64,32,1,65,23,73,4,64,32,1,65,2,116,65,176,3,106,65,0,54,2,4,65,0,33,2,3,64,32,2,65,16,73,4,64,32,1,65,4,116,32,2,106,65,2,116,65,176,3,106,65,0,54,2,96,32,2,65,1,106,33,2,12,1,11,11,32,1,65,1,106,33,1,12,1,11,11,65,176,3,65,224,15,63,0,65,16,116,16,3,65,176,3,36,0,11,32,0,11,45,0,32,0,65,240,255,255,255,3,79,4,64,65,32,65,224,0,65,201,3,65,29,16,0,0,11,32,0,65,15,106,65,112,113,34,0,65,16,32,0,65,16,75,27,11,169,1,1,1,127,32,0,32,1,65,128,2,73,4,127,32,1,65,4,118,33,1,65,0,5,32,1,65,248,255,255,255,1,73,4,64,32,1,65,1,65,27,32,1,103,107,116,106,65,1,107,33,1,11,32,1,65,31,32,1,103,107,34,2,65,4,107,118,65,16,115,33,1,32,2,65,7,107,11,34,2,65,2,116,106,40,2,4,65,127,32,1,116,113,34,1,4,127,32,0,32,1,104,32,2,65,4,116,106,65,2,116,106,40,2,96,5,32,0,40,2,0,65,127,32,2,65,1,106,116,113,34,1,4,127,32,0,32,0,32,1,104,34,0,65,2,116,106,40,2,4,104,32,0,65,4,116,106,65,2,116,106,40,2,96,5,65,0,11,11,11,111,1,1,127,63,0,34,2,32,1,65,248,255,255,255,1,73,4,127,32,1,65,1,65,27,32,1,103,107,116,65,1,107,106,5,32,1,11,65,16,32,0,40,2,160,12,32,2,65,16,116,65,16,107,71,116,106,65,255,255,3,106,65,128,128,124,113,65,16,118,34,1,32,2,32,1,74,27,64,0,65,0,72,4,64,32,1,64,0,65,0,72,4,64,0,11,11,32,0,32,2,65,16,116,63,0,65,16,116,16,3,11,113,1,2,127,32,1,40,2,0,34,3,65,124,113,32,2,107,34,4,65,32,79,4,64,32,1,32,2,32,3,65,2,113,114,54,2,0,32,2,32,1,65,16,106,106,34,1,32,4,65,16,107,65,1,114,54,2,0,32,0,32,1,16,2,5,32,1,32,3,65,126,113,54,2,0,32,1,65,16,106,32,1,40,2,0,65,124,113,106,32,1,65,16,106,32,1,40,2,0,65,124,113,106,40,2,0,65,125,113,54,2,0,11,11,91,1,2,127,32,0,32,1,16,5,34,4,16,6,34,3,69,4,64,65,1,36,1,65,0,36,1,32,0,32,4,16,6,34,3,69,4,64,32,0,32,4,16,7,32,0,32,4,16,6,33,3,11,11,32,3,65,0,54,2,4,32,3,32,2,54,2,8,32,3,32,1,54,2,12,32,0,32,3,16,1,32,0,32,3,32,4,16,8,32,3,11,13,0,16,4,32,0,32,1,16,9,65,16,106,11,33,1,1,127,32,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,32,0,11,18,0,32,0,65,172,3,75,4,64,32,0,65,16,107,16,52,11,11,140,3,1,1,127,2,64,32,1,69,13,0,32,0,65,0,58,0,0,32,0,32,1,106,65,1,107,65,0,58,0,0,32,1,65,2,77,13,0,32,0,65,1,106,65,0,58,0,0,32,0,65,2,106,65,0,58,0,0,32,0,32,1,106,34,2,65,2,107,65,0,58,0,0,32,2,65,3,107,65,0,58,0,0,32,1,65,6,77,13,0,32,0,65,3,106,65,0,58,0,0,32,0,32,1,106,65,4,107,65,0,58,0,0,32,1,65,8,77,13,0,32,1,65,0,32,0,107,65,3,113,34,1,107,33,2,32,0,32,1,106,34,0,65,0,54,2,0,32,0,32,2,65,124,113,34,1,106,65,4,107,65,0,54,2,0,32,1,65,8,77,13,0,32,0,65,4,106,65,0,54,2,0,32,0,65,8,106,65,0,54,2,0,32,0,32,1,106,34,2,65,12,107,65,0,54,2,0,32,2,65,8,107,65,0,54,2,0,32,1,65,24,77,13,0,32,0,65,12,106,65,0,54,2,0,32,0,65,16,106,65,0,54,2,0,32,0,65,20,106,65,0,54,2,0,32,0,65,24,106,65,0,54,2,0,32,0,32,1,106,34,2,65,28,107,65,0,54,2,0,32,2,65,24,107,65,0,54,2,0,32,2,65,20,107,65,0,54,2,0,32,2,65,16,107,65,0,54,2,0,32,0,32,0,65,4,113,65,24,106,34,2,106,33,0,32,1,32,2,107,33,1,3,64,32,1,65,32,79,4,64,32,0,66,0,55,3,0,32,0,65,8,106,66,0,55,3,0,32,0,65,16,106,66,0,55,3,0,32,0,65,24,106,66,0,55,3,0,32,1,65,32,107,33,1,32,0,65,32,106,33,0,12,1,11,11,11,11,178,1,1,3,127,32,1,65,240,255,255,255,3,32,2,118,75,4,64,65,144,1,65,192,1,65,23,65,56,16,0,0,11,32,1,32,2,116,34,3,65,0,16,10,34,2,32,3,16,13,32,0,69,4,64,65,12,65,2,16,10,34,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,2,34,1,32,0,40,2,0,34,4,71,4,64,32,1,65,172,3,75,4,64,32,1,65,16,107,34,5,32,5,40,2,4,65,1,106,54,2,4,11,32,4,16,12,11,32,0,32,1,54,2,0,32,0,32,2,54,2,4,32,0,32,3,54,2,8,32,0,11,46,1,2,127,65,12,65,5,16,10,34,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,32,0,65,128,2,65,3,16,14,11,9,0,65,63,32,0,121,167,107,11,49,1,2,127,65,63,32,1,121,167,107,33,2,3,64,65,63,32,0,121,167,107,32,2,107,34,3,65,0,78,4,64,32,0,32,1,32,3,172,134,133,33,0,12,1,11,11,32,0,11,40,0,32,1,32,0,40,2,8,79,4,64,65,128,2,65,192,2,65,163,1,65,44,16,0,0,11,32,1,32,0,40,2,4,106,65,0,58,0,0,11,38,0,32,1,32,0,40,2,8,79,4,64,65,128,2,65,192,2,65,152,1,65,44,16,0,0,11,32,1,32,0,40,2,4,106,45,0,0,11,254,5,2,1,127,4,126,32,0,69,4,64,65,232,0,65,6,16,10,34,0,65,172,3,75,4,64,32,0,65,16,107,34,5,32,5,40,2,4,65,1,106,54,2,4,11,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,24,32,0,66,0,55,3,32,32,0,66,0,55,3,40,32,0,66,0,55,3,48,32,0,66,0,55,3,56,32,0,66,0,55,3,64,32,0,66,0,55,3,72,32,0,66,0,55,3,80,32,0,66,0,55,3,88,32,0,66,0,55,3,96,32,0,32,2,173,55,3,80,32,0,32,3,173,55,3,88,65,12,65,4,16,10,34,2,65,172,3,75,4,64,32,2,65,16,107,34,3,32,3,40,2,4,65,1,106,54,2,4,11,32,2,32,4,65,0,16,14,33,2,32,0,40,2,0,16,12,32,0,32,2,54,2,0,32,0,32,4,54,2,4,32,0,66,1,32,1,173,134,66,1,125,55,3,96,32,0,66,243,130,183,218,216,230,232,30,55,3,72,35,4,69,4,64,65,0,33,2,3,64,32,2,65,128,2,72,4,64,32,2,65,255,1,113,173,33,6,32,0,41,3,72,34,7,33,8,65,63,32,7,121,167,107,33,1,3,64,65,63,32,6,121,167,107,32,1,107,34,3,65,0,78,4,64,32,6,32,8,32,3,172,134,133,33,6,12,1,11,11,65,0,33,4,3,64,32,4,32,0,40,2,4,65,1,107,72,4,64,32,6,66,8,134,33,6,32,0,41,3,72,34,7,33,8,65,63,32,7,121,167,107,33,1,3,64,65,63,32,6,121,167,107,32,1,107,34,3,65,0,78,4,64,32,6,32,8,32,3,172,134,133,33,6,12,1,11,11,32,4,65,1,106,33,4,12,1,11,11,35,6,40,2,4,32,2,65,3,116,106,32,6,55,3,0,32,2,65,1,106,33,2,12,1,11,11,65,63,32,0,41,3,72,121,167,107,172,33,7,65,0,33,2,3,64,32,2,65,128,2,72,4,64,35,5,33,1,32,2,172,32,7,134,34,8,33,6,65,63,32,0,41,3,72,34,9,121,167,107,33,3,3,64,65,63,32,6,121,167,107,32,3,107,34,4,65,0,78,4,64,32,6,32,9,32,4,172,134,133,33,6,12,1,11,11,32,1,40,2,4,32,2,65,3,116,106,32,6,32,8,132,55,3,0,32,2,65,1,106,33,2,12,1,11,11,65,1,36,4,11,32,0,66,0,55,3,24,32,0,66,0,55,3,32,65,0,33,2,3,64,32,2,32,0,40,2,4,72,4,64,32,0,40,2,0,32,2,16,18,32,2,65,1,106,33,2,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,19,33,1,32,0,40,2,8,32,0,40,2,0,40,2,4,106,65,1,58,0,0,32,0,32,0,41,3,40,35,6,40,2,4,32,1,65,3,116,106,41,3,0,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,35,5,40,2,4,32,0,41,3,40,34,6,66,45,136,167,65,3,116,106,41,3,0,32,6,66,8,134,66,1,132,133,55,3,40,32,0,11,38,1,1,127,32,0,40,2,0,34,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,32,0,11,55,1,2,127,32,1,32,0,40,2,0,34,2,71,4,64,32,1,65,172,3,75,4,64,32,1,65,16,107,34,3,32,3,40,2,4,65,1,106,54,2,4,11,32,2,16,12,11,32,0,32,1,54,2,0,11,7,0,32,0,40,2,4,11,9,0,32,0,32,1,54,2,4,11,7,0,32,0,40,2,8,11,9,0,32,0,32,1,54,2,8,11,7,0,32,0,41,3,16,11,9,0,32,0,32,1,55,3,16,11,7,0,32,0,41,3,24,11,9,0,32,0,32,1,55,3,24,11,7,0,32,0,41,3,32,11,9,0,32,0,32,1,55,3,32,11,7,0,32,0,41,3,40,11,9,0,32,0,32,1,55,3,40,11,7,0,32,0,41,3,48,11,9,0,32,0,32,1,55,3,48,11,7,0,32,0,41,3,56,11,9,0,32,0,32,1,55,3,56,11,7,0,32,0,41,3,64,11,9,0,32,0,32,1,55,3,64,11,7,0,32,0,41,3,72,11,9,0,32,0,32,1,55,3,72,11,7,0,32,0,41,3,80,11,9,0,32,0,32,1,55,3,80,11,7,0,32,0,41,3,88,11,9,0,32,0,32,1,55,3,88,11,7,0,32,0,41,3,96,11,9,0,32,0,32,1,55,3,96,11,172,4,2,5,127,1,126,32,2,65,172,3,75,4,64,32,2,65,16,107,34,4,32,4,40,2,4,65,1,106,54,2,4,11,32,2,33,4,65,0,33,2,32,1,40,2,8,33,5,32,1,40,2,4,33,6,3,64,2,127,65,0,33,3,3,64,32,3,32,5,72,4,64,32,3,32,6,106,45,0,0,33,1,32,0,40,2,0,32,0,40,2,8,16,19,33,7,32,0,40,2,8,32,0,40,2,0,40,2,4,106,32,1,58,0,0,32,0,32,0,41,3,40,35,6,40,2,4,32,7,65,3,116,106,41,3,0,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,35,5,40,2,4,32,0,41,3,40,34,8,66,45,136,167,65,3,116,106,41,3,0,32,1,173,32,8,66,8,134,132,133,55,3,40,32,0,32,0,41,3,16,66,1,124,55,3,16,32,0,32,0,41,3,24,66,1,124,55,3,24,32,0,41,3,16,32,0,41,3,80,90,4,127,32,0,41,3,40,32,0,41,3,96,131,80,5,65,0,11,4,127,65,1,5,32,0,41,3,16,32,0,41,3,88,90,11,4,64,32,0,32,0,41,3,32,55,3,48,32,0,32,0,41,3,16,55,3,56,32,0,32,0,41,3,40,55,3,64,65,0,33,1,3,64,32,1,32,0,40,2,4,72,4,64,32,0,40,2,0,32,1,16,18,32,1,65,1,106,33,1,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,19,33,1,32,0,40,2,8,32,0,40,2,0,40,2,4,106,65,1,58,0,0,32,0,32,0,41,3,40,35,6,40,2,4,32,1,65,3,116,106,41,3,0,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,35,5,40,2,4,32,0,41,3,40,34,8,66,45,136,167,65,3,116,106,41,3,0,32,8,66,8,134,66,1,132,133,55,3,40,32,3,65,1,106,12,3,11,32,3,65,1,106,33,3,12,1,11,11,65,127,11,34,1,65,0,78,4,64,32,5,32,1,107,33,5,32,1,32,6,106,33,6,32,2,34,1,65,1,106,33,2,32,4,40,2,4,32,1,65,2,116,106,32,0,41,3,56,62,2,0,12,1,11,11,32,4,11,10,0,16,15,36,5,16,15,36,6,11,3,0,1,11,73,1,2,127,32,0,40,2,4,34,1,65,255,255,255,255,0,113,34,2,65,1,70,4,64,32,0,65,16,106,16,53,32,0,32,0,40,2,0,65,1,114,54,2,0,35,0,32,0,16,2,5,32,0,32,2,65,1,107,32,1,65,128,128,128,128,127,113,114,54,2,4,11,11,58,0,2,64,2,64,2,64,32,0,65,8,107,40,2,0,14,7,0,0,1,1,1,1,1,2,11,15,11,32,0,40,2,0,34,0,4,64,32,0,65,172,3,79,4,64,32,0,65,16,107,16,52,11,11,15,11,0,11,11,137,3,7,0,65,16,11,55,40,0,0,0,1,0,0,0,1,0,0,0,40,0,0,0,97,0,108,0,108,0,111,0,99,0,97,0,116,0,105,0,111,0,110,0,32,0,116,0,111,0,111,0,32,0,108,0,97,0,114,0,103,0,101,0,65,208,0,11,45,30,0,0,0,1,0,0,0,1,0,0,0,30,0,0,0,126,0,108,0,105,0,98,0,47,0,114,0,116,0,47,0,116,0,108,0,115,0,102,0,46,0,116,0,115,0,65,128,1,11,43,28,0,0,0,1,0,0,0,1,0,0,0,28,0,0,0,73,0,110,0,118,0,97,0,108,0,105,0,100,0,32,0,108,0,101,0,110,0,103,0,116,0,104,0,65,176,1,11,53,38,0,0,0,1,0,0,0,1,0,0,0,38,0,0,0,126,0,108,0,105,0,98,0,47,0,97,0,114,0,114,0,97,0,121,0,98,0,117,0,102,0,102,0,101,0,114,0,46,0,116,0,115,0,65,240,1,11,51,36,0,0,0,1,0,0,0,1,0,0,0,36,0,0,0,73,0,110,0,100,0,101,0,120,0,32,0,111,0,117,0,116,0,32,0,111,0,102,0,32,0,114,0,97,0,110,0,103,0,101,0,65,176,2,11,51,36,0,0,0,1,0,0,0,1,0,0,0,36,0,0,0,126,0,108,0,105,0,98,0,47,0,116,0,121,0,112,0,101,0,100,0,97,0,114,0,114,0,97,0,121,0,46,0,116,0,115,0,65,240,2,11,53,7,0,0,0,16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,145,4,0,0,2,0,0,0,49,0,0,0,2,0,0,0,17,1,0,0,2,0,0,0,16,0,34,16,115,111,117,114,99,101,77,97,112,112,105,110,103,85,82,76,16,46,47,114,97,98,105,110,46,119,97,115,109,46,109,97,112]);return i(new Response(new Blob([t],{type:"application/wasm"})),e)}n.supported="undefined"!=typeof WebAssembly,t.exports=n},{"@assemblyscript/loader":"kAk4C"}],kAk4C:[function(e,t,r){"use strict";const i="undefined"!=typeof BigUint64Array,n=Symbol(),s=1024;function o(e,t){const r=new Uint32Array(e),i=new Uint16Array(e);var n=r[t+-4>>>2]>>>1,o=t>>>1;if(n<=s)return String.fromCharCode.apply(String,i.subarray(o,o+n));const a=[];do{const e=i[o+s-1],t=e>=55296&&e<56320?1023:s;a.push(String.fromCharCode.apply(String,i.subarray(o,o+=t))),n-=t}while(n>s);return a.join("")+String.fromCharCode.apply(String,i.subarray(o,o+n))}function a(e){const t={};function r(e,t){return e?o(e.buffer,t):"<yet unknown>"}const i=e.env=e.env||{};return i.abort=i.abort||function(e,n,s,o){const a=t.memory||i.memory;throw Error("abort: "+r(a,e)+" at "+r(a,n)+":"+s+":"+o)},i.trace=i.trace||function(e,n){const s=t.memory||i.memory;console.log("trace: "+r(s,e)+(n?" ":"")+Array.prototype.slice.call(arguments,2,2+n).join(", "))},e.Math=e.Math||Math,e.Date=e.Date||Date,t}function c(e,t){const r=t.exports,n=r.memory,s=r.table,a=r.__alloc,c=r.__retain,u=r.__rtti_base||-1;function l(e){const t=new Uint32Array(n.buffer);if((e>>>=0)>=t[u>>>2])throw Error("invalid id: "+e);return t[(u+4>>>2)+2*e]}function d(e){const t=new Uint32Array(n.buffer);if((e>>>=0)>=t[u>>>2])throw Error("invalid id: "+e);return t[(u+4>>>2)+2*e+1]}function h(e){return 31-Math.clz32(e>>>5&31)}function p(e,t,r){const i=n.buffer;if(r)switch(e){case 2:return new Float32Array(i);case 3:return new Float64Array(i)}else switch(e){case 0:return new(t?Int8Array:Uint8Array)(i);case 1:return new(t?Int16Array:Uint16Array)(i);case 2:return new(t?Int32Array:Uint32Array)(i);case 3:return new(t?BigInt64Array:BigUint64Array)(i)}throw Error("unsupported align: "+e)}function g(e){const t=new Uint32Array(n.buffer),r=t[e+-8>>>2],i=l(r);if(!(1&i))throw Error("not an array: "+r);const s=h(i);var o=t[e+4>>>2];const a=2&i?t[e+12>>>2]:t[o+-4>>>2]>>>s;return p(s,1024&i,2048&i).subarray(o>>>=s,o+a)}function y(e,t,r){return new e(m(e,t,r))}function m(e,t,r){const i=n.buffer,s=new Uint32Array(i),o=s[r+4>>>2];return new e(i,o,s[o+-4>>>2]>>>t)}return e.__allocString=function(e){const t=e.length,r=a(t<<1,1),i=new Uint16Array(n.buffer);for(var s=0,o=r>>>1;s<t;++s)i[o+s]=e.charCodeAt(s);return r},e.__getString=function(e){const t=n.buffer;if(1!==new Uint32Array(t)[e+-8>>>2])throw Error("not a string: "+e);return o(t,e)},e.__allocArray=function(e,t){const r=l(e);if(!(3&r))throw Error("not an array: "+e+" @ "+r);const i=h(r),s=t.length,o=a(s<<i,0),u=a(2&r?16:12,e),d=new Uint32Array(n.buffer);d[u+0>>>2]=c(o),d[u+4>>>2]=o,d[u+8>>>2]=s<<i,2&r&&(d[u+12>>>2]=s);const f=p(i,1024&r,2048&r);if(8192&r)for(let e=0;e<s;++e)f[(o>>>i)+e]=c(t[e]);else f.set(t,o>>>i);return u},e.__getArrayView=g,e.__getArray=function(e){const t=g(e),r=t.length,i=new Array(r);for(let e=0;e<r;e++)i[e]=t[e];return i},e.__getArrayBuffer=function(e){const t=n.buffer,r=new Uint32Array(t)[e+-4>>>2];return t.slice(e,e+r)},e.__getInt8Array=y.bind(null,Int8Array,0),e.__getInt8ArrayView=m.bind(null,Int8Array,0),e.__getUint8Array=y.bind(null,Uint8Array,0),e.__getUint8ArrayView=m.bind(null,Uint8Array,0),e.__getUint8ClampedArray=y.bind(null,Uint8ClampedArray,0),e.__getUint8ClampedArrayView=m.bind(null,Uint8ClampedArray,0),e.__getInt16Array=y.bind(null,Int16Array,1),e.__getInt16ArrayView=m.bind(null,Int16Array,1),e.__getUint16Array=y.bind(null,Uint16Array,1),e.__getUint16ArrayView=m.bind(null,Uint16Array,1),e.__getInt32Array=y.bind(null,Int32Array,2),e.__getInt32ArrayView=m.bind(null,Int32Array,2),e.__getUint32Array=y.bind(null,Uint32Array,2),e.__getUint32ArrayView=m.bind(null,Uint32Array,2),i&&(e.__getInt64Array=y.bind(null,BigInt64Array,3),e.__getInt64ArrayView=m.bind(null,BigInt64Array,3),e.__getUint64Array=y.bind(null,BigUint64Array,3),e.__getUint64ArrayView=m.bind(null,BigUint64Array,3)),e.__getFloat32Array=y.bind(null,Float32Array,2),e.__getFloat32ArrayView=m.bind(null,Float32Array,2),e.__getFloat64Array=y.bind(null,Float64Array,3),e.__getFloat64ArrayView=m.bind(null,Float64Array,3),e.__instanceof=function(e,t){const r=new Uint32Array(n.buffer);var i=r[e+-8>>>2];if(i<=r[u>>>2])do{if(i==t)return!0}while(i=d(i));return!1},e.memory=e.memory||n,e.table=e.table||s,f(r,e)}function u(e){return"undefined"!=typeof Response&&e instanceof Response}async function l(e,t){return u(e=await e)?d(e,t):c(a(t||(t={})),await WebAssembly.instantiate(e instanceof WebAssembly.Module?e:await WebAssembly.compile(e),t))}async function d(e,t){return WebAssembly.instantiateStreaming?c(a(t||(t={})),(await WebAssembly.instantiateStreaming(e,t)).instance):l(u(e=await e)?e.arrayBuffer():e,t)}function f(e,t){var r=t?Object.create(t):{},i=e.__argumentsLength?function(t){e.__argumentsLength.value=t}:e.__setArgumentsLength||e.__setargc||function(){};for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t))continue;const s=e[t];let o=t.split("."),a=r;for(;o.length>1;){let e=o.shift();Object.prototype.hasOwnProperty.call(a,e)||(a[e]={}),a=a[e]}let c=o[0],u=c.indexOf("#");if(u>=0){let r=c.substring(0,u),o=a[r];if(void 0===o||!o.prototype){let e=function(...t){return e.wrap(e.prototype.constructor(0,...t))};e.prototype={valueOf:function(){return this[n]}},e.wrap=function(t){return Object.create(e.prototype,{[n]:{value:t,writable:!1}})},o&&Object.getOwnPropertyNames(o).forEach((t=>Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t)))),a[r]=e}if(c=c.substring(u+1),a=a[r].prototype,/^(get|set):/.test(c)){if(!Object.prototype.hasOwnProperty.call(a,c=c.substring(4))){let r=e[t.replace("set:","get:")],i=e[t.replace("get:","set:")];Object.defineProperty(a,c,{get:function(){return r(this[n])},set:function(e){i(this[n],e)},enumerable:!0})}}else"constructor"===c?(a[c]=(...e)=>(i(e.length),s(...e))).original=s:(a[c]=function(...e){return i(e.length),s(this[n],...e)}).original=s}else/^(get|set):/.test(c)?Object.prototype.hasOwnProperty.call(a,c=c.substring(4))||Object.defineProperty(a,c,{get:e[t.replace("set:","get:")],set:e[t.replace("get:","set:")],enumerable:!0}):"function"==typeof s&&s!==i?(a[c]=(...e)=>(i(e.length),s(...e))).original=s:a[c]=s}return r}r.instantiate=l,r.instantiateSync=function(e,t){return c(a(t||(t={})),new WebAssembly.Instance(e instanceof WebAssembly.Module?e:new WebAssembly.Module(e),t))},r.instantiateStreaming=d,r.demangle=f},{}],hCl8p:[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=i(e("bl/BufferList.js"));t.exports=async function*(e,t){let r=new n.default,i=0,s=!1;const o=t.maxChunkSize;for await(const t of e)for(r.append(t),i+=t.length;i>=o;)if(yield r.slice(0,o),s=!0,o===r.length)r=new n.default,i=0;else{const e=new n.default;e.append(r.shallowSlice(o)),r=e,i-=o}s&&!i||(yield r.slice(0,i))}},{"bl/BufferList.js":"im7j6"}],aCNgw:[function(e,t,r){"use strict";var i=e("err-code"),n=e("uint8arrays/from-string");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(i);t.exports=async function*(e){for await(const t of e){if(void 0===t.length)throw o.default(new Error("Content was invalid"),"ERR_INVALID_CONTENT");if("string"==typeof t||t instanceof String)yield n.fromString(t.toString());else if(Array.isArray(t))yield Uint8Array.from(t);else{if(!(t instanceof Uint8Array))throw o.default(new Error("Content was invalid"),"ERR_INVALID_CONTENT");yield t}}}},{"err-code":"chZjB","uint8arrays/from-string":"dF7Y4"}],"3sIHL":[function(e,t,r){"use strict";var i=e("./dir-flat.js"),n=e("./flat-to-shard.js"),s=e("./dir.js"),o=e("./utils/to-path-components.js");async function a(e,t,r){const a=o(e.path||""),c=a.length-1;let u=t,l="";for(let o=0;o<a.length;o++){const d=a[o];l+=`${l?"/":""}${d}`;const f=o===c;if(u.dirty=!0,u.cid=void 0,u.size=void 0,f)await u.put(d,e),t=await n(null,u,r.shardSplitThreshold,r);else{let e=await u.get(d);e&&e instanceof s||(e=new i({root:!1,dir:!0,parent:u,parentKey:d,path:l,dirty:!0,flat:!0,mtime:e&&e.unixfs&&e.unixfs.mtime,mode:e&&e.unixfs&&e.unixfs.mode},r)),await u.put(d,e),u=e}}return t}async function*c(e,t){e instanceof s?yield*e.flush(t):e&&e.unixfs&&e.unixfs.isDirectory()&&(yield e)}t.exports=async function*(e,t,r){let n=new i({root:!0,dir:!0,path:"",dirty:!0,flat:!0},r);for await(const t of e)t&&(n=await a(t,n,r),t.unixfs&&t.unixfs.isDirectory()||(yield t));if(r.wrapWithDirectory)yield*c(n,t);else for await(const e of n.eachChildSeries())e&&(yield*c(e.child,t))}},{"./dir-flat.js":"1nsnr","./flat-to-shard.js":"khOkw","./dir.js":"4gYma","./utils/to-path-components.js":"brjB0"}],"1nsnr":[function(e,t,r){"use strict";var i=e("@ipld/dag-pb"),n=e("ipfs-unixfs"),s=e("./dir.js"),o=e("./utils/persist.js");t.exports=class extends s{constructor(e,t){super(e,t),this._children={}}async put(e,t){this.cid=void 0,this.size=void 0,this._children[e]=t}get(e){return Promise.resolve(this._children[e])}childCount(){return Object.keys(this._children).length}directChildrenCount(){return this.childCount()}onlyChild(){return this._children[Object.keys(this._children)[0]]}async*eachChildSeries(){const e=Object.keys(this._children);for(let t=0;t<e.length;t++){const r=e[t];yield{key:r,child:this._children[r]}}}async*flush(e){const t=Object.keys(this._children),r=[];for(let i=0;i<t.length;i++){let n=this._children[t[i]];if(n instanceof s)for await(const t of n.flush(e))n=t,yield n;null!=n.size&&n.cid&&r.push({Name:t[i],Tsize:n.size,Hash:n.cid})}const a=new n.UnixFS({type:"directory",mtime:this.mtime,mode:this.mode}),c={Data:a.marshal(),Links:r},u=i.encode(i.prepare(c)),l=await o(u,e,this.options),d=u.length+c.Links.reduce(((e,t)=>e+(null==t.Tsize?0:t.Tsize)),0);this.cid=l,this.size=d,yield{cid:l,unixfs:a,path:this.path,size:d}}}},{"@ipld/dag-pb":"i2cdx","ipfs-unixfs":"dF9VO","./dir.js":"4gYma","./utils/persist.js":"9mA89"}],"4gYma":[function(e,t,r){"use strict";t.exports=class{constructor(e,t){this.options=t||{},this.root=e.root,this.dir=e.dir,this.path=e.path,this.dirty=e.dirty,this.flat=e.flat,this.parent=e.parent,this.parentKey=e.parentKey,this.unixfs=e.unixfs,this.mode=e.mode,this.mtime=e.mtime,this.cid=void 0,this.size=void 0}async put(e,t){}get(e){return Promise.resolve(this)}async*eachChildSeries(){}async*flush(e){}}},{}],khOkw:[function(e,t,r){"use strict";var i=e("./dir-sharded.js"),n=e("./dir-flat.js");t.exports=async function e(t,r,s,o){let a=r;r instanceof n&&r.directChildrenCount()>=s&&(a=await async function(e,t){const r=new i({root:e.root,dir:!0,parent:e.parent,parentKey:e.parentKey,path:e.path,dirty:e.dirty,flat:!1,mtime:e.mtime,mode:e.mode},t);for await(const{key:t,child:i}of e.eachChildSeries())await r.put(t,i);return r}(r,o));const c=a.parent;if(c){if(a!==r){if(t&&(t.parent=a),!a.parentKey)throw new Error("No parent key found");await c.put(a.parentKey,a)}return e(a,c,s,o)}return a}},{"./dir-sharded.js":"aobU3","./dir-flat.js":"1nsnr"}],aobU3:[function(e,t,r){"use strict";var i=e("@ipld/dag-pb"),n=e("ipfs-unixfs"),s=e("./dir.js"),o=e("./utils/persist.js"),a=e("hamt-sharding");async function*c(e,t,r,s){const u=e._children,l=[];let d=0;for(let e=0;e<u.length;e++){const r=u.get(e);if(!r)continue;const i=e.toString(16).toUpperCase().padStart(2,"0");if(r instanceof a.Bucket){let e;for await(const i of await c(r,t,null,s))e=i;if(!e)throw new Error("Could not flush sharded directory, no subshard found");l.push({Name:i,Tsize:e.size,Hash:e.cid}),d+=e.size}else if("function"==typeof r.value.flush){const e=r.value;let n;for await(const r of e.flush(t))n=r,yield n;const s=i+r.key;l.push({Name:s,Tsize:n.size,Hash:n.cid}),d+=n.size}else{const e=r.value;if(!e.cid)continue;const t=i+r.key,n=e.size;l.push({Name:t,Tsize:n,Hash:e.cid}),d+=n}}const f=Uint8Array.from(u.bitField().reverse()),h=new n.UnixFS({type:"hamt-sharded-directory",data:f,fanout:e.tableSize(),hashType:s.hamtHashCode,mtime:r&&r.mtime,mode:r&&r.mode}),p={Data:h.marshal(),Links:l},g=i.encode(i.prepare(p)),y=await o(g,t,s),m=g.length+d;yield{cid:y,unixfs:h,size:m}}t.exports=class extends s{constructor(e,t){super(e,t),this._bucket=a.createHAMT({hashFn:t.hamtHashFn,bits:t.hamtBucketBits})}async put(e,t){await this._bucket.put(e,t)}get(e){return this._bucket.get(e)}childCount(){return this._bucket.leafCount()}directChildrenCount(){return this._bucket.childrenCount()}onlyChild(){return this._bucket.onlyChild()}async*eachChildSeries(){for await(const{key:e,value:t}of this._bucket.eachLeafSeries())yield{key:e,child:t}}async*flush(e){for await(const t of c(this._bucket,e,this,this.options))yield{...t,path:this.path}}}},{"@ipld/dag-pb":"i2cdx","ipfs-unixfs":"dF9VO","./dir.js":"4gYma","./utils/persist.js":"9mA89","hamt-sharding":"1SDvb"}],"1SDvb":[function(e,t,r){"use strict";const i=e("./bucket"),n=e("./consumable-hash");t.exports={createHAMT:function(e){if(!e||!e.hashFn)throw new Error("please define an options.hashFn");const t={bits:e.bits||8,hash:n(e.hashFn)};return new i(t)},Bucket:i}},{"./bucket":"dxES4","./consumable-hash":"8PIJS"}],dxES4:[function(e,t,r){"use strict";const i=e("sparse-array"),{fromString:n}=e("uint8arrays/from-string");class s{constructor(e,t,r=0){this._options=e,this._popCount=0,this._parent=t,this._posAtParent=r,this._children=new i,this.key=null}async put(e,t){const r=await this._findNewBucketAndPos(e);await r.bucket._putAt(r,e,t)}async get(e){const t=await this._findChild(e);if(t)return t.value}async del(e){const t=await this._findPlace(e),r=t.bucket._at(t.pos);r&&r.key===e&&t.bucket._delAt(t.pos)}leafCount(){return this._children.compactArray().reduce(((e,t)=>t instanceof s?e+t.leafCount():e+1),0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){const e=this._children.compactArray();for(const t of e)t instanceof s?yield*t.eachLeafSeries():yield t;return[]}serialize(e,t){return t(this._children.reduce(((r,i,n)=>(i&&(i instanceof s?r.push(i.serialize(e,t)):r.push(e(i,n))),r)),[]))}asyncTransform(e,t){return u(this,e,t)}toJSON(){return this.serialize(a,c)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(e){const t=await this._findPlace(e),r=t.bucket._at(t.pos);if(!(r instanceof s))return r&&r.key===e?r:void 0}async _findPlace(e){const t=this._options.hash("string"==typeof e?n(e):e),r=await t.take(this._options.bits),i=this._children.get(r);return i instanceof s?i._findPlace(t):{bucket:this,pos:r,hash:t,existingChild:i}}async _findNewBucketAndPos(e){const t=await this._findPlace(e);if(t.existingChild&&t.existingChild.key!==e){const e=new s(this._options,t.bucket,t.pos);t.bucket._putObjectAt(t.pos,e);const r=await e._findPlace(t.existingChild.hash);return r.bucket._putAt(r,t.existingChild.key,t.existingChild.value),e._findNewBucketAndPos(t.hash)}return t}_putAt(e,t,r){this._putObjectAt(e.pos,{key:t,value:r,hash:e.hash})}_putObjectAt(e,t){this._children.get(e)||this._popCount++,this._children.set(e,t)}_delAt(e){if(-1===e)throw new Error("Invalid position");this._children.get(e)&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent&&this._popCount<=1)if(1===this._popCount){const e=this._children.find(o);if(e&&!(e instanceof s)){const t=e.hash;t.untake(this._options.bits);const r={pos:this._posAtParent,hash:t,bucket:this._parent};this._parent._putAt(r,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}}function o(e){return Boolean(e)}function a(e,t){return e.key}function c(e){return e}async function u(e,t,r){const i=[];for(const n of e._children.compactArray())if(n instanceof s)await u(n,t,r);else{const r=await t(n);i.push({bitField:e._children.bitField(),children:r})}return r(i)}t.exports=s},{"sparse-array":"26rb7","uint8arrays/from-string":"dF7Y4"}],"26rb7":[function(e,t,r){"use strict";function i(e,t){return e+n(t)}function n(e){let t=e;return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),16843009*(t+(t>>4)&252645135)>>24}function s(e,t){return e[0]-t[0]}function o(e){return e[1]}t.exports=class{constructor(){this._bitArrays=[],this._data=[],this._length=0,this._changedLength=!1,this._changedData=!1}set(e,t){let r=this._internalPositionFor(e,!1);if(void 0===t)-1!==r&&(this._unsetInternalPos(r),this._unsetBit(e),this._changedLength=!0,this._changedData=!0);else{let i=!1;-1===r?(r=this._data.length,this._setBit(e),this._changedData=!0):i=!0,this._setInternalPos(r,e,t,i),this._changedLength=!0}}unset(e){this.set(e,void 0)}get(e){this._sortData();const t=this._internalPositionFor(e,!0);if(-1!==t)return this._data[t][1]}push(e){return this.set(this.length,e),this.length}get length(){if(this._sortData(),this._changedLength){const e=this._data[this._data.length-1];this._length=e?e[0]+1:0,this._changedLength=!1}return this._length}forEach(e){let t=0;for(;t<this.length;)e(this.get(t),t,this),t++}map(e){let t=0,r=new Array(this.length);for(;t<this.length;)r[t]=e(this.get(t),t,this),t++;return r}reduce(e,t){let r=0,i=t;for(;r<this.length;){i=e(i,this.get(r),r),r++}return i}find(e){let t,r,i=0;for(;i<this.length&&!t;)r=this.get(i),t=e(r),i++;return t?r:void 0}_internalPositionFor(e,t){const r=this._bytePosFor(e,t);if(r>=this._bitArrays.length)return-1;const s=this._bitArrays[r],o=e-7*r;if(!((s&1<<o)>0))return-1;return this._bitArrays.slice(0,r).reduce(i,0)+n(s&~(4294967295<<o+1))-1}_bytePosFor(e,t){const r=Math.floor(e/7),i=r+1;for(;!t&&this._bitArrays.length<i;)this._bitArrays.push(0);return r}_setBit(e){const t=this._bytePosFor(e,!1);this._bitArrays[t]|=1<<e-7*t}_unsetBit(e){const t=this._bytePosFor(e,!1);this._bitArrays[t]&=~(1<<e-7*t)}_setInternalPos(e,t,r,i){const n=this._data,s=[t,r];if(i)this._sortData(),n[e]=s;else{if(n.length)if(n[n.length-1][0]>=t)n.push(s);else if(n[0][0]<=t)n.unshift(s);else{const e=Math.round(n.length/2);this._data=n.slice(0,e).concat(s).concat(n.slice(e))}else this._data.push(s);this._changedData=!0,this._changedLength=!0}}_unsetInternalPos(e){this._data.splice(e,1)}_sortData(){this._changedData&&this._data.sort(s),this._changedData=!1}bitField(){const e=[];let t,r=8,i=0,n=0;const s=this._bitArrays.slice();for(;s.length||i;){0===i&&(t=s.shift(),i=7);const o=Math.min(i,r);n|=(t&~(255<<o))<<8-r,t>>>=o,i-=o,r-=o,r&&(i||s.length)||(e.push(n),n=0,r=8)}for(var o=e.length-1;o>0;o--){if(0!==e[o])break;e.pop()}return e}compactArray(){return this._sortData(),this._data.map(o)}}},{}],"8PIJS":[function(e,t,r){"use strict";const i=e("./consumable-buffer"),{concat:n}=e("uint8arrays/concat");class s{constructor(e,t){if(!(e instanceof Uint8Array))throw new Error("can only hash Uint8Arrays");this._value=e,this._hashFn=t,this._depth=-1,this._availableBits=0,this._currentBufferIndex=0,this._buffers=[]}async take(e){let t=e;for(;this._availableBits<t;)await this._produceMoreBits();let r=0;for(;t>0;){const e=this._buffers[this._currentBufferIndex],i=Math.min(e.availableBits(),t);r=(r<<i)+e.take(i),t-=i,this._availableBits-=i,0===e.availableBits()&&this._currentBufferIndex++}return r}untake(e){let t=e;for(;t>0;){const e=this._buffers[this._currentBufferIndex],r=Math.min(e.totalBits()-e.availableBits(),t);e.untake(r),t-=r,this._availableBits+=r,this._currentBufferIndex>0&&e.totalBits()===e.availableBits()&&(this._depth--,this._currentBufferIndex--)}}async _produceMoreBits(){this._depth++;const e=this._depth?n([this._value,Uint8Array.from([this._depth])]):this._value,t=await this._hashFn(e),r=new i(t);this._buffers.push(r),this._availableBits+=r.availableBits()}}t.exports=function(e){return function(t){return t instanceof s?t:new s(t,e)}},t.exports.InfiniteHash=s},{"./consumable-buffer":"ip5wL","uint8arrays/concat":"4EBjG"}],ip5wL:[function(e,t,r){"use strict";const i=[255,254,252,248,240,224,192,128],n=[1,3,7,15,31,63,127,255];function s(e,t,r){const s=function(e,t){return i[e]&n[Math.min(t+e-1,7)]}(t,r);return(e&s)>>>t}t.exports=class{constructor(e){this._value=e,this._currentBytePos=e.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+8*this._currentBytePos}totalBits(){return 8*this._value.length}take(e){let t=e,r=0;for(;t&&this._haveBits();){const e=this._value[this._currentBytePos],i=this._currentBitPos+1,n=Math.min(i,t);r=(r<<n)+s(e,i-n,n),t-=n,this._currentBitPos-=n,this._currentBitPos<0&&(this._currentBitPos=7,this._currentBytePos--)}return r}untake(e){for(this._currentBitPos+=e;this._currentBitPos>7;)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}}},{}],brjB0:[function(e,t,r){"use strict";t.exports=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean)},{}],cda37:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./normalise-content.js"),n=e("./normalise.js");r.normaliseInput=function(e){return n.normalise(e,i.normaliseContent)}},{"./normalise-content.js":"dXynQ","./normalise.js":"7hUEG"}],dXynQ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("err-code"),n=e("uint8arrays/from-string"),s=e("browser-readablestream-to-it"),o=e("blob-to-it"),a=e("it-peekable"),c=e("it-all"),u=e("it-map"),l=e("./utils.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=d(i),h=d(s),p=d(o),g=d(a),y=d(c),m=d(u);function b(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?new Uint8Array(e):Array.isArray(e)?Uint8Array.from(e):n.fromString(e.toString())}r.normaliseContent=async function(e){return async function*(e){if(l.isBytes(e))return void(yield b(e));if("string"==typeof e||e instanceof String)return void(yield b(e.toString()));if(l.isBlob(e))return void(yield*p.default(e));l.isReadableStream(e)&&(e=h.default(e));if(Symbol.iterator in e||Symbol.asyncIterator in e){const t=g.default(e),{value:r,done:i}=await t.peek();if(i)return void(yield*[]);if(t.push(r),Number.isInteger(r))return void(yield Uint8Array.from(await y.default(t)));if(l.isBytes(r)||"string"==typeof r||r instanceof String)return void(yield*m.default(t,b))}throw f.default(new Error(`Unexpected input: ${e}`),"ERR_UNEXPECTED_INPUT")}(e)}},{"err-code":"chZjB","uint8arrays/from-string":"dF7Y4","browser-readablestream-to-it":"aUa4D","blob-to-it":"5K8SZ","it-peekable":"bi9X1","it-all":"iCXBu","it-map":"eeqPk","./utils.js":"ded5K"}],aUa4D:[function(e,t,r){"use strict";t.exports=async function*(e,t={}){const r=e.getReader();try{for(;;){const e=await r.read();if(e.done)return;yield e.value}}finally{!0!==t.preventCancel&&r.cancel(),r.releaseLock()}}},{}],"5K8SZ":[function(e,t,r){"use strict";const i=e("browser-readablestream-to-it");t.exports=function(e){return"function"==typeof e.stream?i(e.stream()):i(new Response(e).body)}},{"browser-readablestream-to-it":"aUa4D"}],bi9X1:[function(e,t,r){"use strict";t.exports=function(e){const[t,r]=e[Symbol.asyncIterator]?[e[Symbol.asyncIterator](),Symbol.asyncIterator]:[e[Symbol.iterator](),Symbol.iterator],i=[];return{peek:()=>t.next(),push:e=>{i.push(e)},next:()=>i.length?{done:!1,value:i.shift()}:t.next(),[r](){return this}}}},{}],ded5K:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.isBlob=function(e){return e.constructor&&("Blob"===e.constructor.name||"File"===e.constructor.name)&&"function"==typeof e.stream},r.isBytes=function(e){return ArrayBuffer.isView(e)||e instanceof ArrayBuffer},r.isFileObject=function(e){return"object"==typeof e&&(e.path||e.content)},r.isReadableStream=e=>e&&"function"==typeof e.getReader},{}],"7hUEG":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("err-code"),n=e("browser-readablestream-to-it"),s=e("it-peekable"),o=e("it-map"),a=e("./utils.js"),c=e("ipfs-unixfs");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(i),d=u(n),f=u(s),h=u(o);async function p(e,t){const{path:r,mode:i,mtime:n,content:s}=e,o={path:r||"",mode:c.parseMode(i),mtime:c.parseMtime(n)};return s?o.content=await t(s):r||(o.content=await t(e)),o}r.normalise=async function*(e,t){if(null==e)throw l.default(new Error(`Unexpected input: ${e}`),"ERR_UNEXPECTED_INPUT");if("string"==typeof e||e instanceof String)yield p(e.toString(),t);else if(a.isBytes(e)||a.isBlob(e))yield p(e,t);else{if(a.isReadableStream(e)&&(e=d.default(e)),Symbol.iterator in e||Symbol.asyncIterator in e){const r=f.default(e),{value:i,done:n}=await r.peek();if(n)return void(yield*[]);if(r.push(i),Number.isInteger(i)||a.isBytes(i))return void(yield p(r,t));if(i._readableState)return void(yield*h.default(r,(e=>p({content:e},t))));if(a.isFileObject(i)||a.isBlob(i)||"string"==typeof i||i instanceof String)return void(yield*h.default(r,(e=>p(e,t))));if(i[Symbol.iterator]||i[Symbol.asyncIterator]||a.isReadableStream(i))return void(yield*h.default(r,(e=>p(e,t))))}if(!a.isFileObject(e))throw l.default(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT");yield p(e,t)}}},{"err-code":"chZjB","browser-readablestream-to-it":"aUa4D","it-peekable":"bi9X1","it-map":"eeqPk","./utils.js":"ded5K","ipfs-unixfs":"dF9VO"}],"1Nm8o":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=e=>{const t={},r=e.split("-");switch(r.length){case 1:t.avgChunkSize=262144;break;case 2:t.avgChunkSize=n(r[1],"avg");break;case 4:t.minChunkSize=n(r[1],"min"),t.avgChunkSize=n(r[2],"avg"),t.maxChunkSize=n(r[3],"max");break;default:throw new Error('Incorrect chunker format (expected "rabin" "rabin-[avg]" or "rabin-[min]-[avg]-[max]"')}return t},n=(e,t)=>{const r=parseInt(e);if(isNaN(r))throw new Error(`Chunker parameter ${t} must be an integer`);return r};r.parseChunkSize=n,r.parseChunkerString=e=>{if(e){if(e.startsWith("size-")){const t=e.split("-")[1],r=parseInt(t);if(isNaN(r))throw new Error("Chunker parameter size must be an integer");return{chunker:"fixed",maxChunkSize:r}}if(e.startsWith("rabin"))return{chunker:"rabin",...i(e)};throw new Error(`Unrecognized chunker option: ${e}`)}return{chunker:"fixed"}},r.parseRabinString=i},{}],dOhzw:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-unixfs-exporter"),n=e("../utils.js"),s=e("ipfs-core-utils/with-timeout-option"),o=e("multiformats/cid");r.createCat=function({repo:e,preload:t}){return s.withTimeoutOption((async function*(r,s={}){if(r=n.normalizeCidPath(r),!1!==s.preload){const e=r.split("/");t(o.CID.parse(e[0]))}const a=await i.exporter(r,e.blocks,s);if("directory"===a.type)throw new Error("this dag node is a directory");if(!a.content)throw new Error("this dag node has no content");yield*a.content(s)}))}},{"ipfs-unixfs-exporter":"BgMiX","../utils.js":"cT4uN","ipfs-core-utils/with-timeout-option":"j29MK","multiformats/cid":"9ooAY"}],BgMiX:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("err-code"),n=e("multiformats/cid"),s=e("./resolvers/index.js"),o=e("it-last");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(i),u=a(o);const l=e=>{if(e instanceof Uint8Array)return{cid:n.CID.decode(e),toResolve:[]};const t=n.CID.asCID(e);if(t)return{cid:t,toResolve:[]};if("string"==typeof e){0===e.indexOf("/ipfs/")&&(e=e.substring(6));const t=((e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean))(e);return{cid:n.CID.parse(t[0]),toResolve:t.slice(1)}}throw c.default(new Error(`Unknown path type ${e}`),"ERR_BAD_PATH")};async function*d(e,t,r={}){let{cid:i,toResolve:n}=l(e),o=i.toString(),a=o;const u=n.length;for(;;){const l=await s(i,o,a,n,u,t,r);if(!l.entry&&!l.next)throw c.default(new Error(`Could not resolve ${e}`),"ERR_NOT_FOUND");if(l.entry&&(yield l.entry),!l.next)return;n=l.next.toResolve,i=l.next.cid,o=l.next.name,a=l.next.path}}async function f(e,t,r={}){const i=await u.default(d(e,t,r));if(!i)throw c.default(new Error(`Could not resolve ${e}`),"ERR_NOT_FOUND");return i}r.exporter=f,r.recursive=async function*(e,t,r={}){const i=await f(e,t,r);if(i&&(yield i,"directory"===i.type))for await(const e of async function*e(t,r){for await(const i of t.content(r))yield i,i instanceof Uint8Array||"directory"===i.type&&(yield*e(i,r))}(i,r))yield e},r.walkPath=d},{"err-code":"chZjB","multiformats/cid":"9ooAY","./resolvers/index.js":"9Jksl","it-last":"cSXX9"}],"9Jksl":[function(e,t,r){"use strict";var i=e("err-code"),n=e("@ipld/dag-pb"),s=e("@ipld/dag-cbor"),o=e("multiformats/codecs/raw"),a=e("multiformats/hashes/identity"),c=e("./unixfs-v1/index.js"),u=e("./raw.js"),l=e("./dag-cbor.js"),d=e("./identity.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function h(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var p=f(i),g=h(n),y=h(s),m=h(o);const b={[g.code]:c,[m.code]:u,[y.code]:l,[a.identity.code]:d};t.exports=function e(t,r,i,n,s,o,a){const c=b[t.code];if(!c)throw p.default(new Error(`No resolver for code ${t.code}`),"ERR_NO_RESOLVER");return c(t,r,i,n,e,s,o,a)}},{"err-code":"chZjB","@ipld/dag-pb":"i2cdx","@ipld/dag-cbor":"3498i","multiformats/codecs/raw":"fdfgp","multiformats/hashes/identity":"eYCZn","./unixfs-v1/index.js":"fnWJf","./raw.js":"7dtUh","./dag-cbor.js":"9CgTa","./identity.js":"lAVdS"}],fnWJf:[function(e,t,r){"use strict";var i=e("err-code"),n=e("ipfs-unixfs"),s=e("../../utils/find-cid-in-shard.js"),o=e("@ipld/dag-pb"),a=e("./content/file.js"),c=e("./content/directory.js"),u=e("./content/hamt-sharded-directory.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=l(i);const f={raw:a,file:a,directory:c,"hamt-sharded-directory":u,metadata:(e,t,r,i,n,s,o)=>()=>[],symlink:(e,t,r,i,n,s,o)=>()=>[]};t.exports=async(e,t,r,i,a,c,u,l)=>{const h=await u.get(e,l),p=o.decode(h);let g,y;if(t||(t=e.toString()),null==p.Data)throw d.default(new Error("no data in PBNode"),"ERR_NOT_UNIXFS");try{g=n.UnixFS.unmarshal(p.Data)}catch(e){throw d.default(e,"ERR_NOT_UNIXFS")}if(r||(r=t),i.length){let e;if(e=g&&"hamt-sharded-directory"===g.type?await s(p,i[0],u):((e,t)=>{const r=e.Links.find((e=>e.Name===t));return r&&r.Hash})(p,i[0]),!e)throw d.default(new Error("file does not exist"),"ERR_NOT_FOUND");const t=i.shift();y={cid:e,toResolve:i,name:t||"",path:`${r}/${t}`}}return{entry:{type:g.isDirectory()?"directory":"file",name:t,path:r,cid:e,content:f[g.type](e,p,g,r,a,c,u),unixfs:g,depth:c,node:p,size:g.fileSize()},next:y}}},{"err-code":"chZjB","ipfs-unixfs":"dF9VO","../../utils/find-cid-in-shard.js":"8EIYq","@ipld/dag-pb":"i2cdx","./content/file.js":"bQPcT","./content/directory.js":"kXtRz","./content/hamt-sharded-directory.js":"f7k0P"}],"8EIYq":[function(e,t,r){"use strict";var i=e("hamt-sharding"),n=e("@ipld/dag-pb"),s=e("@multiformats/murmur3");const o=async function(e){return(await s.murmur3128.encode(e)).slice(0,8).reverse()},a=e=>e.toString(16).toUpperCase().padStart(2,"0").substring(0,2),c=async(e,t,r,s,u)=>{if(!s){const e=i.createHAMT({hashFn:o});s={rootBucket:e,hamtDepth:1,lastBucket:e}}var l,d,f;await(l=e.Links,d=s.lastBucket,f=s.rootBucket,Promise.all(l.map((e=>{if(null==e.Name)throw new Error("Unexpected Link without a Name");if(2===e.Name.length){const t=parseInt(e.Name,16);return d._putObjectAt(t,new i.Bucket({hash:f._options.hash,bits:f._options.bits},d,t))}return f.put(e.Name.substring(2),!0)}))));const h=await s.rootBucket._findNewBucketAndPos(t);let p=a(h.pos);const g=(e=>{let t=e.bucket;const r=[];for(;t._parent;)r.push(t),t=t._parent;return r.push(t),r.reverse()})(h);g.length>s.hamtDepth&&(s.lastBucket=g[s.hamtDepth],p=a(s.lastBucket._posAtParent));const y=e.Links.find((e=>{if(null==e.Name)return!1;const r=e.Name.substring(0,2),i=e.Name.substring(2);return r===p&&(!i||i===t)}));if(!y)return null;if(null!=y.Name&&y.Name.substring(2)===t)return y.Hash;s.hamtDepth++;const m=await r.get(y.Hash,u);return e=n.decode(m),c(e,t,r,s,u)};t.exports=c},{"hamt-sharding":"1SDvb","@ipld/dag-pb":"i2cdx","@multiformats/murmur3":"5DFrl"}],bQPcT:[function(e,t,r){"use strict";var i=e("../../../utils/extract-data-from-block.js"),n=e("../../../utils/validate-offset-and-length.js"),s=e("ipfs-unixfs"),o=e("err-code"),a=e("@ipld/dag-pb"),c=e("@ipld/dag-cbor"),u=e("multiformats/codecs/raw");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var f=l(o),h=d(a),p=d(c),g=d(u);async function*y(e,t,r,n,o=0,a){if(t instanceof Uint8Array){const e=i(t,o,r,n);return e.length&&(yield e),o+=e.length}if(null==t.Data)throw f.default(new Error("no data in PBNode"),"ERR_NOT_UNIXFS");let c;try{c=s.UnixFS.unmarshal(t.Data)}catch(e){throw f.default(e,"ERR_NOT_UNIXFS")}if(c.data&&c.data.length){const e=i(c.data,o,r,n);e.length&&(yield e),o+=c.data.length}let u=o;for(let i=0;i<t.Links.length;i++){const s=t.Links[i],l=o+c.blockSizes[i];if(r>=u&&r<l||n>u&&n<=l||r<u&&n>l){const t=await e.get(s.Hash,{signal:a.signal});let i;switch(s.Hash.code){case h.code:i=await h.decode(t);break;case g.code:i=t;break;case p.code:i=await p.decode(t);break;default:throw Error(`Unsupported codec: ${s.Hash.code}`)}for await(const t of y(e,i,r,n,o,a))o+=t.length,yield t}o=l,u=l+1}}t.exports=(e,t,r,i,s,o,a)=>function(e={}){const i=r.fileSize();if(void 0===i)throw new Error("File was a directory");const{offset:s,length:o}=n(i,e.offset,e.length);return y(a,t,s,s+o,0,e)}},{"../../../utils/extract-data-from-block.js":"Trn4t","../../../utils/validate-offset-and-length.js":"gF8ya","ipfs-unixfs":"dF9VO","err-code":"chZjB","@ipld/dag-pb":"i2cdx","@ipld/dag-cbor":"3498i","multiformats/codecs/raw":"fdfgp"}],Trn4t:[function(e,t,r){"use strict";t.exports=function(e,t,r,i){const n=t+e.length;return r>=n||i<t?new Uint8Array(0):(i>=t&&i<n&&(e=e.slice(0,i-t)),r>=t&&r<n&&(e=e.slice(r-t)),e)}},{}],gF8ya:[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=i(e("err-code"));t.exports=(e,t,r)=>{if(t||(t=0),t<0)throw n.default(new Error("Offset must be greater than or equal to 0"),"ERR_INVALID_PARAMS");if(t>e)throw n.default(new Error("Offset must be less than the file size"),"ERR_INVALID_PARAMS");if(r||0===r||(r=e-t),r<0)throw n.default(new Error("Length must be greater than or equal to 0"),"ERR_INVALID_PARAMS");return t+r>e&&(r=e-t),{offset:t,length:r}}},{"err-code":"chZjB"}],kXtRz:[function(e,t,r){"use strict";t.exports=(e,t,r,i,n,s,o)=>async function*(e={}){const r=e.offset||0,a=e.length||t.Links.length,c=t.Links.slice(r,a);for(const t of c){const r=await n(t.Hash,t.Name||"",`${i}/${t.Name||""}`,[],s+1,o,e);r.entry&&(yield r.entry)}}},{}],f7k0P:[function(e,t,r){"use strict";var i=e("@ipld/dag-pb");async function*n(e,t,r,s,o,a){const c=e.Links;for(const u of c){const c=null!=u.Name?u.Name.substring(2):null;if(c){const e=await r(u.Hash,c,`${t}/${c}`,[],s+1,o,a);yield e.entry}else{const c=await o.get(u.Hash);e=i.decode(c);for await(const i of n(e,t,r,s,o,a))yield i}}}t.exports=(e,t,r,i,s,o,a)=>function(e={}){return n(t,i,s,o,a,e)}},{"@ipld/dag-pb":"i2cdx"}],"7dtUh":[function(e,t,r){"use strict";var i=e("err-code"),n=e("../utils/extract-data-from-block.js"),s=e("../utils/validate-offset-and-length.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(i);t.exports=async(e,t,r,i,o,c,u,l)=>{if(i.length)throw a.default(new Error(`No link named ${r} found in raw node ${e}`),"ERR_NOT_FOUND");const d=await u.get(e,l);return{entry:{type:"raw",name:t,path:r,cid:e,content:(f=d,async function*(e={}){const{offset:t,length:r}=s(f.length,e.offset,e.length);yield n(f,0,t,t+r)}),depth:c,size:d.length,node:d}};var f}},{"err-code":"chZjB","../utils/extract-data-from-block.js":"Trn4t","../utils/validate-offset-and-length.js":"gF8ya"}],"9CgTa":[function(e,t,r){"use strict";var i=e("multiformats/cid"),n=e("err-code"),s=e("@ipld/dag-cbor");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var c=o(n),u=a(s);t.exports=async(e,t,r,n,s,o,a,l)=>{const d=await a.get(e),f=u.decode(d);let h=f,p=r;for(;n.length;){const s=n[0];if(!(s in h))throw c.default(new Error(`No property named ${s} found in cbor node ${e}`),"ERR_NO_PROP");{n.shift(),p=`${p}/${s}`;const a=i.CID.asCID(h[s]);if(a)return{entry:{type:"object",name:t,path:r,cid:e,node:d,depth:o,size:d.length,content:async function*(){yield f}},next:{cid:a,name:s,path:p,toResolve:n}};h=h[s]}}return{entry:{type:"object",name:t,path:r,cid:e,node:d,depth:o,size:d.length,content:async function*(){yield f}}}}},{"multiformats/cid":"9ooAY","err-code":"chZjB","@ipld/dag-cbor":"3498i"}],lAVdS:[function(e,t,r){"use strict";var i=e("err-code"),n=e("../utils/extract-data-from-block.js"),s=e("../utils/validate-offset-and-length.js"),o=e("multiformats/hashes/digest");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=a(i),l=c(o);t.exports=async(e,t,r,i,o,a,c,d)=>{if(i.length)throw u.default(new Error(`No link named ${r} found in raw node ${e}`),"ERR_NOT_FOUND");const f=await l.decode(e.multihash.bytes);return{entry:{type:"identity",name:t,path:r,cid:e,content:(h=f.digest,async function*(e={}){const{offset:t,length:r}=s(h.length,e.offset,e.length);yield n(h,0,t,t+r)}),depth:a,size:f.digest.length,node:f.digest}};var h}},{"err-code":"chZjB","../utils/extract-data-from-block.js":"Trn4t","../utils/validate-offset-and-length.js":"gF8ya","multiformats/hashes/digest":"kpRBg"}],"3pEGl":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-unixfs-exporter"),n=e("err-code"),s=e("../utils.js"),o=e("ipfs-core-utils/with-timeout-option"),a=e("multiformats/cid"),c=e("it-tar"),u=e("it-pipe"),l=e("pako"),d=e("it-map"),f=e("it-to-buffer");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=h(n),g=h(l),y=h(d),m=h(f);r.createGet=function({repo:e,preload:t}){return o.withTimeoutOption((async function*(r,n={}){if(n.compressionLevel<0||n.compressionLevel>9)throw p.default(new Error("Compression level must be between 1 and 9"),"ERR_INVALID_PARAMS");if(!1!==n.preload){let e;try{e=s.normalizeCidPath(r).split("/")}catch(e){throw p.default(e,"ERR_INVALID_PATH")}t(a.CID.parse(e[0]))}const o=a.CID.asCID(r)||r,l=await i.exporter(o,e.blocks,n);if("file"===l.type||"raw"===l.type){const e=[];return n.compress&&!0!==n.archive?e.push(l.content):e.push([{header:{name:l.path,mode:"file"===l.type&&l.unixfs.mode,mtime:"file"===l.type&&l.unixfs.mtime?new Date(1e3*l.unixfs.mtime.secs):void 0,size:l.size,type:"file"},body:l.content()}],c.pack(),(e=>y.default(e,(e=>e.slice())))),n.compress&&e.push((async function*(e){const t=await m.default(e);yield g.default.gzip(t,{level:n.compressionLevel||6})})),void(yield*u.pipe(...e))}if("directory"!==l.type)throw p.default(new Error("Not a UnixFS node"),"ERR_NOT_UNIXFS");{const t=[i.recursive(o,e.blocks,n),async function*(e){for await(const t of e){const e={header:{name:t.path,size:t.size}};if("file"===t.type)e.header.type="file",e.header.mode=null!=t.unixfs.mode?t.unixfs.mode:void 0,e.header.mtime=t.unixfs.mtime?new Date(1e3*t.unixfs.mtime.secs):void 0,e.body=t.content();else if("raw"===t.type)e.header.type="file",e.body=t.content();else{if("directory"!==t.type)throw p.default(new Error("Not a UnixFS node"),"ERR_NOT_UNIXFS");e.header.type="directory",e.header.mode=null!=t.unixfs.mode?t.unixfs.mode:void 0,e.header.mtime=t.unixfs.mtime?new Date(1e3*t.unixfs.mtime.secs):void 0}yield e}},c.pack(),e=>y.default(e,(e=>e.slice()))];if(n.compress){if(!n.archive)throw p.default(new Error("file is not regular"),"ERR_INVALID_PATH");n.compress&&t.push((async function*(e){const t=await m.default(e);yield g.default.gzip(t,{level:n.compressionLevel||6})}))}yield*u.pipe(...t)}}))}},{"ipfs-unixfs-exporter":"BgMiX","err-code":"chZjB","../utils.js":"cT4uN","ipfs-core-utils/with-timeout-option":"j29MK","multiformats/cid":"9ooAY","it-tar":"3xygI","it-pipe":"giKBQ",pako:"ibwO8","it-map":"eeqPk","it-to-buffer":"38Qf6"}],"3xygI":[function(e,t,r){r.extract=e("./extract"),r.pack=e("./pack")},{"./extract":"b9Qck","./pack":"7XvZX"}],b9Qck:[function(e,t,r){const i=e("p-defer"),n=e("./extract-headers"),s=e("./lte-reader");async function o(e,t){const r=function(e){return(e&=511)&&512-e}(t);r&&await e.next(r)}t.exports=e=>((e=e||{}).highWaterMark=e.highWaterMark||16384,t=>async function*(){const r=s(t);let a,c,u,l;try{for(;;){let t;try{const{done:e,value:i}=await r.next(512);if(e)return;t=i}catch(e){if("ERR_UNDER_READ"===e.code)return;throw e}const s=n.decode(t,e.filenameEncoding);if(!s)continue;if("gnu-long-path"===s.type){const{done:t,value:i}=await r.next(s.size);if(t)return;a=n.decodeLongPath(i,e.filenameEncoding),await o(r,s.size);continue}if("gnu-long-link-path"===s.type){const{done:t,value:i}=await r.next(s.size);if(t)return;c=n.decodeLongPath(i,e.filenameEncoding),await o(r,s.size);continue}if("pax-global-header"===s.type){const{done:t,value:i}=await r.next(s.size);if(t)return;u=n.decodePax(i,e.filenameEncoding),await o(r,s.size);continue}if("pax-header"===s.type){const{done:t,value:i}=await r.next(s.size);if(t)return;l=n.decodePax(i,e.filenameEncoding),u&&(l={...u,...l}),await o(r,s.size);continue}if(a&&(s.name=a,a=null),c&&(s.linkname=c,c=null),l&&(l.path&&(s.name=l.path),l.linkpath&&(s.linkname=l.linkpath),l.size&&(s.size=parseInt(l.size,10)),s.pax=l,l=null),!s.size||"directory"===s.type){yield{header:s,body:async function*(){}()};continue}let d=s.size;const f=i(),h=await r.nextLte(Math.min(d,e.highWaterMark));d-=h.value.length,d||f.resolve();const p=async function*(){try{for(yield h.value;d;){const{done:e,value:t}=await r.nextLte(d);if(e)return void(d=0);d-=t.length,yield t}}finally{f.resolve()}}();if(yield{header:s,body:p},await f.promise,d)for await(const e of p);await o(r,s.size)}}finally{await r.return()}}())},{"p-defer":"5rKSv","./extract-headers":"i80wA","./lte-reader":"2v3aC"}],i80wA:[function(e,t,r){const{Buffer:i}=e("buffer"),n=e("bl/BufferList"),s="0".charCodeAt(0),o=i.from("ustar\0","binary"),a=i.from("ustar ","binary"),c=i.from(" \0","binary"),u=257,l=function(e,t,r,i){for(;r<i;r++)if(e.get(r)===t)return r;return i};const d=function(e,t,r){if(e=e.shallowSlice(t,t+r),t=0,128&e.get(t))return function(e){let t;if(128===e.get(0))t=!0;else{if(255!==e.get(0))return null;t=!1}let r=!1;const i=[];for(let n=e.length-1;n>0;n--){const s=e.get(n);t?i.push(s):r&&0===s?i.push(0):r?(r=!1,i.push(256-s)):i.push(255-s)}let n=0;const s=i.length;for(let e=0;e<s;e++)n+=i[e]*Math.pow(256,e);return t?n:-1*n}(e);{for(;t<e.length&&32===e.get(t);)t++;const r=(i=l(e,32,t,e.length),n=e.length,s=e.length,"number"!=typeof i?s:(i=~~i)>=n?n:i>=0||(i+=n)>=0?i:0);for(;t<r&&0===e.get(t);)t++;return r===t?0:parseInt(e.shallowSlice(t,r).toString(),8)}var i,n,s},f=function(e,t,r,i){return e.shallowSlice(t,l(e,0,t,t+r)).toString(i)};r.decodeLongPath=function(e,t){return e=n.isBufferList(e)?e:new n(e),f(e,0,e.length,t)},r.decodePax=function(e){e=n.isBufferList(e)?e:new n(e);const t={};for(;e.length;){let r=0;for(;r<e.length&&32!==e.get(r);)r++;const i=parseInt(e.shallowSlice(0,r).toString(),10);if(!i)return t;const n=e.shallowSlice(r+1,i-1).toString(),s=n.indexOf("=");if(-1===s)return t;t[n.slice(0,s)]=n.slice(s+1),e=e.shallowSlice(i)}return t},r.decode=function(e,t){let r=0===(e=n.isBufferList(e)?e:new n(e)).get(156)?0:e.get(156)-s,i=f(e,0,100,t);const l=d(e,100,8),h=d(e,108,8),p=d(e,116,8),g=d(e,124,12),y=d(e,136,12),m=function(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}(r),b=0===e.get(157)?null:f(e,157,100,t),v=f(e,265,32),w=f(e,297,32),_=d(e,329,8),E=d(e,337,8),S=function(e){let t=256;for(let r=0;r<148;r++)t+=e.get(r);for(let r=156;r<512;r++)t+=e.get(r);return t}(e);if(256===S)return null;if(S!==d(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(0===o.compare(e.slice(u,263)))e.get(345)&&(i=f(e,345,155,t)+"/"+i);else if(0!==a.compare(e.slice(u,263))||0!==c.compare(e.slice(263,265)))throw new Error("Invalid tar header: unknown format.");return 0===r&&i&&"/"===i[i.length-1]&&(r=5),{name:i,mode:l,uid:h,gid:p,size:g,mtime:new Date(1e3*y),type:m,linkname:b,uname:v,gname:w,devmajor:_,devminor:E}}},{buffer:"etowf","bl/BufferList":"im7j6"}],"2v3aC":[function(e,t,r){const i=e("bl/BufferList"),n=e("it-reader");t.exports=function(e){const t=n(e);let r;const s={[Symbol.asyncIterator]:()=>s,async next(e){if(r){let n;if(null==e||r.length===e)n=r,r=null;else if(r.length>e)n=r.shallowSlice(0,e),r=r.shallowSlice(e);else if(r.length<e){const{value:s,done:o}=await t.next(e-r.length);if(o)throw Object.assign(new Error(`stream ended before ${e-r.length} bytes became available`),{code:"ERR_UNDER_READ"});n=new i([r,s]),r=null}return{value:n}}return t.next(e)},async nextLte(e){let{done:t,value:n}=await s.next();return t?{done:t}:n.length<=e?{value:n}:(n=i.isBufferList(n)?n:new i(n),r?r.append(n.shallowSlice(e)):r=n.shallowSlice(e),{value:n.shallowSlice(0,e)})},return:()=>t.return()};return s}},{"bl/BufferList":"im7j6","it-reader":"btxDo"}],btxDo:[function(e,t,r){const i=e("bl/BufferList");t.exports=e=>{const t=async function*(){let t=yield,r=new i;for await(const n of e)if(t)for(r.append(n);r.length>=t;){const e=r.shallowSlice(0,t);if(r.consume(t),t=yield e,!t){r.length&&(t=yield r,r=new i);break}}else t=yield r.append(n),r=new i;if(t)throw Object.assign(new Error(`stream ended before ${t} bytes became available`),{code:"ERR_UNDER_READ",buffer:r})}();return t.next(),t}},{"bl/BufferList":"im7j6"}],"7XvZX":[function(e,t,r){const{Buffer:i}=e("buffer"),n=e("bl/BufferList"),{S_IFMT:s,S_IFBLK:o,S_IFCHR:a,S_IFDIR:c,S_IFIFO:u,S_IFLNK:l}=e("iso-constants"),d=e("it-concat"),f=e("./pack-headers"),h=parseInt("755",8),p=parseInt("644",8),g=i.alloc(1024);function y(e){switch(e&s){case o:return"block-device";case a:return"character-device";case c:return"directory";case u:return"fifo";case l:return"symlink"}return"file"}function m(e){if(e&=511)return new n(g.slice(0,512-e))}function b(e){if(!e.pax){const t=f.encode(e);if(t)return t}return function(e){const t=f.encodePax({name:e.name,linkname:e.linkname,pax:e.pax}),r={name:"PaxHeader",mode:e.mode,uid:e.uid,gid:e.gid,size:t.length,mtime:e.mtime,type:"pax-header",linkname:e.linkname&&"PaxHeader",uname:e.uname,gname:e.gname,devmajor:e.devmajor,devminor:e.devminor};return new n([f.encode(r),t,m(t.length),f.encode({...r,size:e.size,type:e.type})])}(e)}t.exports=()=>async function*(e){for await(let{header:t,body:r}of e){if(t.size&&"symlink"!==t.type||(t.size=0),t.type||(t.type=y(t.mode)),t.mode||(t.mode="directory"===t.type?h:p),t.uid||(t.uid=0),t.gid||(t.gid=0),t.mtime||(t.mtime=new Date),"string"==typeof r&&(r=i.from(r)),i.isBuffer(r)||n.isBufferList(r)){t.size=r.length,yield new n([b(t),r,m(t.size)]);continue}if("symlink"===t.type&&!t.linkname){t.linkname=(await d(r)).toString(),yield b(t);continue}if(yield b(t),"file"!==t.type&&"contiguous-file"!==t.type)continue;let e=0;for await(const t of r)e+=t.length,yield n.isBufferList(t)?t:new n(t);if(e!==t.size)throw new Error("size mismatch");const s=m(t.size);s&&(yield s)}yield new n(g)}},{buffer:"etowf","bl/BufferList":"im7j6","iso-constants":"4lhZA","it-concat":"9rWFO","./pack-headers":"49ru5"}],"4lhZA":[function(e,t,r){"use strict";t.exports={RTLD_LAZY:1,RTLD_NOW:2,RTLD_GLOBAL:256,RTLD_LOCAL:0,RTLD_DEEPBIND:8,E2BIG:7,EACCES:13,EADDRINUSE:98,EADDRNOTAVAIL:99,EAFNOSUPPORT:97,EAGAIN:11,EALREADY:114,EBADF:9,EBADMSG:74,EBUSY:16,ECANCELED:125,ECHILD:10,ECONNABORTED:103,ECONNREFUSED:111,ECONNRESET:104,EDEADLK:35,EDESTADDRREQ:89,EDOM:33,EDQUOT:122,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:113,EIDRM:43,EILSEQ:84,EINPROGRESS:115,EINTR:4,EINVAL:22,EIO:5,EISCONN:106,EISDIR:21,ELOOP:40,EMFILE:24,EMLINK:31,EMSGSIZE:90,EMULTIHOP:72,ENAMETOOLONG:36,ENETDOWN:100,ENETRESET:102,ENETUNREACH:101,ENFILE:23,ENOBUFS:105,ENODATA:61,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:37,ENOLINK:67,ENOMEM:12,ENOMSG:42,ENOPROTOOPT:92,ENOSPC:28,ENOSR:63,ENOSTR:60,ENOSYS:38,ENOTCONN:107,ENOTDIR:20,ENOTEMPTY:39,ENOTSOCK:88,ENOTSUP:95,ENOTTY:25,ENXIO:6,EOPNOTSUPP:95,EOVERFLOW:75,EPERM:1,EPIPE:32,EPROTO:71,EPROTONOSUPPORT:93,EPROTOTYPE:91,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:116,ETIME:62,ETIMEDOUT:110,ETXTBSY:26,EWOULDBLOCK:11,EXDEV:18,PRIORITY_LOW:19,PRIORITY_BELOW_NORMAL:10,PRIORITY_NORMAL:0,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20,SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGBUS:7,SIGFPE:8,SIGKILL:9,SIGUSR1:10,SIGSEGV:11,SIGUSR2:12,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGCHLD:17,SIGSTKFLT:16,SIGCONT:18,SIGSTOP:19,SIGTSTP:20,SIGTTIN:21,SIGTTOU:22,SIGURG:23,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGIO:29,SIGPOLL:29,SIGPWR:30,SIGSYS:31,SIGUNUSED:31,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,O_RDONLY:0,O_WRONLY:1,O_RDWR:2,UV_DIRENT_UNKNOWN:0,UV_DIRENT_FILE:1,UV_DIRENT_DIR:2,UV_DIRENT_LINK:3,UV_DIRENT_FIFO:4,UV_DIRENT_SOCKET:5,UV_DIRENT_CHAR:6,UV_DIRENT_BLOCK:7,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,UV_FS_O_FILEMAP:0,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_DSYNC:4096,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_COPYFILE_EXCL:1,COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_FICLONE_FORCE:4,OPENSSL_VERSION_NUMBER:269488319,SSL_OP_ALL:2147485780,SSL_OP_ALLOW_NO_DHE_KEX:1024,SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION:262144,SSL_OP_CIPHER_SERVER_PREFERENCE:4194304,SSL_OP_CISCO_ANYCONNECT:32768,SSL_OP_COOKIE_EXCHANGE:8192,SSL_OP_CRYPTOPRO_TLSEXT_BUG:2147483648,SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:2048,SSL_OP_EPHEMERAL_RSA:0,SSL_OP_LEGACY_SERVER_CONNECT:4,SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER:0,SSL_OP_MICROSOFT_SESS_ID_BUG:0,SSL_OP_MSIE_SSLV2_RSA_PADDING:0,SSL_OP_NETSCAPE_CA_DN_BUG:0,SSL_OP_NETSCAPE_CHALLENGE_BUG:0,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG:0,SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG:0,SSL_OP_NO_COMPRESSION:131072,SSL_OP_NO_ENCRYPT_THEN_MAC:524288,SSL_OP_NO_QUERY_MTU:4096,SSL_OP_NO_RENEGOTIATION:1073741824,SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION:65536,SSL_OP_NO_SSLv2:0,SSL_OP_NO_SSLv3:33554432,SSL_OP_NO_TICKET:16384,SSL_OP_NO_TLSv1:67108864,SSL_OP_NO_TLSv1_1:268435456,SSL_OP_NO_TLSv1_2:134217728,SSL_OP_NO_TLSv1_3:536870912,SSL_OP_PKCS1_CHECK_1:0,SSL_OP_PKCS1_CHECK_2:0,SSL_OP_PRIORITIZE_CHACHA:2097152,SSL_OP_SINGLE_DH_USE:0,SSL_OP_SINGLE_ECDH_USE:0,SSL_OP_SSLEAY_080_CLIENT_DH_BUG:0,SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG:0,SSL_OP_TLS_BLOCK_PADDING_BUG:0,SSL_OP_TLS_D5_BUG:0,SSL_OP_TLS_ROLLBACK_BUG:8388608,ENGINE_METHOD_RSA:1,ENGINE_METHOD_DSA:2,ENGINE_METHOD_DH:4,ENGINE_METHOD_RAND:8,ENGINE_METHOD_EC:2048,ENGINE_METHOD_CIPHERS:64,ENGINE_METHOD_DIGESTS:128,ENGINE_METHOD_PKEY_METHS:512,ENGINE_METHOD_PKEY_ASN1_METHS:1024,ENGINE_METHOD_ALL:65535,ENGINE_METHOD_NONE:0,DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,RSA_PSS_SALTLEN_DIGEST:-1,RSA_PSS_SALTLEN_MAX_SIGN:-2,RSA_PSS_SALTLEN_AUTO:-2,defaultCoreCipherList:"TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA",TLS1_VERSION:769,TLS1_1_VERSION:770,TLS1_2_VERSION:771,TLS1_3_VERSION:772,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},{}],"9rWFO":[function(e,t,r){const i=e("bl/BufferList"),n={string:()=>"",buffer:()=>i()};t.exports=async(e,t)=>{if((t=t||{}).type&&!n[t.type])throw new Error(`invalid type "${t.type}"`);let r,i;for await(const s of e)r||(i=t.type||("string"==typeof s?"string":"buffer"),r=n[i]()),"string"===i?r+=s:r.append(s);return r||n[t.type||"buffer"]()}},{"bl/BufferList":"im7j6"}],"49ru5":[function(e,t,r){const{Buffer:i}=e("buffer"),n=i.alloc,s="0".charCodeAt(0),o=i.from("ustar\0","binary"),a=i.from("00","binary"),c=parseInt("7777",8),u=function(e,t){return(e=e.toString(8)).length>t?"7777777777777777777".slice(0,t)+" ":"0000000000000000000".slice(0,t-e.length)+e+" "},l=function(e){const t=i.byteLength(e);let r=Math.floor(Math.log(t)/Math.log(10))+1;return t+r>=Math.pow(10,r)&&r++,t+r+e};r.encodePax=function(e){let t="";e.name&&(t+=l(" path="+e.name+"\n")),e.linkname&&(t+=l(" linkpath="+e.linkname+"\n"));const r=e.pax;if(r)for(const e in r)t+=l(" "+e+"="+r[e]+"\n");return i.from(t)},r.encode=function(e){const t=n(512);let r=e.name,l="";if(5===e.typeflag&&"/"!==r[r.length-1]&&(r+="/"),i.byteLength(r)!==r.length)return null;for(;i.byteLength(r)>100;){const e=r.indexOf("/");if(-1===e)return null;l+=l?"/"+r.slice(0,e):r.slice(0,e),r=r.slice(e+1)}return i.byteLength(r)>100||i.byteLength(l)>155||e.linkname&&i.byteLength(e.linkname)>100?null:(t.write(r),t.write(u(e.mode&c,6),100),t.write(u(e.uid,6),108),t.write(u(e.gid,6),116),t.write(u(e.size,11),124),t.write(u(e.mtime.getTime()/1e3|0,11),136),t[156]=s+function(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}(e.type),e.linkname&&t.write(e.linkname,157),o.copy(t,257),a.copy(t,263),e.uname&&t.write(e.uname,265),e.gname&&t.write(e.gname,297),t.write(u(e.devmajor||0,6),329),t.write(u(e.devminor||0,6),337),l&&t.write(l,345),t.write(u(function(e){let t=256;for(let r=0;r<148;r++)t+=e[r];for(let r=156;r<512;r++)t+=e[r];return t}(t),6),148),t)}},{buffer:"etowf"}],ibwO8:[function(e,t,r){"use strict";var i={};(0,e("./lib/utils/common").assign)(i,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=i},{"./lib/utils/common":"aI1i7","./lib/deflate":"j0x9v","./lib/inflate":"fWsHR","./lib/zlib/constants":"822Hi"}],aI1i7:[function(e,t,r){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}r.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)n(r,i)&&(e[i]=r[i])}}return e},r.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var s={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),n);else for(var s=0;s<i;s++)e[n+s]=t[r+s]},flattenChunks:function(e){var t,r,i,n,s,o;for(i=0,t=0,r=e.length;t<r;t++)i+=e[t].length;for(o=new Uint8Array(i),n=0,t=0,r=e.length;t<r;t++)s=e[t],o.set(s,n),n+=s.length;return o}},o={arraySet:function(e,t,r,i,n){for(var s=0;s<i;s++)e[n+s]=t[r+s]},flattenChunks:function(e){return[].concat.apply([],e)}};r.setTyped=function(e){e?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,s)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,o))},r.setTyped(i)},{}],j0x9v:[function(e,t,r){"use strict";var i=e("./zlib/deflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),c=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=n.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var r=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(o[r]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){var l;if(l="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=i.deflateSetDictionary(this.strm,l)))throw new Error(o[r]);this._dict_set=!0}}function l(e,t){var r=new u(t);if(r.push(e,!0),r.err)throw r.msg||o[r.err];return r.result}u.prototype.push=function(e,t){var r,o,a=this.strm,u=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===c.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(u),a.next_out=0,a.avail_out=u),1!==(r=i.deflate(a,o))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||0===a.avail_out)&&1!==r);return 4===o?(r=i.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==o||(this.onEnd(0),a.avail_out=0,!0)},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Deflate=u,r.deflate=l,r.deflateRaw=function(e,t){return(t=t||{}).raw=!0,l(e,t)},r.gzip=function(e,t){return(t=t||{}).gzip=!0,l(e,t)}},{"./zlib/deflate":"eWDtg","./utils/common":"aI1i7","./utils/strings":"gLcvD","./zlib/messages":"2FeB7","./zlib/zstream":"2JH5n"}],eWDtg:[function(e,t,r){"use strict";var i,n=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),c=e("./messages"),u=-2,l=258,d=262,f=103,h=113,p=666;function g(e,t){return e.msg=c[t],t}function y(e){return(e<<1)-(e>4?9:0)}function m(e){for(var t=e.length;--t>=0;)e[t]=0}function b(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(n.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function v(e,t){s._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,b(e.strm)}function w(e,t){e.pending_buf[e.pending++]=t}function _(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function E(e,t){var r,i,n=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,c=e.strstart>e.w_size-d?e.strstart-(e.w_size-d):0,u=e.window,f=e.w_mask,h=e.prev,p=e.strstart+l,g=u[s+o-1],y=u[s+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+o]===y&&u[r+o-1]===g&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&s<p);if(i=l-(p-s),s=p-l,i>o){if(e.match_start=t,o=i,i>=a)break;g=u[s+o-1],y=u[s+o]}}}while((t=h[t&f])>c&&0!=--n);return o<=e.lookahead?o:e.lookahead}function S(e){var t,r,i,s,c,u,l,f,h,p,g=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=g+(g-d)){n.arraySet(e.window,e.window,g,g,0),e.match_start-=g,e.strstart-=g,e.block_start-=g,t=r=e.hash_size;do{i=e.head[--t],e.head[t]=i>=g?i-g:0}while(--r);t=r=g;do{i=e.prev[--t],e.prev[t]=i>=g?i-g:0}while(--r);s+=g}if(0===e.strm.avail_in)break;if(u=e.strm,l=e.window,f=e.strstart+e.lookahead,h=s,p=void 0,(p=u.avail_in)>h&&(p=h),r=0===p?0:(u.avail_in-=p,n.arraySet(l,u.input,u.next_in,p,f),1===u.state.wrap?u.adler=o(u.adler,l,p,f):2===u.state.wrap&&(u.adler=a(u.adler,l,p,f)),u.next_in+=p,u.total_in+=p,p),e.lookahead+=r,e.lookahead+e.insert>=3)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+3-1])&e.hash_mask,e.prev[c&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=c,c++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<d&&0!==e.strm.avail_in)}function T(e,t){for(var r,i;;){if(e.lookahead<d){if(S(e),e.lookahead<d&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-d&&(e.match_length=E(e,r)),e.match_length>=3)if(i=s._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else i=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}function A(e,t){for(var r,i,n;;){if(e.lookahead<d){if(S(e),e.lookahead<d&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-d&&(e.match_length=E(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,i=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(v(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((i=s._tr_tally(e,0,e.window[e.strstart-1]))&&v(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=s._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}function k(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}function I(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new n.Buf16(1146),this.dyn_dtree=new n.Buf16(122),this.bl_tree=new n.Buf16(78),m(this.dyn_ltree),m(this.dyn_dtree),m(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(16),this.heap=new n.Buf16(573),m(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(573),m(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function R(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:h,e.adler=2===t.wrap?0:1,t.last_flush=0,s._tr_init(t),0):g(e,u)}function P(e){var t,r=R(e);return 0===r&&((t=e.state).window_size=2*t.w_size,m(t.head),t.max_lazy_match=i[t.level].max_lazy,t.good_match=i[t.level].good_length,t.nice_match=i[t.level].nice_length,t.max_chain_length=i[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),r}function O(e,t,r,i,s,o){if(!e)return u;var a=1;if(-1===t&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),s<1||s>9||8!==r||i<8||i>15||t<0||t>9||o<0||o>4)return g(e,u);8===i&&(i=9);var c=new I;return e.state=c,c.strm=e,c.wrap=a,c.gzhead=null,c.w_bits=i,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=s+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+3-1)/3),c.window=new n.Buf8(2*c.w_size),c.head=new n.Buf16(c.hash_size),c.prev=new n.Buf16(c.w_size),c.lit_bufsize=1<<s+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new n.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=t,c.strategy=o,c.method=r,P(e)}i=[new k(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(S(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,v(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-d&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(v(e,!1),e.strm.avail_out),1)})),new k(4,4,8,4,T),new k(4,5,16,8,T),new k(4,6,32,32,T),new k(4,4,16,16,A),new k(8,16,32,32,A),new k(8,16,128,128,A),new k(8,32,128,256,A),new k(32,128,258,1024,A),new k(32,258,258,4096,A)],r.deflateInit=function(e,t){return O(e,t,8,15,8,0)},r.deflateInit2=O,r.deflateReset=P,r.deflateResetKeep=R,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,0):u},r.deflate=function(e,t){var r,n,o,c;if(!e||!e.state||t>5||t<0)return e?g(e,u):u;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===p&&4!==t)return g(e,0===e.avail_out?-5:u);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,w(n,31),w(n,139),w(n,8),n.gzhead?(w(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),w(n,255&n.gzhead.time),w(n,n.gzhead.time>>8&255),w(n,n.gzhead.time>>16&255),w(n,n.gzhead.time>>24&255),w(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),w(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(w(n,255&n.gzhead.extra.length),w(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=a(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(w(n,0),w(n,0),w(n,0),w(n,0),w(n,0),w(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),w(n,3),n.status=h);else{var d=8+(n.w_bits-8<<4)<<8;d|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(d|=32),d+=31-d%31,n.status=h,_(n,d),0!==n.strstart&&(_(n,e.adler>>>16),_(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),b(e),o=n.pending,n.pending!==n.pending_buf_size));)w(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),b(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,w(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),b(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,w(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.status=f)}else n.status=f;if(n.status===f&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&b(e),n.pending+2<=n.pending_buf_size&&(w(n,255&e.adler),w(n,e.adler>>8&255),e.adler=0,n.status=h)):n.status=h),0!==n.pending){if(b(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&y(t)<=y(r)&&4!==t)return g(e,-5);if(n.status===p&&0!==e.avail_in)return g(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==p){var E=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(S(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,i,n,o,a=e.window;;){if(e.lookahead<=l){if(S(e),e.lookahead<=l&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=a[n=e.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){o=e.strstart+l;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<o);e.match_length=l-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=s._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(n,t):i[n.level].func(n,t);if(3!==E&&4!==E||(n.status=p),1===E||3===E)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===E&&(1===t?s._tr_align(n):5!==t&&(s._tr_stored_block(n,0,0,!1),3===t&&(m(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),b(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(w(n,255&e.adler),w(n,e.adler>>8&255),w(n,e.adler>>16&255),w(n,e.adler>>24&255),w(n,255&e.total_in),w(n,e.total_in>>8&255),w(n,e.total_in>>16&255),w(n,e.total_in>>24&255)):(_(n,e.adler>>>16),_(n,65535&e.adler)),b(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},r.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==f&&t!==h&&t!==p?g(e,u):(e.state=null,t===h?g(e,-3):0):u},r.deflateSetDictionary=function(e,t){var r,i,s,a,c,l,d,f,h=t.length;if(!e||!e.state)return u;if(2===(a=(r=e.state).wrap)||1===a&&42!==r.status||r.lookahead)return u;for(1===a&&(e.adler=o(e.adler,t,h,0)),r.wrap=0,h>=r.w_size&&(0===a&&(m(r.head),r.strstart=0,r.block_start=0,r.insert=0),f=new n.Buf8(r.w_size),n.arraySet(f,t,h-r.w_size,r.w_size,0),t=f,h=r.w_size),c=e.avail_in,l=e.next_in,d=e.input,e.avail_in=h,e.next_in=0,e.input=t,S(r);r.lookahead>=3;){i=r.strstart,s=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+3-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++}while(--s);r.strstart=i,r.lookahead=2,S(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=l,e.input=d,e.avail_in=c,r.wrap=a,0},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":"aI1i7","./trees":"2tLau","./adler32":"aFgUT","./crc32":"5TUdt","./messages":"2FeB7"}],"2tLau":[function(e,t,r){"use strict";var i=e("../utils/common");function n(e){for(var t=e.length;--t>=0;)e[t]=0}var s=256,o=286,a=30,c=15,u=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],l=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],f=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],h=new Array(576);n(h);var p=new Array(60);n(p);var g=new Array(512);n(g);var y=new Array(256);n(y);var m=new Array(29);n(m);var b,v,w,_=new Array(a);function E(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function S(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function T(e){return e<256?g[e]:g[256+(e>>>7)]}function A(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function k(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,A(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function I(e,t,r){k(e,r[2*t],r[2*t+1])}function R(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function P(e,t,r){var i,n,s=new Array(16),o=0;for(i=1;i<=c;i++)s[i]=o=o+r[i-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=R(s[a]++,a))}}function O(e){var t;for(t=0;t<o;t++)e.dyn_ltree[2*t]=0;for(t=0;t<a;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function C(e){e.bi_valid>8?A(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function j(e,t,r,i){var n=2*t,s=2*r;return e[n]<e[s]||e[n]===e[s]&&i[t]<=i[r]}function D(e,t,r){for(var i=e.heap[r],n=r<<1;n<=e.heap_len&&(n<e.heap_len&&j(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!j(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i}function M(e,t,r){var i,n,o,a,c=0;if(0!==e.last_lit)do{i=e.pending_buf[e.d_buf+2*c]<<8|e.pending_buf[e.d_buf+2*c+1],n=e.pending_buf[e.l_buf+c],c++,0===i?I(e,n,t):(I(e,(o=y[n])+s+1,t),0!==(a=u[o])&&k(e,n-=m[o],a),I(e,o=T(--i),r),0!==(a=l[o])&&k(e,i-=_[o],a))}while(c<e.last_lit);I(e,256,t)}function x(e,t){var r,i,n,s=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,u=t.stat_desc.elems,l=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<u;r++)0!==s[2*r]?(e.heap[++e.heap_len]=l=r,e.depth[r]=0):s[2*r+1]=0;for(;e.heap_len<2;)s[2*(n=e.heap[++e.heap_len]=l<2?++l:0)]=1,e.depth[n]=0,e.opt_len--,a&&(e.static_len-=o[2*n+1]);for(t.max_code=l,r=e.heap_len>>1;r>=1;r--)D(e,s,r);n=u;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],D(e,s,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,s[2*n]=s[2*r]+s[2*i],e.depth[n]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,s[2*r+1]=s[2*i+1]=n,e.heap[1]=n++,D(e,s,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,n,s,o,a,u=t.dyn_tree,l=t.max_code,d=t.stat_desc.static_tree,f=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,g=t.stat_desc.max_length,y=0;for(s=0;s<=c;s++)e.bl_count[s]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(s=u[2*u[2*(i=e.heap[r])+1]+1]+1)>g&&(s=g,y++),u[2*i+1]=s,i>l||(e.bl_count[s]++,o=0,i>=p&&(o=h[i-p]),a=u[2*i],e.opt_len+=a*(s+o),f&&(e.static_len+=a*(d[2*i+1]+o)));if(0!==y){do{for(s=g-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[g]--,y-=2}while(y>0);for(s=g;0!==s;s--)for(i=e.bl_count[s];0!==i;)(n=e.heap[--r])>l||(u[2*n+1]!==s&&(e.opt_len+=(s-u[2*n+1])*u[2*n],u[2*n+1]=s),i--)}}(e,t),P(s,l,e.bl_count)}function B(e,t,r){var i,n,s=-1,o=t[1],a=0,c=7,u=4;for(0===o&&(c=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=o,o=t[2*(i+1)+1],++a<c&&n===o||(a<u?e.bl_tree[2*n]+=a:0!==n?(n!==s&&e.bl_tree[2*n]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,s=n,0===o?(c=138,u=3):n===o?(c=6,u=3):(c=7,u=4))}function L(e,t,r){var i,n,s=-1,o=t[1],a=0,c=7,u=4;for(0===o&&(c=138,u=3),i=0;i<=r;i++)if(n=o,o=t[2*(i+1)+1],!(++a<c&&n===o)){if(a<u)do{I(e,n,e.bl_tree)}while(0!=--a);else 0!==n?(n!==s&&(I(e,n,e.bl_tree),a--),I(e,16,e.bl_tree),k(e,a-3,2)):a<=10?(I(e,17,e.bl_tree),k(e,a-3,3)):(I(e,18,e.bl_tree),k(e,a-11,7));a=0,s=n,0===o?(c=138,u=3):n===o?(c=6,u=3):(c=7,u=4)}}n(_);var N=!1;function U(e,t,r,n){k(e,0+(n?1:0),3),function(e,t,r,n){C(e),n&&(A(e,r),A(e,~r)),i.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}r._tr_init=function(e){N||(!function(){var e,t,r,i,n,s=new Array(16);for(r=0,i=0;i<28;i++)for(m[i]=r,e=0;e<1<<u[i];e++)y[r++]=i;for(y[r-1]=i,n=0,i=0;i<16;i++)for(_[i]=n,e=0;e<1<<l[i];e++)g[n++]=i;for(n>>=7;i<a;i++)for(_[i]=n<<7,e=0;e<1<<l[i]-7;e++)g[256+n++]=i;for(t=0;t<=c;t++)s[t]=0;for(e=0;e<=143;)h[2*e+1]=8,e++,s[8]++;for(;e<=255;)h[2*e+1]=9,e++,s[9]++;for(;e<=279;)h[2*e+1]=7,e++,s[7]++;for(;e<=287;)h[2*e+1]=8,e++,s[8]++;for(P(h,287,s),e=0;e<a;e++)p[2*e+1]=5,p[2*e]=R(e,5);b=new E(h,u,257,o,c),v=new E(p,l,0,a,c),w=new E(new Array(0),d,0,19,7)}(),N=!0),e.l_desc=new S(e.dyn_ltree,b),e.d_desc=new S(e.dyn_dtree,v),e.bl_desc=new S(e.bl_tree,w),e.bi_buf=0,e.bi_valid=0,O(e)},r._tr_stored_block=U,r._tr_flush_block=function(e,t,r,i){var n,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<s;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),x(e,e.l_desc),x(e,e.d_desc),a=function(e){var t;for(B(e,e.dyn_ltree,e.l_desc.max_code),B(e,e.dyn_dtree,e.d_desc.max_code),x(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*f[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=r+5,r+4<=n&&-1!==t?U(e,t,r,i):4===e.strategy||o===n?(k(e,2+(i?1:0),3),M(e,h,p)):(k(e,4+(i?1:0),3),function(e,t,r,i){var n;for(k(e,t-257,5),k(e,r-1,5),k(e,i-4,4),n=0;n<i;n++)k(e,e.bl_tree[2*f[n]+1],3);L(e,e.dyn_ltree,t-1),L(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),M(e,e.dyn_ltree,e.dyn_dtree)),O(e),i&&C(e)},r._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(y[r]+s+1)]++,e.dyn_dtree[2*T(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){k(e,2,3),I(e,256,h),function(e){16===e.bi_valid?(A(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":"aI1i7"}],aFgUT:[function(e,t,r){"use strict";t.exports=function(e,t,r,i){for(var n=65535&e|0,s=e>>>16&65535|0,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{s=s+(n=n+t[i++]|0)|0}while(--o);n%=65521,s%=65521}return n|s<<16|0}},{}],"5TUdt":[function(e,t,r){"use strict";var i=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,n){var s=i,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^s[255&(e^t[a])];return-1^e}},{}],"2FeB7":[function(e,t,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],gLcvD:[function(e,t,r){"use strict";var i=e("./common"),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new i.Buf8(256),a=0;a<256;a++)o[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function c(e,t){if(t<65534&&(e.subarray&&s||!e.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var r="",o=0;o<t;o++)r+=String.fromCharCode(e[o]);return r}o[254]=o[254]=1,r.string2buf=function(e){var t,r,n,s,o,a=e.length,c=0;for(s=0;s<a;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),c+=r<128?1:r<2048?2:r<65536?3:4;for(t=new i.Buf8(c),o=0,s=0;o<c;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},r.buf2binstring=function(e){return c(e,e.length)},r.binstring2buf=function(e){for(var t=new i.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},r.buf2string=function(e,t){var r,i,n,s,a=t||e.length,u=new Array(2*a);for(i=0,r=0;r<a;)if((n=e[r++])<128)u[i++]=n;else if((s=o[n])>4)u[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;s>1&&r<a;)n=n<<6|63&e[r++],s--;s>1?u[i++]=65533:n<65536?u[i++]=n:(n-=65536,u[i++]=55296|n>>10&1023,u[i++]=56320|1023&n)}return c(u,i)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+o[e[r]]>t?r:t}},{"./common":"aI1i7"}],"2JH5n":[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],fWsHR:[function(e,t,r){"use strict";var i=e("./zlib/inflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),c=e("./zlib/zstream"),u=e("./zlib/gzheader"),l=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var r=i.inflateInit2(this.strm,t.windowBits);if(r!==o.Z_OK)throw new Error(a[r]);if(this.header=new u,i.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=s.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=i.inflateSetDictionary(this.strm,t.dictionary))!==o.Z_OK))throw new Error(a[r])}function f(e,t){var r=new d(t);if(r.push(e,!0),r.err)throw r.msg||a[r.err];return r.result}d.prototype.push=function(e,t){var r,a,c,u,d,f=this.strm,h=this.options.chunkSize,p=this.options.dictionary,g=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?f.input=s.binstring2buf(e):"[object ArrayBuffer]"===l.call(e)?f.input=new Uint8Array(e):f.input=e,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new n.Buf8(h),f.next_out=0,f.avail_out=h),(r=i.inflate(f,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&p&&(r=i.inflateSetDictionary(this.strm,p)),r===o.Z_BUF_ERROR&&!0===g&&(r=o.Z_OK,g=!1),r!==o.Z_STREAM_END&&r!==o.Z_OK)return this.onEnd(r),this.ended=!0,!1;f.next_out&&(0!==f.avail_out&&r!==o.Z_STREAM_END&&(0!==f.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(c=s.utf8border(f.output,f.next_out),u=f.next_out-c,d=s.buf2string(f.output,c),f.next_out=u,f.avail_out=h-u,u&&n.arraySet(f.output,f.output,c,u,0),this.onData(d)):this.onData(n.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(g=!0)}while((f.avail_in>0||0===f.avail_out)&&r!==o.Z_STREAM_END);return r===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(r=i.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),f.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Inflate=d,r.inflate=f,r.inflateRaw=function(e,t){return(t=t||{}).raw=!0,f(e,t)},r.ungzip=f},{"./zlib/inflate":"bCmNK","./utils/common":"aI1i7","./utils/strings":"gLcvD","./zlib/constants":"822Hi","./zlib/messages":"2FeB7","./zlib/zstream":"2JH5n","./zlib/gzheader":"2gJW0"}],bCmNK:[function(e,t,r){"use strict";var i=e("../utils/common"),n=e("./adler32"),s=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),c=-2,u=12,l=30;function d(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function f(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function h(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.Buf32(852),t.distcode=t.distdyn=new i.Buf32(592),t.sane=1,t.back=-1,0):c}function p(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,h(e)):c}function g(e,t){var r,i;return e&&e.state?(i=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?c:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,p(e))):c}function y(e,t){var r,i;return e?(i=new f,e.state=i,i.window=null,0!==(r=g(e,t))&&(e.state=null),r):c}var m,b,v=!0;function w(e){if(v){var t;for(m=new i.Buf32(512),b=new i.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(1,e.lens,0,288,m,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,b,0,e.work,{bits:5}),v=!1}e.lencode=m,e.lenbits=9,e.distcode=b,e.distbits=5}function _(e,t,r,n){var s,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new i.Buf8(o.wsize)),n>=o.wsize?(i.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((s=o.wsize-o.wnext)>n&&(s=n),i.arraySet(o.window,t,r-n,s,o.wnext),(n-=s)?(i.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}r.inflateReset=p,r.inflateReset2=g,r.inflateResetKeep=h,r.inflateInit=function(e){return y(e,15)},r.inflateInit2=y,r.inflate=function(e,t){var r,f,h,p,g,y,m,b,v,E,S,T,A,k,I,R,P,O,C,j,D,M,x,B,L=0,N=new i.Buf8(4),U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return c;(r=e.state).mode===u&&(r.mode=13),g=e.next_out,h=e.output,m=e.avail_out,p=e.next_in,f=e.input,y=e.avail_in,b=r.hold,v=r.bits,E=y,S=m,M=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;v<16;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}if(2&r.wrap&&35615===b){r.check=0,N[0]=255&b,N[1]=b>>>8&255,r.check=s(r.check,N,2,0),b=0,v=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&b)<<8)+(b>>8))%31){e.msg="incorrect header check",r.mode=l;break}if(8!=(15&b)){e.msg="unknown compression method",r.mode=l;break}if(v-=4,D=8+(15&(b>>>=4)),0===r.wbits)r.wbits=D;else if(D>r.wbits){e.msg="invalid window size",r.mode=l;break}r.dmax=1<<D,e.adler=r.check=1,r.mode=512&b?10:u,b=0,v=0;break;case 2:for(;v<16;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}if(r.flags=b,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=l;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=l;break}r.head&&(r.head.text=b>>8&1),512&r.flags&&(N[0]=255&b,N[1]=b>>>8&255,r.check=s(r.check,N,2,0)),b=0,v=0,r.mode=3;case 3:for(;v<32;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}r.head&&(r.head.time=b),512&r.flags&&(N[0]=255&b,N[1]=b>>>8&255,N[2]=b>>>16&255,N[3]=b>>>24&255,r.check=s(r.check,N,4,0)),b=0,v=0,r.mode=4;case 4:for(;v<16;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}r.head&&(r.head.xflags=255&b,r.head.os=b>>8),512&r.flags&&(N[0]=255&b,N[1]=b>>>8&255,r.check=s(r.check,N,2,0)),b=0,v=0,r.mode=5;case 5:if(1024&r.flags){for(;v<16;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}r.length=b,r.head&&(r.head.extra_len=b),512&r.flags&&(N[0]=255&b,N[1]=b>>>8&255,r.check=s(r.check,N,2,0)),b=0,v=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((T=r.length)>y&&(T=y),T&&(r.head&&(D=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),i.arraySet(r.head.extra,f,p,T,D)),512&r.flags&&(r.check=s(r.check,f,T,p)),y-=T,p+=T,r.length-=T),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===y)break e;T=0;do{D=f[p+T++],r.head&&D&&r.length<65536&&(r.head.name+=String.fromCharCode(D))}while(D&&T<y);if(512&r.flags&&(r.check=s(r.check,f,T,p)),y-=T,p+=T,D)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===y)break e;T=0;do{D=f[p+T++],r.head&&D&&r.length<65536&&(r.head.comment+=String.fromCharCode(D))}while(D&&T<y);if(512&r.flags&&(r.check=s(r.check,f,T,p)),y-=T,p+=T,D)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;v<16;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}if(b!==(65535&r.check)){e.msg="header crc mismatch",r.mode=l;break}b=0,v=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=u;break;case 10:for(;v<32;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}e.adler=r.check=d(b),b=0,v=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=g,e.avail_out=m,e.next_in=p,e.avail_in=y,r.hold=b,r.bits=v,2;e.adler=r.check=1,r.mode=u;case u:if(5===t||6===t)break e;case 13:if(r.last){b>>>=7&v,v-=7&v,r.mode=27;break}for(;v<3;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}switch(r.last=1&b,v-=1,3&(b>>>=1)){case 0:r.mode=14;break;case 1:if(w(r),r.mode=20,6===t){b>>>=2,v-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=l}b>>>=2,v-=2;break;case 14:for(b>>>=7&v,v-=7&v;v<32;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}if((65535&b)!=(b>>>16^65535)){e.msg="invalid stored block lengths",r.mode=l;break}if(r.length=65535&b,b=0,v=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(T=r.length){if(T>y&&(T=y),T>m&&(T=m),0===T)break e;i.arraySet(h,f,p,T,g),y-=T,p+=T,m-=T,g+=T,r.length-=T;break}r.mode=u;break;case 17:for(;v<14;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}if(r.nlen=257+(31&b),b>>>=5,v-=5,r.ndist=1+(31&b),b>>>=5,v-=5,r.ncode=4+(15&b),b>>>=4,v-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=l;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;v<3;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}r.lens[U[r.have++]]=7&b,b>>>=3,v-=3}for(;r.have<19;)r.lens[U[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,x={bits:r.lenbits},M=a(0,r.lens,0,19,r.lencode,0,r.work,x),r.lenbits=x.bits,M){e.msg="invalid code lengths set",r.mode=l;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;R=(L=r.lencode[b&(1<<r.lenbits)-1])>>>16&255,P=65535&L,!((I=L>>>24)<=v);){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}if(P<16)b>>>=I,v-=I,r.lens[r.have++]=P;else{if(16===P){for(B=I+2;v<B;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}if(b>>>=I,v-=I,0===r.have){e.msg="invalid bit length repeat",r.mode=l;break}D=r.lens[r.have-1],T=3+(3&b),b>>>=2,v-=2}else if(17===P){for(B=I+3;v<B;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}v-=I,D=0,T=3+(7&(b>>>=I)),b>>>=3,v-=3}else{for(B=I+7;v<B;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}v-=I,D=0,T=11+(127&(b>>>=I)),b>>>=7,v-=7}if(r.have+T>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=l;break}for(;T--;)r.lens[r.have++]=D}}if(r.mode===l)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=l;break}if(r.lenbits=9,x={bits:r.lenbits},M=a(1,r.lens,0,r.nlen,r.lencode,0,r.work,x),r.lenbits=x.bits,M){e.msg="invalid literal/lengths set",r.mode=l;break}if(r.distbits=6,r.distcode=r.distdyn,x={bits:r.distbits},M=a(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,x),r.distbits=x.bits,M){e.msg="invalid distances set",r.mode=l;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(y>=6&&m>=258){e.next_out=g,e.avail_out=m,e.next_in=p,e.avail_in=y,r.hold=b,r.bits=v,o(e,S),g=e.next_out,h=e.output,m=e.avail_out,p=e.next_in,f=e.input,y=e.avail_in,b=r.hold,v=r.bits,r.mode===u&&(r.back=-1);break}for(r.back=0;R=(L=r.lencode[b&(1<<r.lenbits)-1])>>>16&255,P=65535&L,!((I=L>>>24)<=v);){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}if(R&&0==(240&R)){for(O=I,C=R,j=P;R=(L=r.lencode[j+((b&(1<<O+C)-1)>>O)])>>>16&255,P=65535&L,!(O+(I=L>>>24)<=v);){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}b>>>=O,v-=O,r.back+=O}if(b>>>=I,v-=I,r.back+=I,r.length=P,0===R){r.mode=26;break}if(32&R){r.back=-1,r.mode=u;break}if(64&R){e.msg="invalid literal/length code",r.mode=l;break}r.extra=15&R,r.mode=22;case 22:if(r.extra){for(B=r.extra;v<B;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}r.length+=b&(1<<r.extra)-1,b>>>=r.extra,v-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;R=(L=r.distcode[b&(1<<r.distbits)-1])>>>16&255,P=65535&L,!((I=L>>>24)<=v);){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}if(0==(240&R)){for(O=I,C=R,j=P;R=(L=r.distcode[j+((b&(1<<O+C)-1)>>O)])>>>16&255,P=65535&L,!(O+(I=L>>>24)<=v);){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}b>>>=O,v-=O,r.back+=O}if(b>>>=I,v-=I,r.back+=I,64&R){e.msg="invalid distance code",r.mode=l;break}r.offset=P,r.extra=15&R,r.mode=24;case 24:if(r.extra){for(B=r.extra;v<B;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}r.offset+=b&(1<<r.extra)-1,b>>>=r.extra,v-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=l;break}r.mode=25;case 25:if(0===m)break e;if(T=S-m,r.offset>T){if((T=r.offset-T)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=l;break}T>r.wnext?(T-=r.wnext,A=r.wsize-T):A=r.wnext-T,T>r.length&&(T=r.length),k=r.window}else k=h,A=g-r.offset,T=r.length;T>m&&(T=m),m-=T,r.length-=T;do{h[g++]=k[A++]}while(--T);0===r.length&&(r.mode=21);break;case 26:if(0===m)break e;h[g++]=r.length,m--,r.mode=21;break;case 27:if(r.wrap){for(;v<32;){if(0===y)break e;y--,b|=f[p++]<<v,v+=8}if(S-=m,e.total_out+=S,r.total+=S,S&&(e.adler=r.check=r.flags?s(r.check,h,S,g-S):n(r.check,h,S,g-S)),S=m,(r.flags?b:d(b))!==r.check){e.msg="incorrect data check",r.mode=l;break}b=0,v=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;v<32;){if(0===y)break e;y--,b+=f[p++]<<v,v+=8}if(b!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=l;break}b=0,v=0}r.mode=29;case 29:M=1;break e;case l:M=-3;break e;case 31:return-4;default:return c}return e.next_out=g,e.avail_out=m,e.next_in=p,e.avail_in=y,r.hold=b,r.bits=v,(r.wsize||S!==e.avail_out&&r.mode<l&&(r.mode<27||4!==t))&&_(e,e.output,e.next_out,S-e.avail_out)?(r.mode=31,-4):(E-=e.avail_in,S-=e.avail_out,e.total_in+=E,e.total_out+=S,r.total+=S,r.wrap&&S&&(e.adler=r.check=r.flags?s(r.check,h,S,e.next_out-S):n(r.check,h,S,e.next_out-S)),e.data_type=r.bits+(r.last?64:0)+(r.mode===u?128:0)+(20===r.mode||15===r.mode?256:0),(0===E&&0===S||4===t)&&0===M&&(M=-5),M)},r.inflateEnd=function(e){if(!e||!e.state)return c;var t=e.state;return t.window&&(t.window=null),e.state=null,0},r.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?c:(r.head=t,t.done=!1,0):c},r.inflateSetDictionary=function(e,t){var r,i=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?c:11===r.mode&&n(1,t,i,0)!==r.check?-3:_(e,t,i,i)?(r.mode=31,-4):(r.havedict=1,0):c},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":"aI1i7","./adler32":"aFgUT","./crc32":"5TUdt","./inffast":"6eObc","./inftrees":"bDewa"}],"6eObc":[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n,s,o,a,c,u,l,d,f,h,p,g,y,m,b,v,w,_,E,S,T,A,k;r=e.state,i=e.next_in,A=e.input,n=i+(e.avail_in-5),s=e.next_out,k=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),c=r.dmax,u=r.wsize,l=r.whave,d=r.wnext,f=r.window,h=r.hold,p=r.bits,g=r.lencode,y=r.distcode,m=(1<<r.lenbits)-1,b=(1<<r.distbits)-1;e:do{p<15&&(h+=A[i++]<<p,p+=8,h+=A[i++]<<p,p+=8),v=g[h&m];t:for(;;){if(h>>>=w=v>>>24,p-=w,0===(w=v>>>16&255))k[s++]=65535&v;else{if(!(16&w)){if(0==(64&w)){v=g[(65535&v)+(h&(1<<w)-1)];continue t}if(32&w){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}_=65535&v,(w&=15)&&(p<w&&(h+=A[i++]<<p,p+=8),_+=h&(1<<w)-1,h>>>=w,p-=w),p<15&&(h+=A[i++]<<p,p+=8,h+=A[i++]<<p,p+=8),v=y[h&b];r:for(;;){if(h>>>=w=v>>>24,p-=w,!(16&(w=v>>>16&255))){if(0==(64&w)){v=y[(65535&v)+(h&(1<<w)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&v,p<(w&=15)&&(h+=A[i++]<<p,(p+=8)<w&&(h+=A[i++]<<p,p+=8)),(E+=h&(1<<w)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(h>>>=w,p-=w,E>(w=s-o)){if((w=E-w)>l&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(S=0,T=f,0===d){if(S+=u-w,w<_){_-=w;do{k[s++]=f[S++]}while(--w);S=s-E,T=k}}else if(d<w){if(S+=u+d-w,(w-=d)<_){_-=w;do{k[s++]=f[S++]}while(--w);if(S=0,d<_){_-=w=d;do{k[s++]=f[S++]}while(--w);S=s-E,T=k}}}else if(S+=d-w,w<_){_-=w;do{k[s++]=f[S++]}while(--w);S=s-E,T=k}for(;_>2;)k[s++]=T[S++],k[s++]=T[S++],k[s++]=T[S++],_-=3;_&&(k[s++]=T[S++],_>1&&(k[s++]=T[S++]))}else{S=s-E;do{k[s++]=k[S++],k[s++]=k[S++],k[s++]=k[S++],_-=3}while(_>2);_&&(k[s++]=k[S++],_>1&&(k[s++]=k[S++]))}break}}break}}while(i<n&&s<a);i-=_=p>>3,h&=(1<<(p-=_<<3))-1,e.next_in=i,e.next_out=s,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=s<a?a-s+257:257-(s-a),r.hold=h,r.bits=p}},{}],bDewa:[function(e,t,r){"use strict";var i=e("../utils/common"),n=15,s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],c=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,r,u,l,d,f,h){var p,g,y,m,b,v,w,_,E,S=h.bits,T=0,A=0,k=0,I=0,R=0,P=0,O=0,C=0,j=0,D=0,M=null,x=0,B=new i.Buf16(16),L=new i.Buf16(16),N=null,U=0;for(T=0;T<=n;T++)B[T]=0;for(A=0;A<u;A++)B[t[r+A]]++;for(R=S,I=n;I>=1&&0===B[I];I--);if(R>I&&(R=I),0===I)return l[d++]=20971520,l[d++]=20971520,h.bits=1,0;for(k=1;k<I&&0===B[k];k++);for(R<k&&(R=k),C=1,T=1;T<=n;T++)if(C<<=1,(C-=B[T])<0)return-1;if(C>0&&(0===e||1!==I))return-1;for(L[1]=0,T=1;T<n;T++)L[T+1]=L[T]+B[T];for(A=0;A<u;A++)0!==t[r+A]&&(f[L[t[r+A]]++]=A);if(0===e?(M=N=f,v=19):1===e?(M=s,x-=257,N=o,U-=257,v=256):(M=a,N=c,v=-1),D=0,A=0,T=k,b=d,P=R,O=0,y=-1,m=(j=1<<R)-1,1===e&&j>852||2===e&&j>592)return 1;for(;;){w=T-O,f[A]<v?(_=0,E=f[A]):f[A]>v?(_=N[U+f[A]],E=M[x+f[A]]):(_=96,E=0),p=1<<T-O,k=g=1<<P;do{l[b+(D>>O)+(g-=p)]=w<<24|_<<16|E|0}while(0!==g);for(p=1<<T-1;D&p;)p>>=1;if(0!==p?(D&=p-1,D+=p):D=0,A++,0==--B[T]){if(T===I)break;T=t[r+f[A]]}if(T>R&&(D&m)!==y){for(0===O&&(O=R),b+=k,C=1<<(P=T-O);P+O<I&&!((C-=B[P+O])<=0);)P++,C<<=1;if(j+=1<<P,1===e&&j>852||2===e&&j>592)return 1;l[y=D&m]=R<<24|P<<16|b-d|0}}return 0!==D&&(l[b+D]=T-O<<24|4194304),h.bits=R,0}},{"../utils/common":"aI1i7"}],"822Hi":[function(e,t,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],"2gJW0":[function(e,t,r){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],"38Qf6":[function(e,t,r){"use strict";const{concat:i}=e("uint8arrays/concat");t.exports=async function(e){let t=new Uint8Array(0);for await(const r of e)t=i([t,r],t.length+r.length);return t}},{"uint8arrays/concat":"4EBjG"}],lCq4W:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-unixfs-exporter"),n=e("err-code"),s=e("../utils.js"),o=e("ipfs-core-utils/with-timeout-option"),a=e("multiformats/cid");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(n);r.createLs=function({repo:e,preload:t}){return o.withTimeoutOption((async function*(r,n={}){const o=s.normalizeCidPath(r),c=o.split("/");!1!==n.preload&&t(a.CID.parse(c[0]));const l=a.CID.asCID(o)||o,d=await i.exporter(l,e.blocks,n);if("file"!==d.type){if("directory"!==d.type)throw u.default(new Error(`Unknown UnixFS type ${d.type}`),"ERR_UNKNOWN_UNIXFS_TYPE");for await(const e of d.content())yield s.mapFile(e)}else yield s.mapFile(d)}))}},{"ipfs-unixfs-exporter":"BgMiX","err-code":"chZjB","../utils.js":"cT4uN","ipfs-core-utils/with-timeout-option":"j29MK","multiformats/cid":"9ooAY"}],"8mBfq":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../version.js"),n=e("ipfs-core-utils/with-timeout-option");r.createVersion=function({repo:e}){return n.withTimeoutOption((async function(t={}){const r=await e.version.get();return{version:i.ipfsCore,commit:i.commit,repo:`${r}`,"ipfs-core":i.ipfsCore,"interface-ipfs-core":i.interfaceIpfsCore}}))}},{"../version.js":"cyFMr","ipfs-core-utils/with-timeout-option":"j29MK"}],cyFMr:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.commit="5ddd0c555cc6577ee15667f4ef4e7f3a3b17d04c",r.interfaceIpfsCore="^0.151.1",r.ipfsCore="0.11.1"},{}],bQa6q:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../version.js"),n=e("multiaddr"),s=e("ipfs-core-utils/with-timeout-option"),o=e("uint8arrays/to-string"),a=e("peer-id"),c=e("../errors.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(a);r.createId=function({peerId:e,network:t}){return s.withTimeoutOption((async function(r={}){r.peerId===e.toB58String()&&delete r.peerId;const s=t.try();if(!s){if(r.peerId)throw new c.NotStartedError;return{id:e.toB58String(),publicKey:o.toString(e.pubKey.bytes,"base64pad"),addresses:[],agentVersion:`js-ipfs/${i.ipfsCore}`,protocolVersion:"9000",protocols:[]}}const a=r.peerId?l.default.createFromB58String(r.peerId.toString()):e,{libp2p:u}=s,d=r.peerId?u.peerStore.keyBook.get(a):a.pubKey,f=r.peerId?u.peerStore.addressBook.getMultiaddrsForPeer(a):u.multiaddrs,h=r.peerId?u.peerStore.protoBook.get(a):Array.from(u.upgrader.protocols.keys()),p=o.toString(u.peerStore.metadataBook.getValue(a,"AgentVersion")||new Uint8Array),g=o.toString(u.peerStore.metadataBook.getValue(a,"ProtocolVersion")||new Uint8Array),y=a.toB58String();return{id:y,publicKey:o.toString(d.bytes,"base64pad"),addresses:(f||[]).map((e=>{const t=e.toString();return t.endsWith(`/p2p/${y}`)?t:`${t}/p2p/${y}`})).sort().map((e=>new n.Multiaddr(e))),agentVersion:p,protocolVersion:g,protocols:(h||[]).sort()}}))}},{"../version.js":"cyFMr",multiaddr:"8Mu1u","ipfs-core-utils/with-timeout-option":"j29MK","uint8arrays/to-string":"hC8JB","peer-id":"8Bdb3","../errors.js":"j69o8"}],"3uMSz":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option"),n=e("debug"),s=e("./profiles.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const a=o(n).default("ipfs:core:config");async function c(e){return Object.keys(s.profiles).map((e=>({name:e,description:s.profiles[e].description})))}r.createConfig=function({repo:e}){return{getAll:i.withTimeoutOption((async function(t={}){return e.config.getAll(t)})),get:i.withTimeoutOption((async function(t,r){return t?e.config.get(t,r):Promise.reject(new Error("key argument is required"))})),set:i.withTimeoutOption((async function(t,r,i){return e.config.set(t,r,i)})),replace:i.withTimeoutOption((async function(t,r){return e.config.replace(t,r)})),profiles:{apply:i.withTimeoutOption((async function(t,r={dryRun:!1}){const{dryRun:i}=r,n=s.profiles[t];if(!n)throw new Error(`No profile with name '${t}' exists`);try{const t=await e.config.getAll(r);let s=JSON.parse(JSON.stringify(t));return s=n.transform(s),i||await e.config.replace(s,r),delete t.Identity.PrivKey,delete s.Identity.PrivKey,{original:t,updated:s}}catch(e){throw a(e),new Error(`Could not apply profile '${t}' to config: ${e.message}`)}})),list:i.withTimeoutOption(c)}}}},{"ipfs-core-utils/with-timeout-option":"j29MK",debug:"bO5wM","./profiles.js":"f6AK7"}],f6AK7:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("just-safe-set"),n=e("ipfs-core-config/config");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(i),a=s(n);const c={server:{description:"Recommended for nodes with public IPv4 address (servers, VPSes, etc.), disables host and content discovery and UPnP in local networks.",transform:e=>(o.default(e,"Discovery.MDNS.Enabled",!1),o.default(e,"Discovery.webRTCStar.Enabled",!1),e.Swarm={...e.Swarm||{},DisableNatPortMap:!0},e)},"local-discovery":{description:"Sets default values to fields affected by `server` profile, enables discovery and UPnP in local networks.",transform:e=>(o.default(e,"Discovery.MDNS.Enabled",!0),o.default(e,"Discovery.webRTCStar.Enabled",!0),o.default(e,"Swarm",{...e.Swarm||{},DisableNatPortMap:!1}),e)},test:{description:"Reduces external interference, useful for running ipfs in test environments. Note that with these settings node won't be able to talk to the rest of the network without manual bootstrap.",transform:e=>{const t=a.default();return o.default(e,"Addresses.API",t.Addresses.API?"/ip4/127.0.0.1/tcp/0":""),o.default(e,"Addresses.Gateway",t.Addresses.Gateway?"/ip4/127.0.0.1/tcp/0":""),o.default(e,"Addresses.Swarm",t.Addresses.Swarm.length?["/ip4/127.0.0.1/tcp/0"]:[]),o.default(e,"Addresses.Delegates",[]),o.default(e,"Bootstrap",[]),o.default(e,"Discovery.MDNS.Enabled",!1),o.default(e,"Discovery.webRTCStar.Enabled",!1),o.default(e,"Swarm",{...e.Swarm||{},DisableNatPortMap:!0}),e}},"default-networking":{description:"Restores default network settings. Inverse profile of the `test` profile.",transform:e=>{const t=a.default();return o.default(e,"Addresses.API",t.Addresses.API),o.default(e,"Addresses.Gateway",t.Addresses.Gateway),o.default(e,"Addresses.Swarm",t.Addresses.Swarm),o.default(e,"Addresses.Delegates",t.Addresses.Delegates),o.default(e,"Bootstrap",t.Bootstrap),o.default(e,"Discovery.MDNS.Enabled",t.Discovery.MDNS.Enabled),o.default(e,"Discovery.webRTCStar.Enabled",t.Discovery.webRTCStar.Enabled),o.default(e,"Swarm",{...e.Swarm||{},DisableNatPortMap:!1}),e}},lowpower:{description:"Reduces daemon overhead on the system. May affect node functionality,performance of content discovery and data fetching may be degraded. Recommended for low power systems.",transform:e=>{const t=e.Swarm||{},r=t.ConnMgr||{};return r.LowWater=20,r.HighWater=40,t.ConnMgr=r,e.Swarm=t,e}},"default-power":{description:'Inverse of "lowpower" profile.',transform:e=>{const t=a.default();return e.Swarm=t.Swarm,e}}};r.profiles=c},{"just-safe-set":"glUwm","ipfs-core-config/config":"ejWbz"}],glUwm:[function(e,t,r){function i(e){if("__proto__"===e||"constructor"===e||"prototype"===e)throw new Error("setting of prototype values not supported")}t.exports=function(e,t,r){var n,s,o;Array.isArray(t)&&(n=t.slice(0));"string"==typeof t&&(n=t.split("."));"symbol"==typeof t&&(n=[t]);if(!Array.isArray(n))throw new Error("props arg must be an array, a string or a symbol");if(!(s=n.pop()))return!1;i(s);for(;o=n.shift();)if(i(o),void 0===e[o]&&(e[o]={}),!(e=e[o])||"object"!=typeof e)return!1;return e[s]=r,!0}},{}],"9rLzF":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./export.js"),n=e("./get.js"),s=e("./import.js"),o=e("./put.js"),a=e("./resolve.js");r.DagAPI=class{constructor({repo:e,codecs:t,hashers:r,preload:c}){this.export=i.createExport({repo:e,preload:c,codecs:t}),this.get=n.createGet({codecs:t,repo:e,preload:c}),this.import=s.createImport({repo:e}),this.resolve=a.createResolve({repo:e,codecs:t,preload:c}),this.put=o.createPut({repo:e,codecs:t,hashers:r,preload:c})}}},{"./export.js":"fGRwg","./get.js":"evp3q","./import.js":"1a905","./put.js":"d8SU0","./resolve.js":"gIL7b"}],fGRwg:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("multiformats/block"),s=e("multiformats/bases/base58"),o=e("@ipld/car/writer"),a=e("ipfs-core-utils/with-timeout-option"),c=e("debug"),u=e("multiformats/codecs/raw"),l=e("multiformats/codecs/json");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function f(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var h=d(c),p=f(u),g=f(l);const y=h.default("ipfs:components:dag:import"),m=[p.code,g.code];async function b(e,t,r,i,o,a=new Set){const c=r.toString(s.base58btc);if(a.has(c))return;const u=await async function(e,t,r,i){const s=await e.blocks.get(r,t);let o=[];const a=await i.getCodec(r.code);if(a){o=[...n.createUnsafe({bytes:s,cid:r,codec:a}).links()].map((e=>e[1]))}else if(!m.includes(r.code))throw new Error(`Can't decode links in block with codec 0x${r.code.toString(16)} to form complete DAG`);return{cid:r,bytes:s,links:o}}(e,t,r,o);y(`Adding block ${r} to car`),await i.put(u),a.add(c);for(const r of u.links)await b(e,t,r,i,o,a)}r.createExport=function({repo:e,preload:t,codecs:r}){return a.withTimeoutOption((async function*(n,s={}){!1!==s.preload&&t(n);const a=i.CID.asCID(n);if(!a)throw new Error(`Unexpected error converting CID type: ${n}`);y(`Exporting ${a} as car`);const{writer:c,out:u}=await o.CarWriter.create([a]);let l=null;(async()=>{try{await b(e,{signal:s.signal,timeout:s.timeout},a,c,r),c.close()}catch(e){l=e}})();for await(const e of u){if(l)break;yield e}if(l)throw l}))}},{"multiformats/cid":"9ooAY","multiformats/block":"i1Z6F","multiformats/bases/base58":"4n7mA","@ipld/car/writer":"7xGrH","ipfs-core-utils/with-timeout-option":"j29MK",debug:"bO5wM","multiformats/codecs/raw":"fdfgp","multiformats/codecs/json":"cRmep"}],i1Z6F:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),e("./index.js");var i=e("./cid.js"),n=e("./bytes.js");const s=({enumerable:e=!0,configurable:t=!1}={})=>({enumerable:e,configurable:t,writable:!1}),o=function*(e,t){if(null!=e&&!(e instanceof Uint8Array))for(const[r,n]of Object.entries(e)){const e=[...t,r];if(null!=n&&"object"==typeof n)if(Array.isArray(n))for(const[t,r]of n.entries()){const n=[...e,t],s=i.CID.asCID(r);s?yield[n.join("/"),s]:"object"==typeof r&&(yield*o(r,n))}else{const t=i.CID.asCID(n);t?yield[e.join("/"),t]:yield*o(n,e)}}},a=function*(e,t){if(null!=e)for(const[r,n]of Object.entries(e)){const e=[...t,r];if(yield e.join("/"),!(null==n||n instanceof Uint8Array||"object"!=typeof n||i.CID.asCID(n)))if(Array.isArray(n))for(const[t,r]of n.entries()){const n=[...e,t];yield n.join("/"),"object"!=typeof r||i.CID.asCID(r)||(yield*a(r,n))}else yield*a(n,e)}};class c{constructor({cid:e,bytes:t,value:r}){if(!e||!t||void 0===r)throw new Error("Missing required argument");this.cid=e,this.bytes=t,this.value=r,this.asBlock=this,Object.defineProperties(this,{cid:s(),bytes:s(),value:s(),asBlock:s()})}links(){return o(this.value,[])}tree(){return a(this.value,[])}get(e="/"){return((e,t)=>{let r=e;for(const[e,n]of t.entries()){if(r=r[n],null==r)throw new Error(`Object has no property at ${t.slice(0,e+1).map((e=>`[${JSON.stringify(e)}]`)).join("")}`);const s=i.CID.asCID(r);if(s)return{value:s,remaining:t.slice(e+1).join("/")}}return{value:r}})(this.value,e.split("/").filter(Boolean))}}const u=({bytes:e,cid:t,value:r,codec:i})=>{const n=void 0!==r?r:i&&i.decode(e);if(void 0===n)throw new Error('Missing required argument, must either provide "value" or "codec"');return new c({cid:t,bytes:e,value:n})};r.Block=c,r.create=async({bytes:e,cid:t,hasher:r,codec:i})=>{if(!e)throw new Error('Missing required argument "bytes"');if(!r)throw new Error('Missing required argument "hasher"');const s=i.decode(e),o=await r.digest(e);if(!n.equals(t.multihash.bytes,o.bytes))throw new Error("CID hash does not match bytes");return u({bytes:e,cid:t,value:s,codec:i})},r.createUnsafe=u,r.decode=async({bytes:e,codec:t,hasher:r})=>{if(!e)throw new Error('Missing required argument "bytes"');if(!t||!r)throw new Error("Missing required argument: codec or hasher");const n=t.decode(e),s=await r.digest(e),o=i.CID.create(1,t.code,s);return new c({value:n,bytes:e,cid:o})},r.encode=async({value:e,codec:t,hasher:r})=>{if(void 0===e)throw new Error('Missing required argument "value"');if(!t||!r)throw new Error("Missing required argument: codec or hasher");const n=t.encode(e),s=await r.digest(n),o=i.CID.create(1,t.code,s);return new c({value:e,bytes:n,cid:o})}},{"./index.js":"3ANyW","./cid.js":"9ooAY","./bytes.js":"6I0Ku"}],"7xGrH":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("./encoder.js"),s=e("./iterator-channel.js"),o=e("./decoder.js");class a{constructor(e,t){this._encoder=t,this._mutex=t.setRoots(e),this._ended=!1}async put(e){if(!(e.bytes instanceof Uint8Array&&e.cid))throw new TypeError("Can only write {cid, bytes} objects");if(this._ended)throw new Error("Already closed");const t=i.CID.asCID(e.cid);if(!t)throw new TypeError("Can only write {cid, bytes} objects");return this._mutex=this._mutex.then((()=>this._encoder.writeBlock({cid:t,bytes:e.bytes}))),this._mutex}async close(){if(this._ended)throw new Error("Already closed");return await this._mutex,this._ended=!0,this._encoder.close()}static create(e){e=function(e){if(void 0===e)return[];if(!Array.isArray(e)){const t=i.CID.asCID(e);if(!t)throw new TypeError("roots must be a single CID or an array of CIDs");return[t]}const t=[];for(const r of e){const e=i.CID.asCID(r);if(!e)throw new TypeError("roots must be a single CID or an array of CIDs");t.push(e)}return t}(e);const{encoder:t,iterator:r}=u();return{writer:new a(e,t),out:new c(r)}}static createAppender(){const{encoder:e,iterator:t}=u();e.setRoots=()=>Promise.resolve();return{writer:new a([],e),out:new c(t)}}static async updateRootsInBytes(e,t){const r=o.bytesReader(e);await o.readHeader(r);const i=n.createHeader(t);if(r.pos!==i.length)throw new Error(`updateRoots() can only overwrite a header of the same length (old header is ${r.pos} bytes, new header is ${i.length} bytes)`);return e.set(i,0),e}}class c{constructor(e){this._iterator=e}[Symbol.asyncIterator](){if(this._iterating)throw new Error("Multiple iterator not supported");return this._iterating=!0,this._iterator}}function u(){const e=s.create(),{writer:t,iterator:r}=e;return{encoder:n.createEncoder(t),iterator:r}}r.CarWriter=a,r.CarWriterOut=c,r.__browser=!0},{"multiformats/cid":"9ooAY","./encoder.js":"d1fSj","./iterator-channel.js":"9nhH8","./decoder.js":"hA2ak"}],d1fSj:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("varint"),n=e("@ipld/dag-cbor");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(i);function a(e){const t=n.encode({version:1,roots:e}),r=o.default.encode(t.length),i=new Uint8Array(r.length+t.length);return i.set(r,0),i.set(t,r.length),i}r.createEncoder=function(e){return{async setRoots(t){const r=a(t);await e.write(r)},async writeBlock(t){const{cid:r,bytes:i}=t;await e.write(new Uint8Array(o.default.encode(r.bytes.length+i.length))),await e.write(r.bytes),i.length&&await e.write(i)},close:async()=>e.end()}},r.createHeader=a},{varint:"aN1CO","@ipld/dag-cbor":"3498i"}],"9nhH8":[function(e,t,r){"use strict";function i(){}Object.defineProperty(r,"__esModule",{value:!0}),r.create=function(){const e=[];let t=null,r=i,n=!1,s=null,o=i;const a=()=>(t||(t=new Promise((e=>{r=()=>{t=null,r=i,e()}}))),t),c={async next(){const t=e.shift();return t?(0===e.length&&r(),{done:!1,value:t}):n?(r(),{done:!0,value:void 0}):(s||(s=new Promise((e=>{o=()=>(s=null,o=i,e(c.next()))}))),s)}};return{writer:{write(t){e.push(t);const r=a();return o(),r},async end(){n=!0;const e=a();return o(),e}},iterator:c}}},{}],hA2ak:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("varint"),n=e("multiformats/cid"),s=e("multiformats/hashes/digest"),o=e("@ipld/dag-cbor");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=a(i),l=c(s);const d=18,f=32,h=112;async function p(e){const t=await e.upTo(8),r=u.default.decode(t);return e.seek(u.default.decode.bytes),r}async function g(e){const t=await p(e);if(0===t)throw new Error("Invalid CAR header (zero length)");const r=await e.exactly(t);e.seek(t);const i=o.decode(r);if(null==i||Array.isArray(i)||"object"!=typeof i)throw new Error("Invalid CAR header format");if(1!==i.version){if("string"==typeof i.version)throw new Error(`Invalid CAR version: "${i.version}"`);throw new Error(`Invalid CAR version: ${i.version}`)}if(!Array.isArray(i.roots))throw new Error("Invalid CAR header format");if(Object.keys(i).filter((e=>"roots"!==e&&"version"!==e)).length)throw new Error("Invalid CAR header format");return i}async function y(e){const t=await e.exactly(2);if(t[0]===d&&t[1]===f){const t=await e.exactly(34);e.seek(34);const r=l.decode(t);return n.CID.create(0,h,r)}const r=await p(e);if(1!==r)throw new Error(`Unexpected CID version (${r})`);const i=await p(e),s=await async function(e){const t=await e.upTo(8);u.default.decode(t);const r=u.default.decode.bytes,i=u.default.decode(t.subarray(u.default.decode.bytes)),n=r+u.default.decode.bytes+i,s=await e.exactly(n);return e.seek(n),s}(e),o=l.decode(s);return n.CID.create(r,i,o)}async function m(e){const t=e.pos;let r=await p(e);if(0===r)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;return{cid:await y(e),length:r,blockLength:r-(e.pos-t)}}async function b(e){const{cid:t,blockLength:r}=await m(e),i=await e.exactly(r);return e.seek(r),{bytes:i,cid:t}}async function v(e){const t=e.pos,{cid:r,length:i,blockLength:n}=await m(e),s={cid:r,length:i,blockLength:n,offset:t,blockOffset:e.pos};return e.seek(s.blockLength),s}function w(e){let t=0,r=0,i=0,n=new Uint8Array(0);const s=async t=>{r=n.length-i;const s=[n.subarray(i)];for(;r<t;){const t=await e();if(null==t)break;r<0?t.length>r&&s.push(t.subarray(-r)):s.push(t),r+=t.length}n=new Uint8Array(s.reduce(((e,t)=>e+t.length),0));let o=0;for(const e of s)n.set(e,o),o+=e.length;i=0};return{upTo:async e=>(n.length-i<e&&await s(e),n.subarray(i,i+Math.min(n.length-i,e))),async exactly(e){if(n.length-i<e&&await s(e),n.length-i<e)throw new Error("Unexpected end of data");return n.subarray(i,i+e)},seek(e){t+=e,i+=e},get pos(){return t}}}r.asyncIterableReader=function(e){const t=e[Symbol.asyncIterator]();return w((async function(){const e=await t.next();return e.done?null:e.value}))},r.bytesReader=function(e){let t=0;return{upTo:async r=>e.subarray(t,t+Math.min(r,e.length-t)),async exactly(r){if(r>e.length-t)throw new Error("Unexpected end of data");return e.subarray(t,t+r)},seek(e){t+=e},get pos(){return t}}},r.chunkReader=w,r.createDecoder=function(e){const t=g(e);return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await b(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await v(e)}}},r.readHeader=g},{varint:"aN1CO","multiformats/cid":"9ooAY","multiformats/hashes/digest":"kpRBg","@ipld/dag-cbor":"3498i"}],evp3q:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option"),n=e("it-first"),s=e("it-last"),o=e("../../utils.js"),a=e("err-code");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(n),l=c(s),d=c(a);r.createGet=function({codecs:e,repo:t,preload:r}){return i.withTimeoutOption((async function(i,n={}){if(!1!==n.preload&&r(i),n.path){const r=n.localResolve?await u.default(o.resolve(i,n.path,e,t,n)):await l.default(o.resolve(i,n.path,e,t,n));if(!r)throw d.default(new Error("Not found"),"ERR_NOT_FOUND");return r}const s=await e.getCodec(i.code),a=await t.blocks.get(i,n);return{value:s.decode(a),remainderPath:""}}))}},{"ipfs-core-utils/with-timeout-option":"j29MK","it-first":"hBrkP","it-last":"cSXX9","../../utils.js":"cT4uN","err-code":"chZjB"}],hBrkP:[function(e,t,r){"use strict";t.exports=async e=>{for await(const t of e)return t}},{}],"1a905":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@ipld/car/iterator"),n=e("ipfs-core-utils/with-timeout-option"),s=e("it-peekable"),o=e("it-drain"),a=e("it-map"),c=e("debug");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(s),d=u(o),f=u(a);const h=u(c).default("ipfs:components:dag:import");async function p(e,t,r){const n=await i.CarBlockIterator.fromIterable(r),s=await n.getRoots();return await d.default(e.blocks.putMany(f.default(n,(({cid:e,bytes:t})=>(h(`Import block ${e}`),{key:e,value:t}))),{signal:t.signal})),s}r.createImport=function({repo:e}){return n.withTimeoutOption((async function*(t,r={}){const i=await e.gcLock.readLock();try{const n={signal:r.signal,timeout:r.timeout},s=l.default(t),{value:o,done:a}=await s.peek();if(a)return;let c;o&&s.push(o),c=o instanceof Uint8Array?[s]:s;for await(const t of c){const i=await p(e,n,t);if(!1!==r.pinRoots)for(const t of i){let r="";try{await e.blocks.has(t)?(h(`Pinning root ${t}`),await e.pins.pinRecursively(t)):r="blockstore: block not found"}catch(e){r=e.message}yield{root:{cid:t,pinErrorMsg:r}}}}}finally{i()}}))}},{"@ipld/car/iterator":"e6CDb","ipfs-core-utils/with-timeout-option":"j29MK","it-peekable":"bi9X1","it-drain":"dKYhO","it-map":"eeqPk",debug:"bO5wM"}],e6CDb:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./decoder.js");class n{constructor(e,t,r){this._version=e,this._roots=t,this._iterable=r,this._decoded=!1}get version(){return this._version}async getRoots(){return this._roots}}class s extends n{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");return this._decoded=!0,this._iterable[Symbol.asyncIterator]()}static async fromBytes(e){const{version:t,roots:r,iterator:i}=await a(e);return new s(t,r,i)}static async fromIterable(e){const{version:t,roots:r,iterator:i}=await c(e);return new s(t,r,i)}}class o extends n{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");this._decoded=!0;const e=this._iterable[Symbol.asyncIterator]();return{async next(){const t=await e.next();return t.done?t:{done:!1,value:t.value.cid}}}}static async fromBytes(e){const{version:t,roots:r,iterator:i}=await a(e);return new o(t,r,i)}static async fromIterable(e){const{version:t,roots:r,iterator:i}=await c(e);return new o(t,r,i)}}async function a(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return u(i.bytesReader(e))}async function c(e){if(!e||"function"!=typeof e[Symbol.asyncIterator])throw new TypeError("fromIterable() requires an async iterable");return u(i.asyncIterableReader(e))}async function u(e){const t=i.createDecoder(e),{version:r,roots:n}=await t.header();return{version:r,roots:n,iterator:t.blocks()}}r.CarBlockIterator=s,r.CarCIDIterator=o,r.CarIteratorBase=n},{"./decoder.js":"hA2ak"}],d8SU0:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("ipfs-core-utils/with-timeout-option");r.createPut=function({repo:e,codecs:t,hashers:r,preload:s}){return n.withTimeoutOption((async function(n,o={}){const a=o.pin?await e.gcLock.readLock():null;try{const c=o.format||"dag-cbor",u=null!=o.version?o.version:"dag-pb"===c?0:1,l=await t.getCodec(c);if(!l)throw new Error(`Unknown codec ${o.format}, please configure additional BlockCodecs for this IPFS instance`);const d=await r.getHasher(o.hashAlg||"sha2-256");if(!d)throw new Error(`Unknown hash algorithm ${o.hashAlg}, please configure additional MultihashHashers for this IPFS instance`);const f=l.encode(n),h=await d.digest(f),p=i.CID.create(u,l.code,h);return await e.blocks.put(p,f,{signal:o.signal}),o.pin&&await e.pins.pinRecursively(p),!1!==o.preload&&s(p),p}finally{a&&a()}}))}},{"multiformats/cid":"9ooAY","ipfs-core-utils/with-timeout-option":"j29MK"}],gIL7b:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option"),n=e("ipfs-core-utils/to-cid-and-path"),s=e("../../utils.js");r.createResolve=function({repo:e,codecs:t,preload:r}){return i.withTimeoutOption((async function(i,o={}){const{cid:a}=n.toCidAndPath(i);return!1!==o.preload&&r(a),s.resolvePath(e,t,i,o)}))}},{"ipfs-core-utils/with-timeout-option":"j29MK","ipfs-core-utils/to-cid-and-path":"jN5CZ","../../utils.js":"cT4uN"}],kBOEV:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiaddr-to-uri"),n=e("debug"),s=e("array-shuffle"),o=e("native-abort-controller"),a=e("ipfs-core-config/preload"),c=e("hashlru");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(i),d=u(n),f=u(s),h=u(c);const p=Object.assign(d.default("ipfs:preload"),{error:d.default("ipfs:preload:error")});r.createPreloader=function(e={}){if(e.enabled=Boolean(e.enabled),e.addresses=e.addresses||[],e.cache=e.cache||1e3,!e.enabled||!e.addresses.length){p("preload disabled");const e=()=>{};return Object.assign(e,{start:()=>{},stop:()=>{}})}let t=!0,r=[];const i=e.addresses.map(l.default),n=h.default(e.cache),s=async e=>{try{if(t)throw new Error(`preload ${e} but preloader is not started`);const s=e.toString();if(n.has(s))return;n.set(s,!0);const c=f.default(i);let u=!1;const l=Date.now();for(const e of c){if(t)throw new Error(`preload aborted for ${s}`);let i;try{i=new o.AbortController,r=r.concat(i),await a.preload(`${e}/api/v0/refs?r=true&arg=${encodeURIComponent(s)}`,{signal:i.signal}),u=!0}catch(e){"aborted"!==e.type&&p.error(e)}finally{r=r.filter((e=>e!==i))}if(u)break}p(`${u?"":"un"}successfully preloaded ${s} in ${Date.now()-l}ms`)}catch(e){p.error(e)}};return s.start=()=>{t=!1},s.stop=()=>{t=!0,p(`aborting ${r.length} pending preload request(s)`),r.forEach((e=>e.abort())),r=[]},s}},{"multiaddr-to-uri":"4PPH7",debug:"bO5wM","array-shuffle":"kUouG","native-abort-controller":"6zwoZ","ipfs-core-config/preload":"lk3b0",hashlru:"kBj5c"}],"4PPH7":[function(e,t,r){const{Multiaddr:i}=e("multiaddr"),n=(e,t)=>t,s={ip4:n,ip6:(e,t,r,i)=>1===i.length&&"ip6"===i[0].protocol?t:`[${t}]`,tcp:(e,t,r,i,n)=>i.some((e=>["http","https","ws","wss"].includes(e.protocol)))?`${e}:${t}`:((e,t,r,i)=>{if(i&&!1===i.assumeHttp)return`tcp://${e}:${t}`;let n="tcp",s=`:${t}`;return"tcp"===r[r.length-1].protocol&&(n="443"===t?"https":"http",s="443"===t||"80"===t?"":s),`${n}://${e}${s}`})(e,t,i,n),udp:(e,t)=>`udp://${e}:${t}`,dnsaddr:n,dns4:n,dns6:n,ipfs:(e,t)=>`${e}/ipfs/${t}`,p2p:(e,t)=>`${e}/p2p/${t}`,http:e=>`http://${e}`,https:e=>`https://${e}`,ws:e=>`ws://${e}`,wss:e=>`wss://${e}`,"p2p-websocket-star":e=>`${e}/p2p-websocket-star`,"p2p-webrtc-star":e=>`${e}/p2p-webrtc-star`,"p2p-webrtc-direct":e=>`${e}/p2p-webrtc-direct`};t.exports=(e,t)=>{const r=new i(e),n=e.toString().split("/").slice(1);return r.tuples().map((e=>({protocol:n.shift(),content:e[1]?n.shift():null}))).reduce(((e,r,i,n)=>{const o=s[r.protocol];if(!o)throw new Error(`Unsupported protocol ${r.protocol}`);return o(e,r.content,i,n,t)}),"")}},{multiaddr:"8Mu1u"}],kUouG:[function(e,t,r){"use strict";t.exports=e=>{if(!Array.isArray(e))throw new TypeError("Expected an array, got "+typeof e);for(let t=(e=[...e]).length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e}},{}],lk3b0:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-utils/src/http.js"),n=e("debug"),s=e("p-queue");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(i),c=o(n),u=o(s);const l=Object.assign(c.default("ipfs:preload"),{error:c.default("ipfs:preload:error")}),d=new(u.default.default?u.default.default:u.default)({concurrency:4});r.preload=function(e,t={}){return l(e),d.add((async()=>{const r=(await a.default.post(e,{signal:t.signal})).body.getReader();try{for(;;){const{done:e}=await r.read();if(e)return}}finally{r.releaseLock()}}))}},{"ipfs-utils/src/http.js":"ifXXn",debug:"bO5wM","p-queue":"biPlv"}],"7arhH":[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("debug"));const s=Object.assign(n.default("ipfs:mfs-preload"),{error:n.default("ipfs:mfs-preload:error")});r.createMfsPreloader=function({preload:e,files:t,options:r={}}){if(r.interval=r.interval||3e4,!r.enabled){s("MFS preload disabled");const e=async()=>{};return{start:e,stop:e}}let i,n="";const o=async()=>{try{const a=await t.stat("/"),c=a.cid.toString();n!==c&&(s(`preloading updated MFS root ${n} -> ${a.cid}`),await e(a.cid),n=c)}catch(e){s.error("failed to preload MFS root",e)}finally{i=setTimeout(o,r.interval)}};return{async start(){const e=await t.stat("/");n=e.cid.toString(),s(`monitoring MFS root ${e.cid}`),i=setTimeout(o,r.interval)},stop(){clearTimeout(i)}}}},{debug:"bO5wM"}],"1yxa2":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils/create-lock.js"),n=e("is-ipfs"),s=e("./stat.js"),o=e("./chmod.js"),a=e("./cp.js"),c=e("./flush.js"),u=e("./mkdir.js"),l=e("./mv.js"),d=e("./rm.js"),f=e("./touch.js"),h=e("./read.js"),p=e("./write.js"),g=e("./ls.js");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=y(n);const b={stat:s.createStat},v={chmod:o.createChmod,cp:a.createCp,flush:c.createFlush,mkdir:u.createMkdir,mv:l.createMv,rm:d.createRm,touch:f.createTouch},w={write:p.createWrite,read:h.createRead,ls:g.createLs},_=({options:e,mfs:t,operations:r,lock:i})=>{Object.keys(r).forEach((n=>{t[n]=i(r[n](e))}))},E={repoOwner:!0,repo:null};r.createFiles=function({repo:e,preload:t,hashers:r,options:n}){const s=function(e){const{repoOwner:t}=Object.assign({},E||{},e),r=i.createLock(t),n={};return _({options:e,mfs:n,operations:b,lock:e=>r.readLock(e)}),_({options:e,mfs:n,operations:v,lock:e=>r.writeLock(e)}),Object.keys(w).forEach((t=>{n[t]=w[t](e)})),n}({repo:e,repoOwner:Boolean(n.repoOwner),hashers:r}),o=e=>(...r)=>{const i=r.filter((e=>m.default.ipfsPath(e)||m.default.cid(e)));if(i.length){const e=r[r.length-1];e&&!1!==e.preload&&i.forEach((e=>t(e)))}return e(...r)};return{...s,chmod:s.chmod,cp:o(s.cp),mkdir:s.mkdir,stat:o(s.stat),rm:s.rm,read:o(s.read),touch:s.touch,write:s.write,mv:o(s.mv),flush:s.flush,ls:o((async function*(...e){for await(const t of s.ls(...e))yield{...t,size:t.size||0}}))}}},{"./utils/create-lock.js":"kHT2F","is-ipfs":"40iuV","./stat.js":"lCUdo","./chmod.js":"4Rlct","./cp.js":"eJoZU","./flush.js":"dFNhT","./mkdir.js":"h1mMu","./mv.js":"347nd","./rm.js":"hU9a1","./touch.js":"d4deE","./read.js":"3Dh6r","./write.js":"fQgQQ","./ls.js":"2uADA"}],kHT2F:[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("mortice"));let s;r.createLock=function(e=!1){if(s)return s;const t=n.default({singleProcess:e});return s={readLock:e=>async(...r)=>{const i=await t.readLock();try{return await e.apply(null,r)}finally{i()}},writeLock:e=>async(...r)=>{const i=await t.writeLock();try{return await e.apply(null,r)}finally{i()}}},s}},{mortice:"b5y0B"}],b5y0B:[function(e,t,r){var i=arguments[3];const n=e("./node"),s=e("./browser"),{default:o}=e("p-queue"),{timeout:a}=e("promise-timeout"),c=e("observable-webworkers"),u={};let l;function d(e,t){let r;const i=new Promise((e=>{r=e}));return e.add((()=>a(new Promise((e=>{r((()=>{e()}))})),t.timeout))),i}const f=(e,t)=>{if(l.isWorker)return{readLock:l.readLock(e,t),writeLock:l.writeLock(e,t)};const r=new o({concurrency:1});let i=null;return{readLock:()=>{if(i)return d(i,t);i=new o({concurrency:t.concurrency,autoStart:!1});const e=i,n=d(i,t);return r.add((()=>(e.start(),e.onIdle().then((()=>{i===e&&(i=null)}))))),n},writeLock:()=>(i=null,d(r,t))}},h={concurrency:1/0,timeout:846e5,global:i,singleProcess:!1};t.exports=(e,t)=>(t||(t={}),"object"==typeof e&&(t=e,e="lock"),e||(e="lock"),t=Object.assign({},h,t),l||(l=n(t)||s(t),l.isWorker||(l.on("requestReadLock",((e,t)=>{u[e]&&u[e].readLock().then((e=>t().finally((()=>e()))))})),l.on("requestWriteLock",(async(e,t)=>{u[e]&&u[e].writeLock().then((e=>t().finally((()=>e()))))})))),u[e]||(u[e]=f(e,t)),u[e]),t.exports.Worker=function(e,t){let r;t=t||i.Worker;try{r=new t(e)}catch(i){i.message.includes("not a constructor")&&(r=t(e))}if(!r)throw new Error("Could not create Worker from",t);return c(r),r}},{"./node":"i9PST","./browser":"jBdTr","p-queue":"biPlv","promise-timeout":"hQpJ2","observable-webworkers":"9ZFPi"}],i9PST:[function(e,t,r){var i=e("process");const n=e("events").EventEmitter,{nanoid:s}=e("nanoid"),{WORKER_REQUEST_READ_LOCK:o,WORKER_RELEASE_READ_LOCK:a,MASTER_GRANT_READ_LOCK:c,WORKER_REQUEST_WRITE_LOCK:u,WORKER_RELEASE_WRITE_LOCK:l,MASTER_GRANT_WRITE_LOCK:d}=e("./constants");let f;const h=(e,t,r,i,n)=>(s,o)=>{o&&o.type===r&&e.emit(t,o.name,(()=>(s.send({type:n,name:o.name,identifier:o.identifier}),new Promise((e=>{const t=r=>{r&&r.type===i&&r.identifier===o.identifier&&(s.removeListener("message",t),e())};s.on("message",t)})))))},p=(e,t,r,n)=>()=>{const o=s();return i.send({type:t,identifier:o,name:e}),new Promise((t=>{const s=a=>{a&&a.type===r&&a.identifier===o&&(i.removeListener("message",s),t((()=>{i.send({type:n,identifier:o,name:e})})))};i.on("message",s)}))};t.exports=t=>{try{if(f=e("cluster"),!Object.keys(f).length)return}catch(e){return}if(f.isMaster||t.singleProcess){const e=new n;return f.on("message",h(e,"requestReadLock",o,a,c)),f.on("message",h(e,"requestWriteLock",u,l,d)),e}return{isWorker:!0,readLock:e=>p(e,o,c,a),writeLock:e=>p(e,u,d,l)}}},{process:"bjUAi",events:"g82pp",nanoid:"dmVhu","./constants":"i3YBW",cluster:"lHksA"}],i3YBW:[function(e,t,r){t.exports={WORKER_REQUEST_READ_LOCK:"lock:worker:request-read",WORKER_RELEASE_READ_LOCK:"lock:worker:release-read",MASTER_GRANT_READ_LOCK:"lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK:"lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK:"lock:worker:release-write",MASTER_GRANT_WRITE_LOCK:"lock:master:grant-write"}},{}],jBdTr:[function(e,t,r){const i=e("events").EventEmitter,{nanoid:n}=e("nanoid"),{WORKER_REQUEST_READ_LOCK:s,WORKER_RELEASE_READ_LOCK:o,MASTER_GRANT_READ_LOCK:a,WORKER_REQUEST_WRITE_LOCK:c,WORKER_RELEASE_WRITE_LOCK:u,MASTER_GRANT_WRITE_LOCK:l}=e("./constants"),d=e("observable-webworkers"),f=(e,t,r,i,n)=>(s,o)=>{if(!o||!o.data||o.data.type!==r)return;const a={type:o.data.type,name:o.data.name,identifier:o.data.identifier};e.emit(t,a.name,(()=>(s.postMessage({type:n,name:a.name,identifier:a.identifier}),new Promise((e=>{const t=r=>{if(!r||!r.data)return;const n={type:r.data.type,name:r.data.name,identifier:r.data.identifier};n&&n.type===i&&n.identifier===a.identifier&&(s.removeEventListener("message",t),e())};s.addEventListener("message",t)})))))},h=(e,t,r,i)=>()=>{const s=n();return globalThis.postMessage({type:t,identifier:s,name:e}),new Promise((t=>{const n=o=>{if(!o||!o.data)return;const a={type:o.data.type,identifier:o.data.identifier};a&&a.type===r&&a.identifier===s&&(globalThis.removeEventListener("message",n),t((()=>{globalThis.postMessage({type:i,identifier:s,name:e})})))};globalThis.addEventListener("message",n)}))},p={singleProcess:!1};t.exports=e=>{e=Object.assign({},p,e);if(!!globalThis.document||e.singleProcess){const e=new i;return d.addEventListener("message",f(e,"requestReadLock",s,o,a)),d.addEventListener("message",f(e,"requestWriteLock",c,u,l)),e}return{isWorker:!0,readLock:e=>h(e,s,a,o),writeLock:e=>h(e,c,l,u)}}},{events:"g82pp",nanoid:"dmVhu","./constants":"i3YBW","observable-webworkers":"9ZFPi"}],"9ZFPi":[function(e,t,r){const i={},n=e=>{e.addEventListener("message",(t=>{n.dispatchEvent("message",e,t)})),e.port&&e.port.addEventListener("message",(t=>{n.dispatchEvent("message",e,t)}))};n.addEventListener=(e,t)=>{i[e]||(i[e]=[]),i[e].push(t)},n.removeEventListener=(e,t)=>{i[e]&&(i[e]=i[e].filter((e=>e===t)))},n.dispatchEvent=function(){const e=Array.prototype.slice.call(arguments),t=e.shift();i[t]&&i[t].forEach((t=>t.apply(null,e)))},t.exports=n},{}],hQpJ2:[function(e,t,r){"use strict";var i;t.exports.timeout=function(e,t){var r,n=new i;return Promise.race([e,new Promise((function(e,i){r=setTimeout((function(){i(n)}),t)}))]).then((function(e){return clearTimeout(r),e}),(function(e){throw clearTimeout(r),e}))};(i=t.exports.TimeoutError=function(){Error.call(this),this.stack=Error().stack,this.message="Timeout"}).prototype=Object.create(Error.prototype),i.prototype.name="TimeoutError"},{}],lCUdo:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("merge-options"),n=e("./utils/to-mfs-path.js"),s=e("ipfs-unixfs-exporter"),o=e("debug"),a=e("err-code"),c=e("ipfs-core-utils/with-timeout-option"),u=e("@ipld/dag-pb");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var f=l(i),h=l(o),p=l(a),g=d(u);const y=f.default.bind({ignoreUndefined:!0}),m=h.default("ipfs:mfs:stat"),b={withLocal:!1};const v={raw:e=>({cid:e.cid,size:e.node.length,cumulativeSize:e.node.length,blocks:0,type:"file",local:void 0,sizeLocal:void 0,withLocality:!1}),file:e=>{const t={cid:e.cid,type:"file",size:e.unixfs.fileSize(),cumulativeSize:g.encode(e.node).length+(e.node.Links||[]).reduce(((e,t)=>e+(t.Tsize||0)),0),blocks:e.unixfs.blockSizes.length,local:void 0,sizeLocal:void 0,withLocality:!1,mode:e.unixfs.mode};return e.unixfs.mtime&&(t.mtime=e.unixfs.mtime),t},directory:e=>{const t={cid:e.cid,type:"directory",size:0,cumulativeSize:g.encode(e.node).length+(e.node.Links||[]).reduce(((e,t)=>e+(t.Tsize||0)),0),blocks:e.node.Links.length,local:void 0,sizeLocal:void 0,withLocality:!1,mode:e.unixfs.mode};return e.unixfs.mtime&&(t.mtime=e.unixfs.mtime),t},object:e=>({cid:e.cid,size:e.node.length,cumulativeSize:e.node.length,type:"file",blocks:0,local:void 0,sizeLocal:void 0,withLocality:!1}),identity:e=>({cid:e.cid,size:e.node.length,cumulativeSize:e.node.length,blocks:0,type:"file",local:void 0,sizeLocal:void 0,withLocality:!1})};r.createStat=function(e){return c.withTimeoutOption((async function(t,r={}){r=y(b,r),m(`Fetching stats for ${t}`);const{type:i,cid:o,mfsPath:a}=await n.toMfsPath(e,t,r),c="ipfs"===i&&o?o:a;let u;try{u=await s.exporter(c,e.repo.blocks)}catch(e){if("ERR_NOT_FOUND"===e.code)throw p.default(new Error(`${t} does not exist`),"ERR_NOT_FOUND");throw e}if(!v[u.type])throw new Error(`Cannot stat codec ${u.cid.code}`);return v[u.type](u)}))}},{"merge-options":"fupyv","./utils/to-mfs-path.js":"gAtPl","ipfs-unixfs-exporter":"BgMiX",debug:"bO5wM","err-code":"chZjB","ipfs-core-utils/with-timeout-option":"j29MK","@ipld/dag-pb":"i2cdx"}],gAtPl:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./with-mfs-root.js"),n=e("./to-path-components.js"),s=e("ipfs-unixfs-exporter"),o=e("err-code"),a=e("multiformats/cid");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(o);const l="ipfs";r.toMfsPath=async(e,t,r)=>{const o=await i.loadMfsRoot(e,r);let c={entryType:"file"},d="";if(d=a.CID.asCID(t)?`/ipfs/${t}`:t.toString(),d=d.trim(),d=d.replace(/(\/\/+)/g,"/"),d.endsWith("/")&&d.length>1&&(d=d.substring(0,d.length-1)),!d)throw u.default(new Error("paths must not be empty"),"ERR_NO_PATH");if("/"!==d.substring(0,1))throw u.default(new Error("paths must start with a leading slash"),"ERR_INVALID_PATH");"/"===d.substring(d.length-1)&&(d=d.substring(0,d.length-1));const f=n.toPathComponents(d);if(f[0]===l){let e;e=2===f.length?`/${f.join("/")}`:`/${f.slice(0,f.length-1).join("/")}`,c={type:"ipfs",depth:f.length-2,entryType:"file",mfsPath:`/${f.join("/")}`,mfsDirectory:e,parts:f,path:`/${f.join("/")}`,name:f[f.length-1]}}else{const e=`/ipfs/${o}${f.length?"/"+f.join("/"):""}`,t=`/ipfs/${o}/${f.slice(0,f.length-1).join("/")}`;c={type:"mfs",depth:f.length,entryType:"file",mfsDirectory:t,mfsPath:e,parts:f,path:`/${f.join("/")}`,name:f[f.length-1]}}const h="mfs"===c.type?c.mfsPath:c.path;try{const t=await s.exporter(h,e.repo.blocks,r);c.cid=t.cid,c.mfsPath=`/ipfs/${t.path}`,c.entryType=t.type,c.content=t.content,"file"!==c.entryType&&"directory"!==c.entryType||"file"!==t.type&&"directory"!==t.type||(c.unixfs=t.unixfs)}catch(e){if("ERR_NOT_FOUND"!==e.code)throw e}return c.exists=Boolean(c.cid),c}},{"./with-mfs-root.js":"ho9kf","./to-path-components.js":"j9m7w","ipfs-unixfs-exporter":"BgMiX","err-code":"chZjB","multiformats/cid":"9ooAY"}],ho9kf:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("ipfs-unixfs"),s=e("@ipld/dag-pb"),o=e("multiformats/hashes/sha2"),a=e("debug"),c=e("err-code"),u=e("../../../utils.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var f=d(s),h=l(a),p=l(c);const g=h.default("ipfs:mfs:utils:with-mfs-root");r.loadMfsRoot=async function(e,t){if(t&&t.signal&&t.signal.aborted)throw p.default(new Error("Request aborted"),"ERR_ABORTED",{name:"Aborted"});let r;await e.repo.datastore.open();try{const t=await e.repo.datastore.get(u.MFS_ROOT_KEY);r=i.CID.decode(t)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s;g("Creating new MFS root");const a=f.encode({Data:new n.UnixFS({type:"directory"}).marshal(),Links:[]}),c=await o.sha256.digest(a);if(r=i.CID.createV0(c),await e.repo.blocks.put(r,a),t&&t.signal&&t.signal.aborted)throw p.default(new Error("Request aborted"),"ERR_ABORTED",{name:"Aborted"});await e.repo.datastore.put(u.MFS_ROOT_KEY,r.bytes)}return g(`Loaded MFS root /ipfs/${r}`),r}},{"multiformats/cid":"9ooAY","ipfs-unixfs":"dF9VO","@ipld/dag-pb":"i2cdx","multiformats/hashes/sha2":"7i9MT",debug:"bO5wM","err-code":"chZjB","../../../utils.js":"cT4uN"}],j9m7w:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.toPathComponents=function(e=""){return(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean)}},{}],"4Rlct":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("merge-options"),n=e("./utils/to-mfs-path.js"),s=e("debug"),o=e("err-code"),a=e("ipfs-unixfs"),c=e("./utils/to-trail.js"),u=e("./utils/add-link.js"),l=e("./utils/update-tree.js"),d=e("./utils/update-mfs-root.js"),f=e("@ipld/dag-pb"),h=e("multiformats/cid"),p=e("it-pipe"),g=e("ipfs-unixfs-importer"),y=e("ipfs-unixfs-exporter"),m=e("it-last"),b=e("./cp.js"),v=e("./rm.js"),w=e("./utils/persist.js"),_=e("ipfs-core-utils/with-timeout-option");function E(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function S(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var T=E(i),A=E(s),k=E(o),I=S(f),R=E(m);const P=T.default.bind({ignoreUndefined:!0}),O=A.default("ipfs:mfs:touch"),C={flush:!0,shardSplitThreshold:1e3,hashAlg:"sha2-256",cidVersion:0,recursive:!1};function j(e,t,r){t||(t=0);const i=e.match(/^(u?g?o?a?)(-?\+?=?)?(r?w?x?X?s?t?)$/);if(!i)throw new Error(`Invalid file mode: ${e}`);let[,n,s,o]=i;"a"!==n&&n||(n="ugo");let a=function(e,t,r){let i=0;return(e.includes("x")||e.includes("X")&&(r||1&t||8&t||64&t))&&(i+=1),e.includes("w")&&(i+=2),e.includes("r")&&(i+=4),i}(o,t,r);return a=function(e,t){let r=0;return e.includes("u")&&(r+=t<<6),e.includes("g")&&(r+=t<<3),e.includes("o")&&(r+=t),r}(n,a),a=function(e,t,r){return t.includes("t")&&(r+=parseInt("1000",8)),t.includes("s")&&(e.includes("u")&&(r+=parseInt("4000",8)),e.includes("g")&&(r+=parseInt("2000",8))),r}(n,o,a),"="===s?(n.includes("u")&&(t&=parseInt("7077",8),t|=a),n.includes("g")&&(t&=parseInt("7707",8),t|=a),n.includes("o")&&(t&=parseInt("7770",8),t|=a),t):"+"===s?a|t:"-"===s?a^t:t}function D(e,t){if(e instanceof String||"string"==typeof e){const r=`${e}`;e=r.match(/^\d+$/g)?parseInt(r,8):0+r.split(",").reduce(((e,r)=>j(r,e,t.isDirectory())),t.mode||0)}return e}r.createChmod=function(e){return _.withTimeoutOption((async function(t,r,i={}){const s=P(C,i);O(`Fetching stats for ${t}`);const{cid:o,mfsDirectory:f,name:m}=await n.toMfsPath(e,t,s);if(o.code!==I.code)throw k.default(new Error(`${t} was not a UnixFS node`),"ERR_NOT_UNIXFS");if(s.recursive){const i=await p.pipe((async function*(){for await(const i of y.recursive(o,e.repo.blocks)){if("file"!==i.type&&"directory"!==i.type)throw k.default(new Error(`${t} was not a UnixFS node`),"ERR_NOT_UNIXFS");i.unixfs.mode=D(r,i.unixfs);const e=I.prepare({Data:i.unixfs.marshal(),Links:i.node.Links});yield{path:i.path,content:e}}}),(t=>g.importer(t,e.repo.blocks,{...s,pin:!1,dagBuilder:async function*(e,t,r){for await(const i of e)yield async function(){const e=i.content,n=I.encode(e),s=await w.persist(n,t,r);if(!e.Data)throw k.default(new Error(`${s} had no data`),"ERR_INVALID_NODE");const o=a.UnixFS.unmarshal(e.Data);return{cid:s,size:n.length,path:i.path,unixfs:o}}}})),(e=>R.default(e)));if(!i)throw k.default(new Error(`Could not chmod ${t}`),"ERR_COULD_NOT_CHMOD");return await v.createRm(e)(t,s),void await b.createCp(e)(`/ipfs/${i.cid}`,t,s)}const _=await e.repo.blocks.get(o),E=I.decode(_);if(!E.Data)throw k.default(new Error(`${o} had no data`),"ERR_INVALID_NODE");const S=a.UnixFS.unmarshal(E.Data);S.mode=D(r,S);const T=I.encode({Data:S.marshal(),Links:E.Links}),A=s.hashAlg||C.hashAlg,j=await e.hashers.getHasher(A),M=await j.digest(T),x=h.CID.create(s.cidVersion,I.code,M);s.flush&&await e.repo.blocks.put(x,T);const B=await c.toTrail(e,f),L=B[B.length-1],N=h.CID.decode(L.cid.bytes),U=await e.repo.blocks.get(N),F=I.decode(U),K=await u.addLink(e,{parent:F,name:m,cid:x,size:T.length,flush:s.flush,hashAlg:A,cidVersion:o.version,shardSplitThreshold:1/0});L.cid=K.cid;const z=await l.updateTree(e,B,s);await d.updateMfsRoot(e,z,s)}))}},{"merge-options":"fupyv","./utils/to-mfs-path.js":"gAtPl",debug:"bO5wM","err-code":"chZjB","ipfs-unixfs":"dF9VO","./utils/to-trail.js":"crUUQ","./utils/add-link.js":"dv4f9","./utils/update-tree.js":"dvDDB","./utils/update-mfs-root.js":"lpX0i","@ipld/dag-pb":"i2cdx","multiformats/cid":"9ooAY","it-pipe":"giKBQ","ipfs-unixfs-importer":"i61x3","ipfs-unixfs-exporter":"BgMiX","it-last":"cSXX9","./cp.js":"eJoZU","./rm.js":"hU9a1","./utils/persist.js":"hc7Uz","ipfs-core-utils/with-timeout-option":"j29MK"}],crUUQ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-unixfs-exporter");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const s=n(e("debug")).default("ipfs:mfs:utils:to-trail");r.toTrail=async function(e,t){s(`Creating trail for path ${t}`);const r=[];for await(const n of i.walkPath(t,e.repo.blocks))r.push({name:n.name,cid:n.cid,size:n.size,type:n.type});return r}},{"ipfs-unixfs-exporter":"BgMiX",debug:"bO5wM"}],dv4f9:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@ipld/dag-pb"),n=e("multiformats/cid"),s=e("debug"),o=e("ipfs-unixfs"),a=e("./dir-sharded.js"),c=e("./hamt-utils.js"),u=e("err-code"),l=e("it-last");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function f(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var h=f(i),p=d(s),g=d(u),y=d(l);const m=p.default("ipfs:mfs:core:utils:add-link");const b=async(e,t)=>{const r=await c.createShard(e,t.parent.Links.map((e=>({name:e.Name||"",size:e.Tsize||0,cid:e.Hash}))).concat({name:t.name,size:t.size,cid:t.cid}),t);return m(`Converted directory to sharded directory ${r.cid}`),r},v=async(e,t)=>{const r=t.parent.Links.filter((e=>e.Name!==t.name));if(r.push({Name:t.name,Tsize:t.size,Hash:t.cid}),!t.parent.Data)throw g.default(new Error("Parent node with no data passed to addToDirectory"),"ERR_INVALID_PARENT");const i=o.UnixFS.unmarshal(t.parent.Data);let s;if(i.mtime){const e=Date.now(),t=Math.floor(e/1e3);i.mtime={secs:t,nsecs:1e3*(e-1e3*t)},s=i.marshal()}else s=t.parent.Data;t.parent=h.prepare({Data:s,Links:r});const a=await e.hashers.getHasher(t.hashAlg),c=h.encode(t.parent),u=await a.digest(c),l=n.CID.create(t.cidVersion,h.code,u);return t.flush&&await e.repo.blocks.put(l,c),{node:t.parent,cid:l,size:c.length}},w=async(e,t)=>{const{shard:r,path:i}=await _(e,t),n=await y.default(r.flush(e.repo.blocks));if(!n)throw new Error("No result from flushing shard");const s=await e.repo.blocks.get(n.cid),o=h.decode(s),a=t.parent.Links.filter((e=>(e.Name||"").substring(0,2)!==i[0].prefix)),u=o.Links.find((e=>(e.Name||"").substring(0,2)===i[0].prefix));if(!u)throw new Error(`No link found with prefix ${i[0].prefix}`);return a.push(u),c.updateHamtDirectory(e,a,i[0].bucket,t)},_=async(e,t)=>{const r={name:t.name,cid:t.cid,size:t.size};if(!t.parent.Data)throw g.default(new Error("Parent node with no data passed to addFileToShardedDirectory"),"ERR_INVALID_PARENT");const i=await c.recreateInitialHamtLevel(t.parent.Links),n=o.UnixFS.unmarshal(t.parent.Data),s=new a.DirSharded({root:!0,dir:!0,parent:void 0,parentKey:void 0,path:"",dirty:!0,flat:!1,mode:n.mode},t);s._bucket=i,n.mtime&&(s.mtime={secs:Math.round(Date.now()/1e3)});const u=await i._findNewBucketAndPos(r.name),l=E(u);l[0].node=t.parent;let d=0;for(;d<l.length;){const t=l[d];d++;const n=t.node;if(!n)throw new Error("Segment had no node");const s=n.Links.find((e=>(e.Name||"").substring(0,2)===t.prefix));if(!s){m(`Link ${t.prefix}${r.name} will be added`),d=l.length;break}if(s.Name===`${t.prefix}${r.name}`){m(`Link ${t.prefix}${r.name} will be replaced`),d=l.length;break}if((s.Name||"").length>2){m(`Link ${s.Name} ${s.Hash} will be replaced with a subshard`),d=l.length;break}m(`Found subshard ${t.prefix}`);const o=await e.repo.blocks.get(s.Hash),a=h.decode(o);if(!l[d]){m(`Loaded new subshard ${t.prefix}`),await c.recreateHamtLevel(a.Links,i,t.bucket,parseInt(t.prefix,16));const e=await i._findNewBucketAndPos(r.name);l.push({bucket:e.bucket,prefix:c.toPrefix(e.pos),node:a});break}const u=l[d];await c.addLinksToHamtBucket(a.Links,u.bucket,i),u.node=a}return await s._bucket.put(r.name,{size:r.size,cid:r.cid}),{shard:s,path:l}},E=e=>{const t=[{bucket:e.bucket,prefix:c.toPrefix(e.pos)}];let r=e.bucket._parent,i=e.bucket._posAtParent;for(;r;)t.push({bucket:r,prefix:c.toPrefix(i)}),i=r._posAtParent,r=r._parent;return t.reverse(),t};r.addLink=async function(e,t){let r=t.parent;if(t.parentCid){const i=n.CID.asCID(t.parentCid);if(null===i)throw g.default(new Error("Invalid CID passed to addLink"),"EINVALIDPARENTCID");if(i.code!==h.code)throw g.default(new Error("Unsupported codec. Only DAG-PB is supported"),"EINVALIDPARENTCID");m(`Loading parent node ${i}`);const s=await e.repo.blocks.get(i);r=h.decode(s)}if(!r)throw g.default(new Error("No parent node or CID passed to addLink"),"EINVALIDPARENT");if(!t.cid)throw g.default(new Error("No child cid passed to addLink"),"EINVALIDCHILDCID");if(!t.name)throw g.default(new Error("No child name passed to addLink"),"EINVALIDCHILDNAME");if(!t.size&&0!==t.size)throw g.default(new Error("No child size passed to addLink"),"EINVALIDCHILDSIZE");if(!r.Data)throw g.default(new Error("Parent node with no data passed to addLink"),"ERR_INVALID_PARENT");const i=o.UnixFS.unmarshal(r.Data);return"hamt-sharded-directory"===i.type?(m("Adding link to sharded directory"),w(e,{...t,parent:r})):r.Links.length>=t.shardSplitThreshold?(m("Converting directory to sharded directory"),b(e,{...t,parent:r,mtime:i.mtime,mode:i.mode})):(m(`Adding ${t.name} (${t.cid}) to regular directory`),v(e,{...t,parent:r}))}},{"@ipld/dag-pb":"i2cdx","multiformats/cid":"9ooAY",debug:"bO5wM","ipfs-unixfs":"dF9VO","./dir-sharded.js":"ixBLc","./hamt-utils.js":"gemQO","err-code":"chZjB","it-last":"cSXX9"}],ixBLc:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@ipld/dag-pb"),n=e("ipfs-unixfs"),s=e("./persist.js"),o=e("hamt-sharding"),a=e("./hamt-constants.js");class c{constructor(e,t){this.options=t||{},this.root=e.root,this.dir=e.dir,this.path=e.path,this.dirty=e.dirty,this.flat=e.flat,this.parent=e.parent,this.parentKey=e.parentKey,this.unixfs=e.unixfs,this.mode=e.mode,this.mtime=e.mtime,this.cid=void 0,this.size=void 0}async put(e,t){}get(e){return Promise.resolve(this)}async*eachChildSeries(){}async*flush(e){}}async function*u(e,t,r,c){const l=e._children,d=[];let f=0;for(let e=0;e<l.length;e++){const r=l.get(e);if(!r)continue;const i=e.toString(16).toUpperCase().padStart(2,"0");if(r instanceof o.Bucket){let e;for await(const i of await u(r,t,null,c))e=i;if(!e)throw new Error("Could not flush sharded directory, no subshard found");d.push({Name:i,Tsize:e.size,Hash:e.cid}),f+=e.size}else if("function"==typeof r.value.flush){const e=r.value;let n;for await(const r of e.flush(t))n=r,yield n;const s=i+r.key;d.push({Name:s,Tsize:n.size,Hash:n.cid}),f+=n.size}else{const e=r.value;if(!e.cid)continue;const t=i+r.key,n=e.size;d.push({Name:t,Tsize:n,Hash:e.cid}),f+=n}}const h=Uint8Array.from(l.bitField().reverse()),p={Data:new n.UnixFS({type:"hamt-sharded-directory",data:h,fanout:e.tableSize(),hashType:a.hamtHashCode,mtime:r&&r.mtime,mode:r&&r.mode}).marshal(),Links:d},g=i.encode(i.prepare(p)),y=await s.persist(g,t,c),m=g.length+f;yield{cid:y,node:p,size:m}}r.Dir=c,r.DirSharded=class extends c{constructor(e,t){super(e,t),this._bucket=o.createHAMT({hashFn:a.hamtHashFn,bits:a.hamtBucketBits})}async put(e,t){await this._bucket.put(e,t)}get(e){return this._bucket.get(e)}childCount(){return this._bucket.leafCount()}directChildrenCount(){return this._bucket.childrenCount()}onlyChild(){return this._bucket.onlyChild()}async*eachChildSeries(){for await(const{key:e,value:t}of this._bucket.eachLeafSeries())yield{key:e,child:t}}async*flush(e){yield*u(this._bucket,e,this,this.options)}}},{"@ipld/dag-pb":"i2cdx","ipfs-unixfs":"dF9VO","./persist.js":"hc7Uz","hamt-sharding":"1SDvb","./hamt-constants.js":"2jyXQ"}],hc7Uz:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("@ipld/dag-pb"),s=e("multiformats/hashes/sha2");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=o(n);r.persist=async(e,t,r)=>{r.codec||(r.codec=a),r.hasher||(r.hasher=s.sha256),void 0===r.cidVersion&&(r.cidVersion=1),r.codec===a&&r.hasher!==s.sha256&&(r.cidVersion=1);const n=await r.hasher.digest(e),o=i.CID.create(r.cidVersion,r.codec.code,n);return r.onlyHash||await t.put(o,e,{signal:r.signal}),o}},{"multiformats/cid":"9ooAY","@ipld/dag-pb":"i2cdx","multiformats/hashes/sha2":"7i9MT"}],"2jyXQ":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@multiformats/murmur3");const n=i.murmur3128.code;r.hamtBucketBits=8,r.hamtHashCode=n,r.hamtHashFn=async function(e){return(await i.murmur3128.encode(e)).slice(0,8).reverse()}},{"@multiformats/murmur3":"5DFrl"}],gemQO:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@ipld/dag-pb"),n=e("hamt-sharding"),s=e("./dir-sharded.js"),o=e("debug"),a=e("ipfs-unixfs"),c=e("it-last"),u=e("multiformats/cid"),l=e("./hamt-constants.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function f(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var h=f(i),p=d(o),g=d(c);const y=p.default("ipfs:mfs:core:utils:hamt-utils"),m=async(e,t,r,i)=>{const s=new n.Bucket({hash:t._options.hash,bits:t._options.bits},r,i);return r._putObjectAt(i,s),await v(e,s,t),s},b=async e=>{const t=n.createHAMT({hashFn:l.hamtHashFn,bits:l.hamtBucketBits});return await v(e,t,t),t},v=async(e,t,r)=>{await Promise.all(e.map((e=>{const i=e.Name||"";if(2===i.length){const e=parseInt(i,16);return t._putObjectAt(e,new n.Bucket({hash:r._options.hash,bits:r._options.bits},t,e)),Promise.resolve()}return r.put(i.substring(2),{size:e.Tsize,cid:e.Hash})})))},w=e=>e.toString(16).toUpperCase().padStart(2,"0").substring(0,2);r.addLinksToHamtBucket=v,r.createShard=async(e,t,r={})=>{const i=new s.DirSharded({root:!0,dir:!0,parent:void 0,parentKey:void 0,path:"",dirty:!0,flat:!1,mtime:r.mtime,mode:r.mode},r);for(let e=0;e<t.length;e++)await i._bucket.put(t[e].name,{size:t[e].size,cid:t[e].cid});const n=await g.default(i.flush(e.repo.blocks));if(!n)throw new Error("Flushing shard yielded no result");return n},r.generatePath=async(e,t,r)=>{const i=await b(r.Links),n=await i._findNewBucketAndPos(t),s=[{bucket:n.bucket,prefix:w(n.pos)}];let o=n.bucket;for(;o!==i;)s.push({bucket:o,prefix:w(o._posAtParent)}),o=o._parent;s.reverse(),s[0].node=r;for(let r=0;r<s.length;r++){const n=s[r];if(!n.node)throw new Error("Could not generate HAMT path");const o=n.node.Links.filter((e=>(e.Name||"").substring(0,2)===n.prefix)).pop();if(!o){y(`Link ${n.prefix}${t} will be added`);continue}if(o.Name===`${n.prefix}${t}`){y(`Link ${n.prefix}${t} will be replaced`);continue}y(`Found subshard ${n.prefix}`);const a=await e.repo.blocks.get(o.Hash),c=h.decode(a);if(!s[r+1]){y(`Loaded new subshard ${n.prefix}`),await m(c.Links,i,n.bucket,parseInt(n.prefix,16));const e=await i._findNewBucketAndPos(t);s.push({bucket:e.bucket,prefix:w(e.pos),node:c});continue}const u=s[r+1];await v(c.Links,u.bucket,i),u.node=c}return await i.put(t,!0),s.reverse(),{rootBucket:i,path:s}},r.recreateHamtLevel=m,r.recreateInitialHamtLevel=b,r.toPrefix=w,r.updateHamtDirectory=async(e,t,r,i)=>{if(!i.parent.Data)throw new Error("Could not update HAMT directory because parent had no data");const n=Uint8Array.from(r._children.bitField().reverse()),s=a.UnixFS.unmarshal(i.parent.Data),o=new a.UnixFS({type:"hamt-sharded-directory",data:n,fanout:r.tableSize(),hashType:l.hamtHashCode,mode:s.mode,mtime:s.mtime}),c=await e.hashers.getHasher(i.hashAlg),d={Data:o.marshal(),Links:t.sort(((e,t)=>(e.Name||"").localeCompare(t.Name||"")))},f=h.encode(d),p=await c.digest(f),g=u.CID.create(i.cidVersion,h.code,p);return i.flush&&await e.repo.blocks.put(g,f),{node:d,cid:g,size:t.reduce(((e,t)=>e+(t.Tsize||0)),f.length)}}},{"@ipld/dag-pb":"i2cdx","hamt-sharding":"1SDvb","./dir-sharded.js":"ixBLc",debug:"bO5wM","ipfs-unixfs":"dF9VO","it-last":"cSXX9","multiformats/cid":"9ooAY","./hamt-constants.js":"2jyXQ"}],dvDDB:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("debug"),n=e("./add-link.js"),s=e("@ipld/dag-pb");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const a=o(i).default("ipfs:mfs:utils:update-tree"),c={shardSplitThreshold:1e3};r.updateTree=async function(e,t,r){r=Object.assign({},c,r),a("Trail",t),t=t.slice().reverse();let i,o=0;for await(const a of e.repo.blocks.getMany(t.map((e=>e.cid)))){const c=s.decode(a),u=t[o].cid,l=t[o].name;if(o++,!i){i={cid:u,name:l,size:a.length};continue}const d=await n.addLink(e,{parent:c,name:i.name,cid:i.cid,size:i.size,flush:r.flush,shardSplitThreshold:r.shardSplitThreshold,hashAlg:r.hashAlg,cidVersion:r.cidVersion});i={cid:d.cid,name:l,size:d.size}}const{cid:u}=i;return a(`Final CID ${u}`),u}},{debug:"bO5wM","./add-link.js":"dv4f9","@ipld/dag-pb":"i2cdx"}],lpX0i:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("debug"),n=e("../../../utils.js"),s=e("err-code");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(i),c=o(s);const u=a.default("ipfs:mfs:utils:update-mfs-root");r.updateMfsRoot=async function(e,t,r){if(r&&r.signal&&r.signal.aborted)throw c.default(new Error("Request aborted"),"ERR_ABORTED",{name:"Aborted"});return u(`New MFS root will be ${t}`),await e.repo.datastore.put(n.MFS_ROOT_KEY,t.bytes),t}},{debug:"bO5wM","../../../utils.js":"cT4uN","err-code":"chZjB"}],eJoZU:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./mkdir.js"),n=e("./stat.js"),s=e("debug"),o=e("err-code"),a=e("./utils/update-tree.js"),c=e("./utils/update-mfs-root.js"),u=e("./utils/add-link.js"),l=e("./utils/to-mfs-path.js"),d=e("merge-options"),f=e("./utils/to-trail.js"),h=e("ipfs-core-utils/with-timeout-option");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=p(s),y=p(o);const m=p(d).default.bind({ignoreUndefined:!0}),b=g.default("ipfs:mfs:cp"),v={parents:!1,flush:!0,hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3};const w=e=>e.unixfs&&e.unixfs.type&&e.unixfs.type.includes("directory"),_=async(e,t,r,i,n)=>{let s=i.pop();if(!s)throw y.default(new Error("destination had no parent"),"ERR_INVALID_PARAMS");s=await S(e,t,r,s,n),i.push(s);const o=await a.updateTree(e,i,n);await c.updateMfsRoot(e,o,n)},E=async(e,t,r,i,n)=>{for(let i=0;i<t.length;i++){const s=t[i];r=await S(e,s,s.name,r,n)}i[i.length-1]=r;const s=await a.updateTree(e,i,n);await c.updateMfsRoot(e,s,n)},S=async(e,t,r,i,n)=>{const s=await e.repo.blocks.get(t.cid),{node:o,cid:a,size:c}=await u.addLink(e,{parentCid:i.cid,size:s.length,cid:t.cid,name:r,hashAlg:n.hashAlg,cidVersion:n.cidVersion,flush:n.flush,shardSplitThreshold:n.shardSplitThreshold});return i.node=o,i.cid=a,i.size=c,i};r.createCp=function(e){return h.withTimeoutOption((async function(t,r,s={}){const o=m(v,s);Array.isArray(t)||(t=[t]);const a=await Promise.all(t.map((t=>l.toMfsPath(e,t,o))));let c=await l.toMfsPath(e,r,o);if(!a.length||!c)throw y.default(new Error("Please supply at least one source"),"ERR_INVALID_PARAMS");const u=a.find((e=>!e.exists));if(u)throw y.default(new Error(`${u.path} does not exist`),"ERR_INVALID_PARAMS");const d=w(c);if(c.exists){if(b("Destination exists"),1===a.length&&!d)throw y.default(new Error("directory already has entry by that name"),"ERR_ALREADY_EXISTS")}else if(b("Destination does not exist"),a.length>1){if(!o.parents)throw y.default(new Error("destination did not exist, pass -p to create intermediate directories"),"ERR_INVALID_PARAMS");await i.createMkdir(e)(c.path,o),c=await l.toMfsPath(e,c.path,o)}else if(c.parts.length>1){const t=`/${c.parts.slice(0,-1).join("/")}`;try{await n.createStat(e)(t,o)}catch(r){if("ERR_NOT_FOUND"!==r.code)throw r;if(!o.parents)throw y.default(new Error("destination did not exist, pass -p to create intermediate directories"),"ERR_INVALID_PARAMS");await i.createMkdir(e)(t,o),c=await l.toMfsPath(e,c.path,o)}}const h=w(c)?c.mfsPath:c.mfsDirectory,p=await f.toTrail(e,h);if(1===a.length){const t=a.pop();if(!t)throw y.default(new Error("could not find source"),"ERR_INVALID_PARAMS");const r=d?t.name:c.name;return b(`Only one source, copying to destination ${d?"directory":"file"} ${r}`),_(e,t,r,p,o)}return b("Multiple sources, wrapping in a directory"),E(e,a,c,p,o)}))}},{"./mkdir.js":"h1mMu","./stat.js":"lCUdo",debug:"bO5wM","err-code":"chZjB","./utils/update-tree.js":"dvDDB","./utils/update-mfs-root.js":"lpX0i","./utils/add-link.js":"dv4f9","./utils/to-mfs-path.js":"gAtPl","merge-options":"fupyv","./utils/to-trail.js":"crUUQ","ipfs-core-utils/with-timeout-option":"j29MK"}],h1mMu:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("err-code"),n=e("debug"),s=e("ipfs-unixfs-exporter"),o=e("./utils/create-node.js"),a=e("./utils/to-path-components.js"),c=e("./utils/update-mfs-root.js"),u=e("./utils/update-tree.js"),l=e("./utils/add-link.js"),d=e("./utils/with-mfs-root.js"),f=e("merge-options"),h=e("ipfs-core-utils/with-timeout-option");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=p(i),y=p(n);const m=p(f).default.bind({ignoreUndefined:!0}),b=y.default("ipfs:mfs:mkdir"),v={parents:!1,hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3,flush:!0};const w=async(e,t,r,i,n,s)=>{b(`Adding empty dir called ${t} to ${i.cid}`);const o=await l.addLink(e,{parent:i.node,parentCid:i.cid,size:0,cid:r.cid,name:t,hashAlg:s.hashAlg,cidVersion:s.cidVersion,flush:s.flush,shardSplitThreshold:s.shardSplitThreshold});n[n.length-1].cid=o.cid,n.push({name:t,cid:r.cid})};r.createMkdir=function(e){return h.withTimeoutOption((async function(t,r={}){const i=m(v,r);if(!t)throw new Error("no path given to Mkdir");if("/"===(t=t.trim())){if(i.parents)return;throw g.default(new Error("cannot create directory '/': Already exists"),"ERR_INVALID_PATH")}if("/"!==t.substring(0,1))throw g.default(new Error("paths must start with a leading slash"),"ERR_INVALID_PATH");b(`Creating ${t}`);const n=a.toPathComponents(t);if("ipfs"===n[0])throw g.default(new Error("path cannot have the prefix 'ipfs'"),"ERR_INVALID_PATH");const l=await d.loadMfsRoot(e,i);let f;const h=[],p=await o.createNode(e,"directory",i);for(let r=0;r<=n.length;r++){const o=n.slice(0,r),a=`/ipfs/${l}/${o.join("/")}`;try{if(f=await s.exporter(a,e.repo.blocks),"file"!==f.type&&"directory"!==f.type)throw g.default(new Error(`${t} was not a UnixFS node`),"ERR_NOT_UNIXFS");if(r===n.length){if(i.parents)return;throw g.default(new Error("file already exists"),"ERR_ALREADY_EXISTS")}h.push({name:f.name,cid:f.cid})}catch(t){if("ERR_NOT_FOUND"!==t.code)throw t;if(r<n.length&&!i.parents)throw g.default(new Error(`Intermediate directory path ${a} does not exist, use the -p flag to create it`),"ERR_NOT_FOUND");await w(e,o[o.length-1],p,h[h.length-1],h,i)}}const y=await u.updateTree(e,h,i);await c.updateMfsRoot(e,y,i)}))}},{"err-code":"chZjB",debug:"bO5wM","ipfs-unixfs-exporter":"BgMiX","./utils/create-node.js":"5enkT","./utils/to-path-components.js":"j9m7w","./utils/update-mfs-root.js":"lpX0i","./utils/update-tree.js":"dvDDB","./utils/add-link.js":"dv4f9","./utils/with-mfs-root.js":"ho9kf","merge-options":"fupyv","ipfs-core-utils/with-timeout-option":"j29MK"}],"5enkT":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-unixfs"),n=e("@ipld/dag-pb"),s=e("multiformats/cid");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=o(n);r.createNode=async function(e,t,r){const n=new i.UnixFS({type:t,mode:r.mode,mtime:r.mtime}),o=await e.hashers.getHasher(r.hashAlg),c={Data:n.marshal(),Links:[]},u=a.encode(c),l=await o.digest(u),d=s.CID.create(r.cidVersion,a.code,l);return r.flush&&await e.repo.blocks.put(d,u),{cid:d,node:c}}},{"ipfs-unixfs":"dF9VO","@ipld/dag-pb":"i2cdx","multiformats/cid":"9ooAY"}],hU9a1:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("err-code"),n=e("./utils/update-tree.js"),s=e("./utils/update-mfs-root.js"),o=e("./utils/remove-link.js"),a=e("./utils/to-mfs-path.js"),c=e("./utils/to-trail.js"),u=e("ipfs-core-utils/with-timeout-option"),l=e("merge-options");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=d(i);const h=d(l).default.bind({ignoreUndefined:!0}),p={recursive:!1,cidVersion:0,hashAlg:"sha2-256",flush:!0,shardSplitThreshold:1e3};const g=async(e,t,r)=>{const i=await a.toMfsPath(e,t,r),u=await c.toTrail(e,i.mfsPath),l=u[u.length-1];u.pop();const d=u[u.length-1];if(!d)throw f.default(new Error(`${t} does not exist`),"ERR_NOT_FOUND");if("directory"===l.type&&!r.recursive)throw f.default(new Error(`${t} is a directory, use -r to remove directories`),"ERR_WAS_DIR");const{cid:h}=await o.removeLink(e,{parentCid:d.cid,name:l.name,hashAlg:r.hashAlg,cidVersion:r.cidVersion,flush:r.flush,shardSplitThreshold:r.shardSplitThreshold});d.cid=h;const p=await n.updateTree(e,u,r);await s.updateMfsRoot(e,p,r)};r.createRm=function(e){return u.withTimeoutOption((async function(t,r={}){const i=h(p,r);Array.isArray(t)||(t=[t]);const n=await Promise.all(t.map((t=>a.toMfsPath(e,t,i))));if(!n.length)throw f.default(new Error("Please supply at least one path to remove"),"ERR_INVALID_PARAMS");n.forEach((e=>{if("/"===e.path)throw f.default(new Error("Cannot delete root"),"ERR_INVALID_PARAMS")}));for(const t of n)await g(e,t.path,i)}))}},{"err-code":"chZjB","./utils/update-tree.js":"dvDDB","./utils/update-mfs-root.js":"lpX0i","./utils/remove-link.js":"fAytm","./utils/to-mfs-path.js":"gAtPl","./utils/to-trail.js":"crUUQ","ipfs-core-utils/with-timeout-option":"j29MK","merge-options":"fupyv"}],fAytm:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@ipld/dag-pb"),n=e("multiformats/cid"),s=e("debug"),o=e("ipfs-unixfs"),a=e("./hamt-utils.js"),c=e("err-code");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var d=l(i),f=u(s),h=u(c);const p=f.default("ipfs:mfs:core:utils:remove-link");const g=async(e,t)=>{t.parent.Links=t.parent.Links.filter((e=>e.Name!==t.name));const r=await d.encode(t.parent),i=await e.hashers.getHasher(t.hashAlg),s=await i.digest(r),o=n.CID.create(t.cidVersion,d.code,s);return await e.repo.blocks.put(o,r),p(`Updated regular directory ${o}`),{node:t.parent,cid:o}},y=async(e,t)=>{const{rootBucket:r,path:i}=await a.generatePath(e,t.name,t.parent);await r.del(t.name);const{node:n}=await m(e,i,t.name,t);return a.updateHamtDirectory(e,n.Links,r,t)},m=async(e,t,r,i)=>{const n=t.pop();if(!n)throw h.default(new Error("Could not find parent"),"EINVALIDPARENT");const{bucket:s,prefix:o,node:c}=n;if(!c)throw h.default(new Error("Could not find parent"),"EINVALIDPARENT");const u=c.Links.find((e=>(e.Name||"").substring(0,2)===o));if(!u)throw h.default(new Error(`No link found with prefix ${o} for file ${r}`),"ERR_NOT_FOUND");if(u.Name===`${o}${r}`){p(`Removing existing link ${u.Name}`);const t=c.Links.filter((e=>e.Name!==u.Name));return await s.del(r),a.updateHamtDirectory(e,t,s,i)}p(`Descending into sub-shard ${u.Name} for ${o}${r}`);const l=await m(e,t,r,i);let d=l.cid,f=l.size,g=o;if(1===l.node.Links.length){p(`Removing subshard for ${o}`);const e=l.node.Links[0];g=`${o}${(e.Name||"").substring(2)}`,d=e.Hash,f=e.Tsize||0}return p(`Updating shard ${o} with name ${g}`),b(e,s,c,o,g,f,d,i)},b=(e,t,r,i,n,s,o,c)=>{const u=r.Links.filter((e=>e.Name!==i));return u.push({Name:n,Tsize:s,Hash:o}),a.updateHamtDirectory(e,u,t,c)};r.removeLink=async function(e,t){let r=t.parent;if(t.parentCid){const i=n.CID.asCID(t.parentCid);if(null===i)throw h.default(new Error("Invalid CID passed to removeLink"),"EINVALIDPARENTCID");p(`Loading parent node ${i}`);const s=await e.repo.blocks.get(i);r=d.decode(s)}if(!r)throw h.default(new Error("No parent node or CID passed to removeLink"),"EINVALIDPARENT");if(!t.name)throw h.default(new Error("No child name passed to removeLink"),"EINVALIDCHILDNAME");if(!r.Data)throw h.default(new Error("Parent node had no data"),"ERR_INVALID_NODE");return"hamt-sharded-directory"===o.UnixFS.unmarshal(r.Data).type?(p(`Removing ${t.name} from sharded directory`),y(e,{...t,parent:r})):(p(`Removing link ${t.name} regular directory`),g(e,{...t,parent:r}))}},{"@ipld/dag-pb":"i2cdx","multiformats/cid":"9ooAY",debug:"bO5wM","ipfs-unixfs":"dF9VO","./hamt-utils.js":"gemQO","err-code":"chZjB"}],dFNhT:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./stat.js"),n=e("ipfs-core-utils/with-timeout-option");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const o=s(e("merge-options")).default.bind({ignoreUndefined:!0}),a={};r.createFlush=function(e){return n.withTimeoutOption((async function(t,r={}){r=o(a,r);const{cid:n}=await i.createStat(e)(t,r);return n}))}},{"./stat.js":"lCUdo","ipfs-core-utils/with-timeout-option":"j29MK","merge-options":"fupyv"}],"347nd":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./cp.js"),n=e("./rm.js"),s=e("merge-options"),o=e("ipfs-core-utils/with-timeout-option");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const c=a(s).default.bind({ignoreUndefined:!0}),u={parents:!1,flush:!0,cidVersion:0,hashAlg:"sha2-256",shardSplitThreshold:1e3};r.createMv=function(e){return o.withTimeoutOption((async function(t,r,s={}){const o=c(u,s);await i.createCp(e)(t,r,o),await n.createRm(e)(t,{...o,recursive:!0})}))}},{"./cp.js":"eJoZU","./rm.js":"hU9a1","merge-options":"fupyv","ipfs-core-utils/with-timeout-option":"j29MK"}],d4deE:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("merge-options"),n=e("./utils/to-mfs-path.js"),s=e("debug"),o=e("err-code"),a=e("ipfs-unixfs"),c=e("./utils/to-trail.js"),u=e("./utils/add-link.js"),l=e("./utils/update-tree.js"),d=e("./utils/update-mfs-root.js"),f=e("@ipld/dag-pb"),h=e("multiformats/cid"),p=e("ipfs-core-utils/with-timeout-option");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function y(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var m=g(i),b=g(s),v=g(o),w=y(f);const _=m.default.bind({ignoreUndefined:!0}),E=b.default("ipfs:mfs:touch"),S={flush:!0,shardSplitThreshold:1e3,cidVersion:0,hashAlg:"sha2-256"};r.createTouch=function(e){return p.withTimeoutOption((async function(t,r={}){const i=_(S,r);i.mtime=i.mtime||new Date,E(`Touching ${t} mtime: ${i.mtime}`);const{cid:s,mfsDirectory:o,name:f,exists:p}=await n.toMfsPath(e,t,i),g=r.hashAlg||S.hashAlg,y=await e.hashers.getHasher(g);let m,b,T=i.cidVersion;if(p){if(s.code!==w.code)throw v.default(new Error(`${t} was not a UnixFS node`),"ERR_NOT_UNIXFS");T=s.version;const r=await e.repo.blocks.get(s),n=w.decode(r);if(!n.Data)throw v.default(new Error(`${t} had no data`),"ERR_INVALID_NODE");const o=a.UnixFS.unmarshal(n.Data);o.mtime=i.mtime,m=w.encode({Data:o.marshal(),Links:n.Links});const c=await y.digest(m);b=h.CID.create(i.cidVersion,w.code,c),i.flush&&await e.repo.blocks.put(b,m)}else{const t=new a.UnixFS({type:"file",mtime:i.mtime});m=w.encode({Data:t.marshal(),Links:[]});const r=await y.digest(m);b=h.CID.create(i.cidVersion,w.code,r),i.flush&&await e.repo.blocks.put(b,m)}const A=await c.toTrail(e,o),k=A[A.length-1],I=k.cid,R=await e.repo.blocks.get(I),P=w.decode(R),O=await u.addLink(e,{parent:P,name:f,cid:b,size:m.length,flush:i.flush,shardSplitThreshold:i.shardSplitThreshold,hashAlg:i.hashAlg,cidVersion:T});k.cid=O.cid;const C=await l.updateTree(e,A,i);await d.updateMfsRoot(e,C,i)}))}},{"merge-options":"fupyv","./utils/to-mfs-path.js":"gAtPl",debug:"bO5wM","err-code":"chZjB","ipfs-unixfs":"dF9VO","./utils/to-trail.js":"crUUQ","./utils/add-link.js":"dv4f9","./utils/update-tree.js":"dvDDB","./utils/update-mfs-root.js":"lpX0i","@ipld/dag-pb":"i2cdx","multiformats/cid":"9ooAY","ipfs-core-utils/with-timeout-option":"j29MK"}],"3Dh6r":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-unixfs-exporter"),n=e("merge-options"),s=e("./utils/to-mfs-path.js"),o=e("err-code"),a=e("ipfs-core-utils/with-timeout-option");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(n),l=c(o);const d=u.default.bind({ignoreUndefined:!0}),f={offset:0,length:1/0};r.createRead=function(e){return a.withTimeoutOption((function(t,r={}){return r=d(f,r),{[Symbol.asyncIterator]:async function*(){const n=await s.toMfsPath(e,t,r),o=await i.exporter(n.mfsPath,e.repo.blocks);if("file"!==o.type)throw l.default(new Error(`${t} was not a file`),"ERR_NOT_FILE");if(!o.content)throw l.default(new Error(`Could not load content stream from ${t}`),"ERR_NO_CONTENT");for await(const e of o.content({offset:r.offset,length:r.length}))yield e}}}))}},{"ipfs-unixfs-exporter":"BgMiX","merge-options":"fupyv","./utils/to-mfs-path.js":"gAtPl","err-code":"chZjB","ipfs-core-utils/with-timeout-option":"j29MK"}],fQgQQ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("debug"),n=e("ipfs-unixfs-importer"),s=e("@ipld/dag-pb"),o=e("multiformats/hashes/sha2"),a=e("./stat.js"),c=e("./mkdir.js"),u=e("./utils/add-link.js"),l=e("merge-options"),d=e("./utils/create-lock.js"),f=e("./utils/to-async-iterator.js"),h=e("./utils/to-mfs-path.js"),p=e("./utils/to-path-components.js"),g=e("./utils/to-trail.js"),y=e("./utils/update-tree.js"),m=e("./utils/update-mfs-root.js"),b=e("err-code"),v=e("../../utils.js"),w=e("it-last"),_=e("ipfs-core-utils/with-timeout-option"),E=e("ipfs-unixfs");function S(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var T=S(i),A=S(l),k=S(b),I=S(w);const R=A.default.bind({ignoreUndefined:!0}),P=T.default("ipfs:mfs:write"),O={offset:0,length:1/0,create:!1,truncate:!1,rawLeaves:!1,reduceSingleLeafToSelf:!1,cidVersion:0,hashAlg:"sha2-256",parents:!1,progress:(e,t)=>{},strategy:"trickle",flush:!0,leafType:"raw",shardSplitThreshold:1e3};const C=async(e,t,r,i,n)=>{const o=await j(e,r,i,n);await d.createLock().writeLock((async()=>{const r=p.toPathComponents(t),i=r.pop();if(null==i)throw k.default(new Error("source does not exist"),"ERR_NO_EXIST");let l=!1;try{await a.createStat(e)(`/${r.join("/")}`,n),l=!0}catch(e){if("ERR_NOT_FOUND"!==e.code)throw e}l||await c.createMkdir(e)(`/${r.join("/")}`,n);const d=await h.toMfsPath(e,t,n),f=await g.toTrail(e,d.mfsDirectory),b=f[f.length-1];if(!b)throw k.default(new Error("directory does not exist"),"ERR_NO_EXIST");if(!b.type||!b.type.includes("directory"))throw k.default(new Error(`cannot write to ${b.name}: Not a directory`),"ERR_NOT_A_DIRECTORY");const v=await e.repo.blocks.get(b.cid),w=s.decode(v),_=await u.addLink(e,{parent:w,name:i,cid:o.cid,size:o.size,flush:n.flush,shardSplitThreshold:n.shardSplitThreshold,hashAlg:n.hashAlg,cidVersion:n.cidVersion});b.cid=_.cid;const E=await y.updateTree(e,f,n);await m.updateMfsRoot(e,E,n)}))()},j=async(e,t,r,i)=>{r.exists?P(`Overwriting file ${r.cid} offset ${i.offset} length ${i.length}`):P(`Writing file offset ${i.offset} length ${i.length}`);const s=[];if(i.offset>0)if(r.unixfs){if(P(`Writing first ${i.offset} bytes of original file`),s.push((()=>r.content({offset:0,length:i.offset}))),r.unixfs.fileSize()<i.offset){const e=i.offset-r.unixfs.fileSize();P(`Writing zeros for extra ${e} bytes`),s.push(M(e))}}else P(`Writing zeros for first ${i.offset} bytes`),s.push(M(i.offset));s.push(D(t,i.length));const a=B(x(s),(e=>{if(r.unixfs&&!i.truncate){const t=r.unixfs.fileSize();if(t>e)return P(`Writing last ${t-e} of ${t} bytes from original file starting at offset ${e}`),r.content({offset:e});P("Not writing last bytes from original file")}return{[Symbol.asyncIterator]:async function*(){}}}));let c,u,l;switch(void 0!==i.mode&&null!==i.mode?c=E.parseMode(i.mode):r&&r.unixfs&&(c=r.unixfs.mode),null!=i.mtime?u=E.parseMtime(i.mtime):r&&r.unixfs&&(u=r.unixfs.mtime),i.hashAlg){case"sha2-256":l=o.sha256;break;case"sha2-512":l=o.sha512;break;default:throw new Error(`TODO vmx 2021-03-31: Proper error message for unsupported hash algorithms like ${i.hashAlg}`)}const d=await I.default(n.importer([{content:a,mode:c,mtime:u}],e.repo.blocks,{progress:i.progress,hasher:l,cidVersion:i.cidVersion,strategy:i.strategy,rawLeaves:i.rawLeaves,reduceSingleLeafToSelf:i.reduceSingleLeafToSelf,leafType:i.leafType}));if(!d)throw k.default(new Error(`cannot write to ${parent.name}`),"ERR_COULD_NOT_WRITE");return P(`Wrote ${d.cid}`),{cid:d.cid,size:d.size}},D=(e,t)=>async function*(){let r=0;for await(const i of e){if(r+=i.length,r>t)return void(yield i.slice(0,t-r));yield i}},M=(e,t=v.MFS_MAX_CHUNK_SIZE)=>{const r=new Uint8Array(t);return D(async function*(){for(;;)yield r.slice()}(),e)},x=async function*(e){for(let t=0;t<e.length;t++)yield*e[t]()},B=async function*(e,t){let r=0;for await(const t of e)r+=t.length,yield t;for await(const e of t(r))r+=e.length,yield e};r.createWrite=function(e){return _.withTimeoutOption((async function(t,r,i={}){const n=R(O,i);let s,o,a;if(P("Reading source, destination and parent"),await d.createLock().readLock((async()=>{s=await f.toAsyncIterator(r),o=await h.toMfsPath(e,t,n),a=await h.toMfsPath(e,o.mfsDirectory,n)}))(),P("Read source, destination and parent"),!n.parents&&!a.exists)throw k.default(new Error("directory does not exist"),"ERR_NO_EXIST");if(null==s)throw k.default(new Error("could not create source"),"ERR_NO_SOURCE");if(null==o)throw k.default(new Error("could not create destination"),"ERR_NO_DESTINATION");if(!n.create&&!o.exists)throw k.default(new Error("file does not exist"),"ERR_NO_EXIST");if("file"!==o.entryType)throw k.default(new Error("not a file"),"ERR_NOT_A_FILE");return C(e,t,s,o,n)}))}},{debug:"bO5wM","ipfs-unixfs-importer":"i61x3","@ipld/dag-pb":"i2cdx","multiformats/hashes/sha2":"7i9MT","./stat.js":"lCUdo","./mkdir.js":"h1mMu","./utils/add-link.js":"dv4f9","merge-options":"fupyv","./utils/create-lock.js":"kHT2F","./utils/to-async-iterator.js":"jbAGR","./utils/to-mfs-path.js":"gAtPl","./utils/to-path-components.js":"j9m7w","./utils/to-trail.js":"crUUQ","./utils/update-tree.js":"dvDDB","./utils/update-mfs-root.js":"lpX0i","err-code":"chZjB","../../utils.js":"cT4uN","it-last":"cSXX9","ipfs-core-utils/with-timeout-option":"j29MK","ipfs-unixfs":"dF9VO"}],jbAGR:[function(e,t,r){var i=arguments[3];Object.defineProperty(r,"__esModule",{value:!0});var n=e("err-code"),s=e("debug"),o=e("../../../utils.js"),a=e("uint8arrays/from-string");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(n),l=c(s);const d=l.default("ipfs:mfs:utils:to-async-iterator");function f(e){if(!e)throw u.default(new Error("paths must start with a leading slash"),"ERR_INVALID_PATH");if(("string"==typeof e||e instanceof String)&&(d("Content was a string"),e=a.fromString(e.toString())),e.length)return d("Content was array-like"),{[Symbol.asyncIterator]:function*(){yield e}};if(e[Symbol.asyncIterator])return d("Content was an async iterator"),e;if(e[Symbol.iterator])return d("Content was an iterator"),e;if(i.Blob&&e instanceof i.Blob){d("Content was an HTML5 Blob");let t=0;const r={next:()=>t>e.size?{done:!0}:new Promise(((r,n)=>{const s=e.slice(t,o.MFS_MAX_CHUNK_SIZE);t+=o.MFS_MAX_CHUNK_SIZE;const a=new i.FileReader,c=e=>{if(a.removeEventListener("loadend",c,!1),e.error)return n(e.error);r({done:!1,value:new Uint8Array(a.result)})};a.addEventListener("loadend",c),a.readAsArrayBuffer(s)}))};return{[Symbol.asyncIterator]:()=>r}}throw u.default(new Error(`Don't know how to convert ${e} into an async iterator`),"ERR_INVALID_PARAMS")}r.toAsyncIterator=f},{"err-code":"chZjB",debug:"bO5wM","../../../utils.js":"cT4uN","uint8arrays/from-string":"dF7Y4"}],"2uADA":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-unixfs-exporter"),n=e("./utils/to-mfs-path.js"),s=e("ipfs-core-utils/with-timeout-option");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(e("it-map"));const c=e=>{const t={cid:e.cid,name:e.name,type:"directory"===e.type?"directory":"file",size:e.size};return"file"!==e.type&&"directory"!==e.type||(t.mode=e.unixfs.mode,t.mtime=e.unixfs.mtime),t};r.createLs=function(e){return s.withTimeoutOption((async function*(t,r={}){const s=await n.toMfsPath(e,t,r),o=await i.exporter(s.mfsPath,e.repo.blocks);"directory"!==o.type?yield c(o):yield*a.default(o.content(r),c)}))}},{"ipfs-unixfs-exporter":"BgMiX","./utils/to-mfs-path.js":"gAtPl","ipfs-core-utils/with-timeout-option":"j29MK","it-map":"eeqPk"}],aJXOU:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./export.js"),n=e("./gen.js"),s=e("./import.js"),o=e("./info.js"),a=e("./list.js"),c=e("./rename.js"),u=e("./rm.js");r.KeyAPI=class{constructor({keychain:e}){this.gen=n.createGen({keychain:e}),this.list=a.createList({keychain:e}),this.rm=u.createRm({keychain:e}),this.rename=c.createRename({keychain:e}),this.export=i.createExport({keychain:e}),this.import=s.createImport({keychain:e}),this.info=o.createInfo({keychain:e})}}},{"./export.js":"bcIEv","./gen.js":"9dF1X","./import.js":"5TBS8","./info.js":"4SpeM","./list.js":"kkYzS","./rename.js":"idv1N","./rm.js":"iQMly"}],bcIEv:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createExport=function({keychain:e}){return i.withTimeoutOption(((t,r)=>e.exportKey(t,r)))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],"9dF1X":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");const n="ed25519";r.createGen=function({keychain:e}){return i.withTimeoutOption(((t,r={type:n,size:2048})=>e.createKey(t,r.type||n,r.size||2048)))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],"5TBS8":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createImport=function({keychain:e}){return i.withTimeoutOption(((t,r,i)=>e.importKey(t,r,i)))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],"4SpeM":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createInfo=function({keychain:e}){return i.withTimeoutOption((t=>e.findKeyByName(t)))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],kkYzS:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createList=function({keychain:e}){return i.withTimeoutOption((()=>e.listKeys()))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],idv1N:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createRename=function({keychain:e}){return i.withTimeoutOption((async(t,r)=>{const i=await e.renameKey(t,r);return{was:t,now:i.name,id:i.id,overwrite:!1}}))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],iQMly:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createRm=function({keychain:e}){return i.withTimeoutOption((t=>e.removeKey(t)))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],kwMxL:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./data.js"),n=e("./get.js"),s=e("./links.js"),o=e("./new.js"),a=e("./put.js"),c=e("./stat.js"),u=e("./patch/index.js");r.ObjectAPI=class{constructor({repo:e,codecs:t,preload:r}){this.data=i.createData({repo:e,preload:r}),this.get=n.createGet({repo:e,preload:r}),this.links=s.createLinks({repo:e,codecs:t}),this.new=o.createNew({repo:e,preload:r}),this.put=a.createPut({repo:e,preload:r}),this.stat=c.createStat({repo:e,preload:r}),this.patch=new u.ObjectPatchAPI({repo:e,preload:r})}}},{"./data.js":"lgHu1","./get.js":"3KrcI","./links.js":"2SX04","./new.js":"fa8jR","./put.js":"2HgKS","./stat.js":"1xg5C","./patch/index.js":"ejlpO"}],lgHu1:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option"),n=e("./get.js");r.createData=function({repo:e,preload:t}){const r=n.createGet({repo:e,preload:t});return i.withTimeoutOption((async function(e,t={}){return(await r(e,t)).Data||new Uint8Array(0)}))}},{"ipfs-core-utils/with-timeout-option":"j29MK","./get.js":"3KrcI"}],"3KrcI":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@ipld/dag-pb"),n=e("ipfs-core-utils/with-timeout-option");function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=s(i);r.createGet=function({repo:e,preload:t}){return n.withTimeoutOption((async function(r,i={}){!1!==i.preload&&t(r);const n=await e.blocks.get(r,i);return o.decode(n)}))}},{"@ipld/dag-pb":"i2cdx","ipfs-core-utils/with-timeout-option":"j29MK"}],"2SX04":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@ipld/dag-pb"),n=e("@ipld/dag-cbor"),s=e("multiformats/codecs/raw"),o=e("multiformats/cid"),a=e("ipfs-core-utils/with-timeout-option");function c(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=c(i),l=c(n),d=c(s);function f(e,t=[]){for(const r in e){const i=e[r];if("/"===r&&1===Object.keys(e).length)try{t.push({Name:"",Tsize:0,Hash:o.CID.parse(i)});continue}catch(e){}const n=o.CID.asCID(i);n?t.push({Name:"",Tsize:0,Hash:n}):(Array.isArray(i)&&f(i,t),i&&"object"==typeof i&&f(i,t))}return t}r.createLinks=function({repo:e,codecs:t}){return a.withTimeoutOption((async function(r,i={}){const n=await t.getCodec(r.code),s=await e.blocks.get(r,i),o=n.decode(s);if(r.code===d.code)return[];if(r.code===u.code)return o.Links;if(r.code===l.code)return f(o);throw new Error(`Cannot resolve links from codec ${r.code}`)}))}},{"@ipld/dag-pb":"i2cdx","@ipld/dag-cbor":"3498i","multiformats/codecs/raw":"fdfgp","multiformats/cid":"9ooAY","ipfs-core-utils/with-timeout-option":"j29MK"}],fa8jR:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@ipld/dag-pb"),n=e("multiformats/hashes/sha2"),s=e("ipfs-unixfs"),o=e("ipfs-core-utils/with-timeout-option"),a=e("multiformats/cid");function c(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=c(i);r.createNew=function({repo:e,preload:t}){return o.withTimeoutOption((async function(r={}){let i;if(r.template){if("unixfs-dir"!==r.template)throw new Error("unknown template");i=new s.UnixFS({type:"directory"}).marshal()}const o=u.encode({Data:i,Links:[]}),c=await n.sha256.digest(o),l=a.CID.createV0(c);return await e.blocks.put(l,o,{signal:r.signal}),!1!==r.preload&&t(l),l}))}},{"@ipld/dag-pb":"i2cdx","multiformats/hashes/sha2":"7i9MT","ipfs-unixfs":"dF9VO","ipfs-core-utils/with-timeout-option":"j29MK","multiformats/cid":"9ooAY"}],"2HgKS":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@ipld/dag-pb"),n=e("multiformats/cid"),s=e("multiformats/hashes/sha2"),o=e("ipfs-core-utils/with-timeout-option");function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var c=a(i);r.createPut=function({repo:e,preload:t}){return o.withTimeoutOption((async function(r,i={}){const o=await e.gcLock.readLock();try{const a=c.encode(r),u=await s.sha256.digest(a),l=n.CID.createV0(u);return await e.blocks.put(l,a,{signal:i.signal}),!1!==i.preload&&t(l),i.pin&&await e.pins.pinRecursively(l,{signal:i.signal}),l}finally{o()}}))}},{"@ipld/dag-pb":"i2cdx","multiformats/cid":"9ooAY","multiformats/hashes/sha2":"7i9MT","ipfs-core-utils/with-timeout-option":"j29MK"}],"1xg5C":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@ipld/dag-pb"),n=e("ipfs-core-utils/with-timeout-option"),s=e("./get.js");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=o(i);r.createStat=function({repo:e,preload:t}){const r=s.createGet({repo:e,preload:t});return n.withTimeoutOption((async function(e,t={}){const i=await r(e,t),n=a.encode(i).length,s=i.Links.reduce(((e,t)=>e+(t.Tsize||0)),0);return{Hash:e,NumLinks:i.Links.length,BlockSize:n,LinksSize:n-(i.Data||[]).length,DataSize:(i.Data||[]).length,CumulativeSize:n+s}}))}},{"@ipld/dag-pb":"i2cdx","ipfs-core-utils/with-timeout-option":"j29MK","./get.js":"3KrcI"}],ejlpO:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./add-link.js"),n=e("./append-data.js"),s=e("./rm-link.js"),o=e("./set-data.js");r.ObjectPatchAPI=class{constructor({repo:e,preload:t}){this.addLink=i.createAddLink({repo:e,preload:t}),this.appendData=n.createAppendData({repo:e,preload:t}),this.rmLink=s.createRmLink({repo:e,preload:t}),this.setData=o.createSetData({repo:e,preload:t})}}},{"./add-link.js":"4oi3r","./append-data.js":"c7ABb","./rm-link.js":"f9JX7","./set-data.js":"7RZAU"}],"4oi3r":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option"),n=e("../get.js"),s=e("../put.js");r.createAddLink=function({repo:e,preload:t}){const r=n.createGet({repo:e,preload:t}),o=s.createPut({repo:e,preload:t});return i.withTimeoutOption((async function(e,t,i={}){const n=await r(e,i);return o({...n,Links:n.Links.concat([t])},i)}))}},{"ipfs-core-utils/with-timeout-option":"j29MK","../get.js":"3KrcI","../put.js":"2HgKS"}],c7ABb:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option"),n=e("uint8arrays/concat"),s=e("../get.js"),o=e("../put.js");r.createAppendData=function({repo:e,preload:t}){const r=s.createGet({repo:e,preload:t}),a=o.createPut({repo:e,preload:t});return i.withTimeoutOption((async function(e,t,i={}){const s=await r(e,i),o=n.concat([s.Data||[],t]);return a({...s,Data:o},i)}))}},{"ipfs-core-utils/with-timeout-option":"j29MK","uint8arrays/concat":"4EBjG","../get.js":"3KrcI","../put.js":"2HgKS"}],f9JX7:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option"),n=e("../get.js"),s=e("../put.js");r.createRmLink=function({repo:e,preload:t}){const r=n.createGet({repo:e,preload:t}),o=s.createPut({repo:e,preload:t});return i.withTimeoutOption((async function(e,t,i={}){const n=await r(e,i),s=("string"==typeof t?t:t.Name)||"";return n.Links=n.Links.filter((e=>e.Name!==s)),o(n,i)}))}},{"ipfs-core-utils/with-timeout-option":"j29MK","../get.js":"3KrcI","../put.js":"2HgKS"}],"7RZAU":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option"),n=e("../get.js"),s=e("../put.js");r.createSetData=function({repo:e,preload:t}){const r=n.createGet({repo:e,preload:t}),o=s.createPut({repo:e,preload:t});return i.withTimeoutOption((async function(e,t,i={}){const n=await r(e,i);return o({...n,Data:t},i)}))}},{"ipfs-core-utils/with-timeout-option":"j29MK","../get.js":"3KrcI","../put.js":"2HgKS"}],"1qDVo":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./gc.js"),n=e("./stat.js"),s=e("./version.js");r.RepoAPI=class{constructor({repo:e,hashers:t}){this.gc=i.createGc({repo:e,hashers:t}),this.stat=n.createStat({repo:e}),this.version=s.createVersion({repo:e}),this.setApiAddr=t=>e.apiAddr.set(t)}}},{"./gc.js":"gtgb5","./stat.js":"cgD5k","./version.js":"7VIBe"}],gtgb5:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("debug"),n=e("ipfs-core-utils/with-timeout-option"),s=e("../files/utils/with-mfs-root.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const a=o(i).default("ipfs:repo:gc");r.createGc=function({repo:e,hashers:t}){return n.withTimeoutOption((async function*(r={}){const i=Date.now();let n;try{n=await s.loadMfsRoot({repo:e,hashers:t},r),await e.pins.pinRecursively(n),yield*e.gc()}finally{n&&await e.pins.unpin(n)}a(`Complete (${Date.now()-i}ms)`)}))}},{debug:"bO5wM","ipfs-core-utils/with-timeout-option":"j29MK","../files/utils/with-mfs-root.js":"ho9kf"}],cgD5k:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createStat=function({repo:e}){return i.withTimeoutOption((async function(t={}){const r=await e.stat();return{numObjects:BigInt(r.numObjects.toString()),repoSize:BigInt(r.repoSize.toString()),repoPath:r.repoPath,version:`${r.version}`,storageMax:BigInt(r.storageMax.toString())}}))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],"7VIBe":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option"),n=e("ipfs-repo/constants");r.createVersion=function({repo:e}){return i.withTimeoutOption((async function(t={}){try{await e._checkInitialized(t)}catch(e){if([/Key not found in database \[\/version\]/,/ENOENT/,/repo is not initialized yet/].some((t=>t.test(e.message))))return n.repoVersion;throw e}return e.version.get()}))}},{"ipfs-core-utils/with-timeout-option":"j29MK","ipfs-repo/constants":"kDOvV"}],kDOvV:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.repoVersion=11},{}],"1NkyG":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./bw.js"),n=e("../repo/stat.js"),s=e("../bitswap/stat.js");r.StatsAPI=class{constructor({repo:e,network:t}){this.repo=n.createStat({repo:e}),this.bw=i.createBw({network:t}),this.bitswap=s.createStat({network:t})}}},{"./bw.js":"DMKGd","../repo/stat.js":"cgD5k","../bitswap/stat.js":"aHPBA"}],DMKGd:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("parse-duration"),n=e("err-code"),s=e("ipfs-core-utils/with-timeout-option");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(i),c=o(n);function u(e,t){let r;if(r=e.metrics?t.peer?e.metrics.forPeer(t.peer):t.proto?e.metrics.forProtocol(t.proto):e.metrics.global:void 0,!r)return{totalIn:BigInt(0),totalOut:BigInt(0),rateIn:0,rateOut:0};const{movingAverages:i,snapshot:n}=r;return{totalIn:BigInt(n.dataReceived.integerValue().toString()),totalOut:BigInt(n.dataSent.integerValue().toString()),rateIn:i.dataReceived[6e4].movingAverage()/60,rateOut:i.dataSent[6e4].movingAverage()/60}}r.createBw=function({network:e}){return s.withTimeoutOption((async function*(t={}){const{libp2p:r}=await e.use(t);if(!t.poll)return void(yield u(r,t));const i=t.interval||1e3;let n,s=-1;try{if(s="string"==typeof i?a.default(i)||-1:i,!s||s<0)throw new Error("invalid duration")}catch(e){throw c.default(e,"ERR_INVALID_POLL_INTERVAL")}try{for(;;)yield u(r,t),await new Promise((e=>{n=setTimeout(e,s)}))}finally{clearTimeout(n)}}))}},{"parse-duration":"fGYtw","err-code":"chZjB","ipfs-core-utils/with-timeout-option":"j29MK"}],bI63q:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("debug"),n=e("ipfs-core-config/repo"),s=e("ipfs-core-config/config"),o=e("uint8arrays/from-string"),a=e("uint8arrays/to-string"),c=e("peer-id"),u=e("merge-options"),l=e("./config/profiles.js"),d=e("../errors.js"),f=e("./libp2p.js"),h=e("ipfs-repo/errors");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=p(i),y=p(s),m=p(c);const b=p(u).default.bind({ignoreUndefined:!0}),v=g.default("ipfs:components:peer:storage");class w{constructor(e,t,r,i,n){this.print=i,this.peerId=e,this.keychain=t,this.repo=r,this.print=i,this.isNew=n}static async start(e,t,r){const{repoAutoMigrate:i,repo:s,onMigrationProgress:o}=r,a="string"==typeof s||null==s?n.createRepo(e,t,{path:s,autoMigrate:i,onMigrationProgress:o}):s,{peerId:c,keychain:u,isNew:l}=await _(e,a,r);return new w(c,u,a,e,l)}}const _=async(e,t,r)=>{if(!t.closed)return{...await k(t,r),isNew:!1};try{return await t.open(),{...await k(t,r),isNew:!1}}catch(i){if(i.code!==h.ERR_REPO_NOT_INITIALIZED)throw i;if(r.init&&!1===r.init.allowNew)throw new d.NotEnabledError("Initialization of new repos disabled by config, pass `config.init.isNew: true` to enable it");return{...await E(e,t,r),isNew:!0}}},E=async(e,t,r)=>{const i=r.init||{},n=await t.exists();if(v("repo exists?",n),!0===n)throw new Error("repo already exists");const s=i.privateKey?await S(i.privateKey):await T(e,i),o=A(s);v("peer identity: %s",o.PeerID);const a={...b(R(y.default(),i.profiles),r.config),Identity:o};await t.init(a),await t.open(),v("repo opened");const c={pass:r.pass};try{c.dek=await t.config.get("Keychain.DEK")}catch(e){if("ERR_NOT_FOUND"!==e.code)throw e}const u=await f.createLibp2p({options:void 0,multiaddrs:void 0,peerId:s,repo:t,config:a,keychainConfig:c});return u.keychain&&u.keychain.opts&&(await u.loadKeychain(),await t.config.set("Keychain",{DEK:u.keychain.opts.dek})),{peerId:s,keychain:u.keychain}},S=e=>(v("using user-supplied private-key"),"object"==typeof e?e:m.default.createFromPrivKey(o.fromString(e,"base64pad"))),T=(e,{algorithm:t="Ed25519",bits:r=2048})=>(e("generating %s keypair...",t),m.default.create({keyType:t,bits:r})),A=e=>({PeerID:e.toB58String(),PrivKey:a.toString(e.privKey.bytes,"base64pad")}),k=async(e,t)=>{const r=t.config,i=t.init&&t.init.profiles||[],n=t.pass,s=await e.config.getAll(),o=I(R(s,i),r);if(s!==o&&await e.config.replace(o),!o.Identity||!o.Identity.PrivKey)throw new d.NotInitializedError("No private key was found in the config, please intialize the repo");const a=await m.default.createFromPrivKey(o.Identity.PrivKey),c=await f.createLibp2p({options:void 0,multiaddrs:void 0,peerId:a,repo:e,config:o,keychainConfig:{pass:n,...o.Keychain}});return c.keychain&&await c.loadKeychain(),{peerId:a,keychain:c.keychain}},I=(e,t)=>t?b(e,t):e,R=(e,t)=>(t||[]).reduce(((e,t)=>{const r=l.profiles[t];if(!r)throw new Error(`Could not find profile with name '${t}'`);return v("applying profile %s",t),r.transform(e)}),e);r.Storage=w},{debug:"bO5wM","ipfs-core-config/repo":"cPlYr","ipfs-core-config/config":"ejWbz","uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB","peer-id":"8Bdb3","merge-options":"fupyv","./config/profiles.js":"f6AK7","../errors.js":"j69o8","./libp2p.js":"jcB2q","ipfs-repo/errors":"jDxkJ"}],cPlYr:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-repo"),n=e("datastore-level"),s=e("blockstore-datastore-adapter"),o=e("ipfs-repo/locks/memory");r.createRepo=function(e,t,r){const a=r.path||"ipfs";return i.createRepo(a,(e=>t.getCodec(e)),{root:new n.LevelDatastore(a,{prefix:"",version:2}),blocks:new s.BlockstoreDatastoreAdapter(new n.LevelDatastore(`${a}/blocks`,{prefix:"",version:2})),datastore:new n.LevelDatastore(`${a}/datastore`,{prefix:"",version:2}),keys:new n.LevelDatastore(`${a}/keys`,{prefix:"",version:2}),pins:new n.LevelDatastore(`${a}/pins`,{prefix:"",version:2})},{autoMigrate:r.autoMigrate,onMigrationProgress:r.onMigrationProgress||e,repoLock:o.MemoryLock})}},{"ipfs-repo":"c5Wg7","datastore-level":"3taGN","blockstore-datastore-adapter":"lEkQn","ipfs-repo/locks/memory":"xMQlv"}],c5Wg7:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("just-safe-get"),n=e("debug"),s=e("err-code"),o=e("ipfs-repo-migrations"),a=e("bytes"),c=e("merge-options"),u=e("./constants.js"),l=e("./version.js"),d=e("./config.js"),f=e("./spec.js"),h=e("./api-addr.js"),p=e("./idstore.js"),g=e("./default-options.js"),y=e("./default-datastore.js"),m=e("./errors.js"),b=e("./pin-manager.js"),v=e("./pinned-blockstore.js"),w=e("mortice"),_=e("./gc.js");function E(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function S(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var T=E(i),A=E(n),k=E(s),I=S(o),R=E(a),P=E(c),O=E(w);const C=A.default("ipfs:repo"),j=Number.MAX_SAFE_INTEGER;class D{constructor(e,t,r,i){if("string"!=typeof e)throw new Error("missing repo path");if("function"!=typeof t)throw new Error("missing codec loader");this.options=P.default(g,i),this.closed=!0,this.path=e,this.root=r.root,this.datastore=r.datastore,this.keys=r.keys;const n=r.blocks,s=r.pins;this.pins=new b.PinManager({pinstore:s,blockstore:n,loadCodec:t});const o=v.createPinnedBlockstore(this.pins,n);this.blocks=p.createIdStore(o),this.version=l.version(this.root),this.config=d.config(this.root),this.spec=f.spec(this.root),this.apiAddr=h.apiAddr(this.root),this.gcLock=O.default(e,{singleProcess:!1!==this.options.repoOwner}),this.gc=_.gc({gcLock:this.gcLock,pins:this.pins,blockstore:this.blocks,root:this.root,loadCodec:t})}async init(e){var t;C("initializing at: %s",this.path),await this._openRoot(),await this.config.replace((t=e,t.Datastore=Object.assign({},y,T.default(t,"datastore")),t)),await this.spec.set(function(e){const t={...y.Spec,...T.default(e,"Datastore.Spec")};return{type:t.type,mounts:t.mounts.map((e=>({mountpoint:e.mountpoint,type:e.child.type,path:e.child.path,shardFunc:e.child.shardFunc})))}}(e)),await this.version.set(u.repoVersion)}async isInitialized(){if(!this.closed)return!0;try{return await this._openRoot(),await this._checkInitialized(),await this.root.close(),!0}catch(e){return!1}}async open(){if(!this.closed)throw k.default(new Error("repo is already open"),m.ERR_REPO_ALREADY_OPEN);C("opening at: %s",this.path);try{await this._openRoot(),await this._checkInitialized(),this._lockfile=await this._openLock(),C("acquired repo.lock");if(!await this.version.check(u.repoVersion)){if(!await this._isAutoMigrationEnabled())throw new m.InvalidRepoVersionError("Incompatible repo versions. Automatic migrations disabled. Please migrate the repo manually.");await this._migrate(u.repoVersion,{root:this.root,datastore:this.datastore,pins:this.pins.pinstore,blocks:this.pins.blockstore,keys:this.keys})}C("creating datastore"),await this.datastore.open(),C("creating blocks"),await this.blocks.open(),C("creating keystore"),await this.keys.open(),C("creating pins"),await this.pins.pinstore.open(),this.closed=!1,C("all opened")}catch(e){if(this._lockfile)try{await this._closeLock(),this._lockfile=null}catch(e){C("error removing lock",e)}throw e}}async _openRoot(){try{await this.root.open()}catch(e){if("Already open"!==e.message)throw e}}async _openLock(){const e=await this.options.repoLock.lock(this.path);if("function"!=typeof e.close)throw k.default(new Error("Locks must have a close method"),"ERR_NO_CLOSE_FUNCTION");return e}_closeLock(){return this._lockfile&&this._lockfile.close()}async _checkInitialized(){let e;C("init check");try{[e]=await Promise.all([this.config.exists(),this.spec.exists(),this.version.exists()])}catch(e){if("ERR_NOT_FOUND"===e.code)throw k.default(new Error("repo is not initialized yet"),m.ERR_REPO_NOT_INITIALIZED,{path:this.path});throw e}if(!e)throw k.default(new Error("repo is not initialized yet"),m.ERR_REPO_NOT_INITIALIZED,{path:this.path})}async close(){if(this.closed)throw k.default(new Error("repo is already closed"),m.ERR_REPO_ALREADY_CLOSED);C("closing at: %s",this.path);try{await this.apiAddr.delete()}catch(e){if(e.code!==m.ERR_REPO_NOT_INITIALIZED&&!e.message.startsWith("ENOENT"))throw e}await Promise.all([this.root,this.blocks,this.keys,this.datastore,this.pins.pinstore].map((e=>e&&e.close()))),C("unlocking"),this.closed=!0,await this._closeLock()}exists(){return this.version.exists()}async stat(){if(this.datastore&&this.keys){const[e,t,r,i,n]=await Promise.all([this._storageMaxStat(),this._blockStat(),this.version.get(),M(this.datastore),M(this.keys)]),s=t.size+i+n;return{repoPath:this.path,storageMax:e,version:r,numObjects:t.count,repoSize:s}}throw k.default(new Error("repo is not initialized yet"),m.ERR_REPO_NOT_INITIALIZED,{path:this.path})}async _isAutoMigrationEnabled(){if(void 0!==this.options.autoMigrate)return this.options.autoMigrate;let e;try{e=await this.config.get("repoAutoMigrate")}catch(t){if(t.code!==m.NotFoundError.code)throw t;e=!0}return e}async _migrate(e,t){return await this.version.get()>e?(C(`reverting to version ${e}`),I.revert(this.path,t,this.options,e,{ignoreLock:!0,onProgress:this.options.onMigrationProgress})):(C(`migrating to version ${e}`),I.migrate(this.path,t,this.options,e,{ignoreLock:!0,onProgress:this.options.onMigrationProgress}))}async _storageMaxStat(){try{const e=await this.config.get("Datastore.StorageMax");return BigInt(R.default(e))}catch(e){return BigInt(j)}}async _blockStat(){let e=BigInt(0),t=BigInt(0);if(this.blocks)for await(const{key:r,value:i}of this.blocks.query({}))e+=BigInt(1),t+=BigInt(i.byteLength),t+=BigInt(r.bytes.byteLength);return{count:e,size:t}}}async function M(e){let t=BigInt(0);for await(const r of e.query({}))t+=BigInt(r.value.byteLength),t+=BigInt(r.key.uint8Array().byteLength);return t}r.createRepo=function(e,t,r,i){return new D(e,t,r,i)}},{"just-safe-get":"6M8pS",debug:"bO5wM","err-code":"chZjB","ipfs-repo-migrations":"6Vgma",bytes:"7yIGD","merge-options":"fupyv","./constants.js":"kDOvV","./version.js":"4JQCP","./config.js":"1Sgmj","./spec.js":"hVqbt","./api-addr.js":"jPLmC","./idstore.js":"4g9K0","./default-options.js":"kDkh7","./default-datastore.js":"gHTwB","./errors.js":"jDxkJ","./pin-manager.js":"byEbm","./pinned-blockstore.js":"ds9CD",mortice:"b5y0B","./gc.js":"e9PbA"}],"6M8pS":[function(e,t,r){t.exports=function(e,t,r){if(!e)return r;var i,n;Array.isArray(t)&&(i=t.slice(0));"string"==typeof t&&(i=t.split("."));"symbol"==typeof t&&(i=[t]);if(!Array.isArray(i))throw new Error("props arg must be an array, a string or a symbol");for(;i.length;){if(n=i.shift(),!e)return r;if(void 0===(e=e[n]))return r}return e}},{}],"6Vgma":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../migrations/index.js"),n=e("./repo/version.js"),s=e("./errors.js"),o=e("./utils.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const c=a(e("debug")).default("ipfs:repo:migrator");function u(e){return e=e||i,Array.isArray(e)&&0!==e.length?e[e.length-1].version:0}function l(e,t,r,i=!1){let n=0;for(const s of e){if(s.version>r)break;if(s.version>t){if(i&&!s.revert)throw new f.NonReversibleMigrationError(`It is not possible to revert to version ${t} because migration version ${s.version} is not reversible. Cancelling reversion.`);n++}}if(n!==r-t)throw new f.InvalidValueError(`The ipfs-repo-migrations package does not have all migration to migrate from version ${t} to ${r}`)}const d=n.getVersion,f=s,h=i;r.errors=f,r.getCurrentRepoVersion=d,r.getLatestMigrationVersion=u,r.migrate=async function(e,t,r,s,{ignoreLock:a=!1,onProgress:d,isDryRun:h=!1,migrations:p}){if(p=p||i,!e)throw new f.RequiredParameterError("Path argument is required!");if(!r)throw new f.RequiredParameterError("repoOptions argument is required!");if(!s)throw new f.RequiredParameterError("toVersion argument is required!");if(!Number.isInteger(s)||s<=0)throw new f.InvalidValueError("Version has to be positive integer!");t=o.wrapBackends(t);const g=await n.getVersion(t);if(g===s)return void c("Nothing to migrate.");if(g>s)throw new f.InvalidValueError(`Current repo's version (${g}) is higher then toVersion (${s}), you probably wanted to revert it?`);let y;l(p,g,s),h||a||(y=await r.repoLock.lock(e));try{for(const e of p){if(void 0!==s&&e.version>s)break;if(!(e.version<=g)){c(`Migrating version ${e.version}`);try{if(!h){let r=()=>{};d&&(r=(t,r)=>d(e.version,t.toFixed(2),r)),await e.migrate(t,r)}}catch(r){const i=e.version-1;throw c(`An exception was raised during execution of migration. Setting the repo's version to last successfully migrated version: ${i}`),await n.setVersion(i,t),new Error(`During migration to version ${e.version} exception was raised: ${r.stack||r.message||r}`)}c(`Migrating to version ${e.version} finished`)}}h||await n.setVersion(s||u(p),t),c("Repo successfully migrated",void 0!==s?`to version ${s}!`:"to latest version!")}finally{h||a||!y||await y.close()}},r.migrations=h,r.revert=async function(e,t,r,s,{ignoreLock:a=!1,onProgress:u,isDryRun:d=!1,migrations:h}){if(h=h||i,!e)throw new f.RequiredParameterError("Path argument is required!");if(!r)throw new f.RequiredParameterError("repoOptions argument is required!");if(!s)throw new f.RequiredParameterError("When reverting migrations, you have to specify to which version to revert!");if(!Number.isInteger(s)||s<=0)throw new f.InvalidValueError("Version has to be positive integer!");t=o.wrapBackends(t);const p=await n.getVersion(t);if(p===s)return void c("Nothing to revert.");if(p<s)throw new f.InvalidValueError(`Current repo's version (${p}) is lower then toVersion (${s}), you probably wanted to migrate it?`);let g;l(h,s,p,!0),d||a||(g=await r.repoLock.lock(e)),c(`Reverting from version ${p} to ${s}`);try{const e=h.slice().reverse();for(const r of e){if(r.version<=s)break;if(!(r.version>p)){c(`Reverting migration version ${r.version}`);try{if(!d){let e=()=>{};u&&(e=(e,t)=>u(r.version,e.toFixed(2),t)),await r.revert(t,e)}}catch(e){const i=r.version;throw c(`An exception was raised during execution of migration. Setting the repo's version to last successfully reverted version: ${i}`),await n.setVersion(i,t),e.message=`During reversion to version ${r.version} exception was raised: ${e.message}`,e}c(`Reverting to version ${r.version} finished`)}}d||await n.setVersion(s,t),c(`All migrations successfully reverted to version ${s}!`)}finally{d||a||!g||await g.close()}}},{"../migrations/index.js":"lR7UE","./repo/version.js":"h9pUV","./errors.js":"dUdRa","./utils.js":"2ugL9",debug:"bO5wM"}],lR7UE:[function(e,t,r){"use strict";var i=e("./migration-8/index.js"),n=e("./migration-9/index.js"),s=e("./migration-10/index.js"),o=e("./migration-11/index.js");const a={description:"Empty migration.",migrate:()=>{},revert:()=>{},empty:!0};var c=[Object.assign({version:1},a),Object.assign({version:2},a),Object.assign({version:3},a),Object.assign({version:4},a),Object.assign({version:5},a),Object.assign({version:6},a),Object.assign({version:7},a),i.migration,n.migration,s.migration,o.migration];t.exports=c},{"./migration-8/index.js":"iqKuU","./migration-9/index.js":"bq0Kw","./migration-10/index.js":"qHC3R","./migration-11/index.js":"5Bi4X"}],iqKuU:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("interface-datastore/key"),s=e("debug"),o=e("it-length"),a=e("multiformats/bases/base32"),c=e("multiformats/codecs/raw"),u=e("multiformats/hashes/digest");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var f=l(s),h=l(o),p=d(c),g=d(u);const y=f.default("ipfs:repo:migrator:migration-8");function m(e){return e.child?m(e.child):e}function b(e){try{const t=a.base32.decode(`b${e.toString().toLowerCase().slice(1)}`),r=i.CID.decode(t).multihash.bytes,s=a.base32.encode(r).slice(1).toUpperCase();return new n.Key(`/${s}`,!1)}catch(t){return e}}function v(e){try{const t=a.base32.decode(`b${e.toString().toLowerCase().slice(1)}`),r=g.decode(t),s=a.base32.encode(i.CID.createV1(p.code,r).bytes).slice(1);return new n.Key(`/${s.toUpperCase()}`,!1)}catch{return e}}async function w(e,t,r){const i=e.blocks;await i.open();const n=m(i),s=await h.default(n.queryKeys({filters:[e=>r(e).toString()!==e.toString()]}));try{let e=0;for await(const i of n.query({})){const o=r(i.key);o.toString()!==i.key.toString()&&(e+=1,y(`Migrating Block from ${i.key} to ${o}`,await n.has(i.key)),await n.delete(i.key),await n.put(o,i.value),t(e/s*100,`Migrated Block from ${i.key} to ${o}`))}}finally{await i.close()}}const _={version:8,description:"Transforms key names into base32 encoding and converts Block store to use bare multihashes encoded as base32",migrate:(e,t=(()=>{}))=>w(e,t,b),revert:(e,t=(()=>{}))=>w(e,t,v)};r.migration=_},{"multiformats/cid":"9ooAY","interface-datastore/key":"9hGOz",debug:"bO5wM","it-length":"6ksGI","multiformats/bases/base32":"5k9Tu","multiformats/codecs/raw":"fdfgp","multiformats/hashes/digest":"kpRBg"}],"6ksGI":[function(e,t,r){"use strict";t.exports=async e=>{let t=0;for await(const r of e)t++;return t}},{}],bq0Kw:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("@ipld/dag-pb"),s=e("cborg"),o=e("./pin-set.js"),a=e("./utils.js"),c=e("it-length"),u=e("multiformats/hashes/sha2"),l=e("multiformats/hashes/digest"),d=e("multiformats/bases/base32");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function h(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var p=h(n),g=h(s),y=f(c),m=h(l);async function b(e,t,r,n){if(!await t.has(a.PIN_DS_KEY))return;const s=await t.get(a.PIN_DS_KEY),c=i.CID.decode(s),u=await e.get(c),l=p.decode(u);let d=0;const f=await y.default(o.loadSet(e,l,a.PinTypes.recursive))+await y.default(o.loadSet(e,l,a.PinTypes.direct));for await(const t of o.loadSet(e,l,a.PinTypes.recursive)){d++;const e={depth:1/0};0!==t.version&&(e.version=t.version),t.code!==p.code&&(e.codec=t.code),await r.put(a.cidToKey(t),g.encode(e)),n(d/f*100,`Migrated recursive pin ${t}`)}for await(const t of o.loadSet(e,l,a.PinTypes.direct)){d++;const e={depth:0};0!==t.version&&(e.version=t.version),t.code!==p.code&&(e.codec=t.code),await r.put(a.cidToKey(t),g.encode(e)),n(d/f*100,`Migrated direct pin ${t}`)}await e.delete(c),await t.delete(a.PIN_DS_KEY)}async function v(e,t,r,n){const s=[],c=[];let l=0;const f=await y.default(r.queryKeys({}));for await(const{key:e,value:t}of r.query({})){l++;const r=g.decode(t),o=i.CID.create(r.version||0,r.codec||p.code,m.decode(d.base32.decode("b"+e.toString().toLowerCase().split("/").pop())));0===r.depth?(n(l/f*100,`Reverted direct pin ${o}`),c.push(o)):(n(l/f*100,`Reverted recursive pin ${o}`),s.push(o))}n(100,"Updating pin root");const h={Links:[await o.storeSet(e,a.PinTypes.direct,c),await o.storeSet(e,a.PinTypes.recursive,s)]},b=p.encode(h),v=await u.sha256.digest(b),w=i.CID.createV0(v);await e.put(w,b),await t.put(a.PIN_DS_KEY,w.bytes)}async function w(e,t,r){const i=e.blocks,n=e.datastore,s=e.pins;await i.open(),await n.open(),await s.open();try{await r(i,n,s,t)}finally{await s.close(),await n.close(),await i.close()}}const _={version:9,description:"Migrates pins to datastore",migrate:(e,t=(()=>{}))=>w(e,t,b),revert:(e,t=(()=>{}))=>w(e,t,v)};r.migration=_},{"multiformats/cid":"9ooAY","@ipld/dag-pb":"i2cdx",cborg:"iZrkE","./pin-set.js":"4k7S6","./utils.js":"iretC","it-length":"6ksGI","multiformats/hashes/sha2":"7i9MT","multiformats/hashes/digest":"kpRBg","multiformats/bases/base32":"5k9Tu"}],"4k7S6":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("./pin.js"),s=e("fnv1a"),o=e("varint"),a=e("@ipld/dag-pb"),c=e("./utils.js"),u=e("uint8arrays/concat"),l=e("uint8arrays/compare"),d=e("uint8arrays/to-string"),f=e("uint8arrays/from-string"),h=e("multiformats/hashes/sha2");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function g(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var y=p(s),m=p(o),b=g(a);const v=n.ipfs.pin.Set;async function*w(e,t){const r=function(e){const t=e.Data;if(!t)throw new Error("No data present");const r=m.default.decode(t),i=m.default.decode.bytes;if(i<=0)throw new Error("Invalid Set header length");if(i+r>t.length)throw new Error("Impossibly large set header length");const n=t.slice(i,r+i),s=v.toObject(v.decode(n),{defaults:!1,arrays:!0,longs:Number,objects:!1});if(1!==s.version)throw new Error(`Unsupported Set version: ${s.version}`);if(s.fanout>e.Links.length)throw new Error("Impossibly large fanout");return{header:s,data:t.slice(r+i)}}(t);let i=0;for(const n of t.Links){if(i<r.header.fanout){const t=n.Hash;if(!c.EMPTY_KEY.equals(t)){const r=await e.get(t),i=b.decode(r);yield*w(e,i)}}else yield n.Hash;i++}}function _(e,t){return async function t(r,n){const s=v.encode({version:1,fanout:c.DEFAULT_FANOUT,seed:n}).finish(),o=m.default.encode(s.length),a=u.concat([o,s]),p=[];for(let e=0;e<c.DEFAULT_FANOUT;e++)p.push({Name:"",Tsize:1,Hash:c.EMPTY_KEY});if(r.length<=c.MAX_ITEMS){const e=r.map((e=>({link:{Name:"",Tsize:1,Hash:e.key},data:e.data||new Uint8Array}))).sort(((e,t)=>l.compare(e.link.Hash.bytes,t.link.Hash.bytes))),t=p.concat(e.map((e=>e.link)));return{Data:u.concat([a,...e.map((e=>e.data))]),Links:t}}{const e=r.reduce(((e,t)=>{const r=function(e,t){const r=new Uint8Array(4);new DataView(r.buffer).setUint32(0,e,!0);const i=f.fromString(t.toString()),n=u.concat([r,i],r.byteLength+i.byteLength);return y.default(d.toString(n))}(n,t.key)%c.DEFAULT_FANOUT;return e[r]=r in e?e[r].concat([t]):[t],e}),[]);let i=0;for(const r of e){const e=await t(r,n+1);await g(e,i),i++}return{Data:a,Links:p}}async function g(t,r){const n=b.encode(t),s=await h.sha256.digest(n),o=i.CID.createV0(s);await e.put(o,n);const a=t.Links.reduce(((e,t)=>e+(t.Tsize||0)),0)+n.length;p[r]={Name:"",Tsize:a,Hash:o}}}(t,0)}r.loadSet=async function*(e,t,r){const i=t.Links.find((e=>e.Name===r));if(!i)throw new Error("No link found with name "+r);const n=await e.get(i.Hash),s=b.decode(n);yield*w(e,s)},r.storeSet=async function(e,t,r){const n=await _(e,r.map((e=>({key:e})))),s=b.encode(n),o=await h.sha256.digest(s),a=i.CID.createV0(o);return await e.put(a,s),{Name:t,Tsize:n.Links.reduce(((e,t)=>e+t.Tsize),0)+s.length,Hash:a}}},{"multiformats/cid":"9ooAY","./pin.js":"0pDow",fnv1a:"9l12K",varint:"aN1CO","@ipld/dag-pb":"i2cdx","./utils.js":"iretC","uint8arrays/concat":"4EBjG","uint8arrays/compare":"2xv9i","uint8arrays/to-string":"hC8JB","uint8arrays/from-string":"dF7Y4","multiformats/hashes/sha2":"7i9MT"}],"0pDow":[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("protobufjs/minimal.js"));const s=n.default.Reader,o=n.default.Writer,a=(n.default.util,n.default.roots.default||(n.default.roots.default={})),c=a.ipfs=(()=>{const e={};return e.pin=function(){const e={};return e.Set=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.version=0,e.prototype.fanout=0,e.prototype.seed=0,e.encode=function(e,t){return t||(t=o.create()),null!=e.version&&Object.hasOwnProperty.call(e,"version")&&t.uint32(8).uint32(e.version),null!=e.fanout&&Object.hasOwnProperty.call(e,"fanout")&&t.uint32(16).uint32(e.fanout),null!=e.seed&&Object.hasOwnProperty.call(e,"seed")&&t.uint32(29).fixed32(e.seed),t},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.ipfs.pin.Set;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.version=e.uint32();break;case 2:i.fanout=e.uint32();break;case 3:i.seed=e.fixed32();break;default:e.skipType(7&n)}}return i},e.fromObject=function(e){if(e instanceof a.ipfs.pin.Set)return e;var t=new a.ipfs.pin.Set;return null!=e.version&&(t.version=e.version>>>0),null!=e.fanout&&(t.fanout=e.fanout>>>0),null!=e.seed&&(t.seed=e.seed>>>0),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.version=0,r.fanout=0,r.seed=0),null!=e.version&&e.hasOwnProperty("version")&&(r.version=e.version),null!=e.fanout&&e.hasOwnProperty("fanout")&&(r.fanout=e.fanout),null!=e.seed&&e.hasOwnProperty("seed")&&(r.seed=e.seed),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.default.util.toJSONOptions)},e}(),e}(),e})();r.default=a,r.ipfs=c},{"protobufjs/minimal.js":"grAXL"}],"9l12K":[function(e,t,r){function i(e){for(var t=i.BASE,r=0,n=e.length;r<n;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}i.BASE=2166136261,t.exports=i},{}],iretC:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("interface-datastore/key"),n=e("multiformats/bases/base32"),s=e("multiformats/cid");const o=new i.Key("/local/pins"),a=s.CID.parse("QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n");r.DEFAULT_FANOUT=256,r.EMPTY_KEY=a,r.MAX_ITEMS=8192,r.PIN_DS_KEY=o,r.PinTypes={direct:"direct",recursive:"recursive"},r.cidToKey=function(e){return new i.Key(`/${n.base32.encode(e.multihash.bytes).toUpperCase().substring(1)}`)}},{"interface-datastore/key":"9hGOz","multiformats/bases/base32":"5k9Tu","multiformats/cid":"9ooAY"}],"2xv9i":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.compare=function(e,t){for(let r=0;r<e.byteLength;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return e.byteLength>t.byteLength?1:e.byteLength<t.byteLength?-1:0}},{}],qHC3R:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../src/utils.js"),n=e("uint8arrays/from-string"),s=e("uint8arrays/to-string");async function o(e,t,r=(()=>{})){const s=i.findLevelJs(t);if(!s)return void r(`${e} did not need an upgrade`);r(`Upgrading ${e}`);await d(s,((e,t)=>[{type:"del",key:e},{type:"put",key:n.fromString(e),value:t}]))}async function a(e,t,r=(()=>{})){const n=i.findLevelJs(t);if(!n)return void r(`${e} did not need a downgrade`);r(`Downgrading ${e}`);await d(n,((e,t)=>[{type:"del",key:e},{type:"put",key:s.toString(e),value:t}]))}function c(e){return e.child?c(e.child):e}async function u(e,t,r){const i=Object.entries(e).map((([e,t])=>({key:e,backend:c(t)}))).filter((({key:e,backend:t})=>"LevelDatastore"===t.constructor.name)).map((({key:e,backend:t})=>({name:e,store:t})));t(0,`Migrating ${i.length} dbs`);let n=0;const s=e=>{t(Math.round(n/i.length*100),e)};for(const{name:e,store:t}of i){await t.open();try{await r(e,t,s)}finally{n++,await t.close()}}t(100,`Migrated ${i.length} dbs`)}const l={version:10,description:"Migrates datastore-level keys to binary",migrate:(e,t=(()=>{}))=>u(e,t,o),revert:(e,t=(()=>{}))=>u(e,t,a)};function d(e,t){return new Promise(((r,i)=>{const n=e.iterator();n._deserializeKey=n._deserializeValue=e=>e,function s(){const o=(o,a,c)=>{if(o||void 0===a){const e=e=>{e?i(e):r()};n.end(e)}else!function(t,r){const i=e.store("readwrite"),n=i.transaction;let s,o=0;n.onabort=()=>r(s||n.error||new Error("aborted by user")),n.oncomplete=()=>r(),function e(){const r=t[o++],a=r.key;let c;try{c="del"===r.type?i.delete(a):i.put(r.value,a)}catch(e){return s=e,void n.abort()}o<t.length&&(c.onsuccess=e)}()}(t(a,c),s)};n.next(o)}()}))}r.migration=l},{"../../src/utils.js":"2ugL9","uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB"}],"2ugL9":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("interface-datastore/key"),n=e("datastore-core/errors");const s=new i.Key("/config"),o=new i.Key("/version");function a(e){let t=e;for(;t.db||t.child;)if(t=t.db||t.child,"level-js"===t.type||"Level"===t.constructor.name)return t}async function c(e,t,r){const i=await t(e);if(i)return i;const n=a(r);return!!n&&new Promise(((t,r)=>{const i=n.store("readonly").get(e.toString());i.transaction.onabort=()=>{r(i.transaction.error)},i.transaction.oncomplete=()=>{t(Boolean(i.result))}}))}function u(e){const t=e.get.bind(e),r=e.has.bind(e);return e.get=i=>async function(e,t,r,i){if(await r(e))return t(e);const s=a(i);if(!s)throw n.notFoundError();return new Promise(((t,r)=>{const i=s.store("readonly").get(e.toString());i.transaction.onabort=()=>{r(i.transaction.error)},i.transaction.oncomplete=()=>{if(i.result)return t(i.result);r(n.notFoundError())}}))}(i,t,r,e),e.has=t=>c(t,r,e),e}r.CONFIG_KEY=s,r.VERSION_KEY=o,r.findLevelJs=a,r.hasWithFallback=c,r.wrapBackends=function(e){return{...e,root:u(e.root),datastore:u(e.datastore),pins:u(e.pins),keys:u(e.keys)}}},{"interface-datastore/key":"9hGOz","datastore-core/errors":"65M4b"}],"5Bi4X":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=new(e("interface-datastore/key").Key)("/local/filesroot");const n={version:11,description:"Store mfs root in the datastore",migrate:async function(e,t=(()=>{})){if(t(100,"Migrating MFS root to repo datastore"),await e.root.open(),await e.datastore.open(),await e.root.has(i)){const t=await e.root.get(i);await e.datastore.put(i,t),await e.root.delete(i)}await e.datastore.close(),await e.root.close(),t(100,"Stored MFS root in repo datastore")},revert:async function(e,t=(()=>{})){if(t(100,"Migrating MFS root to repo root datastore"),await e.root.open(),await e.datastore.open(),await e.datastore.has(i)){const t=await e.datastore.get(i);await e.root.put(i,t),await e.datastore.delete(i)}await e.datastore.close(),await e.root.close(),t(100,"Stored MFS root in repo root datastore")}};r.migration=n},{"interface-datastore/key":"9hGOz"}],h9pUV:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./init.js"),n=e("../errors.js"),s=e("../utils.js"),o=e("uint8arrays/from-string"),a=e("uint8arrays/to-string");r.getVersion=async function(e){if(!await i.isRepoInitialized(e))throw new n.NotInitializedRepoError("Repo is not initialized!");const t=e.root;await t.open();try{return parseInt(a.toString(await t.get(s.VERSION_KEY)))}finally{await t.close()}},r.setVersion=async function(e,t){if(!t)throw new n.MissingRepoOptionsError("Please pass repo options when trying to open a repo");const r=t.root;await r.open(),await r.put(s.VERSION_KEY,o.fromString(String(e))),await r.close()}},{"./init.js":"fVppP","../errors.js":"dUdRa","../utils.js":"2ugL9","uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB"}],fVppP:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("debug"),n=e("../utils.js"),s=e("../errors.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const a=o(i).default("ipfs:repo:migrator:repo:init");r.isRepoInitialized=async function(e){if(!e)throw new s.MissingRepoOptionsError("Please pass repo options when trying to open a repo");const t=e.root;try{await t.open();const e=await t.has(n.VERSION_KEY),r=await t.has(n.CONFIG_KEY);return!(!e||!r)||(a(`Version entry present: ${e}`),a(`Config entry present: ${r}`),!1)}catch(e){return a("While checking if repo is initialized error was thrown: "+e.message),!1}finally{if(void 0!==t)try{await t.close()}catch{}}}},{debug:"bO5wM","../utils.js":"2ugL9","../errors.js":"dUdRa"}],dUdRa:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});class i extends Error{constructor(e){super(e),this.name="NonReversibleMigrationError",this.code=i.code,this.message=e}}i.code="ERR_NON_REVERSIBLE_MIGRATION";class n extends Error{constructor(e){super(e),this.name="NotInitializedRepoError",this.code=n.code,this.message=e}}n.code="ERR_NOT_INITIALIZED_REPO";class s extends Error{constructor(e){super(e),this.name="RequiredParameterError",this.code=s.code,this.message=e}}s.code="ERR_REQUIRED_PARAMETER";class o extends Error{constructor(e){super(e),this.name="InvalidValueError",this.code=o.code,this.message=e}}o.code="ERR_INVALID_VALUE";class a extends Error{constructor(e){super(e),this.name="MissingRepoOptionsError",this.code=a.code,this.message=e}}a.code="ERR_MISSING_REPO_OPTIONS",r.InvalidValueError=o,r.MissingRepoOptionsError=a,r.NonReversibleMigrationError=i,r.NotInitializedRepoError=n,r.RequiredParameterError=s},{}],"7yIGD":[function(e,t,r){
/*!
* bytes
* Copyright(c) 2012-2014 TJ Holowaychuk
* Copyright(c) 2015 Jed Watson
* MIT Licensed
*/
"use strict";t.exports=function(e,t){return"string"==typeof e?c(e):"number"==typeof e?a(e,t):null},t.exports.format=a,t.exports.parse=c;var i=/\B(?=(\d{3})+(?!\d))/g,n=/(?:\.0*|(\.[^0]+)0+)$/,s={b:1,kb:1024,mb:1048576,gb:1073741824,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},o=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function a(e,t){if(!Number.isFinite(e))return null;var r=Math.abs(e),o=t&&t.thousandsSeparator||"",a=t&&t.unitSeparator||"",c=t&&void 0!==t.decimalPlaces?t.decimalPlaces:2,u=Boolean(t&&t.fixedDecimals),l=t&&t.unit||"";l&&s[l.toLowerCase()]||(l=r>=s.pb?"PB":r>=s.tb?"TB":r>=s.gb?"GB":r>=s.mb?"MB":r>=s.kb?"KB":"B");var d=(e/s[l.toLowerCase()]).toFixed(c);return u||(d=d.replace(n,"$1")),o&&(d=d.split(".").map((function(e,t){return 0===t?e.replace(i,o):e})).join(".")),d+a+l}function c(e){if("number"==typeof e&&!isNaN(e))return e;if("string"!=typeof e)return null;var t,r=o.exec(e),i="b";return r?(t=parseFloat(r[1]),i=r[4].toLowerCase()):(t=parseInt(e,10),i="b"),Math.floor(s[i]*t)}},{}],"4JQCP":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("interface-datastore/key"),n=e("debug"),s=e("uint8arrays/to-string"),o=e("uint8arrays/from-string"),a=e("./utils/level.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const u=c(n).default("ipfs:repo:version"),l=new i.Key("version");r.version=function(e){return{exists:async()=>a.hasWithFallback(l,e.has.bind(e),e),async get(){const t=await a.getWithFallback(l,e.get.bind(e),e.has.bind(e),e);return parseInt(s.toString(t),10)},set:t=>e.put(l,o.fromString(String(t))),async check(e){const t=await this.get();u("comparing version: %s and %s",t,e);return t===e||(6===t&&7===e||6===e&&7===t)}}}},{"interface-datastore/key":"9hGOz",debug:"bO5wM","uint8arrays/to-string":"hC8JB","uint8arrays/from-string":"dF7Y4","./utils/level.js":"hR5hb"}],hR5hb:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../errors.js");function n(e){let t=e;for(;t.db||t.child;)if(t=t.db||t.child,"level-js"===t.type||"Level"===t.constructor.name)return t}r.getWithFallback=async function(e,t,r,s){if(await r(e))return t(e);const o=n(s);if(!o)throw new i.NotFoundError;return new Promise(((t,r)=>{const n=o.store("readonly").get(e.toString());n.transaction.onabort=()=>{r(n.transaction.error)},n.transaction.oncomplete=()=>{if(n.result)return t(n.result);r(new i.NotFoundError)}}))},r.hasWithFallback=async function(e,t,r){const i=await t(e);if(i)return i;const s=n(r);return!!s&&new Promise(((t,r)=>{const i=s.store("readonly").get(e.toString());i.transaction.onabort=()=>{r(i.transaction.error)},i.transaction.oncomplete=()=>{t(Boolean(i.result))}}))}},{"../errors.js":"jDxkJ"}],jDxkJ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});class i extends Error{constructor(e){super(e),this.name="LockExistsError",this.code=i.code}}i.code="ERR_LOCK_EXISTS";class n extends Error{constructor(e){super(e),this.name="NotFoundError",this.code=n.code}}n.code="ERR_NOT_FOUND";class s extends Error{constructor(e){super(e),this.name="InvalidRepoVersionError",this.code=s.code}}s.code="ERR_INVALID_REPO_VERSION";r.ERR_REPO_ALREADY_CLOSED="ERR_REPO_ALREADY_CLOSED",r.ERR_REPO_ALREADY_OPEN="ERR_REPO_ALREADY_OPEN",r.ERR_REPO_NOT_INITIALIZED="ERR_REPO_NOT_INITIALIZED",r.InvalidRepoVersionError=s,r.LockExistsError=i,r.NotFoundError=n},{}],"1Sgmj":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("interface-datastore/key"),n=e("p-queue"),s=e("just-safe-get"),o=e("just-safe-set"),a=e("err-code"),c=e("./errors.js"),u=e("uint8arrays/to-string"),l=e("uint8arrays/from-string"),d=e("./utils/level.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=f(n),p=f(s),g=f(o),y=f(a);const m=h.default.default?h.default.default:h.default,b=new i.Key("config");r.config=function(e){const t=new m({concurrency:1}),r={async getAll(t={}){const r=await d.getWithFallback(b,e.get.bind(e),e.has.bind(e),e);return JSON.parse(u.toString(r))},async get(e,t={}){if(null==e)throw new c.NotFoundError(`Key ${e} does not exist in config`);const r=await this.getAll(t),i=p.default(r,e);if(void 0===i)throw new c.NotFoundError(`Key ${e} does not exist in config`);return i},set(e,r,n={}){if("string"!=typeof e&&!(e instanceof String))throw y.default(new Error("Invalid key type: "+typeof e),"ERR_INVALID_KEY");if(void 0===r||r instanceof Uint8Array)throw y.default(new Error("Invalid value type: "+typeof r),"ERR_INVALID_VALUE");return t.add((()=>i({key:e,value:r},n.signal)))},replace(e,r={}){if(!e||e instanceof Uint8Array)throw y.default(new Error("Invalid value type: "+typeof e),"ERR_INVALID_VALUE");return t.add((()=>i({key:void 0,value:e},r.signal)))},exists:async()=>d.hasWithFallback(b,e.has.bind(e),e)};async function i(e,t){if(t&&t.aborted)return;const i=e.key,s=e.value;if(i){const e=await r.getAll();return"object"==typeof e&&null!==e&&g.default(e,i,s),n(e)}return n(s)}function n(t){const r=l.fromString(JSON.stringify(t,null,2));return e.put(b,r)}return r}},{"interface-datastore/key":"9hGOz","p-queue":"biPlv","just-safe-get":"6M8pS","just-safe-set":"glUwm","err-code":"chZjB","./errors.js":"jDxkJ","uint8arrays/to-string":"hC8JB","uint8arrays/from-string":"dF7Y4","./utils/level.js":"hR5hb"}],hVqbt:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("interface-datastore"),n=e("sort-keys"),s=e("uint8arrays/to-string"),o=e("uint8arrays/from-string");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(n);const u=new i.Key("datastore_spec");r.spec=function(e){return{exists:()=>e.has(u),async get(){const t=await e.get(u);return JSON.parse(s.toString(t))},set:async t=>e.put(u,o.fromString(JSON.stringify(c.default(t,{deep:!0}))))}}},{"interface-datastore":"1Ax6d","sort-keys":"lwzsm","uint8arrays/to-string":"hC8JB","uint8arrays/from-string":"dF7Y4"}],lwzsm:[function(e,t,r){"use strict";const i=e("is-plain-obj");t.exports=(e,t={})=>{if(!i(e)&&!Array.isArray(e))throw new TypeError("Expected a plain object or array");const{deep:r}=t,n=[],s=[],o=e=>{const t=n.indexOf(e);if(-1!==t)return s[t];const r=[];return n.push(e),s.push(r),r.push(...e.map((e=>Array.isArray(e)?o(e):i(e)?a(e):e))),r},a=e=>{const c=n.indexOf(e);if(-1!==c)return s[c];const u={},l=Object.keys(e).sort(t.compare);n.push(e),s.push(u);for(const t of l){const n=e[t];let s;s=r&&Array.isArray(n)?o(n):r&&i(n)?a(n):n,Object.defineProperty(u,t,{...Object.getOwnPropertyDescriptor(e,t),value:s})}return u};return Array.isArray(e)?r?o(e):e.slice():a(e)}},{"is-plain-obj":"jGt65"}],jPLmC:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("interface-datastore/key"),n=e("uint8arrays/from-string");const s=new i.Key("api");r.apiAddr=function(e){return{async get(){const t=await e.get(s);return t&&t.toString()},set:t=>e.put(s,n.fromString(t.toString())),delete:()=>e.delete(s)}}},{"interface-datastore/key":"9hGOz","uint8arrays/from-string":"dF7Y4"}],"4g9K0":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("it-filter"),n=e("it-pushable"),s=e("it-drain"),o=e("multiformats/cid"),a=e("err-code"),c=e("multiformats/hashes/identity");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(i),d=u(n),f=u(s),h=u(a);function p(e){const t=o.CID.asCID(e);if(null==t)throw h.default(new Error("Not a valid cid"),"ERR_INVALID_CID");return t.multihash.code!==c.identity.code?{isIdentity:!1}:{isIdentity:!0,digest:t.multihash.digest}}r.createIdStore=function(e){return{open:()=>e.open(),close:()=>e.close(),query:(t,r)=>e.query(t,r),queryKeys:(t,r)=>e.queryKeys(t,r),async get(t,r){const i=p(t);return i.isIdentity?Promise.resolve(i.digest):e.get(t,r)},async*getMany(e,t){for await(const r of e)yield this.get(r,t)},async put(t,r,i){const{isIdentity:n}=p(t);n||await e.put(t,r,i)},async*putMany(t,r){const i=d.default();(globalThis.process&&globalThis.process.nextTick?globalThis.process.nextTick:globalThis.setImmediate||globalThis.setTimeout)((async()=>{try{await f.default(e.putMany(async function*(){for await(const{key:e,value:r}of t)p(e).isIdentity||(yield{key:e,value:r}),i.push({key:e,value:r})}())),i.end()}catch(e){i.end(e)}})),yield*i},has(t,r){const{isIdentity:i}=p(t);return i?Promise.resolve(!0):e.has(t,r)},delete(t,r){const{isIdentity:i}=p(t);return i?Promise.resolve():e.delete(t,r)},deleteMany:(t,r)=>e.deleteMany(l.default(t,(e=>!p(e).isIdentity)),r),batch(){const t=e.batch();return{put(e,r){const{isIdentity:i}=p(e);i||t.put(e,r)},delete(e){const{isIdentity:r}=p(e);r||t.delete(e)},commit:e=>t.commit(e)}}}}},{"it-filter":"5LCTL","it-pushable":"bnpei","it-drain":"dKYhO","multiformats/cid":"9ooAY","err-code":"chZjB","multiformats/hashes/identity":"eYCZn"}],kDkh7:[function(e,t,r){"use strict";var i={autoMigrate:!0,onMigrationProgress:()=>{},repoOwner:!0,repoLock:e("./locks/memory.js").MemoryLock};t.exports=i},{"./locks/memory.js":"xMQlv"}],xMQlv:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../errors.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const s=n(e("debug")).default("ipfs:repo:lock:memory"),o="repo.lock",a={};const c={lock:async function(e){const t=e+"/"+o;if(s("locking %s",t),!0===a[t])throw new i.LockExistsError(`Lock already being held for file: ${t}`);return a[t]=!0,{async close(){a[t]&&delete a[t]}}},locked:async function(e){const t=e+"/"+o;return s(`checking lock: ${t}`),Boolean(a[t])}};r.MemoryLock=c},{"../errors.js":"jDxkJ",debug:"bO5wM"}],gHTwB:[function(e,t,r){"use strict";t.exports={Spec:{type:"mount",mounts:[{mountpoint:"/blocks",type:"measure",prefix:"flatfs.datastore",child:{type:"flatfs",path:"blocks",sync:!0,shardFunc:"/repo/flatfs/shard/v1/next-to-last/2"}},{mountpoint:"/",type:"measure",prefix:"leveldb.datastore",child:{type:"levelds",path:"datastore",compression:"none"}}]}}},{}],byEbm:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("err-code"),s=e("debug"),o=e("it-first"),a=e("multiformats/block"),c=e("cborg"),u=e("@ipld/dag-pb"),l=e("./utils/blockstore.js"),d=e("./utils/walk-dag.js"),f=e("./pin-types.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var g=h(n),y=h(s),m=h(o),b=p(c),v=p(u);r.PinManager=class{constructor({pinstore:e,blockstore:t,loadCodec:r}){this.pinstore=e,this.blockstore=t,this.loadCodec=r,this.log=y.default("ipfs:repo:pin"),this.directPins=new Set,this.recursivePins=new Set}async pinDirectly(e,t={}){await this.blockstore.get(e,t);const r={depth:0};return 0!==e.version&&(r.version=e.version),e.code!==v.code&&(r.codec=e.code),t.metadata&&(r.metadata=t.metadata),this.pinstore.put(l.cidToKey(e),b.encode(r))}unpin(e,t){return this.pinstore.delete(l.cidToKey(e),t)}async pinRecursively(e,t={}){await this.fetchCompleteDag(e,t);const r={depth:1/0};0!==e.version&&(r.version=e.version),e.code!==v.code&&(r.codec=e.code),t.metadata&&(r.metadata=t.metadata),await this.pinstore.put(l.cidToKey(e),b.encode(r))}async*directKeys(e){for await(const e of this.pinstore.query({filters:[e=>0===b.decode(e.value).depth]})){const t=b.decode(e.value),r=t.version||0,n=null!=t.codec?t.codec:v.code,s=l.keyToMultihash(e.key);yield{cid:i.CID.create(r,n,s),metadata:t.metadata}}}async*recursiveKeys(e){for await(const e of this.pinstore.query({filters:[e=>b.decode(e.value).depth===1/0]})){const t=b.decode(e.value),r=t.version||0,n=null!=t.codec?t.codec:v.code,s=l.keyToMultihash(e.key);yield{cid:i.CID.create(r,n,s),metadata:t.metadata}}}async*indirectKeys(e){for await(const{cid:t}of this.recursiveKeys())for await(const r of d.walkDag(t,this.blockstore,this.loadCodec,e)){const e=[f.PinTypes.recursive];(await this.isPinnedWithType(r,e)).pinned||(yield r)}}async isPinnedWithType(e,t,r){Array.isArray(t)||(t=[t]);const i=t.includes(f.PinTypes.all),n=t.includes(f.PinTypes.direct),s=t.includes(f.PinTypes.recursive),o=t.includes(f.PinTypes.indirect);if(s||n||i){const r=await m.default(this.pinstore.query({prefix:l.cidToKey(e).toString(),filters:[e=>{if(i)return!0;const r=b.decode(e.value);return t.includes(0===r.depth?f.PinTypes.direct:f.PinTypes.recursive)}],limit:1}));if(r){const t=b.decode(r.value);return{cid:e,pinned:!0,reason:0===t.depth?f.PinTypes.direct:f.PinTypes.recursive,metadata:t.metadata}}}const a=this;if(i||o){const t=await m.default(async function*(e,t){for await(const{cid:r}of t)for await(const t of d.walkDag(r,a.blockstore,a.loadCodec))if(t.equals(e))return void(yield r)}(e,this.recursiveKeys()));if(t)return{cid:e,pinned:!0,reason:f.PinTypes.indirect,parent:t}}return{cid:e,pinned:!1}}async fetchCompleteDag(e,t){const r=new Set,i=async(e,t)=>{if(r.has(e.toString()))return;r.add(e.toString());const n=await this.blockstore.get(e,t),s=await this.loadCodec(e.code),o=a.createUnsafe({bytes:n,cid:e,codec:s});await Promise.all([...o.links()].map((([,e])=>i(e,t))))};await i(e,t)}static checkPinType(e){if("string"!=typeof e||!Object.keys(f.PinTypes).includes(e))throw function(e){const t=`Invalid type '${e}', must be one of {direct, indirect, recursive, all}`;return g.default(new Error(t),"ERR_INVALID_PIN_TYPE")}(e);return!0}}},{"multiformats/cid":"9ooAY","err-code":"chZjB",debug:"bO5wM","it-first":"hBrkP","multiformats/block":"i1Z6F",cborg:"iZrkE","@ipld/dag-pb":"i2cdx","./utils/blockstore.js":"gV6JY","./utils/walk-dag.js":"2YVIq","./pin-types.js":"uek22"}],gV6JY:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("interface-datastore/key"),n=e("multiformats"),s=e("multiformats/codecs/raw"),o=e("err-code"),a=e("multiformats/bases/base32"),c=e("multiformats/hashes/digest");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var d=l(s),f=u(o),h=l(c);function p(e){return h.decode(a.base32.decode(`b${e.toString().toLowerCase().substring(1)}`))}r.cidToKey=function(e){const t=n.CID.asCID(e);if(null==t)throw f.default(new Error("Not a valid cid"),"ERR_INVALID_CID");const r=a.base32.encode(t.multihash.bytes);return new i.Key("/"+r.slice(1).toUpperCase(),!1)},r.keyToCid=function(e){return n.CID.createV1(d.code,p(e))},r.keyToMultihash=p},{"interface-datastore/key":"9hGOz",multiformats:"3ANyW","multiformats/codecs/raw":"fdfgp","err-code":"chZjB","multiformats/bases/base32":"5k9Tu","multiformats/hashes/digest":"kpRBg"}],"2YVIq":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("debug"),n=e("multiformats/block");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const o=s(i).default("ipfs:repo:utils:walk-dag");r.walkDag=async function*e(t,r,i,s){try{const o=await r.get(t,s),a=await i(t.code),c=n.createUnsafe({bytes:o,cid:t,codec:a});for(const[,t]of c.links())yield t,yield*e(t,r,i,s)}catch(e){throw o("Could not walk DAG for CID",t.toString(),e),e}}},{debug:"bO5wM","multiformats/block":"i1Z6F"}],ds9CD:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("it-map"),n=e("err-code"),s=e("./pin-types.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(i),c=o(n);async function u(e,t){const{pinned:r,reason:i}=await t.isPinnedWithType(e,s.PinTypes.all);if(r)throw c.default(new Error(`pinned: ${i}`),"ERR_BLOCK_PINNED")}r.createPinnedBlockstore=function(e,t){return{open:()=>t.open(),close:()=>t.close(),query:(e,r)=>t.query(e,r),queryKeys:(e,r)=>t.queryKeys(e,r),get:async(e,r)=>t.get(e,r),async*getMany(e,r){yield*t.getMany(e,r)},async put(e,r,i){await t.put(e,r,i)},async*putMany(e,r){yield*t.putMany(e,r)},has:(e,r)=>t.has(e,r),delete:async(r,i)=>(await u(r,e),t.delete(r,i)),deleteMany:(r,i)=>t.deleteMany(a.default(r,(async t=>(await u(t,e),t))),i),batch:()=>t.batch()}}},{"it-map":"eeqPk","err-code":"chZjB","./pin-types.js":"uek22"}],e9PbA:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("debug"),s=e("datastore-core/errors"),o=e("it-parallel-batch"),a=e("it-pipe"),c=e("it-merge"),u=e("it-map"),l=e("it-filter"),d=e("interface-datastore/key"),f=e("multiformats/bases/base32"),h=e("./utils/walk-dag.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=p(n),y=p(o),m=p(c),b=p(u),v=p(l);const w=g.default("ipfs:repo:gc"),_=s.notFoundError().code,E=new d.Key("/local/filesroot");r.gc=function({gcLock:e,pins:t,blockstore:r,root:n,loadCodec:s}){return async function*(){const o=Date.now();w("Creating set of marked blocks");const c=await e.writeLock();try{const e=await async function({pins:e,blockstore:t,loadCodec:r,root:n}){const s=async function*(){let e;try{e=await n.get(E)}catch(e){if(e.code===_)return void w("No blocks in MFS");throw e}const s=i.CID.decode(e);yield s,yield*h.walkDag(s,t,r)}(),o=m.default(b.default(e.recursiveKeys(),(({cid:e})=>e)),e.indirectKeys(),b.default(e.directKeys(),(({cid:e})=>e)),s),a=new Set;for await(const e of m.default(o,s))a.add(f.base32.encode(e.multihash.bytes));return a}({pins:t,blockstore:r,root:n,loadCodec:s}),u=r.queryKeys({});yield*async function*({blockstore:e},t,r){let i=0,n=0;const s=async r=>async function(){i++;try{const i=f.base32.encode(r.multihash.bytes);if(t.has(i))return null;try{await e.delete(r),n++}catch(e){return{err:new Error(`Could not delete block with CID ${r}: ${e.message}`)}}return{cid:r}}catch(e){const t=`Could delete block with CID ${r}`;return w(t,e),{err:new Error(t+`: ${e.message}`)}}};yield*a.pipe(y.default(b.default(r,s),256),(e=>v.default(e,Boolean))),w(`Marked set has ${t.size} unique blocks. Blockstore has ${i} blocks. Deleted ${n} blocks.`)}({blockstore:r},e,u),w(`Complete (${Date.now()-o}ms)`)}finally{c()}}}},{"multiformats/cid":"9ooAY",debug:"bO5wM","datastore-core/errors":"65M4b","it-parallel-batch":"lPBqc","it-pipe":"giKBQ","it-merge":"cPFu3","it-map":"eeqPk","it-filter":"5LCTL","interface-datastore/key":"9hGOz","multiformats/bases/base32":"5k9Tu","./utils/walk-dag.js":"2YVIq"}],"3taGN":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("interface-datastore"),n=e("datastore-core"),s=e("it-filter"),o=e("it-map"),a=e("it-take"),c=e("it-sort"),u=e("level");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=l(s),f=l(o),h=l(a),p=l(c),g=l(u);class y extends n.BaseDatastore{constructor(e,t){super(),this.path=e,this.opts=t,t&&t.db?(this.database=t.db,delete t.db):this.database=g.default}_initDb(){return new Promise(((e,t)=>{this.db=this.database(this.path,{...this.opts,valueEncoding:"binary",compression:!1},(r=>{if(r)return t(r);e(this.db)}))}))}async open(){try{this.db?await this.db.open():this.db=await this._initDb()}catch(e){throw n.Errors.dbOpenFailedError(e)}}async put(e,t){try{await this.db.put(e.toString(),t)}catch(e){throw n.Errors.dbWriteFailedError(e)}}async get(e){let t;try{t=await this.db.get(e.toString())}catch(e){if(e.notFound)throw n.Errors.notFoundError(e);throw n.Errors.dbWriteFailedError(e)}return t}async has(e){try{await this.db.get(e.toString())}catch(e){if(e.notFound)return!1;throw e}return!0}async delete(e){try{await this.db.del(e.toString())}catch(e){throw n.Errors.dbDeleteFailedError(e)}}close(){return this.db&&this.db.close()}batch(){const e=[];return{put:(t,r)=>{e.push({type:"put",key:t.toString(),value:r})},delete:t=>{e.push({type:"del",key:t.toString()})},commit:()=>this.db.batch(e)}}query(e){let t=this._query({values:!0,prefix:e.prefix});Array.isArray(e.filters)&&(t=e.filters.reduce(((e,t)=>d.default(e,t)),t)),Array.isArray(e.orders)&&(t=e.orders.reduce(((e,t)=>p.default(e,t)),t));const{offset:r,limit:i}=e;if(r){let e=0;t=d.default(t,(()=>e++>=r))}return i&&(t=h.default(t,i)),t}queryKeys(e){let t=f.default(this._query({values:!1,prefix:e.prefix}),(({key:e})=>e));Array.isArray(e.filters)&&(t=e.filters.reduce(((e,t)=>d.default(e,t)),t)),Array.isArray(e.orders)&&(t=e.orders.reduce(((e,t)=>p.default(e,t)),t));const{offset:r,limit:i}=e;if(r){let e=0;t=d.default(t,(()=>e++>=r))}return i&&(t=h.default(t,i)),t}_query(e){const t={keys:!0,keyAsBuffer:!0,values:e.values};if(null!=e.prefix){const r=e.prefix.toString();t.gte=r,t.lt=r+"ÿ"}return r=this.db.iterator(t),{[Symbol.asyncIterator]:()=>({next:()=>new Promise(((e,t)=>{r.next(((n,s,o)=>n?t(n):null==s?r.end((r=>{if(r)return t(r);e({done:!0,value:void 0})})):void e({done:!1,value:{key:new i.Key(s,!1),value:o}})))})),return:()=>new Promise(((e,t)=>{r.end((r=>{if(r)return t(r);e({done:!0,value:void 0})}))}))})};var r}}r.LevelDatastore=y},{"interface-datastore":"1Ax6d","datastore-core":"bBniO","it-filter":"5LCTL","it-map":"eeqPk","it-take":"gxr1t","it-sort":"1r2il",level:"2sKBw"}],"1r2il":[function(e,t,r){"use strict";const i=e("it-all");t.exports=async function*(e,t){const r=await i(e);yield*r.sort(t)}},{"it-all":"iCXBu"}],"2sKBw":[function(e,t,r){t.exports=e("level-packager")(e("level-js"))},{"level-packager":"6lvLX","level-js":"lRPoL"}],"6lvLX":[function(e,t,r){"use strict";const i=e("levelup"),n=e("encoding-down");t.exports=function(e){function t(t,s,o){return"function"==typeof t?o=t:"function"==typeof s&&(o=s),r(s)||(s=r(t)?t:{}),i(n(e(t,s),s),s,o)}function r(e){return"object"==typeof e&&null!==e}for(const r of["destroy","repair"])"function"==typeof e[r]&&(t[r]=function(...t){e[r](...t)});return t.errors=i.errors,t}},{levelup:"axpZu","encoding-down":"eMHkk"}],axpZu:[function(e,t,r){"use strict";const i=e("events").EventEmitter,n=e("util").inherits,s=e("deferred-leveldown"),o=e("level-iterator-stream"),a=e("./batch"),c=e("level-errors"),u=e("level-supports"),l=e("catering"),d=e("./common").getCallback,f=e("./common").getOptions,h=e("./next-tick"),p=c.WriteError,g=c.ReadError,y=c.NotFoundError,m=c.OpenError,b=c.InitializationError;function v(e,t,r){if(!(this instanceof v))return new v(e,t,r);let n;if(i.call(this),this.setMaxListeners(1/0),"function"==typeof t&&(r=t,t={}),t=t||{},!e||"object"!=typeof e){if(n=new b("First argument must be an abstract-leveldown compliant store"),"function"==typeof r)return h(r,n);throw n}if("string"!=typeof e.status)throw new Error(".status required, old abstract-leveldown");this.options=f(t),this._db=e,this.db=null,this.open(r||(e=>{e&&this.emit("error",e)})),this.supports=u(this.db.supports,{status:!0,deferredOpen:!0,openCallback:!0,promises:!0,streams:!0});for(const e of Object.keys(this.supports.additionalMethods))null==this[e]&&(this[e]=function(...t){return this.db[e](...t)})}function w(e,t){return!e.isOperational()&&(h(t,new g("Database is not open")),!0)}v.prototype.emit=i.prototype.emit,v.prototype.once=i.prototype.once,n(v,i),Object.defineProperty(v.prototype,"status",{enumerable:!0,get(){return this.db.status}}),v.prototype.isOperational=function(){return"open"===this.db.status||"opening"===this.db.status},v.prototype.open=function(e,t){return"function"==typeof e&&(t=e,e=null),t=l.fromCallback(t),e||(e=this.options),this.db&&this.isOpen()?(h(t,null,this),t.promise):this.db&&this._isOpening()?(this.once("open",(()=>{t(null,this)})),t.promise):(this.db=new s(this._db),this.emit("opening"),this.db.open(e,(e=>{if(e)return t(new m(e));this.db=this._db,t(null,this),this.emit("open"),this.emit("ready")})),t.promise)},v.prototype.close=function(e){return e=l.fromCallback(e),this.isOpen()?(this.db.close(((t,...r)=>{this.emit("closed"),e(t,...r)})),this.emit("closing")):this.isClosed()?h(e):"closing"===this.db.status?this.once("closed",e):this._isOpening()&&this.once("open",(()=>{this.close(e)})),e.promise},v.prototype.isOpen=function(){return"open"===this.db.status},v.prototype._isOpening=function(){return"opening"===this.db.status},v.prototype.isClosed=function(){return/^clos|new/.test(this.db.status)},v.prototype.get=function(e,t,r){return r=d(t,r),w(this,r=l.fromCallback(r))||(t=f(t),this.db.get(e,t,(function(t,i){if(t)return t=/notfound/i.test(t)||t.notFound?new y("Key not found in database ["+e+"]",t):new g(t),r(t);r(null,i)}))),r.promise},v.prototype.getMany=function(e,t,r){return this.db.getMany(e,t,r)},v.prototype.put=function(e,t,r,i){return i=d(r,i),w(this,i=l.fromCallback(i))||(r=f(r),this.db.put(e,t,r,(r=>{if(r)return i(new p(r));this.emit("put",e,t),i()}))),i.promise},v.prototype.del=function(e,t,r){return r=d(t,r),w(this,r=l.fromCallback(r))||(t=f(t),this.db.del(e,t,(t=>{if(t)return r(new p(t));this.emit("del",e),r()}))),r.promise},v.prototype.batch=function(e,t,r){return arguments.length?(r="function"==typeof e?e:d(t,r),w(this,r=l.fromCallback(r))||(t=f(t),this.db.batch(e,t,(t=>{if(t)return r(new p(t));this.emit("batch",e),r()}))),r.promise):new a(this)},v.prototype.iterator=function(e){return this.db.iterator(e)},v.prototype.clear=function(e,t){return t=d(e,t),e=f(e),w(this,t=l.fromCallback(t))||this.db.clear(e,(r=>{if(r)return t(new p(r));this.emit("clear",e),t()})),t.promise},v.prototype.readStream=v.prototype.createReadStream=function(e){return"number"!=typeof(e=Object.assign({keys:!0,values:!0},e)).limit&&(e.limit=-1),new o(this.db.iterator(e),e)},v.prototype.keyStream=v.prototype.createKeyStream=function(e){return this.createReadStream(Object.assign({},e,{keys:!0,values:!1}))},v.prototype.valueStream=v.prototype.createValueStream=function(e){return this.createReadStream(Object.assign({},e,{keys:!1,values:!0}))},v.prototype.toString=function(){return"LevelUP"},v.prototype.type="levelup",v.prototype._nextTick=h,v.errors=c,t.exports=v},{events:"g82pp",util:"5ZAct","deferred-leveldown":"lVYRW","level-iterator-stream":"284tK","./batch":"8aV2Q","level-errors":"iLFVA","level-supports":"4gseK",catering:"3yKZX","./common":"4WQgu","./next-tick":"8xl4Y"}],"5ZAct":[function(e,t,r){var i=e("process"),n=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},i=0;i<t.length;i++)r[t[i]]=Object.getOwnPropertyDescriptor(e,t[i]);return r},s=/%[sdj%]/g;r.format=function(e){if(!b(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(c(arguments[r]));return t.join(" ")}r=1;for(var i=arguments,n=i.length,o=String(e).replace(s,(function(e){if("%%"===e)return"%";if(r>=n)return e;switch(e){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(e){return"[Circular]"}default:return e}})),a=i[r];r<n;a=i[++r])y(a)||!_(a)?o+=" "+a:o+=" "+c(a);return o},r.deprecate=function(e,t){if(void 0!==i&&!0===i.noDeprecation)return e;if(void 0===i)return function(){return r.deprecate(e,t).apply(this,arguments)};var n=!1;return function(){if(!n){if(i.throwDeprecation)throw new Error(t);i.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}};var o={},a=/^$/;function c(e,t){var i={seen:[],stylize:l};return arguments.length>=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),g(t)?i.showHidden=t:t&&r._extend(i,t),v(i.showHidden)&&(i.showHidden=!1),v(i.depth)&&(i.depth=2),v(i.colors)&&(i.colors=!1),v(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),d(i,e,i.depth)}function u(e,t){var r=c.styles[t];return r?"["+c.colors[r][0]+"m"+e+"["+c.colors[r][1]+"m":e}function l(e,t){return e}function d(e,t,i){if(e.customInspect&&t&&T(t.inspect)&&t.inspect!==r.inspect&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(i,e);return b(n)||(n=d(e,n,i)),n}var s=function(e,t){if(v(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(m(t))return e.stylize(""+t,"number");if(g(t))return e.stylize(""+t,"boolean");if(y(t))return e.stylize("null","null")}(e,t);if(s)return s;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),S(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(t);if(0===o.length){if(T(t)){var c=t.name?": "+t.name:"";return e.stylize("[Function"+c+"]","special")}if(w(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(E(t))return e.stylize(Date.prototype.toString.call(t),"date");if(S(t))return f(t)}var u,l="",_=!1,A=["{","}"];(p(t)&&(_=!0,A=["[","]"]),T(t))&&(l=" [Function"+(t.name?": "+t.name:"")+"]");return w(t)&&(l=" "+RegExp.prototype.toString.call(t)),E(t)&&(l=" "+Date.prototype.toUTCString.call(t)),S(t)&&(l=" "+f(t)),0!==o.length||_&&0!=t.length?i<0?w(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=_?function(e,t,r,i,n){for(var s=[],o=0,a=t.length;o<a;++o)P(t,String(o))?s.push(h(e,t,r,i,String(o),!0)):s.push("");return n.forEach((function(n){n.match(/^\d+$/)||s.push(h(e,t,r,i,n,!0))})),s}(e,t,i,a,o):o.map((function(r){return h(e,t,i,a,r,_)})),e.seen.pop(),function(e,t,r){var i=0;return e.reduce((function(e,t){i++;if(t.indexOf("\n")>=0)i++;return e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}(u,l,A)):A[0]+l+A[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,r,i,n,s){var o,a,c;if((c=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),P(i,n)||(o="["+n+"]"),a||(e.seen.indexOf(c.value)<0?(a=y(r)?d(e,c.value,null):d(e,c.value,r-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")),v(o)){if(s&&n.match(/^\d+$/))return a;(o=JSON.stringify(""+n)).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 p(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function m(e){return"number"==typeof e}function b(e){return"string"==typeof e}function v(e){return void 0===e}function w(e){return _(e)&&"[object RegExp]"===A(e)}function _(e){return"object"==typeof e&&null!==e}function E(e){return _(e)&&"[object Date]"===A(e)}function S(e){return _(e)&&("[object Error]"===A(e)||e instanceof Error)}function T(e){return"function"==typeof e}function A(e){return Object.prototype.toString.call(e)}function k(e){return e<10?"0"+e.toString(10):e.toString(10)}r.debuglog=function(e){if(e=e.toUpperCase(),!o[e])if(a.test(e)){var t=i.pid;o[e]=function(){var i=r.format.apply(r,arguments);console.error("%s %d: %s",e,t,i)}}else o[e]=function(){};return o[e]},r.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"},r.types=e("./support/types"),r.isArray=p,r.isBoolean=g,r.isNull=y,r.isNullOrUndefined=function(e){return null==e},r.isNumber=m,r.isString=b,r.isSymbol=function(e){return"symbol"==typeof e},r.isUndefined=v,r.isRegExp=w,r.types.isRegExp=w,r.isObject=_,r.isDate=E,r.types.isDate=E,r.isError=S,r.types.isNativeError=S,r.isFunction=T,r.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},r.isBuffer=e("./support/isBuffer");var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function R(){var e=new Date,t=[k(e.getHours()),k(e.getMinutes()),k(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}r.log=function(){console.log("%s - %s",R(),r.format.apply(r,arguments))},r.inherits=e("inherits"),r._extend=function(e,t){if(!t||!_(t))return e;for(var r=Object.keys(t),i=r.length;i--;)e[r[i]]=t[r[i]];return e};var O="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function C(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}r.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(O&&e[O]){var t;if("function"!=typeof(t=e[O]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,O,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,i=new Promise((function(e,i){t=e,r=i})),n=[],s=0;s<arguments.length;s++)n.push(arguments[s]);n.push((function(e,i){e?r(e):t(i)}));try{e.apply(this,n)}catch(e){r(e)}return i}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),O&&Object.defineProperty(t,O,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,n(e))},r.promisify.custom=O,r.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function t(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var n=t.pop();if("function"!=typeof n)throw new TypeError("The last argument must be of type Function");var s=this,o=function(){return n.apply(s,arguments)};e.apply(this,t).then((function(e){i.nextTick(o.bind(null,null,e))}),(function(e){i.nextTick(C.bind(null,e,o))}))}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,n(e)),t}},{process:"bjUAi","./support/types":"7x1io","./support/isBuffer":"TyASC",inherits:"j5plK"}],"7x1io":[function(e,t,r){"use strict";var i=e("is-arguments"),n=e("is-generator-function"),s=e("which-typed-array"),o=e("is-typed-array");function a(e){return e.call.bind(e)}var c="undefined"!=typeof BigInt,u="undefined"!=typeof Symbol,l=a(Object.prototype.toString),d=a(Number.prototype.valueOf),f=a(String.prototype.valueOf),h=a(Boolean.prototype.valueOf);if(c)var p=a(BigInt.prototype.valueOf);if(u)var g=a(Symbol.prototype.valueOf);function y(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function m(e){return"[object Map]"===l(e)}function b(e){return"[object Set]"===l(e)}function v(e){return"[object WeakMap]"===l(e)}function w(e){return"[object WeakSet]"===l(e)}function _(e){return"[object ArrayBuffer]"===l(e)}function E(e){return"undefined"!=typeof ArrayBuffer&&(_.working?_(e):e instanceof ArrayBuffer)}function S(e){return"[object DataView]"===l(e)}function T(e){return"undefined"!=typeof DataView&&(S.working?S(e):e instanceof DataView)}r.isArgumentsObject=i,r.isGeneratorFunction=n,r.isTypedArray=o,r.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},r.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):o(e)||T(e)},r.isUint8Array=function(e){return"Uint8Array"===s(e)},r.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===s(e)},r.isUint16Array=function(e){return"Uint16Array"===s(e)},r.isUint32Array=function(e){return"Uint32Array"===s(e)},r.isInt8Array=function(e){return"Int8Array"===s(e)},r.isInt16Array=function(e){return"Int16Array"===s(e)},r.isInt32Array=function(e){return"Int32Array"===s(e)},r.isFloat32Array=function(e){return"Float32Array"===s(e)},r.isFloat64Array=function(e){return"Float64Array"===s(e)},r.isBigInt64Array=function(e){return"BigInt64Array"===s(e)},r.isBigUint64Array=function(e){return"BigUint64Array"===s(e)},m.working="undefined"!=typeof Map&&m(new Map),r.isMap=function(e){return"undefined"!=typeof Map&&(m.working?m(e):e instanceof Map)},b.working="undefined"!=typeof Set&&b(new Set),r.isSet=function(e){return"undefined"!=typeof Set&&(b.working?b(e):e instanceof Set)},v.working="undefined"!=typeof WeakMap&&v(new WeakMap),r.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(v.working?v(e):e instanceof WeakMap)},w.working="undefined"!=typeof WeakSet&&w(new WeakSet),r.isWeakSet=function(e){return w(e)},_.working="undefined"!=typeof ArrayBuffer&&_(new ArrayBuffer),r.isArrayBuffer=E,S.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&S(new DataView(new ArrayBuffer(1),0,1)),r.isDataView=T;var A="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function k(e){return"[object SharedArrayBuffer]"===l(e)}function I(e){return void 0!==A&&(void 0===k.working&&(k.working=k(new A)),k.working?k(e):e instanceof A)}function R(e){return y(e,d)}function P(e){return y(e,f)}function O(e){return y(e,h)}function C(e){return c&&y(e,p)}function j(e){return u&&y(e,g)}r.isSharedArrayBuffer=I,r.isAsyncFunction=function(e){return"[object AsyncFunction]"===l(e)},r.isMapIterator=function(e){return"[object Map Iterator]"===l(e)},r.isSetIterator=function(e){return"[object Set Iterator]"===l(e)},r.isGeneratorObject=function(e){return"[object Generator]"===l(e)},r.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===l(e)},r.isNumberObject=R,r.isStringObject=P,r.isBooleanObject=O,r.isBigIntObject=C,r.isSymbolObject=j,r.isBoxedPrimitive=function(e){return R(e)||P(e)||O(e)||C(e)||j(e)},r.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(E(e)||I(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(e){Object.defineProperty(r,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})}))},{"is-arguments":"e9OUu","is-generator-function":"7YEhx","which-typed-array":"A5R6f","is-typed-array":"5GGoW"}],e9OUu:[function(e,t,r){"use strict";var i=e("has-tostringtag/shams")(),n=e("call-bind/callBound")("Object.prototype.toString"),s=function(e){return!(i&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===n(e)},o=function(e){return!!s(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==n(e)&&"[object Function]"===n(e.callee)},a=function(){return s(arguments)}();s.isLegacyArguments=o,t.exports=a?s:o},{"has-tostringtag/shams":"5rcWo","call-bind/callBound":"1dGMo"}],"5rcWo":[function(e,t,r){"use strict";var i=e("has-symbols/shams");t.exports=function(){return i()&&!!Symbol.toStringTag}},{"has-symbols/shams":"9MVhZ"}],"9MVhZ":[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var i=Object.getOwnPropertySymbols(e);if(1!==i.length||i[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},{}],"1dGMo":[function(e,t,r){"use strict";var i=e("get-intrinsic"),n=e("./"),s=n(i("String.prototype.indexOf"));t.exports=function(e,t){var r=i(e,!!t);return"function"==typeof r&&s(e,".prototype.")>-1?n(r):r}},{"get-intrinsic":"hgNcX","./":"xRFOX"}],hgNcX:[function(e,t,r){"use strict";var i,n=SyntaxError,s=Function,o=TypeError,a=function(e){try{return s('"use strict"; return ('+e+").constructor;")()}catch(e){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(e){c=null}var u=function(){throw new o},l=c?function(){try{return u}catch(e){try{return c(arguments,"callee").get}catch(e){return u}}}():u,d=e("has-symbols")(),f=Object.getPrototypeOf||function(e){return e.__proto__},h={},p="undefined"==typeof Uint8Array?i:f(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":d?f([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":h,"%AsyncGenerator%":h,"%AsyncGeneratorFunction%":h,"%AsyncIteratorPrototype%":h,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":s,"%GeneratorFunction%":h,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":d?f(f([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&d?f((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&d?f((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":d?f(""[Symbol.iterator]()):i,"%Symbol%":d?Symbol:i,"%SyntaxError%":n,"%ThrowTypeError%":l,"%TypedArray%":p,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet},y=function e(t){var r;if("%AsyncFunction%"===t)r=a("async function () {}");else if("%GeneratorFunction%"===t)r=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=a("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&(r=f(n.prototype))}return g[t]=r,r},m={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},b=e("function-bind"),v=e("has"),w=b.call(Function.call,Array.prototype.concat),_=b.call(Function.apply,Array.prototype.splice),E=b.call(Function.call,String.prototype.replace),S=b.call(Function.call,String.prototype.slice),T=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,A=/\\(\\)?/g,k=function(e){var t=S(e,0,1),r=S(e,-1);if("%"===t&&"%"!==r)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new n("invalid intrinsic syntax, expected opening `%`");var i=[];return E(e,T,(function(e,t,r,n){i[i.length]=r?E(n,A,"$1"):t||e})),i},I=function(e,t){var r,i=e;if(v(m,i)&&(i="%"+(r=m[i])[0]+"%"),v(g,i)){var s=g[i];if(s===h&&(s=y(i)),void 0===s&&!t)throw new o("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:s}}throw new n("intrinsic "+e+" does not exist!")};t.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new o('"allowMissing" argument must be a boolean');var r=k(e),i=r.length>0?r[0]:"",s=I("%"+i+"%",t),a=s.name,u=s.value,l=!1,d=s.alias;d&&(i=d[0],_(r,w([0,1],d)));for(var f=1,h=!0;f<r.length;f+=1){var p=r[f],y=S(p,0,1),m=S(p,-1);if(('"'===y||"'"===y||"`"===y||'"'===m||"'"===m||"`"===m)&&y!==m)throw new n("property names with quotes must have matching quotes");if("constructor"!==p&&h||(l=!0),v(g,a="%"+(i+="."+p)+"%"))u=g[a];else if(null!=u){if(!(p in u)){if(!t)throw new o("base intrinsic for "+e+" exists, but the property is not available.");return}if(c&&f+1>=r.length){var b=c(u,p);u=(h=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:u[p]}else h=v(u,p),u=u[p];h&&!l&&(g[a]=u)}}return u}},{"has-symbols":"6NJIK","function-bind":"fm3P8",has:"a1vs2"}],"6NJIK":[function(e,t,r){"use strict";var i="undefined"!=typeof Symbol&&Symbol,n=e("./shams");t.exports=function(){return"function"==typeof i&&("function"==typeof Symbol&&("symbol"==typeof i("foo")&&("symbol"==typeof Symbol("bar")&&n())))}},{"./shams":"9MVhZ"}],fm3P8:[function(e,t,r){"use strict";var i=e("./implementation");t.exports=Function.prototype.bind||i},{"./implementation":"kD0YI"}],kD0YI:[function(e,t,r){"use strict";var i="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,s=Object.prototype.toString,o="[object Function]";t.exports=function(e){var t=this;if("function"!=typeof t||s.call(t)!==o)throw new TypeError(i+t);for(var r,a=n.call(arguments,1),c=function(){if(this instanceof r){var i=t.apply(this,a.concat(n.call(arguments)));return Object(i)===i?i:this}return t.apply(e,a.concat(n.call(arguments)))},u=Math.max(0,t.length-a.length),l=[],d=0;d<u;d++)l.push("$"+d);if(r=Function("binder","return function ("+l.join(",")+"){ return binder.apply(this,arguments); }")(c),t.prototype){var f=function(){};f.prototype=t.prototype,r.prototype=new f,f.prototype=null}return r}},{}],a1vs2:[function(e,t,r){"use strict";var i=e("function-bind");t.exports=i.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":"fm3P8"}],xRFOX:[function(e,t,r){"use strict";var i=e("function-bind"),n=e("get-intrinsic"),s=n("%Function.prototype.apply%"),o=n("%Function.prototype.call%"),a=n("%Reflect.apply%",!0)||i.call(o,s),c=n("%Object.getOwnPropertyDescriptor%",!0),u=n("%Object.defineProperty%",!0),l=n("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}t.exports=function(e){var t=a(i,o,arguments);if(c&&u){var r=c(t,"length");r.configurable&&u(t,"length",{value:1+l(0,e.length-(arguments.length-1))})}return t};var d=function(){return a(i,s,arguments)};u?u(t.exports,"apply",{value:d}):t.exports.apply=d},{"function-bind":"fm3P8","get-intrinsic":"hgNcX"}],"7YEhx":[function(e,t,r){"use strict";var i,n=Object.prototype.toString,s=Function.prototype.toString,o=/^\s*(?:function)?\*/,a=e("has-tostringtag/shams")(),c=Object.getPrototypeOf;t.exports=function(e){if("function"!=typeof e)return!1;if(o.test(s.call(e)))return!0;if(!a)return"[object GeneratorFunction]"===n.call(e);if(!c)return!1;if(void 0===i){var t=function(){if(!a)return!1;try{return Function("return function*() {}")()}catch(e){}}();i=!!t&&c(t)}return c(e)===i}},{"has-tostringtag/shams":"5rcWo"}],A5R6f:[function(e,t,r){var i=arguments[3],n=e("foreach"),s=e("available-typed-arrays"),o=e("call-bind/callBound"),a=o("Object.prototype.toString"),c=e("has-tostringtag/shams")(),u="undefined"==typeof globalThis?i:globalThis,l=s(),d=o("String.prototype.slice"),f={},h=e("es-abstract/helpers/getOwnPropertyDescriptor"),p=Object.getPrototypeOf;c&&h&&p&&n(l,(function(e){if("function"==typeof u[e]){var t=new u[e];if(Symbol.toStringTag in t){var r=p(t),i=h(r,Symbol.toStringTag);if(!i){var n=p(r);i=h(n,Symbol.toStringTag)}f[e]=i.get}}}));var g=function(e){var t=!1;return n(f,(function(r,i){if(!t)try{var n=r.call(e);n===i&&(t=n)}catch(e){}})),t},y=e("is-typed-array");t.exports=function(e){return!!y(e)&&(c&&Symbol.toStringTag in e?g(e):d(a(e),8,-1))}},{foreach:"aKWtH","available-typed-arrays":"8JQPQ","call-bind/callBound":"1dGMo","has-tostringtag/shams":"5rcWo","es-abstract/helpers/getOwnPropertyDescriptor":"5W76e","is-typed-array":"5GGoW"}],aKWtH:[function(e,t,r){var i=Object.prototype.hasOwnProperty,n=Object.prototype.toString;t.exports=function(e,t,r){if("[object Function]"!==n.call(t))throw new TypeError("iterator must be a function");var s=e.length;if(s===+s)for(var o=0;o<s;o++)t.call(r,e[o],o,e);else for(var a in e)i.call(e,a)&&t.call(r,e[a],a,e)}},{}],"8JQPQ":[function(e,t,r){var i=arguments[3],n=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],s="undefined"==typeof globalThis?i:globalThis;t.exports=function(){for(var e=[],t=0;t<n.length;t++)"function"==typeof s[n[t]]&&(e[e.length]=n[t]);return e}},{}],"5W76e":[function(e,t,r){"use strict";var i=e("get-intrinsic")("%Object.getOwnPropertyDescriptor%",!0);if(i)try{i([],"length")}catch(e){i=null}t.exports=i},{"get-intrinsic":"hgNcX"}],"5GGoW":[function(e,t,r){var i=arguments[3],n=e("foreach"),s=e("available-typed-arrays"),o=e("call-bind/callBound"),a=o("Object.prototype.toString"),c=e("has-tostringtag/shams")(),u="undefined"==typeof globalThis?i:globalThis,l=s(),d=o("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},f=o("String.prototype.slice"),h={},p=e("es-abstract/helpers/getOwnPropertyDescriptor"),g=Object.getPrototypeOf;c&&p&&g&&n(l,(function(e){var t=new u[e];if(Symbol.toStringTag in t){var r=g(t),i=p(r,Symbol.toStringTag);if(!i){var n=g(r);i=p(n,Symbol.toStringTag)}h[e]=i.get}}));var y=function(e){var t=!1;return n(h,(function(r,i){if(!t)try{t=r.call(e)===i}catch(e){}})),t};t.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!c||!(Symbol.toStringTag in e)){var t=f(a(e),8,-1);return d(l,t)>-1}return!!p&&y(e)}},{foreach:"aKWtH","available-typed-arrays":"8JQPQ","call-bind/callBound":"1dGMo","has-tostringtag/shams":"5rcWo","es-abstract/helpers/getOwnPropertyDescriptor":"5W76e"}],TyASC:[function(e,t,r){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],lVYRW:[function(e,t,r){"use strict";const{AbstractLevelDOWN:i}=e("abstract-leveldown"),n=e("inherits"),s=e("./deferred-iterator"),o=e("./deferred-chained-batch"),a=e("./util").getCallback,c=["put","get","getMany","del","batch","clear"],u=["approximateSize","compactRange"],l=Symbol("innerDb"),d=Symbol("operations"),f=Symbol("promise");function h(e){i.call(this,e.supports||{});for(const t of u)"function"!=typeof e[t]||this.supports.additionalMethods[t]||(this.supports.additionalMethods[t]=!0);this[l]=e,this[d]=[],function(e){const t=Object.keys(e.supports.additionalMethods);for(const r of c.concat(t))e[r]=function(...e){if("batch"===r&&0===e.length)return new o(this);if("open"===this.status)return this[l][r](...e);const t=a(e,f);return"opening"===this.status?this[d].push({method:r,args:e}):this._nextTick(t,new Error("Database is not open")),t[f]};e.iterator=function(e){if("open"===this.status)return this[l].iterator(e);if("opening"===this.status){const t=new s(this,e);return this[d].push({iterator:t}),t}throw new Error("Database is not open")};for(const t of c.concat(["iterator"]))e["_"+t]=function(){throw new Error("Did not expect private method to be called: "+t)}}(this)}n(h,i),h.prototype.type="deferred-leveldown",Object.defineProperty(h.prototype,"_db",{enumerable:!0,get(){return this[l]}}),h.prototype._open=function(e,t){const r=e=>{if(e||"open"!==this[l].status)return t(e||new Error("Database is not open"));const r=this[d];this[d]=[];for(const e of r)e.iterator?e.iterator.setDb(this[l]):this[l][e.method](...e.args);if(this[d].length>0)throw new Error("Did not expect further operations");t()};"new"===this[l].status||"closed"===this[l].status?this[l].open(e,r):this._nextTick(r)},h.prototype._close=function(e){this[l].close(e)},h.prototype._isOperational=function(){return"opening"===this.status},t.exports=h,t.exports.DeferredIterator=s},{"abstract-leveldown":"f3ZXE",inherits:"j5plK","./deferred-iterator":"35pXB","./deferred-chained-batch":"fHwIS","./util":"hJkDA"}],f3ZXE:[function(e,t,r){"use strict";r.AbstractLevelDOWN=e("./abstract-leveldown"),r.AbstractIterator=e("./abstract-iterator"),r.AbstractChainedBatch=e("./abstract-chained-batch")},{"./abstract-leveldown":"cguMf","./abstract-iterator":"lYFsd","./abstract-chained-batch":"hpfv2"}],cguMf:[function(e,t,r){"use strict";const i=e("level-supports"),n=e("is-buffer"),s=e("catering"),o=e("./abstract-iterator"),a=e("./abstract-chained-batch"),c=e("./lib/common").getCallback,u=e("./lib/common").getOptions,l=Object.prototype.hasOwnProperty,d=["lt","lte","gt","gte"];function f(e){this.status="new",this.supports=i(e,{status:!0})}function h(e,t){const r={};for(const i in t){if(!l.call(t,i))continue;if("start"===i||"end"===i)throw new Error('Legacy range options ("start" and "end") have been removed');let n=t[i];p(i)&&(n=e._serializeKey(n)),r[i]=n}return r}function p(e){return-1!==d.indexOf(e)}f.prototype.open=function(e,t){const r=this.status;if("function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("open() requires a callback argument");"object"==typeof e&&null!==e||(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,(e=>{if(e)return this.status=r,t(e);this.status="open",t()}))},f.prototype._open=function(e,t){this._nextTick(t)},f.prototype.close=function(e){const t=this.status;if("function"!=typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close((r=>{if(r)return this.status=t,e(r);this.status="closed",e()}))},f.prototype._close=function(e){this._nextTick(e)},f.prototype.get=function(e,t,r){if("function"==typeof t&&(r=t),"function"!=typeof r)throw new Error("get() requires a callback argument");const i=this._checkKey(e);if(i)return this._nextTick(r,i);e=this._serializeKey(e),"object"==typeof t&&null!==t||(t={}),t.asBuffer=!1!==t.asBuffer,this._get(e,t,r)},f.prototype._get=function(e,t,r){this._nextTick((function(){r(new Error("NotFound"))}))},f.prototype.getMany=function(e,t,r){if(r=c(t,r),r=s.fromCallback(r),t=u(t),function(e,t){if(!e.isOperational())return e._nextTick(t,new Error("Database is not open")),!0;return!1}(this,r))return r.promise;if(!Array.isArray(e))return this._nextTick(r,new Error("getMany() requires an array argument")),r.promise;if(0===e.length)return this._nextTick(r,null,[]),r.promise;"boolean"!=typeof t.asBuffer&&(t={...t,asBuffer:!0});const i=new Array(e.length);for(let t=0;t<e.length;t++){const n=e[t],s=this._checkKey(n);if(s)return this._nextTick(r,s),r.promise;i[t]=this._serializeKey(n)}return this._getMany(i,t,r),r.promise},f.prototype._getMany=function(e,t,r){this._nextTick(r,null,new Array(e.length).fill(void 0))},f.prototype.put=function(e,t,r,i){if("function"==typeof r&&(i=r),"function"!=typeof i)throw new Error("put() requires a callback argument");const n=this._checkKey(e)||this._checkValue(t);if(n)return this._nextTick(i,n);e=this._serializeKey(e),t=this._serializeValue(t),"object"==typeof r&&null!==r||(r={}),this._put(e,t,r,i)},f.prototype._put=function(e,t,r,i){this._nextTick(i)},f.prototype.del=function(e,t,r){if("function"==typeof t&&(r=t),"function"!=typeof r)throw new Error("del() requires a callback argument");const i=this._checkKey(e);if(i)return this._nextTick(r,i);e=this._serializeKey(e),"object"==typeof t&&null!==t||(t={}),this._del(e,t,r)},f.prototype._del=function(e,t,r){this._nextTick(r)},f.prototype.batch=function(e,t,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof t&&(r=t),"function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return this._nextTick(r,new Error("batch(array) requires an array argument"));if(0===e.length)return this._nextTick(r);"object"==typeof t&&null!==t||(t={});const i=new Array(e.length);for(let t=0;t<e.length;t++){if("object"!=typeof e[t]||null===e[t])return this._nextTick(r,new Error("batch(array) element must be an object and not `null`"));const n=Object.assign({},e[t]);if("put"!==n.type&&"del"!==n.type)return this._nextTick(r,new Error("`type` must be 'put' or 'del'"));const s=this._checkKey(n.key);if(s)return this._nextTick(r,s);if(n.key=this._serializeKey(n.key),"put"===n.type){const e=this._checkValue(n.value);if(e)return this._nextTick(r,e);n.value=this._serializeValue(n.value)}i[t]=n}this._batch(i,t,r)},f.prototype._batch=function(e,t,r){this._nextTick(r)},f.prototype.clear=function(e,t){if("function"==typeof e)t=e;else if("function"!=typeof t)throw new Error("clear() requires a callback argument");(e=h(this,e)).reverse=!!e.reverse,e.limit="limit"in e?e.limit:-1,this._clear(e,t)},f.prototype._clear=function(e,t){e.keys=!0,e.values=!1,e.keyAsBuffer=!0,e.valueAsBuffer=!0;const r=this._iterator(e),i={},n=e=>{if(e)return r.end((function(){t(e)}));r.next(((e,s)=>e?n(e):void 0===s?r.end(t):void this._del(s,i,n)))};n()},f.prototype._setupIteratorOptions=function(e){return(e=h(this,e)).reverse=!!e.reverse,e.keys=!1!==e.keys,e.values=!1!==e.values,e.limit="limit"in e?e.limit:-1,e.keyAsBuffer=!1!==e.keyAsBuffer,e.valueAsBuffer=!1!==e.valueAsBuffer,e},f.prototype.iterator=function(e){return"object"==typeof e&&null!==e||(e={}),e=this._setupIteratorOptions(e),this._iterator(e)},f.prototype._iterator=function(e){return new o(this)},f.prototype._chainedBatch=function(){return new a(this)},f.prototype._serializeKey=function(e){return e},f.prototype._serializeValue=function(e){return e},f.prototype._checkKey=function(e){return null==e?new Error("key cannot be `null` or `undefined`"):n(e)&&0===e.length?new Error("key cannot be an empty Buffer"):""===e?new Error("key cannot be an empty String"):Array.isArray(e)&&0===e.length?new Error("key cannot be an empty Array"):void 0},f.prototype._checkValue=function(e){if(null==e)return new Error("value cannot be `null` or `undefined`")},f.prototype.isOperational=function(){return"open"===this.status||this._isOperational()},f.prototype._isOperational=function(){return!1},f.prototype._nextTick=e("./next-tick"),t.exports=f},{"level-supports":"4gseK","is-buffer":"5yoKf",catering:"3yKZX","./abstract-iterator":"lYFsd","./abstract-chained-batch":"hpfv2","./lib/common":"aaqLC","./next-tick":"clHeC"}],"4gseK":[function(e,t,r){"use strict";function i(e){return!!e&&Object.assign({},e)}t.exports=function(...e){const t=e.reduce(((e,t)=>Object.assign(e,t)),{});return Object.assign(t,{bufferKeys:t.bufferKeys||!1,snapshots:t.snapshots||!1,permanence:t.permanence||!1,seek:t.seek||!1,clear:t.clear||!1,getMany:t.getMany||!1,keyIterator:t.keyIterator||!1,valueIterator:t.valueIterator||!1,iteratorNextv:t.iteratorNextv||!1,iteratorAll:t.iteratorAll||!1,status:t.status||!1,idempotentOpen:t.idempotentOpen||!1,passiveOpen:t.passiveOpen||!1,serialize:t.serialize||!1,createIfMissing:t.createIfMissing||!1,errorIfExists:t.errorIfExists||!1,deferredOpen:t.deferredOpen||!1,openCallback:t.openCallback||!1,promises:t.promises||!1,streams:t.streams||!1,encodings:i(t.encodings),events:i(t.events),additionalMethods:Object.assign({},t.additionalMethods)})}},{}],"5yoKf":[function(e,t,r){
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
t.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},{}],"3yKZX":[function(e,t,r){"use strict";var i=e("queue-tick");r.fromCallback=function(e,t){if(void 0===e){var r=new Promise((function(t,r){e=function(e,i){e?r(e):t(i)}}));e[void 0!==t?t:"promise"]=r}else if("function"!=typeof e)throw new TypeError("Callback must be a function");return e},r.fromPromise=function(e,t){if(void 0===t)return e;e.then((function(e){i((()=>t(null,e)))})).catch((function(e){i((()=>t(e)))}))}},{"queue-tick":"gJSe0"}],gJSe0:[function(e,t,r){t.exports="function"==typeof queueMicrotask?queueMicrotask:e=>Promise.resolve().then(e)},{}],lYFsd:[function(e,t,r){"use strict";function i(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}i.prototype.next=function(e){let t=this;if(void 0===e)t=new Promise((function(t,r){e=function(e,i,n){e?r(e):void 0===i&&void 0===n?t():t([i,n])}}));else if("function"!=typeof e)throw new Error("next() requires a callback argument");return this._ended?(this._nextTick(e,new Error("cannot call next() after end()")),t):this._nexting?(this._nextTick(e,new Error("cannot call next() before previous next() has completed")),t):(this._nexting=!0,this._next(((t,...r)=>{this._nexting=!1,e(t,...r)})),t)},i.prototype._next=function(e){this._nextTick(e)},i.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},i.prototype._seek=function(e){},i.prototype.end=function(e){let t;if(void 0===e)t=new Promise((function(t,r){e=function(e){e?r(e):t()}}));else if("function"!=typeof e)throw new Error("end() requires a callback argument");return this._ended?(this._nextTick(e,new Error("end() already called on iterator")),t):(this._ended=!0,this._end(e),t)},i.prototype._end=function(e){this._nextTick(e)},i.prototype[Symbol.asyncIterator]=async function*(){try{let e;for(;void 0!==(e=await this.next());)yield e}finally{this._ended||await this.end()}},i.prototype._nextTick=e("./next-tick"),t.exports=i},{"./next-tick":"clHeC"}],clHeC:[function(e,t,r){"use strict";const i=e("queue-microtask");t.exports=function(e,...t){0===t.length?i(e):i((()=>e(...t)))}},{"queue-microtask":"3aIgO"}],"3aIgO":[function(e,t,r){var i=arguments[3];
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */let n;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:i):e=>(n||(n=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)))},{}],hpfv2:[function(e,t,r){"use strict";const i=Object.freeze({});function n(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}n.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},n.prototype.put=function(e,t,r){this._checkWritten();const n=this.db._checkKey(e)||this.db._checkValue(t);if(n)throw n;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t,null!=r?r:i),this},n.prototype._put=function(e,t,r){this._operations.push({...r,type:"put",key:e,value:t})},n.prototype.del=function(e,t){this._checkWritten();const r=this.db._checkKey(e);if(r)throw r;return e=this.db._serializeKey(e),this._del(e,null!=t?t:i),this},n.prototype._del=function(e,t){this._operations.push({...t,type:"del",key:e})},n.prototype.clear=function(){return this._checkWritten(),this._clear(),this},n.prototype._clear=function(){this._operations=[]},n.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},n.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},n.prototype._nextTick=e("./next-tick"),t.exports=n},{"./next-tick":"clHeC"}],aaqLC:[function(e,t,r){"use strict";r.getCallback=function(e,t){return"function"==typeof e?e:t},r.getOptions=function(e){return"object"==typeof e&&null!==e?e:{}}},{}],"35pXB":[function(e,t,r){"use strict";const{AbstractIterator:i}=e("abstract-leveldown"),n=e("inherits"),s=e("./util").getCallback,o=Symbol("options"),a=Symbol("iterator"),c=Symbol("operations"),u=Symbol("promise");function l(e,t){i.call(this,e),this[o]=t,this[a]=null,this[c]=[]}n(l,i),l.prototype.setDb=function(e){this[a]=e.iterator(this[o]);for(const e of this[c].splice(0,this[c].length))this[a][e.method](...e.args)},l.prototype.next=function(...e){if("open"===this.db.status)return this[a].next(...e);const t=s(e,u,(function(e,t){return void 0===e&&void 0===t?void 0:[e,t]}));return"opening"===this.db.status?this[c].push({method:"next",args:e}):this._nextTick(t,new Error("Database is not open")),t[u]||this},l.prototype.seek=function(...e){if("open"===this.db.status)this[a].seek(...e);else{if("opening"!==this.db.status)throw new Error("Database is not open");this[c].push({method:"seek",args:e})}},l.prototype.end=function(...e){if("open"===this.db.status)return this[a].end(...e);const t=s(e,u);return"opening"===this.db.status?this[c].push({method:"end",args:e}):this._nextTick(t,new Error("Database is not open")),t[u]||this};for(const e of["next","seek","end"])l.prototype["_"+e]=function(){throw new Error("Did not expect private method to be called: "+e)};t.exports=l},{"abstract-leveldown":"f3ZXE",inherits:"j5plK","./util":"hJkDA"}],hJkDA:[function(e,t,r){"use strict";r.getCallback=function(e,t,r){let i=e[e.length-1];if("function"!=typeof i){const n=new Promise(((t,n)=>{e.push(i=function(e,...i){e?n(e):t(r?r(...i):i[0])})}));i[t]=n}return i}},{}],fHwIS:[function(e,t,r){"use strict";const{AbstractChainedBatch:i}=e("abstract-leveldown"),n=Symbol("operations");t.exports=class extends i{constructor(e){super(e),this[n]=[]}_put(e,t,r){this[n].push({...r,type:"put",key:e,value:t})}_del(e,t){this[n].push({...t,type:"del",key:e})}_clear(){this[n]=[]}_write(e,t){this.db.batch(this[n],e,t)}}},{"abstract-leveldown":"f3ZXE"}],"284tK":[function(e,t,r){"use strict";const i=e("inherits"),{Readable:n}=e("readable-stream");function s(e,t){if(!(this instanceof s))return new s(e,t);t=t||{},n.call(this,Object.assign({},t,{objectMode:!0})),this._iterator=e,this._options=t,this.on("end",this.destroy.bind(this,null,null))}t.exports=s,i(s,n),s.prototype._read=function(){this.destroyed||this._iterator.next(((e,t,r)=>{if(!this.destroyed)return e?this.destroy(e):void(void 0===t&&void 0===r?this.push(null):!1!==this._options.keys&&!1===this._options.values?this.push(t):!1===this._options.keys&&!1!==this._options.values?this.push(r):this.push({key:t,value:r}))}))},s.prototype._destroy=function(e,t){this._iterator.end((function(r){t(e||r)}))}},{inherits:"j5plK","readable-stream":"w0M38"}],w0M38:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_readable.js":"hUJUV","./lib/_stream_writable.js":"5EyvX","./lib/_stream_duplex.js":"bbfLz","./lib/_stream_transform.js":"9ioV2","./lib/_stream_passthrough.js":"8DY2M","./lib/internal/streams/end-of-stream.js":"6WyPU","./lib/internal/streams/pipeline.js":"7zSdy"}],hUJUV:[function(e,t,r){var i,n=e("process"),s=arguments[3];t.exports=O,O.ReadableState=P;e("events").EventEmitter;var o=function(e,t){return e.listeners(t).length},a=e("./internal/streams/stream"),c=e("buffer").Buffer,u=s.Uint8Array||function(){};function l(e){return c.from(e)}function d(e){return c.isBuffer(e)||e instanceof u}var f,h=e("util");f=h&&h.debuglog?h.debuglog("stream"):function(){};var p,g,y,m=e("./internal/streams/buffer_list"),b=e("./internal/streams/destroy"),v=e("./internal/streams/state"),w=v.getHighWaterMark,_=e("../errors").codes,E=_.ERR_INVALID_ARG_TYPE,S=_.ERR_STREAM_PUSH_AFTER_EOF,T=_.ERR_METHOD_NOT_IMPLEMENTED,A=_.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e("inherits")(O,a);var k=b.errorOrDestroy,I=["error","close","destroy","pause","resume"];function R(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function P(t,r,n){i=i||e("./_stream_duplex"),t=t||{},"boolean"!=typeof n&&(n=r instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=w(this,t,"readableHighWaterMark",n),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=e("string_decoder/").StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function O(t){if(i=i||e("./_stream_duplex"),!(this instanceof O))return new O(t);var r=this instanceof i;this._readableState=new P(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function C(e,t,r,i,n){f("readableAddChunk",t);var s,o=e._readableState;if(null===t)o.reading=!1,L(e,o);else if(n||(s=D(o,t)),s)k(e,s);else if(o.objectMode||t&&t.length>0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=l(t)),i)o.endEmitted?k(e,new A):j(e,o,t,!0);else if(o.ended)k(e,new S);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?j(e,o,t,!1):F(e,o)):j(e,o,t,!1)}else i||(o.reading=!1,F(e,o));return!o.ended&&(o.length<o.highWaterMark||0===o.length)}function j(e,t,r,i){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&N(e)),F(e,t)}function D(e,t){var r;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new E("chunk",["string","Buffer","Uint8Array"],t)),r}Object.defineProperty(O.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),O.prototype.destroy=b.destroy,O.prototype._undestroy=b.undestroy,O.prototype._destroy=function(e,t){t(e)},O.prototype.push=function(e,t){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=c.from(e,t),t=""),r=!0),C(this,e,t,!1,r)},O.prototype.unshift=function(e){return C(this,e,null,!0,!1)},O.prototype.isPaused=function(){return!1===this._readableState.flowing},O.prototype.setEncoding=function(t){p||(p=e("string_decoder/").StringDecoder);var r=new p(t);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var i=this._readableState.buffer.head,n="";null!==i;)n+=r.write(i.data),i=i.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var M=1073741824;function x(e){return e>=M?e=M:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function B(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=x(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function L(e,t){if(f("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?N(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,U(e)))}}function N(e){var t=e._readableState;f("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(f("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(U,e))}function U(e){var t=e._readableState;f("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,$(e)}function F(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(K,e,t))}function K(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(f("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function z(e){return function(){var t=e._readableState;f("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,$(e))}}function V(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function q(e){f("readable nexttick read 0"),e.read(0)}function G(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(H,e,t))}function H(e,t){f("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),$(e),t.flowing&&!t.reading&&e.read(0)}function $(e){var t=e._readableState;for(f("flow",t.flowing);t.flowing&&null!==e.read(););}function W(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function Y(e){var t=e._readableState;f("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(X,t,e))}function X(e,t){if(f("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function Z(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}O.prototype.read=function(e){f("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return f("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Y(this):N(this),null;if(0===(e=B(e,t))&&t.ended)return 0===t.length&&Y(this),null;var i,n=t.needReadable;return f("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&f("length less than watermark",n=!0),t.ended||t.reading?f("reading or ended",n=!1):n&&(f("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=B(r,t))),null===(i=e>0?W(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&Y(this)),null!==i&&this.emit("data",i),i},O.prototype._read=function(e){k(this,new T("_read()"))},O.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,f("pipe count=%d opts=%j",i.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?c:y;function a(t,n){f("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,f("cleanup"),e.removeListener("close",p),e.removeListener("finish",g),e.removeListener("drain",u),e.removeListener("error",h),e.removeListener("unpipe",a),r.removeListener("end",c),r.removeListener("end",y),r.removeListener("data",d),l=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}function c(){f("onend"),e.end()}i.endEmitted?n.nextTick(s):r.once("end",s),e.on("unpipe",a);var u=z(r);e.on("drain",u);var l=!1;function d(t){f("ondata");var n=e.write(t);f("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==Z(i.pipes,e))&&!l&&(f("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function h(t){f("onerror",t),y(),e.removeListener("error",h),0===o(e,"error")&&k(e,t)}function p(){e.removeListener("finish",g),y()}function g(){f("onfinish"),e.removeListener("close",p),y()}function y(){f("unpipe"),r.unpipe(e)}return r.on("data",d),R(e,"error",h),e.once("close",p),e.once("finish",g),e.emit("pipe",r),i.flowing||(f("pipe resume"),r.resume()),e},O.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<n;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=Z(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},O.prototype.on=function(e,t){var r=a.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,f("on readable",i.length,i.reading),i.length?N(this):i.reading||n.nextTick(q,this))),r},O.prototype.addListener=O.prototype.on,O.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(V,this),r},O.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(V,this),t},O.prototype.resume=function(){var e=this._readableState;return e.flowing||(f("resume"),e.flowing=!e.readableListening,G(this,e)),e.paused=!1,this},O.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},O.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;for(var n in e.on("end",(function(){if(f("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(f("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(i=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var s=0;s<I.length;s++)e.on(I[s],this.emit.bind(this,I[s]));return this._read=function(t){f("wrapped _read",t),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(O.prototype[Symbol.asyncIterator]=function(){return void 0===g&&(g=e("./internal/streams/async_iterator")),g(this)}),Object.defineProperty(O.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(O.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(O.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),O._fromList=W,Object.defineProperty(O.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(O.from=function(t,r){return void 0===y&&(y=e("./internal/streams/from")),y(O,t,r)})},{process:"bjUAi",events:"g82pp","./internal/streams/stream":"WXKP8",buffer:"etowf",util:"lHksA","./internal/streams/buffer_list":"7tlwE","./internal/streams/destroy":"hWarO","./internal/streams/state":"kof1d","../errors":"7Ny4a",inherits:"j5plK","./_stream_duplex":"bbfLz","string_decoder/":"cHJFU","./internal/streams/async_iterator":"deb8T","./internal/streams/from":"64tCr"}],WXKP8:[function(e,t,r){t.exports=e("events").EventEmitter},{events:"g82pp"}],"7tlwE":[function(e,t,r){"use strict";function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var o=e("buffer").Buffer,a=e("util").inspect,c=a&&a.custom||"inspect";t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r,u;return t=e,r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,r,i,n=o.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=n,i=a,o.prototype.copy.call(t,r,i),a+=s.data.length,s=s.next;return n}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,i=t.data;for(e-=i.length;t=t.next;){var n=t.data,s=e>n.length?n.length:e;if(s===n.length?i+=n:i+=n.slice(0,e),0==(e-=s)){s===n.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=n.slice(s));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),r=this.head,i=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var n=r.data,s=e>n.length?n.length:e;if(n.copy(t,t.length-e,0,s),0==(e-=s)){s===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(s));break}++i}return this.length-=i,t}},{key:c,value:function(e,t){return a(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}],r&&s(t.prototype,r),u&&s(t,u),e}()},{buffer:"etowf",util:"lHksA"}],hWarO:[function(e,t,r){var i=e("process");function n(e,t){o(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function o(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,i.nextTick(o,this,e)):i.nextTick(o,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?i.nextTick(s,r):(r._writableState.errorEmitted=!0,i.nextTick(n,r,e)):i.nextTick(n,r,e):t?(i.nextTick(s,r),t(e)):i.nextTick(s,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}}},{process:"bjUAi"}],kof1d:[function(e,t,r){"use strict";var i=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,r,n){var s=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new i(n?r:"highWaterMark",s);return Math.floor(s)}return e.objectMode?16:16384}}},{"../../../errors":"7Ny4a"}],"7Ny4a":[function(e,t,r){"use strict";var i={};function n(e,t,r){r||(r=Error);var n=function(e){var r,i;function n(r,i,n){return e.call(this,function(e,r,i){return"string"==typeof t?t:t(e,r,i)}(r,i,n))||this}return i=e,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,n}(r);n.prototype.name=r.name,n.prototype.code=e,i[e]=n}function s(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}n("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,n,o,a;if("string"==typeof t&&(n="not ",t.substr(!o||o<0?0:+o,n.length)===n)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))a="The ".concat(e," ").concat(i," ").concat(s(t,"type"));else{var c=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(c," ").concat(i," ").concat(s(t,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},{}],bbfLz:[function(e,t,r){var i=e("process"),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=l;var s=e("./_stream_readable"),o=e("./_stream_writable");e("inherits")(l,s);for(var a=n(o.prototype),c=0;c<a.length;c++){var u=a[c];l.prototype[u]||(l.prototype[u]=o.prototype[u])}function l(e){if(!(this instanceof l))return new l(e);s.call(this,e),o.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",d)))}function d(){this._writableState.ended||i.nextTick(f,this)}function f(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},{process:"bjUAi","./_stream_readable":"hUJUV","./_stream_writable":"5EyvX",inherits:"j5plK"}],"5EyvX":[function(e,t,r){var i,n=arguments[3],s=e("process");function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){H(t,e)}}t.exports=P,P.WritableState=R;var a={deprecate:e("util-deprecate")},c=e("./internal/streams/stream"),u=e("buffer").Buffer,l=n.Uint8Array||function(){};function d(e){return u.from(e)}function f(e){return u.isBuffer(e)||e instanceof l}var h,p=e("./internal/streams/destroy"),g=e("./internal/streams/state"),y=g.getHighWaterMark,m=e("../errors").codes,b=m.ERR_INVALID_ARG_TYPE,v=m.ERR_METHOD_NOT_IMPLEMENTED,w=m.ERR_MULTIPLE_CALLBACK,_=m.ERR_STREAM_CANNOT_PIPE,E=m.ERR_STREAM_DESTROYED,S=m.ERR_STREAM_NULL_VALUES,T=m.ERR_STREAM_WRITE_AFTER_END,A=m.ERR_UNKNOWN_ENCODING,k=p.errorOrDestroy;function I(){}function R(t,r,n){i=i||e("./_stream_duplex"),t=t||{},"boolean"!=typeof n&&(n=r instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=y(this,t,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){L(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function P(t){var r=this instanceof(i=i||e("./_stream_duplex"));if(!r&&!h.call(P,this))return new P(t);this._writableState=new R(t,this,r),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),c.call(this)}function O(e,t){var r=new T;k(e,r),s.nextTick(t,r)}function C(e,t,r,i){var n;return null===r?n=new S:"string"==typeof r||t.objectMode||(n=new b("chunk",["string","Buffer"],r)),!n||(k(e,n),s.nextTick(i,n),!1)}function j(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,r)),t}function D(e,t,r,i,n,s){if(!r){var o=j(t,i,n);i!==o&&(r=!0,n="buffer",i=o)}var a=t.objectMode?1:i.length;t.length+=a;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:s,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else M(e,t,!1,a,i,n,s);return c}function M(e,t,r,i,n,s,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new E("write")):r?e._writev(n,t.onwrite):e._write(n,s,t.onwrite),t.sync=!1}function x(e,t,r,i,n){--t.pendingcb,r?(s.nextTick(n,i),s.nextTick(q,e,t),e._writableState.errorEmitted=!0,k(e,i)):(n(i),e._writableState.errorEmitted=!0,k(e,i),q(e,t))}function B(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function L(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if("function"!=typeof n)throw new w;if(B(r),t)x(e,r,i,t,n);else{var o=K(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||F(e,r),i?s.nextTick(N,e,r,o,n):N(e,r,o,n)}}function N(e,t,r,i){r||U(e,t),t.pendingcb--,i(),q(e,t)}function U(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function F(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),s=t.corkedRequestsFree;s.entry=r;for(var a=0,c=!0;r;)n[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;n.allBuffers=c,M(e,t,!0,t.length,n,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,l=r.encoding,d=r.callback;if(M(e,t,!1,t.objectMode?1:u.length,u,l,d),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function K(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function z(e,t){e._final((function(r){t.pendingcb--,r&&k(e,r),t.prefinished=!0,e.emit("prefinish"),q(e,t)}))}function V(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,s.nextTick(z,e,t)))}function q(e,t){var r=K(t);if(r&&(V(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return r}function G(e,t,r){t.ending=!0,q(e,t),r&&(t.finished?s.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function H(e,t,r){var i=e.entry;for(e.entry=null;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}e("inherits")(P,c),R.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(R.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(P,Symbol.hasInstance,{value:function(e){return!!h.call(this,e)||this===P&&(e&&e._writableState instanceof R)}})):h=function(e){return e instanceof this},P.prototype.pipe=function(){k(this,new _)},P.prototype.write=function(e,t,r){var i=this._writableState,n=!1,s=!i.objectMode&&f(e);return s&&!u.isBuffer(e)&&(e=d(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=I),i.ending?O(this,r):(s||C(this,i,e,r))&&(i.pendingcb++,n=D(this,i,s,e,t,r)),n},P.prototype.cork=function(){this._writableState.corked++},P.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||F(this,e))},P.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new A(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(P.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(P.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),P.prototype._write=function(e,t,r){r(new v("_write()"))},P.prototype._writev=null,P.prototype.end=function(e,t,r){var i=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||G(this,i,r),this},Object.defineProperty(P.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(P.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),P.prototype.destroy=p.destroy,P.prototype._undestroy=p.undestroy,P.prototype._destroy=function(e,t){t(e)}},{process:"bjUAi","util-deprecate":"3zH8r","./internal/streams/stream":"WXKP8",buffer:"etowf","./internal/streams/destroy":"hWarO","./internal/streams/state":"kof1d","../errors":"7Ny4a",inherits:"j5plK","./_stream_duplex":"bbfLz"}],"3zH8r":[function(e,t,r){var i=arguments[3];function n(e,t){if(s("noDeprecation"))return e;var r=!1;return function(){if(!r){if(s("throwDeprecation"))throw new Error(t);s("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}function s(e){try{if(!i.localStorage)return!1}catch(e){return!1}var t=i.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}t.exports=n},{}],cHJFU:[function(e,t,r){"use strict";var i=e("safe-buffer").Buffer,n=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=d,t=3;break;default:return this.write=f,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"<22>";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"<22>";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"<22>"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}r.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"<22>":t},s.prototype.text=function(e,t){var r=function(e,t,r){var i=t.length-1;if(i<r)return 0;var n=o(t[i]);if(n>=0)return n>0&&(e.lastNeed=n-1),n;if(--i<r||-2===n)return 0;if((n=o(t[i]))>=0)return n>0&&(e.lastNeed=n-2),n;if(--i<r||-2===n)return 0;if((n=o(t[i]))>=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":"2ZY92"}],"2ZY92":[function(e,t,r){
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var i=e("buffer"),n=i.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(s(i,r),r.Buffer=o),o.prototype=Object.create(n.prototype),s(n,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},{buffer:"etowf"}],deb8T:[function(e,t,r){var i,n=e("process");function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=e("./end-of-stream"),a=Symbol("lastResolve"),c=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),d=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function p(e,t){return{value:e,done:t}}function g(e){var t=e[a];if(null!==t){var r=e[h].read();null!==r&&(e[d]=null,e[a]=null,e[c]=null,t(p(r,!1)))}}function y(e){n.nextTick(g,e)}var m=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((s(i={get stream(){return this[h]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(p(void 0,!0));if(this[h].destroyed)return new Promise((function(t,r){n.nextTick((function(){e[u]?r(e[u]):t(p(void 0,!0))}))}));var r,i=this[d];if(i)r=new Promise(function(e,t){return function(r,i){e.then((function(){t[l]?r(p(void 0,!0)):t[f](r,i)}),i)}}(i,this));else{var s=this[h].read();if(null!==s)return Promise.resolve(p(s,!1));r=new Promise(this[f])}return this[d]=r,r}},Symbol.asyncIterator,(function(){return this})),s(i,"return",(function(){var e=this;return new Promise((function(t,r){e[h].destroy(null,(function(e){e?r(e):t(p(void 0,!0))}))}))})),i),m);t.exports=function(e){var t,r=Object.create(b,(s(t={},h,{value:e,writable:!0}),s(t,a,{value:null,writable:!0}),s(t,c,{value:null,writable:!0}),s(t,u,{value:null,writable:!0}),s(t,l,{value:e._readableState.endEmitted,writable:!0}),s(t,f,{value:function(e,t){var i=r[h].read();i?(r[d]=null,r[a]=null,r[c]=null,e(p(i,!1))):(r[a]=e,r[c]=t)},writable:!0}),t));return r[d]=null,o(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[c];return null!==t&&(r[d]=null,r[a]=null,r[c]=null,t(e)),void(r[u]=e)}var i=r[a];null!==i&&(r[d]=null,r[a]=null,r[c]=null,i(p(void 0,!0))),r[l]=!0})),e.on("readable",y.bind(null,r)),r}},{process:"bjUAi","./end-of-stream":"6WyPU"}],"6WyPU":[function(e,t,r){"use strict";var i=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function n(){}t.exports=function e(t,r,s){if("function"==typeof r)return e(t,null,r);r||(r={}),s=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];e.apply(this,i)}}}(s||n);var o=r.readable||!1!==r.readable&&t.readable,a=r.writable||!1!==r.writable&&t.writable,c=function(){t.writable||l()},u=t._writableState&&t._writableState.finished,l=function(){a=!1,u=!0,o||s.call(t)},d=t._readableState&&t._readableState.endEmitted,f=function(){o=!1,d=!0,a||s.call(t)},h=function(e){s.call(t,e)},p=function(){var e;return o&&!d?(t._readableState&&t._readableState.ended||(e=new i),s.call(t,e)):a&&!u?(t._writableState&&t._writableState.ended||(e=new i),s.call(t,e)):void 0},g=function(){t.req.on("finish",l)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?a&&!t._writableState&&(t.on("end",c),t.on("close",c)):(t.on("complete",l),t.on("abort",p),t.req?g():t.on("request",g)),t.on("end",f),t.on("finish",l),!1!==r.error&&t.on("error",h),t.on("close",p),function(){t.removeListener("complete",l),t.removeListener("abort",p),t.removeListener("request",g),t.req&&t.req.removeListener("finish",l),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",l),t.removeListener("end",f),t.removeListener("error",h),t.removeListener("close",p)}}},{"../../../errors":"7Ny4a"}],"64tCr":[function(e,t,r){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],"9ioV2":[function(e,t,r){"use strict";t.exports=l;var i=e("../errors").codes,n=i.ERR_METHOD_NOT_IMPLEMENTED,s=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=i.ERR_TRANSFORM_WITH_LENGTH_0,c=e("./_stream_duplex");function u(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new s);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function l(e){if(!(this instanceof l))return new l(e);c.call(this,e),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",d)}function d(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?f(this,null,null):this._flush((function(t,r){f(e,t,r)}))}function f(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new a;if(e._transformState.transforming)throw new o;return e.push(null)}e("inherits")(l,c),l.prototype.push=function(e,t){return this._transformState.needTransform=!1,c.prototype.push.call(this,e,t)},l.prototype._transform=function(e,t,r){r(new n("_transform()"))},l.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},l.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},l.prototype._destroy=function(e,t){c.prototype._destroy.call(this,e,(function(e){t(e)}))}},{"../errors":"7Ny4a","./_stream_duplex":"bbfLz",inherits:"j5plK"}],"8DY2M":[function(e,t,r){"use strict";t.exports=n;var i=e("./_stream_transform");function n(e){if(!(this instanceof n))return new n(e);i.call(this,e)}e("inherits")(n,i),n.prototype._transform=function(e,t,r){r(null,e)}},{"./_stream_transform":"9ioV2",inherits:"j5plK"}],"7zSdy":[function(e,t,r){"use strict";var i;var n=e("../../../errors").codes,s=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function c(t,r,n,s){s=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(s);var a=!1;t.on("close",(function(){a=!0})),void 0===i&&(i=e("./end-of-stream")),i(t,{readable:r,writable:n},(function(e){if(e)return s(e);a=!0,s()}));var c=!1;return function(e){if(!a&&!c)return c=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void s(e||new o("pipe"))}}function u(e){e()}function l(e,t){return e.pipe(t)}function d(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}t.exports=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i,n=d(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new s("streams");var o=t.map((function(e,r){var s=r<t.length-1;return c(e,s,r>0,(function(e){i||(i=e),e&&o.forEach(u),s||(o.forEach(u),n(i))}))}));return t.reduce(l)}},{"../../../errors":"7Ny4a","./end-of-stream":"6WyPU"}],"8aV2Q":[function(e,t,r){"use strict";const i=e("level-errors").WriteError,n=e("catering"),s=e("./common").getCallback,o=e("./common").getOptions;function a(e){this.db=e,this.batch=e.db.batch(),this.ops=[],this.length=0}a.prototype.put=function(e,t,r){try{this.batch.put(e,t,r)}catch(e){throw new i(e)}return this.ops.push({...r,type:"put",key:e,value:t}),this.length++,this},a.prototype.del=function(e,t){try{this.batch.del(e,t)}catch(e){throw new i(e)}return this.ops.push({...t,type:"del",key:e}),this.length++,this},a.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new i(e)}return this.ops=[],this.length=0,this},a.prototype.write=function(e,t){const r=this.db,a=this.ops;t=s(e,t),t=n.fromCallback(t),e=o(e);try{this.batch.write(e,(function(e){if(e)return t(new i(e));r.emit("batch",a),t()}))}catch(e){throw new i(e)}return t.promise},t.exports=a},{"level-errors":"iLFVA",catering:"3yKZX","./common":"4WQgu"}],iLFVA:[function(e,t,r){"use strict";function i(e,t){const r=function(t,i){if("object"==typeof t&&null!==t&&(i=i||t,t=t.message||t.name),t=t||"","object"==typeof(i=i||void 0)&&i.type===e&&i.message===t)return i;Object.defineProperty(this,"type",{value:e,enumerable:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"name",{value:e,enumerable:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"cause",{value:i,enumerable:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"message",{value:t,enumerable:!1,writable:!0,configurable:!0}),Error.call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,r)};return r.prototype=new t,r}const n=i("LevelUPError",Error);t.exports={LevelUPError:n,InitializationError:i("InitializationError",n),OpenError:i("OpenError",n),ReadError:i("ReadError",n),WriteError:i("WriteError",n),NotFoundError:i("NotFoundError",n),EncodingError:i("EncodingError",n)},t.exports.NotFoundError.prototype.notFound=!0,t.exports.NotFoundError.prototype.status=404},{}],"4WQgu":[function(e,t,r){"use strict";r.getCallback=function(e,t){return"function"==typeof e?e:t},r.getOptions=function(e){return"object"==typeof e&&null!==e?e:{}}},{}],"8xl4Y":[function(e,t,r){"use strict";const i=e("queue-microtask");t.exports=function(e,...t){0===t.length?i(e):i((()=>e(...t)))}},{"queue-microtask":"3aIgO"}],eMHkk:[function(e,t,r){"use strict";const i=e("abstract-leveldown").AbstractLevelDOWN,n=e("abstract-leveldown").AbstractChainedBatch,s=e("abstract-leveldown").AbstractIterator,o=e("inherits"),a=e("level-codec"),c=e("level-errors").EncodingError,u=["approximateSize","compactRange"];function l(e,t){if(!(this instanceof l))return new l(e,t);const r=e.supports||{},n=r.additionalMethods||{};i.call(this,r),this.supports.encodings=!0,this.supports.additionalMethods={},u.forEach((function(t){const r="function"==typeof e[t];(n[t]||r)&&(this.supports.additionalMethods[t]=!0,this[t]=function(e,r,i,n){return e=this.codec.encodeKey(e,i),r=this.codec.encodeKey(r,i),this.db[t](e,r,i,n)})}),this),void 0===(t=t||{}).keyEncoding&&(t.keyEncoding="utf8"),void 0===t.valueEncoding&&(t.valueEncoding="utf8"),this.db=e,this.codec=new a(t)}function d(e,t){s.call(this,e),this.codec=e.codec,this.keys=t.keys,this.values=t.values,this.opts=this.codec.encodeLtgt(t),this.it=e.db.iterator(this.opts)}function f(e,t){n.call(this,e),this.codec=e.codec,this.batch=e.db.batch()}t.exports=l,o(l,i),l.prototype.type="encoding-down",l.prototype._serializeKey=l.prototype._serializeValue=function(e){return e},l.prototype._open=function(e,t){this.db.open(e,t)},l.prototype._close=function(e){this.db.close(e)},l.prototype._put=function(e,t,r,i){e=this.codec.encodeKey(e,r),t=this.codec.encodeValue(t,r),this.db.put(e,t,r,i)},l.prototype._get=function(e,t,r){e=this.codec.encodeKey(e,t),t.asBuffer=this.codec.valueAsBuffer(t),this.db.get(e,t,((e,i)=>{if(e)return r(e);try{i=this.codec.decodeValue(i,t)}catch(e){return r(new c(e))}r(null,i)}))},l.prototype._getMany=function(e,t,r){e=e.map((e=>this.codec.encodeKey(e,t))),t.asBuffer=this.codec.valueAsBuffer(t),this.db.getMany(e,t,((e,i)=>{if(e)return r(e);const n=new Array(i.length);for(let s=0;s<i.length;s++)if(void 0!==i[s])try{n[s]=this.codec.decodeValue(i[s],t)}catch(e){return r(new c(e))}else n[s]=void 0;r(null,n)}))},l.prototype._del=function(e,t,r){e=this.codec.encodeKey(e,t),this.db.del(e,t,r)},l.prototype._chainedBatch=function(){return new f(this)},l.prototype._batch=function(e,t,r){e=this.codec.encodeBatch(e,t),this.db.batch(e,t,r)},l.prototype._iterator=function(e){return e.keyAsBuffer=this.codec.keyAsBuffer(e),e.valueAsBuffer=this.codec.valueAsBuffer(e),new d(this,e)},l.prototype._clear=function(e,t){e=this.codec.encodeLtgt(e),this.db.clear(e,t)},o(d,s),d.prototype._next=function(e){this.it.next(((t,r,i)=>{if(t)return e(t);try{r=this.keys&&void 0!==r?this.codec.decodeKey(r,this.opts):void 0,i=this.values&&void 0!==i?this.codec.decodeValue(i,this.opts):void 0}catch(t){return e(new c(t))}e(null,r,i)}))},d.prototype._seek=function(e){e=this.codec.encodeKey(e,this.opts),this.it.seek(e)},d.prototype._end=function(e){this.it.end(e)},o(f,n),f.prototype._put=function(e,t,r){e=this.codec.encodeKey(e,r),t=this.codec.encodeValue(t,r),this.batch.put(e,t)},f.prototype._del=function(e,t){e=this.codec.encodeKey(e,t),this.batch.del(e)},f.prototype._clear=function(){this.batch.clear()},f.prototype._write=function(e,t){this.batch.write(e,t)}},{"abstract-leveldown":"f3ZXE",inherits:"j5plK","level-codec":"avh2o","level-errors":"iLFVA"}],avh2o:[function(e,t,r){"use strict";const i=e("./lib/encodings"),n=new Set(["lt","gt","lte","gte"]);function s(e){if(!(this instanceof s))return new s(e);this.opts=e||{},this.encodings=i}t.exports=s,s.prototype._encoding=function(e){return"string"==typeof e&&(e=i[e]),e||(e=i.id),e},s.prototype._keyEncoding=function(e,t){return this._encoding(t&&t.keyEncoding||e&&e.keyEncoding||this.opts.keyEncoding)},s.prototype._valueEncoding=function(e,t){return this._encoding(t&&(t.valueEncoding||t.encoding)||e&&(e.valueEncoding||e.encoding)||this.opts.valueEncoding||this.opts.encoding)},s.prototype.encodeKey=function(e,t,r){return this._keyEncoding(t,r).encode(e)},s.prototype.encodeValue=function(e,t,r){return this._valueEncoding(t,r).encode(e)},s.prototype.decodeKey=function(e,t){return this._keyEncoding(t).decode(e)},s.prototype.decodeValue=function(e,t){return this._valueEncoding(t).decode(e)},s.prototype.encodeBatch=function(e,t){return e.map((e=>{const r={type:e.type,key:this.encodeKey(e.key,t,e)};return this.keyAsBuffer(t,e)&&(r.keyEncoding="binary"),e.prefix&&(r.prefix=e.prefix),"value"in e&&(r.value=this.encodeValue(e.value,t,e),this.valueAsBuffer(t,e)&&(r.valueEncoding="binary")),r}))},s.prototype.encodeLtgt=function(e){const t={};for(const r of Object.keys(e)){if("start"===r||"end"===r)throw new Error('Legacy range options ("start" and "end") have been removed');t[r]=n.has(r)?this.encodeKey(e[r],e):e[r]}return t},s.prototype.createStreamDecoder=function(e){return e.keys&&e.values?(t,r)=>({key:this.decodeKey(t,e),value:this.decodeValue(r,e)}):e.keys?t=>this.decodeKey(t,e):e.values?(t,r)=>this.decodeValue(r,e):function(){}},s.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},s.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},{"./lib/encodings":"yLou2"}],yLou2:[function(e,t,r){"use strict";const{Buffer:i}=e("buffer");r.utf8=r["utf-8"]={encode:function(e){return o(e)?e:String(e)},decode:s,buffer:!1,type:"utf8"},r.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},r.binary={encode:function(e){return o(e)?e:i.from(e)},decode:s,buffer:!0,type:"binary"},r.none={encode:s,decode:s,buffer:!1,type:"id"},r.id=r.none;const n=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];for(const e of n)r[e]={encode:function(t){return o(t)?t:i.from(t,e)},decode:function(t){return t.toString(e)},buffer:!0,type:e};function s(e){return e}function o(e){return null==e||i.isBuffer(e)}},{buffer:"etowf"}],lRPoL:[function(e,t,r){"use strict";t.exports=h;const i=e("abstract-leveldown").AbstractLevelDOWN,n=e("inherits"),s=e("run-parallel-limit"),o=e("./iterator"),a=e("./util/serialize"),c=e("./util/deserialize"),u=e("./util/support"),l=e("./util/clear"),d=e("./util/key-range"),f="level-js-";function h(e,t){if(!(this instanceof h))return new h(e,t);if(i.call(this,{bufferKeys:u.bufferKeys(indexedDB),snapshots:!0,permanence:!0,clear:!0,getMany:!0}),t=t||{},"string"!=typeof e)throw new Error("constructor requires a location string argument");this.location=e,this.prefix=null==t.prefix?f:t.prefix,this.version=parseInt(t.version||1,10)}n(h,i),h.prototype.type="level-js",h.prototype._open=function(e,t){const r=indexedDB.open(this.prefix+this.location,this.version);r.onerror=function(){t(r.error||new Error("unknown error"))},r.onsuccess=()=>{this.db=r.result,t()},r.onupgradeneeded=e=>{const t=e.target.result;t.objectStoreNames.contains(this.location)||t.createObjectStore(this.location)}},h.prototype.store=function(e){return this.db.transaction([this.location],e).objectStore(this.location)},h.prototype.await=function(e,t){const r=e.transaction;r.onabort=function(){t(r.error||new Error("aborted by user"))},r.oncomplete=function(){t(null,e.result)}},h.prototype._get=function(e,t,r){const i=this.store("readonly");let n;try{n=i.get(e)}catch(e){return this._nextTick(r,e)}this.await(n,(function(e,i){return e?r(e):void 0===i?r(new Error("NotFound")):void r(null,c(i,t.asBuffer))}))},h.prototype._getMany=function(e,t,r){const i=t.asBuffer,n=this.store("readonly"),o=e.map((e=>t=>{let r;try{r=n.get(e)}catch(e){return t(e)}r.onsuccess=()=>{const e=r.result;t(null,void 0===e?e:c(e,i))},r.onerror=e=>{e.stopPropagation(),t(r.error)}}));s(o,16,r)},h.prototype._del=function(e,t,r){const i=this.store("readwrite");let n;try{n=i.delete(e)}catch(e){return this._nextTick(r,e)}this.await(n,r)},h.prototype._put=function(e,t,r,i){const n=this.store("readwrite");let s;try{s=n.put(t,e)}catch(e){return this._nextTick(i,e)}this.await(s,i)},h.prototype._serializeKey=function(e){return a(e,this.supports.bufferKeys)},h.prototype._serializeValue=function(e){return a(e,!0)},h.prototype._iterator=function(e){return new o(this,this.location,e)},h.prototype._batch=function(e,t,r){if(0===e.length)return this._nextTick(r);const i=this.store("readwrite"),n=i.transaction;let s,o=0;n.onabort=function(){r(s||n.error||new Error("aborted by user"))},n.oncomplete=function(){r()},function t(){const r=e[o++],a=r.key;let c;try{c="del"===r.type?i.delete(a):i.put(r.value,a)}catch(e){return s=e,void n.abort()}o<e.length&&(c.onsuccess=t)}()},h.prototype._clear=function(e,t){let r,i;try{r=d(e)}catch(e){return this._nextTick(t)}if(e.limit>=0)return l(this,this.location,r,e,t);try{const e=this.store("readwrite");i=r?e.delete(r):e.clear()}catch(e){return this._nextTick(t,e)}this.await(i,t)},h.prototype._close=function(e){this.db.close(),this._nextTick(e)},h.prototype.upgrade=function(e){if("open"!==this.status)return this._nextTick(e,new Error("cannot upgrade() before open()"));const t=this.iterator(),r={},i=this;function n(e){if(e)return o(e);t.next(s)}function s(e,t,s){if(e||void 0===t)return o(e);const a=i._serializeKey(c(t,!0)),u=i._serializeValue(c(s,!0));i._batch([{type:"del",key:t},{type:"put",key:a,value:u}],r,n)}function o(r){t.end((function(t){e(r||t)}))}t._deserializeKey=t._deserializeValue=function(e){return e},n()},h.destroy=function(e,t,r){"function"==typeof t&&(r=t,t=f);const i=indexedDB.deleteDatabase(t+e);i.onsuccess=function(){r()},i.onerror=function(e){r(e)}}},{"abstract-leveldown":"f3ZXE",inherits:"j5plK","run-parallel-limit":"i7UCm","./iterator":"K8EMC","./util/serialize":"hGPws","./util/deserialize":"kV0qO","./util/support":"8xE1u","./util/clear":"6sCF8","./util/key-range":"iJjZ3"}],i7UCm:[function(e,t,r){
/*! run-parallel-limit. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */t.exports=function(e,t,r){if("number"!=typeof t)throw new Error("second argument must be a Number");let n,s,o,a,c,u,l=!0;Array.isArray(e)?(n=[],o=s=e.length):(a=Object.keys(e),n={},o=s=a.length);function d(e){function t(){r&&r(e,n),r=null}l?i(t):t()}function f(t,r,i){if(n[t]=i,r&&(c=!0),0==--o||r)d(r);else if(!c&&u<s){let t;a?(t=a[u],u+=1,e[t]((function(e,r){f(t,e,r)}))):(t=u,u+=1,e[t]((function(e,r){f(t,e,r)})))}}u=t,o?a?a.some((function(r,i){return e[r]((function(e,t){f(r,e,t)})),i===t-1})):e.some((function(e,r){return e((function(e,t){f(r,e,t)})),r===t-1})):d(null);l=!1};const i=e("queue-microtask")},{"queue-microtask":"3aIgO"}],K8EMC:[function(e,t,r){"use strict";const i=e("inherits"),n=e("abstract-leveldown").AbstractIterator,s=e("./util/key-range"),o=e("./util/deserialize"),a=function(){};function c(e,t,r){if(n.call(this,e),this._limit=r.limit,this._count=0,this._callback=null,this._cache=[],this._completed=!1,this._aborted=!1,this._error=null,this._transaction=null,this._keys=r.keys,this._values=r.values,this._keyAsBuffer=r.keyAsBuffer,this._valueAsBuffer=r.valueAsBuffer,0===this._limit)return void(this._completed=!0);let i;try{i=s(r)}catch(e){return void(this._completed=!0)}this.createIterator(t,i,r.reverse)}t.exports=c,i(c,n),c.prototype.createIterator=function(e,t,r){const i=this.db.db.transaction([e],"readonly");i.objectStore(e).openCursor(t,r?"prev":"next").onsuccess=e=>{const t=e.target.result;t&&this.onItem(t)},this._transaction=i,i.onabort=()=>{this.onAbort(this._transaction.error||new Error("aborted by user"))},i.oncomplete=()=>{this.onComplete()}},c.prototype.onItem=function(e){this._cache.push(e.key,e.value),(this._limit<=0||++this._count<this._limit)&&e.continue(),this.maybeNext()},c.prototype.onAbort=function(e){this._aborted=!0,this._error=e,this.maybeNext()},c.prototype.onComplete=function(){this._completed=!0,this.maybeNext()},c.prototype.maybeNext=function(){this._callback&&(this._next(this._callback),this._callback=null)},c.prototype._next=function(e){if(this._aborted){const t=this._error;this._error=null,this._nextTick(e,t)}else if(this._cache.length>0){let t=this._cache.shift(),r=this._cache.shift();t=this._keys&&void 0!==t?this._deserializeKey(t,this._keyAsBuffer):void 0,r=this._values&&void 0!==r?this._deserializeValue(r,this._valueAsBuffer):void 0,this._nextTick(e,null,t,r)}else this._completed?this._nextTick(e):this._callback=e},c.prototype._deserializeKey=o,c.prototype._deserializeValue=o,c.prototype._end=function(e){if(this._aborted||this._completed)return this._nextTick(e,this._error);this.onItem=a,this.onAbort=e,this.onComplete=e}},{inherits:"j5plK","abstract-leveldown":"f3ZXE","./util/key-range":"iJjZ3","./util/deserialize":"kV0qO"}],iJjZ3:[function(e,t,r){"use strict";const i=e("ltgt"),n=Symbol("none");t.exports=function(e){const t=i.lowerBound(e,n),r=i.upperBound(e,n),s=i.lowerBoundExclusive(e,n),o=i.upperBoundExclusive(e,n);return t!==n&&r!==n?IDBKeyRange.bound(t,r,s,o):t!==n?IDBKeyRange.lowerBound(t,s):r!==n?IDBKeyRange.upperBound(r,o):null}},{ltgt:"fRjrc"}],fRjrc:[function(e,t,r){var i=e("buffer").Buffer;function n(e){return void 0!==e&&""!==e}function s(e,t){return Object.hasOwnProperty.call(e,t)}function o(e,t){return Object.hasOwnProperty.call(e,t)&&t}r.compare=function(e,t){if(i.isBuffer(e)){for(var r=Math.min(e.length,t.length),n=0;n<r;n++){var s=e[n]-t[n];if(s)return s}return e.length-t.length}return e<t?-1:e>t?1:0};var a=r.lowerBoundKey=function(e){return o(e,"gt")||o(e,"gte")||o(e,"min")||(e.reverse?o(e,"end"):o(e,"start"))||void 0},c=r.lowerBound=function(e,t){var r=a(e);return r?e[r]:t},u=r.lowerBoundInclusive=function(e){return!s(e,"gt")},l=r.upperBoundInclusive=function(e){return!s(e,"lt")},d=r.lowerBoundExclusive=function(e){return!u(e)},f=r.upperBoundExclusive=function(e){return!l(e)},h=r.upperBoundKey=function(e){return o(e,"lt")||o(e,"lte")||o(e,"max")||(e.reverse?o(e,"start"):o(e,"end"))||void 0},p=r.upperBound=function(e,t){var r=h(e);return r?e[r]:t};function g(e){return e}r.start=function(e,t){return e.reverse?p(e,t):c(e,t)},r.end=function(e,t){return e.reverse?c(e,t):p(e,t)},r.startInclusive=function(e){return e.reverse?l(e):u(e)},r.endInclusive=function(e){return e.reverse?u(e):l(e)},r.toLtgt=function(e,t,i,n,o){t=t||{},i=i||g;var a=arguments.length>3,c=r.lowerBoundKey(e),u=r.upperBoundKey(e);return c?"gt"===c?t.gt=i(e.gt,!1):t.gte=i(e[c],!1):a&&(t.gte=i(n,!1)),u?"lt"===u?t.lt=i(e.lt,!0):t.lte=i(e[u],!0):a&&(t.lte=i(o,!0)),null!=e.reverse&&(t.reverse=!!e.reverse),s(t,"max")&&delete t.max,s(t,"min")&&delete t.min,s(t,"start")&&delete t.start,s(t,"end")&&delete t.end,t},r.contains=function(e,t,i){i=i||r.compare;var s=c(e);if(n(s)&&((o=i(t,s))<0||0===o&&d(e)))return!1;var o,a=p(e);if(n(a)&&((o=i(t,a))>0||0===o&&f(e)))return!1;return!0},r.filter=function(e,t){return function(i){return r.contains(e,i,t)}}},{buffer:"etowf"}],kV0qO:[function(e,t,r){var i=arguments[3];const n=e("buffer").Buffer,s=function(){if(i.TextDecoder){const e=new TextDecoder("utf-8");return e.decode.bind(e)}return function(e){return a(e).toString()}}(),o=function(){if(i.TextDecoder){const e=new TextDecoder("utf-8");return e.decode.bind(e)}return function(e){return n.from(e).toString()}}();function a(e){const t=n.from(e.buffer);return e.byteLength===e.buffer.byteLength?t:t.slice(e.byteOffset,e.byteOffset+e.byteLength)}t.exports=function(e,t){return e instanceof Uint8Array?t?a(e):s(e):e instanceof ArrayBuffer?t?n.from(e):o(e):t?n.from(String(e)):String(e)}},{buffer:"etowf"}],hGPws:[function(e,t,r){var i=arguments[3];const n=e("buffer").Buffer,s=function(){if(i.TextEncoder){const e=new TextEncoder("utf-8");return e.encode.bind(e)}return n.from}();t.exports=function(e,t){return t?n.isBuffer(e)?e:s(String(e)):String(e)}},{buffer:"etowf"}],"8xE1u":[function(e,t,r){"use strict";const i=e("buffer").Buffer;r.test=function(e){return function(t){try{return t.cmp(e,0),!0}catch(e){return!1}}},r.bufferKeys=r.test(i.alloc(0))},{buffer:"etowf"}],"6sCF8":[function(e,t,r){"use strict";t.exports=function(e,t,r,i,n){if(0===i.limit)return e._nextTick(n);const s=e.db.transaction([t],"readwrite"),o=s.objectStore(t);let a=0;s.oncomplete=function(){n()},s.onabort=function(){n(s.error||new Error("aborted by user"))};const c=o.openKeyCursor?"openKeyCursor":"openCursor",u=i.reverse?"prev":"next";o[c](r,u).onsuccess=function(e){const t=e.target.result;t&&(o.delete(t.key).onsuccess=function(){(i.limit<=0||++a<i.limit)&&t.continue()})}}},{}],lEkQn:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("it-drain"),n=e("it-pushable"),s=e("interface-datastore/key"),o=e("multiformats/cid"),a=e("multiformats/codecs/raw"),c=e("multiformats/hashes/digest"),u=e("multiformats/bases/base32"),l=e("multiformats/bases/base58"),d=e("err-code"),f=e("blockstore-core/base");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var g=h(i),y=h(n),m=p(a),b=p(c),v=h(d);function w(e){const t=o.CID.asCID(e);if(!t)throw v.default(new Error("Not a valid cid"),"ERR_INVALID_CID");return new s.Key("/"+u.base32.encode(t.multihash.bytes).slice(1).toUpperCase(),!1)}function _(e){return o.CID.createV1(m.code,b.decode(u.base32.decode("b"+e.toString().slice(1).toLowerCase())))}function E(e){const t=e.substring(0,1);if("/"===t)return E(e.substring(1));let r,i;r="b"===t.toLowerCase()?e=>u.base32.decode(e.toLowerCase()).subarray(2):"c"===t.toLowerCase()?e=>u.base32pad.decode(e.toLowerCase()).subarray(2):"z"===t?e=>l.base58btc.decode(e).subarray(2):"Q"===t?e=>l.base58btc.decode("z"+e):e=>u.base32.decode("b"+e.toLowerCase()).subarray(2);for(let t=1;t<e.length;t++)try{i=r(e.substring(0,t))}catch(e){if("Unexpected end of data"!==e.message)throw e}let n="/C";return i&&(n=`/${u.base32.encode(i).slice(1,-1).toUpperCase()||"C"}`),n}class S extends f.BaseBlockstore{constructor(e){super(),this.child=e}open(){return this.child.open()}close(){return this.child.close()}async*query(e,t){for await(const{key:r,value:i}of this.child.query(function(e){return{...e,prefix:e.prefix?E(e.prefix):void 0,filters:e.filters?e.filters.map((e=>t=>e({key:_(t.key),value:t.value}))):void 0,orders:e.orders?e.orders.map((e=>(t,r)=>e({key:_(t.key),value:t.value},{key:_(r.key),value:r.value}))):void 0}}(e),t))yield{key:_(r),value:i}}async*queryKeys(e,t){for await(const i of this.child.queryKeys((r=e,{...r,prefix:r.prefix?E(r.prefix):void 0,filters:r.filters?r.filters.map((e=>t=>e(_(t)))):void 0,orders:r.orders?r.orders.map((e=>(t,r)=>e(_(t),_(r)))):void 0}),t))yield _(i);var r}async get(e,t){return this.child.get(w(e),t)}async*getMany(e,t){for await(const r of e)yield this.get(r,t)}async put(e,t,r){await this.child.put(w(e),t,r)}async*putMany(e,t){const r=y.default();(globalThis.process&&globalThis.process.nextTick?globalThis.process.nextTick:globalThis.setImmediate||globalThis.setTimeout)((async()=>{try{const i=this.child;await g.default(this.child.putMany(async function*(){for await(const n of e){const e=w(n.key);await i.has(e,t)||(yield{key:e,value:n.value}),r.push(n)}}())),r.end()}catch(e){r.end(e)}})),yield*r}has(e,t){return this.child.has(w(e),t)}delete(e,t){return this.child.delete(w(e),t)}deleteMany(e,t){const r=y.default();return g.default(this.child.deleteMany(async function*(){for await(const t of e)yield w(t),r.push(t);r.end()}(),t)).catch((e=>{r.end(e)})),r}}r.BlockstoreDatastoreAdapter=S},{"it-drain":"dKYhO","it-pushable":"bnpei","interface-datastore/key":"9hGOz","multiformats/cid":"9ooAY","multiformats/codecs/raw":"fdfgp","multiformats/hashes/digest":"kpRBg","multiformats/bases/base32":"5k9Tu","multiformats/bases/base58":"4n7mA","err-code":"chZjB","blockstore-core/base":"l2CNM"}],l2CNM:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("it-drain"),n=e("it-filter"),s=e("it-take"),o=e("it-all");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(i),u=a(n),l=a(s),d=a(o);const f=(e,t)=>async function*(){const r=await d.default(e);yield*r.sort(t)}();r.BaseBlockstore=class{open(){return Promise.reject(new Error(".open is not implemented"))}close(){return Promise.reject(new Error(".close is not implemented"))}put(e,t,r){return Promise.reject(new Error(".put is not implemented"))}get(e,t){return Promise.reject(new Error(".get is not implemented"))}has(e,t){return Promise.reject(new Error(".has is not implemented"))}delete(e,t){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(e,t={}){for await(const{key:r,value:i}of e)await this.put(r,i,t),yield{key:r,value:i}}async*getMany(e,t={}){for await(const r of e)yield this.get(r,t)}async*deleteMany(e,t={}){for await(const r of e)await this.delete(r,t),yield r}batch(){let e=[],t=[];return{put(t,r){e.push({key:t,value:r})},delete(e){t.push(e)},commit:async r=>{await c.default(this.putMany(e,r)),e=[],await c.default(this.deleteMany(t,r)),t=[]}}}async*_all(e,t){throw new Error("._all is not implemented")}async*_allKeys(e,t){throw new Error("._allKeys is not implemented")}query(e,t){let r=this._all(e,t);if(null!=e.prefix&&(r=u.default(r,(t=>t.key.toString().startsWith(e.prefix||"")))),Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>u.default(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>f(e,t)),r)),null!=e.offset){let t=0;r=u.default(r,(()=>t++>=(e.offset||0)))}return null!=e.limit&&(r=l.default(r,e.limit)),r}queryKeys(e,t){let r=this._allKeys(e,t);if(null!=e.prefix&&(r=u.default(r,(t=>t.toString().startsWith(e.prefix||"")))),Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>u.default(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>f(e,t)),r)),null!=e.offset){let t=0;r=u.default(r,(()=>t++>=e.offset))}return null!=e.limit&&(r=l.default(r,e.limit)),r}}},{"it-drain":"dKYhO","it-filter":"5LCTL","it-take":"gxr1t","it-all":"iCXBu"}],jcB2q:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("dlv"),n=e("merge-options"),s=e("err-code"),o=e("ipfs-core-config/libp2p-pubsub-routers"),a=e("libp2p-delegated-peer-routing"),c=e("libp2p-delegated-content-routing"),u=e("ipfs-http-client"),l=e("multiaddr"),d=e("../version.js"),f=e("ipfs-core-config/libp2p"),h=e("libp2p-bootstrap"),p=e("libp2p");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var y=g(i),m=g(n),b=g(s),v=g(a),w=g(c),_=g(h),E=g(p);const S=m.default.bind({ignoreUndefined:!0});r.createLibp2p=function({options:e={},peerId:t,multiaddrs:r=[],repo:i,keychainConfig:n={},config:s={}}){const{datastore:a,keys:c}=i,h=function({options:e,config:t,datastore:r,keys:i,keychainConfig:n,peerId:s,multiaddrs:a}){const c={datastore:r,peerId:s,modules:{}},h={modules:{pubsub:(()=>{const e=y.default(t,"Pubsub.Router")||"gossipsub";if(!o.routers[e])throw b.default(new Error(`Router unavailable. Configure libp2p.modules.pubsub to use the ${e} router.`),"ERR_NOT_SUPPORTED");return o.routers[e]})(),contentRouting:[],peerRouting:[]},config:{peerDiscovery:{mdns:{enabled:y.default(e,"config.Discovery.MDNS.Enabled",y.default(t,"Discovery.MDNS.Enabled",!0))},webRTCStar:{enabled:y.default(e,"config.Discovery.webRTCStar.Enabled",y.default(t,"Discovery.webRTCStar.Enabled",!0))},bootstrap:{list:y.default(e,"config.Bootstrap",y.default(t,"Bootstrap",[]))}},relay:{enabled:y.default(e,"relay.enabled",y.default(t,"relay.enabled",!0)),hop:{enabled:y.default(e,"relay.hop.enabled",y.default(t,"relay.hop.enabled",!1)),active:y.default(e,"relay.hop.active",y.default(t,"relay.hop.active",!1))}},dht:{enabled:"none"!==y.default(t,"Routing.Type","none"),clientMode:"dhtserver"!==y.default(t,"Routing.Type","dht"),kBucketSize:y.default(e,"dht.kBucketSize",20)},pubsub:{enabled:y.default(e,"config.Pubsub.Enabled",y.default(t,"Pubsub.Enabled",!0))},nat:{enabled:!y.default(t,"Swarm.DisableNatPortMap",!1)}},addresses:{listen:a.map((e=>e.toString())),announce:y.default(e,"addresses.announce",y.default(t,"Addresses.Announce",[])),noAnnounce:y.default(e,"addresses.noAnnounce",y.default(t,"Addresses.NoAnnounce",[]))},connectionManager:y.default(e,"connectionManager",{maxConnections:y.default(e,"config.Swarm.ConnMgr.HighWater",y.default(t,"Swarm.ConnMgr.HighWater")),minConnections:y.default(e,"config.Swarm.ConnMgr.LowWater",y.default(t,"Swarm.ConnMgr.LowWater"))}),keychain:{datastore:i,...n},host:{agentVersion:`js-ipfs/${d.ipfsCore}`}};let p=y.default(e,"libp2p",void 0);"function"==typeof p&&(p=void 0);const g=S(c,f.libp2pConfig(),h,p);y.default(g,"config.peerDiscovery.bootstrap.list",[]).length>0&&g.modules.peerDiscovery.push(_.default);const m=y.default(e,"config.Addresses.Delegates",y.default(t,"Addresses.Delegates",[]));if(m.length>0){const e=m[Math.floor(Math.random()*m.length)],t=new l.Multiaddr(e).toOptions(),r={host:t.host,protocol:443===parseInt(t.port)?"https":"http",port:t.port},i=u.create(r);h.modules.contentRouting=h.modules.contentRouting||[],h.modules.contentRouting.push(new w.default(s,i)),h.modules.peerRouting=h.modules.peerRouting||[],h.modules.peerRouting.push(new v.default(i))}return g}({options:e,config:s,datastore:a,keys:c,keychainConfig:n,peerId:t,multiaddrs:r});return"function"==typeof e.libp2p?e.libp2p({libp2pOptions:h,options:e,config:s,datastore:a,peerId:t}):E.default.create(h)}},{dlv:"hp0pQ","merge-options":"fupyv","err-code":"chZjB","ipfs-core-config/libp2p-pubsub-routers":"3XeOM","libp2p-delegated-peer-routing":"jgA5e","libp2p-delegated-content-routing":"gg6SI","ipfs-http-client":"h5Uk6",multiaddr:"8Mu1u","../version.js":"cyFMr","ipfs-core-config/libp2p":"eStoI","libp2p-bootstrap":"hla2J",libp2p:"757Qe"}],"3XeOM":[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});const n={gossipsub:i(e("libp2p-gossipsub")).default};r.routers=n},{"libp2p-gossipsub":"eSowE"}],eSowE:[function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t},o=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};const a=s(e("libp2p-interfaces/src/pubsub")),c=e("./message-cache"),u=e("./message/rpc"),l=s(e("./constants")),d=e("./heartbeat"),f=e("./get-gossip-peers"),h=e("./utils"),p=e("./score"),g=e("./tracer"),y=e("time-cache"),m=e("peer-id"),b=e("libp2p/src/record/envelope");class v extends a.default{constructor(e,t={}){const r=[l.GossipsubIDv11,l.GossipsubIDv10],i=Object.assign(Object.assign({gossipIncoming:!0,fallbackToFloodsub:!0,floodPublish:!0,doPX:!1,directPeers:[],D:l.GossipsubD,Dlo:l.GossipsubDlo,Dhi:l.GossipsubDhi,Dscore:l.GossipsubDscore,Dout:l.GossipsubDout,Dlazy:l.GossipsubDlazy,heartbeatInterval:l.GossipsubHeartbeatInterval,fanoutTTL:l.GossipsubFanoutTTL,mcacheLength:l.GossipsubHistoryLength,mcacheGossip:l.GossipsubHistoryGossip,seenTTL:l.GossipsubSeenTTL},t),{scoreParams:p.createPeerScoreParams(t.scoreParams),scoreThresholds:p.createPeerScoreThresholds(t.scoreThresholds)});i.fallbackToFloodsub&&r.push(l.FloodsubID),super(Object.assign({debugName:"libp2p:gossipsub",multicodecs:r,libp2p:e},i)),this._options=i,this.direct=new Set(i.directPeers.map((e=>e.id.toB58String()))),i.directPeers.forEach((t=>{e.peerStore.addressBook.add(t.id,t.addrs)})),this.seenCache=new y({validity:i.seenTTL/1e3}),this.mesh=new Map,this.fanout=new Map,this.lastpub=new Map,this.gossip=new Map,this.control=new Map,this.peerhave=new Map,this.iasked=new Map,this.backoff=new Map,this.outbound=new Map,this.messageCache=t.messageCache||new c.MessageCache(i.mcacheGossip,i.mcacheLength,this.getMsgId.bind(this)),this.heartbeat=new d.Heartbeat(this),this.heartbeatTicks=0,this.gossipTracer=new g.IWantTracer(this.getMsgId.bind(this)),this._libp2p=e,this.score=new p.PeerScore(this._options.scoreParams,e.connectionManager,this.getMsgId.bind(this))}_decodeRpc(e){return u.RPC.decode(e)}_encodeRpc(e){return u.RPC.encode(e).finish()}_addPeer(e,t){const r=super._addPeer(e,t);this.score.addPeer(e.toB58String());let i=!1;for(const r of this._libp2p.connectionManager.getAll(e))if("outbound"===r.stat.direction&&Array.from(r.registry.values()).some((e=>t===e.protocol))){i=!0;break}return this.outbound.set(r.id.toB58String(),i),r}_removePeer(e){const t=super._removePeer(e),r=e.toB58String();for(const e of this.mesh.values())e.delete(r);for(const e of this.fanout.values())e.delete(r);return this.gossip.delete(r),this.control.delete(r),this.outbound.delete(r),this.score.removePeer(r),t}_processRpc(e,t,r){const i=Object.create(null,{_processRpc:{get:()=>super._processRpc}});return o(this,void 0,void 0,(function*(){return!!(yield i._processRpc.call(this,e,t,r))&&(r.control&&this._processRpcControlMessage(e,r.control),!0)}))}_processRpcControlMessage(e,t){if(!t)return;const r=t.ihave?this._handleIHave(e,t.ihave):[],i=t.iwant?this._handleIWant(e,t.iwant):[],n=t.graft?this._handleGraft(e,t.graft):[];if(t.prune&&this._handlePrune(e,t.prune),!r.length&&!i.length&&!n.length)return;const s=h.createGossipRpc(i,{iwant:r,prune:n});this._sendRpc(e,s)}_processRpcMessage(e){const t=Object.create(null,{_processRpcMessage:{get:()=>super._processRpcMessage}});return o(this,void 0,void 0,(function*(){const r=yield this.getMsgId(e),i=h.messageIdToString(r);this.seenCache.has(i)?this.score.duplicateMessage(e):(this.seenCache.put(i),yield this.score.validateMessage(e),yield t._processRpcMessage.call(this,e))}))}_acceptFrom(e){return this.direct.has(e)||this.score.score(e)>=this._options.scoreThresholds.graylistThreshold}validate(e){const t=Object.create(null,{validate:{get:()=>super.validate}});return o(this,void 0,void 0,(function*(){try{yield t.validate.call(this,e)}catch(t){throw this.score.rejectMessage(e,t.code),this.gossipTracer.rejectMessage(e,t.code),t}}))}_handleIHave(e,t){if(!t.length)return[];const r=this.score.score(e);if(r<this._options.scoreThresholds.gossipThreshold)return this.log("IHAVE: ignoring peer %s with score below threshold [ score = %d ]",e,r),[];const i=(this.peerhave.get(e)||0)+1;if(this.peerhave.set(e,i),i>l.GossipsubMaxIHaveMessages)return this.log("IHAVE: peer %s has advertised too many times (%d) within this heartbeat interval; ignoring",e,i),[];const n=this.iasked.get(e)||0;if(n>=l.GossipsubMaxIHaveLength)return this.log("IHAVE: peer %s has already advertised too many messages (%d); ignoring",e,n),[];const s=new Map;if(t.forEach((({topicID:e,messageIDs:t})=>{e&&t&&this.mesh.has(e)&&t.forEach((e=>{const t=h.messageIdToString(e);this.seenCache.has(t)||s.set(t,e)}))})),!s.size)return[];let o=s.size;o+n>l.GossipsubMaxIHaveLength&&(o=l.GossipsubMaxIHaveLength-n),this.log("IHAVE: Asking for %d out of %d messages from %s",o,s.size,e);let a=Array.from(s.values());return h.shuffle(a),a=a.slice(0,o),this.iasked.set(e,n+o),this.gossipTracer.addPromise(e,a),[{messageIDs:a}]}_handleIWant(e,t){if(!t.length)return[];const r=this.score.score(e);if(r<this._options.scoreThresholds.gossipThreshold)return this.log("IWANT: ignoring peer %s with score below threshold [score = %d]",e,r),[];const i=new Map;return t.forEach((({messageIDs:t})=>{t&&t.forEach((t=>{const[r,n]=this.messageCache.getForPeer(t,e);r&&(n>l.GossipsubGossipRetransmission?this.log("IWANT: Peer %s has asked for message %s too many times: ignoring request",e,t):i.set(h.messageIdToString(t),r))}))})),i.size?(this.log("IWANT: Sending %d messages to %s",i.size,e),Array.from(i.values()).map(a.utils.normalizeOutRpcMessage)):[]}_handleGraft(e,t){const r=[],i=this.score.score(e),n=this._now();let s=this._options.doPX;return t.forEach((({topicID:t})=>{var o;if(!t)return;const a=this.mesh.get(t);if(!a)return void(s=!1);if(a.has(e))return;if(this.direct.has(e))return this.log("GRAFT: ignoring request from direct peer %s",e),r.push(t),void(s=!1);const c=null===(o=this.backoff.get(t))||void 0===o?void 0:o.get(e);if("number"==typeof c&&n<c){this.log("GRAFT: ignoring backed off peer %s",e),this.score.addPenalty(e,1),s=!1;const i=c+l.GossipsubGraftFloodThreshold-l.GossipsubPruneBackoff;return n<i&&this.score.addPenalty(e,1),this._addBackoff(e,t),void r.push(t)}return i<0?(this.log("GRAFT: ignoring peer %s with negative score: score=%d, topic=%s",e,i,t),r.push(t),s=!1,void this._addBackoff(e,t)):a.size>=this._options.Dhi&&!this.outbound.get(e)?(r.push(t),void this._addBackoff(e,t)):(this.log("GRAFT: Add mesh link from %s in %s",e,t),this.score.graft(e,t),void a.add(e))})),r.length?r.map((t=>this._makePrune(e,t,s))):[]}_handlePrune(e,t){const r=this.score.score(e);t.forEach((({topicID:t,backoff:i,peers:n})=>{if(!t)return;const s=this.mesh.get(t);if(s&&(this.log("PRUNE: Remove mesh link to %s in %s",e,t),this.score.prune(e,t),s.delete(e),"number"==typeof i&&i>0?this._doAddBackoff(e,t,1e3*i):this._addBackoff(e,t),n&&n.length)){if(r<this._options.scoreThresholds.acceptPXThreshold)return void this.log("PRUNE: ignoring PX from peer %s with insufficient score [score = %d, topic = %s]",e,r,t);this._pxConnect(n)}}))}_addBackoff(e,t){this._doAddBackoff(e,t,l.GossipsubPruneBackoff)}_doAddBackoff(e,t,r){let i=this.backoff.get(t);i||(i=new Map,this.backoff.set(t,i));const n=this._now()+r;(i.get(e)||0)<n&&i.set(e,n)}_applyIwantPenalties(){this.gossipTracer.getBrokenPromises().forEach(((e,t)=>{this.log("peer %s didn't follow up in %d IWANT requests; adding penalty",t,e),this.score.addPenalty(t,e)}))}_clearBackoff(){if(this.heartbeatTicks%l.GossipsubPruneBackoffTicks!=0)return;const e=this._now();this.backoff.forEach(((t,r)=>{t.forEach(((r,i)=>{r<e&&t.delete(i)})),0===t.size&&this.backoff.delete(r)}))}_directConnect(){if(this.heartbeatTicks%l.GossipsubDirectConnectTicks!=0)return;const e=[];this.direct.forEach((t=>{const r=this.peers.get(t);r&&r.isWritable||e.push(t)})),e.length&&e.forEach((e=>{this._connect(e)}))}_pxConnect(e){return o(this,void 0,void 0,(function*(){e.length>l.GossipsubPrunePeers&&(h.shuffle(e),e=e.slice(0,l.GossipsubPrunePeers));const t=[];yield Promise.all(e.map((e=>o(this,void 0,void 0,(function*(){if(!e.peerID)return;const r=m.createFromBytes(e.peerID).toB58String();if(!this.peers.has(r))if(e.signedPeerRecord)try{const i=yield b.openAndCertify(e.signedPeerRecord,"libp2p-peer-record"),n=i.peerId.toB58String();if(r!==n)return void this.log("bogus peer record obtained through px: peer ID %s doesn't match expected peer %s",n,r);if(!this._libp2p.peerStore.addressBook.consumePeerRecord(i))return void this.log("bogus peer record obtained through px: could not add peer record to address book");t.push(r)}catch(e){this.log("bogus peer record obtained through px: invalid signature or not a peer record")}else t.push(r)}))))),t.length&&t.forEach((e=>this._connect(e)))}))}start(){super.start(),this.heartbeat.start(),this.score.start(),this._directPeerInitial=setTimeout((()=>{this.direct.forEach((e=>{this._connect(e)}))}),l.GossipsubDirectConnectInitialDelay)}stop(){super.stop(),this.heartbeat.stop(),this.score.stop(),this.mesh=new Map,this.fanout=new Map,this.lastpub=new Map,this.gossip=new Map,this.control=new Map,this.peerhave=new Map,this.iasked=new Map,this.backoff=new Map,this.outbound=new Map,this.gossipTracer.clear(),clearTimeout(this._directPeerInitial)}_connect(e){this.log("Initiating connection with %s",e),this._libp2p.dialProtocol(m.createFromB58String(e),this.multicodecs)}subscribe(e){super.subscribe(e),this.join(e)}unsubscribe(e){super.unsubscribe(e),this.leave(e)}join(e){if(!this.started)throw new Error("Gossipsub has not started");this.log("JOIN %s",e);const t=this.fanout.get(e);if(t)t.forEach((e=>{this.score.score(e)<0&&t.delete(e)})),t.size<this._options.D&&f.getGossipPeers(this,e,this._options.D-t.size,(e=>!t.has(e)&&!this.direct.has(e)&&this.score.score(e)>=0)).forEach((e=>t.add(e))),this.mesh.set(e,t),this.fanout.delete(e),this.lastpub.delete(e);else{const t=f.getGossipPeers(this,e,this._options.D,(e=>!this.direct.has(e)&&this.score.score(e)>=0));this.mesh.set(e,t)}this.mesh.get(e).forEach((t=>{this.log("JOIN: Add mesh link to %s in %s",t,e),this._sendGraft(t,e)}))}leave(e){if(!this.started)throw new Error("Gossipsub has not started");this.log("LEAVE %s",e);const t=this.mesh.get(e);t&&(t.forEach((t=>{this.log("LEAVE: Remove mesh link to %s in %s",t,e),this._sendPrune(t,e)})),this.mesh.delete(e))}_publish(e){return o(this,void 0,void 0,(function*(){e.receivedFrom!==this.peerId.toB58String()&&(this.score.deliverMessage(e),this.gossipTracer.deliverMessage(e));const t=yield this.getMsgId(e),r=h.messageIdToString(t);this.seenCache.put(r),this.messageCache.put(e);const i=new Set;e.topicIDs.forEach((t=>{const r=this.topics.get(t);if(r)if(this._options.floodPublish&&e.from===this.peerId.toB58String())r.forEach((e=>{(this.direct.has(e)||this.score.score(e)>=this._options.scoreThresholds.publishThreshold)&&i.add(e)}));else{this.direct.forEach((e=>{i.add(e)})),r.forEach((e=>{const t=this.score.score(e),r=this.peers.get(e);r&&r.protocol===l.FloodsubID&&t>=this._options.scoreThresholds.publishThreshold&&i.add(e)}));let e=this.mesh.get(t);if(!e||!e.size){if(e=this.fanout.get(t),!e){const r=f.getGossipPeers(this,t,this._options.D,(e=>this.score.score(e)>=this._options.scoreThresholds.publishThreshold));r.size>0?(e=r,this.fanout.set(t,r)):e=new Set}this.lastpub.set(t,this._now())}e.forEach((e=>{i.add(e)}))}}));const n=h.createGossipRpc([a.utils.normalizeOutRpcMessage(e)]);i.forEach((t=>{t!==e.from&&this._sendRpc(t,n)}))}))}_sendGraft(e,t){const r=[{topicID:t}],i=h.createGossipRpc([],{graft:r});this._sendRpc(e,i)}_sendPrune(e,t){const r=[this._makePrune(e,t,this._options.doPX)],i=h.createGossipRpc([],{prune:r});this._sendRpc(e,i)}_sendRpc(e,t){const r=this.peers.get(e);if(!r||!r.isWritable)return;const i=this.control.get(e);i&&(this._piggybackControl(e,t,i),this.control.delete(e));const n=this.gossip.get(e);n&&(this._piggybackGossip(e,t,n),this.gossip.delete(e)),r.write(u.RPC.encode(t).finish())}_piggybackControl(e,t,r){const i=(r.graft||[]).filter((({topicID:t})=>(t&&this.mesh.get(t)||new Set).has(e))),n=(r.prune||[]).filter((({topicID:t})=>!(t&&this.mesh.get(t)||new Set).has(e)));(i.length||n.length)&&(t.control?(t.control.graft=t.control.graft&&t.control.graft.concat(i),t.control.prune=t.control.prune&&t.control.prune.concat(n)):t.control={ihave:[],iwant:[],graft:i,prune:n})}_piggybackGossip(e,t,r){t.control||(t.control={ihave:[],iwant:[],graft:[],prune:[]}),t.control.ihave=r}_sendGraftPrune(e,t,r){const i=this._options.doPX;for(const[n,s]of e){const e=s.map((e=>({topicID:e})));let o=[];const a=t.get(n);a&&(o=a.map((e=>this._makePrune(n,e,i&&!r.get(n)))),t.delete(n));const c=h.createGossipRpc([],{graft:e,prune:o});this._sendRpc(n,c)}for(const[e,n]of t){const t=n.map((t=>this._makePrune(e,t,i&&!r.get(e)))),s=h.createGossipRpc([],{prune:t});this._sendRpc(e,s)}}_emitGossip(e,t){const r=this.messageCache.getGossipIDs(e);if(!r.length)return;h.shuffle(r),r.length>l.GossipsubMaxIHaveLength&&this.log("too many messages for gossip; will truncate IHAVE list (%d messages)",r.length);const i=[],n=this.topics.get(e);if(!n)return;n.forEach((e=>{const r=this.peers.get(e);r&&!t.has(e)&&!this.direct.has(e)&&h.hasGossipProtocol(r.protocol)&&this.score.score(e)>=this._options.scoreThresholds.gossipThreshold&&i.push(e)}));let s=this._options.Dlazy;const o=l.GossipsubGossipFactor*i.length;o>s&&(s=o),s>i.length?s=i.length:h.shuffle(i),i.slice(0,s).forEach((t=>{let i=r;r.length>l.GossipsubMaxIHaveLength&&(i=h.shuffle(i.slice()).slice(0,l.GossipsubMaxIHaveLength)),this._pushGossip(t,{topicID:e,messageIDs:i})}))}_flush(){for(const[e,t]of this.gossip.entries()){this.gossip.delete(e);const r=h.createGossipRpc([],{ihave:t});this._sendRpc(e,r)}for(const[e,t]of this.control.entries()){this.control.delete(e);const r=h.createGossipRpc([],{graft:t.graft,prune:t.prune});this._sendRpc(e,r)}}_pushGossip(e,t){this.log("Add gossip to %s",e);const r=this.gossip.get(e)||[];this.gossip.set(e,r.concat(t))}_now(){return Date.now()}_makePrune(e,t,r){if(this.peers.get(e).protocol===l.GossipsubIDv10)return{topicID:t,peers:[]};const i=l.GossipsubPruneBackoff/1e3,n=[];if(r){f.getGossipPeers(this,t,l.GossipsubPrunePeers,(t=>t!==e&&this.score.score(t)>=0)).forEach((e=>{const t=m.createFromB58String(e);n.push({peerID:t.toBytes(),signedPeerRecord:this._libp2p.peerStore.addressBook.getRawEnvelope(t)})}))}return{topicID:t,peers:n,backoff:i}}}v.multicodec=l.GossipsubIDv11,t.exports=v},{"libp2p-interfaces/src/pubsub":"6JRpn","./message-cache":"gJumF","./message/rpc":"8UPPx","./constants":"kx67k","./heartbeat":"l9R1d","./get-gossip-peers":"jYUGm","./utils":"8kUZs","./score":"8Uy6q","./tracer":"8V5x8","time-cache":"gpqKk","peer-id":"8Bdb3","libp2p/src/record/envelope":"27rHX"}],"6JRpn":[function(e,t,r){"use strict";const i=e("debug"),{EventEmitter:n}=e("events"),s=e("err-code"),{pipe:o}=e("it-pipe"),{default:a}=e("p-queue"),c=e("../topology/multicodec-topology"),{codes:u}=e("./errors"),{RPC:l}=e("./message/rpc"),d=e("./peer-streams"),{SignaturePolicy:f}=e("./signature-policy"),h=e("./utils"),{signMessage:p,verifySignature:g}=e("./message/sign");class y extends n{constructor({debugName:e,multicodecs:t,libp2p:r,globalSignaturePolicy:n=f.StrictSign,canRelayMessage:o=!1,emitSelf:c=!1,messageProcessingConcurrency:l=10}){if("string"!=typeof e)throw new Error("a debugname `string` is required");if(!t)throw new Error("multicodecs are required");if(!r)throw new Error("libp2p is required");if(super(),this.log=Object.assign(i(e),{err:i(`${e}:error`)}),this.multicodecs=h.ensureArray(t),this._libp2p=r,this.registrar=r.registrar,this.peerId=r.peerId,this.started=!1,this.topics=new Map,this.subscriptions=new Set,this.peers=new Map,!f[n])throw s(new Error("Invalid global signature policy"),u.ERR_INVALID_SIGNATURE_POLICY);this.globalSignaturePolicy=n,this.canRelayMessage=o,this.emitSelf=c,this.topicValidators=new Map,this.queue=new a({concurrency:l}),this._registrarId=void 0,this._onIncomingStream=this._onIncomingStream.bind(this),this._onPeerConnected=this._onPeerConnected.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this)}start(){if(this.started)return;this.log("starting"),this.registrar.handle(this.multicodecs,this._onIncomingStream);const e=new c({multicodecs:this.multicodecs,handlers:{onConnect:this._onPeerConnected,onDisconnect:this._onPeerDisconnected}});this._registrarId=this.registrar.register(e),this.log("started"),this.started=!0}stop(){this.started&&(this.registrar.unregister(this._registrarId),this.log("stopping"),this.peers.forEach((e=>e.close())),this.peers=new Map,this.subscriptions=new Set,this.started=!1,this.log("stopped"))}_onIncomingStream({protocol:e,stream:t,connection:r}){const i=r.remotePeer,n=i.toB58String(),s=this._addPeer(i,e),o=s.attachInboundStream(t);this._processMessages(n,o,s)}async _onPeerConnected(e,t){const r=e.toB58String();this.log("connected",r);try{const{stream:r,protocol:i}=await t.newStream(this.multicodecs),n=this._addPeer(e,i);await n.attachOutboundStream(r)}catch(e){this.log.err(e)}this._sendSubscriptions(r,Array.from(this.subscriptions),!0)}_onPeerDisconnected(e,t){const r=e.toB58String();this.log("connection ended",r,t?t.message:""),this._removePeer(e)}_addPeer(e,t){const r=e.toB58String(),i=this.peers.get(r);if(i)return i;this.log("new peer",r);const n=new d({id:e,protocol:t});return this.peers.set(r,n),n.once("close",(()=>this._removePeer(e))),n}_removePeer(e){if(!e)return;const t=e.toB58String(),r=this.peers.get(t);if(r){r.removeAllListeners(),r.close(),this.log("delete peer",t),this.peers.delete(t);for(const e of this.topics.values())e.delete(t);return r}}async _processMessages(e,t,r){try{await o(t,(async t=>{for await(const i of t){const t=i instanceof Uint8Array?i:i.slice(),n=this._decodeRpc(t);(async()=>{try{await this._processRpc(e,r,n)}catch(e){this.log.err(e)}})()}}))}catch(e){this._onPeerDisconnected(r.id,e)}}async _processRpc(e,t,r){this.log("rpc from",e);const i=r.subscriptions,n=r.msgs;return i.length&&(i.forEach((t=>{this._processRpcSubOpt(e,t)})),this.emit("pubsub:subscription-change",t.id,i)),this._acceptFrom(e)?(n.length&&this.queue.addAll(n.map((t=>async()=>{if(this.canRelayMessage||t.topicIDs&&t.topicIDs.some((e=>this.subscriptions.has(e))))try{const r=h.normalizeInRpcMessage(t,e);await this._processRpcMessage(r)}catch(e){this.log.err(e)}else this.log("received message we didn't subscribe to. Dropping.")}))),!0):(this.log("received message from unacceptable peer %s",e),!1)}_processRpcSubOpt(e,t){const r=t.topicID;if(!r)return;let i=this.topics.get(r);i||(i=new Set,this.topics.set(r,i)),t.subscribe?i.add(e):i.delete(e)}async _processRpcMessage(e){if(this.peerId.toB58String()!==e.from||this.emitSelf){try{await this.validate(e)}catch(e){return void this.log("Message is invalid, dropping it. %O",e)}return this._emitMessage(e),this._publish(h.normalizeOutRpcMessage(e))}}_emitMessage(e){e.topicIDs.forEach((t=>{this.subscriptions.has(t)&&this.emit(t,e)}))}getMsgId(e){const t=this.globalSignaturePolicy;switch(t){case f.StrictSign:return h.msgId(e.from,e.seqno);case f.StrictNoSign:return h.noSignMsgId(e.data);default:throw s(new Error("Cannot get message id: unhandled signature policy: "+t),u.ERR_UNHANDLED_SIGNATURE_POLICY)}}_acceptFrom(e){return!0}_decodeRpc(e){return l.decode(e)}_encodeRpc(e){return l.encode(e).finish()}_sendRpc(e,t){const r=this.peers.get(e);if(r&&r.isWritable)r.write(this._encodeRpc(t));else{const t=`Cannot send RPC to ${e} as there is no open stream to it available`;this.log.err(t)}}_sendSubscriptions(e,t,r){return this._sendRpc(e,{subscriptions:t.map((e=>({topicID:e,subscribe:r})))})}async validate(e){const t=this.globalSignaturePolicy;switch(t){case f.StrictNoSign:if(e.from)throw s(new Error("StrictNoSigning: from should not be present"),u.ERR_UNEXPECTED_FROM);if(e.signature)throw s(new Error("StrictNoSigning: signature should not be present"),u.ERR_UNEXPECTED_SIGNATURE);if(e.key)throw s(new Error("StrictNoSigning: key should not be present"),u.ERR_UNEXPECTED_KEY);if(e.seqno)throw s(new Error("StrictNoSigning: seqno should not be present"),u.ERR_UNEXPECTED_SEQNO);break;case f.StrictSign:if(!e.signature)throw s(new Error("StrictSigning: Signing required and no signature was present"),u.ERR_MISSING_SIGNATURE);if(!e.seqno)throw s(new Error("StrictSigning: Signing required and no seqno was present"),u.ERR_MISSING_SEQNO);if(!await g(e))throw s(new Error("StrictSigning: Invalid message signature"),u.ERR_INVALID_SIGNATURE);break;default:throw s(new Error("Cannot validate message: unhandled signature policy: "+t),u.ERR_UNHANDLED_SIGNATURE_POLICY)}for(const t of e.topicIDs){const r=this.topicValidators.get(t);r&&await r(t,e)}}_buildMessage(e){const t=this.globalSignaturePolicy;switch(t){case f.StrictSign:return e.from=this.peerId.toB58String(),e.seqno=h.randomSeqno(),p(this.peerId,e);case f.StrictNoSign:return Promise.resolve(e);default:throw s(new Error("Cannot build message: unhandled signature policy: "+t),u.ERR_UNHANDLED_SIGNATURE_POLICY)}}getSubscribers(e){if(!this.started)throw s(new Error("not started yet"),"ERR_NOT_STARTED_YET");if(!e||"string"!=typeof e)throw s(new Error("a string topic must be provided"),"ERR_NOT_VALID_TOPIC");const t=this.topics.get(e);return t?Array.from(t):[]}async publish(e,t){if(!this.started)throw new Error("Pubsub has not started");this.log("publish",e,t);const r={receivedFrom:this.peerId.toB58String(),data:t,topicIDs:[e]},i=await this._buildMessage(r),n=h.normalizeInRpcMessage(i);this.emitSelf&&this._emitMessage(n),await this._publish(n)}_publish(e){throw s(new Error("publish must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}subscribe(e){if(!this.started)throw new Error("Pubsub has not started");this.subscriptions.has(e)||(this.subscriptions.add(e),this.peers.forEach(((t,r)=>this._sendSubscriptions(r,[e],!0))))}unsubscribe(e){if(!this.started)throw new Error("Pubsub is not started");this.subscriptions.has(e)&&0===this.listenerCount(e)&&(this.subscriptions.delete(e),this.peers.forEach(((t,r)=>this._sendSubscriptions(r,[e],!1))))}getTopics(){if(!this.started)throw new Error("Pubsub is not started");return Array.from(this.subscriptions)}}y.utils=h,y.SignaturePolicy=f,t.exports=y},{debug:"bO5wM",events:"g82pp","err-code":"chZjB","it-pipe":"giKBQ","p-queue":"biPlv","../topology/multicodec-topology":"52SML","./errors":"i7hyG","./message/rpc":"27BcS","./peer-streams":"l6fHJ","./signature-policy":"dUKk2","./utils":"3CEYj","./message/sign":"2dsDd"}],"52SML":[function(e,t,r){"use strict";const i=e("./index"),n=Symbol.for("@libp2p/js-interfaces/topology/multicodec-topology");class s extends i{constructor({min:e,max:t,multicodecs:r,handlers:i}){if(super({min:e,max:t,handlers:i}),!r)throw new Error("one or more multicodec should be provided");if(!i)throw new Error("the handlers should be provided");if("function"!=typeof i.onConnect)throw new Error("the 'onConnect' handler must be provided");if("function"!=typeof i.onDisconnect)throw new Error("the 'onDisconnect' handler must be provided");this.multicodecs=Array.isArray(r)?r:[r],this._registrar=void 0,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerConnect=this._onPeerConnect.bind(this)}get[Symbol.toStringTag](){return"Topology"}get[n](){return!0}static isMulticodecTopology(e){return Boolean(e&&e[n])}set registrar(e){this._registrar=e,this._registrar.peerStore.on("change:protocols",this._onProtocolChange),this._registrar.connectionManager.on("peer:connect",this._onPeerConnect),this._updatePeers(this._registrar.peerStore.peers.values())}_updatePeers(e){for(const{id:t,protocols:r}of e)if(this.multicodecs.filter((e=>r.includes(e))).length){this.peers.add(t.toB58String());const e=this._registrar.getConnection(t);e&&this._onConnect(t,e)}else this.peers.delete(t.toB58String())}_onProtocolChange({peerId:e,protocols:t}){const r=this.peers.has(e.toB58String()),i=t.filter((e=>this.multicodecs.includes(e)));r&&0===i.length&&this._onDisconnect(e);for(const r of t)if(this.multicodecs.includes(r)){const t=this._registrar.peerStore.get(e);return void this._updatePeers([t])}}_onPeerConnect(e){const t=e.remotePeer,r=this._registrar.peerStore.protoBook.get(t);r&&this.multicodecs.find((e=>r.includes(e)))&&(this.peers.add(t.toB58String()),this._onConnect(t,e))}}t.exports=s},{"./index":"6HbOL"}],"6HbOL":[function(e,t,r){"use strict";const i=()=>{},n=Symbol.for("@libp2p/js-interfaces/topology");class s{constructor({min:e=0,max:t=1/0,handlers:r={}}){this.min=e,this.max=t,this._onConnect=r.onConnect||i,this._onDisconnect=r.onDisconnect||i,this.peers=new Set}get[Symbol.toStringTag](){return"Topology"}get[n](){return!0}static isTopology(e){return Boolean(e&&e[n])}set registrar(e){this._registrar=e}disconnect(e){this._onDisconnect(e)}}t.exports=s},{}],i7hyG:[function(e,t,r){"use strict";r.codes={ERR_INVALID_SIGNATURE_POLICY:"ERR_INVALID_SIGNATURE_POLICY",ERR_UNHANDLED_SIGNATURE_POLICY:"ERR_UNHANDLED_SIGNATURE_POLICY",ERR_MISSING_SIGNATURE:"ERR_MISSING_SIGNATURE",ERR_MISSING_SEQNO:"ERR_MISSING_SEQNO",ERR_INVALID_SIGNATURE:"ERR_INVALID_SIGNATURE",ERR_UNEXPECTED_FROM:"ERR_UNEXPECTED_FROM",ERR_UNEXPECTED_SIGNATURE:"ERR_UNEXPECTED_SIGNATURE",ERR_UNEXPECTED_KEY:"ERR_UNEXPECTED_KEY",ERR_UNEXPECTED_SEQNO:"ERR_UNEXPECTED_SEQNO"}},{}],"27BcS":[function(e,t,r){"use strict";var i=e("protobufjs/minimal"),n=i.Reader,s=i.Writer,o=i.util,a=i.roots["libp2p-pubsub-rpc"]||(i.roots["libp2p-pubsub-rpc"]={});a.RPC=function(){function e(e){if(this.subscriptions=[],this.msgs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.subscriptions=o.emptyArray,e.prototype.msgs=o.emptyArray,e.encode=function(e,t){if(t||(t=s.create()),null!=e.subscriptions&&e.subscriptions.length)for(var r=0;r<e.subscriptions.length;++r)a.RPC.SubOpts.encode(e.subscriptions[r],t.uint32(10).fork()).ldelim();if(null!=e.msgs&&e.msgs.length)for(r=0;r<e.msgs.length;++r)a.RPC.Message.encode(e.msgs[r],t.uint32(18).fork()).ldelim();return t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.RPC;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.subscriptions&&i.subscriptions.length||(i.subscriptions=[]),i.subscriptions.push(a.RPC.SubOpts.decode(e,e.uint32()));break;case 2:i.msgs&&i.msgs.length||(i.msgs=[]),i.msgs.push(a.RPC.Message.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.RPC)return e;var t=new a.RPC;if(e.subscriptions){if(!Array.isArray(e.subscriptions))throw TypeError(".RPC.subscriptions: array expected");t.subscriptions=[];for(var r=0;r<e.subscriptions.length;++r){if("object"!=typeof e.subscriptions[r])throw TypeError(".RPC.subscriptions: object expected");t.subscriptions[r]=a.RPC.SubOpts.fromObject(e.subscriptions[r])}}if(e.msgs){if(!Array.isArray(e.msgs))throw TypeError(".RPC.msgs: array expected");t.msgs=[];for(r=0;r<e.msgs.length;++r){if("object"!=typeof e.msgs[r])throw TypeError(".RPC.msgs: object expected");t.msgs[r]=a.RPC.Message.fromObject(e.msgs[r])}}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.subscriptions=[],r.msgs=[]),e.subscriptions&&e.subscriptions.length){r.subscriptions=[];for(var i=0;i<e.subscriptions.length;++i)r.subscriptions[i]=a.RPC.SubOpts.toObject(e.subscriptions[i],t)}if(e.msgs&&e.msgs.length){r.msgs=[];for(i=0;i<e.msgs.length;++i)r.msgs[i]=a.RPC.Message.toObject(e.msgs[i],t)}return r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e.SubOpts=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var t;return e.prototype.subscribe=null,e.prototype.topicID=null,Object.defineProperty(e.prototype,"_subscribe",{get:o.oneOfGetter(t=["subscribe"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_topicID",{get:o.oneOfGetter(t=["topicID"]),set:o.oneOfSetter(t)}),e.encode=function(e,t){return t||(t=s.create()),null!=e.subscribe&&Object.hasOwnProperty.call(e,"subscribe")&&t.uint32(8).bool(e.subscribe),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(18).string(e.topicID),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.RPC.SubOpts;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.subscribe=e.bool();break;case 2:i.topicID=e.string();break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.RPC.SubOpts)return e;var t=new a.RPC.SubOpts;return null!=e.subscribe&&(t.subscribe=Boolean(e.subscribe)),null!=e.topicID&&(t.topicID=String(e.topicID)),t},e.toObject=function(e,t){t||(t={});var r={};return null!=e.subscribe&&e.hasOwnProperty("subscribe")&&(r.subscribe=e.subscribe,t.oneofs&&(r._subscribe="subscribe")),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),e.Message=function(){function e(e){if(this.topicIDs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var t;return e.prototype.from=null,e.prototype.data=null,e.prototype.seqno=null,e.prototype.topicIDs=o.emptyArray,e.prototype.signature=null,e.prototype.key=null,Object.defineProperty(e.prototype,"_from",{get:o.oneOfGetter(t=["from"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_data",{get:o.oneOfGetter(t=["data"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_seqno",{get:o.oneOfGetter(t=["seqno"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_signature",{get:o.oneOfGetter(t=["signature"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_key",{get:o.oneOfGetter(t=["key"]),set:o.oneOfSetter(t)}),e.encode=function(e,t){if(t||(t=s.create()),null!=e.from&&Object.hasOwnProperty.call(e,"from")&&t.uint32(10).bytes(e.from),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(18).bytes(e.data),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(26).bytes(e.seqno),null!=e.topicIDs&&e.topicIDs.length)for(var r=0;r<e.topicIDs.length;++r)t.uint32(34).string(e.topicIDs[r]);return null!=e.signature&&Object.hasOwnProperty.call(e,"signature")&&t.uint32(42).bytes(e.signature),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(50).bytes(e.key),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.RPC.Message;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.from=e.bytes();break;case 2:i.data=e.bytes();break;case 3:i.seqno=e.bytes();break;case 4:i.topicIDs&&i.topicIDs.length||(i.topicIDs=[]),i.topicIDs.push(e.string());break;case 5:i.signature=e.bytes();break;case 6:i.key=e.bytes();break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.RPC.Message)return e;var t=new a.RPC.Message;if(null!=e.from&&("string"==typeof e.from?o.base64.decode(e.from,t.from=o.newBuffer(o.base64.length(e.from)),0):e.from.length&&(t.from=e.from)),null!=e.data&&("string"==typeof e.data?o.base64.decode(e.data,t.data=o.newBuffer(o.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),null!=e.seqno&&("string"==typeof e.seqno?o.base64.decode(e.seqno,t.seqno=o.newBuffer(o.base64.length(e.seqno)),0):e.seqno.length&&(t.seqno=e.seqno)),e.topicIDs){if(!Array.isArray(e.topicIDs))throw TypeError(".RPC.Message.topicIDs: array expected");t.topicIDs=[];for(var r=0;r<e.topicIDs.length;++r)t.topicIDs[r]=String(e.topicIDs[r])}return null!=e.signature&&("string"==typeof e.signature?o.base64.decode(e.signature,t.signature=o.newBuffer(o.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),null!=e.key&&("string"==typeof e.key?o.base64.decode(e.key,t.key=o.newBuffer(o.base64.length(e.key)),0):e.key.length&&(t.key=e.key)),t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.topicIDs=[]),null!=e.from&&e.hasOwnProperty("from")&&(r.from=t.bytes===String?o.base64.encode(e.from,0,e.from.length):t.bytes===Array?Array.prototype.slice.call(e.from):e.from,t.oneofs&&(r._from="from")),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?o.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data,t.oneofs&&(r._data="data")),null!=e.seqno&&e.hasOwnProperty("seqno")&&(r.seqno=t.bytes===String?o.base64.encode(e.seqno,0,e.seqno.length):t.bytes===Array?Array.prototype.slice.call(e.seqno):e.seqno,t.oneofs&&(r._seqno="seqno")),e.topicIDs&&e.topicIDs.length){r.topicIDs=[];for(var i=0;i<e.topicIDs.length;++i)r.topicIDs[i]=e.topicIDs[i]}return null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?o.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature,t.oneofs&&(r._signature="signature")),null!=e.key&&e.hasOwnProperty("key")&&(r.key=t.bytes===String?o.base64.encode(e.key,0,e.key.length):t.bytes===Array?Array.prototype.slice.call(e.key):e.key,t.oneofs&&(r._key="key")),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),e}(),t.exports=a},{"protobufjs/minimal":"grAXL"}],l6fHJ:[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p-pubsub:peer-streams"),{error:i("libp2p-pubsub:peer-streams:err")}),{EventEmitter:s}=e("events"),o=e("it-length-prefixed"),a=e("it-pushable"),{pipe:c}=e("it-pipe"),{source:u}=e("abortable-iterator"),l=e("abort-controller").default;t.exports=class extends s{constructor({id:e,protocol:t}){super(),this.id=e,this.protocol=t,this._rawOutboundStream=null,this._rawInboundStream=null,this._inboundAbortController=new l,this.outboundStream=null,this.inboundStream=null}get isReadable(){return Boolean(this.inboundStream)}get isWritable(){return Boolean(this.outboundStream)}write(e){if(!this.outboundStream){const e=this.id.toB58String();throw new Error("No writable connection to "+e)}this.outboundStream.push(e)}attachInboundStream(e){return this._rawInboundStream=e,this.inboundStream=u(c(this._rawInboundStream,o.decode()),this._inboundAbortController.signal,{returnOnAbort:!0}),this.emit("stream:inbound"),this.inboundStream}async attachOutboundStream(e){const t=this.outboundStream;this.outboundStream&&await this.outboundStream.end(),this._rawOutboundStream=e,this.outboundStream=a({onEnd:e=>{this._rawOutboundStream&&this._rawOutboundStream.reset&&this._rawOutboundStream.reset(),this._rawOutboundStream=null,this.outboundStream=null,e&&this.emit("close")}}),c(this.outboundStream,o.encode(),this._rawOutboundStream).catch((e=>{n.error(e)})),t||this.emit("stream:outbound")}close(){this.outboundStream&&this.outboundStream.end(),this.inboundStream&&this._inboundAbortController.abort(),this._rawOutboundStream=null,this.outboundStream=null,this._rawInboundStream=null,this.inboundStream=null,this.emit("close")}}},{debug:"bO5wM",events:"g82pp","it-length-prefixed":"3yxIE","it-pushable":"bnpei","it-pipe":"giKBQ","abortable-iterator":"awlU8","abort-controller":"lNJ7z"}],"3yxIE":[function(e,t,r){"use strict";r.encode=e("./encode"),r.decode=e("./decode"),r.varintEncode=e("./varint-encode"),r.varintDecode=e("./varint-decode"),r.int32BEEncode=e("./int32BE-encode"),r.int32BEDecode=e("./int32BE-decode")},{"./encode":"d162i","./decode":"gBAfD","./varint-encode":"c11wj","./varint-decode":"eMugP","./int32BE-encode":"lRnoQ","./int32BE-decode":"aDo5s"}],d162i:[function(e,t,r){"use strict";const{Buffer:i}=e("buffer"),n=e("bl/BufferList"),s=e("./varint-encode");function o(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||s;return async function*(e){let s=i.alloc(t),o=0;for await(const a of e){r(a.length,s,o);const e=s.slice(o,o+r.bytes);o+=r.bytes,s.length-o<8&&(s=i.alloc(t),o=0),yield(new n).append(e).append(a)}}}o.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||s;return new n([r(e.length),e.slice()])},t.exports=o,t.exports.MIN_POOL_SIZE=8,t.exports.DEFAULT_POOL_SIZE=10240},{buffer:"etowf","bl/BufferList":"im7j6","./varint-encode":"c11wj"}],c11wj:[function(e,t,r){"use strict";const i=e("varint"),{Buffer:n}=e("buffer"),s=(e,t,r)=>{const o=i.encode(e,t,r);return s.bytes=i.encode.bytes,t||n.from(o)};t.exports=s},{varint:"aN1CO",buffer:"etowf"}],gBAfD:[function(e,t,r){"use strict";const{Buffer:i}=e("buffer"),n=e("bl/BufferList"),s=e("./varint-decode"),o=4194304,a=i.alloc(0),c="readLength",u="readData",l={[c]:(e,t,r,i)=>{let s;t=t.append(e);try{s=i.lengthDecoder(t)}catch(e){if(t.length>i.maxLengthLength)throw Object.assign(e,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(e instanceof RangeError)return{mode:c,buffer:t,chunk:void 0,state:void 0,data:void 0};throw e}if(s>i.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=t.shallowSlice(i.lengthDecoder.bytes),t=new n,i.onLength&&i.onLength(s),s<=0?(i.onData&&i.onData(a),{mode:c,chunk:e,buffer:t,data:a}):{mode:u,chunk:e,buffer:t,state:{dataLength:s},data:void 0}},[u]:(e,t,r,i)=>{if(t=t.append(e),!r)throw new Error("state is required");if(t.length<r.dataLength)return{mode:u,buffer:t,state:r,chunk:void 0,data:void 0};const{dataLength:s}=r,o=t.shallowSlice(0,s),a=t.length>s?t.shallowSlice(s):void 0;return t=new n,i.onData&&i.onData(o),{mode:c,chunk:a,buffer:t,state:void 0,data:o}}};function d(e){const t={lengthDecoder:(e=e||{}).lengthDecoder||s,maxLengthLength:e.maxLengthLength||8,maxDataLength:e.maxDataLength||o,onLength:e.onLength,onData:e.onData};return async function*(e){let r,i=new n,s=c;for await(const n of e){let e=n;for(;e;){const n=l[s](e,i,r,t);s=n.mode,e=n.chunk,i=n.buffer,r=n.state,n.data&&(yield n.data)}}if(i.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}d.fromReader=(e,t)=>{let r=1;const i={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(r)}catch(e){if("ERR_UNDER_READ"===e.code)return{done:!0,value:null};throw e}finally{r=1}}};return d({...t||{},onLength:e=>{r=e}})(i)},t.exports=d,t.exports.MAX_LENGTH_LENGTH=8,t.exports.MAX_DATA_LENGTH=o},{buffer:"etowf","bl/BufferList":"im7j6","./varint-decode":"eMugP"}],eMugP:[function(e,t,r){"use strict";const i=e("varint"),{Buffer:n}=e("buffer"),s=e=>{const t=i.decode(n.isBuffer(e)?e:(r=e,new Proxy({},{get:(e,t)=>"l"===t[0]?r[t]:r.get(parseInt(t))})));var r;return s.bytes=i.decode.bytes,t};t.exports=s},{varint:"aN1CO",buffer:"etowf"}],lRnoQ:[function(e,t,r){"use strict";const{Buffer:i}=e("buffer"),n=(e,t,r)=>((t=t||i.allocUnsafe(4)).writeInt32BE(e,r),t);n.bytes=4,t.exports=n},{buffer:"etowf"}],aDo5s:[function(e,t,r){"use strict";const i=e=>{if(e.length<4)throw RangeError("Could not decode int32BE");return e.readInt32BE(0)};i.bytes=4,t.exports=i},{}],awlU8:[function(e,t,r){const i=e("get-iterator"),n=e("./AbortError"),s=(e,t,r)=>o(e,Array.isArray(t)?t:[{signal:t,options:r}]),o=(e,t)=>(e=i(e),t=t.map((({signal:e,options:t})=>({signal:e,options:t||{}}))),async function*(){let r;const i=()=>{r&&r()};for(const{signal:e}of t)e.addEventListener("abort",i);for(;;){let s;try{for(const{signal:e,options:r}of t)if(e.aborted){const{abortMessage:e,abortCode:t}=r;throw new n(e,t)}const i=new Promise(((e,i)=>{r=()=>{const{options:e}=t.find((({signal:e})=>e.aborted)),{abortMessage:r,abortCode:s}=e;i(new n(r,s))}}));s=await Promise.race([i,e.next()]),r=null}catch(r){for(const{signal:e}of t)e.removeEventListener("abort",i);const n=t.find((({signal:e})=>e.aborted)),s="aborted"===r.type&&n;if(s&&n.options.onAbort&&await n.options.onAbort(e),"function"==typeof e.return&&await e.return(),s&&n.options.returnOnAbort)return;throw r}if(s.done)break;yield s.value}for(const{signal:e}of t)e.removeEventListener("abort",i)}()),a=(e,t,r)=>c(e,Array.isArray(t)?t:[{signal:t,options:r}]),c=(e,t)=>r=>e(o(r,t)),u=(e,t)=>({sink:c(e.sink,t),source:o(e.source,t)});t.exports=s,t.exports.AbortError=n,t.exports.source=s,t.exports.sink=a,t.exports.transform=a,t.exports.duplex=(e,t,r)=>u(e,Array.isArray(t)?t:[{signal:t,options:r}])},{"get-iterator":"li8y1","./AbortError":"daAph"}],li8y1:[function(e,t,r){t.exports=function(e){if(e){if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();if("function"==typeof e.next)return e}throw new Error("argument is not an iterator or iterable")}},{}],daAph:[function(e,t,r){t.exports=class extends Error{constructor(e,t){super(e||"The operation was aborted"),this.type="aborted",this.code=t||"ABORT_ERR"}}},{}],dUKk2:[function(e,t,r){"use strict";r.SignaturePolicy={StrictSign:"StrictSign",StrictNoSign:"StrictNoSign"}},{}],"3CEYj":[function(e,t,r){"use strict";const i=e("libp2p-crypto/src/random-bytes"),{toString:n}=e("uint8arrays/to-string"),{fromString:s}=e("uint8arrays/from-string"),o=e("peer-id"),{sha256:a}=e("multiformats/hashes/sha2");t.exports={randomSeqno:()=>i(8),msgId:(e,t)=>{let r;r=e instanceof Uint8Array?o.createFromBytes(e).id:o.parse(e).id;const i=new Uint8Array(r.length+t.length);return i.set(r,0),i.set(t,r.length),i},noSignMsgId:e=>a.encode(e),anyMatch:(e,t)=>{let r;r=Array.isArray(t)?e=>t.indexOf(e)>-1:e=>t.has(e);for(const t of e)if(r(t))return!0;return!1},ensureArray:e=>Array.isArray(e)?e:[e],normalizeInRpcMessage:(e,t)=>{const r=Object.assign({},e);return e.from instanceof Uint8Array&&(r.from=n(e.from,"base58btc")),t&&(r.receivedFrom=t),r},normalizeOutRpcMessage:e=>{const t=Object.assign({},e);return"string"==typeof e.from&&(t.from=s(e.from,"base58btc")),"string"==typeof e.data&&(t.data=s(e.data)),t}}},{"libp2p-crypto/src/random-bytes":"gsnuW","uint8arrays/to-string":"hC8JB","uint8arrays/from-string":"dF7Y4","peer-id":"8Bdb3","multiformats/hashes/sha2":"7i9MT"}],"2dsDd":[function(e,t,r){"use strict";const i=e("peer-id"),{RPC:n}=e("./rpc"),{concat:s}=e("uint8arrays/concat"),{fromString:o}=e("uint8arrays/from-string"),a=o("libp2p-pubsub:"),{normalizeOutRpcMessage:c}=e("../utils");async function u(e){if(!e.from)throw new Error("Could not get the public key from the originator id");const t=i.createFromB58String(e.from);if(e.key){const r=await i.createFromPubKey(e.key);if(r.equals(t))return r.pubKey;throw new Error("Public Key does not match the originator")}if(t.pubKey)return t.pubKey;throw new Error("Could not get the public key from the originator id")}t.exports={messagePublicKey:u,signMessage:async function(e,t){const r=s([a,n.Message.encode(c(t)).finish()]),i=await e.privKey.sign(r);return{...t,signature:i,key:e.pubKey.bytes}},SignPrefix:a,verifySignature:async function(e){if(!e.signature)throw new Error("Message must contain a signature to be verified");if(!e.from)throw new Error("Message must contain a from property to be verified");const t=s([a,n.Message.encode({...e,from:i.createFromB58String(e.from).toBytes(),signature:void 0,key:void 0}).finish()]);return(await u(e)).verify(t,e.signature)}}},{"peer-id":"8Bdb3","./rpc":"27BcS","uint8arrays/concat":"4EBjG","uint8arrays/from-string":"dF7Y4","../utils":"3CEYj"}],gJumF:[function(e,t,r){"use strict";var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.MessageCache=void 0;const n=e("./utils");r.MessageCache=class{constructor(e,t,r){this.msgs=new Map,this.peertx=new Map,this.history=[];for(let e=0;e<t;e++)this.history[e]=[];this.gossip=e,this.msgIdFn=r}put(e){return i(this,void 0,void 0,(function*(){const t=yield this.getMsgId(e),r=n.messageIdToString(t);this.msgs.set(r,e),this.history[0].push({msgID:t,topics:e.topicIDs})}))}getMsgId(e){return this.msgIdFn(e)}get(e){return this.msgs.get(n.messageIdToString(e))}getForPeer(e,t){const r=n.messageIdToString(e),i=this.msgs.get(r);if(!i)return[void 0,0];let s=this.peertx.get(r);s||(s=new Map,this.peertx.set(r,s));const o=(s.get(t)||0)+1;return s.set(t,o),[i,o]}getGossipIDs(e){const t=[];for(let r=0;r<this.gossip;r++)this.history[r].forEach((r=>{for(const i of r.topics)if(i===e){t.push(r.msgID);break}}));return t}shift(){this.history[this.history.length-1].forEach((e=>{const t=n.messageIdToString(e.msgID);this.msgs.delete(t),this.peertx.delete(t)})),this.history.pop(),this.history.unshift([])}}},{"./utils":"8kUZs"}],"8kUZs":[function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),n(e("./create-gossip-rpc"),r),n(e("./shuffle"),r),n(e("./has-gossip-protocol"),r),n(e("./messageIdToString"),r)},{"./create-gossip-rpc":"8OYkT","./shuffle":"e1hER","./has-gossip-protocol":"l4KwQ","./messageIdToString":"8V5xp"}],"8OYkT":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.createGossipRpc=void 0,r.createGossipRpc=function(e=[],t={}){return{subscriptions:[],msgs:e,control:Object.assign({ihave:[],iwant:[],graft:[],prune:[]},t)}}},{}],e1hER:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shuffle=void 0,r.shuffle=function(e){if(e.length<=1)return e;for(let t=0;t<e.length;t++){const r=Math.floor(Math.random()*Math.floor(e.length)),i=e[t];e[t]=e[r],e[r]=i}return e}},{}],l4KwQ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hasGossipProtocol=void 0;const i=e("../constants");r.hasGossipProtocol=function(e){return e===i.GossipsubIDv10||e===i.GossipsubIDv11}},{"../constants":"kx67k"}],kx67k:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ERR_TOPIC_VALIDATOR_IGNORE=r.ERR_TOPIC_VALIDATOR_REJECT=r.TimeCacheDuration=r.GossipsubSeenTTL=r.GossipsubIWantFollowupTime=r.GossipsubMaxIHaveMessages=r.GossipsubMaxIHaveLength=r.GossipsubGraftFloodThreshold=r.GossipsubOpportunisticGraftPeers=r.GossipsubOpportunisticGraftTicks=r.GossipsubDirectConnectInitialDelay=r.GossipsubDirectConnectTicks=r.GossipsubConnectionTimeout=r.GossipsubMaxPendingConnections=r.GossipsubConnectors=r.GossipsubPruneBackoffTicks=r.GossipsubPruneBackoff=r.GossipsubPrunePeers=r.GossipsubFanoutTTL=r.GossipsubHeartbeatInterval=r.GossipsubHeartbeatInitialDelay=r.GossipsubGossipRetransmission=r.GossipsubGossipFactor=r.GossipsubDlazy=r.GossipsubHistoryGossip=r.GossipsubHistoryLength=r.GossipsubDout=r.GossipsubDscore=r.GossipsubDhi=r.GossipsubDlo=r.GossipsubD=r.GossipsubIDv11=r.GossipsubIDv10=r.FloodsubID=r.minute=r.second=void 0,r.second=1e3,r.minute=60*r.second,r.FloodsubID="/floodsub/1.0.0",r.GossipsubIDv10="/meshsub/1.0.0",r.GossipsubIDv11="/meshsub/1.1.0",r.GossipsubD=6,r.GossipsubDlo=4,r.GossipsubDhi=12,r.GossipsubDscore=4,r.GossipsubDout=2,r.GossipsubHistoryLength=5,r.GossipsubHistoryGossip=3,r.GossipsubDlazy=6,r.GossipsubGossipFactor=.25,r.GossipsubGossipRetransmission=3,r.GossipsubHeartbeatInitialDelay=100,r.GossipsubHeartbeatInterval=r.second,r.GossipsubFanoutTTL=r.minute,r.GossipsubPrunePeers=16,r.GossipsubPruneBackoff=r.minute,r.GossipsubPruneBackoffTicks=15,r.GossipsubConnectors=8,r.GossipsubMaxPendingConnections=128,r.GossipsubConnectionTimeout=30*r.second,r.GossipsubDirectConnectTicks=300,r.GossipsubDirectConnectInitialDelay=r.second,r.GossipsubOpportunisticGraftTicks=60,r.GossipsubOpportunisticGraftPeers=2,r.GossipsubGraftFloodThreshold=10*r.second,r.GossipsubMaxIHaveLength=5e3,r.GossipsubMaxIHaveMessages=10,r.GossipsubIWantFollowupTime=3*r.second,r.GossipsubSeenTTL=30*r.second,r.TimeCacheDuration=12e4,r.ERR_TOPIC_VALIDATOR_REJECT="ERR_TOPIC_VALIDATOR_REJECT",r.ERR_TOPIC_VALIDATOR_IGNORE="ERR_TOPIC_VALIDATOR_IGNORE"},{}],"8V5xp":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.messageIdToString=void 0;const i=e("uint8arrays/to-string");r.messageIdToString=function(e){return i.toString(e,"base64")}},{"uint8arrays/to-string":"hC8JB"}],"8UPPx":[function(e,t,r){var i;i=function(e){"use strict";var t=e.Reader,r=e.Writer,i=e.util,n=e.roots.default||(e.roots.default={});return n.RPC=function(){function s(e){if(this.subscriptions=[],this.msgs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.subscriptions=i.emptyArray,s.prototype.msgs=i.emptyArray,s.prototype.control=null,Object.defineProperty(s.prototype,"_control",{get:i.oneOfGetter(o=["control"]),set:i.oneOfSetter(o)}),s.encode=function(e,t){if(t||(t=r.create()),null!=e.subscriptions&&e.subscriptions.length)for(var i=0;i<e.subscriptions.length;++i)n.RPC.SubOpts.encode(e.subscriptions[i],t.uint32(10).fork()).ldelim();if(null!=e.msgs&&e.msgs.length)for(i=0;i<e.msgs.length;++i)n.RPC.Message.encode(e.msgs[i],t.uint32(18).fork()).ldelim();return null!=e.control&&Object.hasOwnProperty.call(e,"control")&&n.RPC.ControlMessage.encode(e.control,t.uint32(26).fork()).ldelim(),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var i=void 0===r?e.len:e.pos+r,s=new n.RPC;e.pos<i;){var o=e.uint32();switch(o>>>3){case 1:s.subscriptions&&s.subscriptions.length||(s.subscriptions=[]),s.subscriptions.push(n.RPC.SubOpts.decode(e,e.uint32()));break;case 2:s.msgs&&s.msgs.length||(s.msgs=[]),s.msgs.push(n.RPC.Message.decode(e,e.uint32()));break;case 3:s.control=n.RPC.ControlMessage.decode(e,e.uint32());break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof n.RPC)return e;var t=new n.RPC;if(e.subscriptions){if(!Array.isArray(e.subscriptions))throw TypeError(".RPC.subscriptions: array expected");t.subscriptions=[];for(var r=0;r<e.subscriptions.length;++r){if("object"!=typeof e.subscriptions[r])throw TypeError(".RPC.subscriptions: object expected");t.subscriptions[r]=n.RPC.SubOpts.fromObject(e.subscriptions[r])}}if(e.msgs){if(!Array.isArray(e.msgs))throw TypeError(".RPC.msgs: array expected");for(t.msgs=[],r=0;r<e.msgs.length;++r){if("object"!=typeof e.msgs[r])throw TypeError(".RPC.msgs: object expected");t.msgs[r]=n.RPC.Message.fromObject(e.msgs[r])}}if(null!=e.control){if("object"!=typeof e.control)throw TypeError(".RPC.control: object expected");t.control=n.RPC.ControlMessage.fromObject(e.control)}return t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.subscriptions=[],r.msgs=[]),e.subscriptions&&e.subscriptions.length){r.subscriptions=[];for(var i=0;i<e.subscriptions.length;++i)r.subscriptions[i]=n.RPC.SubOpts.toObject(e.subscriptions[i],t)}if(e.msgs&&e.msgs.length)for(r.msgs=[],i=0;i<e.msgs.length;++i)r.msgs[i]=n.RPC.Message.toObject(e.msgs[i],t);return null!=e.control&&e.hasOwnProperty("control")&&(r.control=n.RPC.ControlMessage.toObject(e.control,t),t.oneofs&&(r._control="control")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s.SubOpts=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.subscribe=null,s.prototype.topicID=null,Object.defineProperty(s.prototype,"_subscribe",{get:i.oneOfGetter(o=["subscribe"]),set:i.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_topicID",{get:i.oneOfGetter(o=["topicID"]),set:i.oneOfSetter(o)}),s.encode=function(e,t){return t||(t=r.create()),null!=e.subscribe&&Object.hasOwnProperty.call(e,"subscribe")&&t.uint32(8).bool(e.subscribe),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(18).string(e.topicID),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var i=void 0===r?e.len:e.pos+r,s=new n.RPC.SubOpts;e.pos<i;){var o=e.uint32();switch(o>>>3){case 1:s.subscribe=e.bool();break;case 2:s.topicID=e.string();break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.SubOpts)return e;var t=new n.RPC.SubOpts;return null!=e.subscribe&&(t.subscribe=Boolean(e.subscribe)),null!=e.topicID&&(t.topicID=String(e.topicID)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.subscribe&&e.hasOwnProperty("subscribe")&&(r.subscribe=e.subscribe,t.oneofs&&(r._subscribe="subscribe")),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.Message=function(){function s(e){if(this.topicIDs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.from=null,s.prototype.data=null,s.prototype.seqno=null,s.prototype.topicIDs=i.emptyArray,s.prototype.signature=null,s.prototype.key=null,Object.defineProperty(s.prototype,"_from",{get:i.oneOfGetter(o=["from"]),set:i.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_data",{get:i.oneOfGetter(o=["data"]),set:i.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_seqno",{get:i.oneOfGetter(o=["seqno"]),set:i.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_signature",{get:i.oneOfGetter(o=["signature"]),set:i.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_key",{get:i.oneOfGetter(o=["key"]),set:i.oneOfSetter(o)}),s.encode=function(e,t){if(t||(t=r.create()),null!=e.from&&Object.hasOwnProperty.call(e,"from")&&t.uint32(10).bytes(e.from),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(18).bytes(e.data),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(26).bytes(e.seqno),null!=e.topicIDs&&e.topicIDs.length)for(var i=0;i<e.topicIDs.length;++i)t.uint32(34).string(e.topicIDs[i]);return null!=e.signature&&Object.hasOwnProperty.call(e,"signature")&&t.uint32(42).bytes(e.signature),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(50).bytes(e.key),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var i=void 0===r?e.len:e.pos+r,s=new n.RPC.Message;e.pos<i;){var o=e.uint32();switch(o>>>3){case 1:s.from=e.bytes();break;case 2:s.data=e.bytes();break;case 3:s.seqno=e.bytes();break;case 4:s.topicIDs&&s.topicIDs.length||(s.topicIDs=[]),s.topicIDs.push(e.string());break;case 5:s.signature=e.bytes();break;case 6:s.key=e.bytes();break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.Message)return e;var t=new n.RPC.Message;if(null!=e.from&&("string"==typeof e.from?i.base64.decode(e.from,t.from=i.newBuffer(i.base64.length(e.from)),0):e.from.length&&(t.from=e.from)),null!=e.data&&("string"==typeof e.data?i.base64.decode(e.data,t.data=i.newBuffer(i.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),null!=e.seqno&&("string"==typeof e.seqno?i.base64.decode(e.seqno,t.seqno=i.newBuffer(i.base64.length(e.seqno)),0):e.seqno.length&&(t.seqno=e.seqno)),e.topicIDs){if(!Array.isArray(e.topicIDs))throw TypeError(".RPC.Message.topicIDs: array expected");t.topicIDs=[];for(var r=0;r<e.topicIDs.length;++r)t.topicIDs[r]=String(e.topicIDs[r])}return null!=e.signature&&("string"==typeof e.signature?i.base64.decode(e.signature,t.signature=i.newBuffer(i.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),null!=e.key&&("string"==typeof e.key?i.base64.decode(e.key,t.key=i.newBuffer(i.base64.length(e.key)),0):e.key.length&&(t.key=e.key)),t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.topicIDs=[]),null!=e.from&&e.hasOwnProperty("from")&&(r.from=t.bytes===String?i.base64.encode(e.from,0,e.from.length):t.bytes===Array?Array.prototype.slice.call(e.from):e.from,t.oneofs&&(r._from="from")),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?i.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data,t.oneofs&&(r._data="data")),null!=e.seqno&&e.hasOwnProperty("seqno")&&(r.seqno=t.bytes===String?i.base64.encode(e.seqno,0,e.seqno.length):t.bytes===Array?Array.prototype.slice.call(e.seqno):e.seqno,t.oneofs&&(r._seqno="seqno")),e.topicIDs&&e.topicIDs.length){r.topicIDs=[];for(var n=0;n<e.topicIDs.length;++n)r.topicIDs[n]=e.topicIDs[n]}return null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?i.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature,t.oneofs&&(r._signature="signature")),null!=e.key&&e.hasOwnProperty("key")&&(r.key=t.bytes===String?i.base64.encode(e.key,0,e.key.length):t.bytes===Array?Array.prototype.slice.call(e.key):e.key,t.oneofs&&(r._key="key")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlMessage=function(){function s(e){if(this.ihave=[],this.iwant=[],this.graft=[],this.prune=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return s.prototype.ihave=i.emptyArray,s.prototype.iwant=i.emptyArray,s.prototype.graft=i.emptyArray,s.prototype.prune=i.emptyArray,s.encode=function(e,t){if(t||(t=r.create()),null!=e.ihave&&e.ihave.length)for(var i=0;i<e.ihave.length;++i)n.RPC.ControlIHave.encode(e.ihave[i],t.uint32(10).fork()).ldelim();if(null!=e.iwant&&e.iwant.length)for(i=0;i<e.iwant.length;++i)n.RPC.ControlIWant.encode(e.iwant[i],t.uint32(18).fork()).ldelim();if(null!=e.graft&&e.graft.length)for(i=0;i<e.graft.length;++i)n.RPC.ControlGraft.encode(e.graft[i],t.uint32(26).fork()).ldelim();if(null!=e.prune&&e.prune.length)for(i=0;i<e.prune.length;++i)n.RPC.ControlPrune.encode(e.prune[i],t.uint32(34).fork()).ldelim();return t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var i=void 0===r?e.len:e.pos+r,s=new n.RPC.ControlMessage;e.pos<i;){var o=e.uint32();switch(o>>>3){case 1:s.ihave&&s.ihave.length||(s.ihave=[]),s.ihave.push(n.RPC.ControlIHave.decode(e,e.uint32()));break;case 2:s.iwant&&s.iwant.length||(s.iwant=[]),s.iwant.push(n.RPC.ControlIWant.decode(e,e.uint32()));break;case 3:s.graft&&s.graft.length||(s.graft=[]),s.graft.push(n.RPC.ControlGraft.decode(e,e.uint32()));break;case 4:s.prune&&s.prune.length||(s.prune=[]),s.prune.push(n.RPC.ControlPrune.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlMessage)return e;var t=new n.RPC.ControlMessage;if(e.ihave){if(!Array.isArray(e.ihave))throw TypeError(".RPC.ControlMessage.ihave: array expected");t.ihave=[];for(var r=0;r<e.ihave.length;++r){if("object"!=typeof e.ihave[r])throw TypeError(".RPC.ControlMessage.ihave: object expected");t.ihave[r]=n.RPC.ControlIHave.fromObject(e.ihave[r])}}if(e.iwant){if(!Array.isArray(e.iwant))throw TypeError(".RPC.ControlMessage.iwant: array expected");for(t.iwant=[],r=0;r<e.iwant.length;++r){if("object"!=typeof e.iwant[r])throw TypeError(".RPC.ControlMessage.iwant: object expected");t.iwant[r]=n.RPC.ControlIWant.fromObject(e.iwant[r])}}if(e.graft){if(!Array.isArray(e.graft))throw TypeError(".RPC.ControlMessage.graft: array expected");for(t.graft=[],r=0;r<e.graft.length;++r){if("object"!=typeof e.graft[r])throw TypeError(".RPC.ControlMessage.graft: object expected");t.graft[r]=n.RPC.ControlGraft.fromObject(e.graft[r])}}if(e.prune){if(!Array.isArray(e.prune))throw TypeError(".RPC.ControlMessage.prune: array expected");for(t.prune=[],r=0;r<e.prune.length;++r){if("object"!=typeof e.prune[r])throw TypeError(".RPC.ControlMessage.prune: object expected");t.prune[r]=n.RPC.ControlPrune.fromObject(e.prune[r])}}return t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.ihave=[],r.iwant=[],r.graft=[],r.prune=[]),e.ihave&&e.ihave.length){r.ihave=[];for(var i=0;i<e.ihave.length;++i)r.ihave[i]=n.RPC.ControlIHave.toObject(e.ihave[i],t)}if(e.iwant&&e.iwant.length)for(r.iwant=[],i=0;i<e.iwant.length;++i)r.iwant[i]=n.RPC.ControlIWant.toObject(e.iwant[i],t);if(e.graft&&e.graft.length)for(r.graft=[],i=0;i<e.graft.length;++i)r.graft[i]=n.RPC.ControlGraft.toObject(e.graft[i],t);if(e.prune&&e.prune.length)for(r.prune=[],i=0;i<e.prune.length;++i)r.prune[i]=n.RPC.ControlPrune.toObject(e.prune[i],t);return r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlIHave=function(){function s(e){if(this.messageIDs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.topicID=null,s.prototype.messageIDs=i.emptyArray,Object.defineProperty(s.prototype,"_topicID",{get:i.oneOfGetter(o=["topicID"]),set:i.oneOfSetter(o)}),s.encode=function(e,t){if(t||(t=r.create()),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(10).string(e.topicID),null!=e.messageIDs&&e.messageIDs.length)for(var i=0;i<e.messageIDs.length;++i)t.uint32(18).bytes(e.messageIDs[i]);return t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var i=void 0===r?e.len:e.pos+r,s=new n.RPC.ControlIHave;e.pos<i;){var o=e.uint32();switch(o>>>3){case 1:s.topicID=e.string();break;case 2:s.messageIDs&&s.messageIDs.length||(s.messageIDs=[]),s.messageIDs.push(e.bytes());break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlIHave)return e;var t=new n.RPC.ControlIHave;if(null!=e.topicID&&(t.topicID=String(e.topicID)),e.messageIDs){if(!Array.isArray(e.messageIDs))throw TypeError(".RPC.ControlIHave.messageIDs: array expected");t.messageIDs=[];for(var r=0;r<e.messageIDs.length;++r)"string"==typeof e.messageIDs[r]?i.base64.decode(e.messageIDs[r],t.messageIDs[r]=i.newBuffer(i.base64.length(e.messageIDs[r])),0):e.messageIDs[r].length&&(t.messageIDs[r]=e.messageIDs[r])}return t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.messageIDs=[]),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),e.messageIDs&&e.messageIDs.length){r.messageIDs=[];for(var n=0;n<e.messageIDs.length;++n)r.messageIDs[n]=t.bytes===String?i.base64.encode(e.messageIDs[n],0,e.messageIDs[n].length):t.bytes===Array?Array.prototype.slice.call(e.messageIDs[n]):e.messageIDs[n]}return r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlIWant=function(){function s(e){if(this.messageIDs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return s.prototype.messageIDs=i.emptyArray,s.encode=function(e,t){if(t||(t=r.create()),null!=e.messageIDs&&e.messageIDs.length)for(var i=0;i<e.messageIDs.length;++i)t.uint32(10).bytes(e.messageIDs[i]);return t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var i=void 0===r?e.len:e.pos+r,s=new n.RPC.ControlIWant;e.pos<i;){var o=e.uint32();o>>>3==1?(s.messageIDs&&s.messageIDs.length||(s.messageIDs=[]),s.messageIDs.push(e.bytes())):e.skipType(7&o)}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlIWant)return e;var t=new n.RPC.ControlIWant;if(e.messageIDs){if(!Array.isArray(e.messageIDs))throw TypeError(".RPC.ControlIWant.messageIDs: array expected");t.messageIDs=[];for(var r=0;r<e.messageIDs.length;++r)"string"==typeof e.messageIDs[r]?i.base64.decode(e.messageIDs[r],t.messageIDs[r]=i.newBuffer(i.base64.length(e.messageIDs[r])),0):e.messageIDs[r].length&&(t.messageIDs[r]=e.messageIDs[r])}return t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.messageIDs=[]),e.messageIDs&&e.messageIDs.length){r.messageIDs=[];for(var n=0;n<e.messageIDs.length;++n)r.messageIDs[n]=t.bytes===String?i.base64.encode(e.messageIDs[n],0,e.messageIDs[n].length):t.bytes===Array?Array.prototype.slice.call(e.messageIDs[n]):e.messageIDs[n]}return r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlGraft=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.topicID=null,Object.defineProperty(s.prototype,"_topicID",{get:i.oneOfGetter(o=["topicID"]),set:i.oneOfSetter(o)}),s.encode=function(e,t){return t||(t=r.create()),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(10).string(e.topicID),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var i=void 0===r?e.len:e.pos+r,s=new n.RPC.ControlGraft;e.pos<i;){var o=e.uint32();o>>>3==1?s.topicID=e.string():e.skipType(7&o)}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlGraft)return e;var t=new n.RPC.ControlGraft;return null!=e.topicID&&(t.topicID=String(e.topicID)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlPrune=function(){function s(e){if(this.peers=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.topicID=null,s.prototype.peers=i.emptyArray,s.prototype.backoff=null,Object.defineProperty(s.prototype,"_topicID",{get:i.oneOfGetter(o=["topicID"]),set:i.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_backoff",{get:i.oneOfGetter(o=["backoff"]),set:i.oneOfSetter(o)}),s.encode=function(e,t){if(t||(t=r.create()),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(10).string(e.topicID),null!=e.peers&&e.peers.length)for(var i=0;i<e.peers.length;++i)n.RPC.PeerInfo.encode(e.peers[i],t.uint32(18).fork()).ldelim();return null!=e.backoff&&Object.hasOwnProperty.call(e,"backoff")&&t.uint32(24).uint64(e.backoff),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var i=void 0===r?e.len:e.pos+r,s=new n.RPC.ControlPrune;e.pos<i;){var o=e.uint32();switch(o>>>3){case 1:s.topicID=e.string();break;case 2:s.peers&&s.peers.length||(s.peers=[]),s.peers.push(n.RPC.PeerInfo.decode(e,e.uint32()));break;case 3:s.backoff=e.uint64();break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlPrune)return e;var t=new n.RPC.ControlPrune;if(null!=e.topicID&&(t.topicID=String(e.topicID)),e.peers){if(!Array.isArray(e.peers))throw TypeError(".RPC.ControlPrune.peers: array expected");t.peers=[];for(var r=0;r<e.peers.length;++r){if("object"!=typeof e.peers[r])throw TypeError(".RPC.ControlPrune.peers: object expected");t.peers[r]=n.RPC.PeerInfo.fromObject(e.peers[r])}}return null!=e.backoff&&(i.Long?(t.backoff=i.Long.fromValue(e.backoff)).unsigned=!0:"string"==typeof e.backoff?t.backoff=parseInt(e.backoff,10):"number"==typeof e.backoff?t.backoff=e.backoff:"object"==typeof e.backoff&&(t.backoff=new i.LongBits(e.backoff.low>>>0,e.backoff.high>>>0).toNumber(!0))),t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.peers=[]),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),e.peers&&e.peers.length){r.peers=[];for(var s=0;s<e.peers.length;++s)r.peers[s]=n.RPC.PeerInfo.toObject(e.peers[s],t)}return null!=e.backoff&&e.hasOwnProperty("backoff")&&("number"==typeof e.backoff?r.backoff=t.longs===String?String(e.backoff):e.backoff:r.backoff=t.longs===String?i.Long.prototype.toString.call(e.backoff):t.longs===Number?new i.LongBits(e.backoff.low>>>0,e.backoff.high>>>0).toNumber(!0):e.backoff,t.oneofs&&(r._backoff="backoff")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.PeerInfo=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.peerID=null,s.prototype.signedPeerRecord=null,Object.defineProperty(s.prototype,"_peerID",{get:i.oneOfGetter(o=["peerID"]),set:i.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_signedPeerRecord",{get:i.oneOfGetter(o=["signedPeerRecord"]),set:i.oneOfSetter(o)}),s.encode=function(e,t){return t||(t=r.create()),null!=e.peerID&&Object.hasOwnProperty.call(e,"peerID")&&t.uint32(10).bytes(e.peerID),null!=e.signedPeerRecord&&Object.hasOwnProperty.call(e,"signedPeerRecord")&&t.uint32(18).bytes(e.signedPeerRecord),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var i=void 0===r?e.len:e.pos+r,s=new n.RPC.PeerInfo;e.pos<i;){var o=e.uint32();switch(o>>>3){case 1:s.peerID=e.bytes();break;case 2:s.signedPeerRecord=e.bytes();break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.PeerInfo)return e;var t=new n.RPC.PeerInfo;return null!=e.peerID&&("string"==typeof e.peerID?i.base64.decode(e.peerID,t.peerID=i.newBuffer(i.base64.length(e.peerID)),0):e.peerID.length&&(t.peerID=e.peerID)),null!=e.signedPeerRecord&&("string"==typeof e.signedPeerRecord?i.base64.decode(e.signedPeerRecord,t.signedPeerRecord=i.newBuffer(i.base64.length(e.signedPeerRecord)),0):e.signedPeerRecord.length&&(t.signedPeerRecord=e.signedPeerRecord)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.peerID&&e.hasOwnProperty("peerID")&&(r.peerID=t.bytes===String?i.base64.encode(e.peerID,0,e.peerID.length):t.bytes===Array?Array.prototype.slice.call(e.peerID):e.peerID,t.oneofs&&(r._peerID="peerID")),null!=e.signedPeerRecord&&e.hasOwnProperty("signedPeerRecord")&&(r.signedPeerRecord=t.bytes===String?i.base64.encode(e.signedPeerRecord,0,e.signedPeerRecord.length):t.bytes===Array?Array.prototype.slice.call(e.signedPeerRecord):e.signedPeerRecord,t.oneofs&&(r._signedPeerRecord="signedPeerRecord")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s}(),n},"function"==typeof define&&define.amd?define(["protobufjs/minimal"],i):"function"==typeof e&&"object"==typeof t&&t&&t.exports&&(t.exports=i(e("protobufjs/minimal")))},{"protobufjs/minimal":"grAXL"}],l9R1d:[function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Heartbeat=void 0;const o=s(e("./constants")),a=e("./get-gossip-peers"),c=e("./utils");r.Heartbeat=class{constructor(e){this.gossipsub=e}start(){if(this._heartbeatTimer)return;const e=this._heartbeat.bind(this),t=setTimeout((()=>{e(),this._heartbeatTimer.runPeriodically(e,this.gossipsub._options.heartbeatInterval)}),o.GossipsubHeartbeatInitialDelay);this._heartbeatTimer={_intervalId:void 0,runPeriodically:(e,t)=>{this._heartbeatTimer._intervalId=setInterval(e,t)},cancel:()=>{clearTimeout(t),clearInterval(this._heartbeatTimer._intervalId)}}}stop(){this._heartbeatTimer&&(this._heartbeatTimer.cancel(),this._heartbeatTimer=null)}_heartbeat(){const{D:e,Dlo:t,Dhi:r,Dscore:i,Dout:n,fanoutTTL:s}=this.gossipsub._options;this.gossipsub.heartbeatTicks++;const u=new Map,l=e=>{let t=u.get(e);return void 0===t&&(t=this.gossipsub.score.score(e),u.set(e,t)),t},d=new Map,f=new Map,h=new Map;this.gossipsub._clearBackoff(),this.gossipsub.peerhave.clear(),this.gossipsub.iasked.clear(),this.gossipsub._applyIwantPenalties(),this.gossipsub._directConnect(),this.gossipsub.mesh.forEach(((s,u)=>{const p=e=>{this.gossipsub.log("HEARTBEAT: Remove mesh link to %s in %s",e,u),this.gossipsub.score.prune(e,u),this.gossipsub._addBackoff(e,u),s.delete(e);const t=f.get(e);t?t.push(u):f.set(e,[u])},g=e=>{this.gossipsub.log("HEARTBEAT: Add mesh link to %s in %s",e,u),this.gossipsub.score.graft(e,u),s.add(e);const t=d.get(e);t?t.push(u):d.set(e,[u])};if(s.forEach((e=>{const t=l(e);t<0&&(this.gossipsub.log("HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s",e,t,u),p(e),h.set(e,!0))})),s.size<t){const t=this.gossipsub.backoff.get(u),r=e-s.size;a.getGossipPeers(this.gossipsub,u,r,(e=>!s.has(e)&&!this.gossipsub.direct.has(e)&&(!t||!t.has(e))&&l(e)>=0)).forEach(g)}if(s.size>r){let t=Array.from(s);t.sort(((e,t)=>l(t)-l(e))),t=t.slice(0,i).concat(c.shuffle(t.slice(i)));let r=0;if(t.slice(0,e).forEach((e=>{this.gossipsub.outbound.get(e)&&r++})),r<n){const i=e=>{const r=t[e];for(let r=e;r>0;r--)t[r]=t[r-1];t[0]=r};if(r>0){let n=r;for(let r=1;r<e&&n>0;r++)this.gossipsub.outbound.get(t[r])&&(i(r),n--)}let n=e-r;for(let r=e;r<t.length&&n>0;r++)this.gossipsub.outbound.get(t[r])&&(i(r),n--)}t.slice(e).forEach(p)}if(s.size>=t){let e=0;if(s.forEach((t=>{this.gossipsub.outbound.get(t)&&e++})),e<n){const t=n-e,r=this.gossipsub.backoff.get(u);a.getGossipPeers(this.gossipsub,u,t,(e=>!s.has(e)&&!this.gossipsub.direct.has(e)&&(!r||!r.has(e))&&l(e)>=0)).forEach(g)}}if(this.gossipsub.heartbeatTicks%o.GossipsubOpportunisticGraftTicks==0&&s.size>1){const e=Array.from(s).sort(((e,t)=>l(e)-l(t))),t=Math.floor(s.size/2),r=l(e[t]);if(r<this.gossipsub._options.scoreThresholds.opportunisticGraftThreshold){const e=this.gossipsub.backoff.get(u);a.getGossipPeers(this.gossipsub,u,o.GossipsubOpportunisticGraftPeers,(t=>s.has(t)&&!this.gossipsub.direct.has(t)&&(!e||!e.has(t))&&l(t)>r)).forEach((e=>{this.gossipsub.log("HEARTBEAT: Opportunistically graft peer %s on topic %s",e,u),g(e)}))}}this.gossipsub._emitGossip(u,s)}));const p=this.gossipsub._now();this.gossipsub.lastpub.forEach(((e,t)=>{e+s<p&&(this.gossipsub.fanout.delete(t),this.gossipsub.lastpub.delete(t))})),this.gossipsub.fanout.forEach(((t,r)=>{const i=this.gossipsub.topics.get(r);if(t.forEach((e=>{(!i.has(e)||l(e)<this.gossipsub._options.scoreThresholds.publishThreshold)&&t.delete(e)})),t.size<e){const i=e-t.size;a.getGossipPeers(this.gossipsub,r,i,(e=>!t.has(e)&&!this.gossipsub.direct.has(e)&&l(e)>=this.gossipsub._options.scoreThresholds.publishThreshold)).forEach((e=>{t.add(e)}))}this.gossipsub._emitGossip(r,t)})),this.gossipsub._sendGraftPrune(d,f,h),this.gossipsub._flush(),this.gossipsub.messageCache.shift(),this.gossipsub.emit("gossipsub:heartbeat")}}},{"./constants":"kx67k","./get-gossip-peers":"jYUGm","./utils":"8kUZs"}],jYUGm:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getGossipPeers=void 0;const i=e("./utils");r.getGossipPeers=function(e,t,r,n=(()=>!0)){const s=e.topics.get(t);if(!s)return new Set;let o=[];return s.forEach((t=>{const r=e.peers.get(t);r&&i.hasGossipProtocol(r.protocol)&&n(t)&&o.push(t)})),o=i.shuffle(o),r>0&&o.length>r&&(o=o.slice(0,r)),new Set(o)}},{"./utils":"8kUZs"}],"8Uy6q":[function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),n(e("./peer-score-params"),r),n(e("./peer-score-thresholds"),r),n(e("./peer-score"),r)},{"./peer-score-params":"lHcoR","./peer-score-thresholds":"kpAfK","./peer-score":"2EtC2"}],lHcoR:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validateTopicScoreParams=r.validatePeerScoreParams=r.createTopicScoreParams=r.createPeerScoreParams=r.defaultTopicScoreParams=r.defaultPeerScoreParams=void 0;const i=e("./constants"),n=e("err-code");function s(e={}){return Object.assign(Object.assign({},r.defaultTopicScoreParams),e)}function o(e){if(e.topicWeight<0)throw n(new Error("invalid topic weight; must be >= 0"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(0===e.timeInMeshQuantum)throw n(new Error("invalid TimeInMeshQuantum; must be non zero"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(e.timeInMeshWeight<0)throw n(new Error("invalid TimeInMeshWeight; must be positive (or 0 to disable)"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.timeInMeshWeight&&e.timeInMeshQuantum<=0)throw n(new Error("invalid TimeInMeshQuantum; must be positive"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.timeInMeshWeight&&e.timeInMeshCap<=0)throw n(new Error("invalid TimeInMeshCap; must be positive"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(e.firstMessageDeliveriesWeight<0)throw n(new Error("invallid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.firstMessageDeliveriesWeight&&(e.firstMessageDeliveriesDecay<=0||e.firstMessageDeliveriesDecay>=1))throw n(new Error("invalid FirstMessageDeliveriesDecay; must be between 0 and 1"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.firstMessageDeliveriesWeight&&e.firstMessageDeliveriesCap<=0)throw n(new Error("invalid FirstMessageDeliveriesCap; must be positive"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(e.meshMessageDeliveriesWeight>0)throw n(new Error("invalid MeshMessageDeliveriesWeight; must be negative (or 0 to disable)"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.meshMessageDeliveriesWeight&&(e.meshMessageDeliveriesDecay<=0||e.meshMessageDeliveriesDecay>=1))throw n(new Error("invalid MeshMessageDeliveriesDecay; must be between 0 and 1"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesCap<=0)throw n(new Error("invalid MeshMessageDeliveriesCap; must be positive"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesThreshold<=0)throw n(new Error("invalid MeshMessageDeliveriesThreshold; must be positive"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(e.meshMessageDeliveriesWindow<0)throw n(new Error("invalid MeshMessageDeliveriesWindow; must be non-negative"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesActivation<1e3)throw n(new Error("invalid MeshMessageDeliveriesActivation; must be at least 1s"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(e.meshFailurePenaltyWeight>0)throw n(new Error("invalid MeshFailurePenaltyWeight; must be negative (or 0 to disable)"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.meshFailurePenaltyWeight&&(e.meshFailurePenaltyDecay<=0||e.meshFailurePenaltyDecay>=1))throw n(new Error("invalid MeshFailurePenaltyDecay; must be between 0 and 1"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(e.invalidMessageDeliveriesWeight>0)throw n(new Error("invalid InvalidMessageDeliveriesWeight; must be negative (or 0 to disable)"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(e.invalidMessageDeliveriesDecay<=0||e.invalidMessageDeliveriesDecay>=1)throw n(new Error("invalid InvalidMessageDeliveriesDecay; must be between 0 and 1"),i.ERR_INVALID_PEER_SCORE_PARAMS)}r.defaultPeerScoreParams={topics:{},topicScoreCap:10,appSpecificScore:()=>0,appSpecificWeight:10,IPColocationFactorWeight:-5,IPColocationFactorThreshold:10,IPColocationFactorWhitelist:new Set,behaviourPenaltyWeight:-10,behaviourPenaltyDecay:.2,decayInterval:1e3,decayToZero:.1,retainScore:36e5},r.defaultTopicScoreParams={topicWeight:.5,timeInMeshWeight:1,timeInMeshQuantum:1,timeInMeshCap:3600,firstMessageDeliveriesWeight:1,firstMessageDeliveriesDecay:.5,firstMessageDeliveriesCap:2e3,meshMessageDeliveriesWeight:-1,meshMessageDeliveriesDecay:.5,meshMessageDeliveriesCap:100,meshMessageDeliveriesThreshold:20,meshMessageDeliveriesWindow:10,meshMessageDeliveriesActivation:5e3,meshFailurePenaltyWeight:-1,meshFailurePenaltyDecay:.5,invalidMessageDeliveriesWeight:-1,invalidMessageDeliveriesDecay:.3},r.createPeerScoreParams=function(e={}){return Object.assign(Object.assign(Object.assign({},r.defaultPeerScoreParams),e),{topics:e.topics?Object.entries(e.topics).reduce(((e,[t,r])=>(e[t]=s(r),e)),{}):{}})},r.createTopicScoreParams=s,r.validatePeerScoreParams=function(e){for(const[t,r]of Object.entries(e.topics))try{o(r)}catch(e){throw n(new Error(`invalid score parameters for topic ${t}: ${e.message}`),i.ERR_INVALID_PEER_SCORE_PARAMS)}if(e.topicScoreCap<0)throw n(new Error("invalid topic score cap; must be positive (or 0 for no cap)"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(null===e.appSpecificScore||void 0===e.appSpecificScore)throw n(new Error("missing application specific score function"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(e.IPColocationFactorWeight>0)throw n(new Error("invalid IPColocationFactorWeight; must be negative (or 0 to disable)"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.IPColocationFactorWeight&&e.IPColocationFactorThreshold<1)throw n(new Error("invalid IPColocationFactorThreshold; must be at least 1"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(e.behaviourPenaltyWeight>0)throw n(new Error("invalid BehaviourPenaltyWeight; must be negative (or 0 to disable)"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.behaviourPenaltyWeight&&(e.behaviourPenaltyDecay<=0||e.behaviourPenaltyDecay>=1))throw n(new Error("invalid BehaviourPenaltyDecay; must be between 0 and 1"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(e.decayInterval<1e3)throw n(new Error("invalid DecayInterval; must be at least 1s"),i.ERR_INVALID_PEER_SCORE_PARAMS);if(e.decayToZero<=0||e.decayToZero>=1)throw n(new Error("invalid DecayToZero; must be between 0 and 1"),i.ERR_INVALID_PEER_SCORE_PARAMS)},r.validateTopicScoreParams=o},{"./constants":"eJAl3","err-code":"chZjB"}],eJAl3:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ERR_INVALID_PEER_SCORE_THRESHOLDS=r.ERR_INVALID_PEER_SCORE_PARAMS=void 0,r.ERR_INVALID_PEER_SCORE_PARAMS="ERR_INVALID_PEER_SCORE_PARAMS",r.ERR_INVALID_PEER_SCORE_THRESHOLDS="ERR_INVALID_PEER_SCORE_THRESHOLDS"},{}],kpAfK:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validatePeerScoreThresholds=r.createPeerScoreThresholds=r.defaultPeerScoreThresholds=void 0;const i=e("./constants"),n=e("err-code");r.defaultPeerScoreThresholds={gossipThreshold:-10,publishThreshold:-50,graylistThreshold:-80,acceptPXThreshold:10,opportunisticGraftThreshold:20},r.createPeerScoreThresholds=function(e={}){return Object.assign(Object.assign({},r.defaultPeerScoreThresholds),e)},r.validatePeerScoreThresholds=function(e){if(e.gossipThreshold>0)throw n(new Error("invalid gossip threshold; it must be <= 0"),i.ERR_INVALID_PEER_SCORE_THRESHOLDS);if(e.publishThreshold>0||e.publishThreshold>e.gossipThreshold)throw n(new Error("invalid publish threshold; it must be <= 0 and <= gossip threshold"),i.ERR_INVALID_PEER_SCORE_THRESHOLDS);if(e.graylistThreshold>0||e.graylistThreshold>e.publishThreshold)throw n(new Error("invalid graylist threshold; it must be <= 0 and <= publish threshold"),i.ERR_INVALID_PEER_SCORE_THRESHOLDS);if(e.acceptPXThreshold<0)throw n(new Error("invalid accept PX threshold; it must be >= 0"),i.ERR_INVALID_PEER_SCORE_THRESHOLDS);if(e.opportunisticGraftThreshold<0)throw n(new Error("invalid opportunistic grafting threshold; it must be >= 0"),i.ERR_INVALID_PEER_SCORE_THRESHOLDS)}},{"./constants":"eJAl3","err-code":"chZjB"}],"2EtC2":[function(e,t,r){"use strict";var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.PeerScore=void 0;const s=e("./peer-score-params"),o=e("./peer-stats"),a=e("./compute-score"),c=e("./message-deliveries"),u=e("../constants"),l=n(e("peer-id")),d=e("debug"),f=e("libp2p-interfaces/src/pubsub/errors"),{ERR_INVALID_SIGNATURE:h,ERR_MISSING_SIGNATURE:p}=f.codes,g=d("libp2p:gossipsub:score");r.PeerScore=class{constructor(e,t,r){s.validatePeerScoreParams(e),this.params=e,this._connectionManager=t,this.peerStats=new Map,this.peerIPs=new Map,this.deliveryRecords=new c.MessageDeliveries,this.msgId=r}start(){this._backgroundInterval?g("Peer score already running"):(this._backgroundInterval=setInterval((()=>this.background()),this.params.decayInterval),g("started"))}stop(){this._backgroundInterval?(clearInterval(this._backgroundInterval),delete this._backgroundInterval,this.peerIPs.clear(),this.peerStats.clear(),this.deliveryRecords.clear(),g("stopped")):g("Peer score already stopped")}background(){this._refreshScores(),this._updateIPs(),this.deliveryRecords.gc()}_refreshScores(){const e=Date.now(),t=this.params.decayToZero;this.peerStats.forEach(((r,i)=>{r.connected?(Object.entries(r.topics).forEach((([r,i])=>{const n=this.params.topics[r];n&&(i.firstMessageDeliveries*=n.firstMessageDeliveriesDecay,i.firstMessageDeliveries<t&&(i.firstMessageDeliveries=0),i.meshMessageDeliveries*=n.meshMessageDeliveriesDecay,i.meshMessageDeliveries<t&&(i.meshMessageDeliveries=0),i.meshFailurePenalty*=n.meshFailurePenaltyDecay,i.meshFailurePenalty<t&&(i.meshFailurePenalty=0),i.invalidMessageDeliveries*=n.invalidMessageDeliveriesDecay,i.invalidMessageDeliveries<t&&(i.invalidMessageDeliveries=0),i.inMesh&&(i.meshTime=e-i.graftTime,i.meshTime>n.meshMessageDeliveriesActivation&&(i.meshMessageDeliveriesActive=!0)))})),r.behaviourPenalty*=this.params.behaviourPenaltyDecay,r.behaviourPenalty<t&&(r.behaviourPenalty=0)):e>r.expire&&(this._removeIPs(i,r.ips),this.peerStats.delete(i))}))}score(e){const t=this.peerStats.get(e);return t?a.computeScore(e,t,this.params,this.peerIPs):0}addPenalty(e,t){const r=this.peerStats.get(e);r&&(r.behaviourPenalty+=t)}addPeer(e){const t=o.createPeerStats({connected:!0});this.peerStats.set(e,t);const r=this._getIPs(e);this._setIPs(e,r,t.ips),t.ips=r}removePeer(e){const t=this.peerStats.get(e);if(t){if(this.score(e)>0)return this._removeIPs(e,t.ips),void this.peerStats.delete(e);Object.entries(t.topics).forEach((([e,t])=>{t.firstMessageDeliveries=0;const r=this.params.topics[e].meshMessageDeliveriesThreshold;if(t.inMesh&&t.meshMessageDeliveriesActive&&t.meshMessageDeliveries<r){const e=r-t.meshMessageDeliveries;t.meshFailurePenalty+=e*e}t.inMesh=!1})),t.connected=!1,t.expire=Date.now()+this.params.retainScore}}graft(e,t){const r=this.peerStats.get(e);if(!r)return;const i=o.ensureTopicStats(t,r,this.params);i&&(i.inMesh=!0,i.graftTime=Date.now(),i.meshTime=0,i.meshMessageDeliveriesActive=!1)}prune(e,t){const r=this.peerStats.get(e);if(!r)return;const i=o.ensureTopicStats(t,r,this.params);if(!i)return;const n=this.params.topics[t].meshMessageDeliveriesThreshold;if(i.meshMessageDeliveriesActive&&i.meshMessageDeliveries<n){const e=n-i.meshMessageDeliveries;i.meshFailurePenalty+=e*e}i.inMesh=!1}validateMessage(e){return i(this,void 0,void 0,(function*(){this.deliveryRecords.ensureRecord(yield this.msgId(e))}))}deliverMessage(e){return i(this,void 0,void 0,(function*(){const t=e.receivedFrom;this._markFirstMessageDelivery(t,e);const r=this.deliveryRecords.ensureRecord(yield this.msgId(e)),i=Date.now();r.status===c.DeliveryRecordStatus.unknown?(r.status=c.DeliveryRecordStatus.valid,r.validated=i,r.peers.forEach((r=>{r!==t&&this._markDuplicateMessageDelivery(r,e)}))):g("unexpected delivery: message from %s was first seen %s ago and has delivery status %d",t,i-r.firstSeen,c.DeliveryRecordStatus[r.status])}))}rejectMessage(e,t){return i(this,void 0,void 0,(function*(){const r=e.receivedFrom;switch(t){case p:case h:return void this._markInvalidMessageDelivery(r,e)}const i=this.deliveryRecords.ensureRecord(yield this.msgId(e));i.status===c.DeliveryRecordStatus.unknown?t!==u.ERR_TOPIC_VALIDATOR_IGNORE?(i.status=c.DeliveryRecordStatus.invalid,this._markInvalidMessageDelivery(r,e),i.peers.forEach((t=>{this._markInvalidMessageDelivery(t,e)}))):i.status=c.DeliveryRecordStatus.ignored:g("unexpected rejection: message from %s was first seen %s ago and has delivery status %d",r,Date.now()-i.firstSeen,c.DeliveryRecordStatus[i.status])}))}duplicateMessage(e){return i(this,void 0,void 0,(function*(){const t=e.receivedFrom,r=this.deliveryRecords.ensureRecord(yield this.msgId(e));if(!r.peers.has(t))switch(r.status){case c.DeliveryRecordStatus.unknown:r.peers.add(t);break;case c.DeliveryRecordStatus.valid:r.peers.add(t),this._markDuplicateMessageDelivery(t,e,r.validated);break;case c.DeliveryRecordStatus.invalid:this._markInvalidMessageDelivery(t,e)}}))}_markInvalidMessageDelivery(e,t){const r=this.peerStats.get(e);r&&t.topicIDs.forEach((e=>{const t=o.ensureTopicStats(e,r,this.params);t&&(t.invalidMessageDeliveries+=1)}))}_markFirstMessageDelivery(e,t){const r=this.peerStats.get(e);r&&t.topicIDs.forEach((e=>{const t=o.ensureTopicStats(e,r,this.params);if(!t)return;let i=this.params.topics[e].firstMessageDeliveriesCap;t.firstMessageDeliveries+=1,t.firstMessageDeliveries>i&&(t.firstMessageDeliveries=i),t.inMesh&&(i=this.params.topics[e].meshMessageDeliveriesCap,t.meshMessageDeliveries+=1,t.meshMessageDeliveries>i&&(t.meshMessageDeliveries=i))}))}_markDuplicateMessageDelivery(e,t,r=0){const i=this.peerStats.get(e);if(!i)return;const n=r?Date.now():0;t.topicIDs.forEach((e=>{const t=o.ensureTopicStats(e,i,this.params);if(!t)return;if(!t.inMesh)return;const s=this.params.topics[e];if(r&&n>r+s.meshMessageDeliveriesWindow)return;const a=s.meshMessageDeliveriesCap;t.meshMessageDeliveries+=1,t.meshMessageDeliveries>a&&(t.meshMessageDeliveries=a)}))}_getIPs(e){return this._connectionManager.getAll(l.default.createFromB58String(e)).map((e=>e.remoteAddr.toOptions().host))}_setIPs(e,t,r){e:for(const i of t){for(const e of r)if(i===e)continue e;let t=this.peerIPs.get(i);t||(t=new Set,this.peerIPs.set(i,t)),t.add(e)}e:for(const i of r){for(const e of t)if(i===e)continue e;const r=this.peerIPs.get(i);r&&(r.delete(e),r.size||this.peerIPs.delete(i))}}_removeIPs(e,t){t.forEach((t=>{const r=this.peerIPs.get(t);r&&(r.delete(e),r.size||this.peerIPs.delete(t))}))}_updateIPs(){this.peerStats.forEach(((e,t)=>{const r=this._getIPs(t);this._setIPs(t,r,e.ips),e.ips=r}))}}},{"./peer-score-params":"lHcoR","./peer-stats":"ghpOC","./compute-score":"b22gU","./message-deliveries":"pijyj","../constants":"kx67k","peer-id":"8Bdb3",debug:"bO5wM","libp2p-interfaces/src/pubsub/errors":"i7hyG"}],ghpOC:[function(e,t,r){"use strict";function i(e={}){return Object.assign({inMesh:!1,graftTime:0,meshTime:0,firstMessageDeliveries:0,meshMessageDeliveries:0,meshMessageDeliveriesActive:!1,meshFailurePenalty:0,invalidMessageDeliveries:0},e)}Object.defineProperty(r,"__esModule",{value:!0}),r.ensureTopicStats=r.createTopicStats=r.createPeerStats=void 0,r.createPeerStats=function(e={}){return Object.assign(Object.assign({connected:!1,expire:0,ips:[],behaviourPenalty:0},e),{topics:e.topics?Object.entries(e.topics).reduce(((e,[t,r])=>(e[t]=i(r),e)),{}):{}})},r.createTopicStats=i,r.ensureTopicStats=function(e,t,r){let n=t.topics[e];return n||(r.topics[e]?(t.topics[e]=n=i(),n):void 0)}},{}],b22gU:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.computeScore=void 0,r.computeScore=function(e,t,r,i){let n=0;Object.entries(t.topics).forEach((([e,t])=>{const i=r.topics[e];if(!i)return;let s=0;if(t.inMesh){let e=t.meshTime/i.timeInMeshQuantum;e>i.timeInMeshCap&&(e=i.timeInMeshCap),s+=e*i.timeInMeshWeight}if(s+=t.firstMessageDeliveries*i.firstMessageDeliveriesWeight,t.meshMessageDeliveriesActive&&t.meshMessageDeliveries<i.meshMessageDeliveriesThreshold){const e=i.meshMessageDeliveriesThreshold-t.meshMessageDeliveries;s+=e*e*i.meshMessageDeliveriesWeight}s+=t.meshFailurePenalty*i.meshFailurePenaltyWeight;s+=t.invalidMessageDeliveries*t.invalidMessageDeliveries*i.invalidMessageDeliveriesWeight,n+=s*i.topicWeight})),r.topicScoreCap>0&&n>r.topicScoreCap&&(n=r.topicScoreCap);const s=r.appSpecificScore(e);n+=s*r.appSpecificWeight,t.ips.forEach((e=>{if(r.IPColocationFactorWhitelist.has(e))return;const t=i.get(e),s=t?t.size:0;if(s>r.IPColocationFactorThreshold){const e=s-r.IPColocationFactorThreshold;n+=e*e*r.IPColocationFactorWeight}}));const o=t.behaviourPenalty*t.behaviourPenalty;return n+=o*r.behaviourPenaltyWeight,n}},{}],pijyj:[function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.MessageDeliveries=r.DeliveryRecordStatus=void 0;const n=e("../constants"),s=i(e("denque")),o=e("../utils");var a,c;(c=a=r.DeliveryRecordStatus||(r.DeliveryRecordStatus={}))[c.unknown=0]="unknown",c[c.valid=1]="valid",c[c.invalid=2]="invalid",c[c.ignored=3]="ignored";r.MessageDeliveries=class{constructor(){this.records=new Map,this.queue=new s.default}ensureRecord(e){const t=o.messageIdToString(e);let r=this.records.get(t);if(r)return r;r={status:a.unknown,firstSeen:Date.now(),validated:0,peers:new Set},this.records.set(t,r);const i={msgId:t,expire:Date.now()+n.TimeCacheDuration};return this.queue.push(i),r}gc(){const e=Date.now();let t=this.queue.peekFront();for(;t&&t.expire<e;)this.records.delete(t.msgId),this.queue.shift(),t=this.queue.peekFront()}clear(){this.records.clear(),this.queue.clear()}}},{"../constants":"kx67k",denque:"3Jiub","../utils":"8kUZs"}],"3Jiub":[function(e,t,r){"use strict";function i(e,t){t=t||{};this._head=0,this._tail=0,this._capacity=t.capacity,this._capacityMask=3,this._list=new Array(4),Array.isArray(e)&&this._fromArray(e)}i.prototype.peekAt=function(e){var t=e;if(t===(0|t)){var r=this.size();if(!(t>=r||t<-r))return t<0&&(t+=r),t=this._head+t&this._capacityMask,this._list[t]}},i.prototype.get=function(e){return this.peekAt(e)},i.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},i.prototype.peekFront=function(){return this.peek()},i.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(i.prototype,"length",{get:function(){return this.size()}}),i.prototype.size=function(){return this._head===this._tail?0:this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},i.prototype.unshift=function(e){if(void 0===e)return this.size();var t=this._list.length;return this._head=this._head-1+t&this._capacityMask,this._list[this._head]=e,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.pop(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},i.prototype.shift=function(){var e=this._head;if(e!==this._tail){var t=this._list[e];return this._list[e]=void 0,this._head=e+1&this._capacityMask,e<2&&this._tail>1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),t}},i.prototype.push=function(e){if(void 0===e)return this.size();var t=this._tail;return this._list[t]=e,this._tail=t+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},i.prototype.pop=function(){var e=this._tail;if(e!==this._head){var t=this._list.length;this._tail=e-1+t&this._capacityMask;var r=this._list[this._tail];return this._list[this._tail]=void 0,this._head<2&&e>1e4&&e<=t>>>2&&this._shrinkArray(),r}},i.prototype.removeOne=function(e){var t=e;if(t===(0|t)&&this._head!==this._tail){var r=this.size(),i=this._list.length;if(!(t>=r||t<-r)){t<0&&(t+=r),t=this._head+t&this._capacityMask;var n,s=this._list[t];if(e<r/2){for(n=e;n>0;n--)this._list[t]=this._list[t=t-1+i&this._capacityMask];this._list[t]=void 0,this._head=this._head+1+i&this._capacityMask}else{for(n=r-1-e;n>0;n--)this._list[t]=this._list[t=t+1+i&this._capacityMask];this._list[t]=void 0,this._tail=this._tail-1+i&this._capacityMask}return s}}},i.prototype.remove=function(e,t){var r,i=e,n=t;if(i===(0|i)&&this._head!==this._tail){var s=this.size(),o=this._list.length;if(!(i>=s||i<-s||t<1)){if(i<0&&(i+=s),1===t||!t)return(r=new Array(1))[0]=this.removeOne(i),r;if(0===i&&i+t>=s)return r=this.toArray(),this.clear(),r;var a;for(i+t>s&&(t=s-i),r=new Array(t),a=0;a<t;a++)r[a]=this._list[this._head+i+a&this._capacityMask];if(i=this._head+i&this._capacityMask,e+t===s){for(this._tail=this._tail-t+o&this._capacityMask,a=t;a>0;a--)this._list[i=i+1+o&this._capacityMask]=void 0;return r}if(0===e){for(this._head=this._head+t+o&this._capacityMask,a=t-1;a>0;a--)this._list[i=i+1+o&this._capacityMask]=void 0;return r}if(i<s/2){for(this._head=this._head+e+t+o&this._capacityMask,a=e;a>0;a--)this.unshift(this._list[i=i-1+o&this._capacityMask]);for(i=this._head-1+o&this._capacityMask;n>0;)this._list[i=i-1+o&this._capacityMask]=void 0,n--;e<0&&(this._tail=i)}else{for(this._tail=i,i=i+t+o&this._capacityMask,a=s-(t+e);a>0;a--)this.push(this._list[i++]);for(i=this._tail;n>0;)this._list[i=i+1+o&this._capacityMask]=void 0,n--}return this._head<2&&this._tail>1e4&&this._tail<=o>>>2&&this._shrinkArray(),r}}},i.prototype.splice=function(e,t){var r=e;if(r===(0|r)){var i=this.size();if(r<0&&(r+=i),!(r>i)){if(arguments.length>2){var n,s,o,a=arguments.length,c=this._list.length,u=2;if(!i||r<i/2){for(s=new Array(r),n=0;n<r;n++)s[n]=this._list[this._head+n&this._capacityMask];for(0===t?(o=[],r>0&&(this._head=this._head+r+c&this._capacityMask)):(o=this.remove(r,t),this._head=this._head+r+c&this._capacityMask);a>u;)this.unshift(arguments[--a]);for(n=r;n>0;n--)this.unshift(s[n-1])}else{var l=(s=new Array(i-(r+t))).length;for(n=0;n<l;n++)s[n]=this._list[this._head+r+t+n&this._capacityMask];for(0===t?(o=[],r!=i&&(this._tail=this._head+r+c&this._capacityMask)):(o=this.remove(r,t),this._tail=this._tail-l+c&this._capacityMask);u<a;)this.push(arguments[u++]);for(n=0;n<l;n++)this.push(s[n])}return o}return this.remove(r,t)}}},i.prototype.clear=function(){this._head=0,this._tail=0},i.prototype.isEmpty=function(){return this._head===this._tail},i.prototype.toArray=function(){return this._copyArray(!1)},i.prototype._fromArray=function(e){for(var t=0;t<e.length;t++)this.push(e[t])},i.prototype._copyArray=function(e){var t,r=[],i=this._list,n=i.length;if(e||this._head>this._tail){for(t=this._head;t<n;t++)r.push(i[t]);for(t=0;t<this._tail;t++)r.push(i[t])}else for(t=this._head;t<this._tail;t++)r.push(i[t]);return r},i.prototype._growArray=function(){this._head&&(this._list=this._copyArray(!0),this._head=0),this._tail=this._list.length,this._list.length<<=1,this._capacityMask=this._capacityMask<<1|1},i.prototype._shrinkArray=function(){this._list.length>>>=1,this._capacityMask>>>=1},t.exports=i},{}],"8V5x8":[function(e,t,r){"use strict";var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.IWantTracer=void 0;const n=e("./constants"),s=e("./utils"),o=e("libp2p-interfaces/src/pubsub/errors"),{ERR_INVALID_SIGNATURE:a,ERR_MISSING_SIGNATURE:c}=o.codes;r.IWantTracer=class{constructor(e){this.getMsgId=e,this.promises=new Map}addPromise(e,t){const r=t[Math.floor(Math.random()*t.length)],i=s.messageIdToString(r);let o=this.promises.get(i);o||(o=new Map,this.promises.set(i,o)),o.has(e)||o.set(e,Date.now()+n.GossipsubIWantFollowupTime)}getBrokenPromises(){const e=Date.now(),t=new Map;return this.promises.forEach(((r,i)=>{r.forEach(((i,n)=>{i<e&&(t.set(n,(t.get(n)||0)+1),r.delete(n))})),r.size||this.promises.delete(i)})),t}deliverMessage(e){return i(this,void 0,void 0,(function*(){const t=yield this.getMsgId(e),r=s.messageIdToString(t);this.promises.delete(r)}))}rejectMessage(e,t){return i(this,void 0,void 0,(function*(){switch(t){case a:case c:return}const r=yield this.getMsgId(e),i=s.messageIdToString(r);this.promises.delete(i)}))}clear(){this.promises.clear()}}},{"./constants":"kx67k","./utils":"8kUZs","libp2p-interfaces/src/pubsub/errors":"i7hyG"}],gpqKk:[function(e,t,r){"use strict";const i=e("lodash.throttle");t.exports=function e(t){if(!(this instanceof e))return new e(t);const r=(t=t||{}).validity||30,n=new Map,s=i((()=>{n.forEach(((e,t)=>{const i=e.validity||r;(function(e){const t=(new Date).getTime()-e.getTime();return Math.floor(t/1e3)})(e.timestamp)>i&&n.delete(t)}))}),200);this.put=(e,t,r)=>{this.has(e)||n.set(e,{value:t,timestamp:new Date,validity:r}),s()},this.get=e=>{if(n.has(e))return n.get(e).value;throw new Error("key does not exist")},this.has=e=>n.has(e)}},{"lodash.throttle":"3gPBz"}],"3gPBz":[function(e,t,r){var i=arguments[3],n="Expected a function",s=NaN,o="[object Symbol]",a=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,l=/^0o[0-7]+$/i,d=parseInt,f="object"==typeof i&&i&&i.Object===Object&&i,h="object"==typeof self&&self&&self.Object===Object&&self,p=f||h||Function("return this")(),g=Object.prototype,y=g.toString,m=Math.max,b=Math.min,v=function(){return p.Date.now()};function w(e,t,r){var i,s,o,a,c,u,l=0,d=!1,f=!1,h=!0;if("function"!=typeof e)throw new TypeError(n);function p(t){var r=i,n=s;return i=s=void 0,l=t,a=e.apply(n,r)}function g(e){return l=e,c=setTimeout(w,t),d?p(e):a}function y(e){var r=e-u;return void 0===u||r>=t||r<0||f&&e-l>=o}function w(){var e=v();if(y(e))return _(e);c=setTimeout(w,function(e){var r=t-(e-u);return f?b(r,o-(e-l)):r}(e))}function _(e){return c=void 0,h&&i?p(e):(i=s=void 0,a)}function S(){var e=v(),r=y(e);if(i=arguments,s=this,u=e,r){if(void 0===c)return g(u);if(f)return c=setTimeout(w,t),p(u)}return void 0===c&&(c=setTimeout(w,t)),a}return t=A(t)||0,E(r)&&(d=!!r.leading,o=(f="maxWait"in r)?m(A(r.maxWait)||0,t):o,h="trailing"in r?!!r.trailing:h),S.cancel=function(){void 0!==c&&clearTimeout(c),l=0,i=u=s=c=void 0},S.flush=function(){return void 0===c?a:_(v())},S}function _(e,t,r){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError(n);return E(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),w(e,t,{leading:i,maxWait:t,trailing:s})}function E(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function S(e){return!!e&&"object"==typeof e}function T(e){return"symbol"==typeof e||S(e)&&y.call(e)==o}function A(e){if("number"==typeof e)return e;if(T(e))return s;if(E(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=E(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(a,"");var r=u.test(e);return r||l.test(e)?d(e.slice(2),r?2:8):c.test(e)?s:+e}t.exports=_},{}],"27rHX":[function(e,t,r){"use strict";const i=e("err-code"),{concat:n}=e("uint8arrays/concat"),{fromString:s}=e("uint8arrays/from-string"),o=e("libp2p-crypto/src/keys"),a=e("peer-id"),c=e("varint"),{equals:u}=e("uint8arrays/equals"),{codes:l}=e("../../errors"),{Envelope:d}=e("./envelope");class f{constructor({peerId:e,payloadType:t,payload:r,signature:i}){this.peerId=e,this.payloadType=t,this.payload=r,this.signature=i,this._marshal=void 0}marshal(){if(this._marshal)return this._marshal;const e=o.marshalPublicKey(this.peerId.pubKey);return this._marshal=d.encode({publicKey:e,payloadType:this.payloadType,payload:this.payload,signature:this.signature}).finish(),this._marshal}equals(e){return u(this.peerId.pubKey.bytes,e.peerId.pubKey.bytes)&&u(this.payloadType,e.payloadType)&&u(this.payload,e.payload)&&u(this.signature,e.signature)}validate(e){const t=h(e,this.payloadType,this.payload);return this.peerId.pubKey.verify(t,this.signature)}}const h=(e,t,r)=>{const i=s(e),o=c.encode(i.byteLength),a=c.encode(t.length),u=c.encode(r.length);return n([new Uint8Array(o),i,new Uint8Array(a),t,new Uint8Array(u),r])};f.createFromProtobuf=async e=>{const t=d.decode(e),r=await a.createFromPubKey(t.publicKey);return new f({peerId:r,payloadType:t.payloadType,payload:t.payload,signature:t.signature})},f.seal=async(e,t)=>{const r=e.domain,i=e.codec,n=e.marshal(),s=h(r,i,n),o=await t.privKey.sign(s);return new f({peerId:t,payloadType:i,payload:n,signature:o})},f.openAndCertify=async(e,t)=>{const r=await f.createFromProtobuf(e);if(!await r.validate(t))throw i(new Error("envelope signature is not valid for the given domain"),l.ERR_SIGNATURE_NOT_VALID);return r},t.exports=f},{"err-code":"chZjB","uint8arrays/concat":"4EBjG","uint8arrays/from-string":"dF7Y4","libp2p-crypto/src/keys":"kWJWg","peer-id":"8Bdb3",varint:"aN1CO","uint8arrays/equals":"eY3cX","../../errors":"3rNo5","./envelope":"1obky"}],"3rNo5":[function(e,t,r){"use strict";r.messages={NOT_STARTED_YET:"The libp2p node is not started yet",DHT_DISABLED:"DHT is not available",CONN_ENCRYPTION_REQUIRED:"At least one connection encryption module is required"},r.codes={DHT_DISABLED:"ERR_DHT_DISABLED",PUBSUB_NOT_STARTED:"ERR_PUBSUB_NOT_STARTED",DHT_NOT_STARTED:"ERR_DHT_NOT_STARTED",CONN_ENCRYPTION_REQUIRED:"ERR_CONN_ENCRYPTION_REQUIRED",ERR_INVALID_PROTOCOLS_FOR_STREAM:"ERR_INVALID_PROTOCOLS_FOR_STREAM",ERR_CONNECTION_ENDED:"ERR_CONNECTION_ENDED",ERR_CONNECTION_FAILED:"ERR_CONNECTION_FAILED",ERR_NODE_NOT_STARTED:"ERR_NODE_NOT_STARTED",ERR_ALREADY_ABORTED:"ERR_ALREADY_ABORTED",ERR_TOO_MANY_ADDRESSES:"ERR_TOO_MANY_ADDRESSES",ERR_NO_VALID_ADDRESSES:"ERR_NO_VALID_ADDRESSES",ERR_RELAYED_DIAL:"ERR_RELAYED_DIAL",ERR_DIALED_SELF:"ERR_DIALED_SELF",ERR_DISCOVERED_SELF:"ERR_DISCOVERED_SELF",ERR_DUPLICATE_TRANSPORT:"ERR_DUPLICATE_TRANSPORT",ERR_ENCRYPTION_FAILED:"ERR_ENCRYPTION_FAILED",ERR_HOP_REQUEST_FAILED:"ERR_HOP_REQUEST_FAILED",ERR_INVALID_KEY:"ERR_INVALID_KEY",ERR_INVALID_MESSAGE:"ERR_INVALID_MESSAGE",ERR_INVALID_PARAMETERS:"ERR_INVALID_PARAMETERS",ERR_INVALID_PEER:"ERR_INVALID_PEER",ERR_MUXER_UNAVAILABLE:"ERR_MUXER_UNAVAILABLE",ERR_TIMEOUT:"ERR_TIMEOUT",ERR_TRANSPORT_UNAVAILABLE:"ERR_TRANSPORT_UNAVAILABLE",ERR_TRANSPORT_DIAL_FAILED:"ERR_TRANSPORT_DIAL_FAILED",ERR_UNSUPPORTED_PROTOCOL:"ERR_UNSUPPORTED_PROTOCOL",ERR_INVALID_MULTIADDR:"ERR_INVALID_MULTIADDR",ERR_SIGNATURE_NOT_VALID:"ERR_SIGNATURE_NOT_VALID"}},{}],"1obky":[function(e,t,r){"use strict";var i=e("protobufjs/minimal"),n=i.Reader,s=i.Writer,o=i.util,a=i.roots["libp2p-envelope"]||(i.roots["libp2p-envelope"]={});a.Envelope=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.publicKey=o.newBuffer([]),e.prototype.payloadType=o.newBuffer([]),e.prototype.payload=o.newBuffer([]),e.prototype.signature=o.newBuffer([]),e.encode=function(e,t){return t||(t=s.create()),null!=e.publicKey&&Object.hasOwnProperty.call(e,"publicKey")&&t.uint32(10).bytes(e.publicKey),null!=e.payloadType&&Object.hasOwnProperty.call(e,"payloadType")&&t.uint32(18).bytes(e.payloadType),null!=e.payload&&Object.hasOwnProperty.call(e,"payload")&&t.uint32(26).bytes(e.payload),null!=e.signature&&Object.hasOwnProperty.call(e,"signature")&&t.uint32(42).bytes(e.signature),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.Envelope;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.publicKey=e.bytes();break;case 2:i.payloadType=e.bytes();break;case 3:i.payload=e.bytes();break;case 5:i.signature=e.bytes();break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.Envelope)return e;var t=new a.Envelope;return null!=e.publicKey&&("string"==typeof e.publicKey?o.base64.decode(e.publicKey,t.publicKey=o.newBuffer(o.base64.length(e.publicKey)),0):e.publicKey.length&&(t.publicKey=e.publicKey)),null!=e.payloadType&&("string"==typeof e.payloadType?o.base64.decode(e.payloadType,t.payloadType=o.newBuffer(o.base64.length(e.payloadType)),0):e.payloadType.length&&(t.payloadType=e.payloadType)),null!=e.payload&&("string"==typeof e.payload?o.base64.decode(e.payload,t.payload=o.newBuffer(o.base64.length(e.payload)),0):e.payload.length&&(t.payload=e.payload)),null!=e.signature&&("string"==typeof e.signature?o.base64.decode(e.signature,t.signature=o.newBuffer(o.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.publicKey="":(r.publicKey=[],t.bytes!==Array&&(r.publicKey=o.newBuffer(r.publicKey))),t.bytes===String?r.payloadType="":(r.payloadType=[],t.bytes!==Array&&(r.payloadType=o.newBuffer(r.payloadType))),t.bytes===String?r.payload="":(r.payload=[],t.bytes!==Array&&(r.payload=o.newBuffer(r.payload))),t.bytes===String?r.signature="":(r.signature=[],t.bytes!==Array&&(r.signature=o.newBuffer(r.signature)))),null!=e.publicKey&&e.hasOwnProperty("publicKey")&&(r.publicKey=t.bytes===String?o.base64.encode(e.publicKey,0,e.publicKey.length):t.bytes===Array?Array.prototype.slice.call(e.publicKey):e.publicKey),null!=e.payloadType&&e.hasOwnProperty("payloadType")&&(r.payloadType=t.bytes===String?o.base64.encode(e.payloadType,0,e.payloadType.length):t.bytes===Array?Array.prototype.slice.call(e.payloadType):e.payloadType),null!=e.payload&&e.hasOwnProperty("payload")&&(r.payload=t.bytes===String?o.base64.encode(e.payload,0,e.payload.length):t.bytes===Array?Array.prototype.slice.call(e.payload):e.payload),null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?o.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),t.exports=a},{"protobufjs/minimal":"grAXL"}],jgA5e:[function(e,t,r){"use strict";const i=e("peer-id"),{base58btc:n}=e("multiformats/bases/base58"),{default:s}=e("p-queue"),o=e("p-defer"),a=e("debug"),c=a("libp2p-delegated-peer-routing");c.error=a("libp2p-delegated-peer-routing:error");t.exports=class{constructor(e){if(null==e)throw new Error("missing ipfs http client");this._client=e,this._httpQueue=new s({concurrency:4});const{protocol:t,host:r,port:i}=e.getEndpointConfig();c(`enabled DelegatedPeerRouting via ${t}://${r}:${i}`)}async findPeer(e,t={}){let r=e;i.isPeerId(r)&&(r=e.toB58String()),c("findPeer starts: "+e),t.timeout=t.timeout||3e4;try{return await this._httpQueue.add((async()=>{const{addrs:i}=await this._client.dht.findPeer(r,{timeout:t.timeout});return{id:e,multiaddrs:i}}))}catch(e){if(e.message.includes("not found"))return;throw e}finally{c("findPeer finished: "+e)}}async*getClosestPeers(e,t={}){const r=n.encode(e).substring(1);c("getClosestPeers starts:",r),t.timeout=t.timeout||3e4;const s=o(),a=o();this._httpQueue.add((()=>(s.resolve(),a.promise)));try{await s.promise;const e=new Map;for await(const n of this._client.dht.query(r,{timeout:t.timeout}))switch(n.type){case 1:n.responses.forEach((t=>{e.set(t.id,{id:i.parse(t.id),multiaddrs:t.addrs})}));break;case 2:yield e.get(n.id.string)||{id:i.createFromCID(n.id),multiaddrs:[]};break;default:c("getClosestPeers unhandled response",n)}}catch(e){throw c.error("getClosestPeers errored:",e),e}finally{a.resolve(),c("getClosestPeers finished:",r)}}}},{"peer-id":"8Bdb3","multiformats/bases/base58":"4n7mA","p-queue":"biPlv","p-defer":"5rKSv",debug:"bO5wM"}],gg6SI:[function(e,t,r){"use strict";const i=e("debug"),n=e("peer-id"),s=e("it-drain"),{default:o}=e("p-queue"),a=e("p-defer"),c=i("libp2p-delegated-content-routing");c.error=i("libp2p-delegated-content-routing:error");t.exports=class{constructor(e,t){if(null==e)throw new Error("missing self peerId");if(null==t)throw new Error("missing ipfs http client");this._client=t,this.peerId=e;const r={concurrency:4};this._httpQueue=new o(r),this._httpQueueRefs=new o(Object.assign({},r,{concurrency:2}));const{protocol:i,host:n,port:s}=t.getEndpointConfig();c(`enabled DelegatedContentRouting via ${i}://${n}:${s}`)}async*findProviders(e,t={}){c(`findProviders starts: ${e}`),t.timeout=t.timeout||3e4;let r=0;const i=a(),s=a();this._httpQueue.add((()=>(i.resolve(),s.promise)));try{await i.promise;for await(const{id:i,addrs:s}of this._client.dht.findProvs(e,{numProviders:t.numProviders,timeout:t.timeout}))yield{id:n.parse(i),multiaddrs:s},r++}catch(e){throw c.error("findProviders errored:",e),e}finally{s.resolve(),c(`findProviders finished: ${e} found ${r} providers`)}}async provide(e){c(`provide starts: ${e}`),await this._httpQueueRefs.add((async()=>{await this._client.block.stat(e),await s(this._client.dht.provide(e))})),c(`provide finished: ${e}`)}}},{debug:"bO5wM","peer-id":"8Bdb3","it-drain":"dKYhO","p-queue":"biPlv","p-defer":"5rKSv"}],h5Uk6:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/multibases"),n=e("ipfs-core-utils/multicodecs"),s=e("ipfs-core-utils/multihashes"),o=e("@ipld/dag-pb"),a=e("@ipld/dag-cbor"),c=e("multiformats/hashes/identity"),u=e("multiformats/basics"),l=e("./bitswap/index.js"),d=e("./block/index.js"),f=e("./bootstrap/index.js"),h=e("./config/index.js"),p=e("./dag/index.js"),g=e("./dht/index.js"),y=e("./diag/index.js"),m=e("./files/index.js"),b=e("./key/index.js"),v=e("./log/index.js"),w=e("./name/index.js"),_=e("./object/index.js"),E=e("./pin/index.js"),S=e("./pubsub/index.js"),T=e("./refs/index.js"),A=e("./repo/index.js"),k=e("./stats/index.js"),I=e("./swarm/index.js"),R=e("./add.js"),P=e("./add-all.js"),O=e("./cat.js"),C=e("./commands.js"),j=e("./dns.js"),D=e("./get-endpoint-config.js"),M=e("./get.js"),x=e("./id.js"),B=e("./is-online.js"),L=e("./ls.js"),N=e("./mount.js"),U=e("./ping.js"),F=e("./resolve.js"),K=e("./start.js"),z=e("./stop.js"),V=e("./version.js"),q=e("ipfs-utils/src/files/glob-source.js"),G=e("multiformats/cid"),H=e("multiaddr"),$=e("ipfs-utils/src/files/url-source.js");function W(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function Y(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var X=Y(o),Z=Y(a),Q=W(q),J=W($);const ee=Q.default;Object.defineProperty(r,"CID",{enumerable:!0,get:function(){return G.CID}}),Object.defineProperty(r,"multiaddr",{enumerable:!0,get:function(){return H.Multiaddr}}),Object.defineProperty(r,"urlSource",{enumerable:!0,get:function(){return J.default}}),r.create=function(e={}){const t={name:c.identity.name,code:c.identity.code,encode:e=>e,decode:e=>e},r=Object.values(u.bases);(e.ipld&&e.ipld.bases?e.ipld.bases:[]).forEach((e=>r.push(e)));const o=new i.Multibases({bases:r,loadBase:e.ipld&&e.ipld.loadBase}),a=Object.values(u.codecs);[X,Z,t].concat(e.ipld&&e.ipld.codecs||[]).forEach((e=>a.push(e)));const q=new n.Multicodecs({codecs:a,loadCodec:e.ipld&&e.ipld.loadCodec}),G=Object.values(u.hashes);(e.ipld&&e.ipld.hashers?e.ipld.hashers:[]).forEach((e=>G.push(e)));const H=new s.Multihashes({hashers:G,loadHasher:e.ipld&&e.ipld.loadHasher});return{add:R.createAdd(e),addAll:P.createAddAll(e),bitswap:l.createBitswap(e),block:d.createBlock(e),bootstrap:f.createBootstrap(e),cat:O.createCat(e),commands:C.createCommands(e),config:h.createConfig(e),dag:p.createDag(q,e),dht:g.createDht(e),diag:y.createDiag(e),dns:j.createDns(e),files:m.createFiles(e),get:M.createGet(e),getEndpointConfig:D.createGetEndpointConfig(e),id:x.createId(e),isOnline:B.createIsOnline(e),key:b.createKey(e),log:v.createLog(e),ls:L.createLs(e),mount:N.createMount(e),name:w.createName(e),object:_.createObject(q,e),pin:E.createPin(e),ping:U.createPing(e),pubsub:S.createPubsub(e),refs:T.createRefs(e),repo:A.createRepo(e),resolve:F.createResolve(e),start:K.createStart(e),stats:k.createStats(e),stop:z.createStop(e),swarm:I.createSwarm(e),version:V.createVersion(e),bases:o,codecs:q,hashers:H}},r.globSource=ee},{"ipfs-core-utils/multibases":"lr7wI","ipfs-core-utils/multicodecs":"4I7TQ","ipfs-core-utils/multihashes":"febSG","@ipld/dag-pb":"i2cdx","@ipld/dag-cbor":"3498i","multiformats/hashes/identity":"eYCZn","multiformats/basics":"lPcQG","./bitswap/index.js":"e1wIm","./block/index.js":"jb9Ty","./bootstrap/index.js":"94xQz","./config/index.js":"jQsLT","./dag/index.js":"alcVs","./dht/index.js":"l4zXl","./diag/index.js":"lYFrh","./files/index.js":"5SjY6","./key/index.js":"d23S0","./log/index.js":"dax7W","./name/index.js":"hAUWJ","./object/index.js":"lIWb3","./pin/index.js":"2EyML","./pubsub/index.js":"9yoEA","./refs/index.js":"6sM7A","./repo/index.js":"lf1uS","./stats/index.js":"8ekdG","./swarm/index.js":"9n7fV","./add.js":"bh9eV","./add-all.js":"dygjF","./cat.js":"37ULc","./commands.js":"d7oos","./dns.js":"6WsTM","./get-endpoint-config.js":"e09lW","./get.js":"9dl4d","./id.js":"iMd7i","./is-online.js":"1Ujko","./ls.js":"jIkVK","./mount.js":"5Ghx1","./ping.js":"fIZQw","./resolve.js":"fqXrw","./start.js":"4YTOj","./stop.js":"j2dHM","./version.js":"k3Foi","ipfs-utils/src/files/glob-source.js":"lHksA","multiformats/cid":"9ooAY",multiaddr:"8Mu1u","ipfs-utils/src/files/url-source.js":"jQSIS"}],lr7wI:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=e=>Promise.reject(new Error(`No base found for "${e}"`));r.Multibases=class{constructor(e){this._basesByName={},this._basesByPrefix={},this._loadBase=e.loadBase||i;for(const t of e.bases)this.addBase(t)}addBase(e){if(this._basesByName[e.name]||this._basesByPrefix[e.prefix])throw new Error(`Codec already exists for codec "${e.name}"`);this._basesByName[e.name]=e,this._basesByPrefix[e.prefix]=e}removeBase(e){delete this._basesByName[e.name],delete this._basesByPrefix[e.prefix]}async getBase(e){if(this._basesByName[e])return this._basesByName[e];if(this._basesByPrefix[e])return this._basesByPrefix[e];const t=await this._loadBase(e);return null==this._basesByName[t.name]&&null==this._basesByPrefix[t.prefix]&&this.addBase(t),t}listBases(){return Object.values(this._basesByName)}}},{}],"4I7TQ":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=e=>Promise.reject(new Error(`No codec found for "${e}"`));r.Multicodecs=class{constructor(e){this._codecsByName={},this._codecsByCode={},this._loadCodec=e.loadCodec||i;for(const t of e.codecs)this.addCodec(t)}addCodec(e){if(this._codecsByName[e.name]||this._codecsByCode[e.code])throw new Error(`Resolver already exists for codec "${e.name}"`);this._codecsByName[e.name]=e,this._codecsByCode[e.code]=e}removeCodec(e){delete this._codecsByName[e.name],delete this._codecsByCode[e.code]}async getCodec(e){const t="string"==typeof e?this._codecsByName:this._codecsByCode;if(t[e])return t[e];const r=await this._loadCodec(e);return null==t[e]&&this.addCodec(r),r}listCodecs(){return Object.values(this._codecsByName)}}},{}],febSG:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=e=>Promise.reject(new Error(`No hasher found for "${e}"`));r.Multihashes=class{constructor(e){this._hashersByName={},this._hashersByCode={},this._loadHasher=e.loadHasher||i;for(const t of e.hashers)this.addHasher(t)}addHasher(e){if(this._hashersByName[e.name]||this._hashersByCode[e.code])throw new Error(`Resolver already exists for codec "${e.name}"`);this._hashersByName[e.name]=e,this._hashersByCode[e.code]=e}removeHasher(e){delete this._hashersByName[e.name],delete this._hashersByCode[e.code]}async getHasher(e){const t="string"==typeof e?this._hashersByName:this._hashersByCode;if(t[e])return t[e];const r=await this._loadHasher(e);return null==t[e]&&this.addHasher(r),r}listHashers(){return Object.values(this._hashersByName)}}},{}],e1wIm:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./wantlist.js"),n=e("./wantlist-for-peer.js"),s=e("./stat.js"),o=e("./unwant.js");r.createBitswap=function(e){return{wantlist:i.createWantlist(e),wantlistForPeer:n.createWantlistForPeer(e),unwant:o.createUnwant(e),stat:s.createStat(e)}}},{"./wantlist.js":"hU5XK","./wantlist-for-peer.js":"9fQsQ","./stat.js":"3Q0KE","./unwant.js":"azoPb"}],hU5XK:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t={}){return((await(await e.post("bitswap/wantlist",{signal:t.signal,searchParams:s.toUrlSearchParams(t),headers:t.headers})).json()).Keys||[]).map((e=>i.CID.parse(e["/"])))}));r.createWantlist=o},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],hR8g6:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./core.js");r.configure=e=>t=>e(new i.Client(t),t)},{"./core.js":"3XXp5"}],"3XXp5":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiaddr"),n=e("ipfs-utils/src/env.js"),s=e("parse-duration"),o=e("debug"),a=e("ipfs-utils/src/http.js"),c=e("merge-options"),u=e("ipfs-core-utils/to-url-string"),l=e("ipfs-core-utils/agent");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=d(s),h=d(o),p=d(a),g=d(c),y=d(l);const m=h.default("ipfs-http-client:lib:error-handler"),b=g.default.bind({ignoreUndefined:!0}),v=n.isBrowser||n.isWebWorker?location.protocol:"http",w=n.isBrowser||n.isWebWorker?location.hostname:"localhost",_=n.isBrowser||n.isWebWorker?location.port:"5001",E=async e=>{let t;try{if((e.headers.get("Content-Type")||"").startsWith("application/json")){const r=await e.json();m(r),t=r.Message||r.message}else t=await e.text()}catch(e){m("Failed to parse error response",e),t=e.message}let r=new p.default.HTTPError(e);throw t&&(t.includes("deadline has elapsed")&&(r=new p.default.TimeoutError),t&&t.includes("context deadline exceeded")&&(r=new p.default.TimeoutError)),t&&t.includes("request timed out")&&(r=new p.default.TimeoutError),t&&(r.message=t),r},S=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,T=e=>e.replace(S,(function(e){return"-"+e.toLowerCase()}));class A extends p.default{constructor(e={}){const t=((e={})=>{let t,r,s={};if("string"==typeof e||i.Multiaddr.isMultiaddr(e))t=new URL(u.toUrlString(e));else if(e instanceof URL)t=e;else if("string"==typeof e.url||i.Multiaddr.isMultiaddr(e.url))t=new URL(u.toUrlString(e.url)),s=e;else if(e.url instanceof URL)t=e.url,s=e;else{s=e||{};const r=(s.protocol||v).replace(":",""),i=(s.host||w).split(":")[0],n=s.port||_;t=new URL(`${r}://${i}:${n}`)}if(s.apiPath?t.pathname=s.apiPath:"/"!==t.pathname&&void 0!==t.pathname||(t.pathname="api/v0"),n.isNode){const e=y.default(t);r=s.agent||new e({keepAlive:!0,maxSockets:6})}return{...s,host:t.host,protocol:t.protocol.replace(":",""),port:Number(t.port),apiPath:t.pathname,url:t,agent:r}})(e);var r;super({timeout:(r=t.timeout||0,("string"==typeof r?f.default(r):r)||void 0),headers:t.headers,base:`${t.url}`,handleError:E,transformSearchParams:e=>{const t=new URLSearchParams;for(const[r,i]of e)"undefined"!==i&&"null"!==i&&"signal"!==r&&t.append(T(r),i),"timeout"!==r||isNaN(i)||t.append(T(r),i);return t},agent:t.agent}),delete this.get,delete this.put,delete this.delete,delete this.options;const s=this.fetch;this.fetch=(e,r={})=>("string"!=typeof e||e.startsWith("/")||(e=`${t.url}/${e}`),s.call(this,e,b(r,{method:"POST"})))}}const k=p.default.HTTPError;r.Client=A,r.HTTPError=k,r.errorHandler=E},{multiaddr:"8Mu1u","ipfs-utils/src/env.js":"flyHr","parse-duration":"fGYtw",debug:"bO5wM","ipfs-utils/src/http.js":"ifXXn","merge-options":"fupyv","ipfs-core-utils/to-url-string":"aPEcT","ipfs-core-utils/agent":"lcuEJ"}],aPEcT:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiaddr");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e("multiaddr-to-uri"));r.toUrlString=function(e){try{e=s.default(new i.Multiaddr(e))}catch(e){}return e=e.toString()}},{multiaddr:"8Mu1u","multiaddr-to-uri":"4PPH7"}],lcuEJ:[function(e,t,r){"use strict";t.exports=()=>{}},{}],fT4zz:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./mode-to-string.js"),n=e("./parse-mtime.js");r.toUrlSearchParams=function({arg:e,searchParams:t,hashAlg:r,mtime:s,mode:o,...a}={}){t&&(a={...a,...t}),r&&(a.hash=r),null!=s&&(s=n.parseMtime(s),a.mtime=s.secs,a.mtimeNsecs=s.nsecs),null!=o&&(a.mode=i.modeToString(o)),a.timeout&&!isNaN(a.timeout)&&(a.timeout=`${a.timeout}ms`),null==e?e=[]:Array.isArray(e)||(e=[e]);const c=new URLSearchParams(a);return e.forEach((e=>c.append("arg",e))),c}},{"./mode-to-string.js":"bbWaj","./parse-mtime.js":"aLNRF"}],bbWaj:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.modeToString=function(e){if(null!=e)return"string"==typeof e?e:e.toString(8).padStart(4,"0")}},{}],aLNRF:[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("err-code"));r.parseMtime=function(e){if(null==e)return;let t;if(null!=e.secs&&(t={secs:e.secs,nsecs:e.nsecs}),null!=e.Seconds&&(t={secs:e.Seconds,nsecs:e.FractionalNanoseconds}),Array.isArray(e)&&(t={secs:e[0],nsecs:e[1]}),e instanceof Date){const r=e.getTime(),i=Math.floor(r/1e3);t={secs:i,nsecs:1e3*(r-1e3*i)}}if(Object.prototype.hasOwnProperty.call(t,"secs")){if(null!=t&&null!=t.nsecs&&(t.nsecs<0||t.nsecs>999999999))throw n.default(new Error("mtime-nsecs must be within the range [0,999999999]"),"ERR_INVALID_MTIME_NSECS");return t}}},{"err-code":"chZjB"}],"9fQsQ":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r={}){return((await(await e.post("bitswap/wantlist",{signal:r.signal,searchParams:s.toUrlSearchParams({...r,peer:t.toString()}),headers:r.headers})).json()).Keys||[]).map((e=>i.CID.parse(e["/"])))}));r.createWantlistForPeer=o},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"3Q0KE":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t={}){const r=await e.post("bitswap/stat",{searchParams:s.toUrlSearchParams(t),signal:t.signal,headers:t.headers});return function(e){return{provideBufLen:e.ProvideBufLen,wantlist:(e.Wantlist||[]).map((e=>i.CID.parse(e["/"]))),peers:e.Peers||[],blocksReceived:BigInt(e.BlocksReceived),dataReceived:BigInt(e.DataReceived),blocksSent:BigInt(e.BlocksSent),dataSent:BigInt(e.DataSent),dupBlksReceived:BigInt(e.DupBlksReceived),dupDataReceived:BigInt(e.DupDataReceived)}}(await r.json())}));r.createStat=o},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],azoPb:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t,r={}){return(await e.post("bitswap/unwant",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t.toString(),...r}),headers:r.headers})).json()}));r.createUnwant=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],jb9Ty:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./get.js"),n=e("./put.js"),s=e("./rm.js"),o=e("./stat.js");r.createBlock=function(e){return{get:i.createGet(e),put:n.createPut(e),rm:s.createRm(e),stat:o.createStat(e)}}},{"./get.js":"818EH","./put.js":"aXuxp","./rm.js":"7gdfk","./stat.js":"h9r67"}],"818EH":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t,r={}){const i=await e.post("block/get",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t.toString(),...r}),headers:r.headers});return new Uint8Array(await i.arrayBuffer())}));r.createGet=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],aXuxp:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("ipfs-core-utils/multipart-request"),s=e("../lib/configure.js"),o=e("../lib/to-url-search-params.js"),a=e("../lib/abort-signal.js"),c=e("native-abort-controller");const u=s.configure((e=>async function t(r,s={}){const u=new c.AbortController,l=a.abortSignal(u.signal,s.signal);let d;try{const t=await e.post("block/put",{signal:l,searchParams:o.toUrlSearchParams(s),...await n.multipartRequest(r,u,s.headers)});d=await t.json()}catch(e){if("dag-pb"===s.format)return t(r,{...s,format:"protobuf"});if("dag-cbor"===s.format)return t(r,{...s,format:"cbor"});throw e}return i.CID.parse(d.Key)}));r.createPut=u},{"multiformats/cid":"9ooAY","ipfs-core-utils/multipart-request":"7TICD","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz","../lib/abort-signal.js":"hzxSr","native-abort-controller":"6zwoZ"}],"7TICD":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./files/normalise-input.browser.js"),n=e("./mode-to-string.js");r.multipartRequest=async function(e,t,r={}){const s=[],o=new FormData;let a=0,c=0;for await(const{content:t,path:r,mode:u,mtime:l}of i.normaliseInput(e)){let e="";a>0&&(e=`-${a}`);let i=(t?"file":"dir")+e;const d=[];if(null!=u&&d.push(`mode=${n.modeToString(u)}`),null!=l){const{secs:e,nsecs:t}=l;d.push(`mtime=${e}`),null!=t&&d.push(`mtime-nsecs=${t}`)}if(d.length&&(i=`${i}?${d.join("&")}`),t){o.set(i,t,null!=r?encodeURIComponent(r):void 0);const e=c+t.size;s.push({name:r,start:c,end:e}),c=e}else{if(null==r)throw new Error("path or content or both must be set");o.set(i,new File([""],encodeURIComponent(r),{type:"application/x-directory"}))}a++}return{total:c,parts:s,headers:r,body:o}}},{"./files/normalise-input.browser.js":"67MIR","./mode-to-string.js":"laXQo"}],"67MIR":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./normalise-content.browser.js"),n=e("./normalise.js");r.normaliseInput=function(e){return n.normalise(e,i.normaliseContent)}},{"./normalise-content.browser.js":"fbARE","./normalise.js":"7hUEG"}],fbARE:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("err-code"),n=e("it-peekable"),s=e("browser-readablestream-to-it"),o=e("it-all"),a=e("./utils.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(i),l=c(n),d=c(s),f=c(o);async function h(e){const t=[];for await(const r of e)t.push(r);return new Blob(t)}r.normaliseContent=async function(e){if(a.isBytes(e))return new Blob([e]);if("string"==typeof e||e instanceof String)return new Blob([e.toString()]);if(a.isBlob(e))return e;if(a.isReadableStream(e)&&(e=d.default(e)),Symbol.iterator in e||Symbol.asyncIterator in e){const t=l.default(e),{value:r,done:i}=await t.peek();if(i)return h(t);if(t.push(r),Number.isInteger(r))return new Blob([Uint8Array.from(await f.default(t))]);if(a.isBytes(r)||"string"==typeof r||r instanceof String)return h(t)}throw u.default(new Error(`Unexpected input: ${e}`),"ERR_UNEXPECTED_INPUT")}},{"err-code":"chZjB","it-peekable":"bi9X1","browser-readablestream-to-it":"aUa4D","it-all":"iCXBu","./utils.js":"ded5K"}],laXQo:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.modeToString=function(e){if(null!=e)return"string"==typeof e?e:e.toString(8).padStart(4,"0")}},{}],hzxSr:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("any-signal");r.abortSignal=function(...e){return i.anySignal(function(e){return e.filter(Boolean)}(e))}},{"any-signal":"kXgRR"}],"7gdfk":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function*(t,r={}){Array.isArray(t)||(t=[t]);const i=await e.post("block/rm",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:t.map((e=>e.toString())),"stream-channels":!0,...r}),headers:r.headers});for await(const e of i.ndjson())yield a(e)}));function a(e){const t={cid:i.CID.parse(e.Hash)};return e.Error&&(t.error=new Error(e.Error)),t}r.createRm=o},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],h9r67:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r={}){const n=await e.post("block/stat",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:t.toString(),...r}),headers:r.headers}),o=await n.json();return{cid:i.CID.parse(o.Key),size:o.Size}}));r.createStat=o},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"94xQz":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./add.js"),n=e("./clear.js"),s=e("./list.js"),o=e("./reset.js"),a=e("./rm.js");r.createBootstrap=function(e){return{add:i.createAdd(e),clear:n.createClear(e),list:s.createList(e),reset:o.createReset(e),rm:a.createRm(e)}}},{"./add.js":"i6XDR","./clear.js":"89Gdv","./list.js":"4mZUF","./reset.js":"ldIgy","./rm.js":"5vusI"}],i6XDR:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js"),s=e("multiaddr");const o=i.configure((e=>async function(t,r={}){const i=await e.post("bootstrap/add",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,...r}),headers:r.headers}),{Peers:o}=await i.json();return{Peers:o.map((e=>new s.Multiaddr(e)))}}));r.createAdd=o},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz",multiaddr:"8Mu1u"}],"89Gdv":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js"),s=e("multiaddr");const o=i.configure((e=>async function(t={}){const r=await e.post("bootstrap/rm",{signal:t.signal,searchParams:n.toUrlSearchParams({...t,all:!0}),headers:t.headers}),{Peers:i}=await r.json();return{Peers:i.map((e=>new s.Multiaddr(e)))}}));r.createClear=o},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz",multiaddr:"8Mu1u"}],"4mZUF":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js"),s=e("multiaddr");const o=i.configure((e=>async function(t={}){const r=await e.post("bootstrap/list",{signal:t.signal,searchParams:n.toUrlSearchParams(t),headers:t.headers}),{Peers:i}=await r.json();return{Peers:i.map((e=>new s.Multiaddr(e)))}}));r.createList=o},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz",multiaddr:"8Mu1u"}],ldIgy:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js"),s=e("multiaddr");const o=i.configure((e=>async function(t={}){const r=await e.post("bootstrap/add",{signal:t.signal,searchParams:n.toUrlSearchParams({...t,default:!0}),headers:t.headers}),{Peers:i}=await r.json();return{Peers:i.map((e=>new s.Multiaddr(e)))}}));r.createReset=o},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz",multiaddr:"8Mu1u"}],"5vusI":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js"),s=e("multiaddr");const o=i.configure((e=>async function(t,r={}){const i=await e.post("bootstrap/rm",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,...r}),headers:r.headers}),{Peers:o}=await i.json();return{Peers:o.map((e=>new s.Multiaddr(e)))}}));r.createRm=o},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz",multiaddr:"8Mu1u"}],jQsLT:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./profiles/index.js"),n=e("./get.js"),s=e("./get-all.js"),o=e("./replace.js"),a=e("./set.js");r.createConfig=function(e){return{getAll:s.createGetAll(e),get:n.createGet(e),set:a.createSet(e),replace:o.createReplace(e),profiles:i.createProfiles(e)}}},{"./profiles/index.js":"h2X0u","./get.js":"7SQ8n","./get-all.js":"6OKA2","./replace.js":"2ISib","./set.js":"eroO0"}],h2X0u:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./apply.js"),n=e("./list.js");r.createProfiles=function(e){return{apply:i.createApply(e),list:n.createList(e)}}},{"./apply.js":"brNlE","./list.js":"bZlc4"}],brNlE:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../lib/configure.js"),n=e("../../lib/to-url-search-params.js");const s=i.configure((e=>async function(t,r={}){const i=await e.post("config/profile/apply",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,...r}),headers:r.headers}),s=await i.json();return{original:s.OldCfg,updated:s.NewCfg}}));r.createApply=s},{"../../lib/configure.js":"hR8g6","../../lib/to-url-search-params.js":"fT4zz"}],bZlc4:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../lib/object-to-camel.js"),n=e("../../lib/configure.js"),s=e("../../lib/to-url-search-params.js");const o=n.configure((e=>async function(t={}){const r=await e.post("config/profile/list",{signal:t.signal,searchParams:s.toUrlSearchParams(t),headers:t.headers});return(await r.json()).map((e=>i.objectToCamel(e)))}));r.createList=o},{"../../lib/object-to-camel.js":"hdPx4","../../lib/configure.js":"hR8g6","../../lib/to-url-search-params.js":"fT4zz"}],hdPx4:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.objectToCamel=function(e){if(null==e)return e;const t=/^[A-Z]+$/;return Object.keys(e).reduce(((r,i)=>(t.test(i)?r[i.toLowerCase()]=e[i]:t.test(i[0])?r[i[0].toLowerCase()+i.slice(1)]=e[i]:r[i]=e[i],r)),{})}},{}],"7SQ8n":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async(t,r={})=>{if(!t)throw new Error("key argument is required");const i=await e.post("config",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,...r}),headers:r.headers});return(await i.json()).Value}));r.createGet=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"6OKA2":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async(t={})=>{const r=await e.post("config/show",{signal:t.signal,searchParams:n.toUrlSearchParams({...t}),headers:t.headers});return await r.json()}));r.createGetAll=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"2ISib":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("uint8arrays/from-string"),n=e("ipfs-core-utils/multipart-request"),s=e("../lib/configure.js"),o=e("../lib/to-url-search-params.js"),a=e("../lib/abort-signal.js"),c=e("native-abort-controller");const u=s.configure((e=>async(t,r={})=>{const s=new c.AbortController,u=a.abortSignal(s.signal,r.signal),l=await e.post("config/replace",{signal:u,searchParams:o.toUrlSearchParams(r),...await n.multipartRequest(i.fromString(JSON.stringify(t)),s,r.headers)});await l.text()}));r.createReplace=u},{"uint8arrays/from-string":"dF7Y4","ipfs-core-utils/multipart-request":"7TICD","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz","../lib/abort-signal.js":"hzxSr","native-abort-controller":"6zwoZ"}],eroO0:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async(t,r,i={})=>{if("string"!=typeof t)throw new Error("Invalid key type");const s={...i,...o(t,r)},a=await e.post("config",{signal:i.signal,searchParams:n.toUrlSearchParams(s),headers:i.headers});await a.text()})),o=(e,t)=>{switch(typeof t){case"boolean":return{arg:[e,t.toString()],bool:!0};case"string":return{arg:[e,t]};default:return{arg:[e,JSON.stringify(t)],json:!0}}};r.createSet=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],alcVs:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./export.js"),n=e("./get.js"),s=e("./import.js"),o=e("./put.js"),a=e("./resolve.js");r.createDag=function(e,t){return{export:i.createExport(t),get:n.createGet(e,t),import:s.createImport(t),put:o.createPut(e,t),resolve:a.createResolve(t)}}},{"./export.js":"42FYP","./get.js":"1DVHz","./import.js":"91D00","./put.js":"e3DVQ","./resolve.js":"fYLE3"}],"42FYP":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function*(t,r={}){const i=await e.post("dag/export",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t.toString()}),headers:r.headers});yield*i.iterator()}));r.createExport=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"1DVHz":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/resolve.js"),s=e("it-first"),o=e("it-last"),a=e("err-code"),c=e("../block/get.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(s),d=u(o),f=u(a);r.createGet=(e,t)=>i.configure(((t,r)=>{const i=c.createGet(r);return async(t,r={})=>{if(r.path){const s=r.localResolve?await l.default(n.resolve(t,r.path,e,i,r)):await d.default(n.resolve(t,r.path,e,i,r));if(!s)throw f.default(new Error("Not found"),"ERR_NOT_FOUND");return s}const s=await e.getCodec(t.code),o=await i(t,r);return{value:s.decode(o),remainderPath:""}}}))(t)},{"../lib/configure.js":"hR8g6","../lib/resolve.js":"7MeIb","it-first":"hBrkP","it-last":"cSXX9","err-code":"chZjB","../block/get.js":"818EH"}],"7MeIb":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e("err-code"));r.resolve=async function*(e,t,r,n,o){const a=async e=>{const t=await r.getCodec(e.code),i=await n(e,o);return t.decode(i)},c=t.split("/").filter(Boolean);let u=await a(e),l=e;for(c.length||(yield{value:u,remainderPath:""});c.length;){const e=c.shift();if(!e)throw s.default(new Error(`Could not resolve path "${t}"`),"ERR_INVALID_PATH");if(!Object.prototype.hasOwnProperty.call(u,e))throw s.default(new Error(`no link named "${e}" under ${l}`),"ERR_NO_LINK");u=u[e],yield{value:u,remainderPath:c.join("/")};const r=i.CID.asCID(u);r&&(l=r,u=await a(u))}}},{"multiformats/cid":"9ooAY","err-code":"chZjB"}],"91D00":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js"),s=e("../lib/abort-signal.js"),o=e("ipfs-core-utils/multipart-request"),a=e("native-abort-controller"),c=e("multiformats/cid");const u=i.configure((e=>async function*(t,r={}){const i=new a.AbortController,u=s.abortSignal(i.signal,r.signal),{headers:l,body:d}=await o.multipartRequest(t,i,r.headers),f=await e.post("dag/import",{signal:u,headers:l,body:d,searchParams:n.toUrlSearchParams({"pin-roots":r.pinRoots})});for await(const{Root:e}of f.ndjson())if(void 0!==e){const{Cid:{"/":t},PinErrorMsg:r}=e;yield{root:{cid:c.CID.parse(t),pinErrorMsg:r}}}}));r.createImport=u},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz","../lib/abort-signal.js":"hzxSr","ipfs-core-utils/multipart-request":"7TICD","native-abort-controller":"6zwoZ","multiformats/cid":"9ooAY"}],e3DVQ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("ipfs-core-utils/multipart-request"),o=e("../lib/to-url-search-params.js"),a=e("../lib/abort-signal.js"),c=e("native-abort-controller");r.createPut=(e,t)=>n.configure((t=>async(r,n={})=>{const u={format:"dag-cbor",hashAlg:"sha2-256",inputEnc:"raw",...n},l=(await e.getCodec(u.format)).encode(r),d=new c.AbortController,f=a.abortSignal(d.signal,u.signal),h=await t.post("dag/put",{timeout:u.timeout,signal:f,searchParams:o.toUrlSearchParams(u),...await s.multipartRequest(l,d,u.headers)}),p=await h.json();return i.CID.parse(p.Cid["/"])}))(t)},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","ipfs-core-utils/multipart-request":"7TICD","../lib/to-url-search-params.js":"fT4zz","../lib/abort-signal.js":"hzxSr","native-abort-controller":"6zwoZ"}],fYLE3:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async(t,r={})=>{const n=await e.post("dag/resolve",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:`${t}${r.path?`/${r.path}`.replace(/\/[/]+/g,"/"):""}`,...r}),headers:r.headers}),o=await n.json();return{cid:i.CID.parse(o.Cid["/"]),remainderPath:o.RemPath}}));r.createResolve=o},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],l4zXl:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./find-peer.js"),n=e("./find-provs.js"),s=e("./get.js"),o=e("./provide.js"),a=e("./put.js"),c=e("./query.js");r.createDht=function(e){return{findPeer:i.createFindPeer(e),findProvs:n.createFindProvs(e),get:s.createGet(e),provide:o.createProvide(e),put:a.createPut(e),query:c.createQuery(e)}}},{"./find-peer.js":"c2Je3","./find-provs.js":"Cn9mt","./get.js":"8ckSi","./provide.js":"i1las","./put.js":"fVqLD","./query.js":"aEVP8"}],c2Je3:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiaddr"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js"),o=e("./response-types.js");const a=n.configure((e=>async function(t,r={}){const n=await e.post("dht/findpeer",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:t,...r}),headers:r.headers});for await(const e of n.ndjson())if(e.Type===o.FinalPeer&&e.Responses){const{ID:t,Addrs:r}=e.Responses[0];return{id:t,addrs:(r||[]).map((e=>new i.Multiaddr(e)))}}throw new Error("not found")}));r.createFindPeer=a},{multiaddr:"8Mu1u","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz","./response-types.js":"lyzlA"}],lyzlA:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.AddingPeer=6,r.DialingPeer=7,r.FinalPeer=2,r.PeerResponse=1,r.Provider=4,r.QueryError=3,r.SendingQuery=0,r.Value=5},{}],Cn9mt:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiaddr"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js"),o=e("./response-types.js");const a=n.configure((e=>async function*(t,r={}){const n=await e.post("dht/findprovs",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:t.toString(),...r}),headers:r.headers});for await(const e of n.ndjson())if(e.Type===o.Provider&&e.Responses)for(const{ID:t,Addrs:r}of e.Responses)yield{id:t,addrs:(r||[]).map((e=>new i.Multiaddr(e)))}}));r.createFindProvs=a},{multiaddr:"8Mu1u","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz","./response-types.js":"lyzlA"}],"8ckSi":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js"),s=e("./response-types.js"),o=e("uint8arrays/from-string"),a=e("uint8arrays/to-string");const c=i.configure((e=>async function(t,r={}){const i=await e.post("dht/get",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t instanceof Uint8Array?a.toString(t):t,...r}),headers:r.headers});for await(const e of i.ndjson())if(e.Type===s.Value)return o.fromString(e.Extra,"base64pad");throw new Error("not found")}));r.createGet=c},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz","./response-types.js":"lyzlA","uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB"}],i1las:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiaddr"),n=e("../lib/object-to-camel.js"),s=e("../lib/configure.js"),o=e("../lib/to-url-search-params.js");const a=s.configure((e=>async function*(t,r={recursive:!1}){const s=Array.isArray(t)?t:[t],a=await e.post("dht/provide",{signal:r.signal,searchParams:o.toUrlSearchParams({arg:s.map((e=>e.toString())),...r}),headers:r.headers});for await(let e of a.ndjson())e=n.objectToCamel(e),e.responses?e.responses=e.responses.map((({ID:e,Addrs:t})=>({id:e,addrs:(t||[]).map((e=>new i.Multiaddr(e)))}))):e.responses=[],yield e}));r.createProvide=a},{multiaddr:"8Mu1u","../lib/object-to-camel.js":"hdPx4","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],fVqLD:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiaddr"),n=e("../lib/object-to-camel.js"),s=e("../lib/configure.js"),o=e("../lib/to-url-search-params.js"),a=e("ipfs-core-utils/multipart-request"),c=e("../lib/abort-signal.js"),u=e("native-abort-controller"),l=e("uint8arrays/to-string");const d=s.configure((e=>async function*(t,r,s={}){const d=new u.AbortController,f=c.abortSignal(d.signal,s.signal),h=await e.post("dht/put",{signal:f,searchParams:o.toUrlSearchParams({arg:l.toString(t),...s}),...await a.multipartRequest(r,d,s.headers)});for await(let e of h.ndjson())e=n.objectToCamel(e),e.responses&&(e.responses=e.responses.map((({ID:e,Addrs:t})=>({id:e,addrs:(t||[]).map((e=>new i.Multiaddr(e)))})))),yield e}));r.createPut=d},{multiaddr:"8Mu1u","../lib/object-to-camel.js":"hdPx4","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz","ipfs-core-utils/multipart-request":"7TICD","../lib/abort-signal.js":"hzxSr","native-abort-controller":"6zwoZ","uint8arrays/to-string":"hC8JB"}],aEVP8:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiaddr"),n=e("../lib/object-to-camel.js"),s=e("../lib/configure.js"),o=e("../lib/to-url-search-params.js");const a=s.configure((e=>async function*(t,r={}){const s=await e.post("dht/query",{signal:r.signal,searchParams:o.toUrlSearchParams({arg:t.toString(),...r}),headers:r.headers});for await(let e of s.ndjson())e=n.objectToCamel(e),e.responses=(e.responses||[]).map((({ID:e,Addrs:t})=>({id:e,addrs:(t||[]).map((e=>new i.Multiaddr(e)))}))),yield e}));r.createQuery=a},{multiaddr:"8Mu1u","../lib/object-to-camel.js":"hdPx4","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],lYFrh:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./cmds.js"),n=e("./net.js"),s=e("./sys.js");r.createDiag=function(e){return{cmds:i.createCmds(e),net:n.createNet(e),sys:s.createSys(e)}}},{"./cmds.js":"l9zdD","./net.js":"6Ce1z","./sys.js":"ySsKi"}],l9zdD:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t={}){return(await e.post("diag/cmds",{signal:t.signal,searchParams:n.toUrlSearchParams(t),headers:t.headers})).json()}));r.createCmds=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"6Ce1z":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t={}){return(await e.post("diag/net",{signal:t.signal,searchParams:n.toUrlSearchParams(t),headers:t.headers})).json()}));r.createNet=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],ySsKi:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t={}){return(await e.post("diag/sys",{signal:t.signal,searchParams:n.toUrlSearchParams(t),headers:t.headers})).json()}));r.createSys=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"5SjY6":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./chmod.js"),n=e("./cp.js"),s=e("./flush.js"),o=e("./ls.js"),a=e("./mkdir.js"),c=e("./mv.js"),u=e("./read.js"),l=e("./rm.js"),d=e("./stat.js"),f=e("./touch.js"),h=e("./write.js");r.createFiles=function(e){return{chmod:i.createChmod(e),cp:n.createCp(e),flush:s.createFlush(e),ls:o.createLs(e),mkdir:a.createMkdir(e),mv:c.createMv(e),read:u.createRead(e),rm:l.createRm(e),stat:d.createStat(e),touch:f.createTouch(e),write:h.createWrite(e)}}},{"./chmod.js":"i7Fmt","./cp.js":"5v5u2","./flush.js":"deUwB","./ls.js":"1dhdH","./mkdir.js":"iocNx","./mv.js":"jgv4R","./read.js":"2jkwj","./rm.js":"60cHB","./stat.js":"2InTg","./touch.js":"aa8jv","./write.js":"aw4qs"}],i7Fmt:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t,r,i={}){const s=await e.post("files/chmod",{signal:i.signal,searchParams:n.toUrlSearchParams({arg:t,mode:r,...i}),headers:i.headers});await s.text()}));r.createChmod=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"5v5u2":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r,n={}){const o=Array.isArray(t)?t:[t],a=await e.post("files/cp",{signal:n.signal,searchParams:s.toUrlSearchParams({arg:o.concat(r).map((e=>i.CID.asCID(e)?`/ipfs/${e}`:e)),...n}),headers:n.headers});await a.text()}));r.createCp=o},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],deUwB:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r={}){if(!t||"string"!=typeof t)throw new Error("ipfs.files.flush requires a path");const n=await e.post("files/flush",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:t,...r}),headers:r.headers}),o=await n.json();return i.CID.parse(o.Cid)}));r.createFlush=o},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"1dhdH":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/object-to-camel-with-metadata.js"),s=e("../lib/configure.js"),o=e("../lib/to-url-search-params.js");const a=s.configure((e=>async function*(t,r={}){if(!t)throw new Error("ipfs.files.ls requires a path");const s=await e.post("files/ls",{signal:r.signal,searchParams:o.toUrlSearchParams({arg:i.CID.asCID(t)?`/ipfs/${t}`:t,long:!0,...r,stream:!0}),headers:r.headers});for await(const e of s.ndjson())if("Entries"in e)for(const t of e.Entries||[])yield c(n.objectToCamelWithMetadata(t));else yield c(n.objectToCamelWithMetadata(e))}));function c(e){return e.hash&&(e.cid=i.CID.parse(e.hash)),delete e.hash,e.type=1===e.type?"directory":"file",e}r.createLs=a},{"multiformats/cid":"9ooAY","../lib/object-to-camel-with-metadata.js":"1iQWC","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"1iQWC":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./object-to-camel.js");r.objectToCamelWithMetadata=function(e){const t=i.objectToCamel(e);return Object.prototype.hasOwnProperty.call(t,"mode")&&(t.mode=parseInt(t.mode,8)),Object.prototype.hasOwnProperty.call(t,"mtime")&&(t.mtime={secs:t.mtime,nsecs:t.mtimeNsecs||0},delete t.mtimeNsecs),t}},{"./object-to-camel.js":"hdPx4"}],iocNx:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t,r={}){const i=await e.post("files/mkdir",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,...r}),headers:r.headers});await i.text()}));r.createMkdir=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],jgv4R:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t,r,i={}){Array.isArray(t)||(t=[t]);const s=await e.post("files/mv",{signal:i.signal,searchParams:n.toUrlSearchParams({arg:t.concat(r),...i}),headers:i.headers});await s.text()}));r.createMv=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"2jkwj":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(e("stream-to-it/source.js"));const a=i.configure((e=>async function*(t,r={}){const i=await e.post("files/read",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,count:r.length,...r}),headers:r.headers});yield*o.default(i.body)}));r.createRead=a},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz","stream-to-it/source.js":"7664L"}],"7664L":[function(e,t,r){t.exports=e=>{if(e[Symbol.asyncIterator])return e;if(e.getReader)return async function*(){const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)return;yield r}}finally{t.releaseLock()}}();throw new Error("unknown stream")}},{}],"60cHB":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t,r={}){const i=await e.post("files/rm",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,...r}),headers:r.headers});await i.text()}));r.createRm=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"2InTg":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/object-to-camel-with-metadata.js"),s=e("../lib/configure.js"),o=e("../lib/to-url-search-params.js");const a=s.configure((e=>async function(t,r={}){const s=await e.post("files/stat",{signal:r.signal,searchParams:o.toUrlSearchParams({arg:t,...r}),headers:r.headers}),a=await s.json();return a.WithLocality=a.WithLocality||!1,(c=n.objectToCamelWithMetadata(a)).cid=i.CID.parse(c.hash),delete c.hash,c;var c}));r.createStat=a},{"multiformats/cid":"9ooAY","../lib/object-to-camel-with-metadata.js":"1iQWC","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],aa8jv:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t,r={}){const i=await e.post("files/touch",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,...r}),headers:r.headers});await i.text()}));r.createTouch=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],aw4qs:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/mode-to-string.js"),n=e("../lib/parse-mtime.js"),s=e("../lib/configure.js"),o=e("ipfs-core-utils/multipart-request"),a=e("../lib/to-url-search-params.js"),c=e("../lib/abort-signal.js"),u=e("native-abort-controller");const l=s.configure((e=>async function(t,r,s={}){const l=new u.AbortController,d=c.abortSignal(l.signal,s.signal),f=await e.post("files/write",{signal:d,searchParams:a.toUrlSearchParams({arg:t,streamChannels:!0,count:s.length,...s}),...await o.multipartRequest({content:r,path:"arg",mode:i.modeToString(s.mode),mtime:n.parseMtime(s.mtime)},l,s.headers)});await f.text()}));r.createWrite=l},{"../lib/mode-to-string.js":"bbWaj","../lib/parse-mtime.js":"aLNRF","../lib/configure.js":"hR8g6","ipfs-core-utils/multipart-request":"7TICD","../lib/to-url-search-params.js":"fT4zz","../lib/abort-signal.js":"hzxSr","native-abort-controller":"6zwoZ"}],d23S0:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./export.js"),n=e("./gen.js"),s=e("./import.js"),o=e("./info.js"),a=e("./list.js"),c=e("./rename.js"),u=e("./rm.js");r.createKey=function(e){return{export:i.createExport(e),gen:n.createGen(e),import:s.createImport(e),info:o.createInfo(e),list:a.createList(e),rename:c.createRename(e),rm:u.createRm(e)}}},{"./export.js":"kC3hv","./gen.js":"ezvwT","./import.js":"liRPy","./info.js":"4TCmX","./list.js":"91GPg","./rename.js":"etz52","./rm.js":"lHlAl"}],kC3hv:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e("err-code"));const o=i.configure((e=>async(e,t,r={})=>{throw s.default(new Error("Not implemented"),"ERR_NOT_IMPLEMENTED")}));r.createExport=o},{"../lib/configure.js":"hR8g6","err-code":"chZjB"}],ezvwT:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/object-to-camel.js"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r={type:"rsa",size:2048}){const n=await e.post("key/gen",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:t,...r}),headers:r.headers}),o=await n.json();return i.objectToCamel(o)}));r.createGen=o},{"../lib/object-to-camel.js":"hdPx4","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],liRPy:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/object-to-camel.js"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r,n,o={}){const a=await e.post("key/import",{signal:o.signal,searchParams:s.toUrlSearchParams({arg:t,pem:r,password:n,...o}),headers:o.headers}),c=await a.json();return i.objectToCamel(c)}));r.createImport=o},{"../lib/object-to-camel.js":"hdPx4","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"4TCmX":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e("err-code"));const o=i.configure((e=>async(e,t={})=>{throw s.default(new Error("Not implemented"),"ERR_NOT_IMPLEMENTED")}));r.createInfo=o},{"../lib/configure.js":"hR8g6","err-code":"chZjB"}],"91GPg":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/object-to-camel.js"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t={}){const r=await e.post("key/list",{signal:t.signal,searchParams:s.toUrlSearchParams(t),headers:t.headers});return((await r.json()).Keys||[]).map((e=>i.objectToCamel(e)))}));r.createList=o},{"../lib/object-to-camel.js":"hdPx4","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],etz52:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/object-to-camel.js"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r,n={}){const o=await e.post("key/rename",{signal:n.signal,searchParams:s.toUrlSearchParams({arg:[t,r],...n}),headers:n.headers});return i.objectToCamel(await o.json())}));r.createRename=o},{"../lib/object-to-camel.js":"hdPx4","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],lHlAl:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/object-to-camel.js"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r={}){const n=await e.post("key/rm",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:t,...r}),headers:r.headers}),o=await n.json();return i.objectToCamel(o.Keys[0])}));r.createRm=o},{"../lib/object-to-camel.js":"hdPx4","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],dax7W:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./level.js"),n=e("./ls.js"),s=e("./tail.js");r.createLog=function(e){return{level:i.createLevel(e),ls:n.createLs(e),tail:s.createTail(e)}}},{"./level.js":"1Z9n5","./ls.js":"7ctbp","./tail.js":"3faFf"}],"1Z9n5":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/object-to-camel.js"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r,n={}){const o=await e.post("log/level",{signal:n.signal,searchParams:s.toUrlSearchParams({arg:[t,r],...n}),headers:n.headers});return i.objectToCamel(await o.json())}));r.createLevel=o},{"../lib/object-to-camel.js":"hdPx4","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"7ctbp":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t={}){const r=await e.post("log/ls",{signal:t.signal,searchParams:n.toUrlSearchParams(t),headers:t.headers});return(await r.json()).Strings}));r.createLs=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"3faFf":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function*(t={}){const r=await e.post("log/tail",{signal:t.signal,searchParams:n.toUrlSearchParams(t),headers:t.headers});yield*r.ndjson()}));r.createTail=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],hAUWJ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./publish.js"),n=e("./resolve.js"),s=e("./pubsub/index.js");r.createName=function(e){return{publish:i.createPublish(e),resolve:n.createResolve(e),pubsub:s.createPubsub(e)}}},{"./publish.js":"kB8Vy","./resolve.js":"jDw6l","./pubsub/index.js":"1TMtb"}],kB8Vy:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/object-to-camel.js"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r={}){const n=await e.post("name/publish",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:`${t}`,...r}),headers:r.headers});return i.objectToCamel(await n.json())}));r.createPublish=o},{"../lib/object-to-camel.js":"hdPx4","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],jDw6l:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function*(t,r={}){const i=await e.post("name/resolve",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,stream:!0,...r}),headers:r.headers});for await(const e of i.ndjson())yield e.Path}));r.createResolve=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"1TMtb":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./cancel.js"),n=e("./state.js"),s=e("./subs.js");r.createPubsub=function(e){return{cancel:i.createCancel(e),state:n.createState(e),subs:s.createSubs(e)}}},{"./cancel.js":"0ogCj","./state.js":"9oBIl","./subs.js":"eKxDJ"}],"0ogCj":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../lib/object-to-camel.js"),n=e("../../lib/configure.js"),s=e("../../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r={}){const n=await e.post("name/pubsub/cancel",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:t,...r}),headers:r.headers});return i.objectToCamel(await n.json())}));r.createCancel=o},{"../../lib/object-to-camel.js":"hdPx4","../../lib/configure.js":"hR8g6","../../lib/to-url-search-params.js":"fT4zz"}],"9oBIl":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../lib/object-to-camel.js"),n=e("../../lib/configure.js"),s=e("../../lib/to-url-search-params.js");const o=n.configure((e=>async function(t={}){const r=await e.post("name/pubsub/state",{signal:t.signal,searchParams:s.toUrlSearchParams(t),headers:t.headers});return i.objectToCamel(await r.json())}));r.createState=o},{"../../lib/object-to-camel.js":"hdPx4","../../lib/configure.js":"hR8g6","../../lib/to-url-search-params.js":"fT4zz"}],eKxDJ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../lib/configure.js"),n=e("../../lib/to-url-search-params.js");const s=i.configure((e=>async function(t={}){const r=await e.post("name/pubsub/subs",{signal:t.signal,searchParams:n.toUrlSearchParams(t),headers:t.headers});return(await r.json()).Strings||[]}));r.createSubs=s},{"../../lib/configure.js":"hR8g6","../../lib/to-url-search-params.js":"fT4zz"}],lIWb3:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./data.js"),n=e("./get.js"),s=e("./links.js"),o=e("./new.js"),a=e("./put.js"),c=e("./stat.js"),u=e("./patch/index.js");r.createObject=function(e,t){return{data:i.createData(t),get:n.createGet(t),links:s.createLinks(t),new:o.createNew(t),put:a.createPut(e,t),stat:c.createStat(t),patch:u.createPatch(t)}}},{"./data.js":"ef4Az","./get.js":"2uTHZ","./links.js":"10Mon","./new.js":"4VILN","./put.js":"3vtk9","./stat.js":"4TYop","./patch/index.js":"kOUgR"}],ef4Az:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r={}){const n=await e.post("object/data",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:`${t instanceof Uint8Array?i.CID.decode(t):t}`,...r}),headers:r.headers}),o=await n.arrayBuffer();return new Uint8Array(o,0,o.byteLength)}));r.createData=o},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"2uTHZ":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js"),o=e("uint8arrays/from-string");const a=n.configure((e=>async function(t,r={}){const n=await e.post("object/get",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:`${t instanceof Uint8Array?i.CID.decode(t):t}`,dataEncoding:"base64",...r}),headers:r.headers}),a=await n.json();return{Data:o.fromString(a.Data,"base64pad"),Links:(a.Links||[]).map((e=>({Name:e.Name,Hash:i.CID.parse(e.Hash),Tsize:e.Size})))}}));r.createGet=a},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz","uint8arrays/from-string":"dF7Y4"}],"10Mon":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r={}){const n=await e.post("object/links",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:`${t instanceof Uint8Array?i.CID.decode(t):t}`,...r}),headers:r.headers});return((await n.json()).Links||[]).map((e=>({Name:e.Name,Tsize:e.Size,Hash:i.CID.parse(e.Hash)})))}));r.createLinks=o},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"4VILN":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t={}){const r=await e.post("object/new",{signal:t.signal,searchParams:s.toUrlSearchParams({arg:t.template,...t}),headers:t.headers}),{Hash:n}=await r.json();return i.CID.parse(n)}));r.createNew=o},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"3vtk9":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../dag/put.js");r.createPut=(e,t)=>i.configure((r=>{const i=n.createPut(e,t);return async function(e,t={}){return i(e,{...t,format:"dag-pb",hashAlg:"sha2-256",version:0})}}))(t)},{"../lib/configure.js":"hR8g6","../dag/put.js":"e3DVQ"}],"4TYop":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r={}){const n=await e.post("object/stat",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:`${t}`,...r}),headers:r.headers}),o=await n.json();return{...o,Hash:i.CID.parse(o.Hash)}}));r.createStat=o},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],kOUgR:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./add-link.js"),n=e("./append-data.js"),s=e("./rm-link.js"),o=e("./set-data.js");r.createPatch=function(e){return{addLink:i.createAddLink(e),appendData:n.createAppendData(e),rmLink:s.createRmLink(e),setData:o.createSetData(e)}}},{"./add-link.js":"9EUqN","./append-data.js":"2uXuE","./rm-link.js":"6Y2ZK","./set-data.js":"SCMuD"}],"9EUqN":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../../lib/configure.js"),s=e("../../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r,n={}){const o=await e.post("object/patch/add-link",{signal:n.signal,searchParams:s.toUrlSearchParams({arg:[`${t}`,r.Name||r.name||"",(r.Hash||r.cid||"").toString()||null],...n}),headers:n.headers}),{Hash:a}=await o.json();return i.CID.parse(a)}));r.createAddLink=o},{"multiformats/cid":"9ooAY","../../lib/configure.js":"hR8g6","../../lib/to-url-search-params.js":"fT4zz"}],"2uXuE":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("ipfs-core-utils/multipart-request"),s=e("../../lib/configure.js"),o=e("../../lib/to-url-search-params.js"),a=e("../../lib/abort-signal.js"),c=e("native-abort-controller");const u=s.configure((e=>async function(t,r,s={}){const u=new c.AbortController,l=a.abortSignal(u.signal,s.signal),d=await e.post("object/patch/append-data",{signal:l,searchParams:o.toUrlSearchParams({arg:`${t}`,...s}),...await n.multipartRequest(r,u,s.headers)}),{Hash:f}=await d.json();return i.CID.parse(f)}));r.createAppendData=u},{"multiformats/cid":"9ooAY","ipfs-core-utils/multipart-request":"7TICD","../../lib/configure.js":"hR8g6","../../lib/to-url-search-params.js":"fT4zz","../../lib/abort-signal.js":"hzxSr","native-abort-controller":"6zwoZ"}],"6Y2ZK":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../../lib/configure.js"),s=e("../../lib/to-url-search-params.js");const o=n.configure((e=>async function(t,r,n={}){const o=await e.post("object/patch/rm-link",{signal:n.signal,searchParams:s.toUrlSearchParams({arg:[`${t}`,r.Name||r.name||null],...n}),headers:n.headers}),{Hash:a}=await o.json();return i.CID.parse(a)}));r.createRmLink=o},{"multiformats/cid":"9ooAY","../../lib/configure.js":"hR8g6","../../lib/to-url-search-params.js":"fT4zz"}],SCMuD:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("ipfs-core-utils/multipart-request"),s=e("../../lib/configure.js"),o=e("../../lib/to-url-search-params.js"),a=e("../../lib/abort-signal.js"),c=e("native-abort-controller");const u=s.configure((e=>async function(t,r,s={}){const u=new c.AbortController,l=a.abortSignal(u.signal,s.signal),d=await e.post("object/patch/set-data",{signal:l,searchParams:o.toUrlSearchParams({arg:[`${t}`],...s}),...await n.multipartRequest(r,u,s.headers)}),{Hash:f}=await d.json();return i.CID.parse(f)}));r.createSetData=u},{"multiformats/cid":"9ooAY","ipfs-core-utils/multipart-request":"7TICD","../../lib/configure.js":"hR8g6","../../lib/to-url-search-params.js":"fT4zz","../../lib/abort-signal.js":"hzxSr","native-abort-controller":"6zwoZ"}],"2EyML":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./add-all.js"),n=e("./add.js"),s=e("./ls.js"),o=e("./rm-all.js"),a=e("./rm.js"),c=e("./remote/index.js");r.createPin=function(e){return{addAll:i.createAddAll(e),add:n.createAdd(e),ls:s.createLs(e),rmAll:o.createRmAll(e),rm:a.createRm(e),remote:c.createRemote(e)}}},{"./add-all.js":"6SsJV","./add.js":"gNAmm","./ls.js":"4xLZT","./rm-all.js":"1RTay","./rm.js":"iRwZg","./remote/index.js":"5Qqlr"}],"6SsJV":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("ipfs-core-utils/pins/normalise-input"),o=e("../lib/to-url-search-params.js");const a=n.configure((e=>async function*(t,r={}){for await(const{path:n,recursive:a,metadata:c}of s.normaliseInput(t)){const t=await e.post("pin/add",{signal:r.signal,searchParams:o.toUrlSearchParams({...r,arg:n,recursive:a,metadata:c?JSON.stringify(c):void 0,stream:!0}),headers:r.headers});for await(const e of t.ndjson())if(e.Pins)for(const t of e.Pins)yield i.CID.parse(t);else yield i.CID.parse(e)}}));r.createAddAll=a},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","ipfs-core-utils/pins/normalise-input":"4NDJq","../lib/to-url-search-params.js":"fT4zz"}],gNAmm:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./add-all.js"),n=e("it-last"),s=e("../lib/configure.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(n);r.createAdd=function(e){const t=i.createAddAll(e);return s.configure((()=>async function(e,r={}){return a.default(t([{path:e,...r}],r))}))(e)}},{"./add-all.js":"6SsJV","it-last":"cSXX9","../lib/configure.js":"hR8g6"}],"4xLZT":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");function o(e,t,r){const n={type:e,cid:i.CID.parse(t)};return r&&(n.metadata=r),n}const a=n.configure((e=>async function*(t={}){let r=[];t.paths&&(r=Array.isArray(t.paths)?t.paths:[t.paths]);const i=await e.post("pin/ls",{signal:t.signal,searchParams:s.toUrlSearchParams({...t,arg:r.map((e=>`${e}`)),stream:!0}),headers:t.headers});for await(const e of i.ndjson()){if(e.Keys){for(const t of Object.keys(e.Keys))yield o(e.Keys[t].Type,t,e.Keys[t].Metadata);return}yield o(e.Type,e.Cid,e.Metadata)}}));r.createLs=a},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"1RTay":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("ipfs-core-utils/pins/normalise-input"),o=e("../lib/to-url-search-params.js");const a=n.configure((e=>async function*(t,r={}){for await(const{path:n,recursive:a}of s.normaliseInput(t)){const t=new URLSearchParams(r.searchParams);t.append("arg",`${n}`),null!=a&&t.set("recursive",String(a));const s=await e.post("pin/rm",{signal:r.signal,headers:r.headers,searchParams:o.toUrlSearchParams({...r,arg:`${n}`,recursive:a})});for await(const e of s.ndjson())e.Pins?yield*e.Pins.map((e=>i.CID.parse(e))):yield i.CID.parse(e)}}));r.createRmAll=a},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","ipfs-core-utils/pins/normalise-input":"4NDJq","../lib/to-url-search-params.js":"fT4zz"}],iRwZg:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./rm-all.js"),n=e("it-last"),s=e("../lib/configure.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(n);r.createRm=e=>{const t=i.createRmAll(e);return s.configure((()=>async function(e,r={}){return a.default(t([{path:e,...r}],r))}))(e)}},{"./rm-all.js":"1RTay","it-last":"cSXX9","../lib/configure.js":"hR8g6"}],"5Qqlr":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../lib/core.js"),n=e("./add.js"),s=e("./ls.js"),o=e("./rm.js"),a=e("./rm-all.js"),c=e("./service/index.js");r.createRemote=function(e){const t=new i.Client(e);return{add:n.createAdd(t),ls:s.createLs(t),rm:o.createRm(t),rmAll:a.createRmAll(t),service:c.createService(e)}}},{"../../lib/core.js":"3XXp5","./add.js":"6QlyE","./ls.js":"jHl8Y","./rm.js":"1hrlp","./rm-all.js":"fIlTt","./service/index.js":"78IT1"}],"6QlyE":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils.js");r.createAdd=function(e){return async function(t,{timeout:r,signal:n,headers:s,...o}){const a=await e.post("pin/remote/add",{timeout:r,signal:n,headers:s,searchParams:i.encodeAddParams({cid:t,...o})});return i.decodePin(await a.json())}}},{"./utils.js":"bQgDT"}],bQgDT:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../../lib/to-url-search-params.js");const s=e=>{if("string"==typeof e&&""!==e)return e;throw new TypeError("service name must be passed")},o=e=>{if(i.CID.asCID(e))return e.toString();throw new TypeError("CID instance expected instead of "+typeof e)};r.decodePin=({Name:e,Status:t,Cid:r})=>({cid:i.CID.parse(r),name:e,status:t}),r.encodeAddParams=({cid:e,service:t,background:r,name:i,origins:a})=>{const c=n.toUrlSearchParams({arg:o(e),service:s(t),name:i,background:!!r||void 0});if(a)for(const e of a)c.append("origin",e.toString());return c},r.encodeCID=o,r.encodeQuery=({service:e,cid:t,name:r,status:i,all:a})=>{const c=n.toUrlSearchParams({service:s(e),name:r,force:!!a||void 0});if(t)for(const e of t)c.append("cid",o(e));if(i)for(const e of i)c.append("status",e);return c},r.encodeService=s},{"multiformats/cid":"9ooAY","../../lib/to-url-search-params.js":"fT4zz"}],jHl8Y:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils.js");r.createLs=function(e){return async function*({timeout:t,signal:r,headers:n,...s}){const o=await e.post("pin/remote/ls",{timeout:t,signal:r,headers:n,searchParams:i.encodeQuery(s)});for await(const e of o.ndjson())yield i.decodePin(e)}}},{"./utils.js":"bQgDT"}],"1hrlp":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils.js");r.createRm=function(e){return async function({timeout:t,signal:r,headers:n,...s}){await e.post("pin/remote/rm",{timeout:t,signal:r,headers:n,searchParams:i.encodeQuery({...s,all:!1})})}}},{"./utils.js":"bQgDT"}],fIlTt:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./utils.js");r.createRmAll=function(e){return async function({timeout:t,signal:r,headers:n,...s}){await e.post("pin/remote/rm",{timeout:t,signal:r,headers:n,searchParams:i.encodeQuery({...s,all:!0})})}}},{"./utils.js":"bQgDT"}],"78IT1":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../../lib/core.js"),n=e("./add.js"),s=e("./ls.js"),o=e("./rm.js");r.createService=function(e){const t=new i.Client(e);return{add:n.createAdd(t),ls:s.createLs(t),rm:o.createRm(t)}}},{"../../../lib/core.js":"3XXp5","./add.js":"jw6p7","./ls.js":"d55dc","./rm.js":"5AjIT"}],jw6p7:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../../lib/to-url-search-params.js"),n=e("./utils.js");r.createAdd=function(e){return async function(t,r){const{endpoint:s,key:o,headers:a,timeout:c,signal:u}=r;await e.post("pin/remote/service/add",{timeout:c,signal:u,searchParams:i.toUrlSearchParams({arg:[t,n.encodeEndpoint(s),o]}),headers:a})}}},{"../../../lib/to-url-search-params.js":"fT4zz","./utils.js":"6pYda"}],"6pYda":[function(e,t,r){"use strict";function i(e){switch(e.Status){case"valid":{const{Pinning:t,Pinned:r,Queued:i,Failed:n}=e.PinCount;return{status:"valid",pinCount:{queued:i,pinning:t,pinned:r,failed:n}}}case"invalid":return{status:"invalid"};default:return{status:e.Status}}}Object.defineProperty(r,"__esModule",{value:!0}),r.decodeRemoteService=function(e){return{service:e.Service,endpoint:new URL(e.ApiEndpoint),...e.Stat&&{stat:i(e.Stat)}}},r.decodeStat=i,r.encodeEndpoint=function(e){const t=String(e);if("undefined"===t)throw Error("endpoint is required");return"/"===t[t.length-1]?t.slice(0,-1):t}},{}],d55dc:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../../lib/to-url-search-params.js"),n=e("./utils.js");r.createLs=function(e){return async function(t={}){const{stat:r,headers:s,timeout:o,signal:a}=t,c=await e.post("pin/remote/service/ls",{timeout:o,signal:a,headers:s,searchParams:!0===r?i.toUrlSearchParams({stat:r}):void 0}),{RemoteServices:u}=await c.json();return u.map(n.decodeRemoteService)}}},{"../../../lib/to-url-search-params.js":"fT4zz","./utils.js":"6pYda"}],"5AjIT":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../../lib/to-url-search-params.js");r.createRm=function(e){return async function(t,r={}){await e.post("pin/remote/service/rm",{signal:r.signal,headers:r.headers,searchParams:i.toUrlSearchParams({arg:t})})}}},{"../../../lib/to-url-search-params.js":"fT4zz"}],"9yoEA":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./ls.js"),n=e("./peers.js"),s=e("./publish.js"),o=e("./subscribe.js"),a=e("./unsubscribe.js"),c=e("./subscription-tracker.js");r.createPubsub=function(e){const t=new c.SubscriptionTracker;return{ls:i.createLs(e),peers:n.createPeers(e),publish:s.createPublish(e),subscribe:o.createSubscribe(e,t),unsubscribe:a.createUnsubscribe(e,t)}}},{"./ls.js":"2yozO","./peers.js":"5ZIFR","./publish.js":"3DcXt","./subscribe.js":"02Av6","./unsubscribe.js":"97bmo","./subscription-tracker.js":"eg0Db"}],"2yozO":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t={}){const{Strings:r}=await(await e.post("pubsub/ls",{signal:t.signal,searchParams:n.toUrlSearchParams(t),headers:t.headers})).json();return r||[]}));r.createLs=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"5ZIFR":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t,r={}){const i=await e.post("pubsub/peers",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,...r}),headers:r.headers}),{Strings:s}=await i.json();return s||[]}));r.createPeers=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"3DcXt":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js"),s=e("ipfs-core-utils/multipart-request"),o=e("../lib/abort-signal.js"),a=e("native-abort-controller");const c=i.configure((e=>async function(t,r,i={}){const c=n.toUrlSearchParams({arg:t,...i}),u=new a.AbortController,l=o.abortSignal(u.signal,i.signal),d=await e.post("pubsub/pub",{signal:l,searchParams:c,...await s.multipartRequest(r,u,i.headers)});await d.text()}));r.createPublish=c},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz","ipfs-core-utils/multipart-request":"7TICD","../lib/abort-signal.js":"hzxSr","native-abort-controller":"6zwoZ"}],"02Av6":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("uint8arrays/from-string"),n=e("uint8arrays/to-string"),s=e("debug"),o=e("../lib/configure.js"),a=e("../lib/to-url-search-params.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const u=c(s).default("ipfs-http-client:pubsub:subscribe");const l=e=>{switch(e.type){case"aborted":case"abort":return!0;default:return"AbortError"===e.name}};r.createSubscribe=(e,t)=>o.configure((e=>async function(r,s,o={}){let c,d;o.signal=t.subscribe(r,s,o.signal);const f=new Promise(((e,t)=>{c=e,d=t})),h=setTimeout((()=>c()),1e3);return e.post("pubsub/sub",{signal:o.signal,searchParams:a.toUrlSearchParams({arg:r,...o}),headers:o.headers}).catch((e=>{t.unsubscribe(r,s),d(e)})).then((e=>{clearTimeout(h),e&&(!async function(e,{onMessage:t,onEnd:r,onError:s}){s=s||u;try{for await(const r of e.ndjson())try{if(!r.from)continue;t({from:n.toString(i.fromString(r.from,"base64pad"),"base58btc"),data:i.fromString(r.data,"base64pad"),seqno:i.fromString(r.seqno,"base64pad"),topicIDs:r.topicIDs})}catch(e){e.message=`Failed to parse pubsub message: ${e.message}`,s(e,!1,r)}}catch(e){l(e)||s(e,!0)}finally{r()}}(e,{onMessage:s,onEnd:()=>t.unsubscribe(r,s),onError:o.onError}),c())})),f}))(e)},{"uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB",debug:"bO5wM","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"97bmo":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.createUnsubscribe=(e,t)=>async function(e,r){t.unsubscribe(e,r)}},{}],eg0Db:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("native-abort-controller");r.SubscriptionTracker=class{constructor(){this._subs=new Map}subscribe(e,t,r){const n=this._subs.get(e)||[];if(n.find((e=>e.handler===t)))throw new Error(`Already subscribed to ${e} with this handler`);const s=new i.AbortController;return this._subs.set(e,[{handler:t,controller:s}].concat(n)),r&&r.addEventListener("abort",(()=>this.unsubscribe(e,t))),s.signal}unsubscribe(e,t){const r=this._subs.get(e)||[];let i;t?(this._subs.set(e,r.filter((e=>e.handler!==t))),i=r.filter((e=>e.handler===t))):(this._subs.set(e,[]),i=r),(this._subs.get(e)||[]).length||this._subs.delete(e),i.forEach((e=>e.controller.abort()))}}},{"native-abort-controller":"6zwoZ"}],"6sM7A":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/object-to-camel.js"),s=e("../lib/configure.js"),o=e("../lib/to-url-search-params.js"),a=e("./local.js");const c=s.configure(((e,t)=>Object.assign((async function*(t,r={}){const s=Array.isArray(t)?t:[t],a=await e.post("refs",{signal:r.signal,searchParams:o.toUrlSearchParams({arg:s.map((e=>`${e instanceof Uint8Array?i.CID.decode(e):e}`)),...r}),headers:r.headers,transform:n.objectToCamel});yield*a.ndjson()}),{local:a.createLocal(t)})));r.createRefs=c},{"multiformats/cid":"9ooAY","../lib/object-to-camel.js":"hdPx4","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz","./local.js":"hVVLK"}],hVVLK:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/object-to-camel.js"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function*(t={}){const r=await e.post("refs/local",{signal:t.signal,transform:i.objectToCamel,searchParams:s.toUrlSearchParams(t),headers:t.headers});yield*r.ndjson()}));r.createLocal=o},{"../lib/object-to-camel.js":"hdPx4","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],lf1uS:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./gc.js"),n=e("./stat.js"),s=e("./version.js");r.createRepo=function(e){return{gc:i.createGc(e),stat:n.createStat(e),version:s.createVersion(e)}}},{"./gc.js":"5kVJA","./stat.js":"kW3mJ","./version.js":"bU0xW"}],"5kVJA":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function*(t={}){const r=await e.post("repo/gc",{signal:t.signal,searchParams:s.toUrlSearchParams(t),headers:t.headers,transform:e=>({err:e.Error?new Error(e.Error):null,cid:(e.Key||{})["/"]?i.CID.parse(e.Key["/"]):null})});yield*r.ndjson()}));r.createGc=o},{"multiformats/cid":"9ooAY","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],kW3mJ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t={}){const r=await e.post("repo/stat",{signal:t.signal,searchParams:n.toUrlSearchParams(t),headers:t.headers}),i=await r.json();return{numObjects:BigInt(i.NumObjects),repoSize:BigInt(i.RepoSize),repoPath:i.RepoPath,version:i.Version,storageMax:BigInt(i.StorageMax)}}));r.createStat=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],bU0xW:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t={}){return(await(await e.post("repo/version",{signal:t.signal,searchParams:n.toUrlSearchParams(t),headers:t.headers})).json()).Version}));r.createVersion=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"8ekdG":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../bitswap/stat.js"),n=e("../repo/stat.js"),s=e("./bw.js");r.createStats=function(e){return{bitswap:i.createStat(e),repo:n.createStat(e),bw:s.createBw(e)}}},{"../bitswap/stat.js":"3Q0KE","../repo/stat.js":"kW3mJ","./bw.js":"cvdwA"}],cvdwA:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function*(t={}){const r=await e.post("stats/bw",{signal:t.signal,searchParams:n.toUrlSearchParams(t),headers:t.headers,transform:e=>({totalIn:BigInt(e.TotalIn),totalOut:BigInt(e.TotalOut),rateIn:parseFloat(e.RateIn),rateOut:parseFloat(e.RateOut)})});yield*r.ndjson()}));r.createBw=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"9n7fV":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./addrs.js"),n=e("./connect.js"),s=e("./disconnect.js"),o=e("./local-addrs.js"),a=e("./peers.js");r.createSwarm=function(e){return{addrs:i.createAddrs(e),connect:n.createConnect(e),disconnect:s.createDisconnect(e),localAddrs:o.createLocalAddrs(e),peers:a.createPeers(e)}}},{"./addrs.js":"fxhEW","./connect.js":"cuaL2","./disconnect.js":"820vp","./local-addrs.js":"dEgBz","./peers.js":"jZx0P"}],fxhEW:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiaddr"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t={}){const r=await e.post("swarm/addrs",{signal:t.signal,searchParams:s.toUrlSearchParams(t),headers:t.headers}),{Addrs:n}=await r.json();return Object.keys(n).map((e=>({id:e,addrs:(n[e]||[]).map((e=>new i.Multiaddr(e)))})))}));r.createAddrs=o},{multiaddr:"8Mu1u","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],cuaL2:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t,r={}){const i=await e.post("swarm/connect",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,...r}),headers:r.headers}),{Strings:s}=await i.json();return s||[]}));r.createConnect=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],"820vp":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../lib/configure.js"),n=e("../lib/to-url-search-params.js");const s=i.configure((e=>async function(t,r={}){const i=await e.post("swarm/disconnect",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,...r}),headers:r.headers}),{Strings:s}=await i.json();return s||[]}));r.createDisconnect=s},{"../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],dEgBz:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiaddr"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t={}){const r=await e.post("swarm/addrs/local",{signal:t.signal,searchParams:s.toUrlSearchParams(t),headers:t.headers}),{Strings:n}=await r.json();return(n||[]).map((e=>new i.Multiaddr(e)))}));r.createLocalAddrs=o},{multiaddr:"8Mu1u","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],jZx0P:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiaddr"),n=e("../lib/configure.js"),s=e("../lib/to-url-search-params.js");const o=n.configure((e=>async function(t={}){const r=await e.post("swarm/peers",{signal:t.signal,searchParams:s.toUrlSearchParams(t),headers:t.headers}),{Peers:n}=await r.json();return(n||[]).map((e=>({addr:new i.Multiaddr(e.Addr),peer:e.Peer,muxer:e.Muxer,latency:e.Latency,streams:e.Streams,direction:null==e.Direction?void 0:0===e.Direction?"inbound":"outbound"})))}));r.createPeers=o},{multiaddr:"8Mu1u","../lib/configure.js":"hR8g6","../lib/to-url-search-params.js":"fT4zz"}],bh9eV:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./add-all.js"),n=e("it-last"),s=e("./lib/configure.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(n);r.createAdd=function(e){const t=i.createAddAll(e);return s.configure((()=>async function(e,r={}){return await a.default(t(e,r))}))(e)}},{"./add-all.js":"dygjF","it-last":"cSXX9","./lib/configure.js":"hR8g6"}],dygjF:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("./lib/object-to-camel.js"),s=e("./lib/configure.js"),o=e("ipfs-core-utils/multipart-request"),a=e("./lib/to-url-search-params.js"),c=e("./lib/abort-signal.js"),u=e("native-abort-controller");const l=s.configure((e=>async function*(t,r={}){const i=new u.AbortController,s=c.abortSignal(i.signal,r.signal),{headers:l,body:f,total:p,parts:g}=await o.multipartRequest(t,i,r.headers),[y,m]="function"==typeof r.progress?d(p,g,r.progress):[void 0,void 0],b=await e.post("add",{searchParams:a.toUrlSearchParams({"stream-channels":!0,...r,progress:Boolean(y)}),onUploadProgress:m,signal:s,headers:l,body:f});for await(let e of b.ndjson())e=n.objectToCamel(e),void 0!==e.hash?yield h(e):y&&y(e.bytes||0,e.name)})),d=(e,t,r)=>t?[void 0,f(e,t,r)]:[r,void 0],f=(e,t,r)=>{let i=0;const n=t.length;return({loaded:s,total:o})=>{const a=Math.floor(s/o*e);for(;i<n;){const{start:e,end:n,name:s}=t[i];if(a<n){r(a-e,s);break}r(n-e,s),i+=1}}};function h({name:e,hash:t,size:r,mode:n,mtime:s,mtimeNsecs:o}){const a={path:e,cid:i.CID.parse(t),size:parseInt(r)};return null!=n&&(a.mode=parseInt(n,8)),null!=s&&(a.mtime={secs:s,nsecs:o||0}),a}r.createAddAll=l},{"multiformats/cid":"9ooAY","./lib/object-to-camel.js":"hdPx4","./lib/configure.js":"hR8g6","ipfs-core-utils/multipart-request":"7TICD","./lib/to-url-search-params.js":"fT4zz","./lib/abort-signal.js":"hzxSr","native-abort-controller":"6zwoZ"}],"37ULc":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./lib/configure.js"),n=e("./lib/to-url-search-params.js");const s=i.configure((e=>async function*(t,r={}){const i=await e.post("cat",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t.toString(),...r}),headers:r.headers});yield*i.iterator()}));r.createCat=s},{"./lib/configure.js":"hR8g6","./lib/to-url-search-params.js":"fT4zz"}],d7oos:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./lib/configure.js"),n=e("./lib/to-url-search-params.js");const s=i.configure((e=>async(t={})=>(await e.post("commands",{signal:t.signal,searchParams:n.toUrlSearchParams(t),headers:t.headers})).json()));r.createCommands=s},{"./lib/configure.js":"hR8g6","./lib/to-url-search-params.js":"fT4zz"}],"6WsTM":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./lib/configure.js"),n=e("./lib/to-url-search-params.js");const s=i.configure((e=>async(t,r={})=>{const i=await e.post("dns",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,...r}),headers:r.headers});return(await i.json()).Path}));r.createDns=s},{"./lib/configure.js":"hR8g6","./lib/to-url-search-params.js":"fT4zz"}],e09lW:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=e("./lib/configure.js").configure((e=>()=>{const t=new URL(e.opts.base||"");return{host:t.hostname,port:t.port,protocol:t.protocol,pathname:t.pathname,"api-path":t.pathname}}));r.createGetEndpointConfig=i},{"./lib/configure.js":"hR8g6"}],"9dl4d":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("./lib/configure.js"),s=e("./lib/to-url-search-params.js");const o=n.configure((e=>async function*(t,r={}){const n={arg:`${t instanceof Uint8Array?i.CID.decode(t):t}`,...r};n.compressionLevel&&(n["compression-level"]=n.compressionLevel,delete n.compressionLevel);const o=await e.post("get",{signal:r.signal,searchParams:s.toUrlSearchParams(n),headers:r.headers});yield*o.iterator()}));r.createGet=o},{"multiformats/cid":"9ooAY","./lib/configure.js":"hR8g6","./lib/to-url-search-params.js":"fT4zz"}],iMd7i:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./lib/object-to-camel.js"),n=e("multiaddr"),s=e("./lib/configure.js"),o=e("./lib/to-url-search-params.js");const a=s.configure((e=>async function(t={}){const r=await e.post("id",{signal:t.signal,searchParams:o.toUrlSearchParams({arg:t.peerId?t.peerId.toString():void 0,...t}),headers:t.headers}),s=await r.json(),a={...i.objectToCamel(s)};return a.addresses&&(a.addresses=a.addresses.map((e=>new n.Multiaddr(e)))),a}));r.createId=a},{"./lib/object-to-camel.js":"hdPx4",multiaddr:"8Mu1u","./lib/configure.js":"hR8g6","./lib/to-url-search-params.js":"fT4zz"}],"1Ujko":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./id.js");r.createIsOnline=e=>{const t=i.createId(e);return async function(e={}){const r=await t(e);return Boolean(r&&r.addresses&&r.addresses.length)}}},{"./id.js":"iMd7i"}],jIkVK:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("./lib/configure.js"),s=e("./lib/to-url-search-params.js"),o=e("./files/stat.js");const a=n.configure(((e,t)=>async function*(r,n={}){const a=`${r instanceof Uint8Array?i.CID.decode(r):r}`;async function u(e){let r=e.Hash;if(r.includes("/")){const e=r.startsWith("/ipfs/")?r:`/ipfs/${r}`;r=(await o.createStat(t)(e)).cid}else r=i.CID.parse(r);const n={name:e.Name,path:a+(e.Name?`/${e.Name}`:""),size:e.Size,cid:r,type:c(e)};return e.Mode&&(n.mode=parseInt(e.Mode,8)),void 0!==e.Mtime&&null!==e.Mtime&&(n.mtime={secs:e.Mtime},void 0!==e.MtimeNsecs&&null!==e.MtimeNsecs&&(n.mtime.nsecs=e.MtimeNsecs)),n}const l=await e.post("ls",{signal:n.signal,searchParams:s.toUrlSearchParams({arg:a,...n}),headers:n.headers});for await(let e of l.ndjson()){if(e=e.Objects,!e)throw new Error("expected .Objects in results");if(e=e[0],!e)throw new Error("expected one array in results.Objects");const t=e.Links;if(!Array.isArray(t))throw new Error("expected one array in results.Objects[0].Links");if(!t.length)return void(yield u(e));yield*t.map(u)}}));function c(e){switch(e.Type){case 1:case 5:return"dir";default:return"file"}}r.createLs=a},{"multiformats/cid":"9ooAY","./lib/configure.js":"hR8g6","./lib/to-url-search-params.js":"fT4zz","./files/stat.js":"2InTg"}],"5Ghx1":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./lib/object-to-camel.js"),n=e("./lib/configure.js"),s=e("./lib/to-url-search-params.js");const o=n.configure((e=>async function(t={}){const r=await e.post("dns",{signal:t.signal,searchParams:s.toUrlSearchParams(t),headers:t.headers});return i.objectToCamel(await r.json())}));r.createMount=o},{"./lib/object-to-camel.js":"hdPx4","./lib/configure.js":"hR8g6","./lib/to-url-search-params.js":"fT4zz"}],fIZQw:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./lib/object-to-camel.js"),n=e("./lib/configure.js"),s=e("./lib/to-url-search-params.js");const o=n.configure((e=>async function*(t,r={}){const n=await e.post("ping",{signal:r.signal,searchParams:s.toUrlSearchParams({arg:`${t}`,...r}),headers:r.headers,transform:i.objectToCamel});yield*n.ndjson()}));r.createPing=o},{"./lib/object-to-camel.js":"hdPx4","./lib/configure.js":"hR8g6","./lib/to-url-search-params.js":"fT4zz"}],fqXrw:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./lib/configure.js"),n=e("./lib/to-url-search-params.js");const s=i.configure((e=>async function(t,r={}){const i=await e.post("resolve",{signal:r.signal,searchParams:n.toUrlSearchParams({arg:t,...r}),headers:r.headers}),{Path:s}=await i.json();return s}));r.createResolve=s},{"./lib/configure.js":"hR8g6","./lib/to-url-search-params.js":"fT4zz"}],"4YTOj":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./lib/configure.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e("err-code"));const o=i.configure((e=>async(e={})=>{throw s.default(new Error("Not implemented"),"ERR_NOT_IMPLEMENTED")}));r.createStart=o},{"./lib/configure.js":"hR8g6","err-code":"chZjB"}],j2dHM:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./lib/configure.js"),n=e("./lib/to-url-search-params.js");const s=i.configure((e=>async function(t={}){const r=await e.post("shutdown",{signal:t.signal,searchParams:n.toUrlSearchParams(t),headers:t.headers});await r.text()}));r.createStop=s},{"./lib/configure.js":"hR8g6","./lib/to-url-search-params.js":"fT4zz"}],k3Foi:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./lib/object-to-camel.js"),n=e("./lib/configure.js"),s=e("./lib/to-url-search-params.js");const o=n.configure((e=>async function(t={}){const r=await e.post("version",{signal:t.signal,searchParams:s.toUrlSearchParams(t),headers:t.headers});return{...i.objectToCamel(await r.json()),"ipfs-http-client":"1.0.0"}}));r.createVersion=o},{"./lib/object-to-camel.js":"hdPx4","./lib/configure.js":"hR8g6","./lib/to-url-search-params.js":"fT4zz"}],jQSIS:[function(e,t,r){"use strict";const i=e("../http");async function*n(e,t){const r=new i,n=await r.get(e,t);yield*n.iterator()}t.exports=(e,t)=>({path:decodeURIComponent(new URL(e).pathname.split("/").pop()||""),content:n(e,t)})},{"../http":"ifXXn"}],eStoI:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("libp2p-websockets"),n=e("libp2p-webrtc-star"),s=e("libp2p-mplex"),o=e("@chainsafe/libp2p-noise"),a=e("libp2p-kad-dht"),c=e("libp2p-gossipsub"),u=e("./utils/ipns.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=l(i),f=l(n),h=l(s),p=l(a),g=l(c);r.libp2pConfig=function(){return{dialer:{maxParallelDials:150,maxDialsPerPeer:4,dialTimeout:1e4},modules:{transport:[d.default,f.default],streamMuxer:[h.default],connEncryption:[o.NOISE],peerDiscovery:[],dht:p.default,pubsub:g.default},config:{peerDiscovery:{autoDial:!0,bootstrap:{enabled:!0},webRTCStar:{enabled:!0}},dht:{kBucketSize:20,enabled:!1,clientMode:!0,randomWalk:{enabled:!1},validators:{ipns:u.validator},selectors:{ipns:u.selector}},pubsub:{enabled:!0,emitSelf:!0},nat:{enabled:!1}},metrics:{enabled:!0},peerStore:{persistence:!0,threshold:1}}}},{"libp2p-websockets":"e2AFa","libp2p-webrtc-star":"jtxJ4","libp2p-mplex":"6n2fc","@chainsafe/libp2p-noise":"5JB8e","libp2p-kad-dht":"lEgzz","libp2p-gossipsub":"eSowE","./utils/ipns.js":"2X3ZY"}],e2AFa:[function(e,t,r){"use strict";const i=e("it-ws/client"),n=e("class-is"),s=e("multiaddr-to-uri"),{AbortError:o}=e("abortable-iterator"),a=e("p-defer"),c=e("debug"),u=c("libp2p:websockets");u.error=c("libp2p:websockets:error");const l=e("ipfs-utils/src/env"),d=e("./listener"),f=e("./socket-to-conn"),h=e("./filters");t.exports=n(class{constructor({upgrader:e,filter:t}){if(!e)throw new Error("An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.");this._upgrader=e,this._filter=t}async dial(e,t={}){u("dialing %s",e);const r=await this._connect(e,t),i=f(r,{remoteAddr:e,signal:t.signal});u("new outbound connection %s",i.remoteAddr);const n=await this._upgrader.upgradeOutbound(i);return u("outbound connection %s upgraded",i.remoteAddr),n}async _connect(e,t={}){if(t.signal&&t.signal.aborted)throw new o;const r=e.toOptions();u("dialing %s:%s",r.host,r.port);const n=a(),c=e=>{const t=`connection error: ${e.message}`;u.error(t),n.reject(e)},l=i(s(e),Object.assign({binary:!0},t));if(l.socket.on?l.socket.on("error",c):l.socket.onerror=c,!t.signal)return await Promise.race([l.connected(),n.promise]),u("connected %s",e),l;let d;const f=new Promise(((e,r)=>{if(d=()=>{r(new o),setTimeout((()=>{l.close()}))},t.signal.aborted)return d();t.signal.addEventListener("abort",d)}));try{await Promise.race([f,n.promise,l.connected()])}finally{t.signal.removeEventListener("abort",d)}return u("connected %s",e),l}createListener(e={},t){return"function"==typeof e&&(t=e,e={}),d({handler:t,upgrader:this._upgrader},e)}filter(e){return e=Array.isArray(e)?e:[e],this._filter?this._filter(e):l.isBrowser||l.isWebWorker?h.dnsWss(e):h.all(e)}},{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})},{"it-ws/client":"3ilsV","class-is":"gx31A","multiaddr-to-uri":"4PPH7","abortable-iterator":"awlU8","p-defer":"5rKSv",debug:"bO5wM","ipfs-utils/src/env":"flyHr","./listener":"8AR2t","./socket-to-conn":"9P0w8","./filters":"f6X4K"}],"3ilsV":[function(e,t,r){"use strict";var i=e("./web-socket"),n=e("./duplex"),s=e("./ws-url");t.exports=function(e,t={}){const r="undefined"==typeof window?{}:window.location,o=s(e,r),a=new i(o,t.websocket),c=n(a,t);return c.remoteAddress=o,c.close=()=>new Promise(((e,t)=>{a.addEventListener("close",e),a.close()})),c.destroy=()=>{a.terminate?a.terminate():a.close()},c.socket=a,c},t.exports.connect=t.exports},{"./web-socket":"S1OKn","./duplex":"l5069","./ws-url":"kgph9"}],S1OKn:[function(e,t,r){t.exports="undefined"==typeof WebSocket?e("ws"):WebSocket},{ws:"lHksA"}],l5069:[function(e,t,r){const i=e("./source"),n=e("./sink");t.exports=(e,t)=>{(t=t||{}).binaryType?e.binaryType=t.binaryType:t.binary&&(e.binaryType="arraybuffer");const r={sink:n(e,t),source:i(e,t),connected:()=>r.source.connected()};return r}},{"./source":"2FpyK","./sink":"6GqBJ"}],"2FpyK":[function(e,t,r){const{Buffer:i}=e("buffer"),{EventIterator:n}=e("event-iterator");t.exports=e=>{const t=e.removeEventListener||e.removeListener,r=async function*(){const r=new n((({push:r,stop:i,fail:n})=>(e.addEventListener("message",r),e.addEventListener("error",n),e.addEventListener("close",i),()=>{t.call(e,"message",r),t.call(e,"error",n),t.call(e,"close",i)})),{highWaterMark:1/0});for await(const{data:e}of r)yield(s=e,s instanceof ArrayBuffer||null!=s&&null!=s.constructor&&"ArrayBuffer"===s.constructor.name&&"number"==typeof s.byteLength?i.from(e):e);var s}();let s,o=1===e.readyState;return e.addEventListener("open",(()=>{o=!0,s=null})),e.addEventListener("close",(()=>{o=!1,s=null})),e.addEventListener("error",(e=>{o||(s=e)})),r.connected=()=>new Promise(((r,i)=>{if(o)return r();if(s)return i(s);const n=r=>{t.call(e,"open",a),t.call(e,"error",c),r()},a=()=>n(r),c=e=>n((()=>i(e)));e.addEventListener("open",a),e.addEventListener("error",c)})),r}},{buffer:"etowf","event-iterator":"atALZ"}],atALZ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=e("./event-iterator");r.EventIterator=i.EventIterator,r.subscribe=function(e,t,r){return new i.EventIterator((({push:r})=>(this.addEventListener(e,r,t),()=>this.removeEventListener(e,r,t))),r)},r.default=i.EventIterator},{"./event-iterator":"eQdTI"}],eQdTI:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});class i{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(e){if(this.isStopped)return;const t={value:e,done:!1};if(this.pullQueue.length){const e=this.pullQueue.shift();e&&e.resolve(t)}else this.pushQueue.push(Promise.resolve(t)),void 0!==this.highWaterMark&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn(`EventIterator queue reached ${this.pushQueue.length} items`))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const e of this.pullQueue)e.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(e){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const t of this.pullQueue)t.reject(e);this.pullQueue.length=0}else{const t=Promise.reject(e);t.catch((()=>{})),this.pushQueue.push(t)}}remove(){Promise.resolve().then((()=>{this.removeCallback&&this.removeCallback()}))}[Symbol.asyncIterator](){return{next:e=>{const t=this.pushQueue.shift();return t?(void 0!==this.lowWaterMark&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),t):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise(((e,t)=>{this.pullQueue.push({resolve:e,reject:t})}))},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}class n{constructor(e,{highWaterMark:t=100,lowWaterMark:r=1}={}){const n=new i;n.highWaterMark=t,n.lowWaterMark=r,n.removeCallback=e({push:e=>n.push(e),stop:()=>n.stop(),fail:e=>n.fail(e),on:(e,t)=>{n.eventHandlers[e]=t}})||(()=>{}),this[Symbol.asyncIterator]=()=>n[Symbol.asyncIterator](),Object.freeze(this)}}r.EventIterator=n,r.default=n},{}],"6GqBJ":[function(e,t,r){const i=e("./ready");t.exports=(e,t)=>((t=t||{}).closeOnEnd=!1!==t.closeOnEnd,async r=>{for await(const t of r){try{await i(e)}catch(e){if("socket closed"===e.message)break;throw e}e.send(t)}if(t.closeOnEnd&&e.readyState<=1)return new Promise(((t,r)=>{e.addEventListener("close",(e=>{if(e.wasClean||1006===e.code)t();else{const t=Object.assign(new Error("ws error"),{event:e});r(t)}})),setTimeout((()=>e.close()))}))})},{"./ready":"3cCUJ"}],"3cCUJ":[function(e,t,r){t.exports=async e=>{if(e.readyState>=2)throw new Error("socket closed");if(1!==e.readyState)return new Promise(((t,r)=>{const i=e&&(e.removeEventListener||e.removeListener);function n(){"function"==typeof i&&(i.call(e,"open",s),i.call(e,"error",o))}function s(){n(),t()}function o(e){n(),r(e)}e.addEventListener("open",s),e.addEventListener("error",o)}))}},{}],kgph9:[function(e,t,r){const{relative:i}=e("iso-url"),n={http:"ws",https:"wss"};t.exports=(e,t)=>i(e,t,n,"ws")},{"iso-url":"86VPZ"}],"8AR2t":[function(e,t,r){"use strict";t.exports=function(){throw new Error("WebSocket Servers can not be created in the browser!")}},{}],"9P0w8":[function(e,t,r){"use strict";const i=e("abortable-iterator"),{CLOSE_TIMEOUT:n}=e("./constants"),s=e("libp2p-utils/src/ip-port-to-multiaddr"),o=e("p-timeout"),a=e("debug"),c=a("libp2p:websockets:socket");c.error=a("libp2p:websockets:socket:error"),t.exports=(e,t={})=>{const r={async sink(r){t.signal&&(r=i(r,t.signal));try{await e.sink(async function*(){for await(const e of r)yield e instanceof Uint8Array?e:e.slice()}())}catch(e){"aborted"!==e.type&&c.error(e)}},source:t.signal?i(e.source,t.signal):e.source,conn:e,localAddr:t.localAddr||(e.localAddress&&e.localPort?s(e.localAddress,e.localPort):void 0),remoteAddr:t.remoteAddr||s(e.remoteAddress,e.remotePort),timeline:{open:Date.now()},async close(){const t=Date.now();try{await o(e.close(),n)}catch(i){const{host:n,port:s}=r.remoteAddr.toOptions();c("timeout closing stream to %s:%s after %dms, destroying it manually",n,s,Date.now()-t),e.destroy()}finally{r.timeline.close=Date.now()}}};return e.socket.once&&e.socket.once("close",(()=>{r.timeline.close||(r.timeline.close=Date.now())})),r}},{"abortable-iterator":"awlU8","./constants":"7O7y1","libp2p-utils/src/ip-port-to-multiaddr":"WM46A","p-timeout":"hP9Ay",debug:"bO5wM"}],"7O7y1":[function(e,t,r){"use strict";r.CODE_P2P=421,r.CODE_CIRCUIT=290,r.CODE_TCP=6,r.CODE_WS=477,r.CODE_WSS=478,r.CLOSE_TIMEOUT=2e3},{}],WM46A:[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:ip-port-to-multiaddr"),{error:i("libp2p:ip-port-to-multiaddr:err")}),{Multiaddr:s}=e("multiaddr"),o=e("err-code"),{Address4:a,Address6:c}=e("ip-address"),u={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};t.exports=function(e,t){if("string"!=typeof e)throw o(new Error(`invalid ip provided: ${e}`),u.ERR_INVALID_IP_PARAMETER);if("string"==typeof t&&(t=parseInt(t)),isNaN(t))throw o(new Error(`invalid port provided: ${t}`),u.ERR_INVALID_PORT_PARAMETER);try{return new a(e),new s(`/ip4/${e}/tcp/${t}`)}catch{}try{const r=new c(e);return r.is4()?new s(`/ip4/${r.to4().correctForm()}/tcp/${t}`):new s(`/ip6/${e}/tcp/${t}`)}catch(r){const i=`invalid ip:port for creating a multiaddr: ${e}:${t}`;throw n.error(i),o(new Error(i),u.ERR_INVALID_IP)}},t.exports.Errors=u},{debug:"bO5wM",multiaddr:"8Mu1u","err-code":"chZjB","ip-address":"14vMS"}],"14vMS":[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"Address4",(()=>n.Address4)),i.export(r,"Address6",(()=>s.Address6)),i.export(r,"AddressError",(()=>o.AddressError)),i.export(r,"v6",(()=>a));var n=e("./lib/ipv4"),s=e("./lib/ipv6"),o=e("./lib/address-error");const a={helpers:e("./lib/v6/helpers")}},{"./lib/ipv4":"blUQX","./lib/ipv6":"a8cEK","./lib/address-error":"fmci6","./lib/v6/helpers":"hT0Uq","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],blUQX:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"Address4",(()=>u));var n=e("./common"),s=e("./v4/constants"),o=e("./address-error"),a=e("jsbn"),c=e("sprintf-js");class u{constructor(e){this.groups=s.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=n.isCorrect(s.BITS),this.isInSubnet=n.isInSubnet,this.address=e;const t=s.RE_SUBNET_STRING.exec(e);if(t){if(this.parsedSubnet=t[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>s.BITS)throw new o.AddressError("Invalid subnet mask.");e=e.replace(s.RE_SUBNET_STRING,"")}this.addressMinusSuffix=e,this.parsedAddress=this.parse(e)}static isValid(e){try{return new u(e),!0}catch(e){return!1}}parse(e){const t=e.split(".");if(!e.match(s.RE_ADDRESS))throw new o.AddressError("Invalid IPv4 address.");return t}correctForm(){return this.parsedAddress.map((e=>parseInt(e,10))).join(".")}static fromHex(e){const t=e.replace(/:/g,"").padStart(8,"0"),r=[];let i;for(i=0;i<8;i+=2){const e=t.slice(i,i+2);r.push(parseInt(e,16))}return new u(r.join("."))}static fromInteger(e){return u.fromHex(e.toString(16))}static fromArpa(e){const t=e.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new u(t)}toHex(){return this.parsedAddress.map((e=>c.sprintf("%02x",parseInt(e,10)))).join(":")}toArray(){return this.parsedAddress.map((e=>parseInt(e,10)))}toGroup6(){const e=[];let t;for(t=0;t<s.GROUPS;t+=2){const r=c.sprintf("%02x%02x",parseInt(this.parsedAddress[t],10),parseInt(this.parsedAddress[t+1],10));e.push(c.sprintf("%x",parseInt(r,16)))}return e.join(":")}bigInteger(){return new a.BigInteger(this.parsedAddress.map((e=>c.sprintf("%02x",parseInt(e,10)))).join(""),16)}_startAddress(){return new a.BigInteger(this.mask()+"0".repeat(s.BITS-this.subnetMask),2)}startAddress(){return u.fromBigInteger(this._startAddress())}startAddressExclusive(){const e=new a.BigInteger("1");return u.fromBigInteger(this._startAddress().add(e))}_endAddress(){return new a.BigInteger(this.mask()+"1".repeat(s.BITS-this.subnetMask),2)}endAddress(){return u.fromBigInteger(this._endAddress())}endAddressExclusive(){const e=new a.BigInteger("1");return u.fromBigInteger(this._endAddress().subtract(e))}static fromBigInteger(e){return u.fromInteger(parseInt(e.toString(),10))}mask(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)}getBitsBase2(e,t){return this.binaryZeroPad().slice(e,t)}reverseForm(e){e||(e={});const t=this.correctForm().split(".").reverse().join(".");return e.omitSuffix?t:c.sprintf("%s.in-addr.arpa.",t)}isMulticast(){return this.isInSubnet(new u("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(s.BITS,"0")}groupForV6(){const e=this.parsedAddress;return this.address.replace(s.RE_ADDRESS,c.sprintf('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',e.slice(0,2).join("."),e.slice(2,4).join(".")))}}},{"./common":"6mE8e","./v4/constants":"7d2VV","./address-error":"fmci6",jsbn:"cmpQN","sprintf-js":"5O475","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],"6mE8e":[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");function n(e){return!(this.subnetMask<e.subnetMask)&&this.mask(e.subnetMask)===e.mask()}function s(e){return function(){return this.addressMinusSuffix===this.correctForm()&&(this.subnetMask===e&&!this.parsedSubnet||this.parsedSubnet===String(this.subnetMask))}}i.defineInteropFlag(r),i.export(r,"isInSubnet",(()=>n)),i.export(r,"isCorrect",(()=>s))},{"@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],"7d2VV":[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"BITS",(()=>n)),i.export(r,"GROUPS",(()=>s)),i.export(r,"RE_ADDRESS",(()=>o)),i.export(r,"RE_SUBNET_STRING",(()=>a));const n=32,s=4,o=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,a=/\/\d{1,2}$/},{"@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],fmci6:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"AddressError",(()=>n));class n extends Error{constructor(e,t){super(e),this.name="AddressError",null!==t&&(this.parseMessage=t)}}},{"@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],cmpQN:[function(e,t,r){(function(){var e;function i(e,t,r){null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function n(){return new i(null)}var s="undefined"!=typeof navigator;s&&"Microsoft Internet Explorer"==navigator.appName?(i.prototype.am=function(e,t,r,i,n,s){for(var o=32767&t,a=t>>15;--s>=0;){var c=32767&this[e],u=this[e++]>>15,l=a*c+u*o;n=((c=o*c+((32767&l)<<15)+r[i]+(1073741823&n))>>>30)+(l>>>15)+a*u+(n>>>30),r[i++]=1073741823&c}return n},e=30):s&&"Netscape"!=navigator.appName?(i.prototype.am=function(e,t,r,i,n,s){for(;--s>=0;){var o=t*this[e++]+r[i]+n;n=Math.floor(o/67108864),r[i++]=67108863&o}return n},e=26):(i.prototype.am=function(e,t,r,i,n,s){for(var o=16383&t,a=t>>14;--s>=0;){var c=16383&this[e],u=this[e++]>>14,l=a*c+u*o;n=((c=o*c+((16383&l)<<14)+r[i]+n)>>28)+(l>>14)+a*u,r[i++]=268435455&c}return n},e=28),i.prototype.DB=e,i.prototype.DM=(1<<e)-1,i.prototype.DV=1<<e;i.prototype.FV=Math.pow(2,52),i.prototype.F1=52-e,i.prototype.F2=2*e-52;var o,a,c=new Array;for(o="0".charCodeAt(0),a=0;a<=9;++a)c[o++]=a;for(o="a".charCodeAt(0),a=10;a<36;++a)c[o++]=a;for(o="A".charCodeAt(0),a=10;a<36;++a)c[o++]=a;function u(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function l(e,t){var r=c[e.charCodeAt(t)];return null==r?-1:r}function d(e){var t=n();return t.fromInt(e),t}function f(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function h(e){this.m=e}function p(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function g(e,t){return e&t}function y(e,t){return e|t}function m(e,t){return e^t}function b(e,t){return e&~t}function v(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function w(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function _(){}function E(e){return e}function S(e){this.r2=n(),this.q3=n(),i.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}h.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},h.prototype.revert=function(e){return e},h.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},h.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},h.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},p.prototype.convert=function(e){var t=n();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(i.ZERO)>0&&this.m.subTo(t,t),t},p.prototype.revert=function(e){var t=n();return e.copyTo(t),this.reduce(t),t},p.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],i=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,i,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},p.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},p.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},i.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},i.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},i.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,s=!1,o=0;--n>=0;){var a=8==r?255&e[n]:l(e,n);a<0?"-"==e.charAt(n)&&(s=!0):(s=!1,0==o?this[this.t++]=a:o+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),s&&i.ZERO.subTo(this,this)},i.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},i.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s},i.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s},i.prototype.lShiftTo=function(e,t){var r,i=e%this.DB,n=this.DB-i,s=(1<<n)-1,o=Math.floor(e/this.DB),a=this.s<<i&this.DM;for(r=this.t-1;r>=0;--r)t[r+o+1]=this[r]>>n|a,a=(this[r]&s)<<i;for(r=o-1;r>=0;--r)t[r]=0;t[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()},i.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var i=e%this.DB,n=this.DB-i,s=(1<<i)-1;t[0]=this[r]>>i;for(var o=r+1;o<this.t;++o)t[o-r-1]|=(this[o]&s)<<n,t[o-r]=this[o]>>i;i>0&&(t[this.t-r-1]|=(this.s&s)<<n),t.t=this.t-r,t.clamp()}},i.prototype.subTo=function(e,t){for(var r=0,i=0,n=Math.min(e.t,this.t);r<n;)i+=this[r]-e[r],t[r++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;r<this.t;)i+=this[r],t[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<e.t;)i-=e[r],t[r++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t[r++]=this.DV+i:i>0&&(t[r++]=i),t.t=r,t.clamp()},i.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),s=r.t;for(t.t=s+n.t;--s>=0;)t[s]=0;for(s=0;s<n.t;++s)t[s+r.t]=r.am(0,n[s],t,s,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&i.ZERO.subTo(t,t)},i.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var i=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,i,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()},i.prototype.divRemTo=function(e,t,r){var s=e.abs();if(!(s.t<=0)){var o=this.abs();if(o.t<s.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=n());var a=n(),c=this.s,u=e.s,l=this.DB-f(s[s.t-1]);l>0?(s.lShiftTo(l,a),o.lShiftTo(l,r)):(s.copyTo(a),o.copyTo(r));var d=a.t,h=a[d-1];if(0!=h){var p=h*(1<<this.F1)+(d>1?a[d-2]>>this.F2:0),g=this.FV/p,y=(1<<this.F1)/p,m=1<<this.F2,b=r.t,v=b-d,w=null==t?n():t;for(a.dlShiftTo(v,w),r.compareTo(w)>=0&&(r[r.t++]=1,r.subTo(w,r)),i.ONE.dlShiftTo(d,w),w.subTo(a,a);a.t<d;)a[a.t++]=0;for(;--v>=0;){var _=r[--b]==h?this.DM:Math.floor(r[b]*g+(r[b-1]+m)*y);if((r[b]+=a.am(0,_,r,v,0,d))<_)for(a.dlShiftTo(v,w),r.subTo(w,r);r[b]<--_;)r.subTo(w,r)}null!=t&&(r.drShiftTo(d,t),c!=u&&i.ZERO.subTo(t,t)),r.t=d,r.clamp(),l>0&&r.rShiftTo(l,r),c<0&&i.ZERO.subTo(r,r)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},i.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},i.prototype.exp=function(e,t){if(e>4294967295||e<1)return i.ONE;var r=n(),s=n(),o=t.convert(this),a=f(e)-1;for(o.copyTo(r);--a>=0;)if(t.sqrTo(r,s),(e&1<<a)>0)t.mulTo(s,o,r);else{var c=r;r=s,s=c}return t.revert(r)},i.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,i=(1<<t)-1,n=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(r=this[o]>>a)>0&&(n=!0,s=u(r));o>=0;)a<t?(r=(this[o]&(1<<a)-1)<<t-a,r|=this[--o]>>(a+=this.DB-t)):(r=this[o]>>(a-=t)&i,a<=0&&(a+=this.DB,--o)),r>0&&(n=!0),n&&(s+=u(r));return n?s:"0"},i.prototype.negate=function(){var e=n();return i.ZERO.subTo(this,e),e},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+f(this[this.t-1]^this.s&this.DM)},i.prototype.mod=function(e){var t=n();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(i.ZERO)>0&&e.subTo(t,t),t},i.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new h(t):new p(t),this.exp(e,r)},i.ZERO=d(0),i.ONE=d(1),_.prototype.convert=E,_.prototype.revert=E,_.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},_.prototype.sqrTo=function(e,t){e.squareTo(t)},S.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=n();return e.copyTo(t),this.reduce(t),t},S.prototype.revert=function(e){return e},S.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},S.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},S.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var T,A,k,I=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],R=67108864/I[I.length-1];function P(){var e;e=(new Date).getTime(),A[k++]^=255&e,A[k++]^=e>>8&255,A[k++]^=e>>16&255,A[k++]^=e>>24&255,k>=B&&(k-=B)}if(i.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},i.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=d(r),s=n(),o=n(),a="";for(this.divRemTo(i,s,o);s.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,s.divRemTo(i,s,o);return o.intValue().toString(e)+a},i.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),s=!1,o=0,a=0,c=0;c<e.length;++c){var u=l(e,c);u<0?"-"==e.charAt(c)&&0==this.signum()&&(s=!0):(a=t*a+u,++o>=r&&(this.dMultiply(n),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),s&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(i.ONE.shiftLeft(e-1),y,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(i.ONE.shiftLeft(e-1),this);else{var n=new Array,s=7&e;n.length=1+(e>>3),t.nextBytes(n),s>0?n[0]&=(1<<s)-1:n[0]=0,this.fromString(n,256)}},i.prototype.bitwiseTo=function(e,t,r){var i,n,s=Math.min(e.t,this.t);for(i=0;i<s;++i)r[i]=t(this[i],e[i]);if(e.t<this.t){for(n=e.s&this.DM,i=s;i<this.t;++i)r[i]=t(this[i],n);r.t=this.t}else{for(n=this.s&this.DM,i=s;i<e.t;++i)r[i]=t(n,e[i]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},i.prototype.changeBit=function(e,t){var r=i.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},i.prototype.addTo=function(e,t){for(var r=0,i=0,n=Math.min(e.t,this.t);r<n;)i+=this[r]+e[r],t[r++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i+=e.s;r<this.t;)i+=this[r],t[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<e.t;)i+=e[r],t[r++]=i&this.DM,i>>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t[r++]=i:i<-1&&(t[r++]=this.DV+i),t.t=r,t.clamp()},i.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},i.prototype.multiplyLowerTo=function(e,t,r){var i,n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(i=r.t-this.t;n<i;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(i=Math.min(e.t,t);n<i;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()},i.prototype.multiplyUpperTo=function(e,t,r){--t;var i=r.t=this.t+e.t-t;for(r.s=0;--i>=0;)r[i]=0;for(i=Math.max(t-this.t,0);i<e.t;++i)r[this.t+i-t]=this.am(t-i,e[i],r,0,0,this.t+i-t);r.clamp(),r.drShiftTo(1,r)},i.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this[0]%e;else for(var i=this.t-1;i>=0;--i)r=(t*r+this[i])%e;return r},i.prototype.millerRabin=function(e){var t=this.subtract(i.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var s=t.shiftRight(r);(e=e+1>>1)>I.length&&(e=I.length);for(var o=n(),a=0;a<e;++a){o.fromInt(I[Math.floor(Math.random()*I.length)]);var c=o.modPow(s,this);if(0!=c.compareTo(i.ONE)&&0!=c.compareTo(t)){for(var u=1;u++<r&&0!=c.compareTo(t);)if(0==(c=c.modPowInt(2,this)).compareTo(i.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0},i.prototype.clone=function(){var e=n();return this.copyTo(e),e},i.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},i.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},i.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},i.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,i=this.DB-e*this.DB%8,n=0;if(e-- >0)for(i<this.DB&&(r=this[e]>>i)!=(this.s&this.DM)>>i&&(t[n++]=r|this.s<<this.DB-i);e>=0;)i<8?(r=(this[e]&(1<<i)-1)<<8-i,r|=this[--e]>>(i+=this.DB-8)):(r=this[e]>>(i-=8)&255,i<=0&&(i+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t},i.prototype.equals=function(e){return 0==this.compareTo(e)},i.prototype.min=function(e){return this.compareTo(e)<0?this:e},i.prototype.max=function(e){return this.compareTo(e)>0?this:e},i.prototype.and=function(e){var t=n();return this.bitwiseTo(e,g,t),t},i.prototype.or=function(e){var t=n();return this.bitwiseTo(e,y,t),t},i.prototype.xor=function(e){var t=n();return this.bitwiseTo(e,m,t),t},i.prototype.andNot=function(e){var t=n();return this.bitwiseTo(e,b,t),t},i.prototype.not=function(){for(var e=n(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},i.prototype.shiftLeft=function(e){var t=n();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},i.prototype.shiftRight=function(e){var t=n();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},i.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+v(this[e]);return this.s<0?this.t*this.DB:-1},i.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=w(this[r]^t);return e},i.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},i.prototype.setBit=function(e){return this.changeBit(e,y)},i.prototype.clearBit=function(e){return this.changeBit(e,b)},i.prototype.flipBit=function(e){return this.changeBit(e,m)},i.prototype.add=function(e){var t=n();return this.addTo(e,t),t},i.prototype.subtract=function(e){var t=n();return this.subTo(e,t),t},i.prototype.multiply=function(e){var t=n();return this.multiplyTo(e,t),t},i.prototype.divide=function(e){var t=n();return this.divRemTo(e,t,null),t},i.prototype.remainder=function(e){var t=n();return this.divRemTo(e,null,t),t},i.prototype.divideAndRemainder=function(e){var t=n(),r=n();return this.divRemTo(e,t,r),new Array(t,r)},i.prototype.modPow=function(e,t){var r,i,s=e.bitLength(),o=d(1);if(s<=0)return o;r=s<18?1:s<48?3:s<144?4:s<768?5:6,i=s<8?new h(t):t.isEven()?new S(t):new p(t);var a=new Array,c=3,u=r-1,l=(1<<r)-1;if(a[1]=i.convert(this),r>1){var g=n();for(i.sqrTo(a[1],g);c<=l;)a[c]=n(),i.mulTo(g,a[c-2],a[c]),c+=2}var y,m,b=e.t-1,v=!0,w=n();for(s=f(e[b])-1;b>=0;){for(s>=u?y=e[b]>>s-u&l:(y=(e[b]&(1<<s+1)-1)<<u-s,b>0&&(y|=e[b-1]>>this.DB+s-u)),c=r;0==(1&y);)y>>=1,--c;if((s-=c)<0&&(s+=this.DB,--b),v)a[y].copyTo(o),v=!1;else{for(;c>1;)i.sqrTo(o,w),i.sqrTo(w,o),c-=2;c>0?i.sqrTo(o,w):(m=o,o=w,w=m),i.mulTo(w,a[y],o)}for(;b>=0&&0==(e[b]&1<<s);)i.sqrTo(o,w),m=o,o=w,w=m,--s<0&&(s=this.DB-1,--b)}return i.revert(o)},i.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return i.ZERO;for(var r=e.clone(),n=this.clone(),s=d(1),o=d(0),a=d(0),c=d(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(s.isEven()&&o.isEven()||(s.addTo(this,s),o.subTo(e,o)),s.rShiftTo(1,s)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),t?(a.isEven()&&c.isEven()||(a.addTo(this,a),c.subTo(e,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(e,c),c.rShiftTo(1,c);r.compareTo(n)>=0?(r.subTo(n,r),t&&s.subTo(a,s),o.subTo(c,o)):(n.subTo(r,n),t&&a.subTo(s,a),c.subTo(o,c))}return 0!=n.compareTo(i.ONE)?i.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},i.prototype.pow=function(e){return this.exp(e,new _)},i.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var i=t;t=r,r=i}var n=t.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return t;for(n<s&&(s=n),s>0&&(t.rShiftTo(s,t),r.rShiftTo(s,r));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r},i.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r[0]<=I[I.length-1]){for(t=0;t<I.length;++t)if(r[0]==I[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<I.length;){for(var i=I[t],n=t+1;n<I.length&&i<R;)i*=I[n++];for(i=r.modInt(i);t<n;)if(i%I[t++]==0)return!1}return r.millerRabin(e)},i.prototype.square=function(){var e=n();return this.squareTo(e),e},i.prototype.Barrett=S,null==A){var O;if(A=new Array,k=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var C=new Uint8Array(32);for(window.crypto.getRandomValues(C),O=0;O<32;++O)A[k++]=C[O]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var j=window.crypto.random(32);for(O=0;O<j.length;++O)A[k++]=255&j.charCodeAt(O)}for(;k<B;)O=Math.floor(65536*Math.random()),A[k++]=O>>>8,A[k++]=255&O;k=0,P()}function D(){if(null==T){for(P(),(T=new x).init(A),k=0;k<A.length;++k)A[k]=0;k=0}return T.next()}function M(){}function x(){this.i=0,this.j=0,this.S=new Array}M.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=D()},x.prototype.init=function(e){var t,r,i;for(t=0;t<256;++t)this.S[t]=t;for(r=0,t=0;t<256;++t)r=r+this.S[t]+e[t%e.length]&255,i=this.S[t],this.S[t]=this.S[r],this.S[r]=i;this.i=0,this.j=0},x.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]};var B=256;void 0!==r?r=t.exports={default:i,BigInteger:i,SecureRandom:M}:this.jsbn={BigInteger:i,SecureRandom:M}}).call(this)},{}],"5O475":[function(e,t,r){!function(){var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(e){return n(o(e),arguments)}function i(e,r){return t.apply(null,[e].concat(r||[]))}function n(r,i){var n,s,o,a,c,u,l,d,f,h=1,p=r.length,g="";for(s=0;s<p;s++)if("string"==typeof r[s])g+=r[s];else if("object"==typeof r[s]){if((a=r[s]).keys)for(n=i[h],o=0;o<a.keys.length;o++){if(null==n)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',a.keys[o],a.keys[o-1]));n=n[a.keys[o]]}else n=a.param_no?i[a.param_no]:i[h++];if(e.not_type.test(a.type)&&e.not_primitive.test(a.type)&&n instanceof Function&&(n=n()),e.numeric_arg.test(a.type)&&"number"!=typeof n&&isNaN(n))throw new TypeError(t("[sprintf] expecting number but found %T",n));switch(e.number.test(a.type)&&(d=n>=0),a.type){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,a.width?parseInt(a.width):0);break;case"e":n=a.precision?parseFloat(n).toExponential(a.precision):parseFloat(n).toExponential();break;case"f":n=a.precision?parseFloat(n).toFixed(a.precision):parseFloat(n);break;case"g":n=a.precision?String(Number(n.toPrecision(a.precision))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=a.precision?n.substring(0,a.precision):n;break;case"t":n=String(!!n),n=a.precision?n.substring(0,a.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=a.precision?n.substring(0,a.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=a.precision?n.substring(0,a.precision):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}e.json.test(a.type)?g+=n:(!e.number.test(a.type)||d&&!a.sign?f="":(f=d?"+":"-",n=n.toString().replace(e.sign,"")),u=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",l=a.width-(f+n).length,c=a.width&&l>0?u.repeat(l):"",g+=a.align?f+n+c:"0"===u?f+c+n:c+f+n)}return g}var s=Object.create(null);function o(t){if(s[t])return s[t];for(var r,i=t,n=[],o=0;i;){if(null!==(r=e.text.exec(i)))n.push(r[0]);else if(null!==(r=e.modulo.exec(i)))n.push("%");else{if(null===(r=e.placeholder.exec(i)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){o|=1;var a=[],c=r[2],u=[];if(null===(u=e.key.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a.push(u[1]);""!==(c=c.substring(u[0].length));)if(null!==(u=e.key_access.exec(c)))a.push(u[1]);else{if(null===(u=e.index_access.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");a.push(u[1])}r[2]=a}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:r[0],param_no:r[1],keys:r[2],sign:r[3],pad_char:r[4],align:r[5],width:r[6],precision:r[7],type:r[8]})}i=i.substring(r[0].length)}return s[t]=n}void 0!==r&&(r.sprintf=t,r.vsprintf=i),"undefined"!=typeof window&&(window.sprintf=t,window.vsprintf=i,"function"==typeof define&&define.amd&&define((function(){return{sprintf:t,vsprintf:i}})))}()},{}],a8cEK:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"Address6",(()=>m));var n=e("./common"),s=e("./v4/constants"),o=e("./v6/constants"),a=e("./v6/helpers"),c=e("./ipv4"),u=e("./v6/regular-expressions"),l=e("./address-error"),d=e("jsbn"),f=e("sprintf-js");function h(e){if(!e)throw new Error("Assertion failed.")}function p(e){return e=(e=e.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2')).replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2')}function g(e){return f.sprintf("%04x",parseInt(e,16))}function y(e){return 255&e}class m{constructor(e,t){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=n.isInSubnet,this.isCorrect=n.isCorrect(o.BITS),this.groups=void 0===t?o.GROUPS:t,this.address=e;const r=o.RE_SUBNET_STRING.exec(e);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>o.BITS)throw new l.AddressError("Invalid subnet mask.");e=e.replace(o.RE_SUBNET_STRING,"")}else if(/\//.test(e))throw new l.AddressError("Invalid subnet mask.");const i=o.RE_ZONE_STRING.exec(e);i&&(this.zone=i[0],e=e.replace(o.RE_ZONE_STRING,"")),this.addressMinusSuffix=e,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(e){try{return new m(e),!0}catch(e){return!1}}static fromBigInteger(e){const t=e.toString(16).padStart(32,"0"),r=[];let i;for(i=0;i<o.GROUPS;i++)r.push(t.slice(4*i,4*(i+1)));return new m(r.join(":"))}static fromURL(e){let t,r,i=null;if(-1!==e.indexOf("[")&&-1!==e.indexOf("]:")){if(r=o.RE_URL_WITH_PORT.exec(e),null===r)return{error:"failed to parse address with port",address:null,port:null};t=r[1],i=r[2]}else if(-1!==e.indexOf("/")){if(e=e.replace(/^[a-z0-9]+:\/\//,""),r=o.RE_URL.exec(e),null===r)return{error:"failed to parse address from URL",address:null,port:null};t=r[1]}else t=e;return i?(i=parseInt(i,10),(i<0||i>65536)&&(i=null)):i=null,{address:new m(t),port:i}}static fromAddress4(e){const t=new c.Address4(e),r=o.BITS-(s.BITS-t.subnetMask);return new m(`::ffff:${t.correctForm()}/${r}`)}static fromArpa(e){let t=e.replace(/(\.ip6\.arpa)?\.$/,"");if(63!==t.length)throw new l.AddressError("Invalid 'ip6.arpa' form.");const r=t.split(".").reverse();for(let e=7;e>0;e--){const t=4*e;r.splice(t,0,":")}return t=r.join(""),new m(t)}microsoftTranscription(){return f.sprintf("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(e=this.subnetMask){return this.getBitsBase2(0,e)}possibleSubnets(e=128){const t=o.BITS-this.subnetMask-Math.abs(e-o.BITS);return t<0?"0":function(e){const t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}(new d.BigInteger("2",10).pow(t).toString(10))}_startAddress(){return new d.BigInteger(this.mask()+"0".repeat(o.BITS-this.subnetMask),2)}startAddress(){return m.fromBigInteger(this._startAddress())}startAddressExclusive(){const e=new d.BigInteger("1");return m.fromBigInteger(this._startAddress().add(e))}_endAddress(){return new d.BigInteger(this.mask()+"1".repeat(o.BITS-this.subnetMask),2)}endAddress(){return m.fromBigInteger(this._endAddress())}endAddressExclusive(){const e=new d.BigInteger("1");return m.fromBigInteger(this._endAddress().subtract(e))}getScope(){let e=o.SCOPES[this.getBits(12,16).intValue()];return"Global unicast"===this.getType()&&"Link local"!==e&&(e="Global"),e||"Unknown"}getType(){for(const e of Object.keys(o.TYPES))if(this.isInSubnet(new m(e)))return o.TYPES[e];return"Global unicast"}getBits(e,t){return new d.BigInteger(this.getBitsBase2(e,t),2)}getBitsBase2(e,t){return this.binaryZeroPad().slice(e,t)}getBitsBase16(e,t){const r=t-e;if(r%4!=0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(e,t).toString(16).padStart(r/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,o.BITS)}reverseForm(e){e||(e={});const t=Math.floor(this.subnetMask/4),r=this.canonicalForm().replace(/:/g,"").split("").slice(0,t).reverse().join(".");return t>0?e.omitSuffix?r:f.sprintf("%s.ip6.arpa.",r):e.omitSuffix?"":"ip6.arpa."}correctForm(){let e,t=[],r=0;const i=[];for(e=0;e<this.parsedAddress.length;e++){const t=parseInt(this.parsedAddress[e],16);0===t&&r++,0!==t&&r>0&&(r>1&&i.push([e-r,e-1]),r=0)}r>1&&i.push([this.parsedAddress.length-r,this.parsedAddress.length-1]);const n=i.map((e=>e[1]-e[0]+1));if(i.length>0){const e=n.indexOf(Math.max(...n));t=function(e,t){const r=[],i=[];let n;for(n=0;n<e.length;n++)n<t[0]?r.push(e[n]):n>t[1]&&i.push(e[n]);return r.concat(["compact"]).concat(i)}(this.parsedAddress,i[e])}else t=this.parsedAddress;for(e=0;e<t.length;e++)"compact"!==t[e]&&(t[e]=parseInt(t[e],16).toString(16));let s=t.join(":");return s=s.replace(/^compact$/,"::"),s=s.replace(/^compact|compact$/,":"),s=s.replace(/compact/,""),s}binaryZeroPad(){return this.bigInteger().toString(2).padStart(o.BITS,"0")}parse4in6(e){const t=e.split(":"),r=t.slice(-1)[0].match(s.RE_ADDRESS);if(r){this.parsedAddress4=r[0],this.address4=new c.Address4(this.parsedAddress4);for(let t=0;t<this.address4.groups;t++)if(/^0[0-9]+/.test(this.address4.parsedAddress[t]))throw new l.AddressError("IPv4 addresses can't have leading zeroes.",e.replace(s.RE_ADDRESS,this.address4.parsedAddress.map(p).join(".")));this.v4=!0,t[t.length-1]=this.address4.toGroup6(),e=t.join(":")}return e}parse(e){const t=(e=this.parse4in6(e)).match(o.RE_BAD_CHARACTERS);if(t)throw new l.AddressError(f.sprintf("Bad character%s detected in address: %s",t.length>1?"s":"",t.join("")),e.replace(o.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));const r=e.match(o.RE_BAD_ADDRESS);if(r)throw new l.AddressError(f.sprintf("Address failed regex: %s",r.join("")),e.replace(o.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));let i=[];const n=e.split("::");if(2===n.length){let e=n[0].split(":"),t=n[1].split(":");1===e.length&&""===e[0]&&(e=[]),1===t.length&&""===t[0]&&(t=[]);const r=this.groups-(e.length+t.length);if(!r)throw new l.AddressError("Error parsing groups");this.elidedGroups=r,this.elisionBegin=e.length,this.elisionEnd=e.length+this.elidedGroups,i=i.concat(e);for(let e=0;e<r;e++)i.push("0");i=i.concat(t)}else{if(1!==n.length)throw new l.AddressError("Too many :: groups found");i=e.split(":"),this.elidedGroups=0}if(i=i.map((e=>f.sprintf("%x",parseInt(e,16)))),i.length!==this.groups)throw new l.AddressError("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(g).join(":")}decimal(){return this.parsedAddress.map((e=>f.sprintf("%05d",parseInt(e,16)))).join(":")}bigInteger(){return new d.BigInteger(this.parsedAddress.map(g).join(""),16)}to4(){const e=this.binaryZeroPad().split("");return c.Address4.fromHex(new d.BigInteger(e.slice(96,128).join(""),2).toString(16))}to4in6(){const e=this.to4(),t=new m(this.parsedAddress.slice(0,6).join(":"),6).correctForm();let r="";return/:$/.test(t)||(r=":"),t+r+e.address}inspectTeredo(){const e=this.getBitsBase16(0,32),t=this.getBits(80,96).xor(new d.BigInteger("ffff",16)).toString(),r=c.Address4.fromHex(this.getBitsBase16(32,64)),i=c.Address4.fromHex(this.getBits(96,128).xor(new d.BigInteger("ffffffff",16)).toString(16)),n=this.getBits(64,80),s=this.getBitsBase2(64,80),o=n.testBit(15),a=n.testBit(14),u=n.testBit(8),l=n.testBit(9),h=new d.BigInteger(s.slice(2,6)+s.slice(8,16),2).toString(10);return{prefix:f.sprintf("%s:%s",e.slice(0,4),e.slice(4,8)),server4:r.address,client4:i.address,flags:s,coneNat:o,microsoft:{reserved:a,universalLocal:l,groupIndividual:u,nonce:h},udpPort:t}}inspect6to4(){const e=this.getBitsBase16(0,16),t=c.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:f.sprintf("%s",e.slice(0,4)),gateway:t.address}}to6to4(){if(!this.is4())return null;const e=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new m(e)}toByteArray(){const e=this.bigInteger().toByteArray();return 17===e.length&&0===e[0]?e.slice(1):e}toUnsignedByteArray(){return this.toByteArray().map(y)}static fromByteArray(e){return this.fromUnsignedByteArray(e.map(y))}static fromUnsignedByteArray(e){const t=new d.BigInteger("256",10);let r=new d.BigInteger("0",10),i=new d.BigInteger("1",10);for(let n=e.length-1;n>=0;n--)r=r.add(i.multiply(new d.BigInteger(e[n].toString(10),10))),i=i.multiply(t);return m.fromBigInteger(r)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return"1111111010000000000000000000000000000000000000000000000000000000"===this.getBitsBase2(0,64)}isMulticast(){return"Multicast"===this.getType()}is4(){return this.v4}isTeredo(){return this.isInSubnet(new m("2001::/32"))}is6to4(){return this.isInSubnet(new m("2002::/16"))}isLoopback(){return"Loopback"===this.getType()}href(e){return e=void 0===e?"":f.sprintf(":%s",e),f.sprintf("http://[%s]%s/",this.correctForm(),e)}link(e){e||(e={}),void 0===e.className&&(e.className=""),void 0===e.prefix&&(e.prefix="/#address="),void 0===e.v4&&(e.v4=!1);let t=this.correctForm;return e.v4&&(t=this.to4in6),e.className?f.sprintf('<a href="%1$s%2$s" class="%3$s">%2$s</a>',e.prefix,t.call(this),e.className):f.sprintf('<a href="%1$s%2$s">%2$s</a>',e.prefix,t.call(this))}group(){if(0===this.elidedGroups)return a.simpleGroup(this.address).join(":");h("number"==typeof this.elidedGroups),h("number"==typeof this.elisionBegin);const e=[],[t,r]=this.address.split("::");t.length?e.push(...a.simpleGroup(t)):e.push("");const i=["hover-group"];for(let e=this.elisionBegin;e<this.elisionBegin+this.elidedGroups;e++)i.push(f.sprintf("group-%d",e));return e.push(f.sprintf('<span class="%s"></span>',i.join(" "))),r.length?e.push(...a.simpleGroup(r,this.elisionEnd)):e.push(""),this.is4()&&(h(this.address4 instanceof c.Address4),e.pop(),e.push(this.address4.groupForV6())),e.join(":")}regularExpressionString(e=!1){let t=[];const r=new m(this.correctForm());if(0===r.elidedGroups)t.push(u.simpleRegularExpression(r.parsedAddress));else if(r.elidedGroups===o.GROUPS)t.push(u.possibleElisions(o.GROUPS));else{const e=r.address.split("::");e[0].length&&t.push(u.simpleRegularExpression(e[0].split(":"))),h("number"==typeof r.elidedGroups),t.push(u.possibleElisions(r.elidedGroups,0!==e[0].length,0!==e[1].length)),e[1].length&&t.push(u.simpleRegularExpression(e[1].split(":"))),t=[t.join(":")]}return e||(t=["(?=^|",u.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...t,")(?=[^\\w\\:]|",u.ADDRESS_BOUNDARY,"|$)"]),t.join("")}regularExpression(e=!1){return new RegExp(this.regularExpressionString(e),"i")}}},{"./common":"6mE8e","./v4/constants":"7d2VV","./v6/constants":"5lfrn","./v6/helpers":"hT0Uq","./ipv4":"blUQX","./v6/regular-expressions":"cbb6J","./address-error":"fmci6",jsbn:"cmpQN","sprintf-js":"5O475","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],"5lfrn":[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"BITS",(()=>n)),i.export(r,"GROUPS",(()=>s)),i.export(r,"SCOPES",(()=>o)),i.export(r,"TYPES",(()=>a)),i.export(r,"RE_BAD_CHARACTERS",(()=>c)),i.export(r,"RE_BAD_ADDRESS",(()=>u)),i.export(r,"RE_SUBNET_STRING",(()=>l)),i.export(r,"RE_ZONE_STRING",(()=>d)),i.export(r,"RE_URL",(()=>f)),i.export(r,"RE_URL_WITH_PORT",(()=>h));const n=128,s=8,o={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},a={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},c=/([^0-9a-f:/%])/gi,u=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,l=/\/\d{1,3}(?=%|$)/,d=/%.*$/,f=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),h=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)},{"@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],hT0Uq:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"spanAllZeroes",(()=>s)),i.export(r,"spanAll",(()=>o)),i.export(r,"spanLeadingZeroes",(()=>c)),i.export(r,"simpleGroup",(()=>u));var n=e("sprintf-js");function s(e){return e.replace(/(0+)/g,'<span class="zero">$1</span>')}function o(e,t=0){return e.split("").map(((e,r)=>n.sprintf('<span class="digit value-%s position-%d">%s</span>',e,r+t,s(e)))).join("")}function a(e){return e.replace(/^(0+)/,'<span class="zero">$1</span>')}function c(e){return e.split(":").map((e=>a(e))).join(":")}function u(e,t=0){return e.split(":").map(((e,r)=>/group-v4/.test(e)?e:n.sprintf('<span class="hover-group group-%d">%s</span>',r+t,a(e))))}},{"sprintf-js":"5O475","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],cbb6J:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"groupPossibilities",(()=>o)),i.export(r,"padGroup",(()=>a)),i.export(r,"ADDRESS_BOUNDARY",(()=>c)),i.export(r,"simpleRegularExpression",(()=>u)),i.export(r,"possibleElisions",(()=>l));var n=e("./constants"),s=e("sprintf-js");function o(e){return s.sprintf("(%s)",e.join("|"))}function a(e){return e.length<4?s.sprintf("0{0,%d}%s",4-e.length,e):e}const c="[^A-Fa-f0-9:]";function u(e){const t=[];e.forEach(((e,r)=>{0===parseInt(e,16)&&t.push(r)}));const r=t.map((t=>e.map(((e,r)=>{if(r===t){const t=0===r||r===n.GROUPS-1?":":"";return o([a(e),t])}return a(e)})).join(":")));return r.push(e.map(a).join(":")),o(r)}function l(e,t,r){const i=t?"":":",n=r?"":":",a=[];t||r||a.push("::"),t&&r&&a.push(""),(r&&!t||!r&&t)&&a.push(":"),a.push(s.sprintf("%s(:0{1,4}){1,%d}",i,e-1)),a.push(s.sprintf("(0{1,4}:){1,%d}%s",e-1,n)),a.push(s.sprintf("(0{1,4}:){%d}0{1,4}",e-1));for(let t=1;t<e-1;t++)for(let r=1;r<e-t;r++)a.push(s.sprintf("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",r,e-r-t-1));return o(a)}},{"./constants":"5lfrn","sprintf-js":"5O475","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],hP9Ay:[function(e,t,r){"use strict";class i extends Error{constructor(e){super(e),this.name="TimeoutError"}}const n=(e,t,r,n)=>{let s;const o=new Promise(((o,a)=>{if("number"!=typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");t!==1/0?(n={customTimers:{setTimeout:setTimeout,clearTimeout:clearTimeout},...n},s=n.customTimers.setTimeout.call(void 0,(()=>{if("function"==typeof r){try{o(r())}catch(e){a(e)}return}const n=r instanceof Error?r:new i("string"==typeof r?r:`Promise timed out after ${t} milliseconds`);"function"==typeof e.cancel&&e.cancel(),a(n)}),t),(async()=>{try{o(await e)}catch(e){a(e)}finally{n.customTimers.clearTimeout.call(void 0,s)}})()):o(e)}));return o.clear=()=>{clearTimeout(s),s=void 0},o};t.exports=n,t.exports.default=n,t.exports.TimeoutError=i},{}],f6X4K:[function(e,t,r){"use strict";const i=e("mafmt"),{CODE_CIRCUIT:n,CODE_P2P:s,CODE_TCP:o,CODE_WS:a,CODE_WSS:c}=e("./constants");t.exports={all:e=>e.filter((e=>{if(e.protoCodes().includes(n))return!1;const t=e.decapsulateCode(s);return i.WebSockets.matches(t)||i.WebSocketsSecure.matches(t)})),dnsWss:e=>e.filter((e=>{if(e.protoCodes().includes(n))return!1;const t=e.decapsulateCode(s);return i.WebSocketsSecure.matches(t)&&i.DNS.matches(t.decapsulateCode(o).decapsulateCode(c))})),dnsWsOrWss:e=>e.filter((e=>{if(e.protoCodes().includes(n))return!1;const t=e.decapsulateCode(s);return i.WebSockets.matches(t)?i.DNS.matches(t.decapsulateCode(o).decapsulateCode(a)):i.WebSocketsSecure.matches(t)&&i.DNS.matches(t.decapsulateCode(o).decapsulateCode(c))}))}},{mafmt:"l1lok","./constants":"7O7y1"}],jtxJ4:[function(e,t,r){"use strict";const i=e("debug"),n=i("libp2p:webrtc-star");n.error=i("libp2p:webrtc-star:error");const{EventEmitter:s}=e("events"),o=e("err-code"),a=e("class-is"),{AbortError:c}=e("abortable-iterator"),u=e("libp2p-webrtc-peer"),{supportsWebRTCDataChannels:l}=e("ipfs-utils/src/supports"),{Multiaddr:d}=e("multiaddr"),f=e("mafmt"),h=e("peer-id"),{CODE_CIRCUIT:p}=e("./constants"),g=e("./listener"),y=e("./socket-to-conn"),{cleanMultiaddr:m,cleanUrlSIO:b}=e("./utils");function v(){}t.exports=a(class{constructor(e={}){if(!e.upgrader)throw new Error("An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.");this._upgrader=e.upgrader,this.sioOptions={transports:["websocket"],"force new connection":!0},e.wrtc&&(this.wrtc=e.wrtc),this.sigReferences=new Map,this.discovery=new s,this.discovery.tag="webRTCStar",this.discovery._isStarted=!1,this.discovery.start=()=>{this.discovery._isStarted=!0},this.discovery.stop=()=>{this.discovery._isStarted=!1},this._peerDiscovered=this._peerDiscovered.bind(this)}async dial(e,t={}){const r=await this._connect(e,t),i=y(r,{remoteAddr:e,signal:t.signal});n("new outbound connection %s",i.remoteAddr);const s=await this._upgrader.upgradeOutbound(i);return n("outbound connection %s upgraded",i.remoteAddr),s}_connect(e,t={}){if(t.signal&&t.signal.aborted)throw new c;const r={initiator:!0,trickle:!1,...t.spOptions||{}};this.wrtc&&(r.wrtc=this.wrtc);const i=e.toOptions(),s=(~~(1e9*Math.random())).toString(36)+Date.now();return new Promise(((a,l)=>{const d=this.sigReferences.get(b(e));if(!d||!d.listener)return l(o(new Error("unknown signal server to use"),"ERR_UNKNOWN_SIGNAL_SERVER"));const f=d.listener.io,h=Date.now();let p;n("dialing %s:%s",i.host,i.port);const g=new u(r),y=e=>{if(!p){const t=`connection error ${i.host}:${i.port}: ${e.message}`;n.error(t),_(e)}},m=()=>{n("connnection timeout %s:%s",i.host,i.port);const e=o(new Error(`connection timeout after ${Date.now()-h}ms`),"ERR_CONNECT_TIMEOUT");g.emit("error",e)},v=()=>{p=!0,n("connection opened %s:%s",i.host,i.port),_(null)},w=()=>{n.error("connection aborted %s:%s",i.host,i.port),g.destroy(),_(new c)},_=e=>{g.removeListener("timeout",m),g.removeListener("connect",v),t.signal&&t.signal.removeEventListener("abort",w),e?l(e):a(g)};g.on("error",y),g.once("timeout",m),g.once("connect",v),g.on("close",(()=>{g.removeListener("error",y)})),t.signal&&t.signal.addEventListener("abort",w),g.on("signal",(t=>{f.emit("ss-handshake",{intentId:s,srcMultiaddr:d.signallingAddr.toString(),dstMultiaddr:e.toString(),signal:t})})),f.on("ws-handshake",(e=>{e.intentId===s&&e.err&&(g.destroy(),l(o(e.err instanceof Error?e.err:new Error(e.err),"ERR_SIGNALLING_FAILED"))),e.intentId===s&&e.answer&&!g.destroyed&&g.signal(e.signal)}))}))}createListener(e={},t){if(!l&&!this.wrtc)throw o(new Error("no WebRTC support"),"ERR_NO_WEBRTC_SUPPORT");return"function"==typeof e&&(t=e,e={}),g({handler:t=t||v,upgrader:this._upgrader},this,e)}filter(e){return(e=Array.isArray(e)?e:[e]).filter((e=>!e.protoCodes().includes(p)&&f.WebRTCStar.matches(e)))}_peerDiscovered(e){if(!this.discovery._isStarted)return;n("Peer Discovered:",e),e=m(e);const t=new d(e),r=h.createFromB58String(t.getPeerId());this.discovery.emit("peer",{id:r,multiaddrs:[t]})}},{className:"WebRTCStar",symbolName:"@libp2p/js-libp2p-webrtc-star/webrtcstar"})},{debug:"bO5wM",events:"g82pp","err-code":"chZjB","class-is":"gx31A","abortable-iterator":"awlU8","libp2p-webrtc-peer":"kt3eh","ipfs-utils/src/supports":"3yyjP",multiaddr:"8Mu1u",mafmt:"l1lok","peer-id":"8Bdb3","./constants":"1IQXV","./listener":"bN3Nc","./socket-to-conn":"heHOu","./utils":"kfyaq"}],kt3eh:[function(e,t,r){
/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var i=e("debug")("simple-peer"),n=e("get-browser-rtc"),s=e("randombytes"),o=e("readable-stream"),a=e("queue-microtask"),c=e("err-code"),u=65536;function l(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}class d extends o.Duplex{constructor(e){if(super(e=Object.assign({allowHalfOpen:!1},e)),this._id=s(4).toString("hex").slice(0,7),this._debug("new peer %o",e),this.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,this.initiator=e.initiator||!1,this.channelConfig=e.channelConfig||d.channelConfig,this.negotiated=this.channelConfig.negotiated,this.config=Object.assign({},d.config,e.config),this.offerOptions=e.offerOptions||{},this.answerOptions=e.answerOptions||{},this.sdpTransform=e.sdpTransform||(e=>e),this.streams=e.streams||(e.stream?[e.stream]:[]),this.trickle=void 0===e.trickle||e.trickle,this.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,this.iceCompleteTimeout=e.iceCompleteTimeout||5e3,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:n(),!this._wrtc)throw"undefined"==typeof window?c(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):c(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!this.negotiated&&!this.initiator,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._firstStable=!0,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(e){return void a((()=>this.destroy(c(e,"ERR_PC_CONSTRUCTOR"))))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=e=>{this._onIceCandidate(e)},this.initiator||this.negotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=e=>{this._setupData(e)},this.streams&&this.streams.forEach((e=>{this.addStream(e)})),this._pc.ontrack=e=>{this._onTrack(e)},this.initiator&&this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(e){if(this.destroyed)throw c(new Error("cannot signal after peer is destroyed"),"ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then((()=>{this.destroyed||(this._pendingCandidates.forEach((e=>{this._addIceCandidate(e)})),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())})).catch((e=>{this.destroy(c(e,"ERR_SET_REMOTE_DESCRIPTION"))})),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.destroy(c(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}_addIceCandidate(e){var t=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(t).catch((e=>{var r;!t.address||t.address.endsWith(".local")?(r="Ignoring unsupported ICE candidate.",console.warn(r)):this.destroy(c(e,"ERR_ADD_ICE_CANDIDATE"))}))}send(e){this._channel.send(e)}addTransceiver(e,t){if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(c(e,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{transceiverRequest:{kind:e,init:t}})}addStream(e){this._debug("addStream()"),e.getTracks().forEach((t=>{this.addTrack(t,e)}))}addTrack(e,t){this._debug("addTrack()");var r=this._senderMap.get(e)||new Map,i=r.get(t);if(i)throw i.removed?c(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):c(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");i=this._pc.addTrack(e,t),r.set(t,i),this._senderMap.set(e,r),this._needsNegotiation()}replaceTrack(e,t,r){this._debug("replaceTrack()");var i=this._senderMap.get(e),n=i?i.get(r):null;if(!n)throw c(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");t&&this._senderMap.set(t,i),null!=n.replaceTrack?n.replaceTrack(t):this.destroy(c(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(e,t){this._debug("removeSender()");var r=this._senderMap.get(e),i=r?r.get(t):null;if(!i)throw c(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{i.removed=!0,this._pc.removeTrack(i)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(i):this.destroy(c(e,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(e){this._debug("removeSenders()"),e.getTracks().forEach((t=>{this.removeTrack(t,e)}))}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,a((()=>{this._batchedNegotiation=!1,this._debug("starting batched negotiation"),this.negotiate()})))}negotiate(){this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout((()=>{this._createOffer()}),0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{renegotiate:!0})),this._isNegotiating=!0}_destroy(e,t){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,t(e)}_setupData(e){if(!e.channel)return this.destroy(c(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=u),this.channelName=this._channel.label,this._channel.onmessage=e=>{this._onChannelMessage(e)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=e=>{this.destroy(c(e,"ERR_DATA_CHANNEL"))};var t=!1;this._closingInterval=setInterval((()=>{this._channel&&"closing"===this._channel.readyState?(t&&this._onChannelClose(),t=!0):t=!1}),5e3)}_read(){}_write(e,t,r){if(this.destroyed)return r(c(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(e)}catch(e){return this.destroy(c(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>u?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=r):r(null)}else this._debug("write before connect"),this._chunk=e,this._cb=r}_onFinish(){if(this.destroyed)return;const e=()=>{setTimeout((()=>this.destroy()),1e3)};this._connected?e():this.once("connect",e)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout((()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))}),this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then((e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=l(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(!this.destroyed){var t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp})}};this._pc.setLocalDescription(e).then((()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))})).catch((e=>{this.destroy(c(e,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((e=>{this.destroy(c(e,"ERR_CREATE_OFFER"))}))}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach((e=>{e.mid||!e.sender.track||e.requested||(e.requested=!0,this.addTransceiver(e.sender.track.kind))}))}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then((e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=l(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(!this.destroyed){var t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(e).then((()=>{this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))})).catch((e=>{this.destroy(c(e,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((e=>{this.destroy(c(e,"ERR_CREATE_ANSWER"))}))}_onConnectionStateChange(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(c(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(!this.destroyed){var e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),"connected"!==e&&"completed"!==e||(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.destroy(c(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.destroy(c(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}}getStats(e){const t=e=>("[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach((t=>{Object.assign(e,t)})),e);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then((r=>{var i=[];r.forEach((e=>{i.push(t(e))})),e(null,i)}),(t=>e(t))):this._pc.getStats.length>0?this._pc.getStats((r=>{if(!this.destroyed){var i=[];r.result().forEach((e=>{var r={};e.names().forEach((t=>{r[t]=e.stat(t)})),r.id=e.id,r.type=e.type,r.timestamp=e.timestamp,i.push(t(r))})),e(null,i)}}),(t=>e(t))):e(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const e=()=>{this.destroyed||this.getStats(((t,r)=>{if(this.destroyed)return;t&&(r=[]);var i={},n={},s={},o=!1;r.forEach((e=>{"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(n[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(s[e.id]=e)}));const a=e=>{o=!0;var t=n[e.localCandidateId];t&&(t.ip||t.address)?(this.localAddress=t.ip||t.address,this.localPort=Number(t.port)):t&&t.ipAddress?(this.localAddress=t.ipAddress,this.localPort=Number(t.portNumber)):"string"==typeof e.googLocalAddress&&(t=e.googLocalAddress.split(":"),this.localAddress=t[0],this.localPort=Number(t[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");var r=i[e.remoteCandidateId];r&&(r.ip||r.address)?(this.remoteAddress=r.ip||r.address,this.remotePort=Number(r.port)):r&&r.ipAddress?(this.remoteAddress=r.ipAddress,this.remotePort=Number(r.portNumber)):"string"==typeof e.googRemoteAddress&&(r=e.googRemoteAddress.split(":"),this.remoteAddress=r[0],this.remotePort=Number(r[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(r.forEach((e=>{"transport"===e.type&&e.selectedCandidatePairId&&a(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&a(e)})),o||Object.keys(s).length&&!Object.keys(n).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(t){return this.destroy(c(t,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');var u=this._cb;this._cb=null,u(null)}"number"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval((()=>this._onInterval()),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}else setTimeout(e,100)}))};e()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>u||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"!==this._pc.signalingState||this._firstStable||(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach((e=>{this._pc.removeTrack(e),this._queuedNegotiation=!0})),this._sendersAwaitingStable=[],this._queuedNegotiation&&(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()),this._debug("negotiate"),this.emit("negotiate")),this._firstStable=!1,this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(e){this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(e){if(!this.destroyed){var t=e.data;t instanceof ArrayBuffer&&(t=new Uint8Array(t)),this.push(t)}}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var e=this._cb;this._cb=null,e(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(e){this.destroyed||e.streams.forEach((t=>{this._debug("on track"),this.emit("track",e.track,t),this._remoteTracks.push({track:e.track,stream:t}),this._remoteStreams.some((e=>e.id===t.id))||(this._remoteStreams.push(t),a((()=>{this.emit("stream",t)})))}))}_debug(){var e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],i.apply(null,e)}}d.WEBRTC_SUPPORT=!!n(),d.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},d.channelConfig={},t.exports=d},{debug:"bO5wM","get-browser-rtc":"k3B3j",randombytes:"jH1v5","readable-stream":"w0M38","queue-microtask":"3aIgO","err-code":"l0zxT"}],k3B3j:[function(e,t,r){t.exports=function(){if("undefined"==typeof globalThis)return null;var e={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return e.RTCPeerConnection?e:null}},{}],jH1v5:[function(e,t,r){var i=arguments[3],n=e("process"),s=65536,o=4294967295;function a(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}var c=e("safe-buffer").Buffer,u=i.crypto||i.msCrypto;function l(e,t){if(e>o)throw new RangeError("requested too many random bytes");var r=c.allocUnsafe(e);if(e>0)if(e>s)for(var i=0;i<e;i+=s)u.getRandomValues(r.slice(i,i+s));else u.getRandomValues(r);return"function"==typeof t?n.nextTick((function(){t(null,r)})):r}u&&u.getRandomValues?t.exports=l:t.exports=a},{process:"bjUAi","safe-buffer":"lstjN"}],lstjN:[function(e,t,r){var i=e("buffer"),n=i.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(s(i,r),r.Buffer=o),s(n,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},{buffer:"etowf"}],l0zxT:[function(e,t,r){"use strict";function i(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}t.exports=function(e,t,r){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");r||(r={}),"object"==typeof t&&(r=t,t=void 0),null!=t&&(r.code=t);try{return i(e,r)}catch(t){r.message=e.message,r.stack=e.stack;const n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(e)),i(new n,r)}}},{}],"3yyjP":[function(e,t,r){"use strict";t.exports={supportsFileReader:"undefined"!=typeof self&&"FileReader"in self,supportsWebRTC:"RTCPeerConnection"in globalThis&&"undefined"!=typeof navigator&&void 0!==navigator.mediaDevices&&"getUserMedia"in navigator.mediaDevices,supportsWebRTCDataChannels:"RTCPeerConnection"in globalThis}},{}],"1IQXV":[function(e,t,r){"use strict";r.CODE_P2P=421,r.CODE_CIRCUIT=290,r.CLOSE_TIMEOUT=2e3},{}],bN3Nc:[function(e,t,r){"use strict";const i=e("events"),n=e("debug"),s=n("libp2p:webrtc-star:listener");s.error=n("libp2p:webrtc-star:listener:error");const o=e("err-code"),a=e("socket.io-client"),c=e("libp2p-webrtc-peer"),u=e("p-defer"),l=e("./socket-to-conn"),{cleanUrlSIO:d}=e("./utils"),{CODE_P2P:f}=e("./constants"),h={transports:["websocket"],"force new connection":!0,path:"/socket.io-next/"};t.exports=({handler:e,upgrader:t},r,n={})=>{const p=new i;let g,y;return p.__connections=[],p.__spChannels=new Map,p.__pendingIntents=new Map,p.listen=i=>{if(g)throw o(new Error("listener already in use"),"ERR_ALREADY_LISTENING");const m=u();let b;g=i,b=!i.protoCodes().includes(f)&&t.localPeer?i.encapsulate(`/p2p/${t.localPeer.toB58String()}`):i,p.on("error",(()=>m.reject())),y=d(i),s("Dialing to Signalling Server on: "+y),p.io=a.connect(y,h);return p.io.once("connect_error",(e=>m.reject(e))),p.io.once("error",(e=>{p.emit("error",e),p.emit("close")})),p.io.on("ws-handshake",(o=>{if(o.answer||o.err||!o.intentId)return;const a=o.intentId;let u=p.__pendingIntents.get(a);u||(u=[],p.__pendingIntents.set(a,u));let d=p.__spChannels.get(a);if(d)return void d.signal(o.signal);if("offer"!==o.signal.type)return void u.push(o);const h={trickle:!1,...n};r.wrtc&&(h.wrtc=r.wrtc),d=new c(h);const g=e=>{s.error("incoming connection errored",e)};d.on("error",g),d.once("close",((...e)=>{d.removeListener("error",g)})),d.on("signal",(e=>{o.signal=e,o.answer=!0,p.io.emit("ss-handshake",o)})),d.signal(o.signal);for(const e of u)d.signal(e.signal);p.__pendingIntents.set(a,[]),d.once("connect",(async()=>{const r=l(d);let n;s("new inbound connection %s",r.remoteAddr);try{n=await t.upgradeInbound(r)}catch(e){return s.error("inbound connection failed to upgrade",e),r.close()}if(!n.remoteAddr)try{n.remoteAddr=i.decapsulateCode(f).encapsulate(`/p2p/${n.remotePeer.toB58String()}`)}catch(e){s.error("could not determine remote address",e)}s("inbound connection %s upgraded",r.remoteAddr),function(e,t,r){e.__connections.push(t);const i=()=>{e.__connections=e.__connections.filter((e=>e!==t)),e.__spChannels.delete(r),e.__pendingIntents.delete(r)};t.conn.once("close",i)}(p,r,a),p.emit("connection",n),e(n)})),p.__spChannels.set(a,d)})),p.io.on("ws-peer",r._peerDiscovered),p.io.on("connect",(()=>{p.io.emit("ss-join",b.toString())})),p.io.once("connect",(()=>{p.emit("listening"),m.resolve()})),r.sigReferences.set(y,{listener:p,signallingAddr:b}),m.promise},p.close=async()=>{const e=r.sigReferences.get(y);e&&e.listener.io&&(e.listener.io.emit("ss-leave"),e.listener.io.close()),await Promise.all(p.__connections.map((e=>e.close()))),p.emit("close"),p.removeAllListeners(),g=void 0,r.sigReferences.delete(y)},p.getAddrs=()=>[g],p}},{events:"g82pp",debug:"bO5wM","err-code":"chZjB","socket.io-client":"iolK3","libp2p-webrtc-peer":"kt3eh","p-defer":"5rKSv","./socket-to-conn":"heHOu","./utils":"kfyaq","./constants":"1IQXV"}],iolK3:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"protocol",(()=>a.protocol)),i.export(r,"Manager",(()=>s.Manager)),i.export(r,"Socket",(()=>o.Socket)),i.export(r,"io",(()=>u)),i.export(r,"connect",(()=>u)),i.export(r,"default",(()=>u));var n=e("./url.js"),s=e("./manager.js"),o=e("./socket.js"),a=e("socket.io-parser");const c={};function u(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};const r=n.url(e,t.path||"/socket.io"),i=r.source,o=r.id,a=r.path,u=c[o]&&a in c[o].nsps;let l;return t.forceNew||t["force new connection"]||!1===t.multiplex||u?l=new s.Manager(i,t):(c[o]||(c[o]=new s.Manager(i,t)),l=c[o]),r.query&&!t.query&&(t.query=r.queryKey),l.socket(r.path,t)}Object.assign(u,{Manager:s.Manager,Socket:o.Socket,io:u,connect:u})},{"./url.js":"hHJao","./manager.js":"2S1kn","./socket.js":"6OhON","socket.io-parser":"5avRb","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],hHJao:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"url",(()=>o));var n=e("parseuri"),s=i.interopDefault(n);function o(e,t="",r){let i=e;r=r||"undefined"!=typeof location&&location,null==e&&(e=r.protocol+"//"+r.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?r.protocol+e:r.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==r?r.protocol+"//"+e:"https://"+e),i=s.default(e)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const n=-1!==i.host.indexOf(":")?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+t,i.href=i.protocol+"://"+n+(r&&r.port===i.port?"":":"+i.port),i}},{parseuri:"iXBlw","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],iXBlw:[function(e,t,r){var i=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(e){var t=e,r=e.indexOf("["),s=e.indexOf("]");-1!=r&&-1!=s&&(e=e.substring(0,r)+e.substring(r,s).replace(/:/g,";")+e.substring(s,e.length));for(var o,a,c=i.exec(e||""),u={},l=14;l--;)u[n[l]]=c[l]||"";return-1!=r&&-1!=s&&(u.source=t,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=function(e,t){var r=/\/{2,9}/g,i=t.replace(r,"/").split("/");"/"!=t.substr(0,1)&&0!==t.length||i.splice(0,1);"/"==t.substr(t.length-1,1)&&i.splice(i.length-1,1);return i}(0,u.path),u.queryKey=(o=u.query,a={},o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,r){t&&(a[t]=r)})),a),u}},{}],"2S1kn":[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"Manager",(()=>d));var n=e("engine.io-client"),s=e("./socket.js"),o=e("socket.io-parser"),a=e("./on.js"),c=e("backo2"),u=i.interopDefault(c),l=e("@socket.io/component-emitter");class d extends l.Emitter{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,n.installTimerFunctions(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(r=t.randomizationFactor)&&void 0!==r?r:.5),this.backoff=new u.default({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||o;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new n.Socket(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=a.on(t,"open",(function(){r.onopen(),e&&e()})),s=a.on(t,"error",(t=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",t),e?e(t):r.maybeReconnectOnOpen()}));if(!1!==this._timeout){const e=this._timeout;0===e&&i();const r=this.setTimeoutFn((()=>{i(),t.close(),t.emit("error",new Error("timeout"))}),e);this.opts.autoUnref&&r.unref(),this.subs.push((function(){clearTimeout(r)}))}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(a.on(e,"ping",this.onping.bind(this)),a.on(e,"data",this.ondata.bind(this)),a.on(e,"error",this.onerror.bind(this)),a.on(e,"close",this.onclose.bind(this)),a.on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){this.decoder.add(e)}ondecoded(e){this.emitReserved("packet",e)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r||(r=new s.Socket(this,e,t),this.nsps[e]=r),r}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&r.unref(),this.subs.push((function(){clearTimeout(r)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}},{"engine.io-client":"3bSox","./socket.js":"6OhON","socket.io-parser":"5avRb","./on.js":"8c8jd",backo2:"jE9JM","@socket.io/component-emitter":"kYHC2","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],"3bSox":[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"Socket",(()=>n.Socket)),i.export(r,"protocol",(()=>c)),i.export(r,"Transport",(()=>s.Transport)),i.export(r,"transports",(()=>o.transports)),i.export(r,"installTimerFunctions",(()=>a.installTimerFunctions));var n=e("./socket.js"),s=e("./transport.js"),o=e("./transports/index.js"),a=e("./util.js");const c=n.Socket.protocol},{"./socket.js":"7OyJL","./transport.js":"jdgVA","./transports/index.js":"ae41u","./util.js":"hj4iM","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],"7OyJL":[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"Socket",(()=>f));var n=e("./transports/index.js"),s=e("./util.js"),o=e("parseqs"),a=i.interopDefault(o),c=e("parseuri"),u=i.interopDefault(c),l=e("@socket.io/component-emitter"),d=e("engine.io-parser");class f extends l.Emitter{constructor(e,t={}){super(),e&&"object"==typeof e&&(t=e,e=null),e?(e=u.default(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=u.default(t.host).host),s.installTimerFunctions(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+"/","string"==typeof this.opts.query&&(this.opts.query=a.default.decode(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&addEventListener("beforeunload",(()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())}),!1),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close")},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=function(e){const t={};for(let r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}(this.opts.query);t.EIO=d.protocol,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new n.transports[e](r)}open(){let e;if(this.opts.rememberUpgrade&&f.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(()=>{this.onClose("transport close")}))}probe(e){let t=this.createTransport(e),r=!1;f.priorWebsocketSuccess=!1;const i=()=>{r||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!r)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;f.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{r||"closed"!==this.readyState&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function n(){r||(r=!0,u(),t.close(),t=null)}const s=e=>{const r=new Error("probe error: "+e);r.transport=t.name,n(),this.emitReserved("upgradeError",r)};function o(){s("transport closed")}function a(){s("socket closed")}function c(e){t&&e.name!==t.name&&n()}const u=()=>{t.removeListener("open",i),t.removeListener("error",s),t.removeListener("close",o),this.off("close",a),this.off("upgrading",c)};t.once("open",i),t.once("error",s),t.once("close",o),this.once("close",a),this.once("upgrading",c),t.open()}onOpen(){if(this.readyState="open",f.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emitReserved("flush"))}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,i){if("function"==typeof t&&(i=t,t=void 0),"function"==typeof r&&(i=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;const n={type:e,data:t,options:r};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?r():e()})):this.upgrading?r():e()),this}onError(e){f.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&removeEventListener("offline",this.offlineEventListener,!1),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let r=0;const i=e.length;for(;r<i;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}}f.protocol=d.protocol},{"./transports/index.js":"ae41u","./util.js":"hj4iM",parseqs:"kg931",parseuri:"iXBlw","@socket.io/component-emitter":"kYHC2","engine.io-parser":"mMYXv","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],ae41u:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"transports",(()=>s));var n=e("./polling-xhr.js");const s={websocket:e("./websocket.js").WS,polling:n.XHR}},{"./polling-xhr.js":"amf1l","./websocket.js":"iYHZM","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],amf1l:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"XHR",(()=>h)),i.export(r,"Request",(()=>p));var n=e("./xmlhttprequest.js"),s=i.interopDefault(n),o=e("../globalThis.js"),a=i.interopDefault(o),c=e("../util.js"),u=e("@socket.io/component-emitter"),l=e("./polling.js");function d(){}const f=null!=new s.default({xdomain:!1}).responseType;class h extends l.Polling{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let r=location.port;r||(r=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||r!==e.port,this.xs=e.secure!==t}const t=e&&e.forceBase64;this.supportsBinary=f&&!t}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new p(this.uri(),e)}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(e=>{this.onError("xhr post error",e)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e=>{this.onError("xhr poll error",e)})),this.pollXhr=e}}class p extends u.Emitter{constructor(e,t){super(),c.installTimerFunctions(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.create()}create(){const e=c.pick(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const t=this.xhr=new s.default(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&t.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(e){}if("POST"===this.method)try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{t.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{4===t.readyState&&(200===t.status||1223===t.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof t.status?t.status:0)}),0))},t.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=p.requestsCount++,p.requests[this.index]=this)}onSuccess(){this.emit("success"),this.cleanup()}onData(e){this.emit("data",e),this.onSuccess()}onError(e){this.emit("error",e),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=d,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete p.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&this.onData(e)}abort(){this.cleanup()}}if(p.requestsCount=0,p.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",g);else if("function"==typeof addEventListener){const e="onpagehide"in a.default?"pagehide":"unload";addEventListener(e,g,!1)}function g(){for(let e in p.requests)p.requests.hasOwnProperty(e)&&p.requests[e].abort()}},{"./xmlhttprequest.js":"fZPB9","../globalThis.js":"fLI8m","../util.js":"hj4iM","@socket.io/component-emitter":"kYHC2","./polling.js":"kT6ee","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],fZPB9:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r);var n=e("has-cors"),s=i.interopDefault(n),o=e("../globalThis.js"),a=i.interopDefault(o);r.default=function(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||s.default))return new XMLHttpRequest}catch(e){}if(!t)try{return new(a.default[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}},{"has-cors":"f7en3","../globalThis.js":"fLI8m","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],f7en3:[function(e,t,r){try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){t.exports=!1}},{}],fLI8m:[function(e,t,r){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(r),r.default="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")()},{"@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],hj4iM:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"pick",(()=>o)),i.export(r,"installTimerFunctions",(()=>u));var n=e("./globalThis.js"),s=i.interopDefault(n);function o(e,...t){return t.reduce(((t,r)=>(e.hasOwnProperty(r)&&(t[r]=e[r]),t)),{})}const a=setTimeout,c=clearTimeout;function u(e,t){t.useNativeTimers?(e.setTimeoutFn=a.bind(s.default),e.clearTimeoutFn=c.bind(s.default)):(e.setTimeoutFn=setTimeout.bind(s.default),e.clearTimeoutFn=clearTimeout.bind(s.default))}},{"./globalThis.js":"fLI8m","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],kYHC2:[function(e,t,r){function i(e){if(e)return function(e){for(var t in i.prototype)e[t]=i.prototype[t];return e}(e)}r.Emitter=i,i.prototype.on=i.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},i.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var n=0;n<i.length;n++)if((r=i[n])===t||r.fn===t){i.splice(n,1);break}return 0===i.length&&delete this._callbacks["$"+e],this},i.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(r){i=0;for(var n=(r=r.slice(0)).length;i<n;++i)r[i].apply(this,t)}return this},i.prototype.emitReserved=i.prototype.emit,i.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},i.prototype.hasListeners=function(e){return!!this.listeners(e).length}},{}],kT6ee:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"Polling",(()=>l));var n=e("../transport.js"),s=e("yeast"),o=i.interopDefault(s),a=e("parseqs"),c=i.interopDefault(a),u=e("engine.io-parser");class l extends n.Transport{constructor(){super(...arguments),this.polling=!1}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emit("poll")}onData(e){u.decodePayload(e,this.socket.binaryType).forEach((e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose(),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,u.encodePayload(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emit("drain")}))}))}uri(){let e=this.query||{};const t=this.opts.secure?"https":"http";let r="";!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=o.default()),this.supportsBinary||e.sid||(e.b64=1),this.opts.port&&("https"===t&&443!==Number(this.opts.port)||"http"===t&&80!==Number(this.opts.port))&&(r=":"+this.opts.port);const i=c.default.encode(e);return t+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}}},{"../transport.js":"jdgVA",yeast:"da0sk",parseqs:"kg931","engine.io-parser":"mMYXv","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],jdgVA:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"Transport",(()=>a));var n=e("engine.io-parser"),s=e("@socket.io/component-emitter"),o=e("./util.js");class a extends s.Emitter{constructor(e){super(),this.writable=!1,o.installTimerFunctions(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,t){const r=new Error(e);return r.type="TransportError",r.description=t,super.emit("error",r),this}open(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emit("open")}onData(e){const t=n.decodePacket(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emit("packet",e)}onClose(){this.readyState="closed",super.emit("close")}}},{"engine.io-parser":"mMYXv","@socket.io/component-emitter":"kYHC2","./util.js":"hj4iM","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],mMYXv:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"protocol",(()=>d)),i.export(r,"encodePacket",(()=>s.default)),i.export(r,"encodePayload",(()=>u)),i.export(r,"decodePacket",(()=>a.default)),i.export(r,"decodePayload",(()=>l));var n=e("./encodePacket.js"),s=i.interopDefault(n),o=e("./decodePacket.js"),a=i.interopDefault(o);const c=String.fromCharCode(30),u=(e,t)=>{const r=e.length,i=new Array(r);let n=0;e.forEach(((e,o)=>{s.default(e,!1,(e=>{i[o]=e,++n===r&&t(i.join(c))}))}))},l=(e,t)=>{const r=e.split(c),i=[];for(let e=0;e<r.length;e++){const n=a.default(r[e],t);if(i.push(n),"error"===n.type)break}return i},d=4},{"./encodePacket.js":"2PJ33","./decodePacket.js":"dGiro","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],"2PJ33":[function(e,t,r){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(r);var i=e("./commons.js");const n="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),s="function"==typeof ArrayBuffer,o=(e,t)=>{const r=new FileReader;return r.onload=function(){const e=r.result.split(",")[1];t("b"+e)},r.readAsDataURL(e)};r.default=({type:e,data:t},r,a)=>{return n&&t instanceof Blob?r?a(t):o(t,a):s&&(t instanceof ArrayBuffer||(c=t,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(c):c&&c.buffer instanceof ArrayBuffer))?r?a(t):o(new Blob([t]),a):a(i.PACKET_TYPES[e]+(t||""));var c}},{"./commons.js":"2D0Nf","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],"2D0Nf":[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"PACKET_TYPES",(()=>n)),i.export(r,"PACKET_TYPES_REVERSE",(()=>s)),i.export(r,"ERROR_PACKET",(()=>o));const n=Object.create(null);n.open="0",n.close="1",n.ping="2",n.pong="3",n.message="4",n.upgrade="5",n.noop="6";const s=Object.create(null);Object.keys(n).forEach((e=>{s[n[e]]=e}));const o={type:"error",data:"parser error"}},{"@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],dGiro:[function(e,t,r){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(r);var i=e("./commons.js"),n=e("base64-arraybuffer");const s="function"==typeof ArrayBuffer,o=(e,t)=>{if(s){const r=n.decode(e);return a(r,t)}return{base64:!0,data:e}},a=(e,t)=>"blob"===t&&e instanceof ArrayBuffer?new Blob([e]):e;r.default=(e,t)=>{if("string"!=typeof e)return{type:"message",data:a(e,t)};const r=e.charAt(0);if("b"===r)return{type:"message",data:o(e.substring(1),t)};return i.PACKET_TYPES_REVERSE[r]?e.length>1?{type:i.PACKET_TYPES_REVERSE[r],data:e.substring(1)}:{type:i.PACKET_TYPES_REVERSE[r]}:i.ERROR_PACKET}},{"./commons.js":"2D0Nf","base64-arraybuffer":"h2Zgn","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],h2Zgn:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"decode",(()=>c)),i.export(r,"encode",(()=>a));for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s="undefined"==typeof Uint8Array?[]:new Uint8Array(256),o=0;o<n.length;o++)s[n.charCodeAt(o)]=o;var a=function(e){var t,r=new Uint8Array(e),i=r.length,s="";for(t=0;t<i;t+=3)s+=n[r[t]>>2],s+=n[(3&r[t])<<4|r[t+1]>>4],s+=n[(15&r[t+1])<<2|r[t+2]>>6],s+=n[63&r[t+2]];return i%3==2?s=s.substring(0,s.length-1)+"=":i%3==1&&(s=s.substring(0,s.length-2)+"=="),s},c=function(e){var t,r,i,n,o,a=.75*e.length,c=e.length,u=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var l=new ArrayBuffer(a),d=new Uint8Array(l);for(t=0;t<c;t+=4)r=s[e.charCodeAt(t)],i=s[e.charCodeAt(t+1)],n=s[e.charCodeAt(t+2)],o=s[e.charCodeAt(t+3)],d[u++]=r<<2|i>>4,d[u++]=(15&i)<<4|n>>2,d[u++]=(3&n)<<6|63&o;return l}},{"@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],da0sk:[function(e,t,r){"use strict";var i,n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),s={},o=0,a=0;function c(e){var t="";do{t=n[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function u(){var e=c(+new Date);return e!==i?(o=0,i=e):e+"."+c(o++)}for(;a<64;a++)s[n[a]]=a;u.encode=c,u.decode=function(e){var t=0;for(a=0;a<e.length;a++)t=64*t+s[e.charAt(a)];return t},t.exports=u},{}],kg931:[function(e,t,r){r.encode=function(e){var t="";for(var r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t},r.decode=function(e){for(var t={},r=e.split("&"),i=0,n=r.length;i<n;i++){var s=r[i].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}},{}],iYHZM:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"WS",(()=>p));var n=e("../transport.js"),s=e("parseqs"),o=i.interopDefault(s),a=e("yeast"),c=i.interopDefault(a),u=e("../util.js"),l=e("./websocket-constructor.js"),d=e("engine.io-parser"),f=e("buffer").Buffer;const h="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class p extends n.Transport{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,r=h?{}:u.pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=l.usingBrowserWebSocket&&!h?t?new l.WebSocket(e,t):new l.WebSocket(e):new l.WebSocket(e,t,r)}catch(e){return this.emit("error",e)}this.ws.binaryType=this.socket.binaryType||l.defaultBinaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=this.onClose.bind(this),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],i=t===e.length-1;d.encodePacket(r,this.supportsBinary,(e=>{const t={};if(!l.usingBrowserWebSocket&&(r.options&&(t.compress=r.options.compress),this.opts.perMessageDeflate)){("string"==typeof e?f.byteLength(e):e.length)<this.opts.perMessageDeflate.threshold&&(t.compress=!1)}try{l.usingBrowserWebSocket?this.ws.send(e):this.ws.send(e,t)}catch(e){}i&&l.nextTick((()=>{this.writable=!0,this.emit("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const t=this.opts.secure?"wss":"ws";let r="";this.opts.port&&("wss"===t&&443!==Number(this.opts.port)||"ws"===t&&80!==Number(this.opts.port))&&(r=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=c.default()),this.supportsBinary||(e.b64=1);const i=o.default.encode(e);return t+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}check(){return!(!l.WebSocket||"__initialize"in l.WebSocket&&this.name===p.prototype.name)}}},{buffer:"etowf","../transport.js":"jdgVA",parseqs:"kg931",yeast:"da0sk","../util.js":"hj4iM","./websocket-constructor.js":"eTlGe","engine.io-parser":"mMYXv","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],eTlGe:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"nextTick",(()=>o)),i.export(r,"WebSocket",(()=>a)),i.export(r,"usingBrowserWebSocket",(()=>c)),i.export(r,"defaultBinaryType",(()=>u));var n=e("../globalThis.js"),s=i.interopDefault(n);const o="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),a=s.default.WebSocket||s.default.MozWebSocket,c=!0,u="arraybuffer"},{"../globalThis.js":"fLI8m","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],"6OhON":[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"Socket",(()=>c));var n=e("socket.io-parser"),s=e("./on.js"),o=e("@socket.io/component-emitter");const a=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class c extends o.Emitter{constructor(e,t,r){super(),this.connected=!1,this.disconnected=!0,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this.io._autoConnect&&this.open()}subEvents(){if(this.subs)return;const e=this.io;this.subs=[s.on(e,"open",this.onopen.bind(this)),s.on(e,"packet",this.onpacket.bind(this)),s.on(e,"error",this.onerror.bind(this)),s.on(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(a.hasOwnProperty(e))throw new Error('"'+e+'" is a reserved event name');t.unshift(e);const r={type:n.PacketType.EVENT,data:t,options:{}};if(r.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,i=t.pop();this._registerAckCallback(e,i),r.id=e}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?this.packet(r):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,t){const r=this.flags.timeout;if(void 0===r)return void(this.acks[e]=t);const i=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))}),r);this.acks[e]=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,[null,...e])}}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this.packet({type:n.PacketType.CONNECT,data:e})})):this.packet({type:n.PacketType.CONNECT,data:this.auth})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e){this.connected=!1,this.disconnected=!0,delete this.id,this.emitReserved("disconnect",e)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case n.PacketType.CONNECT:if(e.data&&e.data.sid){const t=e.data.sid;this.onconnect(t)}else this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case n.PacketType.EVENT:case n.PacketType.BINARY_EVENT:this.onevent(e);break;case n.PacketType.ACK:case n.PacketType.BINARY_ACK:this.onack(e);break;case n.PacketType.DISCONNECT:this.ondisconnect();break;case n.PacketType.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const r of t)r.apply(this,e)}super.emit.apply(this,e)}ack(e){const t=this;let r=!1;return function(...i){r||(r=!0,t.packet({type:n.PacketType.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e){this.id=e,this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>this.packet(e))),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:n.PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}}},{"socket.io-parser":"5avRb","./on.js":"8c8jd","@socket.io/component-emitter":"kYHC2","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],"5avRb":[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"protocol",(()=>a)),i.export(r,"PacketType",(()=>c)),i.export(r,"Encoder",(()=>l)),i.export(r,"Decoder",(()=>d));var n=e("@socket.io/component-emitter"),s=e("./binary.js"),o=e("./is-binary.js");const a=5;var c,u;(u=c||(c={}))[u.CONNECT=0]="CONNECT",u[u.DISCONNECT=1]="DISCONNECT",u[u.EVENT=2]="EVENT",u[u.ACK=3]="ACK",u[u.CONNECT_ERROR=4]="CONNECT_ERROR",u[u.BINARY_EVENT=5]="BINARY_EVENT",u[u.BINARY_ACK=6]="BINARY_ACK";class l{encode(e){return e.type!==c.EVENT&&e.type!==c.ACK||!o.hasBinary(e)?[this.encodeAsString(e)]:(e.type=e.type===c.EVENT?c.BINARY_EVENT:c.BINARY_ACK,this.encodeAsBinary(e))}encodeAsString(e){let t=""+e.type;return e.type!==c.BINARY_EVENT&&e.type!==c.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data)),t}encodeAsBinary(e){const t=s.deconstructPacket(e),r=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(r),i}}class d extends n.Emitter{constructor(){super()}add(e){let t;if("string"==typeof e)t=this.decodeString(e),t.type===c.BINARY_EVENT||t.type===c.BINARY_ACK?(this.reconstructor=new f(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t);else{if(!o.isBinary(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const r={type:Number(e.charAt(0))};if(void 0===c[r.type])throw new Error("unknown packet type "+r.type);if(r.type===c.BINARY_EVENT||r.type===c.BINARY_ACK){const i=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const n=e.substring(i,t);if(n!=Number(n)||"-"!==e.charAt(t))throw new Error("Illegal attachments");r.attachments=Number(n)}if("/"===e.charAt(t+1)){const i=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}r.nsp=e.substring(i,t)}else r.nsp="/";const i=e.charAt(t+1);if(""!==i&&Number(i)==i){const i=t+1;for(;++t;){const r=e.charAt(t);if(null==r||Number(r)!=r){--t;break}if(t===e.length)break}r.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=function(e){try{return JSON.parse(e)}catch(e){return!1}}(e.substr(t));if(!d.isPayloadValid(r.type,i))throw new Error("invalid payload");r.data=i}return r}static isPayloadValid(e,t){switch(e){case c.CONNECT:return"object"==typeof t;case c.DISCONNECT:return void 0===t;case c.CONNECT_ERROR:return"string"==typeof t||"object"==typeof t;case c.EVENT:case c.BINARY_EVENT:return Array.isArray(t)&&t.length>0;case c.ACK:case c.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}class f{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=s.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}},{"@socket.io/component-emitter":"kYHC2","./binary.js":"c0isJ","./is-binary.js":"2y0fk","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],c0isJ:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"deconstructPacket",(()=>s)),i.export(r,"reconstructPacket",(()=>a));var n=e("./is-binary.js");function s(e){const t=[],r=e.data,i=e;return i.data=o(r,t),i.attachments=t.length,{packet:i,buffers:t}}function o(e,t){if(!e)return e;if(n.isBinary(e)){const r={_placeholder:!0,num:t.length};return t.push(e),r}if(Array.isArray(e)){const r=new Array(e.length);for(let i=0;i<e.length;i++)r[i]=o(e[i],t);return r}if("object"==typeof e&&!(e instanceof Date)){const r={};for(const i in e)e.hasOwnProperty(i)&&(r[i]=o(e[i],t));return r}return e}function a(e,t){return e.data=c(e.data,t),e.attachments=void 0,e}function c(e,t){if(!e)return e;if(e&&e._placeholder)return t[e.num];if(Array.isArray(e))for(let r=0;r<e.length;r++)e[r]=c(e[r],t);else if("object"==typeof e)for(const r in e)e.hasOwnProperty(r)&&(e[r]=c(e[r],t));return e}},{"./is-binary.js":"2y0fk","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],"2y0fk":[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"isBinary",(()=>c)),i.export(r,"hasBinary",(()=>u));const n="function"==typeof ArrayBuffer,s=Object.prototype.toString,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===s.call(Blob),a="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===s.call(File);function c(e){return n&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||o&&e instanceof Blob||a&&e instanceof File}function u(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,r=e.length;t<r;t++)if(u(e[t]))return!0;return!1}if(c(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return u(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&u(e[t]))return!0;return!1}},{"@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],"8c8jd":[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");function n(e,t,r){return e.on(t,r),function(){e.off(t,r)}}i.defineInteropFlag(r),i.export(r,"on",(()=>n))},{"@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],jE9JM:[function(e,t,r){function i(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}t.exports=i,i.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-r:e+r}return 0|Math.min(e,this.max)},i.prototype.reset=function(){this.attempts=0},i.prototype.setMin=function(e){this.ms=e},i.prototype.setMax=function(e){this.max=e},i.prototype.setJitter=function(e){this.jitter=e}},{}],heHOu:[function(e,t,r){"use strict";const i=e("abortable-iterator"),n=e("stream-to-it"),{CLOSE_TIMEOUT:s}=e("./constants"),o=e("libp2p-utils/src/ip-port-to-multiaddr"),a=e("debug"),c=a("libp2p:webrtc-star:socket");c.error=a("libp2p:webrtc-star:socket:error");const u=(e,t)=>{if(e&&t)try{return o(e,t)}catch(e){return c.error(e),o("0.0.0.0",t)}};t.exports=(e,t={})=>{const{sink:r,source:o}=n.duplex(e),a=t.remoteAddr||u(e.remoteAddress,e.remotePort),l=u(e.localAddress,e.localPort),d={async sink(e){t.signal&&(e=i(e,t.signal));try{await r(async function*(){for await(const t of e)yield t instanceof Uint8Array?t:t.slice()}())}catch(e){"aborted"!==e.type&&c.error(e)}},source:t.signal?i(o,t.signal):o,conn:e,localAddr:l,remoteAddr:a,timeline:{open:Date.now()},close(){if(!e.destroyed)return new Promise(((t,r)=>{const i=Date.now(),n=setTimeout((()=>{if(d.remoteAddr){const{host:e,port:t}=d.remoteAddr.toOptions();c("timeout closing socket to %s:%s after %dms, destroying it manually",e,t,Date.now()-i)}e.destroyed||e.destroy()}),s);e.once("close",(()=>{t()})),e.end((e=>{if(clearTimeout(n),d.timeline.close=Date.now(),e)return r(e)}))}))}};return e.once("close",(()=>{d.timeline.close||(d.timeline.close=Date.now())})),d}},{"abortable-iterator":"awlU8","stream-to-it":"8tF2x","./constants":"1IQXV","libp2p-utils/src/ip-port-to-multiaddr":"WM46A",debug:"bO5wM"}],"8tF2x":[function(e,t,r){t.exports=e("./source"),t.exports.source=e("./source"),t.exports.sink=e("./sink"),t.exports.transform=e("./transform"),t.exports.duplex=e("./duplex")},{"./source":"7664L","./sink":"5VmJ6","./transform":"9Vbep","./duplex":"dkoqM"}],"5VmJ6":[function(e,t,r){const i=e("get-iterator");t.exports=e=>async t=>{t=i(t);const r=e=>{"function"==typeof e.return&&e.return()};let n=null,s=null;const o=e=>{n=e,s&&s(e),r(t)};let a=null,c=!1;const u=()=>{c=!0,a&&a()};let l=null,d=!1;const f=()=>{d=!0,l&&l()};let h=null;const p=()=>{h&&h()};e.once("error",o),e.once("close",u),e.once("finish",f);try{for await(const r of t){if(!e.writable||e.destroyed||n)break;!1===e.write(r)&&await new Promise(((t,r)=>{a=h=t,s=r,e.once("drain",p)}))}}catch(t){n||e.destroy(),n=t}try{if(e.writable&&e.end(),await(r(t),new Promise(((e,t)=>{if(c||d||n)return e();l=a=e,s=t}))),n)throw n}finally{e.removeListener("error",o),e.removeListener("close",u),e.removeListener("finish",f),e.removeListener("drain",p)}}},{"get-iterator":"li8y1"}],"9Vbep":[function(e,t,r){const i=e("./duplex");t.exports=e=>async function*(t){const r=i(e);let n;if(r.sink(t).catch((e=>{n=e})),yield*r.source,n)throw n}},{"./duplex":"dkoqM"}],dkoqM:[function(e,t,r){const i=e("./sink"),n=e("./source");t.exports=e=>({sink:i(e),source:n(e)})},{"./sink":"5VmJ6","./source":"7664L"}],kfyaq:[function(e,t,r){"use strict";const{Multiaddr:i}=e("multiaddr");t.exports={cleanUrlSIO:function(e){const t=e.toString().split("/"),r=e.protos()[1].name,n=e.protos()[2].name,s=e.stringTuples()[1][1];if("tcp"!==r||"ws"!==n&&"wss"!==n)throw new Error("invalid multiaddr: "+e.toString());return i.isName(e)?"ws"===n?"http://"+t[2]+("80"===s?"":":"+s):"wss"===n?"https://"+t[2]+("443"===s?"":":"+s):void 0:"http://"+t[2]+":"+t[4]},cleanMultiaddr:function(e){const t="/libp2p-webrtc-star";if(-1!==e.indexOf(t)){e=e.substring(t.length,e.length);let r=new i(e);const n=r.stringTuples().filter((e=>421===e[0]))[0];r=r.decapsulate("p2p"),r=r.encapsulate("/p2p-webrtc-star"),r=r.encapsulate(`/p2p/${n[1]}`),e=r.toString()}return e}}},{multiaddr:"8Mu1u"}],"6n2fc":[function(e,t,r){"use strict";t.exports=e("./mplex")},{"./mplex":"bdx0L"}],bdx0L:[function(e,t,r){"use strict";const i=e("it-pipe"),n=e("it-pushable"),s=e("debug")("libp2p:mplex"),o=e("abortable-iterator"),a=e("./coder"),c=e("./restrict-size"),{MessageTypes:u,MessageTypeNames:l}=e("./message-types"),d=e("./stream");class f{constructor(e){e="function"==typeof(e=e||{})?{onStream:e}:e,this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._options=e,this.sink=this._createSink(),this.source=this._createSource(),this.onStream=e.onStream,this.onStreamEnd=e.onStreamEnd}get streams(){const e=[];return this._streams.initiators.forEach((t=>{e.push(t)})),this._streams.receivers.forEach((t=>{e.push(t)})),e}newStream(e){const t=this._streamId++;e=null==e?t.toString():String(e);const r=this._streams.initiators;return this._newStream({id:t,name:e,type:"initiator",registry:r})}_newReceiverStream({id:e,name:t}){const r=this._streams.receivers;return this._newStream({id:e,name:t,type:"receiver",registry:r})}_newStream({id:e,name:t,type:r,registry:i}){if(i.has(e))throw new Error(`${r} stream ${e} already exists!`);s("new %s stream %s %s",r,e,t);const n=d({id:e,name:t,send:i=>(s.enabled&&s("%s stream %s %s send",r,e,t,{...i,type:l[i.type],data:i.data&&i.data.slice()}),this.source.push(i)),type:r,onEnd:()=>{s("%s stream %s %s ended",r,e,t),i.delete(e),this.onStreamEnd&&this.onStreamEnd(n)},maxMsgSize:this._options.maxMsgSize});return i.set(e,n),n}_createSink(){return async e=>{this._options.signal&&(e=o(e,this._options.signal));try{await i(e,a.decode,c(this._options.maxMsgSize),(async e=>{for await(const t of e)for(const e of t)this._handleIncoming(e)}))}catch(e){return s("error in sink",e),this.source.end(e)}this.source.end()}}_createSource(){const e=n({onEnd:e=>{const{initiators:t,receivers:r}=this._streams;for(const r of t.values())r.abort(e);for(const t of r.values())t.abort(e)},writev:!0});return Object.assign(a.encode(e),{push:e.push,end:e.end,return:e.return})}_handleIncoming({id:e,type:t,data:r}){if(s.enabled&&s("incoming message",{id:e,type:l[t],data:r.slice()}),t===u.NEW_STREAM&&this.onStream){const t=this._newReceiverStream({id:e,name:r.toString()});return this.onStream(t)}const i=(1&t?this._streams.initiators:this._streams.receivers).get(e);if(!i)return s("missing stream %s",e);switch(t){case u.MESSAGE_INITIATOR:case u.MESSAGE_RECEIVER:i.source.push(r);break;case u.CLOSE_INITIATOR:case u.CLOSE_RECEIVER:i.close();break;case u.RESET_INITIATOR:case u.RESET_RECEIVER:i.reset();break;default:s("unknown message type %s",t)}}}f.multicodec="/mplex/6.7.0",t.exports=f},{"it-pipe":"giKBQ","it-pushable":"bnpei",debug:"bO5wM","abortable-iterator":"awlU8","./coder":"7KKkK","./restrict-size":"aHge1","./message-types":"guJdt","./stream":"eKb79"}],"7KKkK":[function(e,t,r){"use strict";r.encode=e("./encode"),r.decode=e("./decode")},{"./encode":"7SPKN","./decode":"5DYd5"}],"7SPKN":[function(e,t,r){"use strict";const i=e("varint"),n=e("bl/BufferList"),s=10240;const o=new class{constructor(){this._pool=new Uint8Array(s),this._poolOffset=0}write(e){const t=this._pool;let r=this._poolOffset;i.encode(e.id<<3|e.type,t,r),r+=i.encode.bytes,i.encode(e.data?e.data.length:0,t,r),r+=i.encode.bytes;const n=t.subarray(this._poolOffset,r);return s-r<100?(this._pool=new Uint8Array(s),this._poolOffset=0):this._poolOffset=r,e.data?[n,e.data]:n}};t.exports=e=>async function*(){for await(const t of e)Array.isArray(t)?yield new n(t.map((e=>o.write(e)))):yield new n(o.write(t))}()},{varint:"aN1CO","bl/BufferList":"im7j6"}],"5DYd5":[function(e,t,r){"use strict";const i=e("varint"),n=e("bl/BufferList");t.exports=e=>async function*(){const t=new s;for await(const r of e){const e=t.write(r);e.length&&(yield e)}}();class s{constructor(){this._buffer=new n,this._bufferProxy=new Proxy({},{get:(e,t)=>"l"===t[0]?this._buffer[t]:this._buffer.get(parseInt(t))}),this._headerInfo=null}write(e){if(!e||!e.length)return[];this._buffer.append(e);const t=[];for(;;){if(!this._headerInfo)try{this._headerInfo=this._decodeHeader(this._bufferProxy)}catch(e){break}const{id:e,type:r,length:i,offset:n}=this._headerInfo;if(this._buffer.length-n<i)break;t.push({id:e,type:r,data:this._buffer.shallowSlice(n,n+i)}),this._buffer.consume(n+i),this._headerInfo=null}return t}_decodeHeader(e){const t=i.decode(e);let r=i.decode.bytes;const n=i.decode(e,r);return r+=i.decode.bytes,{id:t>>3,type:7&t,offset:r,length:n}}}},{varint:"aN1CO","bl/BufferList":"im7j6"}],aHge1:[function(e,t,r){"use strict";const i=1048576;t.exports=e=>{e=e||i;const t=t=>{if(t.data&&t.data.length>e)throw Object.assign(new Error("message size too large!"),{code:"ERR_MSG_TOO_BIG"})};return e=>async function*(){for await(const r of e)Array.isArray(r)?r.forEach(t):t(r),yield r}()},t.exports.MAX_MSG_SIZE=i},{}],guJdt:[function(e,t,r){"use strict";const i=Object.freeze({NEW_STREAM:0,MESSAGE_RECEIVER:1,MESSAGE_INITIATOR:2,CLOSE_RECEIVER:3,CLOSE_INITIATOR:4,RESET_RECEIVER:5,RESET_INITIATOR:6});r.MessageTypes=i,r.InitiatorMessageTypes=Object.freeze({NEW_STREAM:i.NEW_STREAM,MESSAGE:i.MESSAGE_INITIATOR,CLOSE:i.CLOSE_INITIATOR,RESET:i.RESET_INITIATOR}),r.ReceiverMessageTypes=Object.freeze({MESSAGE:i.MESSAGE_RECEIVER,CLOSE:i.CLOSE_RECEIVER,RESET:i.RESET_RECEIVER}),r.MessageTypeNames=Object.freeze(Object.entries(i).reduce(((e,t)=>(e[t[1]]=t[0],e)),{}))},{}],eKb79:[function(e,t,r){"use strict";const i=e("abortable-iterator"),n=e("abort-controller"),s=e("debug")("libp2p:mplex:stream"),o=e("it-pushable"),a=e("bl/BufferList"),c=e("err-code"),{MAX_MSG_SIZE:u}=e("./restrict-size"),{InitiatorMessageTypes:l,ReceiverMessageTypes:d}=e("./message-types"),f="ERR_MPLEX_STREAM_RESET";t.exports=({id:e,name:t,send:r,onEnd:h=(()=>{}),type:p="initiator",maxMsgSize:g=u})=>{const y=new n,m=new n,b="initiator"===p?l:d,v="initiator"===p?`i${e}`:`r${e}`;t=String(null==t?e:t);let w,_=!1,E=!1;const S=e=>{E||(E=!0,s("%s stream %s sink end",p,t,e),e&&!w&&(w=e),_&&(T.timeline.close=Date.now(),h(w)))},T={close:()=>T.source.end(),abort:e=>{s("%s stream %s abort",p,t,e),T.source.end(e),y.abort(),S(e)},reset:()=>{const e=c(new Error("stream reset"),f);m.abort(),T.source.end(e),S(e)},sink:async n=>{n=i(n,[{signal:y.signal,options:{abortMessage:"stream aborted",abortCode:"ERR_MPLEX_STREAM_ABORT"}},{signal:m.signal,options:{abortMessage:"stream reset",abortCode:f}}]),"initiator"===p&&r({id:e,type:b.NEW_STREAM,data:t});try{for await(let t of n)for(;t.length;){if(t.length<=g){r({id:e,type:b.MESSAGE,data:t});break}t=a.isBufferList(t)?t:new a(t),r({id:e,type:b.MESSAGE,data:t.shallowSlice(0,g)}),t.consume(g)}}catch(i){return i.code===f?s("%s stream %s reset",p,t):(s("%s stream %s error",p,t,i),r({id:e,type:b.RESET})),T.source.end(i),S(i)}r({id:e,type:b.CLOSE}),S()},source:o((e=>{_||(_=!0,s("%s stream %s source end",p,t,e),e&&!w&&(w=e),E&&(T.timeline.close=Date.now(),h(w)))})),timeline:{open:Date.now(),close:null},id:v};return T}},{"abortable-iterator":"awlU8","abort-controller":"lNJ7z",debug:"bO5wM","it-pushable":"bnpei","bl/BufferList":"im7j6","err-code":"chZjB","./restrict-size":"aHge1","./message-types":"guJdt"}],"5JB8e":[function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.NOISE=void 0;const s=e("./noise");n(e("./noise"),r),r.NOISE=new s.Noise},{"./noise":"j7J44"}],j7J44:[function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Noise=void 0;const a=s(e("@stablelib/x25519")),c=e("buffer"),u=o(e("it-pb-rpc")),l=o(e("it-pair/duplex")),d=o(e("it-buffer")),f=o(e("it-pipe")),h=e("it-length-prefixed"),p=e("./handshake-xx"),g=e("./handshake-ik"),y=e("./handshake-xx-fallback"),m=e("./utils"),b=e("./encoder"),v=e("./crypto"),w=e("./keycache"),_=e("./logger"),E=e("./constants");r.Noise=class{constructor(e,t){if(this.protocol="/noise",this.prologue=c.Buffer.alloc(0),this.earlyData=null!=t?t:c.Buffer.alloc(0),this.useNoisePipes=!1,e){const t=a.generateKeyPairFromSeed(e);this.staticKeys={privateKey:c.Buffer.from(t.secretKey.buffer,t.secretKey.byteOffset,t.secretKey.length),publicKey:c.Buffer.from(t.publicKey.buffer,t.publicKey.byteOffset,t.publicKey.length)}}else this.staticKeys=m.generateKeypair()}async secureOutbound(e,t,r){const i=u.default(t,{lengthEncoder:b.uint16BEEncode,lengthDecoder:b.uint16BEDecode,maxDataLength:E.NOISE_MSG_MAX_LENGTH_BYTES}),n=await this.performHandshake({connection:i,isInitiator:!0,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(i,n),remoteEarlyData:n.remoteEarlyData,remotePeer:n.remotePeer}}async secureInbound(e,t,r){const i=u.default(t,{lengthEncoder:b.uint16BEEncode,lengthDecoder:b.uint16BEDecode,maxDataLength:E.NOISE_MSG_MAX_LENGTH_BYTES}),n=await this.performHandshake({connection:i,isInitiator:!1,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(i,n),remoteEarlyData:n.remoteEarlyData,remotePeer:n.remotePeer}}async performHandshake(e){var t;const r=await m.getPayload(e.localPeer,this.staticKeys.publicKey,this.earlyData);let i=this.useNoisePipes;if(e.isInitiator&&null===w.KeyCache.load(e.remotePeer)&&(i=!1),!i)return await this.performXXHandshake(e,r);{const{remotePeer:i,connection:n,isInitiator:s}=e,o=new g.IKHandshake(s,r,this.prologue,this.staticKeys,n,null!==(t=w.KeyCache.load(e.remotePeer))&&void 0!==t?t:c.Buffer.alloc(32),i);try{return await this.performIKHandshake(o)}catch(t){let i;return e.isInitiator&&(i=o.getLocalEphemeralKeys()),await this.performXXFallbackHandshake(e,r,t.initialMsg,i)}}}async performXXFallbackHandshake(e,t,r,i){const{isInitiator:n,remotePeer:s,connection:o}=e,a=new y.XXFallbackHandshake(n,t,this.prologue,this.staticKeys,o,r,s,i);try{await a.propose(),await a.exchange(),await a.finish()}catch(e){_.logger(e);throw new Error(`Error occurred during XX Fallback handshake: ${e.message}`)}return a}async performXXHandshake(e,t){const{isInitiator:r,remotePeer:i,connection:n}=e,s=new p.XXHandshake(r,t,this.prologue,this.staticKeys,n,i);try{await s.propose(),await s.exchange(),await s.finish(),this.useNoisePipes&&s.remotePeer&&w.KeyCache.store(s.remotePeer,s.getRemoteStaticKey())}catch(e){throw new Error(`Error occurred during XX handshake: ${e.message}`)}return s}async performIKHandshake(e){return await e.stage0(),await e.stage1(),e}async createSecureConnection(e,t){const[r,i]=l.default(),n=e.unwrap();return await f.default(r,d.default,v.encryptStream(t),h.encode({lengthEncoder:b.uint16BEEncode}),n,h.decode({lengthDecoder:b.uint16BEDecode}),d.default,v.decryptStream(t),r),i}}},{"@stablelib/x25519":"5PJXv",buffer:"etowf","it-pb-rpc":"1VNxb","it-pair/duplex":"i2hGG","it-buffer":"jQv22","it-pipe":"giKBQ","it-length-prefixed":"3yxIE","./handshake-xx":"aO5Kw","./handshake-ik":"6aLUa","./handshake-xx-fallback":"3Y81f","./utils":"hkQyI","./encoder":"fJwxo","./crypto":"fylsy","./keycache":"8Z0xy","./logger":"iHFBc","./constants":"dt6rC"}],"5PJXv":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@stablelib/random"),n=e("@stablelib/wipe");function s(e){var t=new Float64Array(16);if(e)for(var r=0;r<e.length;r++)t[r]=e[r];return t}r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;var o=new Uint8Array(32);o[0]=9;var a=s([56129,1]);function c(e){for(var t=1,r=0;r<16;r++){var i=e[r]+t+65535;t=Math.floor(i/65536),e[r]=i-65536*t}e[0]+=t-1+37*(t-1)}function u(e,t,r){for(var i=~(r-1),n=0;n<16;n++){var s=i&(e[n]^t[n]);e[n]^=s,t[n]^=s}}function l(e,t,r){for(var i=0;i<16;i++)e[i]=t[i]+r[i]}function d(e,t,r){for(var i=0;i<16;i++)e[i]=t[i]-r[i]}function f(e,t,r){var i,n,s=0,o=0,a=0,c=0,u=0,l=0,d=0,f=0,h=0,p=0,g=0,y=0,m=0,b=0,v=0,w=0,_=0,E=0,S=0,T=0,A=0,k=0,I=0,R=0,P=0,O=0,C=0,j=0,D=0,M=0,x=0,B=r[0],L=r[1],N=r[2],U=r[3],F=r[4],K=r[5],z=r[6],V=r[7],q=r[8],G=r[9],H=r[10],$=r[11],W=r[12],Y=r[13],X=r[14],Z=r[15];s+=(i=t[0])*B,o+=i*L,a+=i*N,c+=i*U,u+=i*F,l+=i*K,d+=i*z,f+=i*V,h+=i*q,p+=i*G,g+=i*H,y+=i*$,m+=i*W,b+=i*Y,v+=i*X,w+=i*Z,o+=(i=t[1])*B,a+=i*L,c+=i*N,u+=i*U,l+=i*F,d+=i*K,f+=i*z,h+=i*V,p+=i*q,g+=i*G,y+=i*H,m+=i*$,b+=i*W,v+=i*Y,w+=i*X,_+=i*Z,a+=(i=t[2])*B,c+=i*L,u+=i*N,l+=i*U,d+=i*F,f+=i*K,h+=i*z,p+=i*V,g+=i*q,y+=i*G,m+=i*H,b+=i*$,v+=i*W,w+=i*Y,_+=i*X,E+=i*Z,c+=(i=t[3])*B,u+=i*L,l+=i*N,d+=i*U,f+=i*F,h+=i*K,p+=i*z,g+=i*V,y+=i*q,m+=i*G,b+=i*H,v+=i*$,w+=i*W,_+=i*Y,E+=i*X,S+=i*Z,u+=(i=t[4])*B,l+=i*L,d+=i*N,f+=i*U,h+=i*F,p+=i*K,g+=i*z,y+=i*V,m+=i*q,b+=i*G,v+=i*H,w+=i*$,_+=i*W,E+=i*Y,S+=i*X,T+=i*Z,l+=(i=t[5])*B,d+=i*L,f+=i*N,h+=i*U,p+=i*F,g+=i*K,y+=i*z,m+=i*V,b+=i*q,v+=i*G,w+=i*H,_+=i*$,E+=i*W,S+=i*Y,T+=i*X,A+=i*Z,d+=(i=t[6])*B,f+=i*L,h+=i*N,p+=i*U,g+=i*F,y+=i*K,m+=i*z,b+=i*V,v+=i*q,w+=i*G,_+=i*H,E+=i*$,S+=i*W,T+=i*Y,A+=i*X,k+=i*Z,f+=(i=t[7])*B,h+=i*L,p+=i*N,g+=i*U,y+=i*F,m+=i*K,b+=i*z,v+=i*V,w+=i*q,_+=i*G,E+=i*H,S+=i*$,T+=i*W,A+=i*Y,k+=i*X,I+=i*Z,h+=(i=t[8])*B,p+=i*L,g+=i*N,y+=i*U,m+=i*F,b+=i*K,v+=i*z,w+=i*V,_+=i*q,E+=i*G,S+=i*H,T+=i*$,A+=i*W,k+=i*Y,I+=i*X,R+=i*Z,p+=(i=t[9])*B,g+=i*L,y+=i*N,m+=i*U,b+=i*F,v+=i*K,w+=i*z,_+=i*V,E+=i*q,S+=i*G,T+=i*H,A+=i*$,k+=i*W,I+=i*Y,R+=i*X,P+=i*Z,g+=(i=t[10])*B,y+=i*L,m+=i*N,b+=i*U,v+=i*F,w+=i*K,_+=i*z,E+=i*V,S+=i*q,T+=i*G,A+=i*H,k+=i*$,I+=i*W,R+=i*Y,P+=i*X,O+=i*Z,y+=(i=t[11])*B,m+=i*L,b+=i*N,v+=i*U,w+=i*F,_+=i*K,E+=i*z,S+=i*V,T+=i*q,A+=i*G,k+=i*H,I+=i*$,R+=i*W,P+=i*Y,O+=i*X,C+=i*Z,m+=(i=t[12])*B,b+=i*L,v+=i*N,w+=i*U,_+=i*F,E+=i*K,S+=i*z,T+=i*V,A+=i*q,k+=i*G,I+=i*H,R+=i*$,P+=i*W,O+=i*Y,C+=i*X,j+=i*Z,b+=(i=t[13])*B,v+=i*L,w+=i*N,_+=i*U,E+=i*F,S+=i*K,T+=i*z,A+=i*V,k+=i*q,I+=i*G,R+=i*H,P+=i*$,O+=i*W,C+=i*Y,j+=i*X,D+=i*Z,v+=(i=t[14])*B,w+=i*L,_+=i*N,E+=i*U,S+=i*F,T+=i*K,A+=i*z,k+=i*V,I+=i*q,R+=i*G,P+=i*H,O+=i*$,C+=i*W,j+=i*Y,D+=i*X,M+=i*Z,w+=(i=t[15])*B,o+=38*(E+=i*N),a+=38*(S+=i*U),c+=38*(T+=i*F),u+=38*(A+=i*K),l+=38*(k+=i*z),d+=38*(I+=i*V),f+=38*(R+=i*q),h+=38*(P+=i*G),p+=38*(O+=i*H),g+=38*(C+=i*$),y+=38*(j+=i*W),m+=38*(D+=i*Y),b+=38*(M+=i*X),v+=38*(x+=i*Z),s=(i=(s+=38*(_+=i*L))+(n=1)+65535)-65536*(n=Math.floor(i/65536)),o=(i=o+n+65535)-65536*(n=Math.floor(i/65536)),a=(i=a+n+65535)-65536*(n=Math.floor(i/65536)),c=(i=c+n+65535)-65536*(n=Math.floor(i/65536)),u=(i=u+n+65535)-65536*(n=Math.floor(i/65536)),l=(i=l+n+65535)-65536*(n=Math.floor(i/65536)),d=(i=d+n+65535)-65536*(n=Math.floor(i/65536)),f=(i=f+n+65535)-65536*(n=Math.floor(i/65536)),h=(i=h+n+65535)-65536*(n=Math.floor(i/65536)),p=(i=p+n+65535)-65536*(n=Math.floor(i/65536)),g=(i=g+n+65535)-65536*(n=Math.floor(i/65536)),y=(i=y+n+65535)-65536*(n=Math.floor(i/65536)),m=(i=m+n+65535)-65536*(n=Math.floor(i/65536)),b=(i=b+n+65535)-65536*(n=Math.floor(i/65536)),v=(i=v+n+65535)-65536*(n=Math.floor(i/65536)),w=(i=w+n+65535)-65536*(n=Math.floor(i/65536)),s=(i=(s+=n-1+37*(n-1))+(n=1)+65535)-65536*(n=Math.floor(i/65536)),o=(i=o+n+65535)-65536*(n=Math.floor(i/65536)),a=(i=a+n+65535)-65536*(n=Math.floor(i/65536)),c=(i=c+n+65535)-65536*(n=Math.floor(i/65536)),u=(i=u+n+65535)-65536*(n=Math.floor(i/65536)),l=(i=l+n+65535)-65536*(n=Math.floor(i/65536)),d=(i=d+n+65535)-65536*(n=Math.floor(i/65536)),f=(i=f+n+65535)-65536*(n=Math.floor(i/65536)),h=(i=h+n+65535)-65536*(n=Math.floor(i/65536)),p=(i=p+n+65535)-65536*(n=Math.floor(i/65536)),g=(i=g+n+65535)-65536*(n=Math.floor(i/65536)),y=(i=y+n+65535)-65536*(n=Math.floor(i/65536)),m=(i=m+n+65535)-65536*(n=Math.floor(i/65536)),b=(i=b+n+65535)-65536*(n=Math.floor(i/65536)),v=(i=v+n+65535)-65536*(n=Math.floor(i/65536)),w=(i=w+n+65535)-65536*(n=Math.floor(i/65536)),s+=n-1+37*(n-1),e[0]=s,e[1]=o,e[2]=a,e[3]=c,e[4]=u,e[5]=l,e[6]=d,e[7]=f,e[8]=h,e[9]=p,e[10]=g,e[11]=y,e[12]=m,e[13]=b,e[14]=v,e[15]=w}function h(e,t){f(e,t,t)}function p(e,t){for(var r=new Uint8Array(32),i=new Float64Array(80),n=s(),o=s(),p=s(),g=s(),y=s(),m=s(),b=0;b<31;b++)r[b]=e[b];r[31]=127&e[31]|64,r[0]&=248,function(e,t){for(var r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(i,t);for(b=0;b<16;b++)o[b]=i[b];n[0]=g[0]=1;for(b=254;b>=0;--b){var v=r[b>>>3]>>>(7&b)&1;u(n,o,v),u(p,g,v),l(y,n,p),d(n,n,p),l(p,o,g),d(o,o,g),h(g,y),h(m,n),f(n,p,n),f(p,o,y),l(y,n,p),d(n,n,p),h(o,n),d(p,g,m),f(n,p,a),l(n,n,g),f(p,p,n),f(n,g,m),f(g,o,i),h(o,y),u(n,o,v),u(p,g,v)}for(b=0;b<16;b++)i[b+16]=n[b],i[b+32]=p[b],i[b+48]=o[b],i[b+64]=g[b];var w=i.subarray(32),_=i.subarray(16);!function(e,t){for(var r=s(),i=0;i<16;i++)r[i]=t[i];for(i=253;i>=0;i--)h(r,r),2!==i&&4!==i&&f(r,r,t);for(i=0;i<16;i++)e[i]=r[i]}(w,w),f(_,_,w);var E=new Uint8Array(32);return function(e,t){for(var r=s(),i=s(),n=0;n<16;n++)i[n]=t[n];c(i),c(i),c(i);for(var o=0;o<2;o++){for(r[0]=i[0]-65517,n=1;n<15;n++)r[n]=i[n]-65535-(r[n-1]>>16&1),r[n-1]&=65535;r[15]=i[15]-32767-(r[14]>>16&1);var a=r[15]>>16&1;r[14]&=65535,u(i,r,1-a)}for(n=0;n<16;n++)e[2*n]=255&i[n],e[2*n+1]=i[n]>>8}(E,_),E}function g(e){return p(e,o)}function y(e){if(e.length!==r.SECRET_KEY_LENGTH)throw new Error("x25519: seed must be "+r.SECRET_KEY_LENGTH+" bytes");var t=new Uint8Array(e);return{publicKey:g(t),secretKey:t}}r.scalarMult=p,r.scalarMultBase=g,r.generateKeyPairFromSeed=y,r.generateKeyPair=function(e){var t=i.randomBytes(32,e),r=y(t);return n.wipe(t),r},r.sharedKey=function(e,t,i){if(void 0===i&&(i=!1),e.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(t.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");var n=p(e,t);if(i){for(var s=0,o=0;o<n.length;o++)s|=n[o];if(0===s)throw new Error("X25519: invalid shared key")}return n}},{"@stablelib/random":"1Dte0","@stablelib/wipe":"4bsjy"}],"1Dte0":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./source/system"),n=e("@stablelib/binary"),s=e("@stablelib/wipe");function o(e,t){return void 0===t&&(t=r.defaultRandomSource),t.randomBytes(e)}r.defaultRandomSource=new i.SystemRandomSource,r.randomBytes=o,r.randomUint32=function(e){void 0===e&&(e=r.defaultRandomSource);var t=o(4,e),i=n.readUint32LE(t);return s.wipe(t),i};var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(e,t,i){if(void 0===t&&(t=a),void 0===i&&(i=r.defaultRandomSource),t.length<2)throw new Error("randomString charset is too short");if(t.length>256)throw new Error("randomString charset is too long");for(var n="",c=t.length,u=256-256%c;e>0;){for(var l=o(Math.ceil(256*e/u),i),d=0;d<l.length&&e>0;d++){var f=l[d];f<u&&(n+=t.charAt(f%c),e--)}s.wipe(l)}return n}r.randomString=c,r.randomStringForEntropy=function(e,t,i){return void 0===t&&(t=a),void 0===i&&(i=r.defaultRandomSource),c(Math.ceil(e/(Math.log(t.length)/Math.LN2)),t,i)}},{"./source/system":"2wcEY","@stablelib/binary":"h0oFL","@stablelib/wipe":"4bsjy"}],"2wcEY":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./browser"),n=e("./node"),s=function(){function e(){return this.isAvailable=!1,this.name="",this._source=new i.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new n.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}return e.prototype.randomBytes=function(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)},e}();r.SystemRandomSource=s},{"./browser":"d9aB9","./node":"iBoaj"}],d9aB9:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(){this.isAvailable=!1,this.isInstantiated=!1;var e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return e.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");for(var t=new Uint8Array(e),r=0;r<t.length;r+=65536)this._crypto.getRandomValues(t.subarray(r,r+Math.min(t.length-r,65536)));return t},e}();r.BrowserRandomSource=i},{}],iBoaj:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@stablelib/wipe"),n=function(){function t(){if(this.isAvailable=!1,this.isInstantiated=!1,void 0!==e){var t=e("crypto");t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}return t.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");var t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");for(var r=new Uint8Array(e),n=0;n<r.length;n++)r[n]=t[n];return i.wipe(t),r},t}();r.NodeRandomSource=n},{"@stablelib/wipe":"4bsjy",crypto:"lHksA"}],"4bsjy":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.wipe=function(e){for(var t=0;t<e.length;t++)e[t]=0;return e}},{}],h0oFL:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@stablelib/int");function n(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function s(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function o(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function c(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function u(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function l(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function d(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function f(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),l(e/4294967296>>>0,t,r),l(e>>>0,t,r+4),t}function h(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),d(e>>>0,t,r),d(e/4294967296>>>0,t,r+4),t}r.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},r.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},r.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},r.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},r.writeUint16BE=n,r.writeInt16BE=n,r.writeUint16LE=s,r.writeInt16LE=s,r.readInt32BE=o,r.readUint32BE=a,r.readInt32LE=c,r.readUint32LE=u,r.writeUint32BE=l,r.writeInt32BE=l,r.writeUint32LE=d,r.writeInt32LE=d,r.readInt64BE=function(e,t){void 0===t&&(t=0);var r=o(e,t),i=o(e,t+4);return 4294967296*r+i-4294967296*(i>>31)},r.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},r.readInt64LE=function(e,t){void 0===t&&(t=0);var r=c(e,t);return 4294967296*c(e,t+4)+r-4294967296*(r>>31)},r.readUint64LE=function(e,t){void 0===t&&(t=0);var r=u(e,t);return 4294967296*u(e,t+4)+r},r.writeUint64BE=f,r.writeInt64BE=f,r.writeUint64LE=h,r.writeInt64LE=h,r.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=e/8+r-1;s>=r;s--)i+=t[s]*n,n*=256;return i},r.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=r;s<r+e/8;s++)i+=t[s]*n,n*=256;return i},r.writeUintBE=function(e,t,r,n){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===n&&(n=0),e%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!i.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var s=1,o=e/8+n-1;o>=n;o--)r[o]=t/s&255,s*=256;return r},r.writeUintLE=function(e,t,r,n){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===n&&(n=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!i.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var s=1,o=n;o<n+e/8;o++)r[o]=t/s&255,s*=256;return r},r.readFloat32BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t)},r.readFloat32LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t,!0)},r.readFloat64BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t)},r.readFloat64LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t,!0)},r.writeFloat32BE=function(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e),t},r.writeFloat32LE=function(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e,!0),t},r.writeFloat64BE=function(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e),t},r.writeFloat64LE=function(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e,!0),t}},{"@stablelib/int":"3xEcf"}],"3xEcf":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.mul=Math.imul||function(e,t){var r=65535&e,i=65535&t;return r*i+((e>>>16&65535)*i+r*(t>>>16&65535)<<16>>>0)|0},r.add=function(e,t){return e+t|0},r.sub=function(e,t){return e-t|0},r.rotl=function(e,t){return e<<t|e>>>32-t},r.rotr=function(e,t){return e<<32-t|e>>>t},r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(e){return r.isInteger(e)&&e>=-r.MAX_SAFE_INTEGER&&e<=r.MAX_SAFE_INTEGER}},{}],"1VNxb":[function(e,t,r){"use strict";const i=e("is-buffer"),n=e("it-handshake"),s=e("it-length-prefixed");t.exports=(e,t={})=>{const r=n(e),o=s.decode.fromReader(r.reader,t);let a=!1;const c={read:async e=>{const{value:t,done:i}=await r.reader.next(e);if(i&&t.length<e)throw new Error("Couldn't read enough bytes");if(a=i,!t)throw new Error("Value is null");return t},readLP:async()=>{const{value:e,done:t}=await o.next();if(a=t,!e)throw new Error("Value is null");return e},readPB:async e=>{const t=await c.readLP();if(!t)throw new Error("Value is null");const r=i(t)?t:t.slice();return e.decode(r)},write:e=>{r.writer.push(e)},writeLP:e=>{c.write(s.encode.single(e,t))},writePB:(e,t)=>{c.writeLP(t.encode(e))},pb:e=>({read:()=>c.readPB(e),write:t=>c.writePB(t,e)}),unwrap:()=>(r.rest(),r.stream)};return c}},{"is-buffer":"5yoKf","it-handshake":"5ZBDe","it-length-prefixed":"3yxIE"}],"5ZBDe":[function(e,t,r){"use strict";const i=e("it-reader"),n=e("it-pushable"),s=e("p-defer");t.exports=e=>{const t=n(),r=i(e.source),o=s();let a;const c=e.sink(async function*(){yield*t;const e=await o.promise;yield*e}());c.catch((e=>{a=e}));return{reader:r,writer:t,stream:{sink:e=>a?Promise.reject(a):(o.resolve(e),c),source:r},rest:()=>t.end(),write:t.push,read:async()=>(await r.next()).value}}},{"it-reader":"btxDo","it-pushable":"bnpei","p-defer":"5rKSv"}],i2hGG:[function(e,t,r){var i=e("./");t.exports=function(){var e=i(),t=i();return[{source:e.source,sink:t.sink},{source:t.source,sink:e.sink}]}},{"./":"hvKe2"}],hvKe2:[function(e,t,r){"use strict";const i=e("get-iterator");t.exports=function(){let e,t;return{sink:async r=>{if(e)throw new Error("already piped");e=i(r),t&&t(e)},source:{[Symbol.asyncIterator](){return this},next:()=>e?e.next():new Promise((e=>{t=r=>{t=null,e(r.next())}}))}}}},{"get-iterator":"li8y1"}],jQv22:[function(e,t,r){"use strict";const{Buffer:i}=e("buffer"),n=e("bl/BufferList");t.exports=async function*(e){for await(const t of e)i.isBuffer(t)?yield t:n.isBufferList(t)?yield t.slice():yield i.from(t)},t.exports.toBuffer=t.exports,t.exports.toList=async function*(e){for await(const t of e)i.isBuffer(t)?yield(new n).append(t):n.isBufferList(t)?yield t:yield(new n).append(i.from(t))}},{buffer:"etowf","bl/BufferList":"im7j6"}],aO5Kw:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.XXHandshake=void 0;const i=e("buffer"),n=e("./handshakes/xx"),s=e("./utils"),o=e("./logger"),a=e("./encoder");r.XXHandshake=class{constructor(e,t,r,s,o,a,c){this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=s,this.connection=o,a&&(this.remotePeer=a),this.xx=null!=c?c:new n.XX,this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair),this.remoteEarlyData=i.Buffer.alloc(0)}async propose(){if(o.logLocalStaticKeys(this.session.hs.s),this.isInitiator){o.logger("Stage 0 - Initiator starting to send first message.");const e=this.xx.sendMessage(this.session,i.Buffer.alloc(0));this.connection.writeLP(a.encode0(e)),o.logger("Stage 0 - Initiator finished sending first message."),o.logLocalEphemeralKeys(this.session.hs.e)}else{o.logger("Stage 0 - Responder waiting to receive first message...");const e=a.decode0((await this.connection.readLP()).slice()),{valid:t}=this.xx.recvMessage(this.session,e);if(!t)throw new Error("xx handshake stage 0 validation fail");o.logger("Stage 0 - Responder received first message."),o.logRemoteEphemeralKey(this.session.hs.re)}}async exchange(){if(this.isInitiator){o.logger("Stage 1 - Initiator waiting to receive first message from responder...");const e=a.decode1((await this.connection.readLP()).slice()),{plaintext:t,valid:r}=this.xx.recvMessage(this.session,e);if(!r)throw new Error("xx handshake stage 1 validation fail");o.logger("Stage 1 - Initiator received the message."),o.logRemoteEphemeralKey(this.session.hs.re),o.logRemoteStaticKey(this.session.hs.rs),o.logger("Initiator going to check remote's signature...");try{const r=await s.decodePayload(t);this.remotePeer=this.remotePeer||await s.getPeerIdFromPayload(r),this.remotePeer=await s.verifySignedPayload(e.ns,r,this.remotePeer),this.setRemoteEarlyData(r.data)}catch(e){throw new Error(`Error occurred while verifying signed payload: ${e.message}`)}o.logger("All good with the signature!")}else{o.logger("Stage 1 - Responder sending out first message with signed payload and static key.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(a.encode1(e)),o.logger("Stage 1 - Responder sent the second handshake message with signed payload."),o.logLocalEphemeralKeys(this.session.hs.e)}}async finish(){if(this.isInitiator){o.logger("Stage 2 - Initiator sending third handshake message.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(a.encode2(e)),o.logger("Stage 2 - Initiator sent message with signed payload.")}else{o.logger("Stage 2 - Responder waiting for third handshake message...");const e=a.decode2((await this.connection.readLP()).slice()),{plaintext:t,valid:r}=this.xx.recvMessage(this.session,e);if(!r)throw new Error("xx handshake stage 2 validation fail");o.logger("Stage 2 - Responder received the message, finished handshake.");try{const e=await s.decodePayload(t);this.remotePeer=this.remotePeer||await s.getPeerIdFromPayload(e),await s.verifySignedPayload(this.session.hs.rs,e,this.remotePeer),this.setRemoteEarlyData(e.data)}catch(e){throw new Error(`Error occurred while verifying signed payload: ${e.message}`)}}o.logCipherState(this.session)}encrypt(e,t){const r=this.getCS(t);return this.xx.encryptWithAd(r,i.Buffer.alloc(0),e)}decrypt(e,t){const r=this.getCS(t,!1);return this.xx.decryptWithAd(r,i.Buffer.alloc(0),e)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e,t=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?t?e.cs1:e.cs2:t?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=i.Buffer.from(e.buffer,e.byteOffset,e.length))}}},{buffer:"etowf","./handshakes/xx":"9a2BV","./utils":"hkQyI","./logger":"iHFBc","./encoder":"fJwxo"}],"9a2BV":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.XX=void 0;const i=e("buffer"),n=e("../utils"),s=e("./abstract-handshake");class o extends s.AbstractHandshake{initializeInitiator(e,t,r,n){const s=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(s,e);return{ss:s,s:t,rs:r,psk:n,re:i.Buffer.alloc(32)}}initializeResponder(e,t,r,n){const s=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(s,e);return{ss:s,s:t,rs:r,psk:n,re:i.Buffer.alloc(32)}}writeMessageA(e,t,r){const s=i.Buffer.alloc(0);e.e=void 0!==r?r:n.generateKeypair();const o=e.e.publicKey;this.mixHash(e.ss,o);return{ne:o,ns:s,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=n.generateKeypair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const s=i.Buffer.from(e.s.publicKey),o=this.encryptAndHash(e.ss,s);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));return{ne:r,ns:o,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageC(e,t){const r=i.Buffer.from(e.s.publicKey),n=this.encryptAndHash(e.ss,r);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const s=this.encryptAndHash(e.ss,t),o={ne:this.createEmptyKey(),ns:n,ciphertext:s},{cs1:a,cs2:c}=this.split(e.ss);return{h:e.ss.h,messageBuffer:o,cs1:a,cs2:c}}readMessageA(e,t){return n.isValidPublicKey(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,t.ciphertext)}readMessageB(e,t){if(n.isValidPublicKey(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const{plaintext:r,valid:i}=this.decryptAndHash(e.ss,t.ns);i&&32===r.length&&n.isValidPublicKey(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:s,valid:i&&o}}readMessageC(e,t){const{plaintext:r,valid:i}=this.decryptAndHash(e.ss,t.ns);if(i&&32===r.length&&n.isValidPublicKey(r)&&(e.rs=r),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:a,cs2:c}=this.split(e.ss);return{h:e.ss.h,plaintext:s,valid:i&&o,cs1:a,cs2:c}}initSession(e,t,r){const n=this.createEmptyKey(),s=i.Buffer.alloc(32);let o;return o=e?this.initializeInitiator(t,r,s,n):this.initializeResponder(t,r,s,n),{hs:o,i:e,mc:0}}sendMessage(e,t,r){let i;if(0===e.mc)i=this.writeMessageA(e.hs,t,r);else if(1===e.mc)i=this.writeMessageB(e.hs,t);else if(2===e.mc){const{h:r,messageBuffer:n,cs1:s,cs2:o}=this.writeMessageC(e.hs,t);i=n,e.h=r,e.cs1=s,e.cs2=o}else{if(!(e.mc>2))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");i=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");i=this.writeMessageRegular(e.cs2,t)}}return e.mc++,i}recvMessage(e,t){let r=i.Buffer.alloc(0),n=!1;if(0===e.mc)({plaintext:r,valid:n}=this.readMessageA(e.hs,t));else if(1===e.mc)({plaintext:r,valid:n}=this.readMessageB(e.hs,t));else if(2===e.mc){const{h:i,plaintext:s,valid:o,cs1:a,cs2:c}=this.readMessageC(e.hs,t);r=s,n=o,e.h=i,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:n}}}r.XX=o},{buffer:"etowf","../utils":"hkQyI","./abstract-handshake":"8oSG2"}],hkQyI:[function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.isValidPublicKey=r.getHkdf=r.verifySignedPayload=r.getHandshakePayload=r.decodePayload=r.getPeerIdFromPayload=r.signPayload=r.createHandshakePayload=r.getPayload=r.generateKeypair=void 0;const a=e("@stablelib/hkdf"),c=e("@stablelib/sha256"),u=s(e("@stablelib/x25519")),l=e("buffer"),d=o(e("peer-id")),f=e("libp2p-crypto"),h=e("./proto/payload"),p=e("uint8arrays/equals"),g=h.pb.NoiseHandshakePayload;function y(e,t,r){const i=g.create({identityKey:l.Buffer.from(e),identitySig:t,data:null!=r?r:null});return l.Buffer.from(g.encode(i).finish())}async function m(e,t){return l.Buffer.from(await e.privKey.sign(t))}function b(e){return l.Buffer.concat([l.Buffer.from("noise-libp2p-static-key:"),e])}r.generateKeypair=function(){const e=u.generateKeyPair();return{publicKey:l.Buffer.from(e.publicKey.buffer,e.publicKey.byteOffset,e.publicKey.length),privateKey:l.Buffer.from(e.secretKey.buffer,e.secretKey.byteOffset,e.secretKey.length)}},r.getPayload=async function(e,t,r){const i=await m(e,b(t)),n=null!=r?r:l.Buffer.alloc(0);return y(e.marshalPubKey(),i,n)},r.createHandshakePayload=y,r.signPayload=m,r.getPeerIdFromPayload=async function(e){return await d.default.createFromPubKey(l.Buffer.from(e.identityKey))},r.decodePayload=function(e){return g.toObject(g.decode(l.Buffer.from(e)))},r.getHandshakePayload=b,r.verifySignedPayload=async function(e,t,r){const i=l.Buffer.from(t.identityKey);if(!await async function(e,t){const r=await d.default.createFromPubKey(t);return p.equals(r.id,e)}(r.id,i))throw new Error("Peer ID doesn't match libp2p public key.");const n=b(e),s=f.keys.unmarshalPublicKey(i);if(!t.identitySig||!s.verify(n,l.Buffer.from(t.identitySig)))throw new Error("Static key doesn't match to peer that signed payload!");return await d.default.createFromPubKey(i)},r.getHkdf=function(e,t){const r=new a.HKDF(c.SHA256,t,e).expand(96),i=l.Buffer.from(r.buffer,r.byteOffset,r.length);return[i.slice(0,32),i.slice(32,64),i.slice(64,96)]},r.isValidPublicKey=function(e){return!!l.Buffer.isBuffer(e)&&32===e.length}},{"@stablelib/hkdf":"2qV77","@stablelib/sha256":"9CBdD","@stablelib/x25519":"5PJXv",buffer:"etowf","peer-id":"8Bdb3","libp2p-crypto":"bb1cb","./proto/payload":"cBkC4","uint8arrays/equals":"eY3cX"}],"2qV77":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@stablelib/hmac"),n=e("@stablelib/wipe"),s=function(){function e(e,t,r,n){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=i.hmac(this._hash,r,t);this._hmac=new i.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),r=0;r<t.length;r++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[r]=this._buffer[this._bufpos++];return t},e.prototype.clean=function(){this._hmac.clean(),n.wipe(this._buffer),n.wipe(this._counter),this._bufpos=0},e}();r.HKDF=s},{"@stablelib/hmac":"hB00A","@stablelib/wipe":"4bsjy"}],hB00A:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@stablelib/hash"),n=e("@stablelib/constant-time"),s=e("@stablelib/wipe"),o=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var r=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(r).clean():r.set(t);for(var n=0;n<r.length;n++)r[n]^=54;this._inner.update(r);for(n=0;n<r.length;n++)r[n]^=106;this._outer.update(r),i.isSerializableHash(this._inner)&&i.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),s.wipe(r)}return e.prototype.reset=function(){if(!i.isSerializableHash(this._inner)||!i.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){i.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),i.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(e){return this._inner.update(e),this},e.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(!i.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(e){if(!i.isSerializableHash(this._inner)||!i.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(e){if(!i.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},e}();r.HMAC=o,r.hmac=function(e,t,r){var i=new o(e,t);i.update(r);var n=i.digest();return i.clean(),n},r.equal=n.equal},{"@stablelib/hash":"hDBwI","@stablelib/constant-time":"bVMF0","@stablelib/wipe":"4bsjy"}],hDBwI:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isSerializableHash=function(e){return void 0!==e.saveState&&void 0!==e.restoreState&&void 0!==e.cleanSavedState}},{}],bVMF0:[function(e,t,r){"use strict";function i(e,t){if(e.length!==t.length)return 0;for(var r=0,i=0;i<e.length;i++)r|=e[i]^t[i];return 1&r-1>>>8}Object.defineProperty(r,"__esModule",{value:!0}),r.select=function(e,t,r){return~(e-1)&t|e-1&r},r.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},r.compare=i,r.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==i(e,t)}},{}],"9CBdD":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@stablelib/binary"),n=e("@stablelib/wipe");r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var s=function(){function e(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},e.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&t>0;)this._buffer[this._bufferLength++]=e[r++],t--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(r=a(this._temp,this._state,e,r,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[r++],t--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,r=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%64<56?64:128;this._buffer[r]=128;for(var c=r+1;c<o-8;c++)this._buffer[c]=0;i.writeUint32BE(n,this._buffer,o-8),i.writeUint32BE(s,this._buffer,o-4),a(this._temp,this._state,this._buffer,0,o),this._finished=!0}for(c=0;c<this.digestLength/4;c++)i.writeUint32BE(this._state[c],e,4*c);return this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){n.wipe(e.state),e.buffer&&n.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();r.SHA256=s;var o=new Int32Array([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]);function a(e,t,r,n,s){for(;s>=64;){for(var a=t[0],c=t[1],u=t[2],l=t[3],d=t[4],f=t[5],h=t[6],p=t[7],g=0;g<16;g++){var y=n+4*g;e[g]=i.readUint32BE(r,y)}for(g=16;g<64;g++){var m=e[g-2],b=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,v=((m=e[g-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3;e[g]=(b+e[g-7]|0)+(v+e[g-16]|0)}for(g=0;g<64;g++){b=(((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&f^~d&h)|0)+(p+(o[g]+e[g]|0)|0)|0,v=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&c^a&u^c&u)|0;p=h,h=f,f=d,d=l+b|0,l=u,u=c,c=a,a=b+v|0}t[0]+=a,t[1]+=c,t[2]+=u,t[3]+=l,t[4]+=d,t[5]+=f,t[6]+=h,t[7]+=p,n+=64,s-=64}return n}r.hash=function(e){var t=new s;t.update(e);var r=t.digest();return t.clean(),r}},{"@stablelib/binary":"h0oFL","@stablelib/wipe":"4bsjy"}],cBkC4:[function(e,t,r){"use strict";var i;i=function(e){var t,r=e.Reader,i=e.Writer,n=e.util,s=e.roots["libp2p-noise"]||(e.roots["libp2p-noise"]={});return s.pb=((t={}).NoiseHandshakePayload=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return t.prototype.identityKey=n.newBuffer([]),t.prototype.identitySig=n.newBuffer([]),t.prototype.data=n.newBuffer([]),t.create=function(e){return new t(e)},t.encode=function(e,t){return t||(t=i.create()),null!=e.identityKey&&Object.hasOwnProperty.call(e,"identityKey")&&t.uint32(10).bytes(e.identityKey),null!=e.identitySig&&Object.hasOwnProperty.call(e,"identitySig")&&t.uint32(18).bytes(e.identitySig),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(26).bytes(e.data),t},t.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},t.decode=function(e,t){e instanceof r||(e=r.create(e));for(var i=void 0===t?e.len:e.pos+t,n=new s.pb.NoiseHandshakePayload;e.pos<i;){var o=e.uint32();switch(o>>>3){case 1:n.identityKey=e.bytes();break;case 2:n.identitySig=e.bytes();break;case 3:n.data=e.bytes();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.identityKey&&e.hasOwnProperty("identityKey")&&!(e.identityKey&&"number"==typeof e.identityKey.length||n.isString(e.identityKey))?"identityKey: buffer expected":null!=e.identitySig&&e.hasOwnProperty("identitySig")&&!(e.identitySig&&"number"==typeof e.identitySig.length||n.isString(e.identitySig))?"identitySig: buffer expected":null!=e.data&&e.hasOwnProperty("data")&&!(e.data&&"number"==typeof e.data.length||n.isString(e.data))?"data: buffer expected":null},t.fromObject=function(e){if(e instanceof s.pb.NoiseHandshakePayload)return e;var t=new s.pb.NoiseHandshakePayload;return null!=e.identityKey&&("string"==typeof e.identityKey?n.base64.decode(e.identityKey,t.identityKey=n.newBuffer(n.base64.length(e.identityKey)),0):e.identityKey.length&&(t.identityKey=e.identityKey)),null!=e.identitySig&&("string"==typeof e.identitySig?n.base64.decode(e.identitySig,t.identitySig=n.newBuffer(n.base64.length(e.identitySig)),0):e.identitySig.length&&(t.identitySig=e.identitySig)),null!=e.data&&("string"==typeof e.data?n.base64.decode(e.data,t.data=n.newBuffer(n.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.identityKey="":(r.identityKey=[],t.bytes!==Array&&(r.identityKey=n.newBuffer(r.identityKey))),t.bytes===String?r.identitySig="":(r.identitySig=[],t.bytes!==Array&&(r.identitySig=n.newBuffer(r.identitySig))),t.bytes===String?r.data="":(r.data=[],t.bytes!==Array&&(r.data=n.newBuffer(r.data)))),null!=e.identityKey&&e.hasOwnProperty("identityKey")&&(r.identityKey=t.bytes===String?n.base64.encode(e.identityKey,0,e.identityKey.length):t.bytes===Array?Array.prototype.slice.call(e.identityKey):e.identityKey),null!=e.identitySig&&e.hasOwnProperty("identitySig")&&(r.identitySig=t.bytes===String?n.base64.encode(e.identitySig,0,e.identitySig.length):t.bytes===Array?Array.prototype.slice.call(e.identitySig):e.identitySig),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?n.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t}(),t),s},"function"==typeof define&&define.amd?define(["protobufjs/minimal"],i):"function"==typeof e&&"object"==typeof t&&t&&t.exports&&(t.exports=i(e("protobufjs/minimal")))},{"protobufjs/minimal":"grAXL"}],"8oSG2":[function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.AbstractHandshake=r.MIN_NONCE=void 0;const o=e("buffer"),a=s(e("@stablelib/x25519")),c=s(e("@stablelib/sha256")),u=e("@stablelib/chacha20poly1305"),l=e("../utils"),d=e("../logger");r.MIN_NONCE=0;r.AbstractHandshake=class{encryptWithAd(e,t,r){const i=this.encrypt(e.k,e.n,t,r);return this.setNonce(e,this.incrementNonce(e.n)),i}decryptWithAd(e,t,r){const{plaintext:i,valid:n}=this.decrypt(e.k,e.n,t,r);return this.setNonce(e,this.incrementNonce(e.n)),{plaintext:i,valid:n}}hasKey(e){return!this.isEmptyKey(e.k)}setNonce(e,t){e.n=t}createEmptyKey(){return o.Buffer.alloc(32)}isEmptyKey(e){return this.createEmptyKey().equals(e)}incrementNonce(e){return e+1}nonceToBytes(e){const t=o.Buffer.alloc(12);return t.writeUInt32LE(e,4),t}encrypt(e,t,r,i){const n=this.nonceToBytes(t),s=new u.ChaCha20Poly1305(e).seal(n,i,r);return o.Buffer.from(s.buffer,s.byteOffset,s.length)}encryptAndHash(e,t){let r;return r=this.hasKey(e.cs)?this.encryptWithAd(e.cs,e.h,t):t,this.mixHash(e,r),r}decrypt(e,t,r,i){const n=this.nonceToBytes(t),s=new u.ChaCha20Poly1305(e).open(n,i,r);return s?{plaintext:o.Buffer.from(s.buffer,s.byteOffset,s.length),valid:!0}:{plaintext:o.Buffer.from(""),valid:!1}}decryptAndHash(e,t){let r,i=!0;return this.hasKey(e.cs)?({plaintext:r,valid:i}=this.decryptWithAd(e.cs,e.h,t)):r=t,this.mixHash(e,t),{plaintext:r,valid:i}}dh(e,t){try{const r=a.sharedKey(e,t),i=o.Buffer.from(r.buffer,r.byteOffset,r.length),n=o.Buffer.alloc(32);return i.copy(n),n}catch(e){return d.logger(e.message),o.Buffer.alloc(32)}}mixHash(e,t){e.h=this.getHash(e.h,t)}getHash(e,t){const r=c.hash(o.Buffer.from([...e,...t]));return o.Buffer.from(r.buffer,r.byteOffset,r.length)}mixKey(e,t){const[r,i]=l.getHkdf(e.ck,t);e.cs=this.initializeKey(i),e.ck=r}initializeKey(e){return{k:e,n:r.MIN_NONCE}}initializeSymmetric(e){const t=o.Buffer.from(e,"utf-8"),r=this.hashProtocolName(t),i=r,n=this.createEmptyKey();return{cs:this.initializeKey(n),ck:i,h:r}}hashProtocolName(e){if(e.length<=32){const t=o.Buffer.alloc(32);return e.copy(t),t}return this.getHash(e,o.Buffer.alloc(0))}split(e){const[t,r]=l.getHkdf(e.ck,o.Buffer.alloc(0));return{cs1:this.initializeKey(t),cs2:this.initializeKey(r)}}writeMessageRegular(e,t){const r=this.encryptWithAd(e,o.Buffer.alloc(0),t);return{ne:this.createEmptyKey(),ns:o.Buffer.alloc(0),ciphertext:r}}readMessageRegular(e,t){return this.decryptWithAd(e,o.Buffer.alloc(0),t.ciphertext)}}},{buffer:"etowf","@stablelib/x25519":"5PJXv","@stablelib/sha256":"9CBdD","@stablelib/chacha20poly1305":"buhYd","../utils":"hkQyI","../logger":"iHFBc"}],buhYd:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@stablelib/chacha"),n=e("@stablelib/poly1305"),s=e("@stablelib/wipe"),o=e("@stablelib/binary"),a=e("@stablelib/constant-time");r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var c=new Uint8Array(16),u=function(){function e(e){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,e.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return e.prototype.seal=function(e,t,r,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var o=new Uint8Array(16);o.set(e,o.length-e.length);var a=new Uint8Array(32);i.stream(this._key,o,a,4);var c,u=t.length+this.tagLength;if(n){if(n.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");c=n}else c=new Uint8Array(u);return i.streamXOR(this._key,o,t,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),a,c.subarray(0,c.length-this.tagLength),r),s.wipe(o),c},e.prototype.open=function(e,t,r,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;var o=new Uint8Array(16);o.set(e,o.length-e.length);var c=new Uint8Array(32);i.stream(this._key,o,c,4);var u=new Uint8Array(this.tagLength);if(this._authenticate(u,c,t.subarray(0,t.length-this.tagLength),r),!a.equal(u,t.subarray(t.length-this.tagLength,t.length)))return null;var l,d=t.length-this.tagLength;if(n){if(n.length!==d)throw new Error("ChaCha20Poly1305: incorrect destination length");l=n}else l=new Uint8Array(d);return i.streamXOR(this._key,o,t.subarray(0,t.length-this.tagLength),l,4),s.wipe(o),l},e.prototype.clean=function(){return s.wipe(this._key),this},e.prototype._authenticate=function(e,t,r,i){var a=new n.Poly1305(t);i&&(a.update(i),i.length%16>0&&a.update(c.subarray(i.length%16))),a.update(r),r.length%16>0&&a.update(c.subarray(r.length%16));var u=new Uint8Array(8);i&&o.writeUint64LE(i.length,u),a.update(u),o.writeUint64LE(r.length,u),a.update(u);for(var l=a.digest(),d=0;d<l.length;d++)e[d]=l[d];a.clean(),s.wipe(l),s.wipe(u)},e}();r.ChaCha20Poly1305=u},{"@stablelib/chacha":"hkxYs","@stablelib/poly1305":"8r9OD","@stablelib/wipe":"4bsjy","@stablelib/binary":"h0oFL","@stablelib/constant-time":"bVMF0"}],hkxYs:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@stablelib/binary"),n=e("@stablelib/wipe");function s(e,t,r){for(var n=1634760805,s=857760878,o=2036477234,a=1797285236,c=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],f=r[19]<<24|r[18]<<16|r[17]<<8|r[16],h=r[23]<<24|r[22]<<16|r[21]<<8|r[20],p=r[27]<<24|r[26]<<16|r[25]<<8|r[24],g=r[31]<<24|r[30]<<16|r[29]<<8|r[28],y=t[3]<<24|t[2]<<16|t[1]<<8|t[0],m=t[7]<<24|t[6]<<16|t[5]<<8|t[4],b=t[11]<<24|t[10]<<16|t[9]<<8|t[8],v=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=n,_=s,E=o,S=a,T=c,A=u,k=l,I=d,R=f,P=h,O=p,C=g,j=y,D=m,M=b,x=v,B=0;B<20;B+=2)T=(T^=R=R+(j=(j^=w=w+T|0)>>>16|j<<16)|0)>>>20|T<<12,A=(A^=P=P+(D=(D^=_=_+A|0)>>>16|D<<16)|0)>>>20|A<<12,k=(k^=O=O+(M=(M^=E=E+k|0)>>>16|M<<16)|0)>>>20|k<<12,I=(I^=C=C+(x=(x^=S=S+I|0)>>>16|x<<16)|0)>>>20|I<<12,k=(k^=O=O+(M=(M^=E=E+k|0)>>>24|M<<8)|0)>>>25|k<<7,I=(I^=C=C+(x=(x^=S=S+I|0)>>>24|x<<8)|0)>>>25|I<<7,A=(A^=P=P+(D=(D^=_=_+A|0)>>>24|D<<8)|0)>>>25|A<<7,T=(T^=R=R+(j=(j^=w=w+T|0)>>>24|j<<8)|0)>>>25|T<<7,A=(A^=O=O+(x=(x^=w=w+A|0)>>>16|x<<16)|0)>>>20|A<<12,k=(k^=C=C+(j=(j^=_=_+k|0)>>>16|j<<16)|0)>>>20|k<<12,I=(I^=R=R+(D=(D^=E=E+I|0)>>>16|D<<16)|0)>>>20|I<<12,T=(T^=P=P+(M=(M^=S=S+T|0)>>>16|M<<16)|0)>>>20|T<<12,I=(I^=R=R+(D=(D^=E=E+I|0)>>>24|D<<8)|0)>>>25|I<<7,T=(T^=P=P+(M=(M^=S=S+T|0)>>>24|M<<8)|0)>>>25|T<<7,k=(k^=C=C+(j=(j^=_=_+k|0)>>>24|j<<8)|0)>>>25|k<<7,A=(A^=O=O+(x=(x^=w=w+A|0)>>>24|x<<8)|0)>>>25|A<<7;i.writeUint32LE(w+n|0,e,0),i.writeUint32LE(_+s|0,e,4),i.writeUint32LE(E+o|0,e,8),i.writeUint32LE(S+a|0,e,12),i.writeUint32LE(T+c|0,e,16),i.writeUint32LE(A+u|0,e,20),i.writeUint32LE(k+l|0,e,24),i.writeUint32LE(I+d|0,e,28),i.writeUint32LE(R+f|0,e,32),i.writeUint32LE(P+h|0,e,36),i.writeUint32LE(O+p|0,e,40),i.writeUint32LE(C+g|0,e,44),i.writeUint32LE(j+y|0,e,48),i.writeUint32LE(D+m|0,e,52),i.writeUint32LE(M+b|0,e,56),i.writeUint32LE(x+v|0,e,60)}function o(e,t,r,i,o){if(void 0===o&&(o=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<r.length)throw new Error("ChaCha: destination is shorter than source");var c,u;if(0===o){if(8!==t.length&&12!==t.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");u=(c=new Uint8Array(16)).length-t.length,c.set(t,u)}else{if(16!==t.length)throw new Error("ChaCha nonce with counter must be 16 bytes");c=t,u=o}for(var l=new Uint8Array(64),d=0;d<r.length;d+=64){s(l,c,e);for(var f=d;f<d+64&&f<r.length;f++)i[f]=r[f]^l[f-d];a(c,0,u)}return n.wipe(l),0===o&&n.wipe(c),i}function a(e,t,r){for(var i=1;r--;)i=i+(255&e[t])|0,e[t]=255&i,i>>>=8,t++;if(i>0)throw new Error("ChaCha: counter overflow")}r.streamXOR=o,r.stream=function(e,t,r,i){return void 0===i&&(i=0),n.wipe(r),o(e,t,r,r,i)}},{"@stablelib/binary":"h0oFL","@stablelib/wipe":"4bsjy"}],"8r9OD":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@stablelib/constant-time"),n=e("@stablelib/wipe");r.DIGEST_LENGTH=16;var s=function(){function e(e){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var t=e[0]|e[1]<<8;this._r[0]=8191&t;var i=e[2]|e[3]<<8;this._r[1]=8191&(t>>>13|i<<3);var n=e[4]|e[5]<<8;this._r[2]=7939&(i>>>10|n<<6);var s=e[6]|e[7]<<8;this._r[3]=8191&(n>>>7|s<<9);var o=e[8]|e[9]<<8;this._r[4]=255&(s>>>4|o<<12),this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=8191&(o>>>14|a<<2);var c=e[12]|e[13]<<8;this._r[7]=8065&(a>>>11|c<<5);var u=e[14]|e[15]<<8;this._r[8]=8191&(c>>>8|u<<8),this._r[9]=u>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return e.prototype._blocks=function(e,t,r){for(var i=this._fin?0:2048,n=this._h[0],s=this._h[1],o=this._h[2],a=this._h[3],c=this._h[4],u=this._h[5],l=this._h[6],d=this._h[7],f=this._h[8],h=this._h[9],p=this._r[0],g=this._r[1],y=this._r[2],m=this._r[3],b=this._r[4],v=this._r[5],w=this._r[6],_=this._r[7],E=this._r[8],S=this._r[9];r>=16;){var T=e[t+0]|e[t+1]<<8;n+=8191&T;var A=e[t+2]|e[t+3]<<8;s+=8191&(T>>>13|A<<3);var k=e[t+4]|e[t+5]<<8;o+=8191&(A>>>10|k<<6);var I=e[t+6]|e[t+7]<<8;a+=8191&(k>>>7|I<<9);var R=e[t+8]|e[t+9]<<8;c+=8191&(I>>>4|R<<12),u+=R>>>1&8191;var P=e[t+10]|e[t+11]<<8;l+=8191&(R>>>14|P<<2);var O=e[t+12]|e[t+13]<<8;d+=8191&(P>>>11|O<<5);var C=e[t+14]|e[t+15]<<8,j=0,D=j;D+=n*p,D+=s*(5*S),D+=o*(5*E),D+=a*(5*_),j=(D+=c*(5*w))>>>13,D&=8191,D+=u*(5*v),D+=l*(5*b),D+=d*(5*m),D+=(f+=8191&(O>>>8|C<<8))*(5*y);var M=j+=(D+=(h+=C>>>5|i)*(5*g))>>>13;M+=n*g,M+=s*p,M+=o*(5*S),M+=a*(5*E),j=(M+=c*(5*_))>>>13,M&=8191,M+=u*(5*w),M+=l*(5*v),M+=d*(5*b),M+=f*(5*m),j+=(M+=h*(5*y))>>>13,M&=8191;var x=j;x+=n*y,x+=s*g,x+=o*p,x+=a*(5*S),j=(x+=c*(5*E))>>>13,x&=8191,x+=u*(5*_),x+=l*(5*w),x+=d*(5*v),x+=f*(5*b);var B=j+=(x+=h*(5*m))>>>13;B+=n*m,B+=s*y,B+=o*g,B+=a*p,j=(B+=c*(5*S))>>>13,B&=8191,B+=u*(5*E),B+=l*(5*_),B+=d*(5*w),B+=f*(5*v);var L=j+=(B+=h*(5*b))>>>13;L+=n*b,L+=s*m,L+=o*y,L+=a*g,j=(L+=c*p)>>>13,L&=8191,L+=u*(5*S),L+=l*(5*E),L+=d*(5*_),L+=f*(5*w);var N=j+=(L+=h*(5*v))>>>13;N+=n*v,N+=s*b,N+=o*m,N+=a*y,j=(N+=c*g)>>>13,N&=8191,N+=u*p,N+=l*(5*S),N+=d*(5*E),N+=f*(5*_);var U=j+=(N+=h*(5*w))>>>13;U+=n*w,U+=s*v,U+=o*b,U+=a*m,j=(U+=c*y)>>>13,U&=8191,U+=u*g,U+=l*p,U+=d*(5*S),U+=f*(5*E);var F=j+=(U+=h*(5*_))>>>13;F+=n*_,F+=s*w,F+=o*v,F+=a*b,j=(F+=c*m)>>>13,F&=8191,F+=u*y,F+=l*g,F+=d*p,F+=f*(5*S);var K=j+=(F+=h*(5*E))>>>13;K+=n*E,K+=s*_,K+=o*w,K+=a*v,j=(K+=c*b)>>>13,K&=8191,K+=u*m,K+=l*y,K+=d*g,K+=f*p;var z=j+=(K+=h*(5*S))>>>13;z+=n*S,z+=s*E,z+=o*_,z+=a*w,j=(z+=c*v)>>>13,z&=8191,z+=u*b,z+=l*m,z+=d*y,z+=f*g,n=D=8191&(j=(j=((j+=(z+=h*p)>>>13)<<2)+j|0)+(D&=8191)|0),s=M+=j>>>=13,o=x&=8191,a=B&=8191,c=L&=8191,u=N&=8191,l=U&=8191,d=F&=8191,f=K&=8191,h=z&=8191,t+=16,r-=16}this._h[0]=n,this._h[1]=s,this._h[2]=o,this._h[3]=a,this._h[4]=c,this._h[5]=u,this._h[6]=l,this._h[7]=d,this._h[8]=f,this._h[9]=h},e.prototype.finish=function(e,t){void 0===t&&(t=0);var r,i,n,s,o=new Uint16Array(10);if(this._leftover){for(s=this._leftover,this._buffer[s++]=1;s<16;s++)this._buffer[s]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,s=2;s<10;s++)this._h[s]+=r,r=this._h[s]>>>13,this._h[s]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,o[0]=this._h[0]+5,r=o[0]>>>13,o[0]&=8191,s=1;s<10;s++)o[s]=this._h[s]+r,r=o[s]>>>13,o[s]&=8191;for(o[9]-=8192,i=(1^r)-1,s=0;s<10;s++)o[s]&=i;for(i=~i,s=0;s<10;s++)this._h[s]=this._h[s]&i|o[s];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),n=this._h[0]+this._pad[0],this._h[0]=65535&n,s=1;s<8;s++)n=(this._h[s]+this._pad[s]|0)+(n>>>16)|0,this._h[s]=65535&n;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},e.prototype.update=function(e){var t,r=0,i=e.length;if(this._leftover){(t=16-this._leftover)>i&&(t=i);for(var n=0;n<t;n++)this._buffer[this._leftover+n]=e[r+n];if(i-=t,r+=t,this._leftover+=t,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(i>=16&&(t=i-i%16,this._blocks(e,r,t),r+=t,i-=t),i){for(n=0;n<i;n++)this._buffer[this._leftover+n]=e[r+n];this._leftover+=i}return this},e.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},e.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},e}();r.Poly1305=s,r.oneTimeAuth=function(e,t){var r=new s(e);r.update(t);var i=r.digest();return r.clean(),i},r.equal=function(e,t){return e.length===r.DIGEST_LENGTH&&t.length===r.DIGEST_LENGTH&&i.equal(e,t)}},{"@stablelib/constant-time":"bVMF0","@stablelib/wipe":"4bsjy"}],iHFBc:[function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.logCipherState=r.logRemoteEphemeralKey=r.logRemoteStaticKey=r.logLocalEphemeralKeys=r.logLocalStaticKeys=r.logger=void 0;const n=i(e("debug")),s=e("./constants");let o;r.logger=n.default("libp2p:noise"),o=s.DUMP_SESSION_KEYS?r.logger:()=>{},r.logLocalStaticKeys=function(e){o(`LOCAL_STATIC_PUBLIC_KEY ${e.publicKey.toString("hex")}`),o(`LOCAL_STATIC_PRIVATE_KEY ${e.privateKey.toString("hex")}`)},r.logLocalEphemeralKeys=function(e){e?(o(`LOCAL_PUBLIC_EPHEMERAL_KEY ${e.publicKey.toString("hex")}`),o(`LOCAL_PRIVATE_EPHEMERAL_KEY ${e.privateKey.toString("hex")}`)):o("Missing local ephemeral keys.")},r.logRemoteStaticKey=function(e){o(`REMOTE_STATIC_PUBLIC_KEY ${e.toString("hex")}`)},r.logRemoteEphemeralKey=function(e){o(`REMOTE_EPHEMERAL_PUBLIC_KEY ${e.toString("hex")}`)},r.logCipherState=function(e){e.cs1&&e.cs2?(o(`CIPHER_STATE_1 ${e.cs1.n} ${e.cs1.k.toString("hex")}`),o(`CIPHER_STATE_2 ${e.cs2.n} ${e.cs2.k.toString("hex")}`)):o("Missing cipher state.")}},{debug:"bO5wM","./constants":"dt6rC"}],dt6rC:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DUMP_SESSION_KEYS=r.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=r.NOISE_MSG_MAX_LENGTH_BYTES=void 0,r.NOISE_MSG_MAX_LENGTH_BYTES=65535,r.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=r.NOISE_MSG_MAX_LENGTH_BYTES-16,r.DUMP_SESSION_KEYS=void 0},{}],fJwxo:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decode2=r.decode1=r.decode0=r.encode2=r.encode1=r.encode0=r.uint16BEDecode=r.uint16BEEncode=void 0;const i=e("buffer");r.uint16BEEncode=(e,t,r)=>((t=t||i.Buffer.allocUnsafe(2)).writeUInt16BE(e,r),t),r.uint16BEEncode.bytes=2;r.uint16BEDecode=e=>{if(e.length<2)throw RangeError("Could not decode int16BE");return e.readUInt16BE(0)},r.uint16BEDecode.bytes=2,r.encode0=function(e){return i.Buffer.concat([e.ne,e.ciphertext])},r.encode1=function(e){return i.Buffer.concat([e.ne,e.ns,e.ciphertext])},r.encode2=function(e){return i.Buffer.concat([e.ns,e.ciphertext])},r.decode0=function(e){if(e.length<32)throw new Error("Cannot decode stage 0 MessageBuffer: length less than 32 bytes.");return{ne:e.slice(0,32),ciphertext:e.slice(32,e.length),ns:i.Buffer.alloc(0)}},r.decode1=function(e){if(e.length<80)throw new Error("Cannot decode stage 1 MessageBuffer: length less than 80 bytes.");return{ne:e.slice(0,32),ns:e.slice(32,80),ciphertext:e.slice(80,e.length)}},r.decode2=function(e){if(e.length<48)throw new Error("Cannot decode stage 2 MessageBuffer: length less than 48 bytes.");return{ne:i.Buffer.alloc(0),ns:e.slice(0,48),ciphertext:e.slice(48,e.length)}}},{buffer:"etowf"}],"6aLUa":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.IKHandshake=void 0;const i=e("./handshakes/ik"),n=e("buffer"),s=e("./encoder"),o=e("./utils"),a=e("./errors"),c=e("./logger");r.IKHandshake=class{constructor(e,t,r,s,o,a,c,u){this.isInitiator=e,this.payload=n.Buffer.from(t),this.prologue=r,this.staticKeypair=s,this.connection=o,c&&(this.remotePeer=c),this.ik=null!=u?u:new i.IK,this.session=this.ik.initSession(this.isInitiator,this.prologue,this.staticKeypair,a),this.remoteEarlyData=n.Buffer.alloc(0)}async stage0(){if(c.logLocalStaticKeys(this.session.hs.s),c.logRemoteStaticKey(this.session.hs.rs),this.isInitiator){c.logger("IK Stage 0 - Initiator sending message...");const e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP(s.encode1(e)),c.logger("IK Stage 0 - Initiator sent message."),c.logLocalEphemeralKeys(this.session.hs.e)}else{c.logger("IK Stage 0 - Responder receiving message...");const e=await this.connection.readLP();try{const t=s.decode1(e.slice()),{plaintext:r,valid:i}=this.ik.recvMessage(this.session,t);if(!i)throw new Error("ik handshake stage 0 decryption validation fail");c.logger("IK Stage 0 - Responder got message, going to verify payload.");const n=await o.decodePayload(r);this.remotePeer=this.remotePeer||await o.getPeerIdFromPayload(n),await o.verifySignedPayload(this.session.hs.rs,n,this.remotePeer),this.setRemoteEarlyData(n.data),c.logger("IK Stage 0 - Responder successfully verified payload!"),c.logRemoteEphemeralKey(this.session.hs.re)}catch(t){const r=t;throw c.logger("Responder breaking up with IK handshake in stage 0."),new a.FailedIKError(e,`Error occurred while verifying initiator's signed payload: ${r.message}`)}}}async stage1(){if(this.isInitiator){c.logger("IK Stage 1 - Initiator receiving message...");const e=(await this.connection.readLP()).slice(),t=s.decode0(n.Buffer.from(e)),{plaintext:r,valid:i}=this.ik.recvMessage(this.session,t);c.logger("IK Stage 1 - Initiator got message, going to verify payload.");try{if(!i)throw new Error("ik stage 1 decryption validation fail");const e=await o.decodePayload(r);this.remotePeer=this.remotePeer||await o.getPeerIdFromPayload(e),await o.verifySignedPayload(t.ns.slice(0,32),e,this.remotePeer),this.setRemoteEarlyData(e.data),c.logger("IK Stage 1 - Initiator successfully verified payload!"),c.logRemoteEphemeralKey(this.session.hs.re)}catch(t){const r=t;throw c.logger("Initiator breaking up with IK handshake in stage 1."),new a.FailedIKError(e,`Error occurred while verifying responder's signed payload: ${r.message}`)}}else{c.logger("IK Stage 1 - Responder sending message...");const e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP(s.encode0(e)),c.logger("IK Stage 1 - Responder sent message..."),c.logLocalEphemeralKeys(this.session.hs.e)}c.logCipherState(this.session)}decrypt(e,t){const r=this.getCS(t,!1);return this.ik.decryptWithAd(r,n.Buffer.alloc(0),e)}encrypt(e,t){const r=this.getCS(t);return this.ik.encryptWithAd(r,n.Buffer.alloc(0),e)}getLocalEphemeralKeys(){if(!this.session.hs.e)throw new Error("Ephemeral keys do not exist.");return this.session.hs.e}getCS(e,t=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?t?e.cs1:e.cs2:t?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=n.Buffer.from(e.buffer,e.byteOffset,e.length))}}},{"./handshakes/ik":"hBdbp",buffer:"etowf","./encoder":"fJwxo","./utils":"hkQyI","./errors":"7MQBJ","./logger":"iHFBc"}],hBdbp:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.IK=void 0;const i=e("buffer"),n=e("../utils"),s=e("./abstract-handshake");class o extends s.AbstractHandshake{initSession(e,t,r,i){const n=this.createEmptyKey();let s;return s=e?this.initializeInitiator(t,r,i,n):this.initializeResponder(t,r,i,n),{hs:s,i:e,mc:0}}sendMessage(e,t){let r;if(0===e.mc)r=this.writeMessageA(e.hs,t);else if(1===e.mc){const{messageBuffer:i,h:n,cs1:s,cs2:o}=this.writeMessageB(e.hs,t);r=i,e.h=n,e.cs1=s,e.cs2=o}else{if(!(e.mc>1))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");r=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");r=this.writeMessageRegular(e.cs2,t)}}return e.mc++,r}recvMessage(e,t){let r=i.Buffer.alloc(0),n=!1;if(0===e.mc&&({plaintext:r,valid:n}=this.readMessageA(e.hs,t)),1===e.mc){const{plaintext:i,valid:s,h:o,cs1:a,cs2:c}=this.readMessageB(e.hs,t);r=i,n=s,e.h=o,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:n}}writeMessageA(e,t){e.e=n.generateKeypair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const s=i.Buffer.from(e.s.publicKey),o=this.encryptAndHash(e.ss,s);this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));return{ne:r,ns:o,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=n.generateKeypair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const i=this.encryptAndHash(e.ss,t),s={ne:r,ns:this.createEmptyKey(),ciphertext:i},{cs1:o,cs2:a}=this.split(e.ss);return{messageBuffer:s,cs1:o,cs2:a,h:e.ss.h}}readMessageA(e,t){n.isValidPublicKey(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const{plaintext:r,valid:i}=this.decryptAndHash(e.ss,t.ns);i&&32===r.length&&n.isValidPublicKey(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));const{plaintext:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:s,valid:i&&o}}readMessageB(e,t){if(n.isValidPublicKey(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state should contain ephemeral key by now.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const{plaintext:r,valid:i}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:s,cs2:o}=this.split(e.ss);return{h:e.ss.h,valid:i,plaintext:r,cs1:s,cs2:o}}initializeInitiator(e,t,r,n){const s=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");this.mixHash(s,e),this.mixHash(s,r);return{ss:s,s:t,rs:r,re:i.Buffer.alloc(32),psk:n}}initializeResponder(e,t,r,n){const s=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");this.mixHash(s,e),this.mixHash(s,t.publicKey);return{ss:s,s:t,rs:r,re:i.Buffer.alloc(32),psk:n}}}r.IK=o},{buffer:"etowf","../utils":"hkQyI","./abstract-handshake":"8oSG2"}],"7MQBJ":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.FailedIKError=void 0;class i extends Error{constructor(e,t){super(t),this.initialMsg=e,this.name="FailedIKhandshake"}}r.FailedIKError=i},{}],"3Y81f":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.XXFallbackHandshake=void 0;const i=e("buffer"),n=e("./handshake-xx"),s=e("./utils"),o=e("./logger"),a=e("./encoder");class c extends n.XXHandshake{constructor(e,t,r,i,n,s,o,a,c){super(e,t,r,i,n,o,c),a&&(this.ephemeralKeys=a),this.initialMsg=s}async propose(){if(this.isInitiator)this.xx.sendMessage(this.session,i.Buffer.alloc(0),this.ephemeralKeys),o.logger("XX Fallback Stage 0 - Initialized state as the first message was sent by initiator."),o.logLocalEphemeralKeys(this.session.hs.e);else{o.logger("XX Fallback Stage 0 - Responder decoding initial msg from IK.");const e=a.decode0(this.initialMsg),{valid:t}=this.xx.recvMessage(this.session,{ne:e.ne,ns:i.Buffer.alloc(0),ciphertext:i.Buffer.alloc(0)});if(!t)throw new Error("xx fallback stage 0 decryption validation fail");o.logger("XX Fallback Stage 0 - Responder used received message from IK."),o.logRemoteEphemeralKey(this.session.hs.re)}}async exchange(){if(this.isInitiator){const e=a.decode1(this.initialMsg),{plaintext:t,valid:r}=this.xx.recvMessage(this.session,e);if(!r)throw new Error("xx fallback stage 1 decryption validation fail");o.logger("XX Fallback Stage 1 - Initiator used received message from IK."),o.logRemoteEphemeralKey(this.session.hs.re),o.logRemoteStaticKey(this.session.hs.rs),o.logger("Initiator going to check remote's signature...");try{const e=await s.decodePayload(t);this.remotePeer=this.remotePeer||await s.getPeerIdFromPayload(e),await s.verifySignedPayload(this.session.hs.rs,e,this.remotePeer),this.setRemoteEarlyData(e.data)}catch(e){throw new Error(`Error occurred while verifying signed payload from responder: ${e.message}`)}o.logger("All good with the signature!")}else o.logger("XX Fallback Stage 1 - Responder start"),await super.exchange(),o.logger("XX Fallback Stage 1 - Responder end")}}r.XXFallbackHandshake=c},{buffer:"etowf","./handshake-xx":"aO5Kw","./utils":"hkQyI","./logger":"iHFBc","./encoder":"fJwxo"}],fylsy:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decryptStream=r.encryptStream=void 0;const i=e("buffer"),n=e("./constants");r.encryptStream=function(e){return async function*(t){for await(const r of t){const t=i.Buffer.from(r.buffer,r.byteOffset,r.length);for(let r=0;r<t.length;r+=n.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG){let i=r+n.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG;i>t.length&&(i=t.length);const s=e.encrypt(t.slice(r,i),e.session);yield s}}}},r.decryptStream=function(e){return async function*(t){for await(const r of t){const t=i.Buffer.from(r.buffer,r.byteOffset,r.length);for(let r=0;r<t.length;r+=n.NOISE_MSG_MAX_LENGTH_BYTES){let i=r+n.NOISE_MSG_MAX_LENGTH_BYTES;i>t.length&&(i=t.length);const s=t.slice(r,i),{plaintext:o,valid:a}=await e.decrypt(s,e.session);if(!a)throw new Error("Failed to validate decrypted chunk");yield o}}}}},{buffer:"etowf","./constants":"dt6rC"}],"8Z0xy":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.KeyCache=void 0;const i=new class{constructor(){this.storage=new Map}store(e,t){this.storage.set(e.id,t)}load(e){var t;return e&&null!==(t=this.storage.get(e.id))&&void 0!==t?t:null}resetStorage(){this.storage.clear()}};r.KeyCache=i},{}],lEgzz:[function(e,t,r){"use strict";const{EventEmitter:i}=e("events"),n=e("err-code"),s=e("libp2p-record"),{MemoryDatastore:o}=e("datastore-core/memory"),{equals:a}=e("uint8arrays/equals"),{toString:c}=e("uint8arrays/to-string"),u=e("./routing-table"),l=e("./utils"),d=e("./constants"),f=e("./network"),h=e("./content-fetching"),p=e("./content-routing"),g=e("./peer-routing"),y=e("./message"),m=e("./providers"),b=e("./query-manager"),v=s.Record;t.exports=class extends i{constructor({libp2p:e,dialer:t,peerId:r,peerStore:i,registrar:n,protocolPrefix:a="/ipfs",forceProtocolLegacy:c=!1,datastore:y=new o,kBucketSize:v=d.K,clientMode:w=!1,concurrency:_=d.ALPHA,validators:E={},selectors:S={},onPut:T=(()=>{}),onRemove:A=(()=>{})}){if(super(),!t)throw new Error("libp2p-kad-dht requires an instance of Dialer");this.libp2p=e,this.dialer=t,this.peerId=r,this.peerStore=i,this.registrar=n,this.protocol=a+(c?"":d.PROTOCOL_DHT),this.kBucketSize=v,this._clientMode=w,this.concurrency=_,this.disjointPaths=Math.ceil(this.kBucketSize/2),this.routingTable=new u(this,{kBucketSize:this.kBucketSize}),this.datastore=y,this.providers=new m(this.datastore,this.peerId),this.validators={pk:s.validator.validators.pk,...E},this.selectors={pk:s.selection.selectors.pk,...S},this.network=new f(this),this._log=l.logger(this.peerId),this._queryManager=new b,this._running=!1,this.contentFetching=h(this),this.contentRouting=p(this),this.peerRouting=g(this),this.onPut=T,this.onRemove=A}get isStarted(){return this._running}start(){return this._running=!0,Promise.all([this.providers.start(),this._queryManager.start(),this.network.start(),this.routingTable.start()])}stop(){return this._running=!1,Promise.all([this.providers.stop(),this._queryManager.stop(),this.network.stop(),this.routingTable.stop()])}async put(e,t,r={}){return this.contentFetching.put(e,t,r)}async get(e,t={}){return this.contentFetching.get(e,t)}async getMany(e,t,r={}){return this.contentFetching.getMany(e,t,r)}async removeLocal(e){this._log(`removeLocal: ${c(e,"base32")}`);const t=l.bufferToKey(e);try{await this.datastore.delete(t)}catch(e){if("ERR_NOT_FOUND"===e.code)return;throw e}}async _putLocal(e,t){this._log(`_putLocal: ${c(e,"base32")}`);const r=l.bufferToKey(e);await this.datastore.put(r,t)}async provide(e){return this.contentRouting.provide(e)}async*findProviders(e,t={timeout:6e3,maxNumProviders:5}){for await(const r of this.contentRouting.findProviders(e,t))yield r}async findPeer(e,t={timeout:6e4}){return this.peerRouting.findPeer(e,t)}async*getClosestPeers(e,t={shallow:!1}){yield*this.peerRouting.getClosestPeers(e,t)}getPublicKey(e){return this.peerRouting.getPublicKey(e)}_peerDiscovered(e,t){this.emit("peer",{id:e,multiaddrs:t})}async _nearestPeersToQuery(e){const t=await l.convertBuffer(e.key);return this.routingTable.closestPeers(t,this.kBucketSize).map((e=>{const t=this.peerStore.get(e);return{id:e,multiaddrs:t?t.addresses.map((e=>e.multiaddr)):[]}}))}async _betterPeersToQuery(e,t){this._log("betterPeersToQuery");return(await this._nearestPeersToQuery(e)).filter((e=>this._isSelf(e.id)?(this._log.error("trying to return self as closer"),!1):!e.id.isEqual(t)))}async _checkLocalDatastore(e){this._log(`checkLocalDatastore: ${c(e)} %b`,e);const t=l.bufferToKey(e);let r;try{r=await this.datastore.get(t)}catch(e){if("ERR_NOT_FOUND"===e.code)return;throw e}const i=v.deserialize(r);if(!i)throw n(new Error("Invalid record"),"ERR_INVALID_RECORD");return null==i.timeReceived||l.now()-i.timeReceived.getTime()>d.MAX_RECORD_AGE?(await this.datastore.delete(t),void this.onRemove(i)):i}async _add(e){await this.routingTable.add(e)}async _verifyRecordLocally(e){this._log("verifyRecordLocally"),await s.validator.verifyRecord(this.validators,e)}_isSelf(e){return e&&a(this.peerId.id,e.id)}async _putValueToPeer(e,t,r){const i=new y(y.TYPES.PUT_VALUE,e,0);i.record=v.deserialize(t);const s=await this.network.sendRequest(r,i);if(s.record&&!a(s.record.value,v.deserialize(t).value))throw n(new Error("value not put correctly"),"ERR_PUT_VALUE_INVALID")}async _getValueOrPeers(e,t){const r=await this._getValueSingle(e,t),i=r.closerPeers,s=r.record;if(s){try{await this._verifyRecordOnline(s)}catch(e){const t="invalid record received, discarded";throw this._log(t),n(new Error(t),"ERR_INVALID_RECORD")}return{record:s,peers:i}}if(i.length>0)return{peers:i};throw n(new Error("Not found"),"ERR_NOT_FOUND")}async _getValueSingle(e,t){const r=new y(y.TYPES.GET_VALUE,t,0);return this.network.sendRequest(e,r)}async _verifyRecordOnline(e){await s.validator.verifyRecord(this.validators,e)}},t.exports.multicodec="/ipfs"+d.PROTOCOL_DHT},{events:"g82pp","err-code":"chZjB","libp2p-record":"h5gPS","datastore-core/memory":"farQr","uint8arrays/equals":"eY3cX","uint8arrays/to-string":"hC8JB","./routing-table":"6K2UO","./utils":"eTk1n","./constants":"4YMVW","./network":"4PJUJ","./content-fetching":"7ohZp","./content-routing":"bDSmy","./peer-routing":"nezkB","./message":"dWtGc","./providers":"lunE9","./query-manager":"9th0A"}],"6K2UO":[function(e,t,r){"use strict";const i=e("k-bucket"),{xor:n}=e("uint8arrays/xor"),s=e("./generated-prefix-list.json"),{sha256:o}=e("multiformats/hashes/sha2"),a=e("libp2p-crypto"),c=e("peer-id"),u=e("../utils"),l=e("debug"),d=Object.assign(l("libp2p:dht:routing-table"),{error:l("libp2p:dht:routing-table:error")}),f=e("it-length");t.exports=class{constructor(e,{kBucketSize:t,refreshInterval:r}={}){this.peerId=e.peerId,this.dht=e,this._kBucketSize=t||20,this._refreshInterval=r||3e4,this.kb=new i({numberOfNodesPerKBucket:this._kBucketSize,numberOfNodesToPing:1}),this.commonPrefixLengthRefreshedAt=[],this._refreshTable=this._refreshTable.bind(this),this._onPing=this._onPing.bind(this)}async start(){this.kb.localNodeId=await u.convertPeerId(this.peerId),this.kb.on("ping",this._onPing),await this._refreshTable(!0)}async stop(){this._refreshTimeoutId&&clearTimeout(this._refreshTimeoutId)}async _refreshTable(e){d("refreshing routing table");const t=this._maxCommonPrefix(),r=this._getTrackedCommonPrefixLengthsForRefresh(t);d(`max common prefix length ${t}`),d(`tracked CPLs [ ${r.map((e=>`${e.getFullYear()}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")} ${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}`)).join(", ")} ]`),await Promise.all(r.map((async(i,n)=>{try{if(await this._refreshCommonPrefixLength(n,i,!0===e),0===this._numPeersForCpl(t)){const t=Math.min(2*(n+1),r.length-1);for(let r=n+1;r<t+1;r++)try{await this._refreshCommonPrefixLength(r,i,!0===e)}catch(e){d.error(e)}}}catch(e){d.error(e)}}))),this._refreshTimeoutId=setTimeout(this._refreshTable,this._refreshInterval),this._refreshTimeoutId.unref()}async _refreshCommonPrefixLength(e,t,r){if(!r&&t.getTime()>Date.now()-this._refreshInterval)return void d(`not running refresh for cpl ${e} as time since last refresh not above interval`);const i=await this._generateRandomPeerId(e);d(`starting refreshing cpl ${e} with key ${i.toB58String()} (routing table size was ${this.kb.count()})`);const n=await f(this.dht.getClosestPeers(i.toBytes(),{}));d(`found ${n} peers that were close to imaginary peer ${i.toB58String()}`),d(`finished refreshing cpl ${e} with key ${i.toB58String()} (routing table size was ${this.kb.count()})`)}_getTrackedCommonPrefixLengthsForRefresh(e){e>15&&(e=15);const t=[];for(let r=0;r<=e;r++)t[r]=this.commonPrefixLengthRefreshedAt[r]||new Date;return t}async _generateRandomPeerId(e){const t=a.randomBytes(2),r=(t[1]<<8)+t[0],i=await this._makePeerId(this.kb.localNodeId,r,e);return c.createFromBytes(i)}async _makePeerId(e,t,r){if(r>15)throw new Error("Cannot generate peer ID for common prefix length greater than 15");const i=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(0,!1),n=65535<<16-(r+1),a=s[(i^32768>>r)&n|t&~n],c=new ArrayBuffer(34),u=new DataView(c,0,c.byteLength);return u.setUint8(0,o.code),u.setUint8(1,32),u.setUint32(2,a,!1),new Uint8Array(u.buffer,u.byteOffset,u.byteLength)}_maxCommonPrefix(){if(!this.kb.localNodeId)return 0;let e=0;for(const t of this._prefixLengths())t>e&&(e=t);return e}_numPeersForCpl(e){let t=0;for(const r of this._prefixLengths())r===e&&t++;return t}*_prefixLengths(){for(const{id:e}of this.kb.toIterable()){const t=n(this.kb.localNodeId,e);let r=0;for(const e of t){if(0!==e)break;r++}yield r}}_onPing(e,t){const r=e[0];r&&this.kb.remove(r.id),this.kb.add(t)}get size(){return this.kb.count()}async find(e){const t=await u.convertPeerId(e),r=this.closestPeer(t);if(r&&e.equals(r))return r}closestPeer(e){const t=this.closestPeers(e,1);if(t.length>0)return t[0]}closestPeers(e,t){return this.kb.closest(e,t).map((e=>e.peer))}async add(e){const t=await u.convertPeerId(e);this.kb.add({id:t,peer:e})}async remove(e){const t=await u.convertPeerId(e);this.kb.remove(t)}}},{"k-bucket":"6o2Us","uint8arrays/xor":"6wTd5","./generated-prefix-list.json":"15vmo","multiformats/hashes/sha2":"7i9MT","libp2p-crypto":"bb1cb","peer-id":"8Bdb3","../utils":"eTk1n",debug:"bO5wM","it-length":"6ksGI"}],"6o2Us":[function(e,t,r){"use strict";const i=e("randombytes"),{EventEmitter:n}=e("events");function s(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;++r)if(e[r]!==t[r])return!1;return!0}function o(e,t){if(!(t instanceof Uint8Array))throw new TypeError(e+" is not a Uint8Array")}class a extends n{constructor(e={}){super(),this.localNodeId=e.localNodeId||i(20),this.numberOfNodesPerKBucket=e.numberOfNodesPerKBucket||20,this.numberOfNodesToPing=e.numberOfNodesToPing||3,this.distance=e.distance||a.distance,this.arbiter=e.arbiter||a.arbiter,this.metadata=Object.assign({},e.metadata),o("option.localNodeId as parameter 1",this.localNodeId),this.root={contacts:[],dontSplit:!1,left:null,right:null}}static arbiter(e,t){return e.vectorClock>t.vectorClock?e:t}static distance(e,t){let r=0,i=0;const n=Math.min(e.length,t.length),s=Math.max(e.length,t.length);for(;i<n;++i)r=256*r+(e[i]^t[i]);for(;i<s;++i)r=256*r+255;return r}add(e){o("contact.id",(e||{}).id);let t=0,r=this.root;for(;null===r.contacts;)r=this._determineNode(r,e.id,t++);const i=this._indexOf(r,e.id);return i>=0?(this._update(r,i,e),this):r.contacts.length<this.numberOfNodesPerKBucket?(r.contacts.push(e),this.emit("added",e),this):r.dontSplit?(this.emit("ping",r.contacts.slice(0,this.numberOfNodesToPing),e),this):(this._split(r,t),this.add(e))}closest(e,t=1/0){if(o("id",e),!Number.isInteger(t)&&t!==1/0||t<=0)throw new TypeError("n is not positive number");let r=[];for(let i=[this.root],n=0;i.length>0&&r.length<t;){const t=i.pop();if(null===t.contacts){const r=this._determineNode(t,e,n++);i.push(t.left===r?t.right:t.left),i.push(r)}else r=r.concat(t.contacts)}return r.map((t=>[this.distance(t.id,e),t])).sort(((e,t)=>e[0]-t[0])).slice(0,t).map((e=>e[1]))}count(){let e=0;for(const t=[this.root];t.length>0;){const r=t.pop();null===r.contacts?t.push(r.right,r.left):e+=r.contacts.length}return e}_determineNode(e,t,r){const i=r>>3,n=r%8;if(t.length<=i&&0!==n)return e.left;return t[i]&1<<7-n?e.right:e.left}get(e){o("id",e);let t=0,r=this.root;for(;null===r.contacts;)r=this._determineNode(r,e,t++);const i=this._indexOf(r,e);return i>=0?r.contacts[i]:null}_indexOf(e,t){for(let r=0;r<e.contacts.length;++r)if(s(e.contacts[r].id,t))return r;return-1}remove(e){o("the id as parameter 1",e);let t=0,r=this.root;for(;null===r.contacts;)r=this._determineNode(r,e,t++);const i=this._indexOf(r,e);if(i>=0){const e=r.contacts.splice(i,1)[0];this.emit("removed",e)}return this}_split(e,t){e.left={contacts:[],dontSplit:!1,left:null,right:null},e.right={contacts:[],dontSplit:!1,left:null,right:null};for(const r of e.contacts)this._determineNode(e,r.id,t).contacts.push(r);e.contacts=null;const r=this._determineNode(e,this.localNodeId,t);(e.left===r?e.right:e.left).dontSplit=!0}toArray(){let e=[];for(const t=[this.root];t.length>0;){const r=t.pop();null===r.contacts?t.push(r.right,r.left):e=e.concat(r.contacts)}return e}*toIterable(){for(const e=[this.root];e.length>0;){const t=e.pop();null===t.contacts?e.push(t.right,t.left):yield*t.contacts}}_update(e,t,r){if(!s(e.contacts[t].id,r.id))throw new Error("wrong index for _update");const i=e.contacts[t],n=this.arbiter(i,r);n===i&&i!==r||(e.contacts.splice(t,1),e.contacts.push(n),this.emit("updated",i,n))}}t.exports=a},{randombytes:"jH1v5",events:"g82pp"}],"6wTd5":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.xor=function(e,t){if(e.length!==t.length)throw new Error("Inputs should have the same length");const r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e[i]^t[i];return r}},{}],"15vmo":[function(e,t,r){t.exports=JSON.parse("[77591,22417,43971,28421,740,29829,71467,228973,196661,78537,27689,36431,44415,14362,19456,106025,96308,2882,49509,21149,87173,131409,75844,23676,121838,30291,17492,2953,7564,110620,129477,127283,53113,72417,165166,109690,21200,102125,24049,71504,90342,25307,72039,26812,26715,32264,133800,71161,88956,171987,51779,24425,16671,30251,186294,247761,14202,2121,8465,35024,4876,85917,169730,3638,256836,96184,943,18678,6583,52907,35807,112254,214097,18796,11595,9243,23554,887,268203,382004,24590,111335,11625,16619,29039,102425,69006,97976,92362,32552,63717,41433,128974,137630,59943,10019,13986,35430,33665,108037,43799,43280,38195,29078,58629,18265,14425,46832,235538,40830,77881,110717,58937,3463,325358,51300,47623,117252,19007,10170,20540,91237,294813,4951,79841,56232,36270,128547,69209,66275,100156,32063,73531,34439,80937,28892,44466,88595,216307,32583,49620,16605,82127,45807,21630,78726,20235,40163,111007,96926,5567,72083,21665,58844,39419,179767,48328,42662,51550,5251,37811,49608,81056,50854,55513,20922,18891,197409,164656,32593,71449,220474,58919,85682,67854,13758,35066,3565,61905,214793,119572,141419,21504,10302,27354,67003,46131,32668,15165,64871,34450,17821,2757,11452,34189,5160,12257,85523,560,53385,65887,119549,135620,312353,115979,122356,10867,193231,124537,54783,90675,120791,4715,142253,50943,17271,43358,25331,4917,120566,34580,12878,33786,160528,32523,4869,301307,104817,81491,23276,8832,97911,31265,52065,7998,49622,9715,43998,34091,84587,20664,69041,29419,53205,10838,58288,116145,6185,5154,141795,35924,21307,144738,43730,12085,8279,10002,119,133779,199668,72938,31768,39176,67875,38453,9700,44144,4121,116048,41733,12868,82669,92308,128,34262,11332,7712,90764,36141,13553,71312,77470,117314,96549,49135,23602,54468,28605,6327,62308,17171,67531,21319,14105,894,107722,46157,8503,51069,100472,45138,15246,14577,35609,191464,1757,13364,161349,32067,91705,81144,52339,5408,91066,21983,14157,100545,4372,26630,129112,1423,29676,213626,4397,88436,99190,6877,49958,26122,114348,60661,29818,293118,50042,179738,16400,163423,89627,31040,43973,36638,45952,5153,1894,109322,1898,134021,12402,112077,68309,190269,69866,31938,107383,11522,105232,11248,14868,39852,71707,186525,16530,38162,106212,11700,5130,16608,26998,59586,108399,230033,43683,48135,82179,2073,5015,196684,189293,16378,23452,8301,35640,11632,214551,29240,57644,33137,91949,55157,52384,117313,5090,17717,89668,49363,82238,241035,66216,29066,184088,97206,62820,26595,4241,135635,173672,8202,459,71355,146294,29587,3008,135385,141203,14803,6634,45094,69362,50925,546,51884,62011,83296,234584,44515,56050,89476,87751,19373,12691,149923,19794,13833,35846,87557,58339,2884,19145,25647,12224,11024,77338,64608,122297,53025,7205,36189,36294,170779,21750,7739,173883,75192,35664,224240,113121,30181,26267,27036,117827,92015,106516,55628,203549,67949,60462,60844,35911,20457,1820,920,19773,8738,73173,181993,38521,98254,76257,46008,92796,5384,26868,151566,22124,2411,15919,186872,180021,28099,152961,78811,80237,62352,102653,74259,184890,16792,123702,224945,29940,19512,75283,14059,112691,92811,233329,20411,138569,53341,109802,50600,134528,66747,5529,166531,31578,64732,67189,1596,126357,967,167999,206598,109752,119431,207825,78791,91938,10301,27311,24233,252343,28831,32812,66002,112267,90895,8786,8095,16824,22866,21813,60507,174833,19549,130985,117051,52110,6938,81923,123864,38061,919,18680,53534,46739,112893,161529,85429,26761,11900,81121,91968,15390,217947,56524,1713,6654,37089,85630,138866,61850,16491,75577,16884,98296,73523,6140,44645,6062,36366,29844,57946,37932,42472,5266,20834,19309,33753,127182,134259,35810,41805,45878,312001,14881,47757,49251,120050,44252,3708,25856,107864,120347,1228,36550,41682,34496,47025,8393,173365,246526,12894,161607,35670,90785,126572,2095,124731,157033,58694,554,12786,9642,4817,16136,47864,174698,66992,4639,69284,10625,40710,27763,51738,30404,264105,137904,109882,52487,42824,57514,2740,10479,146799,107390,16586,88038,174951,9410,16185,44158,5568,40658,46108,12763,97385,26175,108859,664,230732,67470,46663,14395,50750,141320,93140,15361,47997,55784,6791,307840,118569,107326,18056,58281,260415,54691,8790,73332,45633,7511,45674,143373,14031,11799,94491,35646,96544,14560,26049,32983,25791,83814,42094,231370,63955,139212,2359,169908,3108,183486,105867,28197,32941,124968,26402,88267,149768,23053,3078,19091,52924,25383,19209,111548,97361,3959,24880,235061,9099,24921,161254,151405,20508,7159,34381,20133,11434,74036,19974,34769,36585,1076,22454,17354,38727,235160,111547,96454,117448,156940,91330,37299,7310,26915,117060,51369,22620,61861,322264,106850,111694,15091,2624,40345,300446,177064,1707,27389,54792,327783,132669,183543,59003,17744,20603,151134,106923,53084,71803,279424,319816,11579,21946,16728,38274,72711,5085,83391,88646,40159,25027,34680,10752,12988,54126,30365,18338,100445,230674,44874,84974,143877,123253,139372,28082,91477,144002,13096,219729,46016,50029,42377,14601,6660,58244,58978,23918,88206,113611,64452,17541,41032,10942,12021,49189,10978,40175,37156,10947,71709,106894,112538,57007,137486,150608,152719,40615,7746,279716,13101,19524,28708,40578,72320,1096,182051,94527,51275,22833,45164,81917,77519,48508,5421,140302,37845,149830,5587,27579,5357,428725,248187,6326,206760,39814,32585,89923,44341,288753,284443,96368,31201,94189,119504,20359,52073,103216,179,27934,32801,96035,34111,34309,101326,18198,20704,210266,37643,27880,141873,106000,19414,56614,167714,66483,107885,86602,4379,20796,75467,4987,5017,118857,26003,34308,114428,29198,6686,29697,73632,3739,69795,16798,41504,7207,30722,21436,36735,28067,28545,3239,11221,36031,41889,100010,19247,317673,29495,174554,6424,129725,53845,94986,7955,59676,2604,191497,19735,102214,62954,23844,11872,179525,261436,34492,428,78404,142035,16747,17246,27578,37021,33672,57944,26056,135760,2369,61674,122066,31327,19374,157065,40553,130982,69619,71290,38855,72100,92903,95940,51422,165999,65713,57873,50726,7288,20272,2081,42326,22624,81120,57914,79352,19447,1684,72302,11774,302559,161481,96396,13692,414988,3721,79066,56627,46883,21150,11747,12184,5856,113458,176117,84416,52079,27933,3354,59765,141359,2212,216309,2555,23458,196722,142463,45701,44548,28798,19418,215,29916,9396,10574,114226,84475,13520,18694,34056,4524,90302,62930,13539,19407,77209,7728,38088,9535,2263,23875,183945,17750,26274,67172,10585,28042,22199,7478,51331,66030,26774,192929,31434,25850,50197,52926,178158,4679,181256,70184,229600,9959,105594,72158,73974,2726,35085,78087,23284,35568,51713,155676,5401,27254,11966,17569,223253,71993,103357,111477,55722,30504,26034,46774,35392,36285,214814,41143,163465,1051,16094,81044,6636,76489,179102,20712,39178,35683,125177,54219,30617,52994,25324,50123,2543,87529,58995,10688,125199,12388,60158,125481,131646,7642,133350,65874,3438,97277,101450,10075,56344,116821,50778,60547,98016,106135,13859,14255,16300,77373,173521,8285,45932,37426,4054,114295,55947,7703,39114,52,51119,128135,19714,60715,9554,50492,88180,2823,118271,52993,122625,97919,23859,37895,25040,33614,32102,20431,3577,9275,15686,43031,157741,110358,1884,40291,125391,13736,5008,64881,87336,77381,70711,43032,49155,118587,70494,4318,10168,30126,12580,10524,280104,104001,145413,2862,84140,6603,106005,13566,12780,11251,42830,571,179910,82443,13146,469,42714,32591,265217,424024,92553,54721,134100,6007,15242,114681,59030,16718,85465,200214,85982,55174,165013,23493,56964,82529,109150,32706,27568,82442,5350,14976,13165,44890,60021,21343,33978,17264,4655,22328,27819,75730,16567,55483,14510,17926,45827,150609,3704,7385,272531,161543,76904,122163,52405,2039,19165,41623,14423,228354,3369,176360,85491,7122,35789,303724,4465,13628,2233,55311,118771,20713,10006,221519,45115,71021,35650,29775,7337,10864,20665,21142,1746,15080,1624,32449,10905,105743,229797,7701,3940,22997,178467,57208,389057,39683,59403,63344,63125,54847,69691,18336,56448,3362,37202,18282,29648,138224,35867,10495,5911,28814,26653,31514,176702,26550,45621,11734,4525,40543,73944,121080,27858,155561,14887,44670,30742,8796,107455,113472,56369,75581,183777,240095,133699,153299,8768,160464,26058,49078,103971,21875,71486,44888,17156,9678,89541,123019,102337,3972,83930,21245,87852,109660,287918,183019,686,10100,39177,283941,11274,24736,26793,26214,25995,77011,141580,4070,23742,46285,46632,30700,26669,19056,35951,115575,174034,56097,35463,87425,24575,44245,38701,82317,85922,281616,100333,147697,61503,7730,84330,8530,59917,61597,17173,9092,32658,90288,193136,39023,20381,56654,31132,7779,1919,1375,117128,30819,11169,40938,23935,115201,101155,151034,4835,11231,74550,89388,59951,91704,107312,167882,115062,12732,72738,88703,464019,158267,57995,60496,737,14371,123867,4174,243339,159946,7568,16025,134556,110916,38103,191,80226,88794,29688,27230,10454,76308,57647,77409,113483,66864,14745,19808,12023,46583,84805,16015,17102,2231,20611,3547,95740,250131,34559,108894,8498,15853,159169,148920,20942,2813,93160,45188,210613,45531,52587,149062,39782,28194,57849,60965,84954,89766,84453,100927,16501,27658,165311,103841,54192,207341,19558,20084,319622,5672,205467,98462,61849,36279,13609,147177,24726,165015,209489,59591,31157,6551,117580,75060,141146,277310,21072,22023,106474,63041,137443,122965,68371,5383,42146,98961,113467,30863,23794,4843,99630,30392,82679,13699,241612,33601,93146,24319,18643,32155,95669,40440,15333,34089,67799,142144,58245,38633,114531,117400,77861,188726,5507,2568,8853,10987,107222,2663,2421,11530,13345,30075,41785,118661,104786,17459,12490,16281,71936,193555,17431,5944,71758,26485,77317,20803,367167,158,7362,93430,11735,172445,46002,11532,54482,930,62911,2235,23004,179236,4764,101859,208113,22477,55163,95579,14098,67320,162556,90709,156949,3826,57492,4025,34092,87442,104565,6718,186015,28214,14209,10039,107186,233912,58877,81637,55265,39828,6194,145813,50831,105849,4974,88319,122296,10272,197216,95714,51540,72418,23324,91555,8743,140452,250249,51666,34124,7229,38592,129641,78169,174242,22464,149964,51450,14034,10026,95376,26190,120062,14401,8700,265,31386,143573,7203,229889,61567,4227,140981,2466,72052,10787,10062,30958,6099,38471,30103,23202,208101,70847,467,58934,32271,32984,36637,24107,30771,17109,73353,13650,2098,157040,67366,66904,106018,265380,107238,18535,44025,32681,144983,62505,91295,56120,3082,77508,10322,63023,36700,81885,224127,16721,45023,239261,111272,13852,7866,149243,204199,32309,22084,42029,38316,126644,104973,14406,43454,67322,61310,15789,40285,24026,181047,6301,70927,23319,115823,27248,66693,115875,278566,63007,146844,56841,59007,87368,180001,22370,42114,80605,12022,10374,308,25079,14689,12618,63368,7936,264973,212291,136713,95999,105801,18965,32075,48700,52230,35119,96912,32992,8586,16606,101333,101812,14969,39930,759,193090,27387,42914,12937,5058,62646,64528,38624,25743,37502,3716,4435,30352,178687,26461,132611,42002,138442,35833,59582,16345,8048,60319,49349,309,47800,49739,90482,26405,34470,63786,32479,85028,39866,47846,11649,23934,29466,2816,42864,31828,7410,74885,49632,47629,111801,90749,19536,18767,105764,59606,21223,10746,76298,22220,39408,7190,79654,64856,11602,82156,272765,17079,70089,245473,51813,184407,384678,1576,122249,5064,27481,6188,25790,74361,27541,318284,45430,31488,620,93579,45723,192118,22670,51913,4162,70244,35966,26397,16199,50899,209613,121702,287507,2993,36101,132229,67345,33062,76295,118628,78705,52316,34375,107083,107454,44863,127561,33964,3073,154010,190914,55967,39074,6272,31047,5550,41123,26154,98638,47110,19998,148091,50229,31329,59900,195442,19106,61347,73497,70015,682,45850,25776,38022,148951,6288,37411,232526,109277,27286,32342,9262,5220,16651,23175,46740,129438,78614,121925,66914,88710,127952,5563,21500,34521,10739,14863,191006,62956,17359,16749,67027,56284,69134,43301,35039,58883,54466,60823,404451,75743,59856,86979,7923,34273,83785,32142,7693,268986,197428,282681,17049,22346,22990,92245,107180,3357,37104,96724,49153,7683,31197,43267,82231,164276,23696,20848,188364,22309,24821,158707,1018,22514,70922,27792,45589,59709,10765,736,35218,63479,51987,24275,63588,55361,92929,81964,4658,20122,12330,44058,13065,311456,72224,8337,211229,38979,22590,138478,52757,32595,133600,8838,31549,94412,43391,90056,1585,94802,127271,6223,31889,137038,132910,2165,57616,230152,6080,10748,36737,74579,134062,50525,180532,119270,34556,76155,82394,52595,29258,31435,87820,67996,26943,183878,38007,2410,13526,180297,69856,3503,187396,167700,7838,16701,9199,56267,3661,37407,65994,23767,5708,62508,221700,67088,86978,46776,84434,32088,5612,9149,88244,21685,95151,46750,189612,2979,506311,2594,3628,40074,105039,78243,28523,6651,38058,71999,30992,12764,68261,108991,6165,26450,61961,13400,22426,7490,60890,109623,2070,12958,50355,67979,257096,7213,42578,52121,35716,65461,7516,124758,39268,302,64712,14977,1467,219452,2840,34229,11121,21602,19270,63574,8024,1532,17331,79839,78885,52029,180767,57957,6069,91265,61380,55767,8927,32881,287603,22149,35029,68876,6428,199567,46926,13412,104132,21434,366616,45060,110046,81924,128910,45886,52821,130416,29416,77342,21762,67329,121432,79924,11724,38625,81006,102033,28338,13326,3250,82056,82526,38212,21112,12382,111495,3263,7414,86274,93490,40844,30224,45212,24019,48411,71367,24941,76729,57776,3769,38114,202019,197745,31953,237533,33270,201580,255648,100798,44741,32241,98468,106931,10085,15090,170358,33154,66787,18819,69760,25061,234005,82660,6295,131975,16874,9076,4094,25005,17740,40908,19533,220019,44330,99792,50040,19619,13950,55228,24423,31253,95308,103177,184795,28590,82285,5059,3210,75525,49894,70007,56178,10580,36051,139681,21617,98736,3555,106306,164189,37352,63915,47824,24883,145530,61904,28444,11483,19837,145446,30420,112972,85939,11835,191233,2262,20705,58630,1753,148334,1197,144714,6887,11223,107667,60879,77914,4151,57417,81594,96681,169430,1784,20444,95138,254041,27038,596,7117,72808,13759,3353,126776,21074,55322,27081,36942,39547,139830,179275,4453,713,8722,71399,19204,25785,22794,23923,104114,11291,25458,102309,88396,75288,230440,206396,104551,58447,130857,37247,94734,31548,176529,226077,65159,20104,10096,66881,94191,237909,27109,37404,1520,27421,25220,113003,23423,24884,50585,6286,231877,150800,11789,3226,90004,60642,5053,202400,61442,132531,175329,57138,30116,103847,9973,75367,16452,32360,59119,21246,10191,164804,23305,61051,37348,154530,13214,5468,50403,66754,130976,50559,80515,14436,155492,84017,5472,43107,41240,2890,90431,70188,382,76234,48040,50211,281038,237007,32115,142178,1536,22761,96429,1811,31243,1679,49143,55209,17402,235054,61494,7462,77030,34925,87609,78002,9499,9027,73289,201078,101379,63544,27666,5469,10642,30029,49816,132979,95620,58086,351930,116300,2110,2043,30845,6154,11279,16727,4122,2277,27281,4971,3650,39060,61970,65951,39674,75686,38151,11370,130809,177895,32665,63725,122267,7857,39618,118483,44792,157755,178624,136994,24260,41308,22471,12404,21707,12486,30473,52781,50246,20247,39065,909,56825,103158,128603,31542,1089,41935,32744,12428,37963,84420,33134,72921,208449,42622,168151,127335,147107,46699,38216,12591,94342,85814,31423,24944,2605,87542,67473,192551,4496,56321,91819,17630,6300,256183,114569,202090,33209,35289,34897,24967,40520,43470,5344,10199,34810,14283,10381,10017,62923,49924,23233,64539,13051,35686,19698,11570,135555,120868,44924,87065,52318,52335,47586,140906,245885,109834,78668,9065,46990,25258,72022,61243,40838,4545,146387,10537,11557,17470,36930,68104,46711,24264,79401,81043,18225,120488,24746,84338,81652,28266,13776,21878,46973,1047,230465,73357,95777,24973,210160,62210,58404,110633,169651,6937,41870,9909,26822,191062,76553,27519,96256,239070,2478,205678,67955,58532,20601,50120,19148,78501,195724,110740,8249,109665,27446,30568,57631,31425,49752,32820,65504,50079,3663,102256,219898,23849,211315,14645,4359,91767,9528,12449,49366,7941,49763,107848,8930,27086,50686,9744,10447,81935,39513,46514,1670,29229,6172,22312,137280,97759,9806,14445,22976,56458,73391,34983,93760,174219,52573,33149,59747,2429,136277,75123,165263,91040,7446,57632,48633,97140,246081,84766,151684,79918,93268,120346,54059,54875,77858,32996,103590,45276,11968,19600,25849,17159,132907,42828,16817,4913,99462,103303,27395,5737,74184,20749,21160,14377,77062,131403,158735,10999,27799,77785,9320,34366,51593,61070,33746,47048,29268,36675,30262,53297,9832,82000,20188,122292,39917,7331,18160,68301,185935,134830,15031,4935,10004,165845,185534,46923,30109,44134,122631,18874,22903,112790,26561,18549,348902,82871,140345,255565,135390,63556,103747,145055,179600,145662,296111,61661,211987,23952,52342,126343,48450,32919,44277,82185,9591,62139,205363,376969,394874,108461,18040,120885,14798,39863,16571,16794,58271,81025,55206,14640,118656,6361,44092,85970,6262,153863,108244,180200,72264,79947,38044,10050,5735,61221,80712,5471,115689,11391,11661,184257,20010,60116,30320,19327,134598,45455,27542,18004,125092,452272,1549,91523,46567,180063,156026,2608,11174,58848,37788,65907,80194,30490,5786,40775,119519,106241,11323,156297,8425,61495,2617,29675,2425,59886,112582,49142,59618,4863,50597,86710,50650,168632,27693,85641,83643,18993,25768,84284,28090,93592,36627,312804,43381,9887,9402,100931,97165,3311,173330,66805,28935,4963,184460,3201,78102,19126,21607,37496,24938,22615,16153,32862,134792,153318,61120,6067,2812,12826,12792,23825,37559,64662,202250,102694,155488,85881,149193,46233,65383,15521,106982,11358,176786,25752,39717,34208,24510,32464,77742,39371,72028,138229,60688,71386,102834,132477,2208,11548,63670,271279,28351,30338,38620,32491,99845,143885,152266,13252,2825,178663,108097,1775,78201,14897,113573,163346,62292,171129,22183,96598,38733,64971,166776,117445,9968,146393,44677,74867,20908,97328,12761,25656,26785,9148,112344,26115,99176,110121,22437,49547,6180,79320,5835,31392,43328,33377,75870,119860,69497,80273,7325,155219,43167,111173,28347,20222,3763,71752,55041,47252,14618,28088,15012,97805,194698,54636,2036,41349,6173,96604,61530,51859,43782,13361,24334,22668,24792,7070,23441,16789,3209,36211,208475,26242,32880,122181,182407,21444,31060,88459,29929,77907,12716,10934,97005,20599,31690,8403,58445,30303,22700,10336,86731,103115,337709,72556,46788,112566,47684,67089,53548,36874,56487,41387,125985,26893,40071,106683,73712,18787,40105,72992,67246,137276,50802,36790,70328,138827,22466,39263,183295,29858,50975,9322,57397,10654,24364,30383,55799,41600,23584,127295,296610,129078,143558,244131,86397,36049,1085,80677,3820,108139,5476,34767,24683,7758,13060,7239,131671,250593,59556,103392,29810,4188,252323,39404,116877,7651,43600,40338,13554,157253,39196,25978,144387,61211,234,50104,6129,10449,93777,9240,356378,274148,4439,72970,3724,147770,78680,62570,115877,40027,40547,36817,224392,64609,34795,165027,67440,2477,37206,23431,50754,164797,46018,94995,170982,27051,7957,22767,3674,27900,56419,18930,60701,41302,2692,84749,339721,61996,111094,80221,50129,1045,8153,62945,19202,8250,37208,37418,32560,79477,41106,88569,33963,36693,5892,30570,1581,66471,49647,11922,160717,29442,5643,114865,82962,95982,132098,22633,22838,94726,54556,28566,205039,162340,33216,16849,35847,221339,94851,26533,71469,1805,3804,12935,45483,71020,36310,65381,192960,34240,35165,59773,1248,46954,155332,96864,4246,388800,16129,57133,74592,44807,442014,38203,42574,80818,91592,26377,36424,65760,977,77387,22628,147610,28018,30561,98454,6969,119628,63648,18170,36854,26601,64018,22027,37279,51395,152934,21153,9430,58760,194742,5330,55115,34158,28917,174111,13171,122326,1526,43896,66094,25325,4234,148354,11450,275,18999,112191,44365,22723,68409,8733,57746,96565,75007,14196,108844,29475,88599,177563,100792,106156,86323,93726,14248,135341,194131,40126,47099,14779,8272,39597,95983,171398,65882,28052,10393,47213,40689,22120,72212,106829,34964,109146,753,648,21660,30047,17527,181025,5619,145357,4085,216883,9359,186951,24779,53931,24545,36197,223296,62628,168101,4243,107313,30321,26642,13049,51059,31027,107912,807,73550,26551,84369,122422,165872,49754,74213,234264,33151,52014,33100,87183,22365,52500,40013,23302,5652,72723,21404,26107,48434,587,94049,168493,96418,32871,70860,31709,25128,443,71597,166253,15670,70994,26341,133675,28280,75491,54756,47955,56028,26182,11952,113272,472197,64640,110753,17919,337,50642,22576,142,87371,53391,93210,126694,15285,19642,85667,14148,1506,42092,52962,33243,11970,20734,135843,57044,58880,13002,219134,22876,64754,232519,4257,43120,321573,24799,64526,124728,52579,81472,70831,276848,17403,74359,23021,182101,74597,23744,148267,12055,7976,5349,11772,67540,167347,65318,18720,127832,108238,22828,90233,9987,259080,118185,73209,79270,13775,90100,137742,90799,70569,15699,19961,9087,67475,57872,39731,8810,134897,131868,146849,19898,3334,2281,167061,91073,60356,467742,74712,188,53179,137679,92769,29241,9537,132595,80119,1041,88962,5976,40171,44911,102859,139059,104558,98987,47761,19272,71472,113864,175377,73338,10857,23402,23758,1591,139864,5644,4076,118760,16427,134198,18853,20291,100849,37423,22038,36677,19071,195521,57445,11069,31869,55718,66882,148490,44,41296,75242,49704,166810,9906,20943,122258,49112,105667,15969,10344,6408,187694,21399,72742,58970,14867,14376,81889,41856,23225,15042,56993,16074,131389,74276,72407,53875,383108,53597,37363,68993,44854,122548,430927,198279,38430,80409,12245,2981,628,2818,17760,37437,238229,7968,46892,2200,3730,34190,65983,37959,112291,87850,70827,6522,20750,73913,111621,41652,19587,2780,58668,25916,85259,18200,168962,95781,42445,102050,7776,57662,103313,47742,96358,41964,66174,100396,29069,204735,19679,27978,7479,40264,22534,61183,36081,107436,58223,14680,23002,101311,24716,124108,12908,5646,31750,40380,14215,232799,102772,14122,96775,61398,50917,12096,149880,67833,598749,124194,155871,49216,790,14677,65319,56917,7440,145744,95701,12206,49405,129269,76199,45732,9767,11058,9047,210885,11051,7392,26307,2130,8132,147526,20802,232698,115660,50060,59789,57344,107623,80343,112676,23291,9866,160971,34032,118291,15719,59730,164911,28975,2659,58046,78480,21854,66209,53863,109085,116045,29021,46481,107552,22130,18764,70254,31272,11300,52460,43933,84738,20721,53869,190840,79673,105300,7561,321817,66924,13940,33281,101046,183181,32176,71878,5678,62924,79535,56646,40303,19559,27703,93042,73368,42187,3670,37376,46440,7023,36816,109628,20680,5940,276440,275233,170848,112093,136996,14984,20226,111441,77693,112960,48577,39370,55707,50314,123404,26570,54281,61372,123391,4857,35928,246740,132507,106646,44241,7196,92258,9825,37688,51197,303141,5590,15476,132986,10955,85782,34486,26696,7991,28813,18858,39546,11703,11365,38185,5716,93555,11925,40121,60002,6985,10976,171384,3887,43394,13337,56346,6381,252336,39573,75042,53711,1028,31781,44295,95925,131713,7214,68125,43571,70954,213234,1628,8760,13391,65485,17320,56038,1710,25248,60803,57399,19839,3870,326,281556,50945,72400,21460,316244,75619,56246,98775,481,13513,55765,50427,7388,123519,32929,57908,27124,61316,101097,57467,30228,48792,10788,20402,37318,50526,155730,34456,158065,145305,17832,43733,64052,4506,35072,205355,177028,184004,187081,68616,35938,83703,10367,36892,93186,260137,51934,89970,4985,23445,26755,21558,7948,78741,23376,124405,85594,68596,57536,49351,12619,56593,132668,99924,109728,71844,71935,196018,65464,17617,14987,89701,143773,33997,8687,22701,33258,2914,4436,72108,85610,9671,49067,2327,82988,1361,1672,44033,35777,30269,24057,10605,82236,616,15793,13919,47249,112086,116698,9484,80207,90574,33304,68624,93127,56101,42210,160929,4827,38995,38095,4701,125119,5027,33680,9236,231236,14135,87837,23318,70261,78893,30151,81482,14332,1084,74256,27532,46644,79185,3148,62615,6981,55672,31668,36825,1849,14536,37446,14738,23779,43058,162749,72199,1168,21346,5592,85932,85302,9668,18351,57135,150360,2080,228015,77953,34670,119302,151751,31009,106725,84265,45214,59289,74178,113071,263206,111009,4021,44449,188119,192629,123592,392506,292847,114487,12831,205858,9852,20780,79648,75767,357014,97721,18166,21005,67950,33226,204009,16536,2987,11335,66717,144910,47950,17262,55060,15063,2934,51038,26775,178497,66008,3427,49433,128592,20036,157553,63861,3089,23015,51210,28696,35933,49942,71135,231518,99620,17248,21835,176536,20676,16944,38700,165831,233253,295625,36723,13023,52745,10907,19423,67972,125868,95473,82875,1183,108455,52685,33417,64095,21433,52438,33191,127809,44505,211823,7810,2752,95548,162031,7185,91196,47563,61721,33359,17897,23682,42806,178101,22874,49707,199897,75419,82456,8618,11171,79712,116847,18783,44190,46564,5346,59046,95032,7893,14916,3214,26800,24172,121453,34362,10250,17408,18888,4840,68696,22831,13162,36005,32512,14800,62357,41723,45046,27247,37486,5372,2564,34261,298500,66509,133920,89138,31305,117697,19097,108304,81386,84106,23802,46411,63304,946,51417,41777,41041,19501,115864,60743,294354,37955,94165,18116,1156,17937,20645,57114,90804,58042,48643,92288,9861,2557,88546,61333,101008,12853,5148,87856,4152,144503,73841,18718,9789,147565,10846,42085,12789,30223,8993,56352,67203,2448,28215,6052,23540,126319,75933,36689,80235,23231,23561,21383,38800,77548,102798,21234,31468,158608,46188,63960,191679,8051,67014,11185,170078,42186,28827,34777,41930,212079,12421,34750,24111,110344,73918,45171,70826,141949,40063,23979,24254,37309,26724,27179,24718,83648,54938,14591,17425,29525,102675,48975,48654,12316,8929,60640,41709,50168,63264,89812,50716,48632,38755,138583,160123,55579,71829,24230,233277,46322,39650,166388,34718,24108,98252,7031,106695,62498,18258,35062,217827,78731,34824,33354,19520,60852,2432,60224,8587,2836,62955,702,20227,42285,40560,95592,62486,11094,53035,143291,18842,46177,77994,1770,9657,107422,172915,32655,128716,25886,25164,156740,119928,165875,85817,11007,89110,33956,12652,65156,180266,8494,36889,19958,20955,96,1264,118288,135769,44754,86671,5632,19026,168220,289120,33569,93821,66144,70635,7687,5642,2714,55445,56636,71545,184182,93133,7332,37389,12643,52315,22729,11014,158742,17050,152889,50178,34601,41945,52136,9948,26914,63548,95721,115951,40759,8960,158258,38938,49232,48325,42234,81523,253019,66128,40978,20048,238048,38760,62928,122560,118532,43687,137472,163689,26680,9878,17448,51035,16211,60834,36749,29178,14241,59868,150086,2305,26477,42422,34342,165341,83279,33894,14257,29928,12743,13957,125571,89134,66712,10952,16507,147839,30146,7249,16565,45399,39874,114565,215780,31990,230881,171477,102,196546,44538,10880,84948,281705,86651,10617,31395,2342,453658,43569,60561,132901,21845,17727,58556,258242,22262,58728,4008,77997,11806,37431,30599,81375,109137,185787,114085,217292,97453,169085,30593,60212,11544,102056,65580,2384,91655,4855,95725,7295,157994,16228,20669,53276,141590,105246,17334,25440,76067,17967,39321,38911,11362,28559,63807,21627,26468,85816,40120,1025,15234,58319,69516,66512,124548,75845,78873,22137,46681,51242,85683,32909,76747,35555,43396,101465,1765,73094,1077,2962,39028,66777,57831,42048,15828,13962,36041,63657,52412,5242,58846,2141,5506,219012,134451,3936,182230,17558,17153,152237,22621,49377,170216,35257,68233,65374,6510,11126,212151,7184,2480,22517,3437,33073,30156,16557,3768,55067,86829,91000,12350,148650,66017,79424,70885,49066,28250,21369,51213,34533,11510,3258,18176,18465,84413,6315,36411,163765,4346,356,107618,598,13727,285026,162695,8749,14583,7132,63521,184253,32378,25991,5604,30961,53675,4874,84693,5086,34811,26978,56564,7904,33519,51221,113942,69253,6664,125563,22055,220680,102008,742,51930,19494,176108,44424,35123,13025,75685,11759,74335,22250,181453,131147,16984,132115,154311,11991,76452,52609,85351,196,30969,9198,74919,2529,56838,71779,29187,116304,3504,62330,41190,86153,28393,254926,104228,105189,13264,84359,3574,12415,8534,57147,10175,188174,59504,60932,66318,16407,107921,17638,99103,49278,28403,39786,145865,8462,3558,43406,142271,29139,21989,36552,93955,72365,7176,13556,106185,37957,321774,17782,129017,51154,27938,24952,1935,39366,2791,33489,41582,56078,24558,9311,5449,218786,27808,190429,68013,36020,86003,29735,3404,87348,119357,115714,2324,86796,81973,40992,43376,93621,28784,16808,36367,2517,2909,191926,24978,55303,53308,205724,60068,3098,21375,64784,23949,26579,63121,12319,80145,39967,97861,6757,70143,67642,37082,34698,69140,122883,46151,62187,80934,429,19437,135071,137885,222647,13331,154065,327,61778,74257,40116,37493,14855,85079,237641,42342,102164,199965,71204,4662,29368,5042,113914,122214,8955,13149,102503,43173,5659,163787,69003,307084,63392,171080,21390,81918,86666,36622,24126,28887,5736,28054,207170,163428,79891,346467,95363,38980,111806,80828,9200,19288,294896,114468,87405,111715,141705,7015,72754,68463,48738,243147,33397,101210,37051,98801,82847,20397,4940,185559,18716,54718,83491,11725,40803,1128,12128,23060,5174,7745,67007,46701,1571,27807,180186,256996,18975,16837,7877,212758,250379,15440,87954,57755,24719,124057,83461,258,50864,8874,29038,71289,31627,15429,9005,4061,113851,107716,82819,13651,79656,117851,17539,111446,12938,39724,190787,4352,15402,21070,62708,8539,23777,73853,13552,38810,86117,16285,56400,1718,75342,142863,29033,378,110113,180321,32586,23606,26393,160984,207987,23783,8406,16904,24596,47274,11693,46539,60524,78595,48423,31718,20170,9009,146268,15183,191060,172765,1349,138436,37365,10970,40509,225817,20021,70394,152138,21541,66559,66544,89352,2725,17258,91345,7313,3815,115868,8660,40362,4071,103524,39388,118275,21950,6549,38226,32754,209574,29201,43495,18028,20296,40597,18370,47520,202450,24134,2219,8195,69545,38041,136934,46374,19041,159811,84865,58620,846,98749,13569,30714,97246,32186,4479,27355,92973,35214,151491,75963,37631,1561,27200,238083,23182,60756,12291,25766,39355,102333,87362,65741,59906,19538,201575,48772,102938,24438,292580,39964,66366,9004,61379,50548,37622,38732,28379,68180,76622,17488,69849,5963,7219,48143,43413,55358,540,58691,29506,19245,52193,48621,5518,13048,118625,44755,191081,42061,89197,2259,60665,66994,71210,51232,3585,142096,55024,7892,8345,58653,463307,65658,64319,137941,136323,53499,12746,43492,6978,95163,29925,60175,5128,7352,41463,184756,121146,20473,18426,4598,5309,54580,14277,121151,10691,56711,43880,63409,76682,11830,172218,264898,32632,66536,81062,31649,25788,92774,60222,11100,63159,9432,224657,25240,53613,152,138620,163829,2397,85345,12501,37507,64932,38575,43522,65789,80198,78796,35226,3851,108891,73311,3060,28391,93671,39663,46142,30982,66041,37281,68157,26553,71872,81142,211527,39747,118119,22695,2859,11066,20232,168911,7933,197005,17066,111071,44434,133994,120798,12766,227798,45756,132852,29917,36076,55352,65281,129800,41958,18944,84678,18580,168093,132621,39997,54092,27740,32354,3770,114118,103242,43918,15899,18574,145944,3190,123469,219903,24169,100571,62403,16776,92779,14535,17168,16475,14304,37231,1712,28218,242754,61688,28980,1318,51359,222657,99200,67989,31772,23932,35351,201251,49041,27306,19128,40135,3986,77333,19649,120683,151927,21081,7076,78375,77501,101599,8011,89585,96715,58179,5378,102138,106793,26051,217276,4197,16297,27014,46721,13322,22806,5278,29629,70632,9647,71519,58818,40603,128530,8903,36770,56900,31483,26935,43845,34265,34920,87658,6114,84767,64250,47318,50720,19264,162514,33357,13117,6705,46696,75032,71054,87004,42035,69138,11903,99854,102328,19611,34525,69312,6431,49842,101600,133178,108751,41829,89939,225664,48916,99556,9195,130387,5960,36857,116724,53518,94002,39077,53996,6945,22261,64291,8314,152785,57588,16522,9091,5048,87671,35441,39509,1945,12423,158923,178413,37549,14095,1475,73188,62878,4819,24012,68534,42606,4010,120809,57497,59564,101758,103718,32701,80116,12345,95834,46918,21468,53213,15665,31200,3867,5140,96013,250744,21016,10069,13968,35449,180829,27683,39704,59956,22893,3115,26293,32785,75934,62445,141162,62720,2018,83638,19949,114012,95006,3330,99829,130935,309272,9565,55874,121727,37017,23586,319858,40970,27602,8625,112329,61060,100088,118525,25922,16232,1907,60671,51583,44553,80993,5262,94679,8676,940,20736,11823,3020,16476,12340,152600,97416,3703,25744,66826,16245,16876,46446,84798,74227,176020,45192,61955,75496,23946,23626,40372,26036,6149,11822,30582,16541,41914,82385,232823,40921,80773,14930,3631,7517,39619,4348,36180,126106,138939,62611,1477,113512,47321,25052,14546,118881,29060,23589,128322,36795,18401,137921,104699,267929,36194,172791,18113,4766,188215,30083,332586,94089,5805,77909,22194,68234,154976,43220,40660,70001,184893,138095,11128,103010,22663,5108,212615,8485,5565,49222,54614,26530,42639,16319,55062,152662,105595,21114,22216,10294,68158,10436,86950,7206,62115,3977,3657,59874,456,118617,18156,106663,112229,80992,17442,8217,55551,5133,34344,251927,51153,39364,201321,7816,66803,23057,156724,145664,14276,95705,979,2796,6875,13429,212525,50602,26276,28284,3424,19465,52397,46963,31420,51399,206476,92317,48851,637,100820,83349,10317,60227,21972,6908,282439,32857,224767,95629,83882,42106,87338,69757,29840,68709,37665,45244,114577,49188,175943,54009,186746,106158,70168,3358,234002,50555,9221,129338,9562,20118,32923,78479,118280,65752,4977,10474,102174,60947,129006,10570,83451,8598,8078,159367,123785,80438,16742,5905,5281,181513,42402,6977,163136,93179,42191,14968,50421,112401,105440,33456,57347,121611,4221,94954,36517,24046,27796,6255,33394,72990,135408,116627,1233,57874,25654,95419,68156,401399,313338,55208,45573,93124,119251,47200,38196,11909,130667,45391,73904,64964,167846,4137,115606,52036,62214,7969,160925,7187,1132,134835,40309,73195,64494,80472,444841,61111,26500,45323,40743,53625,52797,22659,15631,29739,36706,28841,39147,102836,26794,10536,14845,87305,45874,12241,127587,83833,57183,79722,30844,41304,84655,20825,92500,3722,25655,27811,10157,81634,31362,34088,92487,70123,22190,185100,72658,139035,192523,88241,2078,230490,44528,85638,100198,22088,29982,291233,241062,13865,4445,137791,37835,107218,31726,19718,38234,72528,23046,19177,66695,5109,17251,28077,5617,21554,47839,72425,133825,1486,73065,181275,141508,21768,62971,63082,2512,34200,9904,120309,6392,91243,68416,268253,41199,116757,138551,185526,41246,28986,4093,19057,17295,4148,245766,122360,35356,112075,20301,75441,10998,7977,19769,62922,937,63547,100196,26427,157820,20983,236696,22935,8140,90315,156004,47204,140973,7726,45097,52725,22636,23436,257282,105247,522,88389,216031,202204,46812,211666,19693,68828,81691,45925,11256,30292,372,5236,167826,88328,232776,151611,5360,82104,18841,80393,25465,18285,20320,72377,31730,33160,45803,38715,27705,37379,24163,18360,103586,4015,32305,269494,91252,20080,36567,54650,7797,57073,12650,31164,42209,6375,261663,105528,81661,106002,2800,5375,17247,43151,4442,15727,194619,100855,144898,62320,78465,39929,16454,1967,28311,61363,17219,9395,8745,121445,76939,80385,162380,22009,54191,44248,16299,122830,48151,74429,78291,64755,14238,44966,2511,17712,67954,93583,829,105899,49935,84750,11591,33185,85447,42717,27409,208542,28965,62052,52525,5597,25694,65594,16343,63224,276188,12475,9331,127507,38522,57287,24128,133161,79723,105548,133695,48917,27558,43278,46520,13778,141954,110785,83366,17715,46317,105763,66298,147013,41086,94180,16478,220447,44611,730,19722,78975,117889,125643,26254,16574,18480,65006,15806,38549,246418,46052,36056,8440,34984,30170,3163,59800,4458,115442,4283,41970,33507,104078,1653,22,121158,276486,3655,6338,24048,133421,23641,2161,24422,36006,8086,10675,181474,12307,29514,59143,14729,52509,87128,122470,19446,80852,33314,24573,119864,14237,9652,57779,6612,51851,15284,98871,90581,124466,156831,21190,22015,71380,161906,87247,69201,18392,17908,108470,72962,40719,14338,17911,95260,43339,20610,78916,20710,72451,11315,31448,17263,58853,178878,48111,116002,45497,80506,82605,85880,36300,121755,25215,36118,301929,88728,405223,276136,553,34704,212438,49970,78329,922,20711,25036,257130,38295,145369,18128,15385,30829,55656,48345,8012,3561,28004,122041,192900,58338,112508,41085,29976,87040,47117,23905,4336,92061,138880,97407,42083,172121,6256,25192,172671,5,93568,1420,12677,31605,56743,40620,6015,78415,231077,31298,80026,13902,19048,24924,170586,32955,176119,87859,36731,6773,27711,24658,26475,115216,133207,93250,95820,88522,8317,5714,124047,55219,86860,19677,23961,22928,162209,8904,225992,359835,56084,96201,29392,96558,86071,93643,55114,13347,8183,95129,82012,2017,123336,34219,115554,157159,47747,101684,41008,18735,193781,104151,226906,7552,179874,124113,31159,21162,44010,14771,51268,166128,31382,73124,77438,92830,205709,12113,1292,38937,13114,1334,2118,15597,69581,14449,21934,76618,48728,67038,14967,51495,24243,87736,147249,26720,11119,46063,43749,5843,44147,152629,133428,65703,14269,45604,57982,28672,55616,45957,8438,95433,37698,220862,132034,39456,61870,4161,26501,73560,56418,9845,4654,20916,10456,88920,119358,9015,65931,96507,48029,38534,21676,109081,43078,34943,25089,6131,28766,23665,5477,10255,16695,67,45778,42443,42770,29534,23733,100513,62617,42630,48746,14191,43753,50295,26007,8792,57243,43119,54725,164253,58250,112304,131796,25165,4651,3188,24831,47748,3705,19540,13211,102095,5593,18699,23666,32005,117571,33541,60584,74573,86311,99443,25172,27222,168938,7143,11853,53560,18834,19960,86522,28217,53266,117700,72989,34323,18721,66450,34346,74056,47217,202002,46269,9429,68582,75458,37823,82843,96652,32549,145144,27958,19820,158086,31955,201406,135379,31207,192545,12950,51704,9094,248263,76147,64028,110009,79407,89345,99284,223492,47966,26848,15359,201137,2861,110507,71231,72297,31851,118777,71039,151051,240855,16333,50766,14727,7939,4149,80908,418780,88378,59276,1327,7284,38576,79814,65820,42199,84860,49574,62596,12396,70598,40117,8648,7994,16836,7630,14047,359699,106878,525,29037,28064,13380,11675,50669,74216,103539,180314,27449,56299,172344,19274,7301,246099,32043,19422,36506,129317,6806,30140,4614,46639,66926,932,86600,6322,27847,233103,10541,39025,34887,3517,12972,26220,2031,66561,115015,48658,47596,12714,33845,3893,16165,35237,89983,14769,11962,147224,47018,29977,27979,5552,82338,86023,131368,1218,24853,237840,132193,15455,40873,3668,65351,53388,15229,59889,272245,47934,11858,34347,18038,90853,86981,300602,19343,114181,29362,84921,6095,106059,79472,38015,1206,48741,6208,80000,21916,17423,6002,108083,24479,34931,56661,9511,26995,100694,163853,35997,81254,58321,18919,171890,86877,91341,74503,70477,53412,7027,59281,39892,131302,5864,15947,61301,67466,162369,47956,27874,35624,282324,21270,111847,102548,41482,30955,116737,28264,8592,55458,22301,75090,29821,30697,51709,3041,19208,8038,24634,30467,87509,126428,19389,18814,152686,20701,83474,45832,80891,105808,11378,153223,120770,98186,150633,49838,9141,12755,30962,5260,74490,21256,31678,65062,33326,289838,187831,20595,89768,2805,58535,10844,70085,12090,2451,138068,98544,24461,4511,6754,41684,28203,3383,65355,82833,30161,83924,234361,128424,28921,222594,33975,125491,34069,11508,67464,144226,41850,98703,34371,7901,21254,38398,65651,23549,53883,213340,123269,12028,71764,177701,28758,2623,68395,11549,15232,68603,9660,63116,36079,57093,31198,20475,48467,89984,35619,186847,107469,31389,43631,73867,41949,68841,114250,1605,30564,63403,17588,27680,99533,12641,70325,50428,73426,78379,11855,91651,72081,91720,60198,15743,12065,83398,140046,6761,46598,45900,5068,886,62448,148968,37347,19405,9680,15819,43496,63370,75667,163700,37639,3633,22774,34341,183131,134335,37200,23915,7054,14194,12970,26438,13350,285521,25594,8219,104410,91039,168804,138480,149734,15907,33818,61132,60082,4622,110187,56736,13551,73571,3945,73463,65498,17758,263266,17593,2710,27585,54469,38200,45367,63754,28881,3473,12791,98287,31895,65787,4463,94536,24951,36332,59901,28803,52130,86403,7668,181822,74831,18977,9850,177206,145485,109798,7292,31421,26280,77211,58511,12507,127004,11113,147,8729,56208,43066,79926,129937,31345,83947,39915,46146,98763,42566,1337,13192,18323,105163,80570,117753,16555,72883,11077,159438,40764,70933,83329,26066,12276,72059,21655,173836,126713,69454,153482,91585,70644,102558,110483,6764,127864,190133,3961,101798,20945,71138,82402,90884,69669,44753,923,16939,59700,164258,25969,27082,31399,43846,6306,246093,51342,6153,151581,202801,182731,56475,162188,89426,141356,14355,121815,27536,28023,65257,77523,106668,127314,24947,12790,38796,169698,23555,10725,44573,183083,42088,62716,43265,105958,32050,44067,50118,1668,3874,6243,318411,16599,1691,94999,52378,28671,216728,123258,2059,34969,69225,5913,136280,171443,141515,91662,22175,135282,80020,92270,1663,4808,4482,3495,34691,5226,109830,108512,17342,107488,11606,123190,100247,29666,146527,113014,15794,30894,13224,39585,243192,22351,9903,7836,47699,11078,25468,122291,48821,26780,122679,75521,81450,630,4895,92900,55074,74293,17441,3563,111657,103102,51613,12318,52370,36191,68245,34269,40445,41354,122901,168604,182500,62012,42557,11259,24428,115113,86345,12362,3909,78430,86852,134602,20459,47853,93879,22577,7659,3688,38555,13349,17381,56715,91639,12493,10895,92438,3142,37057,28928,2004,36427,32268,34222,209974,10432,67436,41989,173518,107930,27079,62729,30908,55558,5828,45031,14902,53546,8204,144263,60255,14520,88212,86582,109589,69356,8064,47449,8505,66558,16886,4844,52817,111260,215129,12941,91118,650,20770,6273,73089,40618,62790,2873,35002,14023,97208,19386,102646,36993,143736,135457,35385,113601,17893,32627,84439,100619,56016,6581,57264,172160,45452,111710,203627,70131,24100,322787,1996,35665,70078,22358,90922,83658,4097,63200,58499,14542,99153,52159,6615,12414,63415,31986,16823,1579,65405,137809,8841,16898,48082,259,33014,42375,12260,179850,73667,91389,98882,29532,17311,326251,41092,5928,20742,44964,48019,43505,9317,49265,6643,192712,48424,163487,19861,20113,70848,31928,105333,23685,78563,14638,54755,7158,24142,44018,20774,125255,20331,24280,10163,1285,2336,39851,4299,117269,46714,63816,87779,159624,11731,9971,990,137317,108831,50994,74554,162680,23640,131597,146962,170620,34829,91205,21184,1913,63616,18427,93136,156592,17519,67565,115882,138220,78622,88535,18115,2711,33554,109492,54298,971,24914,25863,36363,45715,27099,194995,14299,178181,111488,72395,322385,157719,130787,11897,81843,83999,11369,49280,118604,40922,61332,110343,53407,75639,40582,300440,54722,25637,13694,48248,48278,194521,56203,52779,48783,72627,10953,376,16733,280238,26351,230789,15132,25168,137270,3588,63704,73376,94031,74284,19443,159557,9697,39901,13351,119050,15406,146455,3460,29556,75195,37673,102524,92329,47289,98413,15311,100684,56345,7116,95480,11590,7200,167,23610,58426,17730,136656,27944,53151,2701,8824,103124,3017,90744,113588,53216,79736,65940,26931,498,29568,80540,143543,21292,1740,59268,16561,180816,42323,50174,40890,52866,10703,57169,4700,17191,4424,93511,49698,166650,26972,48631,165169,82879,69326,202970,4007,2376,231325,139592,22119,62851,37504,68816,58345,67398,186643,43331,277416,53749,15746,23102,17432,4793,151138,48822,54265,48203,198688,14305,54287,2291,18018,113378,123260,7180,97549,87027,120085,2920,76080,8190,102005,5641,64580,14955,59802,54028,58884,19367,81779,412567,85957,97053,103637,78871,29364,27637,141728,4767,30686,112738,130146,42745,12730,105040,14844,232,210944,36581,152317,135543,29744,3129,55647,58149,46319,27265,17499,28005,59948,7170,34138,5702,293047,110892,408,91760,218674,18469,46095,81403,14389,4610,35672,73060,11006,74848,104820,118143,190357,20043,105358,141735,5115,27093,45924,123073,52599,29433,9616,238350,78610,24851,58858,26769,31969,24613,18294,4982,32735,39639,143563,112073,202205,12567,4873,88601,44897,81503,101648,81362,34662,85277,17574,48173,21435,221188,40215,39576,80786,26544,64668,81841,10731,37733,247986,149188,127703,495,18382,54388,72446,43071,30974,198723,89608,41360,190,33045,8386,31658,19992,237838,119015,137622,50890,100913,6460,116233,267230,26621,104129,65114,14190,41542,14888,85962,23342,23041,26453,43725,71809,45186,4770,46452,53894,56616,221286,18973,9038,109299,55365,19366,26863,18808,60909,69353,41738,83463,12100,68561,72860,3980,13796,49340,12332,31311,27418,4255,53430,18976,45523,510,14224,30477,26581,4530,3651,101663,139840,22709,150861,31996,63923,120623,262522,3076,10528,2929,14672,130238,18087,9816,121894,100308,25085,55111,14565,18952,53293,2042,369988,23674,61789,133529,28783,108293,35477,47119,36448,71049,40015,33055,78598,198442,1833,159937,40654,77444,189245,113153,8621,18599,38553,35223,166072,2375,11659,21786,89523,6032,12116,63046,159398,18454,3678,32521,47626,11411,103527,38896,42946,15696,26370,10185,8413,37080,165583,4331,63555,14907,72220,50056,6623,62236,36565,49783,10049,17503,100581,55951,146244,24724,9626,17969,25524,109300,173965,99994,101056,46459,43647,53737,277968,8347,123521,74858,33829,44762,77574,877,81377,222525,123532,30602,43881,53145,2973,16284,81940,61281,127044,63620,9875,14756,114829,19032,9202,52759,119141,23928,120551,19607,3599,33401,76821,73233,117430,39968,36539,7071,5446,121735,194059,15206,45283,6706,15603,65615,1207,165723,92275,34773,104447,8396,32353,205240,164323,13600,60555,79205,25532,22907,33410,57480,107111,69630,32137,47832,70913,33161,20321,2371,117348,10714,86246,1625,11763,17900,268,78457,99175,97940,101092,86660,32221,14041,128504,125080,53744,124263,31017,13897,403,31859,21964,5633,111630,5547,77329,17961,18241,84995,25984,12983,67491,62168,47262,5241,297,51191,7351,8967,147212,82060,16821,782,11033,82431,62957,5026,43459,77963,203477,53528,6247,191852,87774,74164,215654,13467,1522,219964,28589,244104,16242,117821,67725,72570,156792,17186,15979,26990,44128,193014,35276,57125,16212,166451,68017,6905,77608,16364,53777,75921,76426,37975,26203,269296,64099,84122,12077,38533,830,4407,20139,963,43028,38902,42911,37503,83343,85045,16979,1165,60835,137387,58380,86990,110066,134540,56331,193845,81238,17922,163093,38744,110641,12502,56404,34862,26865,125964,12965,111648,25547,7771,27196,136980,9555,29551,107158,57885,18831,37705,35505,101742,13970,102109,62548,124657,23328,11124,89592,146376,248050,6241,22033,18337,80685,29898,11908,216623,67721,106162,146610,21377,15085,91552,42041,62560,122532,125336,102365,121537,142559,29693,223919,11515,110495,18776,22494,5895,185059,103592,229351,51220,100102,37027,257855,29359,54123,36066,106493,12244,79258,32002,432,56205,94836,90182,6726,14762,29391,48938,26864,38083,60364,3310,60192,14766,205567,57504,110760,22649,24666,46333,21517,3430,13135,28873,27052,158809,11597,20529,6695,23138,22960,37137,45574,6545,305877,43423,26153,24769,59844,14501,10430,134352,56169,13213,103432,49523,35181,13435,12408,129475,64620,230854,77390,51990,15653,83248,33466,44571,117828,51481,2187,10559,68019,18021,54895,48247,18354,33737,4554,108595,37288,39767,116707,9175,3726,108877,21616,83684,49862,1938,8543,276466,20134,108498,48770,102254,31914,131520,185291,100559,51890,209,19526,76471,50544,71814,99351,8172,198526,28816,20419,9109,98389,136777,76479,75596,30635,165417,48216,120220,25955,211071,39314,24308,32164,2559,146280,43403,9233,17947,90585,1786,86920,125662,2457,64741,32152,32918,122882,78538,44001,31723,56426,23375,103172,88177,145697,52506,49319,68016,31664,41488,18486,110400,7030,28241,986,109199,19900,42147,56864,65287,49183,7858,24000,30453,840,16673,25907,68916,89927,6309,158335,36407,199737,130464,13137,59603,201778,195292,21015,42466,179062,172561,89492,11075,180407,31868,72493,20998,60217,9865,19530,39274,130266,54539,21623,12535,13505,40641,73375,4087,85633,2153,3117,70680,55788,92096,47509,98493,37490,271936,151475,3032,16171,96642,34106,78425,125761,19591,3366,19316,54508,24183,50786,194248,91528,33253,34622,108355,41741,705,3814,3883,108929,13203,67831,10142,59754,68208,29128,84820,56880,38794,24972,48571,40821,40476,18137,164254,24064,236309,79181,11282,395,39169,2013,51587,28551,9645,701,109513,115899,113566,12762,62045,58322,103726,41343,40866,244102,143816,2490,70346,40973,52618,15412,30720,104315,38917,42027,93676,17513,107418,20706,123890,13399,97727,24044,87962,65606,44250,98044,65276,74790,101473,19350,91570,1326,87790,172042,7577,100813,86896,85891,41512,108130,27794,14875,71431,12835,156250,58135,3759,22476,42176,115873,34686,56523,73643,108505,51491,20838,12721,32863,45700,29496,13700,34294,55360,29206,155942,123812,7706,163234,203,132720,49358,144431,8130,175788,35818,3270,76832,25710,54095,97274,28779,94621,74396,19092,128242,58067,20885,14670,93255,15107,63291,23654,126900,129421,59294,262659,9798,3251,67344,28600,44629,50672,29072,26999,31526,23183,49175,165843,175455,17282,175411,32022,45989,30298,90690,78118,83156,23749,35636,31317,7069,80381,94561,133756,14960,97404,6138,41065,78041,32843,16601,34123,9559,146529,123377,96395,54441,42012,84257,123541,10745,22139,106459,11720,150883,172651,154996,110538,4728,53447,25704,2009,71152,119354,21166,66604,1429,216162,8637,122250,63520,27180,29172,36124,276428,107787,77184,4680,14952,104903,24418,14793,51561,52931,8371,26342,48526,7118,92066,67280,40653,8847,34597,105438,14198,50163,61188,146286,50315,41205,170829,161496,585,197359,95056,1687,365794,91349,48507,5804,49263,5146,104902,96365,117343,132222,46084,96919,16875,8073,262381,79982,52663,13928,16056,153908,15145,109256,132308,18763,24904,167644,13618,40750,18686,147124,114709,150038,52849,2938,12568,48617,8778,5459,44202,44591,74914,17183,248689,13878,7822,80060,23116,194037,18487,2067,7798,43077,33678,244028,31320,74273,2794,19466,8218,36280,183997,48124,19416,29656,19280,98734,7715,18311,30701,133602,150307,126956,7378,2933,79903,13178,12593,86571,26604,92446,13574,44205,65699,427599,21118,8245,14407,27877,47936,33542,7916,26460,117762,21596,37818,2249,127359,209394,60044,47677,308089,36791,154971,31417,6998,150042,174360,12255,43009,29335,48739,3912,101398,53340,2580,146939,151295,45360,125275,15273,45383,27456,48761,23314,8750,60801,85823,104759,27894,123685,66968,39480,26917,55290,83305,2696,98390,57569,145853,340733,4919,20024,52268,30884,7413,203685,70989,112855,4129,50536,349518,68205,332641,159581,135361,236026,37563,176404,64899,6578,122033,63871,1850,85234,82089,66124,74145,121098,107351,12687,36881,117334,13136,14698,85933,93866,18047,32620,310,15094,46000,88451,23632,36645,27940,87618,80520,58892,20976,27702,140090,96075,67841,103292,238964,87778,107338,17019,83427,67522,7302,8261,47570,116787,8730,80484,61772,174422,56005,131193,52875,14588,28471,59817,9586,15720,158155,51307,109734,15196,11025,59331,3884,52626,102602,84797,25158,27314,4437,20488,76214,189248,35023,114952,157376,2827,62439,102878,129749,36405,10329,109339,108633,36662,1254,13267,5470,87105,58004,15397,10434,159667,21864,52022,179464,3013,32147,31496,116832,18494,105502,129227,107267,50033,13481,9954,24267,22141,16257,116154,36185,950,115685,11305,176708,2048,178671,112573,287867,162328,497663,95170,50979,193861,50987,30368,136257,31830,46549,15119,169876,23788,17462,249887,57377,1949,35448,14791,43769,210091,3783,34612,282103,88380,245190,5457,20491,98908,11402,86899,117916,16028,162584,60644,320177,156096,31065,55876,22000,77655,9992,23397,13757,317623,63978,215255,2443,17648,93231,27388,104529,93807,55505,140477,12046,112040,70887,40152,94365,112353,25063,114679,266061,71248,119555,15589,2244,617,14129,211431,70110,100652,7777,4383,85911,89221,21010,120615,58357,86405,37554,41647,18,15143,69662,60491,14714,186134,148344,42347,5410,168175,44535,42449,343894,129417,99682,20659,27272,140483,63455,222159,17536,13722,42637,62324,11976,114691,148109,2283,32057,182393,4295,147364,33705,2075,44303,30274,28331,63740,69740,29148,10346,44862,33716,73937,153333,12930,38784,247159,2515,41053,20256,83368,256189,54639,115240,5096,24661,175419,153552,26516,141,138176,63885,34115,47222,55709,2765,28479,38875,236608,12229,22921,77291,54426,45388,2860,57787,114579,295139,105782,17826,71066,19119,54364,69385,16568,12323,28057,33346,34919,124763,155533,101386,31644,8627,49001,303600,29868,63213,9103,77280,71333,9696,138789,37059,24823,5057,21352,32368,114208,56803,19424,10445,58514,8661,209508,26187,171838,10460,63454,14016,122504,41328,21329,46618,32493,38225,7855,31763,7945,29876,8734,6438,24205,97490,139977,130740,47323,33195,85390,57194,13813,60600,21313,96251,7699,27584,170521,139271,1363,4402,336738,129223,84983,69150,13147,3590,163929,207225,155260,55916,20288,4503,8398,98490,11773,27512,37113,84976,86558,28365,11756,116005,182148,13733,115313,47644,67208,85069,9347,14995,226141,14704,101835,41159,35314,13113,63526,214039,29978,50446,83339,17440,129441,72522,118641,97816,24907,73844,15717,118884,167255,96509,162793,30847,36849,51297,78974,77793,10427,1873,2972,9999,35074,28190,64297,146836,46298,60038,163007,108919,61219,2403,75022,127339,4233,110389,69022,9833,128097,88016,79390,222936,22570,94657,28462,56956,38803,81536,30474,152794,19566,16481,147408,74574,81895,20731,1918,1366,76367,187321,54494,24366,21690,61696,33283,107477,77499,31112,414383,74362,18463,218441,120929,59848,258629,201924,69269,454,19989,13054,59894,3623,58908,20681,35723,78523,102680,38988,184112,108087,50944,132704,52966,21699,18860,96349,201411,82697,85395,95658,5093,6427,177894,44191,32755,26961,155739,6249,31310,81030,26574,84311,120155,86730,113535,7424,48888,13516,45747,98098,20077,183995,81945,43210,26704,40420,75831,45648,11180,6855,57927,65528,124096,34851,2598,156633,107572,127352,38169,123845,60142,62722,105584,232364,23211,68120,1601,22169,89299,747,258039,80572,7258,152249,11862,101204,8834,121434,33761,19175,133142,46343,40178,48723,3589,41977,30210,38868,62257,10087,82658,87827,90646,16415,47552,351723,28298,72225,91146,272760,1701,11295,1652,109651,300747,51863,198800,29446,11794,32345,37538,22356,33102,37590,113544,37970,11478,179743,25454,103417,59905,221970,105196,145604,7817,164809,102360,16974,75840,255333,56902,6659,1954,645,59400,67769,7689,18675,5215,13793,20536,27852,3387,29523,259718,16860,94625,43143,29245,15848,233581,22685,63631,78557,22836,133302,84513,1348,51826,47129,98836,58284,1830,1749,94642,10933,6145,12506,10975,13879,103781,144434,10268,28409,32346,52968,121567,107374,77268,23686,35097,10501,155275,15303,47136,21102,168741,55332,90385,15996,84817,681,137803,25054,142275,6163,38175,8056,124296,240642,65621,4934,178205,16101,62803,60964,18230,100622,76465,44689,14545,9543,47514,16852,93380,28048,12047,107106,37575,101485,77047,57326,34819,96137,76916,6469,46264,115983,75768,87668,69942,13027,165,8373,114231,26434,52844,42799,182044,23580,146254,38081,43236,33883,146220,382894,14606,46035,36481,166621,35417,95382,2957,59384,60428,36358,66343,75378,22267,22950,83528,17577,56474,25285,4619,179691,75355,95836,53295,34588,171410,4487,14679,84208,44015,18562,109133,54101,11531,86052,174479,303157,28095,9953,35642,14564,39802,16145,77606,117406,53038,121117,53624,22062,1212,7632,127157,237292,189087,10478,127345,102515,181997,86752,87623,10966,121602,68783,68681,83042,114380,138349,191305,67176,50085,39016,1427,42384,1412,67118,122616,72389,25260,2237,13576,137346,19938,20304,2191,68759,5373,61364,238507,75814,23931,69565,38993,131741,38364,12528,87762,5679,129853,5310,186831,32653,90338,260176,389531,108118,26843,43985,50175,30563,25106,56965,18130,140428,4542,165503,117991,24219,229605,1819,129663,1240,3797,76093,18398,71339,51919,93043,27175,47060,216257,6483,35051,1217,16512,80798,129064,13225,69339,8548,237079,72298,2575,34280,51379,117910,55671,53345,247552,29486,39328,140821,34681,57045,60177,5004,90269,78522,2479,322607,48474,61296,13057,31558,4678,59271,6699,27044,31988,35944,12503,83480,4389,136508,3781,114121,70279,4488,155829,42214,2898,68191,75695,305850,45041,74344,106509,30087,17429,93292,12477,290,23080,114802,35714,18751,26554,105424,17775,2144,2412,100610,65192,113975,52975,180272,135050,129815,76238,106483,21440,63186,4260,46189,9711,28249,4169,23429,23390,8324,141585,63809,67668,38457,38063,39226,59972,1189,203916,62368,14403,16949,61767,85801,1739,40147,35049,76757,33124,62102,15780,103593,103009,53484,22952,67973,114645,6566,5245,50462,7601,8288,3513,194571,80276,1908,54592,5124,58571,2513,6800,273997,193904,1119,17991,117245,2508,129156,82366,26278,71465,63341,56943,39662,106116,94966,156875,9736,2204,122308,94418,27134,1280,24539,49022,45314,3764,50904,46424,30699,28087,293839,9400,33646,40165,822,147499,50263,116179,29085,11863,31314,5578,17797,5104,12454,1604,15342,219206,10232,67800,94261,25872,13565,90339,78971,75377,26649,41184,47695,11514,35369,20767,14227,41953,309396,148270,147938,33074,14453,27499,109019,39018,25738,240196,158931,52820,8612,95853,21524,137010,84901,70869,70021,116794,48404,38771,6732,1070,70990,187297,49140,5238,576,3564,253975,16027,16483,2811,37775,19034,25259,4053,2000,70083,95774,19713,33431,92703,91314,42381,288770,48194,95985,3991,77418,13406,241328,245086,56533,35275,62725,9246,51924,70181,95331,16163,31410,79016,39312,120878,119371,275987,80124,27712,9186,220,23598,146167,85209,68238,282190,57048,31273,30555,80913,17594,75779,59160,135002,101219,189377,29225,96735,60126,62522,104000,27620,86814,17240,147533,11001,5425,43682,410,49460,87270,69480,46315,59448,1816,76201,9431,11788,87960,29063,65539,47347,11678,33846,7008,196704,9895,6753,8633,120892,59970,572824,115934,6646,202559,892,48351,37611,251282,57823,67263,57750,26527,34485,90747,7685,88370,6144,64182,1709,41969,21458,62327,181657,49247,225330,122600,114574,107124,85361,111833,63243,71420,15655,191178,72430,18063,51425,54002,12364,53225,86557,18193,97580,41232,138398,67821,128724,8944,233212,101353,52099,42127,14006,120107,32789,32132,3498,18123,33758,56058,5779,128760,59888,98869,18445,84702,51911,13234,218379,20093,39031,8074,70195,20708,23462,24355,131384,60189,26390,10403,41060,7140,10781,49410,42261,87202,82566,41663,43105,60276,2768,5733,74176,28329,2297,145430,131632,83615,122915,105441,655,224102,5284,136426,67763,16294,188511,32538,61049,27893,3394,13951,159099,28542,17930,145360,9492,190122,32285,78855,26440,13570,58648,73908,4239,124561,2444,74172,53131,11468,10794,73566,11623,35343,64710,30481,4163,10328,38309,29901,10538,154377,76132,92405,24839,11679,3465,13449,11637,7824,2337,57754,1260,14458,41118,19878,38661,13416,159180,37074,163164,54137,28627,52134,184900,8520,40385,29546,30502,22386,66527,107458,6850,24022,47983,30603,35083,8934,304066,39500,9,28261,33026,77251,9374,44833,116312,34990,29236,63563,125639,135405,165398,159055,55690,88141,69643,236964,31983,25572,20436,36746,60896,31850,16179,11828,5888,3043,66368,9750,31167,7915,53111,36430,1333,64344,93659,20061,60596,180191,51630,6792,30244,43509,101058,22409,420,44210,109783,43223,27030,72477,72831,32679,29235,7675,47556,12258,39907,149412,84926,118247,24692,71717,105038,86009,45941,41189,89453,29856,52543,30627,226798,67303,59230,67415,34408,1367,99685,16867,128419,52147,4111,125381,117881,16173,44093,102224,31575,23234,24870,83790,127407,239098,3200,994,1255,100903,242275,117266,55116,38205,16140,29662,11307,40414,208793,123355,56470,4862,75600,30119,58218,70828,24075,26974,7802,192353,4851,5475,78720,66596,3409,28573,64396,30381,30690,59859,88256,5406,99945,103064,34463,37727,24238,86643,60088,4057,23741,5967,162904,38240,28356,93858,25510,122879,6897,3278,7057,11971,4400,35461,211413,21395,59615,39471,87233,55795,128426,3051,22470,41950,14705,3974,180108,80476,78442,204996,91987,15634,67610,139015,142373,35611,51134,10387,4353,153456,57749,181039,14183,68447,151532,21107,36452,20551,3186,46247,46383,129666,88736,140662,146243,2066,8360,7978,64818,106963,17896,47801,10723,114821,223295,74192,3293,3393,16987,74064,11277,91622,4270,29828,27951,387869,103235,1374,61988,120083,477,145892,128378,11779,211263,61354,18221,17869,46530,83061,108538,157981,90608,67199,95080,49064,195814,12302,66307,10348,231346,160732,112859,63633,146558,21271,31037,198802,47622,12862,95710,3910,77850,73961,85585,34752,61000,4082,24595,103679,71107,8208,79568,150019,16615,24961,139857,32664,197366,4559,54735,32696,4126,162019,75698,13916,70108,159638,19834,9349,24675,175560,49643,18206,52459,27992,10809,88865,401975,133172,29000,34558,30915,3658,25834,42430,36562,125265,18182,10155,40149,97082,208980,19575,60853,90529,66545,9600,789,46420,2317,88593,55595,98980,115302,5742,169155,1073,177901,3472,11189,63711,78643,65472,50459,127979,93,42202,67053,21720,157650,11145,141378,42033,22824,85705,79114,35584,15974,1510,54172,28562,12451,104226,19190,97151,73024,20948,5151,81741,21499,29006,84183,198074,54003,45120,170125,26240,35177,28389,64863,79974,60778,176915,232183,45342,2038,80253,41564,40703,32689,5430,100689,5366,23007,134279,14266,26712,73993,24934,64242,52113,102887,61801,46415,201049,54251,62133,122757,164883,30815,139966,2319,30842,766,13362,10287,134518,86111,81665,82440,28333,43019,18963,8804,161944,23439,102144,101145,80029,39052,248708,30350,117340,11878,128467,974,138625,63961,5237,74778,61834,67040,43814,13690,65947,33809,232476,115258,181745,28824,94013,9510,10246,93722,81976,7217,114383,3493,16014,69045,72692,12145,80981,9507,6692,1620,60820,330444,35474,33962,4797,7053,295463,46445,27026,12491,77988,49524,35675,90947,29114,166705,101385,133782,32704,6186,84595,176031,185623,45966,151302,63069,1699,107491,947,15458,74452,196212,6046,10498,12163,10239,35191,243951,9277,9090,29539,54460,22820,26514,112549,60372,51753,48756,21812,70861,260326,41,44222,10441,16961,48148,138771,216194,5914,52153,53400,212036,56519,26245,10117,45888,15294,138019,90913,26368,43842,42111,23348,6082,194845,161089,156206,51546,11647,30759,302912,262094,8635,78876,26535,35283,54183,31183,85484,147873,12989,5197,6356,72894,65347,20150,27370,73787,1493,45918,12366,190217,20724,13858,10981,67449,81213,7553,14115,72242,271517,11842,48310,88743,143726,22177,3290,243231,58452,62937,12592,1654,40066,33477,13751,9921,128442,15868,7106,75236,83773,10775,36938,10482,170465,17368,17469,161508,32752,98340,800,19824,264456,3901,87319,2867,26782,9630,113102,185815,24197,44584,86366,40224,3636,140916,31731,267731,9567,53678,72984,29389,27963,17106,50282,284911,60170,8322,12608,23374,89652,5268,39044,229766,8869,151350,31436,177342,12269,183212,120418,116270,2843,78888,69192,7865,184099,1086,129897,18383,70508,20242,18508,229924,124569,35749,50589,55626,9884,83115,40971,30671,18135,14452,38861,17844,201826,5549,26413,17189,13561,38539,10679,143331,3314,36785,171194,49685,187713,67506,4618,104039,17060,195080,50648,33159,19238,67559,134840,28599,157523,17130,38064,117398,94355,31918,13575,34538,40326,13997,3494,348283,62481,26862,3603,104426,244363,153709,112487,304612,199674,41239,35545,54869,293005,28223,26277,26899,4533,18518,15492,38587,80488,70485,160395,263,60162,11382,222152,4696,250751,51921,182609,10707,48463,46243,1227,49111,111564,46502,33342,56846,68541,63559,858,139927,16654,229375,76759,26478,33205,95828,23399,92945,2637,35630,28470,143992,50214,14174,21456,166191,65665,1711,21594,78019,97599,111701,36,147151,110246,189022,43021,30397,40757,131935,42065,73335,48039,26596,28984,15102,2361,7421,202167,69744,43766,52826,3642,83304,33873,75140,63169,192389,36551,92748,13039,123959,233220,21738,84447,77230,20228,187852,19095,25799,92136,108774,29237,53947,2299,118106,2687,8830,42331,202924,33667,2023,73763,30704,19363,19779,16737,35629,48081,24068,101013,162338,291912,13749,24745,328289,167679,70086,48299,23306,16732,17801,43322,54589,3586,63653,43624,53474,925,109177,251316,43805,13082,19511,86565,142182,92461,17117,101033,103319,64589,4022,4351,235897,5352,82705,107142,46391,156084,5860,61365,10558,13045,7717,18357,33922,12590,33065,6928,46993,783,46937,67846,8952,26295,6107,119656,18799,17458,50747,4229,179559,112727,118080,20683,41464,125468,51560,49749,44231,7359,35339,62988,136487,67015,5208,29150,24956,105186,48858,6143,18097,6972,16404,73489,58742,97196,36357,164616,5834,32267,13746,147733,15113,132091,34127,106298,39729,106426,22294,9780,15602,36213,71502,42808,66802,599,60755,5851,39120,67363,108623,126368,72770,91263,32486,30596,151717,7951,52002,43103,11768,68942,40901,39344,24037,127500,116890,48403,16926,86750,17745,48648,159545,34460,58419,5634,114317,67865,31462,23352,24010,98185,125708,69686,68337,13610,26271,70691,2980,4768,27225,102402,75453,28106,8104,6931,1176,6274,6475,112635,22498,6176,238686,26832,28893,90319,14441,15682,15087,39517,45270,109134,104440,45965,47645,81772,7876,52683,87720,12898,4505,185665,2769,113401,15664,57592,105229,137381,97059,119268,6876,43309,33886,128363,35476,144249,67013,143587,83367,25703,91436,59347,53236,2289,16519,19844,46309,58558,99834,23313,218816,231303,36388,51333,183535,109792,139277,54306,90139,18235,8275,32710,37677,82464,86025,92204,88842,117723,37570,128723,234242,76350,73795,34896,148247,58424,11105,11744,45746,63372,17118,49772,199520,81902,38004,22911,33752,3125,1995,53792,4689,26909,108150,146062,69674,41811,161444,84855,8999,28561,16731,93937,3189,21967,24890,22943,1356,145300,51569,28802,517,118679,31703,40607,48098,108854,25003,10233,73969,177495,5248,24516,215347,146192,48712,60626,69188,40735,5866,586,101541,6509,47590,52129,5969,222045,110933,25733,24223,65339,62812,2414,155418,35819,16022,78423,43138,20995,128255,240673,46745,236093,72176,57085,97841,61248,107,36068,193177,105427,55726,215229,20446,47228,100420,87091,14429,121708,23605,21157,187721,21880,2997,203976,99166,95068,25877,7724,98925,83401,4829,13182,18229,13718,239662,38653,116505,153497,30589,89029,38962,181302,43853,78872,180301,4786,248240,7401,106136,112590,77745,19731,60880,77789,125748,135487,5975,48627,34084,12419,215770,47557,254582,10364,106495,21856,67539,88981,38805,21428,48732,42316,12149,16078,52808,25327,51322,33850,51147,12253,122354,46077,56483,254553,115417,81834,150991,94662,86668,7381,12841,100650,18218,15741,22372,68294,50705,15535,84660,61887,22553,72299,31361,24824,17743,46820,64288,31582,77006,111674,116384,30760,80920,86149,77192,51979,79691,60342,122805,103800,240873,160744,233114,78962,54920,8608,3484,316104,72548,24337,5088,230040,21926,10172,36838,26,86221,83458,102176,12062,17571,41929,41170,28428,68239,41750,103930,2634,18313,53019,34825,97837,63115,24606,73157,152474,14715,91439,37033,109806,140259,30668,174760,380,135597,95673,136073,65073,134249,13829,17279,122305,4420,46444,10237,64848,203623,70728,10349,182885,65075,24519,25783,40318,34139,22222,63394,55266,102764,41422,20126,65100,90408,53640,35128,48932,11192,38935,96839,34782,39492,19396,41332,6250,5511,19492,51304,25936,104466,54099,73771,86115,5080,7669,30891,111700,13931,25276,72289,135447,14820,258641,25265,31005,281179,75286,393,95359,14623,13584,6680,101227,80173,44933,76666,54542,13244,39348,458,25379,109451,134348,81143,6959,65554,12027,51311,8716,57589,140731,28467,23316,17272,30458,25980,55229,77197,83798,28302,114784,7428,34548,26241,14712,39336,103304,18928,54080,12870,334,87722,15208,16895,142098,114262,39820,83913,57817,28682,7721,14900,108672,11250,62246,42849,415188,1724,26555,24549,25505,26443,107450,145899,61035,43528,6901,60726,65906,267741,21338,147590,42079,18924,73017,135236,15393,5206,4026,84185,1531,5988,113890,82647,303391,7386,69844,71611,189865,76523,31877,13315,19314,198575,32821,1928,67641,25913,104475,103489,3297,70391,18406,15446,113347,19295,93790,27856,1792,167471,116449,8541,4408,41757,63233,25765,86680,64501,27034,24816,34975,6079,4486,49693,36229,16917,21581,62426,27862,11612,54284,35702,194034,355,24277,48262,87411,70504,310164,118018,12516,47559,43502,57433,107139,9290,66533,80863,14634,34312,91725,28606,21342,67241,72355,43244,375789,37402,174015,105070,8342,44167,67494,1890,16365,11723,271002,1865,47918,8350,45564,27742,25110,125803,8553,49504,81925,62211,4534,15491,19011,80373,206920,667,102405,128623,245524,5553,113309,192739,65766,19567,22832,261958,29679,21293,71134,20962,105123,24721,860,21752,33448,18372,157167,94822,35770,173224,232737,75729,28937,46828,28062,25453,5207,140366,36665,30652,6169,67920,150458,92040,23186,184604,92330,20891,176492,49427,27828,38305,42495,143982,49560,25503,90043,29747,65328,47830,12932,11068,77721,9003,25213,94205,140426,46090,89945,138173,192691,33329,112232,129905,35709,27514,1841,19957,31411,127476,53572,17497,173549,55063,175135,19841,69314,5192,237921,117660,150697,4060,273045,50414,98940,65348,153665,164423,58804,156695,48994,213928,86036,28608,8355,39574,34540,16927,135680,18374,151587,10830,53805,16878,16623,4282,48030,8537,14986,46102,13062,72897,72,33050,108227,39451,45935,651,113320,40535,95176,57450,48843,5003,19019,10407,211163,3848,1068,4988,32091,30095,41692,15099,43602,107434,50744,7627,171349,16313,150832,352665,207750,33937,38256,51091,156000,87889,90663,84175,24908,114900,50365,31494,83829,5398,169342,47521,54818,18935,8356,43094,41212,174536,10082,92550,6678,60614,23355,69721,14796,34149,128830,58187,3179,208,40325,28399,225029,401412,51150,31580,207268,6657,10993,69818,64282,289845,23308,12961,38447,6681,52944,31855,2572,47646,120728,179148,37240,45196,218274,4816,3695,21961,50084,35209,18073,51452,27004,6100,33941,1377,84831,171214,85,141510,9078,99227,32610,6417,11718,49868,65579,87902,73018,49062,46280,61742,21512,40862,107733,15941,29168,157765,144919,14487,5767,158014,140070,7241,573,71584,16921,223566,40331,179473,35081,47926,140885,41508,52104,59180,42310,32811,29048,123517,102413,80208,10104,14746,12649,153641,126022,37965,113017,4171,83,142592,2809,6362,50416,71323,116894,260776,16204,1524,5760,30351,12658,20703,54403,36083,45408,74772,4946,14485,50759,111222,10890,2195,167147,92962,130534,16283,177256,35016,15472,210156,151187,73922,117691,43250,52051,37392,24811,24358,30830,5775,818,21969,1476,127322,151783,58392,31021,106913,65215,89407,90802,28531,11690,20234,95249,44602,37256,18707,11928,5161,4410,26571,51903,49768,22008,25252,65780,209499,68769,203726,13249,137363,48845,86823,6658,5674,31881,1083,1823,108676,34518,166752,13791,14287,91576,91429,8665,11529,26401,16191,91972,30964,5254,28486,54697,79613,66520,18447,22870,45203,194466,22822,51703,12278,76716,44595,73455,33546,12235,144843,36154,51247,11116,33040,3180,225753,60864,1972,28469,12891,28879,10338,144157,56294,353058,38302,41447,87532,110616,27065,168438,6557,1213,50804,144643,24817,2390,136531,38174,247513,16190,4059,122791,131994,137430,39506,57650,16305,5188,54309,106128,20628,88071,67394,395446,250285,66176,91254,1399,114196,43915,60230,44853,27206,106353,43013,18733,345105,226453,51202,16607,57106,117175,35492,10476,89598,127439,15187,39624,13688,61570,10615,31111,59370,6238,175252,32143,224492,41388,95408,34384,148238,78307,38959,9340,160091,61443,15737,11216,41244,170,38299,102443,113097,26382,14027,33707,3957,76300,66160,19431,18900,6952,1717,108656,82206,188021,257335,27295,43999,41210,31777,46956,57457,12657,11489,15697,48060,204748,53583,82422,284790,30503,137341,8120,19615,220311,15991,10217,63424,9808,67431,70976,98221,4491,15177,28535,144789,751,13230,2394,1504,33977,132104,30316,22230,931,97193,185240,24826,22687,174322,15307,22988,1390,188745,180325,29580,59068,74903,18994,29195,79,15436,7622,38462,11566,138710,44828,45774,37768,99236,68137,84083,19282,22698,17134,74807,126662,173497,46248,16938,119735,3212,28292,213652,49013,9975,32180,45660,86250,4801,68788,95490,77482,113751,11994,44624,94452,46839,128497,100316,5798,58588,73184,202987,65417,37790,88524,1606,43156,97964,105717,34947,11203,100060,37742,130074,93653,107799,94311,196106,41347,8035,10780,16390,27883,118236,167395,1979,25006,19375,31628,18916,144723,78502,114047,103107,86492,107686,5844,20934,206963,23556,22591,16562,146333,20167,10471,117434,33085,2863,9740,36669,41849,37271,22790,18209,28979,8231,12952,54408,21731,25130,45208,55748,138120,75826,414,29593,9925,292865,25999,683,123149,7036,92159,86055,61827,103680,23176,54918,58466,57578,13305,5709,86479,16697,31064,17660,200919,10770,49793,33423,32370,52047,16488,62555,6459,8426,83493,7763,59725,82812,18628,67760,79405,68557,9612,7673,28102,56517,69620,171797,32458,29541,15870,81109,32080,207644,71495,21202,11039,91036,61230,2810,130800,32260,4613,60590,37112,75214,33979,126402,155062,30642,63875,12810,194463,82799,47664,16725,36685,43367,61099,449,172150,102867,21691,301838,36745,7130,18671,57316,34852,38034,54182,35578,65900,99486,19771,3456,2658,16914,99866,28390,28109,8262,21147,34353,20006,4228,137085,1675,203023,283196,198286,214375,163329,290603,152574,40471,83506,30068,14730,23177,131539,34759,27668,32178,71896,104799,116305,85430,119262,42860,25160,8911,23428,49437,105322,6519,16203,6349,74711,1230,38045,8540,75165,44736,25909,51026,317034,4984,32281,91312,27060,44431,17817,45363,155937,239085,35697,59784,91993,29531,126740,213757,76560,167776,285273,24262,8237,65030,41160,74437,48804,118916,13159,37842,1031,75349,1478,11655,108777,23435,277425,101734,67469,70231,124711,43532,28514,65526,54956,1000,21882,17728,25302,40952,52214,149632,1999,2111,3259,63362,89961,220561,39777,26335,9063,10572,12416,34551,34623,38604,24723,5947,15588,69927,66252,119177,69173,46629,28714,70715,212408,20521,406913,74380,11716,50659,50862,37009,88460,130101,7210,53853,538,65120,151950,55806,163748,52837,13153,21100,16674,64536,6091,138201,44837,58547,3723,163,2177,32288,85454,34033,8497,14282,25742,10535,10741,79559,117493,243787,49337,100718,79495,40139,42956,7551,55433,15421,31509,23034,45081,547,61176,53434,328001,8470,36263,30145,4519,74173,53935,11845,73774,60211,78025,3,4102,73782,109293,315332,48412,26683,13714,6865,20128,18490,104141,325,39470,171970,115860,15707,7268,73301,74336,31370,2368,111827,107757,136231,142844,97138,96638,84053,38691,23801,1588,10573,122098,77039,240,186135,146101,11996,18143,112963,46171,155836,348769,47795,121213,116266,132515,3344,144804,31286,99187,255838,129694,35894,48779,55235,148582,71967,65282,15174,13920,47080,6147,108242,157593,125025,7136,1286,28957,127956,28402,98813,20805,7532,109417,40610,5041,32958,15142,18408,108596,33543,50517,27748,80114,233434,91447,487,37094,100048,30541,43477,10639,89862,155868,37667,8726,60684,237903,73408,99589,12190,38739,97348,3914,13594,2680,149016,13907,30171,28343,23530,115225,61104,35821,147679,14337,4297,244282,24085,326976,56428,7851,21303,131620,71446,83253,68692,111870,5224,15813,38197,49026,45057,13660,3306,76345,40671,27905,91072,996,68527,62085,91351,122634,55109,168209,2024,27560,112707,17352,8306,167115,169921,166958,5031,46020,11844,67284,19130,76185,6920,32849,5450,14610,22451,21002,17392,31872,66682,84796,13709,40210,59898,12029,8719,53564,21462,91884,21647,88379,194428,12754,37797,132826,160016,22567,54383,53186,77611,31107,8339,4694,19185,90355,23597,17222,140675,28442,23668,55977,9128,61555,28774,155229,17658,9390,24379,69357,15752,127381,239631,62460,93181,55913,45133,140155,18676,25249,33164,29581,82837,67223,22362,29975,7317,52813,1943,29613,20012,207130,49617,49651,5636,15334,36313,29226,28084,95247,72072,19000,224932,15811,114,32127,38097,37508,88507,37225,27359,91626,12193,69279,20608,11055,88156,92808,2152,57259,55275,72789,24475,104414,1708,9882,3818,48661,66897,1631,34806,227930,85815,87753,18321,250664,72733,25107,206797,50891,8082,196411,92596,96764,152823,65514,22819,387277,62176,51225,40329,15563,189,3659,73670,64357,51793,275136,33482,86653,74615,67058,11318,125720,15388,22388,8267,1730,102663,170910,40784,7144,85373,13040,7088,94309,583,44224,140424,77439,18496,164026,36578,4722,9151,5824,63365,26510,35199,40500,79277,32495,44614,35233,9566,203293,152144,7097,2330,183480,98629,13423,330887,44130,68600,30939,97829,31012,345465,56747,94879,4939,160027,149761,99423,46099,32251,15332,8761,96094,128555,5763,235318,222223,55729,30241,55420,201746,3987,81382,8259,49325,23287,7719,24633,251100,92311,18591,110533,64759,170260,393860,7175,21144,132887,3593,75346,101277,91109,16387,259187,11627,57459,173829,44694,55780,49797,89192,120443,62622,3904,14814,23887,1027,112258,64955,99800,11132,66353,36202,48624,18158,88481,96882,43059,11040,2455,7077,21651,181159,99126,100434,61388,68186,19161,110468,120052,8819,55324,41494,7014,37689,3618,87729,92615,207943,9823,128657,12587,15857,6379,67628,51216,71775,157617,63244,1503,3864,218754,110864,5769,21492,7243,1192,87921,85529,31512,18537,42698,35350,73510,84474,34301,8991,21013,35034,566,38832,19838,35586,37216,39413,55006,12178,59742,856,84563,6900,25632,17437,49786,30723,13847,70845,4044,7843,23944,235976,55530,48942,6518,20939,73769,192653,52936,95207,23895,132542,142982,22632,87452,48042,54018,178468,10728,26230,23559,363,81269,142012,5718,346258,31456,84333,246476,51018,66692,101804,120570,39962,30373,70593,2864,60541,19425,54209,104092,7201,31545,48018,25865,15442,46257,40443,8328,6451,111782,47527,97754,33046,470,245116,31095,39,91934,87208,73470,36708,36521,12801,70624,36272,8892,79768,12427,55454,103756,5908,52390,62962,22720,141138,94634,41689,128402,126390,6628,106394,35527,134394,82727,254651,194502,148064,89549,3202,28359,957,21954,27906,49840,142747,8307,24206,48978,1186,71728,133038,71474,91306,6333,110959,74600,70387,18983,62609,56057,22970,1147,135850,1321,28834,3578,59715,102227,32827,81415,99952,55636,257598,390,22702,35701,85872,402916,39216,189795,14929,19467,10112,144422,61514,5279,63421,134686,41436,8424,51925,10598,132295,124416,4604,194739,210929,57866,31829,51626,50007,9976,91878,61906,56168,81906,60918,61859,40017,23059,16887,40927,62064,12785,32893,32913,21782,93965,20169,44387,79084,38463,11457,93950,27127,157050,2697,337088,5116,54128,48255,33279,8821,27352,25515,124022,65710,28906,38557,33390,1722,104435,72215,38551,12094,30978,25113,6671,37355,175109,42862,98024,65406,221276,59624,118012,64637,78760,86697,21426,1639,40350,12584,67193,84144,31396,7863,143011,69629,63112,9454,28666,65798,46372,134721,6314,51402,30837,151922,2847,38676,38008,92823,136245,17540,5504,109295,205242,37606,5211,214892,1586,20670,208711,137743,19328,40652,16995,20023,14657,154919,34422,12996,13918,38221,47690,16398,2959,37680,89122,6721,198469,91876,172043,83898,101992,26084,94570,3635,76958,22853,76497,38266,176590,168403,44464,142840,79180,184594,1984,41806,83147,11985,6546,366068,59732,24533,271505,8736,39084,222992,93429,28962,58985,86665,8432,30028,14548,32439,54424,165029,55175,27458,69046,121277,46168,33732,20661,24581,135574,123110,37556,79260,72611,16957,12939,46162,58238,44907,72936,253758,41324,32518,96480,11949,124438,65280,43256,34107,53533,43531,37037,28366,45970,32741,173438,6121,194202,62969,26355,30314,58370,28455,1848,50519,82830,90393,21761,295490,10936,256940,133568,44050,20269,4089,27457,21610,219460,36743,14821,101388,52005,13124,30979,140816,167362,26054,18458,60789,34917,40447,26606,33422,9066,3452,83614,5761,20263,137238,25038,91310,101,52322,74548,42572,38084,214054,186568,31802,17665,30620,141936,37730,14420,4265,187218,49640,188208,51441,55388,96452,66659,40869,42039,60967,221027,19234,178581,29105,96050,9165,196118,157335,3738,40354,117436,2965,34136,59659,15570,50843,230035,31444,71260,43886,18316,5387,38500,168508,17406,32174,8828,103373,143806,90367,3560,18719,122310,16508,26719,2541,105429,6645,37998,73190,10591,235916,49737,87112,233941,53188,32193,79154,4544,52905,126477,7580,63501,57314,3216,31337,6541,103083,60846,49,9756,15481,1355,43840,14319,13743,27486,10222,73114,230718,418644,16706,6674,279748,23058,45273,295831,86306,2743,5535,88773,21829,35253,120938,31153,3169,16839,42847,8751,80974,33942,36867,35514,16485,26474,77775,56877,5391,48346,3882,108713,31403,27804,55248,26235,43821,136104,40118,175507,28034,203908,18732,1788,34030,106427,36958,54359,7251,44936,15356,69139,455,157915,22173,140291,50348,43275,82066,49621,54952,15216,36226,96695,66855,6936,1987,8227,196087,4631,68827,99004,47541,110265,17953,147605,110242,58520,31312,38724,329975,642,3155,34497,75937,6207,73843,6120,17249,51429,117746,3218,910,68961,319671,14938,29555,34700,1649,66673,72268,9655,76800,153087,6941,210168,27130,35398,1780,73242,3135,56689,19556,165307,8765,35967,121458,13333,70453,17350,117253,22265,13340,44265,39869,441,3742,135025,23581,33309,16543,17731,13291,157637,283005,21408,101360,63887,52312,83873,5338,233779,23759,186949,34531,177320,38069,156465,91004,19353,59852,68160,14891,1338,1072,29823,1950,28901,81407,313445,73038,84807,162348,240257,37162,138934,16111,58013,41253,102951,16457,96056,19541,56402,67217,41638,94381,89674,29481,37456,80815,151579,13937,13683,132537,19699,134545,67020,29816,222341,141235,427578,48868,129557,233342,23077,87871,16213,18728,16184,9469,37913,19680,2798,171356,178328,13216,50049,72690,71904,124644,55455,7504,29052,41036,266546,19899,30391,188755,8659,59469,16,104298,112943,53865,76203,138226,68857,139953,14125,107625,119795,173133,4398,50273,48808,54390,16466,122086,31835,67035,50971,48859,7508,46427,66477,73021,84615,39985,83076,46779,201569,53336,36443,60865,168164,143810,51393,25548,169307,32896,24485,38424,21837,29087,275813,51674,6714,64883,46169,187369,55186,76192,12852,12018,62134,31067,118303,16542,12125,10579,4928,26291,43854,7091,10946,253716,109062,39283,17261,113012,258512,47764,125126,32646,55892,80279,201623,149872,3192,385,1208,48750,5376,58738,22335,5427,82416,47811,32435,143086,38930,94128,59975,156037,37977,38224,62485,7698,50405,71027,16462,21559,136153,34131,107506,162069,63703,3101,215029,40407,4178,3774,9187,80019,17880,97926,67579,2600,18405,8351,47924,86638,70820,92206,86453,29610,42241,119200,3198,15466,67813,57863,35454,4779,99518,4649,104641,144269,33730,38073,65864,6838,109456,193298,154007,5623,45741,30846,182578,25573,157224,1543,58575,138703,146140,44971,49356,18275,59064,20300,13122,11848,24453,11973,9797,86843,2919,25530,49210,1130,161220,76788,75373,85604,34926,36014,17777,17255,51533,11676,92226,51845,119859,21525,5936,18507,28050,1140,31418,14857,34207,47859,10750,36382,32079,106909,59426,87757,38393,110042,15965,97104,33757,35344,97993,53979,33651,45407,41884,82515,173089,7177,58371,35365,47543,51927,35587,10670,23544,29306,84233,39976,76076,62097,9007,8668,28119,78281,120790,19835,143020,54968,18670,64959,20649,34469,42570,33001,136570,87796,120044,1106,58700,63951,127623,12805,83057,40212,31773,49850,7361,54336,347524,101314,23751,19569,48791,29174,49369,20467,7465,75842,38281,623,112457,60210,28849,51003,94720,6426,90047,85560,43761,3579,85105,34607,90410,118528,7224,42907,111163,18168,6960,161135,191298,5247,100584,127552,171568,20121,91173,12636,54615,20199,63730,98105,2396,40387,14438,125012,4765,33235,12865,45299,37728,82098,77872,114037,59253,19675,24838,398016,102561,11446,17069,57508,178277,65836,99941,26114,2585,271882,136866,50126,11027,155648,118367,14585,8910,123015,335383,40434,41016,53021,14439,87098,176860,201543,121888,2358,9286,5739,22666,54270,37884,169381,33984,93859,16124,89364,72207,51639,76366,99029,65812,2198,12147,174891,194289,6986,30252,88822,21284,11445,288337,160821,33034,100869,43852,25761,52882,1144,103809,1924,84458,86079,43411,13542,139276,18141,34978,41298,7276,26481,173800,33210,17951,142652,33616,33677,2210,19941,98568,2486,192414,80136,12058,235883,50963,249638,29572,27221,47034,6124,72107,63346,97620,158513,299699,40388,23235,37176,224244,198386,121323,67992,23827,63170,17838,106622,158590,26807,5345,23489,91891,55474,74834,37981,13058,5977,72552,34706,26828,145172,19904,21367,34043,960,77092,91381,4733,47446,7680,41697,5170,16960,14741,46101,13656,473,51842,37433,11103,11551,121951,13191,97536,165932,50397,51628,129028,9069,44885,6590,59195,47045,32940,225472,90345,21833,13303,29407,96615,141951,5198,6028,18395,7181,3861,14966,156358,167182,36529,55253,25942,173153,30959,27261,50691,150176,162201,38467,48462,80602,42163,118482,168,108756,26011,17166,54149,456538,22512,91374,13816,90358,131615,18132,226707,1824,28139,26860,42253,93877,77351,65575,8980,80574,22020,27948,40422,91324,76376,13528,39281,91685,82215,122541,144066,1983,193851,17283,26320,2739,194978,4790,26845,42627,61300,65815,174612,55133,4200,191130,79771,158321,52280,166796,221620,62461,11278,4067,88152,83409,31717,121367,13522,47325,37945,10406,174348,249321,154101,64912,29938,51775,17220,15776,166138,78890,84425,54121,42861,16368,24572,291647,10197,32073,22651,11677,97509,26952,35787,18424,41910,71614,94977,72318,41594,70024,275419,37702,60199,7335,39107,61315,18271,18394,33768,87884,104277,123724,7277,56288,71981,189803,49320,3352,6798,14240,8954,69220,94433,57372,28620,68863,193727,85575,42309,41667,67689,42081,22543,44824,12719,28540,114236,101553,27638,27296,4300,5353,4663,19379,94098,3758,95888,95144,80344,87320,28447,259518,12718,71391,152731,37063,24132,31911,104896,15672,103782,1521,4945,72541,23717,122632,15619,87175,206120,29428,189780,61416,28350,44457,972,1175,47233,198738,95789,41907,21953,97034,59341,22864,53713,16873,32971,20693,20954,31336,21477,16169,38370,16412,9019,3841,24599,21938,17085,6484,81198,76413,5849,72514,12320,65247,276175,37234,59796,52642,16312,57349,198507,94148,46134,18958,125552,1747,18725,151873,14901,5490,68287,29470,3689,64794,40814,26018,25692,54450,2703,88278,124886,173087,174000,24159,179477,24276,46004,201876,209202,445,52876,31948,30206,157610,39180,18439,44124,50469,5774,96278,222758,200216,50290,45486,20435,46986,46276,140133,142326,15569,13363,47522,92583,2182,7135,16853,22998,30272,4952,63263,35623,39096,53789,44864,20053,110392,124213,4630,16087,28221,127787,25839,77481,44693,13464,113146,6983,27069,55717,50102,4760,7107,26186,66507,59145,36032,104182,71328,29425,64317,50781,47465,94298,69706,74899,22754,120756,25108,93077,56834,73286,39928,16218,41699,176763,7555,70819,50083,26895,23315,26014,16773,123079,41712,5719,31516,90427,158540,85051,183128,40864,27505,55392,9058,45224,96857,30901,136622,96557,56304,120061,11501,151448,5773,89743,7769,86069,2935,18471,41628,10114,33660,110170,49479,26745,92846,33221,26731,18795,87076,8550,2100,29972,120289,3077,72490,33784,2630,208722,50861,63483,79029,6419,39467,14302,45286,64207,9686,67513,44170,1050,77246,59266,17055,53801,7150,11111,42432,4278,94579,362117,36175,42902,41933,39002,98489,22913,74161,84773,57036,17556,162288,74485,178760,93867,73635,128860,50362,261,67455,80001,46080,35662,4368,25247,19230,74393,22588,1822,27682,235324,13798,85998,13194,235067,23514,71669,147632,23191,134748,214683,105101,1518,25489,247114,7380,54842,26922,3971,26361,20844,68642,170517,77339,123255,8963,77818,150998,48466,36806,2732,23261,11741,236162,18243,126216,28690,50546,16385,92760,197383,246558,201295,88255,67588,71687,176076,172653,169058,33906,63747,24835,157621,43338,30050,46152,132741,2770,51371,94835,6614,15112,11749,56936,1250,19027,399017,58036,100215,23388,55815,308768,124152,94803,9521,64186,8971,28,30427,62163,7616,103838,35079,29203,131235,7743,17389,10882,37420,61460,228512,85363,41581,131077,62822,119647,10130,54445,26925,19968,29016,24446,74028,24176,61448,67185,9254,8563,119129,9771,99184,37716,39514,10532,221512,258753,218630,55980,23394,32141,61924,66749,32411,3741,36475,26678,77010,44946,91203,128749,116953,20476,49625,53116,13735,102335,29376,51946,83407,67892,59212,34685,21083,1546,112982,32972,74397,1078,190545,16082,86140,58591,89611,101531,10061,105104,76319,20035,17551,52611,169061,190842,100780,23907,90413,115619,9675,34710,193435,49443,129734,11183,258877,16318,136182,126808,44635,27304,192375,2599,125648,47051,12091,23814,721,58800,40137,66726,97930,60877,74487,7942,54326,9841,41428,13762,8211,85383,6950,99177,79806,201786,296464,124087,13144,29741,41721,47634,55088,254286,106408,17041,99064,12942,64086,45233,14005,2612,55827,255,7984,13980,38574,12776,46654,73499,249951,2101,26676,25996,132326,116415,119062,50449,31033,23038,11589,179252,20007,14860,129270,21143,17796,144715,60106,70758,69842,34674,282133,44014,16774,57268,38528,24053,46373,201667,28327,471023,51889,102667,21193,114909,84132,69317,96723,67969,16134,68145,15058,28765,32035,2524,101089,98664,25045,76571,14957,86040,118506,262428,154764,81573,39681,283900,73287,127825,544,80448,52347,38512,175971,15180,45467,33086,46552,48894,81107,43213,36672,54025,76703,8053,7608,13299,56619,20752,238099,54164,105133,1444,32942,953,37564,8000,66316,119463,106817,404,13667,149108,128597,31267,10269,49836,106150,1484,52330,76965,160486,171648,38456,31263,22424,37738,66245,67467,143369,60471,75610,20895,115528,86070,60854,40796,49347,18989,15030,11371,37578,15779,79867,10187,86462,46402,155626,93200,40229,7090,57547,108053,99598,11088,47505,41218,206017,2173,20988,30219,22919,80563,57566,42369,93141,41675,2407,182519,120495,27154,16702,29456,14349,7958,16688,117177,140375,42467,261919,74916,153569,10836,34742,49526,7621,105997,12212,2270,392377,7755,17959,25086,232152,138791,33847,13860,35316,5811,1344,71259,50452,207539,92635,50359,5821,33674,30255,2086,2587,96264,17543,42,6029,9580,43007,139248,82831,12917,29607,25786,51467,42137,85161,100698,31561,88989,121990,278500,3602,109344,37982,15279,116442,28936,30880,87894,58079,128661,126731,67392,28051,146885,4861,16216,97344,42827,147561,153948,22684,21335,47685,1853,43349,15185,59642,10229,25520,187921,108972,5579,98037,24945,6697,19193,63734,137934,75056,89740,19767,224268,56138,63643,151661,39313,70618,84031,89723,84074,13703,85626,35460,8867,64845,3439,57906,99776,63968,49270,81130,34356,16210,23547,36446,34090,140028,72439,2221,22163,57058,363492,113754,18913,95451,48663,54464,54037,176097,68425,3023,34906,29482,117389,341780,80431,58330,16753,92616,60907,94846,147486,4498,48646,7773,46801,7778,18946,464978,47558,33223,177444,7328,15626,63337,94700,11743,9351,255024,39098,16447,42647,96230,39769,58840,10068,63439,35800,65843,58823,413844,9156,51258,7434,61791,85018,6872,3692,28096,7121,33024,6009,75532,31997,192535,9661,3304,9547,14753,31987,25314,55689,15896,20430,39472,31340,99744,25398,115569,54883,28719,205423,23071,57855,64638,149867,25671,82403,37616,20668,39989,77996,74948,140555,175248,64810,36515,46595,4958,248773,24045,28728,136673,168704,20804,114833,100325,27135,21205,96151,153134,45992,7093,13992,76047,1980,19432,145001,75159,87462,17710,1013,45556,34297,144882,20648,26061,11319,129567,108555,18872,464580,33386,22717,65948,167189,5603,135042,79542,8801,202632,18114,91882,5973,5239,67315,4431,60916,47819,71693,32597,32606,18183,45072,80329,76385,24749,51305,40314,156514,14693,130345,13168,66214,18029,12858,34801,27628,14544,10823,40522,40185,33739,148694,23548,9923,61012,28859,17933,19442,34364,99849,164107,141167,30629,21054,6744,36491,8096,42474,41706,155060,30650,10600,163442,1143,96655,61390,52359,7559,51568,64256,203854,4467,22453,14504,436398,7878,6980,8293,63610,293747,16167,35763,19627,147603,15419,18032,110744,51346,33681,54571,40472,48615,39073,21604,13754,173027,92560,11083,47299,63062,11813,52007,29883,9734,139722,15953,1550,20651,13616,49306,16113,90089,92326,7584,30712,72424,164858,6831,152871,55746,197721,34167,196442,6022,112107,55215,7538,123381,4920,43539,77165,8939,50392,34192,20225,79762,22505,58667,40770,29788,97180,82835,4568,8579,13273,363569,35898,49983,436,36598,3237,131691,62418,35591,8101,4073,379438,65218,76072,33887,2968,27573,212619,288680,68278,72851,150504,217896,6913,121339,22017,35340,51072,43616,75043,31437,10833,81487,4364,22968,41454,106687,85446,19863,109625,149241,524,141850,214404,54376,657,237023,9401,108137,53800,32474,49712,53334,126876,27337,45552,177696,8269,15036,12097,42240,2328,125374,119295,99715,2500,19624,39441,27220,102691,60957,94543,39101,18566,67362,13975,78230,25017,34017,239007,90027,39351,41681,35354,43822,1043,916,58587,141983,94818,38799,75459,41114,67432,16195,36606,59568,22272,126769,31424,68659,12287,134302,257977,5756,207285,95637,47248,117689,19583,77451,22373,12200,54993,117118,34244,29386,34562,53819,71267,64172,77665,49368,7716,59301,25749,45426,194789,17297,2650,1766,32501,45198,20403,20984,6600,14171,94604,19037,5402,29896,9938,59935,109708,88081,145182,44844,39167,352626,164173,35374,45982,6122,154,73419,220487,53834,53601,17992,8609,229321,5610,68098,66815,71012,95069,140968,27396,8957,134489,24656,86659,56598,134852,17316,123838,255436,6613,41610,138033,81452,32023,32396,123687,63398,8693,29712,30407,19296,121188,3551,36099,20032,111948,56624,16547,27453,35916,15378,52039,56849,13489,22214,73177,53097,277349,2157,14029,187886,10260,141743,246460,91880,50869,3788,49486,133566,54950,33120,129337,53768,18333,9525,26902,312251,10297,9020,70759,16647,112432,59260,84609,9818,82766,73569,468,46001,75780,55028,52106,11498,43645,108069,17150,17753,29417,16705,31799,9606,289,122254,115975,8620,6133,255357,56908,14456,133464,43554,79224,11247,29630,160,12756,25464,65960,350428,62521,321796,100359,67358,35169,46172,113128,48988,88868,31094,33266,6847,60887,98188,49659,69117,92977,220228,13947,80181,35103,62170,97351,13475,2440,199768,19498,36597,46971,25234,67806,62881,84717,73648,181966,10488,94149,21550,26655,63436,48375,14405,165650,9621,24439,28043,42735,4490,29963,56674,45373,1934,262446,50855,67098,26898,5261,52696,40644,33900,9440,180286,87162,22940,19704,26936,69769,10254,101759,27406,12243,48000,73926,113215,54935,5726,192787,4312,106216,9366,11550,52949,23457,212271,277152,133895,108374,6191,96477,29980,218916,58024,54696,40853,91124,65894,91170,65908,252552,6793,29212,15389,44516,122515,52617,35058,9017,103536,39510,49136,19242,130652,662077,74699,47024,31422,8517,73351,24399,13867,128360,4810,4434,61779,111983,61036,17798,110240,59722,102960,39688,10001,23803,23039,176498,56659,44814,134295,17188,77577,74466,226175,102472,154333,63900,111747,18062,41171,79669,32773,408933,42562,28931,30907,107388,43487,2946,240310,23938,24354,319,184983,7927,6488,1422,10790,68809,68209,64775,4361,202,17123,59634,51200,44391,18188,17843,2619,74278,3230,9540,47187,21702,36274,56894,43907,16310,34790,16866,6150,5561,13587,107545,108873,126867,86986,28640,33427,19017,5762,80637,17430,46903,2047,131055,25958,13558,5444,47152,13900,44563,122857,45348,70863,39593,54332,38068,33637,318,40310,143467,18502,24520,11377,62013,28942,27246,28269,83545,17999,59015,90707,30065,15161,34720,1263,37008,2012,6060,98575,92933,5721,299,199555,24578,29223,2985,743,115825,109523,136657,47454,26378,53586,3733,174945,93340,244456,5693,37386,28782,89767,27545,23573,18798,136425,34320,84778,20041,48453,38215,7477,71958,40621,8773,5874,187927,105965,51100,43533,18083,8443,10180,43597,2003,183999,69689,12216,129696,146188,62389,34044,68410,12765,43273,26949,266807,3345,34477,79197,5688,47539,213110,21634,22257,50092,32222,42346,39530,63668,98,134978,74022,5152,59088,174145,37220,9934,9545,118937,5724,87240,19875,15784,40143,23263,87513,181654,285152,37881,263241,4966,43934,10433,186657,6470,74416,225854,25908,142677,246262,32280,6192,75890,45546,143264,135305,29742,47013,77787,11732,126658,8763,37950,21806,57557,113464,89465,108995,164574,23894,22996,23169,15369,23117,17642,130607,40503,36239,280990,44666,9981,40427,147487,26869,168452,32886,32991,46798,240839,15111,70502,65697,88548,44145,28701,48767,31139,206777,35659,181164,166262,14554,171445,31786,66523,76607,17956,6507,31279,90476,116611,167918,6560,1243,115324,80128,41867,55897,187323,37069,32596,189444,145931,13390,105530,65709,26805,6999,55714,41300,22915,68951,22138,21120,22264,10058,19945,33635,56123,99085,10032,5818,6016,46649,57476,35264,94413,112522,262288,93686,83038,14341,23204,28807,66084,77987,6101,126673,7133,38126,5923,122091,170240,97772,46874,215746,43948,41622,3272,55596,8332,146411,251315,13533,8561,81521,115449,48616,175175,2063,186556,3036,134537,75772,29728,82360,22973,186559,86348,89100,38388,82297,45610,2613,87082,9986,177812,57884,23591,47485,42543,33582,44713,74439,257444,252451,31825,35631,38540,33066,5147,13973,4343,51830,70378,22827,26448,95560,36896,241741,48067,203953,298860,61620,20450,3220,67272,6586,107662,100160,108684,6929,57226,4762,7457,1320,40404,77204,99309,62750,208653,59977,44000,74315,34332,5819,172217,64904,114077,18147,84012,1791,98456,90930,21446,116669,103938,7422,85140,59713,5768,326211,16239,75411,13229,29398,10758,236107,1539,112472,95979,152154,151294,306,21196,38146,10700,6891,84282,109646,56492,40539,6589,119491,51354,30685,140209,136906,29622,73617,49553,70525,51671,166869,139616,74395,37439,49595,45678,11959,33211,86560,52434,9282,62690,112155,130810,5243,108261,99970,265613,72551,80049,6391,33365,90721,66737,69872,87011,1860,9032,112544,60905,37371,89015,140351,19076,850,373531,2802,36725,218795,72062,28990,16550,24614,7815,6187,26336,33373,32162,42791,73555,32062,23386,10244,56392,49442,27076,136262,12412,14883,1134,33675,97153,199281,15608,100152,74072,47942,254301,36451,16026,10687,65067,56708,254030,30290,50490,13864,57941,259331,35588,23485,43486,24869,21620,92971,22072,88645,1048,182050,13343,32452,14825,19509,3325,216938,45740,99716,189082,53740,78245,25609,24311,176777,47340,308354,40669,66085,14102,125339,9225,128709,97207,1271,200933,78439,113451,88975,18324,46521,11819,18570,141756,72512,170020,52754,63550,118515,103073,93330,32736,50499,14722,31600,68452,398867,29316,172786,18417,104924,2606,5670,84818,16288,67106,59580,82929,607401,291,85829,359,15897,35830,50696,65630,52672,22115,356968,29895,40837,231192,34024,38957,26722,406,23335,124952,72068,68804,13268,147101,164740,276569,162596,66943,11569,26654,66358,4777,23229,102127,5848,978,2921,59666,5371,28212,90108,42938,39320,2499,4271,108792,33510,125072,71653,65239,38250,66357,38577,13964,86251,35708,50755,36010,29448,12209,3844,38222,206337,100876,67827,137088,14167,252225,84163,195270,1306,5703,54198,779,46802,22028,51124,86759,70560,113164,35685,162145,45471,34561,422,2611,6464,47486,19223,38246,9191,18331,89942,243642,212364,15893,17518,22617,6409,30046,126182,59716,36560,104428,18846,26592,19458,50793,147333,30826,1388,27647,10922,14495,33545,19269,135828,39727,41601,46931,233379,49169,131130,182112,16276,82381,118209,142445,128310,19672,28740,82907,33436,3118,102206,28723,24819,41937,38854,5157,3881,111491,1142,9776,421673,152241,29309,14961,87854,6054,15424,3796,82656,54996,2108,55367,239450,154525,9643,118103,106041,64601,68549,48707,30266,25772,18740,9462,229669,91798,112152,191327,14493,72828,8175,66636,236474,25817,87351,129027,76653,20422,22983,71240,27846,44661,12399,46158,77704,53101,35032,11072,17300,109294,33638,24408,1895,11241,760,17584,82479,125877,63150,141075,34259,23274,81698,15732,43577,48340,91584,14688,16379,24481,150280,96420,262050,48635,43727,61819,56268,72003,88178,17281,79912,13218,122519,125295,166396,11811,2171,118930,67746,17636,178278,174656,95661,173039,83845,79689,17473,98555,127696,203415,54730,22925,232239,9309,12136,175026,20740,180188,10747,39816,314017,266131,10040,175732,112550,220651,31974,37393,888,23008,86799,4303,64905,148467,75337,251,3284,370102,50264,9835,5438,23655,4481,29851,329,12855,7162,64931,78141,12804,42372,296771,83547,18624,34874,86271,3360,48665,77735,88767,11463,63527,28889,22258,29140,194315,113924,25499,6406,31334,1845,4802,49184,43455,35469,127594,92970,61038,115005,38840,87761,106838,8811,20572,55637,11162,96721,132425,108925,2948,125457,36356,3502,75270,27622,127192,2561,123095,49394,61155,16897,110064,9699,89448,53356,19628,220310,21622,83036,9885,112214,6087,26713,17901,161912,91492,3440,68594,9266,92238,8087,6866,150194,72175,80701,13459,31836,43243,239700,95846,44749,50647,21945,230538,120612,132371,244604,5193,105637,34661,41341,68775,85393,1874,8771,33718,49672,77403,595452,99507,6490,58895,128742,7704,39239,73217,43816,62824,37804,199976,22361,80005,87514,94832,14089,4574,139975,59142,75523,100268,43906,53442,15152,2547,186002,17011,19513,204282,3343,60568,128318,119250,4298,51871,41336,71759,21921,45074,98169,145889,99427,11350,1237,5520,28799,7803,53702,21026,136352,38293,128690,12158,90132,44600,10184,26957,39459,126025,78904,82999,59373,39301,150198,120529,153042,20177,50089,14764,271571,30530,123161,38975,101562,22941,5648,124654,109243,69817,71675,49162,106884,21241,107795,30258,16572,188262,141456,7688,60718,8271,11044,32440,104608,103419,236109,93156,43293,128929,42107,67180,25201,115254,185488,130954,72813,167547,20537,39969,38432,22582,184022,1139,27199,5655,17767,97412,122606,209377,27070,35871,326617,188954,42680,73512,80911,22629,3011,95021,315242,157737,383,41821,41808,19335,27950,15674,25677,110950,35375,76835,59108,57370,35262,16569,160415,37706,78086,32041,49691,137143,9782,172080,50148,77917,6323,10110,69172,17711,21795,59511,76184,135114,31046,132319,59105,157578,20549,80778,57649,158421,65143,4575,72235,21899,10797,92745,34035,106079,80159,4508,78304,25350,75457,46458,32937,25623,47,8531,104751,84953,8138,36508,187199,66310,115274,13253,32461,38536,1916,42007,187160,35055,26325,84394,35963,94216,45590,97782]")},{}],eTk1n:[function(e,t,r){"use strict";const i=e("debug"),{sha256:n}=e("multiformats/hashes/sha2"),{base58btc:s}=e("multiformats/bases/base58"),{Key:o}=e("interface-datastore/key"),{xor:a}=e("uint8arrays/xor"),{compare:c}=e("uint8arrays/compare"),u=e("p-map"),{Record:l}=e("libp2p-record"),d=e("peer-id"),f=e("err-code"),{fromString:h}=e("uint8arrays/from-string"),{toString:p}=e("uint8arrays/to-string"),{concat:g}=e("uint8arrays/concat"),y=e("p-timeout");r.convertBuffer=async e=>(await n.digest(e)).digest,r.convertPeerId=async e=>(await n.digest(e.id)).digest,r.bufferToKey=e=>new o("/"+r.encodeBase32(e),!1),r.keyForPublicKey=e=>g([h("/pk/"),e.id]),r.isPublicKeyKey=e=>"/pk/"===p(e.slice(0,4)),r.fromPublicKeyKey=e=>new d(e.slice(4)),r.now=()=>Date.now(),r.encodeBase32=e=>p(e,"base32"),r.decodeBase32=e=>h(e,"base32"),r.sortClosestPeers=async(e,t)=>(await u(e,(async e=>{const i=await r.convertPeerId(e);return{peer:e,distance:a(i,t)}}))).sort(r.xorCompare).map((e=>e.peer)),r.xorCompare=(e,t)=>c(e.distance,t.distance),r.pathSize=(e,t)=>Math.ceil(e/t),r.createPutRecord=(e,t)=>{const r=new Date;return new l(e,t,r).serialize()},r.logger=(e,t)=>{const r=["libp2p","dht"];t&&r.push(t),e&&r.push(`${e.toB58String().slice(0,8)}`),i.formatters.b=e=>s.baseEncode(e);return Object.assign(i(r.join(":")),{error:i(r.concat(["error"]).join(":"))})},r.TimeoutError=class extends Error{get code(){return"ETIMEDOUT"}},r.withTimeout=(e,t)=>async function(...r){if(!t)return e(...r);let i;try{i=await y(e(...r),t)}catch(e){if(e instanceof y.TimeoutError)throw f(e,"ETIMEDOUT");throw e}return i},r.mapParallel=async function(e,t){const r=[];for await(const i of e)r.push(t(i));return Promise.all(r)}},{debug:"bO5wM","multiformats/hashes/sha2":"7i9MT","multiformats/bases/base58":"4n7mA","interface-datastore/key":"9hGOz","uint8arrays/xor":"6wTd5","uint8arrays/compare":"2xv9i","p-map":"ccWP1","libp2p-record":"h5gPS","peer-id":"8Bdb3","err-code":"chZjB","uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB","uint8arrays/concat":"4EBjG","p-timeout":"hP9Ay"}],ccWP1:[function(e,t,r){"use strict";const i=e("aggregate-error");t.exports=async(e,t,{concurrency:r=1/0,stopOnError:n=!0}={})=>new Promise(((s,o)=>{if("function"!=typeof t)throw new TypeError("Mapper function is required");if(!Number.isSafeInteger(r)&&r!==1/0||!(r>=1))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${r}\` (${typeof r})`);const a=[],c=[],u=e[Symbol.iterator]();let l=!1,d=!1,f=0,h=0;const p=()=>{if(l)return;const e=u.next(),r=h;if(h++,e.done)return d=!0,void(0===f&&(n||0===c.length?s(a):o(new i(c))));f++,(async()=>{try{const i=await e.value;a[r]=await t(i,r),f--,p()}catch(e){n?(l=!0,o(e)):(c.push(e),f--,p())}})()};for(let e=0;e<r&&(p(),!d);e++);}))},{"aggregate-error":"45emq"}],"45emq":[function(e,t,r){"use strict";const i=e("indent-string"),n=e("clean-stack");class s extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t=(e=[...e].map((e=>e instanceof Error?e:null!==e&&"object"==typeof e?Object.assign(new Error(e.message),e):new Error(e)))).map((e=>"string"==typeof e.stack?n(e.stack).replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,""):String(e))).join("\n");t="\n"+i(t,4),super(t),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:e})}*[Symbol.iterator](){for(const e of this._errors)yield e}}t.exports=s},{"indent-string":"hRid0","clean-stack":"eUSPW"}],hRid0:[function(e,t,r){"use strict";t.exports=(e,t=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},"string"!=typeof e)throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if("number"!=typeof t)throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if("string"!=typeof r.indent)throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(0===t)return e;const i=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(i,r.indent.repeat(t))}},{}],eUSPW:[function(e,t,r){"use strict";const i=e("os"),n=/\s+at.*(?:\(|\s)(.*)\)?/,s=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,o=void 0===i.homedir?"":i.homedir();t.exports=(e,t)=>(t=Object.assign({pretty:!1},t),e.replace(/\\/g,"/").split("\n").filter((e=>{const t=e.match(n);if(null===t||!t[1])return!0;const r=t[1];return!r.includes(".app/Contents/Resources/electron.asar")&&!r.includes(".app/Contents/Resources/default_app.asar")&&!s.test(r)})).filter((e=>""!==e.trim())).map((e=>t.pretty?e.replace(n,((e,t)=>e.replace(t,t.replace(o,"~")))):e)).join("\n"))},{os:"lHksA"}],"4YMVW":[function(e,t,r){"use strict";const i=r.second=1e3,n=r.minute=60*i,s=r.hour=60*n;r.MAX_RECORD_AGE=36*s,r.PROTOCOL_DHT="/kad/1.0.0",r.PROVIDERS_KEY_PREFIX="/providers/",r.PROVIDERS_LRU_CACHE_SIZE=256,r.PROVIDERS_VALIDITY=24*s,r.PROVIDERS_CLEANUP_INTERVAL=s,r.READ_MESSAGE_TIMEOUT=10*i,r.GET_MANY_RECORD_COUNT=16,r.K=20,r.ALPHA=3},{}],"4PJUJ":[function(e,t,r){"use strict";const i=e("err-code"),{pipe:n}=e("it-pipe"),s=e("it-length-prefixed"),o=e("p-timeout"),{consume:a}=e("streaming-iterables"),c=e("it-first"),u=e("libp2p-interfaces/src/topology/multicodec-topology"),l=e("./rpc"),d=e("./constants"),f=e("./message"),h=e("./utils");t.exports=class{constructor(e){this.dht=e,this.readMessageTimeout=d.READ_MESSAGE_TIMEOUT,this._log=h.logger(this.dht.peerId,"net"),this._rpc=l(this.dht),this._onPeerConnected=this._onPeerConnected.bind(this),this._running=!1}start(){if(this._running)return;if(!this.dht.isStarted)throw i(new Error("Can not start network"),"ERR_CANNOT_START_NETWORK");this._running=!0,!1===this.dht._clientMode&&this.dht.registrar.handle(this.dht.protocol,this._rpc);const e=new u({multicodecs:[this.dht.protocol],handlers:{onConnect:this._onPeerConnected,onDisconnect:()=>{}}});this._registrarId=this.dht.registrar.register(e)}stop(){(this.dht.isStarted||this.isStarted)&&(this._running=!1,this._registrarId&&this.dht.registrar.unregister(this._registrarId))}get isStarted(){return this._running}get isConnected(){return this.dht.isStarted&&this.isStarted}async _onPeerConnected(e){await this.dht._add(e),this._log("added to the routing table: %s",e.toB58String())}async sendRequest(e,t){if(!this.isConnected)throw i(new Error("Network is offline"),"ERR_NETWORK_OFFLINE");const r=e.toB58String();this._log("sending to: %s",r);let n=this.dht.registrar.connectionManager.get(e);n||(n=await this.dht.dialer.connectToPeer(e));const{stream:s}=await n.newStream(this.dht.protocol);return this._writeReadMessage(s,t.serialize())}async sendMessage(e,t){if(!this.isConnected)throw i(new Error("Network is offline"),"ERR_NETWORK_OFFLINE");const r=e.toB58String();this._log("sending to: %s",r);let n=this.dht.registrar.connectionManager.get(e);n||(n=await this.dht.dialer.connectToPeer(e));const{stream:s}=await n.newStream(this.dht.protocol);return this._writeMessage(s,t.serialize())}async _writeReadMessage(e,t){return o(async function(e,t){const r=await n([t],s.encode(),e,s.decode(),(async e=>{const t=await c(e);if(t)return t.slice()}));if(0===r.length)throw i(new Error("No message received"),"ERR_NO_MESSAGE_RECEIVED");return f.deserialize(r)}(e,t),this.readMessageTimeout)}_writeMessage(e,t){return n([t],s.encode(),e,a)}}},{"err-code":"chZjB","it-pipe":"giKBQ","it-length-prefixed":"3yxIE","p-timeout":"hP9Ay","streaming-iterables":"jrrai","it-first":"hBrkP","libp2p-interfaces/src/topology/multicodec-topology":"52SML","./rpc":"8GalW","./constants":"4YMVW","./message":"dWtGc","./utils":"eTk1n"}],jrrai:[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"batch",(()=>s)),i.export(r,"buffer",(()=>u)),i.export(r,"collect",(()=>l)),i.export(r,"concat",(()=>d)),i.export(r,"consume",(()=>f)),i.export(r,"filter",(()=>p)),i.export(r,"flatMap",(()=>b)),i.export(r,"flatTransform",(()=>w)),i.export(r,"flatten",(()=>g)),i.export(r,"fromStream",(()=>E)),i.export(r,"getIterator",(()=>o)),i.export(r,"map",(()=>m)),i.export(r,"merge",(()=>S)),i.export(r,"parallelFlatMap",(()=>k)),i.export(r,"parallelMap",(()=>A)),i.export(r,"parallelMerge",(()=>I)),i.export(r,"pipeline",(()=>T)),i.export(r,"reduce",(()=>P)),i.export(r,"take",(()=>O)),i.export(r,"tap",(()=>j)),i.export(r,"time",(()=>M)),i.export(r,"transform",(()=>B)),i.export(r,"writeToStream",(()=>N));var n=e("process");function s(e,t){return void 0===t?t=>s(e,t):t[Symbol.asyncIterator]?async function*(e,t){let r=[];for await(const i of t)r.push(i),r.length===e&&(yield r,r=[]);r.length>0&&(yield r)}(e,t):function*(e,t){let r=[];for(const i of t)r.push(i),r.length===e&&(yield r,r=[]);r.length>0&&(yield r)}(e,t)}function o(e){if("function"==typeof e.next)return e;if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();throw new TypeError('"values" does not to conform to any of the iterator or iterable protocols')}function a(){let e,t;return{promise:new Promise(((r,i)=>{t=r,e=i})),reject:e,resolve:t}}function c(e,t){const r=o(t),i=[],n=[];let s=!1,c=!1;async function u(){if(!c&&!(s||i.length>=e)){s=!0;try{const{done:e,value:t}=await r.next();e?c=!0:i.push({value:t})}catch(e){c=!0,i.push({error:e})}!function(){for(;n.length>0&&i.length>0;){const e=n.shift(),{error:t,value:r}=i.shift();t?e.reject(t):e.resolve({done:!1,value:r})}for(;n.length>0&&c;){const{resolve:e}=n.shift();e({done:!0,value:void 0})}}(),s=!1,u()}}const l={next:async function(){if(i.length>0){const{error:e,value:t}=i.shift();if(e)throw e;return u(),{done:!1,value:t}}if(c)return{done:!0,value:void 0};const e=a();return n.push(e),u(),e.promise},[Symbol.asyncIterator]:()=>l};return l}function u(e,t){return void 0===t?t=>u(e,t):0===e?t:t[Symbol.asyncIterator]?c(e,t):function*(e,t){const r=[];let i;try{for(const i of t)r.push(i),r.length<=e||(yield r.shift())}catch(e){i=e}for(const e of r)yield e;if(i)throw i}(e,t)}function l(e){return e[Symbol.asyncIterator]?async function(e){const t=[];for await(const r of e)t.push(r);return t}(e):Array.from(e)}function d(...e){return e.find((e=>void 0!==e[Symbol.asyncIterator]))?async function*(e){for await(const t of e)yield*t}(e):function*(e){for(const t of e)yield*t}(e)}function f(e){if(e[Symbol.asyncIterator])return async function(e){for await(const t of e);}(e);for(const t of e);}async function*h(e,t){for await(const r of t)await e(r)&&(yield r)}function p(e,t){return void 0===t?t=>h(e,t):h(e,t)}async function*g(e){for await(const t of e)t&&"string"!=typeof t&&(t[Symbol.iterator]||t[Symbol.asyncIterator])?yield*g(t):yield t}async function*y(e,t){for await(const r of t)yield await e(r)}function m(e,t){return void 0===t?t=>y(e,t):y(e,t)}function b(e,t){return void 0===t?t=>b(e,t):p((e=>null!=e),g(m(e,t)))}function v(e,t,r){const i=o(r),n=[],s=[];let c=!1,u=!1,l=0,d=null;function f(){for(;s.length>0&&n.length>0;){const{resolve:e}=s.shift();e({done:!1,value:n.shift()})}for(;s.length>0&&0===l&&c;){const{resolve:e,reject:t}=s.shift();d?(t(d),d=null):e({done:!0,value:void 0})}}async function h(){if(c)f();else if(!(u||l+n.length>=e)){u=!0,l++;try{const{done:e,value:r}=await i.next();e?(c=!0,l--,f()):async function(e){try{const r=await t(e);if(r&&r[Symbol.asyncIterator])for await(const e of r)n.push(e);else n.push(r)}catch(e){c=!0,d=e}l--,f(),h()}(r)}catch(e){c=!0,l--,d=e,f()}u=!1,h()}}const p={next:async function(){if(0===n.length){const e=a();return s.push(e),h(),e.promise}const e=n.shift();return h(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>p};return p}function w(e,t,r){return void 0===t?(t,r)=>r?w(e,t,r):w(e,t):void 0===r?r=>w(e,t,r):p((e=>null!=e),g(v(e,t,r)))}async function _(e){return new Promise((t=>{e.once("readable",(()=>{t()}))}))}function E(e){return"function"==typeof e[Symbol.asyncIterator]?e:async function*(e){for(;;){const t=e.read();if(null===t){if(e._readableState.ended)break;await _(e)}else yield t}}(e)}async function*S(...e){const t=new Set(e.map(o));for(;t.size>0;)for(const e of t){const r=await e.next();r.done?t.delete(e):yield r.value}}function T(e,...t){let r=e();for(const e of t)r=e(r);return r}function A(e,t,r){return void 0===t?(t,r)=>A(e,t,r):void 0===r?r=>A(e,t,r):1===e?m(t,r):async function*(e,t,r){let i=null;const n=o(T((()=>r),u(1),(async function*(e){for await(const t of e){if(i)return;yield t}}),m((e=>({value:t(e)}))),u(e-1)));for(;;){const{value:e,done:t}=await n.next();if(t)break;try{const t=await e.value;i||(yield t)}catch(e){i=e}}if(i)throw i}(e,t,r)}function k(e,t,r){return void 0===t?(t,r)=>r?k(e,t,r):k(e,t):void 0===r?r=>k(e,t,r):p((e=>null!=e),g(A(e,t,r)))}async function*I(...e){const t=e.map(o),r=new Set,i=new Map;let n=null,s=null,a=null;const c=e=>{n=e,s&&s(e)},u=e=>{a&&a(e)},l=e=>{const t=Promise.resolve(e.next()).then((async({done:n,value:s})=>{n||i.set(e,s),r.delete(t)}));r.add(t),t.then(u,c)};for(const e of t)l(e);for(;;){if(0===r.size&&0===i.size)return;await new Promise(((e,t)=>{if(n&&t(n),i.size>0)return e();a=e,s=t}));for(const[e,t]of i)i.delete(e),yield t,l(e)}}async function R(e,t,r){let i=t;for await(const t of r)i=await e(i,t);return i}function P(e,t,r){return void 0===t?(t,r)=>r?R(e,t,r):P(e,t):void 0===r?r=>P(e,t,r):R(e,t,r)}function O(e,t){return void 0===t?t=>O(e,t):t[Symbol.asyncIterator]?async function*(e,t){let r=0;for await(const i of t)if(yield await i,r++,r>=e)break}(e,t):function*(e,t){let r=0;for(const i of t)if(yield i,r++,r>=e)break}(e,t)}async function*C(e,t){for await(const r of t)await e(r),yield r}function j(e,t){return void 0===t?t=>C(e,t):C(e,t)}function D(e,t){let r=e[0]+t[0],i=e[1]+t[1];if(i>=1e9){const e=i%1e9;r+=(i-e)/1e9,i=e}return[r,i]}function M(e={},t){return void 0===t?t=>M(e,t):void 0!==t[Symbol.asyncIterator]?async function*(e,t){const r=t[Symbol.asyncIterator]();let i=[0,0];for(;;){const t=n.hrtime(),{value:s,done:o}=await r.next(),a=n.hrtime(t);if(i=D(i,a),e.progress&&e.progress(a,i),o)return e.total&&e.total(i),s;yield s}}(e,t):function*(e,t){const r=t[Symbol.iterator]();let i=[0,0];for(;;){const t=n.hrtime(),{value:s,done:o}=r.next(),a=n.hrtime(t);if(i=D(i,a),e.progress&&e.progress(a,i),o)return e.total&&e.total(i),s;yield s}}(e,t)}function x(e,t,r){const i=o(r),n=[],s=[];let c=!1,u=!1,l=0,d=null;function f(){for(;s.length>0&&n.length>0;){const{resolve:e}=s.shift();e({done:!1,value:n.shift()})}for(;s.length>0&&0===l&&c;){const{resolve:e,reject:t}=s.shift();d?(t(d),d=null):e({done:!0,value:void 0})}}async function h(){if(c)f();else if(!(u||l+n.length>=e)){u=!0,l++;try{const{done:e,value:r}=await i.next();e?(c=!0,l--,f()):async function(e){try{const r=await t(e);n.push(r)}catch(e){c=!0,d=e}l--,f(),h()}(r)}catch(e){c=!0,l--,d=e,f()}u=!1,h()}}const p={next:async function(){if(0===n.length){const e=a();return s.push(e),h(),e.promise}const e=n.shift();return h(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>p};return p}function B(e,t,r){return void 0===t?(t,r)=>r?B(e,t,r):B(e,t):void 0===r?r=>B(e,t,r):x(e,t,r)}async function L(e,t){let r=null,i=null,n=null;const s=e=>{r=e,i&&i(e)},o=()=>{n&&n()};e.once("error",s);for await(const s of t)if(!1===e.write(s)&&await new Promise(((t,s)=>{if(r)return s(r);e.once("drain",o),n=t,i=s})),r)break;if(e.removeListener("error",s),e.removeListener("drain",o),r)throw r}function N(e,t){return void 0===t?t=>L(e,t):L(e,t)}},{process:"bjUAi","@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],"8GalW":[function(e,t,r){"use strict";const{pipe:i}=e("it-pipe"),n=e("it-length-prefixed"),s=e("../message"),o=e("./handlers"),a=e("../utils");t.exports=e=>{const t=a.logger(e.peerId,"rpc"),r=o(e);async function c(i,n){const s=r(n.type);try{await e._add(i)}catch(e){t.error("Failed to update the kbucket store",e)}if(s)return s(i,n);t.error(`no handler found for message type: ${n.type}`)}return async function({stream:r,connection:o}){const a=o.remotePeer;try{await e._add(a)}catch(e){t.error(e)}const u=a.toB58String();t("from: %s",u),await i(r.source,n.decode(),(e=>async function*(){for await(const t of e){const e=s.deserialize(t.slice()),r=await c(a,e);r&&(yield r.serialize())}}()),n.encode(),r.sink)}}},{"it-pipe":"giKBQ","it-length-prefixed":"3yxIE","../message":"dWtGc","./handlers":"jYQNr","../utils":"eTk1n"}],dWtGc:[function(e,t,r){"use strict";const i=e("peer-id"),{Multiaddr:n}=e("multiaddr"),{Record:s}=e("libp2p-record"),o=e("./dht"),a=o.Message.MessageType,c=o.Message.ConnectionType;class u{constructor(e,t,r){if(t&&!(t instanceof Uint8Array))throw new Error("Key must be a Uint8Array");this.type=e,this.key=t,this._clusterLevelRaw=r,this.closerPeers=[],this.providerPeers=[],this.record=void 0}get clusterLevel(){const e=this._clusterLevelRaw-1;return e<0?0:e}set clusterLevel(e){this._clusterLevelRaw=e}serialize(){const e={key:this.key,type:this.type,clusterLevelRaw:this._clusterLevelRaw,closerPeers:this.closerPeers.map(l),providerPeers:this.providerPeers.map(l),record:void 0};return this.record&&(this.record instanceof Uint8Array?e.record=this.record:e.record=this.record.serialize()),o.Message.encode(e).finish()}static deserialize(e){const t=o.Message.decode(e),r=new u(t.type||0,t.key||Uint8Array.from([]),t.clusterLevelRaw||0);return r.closerPeers=t.closerPeers.map(d),r.providerPeers=t.providerPeers.map(d),t.record&&t.record.length&&(r.record=s.deserialize(t.record)),r}}function l(e){return{id:e.id.id,addrs:(e.multiaddrs||[]).map((e=>e.bytes)),connection:c.CONNECTED}}function d(e){return{id:new i(e.id),multiaddrs:(e.addrs||[]).map((e=>new n(e)))}}u.TYPES=a,u.CONNECTION_TYPES=c,t.exports=u},{"peer-id":"8Bdb3",multiaddr:"8Mu1u","libp2p-record":"h5gPS","./dht":"xqrwr"}],xqrwr:[function(e,t,r){"use strict";var i=e("protobufjs/minimal"),n=i.Reader,s=i.Writer,o=i.util,a=i.roots["libp2p-dht-message"]||(i.roots["libp2p-dht-message"]={});a.Record=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var t;return e.prototype.key=null,e.prototype.value=null,e.prototype.author=null,e.prototype.signature=null,e.prototype.timeReceived=null,Object.defineProperty(e.prototype,"_key",{get:o.oneOfGetter(t=["key"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_value",{get:o.oneOfGetter(t=["value"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_author",{get:o.oneOfGetter(t=["author"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_signature",{get:o.oneOfGetter(t=["signature"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_timeReceived",{get:o.oneOfGetter(t=["timeReceived"]),set:o.oneOfSetter(t)}),e.encode=function(e,t){return t||(t=s.create()),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(10).bytes(e.key),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&t.uint32(18).bytes(e.value),null!=e.author&&Object.hasOwnProperty.call(e,"author")&&t.uint32(26).bytes(e.author),null!=e.signature&&Object.hasOwnProperty.call(e,"signature")&&t.uint32(34).bytes(e.signature),null!=e.timeReceived&&Object.hasOwnProperty.call(e,"timeReceived")&&t.uint32(42).string(e.timeReceived),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.Record;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.key=e.bytes();break;case 2:i.value=e.bytes();break;case 3:i.author=e.bytes();break;case 4:i.signature=e.bytes();break;case 5:i.timeReceived=e.string();break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.Record)return e;var t=new a.Record;return null!=e.key&&("string"==typeof e.key?o.base64.decode(e.key,t.key=o.newBuffer(o.base64.length(e.key)),0):e.key.length&&(t.key=e.key)),null!=e.value&&("string"==typeof e.value?o.base64.decode(e.value,t.value=o.newBuffer(o.base64.length(e.value)),0):e.value.length&&(t.value=e.value)),null!=e.author&&("string"==typeof e.author?o.base64.decode(e.author,t.author=o.newBuffer(o.base64.length(e.author)),0):e.author.length&&(t.author=e.author)),null!=e.signature&&("string"==typeof e.signature?o.base64.decode(e.signature,t.signature=o.newBuffer(o.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),null!=e.timeReceived&&(t.timeReceived=String(e.timeReceived)),t},e.toObject=function(e,t){t||(t={});var r={};return null!=e.key&&e.hasOwnProperty("key")&&(r.key=t.bytes===String?o.base64.encode(e.key,0,e.key.length):t.bytes===Array?Array.prototype.slice.call(e.key):e.key,t.oneofs&&(r._key="key")),null!=e.value&&e.hasOwnProperty("value")&&(r.value=t.bytes===String?o.base64.encode(e.value,0,e.value.length):t.bytes===Array?Array.prototype.slice.call(e.value):e.value,t.oneofs&&(r._value="value")),null!=e.author&&e.hasOwnProperty("author")&&(r.author=t.bytes===String?o.base64.encode(e.author,0,e.author.length):t.bytes===Array?Array.prototype.slice.call(e.author):e.author,t.oneofs&&(r._author="author")),null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?o.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature,t.oneofs&&(r._signature="signature")),null!=e.timeReceived&&e.hasOwnProperty("timeReceived")&&(r.timeReceived=e.timeReceived,t.oneofs&&(r._timeReceived="timeReceived")),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),a.Message=function(){function e(e){if(this.closerPeers=[],this.providerPeers=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var t,r,c;return e.prototype.type=null,e.prototype.clusterLevelRaw=null,e.prototype.key=null,e.prototype.record=null,e.prototype.closerPeers=o.emptyArray,e.prototype.providerPeers=o.emptyArray,Object.defineProperty(e.prototype,"_type",{get:o.oneOfGetter(t=["type"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_clusterLevelRaw",{get:o.oneOfGetter(t=["clusterLevelRaw"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_key",{get:o.oneOfGetter(t=["key"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_record",{get:o.oneOfGetter(t=["record"]),set:o.oneOfSetter(t)}),e.encode=function(e,t){if(t||(t=s.create()),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(8).int32(e.type),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(18).bytes(e.key),null!=e.record&&Object.hasOwnProperty.call(e,"record")&&t.uint32(26).bytes(e.record),null!=e.closerPeers&&e.closerPeers.length)for(var r=0;r<e.closerPeers.length;++r)a.Message.Peer.encode(e.closerPeers[r],t.uint32(66).fork()).ldelim();if(null!=e.providerPeers&&e.providerPeers.length)for(r=0;r<e.providerPeers.length;++r)a.Message.Peer.encode(e.providerPeers[r],t.uint32(74).fork()).ldelim();return null!=e.clusterLevelRaw&&Object.hasOwnProperty.call(e,"clusterLevelRaw")&&t.uint32(80).int32(e.clusterLevelRaw),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.Message;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.type=e.int32();break;case 10:i.clusterLevelRaw=e.int32();break;case 2:i.key=e.bytes();break;case 3:i.record=e.bytes();break;case 8:i.closerPeers&&i.closerPeers.length||(i.closerPeers=[]),i.closerPeers.push(a.Message.Peer.decode(e,e.uint32()));break;case 9:i.providerPeers&&i.providerPeers.length||(i.providerPeers=[]),i.providerPeers.push(a.Message.Peer.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.Message)return e;var t=new a.Message;switch(e.type){case"PUT_VALUE":case 0:t.type=0;break;case"GET_VALUE":case 1:t.type=1;break;case"ADD_PROVIDER":case 2:t.type=2;break;case"GET_PROVIDERS":case 3:t.type=3;break;case"FIND_NODE":case 4:t.type=4;break;case"PING":case 5:t.type=5}if(null!=e.clusterLevelRaw&&(t.clusterLevelRaw=0|e.clusterLevelRaw),null!=e.key&&("string"==typeof e.key?o.base64.decode(e.key,t.key=o.newBuffer(o.base64.length(e.key)),0):e.key.length&&(t.key=e.key)),null!=e.record&&("string"==typeof e.record?o.base64.decode(e.record,t.record=o.newBuffer(o.base64.length(e.record)),0):e.record.length&&(t.record=e.record)),e.closerPeers){if(!Array.isArray(e.closerPeers))throw TypeError(".Message.closerPeers: array expected");t.closerPeers=[];for(var r=0;r<e.closerPeers.length;++r){if("object"!=typeof e.closerPeers[r])throw TypeError(".Message.closerPeers: object expected");t.closerPeers[r]=a.Message.Peer.fromObject(e.closerPeers[r])}}if(e.providerPeers){if(!Array.isArray(e.providerPeers))throw TypeError(".Message.providerPeers: array expected");t.providerPeers=[];for(r=0;r<e.providerPeers.length;++r){if("object"!=typeof e.providerPeers[r])throw TypeError(".Message.providerPeers: object expected");t.providerPeers[r]=a.Message.Peer.fromObject(e.providerPeers[r])}}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.closerPeers=[],r.providerPeers=[]),null!=e.type&&e.hasOwnProperty("type")&&(r.type=t.enums===String?a.Message.MessageType[e.type]:e.type,t.oneofs&&(r._type="type")),null!=e.key&&e.hasOwnProperty("key")&&(r.key=t.bytes===String?o.base64.encode(e.key,0,e.key.length):t.bytes===Array?Array.prototype.slice.call(e.key):e.key,t.oneofs&&(r._key="key")),null!=e.record&&e.hasOwnProperty("record")&&(r.record=t.bytes===String?o.base64.encode(e.record,0,e.record.length):t.bytes===Array?Array.prototype.slice.call(e.record):e.record,t.oneofs&&(r._record="record")),e.closerPeers&&e.closerPeers.length){r.closerPeers=[];for(var i=0;i<e.closerPeers.length;++i)r.closerPeers[i]=a.Message.Peer.toObject(e.closerPeers[i],t)}if(e.providerPeers&&e.providerPeers.length){r.providerPeers=[];for(i=0;i<e.providerPeers.length;++i)r.providerPeers[i]=a.Message.Peer.toObject(e.providerPeers[i],t)}return null!=e.clusterLevelRaw&&e.hasOwnProperty("clusterLevelRaw")&&(r.clusterLevelRaw=e.clusterLevelRaw,t.oneofs&&(r._clusterLevelRaw="clusterLevelRaw")),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e.MessageType=(r={},(c=Object.create(r))[r[0]="PUT_VALUE"]=0,c[r[1]="GET_VALUE"]=1,c[r[2]="ADD_PROVIDER"]=2,c[r[3]="GET_PROVIDERS"]=3,c[r[4]="FIND_NODE"]=4,c[r[5]="PING"]=5,c),e.ConnectionType=function(){var e={},t=Object.create(e);return t[e[0]="NOT_CONNECTED"]=0,t[e[1]="CONNECTED"]=1,t[e[2]="CAN_CONNECT"]=2,t[e[3]="CANNOT_CONNECT"]=3,t}(),e.Peer=function(){function e(e){if(this.addrs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var t;return e.prototype.id=null,e.prototype.addrs=o.emptyArray,e.prototype.connection=null,Object.defineProperty(e.prototype,"_id",{get:o.oneOfGetter(t=["id"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_connection",{get:o.oneOfGetter(t=["connection"]),set:o.oneOfSetter(t)}),e.encode=function(e,t){if(t||(t=s.create()),null!=e.id&&Object.hasOwnProperty.call(e,"id")&&t.uint32(10).bytes(e.id),null!=e.addrs&&e.addrs.length)for(var r=0;r<e.addrs.length;++r)t.uint32(18).bytes(e.addrs[r]);return null!=e.connection&&Object.hasOwnProperty.call(e,"connection")&&t.uint32(24).int32(e.connection),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.Message.Peer;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.id=e.bytes();break;case 2:i.addrs&&i.addrs.length||(i.addrs=[]),i.addrs.push(e.bytes());break;case 3:i.connection=e.int32();break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.Message.Peer)return e;var t=new a.Message.Peer;if(null!=e.id&&("string"==typeof e.id?o.base64.decode(e.id,t.id=o.newBuffer(o.base64.length(e.id)),0):e.id.length&&(t.id=e.id)),e.addrs){if(!Array.isArray(e.addrs))throw TypeError(".Message.Peer.addrs: array expected");t.addrs=[];for(var r=0;r<e.addrs.length;++r)"string"==typeof e.addrs[r]?o.base64.decode(e.addrs[r],t.addrs[r]=o.newBuffer(o.base64.length(e.addrs[r])),0):e.addrs[r].length&&(t.addrs[r]=e.addrs[r])}switch(e.connection){case"NOT_CONNECTED":case 0:t.connection=0;break;case"CONNECTED":case 1:t.connection=1;break;case"CAN_CONNECT":case 2:t.connection=2;break;case"CANNOT_CONNECT":case 3:t.connection=3}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.addrs=[]),null!=e.id&&e.hasOwnProperty("id")&&(r.id=t.bytes===String?o.base64.encode(e.id,0,e.id.length):t.bytes===Array?Array.prototype.slice.call(e.id):e.id,t.oneofs&&(r._id="id")),e.addrs&&e.addrs.length){r.addrs=[];for(var i=0;i<e.addrs.length;++i)r.addrs[i]=t.bytes===String?o.base64.encode(e.addrs[i],0,e.addrs[i].length):t.bytes===Array?Array.prototype.slice.call(e.addrs[i]):e.addrs[i]}return null!=e.connection&&e.hasOwnProperty("connection")&&(r.connection=t.enums===String?a.Message.ConnectionType[e.connection]:e.connection,t.oneofs&&(r._connection="connection")),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),e}(),t.exports=a},{"protobufjs/minimal":"grAXL"}],jYQNr:[function(e,t,r){"use strict";const i=e("../../message").TYPES;t.exports=t=>{const r={[i.GET_VALUE]:e("./get-value")(t),[i.PUT_VALUE]:e("./put-value")(t),[i.FIND_NODE]:e("./find-node")(t),[i.ADD_PROVIDER]:e("./add-provider")(t),[i.GET_PROVIDERS]:e("./get-providers")(t),[i.PING]:e("./ping")(t)};return function(e){return r[e]}}},{"../../message":"dWtGc","./get-value":"fhqbS","./put-value":"7V6R3","./find-node":"i6Wjq","./add-provider":"7ShND","./get-providers":"1f7P5","./ping":"2BfBU"}],fhqbS:[function(e,t,r){"use strict";const{Record:i}=e("libp2p-record"),n=e("err-code"),s=e("../../message"),o=e("../../utils");t.exports=e=>{const t=o.logger(e.peerId,"rpc:get-value");return async function(r,a){const c=a.key;if(t("key: %b",c),!c||0===c.length)throw n(new Error("Invalid key"),"ERR_INVALID_KEY");const u=new s(s.TYPES.GET_VALUE,c,a.clusterLevel);if(o.isPublicKeyKey(c)){t("is public key");const r=o.fromPublicKeyKey(c);let n;if(e._isSelf(r))n=e.peerId;else{const t=e.peerStore.get(r);n=t&&t.id}if(n&&n.pubKey)return t("returning found public key"),u.record=new i(c,n.pubKey.bytes),u}const[l,d]=await Promise.all([e._checkLocalDatastore(c),e._betterPeersToQuery(a,r)]);return l&&(t("got record"),u.record=l),d.length>0&&(t("got closer %s",d.length),u.closerPeers=d),u}}},{"libp2p-record":"h5gPS","err-code":"chZjB","../../message":"dWtGc","../../utils":"eTk1n"}],"7V6R3":[function(e,t,r){"use strict";const i=e("../../utils"),n=e("err-code");t.exports=e=>{const t=i.logger(e.peerId,"rpc:put-value");return async function(r,s){const o=s.key;t("key: %b",o);const a=s.record;if(!a){const e=`Empty record from: ${r.toB58String()}`;throw t.error(e),n(new Error(e),"ERR_EMPTY_RECORD")}await e._verifyRecordLocally(a),a.timeReceived=new Date;const c=i.bufferToKey(a.key);return await e.datastore.put(c,a.serialize()),e.onPut(a,r),s}}},{"../../utils":"eTk1n","err-code":"chZjB"}],i6Wjq:[function(e,t,r){"use strict";const{equals:i}=e("uint8arrays/equals"),n=e("../../message"),s=e("../../utils");t.exports=e=>{const t=s.logger(e.peerId,"rpc:find-node");return async function(r,s){let o;t("start"),o=i(s.key,e.peerId.id)?[{id:e.peerId,multiaddrs:e.libp2p.multiaddrs}]:await e._betterPeersToQuery(s,r);const a=new n(s.type,new Uint8Array(0),s.clusterLevel);return o.length>0?a.closerPeers=o:t("handle FindNode %s: could not find anything",r.toB58String()),a}}},{"uint8arrays/equals":"eY3cX","../../message":"dWtGc","../../utils":"eTk1n"}],"7ShND":[function(e,t,r){"use strict";const{CID:i}=e("multiformats/cid"),n=e("err-code"),s=e("../../utils");t.exports=e=>{const t=s.logger(e.peerId,"rpc:add-provider");return async function(r,s){if(t("start"),!s.key||0===s.key.length)throw n(new Error("Missing key"),"ERR_MISSING_KEY");let o;try{o=i.decode(s.key)}catch(e){const t=`Invalid CID: ${e.message}`;throw n(new Error(t),"ERR_INVALID_CID")}return s.providerPeers.forEach((i=>{if(i.id.isEqual(r)){if(!(i.multiaddrs.length<1))return t("received provider %s for %s (addrs %s)",r.toB58String(),o.toString(),i.multiaddrs.map((e=>e.toString()))),e._isSelf(i.id)?void 0:(e.peerStore.addressBook.add(i.id,i.multiaddrs),e.providers.addProvider(o,i.id));t("no valid addresses for provider %s. Ignore",r.toB58String())}else t("invalid provider peer %s from %s",i.id.toB58String(),r.toB58String())})),e.providers.addProvider(o,r)}}},{"multiformats/cid":"9ooAY","err-code":"chZjB","../../utils":"eTk1n"}],"1f7P5":[function(e,t,r){"use strict";const{CID:i}=e("multiformats/cid"),n=e("err-code"),s=e("../../message"),o=e("../../utils");t.exports=e=>{const t=o.logger(e.peerId,"rpc:get-providers");return async function(r,a){let c;try{c=i.decode(a.key)}catch(e){throw n(new Error(`Invalid CID: ${e.message}`),"ERR_INVALID_CID")}t("%s",c.toString());const u=o.bufferToKey(c.bytes),[l,d,f]=await Promise.all([e.datastore.has(u),e.providers.getProviders(c),e._betterPeersToQuery(a,r)]),h=d.map((e=>({id:e,multiaddrs:[]}))),p=f.map((e=>({id:e.id,multiaddrs:[]})));l&&h.push({id:e.peerId,multiaddrs:[]});const g=new s(a.type,a.key,a.clusterLevel);return h.length>0&&(g.providerPeers=h),p.length>0&&(g.closerPeers=p),t("got %s providers %s closerPeers",h.length,p.length),g}}},{"multiformats/cid":"9ooAY","err-code":"chZjB","../../message":"dWtGc","../../utils":"eTk1n"}],"2BfBU":[function(e,t,r){"use strict";const i=e("../../utils");t.exports=e=>{const t=i.logger(e.peerId,"rpc:ping");return function(e,r){return t("from %s",e.toB58String()),r}}},{"../../utils":"eTk1n"}],"7ohZp":[function(e,t,r){"use strict";const i=e("err-code"),n=e("p-timeout"),{equals:s}=e("uint8arrays/equals"),{toString:o}=e("uint8arrays/to-string"),a=e("libp2p-record"),c=e("../constants"),u=e("../query"),l=e("../utils"),d=a.Record;t.exports=e=>{const t=async(t,r)=>e.datastore.put(l.bufferToKey(t),r);return{_putLocal:async(e,r)=>t(e,r),async put(r,n,s={}){e._log("PutValue %b",r);const o=await l.createPutRecord(r,n);await t(r,o);let a=0,c=0;await l.mapParallel(e.getClosestPeers(r,{shallow:!0}),(async t=>{try{a+=1,await e._putValueToPeer(r,o,t),c+=1}catch(r){e._log.error("Failed to put to peer (%b): %s",t.id,r)}}));const u=s.minPeers||a;if(u>c){const t=i(new Error(`Failed to put value to enough peers: ${c}/${u}`),"ERR_NOT_ENOUGH_PUT_PEERS");throw e._log.error(t),t}},async get(t,r={}){r.timeout=r.timeout||c.minute,e._log("_get %b",t);const n=await e.getMany(t,c.GET_MANY_RECORD_COUNT,r),o=n.map((e=>e.val));let u=0;try{u=a.selection.bestRecord(e.selectors,t,o)}catch(e){if("ERR_NO_SELECTOR_FUNCTION_FOR_RECORD_KEY"!==e.code)throw e}const d=o[u];if(e._log("GetValue %b %s",t,d),!d)throw i(new Error("best value was not found"),"ERR_NOT_FOUND");return await(async(t,r,i)=>{const n=await l.createPutRecord(t,i);return Promise.all(r.map((async r=>{if(!s(r.val,i))if(e._isSelf(r.from))try{await e._putLocal(t,n)}catch(t){e._log.error("Failed error correcting self",t)}else try{await e._putValueToPeer(t,n,r.from)}catch(t){e._log.error("Failed error correcting entry",t)}})))})(t,n,d),d},async getMany(t,r,s={}){s.timeout=s.timeout||c.minute,e._log("getMany %b (%s)",t,r);const a=[];let f;try{f=await(async t=>{e._log(`getLocal ${o(t,"base32")}`);const r=await e.datastore.get(l.bufferToKey(t));e._log(`found ${o(t,"base32")} in local datastore`);const i=d.deserialize(r);return await e._verifyRecordLocally(i),i})(t)}catch(e){if(0===r)throw e}if(f&&a.push({val:f.value,from:e.peerId}),a.length>=r)return a;const h=await l.convertBuffer(t),p=e.routingTable.closestPeers(h,e.kBucketSize);if(e._log("peers in rt: %d",p.length),0===p.length){const t="Failed to lookup key! No peers from routing table!";if(e._log.error(t),0===a.length)throw i(new Error(t),"ERR_NO_PEERS_IN_ROUTING_TABLE");return a}const g=a.length;const y=new u(e,t,(function(i,n){const s=l.pathSize(r-g,n);let o=0;return async function(r){let i,n,c;try{const s=await e._getValueOrPeers(r,t);i=s.record,n=s.peers}catch(e){if("ERR_INVALID_RECORD"!==e.code)throw e;c=e}const u={closerPeers:n};return i&&i.value?(a.push({val:i.value,from:r}),o++):c&&(a.push({err:c,from:r}),o++),o>=s&&(u.pathComplete=!0),u}}));try{await n(y.run(p),s.timeout)}catch(e){if(0===a.length)throw e}finally{y.stop()}return a}}}},{"err-code":"chZjB","p-timeout":"hP9Ay","uint8arrays/equals":"eY3cX","uint8arrays/to-string":"hC8JB","libp2p-record":"h5gPS","../constants":"4YMVW","../query":"jOM9h","../utils":"eTk1n"}],jOM9h:[function(e,t,r){"use strict";const{base58btc:i}=e("multiformats/bases/base58"),n=e("../utils"),s=e("./run");t.exports=class{constructor(e,t,r){this.dht=e,this.key=t,this.makePath=r,this._log=n.logger(this.dht.peerId,"query:"+i.baseEncode(t)),this.running=!1,this._onStart=this._onStart.bind(this),this._onComplete=this._onComplete.bind(this)}async run(e){return this.dht._queryManager.running?0===e.length?(this._log.error("Running query with no peers"),{finalSet:new Set,paths:[]}):(this._run=new s(this),this._log(`query running with K=${this.dht.kBucketSize}, A=${this.dht.concurrency}, D=${Math.min(this.dht.disjointPaths,e.length)}`),this._run.once("start",this._onStart),this._run.once("complete",this._onComplete),this._run.execute(e)):(this._log.error("Attempt to run query after shutdown"),{finalSet:new Set,paths:[]})}_onStart(){this.running=!0,this._startTime=Date.now(),this._log("query:start"),this.dht._queryManager.queryStarted(this)}_onComplete(){this.stop()}stop(){this._log(`query:done in ${Date.now()-(this._startTime||0)}ms`),this._run&&this._log(`${this._run.errors.length} of ${this._run.peersSeen.size} peers errored (${this._run.errors.length/this._run.peersSeen.size*100}% fail rate)`),this.running&&(this.running=!1,this._run&&(this._run.removeListener("start",this._onStart),this._run.removeListener("complete",this._onComplete),this._run.stop()),this.dht._queryManager.queryCompleted(this))}}},{"multiformats/bases/base58":"4n7mA","../utils":"eTk1n","./run":"gHPwC"}],gHPwC:[function(e,t,r){"use strict";const i=e("../peer-list/peer-distance-list"),n=e("events"),s=e("./path"),o=e("./worker-queue"),a=e("../utils");t.exports=class extends n{constructor(e){super(),this.query=e,this.running=!1,this.workers=[],this.peersSeen=new Set,this.errors=[],this.peersQueried=null}stop(){if(this.running){this.running=!1;for(const e of this.workers)e.stop()}}async execute(e){const t=[],r=Math.min(this.query.dht.disjointPaths,e.length);for(let e=0;e<r;e++)t.push(new s(this,this.query.makePath(e,r)));e.forEach(((e,i)=>{t[i%r].addInitialPeer(e)})),await this.executePaths(t);const i={finalSet:new Set(this.peersQueried&&this.peersQueried.peers),paths:[]};for(const e of t)e.res&&(e.res.pathComplete||e.res.queryComplete)&&(e.res.success=!0,i.paths.push(e.res));return i}async executePaths(e){this.running=!0,this.emit("start");try{await Promise.all(e.map((e=>e.execute())))}finally{this.stop(),this.emit("complete")}if(this.errors.length===this.peersSeen.size)throw this.errors[0]}async workerQueue(e){await this.init(),await this.startWorker(e)}async startWorker(e){const t=new o(this.query.dht,this,e,this.query._log);this.workers.push(t),await t.execute()}async init(){this.peersQueried||(this.peersQueriedPromise?await this.peersQueriedPromise:(this.peersQueriedPromise=(async()=>{const e=await a.convertBuffer(this.query.key);this.peersQueried=new i(e,this.query.dht.kBucketSize)})(),await this.peersQueriedPromise,delete this.peersQueriedPromise))}async continueQuerying(e){if(this.peersQueried&&this.peersQueried.length<this.peersQueried.capacity)return!0;const t=Array.from(e.queuedPeerIds);return!(!this.peersQueried||!await this.peersQueried.anyCloser(t))}}},{"../peer-list/peer-distance-list":"37S0D",events:"g82pp","./path":"jyTZo","./worker-queue":"aCyV8","../utils":"eTk1n"}],"37S0D":[function(e,t,r){"use strict";const i=e("../utils"),n=e("p-map"),{equals:s}=e("uint8arrays/equals"),{compare:o}=e("uint8arrays/compare"),{xor:a}=e("uint8arrays/xor");t.exports=class{constructor(e,t){this.originDhtKey=e,this.capacity=t,this.peerDistances=[]}get length(){return this.peerDistances.length}get peers(){return this.peerDistances.map((e=>e.peerId))}async add(e){if(this.peerDistances.find((t=>s(t.peerId.id,e.id))))return;const t=await i.convertPeerId(e),r={peerId:e,distance:a(this.originDhtKey,t)};this.peerDistances.push(r),this.peerDistances.sort(((e,t)=>o(e.distance,t.distance))),this.peerDistances=this.peerDistances.slice(0,this.capacity)}async anyCloser(e){if(!e.length)return!1;if(!this.length)return!0;const t=await n(e,(e=>i.convertPeerId(e))),r=this.peerDistances[this.peerDistances.length-1].distance;for(const e of t){const t=a(this.originDhtKey,e);if(o(t,r)<0)return!0}return!1}}},{"../utils":"eTk1n","p-map":"ccWP1","uint8arrays/equals":"eY3cX","uint8arrays/compare":"2xv9i","uint8arrays/xor":"6wTd5"}],jyTZo:[function(e,t,r){"use strict";const i=e("../peer-list/peer-queue"),n=e("../utils");t.exports=class{constructor(e,t){if(this.run=e,this.queryFunc=n.withTimeout(t,3e4),!this.queryFunc)throw new Error("Path requires a `queryFn` to be specified");if("function"!=typeof this.queryFunc)throw new Error("Path expected `queryFn` to be a function. Got "+typeof this.queryFunc);this.initialPeers=[],this.peersToQuery=null,this.res=null}addInitialPeer(e){this.initialPeers.push(e)}async execute(){const e=await i.fromKey(this.run.query.key);this.peersToQuery=e,await Promise.all(this.initialPeers.map((e=>this.addPeerToQuery(e)))),await this.run.workerQueue(this)}async addPeerToQuery(e){this.run.query.dht._isSelf(e)||this.run.peersSeen.has(e.toB58String())||this.peersToQuery&&await this.peersToQuery.enqueue(e)}}},{"../peer-list/peer-queue":"2hgn1","../utils":"eTk1n"}],"2hgn1":[function(e,t,r){"use strict";const i=e("heap"),{xor:n}=e("uint8arrays/xor"),s=e("debug"),o=e("../utils"),a=s("libp2p:dht:peer-queue");class c{static async fromPeerId(e){const t=await o.convertPeerId(e);return new c(t)}static async fromKey(e){const t=await o.convertBuffer(e);return new c(t)}constructor(e){a("create: %b",e),this.from=e,this.heap=new i(o.xorCompare)}async enqueue(e){a("enqueue %s",e.toB58String());const t=await o.convertPeerId(e),r={id:e,distance:n(this.from,t)};this.heap.push(r)}dequeue(){const e=this.heap.pop();return a("dequeue %s",e.id.toB58String()),e.id}get length(){return this.heap.size()}}t.exports=c},{heap:"lhu6N","uint8arrays/xor":"6wTd5",debug:"bO5wM","../utils":"eTk1n"}],lhu6N:[function(e,t,r){t.exports=e("./lib/heap")},{"./lib/heap":"bAELV"}],bAELV:[function(e,t,r){(function(){var e,i,n,s,o,a,c,u,l,d,f,h,p,g,y,m,b;n=Math.floor,d=Math.min,i=function(e,t){return e<t?-1:e>t?1:0},l=function(e,t,r,s,o){var a;if(null==r&&(r=0),null==o&&(o=i),r<0)throw new Error("lo must be non-negative");for(null==s&&(s=e.length);r<s;)o(t,e[a=n((r+s)/2)])<0?s=a:r=a+1;return[].splice.apply(e,[r,r-r].concat(t)),t},a=function(e,t,r){return null==r&&(r=i),e.push(t),g(e,0,e.length-1,r)},o=function(e,t){var r,n;return null==t&&(t=i),r=e.pop(),e.length?(n=e[0],e[0]=r,y(e,0,t)):n=r,n},u=function(e,t,r){var n;return null==r&&(r=i),n=e[0],e[0]=t,y(e,0,r),n},c=function(e,t,r){var n;return null==r&&(r=i),e.length&&r(e[0],t)<0&&(t=(n=[e[0],t])[0],e[0]=n[1],y(e,0,r)),t},s=function(e,t){var r,s,o,a,c,u;for(null==t&&(t=i),c=[],s=0,o=(a=function(){u=[];for(var t=0,r=n(e.length/2);0<=r?t<r:t>r;0<=r?t++:t--)u.push(t);return u}.apply(this).reverse()).length;s<o;s++)r=a[s],c.push(y(e,r,t));return c},p=function(e,t,r){var n;if(null==r&&(r=i),-1!==(n=e.indexOf(t)))return g(e,0,n,r),y(e,n,r)},f=function(e,t,r){var n,o,a,u,l;if(null==r&&(r=i),!(o=e.slice(0,t)).length)return o;for(s(o,r),a=0,u=(l=e.slice(t)).length;a<u;a++)n=l[a],c(o,n,r);return o.sort(r).reverse()},h=function(e,t,r){var n,a,c,u,f,h,p,g,y;if(null==r&&(r=i),10*t<=e.length){if(!(c=e.slice(0,t).sort(r)).length)return c;for(a=c[c.length-1],u=0,h=(p=e.slice(t)).length;u<h;u++)r(n=p[u],a)<0&&(l(c,n,0,null,r),c.pop(),a=c[c.length-1]);return c}for(s(e,r),y=[],f=0,g=d(t,e.length);0<=g?f<g:f>g;0<=g?++f:--f)y.push(o(e,r));return y},g=function(e,t,r,n){var s,o,a;for(null==n&&(n=i),s=e[r];r>t&&n(s,o=e[a=r-1>>1])<0;)e[r]=o,r=a;return e[r]=s},y=function(e,t,r){var n,s,o,a,c;for(null==r&&(r=i),s=e.length,c=t,o=e[t],n=2*t+1;n<s;)(a=n+1)<s&&!(r(e[n],e[a])<0)&&(n=a),e[t]=e[n],n=2*(t=n)+1;return e[t]=o,g(e,c,t,r)},e=function(){function e(e){this.cmp=null!=e?e:i,this.nodes=[]}return e.push=a,e.pop=o,e.replace=u,e.pushpop=c,e.heapify=s,e.updateItem=p,e.nlargest=f,e.nsmallest=h,e.prototype.push=function(e){return a(this.nodes,e,this.cmp)},e.prototype.pop=function(){return o(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return-1!==this.nodes.indexOf(e)},e.prototype.replace=function(e){return u(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return c(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return s(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return 0===this.nodes.length},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return(t=new e).nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),m=this,b=function(){return e},"function"==typeof define&&define.amd?define([],b):"object"==typeof r?t.exports=b():m.Heap=b()}).call(this)},{}],aCyV8:[function(e,t,r){"use strict";const{default:i}=e("p-queue");t.exports=class{constructor(e,t,r,i){this.dht=e,this.run=t,this.path=r,this.log=i,this.concurrency=this.dht.concurrency,this.queue=this.setupQueue(),this.execution=null,this.queuedPeerIds=new Set}setupQueue(){const e=new i({concurrency:this.concurrency});return e.on("idle",(()=>{this.path.peersToQuery&&!this.path.peersToQuery.length&&(this.log("queue:drain"),this.stop())})),e.on("next",(()=>{this.running&&e.pending<this.concurrency&&this.fill()})),e}stop(e){this.running&&(this.running=!1,this.queue.clear(),this.log("worker:stop, %d workers still running",this.run.workers.filter((e=>e.running)).length),this.execution&&(e?this.execution.reject(e):this.execution.resolve()))}async execute(){this.running=!0,this.execution=null;const e=new Promise(((e,t)=>{this.execution={resolve:e,reject:t}}));this.fill(),await e}fill(){if(this.path.peersToQuery)for(;this.queue.pending+this.queue.size<this.concurrency&&this.path.peersToQuery.length>0;){const e=this.path.peersToQuery.dequeue();this.queuedPeerIds.add(e),this.queue.add((()=>this.processNext(e).catch((e=>{this.log.error("queue",e),this.stop(e)})).finally((()=>{this.queuedPeerIds.delete(e)}))))}}async processNext(e){if(!this.running)return;if(this.run.peersSeen.has(e.toB58String()))return;let t,r,i,n;try{t=await this.run.continueQuerying(this)}catch(e){r=e}if(this.running){if(r)throw r;if(t){if(!this.run.peersSeen.has(e.toB58String())){this.run.peersSeen.add(e.toB58String()),this.log("queue:work");try{i=await this.execQuery(e)}catch(e){n=e}if(this.running){if(this.log("queue:work:done",n,i),n)throw n;if(i&&i.queryComplete)return this.log("query:complete"),void this.run.stop();i&&i.pathComplete&&this.stop()}}}else this.stop()}}async execQuery(e){let t,r;try{t=await this.path.queryFunc(e)}catch(e){r=e}if(this.running)if(r)this.run.errors.push(r);else if(this.run.peersQueried&&await this.run.peersQueried.add(e),t){if(t.pathComplete||t.queryComplete)return this.path.res=t,{pathComplete:t.pathComplete,queryComplete:t.queryComplete};if(t.closerPeers&&t.closerPeers.length>0){const e=async e=>{this.dht._isSelf(e.id)||(this.dht._peerDiscovered(e.id,e.multiaddrs),await this.path.addPeerToQuery(e.id))};await Promise.all(t.closerPeers.map(e))}}}}},{"p-queue":"biPlv"}],bDSmy:[function(e,t,r){"use strict";const i=e("err-code"),n=e("p-timeout"),s=e("../constants"),o=e("../peer-list/limited-peer-list"),a=e("../message"),c=e("../query"),u=e("../utils");t.exports=e=>({async provide(t){e._log(`provide: ${t}`);const r=[];await e.providers.addProvider(t,e.peerId);const n=e.libp2p?e.libp2p.multiaddrs:[],s=new a(a.TYPES.ADD_PROVIDER,t.bytes,0);if(s.providerPeers=[{id:e.peerId,multiaddrs:n}],await u.mapParallel(e.getClosestPeers(t.bytes),(async function(i){e._log(`putProvider ${t} to ${i.toB58String()}`);try{await e.network.sendMessage(i,s)}catch(e){r.push(e)}})),r.length)throw i(new Error(`Failed to provide to ${r.length} of ${e.kBucketSize} peers`),"ERR_SOME_PROVIDES_FAILED",{errors:r})},async*findProviders(t,r={timeout:6e4,maxNumProviders:5}){const i=r.timeout||s.minute,l=r.maxNumProviders||s.K;e._log(`findProviders ${t}`);const d=new o(l);if((await e.providers.getProviders(t)).forEach((t=>{const r=e.peerStore.get(t);r?d.push({id:r.id,multiaddrs:r.addresses.map((e=>e.multiaddr))}):d.push({id:t,multiaddrs:[]})})),d.length>=l){for(const e of d.toArray())yield e;return}const f=[];const h=new c(e,t.bytes,(function(r,i){const n=u.pathSize(l-d.length,i),s=new o(n);return f.push(s),async function(r){const i=await(async(t,r)=>{const i=new a(a.TYPES.GET_PROVIDERS,r.bytes,0);return e.network.sendRequest(t,i)})(r,t),o=i.providerPeers;return e._log(`Found ${o.length} provider entries for ${t}`),o.forEach((e=>{s.push({...e})})),s.length>=n?{pathComplete:!0}:{closerPeers:i.closerPeers}}})),p=e.routingTable.closestPeers(t.bytes,e.kBucketSize);try{await n(h.run(p),i)}catch(e){if(e.name!==n.TimeoutError.name)throw e}finally{h.stop()}f.forEach((e=>{e.toArray().forEach((e=>{d.push(e)}))}));for(const e of d.toArray())yield e}})},{"err-code":"chZjB","p-timeout":"hP9Ay","../constants":"4YMVW","../peer-list/limited-peer-list":"lGgEB","../message":"dWtGc","../query":"jOM9h","../utils":"eTk1n"}],lGgEB:[function(e,t,r){"use strict";const i=e(".");t.exports=class extends i{constructor(e){super(),this.limit=e}push(e){return this.length<this.limit&&super.push(e)}}},{".":"fdLg6"}],fdLg6:[function(e,t,r){"use strict";t.exports=class{constructor(){this.list=[]}push(e){return!this.has(e.id)&&(this.list.push(e),!0)}has(e){const t=this.list.find((t=>t.id.equals(e)));return Boolean(t)}toArray(){return this.list.slice()}pop(){return this.list.pop()}get length(){return this.list.length}}},{}],nezkB:[function(e,t,r){"use strict";const i=e("err-code"),n=e("p-timeout"),s=e("peer-id"),o=e("libp2p-crypto"),{toString:a}=e("uint8arrays/to-string"),c=e("../constants"),u=e("../message"),l=e("../query"),d=e("../utils");t.exports=e=>{const t=async t=>{const r=d.keyForPublicKey(t),n=await(async(t,r)=>{const i=new u(u.TYPES.GET_VALUE,r,0);return e.network.sendRequest(t,i)})(t,r);if(!n.record||!n.record.value)throw i(new Error(`Node not responding with its public key: ${t.toB58String()}`),"ERR_INVALID_RECORD");const o=await s.createFromPubKey(n.record.value);if(!o.equals(t))throw i(new Error("public key does not match id"),"ERR_PUBLIC_KEY_DOES_NOT_MATCH_ID");return o.pubKey};return{async _findPeerSingle(t,r){e._log("findPeerSingle %s",t.toB58String());const i=new u(u.TYPES.FIND_NODE,r.id,0);return e.network.sendRequest(t,i)},async findPeer(t,r={timeout:6e4}){r.timeout=r.timeout||c.minute,e._log("findPeer %s",t.toB58String());const s=await(async t=>{e._log(`findPeerLocal ${t.toB58String()}`);const r=await e.routingTable.find(t),i=r&&e.peerStore.get(r);if(i)return{id:i.id,multiaddrs:i.addresses.map((e=>e.multiaddr))}})(t);if(null!=s)return e._log("found local"),s;const o=await d.convertPeerId(t),a=e.routingTable.closestPeers(o,e.kBucketSize);if(0===a.length)throw i(new Error("Peer lookup failed"),"ERR_LOOKUP_FAILED");if(a.find((e=>e.isEqual(t)))){const r=e.peerStore.get(t);if(r)return e._log("found in peerStore"),{id:r.id,multiaddrs:r.addresses.map((e=>e.multiaddr))}}const u=new l(e,t.id,(()=>async e=>{const r=await this._findPeerSingle(e,t),i=r.closerPeers.find((e=>e.id.isEqual(t)));return i?{peer:i,queryComplete:!0}:{closerPeers:r.closerPeers}}));let f;try{f=await n(u.run(a),r.timeout)}finally{u.stop()}let h=!1;if(f.paths.forEach((t=>{t.success&&t.peer&&(h=!0,e.peerStore.addressBook.add(t.peer.id,t.peer.multiaddrs))})),e._log("findPeer %s: %s",t.toB58String(),h),!h)throw i(new Error("No peer found"),"ERR_NOT_FOUND");const p=e.peerStore.get(t);if(!p)throw i(new Error("No peer found in peer store"),"ERR_NOT_FOUND");return{id:p.id,multiaddrs:p.addresses.map((e=>e.multiaddr))}},async*getClosestPeers(t,r={shallow:!1}){e._log("getClosestPeers to %b",t);const i=await d.convertBuffer(t),n=e.routingTable.closestPeers(i,e.kBucketSize),o=new l(e,t,(()=>async i=>{const n=await(async(t,r)=>(e._log(`closerPeersSingle ${a(t,"base32")} from ${r.toB58String()}`),(await e.peerRouting._findPeerSingle(r,new s(t))).closerPeers.filter((t=>!e._isSelf(t.id))).map((t=>(e.peerStore.addressBook.add(t.id,t.multiaddrs),t)))))(t,i);return{closerPeers:n,pathComplete:!!r.shallow||void 0}})),c=await o.run(n);if(!c||!c.finalSet)return[];const u=await d.sortClosestPeers(Array.from(c.finalSet),i);for(const t of u.slice(0,e.kBucketSize))yield t},async getPublicKey(r){e._log("getPublicKey %s",r.toB58String());const i=e.peerStore.get(r);if(i&&i.id.pubKey)return e._log("getPublicKey: found local copy"),i.id.pubKey;let n;try{n=await t(r)}catch(t){const i=d.keyForPublicKey(r),s=await e.get(i);n=o.keys.unmarshalPublicKey(s)}const a=new s(r.id,void 0,n),c=(i&&i.addresses||[]).map((e=>e.multiaddr));return e.peerStore.addressBook.add(a,c),e.peerStore.keyBook.set(a,n),n}}}},{"err-code":"chZjB","p-timeout":"hP9Ay","peer-id":"8Bdb3","libp2p-crypto":"bb1cb","uint8arrays/to-string":"hC8JB","../constants":"4YMVW","../message":"dWtGc","../query":"jOM9h","../utils":"eTk1n"}],lunE9:[function(e,t,r){"use strict";const i=e("hashlru"),n=e("varint"),s=e("peer-id"),{Key:o}=e("interface-datastore/key"),{default:a}=e("p-queue"),c=e("./constants"),u=e("./utils");function l(e){return e="string"==typeof e?e:u.encodeBase32(e.bytes),c.PROVIDERS_KEY_PREFIX+e}function d(e){const t=e.toString().split("/");if(4!==t.length)throw new Error("incorrectly formatted provider entry key in datastore: "+e);return{cid:t[2],peerId:t[3]}}function f(e){return n.decode(e)}t.exports=class{constructor(e,t,r){this.datastore=e,this._log=u.logger(t,"providers"),this.cleanupInterval=c.PROVIDERS_CLEANUP_INTERVAL,this.provideValidity=c.PROVIDERS_VALIDITY,this.lruCacheSize=r||c.PROVIDERS_LRU_CACHE_SIZE,this.providers=i(this.lruCacheSize),this.syncQueue=new a({concurrency:1})}start(){this._started||(this._started=!0,this._cleaner=setInterval((()=>this._cleanup()),this.cleanupInterval))}stop(){this._started=!1,this._cleaner&&(clearInterval(this._cleaner),this._cleaner=null)}_cleanup(){return this.syncQueue.add((async()=>{this._log("start cleanup");const e=Date.now();let t=0,r=0;const i=new Map,n=this.datastore.batch(),s=this.datastore.query({prefix:c.PROVIDERS_KEY_PREFIX});for await(const e of s)try{const{cid:s,peerId:o}=d(e.key),a=f(e.value),c=Date.now(),u=c-a,l=u>this.provideValidity;if(this._log("comparing: %d - %d = %d > %d %s",c,a,u,this.provideValidity,l?"(expired)":""),l){r++,n.delete(e.key);const t=i.get(s)||new Set;t.add(o),i.set(s,t)}t++}catch(e){this._log.error(e.message)}this._log("deleting %d / %d entries",r,t),i.size&&await n.commit();for(const[e,t]of i){const r=l(e),i=this.providers.get(r);if(i){for(const e of t)i.delete(e);0===i.size?this.providers.remove(r):this.providers.set(r,i)}}this._log("Cleanup successful (%dms)",Date.now()-e)}))}async _getProvidersMap(e){const t=l(e);let r=this.providers.get(t);return r||(r=await async function(e,t){const r=new Map,i=e.query({prefix:l(t)});for await(const e of i){const{peerId:t}=d(e.key);r.set(t,f(e.value))}return r}(this.datastore,e),this.providers.set(t,r)),r}async addProvider(e,t){return this.syncQueue.add((async()=>{this._log("addProvider %s",e.toString());const r=await this._getProvidersMap(e);this._log("loaded %s provs",r.size);const i=new Date;r.set(u.encodeBase32(t.id),i);const s=l(e);return this.providers.set(s,r),async function(e,t,r,i){const s=[l(t),"/",u.encodeBase32(r.id)].join(""),a=new o(s),c=Uint8Array.from(n.encode(i.getTime()));return e.put(a,c)}(this.datastore,e,t,i)}))}async getProviders(e){return this.syncQueue.add((async()=>{this._log("getProviders %s",e.toString());return[...(await this._getProvidersMap(e)).keys()].map((e=>new s(u.decodeBase32(e))))}))}}},{hashlru:"kBj5c",varint:"aN1CO","peer-id":"8Bdb3","interface-datastore/key":"9hGOz","p-queue":"biPlv","./constants":"4YMVW","./utils":"eTk1n"}],"9th0A":[function(e,t,r){"use strict";t.exports=class{constructor(){this.queries=new Set,this.running=!1}queryStarted(e){this.queries.add(e)}queryCompleted(e){this.queries.delete(e)}start(){this.running=!0}stop(){this.running=!1;for(const e of this.queries)e.stop();this.queries.clear()}}},{}],"2X3ZY":[function(e,t,r){"use strict";function i(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("ipns"));const s={func:(e,t)=>n.validator.validate(t,e)};r.selector=function(e,t){return n.validator.select(t[0],t[1])},r.validator=s},{ipns:"7rNAT"}],hla2J:[function(e,t,r){"use strict";const i=e("peer-id"),{Multiaddr:n}=e("multiaddr"),s=e("mafmt"),{EventEmitter:o}=e("events"),a=e("debug"),c=Object.assign(a("libp2p:bootstrap"),{error:a("libp2p:bootstrap:error")});(t.exports=class extends o{constructor(e={list:[]}){if(!e.list||!e.list.length)throw new Error("Bootstrap requires a list of peer addresses");super(),this._list=e.list,this._interval=e.interval||1e4,this._timer=null}start(){this._timer||(this._timer=setInterval((()=>this._discoverBootstrapPeers()),this._interval),c("Starting bootstrap node discovery"),this._discoverBootstrapPeers())}_discoverBootstrapPeers(){this._timer&&this._list.forEach((e=>{if(!s.P2P.matches(e))return c.error("Invalid multiaddr");const t=new n(e),r=t.getPeerId();if(!r)return void c.error("Invalid bootstrap multiaddr without peer id");const o=i.createFromB58String(r);try{this.emit("peer",{id:o,multiaddrs:[t]})}catch(e){c.error("Invalid bootstrap peer id",e)}}))}stop(){this._timer&&clearInterval(this._timer),this._timer=null}}).tag="bootstrap"},{"peer-id":"8Bdb3",multiaddr:"8Mu1u",mafmt:"l1lok",events:"g82pp",debug:"bO5wM"}],"757Qe":[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p"),{error:i("libp2p:err")}),{EventEmitter:s}=e("events"),o=e("err-code"),a=e("peer-id"),{Multiaddr:c}=e("multiaddr"),u=e("./peer-routing"),l=e("./content-routing"),d=e("./get-peer"),{validate:f}=e("./config"),{codes:h,messages:p}=e("./errors"),g=e("./address-manager"),y=e("./connection-manager"),m=e("./circuit/transport"),b=e("./circuit"),v=e("./dialer"),w=e("./keychain"),_=e("./metrics"),E=e("./transport-manager"),S=e("./upgrader"),T=e("./peer-store"),A=e("./pubsub-adapter"),k=e("./peer-store/persistent"),I=e("./registrar"),R=e("./ping"),P=e("./identify"),O=e("./nat-manager"),{updateSelfPeerRecord:C}=e("./record/utils");class j extends s{static async create(e){if(e.peerId)return new j(e);const t=await a.create();return e.peerId=t,new j(e)}constructor(e){if(super(),this._options=f(e),this.peerId=this._options.peerId,this.datastore=this._options.datastore,this.peerStore=this.datastore&&this._options.peerStore.persistence?new k({peerId:this.peerId,datastore:this.datastore,...this._options.peerStore}):new T({peerId:this.peerId}),this.addresses=this._options.addresses,this.addressManager=new g(this.peerId,this._options.addresses),this.addressManager.on("change:addresses",(()=>{C(this).catch((e=>{n.error("Error updating self peer record",e)}))})),this._modules=this._options.modules,this._config=this._options.config,this._transport=[],this._discovery=new Map,this.connectionManager=new y(this,{autoDial:this._config.peerDiscovery.autoDial,...this._options.connectionManager}),this._options.metrics.enabled&&(this.metrics=new _({...this._options.metrics,connectionManager:this.connectionManager})),this._options.keychain&&this._options.keychain.datastore){n("creating keychain");const e=w.generateOptions();this.keychain=new w(this._options.keychain.datastore,{...e,...this._options.keychain}),n("keychain constructed")}if(this.upgrader=new S({localPeer:this.peerId,metrics:this.metrics,onConnection:e=>this.connectionManager.onConnect(e),onConnectionEnd:e=>this.connectionManager.onDisconnect(e)}),this.transportManager=new E({libp2p:this,upgrader:this.upgrader,faultTolerance:this._options.transportManager.faultTolerance}),this.natManager=new O({peerId:this.peerId,addressManager:this.addressManager,transportManager:this.transportManager,...this._options.config.nat}),this.registrar=new I({peerStore:this.peerStore,connectionManager:this.connectionManager}),this.handle=this.handle.bind(this),this.registrar.handle=this.handle,!this._modules.connEncryption||!this._modules.connEncryption.length)throw o(new Error(p.CONN_ENCRYPTION_REQUIRED),h.CONN_ENCRYPTION_REQUIRED);if(this._modules.connEncryption.forEach((e=>{this.upgrader.cryptos.set(e.protocol,e)})),this.dialer=new v({transportManager:this.transportManager,peerStore:this.peerStore,...this._options.dialer}),this._modules.transport.forEach((e=>{const t=e.prototype[Symbol.toStringTag],r=this._config.transport[t];this.transportManager.add(t,e,r)})),this._config.relay.enabled&&(this.transportManager.add(m.prototype[Symbol.toStringTag],m),this.relay=new b(this)),this._modules.streamMuxer){this._modules.streamMuxer.forEach((e=>{this.upgrader.muxers.set(e.multicodec,e)})),this.identifyService=new P({libp2p:this}),this.handle(Object.values(P.getProtocolStr(this)),this.identifyService.handleMessage)}if(this._modules.connProtector)this.upgrader.protector=this._modules.connProtector;else if(void 0!==globalThis.process&&globalThis.process.env&&globalThis.process.env.LIBP2P_FORCE_PNET)throw new Error("Private network is enforced, but no protector was provided");if(this._modules.dht){const e=this._modules.dht;this._dht=new e({libp2p:this,dialer:this.dialer,peerId:this.peerId,peerStore:this.peerStore,registrar:this.registrar,datastore:this.datastore,...this._config.dht})}if(this._modules.pubsub){const e=this._modules.pubsub;this.pubsub=A(e,this,this._config.pubsub)}this.peerRouting=new u(this),this.contentRouting=new l(this),R.mount(this),this._onDiscoveryPeer=this._onDiscoveryPeer.bind(this)}emit(e,...t){return"error"!==e||this._events.error?super.emit(e,...t):(n.error(t),!1)}async start(){n("libp2p is starting");try{await this._onStarting(),await this._onDidStart(),n("libp2p has started")}catch(e){throw this.emit("error",e),n.error("An error occurred starting libp2p",e),await this.stop(),e}}async stop(){n("libp2p is stopping");try{this._isStarted=!1,this.relay&&this.relay.stop(),this.peerRouting.stop();for(const e of this._discovery.values())e.removeListener("peer",this._onDiscoveryPeer);await Promise.all(Array.from(this._discovery.values(),(e=>e.stop()))),this._discovery=new Map,await this.peerStore.stop(),await this.connectionManager.stop(),await Promise.all([this.pubsub&&this.pubsub.stop(),this._dht&&this._dht.stop(),this.metrics&&this.metrics.stop()]),await this.natManager.stop(),await this.transportManager.close(),R.unmount(this),this.dialer.destroy()}catch(e){e&&(n.error(e),this.emit("error",e))}n("libp2p has stopped")}async loadKeychain(){if(this.keychain)try{await this.keychain.findKeyByName("self")}catch(e){await this.keychain.importPeer("self",this.peerId)}}isStarted(){return this._isStarted}get connections(){return this.connectionManager.connections}dial(e,t){return this._dial(e,t)}async dialProtocol(e,t,r){if(!t||!t.length)throw o(new Error("no protocols were provided to open a stream"),h.ERR_INVALID_PROTOCOLS_FOR_STREAM);return(await this._dial(e,r)).newStream(t)}async _dial(e,t){const{id:r,multiaddrs:i}=d(e);if(r.equals(this.peerId))throw o(new Error("Cannot dial self"),h.ERR_DIALED_SELF);let n=this.connectionManager.get(r);return n?i&&this.peerStore.addressBook.add(r,i):n=await this.dialer.connectToPeer(e,t),n}get multiaddrs(){let e=this.addressManager.getAnnounceAddrs().map((e=>e.toString()));e.length||(e=this.transportManager.getAddrs().map((e=>e.toString()))),e=e.concat(this.addressManager.getObservedAddrs().map((e=>e.toString())));const t=this._options.addresses.announceFilter,r=new Set(e);return t(Array.from(r).map((e=>new c(e))))}async hangUp(e){const{id:t}=d(e),r=this.connectionManager.connections.get(t.toB58String());r&&await Promise.all(r.map((e=>e.close())))}ping(e){const{id:t,multiaddrs:r}=d(e);return R(this,r?r[0]:t)}handle(e,t){(e=Array.isArray(e)?e:[e]).forEach((e=>{this.upgrader.protocols.set(e,t)})),this.peerStore.protoBook.add(this.peerId,e)}unhandle(e){(e=Array.isArray(e)?e:[e]).forEach((e=>{this.upgrader.protocols.delete(e)})),this.peerStore.protoBook.remove(this.peerId,e)}async _onStarting(){const e=this.addressManager.getListenAddrs();await this.transportManager.listen(e),this.natManager.start(),await this.peerStore.start(),this._config.pubsub.enabled&&this.pubsub&&this.pubsub.start(),this._config.dht.enabled&&(this._dht&&this._dht.start(),this._dht.on("peer",this._onDiscoveryPeer)),this.metrics&&this.metrics.start()}async _onDidStart(){this._isStarted=!0,this.peerStore.on("peer",(e=>{this.emit("peer:discovery",e),this._maybeConnect(e)}));for(const e of this.peerStore.peers.values())this.emit("peer:discovery",e.id);this.connectionManager.start(),await this._setupPeerDiscovery(),this.relay&&this.relay.start(),this.peerRouting.start()}_onDiscoveryPeer(e){e.id.toB58String()!==this.peerId.toB58String()?(e.multiaddrs&&this.peerStore.addressBook.add(e.id,e.multiaddrs),e.protocols&&this.peerStore.protoBook.set(e.id,e.protocols)):n.error(new Error(h.ERR_DISCOVERED_SELF))}async _maybeConnect(e){if(!0===this._config.peerDiscovery.autoDial&&!this.connectionManager.get(e)){if((this._options.connectionManager.minConnections||0)>this.connectionManager.size){n("connecting to discovered peer %s",e.toB58String());try{await this.dialer.connectToPeer(e)}catch(t){n.error(`could not connect to discovered peer ${e.toB58String()} with ${t}`)}}}}async _setupPeerDiscovery(){const e=e=>{let t={enabled:!0};if(e.tag&&this._config.peerDiscovery&&this._config.peerDiscovery[e.tag]&&(t={...t,...this._config.peerDiscovery[e.tag]}),t.enabled&&!this._discovery.has(e.tag)){let r;r="function"==typeof e?new e(Object.assign({},t,{peerId:this.peerId,libp2p:this})):e,r.on("peer",this._onDiscoveryPeer),this._discovery.set(e.tag,r)}};for(const t of this._modules.peerDiscovery||[])e(t);for(const t of this.transportManager.getTransports())t.discovery&&e(t.discovery);await Promise.all(Array.from(this._discovery.values(),(e=>e.start())))}}t.exports=j},{debug:"bO5wM",events:"g82pp","err-code":"chZjB","peer-id":"8Bdb3",multiaddr:"8Mu1u","./peer-routing":"6b8mM","./content-routing":"hrRcA","./get-peer":"39nOe","./config":"aC5Bt","./errors":"3rNo5","./address-manager":"8bdzg","./connection-manager":"bZLZf","./circuit/transport":"2UjYE","./circuit":"hBCQx","./dialer":"kwWEi","./keychain":"f4Pg5","./metrics":"jy74B","./transport-manager":"7AeM0","./upgrader":"fdRaE","./peer-store":"hDFM8","./pubsub-adapter":"4AHRd","./peer-store/persistent":"kcKey","./registrar":"bUUbk","./ping":"azCOK","./identify":"jPbT6","./nat-manager":"1LCyC","./record/utils":"7dy3Z"}],"6b8mM":[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:peer-routing"),{error:i("libp2p:peer-routing:err")}),s=e("err-code"),{storeAddresses:o,uniquePeers:a,requirePeers:c}=e("./content-routing/utils"),u=e("it-merge"),{pipe:l}=e("it-pipe"),d=e("it-first"),f=e("it-drain"),h=e("it-filter"),{setDelayedInterval:p,clearDelayedInterval:g}=e("set-delayed-interval");t.exports=class{constructor(e){this._peerId=e.peerId,this._peerStore=e.peerStore,this._routers=e._modules.peerRouting||[],e._dht&&e._config.dht.enabled&&this._routers.push(e._dht),this._refreshManagerOptions=e._options.peerRouting.refreshManager,this._findClosestPeersTask=this._findClosestPeersTask.bind(this)}start(){this._routers.length&&!this._timeoutId&&this._refreshManagerOptions.enabled&&(this._timeoutId=p(this._findClosestPeersTask,this._refreshManagerOptions.interval,this._refreshManagerOptions.bootDelay))}async _findClosestPeersTask(){try{await f(this.getClosestPeers(this._peerId.id))}catch(e){n.error(e)}}stop(){g(this._timeoutId)}async findPeer(e,t){if(!this._routers.length)throw s(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE");if(e.toB58String()===this._peerId.toB58String())throw s(new Error("Should not try to find self"),"ERR_FIND_SELF");const r=await l(u(...this._routers.map((r=>[r.findPeer(e,t)]))),(e=>h(e,Boolean)),(e=>o(e,this._peerStore)),(e=>d(e)));if(r)return r;throw s(new Error("not found"),"NOT_FOUND")}async*getClosestPeers(e,t={timeout:3e4}){if(!this._routers.length)throw s(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE");yield*l(u(...this._routers.map((r=>r.getClosestPeers(e,t)))),(e=>o(e,this._peerStore)),(e=>a(e)),(e=>c(e)))}}},{debug:"bO5wM","err-code":"chZjB","./content-routing/utils":"5SdWt","it-merge":"cPFu3","it-pipe":"giKBQ","it-first":"hBrkP","it-drain":"dKYhO","it-filter":"5LCTL","set-delayed-interval":"4OF34"}],"5SdWt":[function(e,t,r){"use strict";const i=e("err-code"),n=e("it-filter"),s=e("it-map"),o=e("it-take");t.exports={storeAddresses:function(e,t){return s(e,(e=>(t.addressBook.add(e.id,e.multiaddrs),e)))},uniquePeers:function(e){const t=new Set;return n(e,(e=>!t.has(e.id.toString())&&(t.add(e.id.toString()),!0)))},requirePeers:async function*(e,t=1){let r=0;for await(const t of e)r++,yield t;if(r<t)throw i(new Error("not found"),"NOT_FOUND")},maybeLimitSource:function(e,t){return t?o(e,t):e}}},{"err-code":"chZjB","it-filter":"5LCTL","it-map":"eeqPk","it-take":"gxr1t"}],"4OF34":[function(e,t,r){"use strict";const i=new Map;t.exports={setDelayedInterval:function(e,t,r){r=r||t;const n=`${Date.now()}:${Math.floor(1e6*Math.random())}`,s=setTimeout((()=>{!async function(e,t,r){for(;i.get(r);){try{await e()}catch(e){setTimeout((()=>{throw e}),1);break}if(!i.get(r))break;await new Promise((e=>{const n=setTimeout(e,t);i.set(r,n)}))}}(e,t,n)}),r);return i.set(n,s),n},clearDelayedInterval:function(e){const t=i.get(e);t&&(clearTimeout(t),i.delete(e))}}},{}],hrRcA:[function(e,t,r){"use strict";const i=e("err-code"),{messages:n,codes:s}=e("../errors"),{storeAddresses:o,uniquePeers:a,requirePeers:c,maybeLimitSource:u}=e("./utils"),l=e("it-merge"),{pipe:d}=e("it-pipe");t.exports=class{constructor(e){this.libp2p=e,this.routers=e._modules.contentRouting||[],this.dht=e._dht,this.dht&&e._config.dht.enabled&&this.routers.push(this.dht)}async*findProviders(e,t={}){if(!this.routers.length)throw i(new Error("No content this.routers available"),"NO_ROUTERS_AVAILABLE");yield*d(l(...this.routers.map((r=>r.findProviders(e,t)))),(e=>o(e,this.libp2p.peerStore)),(e=>a(e)),(e=>u(e,t.maxNumProviders)),(e=>c(e)))}async provide(e){if(!this.routers.length)throw i(new Error("No content routers available"),"NO_ROUTERS_AVAILABLE");await Promise.all(this.routers.map((t=>t.provide(e))))}put(e,t,r){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw i(new Error(n.NOT_STARTED_YET),s.DHT_NOT_STARTED);return this.dht.put(e,t,r)}get(e,t){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw i(new Error(n.NOT_STARTED_YET),s.DHT_NOT_STARTED);return this.dht.get(e,t)}async getMany(e,t,r){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw i(new Error(n.NOT_STARTED_YET),s.DHT_NOT_STARTED);return this.dht.getMany(e,t,r)}}},{"err-code":"chZjB","../errors":"3rNo5","./utils":"5SdWt","it-merge":"cPFu3","it-pipe":"giKBQ"}],"39nOe":[function(e,t,r){"use strict";const i=e("peer-id"),{Multiaddr:n}=e("multiaddr"),s=e("err-code"),{codes:o}=e("./errors");t.exports=function(e){let t;if("string"==typeof e&&(e=new n(e)),n.isMultiaddr(e)){t=e;const r=e.getPeerId();if(!r)throw s(new Error(`${e} does not have a valid peer type`),o.ERR_INVALID_MULTIADDR);try{e=i.createFromB58String(r)}catch(t){throw s(new Error(`${e} is not a valid peer type`),o.ERR_INVALID_MULTIADDR)}}return{id:e,multiaddrs:t?[t]:void 0}}},{"peer-id":"8Bdb3",multiaddr:"8Mu1u","err-code":"chZjB","./errors":"3rNo5"}],aC5Bt:[function(e,t,r){"use strict";const i=e("merge-options"),{dnsaddrResolver:n}=e("multiaddr/src/resolvers"),s=e("./constants"),{AGENT_VERSION:o}=e("./identify/consts"),a=e("./circuit/constants"),{publicAddressesFirst:c}=e("libp2p-utils/src/address-sort"),{FaultTolerance:u}=e("./transport-manager"),l={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:e=>e},connectionManager:{minConnections:25},transportManager:{faultTolerance:u.FATAL_ALL},dialer:{maxParallelDials:s.MAX_PARALLEL_DIALS,maxDialsPerPeer:s.MAX_PER_PEER_DIALS,dialTimeout:s.DIAL_TIMEOUT,resolvers:{dnsaddr:n},addressSorter:c},host:{agentVersion:o},metrics:{enabled:!1},peerStore:{persistence:!1,threshold:5},peerRouting:{refreshManager:{enabled:!0,interval:6e5,bootDelay:1e4}},config:{protocolPrefix:"ipfs",dht:{enabled:!1,kBucketSize:20,randomWalk:{enabled:!1,queriesPerPeriod:1,interval:3e5,timeout:1e4}},nat:{enabled:!0,ttl:7200,keepAlive:!0,gateway:null,externalIp:null,pmp:{enabled:!1}},peerDiscovery:{autoDial:!0},pubsub:{enabled:!0},relay:{enabled:!0,advertise:{bootDelay:a.ADVERTISE_BOOT_DELAY,enabled:!1,ttl:a.ADVERTISE_TTL},hop:{enabled:!1,active:!1},autoRelay:{enabled:!1,maxListeners:2}},transport:{}}};t.exports.validate=e=>{const t=i(l,e);if(t.modules.transport.length<1)throw new Error("'options.modules.transport' must contain at least 1 transport");return t}},{"merge-options":"fupyv","multiaddr/src/resolvers":"gzxe3","./constants":"92Vak","./identify/consts":"62PhM","./circuit/constants":"eXVcE","libp2p-utils/src/address-sort":"5uTJL","./transport-manager":"7AeM0"}],gzxe3:[function(e,t,r){"use strict";const i=e("../protocols-table"),{code:n}=i("dnsaddr");t.exports={dnsaddrResolver:async function(t){const r=new(e("./dns")),i=t.getPeerId(),[,s]=t.stringTuples().find((([e])=>e===n))||[];let o=(await r.resolveTxt(`_dnsaddr.${s}`)).flat().map((e=>e.split("=")[1]));return i&&(o=o.filter((e=>e.includes(i)))),o}}},{"../protocols-table":"5Z4cQ","./dns":"6yz41"}],"6yz41":[function(e,t,r){"use strict";const i=e("dns-over-http-resolver");t.exports=i},{"dns-over-http-resolver":"9Glvu"}],"9Glvu":[function(e,t,r){"use strict";const i=e("debug"),n=i("dns-over-http-resolver");n.error=i("dns-over-http-resolver:error");const s=e("receptacle"),o=e("./utils");class a{constructor({maxCache:e=100}={}){this._cache=new s({max:e}),this._servers=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve"]}getServers(){return this._servers}_getShuffledServers(){const e=[].concat(this._servers);for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*t),i=e[t];e[t]=e[r],e[r]=i}return e}setServers(e){this._servers=e}resolve(e,t="A"){switch(t){case"A":return this.resolve4(e);case"AAAA":return this.resolve6(e);case"TXT":return this.resolveTxt(e);default:throw new Error(`${t} is not supported`)}}async resolve4(e){const t="A",r=this._cache.get(o.getCacheKey(e,t));if(r)return r;for(const r of this._getShuffledServers())try{const i=await o.fetch(o.buildResource({serverResolver:r,hostname:e,recordType:t})),n=await i.json(),s=n.Answer.map((e=>e.data)),a=Math.min(n.Answer.map((e=>e.TTL)));return this._cache.set(o.getCacheKey(e,t),s,{ttl:a}),s}catch(t){n.error(`${r} could not resolve ${e} record A`)}throw new Error(`Could not resolve ${e} record A`)}async resolve6(e){const t="AAAA",r=this._cache.get(o.getCacheKey(e,t));if(r)return r;for(const r of this._getShuffledServers())try{const i=await o.fetch(o.buildResource({serverResolver:r,hostname:e,recordType:t})),n=await i.json(),s=n.Answer.map((e=>e.data)),a=Math.min(n.Answer.map((e=>e.TTL)));return this._cache.set(o.getCacheKey(e,t),s,{ttl:a}),s}catch(t){n.error(`${r} could not resolve ${e} record AAAA`)}throw new Error(`Could not resolve ${e} record AAAA`)}async resolveTxt(e){const t="TXT",r=this._cache.get(o.getCacheKey(e,t));if(r)return r;for(const r of this._getShuffledServers())try{const i=await o.fetch(o.buildResource({serverResolver:r,hostname:e,recordType:t})),n=await i.json(),s=n.Answer.map((e=>[e.data.replace(/['"]+/g,"")])),a=Math.min(n.Answer.map((e=>e.TTL)));return this._cache.set(o.getCacheKey(e,t),s,{ttl:a}),s}catch(t){n.error(`${r} could not resolve ${e} record TXT`)}throw new Error(`Could not resolve ${e} record TXT`)}}a.Resolver=a,t.exports=a},{debug:"bO5wM",receptacle:"6A2bX","./utils":"jAL77"}],"6A2bX":[function(e,t,r){"use strict";t.exports=o;var i=e("ms"),n=o.prototype,s=new Date%1e9;function o(e){e=e||{},this.id=e.id||(1e9*Math.random()>>>0)+s++,this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,r,i=this.items.length;i--;)t=this.items[i],r=new Date(t.expires)-new Date,this._lookup[t.key]=t,r>0?this.expire(t.key,r):r<=0&&this.delete(t.key)}n.has=function(e){return e in this._lookup},n.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value},n.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null},n.set=function(e,t,r){var i=this._lookup[e],n=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,i?(clearTimeout(i.timeout),this.items.splice(this.items.indexOf(i),1,n)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(n),this.size++),r&&("ttl"in r&&this.expire(e,r.ttl),"meta"in r&&(n.meta=r.meta),r.refresh&&(n.refresh=r.ttl)),this},n.delete=function(e){var t=this._lookup[e];return!!t&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this)},n.expire=function(e,t){var r=t||0,n=this._lookup[e];if(!n)return this;if("string"==typeof r&&(r=i(t)),"number"!=typeof r)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(n.timeout),n.timeout=setTimeout(this.delete.bind(this,n.key),r),n.expires=Number(new Date)+r,this},n.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this},n.toJSON=function(){for(var e,t=new Array(this.items.length),r=t.length;r--;)e=this.items[r],t[r]={key:e.key,meta:e.meta,value:e.value,expires:e.expires,refresh:e.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:t}}},{ms:"kjKOC"}],kjKOC:[function(e,t,r){var i=1e3,n=60*i,s=60*n,o=24*s,a=7*o,c=365.25*o;function u(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}t.exports=function(e,t){t=t||{};var r,l,d=typeof e;if("string"===d&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*c;case"weeks":case"week":case"w":return r*a;case"days":case"day":case"d":return r*o;case"hours":case"hour":case"hrs":case"hr":case"h":return r*s;case"minutes":case"minute":case"mins":case"min":case"m":return r*n;case"seconds":case"second":case"secs":case"sec":case"s":return r*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===d&&isFinite(e))return t.long?(r=e,(l=Math.abs(r))>=o?u(r,l,o,"day"):l>=s?u(r,l,s,"hour"):l>=n?u(r,l,n,"minute"):l>=i?u(r,l,i,"second"):r+" ms"):function(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=s?Math.round(e/s)+"h":t>=n?Math.round(e/n)+"m":t>=i?Math.round(e/i)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],jAL77:[function(e,t,r){"use strict";const{default:i,Headers:n}=e("native-fetch");t.exports={buildResource:function({serverResolver:e,hostname:t,recordType:r}){return`${e}?name=${t}&type=${r}`},fetch:function(e){return i(e,{headers:new n({accept:"application/dns-json"})})},getCacheKey:function(e,t){return`${t}_${e}`}}},{"native-fetch":"kdks4"}],"92Vak":[function(e,t,r){"use strict";t.exports={DIAL_TIMEOUT:3e4,MAX_PARALLEL_DIALS:100,MAX_PER_PEER_DIALS:4,MAX_ADDRS_TO_DIAL:25,METRICS:{computeThrottleMaxQueueSize:1e3,computeThrottleTimeout:2e3,movingAverageIntervals:[6e4,3e5,9e5],maxOldPeersRetention:50}}},{}],"62PhM":[function(e,t,r){"use strict";const i=e("../../package.json").version;t.exports.PROTOCOL_VERSION="ipfs/0.1.0",t.exports.AGENT_VERSION=`js-libp2p/${i}`,t.exports.MULTICODEC_IDENTIFY="/ipfs/id/1.0.0",t.exports.MULTICODEC_IDENTIFY_PUSH="/ipfs/id/push/1.0.0",t.exports.IDENTIFY_PROTOCOL_VERSION="0.1.0",t.exports.MULTICODEC_IDENTIFY_PROTOCOL_NAME="id",t.exports.MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME="id/push",t.exports.MULTICODEC_IDENTIFY_PROTOCOL_VERSION="1.0.0",t.exports.MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION="1.0.0"},{"../../package.json":"cq0b4"}],cq0b4:[function(e,t,r){t.exports=JSON.parse('{"name":"libp2p","version":"0.33.0","description":"JavaScript implementation of libp2p, a modular peer to peer network stack","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","types":"dist/src/index.d.ts","typesVersions":{"*":{"src/*":["dist/src/*","dist/src/*/index"]}},"files":["dist","src"],"scripts":{"lint":"aegir lint","build":"aegir build","build:proto":"npm run build:proto:circuit && npm run build:proto:identify && npm run build:proto:plaintext && npm run build:proto:address-book && npm run build:proto:proto-book && npm run build:proto:peer-record && npm run build:proto:envelope","build:proto:circuit":"pbjs -t static-module -w commonjs -r libp2p-circuit --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/circuit/protocol/index.js ./src/circuit/protocol/index.proto","build:proto:identify":"pbjs -t static-module -w commonjs -r libp2p-identify --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/identify/message.js ./src/identify/message.proto","build:proto:plaintext":"pbjs -t static-module -w commonjs -r libp2p-plaintext --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/insecure/proto.js ./src/insecure/proto.proto","build:proto:address-book":"pbjs -t static-module -w commonjs -r libp2p-address-book --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/address-book.js ./src/peer-store/persistent/pb/address-book.proto","build:proto:proto-book":"pbjs -t static-module -w commonjs -r libp2p-proto-book --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/proto-book.js ./src/peer-store/persistent/pb/proto-book.proto","build:proto:peer-record":"pbjs -t static-module -w commonjs -r libp2p-peer-record --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/peer-record/peer-record.js ./src/record/peer-record/peer-record.proto","build:proto:envelope":"pbjs -t static-module -w commonjs -r libp2p-envelope --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/envelope/envelope.js ./src/record/envelope/envelope.proto","build:proto-types":"npm run build:proto-types:circuit && npm run build:proto-types:identify && npm run build:proto-types:plaintext && npm run build:proto-types:address-book && npm run build:proto-types:proto-book && npm run build:proto-types:peer-record && npm run build:proto-types:envelope","build:proto-types:circuit":"pbts -o src/circuit/protocol/index.d.ts src/circuit/protocol/index.js","build:proto-types:identify":"pbts -o src/identify/message.d.ts src/identify/message.js","build:proto-types:plaintext":"pbts -o src/insecure/proto.d.ts src/insecure/proto.js","build:proto-types:address-book":"pbts -o src/peer-store/persistent/pb/address-book.d.ts src/peer-store/persistent/pb/address-book.js","build:proto-types:proto-book":"pbts -o src/peer-store/persistent/pb/proto-book.d.ts src/peer-store/persistent/pb/proto-book.js","build:proto-types:peer-record":"pbts -o src/record/peer-record/peer-record.d.ts src/record/peer-record/peer-record.js","build:proto-types:envelope":"pbts -o src/record/envelope/envelope.d.ts src/record/envelope/envelope.js","test":"aegir test","test:ts":"aegir build --no-bundle && npm run test --prefix test/ts-use","test:node":"aegir test -t node -f \\"./test/**/*.{node,spec}.js\\"","test:browser":"aegir test -t browser","test:examples":"cd examples && npm run test:all","prepare":"aegir build --no-bundle","release":"aegir release -t node -t browser","release-minor":"aegir release --type minor -t node -t browser","release-major":"aegir release --type major -t node -t browser","coverage":"nyc --reporter=text --reporter=lcov npm run test:node"},"repository":{"type":"git","url":"https://github.com/libp2p/js-libp2p.git"},"keywords":["libp2p","network","p2p","peer","peer-to-peer","IPFS"],"bugs":{"url":"https://github.com/libp2p/js-libp2p/issues"},"homepage":"https://libp2p.io","license":"MIT","engines":{"node":">=14.0.0"},"browser":{"@motrix/nat-api":false},"eslintConfig":{"extends":"ipfs","ignorePatterns":["!.aegir.js","test/ts-use"]},"dependencies":{"abortable-iterator":"^3.0.0","@motrix/nat-api":"^0.3.1","@vascosantos/moving-average":"^1.1.0","abort-controller":"^3.0.0","aggregate-error":"^3.1.0","any-signal":"^2.1.1","bignumber.js":"^9.0.1","class-is":"^1.1.0","debug":"^4.3.1","err-code":"^3.0.0","es6-promisify":"^7.0.0","events":"^3.3.0","hashlru":"^2.3.0","interface-datastore":"^6.0.2","it-all":"^1.0.4","it-buffer":"^0.1.2","it-drain":"^1.0.3","it-filter":"^1.0.1","it-first":"^1.0.4","it-handshake":"^2.0.0","it-length-prefixed":"^5.0.2","it-map":"^1.0.4","it-merge":"^1.0.0","it-pipe":"^1.1.0","it-take":"^1.0.0","libp2p-crypto":"^0.19.4","libp2p-interfaces":"^1.0.0","libp2p-utils":"^0.4.0","mafmt":"^10.0.0","merge-options":"^3.0.4","multiaddr":"^10.0.0","multiformats":"^9.0.0","multistream-select":"^2.0.0","mutable-proxy":"^1.0.0","node-forge":"^0.10.0","p-any":"^3.0.0","p-fifo":"^1.0.0","p-retry":"^4.4.0","p-settle":"^4.1.1","peer-id":"^0.15.0","private-ip":"^2.1.0","protobufjs":"^6.10.2","retimer":"^3.0.0","sanitize-filename":"^1.6.3","set-delayed-interval":"^1.0.0","streaming-iterables":"^6.0.0","timeout-abort-controller":"^1.1.1","uint8arrays":"^3.0.0","varint":"^6.0.0","wherearewe":"^1.0.0","xsalsa20":"^1.1.0"},"devDependencies":{"@chainsafe/libp2p-noise":"^4.0.0","@nodeutils/defaults-deep":"^1.1.0","@types/es6-promisify":"^6.0.0","@types/node":"^16.0.1","@types/node-forge":"^0.10.1","@types/varint":"^6.0.0","aegir":"^33.1.1","buffer":"^6.0.3","datastore-core":"^6.0.7","delay":"^5.0.0","interop-libp2p":"^0.4.0","into-stream":"^7.0.0","ipfs-http-client":"^52.0.2","it-concat":"^2.0.0","it-pair":"^1.0.0","it-pushable":"^1.4.0","libp2p":".","libp2p-bootstrap":"^0.13.0","libp2p-delegated-content-routing":"^0.11.0","libp2p-delegated-peer-routing":"^0.10.0","libp2p-floodsub":"^0.27.0","libp2p-gossipsub":"^0.11.0","libp2p-interfaces-compliance-tests":"^1.0.0","libp2p-kad-dht":"^0.24.2","libp2p-mdns":"^0.17.0","libp2p-mplex":"^0.10.1","libp2p-tcp":"^0.17.0","libp2p-webrtc-star":"^0.23.0","libp2p-websockets":"^0.16.0","nock":"^13.0.3","p-defer":"^3.0.0","p-times":"^3.0.0","p-wait-for":"^3.2.0","rimraf":"^3.0.2","sinon":"^11.1.1","util":"^0.12.3"},"contributors":["Vasco Santos <vasco.santos@moxy.studio>","David Dias <daviddias.p@gmail.com>","Jacob Heun <jacobheun@gmail.com>","Alex Potsides <alex@achingbrain.net>","Alan Shaw <alan@tableflip.io>","Cayman <caymannava@gmail.com>","Pedro Teixeira <i@pgte.me>","Friedel Ziegelmayer <dignifiedquire@gmail.com>","Maciej Krüger <mkg20001@gmail.com>","Hugo Dias <mail@hugodias.me>","Chris Dostert <chrisdostert@users.noreply.github.com>","dirkmc <dirkmdev@gmail.com>","Volker Mische <volker.mische@gmail.com>","zeim839 <50573884+zeim839@users.noreply.github.com>","Richard Littauer <richard.littauer@gmail.com>","a1300 <matthias-knopp@gmx.net>","Ryan Bell <ryan@piing.net>","ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>","Franck Royer <franck@royer.one>","Thomas Eizinger <thomas@eizinger.io>","Giovanni T. Parra <fiatjaf@gmail.com>","acolytec3 <17355484+acolytec3@users.noreply.github.com>","Elven <mon.samuel@qq.com>","Andrew Nesbitt <andrewnez@gmail.com>","Samlior <samlior@foxmail.com>","Didrik Nordström <didrik.nordstrom@gmail.com>","RasmusErik Voel Jensen <github@solsort.com>","Robert Kiel <robert.kiel@hoprnet.org>","Smite Chow <xiaopengyou@live.com>","Soeren <nikorpoulsen@gmail.com>","Sönke Hahn <soenkehahn@gmail.com>","TJKoury <TJKoury@gmail.com>","Tiago Alves <alvesjtiago@gmail.com>","XiaoZhang <zxinmyth@gmail.com>","Yusef Napora <yusef@napora.org>","Zane Starr <zcstarr@gmail.com>","ebinks <elizabethjbinks@gmail.com>","Aditya Bose <13054902+adbose@users.noreply.github.com>","isan_rivkin <isanrivkin@gmail.com>","mayerwin <mayerwin@users.noreply.github.com>","mcclure <andi.m.mcclure@gmail.com>","phillmac <phillmac@users.noreply.github.com>","robertkiel <robert.kiel@validitylabs.org>","shresthagrawal <34920931+shresthagrawal@users.noreply.github.com>","swedneck <40505480+swedneck@users.noreply.github.com>","greenSnot <greenSnot@users.noreply.github.com>","Aleksei <vozhdb@gmail.com>","Bernd Strehl <bernd.strehl@gmail.com>","Chris Bratlien <chrisbratlien@gmail.com>","Cindy Wu <ciindy.wu@gmail.com>","Daijiro Wachi <daijiro.wachi@gmail.com>","Diogo Silva <fsdiogo@gmail.com>","Dmitriy Ryajov <dryajov@gmail.com>","Ethan Lam <elmemphis2000@gmail.com>","Fei Liu <liu.feiwood@gmail.com>","Felipe Martins <felipebrasil93@gmail.com>","Florian-Merle <florian.david.merle@gmail.com>","Francis Gulotta <wizard@roborooter.com>","Guy Sviry <32539816+guysv@users.noreply.github.com>","Henrique Dias <hacdias@gmail.com>","Irakli Gozalishvili <rfobic@gmail.com>","Joel Gustafson <joelg@mit.edu>","John Rees <johnrees@users.noreply.github.com>","João Santos <joaosantos15@users.noreply.github.com>","Julien Bouquillon <contact@revolunet.com>","Kevin Kwok <antimatter15@gmail.com>","Kevin Lacker <lacker@gmail.com>","Lars Gierth <lgierth@users.noreply.github.com>","Leask Wong <i@leaskh.com>","Marcin Tojek <mtojek@users.noreply.github.com>","Michael Burns <5170+mburns@users.noreply.github.com>","Miguel Mota <miguelmota2@gmail.com>","Nuno Nogueira <nunofmn@gmail.com>","Philipp Muens <raute1337@gmx.de>"]}')},{}],eXVcE:[function(e,t,r){"use strict";t.exports={ADVERTISE_BOOT_DELAY:9e5,ADVERTISE_TTL:18e5,CIRCUIT_PROTO_CODE:290,HOP_METADATA_KEY:"hop_relay",HOP_METADATA_VALUE:"true",RELAY_RENDEZVOUS_NS:"/libp2p/relay"}},{}],"5uTJL":[function(e,t,r){"use strict";const i=e("./multiaddr/is-private");function n(e,t){const r=i(e.multiaddr),n=i(t.multiaddr);return r&&!n?1:!r&&n||e.isCertified&&!t.isCertified?-1:!e.isCertified&&t.isCertified?1:0}t.exports.publicAddressesFirst=function(e){return[...e].sort(n)}},{"./multiaddr/is-private":"gME6b"}],gME6b:[function(e,t,r){"use strict";const i=e("private-ip");t.exports=function(e){const{address:t}=e.nodeAddress();return i(t)}},{"private-ip":"kXRph"}],kXRph:[function(e,t,r){"use strict";t.exports=e("./lib").default},{"./lib":"hAqtf"}],hAqtf:[function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});const n=e("netmask"),s=i(e("ip-regex")),o=i(e("is-ip")),a=e("ipaddr.js"),c=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"].map((e=>new n.Netmask(e)));function u(e){return/^::$/.test(e)||/^::1$/.test(e)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(e)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(e)||/^ff([0-9a-fA-F]{2,2}):/i.test(e)}r.default=e=>{if(a.isValid(e)){const t=a.parse(e);if("ipv4"===t.kind())return function(e){for(let t of c)if(t.contains(e))return!0;return!1}(t.toNormalizedString());if("ipv6"===t.kind())return u(e)}else if(o.default(e)&&s.default.v6().test(e))return u(e)}},{netmask:"2iaUq","ip-regex":"foGrp","is-ip":"arQx3","ipaddr.js":"8jiec"}],"2iaUq":[function(e,t,r){(function(){var e,t,i,n,s,o,a,c;c=function(e){return[(-16777216&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e].join(".")},a=function(e){var r,i,n,s,o,a;for(r=[],n=s=0;s<=3&&0!==e.length;n=++s){if(n>0){if("."!==e[0])throw new Error("Invalid IP");e=e.substring(1)}o=(a=t(e))[0],i=a[1],e=e.substring(i),r.push(o)}if(0!==e.length)throw new Error("Invalid IP");switch(r.length){case 1:if(r[0]>4294967295)throw new Error("Invalid IP");return r[0]>>>0;case 2:if(r[0]>255||r[1]>16777215)throw new Error("Invalid IP");return(r[0]<<24|r[1])>>>0;case 3:if(r[0]>255||r[1]>255||r[2]>65535)throw new Error("Invalid IP");return(r[0]<<24|r[1]<<16|r[2])>>>0;case 4:if(r[0]>255||r[1]>255||r[2]>255||r[3]>255)throw new Error("Invalid IP");return(r[0]<<24|r[1]<<16|r[2]<<8|r[3])>>>0;default:throw new Error("Invalid IP")}},n=(i=function(e){return e.charCodeAt(0)})("0"),o=i("a"),s=i("A"),t=function(e){var t,r,a,c,u;for(c=0,t=10,r="9",a=0,e.length>1&&"0"===e[a]&&("x"===e[a+1]||"X"===e[a+1]?(a+=2,t=16):"0"<=e[a+1]&&e[a+1]<="9"&&(a++,t=8,r="7")),u=a;a<e.length;){if("0"<=e[a]&&e[a]<=r)c=c*t+(i(e[a])-n)>>>0;else{if(16!==t)break;if("a"<=e[a]&&e[a]<="f")c=c*t+(10+i(e[a])-o)>>>0;else{if(!("A"<=e[a]&&e[a]<="F"))break;c=c*t+(10+i(e[a])-s)>>>0}}if(c>4294967295)throw new Error("too large");a++}if(a===u)throw new Error("empty octet");return[c,a]},e=function(){function e(e,t){var r,i,n;if("string"!=typeof e)throw new Error("Missing `net' parameter");if(t||(n=e.split("/",2),e=n[0],t=n[1]),t||(t=32),"string"==typeof t&&t.indexOf(".")>-1){try{this.maskLong=a(t)}catch(e){throw e,new Error("Invalid mask: "+t)}for(r=i=32;i>=0;r=--i)if(this.maskLong===4294967295<<32-r>>>0){this.bitmask=r;break}}else{if(!t&&0!==t)throw new Error("Invalid mask: empty");this.bitmask=parseInt(t,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0)}try{this.netLong=(a(e)&this.maskLong)>>>0}catch(t){throw t,new Error("Invalid net address: "+e)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+t);this.size=Math.pow(2,32-this.bitmask),this.base=c(this.netLong),this.mask=c(this.maskLong),this.hostmask=c(~this.maskLong),this.first=this.bitmask<=30?c(this.netLong+1):this.base,this.last=this.bitmask<=30?c(this.netLong+this.size-2):c(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?c(this.netLong+this.size-1):void 0}return e.prototype.contains=function(t){return"string"==typeof t&&(t.indexOf("/")>0||4!==t.split(".").length)&&(t=new e(t)),t instanceof e?this.contains(t.base)&&this.contains(t.broadcast||t.last):(a(t)&this.maskLong)>>>0==(this.netLong&this.maskLong)>>>0},e.prototype.next=function(t){return null==t&&(t=1),new e(c(this.netLong+this.size*t),this.mask)},e.prototype.forEach=function(e){var t,r,i;for(i=a(this.first),r=a(this.last),t=0;i<=r;)e(c(i),i,t),t++,i++},e.prototype.toString=function(){return this.base+"/"+this.bitmask},e}(),r.ip2long=a,r.long2ip=c,r.Netmask=e}).call(this)},{}],"8jiec":[function(e,t,r){!function(e){const r="(0?\\d+|0x[a-f0-9]+)",i={fourOctet:new RegExp(`^${r}\\.${r}\\.${r}\\.${r}$`,"i"),threeOctet:new RegExp(`^${r}\\.${r}\\.${r}$`,"i"),twoOctet:new RegExp(`^${r}\\.${r}$`,"i"),longValue:new RegExp(`^${r}$`,"i")},n=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${a})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${r}\\.${r}\\.${r}\\.${r}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${a})|(?:::)(?:${a})?)${r}\\.${r}\\.${r}\\.${r}(${o})?$`,"i")};function u(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let r,i,n=0,s=-1,o=(e.match(c.zoneIndex)||[])[0];for(o&&(o=o.substring(1),e=e.replace(/%.+$/,""));(s=e.indexOf(":",s+1))>=0;)n++;if("::"===e.substr(0,2)&&n--,"::"===e.substr(-2,2)&&n--,n>t)return null;for(i=t-n,r=":";i--;)r+="0:";return":"===(e=e.replace("::",r))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),r=[];for(let e=0;e<t.length;e++)r.push(parseInt(t[e],16));return r}(),zoneId:o}}function l(e,t,r,i){if(e.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let n,s=0;for(;i>0;){if(n=r-i,n<0&&(n=0),e[s]>>n!=t[s]>>n)return!1;i-=r,s+=1}return!0}function d(e){if(s.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(n.test(e))return parseInt(e,8);throw new Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}const h={};h.IPv4=function(){function e(e){if(4!==e.length)throw new Error("ipaddr: ipv4 octet count should be 4");let t,r;for(t=0;t<e.length;t++)if(r=e[t],!(0<=r&&r<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]]},e.prototype.kind=function(){return"ipv4"},e.prototype.match=function(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv4"!==e.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const r={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let i,n,s;for(i=3;i>=0;i-=1){if(n=this.octets[i],!(n in r))return null;if(s=r[n],t&&0!==s)return null;8!==s&&(t=!0),e+=s}return 32-e},e.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return h.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),h.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),n=[];let s=0;for(;s<4;)n.push(parseInt(r[s],10)|255^parseInt(i[s],10)),s++;return new this(n)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.isIPv4=function(e){return null!==this.parser(e)},h.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(e){return!1}},h.IPv4.isValidFourPartDecimal=function(e){return!(!h.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},h.IPv4.networkAddressFromCIDR=function(e){let t,r,i,n,s;try{for(t=this.parseCIDR(e),i=t[0].toByteArray(),s=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),n=[],r=0;r<4;)n.push(parseInt(i[r],10)&parseInt(s[r],10)),r++;return new this(n)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},h.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const r=[this.parse(t[1]),e];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},h.IPv4.parser=function(e){let t,r,n;if(t=e.match(i.fourOctet))return function(){const e=t.slice(1,6),i=[];for(let t=0;t<e.length;t++)r=e[t],i.push(d(r));return i}();if(t=e.match(i.longValue)){if(n=d(t[1]),n>4294967295||n<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(n>>t&255);return e}().reverse()}return(t=e.match(i.twoOctet))?function(){const e=t.slice(1,4),r=[];if(n=d(e[1]),n>16777215||n<0)throw new Error("ipaddr: address outside defined range");return r.push(d(e[0])),r.push(n>>16&255),r.push(n>>8&255),r.push(255&n),r}():(t=e.match(i.threeOctet))?function(){const e=t.slice(1,5),r=[];if(n=d(e[2]),n>65535||n<0)throw new Error("ipaddr: address outside defined range");return r.push(d(e[0])),r.push(d(e[1])),r.push(n>>8&255),r.push(255&n),r}():null},h.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let r=0;const i=Math.floor(e/8);for(;r<i;)t[r]=255,r++;return i<4&&(t[i]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},h.IPv6=function(){function e(e,t){let r,i;if(16===e.length)for(this.parts=[],r=0;r<=14;r+=2)this.parts.push(e[r]<<8|e[r+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}for(r=0;r<this.parts.length;r++)if(i=this.parts[r],!(0<=i&&i<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],reserved:[[new e([8193,3512,0,0,0,0,0,0]),32]]},e.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv6"!==e.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const r={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let i,n;for(let s=7;s>=0;s-=1){if(i=this.parts[s],!(i in r))return null;if(n=r[i],t&&0!==n)return null;16!==n&&(t=!0),e+=n}return 128-e},e.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],r=this.parts;for(let i=0;i<r.length;i++)e=r[i],t.push(e>>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const e=this.parts.slice(-2),t=e[0],r=e[1];return new h.IPv4([t>>8,255&t,r>>8,255&r])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){const e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString();let r,i=0,n=-1;for(;r=e.exec(t);)r[0].length>n&&(i=r.index,n=r[0].length);return n<0?t:`${t.substring(0,i)}::${t.substring(i+n)}`},e.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},e}(),h.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),n=[];let s=0;for(;s<16;)n.push(parseInt(r[s],10)|255^parseInt(i[s],10)),s++;return new this(n)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},h.IPv6.isIPv6=function(e){return null!==this.parser(e)},h.IPv6.isValid=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(e){return!1}},h.IPv6.networkAddressFromCIDR=function(e){let t,r,i,n,s;try{for(t=this.parseCIDR(e),i=t[0].toByteArray(),s=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),n=[],r=0;r<16;)n.push(parseInt(i[r],10)&parseInt(s[r],10)),r++;return new this(n)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},h.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},h.IPv6.parseCIDR=function(e){let t,r,i;if((r=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(r[2]),t>=0&&t<=128))return i=[this.parse(r[1]),t],Object.defineProperty(i,"toString",{value:function(){return this.join("/")}}),i;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},h.IPv6.parser=function(e){let t,r,i,n,s,o;if(i=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${i[1]}`);if(c.native.test(e))return u(e,8);if((i=e.match(c.transitional))&&(o=i[6]||"",t=u(i[1].slice(0,-1)+o,6),t.parts)){for(s=[parseInt(i[2]),parseInt(i[3]),parseInt(i[4]),parseInt(i[5])],r=0;r<s.length;r++)if(n=s[r],!(0<=n&&n<=255))return null;return t.parts.push(s[0]<<8|s[1]),t.parts.push(s[2]<<8|s[3]),{parts:t.parts,zoneId:t.zoneId}}return null},h.IPv6.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const i=Math.floor(e/8);for(;r<i;)t[r]=255,r++;return i<16&&(t[i]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},h.fromByteArray=function(e){const t=e.length;if(4===t)return new h.IPv4(e);if(16===t)return new h.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},h.isValid=function(e){return h.IPv6.isValid(e)||h.IPv4.isValid(e)},h.parse=function(e){if(h.IPv6.isValid(e))return h.IPv6.parse(e);if(h.IPv4.isValid(e))return h.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},h.parseCIDR=function(e){try{return h.IPv6.parseCIDR(e)}catch(t){try{return h.IPv4.parseCIDR(e)}catch(e){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},h.process=function(e){const t=this.parse(e);return"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t},h.subnetMatch=function(e,t,r){let i,n,s,o;for(n in null==r&&(r="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,n))for(s=t[n],!s[0]||s[0]instanceof Array||(s=[s]),i=0;i<s.length;i++)if(o=s[i],e.kind()===o[0].kind()&&e.match.apply(e,o))return n;return r},void 0!==t&&t.exports?t.exports=h:e.ipaddr=h}(this)},{}],"7AeM0":[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:transports"),{error:i("libp2p:transports:err")}),s=e("p-settle"),{codes:o}=e("./errors"),a=e("err-code"),{updateSelfPeerRecord:c}=e("./record/utils");class u{constructor({libp2p:e,upgrader:t,faultTolerance:r=l.FATAL_ALL}){this.libp2p=e,this.upgrader=t,this._transports=new Map,this._listeners=new Map,this._listenerOptions=new Map,this.faultTolerance=r}add(e,t,r={}){if(n("adding %s",e),!e)throw a(new Error(`Transport must have a valid key, was given '${e}'`),o.ERR_INVALID_KEY);if(this._transports.has(e))throw a(new Error("There is already a transport with this key"),o.ERR_DUPLICATE_TRANSPORT);const i=new t({...r,libp2p:this.libp2p,upgrader:this.upgrader});this._transports.set(e,i),this._listenerOptions.set(e,r.listenerOptions||{}),this._listeners.has(e)||this._listeners.set(e,[])}async close(){const e=[];for(const[t,r]of this._listeners)for(n("closing listeners for %s",t);r.length;){const t=r.pop();t.removeAllListeners("listening"),t.removeAllListeners("close"),e.push(t.close())}await Promise.all(e),n("all listeners closed");for(const e of this._listeners.keys())this._listeners.set(e,[])}async dial(e,t){const r=this.transportForMultiaddr(e);if(!r)throw a(new Error(`No transport available for address ${String(e)}`),o.ERR_TRANSPORT_UNAVAILABLE);try{return await r.dial(e,t)}catch(e){throw e.code||(e.code=o.ERR_TRANSPORT_DIAL_FAILED),e}}getAddrs(){let e=[];for(const t of this._listeners.values())for(const r of t)e=[...e,...r.getAddrs()];return e}getTransports(){return this._transports.values()}transportForMultiaddr(e){for(const t of this._transports.values()){if(t.filter([e]).length)return t}return null}async listen(e){if(!e||0===e.length)return void n("no addresses were provided for listening, this node is dial only");const t=[];for(const[r,i]of this._transports.entries()){const u=i.filter(e),d=[];for(const e of u){n("creating listener for %s on %s",r,e);const t=i.createListener(this._listenerOptions.get(r));this._listeners.get(r).push(t),t.on("listening",(()=>c(this.libp2p))),t.on("close",(()=>c(this.libp2p))),d.push(t.listen(e))}if(0===d.length){t.push(r);continue}if(!(await s(d)).find((e=>!0===e.isFulfilled))&&this.faultTolerance!==l.NO_FATAL)throw a(new Error(`Transport (${r}) could not listen on any available address`),o.ERR_NO_VALID_ADDRESSES)}if(t.length===this._transports.size){const e=`no valid addresses were provided for transports [${t}]`;if(this.faultTolerance===l.FATAL_ALL)throw a(new Error(e),o.ERR_NO_VALID_ADDRESSES);n(`libp2p in dial mode only: ${e}`)}}async remove(e){if(n("removing %s",e),this._listeners.has(e))for(const t of this._listeners.get(e))t.removeAllListeners("listening"),t.removeAllListeners("close"),await t.close();this._transports.delete(e),this._listeners.delete(e)}async removeAll(){const e=[];for(const t of this._transports.keys())e.push(this.remove(t));await Promise.all(e)}}const l={FATAL_ALL:0,NO_FATAL:1};u.FaultTolerance=l,t.exports=u},{debug:"bO5wM","p-settle":"hczkz","./errors":"3rNo5","err-code":"chZjB","./record/utils":"7dy3Z"}],hczkz:[function(e,t,r){"use strict";const i=e("p-reflect"),n=e("p-limit");t.exports=async(e,t={})=>{const{concurrency:r=1/0}=t,s=n(r);return Promise.all(e.map((e=>e&&"function"==typeof e.then?i(e):i("function"==typeof e?s((()=>e())):Promise.resolve(e)))))}},{"p-reflect":"3v3gm","p-limit":"k9NpZ"}],"3v3gm":[function(e,t,r){"use strict";const i=async e=>{try{return{isFulfilled:!0,isRejected:!1,value:await e}}catch(e){return{isFulfilled:!1,isRejected:!0,reason:e}}};t.exports=i,t.exports.default=i},{}],k9NpZ:[function(e,t,r){"use strict";const i=e("p-try"),n=e=>{if(!Number.isInteger(e)&&e!==1/0||!(e>0))return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"));const t=[];let r=0;const n=()=>{r--,t.length>0&&t.shift()()},s=(e,t,...s)=>{r++;const o=i(e,...s);t(o),o.then(n,n)},o=(i,...n)=>new Promise((o=>((i,n,...o)=>{r<e?s(i,n,...o):t.push(s.bind(null,i,n,...o))})(i,o,...n)));return Object.defineProperties(o,{activeCount:{get:()=>r},pendingCount:{get:()=>t.length},clearQueue:{value:()=>{t.length=0}}}),o};t.exports=n,t.exports.default=n},{"p-try":"RBpbF"}],RBpbF:[function(e,t,r){"use strict";const i=(e,...t)=>new Promise((r=>{r(e(...t))}));t.exports=i,t.exports.default=i},{}],"7dy3Z":[function(e,t,r){"use strict";const i=e("./envelope"),n=e("./peer-record");t.exports.updateSelfPeerRecord=async function(e){const t=new n({peerId:e.peerId,multiaddrs:e.multiaddrs}),r=await i.seal(t,e.peerId);e.peerStore.addressBook.consumePeerRecord(r)}},{"./envelope":"27rHX","./peer-record":"ewlv9"}],ewlv9:[function(e,t,r){"use strict";const{Multiaddr:i}=e("multiaddr"),n=e("peer-id"),s=e("libp2p-utils/src/array-equals"),{PeerRecord:o}=e("./peer-record"),{ENVELOPE_DOMAIN_PEER_RECORD:a,ENVELOPE_PAYLOAD_TYPE_PEER_RECORD:c}=e("./consts");class u{constructor({peerId:e,multiaddrs:t=[],seqNumber:r=Date.now()}){this.domain=a,this.codec=c,this.peerId=e,this.multiaddrs=t,this.seqNumber=r,this._marshal=void 0}marshal(){return this._marshal||(this._marshal=o.encode({peerId:this.peerId.toBytes(),seq:this.seqNumber,addresses:this.multiaddrs.map((e=>({multiaddr:e.bytes})))}).finish()),this._marshal}equals(e){return e instanceof u&&(!!this.peerId.equals(e.peerId)&&(this.seqNumber===e.seqNumber&&!!s(this.multiaddrs,e.multiaddrs)))}}u.createFromProtobuf=e=>{const t=o.decode(e),r=n.createFromBytes(t.peerId),s=(t.addresses||[]).map((e=>new i(e.multiaddr))),a=Number(t.seq);return new u({peerId:r,multiaddrs:s,seqNumber:a})},u.DOMAIN=a,t.exports=u},{multiaddr:"8Mu1u","peer-id":"8Bdb3","libp2p-utils/src/array-equals":"8n4Vn","./peer-record":"48CV1","./consts":"5QB9f"}],"8n4Vn":[function(e,t,r){"use strict";t.exports=function(e,t){return e.length===t.length&&t.sort()&&e.sort().every(((e,r)=>t[r].equals(e)))}},{}],"48CV1":[function(e,t,r){"use strict";var i=e("protobufjs/minimal"),n=i.Reader,s=i.Writer,o=i.util,a=i.roots["libp2p-peer-record"]||(i.roots["libp2p-peer-record"]={});a.PeerRecord=function(){function e(e){if(this.addresses=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.peerId=o.newBuffer([]),e.prototype.seq=o.Long?o.Long.fromBits(0,0,!0):0,e.prototype.addresses=o.emptyArray,e.encode=function(e,t){if(t||(t=s.create()),null!=e.peerId&&Object.hasOwnProperty.call(e,"peerId")&&t.uint32(10).bytes(e.peerId),null!=e.seq&&Object.hasOwnProperty.call(e,"seq")&&t.uint32(16).uint64(e.seq),null!=e.addresses&&e.addresses.length)for(var r=0;r<e.addresses.length;++r)a.PeerRecord.AddressInfo.encode(e.addresses[r],t.uint32(26).fork()).ldelim();return t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.PeerRecord;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.peerId=e.bytes();break;case 2:i.seq=e.uint64();break;case 3:i.addresses&&i.addresses.length||(i.addresses=[]),i.addresses.push(a.PeerRecord.AddressInfo.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.PeerRecord)return e;var t=new a.PeerRecord;if(null!=e.peerId&&("string"==typeof e.peerId?o.base64.decode(e.peerId,t.peerId=o.newBuffer(o.base64.length(e.peerId)),0):e.peerId.length&&(t.peerId=e.peerId)),null!=e.seq&&(o.Long?(t.seq=o.Long.fromValue(e.seq)).unsigned=!0:"string"==typeof e.seq?t.seq=parseInt(e.seq,10):"number"==typeof e.seq?t.seq=e.seq:"object"==typeof e.seq&&(t.seq=new o.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0))),e.addresses){if(!Array.isArray(e.addresses))throw TypeError(".PeerRecord.addresses: array expected");t.addresses=[];for(var r=0;r<e.addresses.length;++r){if("object"!=typeof e.addresses[r])throw TypeError(".PeerRecord.addresses: object expected");t.addresses[r]=a.PeerRecord.AddressInfo.fromObject(e.addresses[r])}}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.addresses=[]),t.defaults)if(t.bytes===String?r.peerId="":(r.peerId=[],t.bytes!==Array&&(r.peerId=o.newBuffer(r.peerId))),o.Long){var i=new o.Long(0,0,!0);r.seq=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.seq=t.longs===String?"0":0;if(null!=e.peerId&&e.hasOwnProperty("peerId")&&(r.peerId=t.bytes===String?o.base64.encode(e.peerId,0,e.peerId.length):t.bytes===Array?Array.prototype.slice.call(e.peerId):e.peerId),null!=e.seq&&e.hasOwnProperty("seq")&&("number"==typeof e.seq?r.seq=t.longs===String?String(e.seq):e.seq:r.seq=t.longs===String?o.Long.prototype.toString.call(e.seq):t.longs===Number?new o.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0):e.seq),e.addresses&&e.addresses.length){r.addresses=[];for(var n=0;n<e.addresses.length;++n)r.addresses[n]=a.PeerRecord.AddressInfo.toObject(e.addresses[n],t)}return r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e.AddressInfo=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.multiaddr=o.newBuffer([]),e.encode=function(e,t){return t||(t=s.create()),null!=e.multiaddr&&Object.hasOwnProperty.call(e,"multiaddr")&&t.uint32(10).bytes(e.multiaddr),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.PeerRecord.AddressInfo;e.pos<r;){var s=e.uint32();if(s>>>3==1)i.multiaddr=e.bytes();else e.skipType(7&s)}return i},e.fromObject=function(e){if(e instanceof a.PeerRecord.AddressInfo)return e;var t=new a.PeerRecord.AddressInfo;return null!=e.multiaddr&&("string"==typeof e.multiaddr?o.base64.decode(e.multiaddr,t.multiaddr=o.newBuffer(o.base64.length(e.multiaddr)),0):e.multiaddr.length&&(t.multiaddr=e.multiaddr)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.multiaddr="":(r.multiaddr=[],t.bytes!==Array&&(r.multiaddr=o.newBuffer(r.multiaddr)))),null!=e.multiaddr&&e.hasOwnProperty("multiaddr")&&(r.multiaddr=t.bytes===String?o.base64.encode(e.multiaddr,0,e.multiaddr.length):t.bytes===Array?Array.prototype.slice.call(e.multiaddr):e.multiaddr),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),e}(),t.exports=a},{"protobufjs/minimal":"grAXL"}],"5QB9f":[function(e,t,r){"use strict";const i=Uint8Array.from([3,1]);t.exports={ENVELOPE_DOMAIN_PEER_RECORD:"libp2p-peer-record",ENVELOPE_PAYLOAD_TYPE_PEER_RECORD:i}},{}],"8bdzg":[function(e,t,r){"use strict";const{EventEmitter:i}=e("events"),{Multiaddr:n}=e("multiaddr"),s=e("peer-id");t.exports=class extends i{constructor(e,{listen:t=[],announce:r=[]}={}){super(),this.peerId=e,this.listen=new Set(t.map((e=>e.toString()))),this.announce=new Set(r.map((e=>e.toString()))),this.observed=new Set}getListenAddrs(){return Array.from(this.listen).map((e=>new n(e)))}getAnnounceAddrs(){return Array.from(this.announce).map((e=>new n(e)))}getObservedAddrs(){return Array.from(this.observed).map((e=>new n(e)))}addObservedAddr(e){let t=new n(e);const r=t.getPeerId();if(r){s.createFromB58String(r).equals(this.peerId)&&(t=t.decapsulate(new n(`/p2p/${this.peerId}`)))}const i=t.toString();this.observed.has(i)||(this.observed.add(i),this.emit("change:addresses"))}}},{events:"g82pp",multiaddr:"8Mu1u","peer-id":"8Bdb3"}],bZLZf:[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:connection-manager"),{error:i("libp2p:connection-manager:err")}),s=e("err-code"),o=e("merge-options"),a=e("./latency-monitor"),c=e("retimer"),{EventEmitter:u}=e("events"),l=e("peer-id"),{codes:{ERR_INVALID_PARAMETERS:d}}=e("../errors"),f={maxConnections:1/0,minConnections:0,maxData:1/0,maxSentData:1/0,maxReceivedData:1/0,maxEventLoopDelay:1/0,pollInterval:2e3,autoDialInterval:1e4,movingAverageInterval:6e4,defaultPeerValue:1};t.exports=class extends u{constructor(e,t={}){if(super(),this._libp2p=e,this._peerId=e.peerId.toB58String(),this._options=o.call({ignoreUndefined:!0},f,t),this._options.maxConnections<this._options.minConnections)throw s(new Error("Connection Manager maxConnections must be greater than minConnections"),d);n("options: %j",this._options),this._peerValues=new Map,this.connections=new Map,this._started=!1,this._timer=null,this._autoDialTimeout=null,this._checkMetrics=this._checkMetrics.bind(this),this._autoDial=this._autoDial.bind(this),this._latencyMonitor=new a({latencyCheckIntervalMs:this._options.pollInterval,dataEmitIntervalMs:this._options.pollInterval})}get size(){return Array.from(this.connections.values()).reduce(((e,t)=>e+t.length),0)}start(){this._libp2p.metrics&&(this._timer=this._timer||c(this._checkMetrics,this._options.pollInterval)),this._latencyMonitor.start(),this._onLatencyMeasure=this._onLatencyMeasure.bind(this),this._latencyMonitor.on("data",this._onLatencyMeasure),this._started=!0,n("started"),this._options.autoDial&&this._autoDial()}async stop(){this._autoDialTimeout&&this._autoDialTimeout.clear(),this._timer&&this._timer.clear(),this._latencyMonitor.removeListener("data",this._onLatencyMeasure),this._latencyMonitor.stop(),this._started=!1,await this._close(),n("stopped")}async _close(){const e=[];for(const t of this.connections.values())for(const r of t)e.push(r.close());await Promise.all(e),this.connections.clear()}setPeerValue(e,t){if(t<0||t>1)throw new Error("value should be a number between 0 and 1");this._peerValues.set(e.toB58String(),t)}_checkMetrics(){if(this._libp2p.metrics){const e=this._libp2p.metrics.global.movingAverages,t=e.dataReceived[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxReceivedData",t);const r=e.dataSent[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxSentData",r);const i=t+r;this._checkMaxLimit("maxData",i),n("metrics update",i),this._timer=c(this._checkMetrics,this._options.pollInterval)}}onConnect(e){const t=e.remotePeer,r=t.toB58String(),i=this.connections.get(r);this.emit("peer:connect",e),i?i.push(e):this.connections.set(r,[e]),this._libp2p.peerStore.keyBook.set(t,t.pubKey),this._peerValues.has(r)||this._peerValues.set(r,this._options.defaultPeerValue),this._checkMaxLimit("maxConnections",this.size)}onDisconnect(e){const t=e.remotePeer.toB58String();let r=this.connections.get(t);r&&r.length>1?(r=r.filter((t=>t.id!==e.id)),this.connections.set(t,r)):r&&(this.connections.delete(t),this._peerValues.delete(e.remotePeer.toB58String()),this.emit("peer:disconnect",e))}get(e){const t=this.getAll(e);return t.length?t[0]:null}getAll(e){if(!l.isPeerId(e))throw s(new Error("peerId must be an instance of peer-id"),d);const t=e.toB58String(),r=this.connections.get(t);return r?r.filter((e=>"open"===e.stat.status)):[]}_onLatencyMeasure(e){this._checkMaxLimit("maxEventLoopDelay",e.avgMs)}_checkMaxLimit(e,t){const r=this._options[e];n("checking limit of %s. current value: %d of %d",e,t,r),t>r&&(n("%s: limit exceeded: %s, %d",this._peerId,e,t),this._maybeDisconnectOne())}async _autoDial(){const e=this._options.minConnections;if(this.size>=e)return void(this._autoDialTimeout=c(this._autoDial,this._options.autoDialInterval));const t=Array.from(this._libp2p.peerStore.peers.values()).sort(((e,t)=>!t.protocols||!t.protocols.length||e.protocols&&e.protocols.length?t.id.pubKey&&!e.id.pubKey?1:-1:1));for(let r=0;r<t.length&&this.size<e;r++)if(!this.get(t[r].id)){n("connecting to a peerStore stored peer %s",t[r].id.toB58String());try{if(await this._libp2p.dialer.connectToPeer(t[r].id),!this._started)return}catch(e){n.error("could not connect to peerStore stored peer",e)}}this._autoDialTimeout=c(this._autoDial,this._options.autoDialInterval)}_maybeDisconnectOne(){if(this._options.minConnections<this.connections.size){const e=Array.from(new Map([...this._peerValues.entries()].sort(((e,t)=>e[1]-t[1]))));n("%s: sorted peer values: %j",this._peerId,e);const t=e[0];if(t){const e=t[0];n("%s: lowest value peer is %s",this._peerId,e),n("%s: closing a connection to %j",this._peerId,e);for(const t of this.connections.values())if(t[0].remotePeer.toB58String()===e){t[0].close();break}}}}}},{debug:"bO5wM","err-code":"chZjB","merge-options":"fupyv","./latency-monitor":"cAPgo",retimer:"8W3r3",events:"g82pp","peer-id":"8Bdb3","../errors":"3rNo5"}],cAPgo:[function(e,t,r){"use strict";const{EventEmitter:i}=e("events"),n=e("./visibility-change-emitter"),s=e("debug")("latency-monitor:LatencyMonitor");t.exports=class extends i{constructor({latencyCheckIntervalMs:e,dataEmitIntervalMs:t,asyncTestFn:r,latencyRandomPercentage:i}={}){super();const n=this;n.latencyCheckIntervalMs=e||500,n.latencyRandomPercentage=i||10,n._latecyCheckMultiply=n.latencyRandomPercentage/100*2*n.latencyCheckIntervalMs,n._latecyCheckSubtract=n._latecyCheckMultiply/2,n.dataEmitIntervalMs=null===t||0===t?void 0:t||5e3,s("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",n.latencyCheckIntervalMs,n.dataEmitIntervalMs),n.dataEmitIntervalMs?s("Expecting ~%s events per summary",n.latencyCheckIntervalMs/n.dataEmitIntervalMs):s("Not emitting summaries"),n.asyncTestFn=r}start(){globalThis.process&&globalThis.process.hrtime?(s("Using process.hrtime for timing"),this.now=globalThis.process.hrtime,this.getDeltaMS=e=>{const t=this.now(e);return 1e3*t[0]+t[1]/1e6}):"undefined"!=typeof window&&window.performance&&window.performance.now?(s("Using performance.now for timing"),this.now=window.performance.now.bind(window.performance),this.getDeltaMS=e=>Math.round(this.now()-e)):(s("Using Date.now for timing"),this.now=Date.now,this.getDeltaMS=e=>this.now()-e),this._latencyData=this._initLatencyData(),"undefined"!=typeof window&&(this._visibilityChangeEmitter=new n,this._visibilityChangeEmitter.on("visibilityChange",(e=>{e?this._startTimers():(this._emitSummary(),this._stopTimers())}))),this._visibilityChangeEmitter&&!this._visibilityChangeEmitter.isVisible()||this._startTimers()}stop(){this._stopTimers()}_startTimers(){this._checkLatencyID||(this._checkLatency(),this.dataEmitIntervalMs&&(this._emitIntervalID=setInterval((()=>this._emitSummary()),this.dataEmitIntervalMs),"function"==typeof this._emitIntervalID.unref&&this._emitIntervalID.unref()))}_stopTimers(){this._checkLatencyID&&(clearTimeout(this._checkLatencyID),this._checkLatencyID=void 0),this._emitIntervalID&&(clearInterval(this._emitIntervalID),this._emitIntervalID=void 0)}_emitSummary(){const e=this.getSummary();e.events>0&&this.emit("data",e)}getSummary(){const e={events:this._latencyData.events,minMs:this._latencyData.minMs,maxMs:this._latencyData.maxMs,avgMs:this._latencyData.events?this._latencyData.totalMs/this._latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this._latencyData.startTime)};return this._latencyData=this._initLatencyData(),s("Summary: %O",e),e}_checkLatency(){const e=this,t=Math.random()*e._latecyCheckMultiply-e._latecyCheckSubtract,r={deltaOffset:Math.ceil(e.latencyCheckIntervalMs+t),startTime:e.now()},i=()=>{if(!this._checkLatencyID)return;const t=e.getDeltaMS(r.startTime)-r.deltaOffset;e._checkLatency(),e._latencyData.events++,e._latencyData.minMs=Math.min(e._latencyData.minMs,t),e._latencyData.maxMs=Math.max(e._latencyData.maxMs,t),e._latencyData.totalMs+=t,s("MS: %s Data: %O",t,e._latencyData)};s("localData: %O",r),this._checkLatencyID=setTimeout((()=>{e.asyncTestFn?(r.deltaOffset=0,r.startTime=e.now(),e.asyncTestFn(i)):(r.deltaOffset-=1,i())}),r.deltaOffset),"function"==typeof this._checkLatencyID.unref&&this._checkLatencyID.unref()}_initLatencyData(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}}},{events:"g82pp","./visibility-change-emitter":"dTe03",debug:"bO5wM"}],dTe03:[function(e,t,r){"use strict";const{EventEmitter:i}=e("events"),n=e("debug")("latency-monitor:VisibilityChangeEmitter");t.exports=class extends i{constructor(){super(),"undefined"!=typeof document?(this._initializeVisibilityVarNames(),this._addVisibilityChangeListener()):n('This is not a browser, no "document" found. Stopping.')}_initializeVisibilityVarNames(){let e,t;void 0!==document.hidden?(e="hidden",t="visibilitychange"):void 0!==document.mozHidden?(e="mozHidden",t="mozvisibilitychange"):void 0!==document.msHidden?(e="msHidden",t="msvisibilitychange"):void 0!==document.webkitHidden&&(e="webkitHidden",t="webkitvisibilitychange"),this._hidden=e,this._visibilityChange=t}_addVisibilityChangeListener(){void 0===document.addEventListener||void 0===document[this._hidden]?n("Checking page visibility requires a browser that supports the Page Visibility API."):document.addEventListener(this._visibilityChange,this._handleVisibilityChange.bind(this),!1)}isVisible(){if(void 0!==this._hidden&&void 0!==document[this._hidden])return!document[this._hidden]}_handleVisibilityChange(){const e=!document[this._hidden];n(e?"Page Visible":"Page Hidden"),this.emit("visibilityChange",e)}}},{events:"g82pp",debug:"bO5wM"}],"8W3r3":[function(e,t,r){"use strict";const i=e("./time");class n{constructor(e,t,r){const n=this;this._started=i(),this._rescheduled=0,this._scheduled=t,this._args=r,this._triggered=!1,this._timerWrapper=()=>{n._rescheduled>0?(n._scheduled=n._rescheduled-(i()-n._started),n._schedule(n._scheduled)):(n._triggered=!0,e.apply(null,n._args))},this._timer=setTimeout(this._timerWrapper,t)}reschedule(e){e||(e=this._scheduled);const t=i();t+e-(this._started+this._scheduled)<0?(clearTimeout(this._timer),this._schedule(e)):this._triggered?this._schedule(e):(this._started=t,this._rescheduled=e)}_schedule(e){this._triggered=!1,this._started=i(),this._rescheduled=0,this._scheduled=e,this._timer=setTimeout(this._timerWrapper,e)}clear(){clearTimeout(this._timer)}}t.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("timeout needed");let e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t<e.length;t++)e[t]=arguments[t+2]}return new n(arguments[0],arguments[1],e)}},{"./time":"8bzN6"}],"8bzN6":[function(e,t,r){"use strict";t.exports=function(){return Date.now()}},{}],"2UjYE":[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:circuit"),{error:i("libp2p:circuit:err")}),s=e("err-code"),o=e("mafmt"),{Multiaddr:a}=e("multiaddr"),c=e("peer-id"),{CircuitRelay:u}=e("./protocol"),{codes:l}=e("../errors"),d=e("libp2p-utils/src/stream-to-ma-conn"),{relay:f}=e("./multicodec"),h=e("./listener"),{handleCanHop:p,handleHop:g,hop:y}=e("./circuit/hop"),{handleStop:m}=e("./circuit/stop"),b=e("./circuit/stream-handler"),v=Symbol.for("@libp2p/js-libp2p-circuit/circuit");class w{constructor({libp2p:e,upgrader:t}){this._dialer=e.dialer,this._registrar=e.registrar,this._connectionManager=e.connectionManager,this._upgrader=t,this._options=e._config.relay,this._libp2p=e,this.peerId=e.peerId,this._registrar.handle(f,this._onProtocol.bind(this))}async _onProtocol({connection:e,stream:t}){const r=new b({stream:t}),i=await r.read();if(!i)return;const s=this;let o;switch(i.type){case u.Type.CAN_HOP:n("received CAN_HOP request from %s",e.remotePeer.toB58String()),await p({circuit:s,connection:e,streamHandler:r});break;case u.Type.HOP:n("received HOP request from %s",e.remotePeer.toB58String()),o=await g({connection:e,request:i,streamHandler:r,circuit:s});break;case u.Type.STOP:n("received STOP request from %s",e.remotePeer.toB58String()),o=await m({connection:e,request:i,streamHandler:r});break;default:n("Request of type %s not supported",i.type)}if(o){const e=new a(i.dstPeer.addrs[0]),t=new a(i.srcPeer.addrs[0]),r=d({stream:o,remoteAddr:e,localAddr:t}),s=i.type===u.Type.HOP?"relay":"inbound";n("new %s connection %s",s,r.remoteAddr);const c=await this._upgrader.upgradeInbound(r);n("%s connection %s upgraded",s,r.remoteAddr),this.handler&&this.handler(c)}}async dial(e,t){const r=e.toString().split("/p2p-circuit"),i=new a(r[0]),o=new a(r[r.length-1]),f=i.getPeerId(),h=o.getPeerId();if(!f||!h){const e="Circuit relay dial failed as addresses did not have peer id";throw n.error(e),s(new Error(e),l.ERR_RELAYED_DIAL)}const p=c.createFromB58String(f),g=c.createFromB58String(h);let m=!1,b=this._connectionManager.get(p);b||(b=await this._dialer.connectToPeer(i,t),m=!0);try{const t=await y({connection:b,request:{type:u.Type.HOP,srcPeer:{id:this.peerId.toBytes(),addrs:this._libp2p.multiaddrs.map((e=>e.bytes))},dstPeer:{id:g.toBytes(),addrs:[new a(o).bytes]}}}),r=i.encapsulate(`/p2p-circuit/p2p/${this.peerId.toB58String()}`),s=d({stream:t,remoteAddr:e,localAddr:r});return n("new outbound connection %s",s.remoteAddr),this._upgrader.upgradeOutbound(s)}catch(e){throw n.error("Circuit relay dial failed",e),m&&await b.close(),e}}createListener(e,t){return"function"==typeof e&&(t=e,e={}),this.handler=t,h(this._libp2p)}filter(e){return(e=Array.isArray(e)?e:[e]).filter((e=>o.Circuit.matches(e)))}get[Symbol.toStringTag](){return"Circuit"}static isTransport(e){return Boolean(e&&e[v])}}t.exports=w},{debug:"bO5wM","err-code":"chZjB",mafmt:"l1lok",multiaddr:"8Mu1u","peer-id":"8Bdb3","./protocol":"fLprH","../errors":"3rNo5","libp2p-utils/src/stream-to-ma-conn":"9Ldtq","./multicodec":"cvoxe","./listener":"3rDyV","./circuit/hop":"8wHM9","./circuit/stop":"9XOcP","./circuit/stream-handler":"4ZlbH"}],fLprH:[function(e,t,r){"use strict";var i=e("protobufjs/minimal"),n=i.Reader,s=i.Writer,o=i.util,a=i.roots["libp2p-circuit"]||(i.roots["libp2p-circuit"]={});a.CircuitRelay=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var t,r;return e.prototype.type=1,e.prototype.srcPeer=null,e.prototype.dstPeer=null,e.prototype.code=100,e.encode=function(e,t){return t||(t=s.create()),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(8).int32(e.type),null!=e.srcPeer&&Object.hasOwnProperty.call(e,"srcPeer")&&a.CircuitRelay.Peer.encode(e.srcPeer,t.uint32(18).fork()).ldelim(),null!=e.dstPeer&&Object.hasOwnProperty.call(e,"dstPeer")&&a.CircuitRelay.Peer.encode(e.dstPeer,t.uint32(26).fork()).ldelim(),null!=e.code&&Object.hasOwnProperty.call(e,"code")&&t.uint32(32).int32(e.code),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.CircuitRelay;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.type=e.int32();break;case 2:i.srcPeer=a.CircuitRelay.Peer.decode(e,e.uint32());break;case 3:i.dstPeer=a.CircuitRelay.Peer.decode(e,e.uint32());break;case 4:i.code=e.int32();break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.CircuitRelay)return e;var t=new a.CircuitRelay;switch(e.type){case"HOP":case 1:t.type=1;break;case"STOP":case 2:t.type=2;break;case"STATUS":case 3:t.type=3;break;case"CAN_HOP":case 4:t.type=4}if(null!=e.srcPeer){if("object"!=typeof e.srcPeer)throw TypeError(".CircuitRelay.srcPeer: object expected");t.srcPeer=a.CircuitRelay.Peer.fromObject(e.srcPeer)}if(null!=e.dstPeer){if("object"!=typeof e.dstPeer)throw TypeError(".CircuitRelay.dstPeer: object expected");t.dstPeer=a.CircuitRelay.Peer.fromObject(e.dstPeer)}switch(e.code){case"SUCCESS":case 100:t.code=100;break;case"HOP_SRC_ADDR_TOO_LONG":case 220:t.code=220;break;case"HOP_DST_ADDR_TOO_LONG":case 221:t.code=221;break;case"HOP_SRC_MULTIADDR_INVALID":case 250:t.code=250;break;case"HOP_DST_MULTIADDR_INVALID":case 251:t.code=251;break;case"HOP_NO_CONN_TO_DST":case 260:t.code=260;break;case"HOP_CANT_DIAL_DST":case 261:t.code=261;break;case"HOP_CANT_OPEN_DST_STREAM":case 262:t.code=262;break;case"HOP_CANT_SPEAK_RELAY":case 270:t.code=270;break;case"HOP_CANT_RELAY_TO_SELF":case 280:t.code=280;break;case"STOP_SRC_ADDR_TOO_LONG":case 320:t.code=320;break;case"STOP_DST_ADDR_TOO_LONG":case 321:t.code=321;break;case"STOP_SRC_MULTIADDR_INVALID":case 350:t.code=350;break;case"STOP_DST_MULTIADDR_INVALID":case 351:t.code=351;break;case"STOP_RELAY_REFUSED":case 390:t.code=390;break;case"MALFORMED_MESSAGE":case 400:t.code=400}return t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.type=t.enums===String?"HOP":1,r.srcPeer=null,r.dstPeer=null,r.code=t.enums===String?"SUCCESS":100),null!=e.type&&e.hasOwnProperty("type")&&(r.type=t.enums===String?a.CircuitRelay.Type[e.type]:e.type),null!=e.srcPeer&&e.hasOwnProperty("srcPeer")&&(r.srcPeer=a.CircuitRelay.Peer.toObject(e.srcPeer,t)),null!=e.dstPeer&&e.hasOwnProperty("dstPeer")&&(r.dstPeer=a.CircuitRelay.Peer.toObject(e.dstPeer,t)),null!=e.code&&e.hasOwnProperty("code")&&(r.code=t.enums===String?a.CircuitRelay.Status[e.code]:e.code),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e.Status=(t={},(r=Object.create(t))[t[100]="SUCCESS"]=100,r[t[220]="HOP_SRC_ADDR_TOO_LONG"]=220,r[t[221]="HOP_DST_ADDR_TOO_LONG"]=221,r[t[250]="HOP_SRC_MULTIADDR_INVALID"]=250,r[t[251]="HOP_DST_MULTIADDR_INVALID"]=251,r[t[260]="HOP_NO_CONN_TO_DST"]=260,r[t[261]="HOP_CANT_DIAL_DST"]=261,r[t[262]="HOP_CANT_OPEN_DST_STREAM"]=262,r[t[270]="HOP_CANT_SPEAK_RELAY"]=270,r[t[280]="HOP_CANT_RELAY_TO_SELF"]=280,r[t[320]="STOP_SRC_ADDR_TOO_LONG"]=320,r[t[321]="STOP_DST_ADDR_TOO_LONG"]=321,r[t[350]="STOP_SRC_MULTIADDR_INVALID"]=350,r[t[351]="STOP_DST_MULTIADDR_INVALID"]=351,r[t[390]="STOP_RELAY_REFUSED"]=390,r[t[400]="MALFORMED_MESSAGE"]=400,r),e.Type=function(){var e={},t=Object.create(e);return t[e[1]="HOP"]=1,t[e[2]="STOP"]=2,t[e[3]="STATUS"]=3,t[e[4]="CAN_HOP"]=4,t}(),e.Peer=function(){function e(e){if(this.addrs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.id=o.newBuffer([]),e.prototype.addrs=o.emptyArray,e.encode=function(e,t){if(t||(t=s.create()),t.uint32(10).bytes(e.id),null!=e.addrs&&e.addrs.length)for(var r=0;r<e.addrs.length;++r)t.uint32(18).bytes(e.addrs[r]);return t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.CircuitRelay.Peer;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.id=e.bytes();break;case 2:i.addrs&&i.addrs.length||(i.addrs=[]),i.addrs.push(e.bytes());break;default:e.skipType(7&s)}}if(!i.hasOwnProperty("id"))throw o.ProtocolError("missing required 'id'",{instance:i});return i},e.fromObject=function(e){if(e instanceof a.CircuitRelay.Peer)return e;var t=new a.CircuitRelay.Peer;if(null!=e.id&&("string"==typeof e.id?o.base64.decode(e.id,t.id=o.newBuffer(o.base64.length(e.id)),0):e.id.length&&(t.id=e.id)),e.addrs){if(!Array.isArray(e.addrs))throw TypeError(".CircuitRelay.Peer.addrs: array expected");t.addrs=[];for(var r=0;r<e.addrs.length;++r)"string"==typeof e.addrs[r]?o.base64.decode(e.addrs[r],t.addrs[r]=o.newBuffer(o.base64.length(e.addrs[r])),0):e.addrs[r].length&&(t.addrs[r]=e.addrs[r])}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.addrs=[]),t.defaults&&(t.bytes===String?r.id="":(r.id=[],t.bytes!==Array&&(r.id=o.newBuffer(r.id)))),null!=e.id&&e.hasOwnProperty("id")&&(r.id=t.bytes===String?o.base64.encode(e.id,0,e.id.length):t.bytes===Array?Array.prototype.slice.call(e.id):e.id),e.addrs&&e.addrs.length){r.addrs=[];for(var i=0;i<e.addrs.length;++i)r.addrs[i]=t.bytes===String?o.base64.encode(e.addrs[i],0,e.addrs[i].length):t.bytes===Array?Array.prototype.slice.call(e.addrs[i]):e.addrs[i]}return r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),e}(),t.exports=a},{"protobufjs/minimal":"grAXL"}],"9Ldtq":[function(e,t,r){"use strict";const{source:i}=e("abortable-iterator"),n=e("debug")("libp2p:stream:converter");t.exports=function({stream:e,remoteAddr:t,localAddr:r},s={}){const{sink:o,source:a}=e,c={async sink(e){s.signal&&(e=i(e,s.signal));try{await o(e)}catch(e){"aborted"!==e.type&&n(e)}u()},source:s.signal?i(a,s.signal):a,conn:e,localAddr:r,remoteAddr:t,timeline:{open:Date.now(),close:void 0},close:()=>(o(new Uint8Array(0)),u())};function u(){return c.timeline.close||(c.timeline.close=Date.now()),Promise.resolve()}return c}},{"abortable-iterator":"awlU8",debug:"bO5wM"}],cvoxe:[function(e,t,r){"use strict";t.exports={relay:"/libp2p/circuit/relay/0.1.0"}},{}],"3rDyV":[function(e,t,r){"use strict";const{EventEmitter:i}=e("events"),{Multiaddr:n}=e("multiaddr");t.exports=e=>{const t=new Map;const r=Object.assign(new i,{close:()=>Promise.resolve(),listen:async function(i){const s=String(i).split("/p2p-circuit").find((e=>""!==e)),o=await e.dial(new n(s)),a=o.remoteAddr.encapsulate("/p2p-circuit");t.set(o.remotePeer.toB58String(),a),r.emit("listening")},getAddrs:function(){const e=[];for(const r of t.values())e.push(r);return e}});return e.connectionManager.on("peer:disconnect",(e=>{t.delete(e.remotePeer.toB58String())&&r.emit("close")})),r}},{events:"g82pp",multiaddr:"8Mu1u"}],"8wHM9":[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:circuit:hop"),{error:i("libp2p:circuit:hop:err")}),s=e("err-code"),o=e("peer-id"),{validateAddrs:a}=e("./utils"),c=e("./stream-handler"),{CircuitRelay:u}=e("../protocol"),{pipe:l}=e("it-pipe"),{codes:d}=e("../../errors"),{stop:f}=e("./stop"),h=e("./../multicodec");t.exports={handleHop:async function({connection:e,request:t,streamHandler:r,circuit:i}){if(!i._options.hop.enabled)return n("HOP request received but we are not acting as a relay"),r.end({type:u.Type.STATUS,code:u.Status.HOP_CANT_SPEAK_RELAY});try{a(t,r)}catch(t){return n.error("invalid hop request via peer %s",e.remotePeer.toB58String(),t)}if(!t.dstPeer)return void n("HOP request received but we do not receive a dstPeer");const s=new o(t.dstPeer.id),c=i._connectionManager.get(s);if(!c&&!i._options.hop.active)return n("HOP request received but we are not connected to the destination peer"),r.end({type:u.Type.STATUS,code:u.Status.HOP_NO_CONN_TO_DST});if(!c)return;const d={type:u.Type.STOP,dstPeer:t.dstPeer,srcPeer:t.srcPeer};let h;try{h=await f({connection:c,request:d})}catch(e){return n.error(e)}n("hop request from %s is valid",e.remotePeer.toB58String()),r.write({type:u.Type.STATUS,code:u.Status.SUCCESS});const p=r.rest();return l(p,h,p)},hop:async function({connection:e,request:t}){const{stream:r}=await e.newStream([h.relay]),i=new c({stream:r});i.write(t);const o=await i.read();if(!o)throw s(new Error("HOP request had no response"),d.ERR_HOP_REQUEST_FAILED);if(o.code===u.Status.SUCCESS)return n("hop request was successful"),i.rest();throw n("hop request failed with code %d, closing stream",o.code),i.close(),s(new Error(`HOP request failed with code ${o.code}`),d.ERR_HOP_REQUEST_FAILED)},canHop:async function({connection:e}){const{stream:t}=await e.newStream([h.relay]),r=new c({stream:t});r.write({type:u.Type.CAN_HOP});const i=await r.read();return await r.close(),!(!i||i.code!==u.Status.SUCCESS)},handleCanHop:function({connection:e,streamHandler:t,circuit:r}){const i=r._options.hop.enabled;n("can hop (%s) request from %s",i,e.remotePeer.toB58String()),t.end({type:u.Type.STATUS,code:i?u.Status.SUCCESS:u.Status.HOP_CANT_SPEAK_RELAY})}}},{debug:"bO5wM","err-code":"chZjB","peer-id":"8Bdb3","./utils":"daC1e","./stream-handler":"4ZlbH","../protocol":"fLprH","it-pipe":"giKBQ","../../errors":"3rNo5","./stop":"9XOcP","./../multicodec":"cvoxe"}],daC1e:[function(e,t,r){"use strict";const{Multiaddr:i}=e("multiaddr"),{CircuitRelay:n}=e("../protocol");function s(e,t){e.write({type:n.Type.STATUS,code:t})}t.exports={validateAddrs:function(e,t){try{e.dstPeer&&e.dstPeer.addrs&&e.dstPeer.addrs.forEach((e=>new i(e)))}catch(r){throw s(t,e.type===n.Type.HOP?n.Status.HOP_DST_MULTIADDR_INVALID:n.Status.STOP_DST_MULTIADDR_INVALID),r}try{e.srcPeer&&e.srcPeer.addrs&&e.srcPeer.addrs.forEach((e=>new i(e)))}catch(r){throw s(t,e.type===n.Type.HOP?n.Status.HOP_SRC_MULTIADDR_INVALID:n.Status.STOP_SRC_MULTIADDR_INVALID),r}}}},{multiaddr:"8Mu1u","../protocol":"fLprH"}],"4ZlbH":[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:circuit:stream-handler"),{error:i("libp2p:circuit:stream-handler:err")}),s=e("it-length-prefixed"),o=e("it-handshake"),{CircuitRelay:a}=e("../protocol");t.exports=class{constructor({stream:e,maxLength:t=4096}){this.stream=e,this.shake=o(this.stream),this.decoder=s.decode.fromReader(this.shake.reader,{maxDataLength:t})}async read(){const e=await this.decoder.next();if(e.value){const t=a.decode(e.value.slice());return n("read message type",t.type),t}n("read received no value, closing stream"),this.close()}write(e){n("write message type %s",e.type),this.shake.write(s.encode.single(a.encode(e).finish()))}rest(){return this.shake.rest(),this.shake.stream}end(e){this.write(e),this.close()}close(){n("closing the stream"),this.rest().sink([])}}},{debug:"bO5wM","it-length-prefixed":"3yxIE","it-handshake":"5ZBDe","../protocol":"fLprH"}],"9XOcP":[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:circuit:stop"),{error:i("libp2p:circuit:stop:err")}),{CircuitRelay:s}=e("../protocol"),o=e("../multicodec"),a=e("./stream-handler"),{validateAddrs:c}=e("./utils");t.exports.handleStop=function({connection:e,request:t,streamHandler:r}){try{c(t,r)}catch(t){return n.error("invalid stop request via peer %s",e.remotePeer.toB58String(),t)}return n("stop request is valid"),r.write({type:s.Type.STATUS,code:s.Status.SUCCESS}),r.rest()},t.exports.stop=async function({connection:e,request:t}){const{stream:r}=await e.newStream([o.relay]);n("starting stop request to %s",e.remotePeer.toB58String());const i=new a({stream:r});i.write(t);const c=await i.read();return c?c.code===s.Status.SUCCESS?(n("stop request to %s was successful",e.remotePeer.toB58String()),i.rest()):(n("stop request failed with code %d",c.code),void i.close()):i.close()}},{debug:"bO5wM","../protocol":"fLprH","../multicodec":"cvoxe","./stream-handler":"4ZlbH","./utils":"daC1e"}],hBCQx:[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:relay"),{error:i("libp2p:relay:err")}),{setDelayedInterval:s,clearDelayedInterval:o}=e("set-delayed-interval"),a=e("./auto-relay"),{namespaceToCid:c}=e("./utils"),{RELAY_RENDEZVOUS_NS:u}=e("./constants");t.exports=class{constructor(e){this._libp2p=e,this._options={...e._config.relay},this._autoRelay=this._options.autoRelay.enabled&&new a({libp2p:e,...this._options.autoRelay}),this._advertiseService=this._advertiseService.bind(this)}start(){this._options.hop.enabled&&this._options.advertise.enabled&&(this._timeout=s(this._advertiseService,this._options.advertise.ttl,this._options.advertise.bootDelay))}stop(){o(this._timeout)}async _advertiseService(){try{const e=await c(u);await this._libp2p.contentRouting.provide(e)}catch(e){"NO_ROUTERS_AVAILABLE"===e.code?(n.error("a content router, such as a DHT, must be provided in order to advertise the relay service",e),this.stop()):n.error(e)}}}},{debug:"bO5wM","set-delayed-interval":"4OF34","./auto-relay":"84VTV","./utils":"l4Fw3","./constants":"eXVcE"}],"84VTV":[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:auto-relay"),{error:i("libp2p:auto-relay:err")}),{fromString:s}=e("uint8arrays/from-string"),{toString:o}=e("uint8arrays/to-string"),{Multiaddr:a}=e("multiaddr"),c=e("peer-id"),{relay:u}=e("./multicodec"),{canHop:l}=e("./circuit/hop"),{namespaceToCid:d}=e("./utils"),{CIRCUIT_PROTO_CODE:f,HOP_METADATA_KEY:h,HOP_METADATA_VALUE:p,RELAY_RENDEZVOUS_NS:g}=e("./constants");t.exports=class{constructor({libp2p:e,maxListeners:t=1,onError:r}){this._libp2p=e,this._peerId=e.peerId,this._peerStore=e.peerStore,this._connectionManager=e.connectionManager,this._transportManager=e.transportManager,this._addressSorter=e.dialer.addressSorter,this.maxListeners=t,this._listenRelays=new Set,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this),this._peerStore.on("change:protocols",this._onProtocolChange),this._connectionManager.on("peer:disconnect",this._onPeerDisconnected),this._onError=(e,t)=>{n.error(t||e),r&&r(e,t)}}async _onProtocolChange({peerId:e,protocols:t}){const r=e.toB58String(),i=t.find((e=>e===u));if(i||!this._listenRelays.has(r)){if(i&&!this._listenRelays.has(r))try{const t=this._connectionManager.get(e);if(!t)return;if(t.remoteAddr.protoCodes().includes(f))return void n(`relayed connection to ${r} will not be used to hop on`);await l({connection:t})&&(this._peerStore.metadataBook.set(e,h,s(p)),await this._addListenRelay(t,r))}catch(e){this._onError(e)}}else this._removeListenRelay(r)}_onPeerDisconnected(e){const t=e.remotePeer.toB58String();this._listenRelays.has(t)&&this._removeListenRelay(t)}async _addListenRelay(e,t){if(this._listenRelays.size>=this.maxListeners)return;const r=this._peerStore.addressBook.getMultiaddrsForPeer(e.remotePeer,this._addressSorter);if(!r||!r.length)return;const i=`${r[0].toString()}/p2p-circuit`;this._listenRelays.add(t);try{await this._transportManager.listen([new a(i)])}catch(e){this._onError(e),this._listenRelays.delete(t)}}_removeListenRelay(e){this._listenRelays.delete(e)&&this._listenOnAvailableHopRelays([e])}async _listenOnAvailableHopRelays(e=[]){if(this._listenRelays.size>=this.maxListeners)return;const t=[];for(const[r,i]of this._peerStore.metadataBook.data.entries()){if(this._listenRelays.has(r)||e.includes(r))continue;const n=i.get(h);if(!n||o(n)!==p)continue;const s=c.createFromB58String(r),a=this._connectionManager.get(s);if(a){if(await this._addListenRelay(a,r),this._listenRelays.size>=this.maxListeners)return}else t.push(s)}for(const e of t)if(await this._tryToListenOnRelay(e),this._listenRelays.size>=this.maxListeners)return;try{const e=await d(g);for await(const t of this._libp2p.contentRouting.findProviders(e)){if(!t.multiaddrs.length)continue;const e=t.id;if(this._peerStore.addressBook.add(e,t.multiaddrs),await this._tryToListenOnRelay(e),this._listenRelays.size>=this.maxListeners)return}}catch(e){this._onError(e)}}async _tryToListenOnRelay(e){try{const t=await this._libp2p.dial(e);await this._addListenRelay(t,e.toB58String())}catch(t){this._onError(t,`could not connect and listen on known hop relay ${e.toB58String()}`)}}}},{debug:"bO5wM","uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB",multiaddr:"8Mu1u","peer-id":"8Bdb3","./multicodec":"cvoxe","./circuit/hop":"8wHM9","./utils":"l4Fw3","./constants":"eXVcE"}],l4Fw3:[function(e,t,r){"use strict";const{CID:i}=e("multiformats/cid"),{sha256:n}=e("multiformats/hashes/sha2");t.exports.namespaceToCid=async e=>{const t=(new TextEncoder).encode(e),r=await n.digest(t);return i.createV0(r)}},{"multiformats/cid":"9ooAY","multiformats/hashes/sha2":"7i9MT"}],kwWEi:[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:dialer"),{error:i("libp2p:dialer:err")}),s=e("err-code"),{Multiaddr:o}=e("multiaddr"),a=e("timeout-abort-controller"),{AbortError:c}=e("abortable-iterator"),{anySignal:u}=e("any-signal"),l=e("./dial-request"),{publicAddressesFirst:d}=e("libp2p-utils/src/address-sort"),f=e("../get-peer"),{codes:h}=e("../errors"),{DIAL_TIMEOUT:p,MAX_PARALLEL_DIALS:g,MAX_PER_PEER_DIALS:y,MAX_ADDRS_TO_DIAL:m}=e("../constants");t.exports=class{constructor({transportManager:e,peerStore:t,addressSorter:r=d,maxParallelDials:i=g,maxAddrsToDial:n=m,dialTimeout:s=p,maxDialsPerPeer:a=y,resolvers:c={}}){this.transportManager=e,this.peerStore=t,this.addressSorter=r,this.maxParallelDials=i,this.maxAddrsToDial=n,this.timeout=s,this.maxDialsPerPeer=a,this.tokens=[...new Array(i)].map(((e,t)=>t)),this._pendingDials=new Map,this._pendingDialTargets=new Map;for(const[e,t]of Object.entries(c))o.resolvers.set(e,t)}destroy(){for(const e of this._pendingDials.values())try{e.controller.abort()}catch(e){n.error(e)}this._pendingDials.clear();for(const e of this._pendingDialTargets.values())e.reject(new c("Dialer was destroyed"));this._pendingDialTargets.clear()}async connectToPeer(e,t={}){const r=await this._createCancellableDialTarget(e);if(!r.addrs.length)throw s(new Error("The dial request has no valid addresses"),h.ERR_NO_VALID_ADDRESSES);const i=this._pendingDials.get(r.id)||this._createPendingDial(r,t);try{const e=await i.promise;return n("dial succeeded to %s",r.id),e}catch(e){throw i.controller.signal.aborted&&(e.code=h.ERR_TIMEOUT),n.error(e),e}finally{i.destroy()}}async _createCancellableDialTarget(e){const t=`${parseInt(String(1e9*Math.random()),10).toString()+Date.now()}`,r=new Promise(((e,r)=>{this._pendingDialTargets.set(t,{resolve:e,reject:r})})),i=await Promise.race([this._createDialTarget(e),r]);return this._pendingDialTargets.delete(t),i}async _createDialTarget(e){const{id:t,multiaddrs:r}=f(e);r&&this.peerStore.addressBook.add(t,r);let i=this.peerStore.addressBook.getMultiaddrsForPeer(t,this.addressSorter)||[];o.isMultiaddr(e)&&(i=i.filter((t=>!e.equals(t))),i.unshift(e));const n=[];for(const e of i){(await this._resolve(e)).forEach((e=>n.push(e)))}const a=n.filter((e=>this.transportManager.transportForMultiaddr(e)));if(a.length>this.maxAddrsToDial)throw this.peerStore.delete(t),s(new Error("dial with more addresses than allowed"),h.ERR_TOO_MANY_ADDRESSES);return{id:t.toB58String(),addrs:a}}_createPendingDial(e,t={}){const r=new l({addrs:e.addrs,dialAction:(e,t)=>{if(t.signal.aborted)throw s(new Error("already aborted"),h.ERR_ALREADY_ABORTED);return this.transportManager.dial(e,t)},dialer:this}),i=new a(this.timeout),n=[i.signal];t.signal&&n.push(t.signal);const o=u(n),c={dialRequest:r,controller:i,promise:r.run({...t,signal:o}),destroy:()=>{i.clear(),this._pendingDials.delete(e.id)}};return this._pendingDials.set(e.id,c),c}getTokens(e){const t=Math.min(e,this.maxDialsPerPeer,this.tokens.length),r=this.tokens.splice(0,t);return n("%d tokens request, returning %d, %d remaining",e,t,this.tokens.length),r}releaseToken(e){this.tokens.indexOf(e)>-1||(n("token %d released",e),this.tokens.push(e))}async _resolve(e){if(!e.protoNames().includes("dnsaddr"))return[e];const t=await this._resolveRecord(e);return(await Promise.all(t.map((e=>this._resolve(e))))).flat().reduce(((e,t)=>(e.find((e=>e.equals(t)))||e.push(t),e)),[])}async _resolveRecord(e){try{e=new o(e.toString());return await e.resolve()}catch(t){return n.error(`multiaddr ${e} could not be resolved`),[]}}}},{debug:"bO5wM","err-code":"chZjB",multiaddr:"8Mu1u","timeout-abort-controller":"hzClg","abortable-iterator":"awlU8","any-signal":"kXgRR","./dial-request":"bCRVF","libp2p-utils/src/address-sort":"5uTJL","../get-peer":"39nOe","../errors":"3rNo5","../constants":"92Vak"}],bCRVF:[function(e,t,r){"use strict";const i=e("err-code"),n=e("abort-controller").default,{anySignal:s}=e("any-signal"),o=e("p-fifo"),a=e("p-any");t.exports=class{constructor({addrs:e,dialAction:t,dialer:r}){this.addrs=e,this.dialer=r,this.dialAction=t}async run(e={}){const t=this.dialer.getTokens(this.addrs.length);if(t.length<1)throw i(new Error("No dial tokens available"),"ERR_NO_DIAL_TOKENS");const r=new o;t.forEach((e=>r.push(e)));const c=this.addrs.map((()=>new n));let u=0;try{return await a(this.addrs.map((async(i,n)=>{const o=await r.shift();let a;try{const l=c[n].signal;a=await this.dialAction(i,{...e,signal:e.signal?s([l,e.signal]):l}),c.splice(n,1)}finally{u++,this.addrs.length-u>=t.length?r.push(o):this.dialer.releaseToken(t.splice(t.indexOf(o),1)[0])}return a})))}finally{c.map((e=>e.abort())),t.forEach((e=>this.dialer.releaseToken(e)))}}}},{"err-code":"chZjB","abort-controller":"lNJ7z","any-signal":"kXgRR","p-fifo":"9S0qu","p-any":"24Yiw"}],"9S0qu":[function(e,t,r){const i=e("fast-fifo"),n=e("p-defer");t.exports=class{constructor(){this._buffer=new i,this._waitingConsumers=new i}push(e){const{promise:t,resolve:r}=n();return this._buffer.push({chunk:e,resolve:r}),this._consume(),t}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){const e=this._waitingConsumers.shift(),t=this._buffer.shift();e.resolve(t.chunk),t.resolve()}}shift(){const{promise:e,resolve:t}=n();return this._waitingConsumers.push({resolve:t}),this._consume(),e}isEmpty(){return this._buffer.isEmpty()}}},{"fast-fifo":"8Ws5O","p-defer":"5rKSv"}],"24Yiw":[function(e,t,r){"use strict";const i=e("p-some"),n=e("p-cancelable");t.exports=(e,t)=>{const r=i(e,{...t,count:1});return n.fn((async e=>{e((()=>{r.cancel()}));const[t]=await r;return t}))()},t.exports.AggregateError=i.AggregateError},{"p-some":"gmdP0","p-cancelable":"fDp4B"}],gmdP0:[function(e,t,r){"use strict";const i=e("aggregate-error"),n=e("p-cancelable");class s extends Error{}t.exports=(e,t)=>new n(((r,n,o)=>{const{count:a,filter:c=(()=>!0)}=t;if(!Number.isFinite(a))return void n(new TypeError("Expected a finite number, got "+typeof t.count));const u=[],l=[];let d=0,f=!1;const h=new Set,p=()=>{for(const t of e)h.has(t)||"function"!=typeof t.cancel||t.cancel()};o(p);for(const t of e)d++,(async()=>{try{const e=await t;if(f)return;if(!c(e))throw new s("Value does not satisfy filter");u.push(e)}catch(e){l.push(e)}finally{h.add(t),!f&&(u.length===a&&(r(u),f=!0),d-l.length<a&&(n(new i(l)),f=!0),f)&&p()}})();a>d&&(n(new RangeError(`Expected input to contain at least ${t.count} items, but contains ${d} items`)),p())})),t.exports.AggregateError=i,t.exports.FilterError=s},{"aggregate-error":"45emq","p-cancelable":"fDp4B"}],fDp4B:[function(e,t,r){"use strict";class i extends Error{constructor(e){super(e||"Promise was canceled"),this.name="CancelError"}get isCanceled(){return!0}}class n{static fn(e){return(...t)=>new n(((r,i,n)=>{t.push(n),e(...t).then(r,i)}))}constructor(e){this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise(((t,r)=>{this._reject=r;const i=e=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(e)};return Object.defineProperties(i,{shouldReject:{get:()=>this._rejectOnCancel,set:e=>{this._rejectOnCancel=e}}}),e((e=>{this._isCanceled&&i.shouldReject||(this._isPending=!1,t(e))}),(e=>{this._isPending=!1,r(e)}),i)}))}then(e,t){return this._promise.then(e,t)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(this._isPending&&!this._isCanceled){if(this._isCanceled=!0,this._cancelHandlers.length>0)try{for(const e of this._cancelHandlers)e()}catch(e){return void this._reject(e)}this._rejectOnCancel&&this._reject(new i(e))}}get isCanceled(){return this._isCanceled}}Object.setPrototypeOf(n.prototype,Promise.prototype),t.exports=n,t.exports.CancelError=i},{}],f4Pg5:[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:keychain"),{error:i("libp2p:keychain:err")}),s=e("sanitize-filename"),o=e("merge-options"),a=e("libp2p-crypto"),{Key:c}=e("interface-datastore/key"),u=e("./cms"),l=e("err-code"),{toString:d}=e("uint8arrays/to-string"),{fromString:f}=e("uint8arrays/from-string");e("node-forge/lib/sha512");const h="/info/",p=new WeakMap,g=14,y=16,m=1e3,b={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function v(e){return!!e&&("string"==typeof e&&e===s(e.trim()))}async function w(e){const t=800*Math.random()+200;throw await new Promise((e=>setTimeout(e,t))),e}function _(e){return new c("/pkcs8/"+e)}function E(e){return new c(h+e)}t.exports=class{constructor(e,t){if(!e)throw new Error("store is required");if(this.store=e,this.opts=o(b,t),this.opts.pass&&this.opts.pass.length<20)throw new Error("pass must be least 20 characters");if(this.opts.dek.keyLength<g)throw new Error(`dek.keyLength must be least ${g} bytes`);if(this.opts.dek.salt.length<y)throw new Error(`dek.saltLength must be least ${y} bytes`);if(this.opts.dek.iterationCount<m)throw new Error(`dek.iterationCount must be least ${m}`);const r=this.opts.pass?a.pbkdf2(this.opts.pass,this.opts.dek.salt,this.opts.dek.iterationCount,this.opts.dek.keyLength,this.opts.dek.hash):"";p.set(this,{dek:r})}get cms(){return new u(this,p.get(this).dek)}static generateOptions(){const e=Object.assign({},b),t=3*Math.ceil(y/3);return e.dek.salt=d(a.randomBytes(t),"base64"),e}static get options(){return b}async createKey(e,t,r=2048){const i=this;if(!v(e)||"self"===e)return w(l(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if("string"!=typeof t)return w(l(new Error(`Invalid key type '${t}'`),"ERR_INVALID_KEY_TYPE"));const n=_(e);if(await i.store.has(n))return w(l(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));if("rsa"===t.toLowerCase())if(!Number.isSafeInteger(r)||r<2048)return w(l(new Error(`Invalid RSA key size ${r}`),"ERR_INVALID_KEY_SIZE"));let s;try{const o=await a.keys.generateKeyPair(t,r),c=await o.id(),u=p.get(this).dek,l=await o.export(u);s={name:e,id:c};const d=i.store.batch();d.put(n,f(l)),d.put(E(e),f(JSON.stringify(s))),await d.commit()}catch(e){return w(e)}return s}async listKeys(){const e=this,t={prefix:h},r=[];for await(const i of e.store.query(t))r.push(JSON.parse(d(i.value)));return r}async findKeyById(e){try{return(await this.listKeys()).find((t=>t.id===e))}catch(e){return w(e)}}async findKeyByName(e){if(!v(e))return w(l(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));const t=E(e);try{const e=await this.store.get(t);return JSON.parse(d(e))}catch(t){return w(l(new Error(`Key '${e}' does not exist. ${t.message}`),"ERR_KEY_NOT_FOUND"))}}async removeKey(e){if(!v(e)||"self"===e)return w(l(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));const t=_(e),r=await this.findKeyByName(e),i=this.store.batch();return i.delete(t),i.delete(E(e)),await i.commit(),r}async renameKey(e,t){const r=this;if(!v(e)||"self"===e)return w(l(new Error(`Invalid old key name '${e}'`),"ERR_OLD_KEY_NAME_INVALID"));if(!v(t)||"self"===t)return w(l(new Error(`Invalid new key name '${t}'`),"ERR_NEW_KEY_NAME_INVALID"));const i=_(e),n=_(t),s=E(e),o=E(t);if(await r.store.has(n))return w(l(new Error(`Key '${t}' already exists`),"ERR_KEY_ALREADY_EXISTS"));try{const e=await r.store.get(i),a=await r.store.get(s),c=JSON.parse(d(a));c.name=t;const u=r.store.batch();return u.put(n,e),u.put(o,f(JSON.stringify(c))),u.delete(i),u.delete(s),await u.commit(),c}catch(e){return w(e)}}async exportKey(e,t){if(!v(e))return w(l(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t)return w(l(new Error("Password is required"),"ERR_PASSWORD_REQUIRED"));const r=_(e);try{const e=await this.store.get(r),i=d(e),n=p.get(this).dek;return(await a.keys.import(i,n)).export(t)}catch(e){return w(e)}}async importKey(e,t,r){if(!v(e)||"self"===e)return w(l(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t)return w(l(new Error("PEM encoded key is required"),"ERR_PEM_REQUIRED"));const i=_(e);if(await this.store.has(i))return w(l(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));let n,s;try{n=await a.keys.import(t,r)}catch(e){return w(l(new Error("Cannot read the key, most likely the password is wrong"),"ERR_CANNOT_READ_KEY"))}try{s=await n.id();const e=p.get(this).dek;t=await n.export(e)}catch(e){return w(e)}const o={name:e,id:s},c=this.store.batch();return c.put(i,f(t)),c.put(E(e),f(JSON.stringify(o))),await c.commit(),o}async importPeer(e,t){const r=this;if(!v(e))return w(l(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t||!t.privKey)return w(l(new Error("Peer.privKey is required"),"ERR_MISSING_PRIVATE_KEY"));const i=t.privKey,n=_(e);if(await r.store.has(n))return w(l(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));try{const t=await i.id(),s=p.get(this).dek,o=await i.export(s),a={name:e,id:t},c=r.store.batch();return c.put(n,f(o)),c.put(E(e),f(JSON.stringify(a))),await c.commit(),a}catch(e){return w(e)}}async _getPrivateKey(e){if(!v(e))return w(l(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));try{const t=_(e),r=await this.store.get(t);return d(r)}catch(t){return w(l(new Error(`Key '${e}' does not exist. ${t.message}`),"ERR_KEY_NOT_FOUND"))}}async rotateKeychainPass(e,t){if("string"!=typeof e)return w(l(new Error(`Invalid old pass type '${typeof e}'`),"ERR_INVALID_OLD_PASS_TYPE"));if("string"!=typeof t)return w(l(new Error(`Invalid new pass type '${typeof t}'`),"ERR_INVALID_NEW_PASS_TYPE"));if(t.length<20)return w(l(new Error(`Invalid pass length ${t.length}`),"ERR_INVALID_PASS_LENGTH"));n("recreating keychain");const r=p.get(this).dek;this.opts.pass=t;const i=t?a.pbkdf2(t,this.opts.dek.salt,this.opts.dek.iterationCount,this.opts.dek.keyLength,this.opts.dek.hash):"";p.set(this,{dek:i});const s=await this.listKeys();for(const e of s){const t=await this.store.get(_(e.name)),n=d(t),s=await a.keys.import(n,r),o=i.toString(),c=await s.export(o),u=this.store.batch(),l={name:e.name,id:e.id};u.put(_(e.name),f(c)),u.put(E(e.name),f(JSON.stringify(l))),await u.commit()}n("keychain reconstructed")}}},{debug:"bO5wM","sanitize-filename":"gfrhY","merge-options":"fupyv","libp2p-crypto":"bb1cb","interface-datastore/key":"9hGOz","./cms":"2CEx0","err-code":"chZjB","uint8arrays/to-string":"hC8JB","uint8arrays/from-string":"dF7Y4","node-forge/lib/sha512":"9XKJ9"}],gfrhY:[function(e,t,r){"use strict";var i=e("truncate-utf8-bytes"),n=/[\/\?<>\\:\*\|"]/g,s=/[\x00-\x1f\x80-\x9f]/g,o=/^\.+$/,a=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,c=/[\. ]+$/;function u(e,t){if("string"!=typeof e)throw new Error("Input must be string");var r=e.replace(n,t).replace(s,t).replace(o,t).replace(a,t).replace(c,t);return i(r,255)}t.exports=function(e,t){var r=t&&t.replacement||"",i=u(e,r);return""===r?i:u(i,"")}},{"truncate-utf8-bytes":"jMN74"}],jMN74:[function(e,t,r){"use strict";var i=e("./lib/truncate"),n=e("utf8-byte-length/browser");t.exports=i.bind(null,n)},{"./lib/truncate":"16NPs","utf8-byte-length/browser":"3kc7b"}],"16NPs":[function(e,t,r){"use strict";function i(e){return e>=55296&&e<=56319}function n(e){return e>=56320&&e<=57343}t.exports=function(e,t,r){if("string"!=typeof t)throw new Error("Input must be string");for(var s,o,a=t.length,c=0,u=0;u<a;u+=1){if(s=t.charCodeAt(u),o=t[u],i(s)&&n(t.charCodeAt(u+1))&&(o+=t[u+=1]),(c+=e(o))===r)return t.slice(0,u+1);if(c>r)return t.slice(0,u-o.length+1)}return t}},{}],"3kc7b":[function(e,t,r){"use strict";function i(e){return e>=55296&&e<=56319}function n(e){return e>=56320&&e<=57343}t.exports=function(e){if("string"!=typeof e)throw new Error("Input must be string");for(var t=e.length,r=0,s=null,o=null,a=0;a<t;a++)n(s=e.charCodeAt(a))?null!=o&&i(o)?r+=1:r+=3:s<=127?r+=1:s>=128&&s<=2047?r+=2:s>=2048&&s<=65535&&(r+=3),o=s;return r}},{}],"2CEx0":[function(e,t,r){"use strict";e("node-forge/lib/pkcs7"),e("node-forge/lib/pbe");const i=e("node-forge/lib/forge"),{certificateForKey:n,findAsync:s}=e("./util"),o=e("err-code"),{fromString:a}=e("uint8arrays/from-string"),{toString:c}=e("uint8arrays/to-string"),u=new WeakMap;t.exports=class{constructor(e,t){if(!e)throw o(new Error("keychain is required"),"ERR_KEYCHAIN_REQUIRED");this.keychain=e,u.set(this,{dek:t})}async encrypt(e,t){if(!(t instanceof Uint8Array))throw o(new Error("Plain data must be a Uint8Array"),"ERR_INVALID_PARAMS");const r=await this.keychain.findKeyByName(e),s=await this.keychain._getPrivateKey(e),c=u.get(this).dek,l=i.pki.decryptRsaPrivateKey(s,c),d=await n(r,l),f=i.pkcs7.createEnvelopedData();f.addRecipient(d),f.content=i.util.createBuffer(t),f.encrypt();const h=i.asn1.toDer(f.toAsn1()).getBytes();return a(h,"ascii")}async decrypt(e){if(!(e instanceof Uint8Array))throw o(new Error("CMS data is required"),"ERR_INVALID_PARAMS");let t;try{const r=i.util.createBuffer(c(e,"ascii")),n=i.asn1.fromDer(r);t=i.pkcs7.messageFromAsn1(n)}catch(e){throw o(new Error("Invalid CMS: "+e.message),"ERR_INVALID_CMS")}const r=t.recipients.filter((e=>e.issuer.find((e=>"O"===e.shortName&&"ipfs"===e.value)))).filter((e=>e.issuer.find((e=>"CN"===e.shortName)))).map((e=>({recipient:e,keyId:e.issuer.find((e=>"CN"===e.shortName)).value}))),n=await s(r,(async e=>{try{if(await this.keychain.findKeyById(e.keyId))return!0}catch(e){return!1}return!1}));if(!n){const e=r.map((e=>e.keyId));throw o(new Error("Decryption needs one of the key(s): "+e.join(", ")),"ERR_MISSING_KEYS",{missingKeys:e})}const l=await this.keychain.findKeyById(n.keyId);if(!l)throw o(new Error("No key available to decrypto"),"ERR_NO_KEY");const d=await this.keychain._getPrivateKey(l.name),f=u.get(this).dek,h=i.pki.decryptRsaPrivateKey(d,f);return t.decrypt(n.recipient,h),a(t.content.getBytes(),"ascii")}}},{"node-forge/lib/pkcs7":"2u5SG","node-forge/lib/pbe":"gUP8s","node-forge/lib/forge":"4OuPD","./util":"hlA8C","err-code":"chZjB","uint8arrays/from-string":"dF7Y4","uint8arrays/to-string":"hC8JB"}],"2u5SG":[function(e,t,r){var i=e("./forge");e("./aes"),e("./asn1"),e("./des"),e("./oids"),e("./pem"),e("./pkcs7asn1"),e("./random"),e("./util"),e("./x509");var n=i.asn1,s=t.exports=i.pkcs7=i.pkcs7||{};function o(e){var t={},r=[];if(!n.validate(e,s.asn1.recipientInfoValidator,t,r)){var o=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw o.errors=r,o}return{version:t.version.charCodeAt(0),issuer:i.pki.RDNAttributesAsArray(t.issuer),serialNumber:i.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:n.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){for(var t,r=[],s=0;s<e.length;++s)r.push((t=e[s],n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(t.version).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[i.pki.distinguishedNameToAsn1({attributes:t.issuer}),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,i.util.hexToBytes(t.serialNumber))]),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.encryptedContent.algorithm).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,t.encryptedContent.content)])));return r}function c(e){var t=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(e.version).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[i.pki.distinguishedNameToAsn1({attributes:e.issuer}),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,i.util.hexToBytes(e.serialNumber))]),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.digestAlgorithm).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.signatureAlgorithm).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")])),t.value.push(n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var r=n.create(n.Class.CONTEXT_SPECIFIC,1,!0,[]),s=0;s<e.unauthenticatedAttributes.length;++s){var o=e.unauthenticatedAttributes[s];r.values.push(u(o))}t.value.push(r)}return t}function u(e){var t;if(e.type===i.pki.oids.contentType)t=n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.value).getBytes());else if(e.type===i.pki.oids.messageDigest)t=n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===i.pki.oids.signingTime){var r=new Date("1950-01-01T00:00:00Z"),s=new Date("2050-01-01T00:00:00Z"),o=e.value;if("string"==typeof o){var a=Date.parse(o);o=isNaN(a)?13===o.length?n.utcTimeToDate(o):n.generalizedTimeToDate(o):new Date(a)}t=o>=r&&o<s?n.create(n.Class.UNIVERSAL,n.Type.UTCTIME,!1,n.dateToUtcTime(o)):n.create(n.Class.UNIVERSAL,n.Type.GENERALIZEDTIME,!1,n.dateToGeneralizedTime(o))}return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.type).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SET,!0,[t])])}function l(e,t,r){var s={};if(!n.validate(t,r,s,[])){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw o.errors=o,o}if(n.derToOid(s.contentType)!==i.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(s.encryptedContent){var a="";if(i.util.isArray(s.encryptedContent))for(var c=0;c<s.encryptedContent.length;++c){if(s.encryptedContent[c].type!==n.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");a+=s.encryptedContent[c].value}else a=s.encryptedContent;e.encryptedContent={algorithm:n.derToOid(s.encAlgorithm),parameter:i.util.createBuffer(s.encParameter.value),content:i.util.createBuffer(a)}}if(s.content){a="";if(i.util.isArray(s.content))for(c=0;c<s.content.length;++c){if(s.content[c].type!==n.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");a+=s.content[c].value}else a=s.content;e.content=i.util.createBuffer(a)}return e.version=s.version.charCodeAt(0),e.rawCapture=s,s}function d(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case i.pki.oids["aes128-CBC"]:case i.pki.oids["aes192-CBC"]:case i.pki.oids["aes256-CBC"]:t=i.aes.createDecryptionCipher(e.encryptedContent.key);break;case i.pki.oids.desCBC:case i.pki.oids["des-EDE3-CBC"]:t=i.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}s.messageFromPem=function(e){var t=i.pem.decode(e)[0];if("PKCS7"!==t.type){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var o=n.fromDer(t.body);return s.messageFromAsn1(o)},s.messageToPem=function(e,t){var r={type:"PKCS7",body:n.toDer(e.toAsn1()).getBytes()};return i.pem.encode(r,{maxline:t})},s.messageFromAsn1=function(e){var t={},r=[];if(!n.validate(e,s.asn1.contentInfoValidator,t,r)){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw o.errors=r,o}var a,c=n.derToOid(t.contentType);switch(c){case i.pki.oids.envelopedData:a=s.createEnvelopedData();break;case i.pki.oids.encryptedData:a=s.createEncryptedData();break;case i.pki.oids.signedData:a=s.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+c+" is not (yet) supported.")}return a.fromAsn1(t.content.value[0]),a},s.createSignedData=function(){var e=null;return e={type:i.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(l(e,t,s.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var r=e.rawCapture.certificates.value,n=0;n<r.length;++n)e.certificates.push(i.pki.certificateFromAsn1(r[n]))},toAsn1:function(){e.contentInfo||e.sign();for(var t=[],r=0;r<e.certificates.length;++r)t.push(i.pki.certificateToAsn1(e.certificates[r]));var s=[],o=n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(e.version).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return t.length>0&&o.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!0,t)),s.length>0&&o.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,s)),o.value[0].value.push(n.create(n.Class.UNIVERSAL,n.Type.SET,!0,e.signerInfos)),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.type).getBytes()),o])},addSigner:function(t){var r=t.issuer,n=t.serialNumber;if(t.certificate){var s=t.certificate;"string"==typeof s&&(s=i.pki.certificateFromPem(s)),r=s.issuer.attributes,n=s.serialNumber}var o=t.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof o&&(o=i.pki.privateKeyFromPem(o));var a=t.digestAlgorithm||i.pki.oids.sha1;switch(a){case i.pki.oids.sha1:case i.pki.oids.sha256:case i.pki.oids.sha384:case i.pki.oids.sha512:case i.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var u=!1,l=!1,d=0;d<c.length;++d){var f=c[d];if(u||f.type!==i.pki.oids.contentType){if(l||f.type!==i.pki.oids.messageDigest);else if(l=!0,u)break}else if(u=!0,l)break}if(!u||!l)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:o,version:1,issuer:r,serialNumber:n,digestAlgorithm:a,signatureAlgorithm:i.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(t){var r;(t=t||{},"object"!=typeof e.content||null===e.contentInfo)&&(e.contentInfo=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.pki.oids.data).getBytes())]),"content"in e&&(e.content instanceof i.util.ByteBuffer?r=e.content.bytes():"string"==typeof e.content&&(r=i.util.encodeUtf8(e.content)),t.detached?e.detachedContent=n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,r):e.contentInfo.value.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,r)]))));0!==e.signers.length&&function(t){var r;r=e.detachedContent?e.detachedContent:(r=e.contentInfo.value[1]).value[0];if(!r)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var s=n.derToOid(e.contentInfo.value[0].value),o=n.toDer(r);for(var a in o.getByte(),n.getBerValueLength(o),o=o.getBytes(),t)t[a].start().update(o);for(var l=new Date,d=0;d<e.signers.length;++d){var f=e.signers[d];if(0===f.authenticatedAttributes.length){if(s!==i.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{f.authenticatedAttributesAsn1=n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var h=n.create(n.Class.UNIVERSAL,n.Type.SET,!0,[]),p=0;p<f.authenticatedAttributes.length;++p){var g=f.authenticatedAttributes[p];g.type===i.pki.oids.messageDigest?g.value=t[f.digestAlgorithm].digest():g.type===i.pki.oids.signingTime&&(g.value||(g.value=l)),h.value.push(u(g)),f.authenticatedAttributesAsn1.value.push(u(g))}o=n.toDer(h).getBytes(),f.md.start().update(o)}f.signature=f.key.sign(f.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(c(e[r]));return t}(e.signers)}(function(){for(var t={},r=0;r<e.signers.length;++r){var s=e.signers[r];(o=s.digestAlgorithm)in t||(t[o]=i.md[i.pki.oids[o]].create()),0===s.authenticatedAttributes.length?s.md=t[o]:s.md=i.md[i.pki.oids[o]].create()}for(var o in e.digestAlgorithmIdentifiers=[],t)e.digestAlgorithmIdentifiers.push(n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(o).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]));return t}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"==typeof t&&(t=i.pki.certificateFromPem(t)),e.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},s.createEncryptedData=function(){var e=null;return e={type:i.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:i.pki.oids["aes256-CBC"]},fromAsn1:function(t){l(e,t,s.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),d(e)}}},s.createEnvelopedData=function(){var e=null;return e={type:i.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:i.pki.oids["aes256-CBC"]},fromAsn1:function(t){var r=l(e,t,s.asn1.envelopedDataValidator);e.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(o(e[r]));return t}(r.recipientInfos.value)},toAsn1:function(){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.type).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(e.version).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SET,!0,a(e.recipients)),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,(t=e.encryptedContent,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.pki.oids.data).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.algorithm).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,t.parameter.getBytes())]),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,t.content.getBytes())])]))])])]);var t},findRecipient:function(t){for(var r=t.issuer.attributes,i=0;i<e.recipients.length;++i){var n=e.recipients[i],s=n.issuer;if(n.serialNumber===t.serialNumber&&s.length===r.length){for(var o=!0,a=0;a<r.length;++a)if(s[a].type!==r[a].type||s[a].value!==r[a].value){o=!1;break}if(o)return n}}return null},decrypt:function(t,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case i.pki.oids.rsaEncryption:case i.pki.oids.desCBC:var n=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=i.util.createBuffer(n);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}d(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:i.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===e.encryptedContent.content){var n,s,o;switch(r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key,r){case i.pki.oids["aes128-CBC"]:n=16,s=16,o=i.aes.createEncryptionCipher;break;case i.pki.oids["aes192-CBC"]:n=24,s=16,o=i.aes.createEncryptionCipher;break;case i.pki.oids["aes256-CBC"]:n=32,s=16,o=i.aes.createEncryptionCipher;break;case i.pki.oids["des-EDE3-CBC"]:n=24,s=8,o=i.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=i.util.createBuffer(i.random.getBytes(n));else if(t.length()!=n)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+n+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=i.util.createBuffer(i.random.getBytes(s));var a=o(t);if(a.start(e.encryptedContent.parameter.copy()),a.update(e.content),!a.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=a.output}for(var c=0;c<e.recipients.length;++c){var u=e.recipients[c];if(void 0===u.encryptedContent.content){if(u.encryptedContent.algorithm!==i.pki.oids.rsaEncryption)throw new Error("Unsupported asymmetric cipher, OID "+u.encryptedContent.algorithm);u.encryptedContent.content=u.encryptedContent.key.encrypt(e.encryptedContent.key.data)}}}}}},{"./forge":"4OuPD","./aes":"1SAd7","./asn1":"bcsXQ","./des":"6e2qD","./oids":"7VPL4","./pem":"9qqi9","./pkcs7asn1":"5EqCk","./random":"3tULm","./util":"df43p","./x509":"f2ToB"}],"5EqCk":[function(e,t,r){var i=e("./forge");e("./asn1"),e("./util");var n=i.asn1,s=t.exports=i.pkcs7asn1=i.pkcs7asn1||{};i.pkcs7=i.pkcs7||{},i.pkcs7.asn1=s;var o={name:"ContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};s.contentInfoValidator=o;var a={name:"EncryptedContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};s.envelopedDataValidator={name:"EnvelopedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},s.encryptedDataValidator={name:"EncryptedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var c={name:"SignerInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};s.signedDataValidator={name:"SignedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},o,{name:"SignedData.Certificates",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},s.recipientInfoValidator={name:"RecipientInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},{"./forge":"4OuPD","./asn1":"bcsXQ","./util":"df43p"}],f2ToB:[function(e,t,r){var i=e("./forge");e("./aes"),e("./asn1"),e("./des"),e("./md"),e("./mgf"),e("./oids"),e("./pem"),e("./pss"),e("./rsa"),e("./util");var n=i.asn1,s=t.exports=i.pki=i.pki||{},o=s.oids,a={};a.CN=o.commonName,a.commonName="CN",a.C=o.countryName,a.countryName="C",a.L=o.localityName,a.localityName="L",a.ST=o.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=o.organizationName,a.organizationName="O",a.OU=o.organizationalUnitName,a.organizationalUnitName="OU",a.E=o.emailAddress,a.emailAddress="E";var c=i.pki.rsa.publicKeyValidator,u={name:"Certificate",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:n.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:n.Class.UNIVERSAL,type:n.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:n.Class.UNIVERSAL,type:n.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:n.Class.UNIVERSAL,type:n.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:n.Class.UNIVERSAL,type:n.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},c,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:n.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:n.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:n.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},l={name:"rsapss",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:n.Class.UNIVERSAL,type:n.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:n.Class.UNIVERSAL,type:n.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:n.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:n.Class.UNIVERSAL,type:n.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:n.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:n.Class.UNIVERSAL,type:n.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},d={name:"CertificationRequestInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},c,{name:"CertificationRequestInfo.attributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0}]}]}]},f={name:"CertificationRequest",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[d,{name:"CertificationRequest.signatureAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:n.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function h(e,t){"string"==typeof t&&(t={shortName:t});for(var r,i=null,n=0;null===i&&n<e.attributes.length;++n)r=e.attributes[n],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(i=r);return i}s.RDNAttributesAsArray=function(e,t){for(var r,i,s,c=[],u=0;u<e.value.length;++u){r=e.value[u];for(var l=0;l<r.value.length;++l)s={},i=r.value[l],s.type=n.derToOid(i.value[0].value),s.value=i.value[1].value,s.valueTagClass=i.value[1].type,s.type in o&&(s.name=o[s.type],s.name in a&&(s.shortName=a[s.name])),t&&(t.update(s.type),t.update(s.value)),c.push(s)}return c},s.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var i=e[r],c=n.derToOid(i.value[0].value),u=i.value[1].value,l=0;l<u.length;++l){var d={};if(d.type=c,d.value=u[l].value,d.valueTagClass=u[l].type,d.type in o&&(d.name=o[d.type],d.name in a&&(d.shortName=a[d.name])),d.type===o.extensionRequest){d.extensions=[];for(var f=0;f<d.value.length;++f)d.extensions.push(s.certificateExtensionFromAsn1(d.value[f]))}t.push(d)}return t};var p=function(e,t,r){var i={};if(e!==o["RSASSA-PSS"])return i;r&&(i={hash:{algorithmOid:o.sha1},mgf:{algorithmOid:o.mgf1,hash:{algorithmOid:o.sha1}},saltLength:20});var s={},a=[];if(!n.validate(t,l,s,a)){var c=new Error("Cannot read RSASSA-PSS parameter block.");throw c.errors=a,c}return void 0!==s.hashOid&&(i.hash=i.hash||{},i.hash.algorithmOid=n.derToOid(s.hashOid)),void 0!==s.maskGenOid&&(i.mgf=i.mgf||{},i.mgf.algorithmOid=n.derToOid(s.maskGenOid),i.mgf.hash=i.mgf.hash||{},i.mgf.hash.algorithmOid=n.derToOid(s.maskGenHashOid)),void 0!==s.saltLength&&(i.saltLength=s.saltLength.charCodeAt(0)),i};function g(e){for(var t,r,s=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]),o=e.attributes,a=0;a<o.length;++a){var c=(t=o[a]).value,u=n.Type.PRINTABLESTRING;"valueTagClass"in t&&(u=t.valueTagClass)===n.Type.UTF8&&(c=i.util.encodeUtf8(c)),r=n.create(n.Class.UNIVERSAL,n.Type.SET,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.type).getBytes()),n.create(n.Class.UNIVERSAL,u,!1,c)])]),s.value.push(r)}return s}function y(e){for(var t,r=0;r<e.length;++r){if(void 0===(t=e[r]).name&&(t.type&&t.type in s.oids?t.name=s.oids[t.type]:t.shortName&&t.shortName in a&&(t.name=s.oids[a[t.shortName]])),void 0===t.type){if(!t.name||!(t.name in s.oids))throw(c=new Error("Attribute type not specified.")).attribute=t,c;t.type=s.oids[t.name]}if(void 0===t.shortName&&t.name&&t.name in a&&(t.shortName=a[t.name]),t.type===o.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=n.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var i=0;i<t.extensions.length;++i)t.value.push(s.certificateExtensionToAsn1(m(t.extensions[i])))}var c;if(void 0===t.value)throw(c=new Error("Attribute value not specified.")).attribute=t,c}}function m(e,t){if(t=t||{},void 0===e.name&&e.id&&e.id in s.oids&&(e.name=s.oids[e.id]),void 0===e.id){if(!e.name||!(e.name in s.oids))throw(_=new Error("Extension ID not specified.")).extension=e,_;e.id=s.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var r=0,a=0,c=0;e.digitalSignature&&(a|=128,r=7),e.nonRepudiation&&(a|=64,r=6),e.keyEncipherment&&(a|=32,r=5),e.dataEncipherment&&(a|=16,r=4),e.keyAgreement&&(a|=8,r=3),e.keyCertSign&&(a|=4,r=2),e.cRLSign&&(a|=2,r=1),e.encipherOnly&&(a|=1,r=0),e.decipherOnly&&(c|=128,r=7);var u=String.fromCharCode(r);0!==c?u+=String.fromCharCode(a)+String.fromCharCode(c):0!==a&&(u+=String.fromCharCode(a)),e.value=n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,u)}else if("basicConstraints"===e.name)e.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(n.create(n.Class.UNIVERSAL,n.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);var l=e.value.value;for(var d in e)!0===e[d]&&(d in o?l.push(n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(o[d]).getBytes())):-1!==d.indexOf(".")&&l.push(n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(d).getBytes())))}else if("nsCertType"===e.name){r=0,a=0;e.client&&(a|=128,r=7),e.server&&(a|=64,r=6),e.email&&(a|=32,r=5),e.objsign&&(a|=16,r=4),e.reserved&&(a|=8,r=3),e.sslCA&&(a|=4,r=2),e.emailCA&&(a|=2,r=1),e.objCA&&(a|=1,r=0);u=String.fromCharCode(r);0!==a&&(u+=String.fromCharCode(a)),e.value=n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,u)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);for(var f=0;f<e.altNames.length;++f){u=(b=e.altNames[f]).value;if(7===b.type&&b.ip){if(null===(u=i.util.bytesFromIP(b.ip)))throw(_=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,_}else 8===b.type&&(u=b.oid?n.oidToDer(n.oidToDer(b.oid)):n.oidToDer(u));e.value.value.push(n.create(n.Class.CONTEXT_SPECIFIC,b.type,!1,u))}}else if("nsComment"===e.name&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=n.create(n.Class.UNIVERSAL,n.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var h=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=h.toHex(),e.value=n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,h.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);l=e.value.value;if(e.keyIdentifier){var p=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!1,p))}if(e.authorityCertIssuer){var y=[n.create(n.Class.CONTEXT_SPECIFIC,4,!0,[g(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];l.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,y))}if(e.serialNumber){var m=i.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);l.push(n.create(n.Class.CONTEXT_SPECIFIC,2,!1,m))}}else if("cRLDistributionPoints"===e.name){e.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);l=e.value.value;var b,v=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]),w=n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[]);for(f=0;f<e.altNames.length;++f){u=(b=e.altNames[f]).value;if(7===b.type&&b.ip){if(null===(u=i.util.bytesFromIP(b.ip)))throw(_=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,_}else 8===b.type&&(u=b.oid?n.oidToDer(n.oidToDer(b.oid)):n.oidToDer(u));w.value.push(n.create(n.Class.CONTEXT_SPECIFIC,b.type,!1,u))}v.value.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[w])),l.push(v)}var _;if(void 0===e.value)throw(_=new Error("Extension value not specified.")).extension=e,_;return e}function b(e,t){if(e===o["RSASSA-PSS"]){var r=[];return void 0!==t.hash.algorithmOid&&r.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.hash.algorithmOid).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&r.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.mgf.algorithmOid).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.mgf.hash.algorithmOid).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&r.push(n.create(n.Class.CONTEXT_SPECIFIC,2,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(t.saltLength).getBytes())])),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,r)}return n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")}function v(e){var t=n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return t;for(var r=e.attributes,s=0;s<r.length;++s){var o=r[s],a=o.value,c=n.Type.UTF8;"valueTagClass"in o&&(c=o.valueTagClass),c===n.Type.UTF8&&(a=i.util.encodeUtf8(a));var u=!1;"valueConstructed"in o&&(u=o.valueConstructed);var l=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(o.type).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SET,!0,[n.create(n.Class.UNIVERSAL,c,u,a)])]);t.value.push(l)}return t}s.certificateFromPem=function(e,t,r){var o=i.pem.decode(e)[0];if("CERTIFICATE"!==o.type&&"X509 CERTIFICATE"!==o.type&&"TRUSTED CERTIFICATE"!==o.type){var a=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw a.headerType=o.type,a}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var c=n.fromDer(o.body,r);return s.certificateFromAsn1(c,t)},s.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:n.toDer(s.certificateToAsn1(e)).getBytes()};return i.pem.encode(r,{maxline:t})},s.publicKeyFromPem=function(e){var t=i.pem.decode(e)[0];if("PUBLIC KEY"!==t.type&&"RSA PUBLIC KEY"!==t.type){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var o=n.fromDer(t.body);return s.publicKeyFromAsn1(o)},s.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:n.toDer(s.publicKeyToAsn1(e)).getBytes()};return i.pem.encode(r,{maxline:t})},s.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:n.toDer(s.publicKeyToRSAPublicKey(e)).getBytes()};return i.pem.encode(r,{maxline:t})},s.getPublicKeyFingerprint=function(e,t){var r,o=(t=t||{}).md||i.md.sha1.create();switch(t.type||"RSAPublicKey"){case"RSAPublicKey":r=n.toDer(s.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=n.toDer(s.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}o.start(),o.update(r);var a=o.digest();if("hex"===t.encoding){var c=a.toHex();return t.delimiter?c.match(/.{2}/g).join(t.delimiter):c}if("binary"===t.encoding)return a.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return a},s.certificationRequestFromPem=function(e,t,r){var o=i.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==o.type){var a=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw a.headerType=o.type,a}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var c=n.fromDer(o.body,r);return s.certificationRequestFromAsn1(c,t)},s.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:n.toDer(s.certificationRequestToAsn1(e)).getBytes()};return i.pem.encode(r,{maxline:t})},s.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return h(e.issuer,t)},e.issuer.addField=function(t){y([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return h(e.subject,t)},e.subject.addField=function(t){y([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){y(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){y(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)m(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,i=null,n=0;null===i&&n<e.extensions.length;++n)r=e.extensions[n],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(i=r);return i},e.sign=function(t,r){e.md=r||i.md.sha1.create();var a=o[e.md.algorithm+"WithRSAEncryption"];if(!a){var c=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw c.algorithm=e.md.algorithm,c}e.signatureOid=e.siginfo.algorithmOid=a,e.tbsCertificate=s.getTBSCertificate(e);var u=n.toDer(e.tbsCertificate);e.md.update(u.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var a=t.issuer,c=e.subject;throw(g=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.")).expectedIssuer=a.attributes,g.actualIssuer=c.attributes,g}var u=t.md;if(null===u){if(t.signatureOid in o)switch(o[t.signatureOid]){case"sha1WithRSAEncryption":u=i.md.sha1.create();break;case"md5WithRSAEncryption":u=i.md.md5.create();break;case"sha256WithRSAEncryption":case"RSASSA-PSS":u=i.md.sha256.create();break;case"sha384WithRSAEncryption":u=i.md.sha384.create();break;case"sha512WithRSAEncryption":u=i.md.sha512.create()}if(null===u)throw(g=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=t.signatureOid,g;var l=t.tbsCertificate||s.getTBSCertificate(t),d=n.toDer(l);u.update(d.getBytes())}if(null!==u){var f;switch(t.signatureOid){case o.sha1WithRSAEncryption:f=void 0;break;case o["RSASSA-PSS"]:var h,p,g;if(void 0===(h=o[t.signatureParameters.mgf.hash.algorithmOid])||void 0===i.md[h])throw(g=new Error("Unsupported MGF hash function.")).oid=t.signatureParameters.mgf.hash.algorithmOid,g.name=h,g;if(void 0===(p=o[t.signatureParameters.mgf.algorithmOid])||void 0===i.mgf[p])throw(g=new Error("Unsupported MGF function.")).oid=t.signatureParameters.mgf.algorithmOid,g.name=p,g;if(p=i.mgf[p].create(i.md[h].create()),void 0===(h=o[t.signatureParameters.hash.algorithmOid])||void 0===i.md[h])throw{message:"Unsupported RSASSA-PSS hash function.",oid:t.signatureParameters.hash.algorithmOid,name:h};f=i.pss.create(i.md[h].create(),p,t.signatureParameters.saltLength)}r=e.publicKey.verify(u.digest().getBytes(),t.signature,f)}return r},e.isIssuer=function(t){var r=!1,i=e.issuer,n=t.subject;if(i.hash&&n.hash)r=i.hash===n.hash;else if(i.attributes.length===n.attributes.length){var s,o;r=!0;for(var a=0;r&&a<i.attributes.length;++a)s=i.attributes[a],o=n.attributes[a],s.type===o.type&&s.value===o.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return s.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=o.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var n=e.extensions[r];if(n.id===t){var s=e.generateSubjectKeyIdentifier().getBytes();return i.util.hexToBytes(n.subjectKeyIdentifier)===s}}return!1},e},s.certificateFromAsn1=function(e,t){var r={},a=[];if(!n.validate(e,u,r,a))throw(f=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.")).errors=a,f;if(n.derToOid(r.publicKeyOid)!==s.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=s.createCertificate();c.version=r.certVersion?r.certVersion.charCodeAt(0):0;var l=i.util.createBuffer(r.certSerialNumber);c.serialNumber=l.toHex(),c.signatureOid=i.asn1.derToOid(r.certSignatureOid),c.signatureParameters=p(c.signatureOid,r.certSignatureParams,!0),c.siginfo.algorithmOid=i.asn1.derToOid(r.certinfoSignatureOid),c.siginfo.parameters=p(c.siginfo.algorithmOid,r.certinfoSignatureParams,!1),c.signature=r.certSignature;var d=[];if(void 0!==r.certValidity1UTCTime&&d.push(n.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&d.push(n.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&d.push(n.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&d.push(n.generalizedTimeToDate(r.certValidity4GeneralizedTime)),d.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(d.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=d[0],c.validity.notAfter=d[1],c.tbsCertificate=r.tbsCertificate,t){var f;if(c.md=null,c.signatureOid in o)switch(o[c.signatureOid]){case"sha1WithRSAEncryption":c.md=i.md.sha1.create();break;case"md5WithRSAEncryption":c.md=i.md.md5.create();break;case"sha256WithRSAEncryption":case"RSASSA-PSS":c.md=i.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=i.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=i.md.sha512.create()}if(null===c.md)throw(f=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,f;var g=n.toDer(c.tbsCertificate);c.md.update(g.getBytes())}var m=i.md.sha1.create();c.issuer.getField=function(e){return h(c.issuer,e)},c.issuer.addField=function(e){y([e]),c.issuer.attributes.push(e)},c.issuer.attributes=s.RDNAttributesAsArray(r.certIssuer,m),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=m.digest().toHex();var b=i.md.sha1.create();return c.subject.getField=function(e){return h(c.subject,e)},c.subject.addField=function(e){y([e]),c.subject.attributes.push(e)},c.subject.attributes=s.RDNAttributesAsArray(r.certSubject,b),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=b.digest().toHex(),r.certExtensions?c.extensions=s.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=s.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},s.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var i=e.value[r],n=0;n<i.value.length;++n)t.push(s.certificateExtensionFromAsn1(i.value[n]));return t},s.certificateExtensionFromAsn1=function(e){var t={};if(t.id=n.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===n.Type.BOOLEAN?(t.critical=0!==e.value[1].value.charCodeAt(0),t.value=e.value[2].value):t.value=e.value[1].value,t.id in o)if(t.name=o[t.id],"keyUsage"===t.name){var r=0,s=0;(c=n.fromDer(t.value)).value.length>1&&(r=c.value.charCodeAt(1),s=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128==(128&r),t.nonRepudiation=64==(64&r),t.keyEncipherment=32==(32&r),t.dataEncipherment=16==(16&r),t.keyAgreement=8==(8&r),t.keyCertSign=4==(4&r),t.cRLSign=2==(2&r),t.encipherOnly=1==(1&r),t.decipherOnly=128==(128&s)}else if("basicConstraints"===t.name){(c=n.fromDer(t.value)).value.length>0&&c.value[0].type===n.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var a=null;c.value.length>0&&c.value[0].type===n.Type.INTEGER?a=c.value[0].value:c.value.length>1&&(a=c.value[1].value),null!==a&&(t.pathLenConstraint=n.derToInteger(a))}else if("extKeyUsage"===t.name)for(var c=n.fromDer(t.value),u=0;u<c.value.length;++u){var l=n.derToOid(c.value[u].value);l in o?t[o[l]]=!0:t[l]=!0}else if("nsCertType"===t.name){r=0;(c=n.fromDer(t.value)).value.length>1&&(r=c.value.charCodeAt(1)),t.client=128==(128&r),t.server=64==(64&r),t.email=32==(32&r),t.objsign=16==(16&r),t.reserved=8==(8&r),t.sslCA=4==(4&r),t.emailCA=2==(2&r),t.objCA=1==(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var d;t.altNames=[];c=n.fromDer(t.value);for(var f=0;f<c.value.length;++f){var h={type:(d=c.value[f]).type,value:d.value};switch(t.altNames.push(h),d.type){case 1:case 2:case 6:break;case 7:h.ip=i.util.bytesToIP(d.value);break;case 8:h.oid=n.derToOid(d.value)}}}else if("subjectKeyIdentifier"===t.name){c=n.fromDer(t.value);t.subjectKeyIdentifier=i.util.bytesToHex(c.value)}return t},s.certificationRequestFromAsn1=function(e,t){var r={},a=[];if(!n.validate(e,f,r,a))throw(u=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.")).errors=a,u;if(n.derToOid(r.publicKeyOid)!==s.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=s.createCertificationRequest();if(c.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,c.signatureOid=i.asn1.derToOid(r.csrSignatureOid),c.signatureParameters=p(c.signatureOid,r.csrSignatureParams,!0),c.siginfo.algorithmOid=i.asn1.derToOid(r.csrSignatureOid),c.siginfo.parameters=p(c.siginfo.algorithmOid,r.csrSignatureParams,!1),c.signature=r.csrSignature,c.certificationRequestInfo=r.certificationRequestInfo,t){var u;if(c.md=null,c.signatureOid in o)switch(o[c.signatureOid]){case"sha1WithRSAEncryption":c.md=i.md.sha1.create();break;case"md5WithRSAEncryption":c.md=i.md.md5.create();break;case"sha256WithRSAEncryption":case"RSASSA-PSS":c.md=i.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=i.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=i.md.sha512.create()}if(null===c.md)throw(u=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=c.signatureOid,u;var l=n.toDer(c.certificationRequestInfo);c.md.update(l.getBytes())}var d=i.md.sha1.create();return c.subject.getField=function(e){return h(c.subject,e)},c.subject.addField=function(e){y([e]),c.subject.attributes.push(e)},c.subject.attributes=s.RDNAttributesAsArray(r.certificationRequestInfoSubject,d),c.subject.hash=d.digest().toHex(),c.publicKey=s.publicKeyFromAsn1(r.subjectPublicKeyInfo),c.getAttribute=function(e){return h(c,e)},c.addAttribute=function(e){y([e]),c.attributes.push(e)},c.attributes=s.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),c},s.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return h(e.subject,t)},e.subject.addField=function(t){y([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return h(e,t)},e.addAttribute=function(t){y([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){y(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){y(t),e.attributes=t},e.sign=function(t,r){e.md=r||i.md.sha1.create();var a=o[e.md.algorithm+"WithRSAEncryption"];if(!a){var c=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw c.algorithm=e.md.algorithm,c}e.signatureOid=e.siginfo.algorithmOid=a,e.certificationRequestInfo=s.getCertificationRequestInfo(e);var u=n.toDer(e.certificationRequestInfo);e.md.update(u.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,r=e.md;if(null===r){if(e.signatureOid in o)switch(o[e.signatureOid]){case"sha1WithRSAEncryption":r=i.md.sha1.create();break;case"md5WithRSAEncryption":r=i.md.md5.create();break;case"sha256WithRSAEncryption":case"RSASSA-PSS":r=i.md.sha256.create();break;case"sha384WithRSAEncryption":r=i.md.sha384.create();break;case"sha512WithRSAEncryption":r=i.md.sha512.create()}if(null===r)throw(f=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=e.signatureOid,f;var a=e.certificationRequestInfo||s.getCertificationRequestInfo(e),c=n.toDer(a);r.update(c.getBytes())}if(null!==r){var u;switch(e.signatureOid){case o.sha1WithRSAEncryption:break;case o["RSASSA-PSS"]:var l,d,f;if(void 0===(l=o[e.signatureParameters.mgf.hash.algorithmOid])||void 0===i.md[l])throw(f=new Error("Unsupported MGF hash function.")).oid=e.signatureParameters.mgf.hash.algorithmOid,f.name=l,f;if(void 0===(d=o[e.signatureParameters.mgf.algorithmOid])||void 0===i.mgf[d])throw(f=new Error("Unsupported MGF function.")).oid=e.signatureParameters.mgf.algorithmOid,f.name=d,f;if(d=i.mgf[d].create(i.md[l].create()),void 0===(l=o[e.signatureParameters.hash.algorithmOid])||void 0===i.md[l])throw(f=new Error("Unsupported RSASSA-PSS hash function.")).oid=e.signatureParameters.hash.algorithmOid,f.name=l,f;u=i.pss.create(i.md[l].create(),d,e.signatureParameters.saltLength)}t=e.publicKey.verify(r.digest().getBytes(),e.signature,u)}return t},e};var w=new Date("1950-01-01T00:00:00Z"),_=new Date("2050-01-01T00:00:00Z");function E(e){return e>=w&&e<_?n.create(n.Class.UNIVERSAL,n.Type.UTCTIME,!1,n.dateToUtcTime(e)):n.create(n.Class.UNIVERSAL,n.Type.GENERALIZEDTIME,!1,n.dateToGeneralizedTime(e))}s.getTBSCertificate=function(e){var t=E(e.validity.notBefore),r=E(e.validity.notAfter),o=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(e.version).getBytes())]),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,i.util.hexToBytes(e.serialNumber)),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.siginfo.algorithmOid).getBytes()),b(e.siginfo.algorithmOid,e.siginfo.parameters)]),g(e.issuer),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[t,r]),g(e.subject),s.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&o.value.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,[n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&o.value.push(n.create(n.Class.CONTEXT_SPECIFIC,2,!0,[n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&o.value.push(s.certificateExtensionsToAsn1(e.extensions)),o},s.getCertificationRequestInfo=function(e){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(e.version).getBytes()),g(e.subject),s.publicKeyToAsn1(e.publicKey),v(e)])},s.distinguishedNameToAsn1=function(e){return g(e)},s.certificateToAsn1=function(e){var t=e.tbsCertificate||s.getTBSCertificate(e);return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[t,n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.signatureOid).getBytes()),b(e.signatureOid,e.signatureParameters)]),n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},s.certificateExtensionsToAsn1=function(e){var t=n.create(n.Class.CONTEXT_SPECIFIC,3,!0,[]),r=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);t.value.push(r);for(var i=0;i<e.length;++i)r.value.push(s.certificateExtensionToAsn1(e[i]));return t},s.certificateExtensionToAsn1=function(e){var t=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);t.value.push(n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.id).getBytes())),e.critical&&t.value.push(n.create(n.Class.UNIVERSAL,n.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return"string"!=typeof e.value&&(r=n.toDer(r).getBytes()),t.value.push(n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,r)),t},s.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||s.getCertificationRequestInfo(e);return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[t,n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.signatureOid).getBytes()),b(e.signatureOid,e.signatureParameters)]),n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},s.createCaStore=function(e){var t={certs:{}};function r(e){return o(e),t.certs[e.hash]||null}function o(e){if(!e.hash){var t=i.md.sha1.create();e.attributes=s.RDNAttributesAsArray(g(e),t),e.hash=t.digest().toHex()}}if(t.getIssuer=function(e){return r(e.issuer)},t.addCertificate=function(e){if("string"==typeof e&&(e=i.pki.certificateFromPem(e)),o(e.subject),!t.hasCertificate(e))if(e.subject.hash in t.certs){var r=t.certs[e.subject.hash];i.util.isArray(r)||(r=[r]),r.push(e),t.certs[e.subject.hash]=r}else t.certs[e.subject.hash]=e},t.hasCertificate=function(e){"string"==typeof e&&(e=i.pki.certificateFromPem(e));var t=r(e.subject);if(!t)return!1;i.util.isArray(t)||(t=[t]);for(var o=n.toDer(s.certificateToAsn1(e)).getBytes(),a=0;a<t.length;++a){if(o===n.toDer(s.certificateToAsn1(t[a])).getBytes())return!0}return!1},t.listAllCertificates=function(){var e=[];for(var r in t.certs)if(t.certs.hasOwnProperty(r)){var n=t.certs[r];if(i.util.isArray(n))for(var s=0;s<n.length;++s)e.push(n[s]);else e.push(n)}return e},t.removeCertificate=function(e){var a;if("string"==typeof e&&(e=i.pki.certificateFromPem(e)),o(e.subject),!t.hasCertificate(e))return null;var c=r(e.subject);if(!i.util.isArray(c))return a=t.certs[e.subject.hash],delete t.certs[e.subject.hash],a;for(var u=n.toDer(s.certificateToAsn1(e)).getBytes(),l=0;l<c.length;++l){u===n.toDer(s.certificateToAsn1(c[l])).getBytes()&&(a=c[l],c.splice(l,1))}return 0===c.length&&delete t.certs[e.subject.hash],a},e)for(var a=0;a<e.length;++a){var c=e[a];t.addCertificate(c)}return t},s.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},s.verifyCertificateChain=function(e,t,r){"function"==typeof r&&(r={verify:r}),r=r||{};var n=(t=t.slice(0)).slice(0),o=r.validityCheckDate;void 0===o&&(o=new Date);var a=!0,c=null,u=0;do{var l=t.shift(),d=null,f=!1;if(o&&(o<l.validity.notBefore||o>l.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:s.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:o}),null===c){if(null===(d=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(f=!0,d=l),d){var h=d;i.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){d=h.shift();try{p=d.verify(l)}catch(e){}}p||(c={message:"Certificate signature is invalid.",error:s.certificateError.bad_certificate})}null!==c||d&&!f||e.hasCertificate(l)||(c={message:"Certificate is not trusted.",error:s.certificateError.unknown_ca})}if(null===c&&d&&!l.isIssuer(d)&&(c={message:"Certificate issuer is invalid.",error:s.certificateError.bad_certificate}),null===c)for(var g={keyUsage:!0,basicConstraints:!0},y=0;null===c&&y<l.extensions.length;++y){var m=l.extensions[y];m.critical&&!(m.name in g)&&(c={message:"Certificate has an unsupported critical extension.",error:s.certificateError.unsupported_certificate})}if(null===c&&(!a||0===t.length&&(!d||f))){var b=l.getExtension("basicConstraints"),v=l.getExtension("keyUsage");if(null!==v&&(v.keyCertSign&&null!==b||(c={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:s.certificateError.bad_certificate})),null!==c||null===b||b.cA||(c={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:s.certificateError.bad_certificate}),null===c&&null!==v&&"pathLenConstraint"in b)u-1>b.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:s.certificateError.bad_certificate})}var w=null===c||c.error,_=r.verify?r.verify(w,u,n):w;if(!0!==_)throw!0===w&&(c={message:"The application rejected the certificate.",error:s.certificateError.bad_certificate}),(_||0===_)&&("object"!=typeof _||i.util.isArray(_)?"string"==typeof _&&(c.error=_):(_.message&&(c.message=_.message),_.error&&(c.error=_.error))),c;c=null,a=!1,++u}while(t.length>0);return!0}},{"./forge":"4OuPD","./aes":"1SAd7","./asn1":"bcsXQ","./des":"6e2qD","./md":"fYbz5","./mgf":"igoKv","./oids":"7VPL4","./pem":"9qqi9","./pss":"fYf6X","./rsa":"9ROH2","./util":"df43p"}],igoKv:[function(e,t,r){var i=e("./forge");e("./mgf1"),t.exports=i.mgf=i.mgf||{},i.mgf.mgf1=i.mgf1},{"./forge":"4OuPD","./mgf1":"d3pVa"}],d3pVa:[function(e,t,r){var i=e("./forge");e("./util"),i.mgf=i.mgf||{},(t.exports=i.mgf.mgf1=i.mgf1=i.mgf1||{}).create=function(e){return{generate:function(t,r){for(var n=new i.util.ByteBuffer,s=Math.ceil(r/e.digestLength),o=0;o<s;o++){var a=new i.util.ByteBuffer;a.putInt32(o),e.start(),e.update(t+a.getBytes()),n.putBuffer(e.digest())}return n.truncate(n.length()-r),n.getBytes()}}}},{"./forge":"4OuPD","./util":"df43p"}],fYf6X:[function(e,t,r){var i=e("./forge");e("./random"),e("./util"),(t.exports=i.pss=i.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,n=e.mgf,s=r.digestLength,o=e.salt||null;if("string"==typeof o&&(o=i.util.createBuffer(o)),"saltLength"in e)t=e.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");t=o.length()}if(null!==o&&o.length()!==t)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||i.random,c={encode:function(e,c){var u,l,d=c-1,f=Math.ceil(d/8),h=e.digest().getBytes();if(f<s+t+2)throw new Error("Message is too long to encrypt.");l=null===o?a.getBytesSync(t):o.bytes();var p=new i.util.ByteBuffer;p.fillWithByte(0,8),p.putBytes(h),p.putBytes(l),r.start(),r.update(p.getBytes());var g=r.digest().getBytes(),y=new i.util.ByteBuffer;y.fillWithByte(0,f-t-s-2),y.putByte(1),y.putBytes(l);var m=y.getBytes(),b=f-s-1,v=n.generate(g,b),w="";for(u=0;u<b;u++)w+=String.fromCharCode(m.charCodeAt(u)^v.charCodeAt(u));var _=65280>>8*f-d&255;return(w=String.fromCharCode(w.charCodeAt(0)&~_)+w.substr(1))+g+String.fromCharCode(188)},verify:function(e,o,a){var c,u=a-1,l=Math.ceil(u/8);if(o=o.substr(-l),l<s+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==o.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var d=l-s-1,f=o.substr(0,d),h=o.substr(d,s),p=65280>>8*l-u&255;if(0!=(f.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=n.generate(h,d),y="";for(c=0;c<d;c++)y+=String.fromCharCode(f.charCodeAt(c)^g.charCodeAt(c));y=String.fromCharCode(y.charCodeAt(0)&~p)+y.substr(1);var m=l-s-t-2;for(c=0;c<m;c++)if(0!==y.charCodeAt(c))throw new Error("Leftmost octets not zero as expected");if(1!==y.charCodeAt(m))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var b=y.substr(-t),v=new i.util.ByteBuffer;return v.fillWithByte(0,8),v.putBytes(e),v.putBytes(b),r.start(),r.update(v.getBytes()),h===r.digest().getBytes()}};return c}},{"./forge":"4OuPD","./random":"3tULm","./util":"df43p"}],hlA8C:[function(e,t,r){"use strict";e("node-forge/lib/x509");const i=e("node-forge/lib/forge").pki;t.exports={certificateForKey:(e,t)=>{const r=i.setRsaPublicKey(t.n,t.e),n=i.createCertificate();n.publicKey=r,n.serialNumber="01",n.validity.notBefore=new Date,n.validity.notAfter=new Date,n.validity.notAfter.setFullYear(n.validity.notBefore.getFullYear()+10);const s=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return n.setSubject(s),n.setIssuer(s),n.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),n.sign(t),n},findAsync:async function(e,t){const r=e.map(t);return e[(await Promise.all(r)).findIndex((e=>e))]}}},{"node-forge/lib/x509":"f2ToB","node-forge/lib/forge":"4OuPD"}],jy74B:[function(e,t,r){"use strict";const i=e("merge-options"),{pipe:n}=e("it-pipe"),{tap:s}=e("streaming-iterables"),o=e("./old-peers"),{METRICS:a}=e("../constants"),c=e("./stats"),u=["dataReceived","dataSent"],l={in:"dataReceived",out:"dataSent"};class d{constructor(e){this._options=i(a,e),this._globalStats=new c(u,this._options),this._peerStats=new Map,this._protocolStats=new Map,this._oldPeers=o(this._options.maxOldPeersRetention),this._running=!1,this._onMessage=this._onMessage.bind(this),this._connectionManager=e.connectionManager,this._connectionManager.on("peer:disconnect",(e=>{this.onPeerDisconnected(e.remotePeer)}))}start(){this._running=!0}stop(){this._running=!1,this._globalStats.stop();for(const e of this._peerStats.values())e.stop();for(const e of this._protocolStats.values())e.stop()}get global(){return this._globalStats}get peers(){return Array.from(this._peerStats.keys())}forPeer(e){const t=e.toB58String();return this._peerStats.get(t)||this._oldPeers.get(t)}get protocols(){return Array.from(this._protocolStats.keys())}forProtocol(e){return this._protocolStats.get(e)}onPeerDisconnected(e){const t=e.toB58String(),r=this._peerStats.get(t);r&&(r.stop(),this._peerStats.delete(t),this._oldPeers.set(t,r))}_onMessage({remotePeer:e,protocol:t,direction:r,dataLength:i}){if(!this._running)return;const n=l[r];let s=this.forPeer(e);if(s||(s=new c(u,this._options),this._peerStats.set(e.toB58String(),s)),s.push(n,i),this._globalStats.push(n,i),t){let e=this.forProtocol(t);e||(e=new c(u,this._options),this._protocolStats.set(t,e)),e.push(n,i)}}updatePlaceholder(e,t){if(!this._running)return;const r=this.forPeer(e),i=t.toB58String(),n=this.forPeer(t);let s=r;n&&(s=d.mergeStats(n,s),this._oldPeers.delete(i)),this._peerStats.delete(e.toB58String()),this._peerStats.set(i,s),s.start()}trackStream({stream:e,remotePeer:t,protocol:r}){const i=this,o=e.source;e.source=s((e=>i._onMessage({remotePeer:t,protocol:r,direction:"in",dataLength:e.length})))(o);const a=e.sink;return e.sink=e=>n(e,s((e=>i._onMessage({remotePeer:t,protocol:r,direction:"out",dataLength:e.length}))),a),e}static mergeStats(e,t){return e.stop(),t.stop(),e._queue=[...e._queue,...t._queue],e}}t.exports=d},{"merge-options":"fupyv","it-pipe":"giKBQ","streaming-iterables":"jrrai","./old-peers":"98TJE","../constants":"92Vak","./stats":"e6AW2"}],"98TJE":[function(e,t,r){"use strict";const i=e("hashlru");t.exports=e=>{const t=i(e);return t.delete=t.remove,t}},{hashlru:"kBj5c"}],e6AW2:[function(e,t,r){"use strict";const{EventEmitter:i}=e("events"),{BigNumber:n}=e("bignumber.js"),s=e("@vascosantos/moving-average"),o=e("retimer");t.exports=class extends i{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={dataReceived:n(0),dataSent:n(0)},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this);const r=this._options.movingAverageIntervals;for(let t=0;t<e.length;t++){const i=e[t];this._stats[i]=n(0),this._movingAverages[i]={};for(let e=0;e<r.length;e++){const t=r[e];(this._movingAverages[i][t]=s(t)).push(this._frequencyLastTime,0)}}}start(){this._queue.length&&this._resetComputeTimeout()}stop(){this._timeout&&(this._timeout.clear(),this._timeout=null)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}toJSON(){const e=this.snapshot,t=this.movingAverages,r={dataReceived:e.dataReceived.toString(),dataSent:e.dataSent.toString(),movingAverages:{}},i=Object.keys(t);for(const e of i){r.movingAverages[e]={};for(const i of Object.keys(t[e]))r.movingAverages[e][i]=t[e][i].movingAverage()}return r}push(e,t){this._queue.push([e,t,Date.now()]),this._resetComputeTimeout()}_resetComputeTimeout(){this._timeout=o(this._update,this._nextTimeout())}_nextTimeout(){const e=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-e),0)}_update(){if(this._timeout=null,this._queue.length){let e;for(e of this._queue)this._applyOp(e);this._queue=[],this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){const t=e-this._frequencyLastTime;Object.keys(this._stats).forEach((r=>{this._updateFrequencyFor(r,t,e)})),this._frequencyLastTime=e}_updateFrequencyFor(e,t,r){const i=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const n=i/(t||1)*1e3;let o=this._movingAverages[e];o||(o=this._movingAverages[e]={});const a=this._options.movingAverageIntervals;for(let e=0;e<a.length;e++){const t=a[e];let i=o[t];i||(i=o[t]=s(t)),i.push(r,n)}}_applyOp(e){const t=e[0],r=e[1];if("number"!=typeof r)throw new Error(`invalid increment number: ${r}`);let i;i=Object.prototype.hasOwnProperty.call(this._stats,t)?this._stats[t]:this._stats[t]=n(0),this._stats[t]=i.plus(r),this._frequencyAccumulators[t]||(this._frequencyAccumulators[t]=0),this._frequencyAccumulators[t]+=r}}},{events:"g82pp","bignumber.js":"kKGdq","@vascosantos/moving-average":"2F3Pq",retimer:"8W3r3"}],kKGdq:[function(e,t,r){!function(e){var r,i=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,s=Math.floor,o="[BigNumber Error] ",a=o+"Number primitive has more than 15 significant digits: ",c=1e14,u=14,l=9007199254740991,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],f=1e7,h=1e9;function p(e){var t=0|e;return e>0||e===t?t:t-1}function g(e){for(var t,r,i=1,n=e.length,s=e[0]+"";i<n;){for(t=e[i++]+"",r=u-t.length;r--;t="0"+t);s+=t}for(n=s.length;48===s.charCodeAt(--n););return s.slice(0,n+1||1)}function y(e,t){var r,i,n=e.c,s=t.c,o=e.s,a=t.s,c=e.e,u=t.e;if(!o||!a)return null;if(r=n&&!n[0],i=s&&!s[0],r||i)return r?i?0:-a:o;if(o!=a)return o;if(r=o<0,i=c==u,!n||!s)return i?0:!n^r?1:-1;if(!i)return c>u^r?1:-1;for(a=(c=n.length)<(u=s.length)?c:u,o=0;o<a;o++)if(n[o]!=s[o])return n[o]>s[o]^r?1:-1;return c==u?0:c>u^r?1:-1}function m(e,t,r,i){if(e<t||e>r||e!==s(e))throw Error(o+(i||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function b(e){var t=e.c.length-1;return p(e.e/u)==t&&e.c[t]%2!=0}function v(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function w(e,t,r){var i,n;if(t<0){for(n=r+".";++t;n+=r);e=n+e}else if(++t>(i=e.length)){for(n=r,t-=i;--t;n+=r);e+=n}else t<i&&(e=e.slice(0,t)+"."+e.slice(t));return e}r=function e(t){var r,_,E,S,T,A,k,I,R,P,O=V.prototype={constructor:V,toString:null,valueOf:null},C=new V(1),j=20,D=4,M=-7,x=21,B=-1e7,L=1e7,N=!1,U=1,F=0,K={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},z="0123456789abcdefghijklmnopqrstuvwxyz";function V(e,t){var r,n,o,c,d,f,h,p,g=this;if(!(g instanceof V))return new V(e,t);if(null==t){if(e&&!0===e._isBigNumber)return g.s=e.s,void(!e.c||e.e>L?g.c=g.e=null:e.e<B?g.c=[g.e=0]:(g.e=e.e,g.c=e.c.slice()));if((f="number"==typeof e)&&0*e==0){if(g.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,d=e;d>=10;d/=10,c++);return void(c>L?g.c=g.e=null:(g.e=c,g.c=[e]))}p=String(e)}else{if(!i.test(p=String(e)))return E(g,p,f);g.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(c=p.indexOf("."))>-1&&(p=p.replace(".","")),(d=p.search(/e/i))>0?(c<0&&(c=d),c+=+p.slice(d+1),p=p.substring(0,d)):c<0&&(c=p.length)}else{if(m(t,2,z.length,"Base"),10==t)return $(g=new V(e),j+g.e+1,D);if(p=String(e),f="number"==typeof e){if(0*e!=0)return E(g,p,f,t);if(g.s=1/e<0?(p=p.slice(1),-1):1,V.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(a+e)}else g.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(r=z.slice(0,t),c=d=0,h=p.length;d<h;d++)if(r.indexOf(n=p.charAt(d))<0){if("."==n){if(d>c){c=h;continue}}else if(!o&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){o=!0,d=-1,c=0;continue}return E(g,String(e),f,t)}f=!1,(c=(p=_(p,t,10,g.s)).indexOf("."))>-1?p=p.replace(".",""):c=p.length}for(d=0;48===p.charCodeAt(d);d++);for(h=p.length;48===p.charCodeAt(--h););if(p=p.slice(d,++h)){if(h-=d,f&&V.DEBUG&&h>15&&(e>l||e!==s(e)))throw Error(a+g.s*e);if((c=c-d-1)>L)g.c=g.e=null;else if(c<B)g.c=[g.e=0];else{if(g.e=c,g.c=[],d=(c+1)%u,c<0&&(d+=u),d<h){for(d&&g.c.push(+p.slice(0,d)),h-=u;d<h;)g.c.push(+p.slice(d,d+=u));d=u-(p=p.slice(d)).length}else d-=h;for(;d--;p+="0");g.c.push(+p)}}else g.c=[g.e=0]}function q(e,t,r,i){var n,s,o,a,c;if(null==r?r=D:m(r,0,8),!e.c)return e.toString();if(n=e.c[0],o=e.e,null==t)c=g(e.c),c=1==i||2==i&&(o<=M||o>=x)?v(c,o):w(c,o,"0");else if(s=(e=$(new V(e),t,r)).e,a=(c=g(e.c)).length,1==i||2==i&&(t<=s||s<=M)){for(;a<t;c+="0",a++);c=v(c,s)}else if(t-=o,c=w(c,s,"0"),s+1>a){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=s-a)>0)for(s+1==a&&(c+=".");t--;c+="0");return e.s<0&&n?"-"+c:c}function G(e,t){for(var r,i=1,n=new V(e[0]);i<e.length;i++){if(!(r=new V(e[i])).s){n=r;break}t.call(n,r)&&(n=r)}return n}function H(e,t,r){for(var i=1,n=t.length;!t[--n];t.pop());for(n=t[0];n>=10;n/=10,i++);return(r=i+r*u-1)>L?e.c=e.e=null:r<B?e.c=[e.e=0]:(e.e=r,e.c=t),e}function $(e,t,r,i){var o,a,l,f,h,p,g,y=e.c,m=d;if(y){e:{for(o=1,f=y[0];f>=10;f/=10,o++);if((a=t-o)<0)a+=u,l=t,g=(h=y[p=0])/m[o-l-1]%10|0;else if((p=n((a+1)/u))>=y.length){if(!i)break e;for(;y.length<=p;y.push(0));h=g=0,o=1,l=(a%=u)-u+1}else{for(h=f=y[p],o=1;f>=10;f/=10,o++);g=(l=(a%=u)-u+o)<0?0:h/m[o-l-1]%10|0}if(i=i||t<0||null!=y[p+1]||(l<0?h:h%m[o-l-1]),i=r<4?(g||i)&&(0==r||r==(e.s<0?3:2)):g>5||5==g&&(4==r||i||6==r&&(a>0?l>0?h/m[o-l]:0:y[p-1])%10&1||r==(e.s<0?8:7)),t<1||!y[0])return y.length=0,i?(t-=e.e+1,y[0]=m[(u-t%u)%u],e.e=-t||0):y[0]=e.e=0,e;if(0==a?(y.length=p,f=1,p--):(y.length=p+1,f=m[u-a],y[p]=l>0?s(h/m[o-l]%m[l])*f:0),i)for(;;){if(0==p){for(a=1,l=y[0];l>=10;l/=10,a++);for(l=y[0]+=f,f=1;l>=10;l/=10,f++);a!=f&&(e.e++,y[0]==c&&(y[0]=1));break}if(y[p]+=f,y[p]!=c)break;y[p--]=0,f=1}for(a=y.length;0===y[--a];y.pop());}e.e>L?e.c=e.e=null:e.e<B&&(e.c=[e.e=0])}return e}function W(e){var t,r=e.e;return null===r?e.toString():(t=g(e.c),t=r<=M||r>=x?v(t,r):w(t,r,"0"),e.s<0?"-"+t:t)}return V.clone=e,V.ROUND_UP=0,V.ROUND_DOWN=1,V.ROUND_CEIL=2,V.ROUND_FLOOR=3,V.ROUND_HALF_UP=4,V.ROUND_HALF_DOWN=5,V.ROUND_HALF_EVEN=6,V.ROUND_HALF_CEIL=7,V.ROUND_HALF_FLOOR=8,V.EUCLID=9,V.config=V.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(o+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(m(r=e[t],0,h,t),j=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(m(r=e[t],0,8,t),D=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(m(r[0],-h,0,t),m(r[1],0,h,t),M=r[0],x=r[1]):(m(r,-h,h,t),M=-(x=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)m(r[0],-h,-1,t),m(r[1],1,h,t),B=r[0],L=r[1];else{if(m(r,-h,h,t),!r)throw Error(o+t+" cannot be zero: "+r);B=-(L=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(o+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw N=!r,Error(o+"crypto unavailable");N=r}else N=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(m(r=e[t],0,9,t),U=r),e.hasOwnProperty(t="POW_PRECISION")&&(m(r=e[t],0,h,t),F=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(o+t+" not an object: "+r);K=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(o+t+" invalid: "+r);z=r}}return{DECIMAL_PLACES:j,ROUNDING_MODE:D,EXPONENTIAL_AT:[M,x],RANGE:[B,L],CRYPTO:N,MODULO_MODE:U,POW_PRECISION:F,FORMAT:K,ALPHABET:z}},V.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!V.DEBUG)return!0;var t,r,i=e.c,n=e.e,a=e.s;e:if("[object Array]"=={}.toString.call(i)){if((1===a||-1===a)&&n>=-h&&n<=h&&n===s(n)){if(0===i[0]){if(0===n&&1===i.length)return!0;break e}if((t=(n+1)%u)<1&&(t+=u),String(i[0]).length==t){for(t=0;t<i.length;t++)if((r=i[t])<0||r>=c||r!==s(r))break e;if(0!==r)return!0}}}else if(null===i&&null===n&&(null===a||1===a||-1===a))return!0;throw Error(o+"Invalid BigNumber: "+e)},V.maximum=V.max=function(){return G(arguments,O.lt)},V.minimum=V.min=function(){return G(arguments,O.gt)},V.random=(S=9007199254740992,T=Math.random()*S&2097151?function(){return s(Math.random()*S)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,i,a,c,l=0,f=[],p=new V(C);if(null==e?e=j:m(e,0,h),a=n(e/u),N)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(a*=2));l<a;)(c=131072*t[l]+(t[l+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[l]=r[0],t[l+1]=r[1]):(f.push(c%1e14),l+=2);l=a/2}else{if(!crypto.randomBytes)throw N=!1,Error(o+"crypto unavailable");for(t=crypto.randomBytes(a*=7);l<a;)(c=281474976710656*(31&t[l])+1099511627776*t[l+1]+4294967296*t[l+2]+16777216*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(f.push(c%1e14),l+=7);l=a/7}if(!N)for(;l<a;)(c=T())<9e15&&(f[l++]=c%1e14);for(a=f[--l],e%=u,a&&e&&(c=d[u-e],f[l]=s(a/c)*c);0===f[l];f.pop(),l--);if(l<0)f=[i=0];else{for(i=-1;0===f[0];f.splice(0,1),i-=u);for(l=1,c=f[0];c>=10;c/=10,l++);l<u&&(i-=u-l)}return p.e=i,p.c=f,p}),V.sum=function(){for(var e=1,t=arguments,r=new V(t[0]);e<t.length;)r=r.plus(t[e++]);return r},_=function(){var e="0123456789";function t(e,t,r,i){for(var n,s,o=[0],a=0,c=e.length;a<c;){for(s=o.length;s--;o[s]*=t);for(o[0]+=i.indexOf(e.charAt(a++)),n=0;n<o.length;n++)o[n]>r-1&&(null==o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}return function(i,n,s,o,a){var c,u,l,d,f,h,p,y,m=i.indexOf("."),b=j,v=D;for(m>=0&&(d=F,F=0,i=i.replace(".",""),h=(y=new V(n)).pow(i.length-m),F=d,y.c=t(w(g(h.c),h.e,"0"),10,s,e),y.e=y.c.length),l=d=(p=t(i,n,s,a?(c=z,e):(c=e,z))).length;0==p[--d];p.pop());if(!p[0])return c.charAt(0);if(m<0?--l:(h.c=p,h.e=l,h.s=o,p=(h=r(h,y,b,v,s)).c,f=h.r,l=h.e),m=p[u=l+b+1],d=s/2,f=f||u<0||null!=p[u+1],f=v<4?(null!=m||f)&&(0==v||v==(h.s<0?3:2)):m>d||m==d&&(4==v||f||6==v&&1&p[u-1]||v==(h.s<0?8:7)),u<1||!p[0])i=f?w(c.charAt(1),-b,c.charAt(0)):c.charAt(0);else{if(p.length=u,f)for(--s;++p[--u]>s;)p[u]=0,u||(++l,p=[1].concat(p));for(d=p.length;!p[--d];);for(m=0,i="";m<=d;i+=c.charAt(p[m++]));i=w(i,l,c.charAt(0))}return i}}(),r=function(){function e(e,t,r){var i,n,s,o,a=0,c=e.length,u=t%f,l=t/f|0;for(e=e.slice();c--;)a=((n=u*(s=e[c]%f)+(i=l*s+(o=e[c]/f|0)*u)%f*f+a)/r|0)+(i/f|0)+l*o,e[c]=n%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,i){var n,s;if(r!=i)s=r>i?1:-1;else for(n=s=0;n<r;n++)if(e[n]!=t[n]){s=e[n]>t[n]?1:-1;break}return s}function r(e,t,r,i){for(var n=0;r--;)e[r]-=n,n=e[r]<t[r]?1:0,e[r]=n*i+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,n,o,a,l){var d,f,h,g,y,m,b,v,w,_,E,S,T,A,k,I,R,P=i.s==n.s?1:-1,O=i.c,C=n.c;if(!(O&&O[0]&&C&&C[0]))return new V(i.s&&n.s&&(O?!C||O[0]!=C[0]:C)?O&&0==O[0]||!C?0*P:P/0:NaN);for(w=(v=new V(P)).c=[],P=o+(f=i.e-n.e)+1,l||(l=c,f=p(i.e/u)-p(n.e/u),P=P/u|0),h=0;C[h]==(O[h]||0);h++);if(C[h]>(O[h]||0)&&f--,P<0)w.push(1),g=!0;else{for(A=O.length,I=C.length,h=0,P+=2,(y=s(l/(C[0]+1)))>1&&(C=e(C,y,l),O=e(O,y,l),I=C.length,A=O.length),T=I,E=(_=O.slice(0,I)).length;E<I;_[E++]=0);R=C.slice(),R=[0].concat(R),k=C[0],C[1]>=l/2&&k++;do{if(y=0,(d=t(C,_,I,E))<0){if(S=_[0],I!=E&&(S=S*l+(_[1]||0)),(y=s(S/k))>1)for(y>=l&&(y=l-1),b=(m=e(C,y,l)).length,E=_.length;1==t(m,_,b,E);)y--,r(m,I<b?R:C,b,l),b=m.length,d=1;else 0==y&&(d=y=1),b=(m=C.slice()).length;if(b<E&&(m=[0].concat(m)),r(_,m,E,l),E=_.length,-1==d)for(;t(C,_,I,E)<1;)y++,r(_,I<E?R:C,E,l),E=_.length}else 0===d&&(y++,_=[0]);w[h++]=y,_[0]?_[E++]=O[T]||0:(_=[O[T]],E=1)}while((T++<A||null!=_[0])&&P--);g=null!=_[0],w[0]||w.splice(0,1)}if(l==c){for(h=1,P=w[0];P>=10;P/=10,h++);$(v,o+(v.e=h+f*u-1)+1,a,g)}else v.e=f,v.r=+g;return v}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,k=/^([^.]+)\.$/,I=/^\.([^.]+)$/,R=/^-?(Infinity|NaN)$/,P=/^\s*\+(?=[\w.])|^\s+|\s+$/g,E=function(e,t,r,i){var n,s=r?t:t.replace(P,"");if(R.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(A,(function(e,t,r){return n="x"==(r=r.toLowerCase())?16:"b"==r?2:8,i&&i!=n?e:t})),i&&(n=i,s=s.replace(k,"$1").replace(I,"0.$1")),t!=s))return new V(s,n);if(V.DEBUG)throw Error(o+"Not a"+(i?" base "+i:"")+" number: "+t);e.s=null}e.c=e.e=null},O.absoluteValue=O.abs=function(){var e=new V(this);return e.s<0&&(e.s=1),e},O.comparedTo=function(e,t){return y(this,new V(e,t))},O.decimalPlaces=O.dp=function(e,t){var r,i,n,s=this;if(null!=e)return m(e,0,h),null==t?t=D:m(t,0,8),$(new V(s),e+s.e+1,t);if(!(r=s.c))return null;if(i=((n=r.length-1)-p(this.e/u))*u,n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},O.dividedBy=O.div=function(e,t){return r(this,new V(e,t),j,D)},O.dividedToIntegerBy=O.idiv=function(e,t){return r(this,new V(e,t),0,1)},O.exponentiatedBy=O.pow=function(e,t){var r,i,a,c,l,d,f,h,p=this;if((e=new V(e)).c&&!e.isInteger())throw Error(o+"Exponent not an integer: "+W(e));if(null!=t&&(t=new V(t)),l=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new V(Math.pow(+W(p),l?2-b(e):+W(e))),t?h.mod(t):h;if(d=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new V(NaN);(i=!d&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return c=p.s<0&&b(e)?-0:0,p.e>-1&&(c=1/c),new V(d?1/c:c);F&&(c=n(F/u+2))}for(l?(r=new V(.5),d&&(e.s=1),f=b(e)):f=(a=Math.abs(+W(e)))%2,h=new V(C);;){if(f){if(!(h=h.times(p)).c)break;c?h.c.length>c&&(h.c.length=c):i&&(h=h.mod(t))}if(a){if(0===(a=s(a/2)))break;f=a%2}else if($(e=e.times(r),e.e+1,1),e.e>14)f=b(e);else{if(0===(a=+W(e)))break;f=a%2}p=p.times(p),c?p.c&&p.c.length>c&&(p.c.length=c):i&&(p=p.mod(t))}return i?h:(d&&(h=C.div(h)),t?h.mod(t):c?$(h,F,D,undefined):h)},O.integerValue=function(e){var t=new V(this);return null==e?e=D:m(e,0,8),$(t,t.e+1,e)},O.isEqualTo=O.eq=function(e,t){return 0===y(this,new V(e,t))},O.isFinite=function(){return!!this.c},O.isGreaterThan=O.gt=function(e,t){return y(this,new V(e,t))>0},O.isGreaterThanOrEqualTo=O.gte=function(e,t){return 1===(t=y(this,new V(e,t)))||0===t},O.isInteger=function(){return!!this.c&&p(this.e/u)>this.c.length-2},O.isLessThan=O.lt=function(e,t){return y(this,new V(e,t))<0},O.isLessThanOrEqualTo=O.lte=function(e,t){return-1===(t=y(this,new V(e,t)))||0===t},O.isNaN=function(){return!this.s},O.isNegative=function(){return this.s<0},O.isPositive=function(){return this.s>0},O.isZero=function(){return!!this.c&&0==this.c[0]},O.minus=function(e,t){var r,i,n,s,o=this,a=o.s;if(t=(e=new V(e,t)).s,!a||!t)return new V(NaN);if(a!=t)return e.s=-t,o.plus(e);var l=o.e/u,d=e.e/u,f=o.c,h=e.c;if(!l||!d){if(!f||!h)return f?(e.s=-t,e):new V(h?o:NaN);if(!f[0]||!h[0])return h[0]?(e.s=-t,e):new V(f[0]?o:3==D?-0:0)}if(l=p(l),d=p(d),f=f.slice(),a=l-d){for((s=a<0)?(a=-a,n=f):(d=l,n=h),n.reverse(),t=a;t--;n.push(0));n.reverse()}else for(i=(s=(a=f.length)<(t=h.length))?a:t,a=t=0;t<i;t++)if(f[t]!=h[t]){s=f[t]<h[t];break}if(s&&(n=f,f=h,h=n,e.s=-e.s),(t=(i=h.length)-(r=f.length))>0)for(;t--;f[r++]=0);for(t=c-1;i>a;){if(f[--i]<h[i]){for(r=i;r&&!f[--r];f[r]=t);--f[r],f[i]+=c}f[i]-=h[i]}for(;0==f[0];f.splice(0,1),--d);return f[0]?H(e,f,d):(e.s=3==D?-1:1,e.c=[e.e=0],e)},O.modulo=O.mod=function(e,t){var i,n,s=this;return e=new V(e,t),!s.c||!e.s||e.c&&!e.c[0]?new V(NaN):!e.c||s.c&&!s.c[0]?new V(s):(9==U?(n=e.s,e.s=1,i=r(s,e,0,3),e.s=n,i.s*=n):i=r(s,e,0,U),(e=s.minus(i.times(e))).c[0]||1!=U||(e.s=s.s),e)},O.multipliedBy=O.times=function(e,t){var r,i,n,s,o,a,l,d,h,g,y,m,b,v,w,_=this,E=_.c,S=(e=new V(e,t)).c;if(!(E&&S&&E[0]&&S[0]))return!_.s||!e.s||E&&!E[0]&&!S||S&&!S[0]&&!E?e.c=e.e=e.s=null:(e.s*=_.s,E&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(i=p(_.e/u)+p(e.e/u),e.s*=_.s,(l=E.length)<(g=S.length)&&(b=E,E=S,S=b,n=l,l=g,g=n),n=l+g,b=[];n--;b.push(0));for(v=c,w=f,n=g;--n>=0;){for(r=0,y=S[n]%w,m=S[n]/w|0,s=n+(o=l);s>n;)r=((d=y*(d=E[--o]%w)+(a=m*d+(h=E[o]/w|0)*y)%w*w+b[s]+r)/v|0)+(a/w|0)+m*h,b[s--]=d%v;b[s]=r}return r?++i:b.splice(0,1),H(e,b,i)},O.negated=function(){var e=new V(this);return e.s=-e.s||null,e},O.plus=function(e,t){var r,i=this,n=i.s;if(t=(e=new V(e,t)).s,!n||!t)return new V(NaN);if(n!=t)return e.s=-t,i.minus(e);var s=i.e/u,o=e.e/u,a=i.c,l=e.c;if(!s||!o){if(!a||!l)return new V(n/0);if(!a[0]||!l[0])return l[0]?e:new V(a[0]?i:0*n)}if(s=p(s),o=p(o),a=a.slice(),n=s-o){for(n>0?(o=s,r=l):(n=-n,r=a),r.reverse();n--;r.push(0));r.reverse()}for((n=a.length)-(t=l.length)<0&&(r=l,l=a,a=r,t=n),n=0;t;)n=(a[--t]=a[t]+l[t]+n)/c|0,a[t]=c===a[t]?0:a[t]%c;return n&&(a=[n].concat(a),++o),H(e,a,o)},O.precision=O.sd=function(e,t){var r,i,n,s=this;if(null!=e&&e!==!!e)return m(e,1,h),null==t?t=D:m(t,0,8),$(new V(s),e,t);if(!(r=s.c))return null;if(i=(n=r.length-1)*u+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return e&&s.e+1>i&&(i=s.e+1),i},O.shiftedBy=function(e){return m(e,-9007199254740991,l),this.times("1e"+e)},O.squareRoot=O.sqrt=function(){var e,t,i,n,s,o=this,a=o.c,c=o.s,u=o.e,l=j+4,d=new V("0.5");if(1!==c||!a||!a[0])return new V(!c||c<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(c=Math.sqrt(+W(o)))||c==1/0?(((t=g(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=p((u+1)/2)-(u<0||u%2),i=new V(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):i=new V(c+""),i.c[0])for((c=(u=i.e)+l)<3&&(c=0);;)if(s=i,i=d.times(s.plus(r(o,s,l,1))),g(s.c).slice(0,c)===(t=g(i.c)).slice(0,c)){if(i.e<u&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||($(i,i.e+j+2,1),e=!i.times(i).eq(o));break}if(!n&&($(s,s.e+j+2,0),s.times(s).eq(o))){i=s;break}l+=4,c+=4,n=1}return $(i,i.e+j+1,D,e)},O.toExponential=function(e,t){return null!=e&&(m(e,0,h),e++),q(this,e,t,1)},O.toFixed=function(e,t){return null!=e&&(m(e,0,h),e=e+this.e+1),q(this,e,t)},O.toFormat=function(e,t,r){var i,n=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=K;else if("object"!=typeof r)throw Error(o+"Argument not an object: "+r);if(i=n.toFixed(e,t),n.c){var s,a=i.split("."),c=+r.groupSize,u=+r.secondaryGroupSize,l=r.groupSeparator||"",d=a[0],f=a[1],h=n.s<0,p=h?d.slice(1):d,g=p.length;if(u&&(s=c,c=u,u=s,g-=s),c>0&&g>0){for(s=g%c||c,d=p.substr(0,s);s<g;s+=c)d+=l+p.substr(s,c);u>0&&(d+=l+p.slice(s)),h&&(d="-"+d)}i=f?d+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?f.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):d}return(r.prefix||"")+i+(r.suffix||"")},O.toFraction=function(e){var t,i,n,s,a,c,l,f,h,p,y,m,b=this,v=b.c;if(null!=e&&(!(l=new V(e)).isInteger()&&(l.c||1!==l.s)||l.lt(C)))throw Error(o+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+W(l));if(!v)return new V(b);for(t=new V(C),h=i=new V(C),n=f=new V(C),m=g(v),a=t.e=m.length-b.e-1,t.c[0]=d[(c=a%u)<0?u+c:c],e=!e||l.comparedTo(t)>0?a>0?t:h:l,c=L,L=1/0,l=new V(m),f.c[0]=0;p=r(l,t,0,1),1!=(s=i.plus(p.times(n))).comparedTo(e);)i=n,n=s,h=f.plus(p.times(s=h)),f=s,t=l.minus(p.times(s=t)),l=s;return s=r(e.minus(i),n,0,1),f=f.plus(s.times(h)),i=i.plus(s.times(n)),f.s=h.s=b.s,y=r(h,n,a*=2,D).minus(b).abs().comparedTo(r(f,i,a,D).minus(b).abs())<1?[h,n]:[f,i],L=c,y},O.toNumber=function(){return+W(this)},O.toPrecision=function(e,t){return null!=e&&m(e,1,h),q(this,e,t,2)},O.toString=function(e){var t,r=this,i=r.s,n=r.e;return null===n?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=n<=M||n>=x?v(g(r.c),n):w(g(r.c),n,"0"):10===e?t=w(g((r=$(new V(r),j+n+1,D)).c),r.e,"0"):(m(e,2,z.length,"Base"),t=_(w(g(r.c),n,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},O.valueOf=O.toJSON=function(){return W(this)},O._isBigNumber=!0,null!=t&&V.set(t),V}(),r.default=r.BigNumber=r,"function"==typeof define&&define.amd?define((function(){return r})):void 0!==t&&t.exports?t.exports=r:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=r)}(this)},{}],"2F3Pq":[function(e,t,r){"use strict";const i=Math.exp;t.exports=function(e){if("number"!=typeof e)throw new Error("must provide a timespan to the moving average constructor");if(e<=0)throw new Error("must provide a timespan > 0 to the moving average constructor");let t,r,n=0,s=0,o=0,a={};return a.push=function(a,c){if(r){const u=1-i(-(a-r)/e),l=c-t;t=u*c+(1-u)*t,n=(1-u)*(n+l*(u*l)),s=Math.sqrt(n),o=t+u*l}else t=c;r=a},a.movingAverage=function(){return t},a.variance=function(){return n},a.deviation=function(){return s},a.forecast=function(){return o},a}},{}],fdRaE:[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:upgrader"),{error:i("libp2p:upgrader:err")}),s=e("err-code"),o=e("multistream-select"),{Connection:a}=e("libp2p-interfaces/src/connection"),c=e("peer-id"),{pipe:u}=e("it-pipe"),l=e("mutable-proxy"),{codes:d}=e("./errors");t.exports=class{constructor({localPeer:e,metrics:t,cryptos:r=new Map,muxers:i=new Map,onConnectionEnd:n=(()=>{}),onConnection:s=(()=>{})}){this.localPeer=e,this.metrics=t,this.cryptos=r,this.muxers=i,this.protector=null,this.protocols=new Map,this.onConnection=s,this.onConnectionEnd=n}async upgradeInbound(e){let t,r,i,s,o,a,c;if(this.metrics){({setTarget:a,proxy:c}=l());const t=(1e9*Math.random()).toString(36)+Date.now();a({toB58String:()=>t}),e=this.metrics.trackStream({stream:e,remotePeer:c})}n("Starting the inbound connection upgrade");let u=e;this.protector&&(u=await this.protector.protect(e));try{({conn:t,remotePeer:r,protocol:o}=await this._encryptInbound(this.localPeer,u,this.cryptos)),this.muxers.size?({stream:i,Muxer:s}=await this._multiplexInbound(t,this.muxers)):i=t}catch(t){throw n.error("Failed to upgrade inbound connection",t),await e.close(t),t}return this.metrics&&(this.metrics.updatePlaceholder(c,r),a(r)),n("Successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:o,direction:"inbound",maConn:e,upgradedConn:i,Muxer:s,remotePeer:r})}async upgradeOutbound(e){const t=e.remoteAddr.getPeerId();if(!t)throw s(new Error("outbound connection must have a peer id"),d.ERR_INVALID_MULTIADDR);const r=c.createFromB58String(t);let i,o,a,u,f,h,p;if(this.metrics){({setTarget:h,proxy:p}=l());const t=(1e9*Math.random()).toString(36)+Date.now();h({toB58String:()=>t}),e=this.metrics.trackStream({stream:e,remotePeer:p})}n("Starting the outbound connection upgrade");let g=e;this.protector&&(g=await this.protector.protect(e));try{({conn:i,remotePeer:o,protocol:u}=await this._encryptOutbound(this.localPeer,g,r,this.cryptos)),this.muxers.size?({stream:a,Muxer:f}=await this._multiplexOutbound(i,this.muxers)):a=i}catch(t){throw n.error("Failed to upgrade outbound connection",t),await e.close(t),t}return this.metrics&&(this.metrics.updatePlaceholder(p,o),h(o)),n("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:u,direction:"outbound",maConn:e,upgradedConn:a,Muxer:f,remotePeer:o})}_createConnection({cryptoProtocol:e,direction:t,maConn:r,upgradedConn:i,Muxer:c,remotePeer:l}){let f,h,p;c&&(f=new c({onStream:async e=>{if(!p)return;const r=new o.Listener(e);try{const{stream:i,protocol:s}=await r.handle(Array.from(this.protocols.keys()));n("%s: incoming stream opened on %s",t,s),this.metrics&&this.metrics.trackStream({stream:i,remotePeer:l,protocol:s}),p.addStream(e,{protocol:s}),this._onStream({connection:p,stream:{...e,...i},protocol:s})}catch(e){n.error(e)}},onStreamEnd:e=>{p.removeStream(e.id)}}),h=async e=>{n("%s: starting new stream on %s",t,e);const r=f.newStream(),i=new o.Dialer(r);try{const{stream:t,protocol:n}=await i.select(e);return this.metrics&&this.metrics.trackStream({stream:t,remotePeer:l,protocol:n}),{stream:{...r,...t},protocol:n}}catch(e){throw n.error("could not create new stream",e),s(e,d.ERR_UNSUPPORTED_PROTOCOL)}},u(i,f,i).catch(n.error));const g=r.timeline;r.timeline=new Proxy(g,{set:(...e)=>(p&&"close"===e[1]&&e[2]&&!g.close&&(async()=>{try{"open"===p.stat.status&&await p.close()}catch(e){n.error(e)}finally{this.onConnectionEnd(p)}})(),Reflect.set(...e))}),r.timeline.upgraded=Date.now();const y=()=>{throw s(new Error("connection is not multiplexed"),"ERR_CONNECTION_NOT_MULTIPLEXED")};return p=new a({localAddr:r.localAddr,remoteAddr:r.remoteAddr,localPeer:this.localPeer,remotePeer:l,stat:{direction:t,timeline:r.timeline,multiplexer:c&&c.multicodec,encryption:e},newStream:h||y,getStreams:()=>f?f.streams:y(),close:async()=>{await r.close(),f&&f.streams.map((e=>e.abort()))}}),this.onConnection(p),p}_onStream({connection:e,stream:t,protocol:r}){this.protocols.get(r)({connection:e,stream:t,protocol:r})}async _encryptInbound(e,t,r){const i=new o.Listener(t),a=Array.from(r.keys());n("handling inbound crypto protocol selection",a);try{const{stream:t,protocol:s}=await i.handle(a),o=r.get(s);if(n("encrypting inbound connection..."),!o)throw new Error(`no crypto module found for ${s}`);return{...await o.secureInbound(e,t),protocol:s}}catch(e){throw s(e,d.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,t,r,i){const a=new o.Dialer(t),c=Array.from(i.keys());n("selecting outbound crypto protocol",c);try{const{stream:t,protocol:s}=await a.select(c),o=i.get(s);if(n("encrypting outbound connection to %j",r),!o)throw new Error(`no crypto module found for ${s}`);return{...await o.secureOutbound(e,t,r),protocol:s}}catch(e){throw s(e,d.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,t){const r=new o.Dialer(e),i=Array.from(t.keys());n("outbound selecting muxer %s",i);try{const{stream:e,protocol:s}=await r.select(i);n("%s selected as muxer protocol",s);return{stream:e,Muxer:t.get(s)}}catch(e){throw s(e,d.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,t){const r=new o.Listener(e),i=Array.from(t.keys());n("inbound handling muxers %s",i);try{const{stream:e,protocol:n}=await r.handle(i);return{stream:e,Muxer:t.get(n)}}catch(e){throw s(e,d.ERR_MUXER_UNAVAILABLE)}}}},{debug:"bO5wM","err-code":"chZjB","multistream-select":"jMWmZ","libp2p-interfaces/src/connection":"GaTue","peer-id":"8Bdb3","it-pipe":"giKBQ","mutable-proxy":"iviy0","./errors":"3rNo5"}],jMWmZ:[function(e,t,r){"use strict";const i=e("./select"),n=e("./handle"),s=e("./ls"),{PROTOCOL_ID:o}=e("./constants");r.PROTOCOL_ID=o;class a{constructor(e){this._stream=e,this._shaken=!1}async _handshake(){if(this._shaken)return;const{stream:e}=await i(this._stream,o);this._stream=e,this._shaken=!0}}r.Dialer=class extends a{select(e){return i(this._stream,e,this._shaken?null:o)}async ls(){await this._handshake();const{stream:e,protocols:t}=await s(this._stream);return this._stream=e,t}};r.Listener=class extends a{handle(e){return n(this._stream,e)}}},{"./select":"69bj3","./handle":"dCEW4","./ls":"kJyHp","./constants":"78iMV"}],"69bj3":[function(e,t,r){"use strict";const i=e("debug")("mss:select"),n=e("err-code"),s=e("./multistream"),o=e("it-handshake");t.exports=async(e,t,r)=>{t=Array.isArray(t)?[...t]:[t];const{reader:a,writer:c,rest:u,stream:l}=o(e),d=t.shift();r?(i('select: write ["%s", "%s"]',r,d),s.writeAll(c,[r,d])):(i('select: write "%s"',d),s.write(c,d));let f=(await s.read(a)).toString();if(i('select: read "%s"',f),f===r&&(f=(await s.read(a)).toString(),i('select: read "%s"',f)),f===d)return u(),{stream:l,protocol:d};for(const e of t){i('select: write "%s"',e),s.write(c,e);const t=(await s.read(a)).toString();if(i('select: read "%s" for "%s"',t,e),t===e)return u(),{stream:l,protocol:e}}throw u(),n(new Error("protocol selection failed"),"ERR_UNSUPPORTED_PROTOCOL")}},{debug:"bO5wM","err-code":"chZjB","./multistream":"l6zhU","it-handshake":"5ZBDe"}],l6zhU:[function(e,t,r){"use strict";const i=e("bl/BufferList"),n=e("it-length-prefixed"),s=e("it-pipe"),o=e("err-code"),{fromString:a}=e("uint8arrays/from-string"),c=e("it-first"),u=a("\n");r.encode=e=>n.encode.single(new i([e,u])),r.write=(e,t)=>e.push(r.encode(t)),r.writeAll=(e,t)=>{e.push(t.reduce(((e,t)=>e.append(r.encode(t))),new i))},r.read=async e=>{let t=1;const r={[Symbol.asyncIterator](){return this},next:()=>e.next(t)},i=await s(r,n.decode({onLength:e=>{t=e}}),c);if(i.get(i.length-1)!==u[0])throw o(new Error("missing newline"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return i.shallowSlice(0,-1)}},{"bl/BufferList":"im7j6","it-length-prefixed":"3yxIE","it-pipe":"giKBQ","err-code":"chZjB","uint8arrays/from-string":"dF7Y4","it-first":"hBrkP"}],dCEW4:[function(e,t,r){"use strict";const i=e("debug")("mss:handle"),n=e("bl/BufferList"),s=e("./multistream"),o=e("it-handshake"),{PROTOCOL_ID:a}=e("./constants");t.exports=async(e,t)=>{t=Array.isArray(t)?t:[t];const{writer:r,reader:c,rest:u,stream:l}=o(e);for(;;){const e=(await s.read(c)).toString();if(i('read "%s"',e),e!==a){if(t.includes(e))return s.write(r,e),i('respond with "%s" for "%s"',e,e),u(),{stream:l,protocol:e};"ls"!==e?(s.write(r,"na"),i('respond with "na" for "%s"',e)):(s.write(r,new n(t.map((e=>s.encode(e))))),i('respond with "%s" for %s',t,e))}else i('respond with "%s" for "%s"',a,e),s.write(r,a)}}},{debug:"bO5wM","bl/BufferList":"im7j6","./multistream":"l6zhU","it-handshake":"5ZBDe","./constants":"78iMV"}],"78iMV":[function(e,t,r){"use strict";r.PROTOCOL_ID="/multistream/1.0.0"},{}],kJyHp:[function(e,t,r){"use strict";const i=e("it-reader"),n=e("debug")("it-multistream-select:ls"),s=e("./multistream"),o=e("it-handshake"),a=e("it-length-prefixed"),c=e("it-pipe");t.exports=async e=>{const{reader:t,writer:r,rest:u,stream:l}=o(e);n('write "ls"'),s.write(r,"ls"),u();const d=await s.read(t),f=i([d]),h=[];return await c(f,a.decode(),(async e=>{for await(const t of e)h.push(t.shallowSlice(0,-1).toString())})),{stream:l,protocols:h}}},{"it-reader":"btxDo",debug:"bO5wM","./multistream":"l6zhU","it-handshake":"5ZBDe","it-length-prefixed":"3yxIE","it-pipe":"giKBQ"}],GaTue:[function(e,t,r){"use strict";r.Connection=e("./connection")},{"./connection":"kwiyC"}],kwiyC:[function(e,t,r){"use strict";const i=e("peer-id"),{Multiaddr:n}=e("multiaddr"),s=e("err-code"),{OPEN:o,CLOSING:a,CLOSED:c}=e("./status"),u=Symbol.for("@libp2p/interface-connection/connection");class l{constructor({localAddr:e,remoteAddr:t,localPeer:r,remotePeer:a,newStream:c,close:u,getStreams:l,stat:d}){!function(e,t,r,o,a,c,u){if(e&&!n.isMultiaddr(e))throw s(new Error("localAddr must be an instance of multiaddr"),"ERR_INVALID_PARAMETERS");if(!i.isPeerId(t))throw s(new Error("localPeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if(!i.isPeerId(r))throw s(new Error("remotePeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if("function"!=typeof o)throw s(new Error("new stream must be a function"),"ERR_INVALID_PARAMETERS");if("function"!=typeof a)throw s(new Error("close must be a function"),"ERR_INVALID_PARAMETERS");if("function"!=typeof c)throw s(new Error("getStreams must be a function"),"ERR_INVALID_PARAMETERS");if(!u)throw s(new Error("connection metadata object must be provided"),"ERR_INVALID_PARAMETERS");if("inbound"!==u.direction&&"outbound"!==u.direction)throw s(new Error('direction must be "inbound" or "outbound"'),"ERR_INVALID_PARAMETERS");if(!u.timeline)throw s(new Error("connection timeline object must be provided in the stat object"),"ERR_INVALID_PARAMETERS");if(!u.timeline.open)throw s(new Error("connection open timestamp must be provided"),"ERR_INVALID_PARAMETERS");if(!u.timeline.upgraded)throw s(new Error("connection upgraded timestamp must be provided"),"ERR_INVALID_PARAMETERS")}(e,r,a,c,u,l,d),this.id=parseInt(String(1e9*Math.random())).toString(36)+Date.now(),this.localAddr=e,this.remoteAddr=t,this.localPeer=r,this.remotePeer=a,this._stat={...d,status:o},this._newStream=c,this._close=u,this._getStreams=l,this.registry=new Map,this.tags=[]}get[Symbol.toStringTag](){return"Connection"}get[u](){return!0}static isConnection(e){return Boolean(e&&e[u])}get stat(){return this._stat}get streams(){return this._getStreams()}async newStream(e){if(this.stat.status===a)throw s(new Error("the connection is being closed"),"ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===c)throw s(new Error("the connection is closed"),"ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);const{stream:t,protocol:r}=await this._newStream(e);return this.addStream(t,{protocol:r}),{stream:t,protocol:r}}addStream(e,{protocol:t,metadata:r={}}){this.registry.set(e.id,{protocol:t,...r})}removeStream(e){this.registry.delete(e)}async close(){if(this.stat.status!==c){if(this._closing)return this._closing;this.stat.status=a,this._closing=await this._close(),this._stat.timeline.close=Date.now(),this.stat.status=c}}}t.exports=l},{"peer-id":"8Bdb3",multiaddr:"8Mu1u","err-code":"chZjB","./status":"hXsny"}],hXsny:[function(e,t,r){"use strict";t.exports={OPEN:"open",CLOSING:"closing",CLOSED:"closed"}},{}],iviy0:[function(e,t,r){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}t.exports=function(e){var t=void 0,r=void 0;function n(e){if(!(e instanceof Object))throw new Error('Target "'+e+'" is not an object');r=e}function s(e){Object.keys(e).forEach((function(t){var r=e[t];if("function"!=typeof r)throw new Error('Trap "'+t+": "+r+'" is not a function');if(!Reflect[t])throw new Error('Trap "'+t+": "+r+'" is not a valid trap')})),t=e}n((function(){})),e&&n(e),s(Reflect);var o=new Proxy({},{get:function(e,n){return function(){for(var e=arguments.length,s=Array(e),o=0;o<e;o++)s[o]=arguments[o];return t[n].apply(null,[r].concat(i(s.slice(1))))}}});return{setTarget:n,setHandler:s,getTarget:function(){return r},getHandler:function(){return t},proxy:new Proxy(r,o)}}},{}],hDFM8:[function(e,t,r){"use strict";const i=e("err-code"),{EventEmitter:n}=e("events"),s=e("peer-id"),o=e("./address-book"),a=e("./key-book"),c=e("./metadata-book"),u=e("./proto-book"),{codes:{ERR_INVALID_PARAMETERS:l}}=e("../errors");t.exports=class extends n{constructor({peerId:e}){super(),this._peerId=e,this.addressBook=new o(this),this.keyBook=new a(this),this.metadataBook=new c(this),this.protoBook=new u(this)}start(){}stop(){}get peers(){const e=new Set([...this.addressBook.data.keys(),...this.keyBook.data.keys(),...this.protoBook.data.keys(),...this.metadataBook.data.keys()]);this._peerId&&e.delete(this._peerId.toB58String());const t=new Map;return e.forEach((e=>{t.set(e,this.get(s.createFromB58String(e)))})),t}delete(e){const t=this.addressBook.delete(e),r=this.keyBook.delete(e),i=this.protoBook.delete(e),n=this.metadataBook.delete(e);return t||r||i||n}get(e){if(!s.isPeerId(e))throw i(new Error("peerId must be an instance of peer-id"),l);const t=this.keyBook.data.get(e.toB58String()),r=this.addressBook.get(e),n=this.metadataBook.get(e),o=this.protoBook.get(e);if(t||r||n||o)return{id:t||e,addresses:r||[],protocols:o||[],metadata:n}}}},{"err-code":"chZjB",events:"g82pp","peer-id":"8Bdb3","./address-book":"lgtGk","./key-book":"5ggTp","./metadata-book":"emm3H","./proto-book":"98zRc","../errors":"3rNo5"}],lgtGk:[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:peer-store:address-book"),{error:i("libp2p:peer-store:address-book:err")}),s=e("err-code"),{Multiaddr:o}=e("multiaddr"),a=e("peer-id"),c=e("./book"),u=e("../record/peer-record"),{codes:{ERR_INVALID_PARAMETERS:l}}=e("../errors"),d=e("../record/envelope");t.exports=class extends c{constructor(e){super({peerStore:e,eventName:"change:multiaddrs",eventProperty:"multiaddrs",eventTransformer:e=>e.addresses?e.addresses.map((e=>e.multiaddr)):[]}),this.data=new Map}consumePeerRecord(e){let t;try{t=u.createFromProtobuf(e.payload)}catch(e){return n.error("invalid peer record received"),!1}if(!t.peerId.equals(e.peerId))return n("signing key does not match PeerId in the PeerRecord"),!1;if(!t.multiaddrs||!t.multiaddrs.length)return!1;const r=t.peerId,i=r.toB58String(),s=(this.data.get(i)||{record:void 0}).record;if(s&&s.seqNumber>=t.seqNumber)return!1;const o=this._toAddresses(t.multiaddrs,!0);return this._setData(r,{addresses:o,record:{raw:e.marshal(),seqNumber:t.seqNumber}}),n(`stored provided peer record for ${i}`),!0}getRawEnvelope(e){const t=this.data.get(e.toB58String());if(t&&t.record&&t.record.raw)return t.record.raw}getPeerRecord(e){const t=this.getRawEnvelope(e);if(t)return d.createFromProtobuf(t)}set(e,t){if(!a.isPeerId(e))throw n.error("peerId must be an instance of peer-id to store data"),s(new Error("peerId must be an instance of peer-id"),l);const r=this._toAddresses(t);if(!r.length)return this;const i=e.toB58String(),o=this.data.get(i);if(o&&o.addresses&&o.addresses.length===r.length){if(o.addresses.filter((e=>r.some((t=>e.multiaddr.equals(t.multiaddr))))).length===o.addresses.length)return n(`the addresses provided to store are equal to the already stored for ${i}`),this}return this._setData(e,{addresses:r,record:o&&o.record}),n(`stored provided multiaddrs for ${i}`),o||this._ps.emit("peer",e),this}add(e,t){if(!a.isPeerId(e))throw n.error("peerId must be an instance of peer-id to store data"),s(new Error("peerId must be an instance of peer-id"),l);const r=this._toAddresses(t),i=e.toB58String();if(!r.length)return this;const o=this.data.get(i);return o&&o.addresses&&(o.addresses.forEach((e=>{r.find((t=>t.multiaddr.equals(e.multiaddr)))||r.push(e)})),o.addresses.length===r.length)?(n(`the addresses provided to store are already stored for ${i}`),this):(this._setData(e,{addresses:r,record:o&&o.record}),n(`added provided multiaddrs for ${i}`),o&&o.addresses||this._ps.emit("peer",e),this)}get(e){if(!a.isPeerId(e))throw s(new Error("peerId must be an instance of peer-id"),l);const t=this.data.get(e.toB58String());return t&&t.addresses?[...t.addresses]:void 0}_toAddresses(e,t=!1){if(!e)throw n.error("multiaddrs must be provided to store data"),s(new Error("multiaddrs must be provided"),l);const r=[];return e.forEach((e=>{if(!o.isMultiaddr(e))throw n.error(`multiaddr ${e} must be an instance of multiaddr`),s(new Error(`multiaddr ${e} must be an instance of multiaddr`),l);r.find((t=>t.multiaddr.equals(e)))||r.push({multiaddr:e,isCertified:t})})),r}getMultiaddrsForPeer(e,t=(e=>e)){if(!a.isPeerId(e))throw s(new Error("peerId must be an instance of peer-id"),l);const r=this.data.get(e.toB58String());if(r&&r.addresses)return t(r.addresses||[]).map((t=>{const r=t.multiaddr,i=r.getPeerId();return i&&i===e.toB58String()?r:r.encapsulate(`/p2p/${e.toB58String()}`)}))}}},{debug:"bO5wM","err-code":"chZjB",multiaddr:"8Mu1u","peer-id":"8Bdb3","./book":"aXIpl","../record/peer-record":"ewlv9","../errors":"3rNo5","../record/envelope":"27rHX"}],aXIpl:[function(e,t,r){"use strict";const i=e("err-code"),n=e("peer-id"),{codes:{ERR_INVALID_PARAMETERS:s}}=e("../errors"),o=e=>e;t.exports=class{constructor({peerStore:e,eventName:t,eventProperty:r,eventTransformer:i=o}){this._ps=e,this.eventName=t,this.eventProperty=r,this.eventTransformer=i,this.data=new Map}set(e,t){throw i(new Error("set must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}_setData(e,t,{emit:r=!0}={}){const i=e.toB58String();this.data.set(i,t),r&&this._emit(e,t)}_emit(e,t){this._ps.emit(this.eventName,{peerId:e,[this.eventProperty]:this.eventTransformer(t)})}get(e){if(!n.isPeerId(e))throw i(new Error("peerId must be an instance of peer-id"),s);const t=this.data.get(e.toB58String());return t?[...t]:void 0}delete(e){if(!n.isPeerId(e))throw i(new Error("peerId must be an instance of peer-id"),s);return!!this.data.delete(e.toB58String())&&(this._emit(e,[]),!0)}}},{"err-code":"chZjB","peer-id":"8Bdb3","../errors":"3rNo5"}],"5ggTp":[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:peer-store:key-book"),{error:i("libp2p:peer-store:key-book:err")}),s=e("err-code"),o=e("peer-id"),a=e("./book"),{codes:{ERR_INVALID_PARAMETERS:c}}=e("../errors");t.exports=class extends a{constructor(e){super({peerStore:e,eventName:"change:pubkey",eventProperty:"pubkey",eventTransformer:e=>e.pubKey}),this.data=new Map}set(e,t){if(!o.isPeerId(e))throw n.error("peerId must be an instance of peer-id to store data"),s(new Error("peerId must be an instance of peer-id"),c);const r=e.toB58String();return!this.data.get(r)&&t&&(e.pubKey=t,this._setData(e,e),n(`stored provided public key for ${r}`)),this}get(e){if(!o.isPeerId(e))throw s(new Error("peerId must be an instance of peer-id"),c);const t=this.data.get(e.toB58String());return t?t.pubKey:void 0}}},{debug:"bO5wM","err-code":"chZjB","peer-id":"8Bdb3","./book":"aXIpl","../errors":"3rNo5"}],emm3H:[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:peer-store:proto-book"),{error:i("libp2p:peer-store:proto-book:err")}),s=e("err-code"),{equals:o}=e("uint8arrays/equals"),a=e("peer-id"),c=e("./book"),{codes:{ERR_INVALID_PARAMETERS:u}}=e("../errors");t.exports=class extends c{constructor(e){super({peerStore:e,eventName:"change:metadata",eventProperty:"metadata"}),this.data=new Map}set(e,t,r){if(!a.isPeerId(e))throw n.error("peerId must be an instance of peer-id to store data"),s(new Error("peerId must be an instance of peer-id"),u);if("string"!=typeof t||!(r instanceof Uint8Array))throw n.error("valid key and value must be provided to store data"),s(new Error("valid key and value must be provided"),u);return this._setValue(e,t,r),this}_setValue(e,t,r,{emit:i=!0}={}){const s=e.toB58String(),a=this.data.get(s)||new Map,c=a.get(t);c&&o(r,c)?n(`the metadata provided to store is equal to the already stored for ${s} on ${t}`):(a.set(t,r),this.data.set(s,a),i&&this._emit(e,t))}get(e){if(!a.isPeerId(e))throw s(new Error("peerId must be an instance of peer-id"),u);return this.data.get(e.toB58String())}getValue(e,t){if(!a.isPeerId(e))throw s(new Error("peerId must be an instance of peer-id"),u);const r=this.data.get(e.toB58String());return r&&r.get(t)}delete(e){if(!a.isPeerId(e))throw s(new Error("peerId must be an instance of peer-id"),u);return!!this.data.delete(e.toB58String())&&(this._emit(e),!0)}deleteValue(e,t){if(!a.isPeerId(e))throw s(new Error("peerId must be an instance of peer-id"),u);const r=this.data.get(e.toB58String());return!(!r||!r.delete(t))&&(this._emit(e,t),!0)}}},{debug:"bO5wM","err-code":"chZjB","uint8arrays/equals":"eY3cX","peer-id":"8Bdb3","./book":"aXIpl","../errors":"3rNo5"}],"98zRc":[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:peer-store:proto-book"),{error:i("libp2p:peer-store:proto-book:err")}),s=e("err-code"),o=e("peer-id"),a=e("./book"),{codes:{ERR_INVALID_PARAMETERS:c}}=e("../errors");t.exports=class extends a{constructor(e){super({peerStore:e,eventName:"change:protocols",eventProperty:"protocols",eventTransformer:e=>Array.from(e)}),this.data=new Map}set(e,t){if(!o.isPeerId(e))throw n.error("peerId must be an instance of peer-id to store data"),s(new Error("peerId must be an instance of peer-id"),c);if(!t)throw n.error("protocols must be provided to store data"),s(new Error("protocols must be provided"),c);const r=e.toB58String(),i=this.data.get(r),a=new Set(t);return i&&(l=a,(u=i).size===l.size&&[...u].every((e=>l.has(e))))?(n(`the protocols provided to store are equal to the already stored for ${r}`),this):(this._setData(e,a),n(`stored provided protocols for ${r}`),this);var u,l}add(e,t){if(!o.isPeerId(e))throw n.error("peerId must be an instance of peer-id to store data"),s(new Error("peerId must be an instance of peer-id"),c);if(!t)throw n.error("protocols must be provided to store data"),s(new Error("protocols must be provided"),c);const r=e.toB58String(),i=this.data.get(r)||new Set,a=new Set([...i,...t]);return i.size===a.size?(n(`the protocols provided to store are already stored for ${r}`),this):(this._setData(e,a),n(`added provided protocols for ${r}`),this)}remove(e,t){if(!o.isPeerId(e))throw n.error("peerId must be an instance of peer-id to store data"),s(new Error("peerId must be an instance of peer-id"),c);if(!t)throw n.error("protocols must be provided to store data"),s(new Error("protocols must be provided"),c);const r=e.toB58String(),i=this.data.get(r);if(i){const s=new Set([...i].filter((e=>!t.includes(e))));if(i.size===s.size)return this;this._setData(e,s),n(`removed provided protocols for ${r}`)}return this}}},{debug:"bO5wM","err-code":"chZjB","peer-id":"8Bdb3","./book":"aXIpl","../errors":"3rNo5"}],"4AHRd":[function(e,t,r){"use strict";t.exports=function(e,t,r){const i=new e(t,r);return i._subscribeAdapter=i.subscribe,i._unsubscribeAdapter=i.unsubscribe,i.subscribe=function(e,t){t&&i.on(e,t),i._subscribeAdapter(e)},i.unsubscribe=function(e,t){t?i.removeListener(e,t):i.removeAllListeners(e),0===i.listenerCount(e)&&i._unsubscribeAdapter(e)},i}},{}],kcKey:[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:persistent-peer-store"),{error:i("libp2p:persistent-peer-store:err")}),{Key:s}=e("interface-datastore/key"),{Multiaddr:o}=e("multiaddr"),a=e("peer-id"),{base32:c}=e("multiformats/bases/base32"),u=e(".."),{NAMESPACE_ADDRESS:l,NAMESPACE_COMMON:d,NAMESPACE_KEYS:f,NAMESPACE_METADATA:h,NAMESPACE_PROTOCOL:p}=e("./consts"),{Addresses:g}=e("./pb/address-book"),{Protocols:y}=e("./pb/proto-book");t.exports=class extends u{constructor({peerId:e,datastore:t,threshold:r=5}){super({peerId:e}),this._datastore=t,this._dirtyPeers=new Set,this._dirtyMetadata=new Map,this.threshold=r,this._addDirtyPeer=this._addDirtyPeer.bind(this)}async start(){n("PeerStore is starting"),this.on("change:protocols",this._addDirtyPeer),this.on("change:multiaddrs",this._addDirtyPeer),this.on("change:pubkey",this._addDirtyPeerKey),this.on("change:metadata",this._addDirtyPeerMetadata);for await(const e of this._datastore.query({prefix:d}))await this._processDatastoreEntry(e);n("PeerStore started")}async stop(){n("PeerStore is stopping"),this.removeAllListeners(),await this._commitData(),n("PeerStore stopped")}_addDirtyPeer({peerId:e}){const t=e.toB58String();n("add dirty peer",t),this._dirtyPeers.add(t),this._dirtyPeers.size>=this.threshold&&this._commitData().catch((e=>{n.error("error committing data",e)}))}_addDirtyPeerKey({peerId:e}){if(e.hasInlinePublicKey())return;const t=e.toB58String();n("add dirty peer key",t),this._dirtyPeers.add(t),this._dirtyPeers.size>=this.threshold&&this._commitData().catch((e=>{n.error("error committing data",e)}))}_addDirtyPeerMetadata({peerId:e,metadata:t}){const r=e.toB58String();n("add dirty metadata peer",r),this._dirtyPeers.add(r);const i=this._dirtyMetadata.get(r)||new Set;i.add(t),this._dirtyMetadata.set(r,i),this._dirtyPeers.size>=this.threshold&&this._commitData().catch((e=>{n.error("error committing data",e)}))}async _commitData(){const e=Array.from(this._dirtyPeers);if(!e.length)return;this._dirtyPeers.clear(),n("create batch commit");const t=this._datastore.batch();for(const r of e){const e=this.keyBook.data.get(r)||a.createFromB58String(r);this._batchAddressBook(e,t),!e.hasInlinePublicKey()&&this._batchKeyBook(e,t),this._batchMetadataBook(e,t),this._batchProtoBook(e,t)}await t.commit(),n("batch committed")}_batchAddressBook(e,t){const r=e.toString(),i=new s(`${l}${r}`),o=this.addressBook.data.get(e.toB58String());try{if(!o)return void t.delete(i);const e=g.encode({addrs:o.addresses.map((e=>({multiaddr:e.multiaddr.bytes,isCertified:e.isCertified}))),certifiedRecord:o.record?{seq:o.record.seqNumber,raw:o.record.raw}:void 0}).finish();t.put(i,e)}catch(e){n.error(e)}}_batchKeyBook(e,t){const r=e.toString(),i=new s(`${f}${r}`);try{if(!e.pubKey)return void t.delete(i);const r=e.marshalPubKey();t.put(i,r)}catch(e){n.error(e)}}_batchMetadataBook(e,t){const r=e.toString(),i=this._dirtyMetadata.get(e.toB58String())||[];try{i.forEach((i=>{const n=new s(`${h}${r}/${i}`),o=this.metadataBook.getValue(e,i);o?t.put(n,o):t.delete(n)}))}catch(e){n.error(e)}}_batchProtoBook(e,t){const r=e.toString(),i=new s(`${p}${r}`),o=this.protoBook.get(e);try{if(!o)return void t.delete(i);const e=y.encode({protocols:o}).finish();t.put(i,e)}catch(e){n.error(e)}}async _processDatastoreEntry({key:e,value:t}){try{const r=e.toString().split("/"),i=a.createFromBytes(c.decode(r[3]));let s;switch(r[2]){case"addrs":s=g.decode(t),this.addressBook._setData(i,{addresses:s.addrs.map((e=>({multiaddr:new o(e.multiaddr),isCertified:Boolean(e.isCertified)}))),record:s.certifiedRecord?{raw:s.certifiedRecord.raw,seqNumber:s.certifiedRecord.seq}:void 0},{emit:!1});break;case"keys":s=await a.createFromPubKey(t),this.keyBook._setData(s,s,{emit:!1});break;case"metadata":this.metadataBook._setValue(i,r[4],t,{emit:!1});break;case"protos":s=y.decode(t),this.protoBook._setData(i,new Set(s.protocols),{emit:!1});break;default:n("invalid data persisted for: ",e.toString())}}catch(e){n.error(e)}}}},{debug:"bO5wM","interface-datastore/key":"9hGOz",multiaddr:"8Mu1u","peer-id":"8Bdb3","multiformats/bases/base32":"5k9Tu","..":"hDFM8","./consts":"2EBy4","./pb/address-book":"jj9hF","./pb/proto-book":"j2d2m"}],"2EBy4":[function(e,t,r){"use strict";t.exports.NAMESPACE_COMMON="/peers/",t.exports.NAMESPACE_ADDRESS="/peers/addrs/",t.exports.NAMESPACE_KEYS="/peers/keys/",t.exports.NAMESPACE_METADATA="/peers/metadata/",t.exports.NAMESPACE_PROTOCOL="/peers/protos/"},{}],jj9hF:[function(e,t,r){"use strict";var i=e("protobufjs/minimal"),n=i.Reader,s=i.Writer,o=i.util,a=i.roots["libp2p-address-book"]||(i.roots["libp2p-address-book"]={});a.Addresses=function(){function e(e){if(this.addrs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.addrs=o.emptyArray,e.prototype.certifiedRecord=null,e.encode=function(e,t){if(t||(t=s.create()),null!=e.addrs&&e.addrs.length)for(var r=0;r<e.addrs.length;++r)a.Addresses.Address.encode(e.addrs[r],t.uint32(10).fork()).ldelim();return null!=e.certifiedRecord&&Object.hasOwnProperty.call(e,"certifiedRecord")&&a.Addresses.CertifiedRecord.encode(e.certifiedRecord,t.uint32(18).fork()).ldelim(),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.Addresses;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.addrs&&i.addrs.length||(i.addrs=[]),i.addrs.push(a.Addresses.Address.decode(e,e.uint32()));break;case 2:i.certifiedRecord=a.Addresses.CertifiedRecord.decode(e,e.uint32());break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.Addresses)return e;var t=new a.Addresses;if(e.addrs){if(!Array.isArray(e.addrs))throw TypeError(".Addresses.addrs: array expected");t.addrs=[];for(var r=0;r<e.addrs.length;++r){if("object"!=typeof e.addrs[r])throw TypeError(".Addresses.addrs: object expected");t.addrs[r]=a.Addresses.Address.fromObject(e.addrs[r])}}if(null!=e.certifiedRecord){if("object"!=typeof e.certifiedRecord)throw TypeError(".Addresses.certifiedRecord: object expected");t.certifiedRecord=a.Addresses.CertifiedRecord.fromObject(e.certifiedRecord)}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.addrs=[]),t.defaults&&(r.certifiedRecord=null),e.addrs&&e.addrs.length){r.addrs=[];for(var i=0;i<e.addrs.length;++i)r.addrs[i]=a.Addresses.Address.toObject(e.addrs[i],t)}return null!=e.certifiedRecord&&e.hasOwnProperty("certifiedRecord")&&(r.certifiedRecord=a.Addresses.CertifiedRecord.toObject(e.certifiedRecord,t)),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e.Address=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.multiaddr=o.newBuffer([]),e.prototype.isCertified=!1,e.encode=function(e,t){return t||(t=s.create()),null!=e.multiaddr&&Object.hasOwnProperty.call(e,"multiaddr")&&t.uint32(10).bytes(e.multiaddr),null!=e.isCertified&&Object.hasOwnProperty.call(e,"isCertified")&&t.uint32(16).bool(e.isCertified),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.Addresses.Address;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.multiaddr=e.bytes();break;case 2:i.isCertified=e.bool();break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.Addresses.Address)return e;var t=new a.Addresses.Address;return null!=e.multiaddr&&("string"==typeof e.multiaddr?o.base64.decode(e.multiaddr,t.multiaddr=o.newBuffer(o.base64.length(e.multiaddr)),0):e.multiaddr.length&&(t.multiaddr=e.multiaddr)),null!=e.isCertified&&(t.isCertified=Boolean(e.isCertified)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.multiaddr="":(r.multiaddr=[],t.bytes!==Array&&(r.multiaddr=o.newBuffer(r.multiaddr))),r.isCertified=!1),null!=e.multiaddr&&e.hasOwnProperty("multiaddr")&&(r.multiaddr=t.bytes===String?o.base64.encode(e.multiaddr,0,e.multiaddr.length):t.bytes===Array?Array.prototype.slice.call(e.multiaddr):e.multiaddr),null!=e.isCertified&&e.hasOwnProperty("isCertified")&&(r.isCertified=e.isCertified),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),e.CertifiedRecord=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.seq=o.Long?o.Long.fromBits(0,0,!0):0,e.prototype.raw=o.newBuffer([]),e.encode=function(e,t){return t||(t=s.create()),null!=e.seq&&Object.hasOwnProperty.call(e,"seq")&&t.uint32(8).uint64(e.seq),null!=e.raw&&Object.hasOwnProperty.call(e,"raw")&&t.uint32(18).bytes(e.raw),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.Addresses.CertifiedRecord;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:i.seq=e.uint64();break;case 2:i.raw=e.bytes();break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.Addresses.CertifiedRecord)return e;var t=new a.Addresses.CertifiedRecord;return null!=e.seq&&(o.Long?(t.seq=o.Long.fromValue(e.seq)).unsigned=!0:"string"==typeof e.seq?t.seq=parseInt(e.seq,10):"number"==typeof e.seq?t.seq=e.seq:"object"==typeof e.seq&&(t.seq=new o.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0))),null!=e.raw&&("string"==typeof e.raw?o.base64.decode(e.raw,t.raw=o.newBuffer(o.base64.length(e.raw)),0):e.raw.length&&(t.raw=e.raw)),t},e.toObject=function(e,t){t||(t={});var r={};if(t.defaults){if(o.Long){var i=new o.Long(0,0,!0);r.seq=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else r.seq=t.longs===String?"0":0;t.bytes===String?r.raw="":(r.raw=[],t.bytes!==Array&&(r.raw=o.newBuffer(r.raw)))}return null!=e.seq&&e.hasOwnProperty("seq")&&("number"==typeof e.seq?r.seq=t.longs===String?String(e.seq):e.seq:r.seq=t.longs===String?o.Long.prototype.toString.call(e.seq):t.longs===Number?new o.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0):e.seq),null!=e.raw&&e.hasOwnProperty("raw")&&(r.raw=t.bytes===String?o.base64.encode(e.raw,0,e.raw.length):t.bytes===Array?Array.prototype.slice.call(e.raw):e.raw),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),e}(),t.exports=a},{"protobufjs/minimal":"grAXL"}],j2d2m:[function(e,t,r){"use strict";var i=e("protobufjs/minimal"),n=i.Reader,s=i.Writer,o=i.util,a=i.roots["libp2p-proto-book"]||(i.roots["libp2p-proto-book"]={});a.Protocols=function(){function e(e){if(this.protocols=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.protocols=o.emptyArray,e.encode=function(e,t){if(t||(t=s.create()),null!=e.protocols&&e.protocols.length)for(var r=0;r<e.protocols.length;++r)t.uint32(10).string(e.protocols[r]);return t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.Protocols;e.pos<r;){var s=e.uint32();if(s>>>3==1)i.protocols&&i.protocols.length||(i.protocols=[]),i.protocols.push(e.string());else e.skipType(7&s)}return i},e.fromObject=function(e){if(e instanceof a.Protocols)return e;var t=new a.Protocols;if(e.protocols){if(!Array.isArray(e.protocols))throw TypeError(".Protocols.protocols: array expected");t.protocols=[];for(var r=0;r<e.protocols.length;++r)t.protocols[r]=String(e.protocols[r])}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.protocols=[]),e.protocols&&e.protocols.length){r.protocols=[];for(var i=0;i<e.protocols.length;++i)r.protocols[i]=e.protocols[i]}return r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),t.exports=a},{"protobufjs/minimal":"grAXL"}],bUUbk:[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:registrar"),{error:i("libp2p:registrar:err")}),s=e("err-code"),{codes:{ERR_INVALID_PARAMETERS:o}}=e("./errors"),a=e("libp2p-interfaces/src/topology");t.exports=class{constructor({peerStore:e,connectionManager:t}){this.peerStore=e,this.connectionManager=t,this.topologies=new Map,this._handle=void 0,this._onDisconnect=this._onDisconnect.bind(this),this.connectionManager.on("peer:disconnect",this._onDisconnect)}get handle(){return this._handle}set handle(e){this._handle=e}getConnection(e){return this.connectionManager.get(e)}register(e){if(!a.isTopology(e))throw n.error("topology must be an instance of interfaces/topology"),s(new Error("topology must be an instance of interfaces/topology"),o);const t=(1e9*Math.random()).toString(36)+Date.now();return this.topologies.set(t,e),e.registrar=this,t}unregister(e){return this.topologies.delete(e)}_onDisconnect(e){for(const[,t]of this.topologies)t.disconnect(e.remotePeer)}}},{debug:"bO5wM","err-code":"chZjB","./errors":"3rNo5","libp2p-interfaces/src/topology":"6HbOL"}],azCOK:[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:ping"),{error:i("libp2p:ping:err")}),s=e("err-code"),o=e("libp2p-crypto"),{pipe:a}=e("it-pipe"),{toBuffer:c}=e("it-buffer"),{collect:u,take:l}=e("streaming-iterables"),{equals:d}=e("uint8arrays/equals"),{PROTOCOL_NAME:f,PING_LENGTH:h,PROTOCOL_VERSION:p}=e("./constants");(r=t.exports=async function(e,t){const r=`/${e._config.protocolPrefix}/${f}/${p}`;n("dialing %s to %s",r,t.toB58String?t.toB58String():t);const i=await e.dial(t),{stream:g}=await i.newStream(r),y=Date.now(),m=o.randomBytes(h),[b]=await a([m],g,(e=>l(1,e)),c,u),v=Date.now();if(!d(m,b))throw s(new Error("Received wrong ping ack"),"ERR_WRONG_PING_ACK");return v-y}).mount=function(e){e.handle(`/${e._config.protocolPrefix}/${f}/${p}`,(({stream:e})=>a(e,e)))},r.unmount=function(e){e.unhandle(`/${e._config.protocolPrefix}/${f}/${p}`)}},{debug:"bO5wM","err-code":"chZjB","libp2p-crypto":"bb1cb","it-pipe":"giKBQ","it-buffer":"jQv22","streaming-iterables":"jrrai","uint8arrays/equals":"eY3cX","./constants":"g9JxC"}],g9JxC:[function(e,t,r){"use strict";t.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32,PROTOCOL_VERSION:"1.0.0",PROTOCOL_NAME:"ping"}},{}],jPbT6:[function(e,t,r){"use strict";const i=e("debug"),n=Object.assign(i("libp2p:identify"),{error:i("libp2p:identify:err")}),s=e("err-code"),o=e("it-length-prefixed"),{pipe:a}=e("it-pipe"),{collect:c,take:u,consume:l}=e("streaming-iterables"),{fromString:d}=e("uint8arrays/from-string"),f=e("peer-id"),{Multiaddr:h}=e("multiaddr"),{toBuffer:p}=e("it-buffer"),g=e("./message"),y=e("../record/envelope"),m=e("../record/peer-record"),{MULTICODEC_IDENTIFY:b,MULTICODEC_IDENTIFY_PUSH:v,IDENTIFY_PROTOCOL_VERSION:w,MULTICODEC_IDENTIFY_PROTOCOL_NAME:_,MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME:E,MULTICODEC_IDENTIFY_PROTOCOL_VERSION:S,MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION:T}=e("./consts"),{codes:A}=e("../errors");class k{static getProtocolStr(e){return{identifyProtocolStr:`/${e._config.protocolPrefix}/${_}/${S}`,identifyPushProtocolStr:`/${e._config.protocolPrefix}/${E}/${T}`}}constructor({libp2p:e}){this._libp2p=e,this.peerStore=e.peerStore,this.addressManager=e.addressManager,this.connectionManager=e.connectionManager,this.peerId=e.peerId,this.handleMessage=this.handleMessage.bind(this);const t=k.getProtocolStr(e);this.identifyProtocolStr=t.identifyProtocolStr,this.identifyPushProtocolStr=t.identifyPushProtocolStr,this._host={protocolVersion:`${e._config.protocolPrefix}/${w}`,...e._options.host},this.peerStore.metadataBook.set(this.peerId,"AgentVersion",d(this._host.agentVersion)),this.peerStore.metadataBook.set(this.peerId,"ProtocolVersion",d(this._host.protocolVersion)),this.connectionManager.on("peer:connect",(e=>{this.identify(e).catch(n.error)})),this.peerStore.on("change:multiaddrs",(({peerId:e})=>{e.toString()===this.peerId.toString()&&this.pushToPeerStore()})),this.peerStore.on("change:protocols",(({peerId:e})=>{e.toString()===this.peerId.toString()&&this.pushToPeerStore()}))}async push(e){const t=await this.peerStore.addressBook.getRawEnvelope(this.peerId),r=this._libp2p.multiaddrs.map((e=>e.bytes)),i=this.peerStore.protoBook.get(this.peerId)||[],s=e.map((async e=>{try{const{stream:n}=await e.newStream(this.identifyPushProtocolStr);await a([g.Identify.encode({listenAddrs:r,signedPeerRecord:t,protocols:i}).finish()],o.encode(),n,l)}catch(e){n.error("could not push identify update to peer",e)}}));return Promise.all(s)}pushToPeerStore(){if(!this._libp2p.isStarted())return;const e=[];let t;for(const r of this.peerStore.peers.values())r.protocols.includes(this.identifyPushProtocolStr)&&(t=this.connectionManager.get(r.id))&&e.push(t);this.push(e)}async identify(e){const{stream:t}=await e.newStream(this.identifyProtocolStr),[r]=await a([],t,o.decode(),u(1),p,c);if(!r)throw s(new Error("No data could be retrieved"),A.ERR_CONNECTION_ENDED);let i;try{i=g.Identify.decode(r)}catch(e){throw s(e,A.ERR_INVALID_MESSAGE)}const{publicKey:l,listenAddrs:b,protocols:v,observedAddr:w,signedPeerRecord:_}=i,E=await f.createFromPubKey(l);if(e.remotePeer.toB58String()!==E.toB58String())throw s(new Error("identified peer does not match the expected peer"),A.ERR_INVALID_PEER);const S=k.getCleanMultiaddr(w);try{const e=await y.openAndCertify(_,m.DOMAIN);if(this.peerStore.addressBook.consumePeerRecord(e))return this.peerStore.protoBook.set(E,v),this.peerStore.metadataBook.set(E,"AgentVersion",d(i.agentVersion)),void this.peerStore.metadataBook.set(E,"ProtocolVersion",d(i.protocolVersion))}catch(e){n("received invalid envelope, discard it and fallback to listenAddrs is available",e)}try{this.peerStore.addressBook.set(E,b.map((e=>new h(e))))}catch(e){n.error("received invalid addrs",e)}this.peerStore.protoBook.set(E,v),this.peerStore.metadataBook.set(E,"AgentVersion",d(i.agentVersion)),this.peerStore.metadataBook.set(E,"ProtocolVersion",d(i.protocolVersion)),n("received observed address of %s",S)}handleMessage({connection:e,stream:t,protocol:r}){switch(r){case this.identifyProtocolStr:return this._handleIdentify({connection:e,stream:t});case this.identifyPushProtocolStr:return this._handlePush({connection:e,stream:t});default:n.error("cannot handle unknown protocol %s",r)}}async _handleIdentify({connection:e,stream:t}){let r=new Uint8Array(0);this.peerId.pubKey&&(r=this.peerId.pubKey.bytes);const i=await this.peerStore.addressBook.getRawEnvelope(this.peerId),s=this.peerStore.protoBook.get(this.peerId)||[],c=g.Identify.encode({protocolVersion:this._host.protocolVersion,agentVersion:this._host.agentVersion,publicKey:r,listenAddrs:this._libp2p.multiaddrs.map((e=>e.bytes)),signedPeerRecord:i,observedAddr:e.remoteAddr.bytes,protocols:s}).finish();try{await a([c],o.encode(),t,l)}catch(e){n.error("could not respond to identify request",e)}}async _handlePush({connection:e,stream:t}){let r;try{const[e]=await a([],t,o.decode(),u(1),p,c);r=g.Identify.decode(e)}catch(e){return n.error("received invalid message",e)}const i=e.remotePeer;try{const e=await y.openAndCertify(r.signedPeerRecord,m.DOMAIN);if(this.peerStore.addressBook.consumePeerRecord(e))return void this.peerStore.protoBook.set(i,r.protocols)}catch(e){n("received invalid envelope, discard it and fallback to listenAddrs is available",e)}try{this.peerStore.addressBook.set(i,r.listenAddrs.map((e=>new h(e))))}catch(e){n.error("received invalid addrs",e)}this.peerStore.protoBook.set(i,r.protocols)}static getCleanMultiaddr(e){if(e&&e.length>0)try{return new h(e)}catch(e){return null}return null}}const I={IDENTIFY:b,IDENTIFY_PUSH:v};k.multicodecs=I,k.Messsage=g,t.exports=k},{debug:"bO5wM","err-code":"chZjB","it-length-prefixed":"3yxIE","it-pipe":"giKBQ","streaming-iterables":"jrrai","uint8arrays/from-string":"dF7Y4","peer-id":"8Bdb3",multiaddr:"8Mu1u","it-buffer":"jQv22","./message":"cIqCO","../record/envelope":"27rHX","../record/peer-record":"ewlv9","./consts":"62PhM","../errors":"3rNo5"}],cIqCO:[function(e,t,r){"use strict";var i=e("protobufjs/minimal"),n=i.Reader,s=i.Writer,o=i.util,a=i.roots["libp2p-identify"]||(i.roots["libp2p-identify"]={});a.Identify=function(){function e(e){if(this.listenAddrs=[],this.protocols=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.protocolVersion="",e.prototype.agentVersion="",e.prototype.publicKey=o.newBuffer([]),e.prototype.listenAddrs=o.emptyArray,e.prototype.observedAddr=o.newBuffer([]),e.prototype.protocols=o.emptyArray,e.prototype.signedPeerRecord=o.newBuffer([]),e.encode=function(e,t){if(t||(t=s.create()),null!=e.publicKey&&Object.hasOwnProperty.call(e,"publicKey")&&t.uint32(10).bytes(e.publicKey),null!=e.listenAddrs&&e.listenAddrs.length)for(var r=0;r<e.listenAddrs.length;++r)t.uint32(18).bytes(e.listenAddrs[r]);if(null!=e.protocols&&e.protocols.length)for(r=0;r<e.protocols.length;++r)t.uint32(26).string(e.protocols[r]);return null!=e.observedAddr&&Object.hasOwnProperty.call(e,"observedAddr")&&t.uint32(34).bytes(e.observedAddr),null!=e.protocolVersion&&Object.hasOwnProperty.call(e,"protocolVersion")&&t.uint32(42).string(e.protocolVersion),null!=e.agentVersion&&Object.hasOwnProperty.call(e,"agentVersion")&&t.uint32(50).string(e.agentVersion),null!=e.signedPeerRecord&&Object.hasOwnProperty.call(e,"signedPeerRecord")&&t.uint32(66).bytes(e.signedPeerRecord),t},e.decode=function(e,t){e instanceof n||(e=n.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new a.Identify;e.pos<r;){var s=e.uint32();switch(s>>>3){case 5:i.protocolVersion=e.string();break;case 6:i.agentVersion=e.string();break;case 1:i.publicKey=e.bytes();break;case 2:i.listenAddrs&&i.listenAddrs.length||(i.listenAddrs=[]),i.listenAddrs.push(e.bytes());break;case 4:i.observedAddr=e.bytes();break;case 3:i.protocols&&i.protocols.length||(i.protocols=[]),i.protocols.push(e.string());break;case 8:i.signedPeerRecord=e.bytes();break;default:e.skipType(7&s)}}return i},e.fromObject=function(e){if(e instanceof a.Identify)return e;var t=new a.Identify;if(null!=e.protocolVersion&&(t.protocolVersion=String(e.protocolVersion)),null!=e.agentVersion&&(t.agentVersion=String(e.agentVersion)),null!=e.publicKey&&("string"==typeof e.publicKey?o.base64.decode(e.publicKey,t.publicKey=o.newBuffer(o.base64.length(e.publicKey)),0):e.publicKey.length&&(t.publicKey=e.publicKey)),e.listenAddrs){if(!Array.isArray(e.listenAddrs))throw TypeError(".Identify.listenAddrs: array expected");t.listenAddrs=[];for(var r=0;r<e.listenAddrs.length;++r)"string"==typeof e.listenAddrs[r]?o.base64.decode(e.listenAddrs[r],t.listenAddrs[r]=o.newBuffer(o.base64.length(e.listenAddrs[r])),0):e.listenAddrs[r].length&&(t.listenAddrs[r]=e.listenAddrs[r])}if(null!=e.observedAddr&&("string"==typeof e.observedAddr?o.base64.decode(e.observedAddr,t.observedAddr=o.newBuffer(o.base64.length(e.observedAddr)),0):e.observedAddr.length&&(t.observedAddr=e.observedAddr)),e.protocols){if(!Array.isArray(e.protocols))throw TypeError(".Identify.protocols: array expected");t.protocols=[];for(r=0;r<e.protocols.length;++r)t.protocols[r]=String(e.protocols[r])}return null!=e.signedPeerRecord&&("string"==typeof e.signedPeerRecord?o.base64.decode(e.signedPeerRecord,t.signedPeerRecord=o.newBuffer(o.base64.length(e.signedPeerRecord)),0):e.signedPeerRecord.length&&(t.signedPeerRecord=e.signedPeerRecord)),t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.listenAddrs=[],r.protocols=[]),t.defaults&&(t.bytes===String?r.publicKey="":(r.publicKey=[],t.bytes!==Array&&(r.publicKey=o.newBuffer(r.publicKey))),t.bytes===String?r.observedAddr="":(r.observedAddr=[],t.bytes!==Array&&(r.observedAddr=o.newBuffer(r.observedAddr))),r.protocolVersion="",r.agentVersion="",t.bytes===String?r.signedPeerRecord="":(r.signedPeerRecord=[],t.bytes!==Array&&(r.signedPeerRecord=o.newBuffer(r.signedPeerRecord)))),null!=e.publicKey&&e.hasOwnProperty("publicKey")&&(r.publicKey=t.bytes===String?o.base64.encode(e.publicKey,0,e.publicKey.length):t.bytes===Array?Array.prototype.slice.call(e.publicKey):e.publicKey),e.listenAddrs&&e.listenAddrs.length){r.listenAddrs=[];for(var i=0;i<e.listenAddrs.length;++i)r.listenAddrs[i]=t.bytes===String?o.base64.encode(e.listenAddrs[i],0,e.listenAddrs[i].length):t.bytes===Array?Array.prototype.slice.call(e.listenAddrs[i]):e.listenAddrs[i]}if(e.protocols&&e.protocols.length){r.protocols=[];for(i=0;i<e.protocols.length;++i)r.protocols[i]=e.protocols[i]}return null!=e.observedAddr&&e.hasOwnProperty("observedAddr")&&(r.observedAddr=t.bytes===String?o.base64.encode(e.observedAddr,0,e.observedAddr.length):t.bytes===Array?Array.prototype.slice.call(e.observedAddr):e.observedAddr),null!=e.protocolVersion&&e.hasOwnProperty("protocolVersion")&&(r.protocolVersion=e.protocolVersion),null!=e.agentVersion&&e.hasOwnProperty("agentVersion")&&(r.agentVersion=e.agentVersion),null!=e.signedPeerRecord&&e.hasOwnProperty("signedPeerRecord")&&(r.signedPeerRecord=t.bytes===String?o.base64.encode(e.signedPeerRecord,0,e.signedPeerRecord.length):t.bytes===Array?Array.prototype.slice.call(e.signedPeerRecord):e.signedPeerRecord),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),t.exports=a},{"protobufjs/minimal":"grAXL"}],"1LCyC":[function(e,t,r){"use strict";const i=e("@motrix/nat-api"),n=e("debug"),{promisify:s}=e("es6-promisify"),{Multiaddr:o}=e("multiaddr"),a=Object.assign(n("libp2p:nat"),{error:n("libp2p:nat:err")}),{isBrowser:c}=e("wherearewe"),u=e("p-retry"),l=e("private-ip"),d=e("../package.json"),f=e("err-code"),{codes:{ERR_INVALID_PARAMETERS:h}}=e("./errors"),p=e("libp2p-utils/src/multiaddr/is-loopback"),g=7200;function y(e=1024,t=65535){return Math.floor(Math.random()*(t-e+1)+e)}t.exports=class{constructor({peerId:e,addressManager:t,transportManager:r,...i}){if(this._peerId=e,this._addressManager=t,this._transportManager=r,this._enabled=i.enabled,this._externalIp=i.externalIp,this._options={description:i.description||`${d.name}@${d.version} ${this._peerId}`,ttl:i.ttl||g,autoUpdate:i.keepAlive||!0,gateway:i.gateway,enablePMP:Boolean(i.pmp&&i.pmp.enabled)},this._options.ttl<g)throw f(new Error("NatManager ttl should be at least 7200 seconds"),h)}start(){!c&&this._enabled&&this._start().catch((e=>{a.error(e)}))}async _start(){const e=this._transportManager.getAddrs();for(const t of e){const{family:e,host:r,port:i,transport:n}=t.toOptions();if(!t.isThinWaistAddress()||"tcp"!==n)continue;if(p(t))continue;if(4!==e)continue;const s=this._getClient(),c=this._externalIp||await s.externalIp();if(l(c))throw new Error(`${c} is private - please set config.nat.externalIp to an externally routable IP or ensure you are not behind a double NAT`);const u=y();a(`opening uPnP connection from ${c}:${u} to ${r}:${i}`),await s.map({publicPort:u,privatePort:i,protocol:n.toUpperCase()}),this._addressManager.addObservedAddr(o.fromNodeAddress({family:4,address:c,port:u},n))}}_getClient(){if(this._client)return this._client;const e=new i(this._options),t=s(e.map.bind(e)),r=s(e.destroy.bind(e)),n=s(e.externalIp.bind(e));return this._client={map:(...e)=>u((()=>t(...e)),{onFailedAttempt:a.error,unref:!0}),destroy:(...e)=>u((()=>r(...e)),{onFailedAttempt:a.error,unref:!0}),externalIp:(...e)=>u((()=>n(...e)),{onFailedAttempt:a.error,unref:!0})},this._client}async stop(){if(!c&&this._client)try{await this._client.destroy(),this._client=null}catch(e){a.error(e)}}}},{"@motrix/nat-api":"lHksA",debug:"bO5wM","es6-promisify":"4jb5N",multiaddr:"8Mu1u",wherearewe:"lr9au","p-retry":"3fyh8","private-ip":"kXRph","../package.json":"cq0b4","err-code":"chZjB","./errors":"3rNo5","libp2p-utils/src/multiaddr/is-loopback":"55HY1"}],"4jb5N":[function(e,t,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"promisify",(()=>n));function n(e){if("function"!=typeof e)throw new TypeError("Argument to promisify must be a function");var t=e["__ES6-PROMISIFY--CUSTOM-ARGUMENTS__"],r=n.Promise||Promise;if("function"!=typeof r)throw new Error("No Promise implementation found; do you need a polyfill?");return function(){for(var i=arguments.length,n=Array(i),s=0;s<i;s++)n[s]=arguments[s];return new r(((r,i)=>{n.push((function(e){if(e)return i(e);for(var n=arguments.length,s=Array(1<n?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];if(1===s.length||!t)return r(s[0]);var a={};s.forEach(((e,r)=>{var i=t[r];i&&(a[i]=e)})),r(a)})),e.apply(this,n)}))}}n.argumentNames="__ES6-PROMISIFY--CUSTOM-ARGUMENTS__",n.Promise=void 0},{"@parcel/transformer-js/src/esmodule-helpers.js":"h08wk"}],lr9au:[function(e,t,r){var i=e("process");const n=e("is-electron"),s="object"==typeof window&&"object"==typeof document&&9===document.nodeType,o=n(),a=s&&!o,c=o&&!s,u=o&&s,l="function"==typeof e&&void 0!==i&&void 0!==i.release&&"node"===i.release.name&&!o,d="function"==typeof importScripts&&"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,f=void 0!==i&&void 0!==i.env&&!1;t.exports={isTest:f,isElectron:o,isElectronMain:c,isElectronRenderer:u,isNode:l,isBrowser:a,isWebWorker:d,isEnvWithDom:s}},{process:"bjUAi","is-electron":"e6ybt"}],"3fyh8":[function(e,t,r){"use strict";const i=e("retry"),n=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class s extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,({message:e}=e)):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}}const o=(e,t)=>new Promise(((r,o)=>{t={onFailedAttempt:()=>{},retries:10,...t};const a=i.operation(t);a.attempt((async i=>{try{r(await e(i))}catch(e){if(!(e instanceof Error))return void o(new TypeError(`Non-error was thrown: "${e}". You should only throw errors.`));if(e instanceof s)a.stop(),o(e.originalError);else if(e instanceof TypeError&&(c=e.message,!n.includes(c)))a.stop(),o(e);else{((e,t,r)=>{const i=r.retries-(t-1);e.attemptNumber=t,e.retriesLeft=i})(e,i,t);try{await t.onFailedAttempt(e)}catch(e){return void o(e)}a.retry(e)||o(a.mainError())}}var c}))}));t.exports=o,t.exports.default=o,t.exports.AbortError=s},{retry:"l316T"}],l316T:[function(e,t,r){t.exports=e("./lib/retry")},{"./lib/retry":"e5bUs"}],e5bUs:[function(e,t,r){var i=e("./retry_operation");r.operation=function(e){var t=r.timeouts(e);return new i(t,{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})},r.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in e)t[r]=e[r];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],n=0;n<t.retries;n++)i.push(this.createTimeout(n,t));return e&&e.forever&&!i.length&&i.push(this.createTimeout(n,t)),i.sort((function(e,t){return e-t})),i},r.createTimeout=function(e,t){var r=t.randomize?Math.random()+1:1,i=Math.round(r*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return i=Math.min(i,t.maxTimeout)},r.wrap=function(e,t,i){if(t instanceof Array&&(i=t,t=null),!i)for(var n in i=[],e)"function"==typeof e[n]&&i.push(n);for(var s=0;s<i.length;s++){var o=i[s],a=e[o];e[o]=function(i){var n=r.operation(t),s=Array.prototype.slice.call(arguments,1),o=s.pop();s.push((function(e){n.retry(e)||(e&&(arguments[0]=n.mainError()),o.apply(this,arguments))})),n.attempt((function(){i.apply(e,s)}))}.bind(e,a),e[o].options=t}}},{"./retry_operation":"8VXsG"}],"8VXsG":[function(e,t,r){function i(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=i,i.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},i.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},i.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1)}var i=this;return this._timer=setTimeout((function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout((function(){i._operationTimeoutCb(i._attempts)}),i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)}),r),this._options.unref&&this._timer.unref(),!0},i.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){r._operationTimeoutCb()}),r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},i.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},i.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},i.prototype.start=i.prototype.try,i.prototype.errors=function(){return this._errors},i.prototype.attempts=function(){return this._attempts},i.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,r=0,i=0;i<this._errors.length;i++){var n=this._errors[i],s=n.message,o=(e[s]||0)+1;e[s]=o,o>=r&&(t=n,r=o)}return t}},{}],"55HY1":[function(e,t,r){"use strict";const i=e("is-loopback-addr");t.exports=function(e){const{address:t}=e.nodeAddress();return i(t)}},{"is-loopback-addr":"8SMxm"}],"8SMxm":[function(e,t,r){"use strict";t.exports=function(e){return/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^::1$/.test(e)}},{}],"1MCQb":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-bitswap"),n=e("./libp2p.js"),s=e("multiaddr"),o=e("err-code"),a=e("../block-storage.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(o);class l{constructor(e,t,r,i,n){this.peerId=e,this.libp2p=t,this.bitswap=r,this.repo=i,this.blockstore=n}static async start({peerId:e,repo:t,print:r,options:s}){t.closed&&await t.open();const o=await t.config.getAll(),c=await n.createLibp2p({options:s,repo:t,peerId:e,multiaddrs:d(e,o),config:o,keychainConfig:void 0});c.keychain&&await c.loadKeychain(),await c.start();for(const t of c.multiaddrs)r(`Swarm listening on ${t}/p2p/${e.toB58String()}`);const u=i.createBitswap(c,t.blocks,{statsEnabled:!0});await u.start();const f=new a.BlockStorage(t.blocks,u);return t.blocks=f,t.pins.blockstore=f,new l(e,c,u,t,f)}static async stop(e){e.repo.blocks=e.blockstore.unwrap(),e.repo.pins.blockstore=e.blockstore.unwrap(),await Promise.all([e.bitswap.stop(),e.libp2p.stop()])}}const d=(e,t)=>{const r=e.toB58String(),i=[],n=t.Addresses&&t.Addresses.Swarm||[];for(const e of n){let t=new s.Multiaddr(e);if(t.protoCodes().includes(f))throw u.default(new Error("websocket-star swarm addresses are not supported. See https://github.com/ipfs/js-ipfs/issues/2779"),"ERR_WEBSOCKET_STAR_SWARM_ADDR_NOT_SUPPORTED");const n=t.getPeerId();n&&n!==r&&(t=t.encapsulate(`/p2p/${r}`)),i.push(t)}return i},f=479;r.Network=l},{"ipfs-bitswap":"flwND","./libp2p.js":"jcB2q",multiaddr:"8Mu1u","err-code":"chZjB","../block-storage.js":"55a3I"}],flwND:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./bitswap.js");r.createBitswap=(e,t,r={})=>new i.Bitswap(e,t,r)},{"./bitswap.js":"dAIea"}],dAIea:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./want-manager/index.js"),n=e("./network.js"),s=e("./decision-engine/index.js"),o=e("./notifications.js"),a=e("./utils/index.js"),c=e("./stats/index.js"),u=e("native-abort-controller"),l=e("any-signal"),d=e("blockstore-core/base"),f=e("multiformats/cid");const h={statsEnabled:!1,statsComputeThrottleTimeout:1e3,statsComputeThrottleMaxQueueSize:1e3},p=["blocksReceived","dataReceived","dupBlksReceived","dupDataReceived","blocksSent","dataSent","providesBufferLength","wantListLength","peerCount"];class g extends d.BaseBlockstore{constructor(e,t,r={}){super(),this._libp2p=e,this._log=a.logger(this.peerId),this._options=Object.assign({},h,r),this._stats=new c.Stats(p,{enabled:this._options.statsEnabled,computeThrottleTimeout:this._options.statsComputeThrottleTimeout,computeThrottleMaxQueueSize:this._options.statsComputeThrottleMaxQueueSize}),this.network=new n.Network(e,this,this._stats,{hashLoader:r.hashLoader}),this.blockstore=t,this.engine=new s.DecisionEngine(this.peerId,t,this.network,this._stats),this.wm=new i.WantManager(this.peerId,this.network,this._stats),this.notifications=new o.Notifications(this.peerId),this.started=!1}isStarted(){return this.started}get peerId(){return this._libp2p.peerId}async _receiveMessage(e,t){try{await this.engine.messageReceived(e,t)}catch(e){this._log("failed to receive message",t)}if(0===t.blocks.size)return;const r=[];for(const[e,i]of t.blocks.entries()){const t=f.CID.parse(e);r.push({wasWanted:this.wm.wantlist.contains(t),cid:t,data:i})}this.wm.cancelWants(r.filter((({wasWanted:e})=>e)).map((({cid:e})=>e))),await Promise.all(r.map((({cid:t,wasWanted:r,data:i})=>this._handleReceivedBlock(e,t,i,r))))}async _handleReceivedBlock(e,t,r,i){this._log("received block");const n=await this.blockstore.has(t);this._updateReceiveCounters(e.toB58String(),t,r,n),i&&await this.put(t,r)}_updateReceiveCounters(e,t,r,i){this._stats.push(e,"blocksReceived",1),this._stats.push(e,"dataReceived",r.length),i&&(this._stats.push(e,"dupBlksReceived",1),this._stats.push(e,"dupDataReceived",r.length))}_receiveError(e){this._log.error("ReceiveError: %s",e.message)}_onPeerConnected(e){this.wm.connected(e)}_onPeerDisconnected(e){this.wm.disconnected(e),this.engine.peerDisconnected(e),this._stats.disconnected(e)}enableStats(){this._stats.enable()}disableStats(){this._stats.disable()}wantlistForPeer(e,t){return this.engine.wantlistForPeer(e)}ledgerForPeer(e){return this.engine.ledgerForPeer(e)}async get(e,t={}){const r=(e,t)=>(this.wm.wantBlocks([e],t),this.notifications.wantBlock(e,t));let i=!1;const n=new u.AbortController,s=t.signal?l.anySignal([t.signal,n.signal]):n.signal,o=await Promise.race([this.notifications.wantBlock(e,{signal:s}),(async(e,t)=>{try{return await this.blockstore.get(e,t)}catch(n){if("ERR_NOT_FOUND"!==n.code)throw n;return i||(i=!0,this.network.findAndConnect(e).catch((e=>this._log.error(e)))),r(e,t)}})(e,{signal:s})]);return n.abort(),o}async*getMany(e,t={}){for await(const r of e)yield this.get(r,t)}unwant(e){const t=Array.isArray(e)?e:[e];this.wm.unwantBlocks(t),t.forEach((e=>this.notifications.unwantBlock(e)))}cancelWants(e){this.wm.cancelWants(Array.isArray(e)?e:[e])}async put(e,t,r){await this.blockstore.put(e,t),this._sendHaveBlockNotifications(e,t)}async*putMany(e,t){for await(const{key:r,value:i}of this.blockstore.putMany(e,t))this._sendHaveBlockNotifications(r,i),yield{key:r,value:i}}_sendHaveBlockNotifications(e,t){this.notifications.hasBlock(e,t),this.engine.receivedBlocks([{cid:e,data:t}]),this.network.provide(e).catch((e=>{this._log.error("Failed to provide: %s",e.message)}))}getWantlist(){return this.wm.wantlist.entries()}peers(){return this.engine.peers()}stat(){return this._stats}start(){this.wm.start(),this.network.start(),this.engine.start(),this.started=!0}stop(){this._stats.stop(),this.wm.stop(),this.network.stop(),this.engine.stop(),this.started=!1}unwrap(){return this.blockstore}}r.Bitswap=g},{"./want-manager/index.js":"i19lk","./network.js":"5d3og","./decision-engine/index.js":"drDE5","./notifications.js":"jCbDy","./utils/index.js":"9omCc","./stats/index.js":"da28N","native-abort-controller":"6zwoZ","any-signal":"kXgRR","blockstore-core/base":"l2CNM","multiformats/cid":"9ooAY"}],i19lk:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../message/index.js"),n=e("../wantlist/index.js"),s=e("../constants.js"),o=e("./msg-queue.js"),a=e("../utils/index.js"),c=e("multiformats/bases/base58");r.WantManager=class{constructor(e,t,r){this.peers=new Map,this.wantlist=new n.Wantlist(r),this.network=t,this._stats=r,this._peerId=e,this._log=a.logger(e,"want")}_addEntries(e,t,r){const n=e.map(((e,r)=>new i.BitswapMessage.Entry(e,s.kMaxPriority-r,i.BitswapMessage.WantType.Block,t)));n.forEach((e=>{e.cancel?r?this.wantlist.removeForce(e.cid.toString(c.base58btc)):this.wantlist.remove(e.cid):(this._log("adding to wl"),this.wantlist.add(e.cid,e.priority))}));for(const e of this.peers.values())e.addEntries(n)}_startPeerHandler(e){let t=this.peers.get(e.toB58String());if(t)return void t.refcnt++;t=new o.MsgQueue(this._peerId,e,this.network);const r=new i.BitswapMessage(!0);for(const e of this.wantlist.entries())r.addEntry(e[1].cid,e[1].priority);return t.addMessage(r),this.peers.set(e.toB58String(),t),t}_stopPeerHandler(e){const t=this.peers.get(e.toB58String());t&&(t.refcnt--,t.refcnt>0||this.peers.delete(e.toB58String()))}wantBlocks(e,t={}){this._addEntries(e,!1),t&&t.signal&&t.signal.addEventListener("abort",(()=>{this.cancelWants(e)}))}unwantBlocks(e){this._log("unwant blocks: %s",e.length),this._addEntries(e,!0,!0)}cancelWants(e){this._log("cancel wants: %s",e.length),this._addEntries(e,!0)}connectedPeers(){return Array.from(this.peers.keys())}connected(e){this._startPeerHandler(e)}disconnected(e){this._stopPeerHandler(e)}start(){}stop(){this.peers.forEach((e=>this.disconnected(e.peerId)))}}},{"../message/index.js":"3KDsa","../wantlist/index.js":"hFdtZ","../constants.js":"jvLuC","./msg-queue.js":"bgetp","../utils/index.js":"9omCc","multiformats/bases/base58":"4n7mA"}],"3KDsa":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("multiformats/hashes/sha2"),s=e("multiformats/bases/base58"),o=e("varint-decoder"),a=e("../utils/varint-encoder.js"),c=e("../utils/index.js"),u=e("./message.js"),l=e("./entry.js"),d=e("err-code");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=f(o),p=f(d);class g{constructor(e){this.full=e,this.wantlist=new Map,this.blocks=new Map,this.blockPresences=new Map,this.pendingBytes=0}get empty(){return 0===this.blocks.size&&0===this.wantlist.size&&0===this.blockPresences.size}addEntry(e,t,r,i,n){null==r&&(r=g.WantType.Block);const o=e.toString(s.base58btc),a=this.wantlist.get(o);a?(a.wantType===r&&(a.priority=t),i&&(a.cancel=Boolean(i)),n&&(a.sendDontHave=Boolean(n)),r===g.WantType.Block&&a.wantType===g.WantType.Have&&(a.wantType=r)):this.wantlist.set(o,new l.BitswapMessageEntry(e,t,r,i,n))}addBlock(e,t){const r=e.toString(s.base58btc);this.blocks.set(r,t)}addHave(e){const t=e.toString(s.base58btc);this.blockPresences.has(t)||this.blockPresences.set(t,g.BlockPresenceType.Have)}addDontHave(e){const t=e.toString(s.base58btc);this.blockPresences.has(t)||this.blockPresences.set(t,g.BlockPresenceType.DontHave)}cancel(e){const t=e.toString(s.base58btc);this.wantlist.delete(t),this.addEntry(e,0,g.WantType.Block,!0,!1)}setPendingBytes(e){this.pendingBytes=e}serializeToBitswap100(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map((e=>({block:e.cid.bytes,priority:Number(e.priority),cancel:Boolean(e.cancel)}))),full:!!this.full||void 0},blocks:Array.from(this.blocks.values())};return u.Message.encode(e).finish()}serializeToBitswap110(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map((e=>({block:e.cid.bytes,priority:Number(e.priority),wantType:e.wantType,cancel:Boolean(e.cancel),sendDontHave:Boolean(e.sendDontHave)}))),full:!!this.full||void 0},blockPresences:[],payload:[],pendingBytes:this.pendingBytes};for(const[t,r]of this.blocks.entries()){const n=i.CID.parse(t),s=n.version,o=n.code,c=n.multihash.code,l=n.multihash.digest.length,d=a([s,o,c,l]);e.payload.push(new u.Message.Block({prefix:d,data:r}))}for(const[t,r]of this.blockPresences)e.blockPresences.push(new u.Message.BlockPresence({cid:i.CID.parse(t).bytes,type:r}));return this.pendingBytes>0&&(e.pendingBytes=this.pendingBytes),u.Message.encode(e).finish()}equals(e){return!!(this.full===e.full&&this.pendingBytes===e.pendingBytes&&c.isMapEqual(this.wantlist,e.wantlist)&&c.isMapEqual(this.blocks,e.blocks)&&c.isMapEqual(this.blockPresences,e.blockPresences))}get[Symbol.toStringTag](){const e=Array.from(this.wantlist.keys()),t=Array.from(this.blocks.keys());return`BitswapMessage <full: ${this.full}, list: ${e}, blocks: ${t}>`}}g.deserialize=async(e,t)=>{const r=u.Message.decode(e),s=r.wantlist&&r.wantlist.full||!1,o=new g(s);return r.wantlist&&r.wantlist.entries&&r.wantlist.entries.forEach((e=>{if(!e.block)return;const t=i.CID.decode(e.block);o.addEntry(t,e.priority||0,e.wantType,Boolean(e.cancel),Boolean(e.sendDontHave))})),r.blockPresences&&r.blockPresences.forEach((e=>{if(!e.cid)return;const t=i.CID.decode(e.cid);e.type===g.BlockPresenceType.Have?o.addHave(t):o.addDontHave(t)})),r.blocks.length>0?(await Promise.all(r.blocks.map((async e=>{const t=await n.sha256.digest(e),r=i.CID.createV0(t);o.addBlock(r,e)}))),o):r.payload.length>0?(await Promise.all(r.payload.map((async e=>{if(!e.prefix||!e.data)return;const r=h.default(e.prefix),s=r[0],a=r[1],c=r[2],u=c===n.sha256.code?n.sha256:t&&await t.getHasher(c);if(!u)throw p.default(new Error("Unknown hash algorithm"),"ERR_UNKNOWN_HASH_ALG");const l=await u.digest(e.data),d=i.CID.create(s,a,l);o.addBlock(d,e.data)}))),o.setPendingBytes(r.pendingBytes),o):o},g.blockPresenceSize=e=>e.bytes.length+1,g.Entry=l.BitswapMessageEntry,g.WantType={Block:u.Message.Wantlist.WantType.Block,Have:u.Message.Wantlist.WantType.Have},g.BlockPresenceType={Have:u.Message.BlockPresenceType.Have,DontHave:u.Message.BlockPresenceType.DontHave},r.BitswapMessage=g},{"multiformats/cid":"9ooAY","multiformats/hashes/sha2":"7i9MT","multiformats/bases/base58":"4n7mA","varint-decoder":"4XERa","../utils/varint-encoder.js":"4kcuH","../utils/index.js":"9omCc","./message.js":"2JgzA","./entry.js":"7Jb33","err-code":"chZjB"}],"4XERa":[function(e,t,r){"use strict";const i=e("varint");t.exports=e=>{if(!(e instanceof Uint8Array))throw new Error("arg needs to be a Uint8Array");const t=[];for(;e.length>0;){const r=i.decode(e);t.push(r),e=e.slice(i.decode.bytes)}return t}},{varint:"lqmon"}],lqmon:[function(e,t,r){t.exports={encode:e("./encode.js"),decode:e("./decode.js"),encodingLength:e("./length.js")}},{"./encode.js":"2HIPs","./decode.js":"5Jcva","./length.js":"cD3BZ"}],"2HIPs":[function(e,t,r){t.exports=function e(t,r,n){r=r||[];var s=n=n||0;for(;t>=i;)r[n++]=255&t|128,t/=128;for(;-128&t;)r[n++]=255&t|128,t>>>=7;return r[n]=0|t,e.bytes=n-s+1,r};var i=Math.pow(2,31)},{}],"5Jcva":[function(e,t,r){t.exports=function e(t,r){var i,n=0,s=0,o=r=r||0,a=t.length;do{if(o>=a)throw e.bytes=0,new RangeError("Could not decode varint");i=t[o++],n+=s<28?(127&i)<<s:(127&i)*Math.pow(2,s),s+=7}while(i>=128);return e.bytes=o-r,n}},{}],cD3BZ:[function(e,t,r){var i=Math.pow(2,7),n=Math.pow(2,14),s=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),c=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),d=Math.pow(2,63);t.exports=function(e){return e<i?1:e<n?2:e<s?3:e<o?4:e<a?5:e<c?6:e<u?7:e<l?8:e<d?9:10}},{}],"4kcuH":[function(e,t,r){"use strict";function i(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=i(e("varint"));t.exports=function(e){let t=new Uint8Array(e.reduce(((e,t)=>e+n.default.encodingLength(t)),0)),r=0;for(const i of e)t=n.encode(i,t,r),r+=n.default.encodingLength(i);return t}},{varint:"aN1CO"}],"9omCc":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("debug"),n=e("uint8arrays/equals"),s=e("../message/entry.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(i);const c=(e,t,r)=>{let i=0;const n=r.length;for(;i<n;){if(e(t,r[i]))return!0;i+=1}return!1};r.groupBy=(e,t)=>t.reduce(((t,r)=>{const i=e(r);return t[i]?t[i].push(r):t[i]=[r],t}),{}),r.includesWith=c,r.isMapEqual=(e,t)=>{if(e.size!==t.size)return!1;for(const[r,i]of e){const e=t.get(r);if(void 0===e)return!1;if(i instanceof Uint8Array&&e instanceof Uint8Array&&!n.equals(i,e))return!1;if(i instanceof s.BitswapMessageEntry&&e instanceof s.BitswapMessageEntry&&!i.equals(e))return!1}return!0},r.logger=(e,t)=>{const r=["bitswap"];return t&&r.push(t),e&&r.push(`${e.toB58String().slice(0,8)}`),Object.assign(a.default(r.join(":")),{error:a.default(r.concat(["error"]).join(":"))})},r.pullAllWith=(e,t,r)=>t.filter((t=>!c(e,t,r))),r.sortBy=(e,t)=>Array.prototype.slice.call(t,0).sort(((t,r)=>{const i=e(t),n=e(r);return i<n?-1:i>n?1:0})),r.uniqWith=(e,t)=>{let r=0;const i=t.length,n=[];let s;for(;r<i;)s=t[r],c(e,s,n)||(n[n.length]=s),r+=1;return n}},{debug:"bO5wM","uint8arrays/equals":"eY3cX","../message/entry.js":"7Jb33"}],"7Jb33":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../wantlist/index.js"),n=e("multiformats/bases/base58");const s=i.Wantlist.Entry;class o{constructor(e,t,r,i,n){this.entry=new s(e,t,r),this.cancel=Boolean(i),this.sendDontHave=Boolean(n)}get cid(){return this.entry.cid}set cid(e){this.entry.cid=e}get priority(){return this.entry.priority}set priority(e){this.entry.priority=e}get wantType(){return this.entry.wantType}set wantType(e){this.entry.wantType=e}get[Symbol.toStringTag](){return`BitswapMessageEntry ${this.cid.toString(n.base58btc)} <cancel: ${this.cancel}, priority: ${this.priority}>`}equals(e){return this.cancel===e.cancel&&this.sendDontHave===e.sendDontHave&&this.wantType===e.wantType&&this.entry.equals(e.entry)}}r.BitswapMessageEntry=o},{"../wantlist/index.js":"hFdtZ","multiformats/bases/base58":"4n7mA"}],hFdtZ:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./entry.js"),n=e("multiformats/bases/base58"),s=e("../message/message.js");const o=s.Message.Wantlist.WantType.Block,a=s.Message.Wantlist.WantType.Have;class c{constructor(e){this.set=new Map,this._stats=e}get length(){return this.set.size}add(e,t,r){const s=e.toString(n.base58btc),c=this.set.get(s);c?(c.inc(),c.priority=t,c.wantType===a&&r===o&&(c.wantType=r)):(this.set.set(s,new i.WantListEntry(e,t,r)),this._stats&&this._stats.push(null,"wantListSize",1))}remove(e){const t=e.toString(n.base58btc),r=this.set.get(t);r&&(r.dec(),r.hasRefs()||(this.set.delete(t),this._stats&&this._stats.push(null,"wantListSize",-1)))}removeForce(e){this.set.has(e)&&this.set.delete(e)}forEach(e){return this.set.forEach(e)}entries(){return this.set.entries()}sortedEntries(){return new Map((e=e=>e[1].key,t=Array.from(this.set.entries()),Array.prototype.slice.call(t,0).sort(((t,r)=>{const i=e(t),n=e(r);return i<n?-1:i>n?1:0}))));var e,t}contains(e){const t=e.toString(n.base58btc);return this.set.has(t)}get(e){const t=e.toString(n.base58btc);return this.set.get(t)}}c.Entry=i.WantListEntry,r.Wantlist=c},{"./entry.js":"9pqLF","multiformats/bases/base58":"4n7mA","../message/message.js":"2JgzA"}],"9pqLF":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/bases/base58");class n{constructor(e,t,r){this._refCounter=1,this.cid=e,this.priority=t||1,this.wantType=r}inc(){this._refCounter+=1}dec(){this._refCounter=Math.max(0,this._refCounter-1)}hasRefs(){return this._refCounter>0}get[Symbol.toStringTag](){return`WantlistEntry <key: ${this.cid.toString(i.base58btc)}, priority: ${this.priority}, refs: ${this._refCounter}>`}equals(e){return this._refCounter===e._refCounter&&this.cid.equals(e.cid)&&this.priority===e.priority&&this.wantType===e.wantType}}r.WantListEntry=n},{"multiformats/bases/base58":"4n7mA"}],"2JgzA":[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("protobufjs/minimal.js"));const s=n.default.Reader,o=n.default.Writer,a=n.default.util,c=n.default.roots["ipfs-bitswap"]||(n.default.roots["ipfs-bitswap"]={}),u=c.Message=(()=>{function e(e){if(this.blocks=[],this.payload=[],this.blockPresences=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.wantlist=null,e.prototype.blocks=a.emptyArray,e.prototype.payload=a.emptyArray,e.prototype.blockPresences=a.emptyArray,e.prototype.pendingBytes=0,e.encode=function(e,t){if(t||(t=o.create()),null!=e.wantlist&&Object.hasOwnProperty.call(e,"wantlist")&&c.Message.Wantlist.encode(e.wantlist,t.uint32(10).fork()).ldelim(),null!=e.blocks&&e.blocks.length)for(var r=0;r<e.blocks.length;++r)t.uint32(18).bytes(e.blocks[r]);if(null!=e.payload&&e.payload.length)for(r=0;r<e.payload.length;++r)c.Message.Block.encode(e.payload[r],t.uint32(26).fork()).ldelim();if(null!=e.blockPresences&&e.blockPresences.length)for(r=0;r<e.blockPresences.length;++r)c.Message.BlockPresence.encode(e.blockPresences[r],t.uint32(34).fork()).ldelim();return null!=e.pendingBytes&&Object.hasOwnProperty.call(e,"pendingBytes")&&t.uint32(40).int32(e.pendingBytes),t},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new c.Message;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.wantlist=c.Message.Wantlist.decode(e,e.uint32());break;case 2:i.blocks&&i.blocks.length||(i.blocks=[]),i.blocks.push(e.bytes());break;case 3:i.payload&&i.payload.length||(i.payload=[]),i.payload.push(c.Message.Block.decode(e,e.uint32()));break;case 4:i.blockPresences&&i.blockPresences.length||(i.blockPresences=[]),i.blockPresences.push(c.Message.BlockPresence.decode(e,e.uint32()));break;case 5:i.pendingBytes=e.int32();break;default:e.skipType(7&n)}}return i},e.fromObject=function(e){if(e instanceof c.Message)return e;var t=new c.Message;if(null!=e.wantlist){if("object"!=typeof e.wantlist)throw TypeError(".Message.wantlist: object expected");t.wantlist=c.Message.Wantlist.fromObject(e.wantlist)}if(e.blocks){if(!Array.isArray(e.blocks))throw TypeError(".Message.blocks: array expected");t.blocks=[];for(var r=0;r<e.blocks.length;++r)"string"==typeof e.blocks[r]?a.base64.decode(e.blocks[r],t.blocks[r]=a.newBuffer(a.base64.length(e.blocks[r])),0):e.blocks[r].length&&(t.blocks[r]=e.blocks[r])}if(e.payload){if(!Array.isArray(e.payload))throw TypeError(".Message.payload: array expected");t.payload=[];for(r=0;r<e.payload.length;++r){if("object"!=typeof e.payload[r])throw TypeError(".Message.payload: object expected");t.payload[r]=c.Message.Block.fromObject(e.payload[r])}}if(e.blockPresences){if(!Array.isArray(e.blockPresences))throw TypeError(".Message.blockPresences: array expected");t.blockPresences=[];for(r=0;r<e.blockPresences.length;++r){if("object"!=typeof e.blockPresences[r])throw TypeError(".Message.blockPresences: object expected");t.blockPresences[r]=c.Message.BlockPresence.fromObject(e.blockPresences[r])}}return null!=e.pendingBytes&&(t.pendingBytes=0|e.pendingBytes),t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.blocks=[],r.payload=[],r.blockPresences=[]),t.defaults&&(r.wantlist=null,r.pendingBytes=0),null!=e.wantlist&&e.hasOwnProperty("wantlist")&&(r.wantlist=c.Message.Wantlist.toObject(e.wantlist,t)),e.blocks&&e.blocks.length){r.blocks=[];for(var i=0;i<e.blocks.length;++i)r.blocks[i]=t.bytes===String?a.base64.encode(e.blocks[i],0,e.blocks[i].length):t.bytes===Array?Array.prototype.slice.call(e.blocks[i]):e.blocks[i]}if(e.payload&&e.payload.length){r.payload=[];for(i=0;i<e.payload.length;++i)r.payload[i]=c.Message.Block.toObject(e.payload[i],t)}if(e.blockPresences&&e.blockPresences.length){r.blockPresences=[];for(i=0;i<e.blockPresences.length;++i)r.blockPresences[i]=c.Message.BlockPresence.toObject(e.blockPresences[i],t)}return null!=e.pendingBytes&&e.hasOwnProperty("pendingBytes")&&(r.pendingBytes=e.pendingBytes),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.default.util.toJSONOptions)},e.Wantlist=function(){function e(e){if(this.entries=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.entries=a.emptyArray,e.prototype.full=!1,e.encode=function(e,t){if(t||(t=o.create()),null!=e.entries&&e.entries.length)for(var r=0;r<e.entries.length;++r)c.Message.Wantlist.Entry.encode(e.entries[r],t.uint32(10).fork()).ldelim();return null!=e.full&&Object.hasOwnProperty.call(e,"full")&&t.uint32(16).bool(e.full),t},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new c.Message.Wantlist;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.entries&&i.entries.length||(i.entries=[]),i.entries.push(c.Message.Wantlist.Entry.decode(e,e.uint32()));break;case 2:i.full=e.bool();break;default:e.skipType(7&n)}}return i},e.fromObject=function(e){if(e instanceof c.Message.Wantlist)return e;var t=new c.Message.Wantlist;if(e.entries){if(!Array.isArray(e.entries))throw TypeError(".Message.Wantlist.entries: array expected");t.entries=[];for(var r=0;r<e.entries.length;++r){if("object"!=typeof e.entries[r])throw TypeError(".Message.Wantlist.entries: object expected");t.entries[r]=c.Message.Wantlist.Entry.fromObject(e.entries[r])}}return null!=e.full&&(t.full=Boolean(e.full)),t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.entries=[]),t.defaults&&(r.full=!1),e.entries&&e.entries.length){r.entries=[];for(var i=0;i<e.entries.length;++i)r.entries[i]=c.Message.Wantlist.Entry.toObject(e.entries[i],t)}return null!=e.full&&e.hasOwnProperty("full")&&(r.full=e.full),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.default.util.toJSONOptions)},e.WantType=function(){const e={},t=Object.create(e);return t[e[0]="Block"]=0,t[e[1]="Have"]=1,t}(),e.Entry=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.block=a.newBuffer([]),e.prototype.priority=0,e.prototype.cancel=!1,e.prototype.wantType=0,e.prototype.sendDontHave=!1,e.encode=function(e,t){return t||(t=o.create()),null!=e.block&&Object.hasOwnProperty.call(e,"block")&&t.uint32(10).bytes(e.block),null!=e.priority&&Object.hasOwnProperty.call(e,"priority")&&t.uint32(16).int32(e.priority),null!=e.cancel&&Object.hasOwnProperty.call(e,"cancel")&&t.uint32(24).bool(e.cancel),null!=e.wantType&&Object.hasOwnProperty.call(e,"wantType")&&t.uint32(32).int32(e.wantType),null!=e.sendDontHave&&Object.hasOwnProperty.call(e,"sendDontHave")&&t.uint32(40).bool(e.sendDontHave),t},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new c.Message.Wantlist.Entry;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.block=e.bytes();break;case 2:i.priority=e.int32();break;case 3:i.cancel=e.bool();break;case 4:i.wantType=e.int32();break;case 5:i.sendDontHave=e.bool();break;default:e.skipType(7&n)}}return i},e.fromObject=function(e){if(e instanceof c.Message.Wantlist.Entry)return e;var t=new c.Message.Wantlist.Entry;switch(null!=e.block&&("string"==typeof e.block?a.base64.decode(e.block,t.block=a.newBuffer(a.base64.length(e.block)),0):e.block.length&&(t.block=e.block)),null!=e.priority&&(t.priority=0|e.priority),null!=e.cancel&&(t.cancel=Boolean(e.cancel)),e.wantType){case"Block":case 0:t.wantType=0;break;case"Have":case 1:t.wantType=1}return null!=e.sendDontHave&&(t.sendDontHave=Boolean(e.sendDontHave)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.block="":(r.block=[],t.bytes!==Array&&(r.block=a.newBuffer(r.block))),r.priority=0,r.cancel=!1,r.wantType=t.enums===String?"Block":0,r.sendDontHave=!1),null!=e.block&&e.hasOwnProperty("block")&&(r.block=t.bytes===String?a.base64.encode(e.block,0,e.block.length):t.bytes===Array?Array.prototype.slice.call(e.block):e.block),null!=e.priority&&e.hasOwnProperty("priority")&&(r.priority=e.priority),null!=e.cancel&&e.hasOwnProperty("cancel")&&(r.cancel=e.cancel),null!=e.wantType&&e.hasOwnProperty("wantType")&&(r.wantType=t.enums===String?c.Message.Wantlist.WantType[e.wantType]:e.wantType),null!=e.sendDontHave&&e.hasOwnProperty("sendDontHave")&&(r.sendDontHave=e.sendDontHave),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.default.util.toJSONOptions)},e}(),e}(),e.Block=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.prefix=a.newBuffer([]),e.prototype.data=a.newBuffer([]),e.encode=function(e,t){return t||(t=o.create()),null!=e.prefix&&Object.hasOwnProperty.call(e,"prefix")&&t.uint32(10).bytes(e.prefix),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(18).bytes(e.data),t},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new c.Message.Block;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.prefix=e.bytes();break;case 2:i.data=e.bytes();break;default:e.skipType(7&n)}}return i},e.fromObject=function(e){if(e instanceof c.Message.Block)return e;var t=new c.Message.Block;return null!=e.prefix&&("string"==typeof e.prefix?a.base64.decode(e.prefix,t.prefix=a.newBuffer(a.base64.length(e.prefix)),0):e.prefix.length&&(t.prefix=e.prefix)),null!=e.data&&("string"==typeof e.data?a.base64.decode(e.data,t.data=a.newBuffer(a.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.prefix="":(r.prefix=[],t.bytes!==Array&&(r.prefix=a.newBuffer(r.prefix))),t.bytes===String?r.data="":(r.data=[],t.bytes!==Array&&(r.data=a.newBuffer(r.data)))),null!=e.prefix&&e.hasOwnProperty("prefix")&&(r.prefix=t.bytes===String?a.base64.encode(e.prefix,0,e.prefix.length):t.bytes===Array?Array.prototype.slice.call(e.prefix):e.prefix),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?a.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.default.util.toJSONOptions)},e}(),e.BlockPresenceType=function(){const e={},t=Object.create(e);return t[e[0]="Have"]=0,t[e[1]="DontHave"]=1,t}(),e.BlockPresence=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.cid=a.newBuffer([]),e.prototype.type=0,e.encode=function(e,t){return t||(t=o.create()),null!=e.cid&&Object.hasOwnProperty.call(e,"cid")&&t.uint32(10).bytes(e.cid),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(16).int32(e.type),t},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var r=void 0===t?e.len:e.pos+t,i=new c.Message.BlockPresence;e.pos<r;){var n=e.uint32();switch(n>>>3){case 1:i.cid=e.bytes();break;case 2:i.type=e.int32();break;default:e.skipType(7&n)}}return i},e.fromObject=function(e){if(e instanceof c.Message.BlockPresence)return e;var t=new c.Message.BlockPresence;switch(null!=e.cid&&("string"==typeof e.cid?a.base64.decode(e.cid,t.cid=a.newBuffer(a.base64.length(e.cid)),0):e.cid.length&&(t.cid=e.cid)),e.type){case"Have":case 0:t.type=0;break;case"DontHave":case 1:t.type=1}return t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.cid="":(r.cid=[],t.bytes!==Array&&(r.cid=a.newBuffer(r.cid))),r.type=t.enums===String?"Have":0),null!=e.cid&&e.hasOwnProperty("cid")&&(r.cid=t.bytes===String?a.base64.encode(e.cid,0,e.cid.length):t.bytes===Array?Array.prototype.slice.call(e.cid):e.cid),null!=e.type&&e.hasOwnProperty("type")&&(r.type=t.enums===String?c.Message.BlockPresenceType[e.type]:e.type),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.default.util.toJSONOptions)},e}(),e})();r.Message=u,r.default=c},{"protobufjs/minimal.js":"grAXL"}],jvLuC:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=Math.pow(2,31)-1;r.hasBlockTimeout=15e3,r.kMaxPriority=i,r.maxListeners=1e3,r.maxProvidersPerRequest=3,r.provideTimeout=15e3,r.providerRequestTimeout=1e4,r.wantlistSendDebounceMs=1},{}],bgetp:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("just-debounce-it"),n=e("../message/index.js"),s=e("../utils/index.js"),o=e("../constants.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(i);r.MsgQueue=class{constructor(e,t,r){this.peerId=t,this.network=r,this.refcnt=1,this._entries=[],this._log=s.logger(e,"msgqueue"),this.sendEntries=c.default(this._sendEntries.bind(this),o.wantlistSendDebounceMs)}addMessage(e){e.empty||this.send(e)}addEntries(e){this._entries=this._entries.concat(e),this.sendEntries()}_sendEntries(){if(!this._entries.length)return;const e=new n.BitswapMessage(!1);this._entries.forEach((t=>{t.cancel?e.cancel(t.cid):e.addEntry(t.cid,t.priority)})),this._entries=[],this.addMessage(e)}async send(e){try{await this.network.connectTo(this.peerId)}catch(e){return void this._log.error("cant connect to peer %s: %s",this.peerId.toB58String(),e.message)}this._log("sending message to peer %s",this.peerId.toB58String()),this.network.sendMessage(this.peerId,e).catch((e=>{this._log.error("send error: %s",e.message)}))}}},{"just-debounce-it":"ci2L4","../message/index.js":"3KDsa","../utils/index.js":"9omCc","../constants.js":"jvLuC"}],ci2L4:[function(e,t,r){t.exports=function(e,t,r){var i=null,n=null,s=function(){i&&(clearTimeout(i),n=null,i=null)},o=function(){if(!t)return e.apply(this,arguments);var o=this,a=arguments,c=r&&!i;return s(),n=function(){e.apply(o,a)},i=setTimeout((function(){if(i=null,!c){var e=n;return n=null,e()}}),t),c?n():void 0};return o.cancel=s,o.flush=function(){var e=n;s(),e&&e()},o}},{}],"5d3og":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("it-length-prefixed"),n=e("it-pipe"),s=e("libp2p-interfaces/src/topology/multicodec-topology.js"),o=e("./message/index.js"),a=e("./constants.js"),c=e("./utils/index.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(i),d=u(s);const f="/ipfs/bitswap/1.0.0",h="/ipfs/bitswap/1.1.0",p="/ipfs/bitswap/1.2.0";r.Network=class{constructor(e,t,r,i={}){this._log=c.logger(e.peerId,"network"),this._libp2p=e,this._bitswap=t,this._protocols=[f],i.b100Only||(this._protocols.unshift(h),this._protocols.unshift(p)),this._stats=r,this._running=!1,this._onPeerConnect=this._onPeerConnect.bind(this),this._onPeerDisconnect=this._onPeerDisconnect.bind(this),this._onConnection=this._onConnection.bind(this),this._hashLoader=i.hashLoader}start(){this._running=!0,this._libp2p.handle(this._protocols,this._onConnection);const e=new d.default({multicodecs:this._protocols,handlers:{onConnect:this._onPeerConnect,onDisconnect:this._onPeerDisconnect}});this._registrarId=this._libp2p.registrar.register(e);for(const e of this._libp2p.peerStore.peers.values()){const t=this._libp2p.connectionManager.get(e.id);t&&this._onPeerConnect(t.remotePeer)}}stop(){this._running=!1,this._libp2p.unhandle(this._protocols),null!=this._registrarId&&this._libp2p.registrar.unregister(this._registrarId)}async _onConnection({protocol:e,stream:t,connection:r}){if(this._running){this._log("incoming new bitswap %s connection from %s",e,r.remotePeer.toB58String());try{await n.pipe(t,l.default.decode(),(async e=>{for await(const t of e)try{const e=await o.BitswapMessage.deserialize(t.slice(),this._hashLoader);await this._bitswap._receiveMessage(r.remotePeer,e)}catch(e){this._bitswap._receiveError(e);break}}))}catch(e){this._log(e)}}}_onPeerConnect(e){this._bitswap._onPeerConnected(e)}_onPeerDisconnect(e){this._bitswap._onPeerDisconnected(e)}findProviders(e,t,r={}){return this._libp2p.contentRouting.findProviders(e,{timeout:a.providerRequestTimeout,maxNumProviders:t})}async findAndConnect(e,t){const r=[];for await(const i of this.findProviders(e,a.maxProvidersPerRequest,t))this._log(`connecting to provider ${i.id}`),r.push(this.connectTo(i.id,t).catch((e=>{this._log.error(e)})));await Promise.all(r)}async provide(e,t){await this._libp2p.contentRouting.provide(e,t)}async sendMessage(e,t){if(!this._running)throw new Error("network isn't running");const r=e.toB58String();this._log("sendMessage to %s",r,t);const i=await this._libp2p.dial(e),{stream:s,protocol:o}=await i.newStream([p,h,f]);let a;switch(o){case f:a=t.serializeToBitswap100();break;case h:case p:a=t.serializeToBitswap110();break;default:throw new Error("Unknown protocol: "+o)}!async function(e,t,r){try{await n.pipe([t],l.default.encode(),e)}catch(e){r(e)}}(s,a,this._log),this._updateSentStats(e,t.blocks)}async connectTo(e,t){if(!this._running)throw new Error("network isn't running");return this._libp2p.dial(e,t)}_updateSentStats(e,t){const r=e.toB58String();if(this._stats){for(const e of t.values())this._stats.push(r,"dataSent",e.length);this._stats.push(r,"blocksSent",t.size)}}}},{"it-length-prefixed":"3yxIE","it-pipe":"giKBQ","libp2p-interfaces/src/topology/multicodec-topology.js":"52SML","./message/index.js":"3KDsa","./constants.js":"jvLuC","./utils/index.js":"9omCc"}],drDE5:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("multiformats/cid"),n=e("multiformats/bases/base58"),s=e("../message/index.js"),o=e("../wantlist/index.js"),a=e("./ledger.js"),c=e("./req-queue.js"),u=e("./task-merger.js"),l=e("../utils/index.js");const d=s.BitswapMessage.WantType;r.DecisionEngine=class{constructor(e,t,r,i,n={}){this._log=l.logger(e,"engine"),this.blockstore=t,this.network=r,this._stats=i,this._opts=this._processOpts(n),this.ledgerMap=new Map,this._running=!1,this._requestQueue=new c.RequestQueue(u.TaskMerger)}_processOpts(e){return{maxSizeReplaceHasWithBlock:1024,targetMessageSize:16384,...e}}_scheduleProcessTasks(){setTimeout((()=>{this._processTasks()}))}async _processTasks(){if(!this._running)return;const{peerId:e,tasks:t,pendingSize:r}=this._requestQueue.popTasks(this._opts.targetMessageSize);if(0===t.length)return;const n=new s.BitswapMessage(!1);n.setPendingBytes(r);const o=[],a=new Map;for(const e of t){const t=i.CID.parse(e.topic);e.data.haveBlock?e.data.isWantBlock?(o.push(t),a.set(e.topic,e.data)):n.addHave(t):n.addDontHave(t)}const c=await this._getBlocks(o);for(const[e,t]of a){const r=i.CID.parse(e),s=c.get(e);s?n.addBlock(r,s):t.sendDontHave&&n.addDontHave(r)}if(n.empty)return e&&this._requestQueue.tasksDone(e,t),void this._scheduleProcessTasks();try{e&&await this.network.sendMessage(e,n);for(const[t,r]of c.entries())e&&this.messageSent(e,i.CID.parse(t),r)}catch(e){this._log.error(e)}e&&this._requestQueue.tasksDone(e,t),this._scheduleProcessTasks()}wantlistForPeer(e){const t=e.toB58String(),r=this.ledgerMap.get(t);return r?r.wantlist.sortedEntries():new Map}ledgerForPeer(e){const t=e.toB58String(),r=this.ledgerMap.get(t);return r?{peer:r.partner,value:r.debtRatio(),sent:r.accounting.bytesSent,recv:r.accounting.bytesRecv,exchanged:r.exchangeCount}:null}peers(){return Array.from(this.ledgerMap.values()).map((e=>e.partner))}receivedBlocks(e){if(e.length){for(const t of this.ledgerMap.values())for(const r of e){const e=t.wantlistContains(r.cid);if(!e)continue;const i=r.data.length,o=this._sendAsBlock(e.wantType,i);let a=i;o||(a=s.BitswapMessage.blockPresenceSize(e.cid)),this._requestQueue.pushTasks(t.partner,[{topic:e.cid.toString(n.base58btc),priority:e.priority,size:a,data:{blockSize:i,isWantBlock:o,haveBlock:!0,sendDontHave:!1}}])}this._scheduleProcessTasks()}}async messageReceived(e,t){const r=this._findOrCreate(e);if(t.empty)return;if(t.full&&(r.wantlist=new o.Wantlist),this._updateBlockAccounting(t.blocks,r),0===t.wantlist.size)return void this._scheduleProcessTasks();const i=[],n=[];t.wantlist.forEach((e=>{e.cancel?(r.cancelWant(e.cid),i.push(e.cid)):(r.wants(e.cid,e.priority,e.wantType),n.push(e))})),this._cancelWants(e,i),await this._addWants(e,n),this._scheduleProcessTasks()}_cancelWants(e,t){for(const r of t)this._requestQueue.remove(r.toString(n.base58btc),e)}async _addWants(e,t){const r=await this._getBlockSizes(t.map((e=>e.cid))),i=[];for(const o of t){const t=o.cid.toString(n.base58btc),a=r.get(t);if(null==a)o.sendDontHave&&i.push({topic:t,priority:o.priority,size:s.BitswapMessage.blockPresenceSize(o.cid),data:{isWantBlock:o.wantType===d.Block,blockSize:0,haveBlock:!1,sendDontHave:o.sendDontHave}});else{const e=this._sendAsBlock(o.wantType,a);let r=a;e||(r=s.BitswapMessage.blockPresenceSize(o.cid)),i.push({topic:t,priority:o.priority,size:r,data:{isWantBlock:e,blockSize:a,haveBlock:!0,sendDontHave:o.sendDontHave}})}this._requestQueue.pushTasks(e,i)}}_sendAsBlock(e,t){return e===d.Block||t<=this._opts.maxSizeReplaceHasWithBlock}async _getBlockSizes(e){const t=await this._getBlocks(e);return new Map([...t].map((([e,t])=>[e,t.length])))}async _getBlocks(e){const t=new Map;return await Promise.all(e.map((async e=>{try{const r=await this.blockstore.get(e);t.set(e.toString(n.base58btc),r)}catch(t){"ERR_NOT_FOUND"!==t.code&&this._log.error("failed to query blockstore for %s: %s",e,t)}}))),t}_updateBlockAccounting(e,t){for(const r of e.values())this._log("got block (%s bytes)",r.length),t.receivedBytes(r.length)}messageSent(e,t,r){const i=this._findOrCreate(e);i.sentBytes(r.length),i.wantlist.remove(t)}numBytesSentTo(e){return this._findOrCreate(e).accounting.bytesSent}numBytesReceivedFrom(e){return this._findOrCreate(e).accounting.bytesRecv}peerDisconnected(e){}_findOrCreate(e){const t=e.toB58String(),r=this.ledgerMap.get(t);if(r)return r;const i=new a.Ledger(e);return this.ledgerMap.set(t,i),this._stats&&this._stats.push(t,"peerCount",1),i}start(){this._running=!0}stop(){this._running=!1}}},{"multiformats/cid":"9ooAY","multiformats/bases/base58":"4n7mA","../message/index.js":"3KDsa","../wantlist/index.js":"hFdtZ","./ledger.js":"9MSJX","./req-queue.js":"2w6WU","./task-merger.js":"hlwar","../utils/index.js":"9omCc"}],"9MSJX":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../wantlist/index.js");r.Ledger=class{constructor(e){this.partner=e,this.wantlist=new i.Wantlist,this.exchangeCount=0,this.sentToPeer=new Map,this.accounting={bytesSent:0,bytesRecv:0}}sentBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesSent+=e}receivedBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesRecv+=e}wants(e,t,r){this.wantlist.add(e,t,r)}cancelWant(e){this.wantlist.remove(e)}wantlistContains(e){return this.wantlist.get(e)}debtRatio(){return this.accounting.bytesSent/(this.accounting.bytesRecv+1)}}},{"../wantlist/index.js":"hFdtZ"}],"2w6WU":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../utils/sorted-map.js");const n={hasNewInfo:()=>!1,merge(){}};class s{constructor(e,t){this.peerId=e,this._taskMerger=t,this._activeTotalSize=0,this._pending=new o,this._active=new Set}pushTasks(e){for(const t of e)this._pushTask(t)}_pushTask(e){if(!this._taskHasMoreInfoThanActiveTasks(e))return;const t=this._pending.get(e.topic);if(t)return e.priority>t.priority&&this._pending.updatePriority(e.topic,e.priority),void this._taskMerger.merge(e,t);this._pending.add(e)}_taskHasMoreInfoThanActiveTasks(e){const t=[];for(const r of this._active)r.topic===e.topic&&t.push(r);return 0===t.length||this._taskMerger.hasNewInfo(e,t)}popTasks(e){let t=0;const r=[],i=this._pending.tasks();for(let n=0;n<i.length&&t<e;n++){const e=i[n];r.push(e),t+=e.size,this._pending.delete(e.topic),this._activeTotalSize+=e.size,this._active.add(e)}return{tasks:r,pendingSize:this._pending.totalSize}}taskDone(e){this._active.has(e)&&(this._activeTotalSize-=e.size,this._active.delete(e))}remove(e){this._pending.delete(e)}isIdle(){return 0===this._pending.length&&0===this._active.size}static compare(e,t){return 0===e[1]._pending.length?1:0===t[1]._pending.length?-1:e[1]._activeTotalSize===t[1]._activeTotalSize?t[1]._pending.length-e[1]._pending.length:e[1]._activeTotalSize-t[1]._activeTotalSize}}class o{constructor(){this._tasks=new i.SortedMap([],this._compare)}get length(){return this._tasks.size}get totalSize(){return[...this._tasks.values()].reduce(((e,t)=>e+t.task.size),0)}get(e){return(this._tasks.get(e)||{}).task}add(e){this._tasks.set(e.topic,{created:Date.now(),task:e})}delete(e){this._tasks.delete(e)}tasks(){return[...this._tasks.values()].map((e=>e.task))}updatePriority(e,t){const r=this._tasks.get(e);if(!r)return;const i=this._tasks.indexOf(e);r.task.priority=t,this._tasks.update(i)}_compare(e,t){return e[1].task.priority===t[1].task.priority?e[1].created-t[1].created:t[1].task.priority-e[1].task.priority}}r.RequestQueue=class{constructor(e=n){this._taskMerger=e,this._byPeer=new i.SortedMap([],s.compare)}pushTasks(e,t){let r=this._byPeer.get(e.toB58String());r||(r=new s(e,this._taskMerger)),r.pushTasks(t),this._byPeer.set(e.toB58String(),r)}popTasks(e){const t=this._head();if(void 0===t)return{tasks:[],pendingSize:0};const{tasks:r,pendingSize:i}=t.popTasks(e);if(0===r.length)return{tasks:r,pendingSize:i};const n=t.peerId;return t.isIdle()?this._byPeer.delete(n.toB58String()):this._byPeer.update(0),{peerId:n,tasks:r,pendingSize:i}}_head(){if(0!==this._byPeer.size)for(const[,e]of this._byPeer)return e}remove(e,t){const r=this._byPeer.get(t.toB58String());r&&r.remove(e)}tasksDone(e,t){const r=this._byPeer.get(e.toB58String());if(!r)return;const i=this._byPeer.indexOf(e.toB58String());for(const e of t)r.taskDone(e);this._byPeer.update(i)}}},{"../utils/sorted-map.js":"h0gYa"}],h0gYa:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});class i extends Map{constructor(e,t){super(),this._cmp=t||this._defaultSort,this._keys=[];for(const[t,r]of e||[])this.set(t,r)}update(e){if(e<0||e>=this._keys.length)return;const t=this._keys[e];this._keys.splice(e,1);const r=this._find(t);this._keys.splice(r,0,t)}set(e,t){if(this.has(e)){const t=this.indexOf(e);this._keys.splice(t,1)}super.set(e,t);const r=this._find(e);return this._keys.splice(r,0,e),this}clear(){super.clear(),this._keys=[]}delete(e){if(!this.has(e))return!1;const t=this.indexOf(e);return this._keys.splice(t,1),super.delete(e)}indexOf(e){if(!this.has(e))return-1;const t=this._find(e);if(this._keys[t]===e)return t;for(let r=1;r<this._keys.length;r++){if(this._keys[t+r]===e)return t+r;if(this._keys[t-r]===e)return t-r}return-1}_find(e){let t=0,r=this._keys.length;for(;t<r;){const i=t+r>>>1,n=this._kCmp(this._keys[i],e);if(n<0)t=i+1;else{if(!(n>0))return i;r=i}}return t}*keys(){for(const e of this._keys)yield e}*values(){for(const e of this._keys)yield this.get(e)}*entries(){for(const e of this._keys)yield[e,this.get(e)]}*[Symbol.iterator](){yield*this.entries()}forEach(e,t){if(e)for(const r of this._keys)e.apply(t,[[r,this.get(r)]])}_defaultSort(e,t){return e[0]<t[0]?-1:t[0]<e[0]?1:0}_kCmp(e,t){return this._cmp([e,this.get(e)],[t,this.get(t)])}}r.SortedMap=i},{}],hlwar:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i={hasNewInfo(e,t){let r=!1,i=!1;for(const e of t)e.data.haveBlock&&(r=!0),e.data.isWantBlock&&(i=!0);return!(i||!e.data.isWantBlock)||!(r||!e.data.haveBlock)},merge(e,t){const r=e.data,i=t.data;!i.haveBlock&&r.haveBlock&&(i.haveBlock=r.haveBlock,i.blockSize=r.blockSize),!i.isWantBlock&&r.isWantBlock&&(i.isWantBlock=!0,i.haveBlock&&!r.haveBlock||(i.haveBlock=r.haveBlock,t.size=e.size)),i.isWantBlock&&i.haveBlock&&(t.size=i.blockSize)}};r.TaskMerger=i},{}],jCbDy:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("events"),n=e("uint8arrays/to-string"),s=e("./constants.js"),o=e("./utils/index.js");const a=e=>`unwant:${n.toString(e.multihash.bytes,"base64")}`,c=e=>`block:${n.toString(e.multihash.bytes,"base64")}`;class u extends i.EventEmitter{constructor(e){super(),this.setMaxListeners(s.maxListeners),this._log=o.logger(e,"notif")}hasBlock(e,t){const r=c(e);this._log(r),this.emit(r,t)}wantBlock(e,t={}){if(!e)throw new Error("Not a valid cid");const r=c(e),i=a(e);return this._log(`wantBlock:${e}`),new Promise(((n,s)=>{const o=()=>{this.removeListener(r,a),s(new Error(`Block for ${e} unwanted`))},a=e=>{this.removeListener(i,o),n(e)};this.once(i,o),this.once(r,a),t&&t.signal&&t.signal.addEventListener("abort",(()=>{this.removeListener(r,a),this.removeListener(i,o),s(new Error(`Want for ${e} aborted`))}))}))}unwantBlock(e){const t=a(e);this._log(t),this.emit(t)}}r.Notifications=u},{events:"g82pp","uint8arrays/to-string":"hC8JB","./constants.js":"jvLuC","./utils/index.js":"9omCc"}],da28N:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("events"),n=e("./stat.js");const s={enabled:!1,computeThrottleTimeout:1e3,computeThrottleMaxQueueSize:1e3,movingAverageIntervals:[6e4,3e5,9e5]};class o extends i.EventEmitter{constructor(e=[],t=s){super();const r=Object.assign({},s,t);if("number"!=typeof r.computeThrottleTimeout)throw new Error("need computeThrottleTimeout");if("number"!=typeof r.computeThrottleMaxQueueSize)throw new Error("need computeThrottleMaxQueueSize");this._initialCounters=e,this._options=r,this._enabled=this._options.enabled,this._global=new n.Stat(e,r),this._global.on("update",(e=>this.emit("update",e))),this._peers=new Map}enable(){this._enabled=!0,this._options.enabled=!0,this._global.enable()}disable(){this._enabled=!1,this._options.enabled=!1,this._global.disable()}stop(){this._enabled=!1,this._global.stop();for(const e of this._peers)e[1].stop()}get snapshot(){return this._global.snapshot}get movingAverages(){return this._global.movingAverages}forPeer(e){const t="string"!=typeof e&&e.toB58String?e.toB58String():`${e}`;return this._peers.get(t)}push(e,t,r){if(this._enabled&&(this._global.push(t,r),e)){let i=this._peers.get(e);i||(i=new n.Stat(this._initialCounters,this._options),this._peers.set(e,i)),i.push(t,r)}}disconnected(e){const t=e.toB58String(),r=this._peers.get(t);r&&(r.stop(),this._peers.delete(t))}}r.Stats=o},{events:"g82pp","./stat.js":"bywlH"}],bywlH:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("events");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e("@vascosantos/moving-average"));class o extends i.EventEmitter{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this),e.forEach((e=>{this._stats[e]=BigInt(0),this._movingAverages[e]={},this._options.movingAverageIntervals.forEach((t=>{(this._movingAverages[e][t]=s.default(t)).push(this._frequencyLastTime,0)}))})),this._enabled=this._options.enabled}enable(){this._enabled=!0}disable(){this._disabled=!0}stop(){this._timeout&&clearTimeout(this._timeout)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}push(e,t){this._enabled&&(this._queue.push([e,t,Date.now()]),this._resetComputeTimeout())}_resetComputeTimeout(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(this._update,this._nextTimeout())}_nextTimeout(){const e=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-e),0)}_update(){if(this._timeout=null,this._queue.length){let e;for(;this._queue.length;){const t=e=this._queue.shift();t&&this._applyOp(t)}e&&this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){const t=e-this._frequencyLastTime;t&&Object.keys(this._stats).forEach((r=>{this._updateFrequencyFor(r,t,e)})),this._frequencyLastTime=e}_updateFrequencyFor(e,t,r){const i=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const n=i/t*1e3;let o=this._movingAverages[e];o||(o=this._movingAverages[e]={}),this._options.movingAverageIntervals.forEach((e=>{let t=o[e];t||(t=o[e]=s.default(e)),t.push(r,n)}))}_applyOp(e){const t=e[0],r=e[1];if("number"!=typeof r)throw new Error(`invalid increment number: ${r}`);Object.prototype.hasOwnProperty.call(this._stats,t)||(this._stats[t]=BigInt(0)),this._stats[t]=BigInt(this._stats[t])+BigInt(r),this._frequencyAccumulators[t]||(this._frequencyAccumulators[t]=0),this._frequencyAccumulators[t]+=r}}r.Stat=o},{events:"g82pp","@vascosantos/moving-average":"2F3Pq"}],"55a3I":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("blockstore-core"),n=e("it-merge"),s=e("it-pushable"),o=e("it-filter");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(n),u=a(s),l=a(o);class d extends i.BaseBlockstore{constructor(e,t){super(),this.child=e,this.bitswap=t}open(){return this.child.open()}close(){return this.child.close()}unwrap(){return this.child}async put(e,t,r={}){await this.has(e)||(this.bitswap.isStarted()?await this.bitswap.put(e,t,r):await this.child.put(e,t,r))}async*putMany(e,t={}){const r=l.default(e,(async({key:e})=>!await this.has(e)));this.bitswap.isStarted()?yield*this.bitswap.putMany(r,t):yield*this.child.putMany(r,t)}async get(e,t={}){return!await this.has(e)&&this.bitswap.isStarted()?this.bitswap.get(e,t):this.child.get(e,t)}async*getMany(e,t={}){const r=u.default(),i=u.default();Promise.resolve().then((async()=>{for await(const t of e)!await this.has(t)&&this.bitswap.isStarted()?r.push(t):i.push(t);r.end(),i.end()})),yield*c.default(this.bitswap.getMany(r,t),this.child.getMany(i,t))}async delete(e,t){await this.child.delete(e,t)}async*deleteMany(e,t){yield*this.child.deleteMany(e,t)}async has(e,t={}){return this.child.has(e,t)}async*query(e,t={}){yield*this.child.query(e,t)}async*queryKeys(e,t={}){yield*this.child.queryKeys(e,t)}}r.BlockStorage=d},{"blockstore-core":"alw2u","it-merge":"cPFu3","it-pushable":"bnpei","it-filter":"5LCTL"}],alw2u:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./errors.js"),n=e("./base.js"),s=e("./memory.js");const o={...i};r.BaseBlockstore=n.BaseBlockstore,r.MemoryBlockstore=s.MemoryBlockstore,r.Errors=o},{"./errors.js":"eBPsS","./base.js":"l2CNM","./memory.js":"ahARU"}],eBPsS:[function(e,t,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("err-code"));r.abortedError=function(e){return e=e||new Error("Aborted"),n.default(e,"ERR_ABORTED")},r.notFoundError=function(e){return e=e||new Error("Not Found"),n.default(e,"ERR_NOT_FOUND")}},{"err-code":"chZjB"}],ahARU:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./base.js"),n=e("multiformats/bases/base32"),s=e("multiformats/codecs/raw"),o=e("multiformats/cid"),a=e("multiformats/hashes/digest"),c=e("./errors.js");function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var l=u(s),d=u(a);class f extends i.BaseBlockstore{constructor(){super(),this.data={}}open(){return Promise.resolve()}close(){return Promise.resolve()}async put(e,t){this.data[n.base32.encode(e.multihash.bytes)]=t}async get(e){if(!await this.has(e))throw c.notFoundError();return this.data[n.base32.encode(e.multihash.bytes)]}async has(e){return void 0!==this.data[n.base32.encode(e.multihash.bytes)]}async delete(e){delete this.data[n.base32.encode(e.multihash.bytes)]}async*_all(){yield*Object.entries(this.data).map((([e,t])=>({key:o.CID.createV1(l.code,d.decode(n.base32.decode(e))),value:t})))}async*_allKeys(){yield*Object.entries(this.data).map((([e])=>o.CID.createV1(l.code,d.decode(n.base32.decode(e)))))}}r.MemoryBlockstore=f},{"./base.js":"l2CNM","multiformats/bases/base32":"5k9Tu","multiformats/codecs/raw":"fdfgp","multiformats/cid":"9ooAY","multiformats/hashes/digest":"kpRBg","./errors.js":"eBPsS"}],cGDFf:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./addrs.js"),n=e("./connect.js"),s=e("./disconnect.js"),o=e("./local-addrs.js"),a=e("./peers.js");r.SwarmAPI=class{constructor({network:e}){this.addrs=i.createAddrs({network:e}),this.connect=n.createConnect({network:e}),this.disconnect=s.createDisconnect({network:e}),this.localAddrs=o.createLocalAddrs({network:e}),this.peers=a.createPeers({network:e})}}},{"./addrs.js":"4nmdM","./connect.js":"1cg0c","./disconnect.js":"kER7G","./local-addrs.js":"vjKoo","./peers.js":"gf7YS"}],"4nmdM":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createAddrs=function({network:e}){return i.withTimeoutOption((async function(t={}){const r=[],{libp2p:i}=await e.use(t);for(const[e,t]of i.peerStore.peers.entries())r.push({id:e,addrs:t.addresses.map((e=>e.multiaddr))});return r}))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],"1cg0c":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createConnect=function({network:e}){return i.withTimeoutOption((async function(t,r={}){const{libp2p:i}=await e.use(r);await i.dial(t,r)}))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],kER7G:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createDisconnect=function({network:e}){return i.withTimeoutOption((async function(t,r={}){const{libp2p:i}=await e.use(r);await i.hangUp(t)}))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],vjKoo:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createLocalAddrs=function({network:e}){return i.withTimeoutOption((async function(t={}){const{libp2p:r}=await e.use(t);return r.multiaddrs}))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],gf7YS:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option");r.createPeers=function({network:e}){return i.withTimeoutOption((async function(t={}){const{libp2p:r}=await e.use(t),i=[];for(const[e,n]of r.connections)for(const r of n){const n={addr:r.remoteAddr,peer:e};(t.verbose||t.direction)&&(n.direction=r.stat.direction),t.verbose&&(n.muxer=r.stat.multiplexer,n.latency="n/a",n.streams=[]),i.push(n)}return i}))}},{"ipfs-core-utils/with-timeout-option":"j29MK"}],dHQEh:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("peer-id"),n=e("ipfs-core-utils/with-timeout-option");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(i);const a={success:!0,time:0,text:""};r.createPing=function({network:e}){return n.withTimeoutOption((async function*(t,r={}){const{libp2p:i}=await e.use();r.count=r.count||10;const n=o.default.createFromB58String(t),s=i.peerStore.get(n);let c=s&&s.id;if(!c){yield{...a,text:`Looking up peer ${t}`};const e=await i.peerRouting.findPeer(n);c=e&&e.id}if(!c)throw new Error("Peer was not found");yield{...a,text:`PING ${c.toB58String()}`};let u=0,l=0;for(let e=0;e<r.count;e++)try{const e=await i.ping(c);l+=e,u++,yield{...a,time:e}}catch(e){yield{...a,success:!1,text:e.toString()}}if(u){const e=l/u;yield{...a,text:`Average latency: ${e}ms`}}}))}},{"peer-id":"8Bdb3","ipfs-core-utils/with-timeout-option":"j29MK"}],kOgiu:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("peer-id"),n=e("err-code"),s=e("../errors.js"),o=e("dlv"),a=e("ipfs-core-utils/with-timeout-option");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(i),l=c(n),d=c(o);const f=async(e,t)=>{const r=await e.use(t);if(d.default(r.libp2p,"_config.dht.enabled",!1))return r;throw new s.NotEnabledError("dht not enabled")};r.createDht=function({network:e,repo:t}){const{get:r,put:i,findProvs:n,findPeer:s,provide:o,query:c}={async get(t,r={}){const{libp2p:i}=await f(e,r);return i._dht.get(t,r)},async*put(t,r,i){const{libp2p:n}=await f(e,i);yield*n._dht.put(t,r)},async*findProvs(t,r={numProviders:20}){const{libp2p:i}=await f(e,r);for await(const e of i._dht.findProviders(t,{maxNumProviders:r.numProviders,signal:r.signal}))yield{id:e.id.toB58String(),addrs:e.addrs}},async findPeer(t,r){const{libp2p:i}=await f(e,r),n=await i._dht.findPeer(u.default.parse(t));return{id:n.id.toB58String(),addrs:n.multiaddrs}},async*provide(r,i={recursive:!1}){const{libp2p:n}=await f(e,i),s=Array.isArray(r)?r:[r];if(!(await Promise.all(s.map((e=>t.blocks.has(e))))).every((e=>e)))throw l.default(new Error("block(s) not found locally, cannot provide"),"ERR_BLOCK_NOT_FOUND");if(i.recursive)throw l.default(new Error("not implemented yet"),"ERR_NOT_IMPLEMENTED_YET");for(const e of s)yield n._dht.provide(e)},async*query(t,r){const{libp2p:i}=await f(e,r);for await(const e of i._dht.getClosestPeers(u.default.parse(t).toBytes()))yield{id:e.toB58String(),addrs:[]}}};return{get:a.withTimeoutOption(r),put:a.withTimeoutOption(i),findProvs:a.withTimeoutOption(n),findPeer:a.withTimeoutOption(s),provide:a.withTimeoutOption(o),query:a.withTimeoutOption(c)}}},{"peer-id":"8Bdb3","err-code":"chZjB","../errors.js":"j69o8",dlv:"hp0pQ","ipfs-core-utils/with-timeout-option":"j29MK"}],"7IJgU":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("ipfs-core-utils/with-timeout-option"),n=e("err-code"),s=e("../errors.js"),o=e("dlv");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(n),u=a(o);const l=async()=>{throw new s.NotEnabledError("pubsub not enabled")};r.createPubsub=function({network:e,config:t}){const r=u.default(t||{},"Pubsub.Enabled",!0);return{subscribe:r?i.withTimeoutOption((async function(t,r,i={}){const{libp2p:n}=await e.use(i);return n.pubsub.subscribe(t,r,i)})):l,unsubscribe:r?i.withTimeoutOption((async function(t,r,i={}){const{libp2p:n}=await e.use(i);n.pubsub.unsubscribe(t,r,i)})):l,publish:r?i.withTimeoutOption((async function(t,r,i={}){const{libp2p:n}=await e.use(i);if(!r)throw c.default(new Error('argument "data" is required'),"ERR_ARG_REQUIRED");await n.pubsub.publish(t,r)})):l,ls:r?i.withTimeoutOption((async function(t={}){const{libp2p:r}=await e.use(t);return r.pubsub.getTopics()})):l,peers:r?i.withTimeoutOption((async function(t,r={}){const{libp2p:i}=await e.use(r);return i.pubsub.getSubscribers(t)})):l}}},{"ipfs-core-utils/with-timeout-option":"j29MK","err-code":"chZjB","../errors.js":"j69o8",dlv:"hp0pQ"}],juo1D:[function(e,t,r){var i,n;"undefined"!=typeof window&&(i=this,n=function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/dist/",r(r.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(e,t,r){"use strict";var i=Object.prototype.hasOwnProperty,n="~";function s(){}function o(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,r,i,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,i||e,s),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function c(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function u(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(n=!1)),u.prototype.eventNames=function(){var e,t,r=[];if(0===this._eventsCount)return r;for(t in e=this._events)i.call(e,t)&&r.push(n?t.slice(1):t);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},u.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,s=r.length,o=new Array(s);i<s;i++)o[i]=r[i].fn;return o},u.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},u.prototype.emit=function(e,t,r,i,s,o){var a=n?n+e:e;if(!this._events[a])return!1;var c,u,l=this._events[a],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,i),!0;case 5:return l.fn.call(l.context,t,r,i,s),!0;case 6:return l.fn.call(l.context,t,r,i,s,o),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var f,h=l.length;for(u=0;u<h;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,r);break;case 4:l[u].fn.call(l[u].context,t,r,i);break;default:if(!c)for(f=1,c=new Array(d-1);f<d;f++)c[f-1]=arguments[f];l[u].fn.apply(l[u].context,c)}}return!0},u.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},u.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},u.prototype.removeListener=function(e,t,r,i){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return c(this,s),this;var o=this._events[s];if(o.fn)o.fn!==t||i&&!o.once||r&&o.context!==r||c(this,s);else{for(var a=0,u=[],l=o.length;a<l;a++)(o[a].fn!==t||i&&!o[a].once||r&&o[a].context!==r)&&u.push(o[a]);u.length?this._events[s]=1===u.length?u[0]:u:c(this,s)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&c(this,t)):(this._events=new s,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=n,u.EventEmitter=u,e.exports=u},"./node_modules/url-toolkit/src/url-toolkit.js":function(e,t,r){var i,n,s,o,a;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/,n=/^([^\/?#]*)(.*)$/,s=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var i=a.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=a.normalizePath(i.path),a.buildURLFromParts(i)}var s=a.parseURL(t);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return r.alwaysNormalize?(s.path=a.normalizePath(s.path),a.buildURLFromParts(s)):t;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var c=n.exec(o.path);o.netLoc=c[1],o.path=c[2]}o.netLoc&&!o.path&&(o.path="/");var u={scheme:o.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(u.netLoc=o.netLoc,"/"!==s.path[0]))if(s.path){var l=o.path,d=l.substring(0,l.lastIndexOf("/")+1)+s.path;u.path=a.normalizePath(d)}else u.path=o.path,s.params||(u.params=o.params,s.query||(u.query=o.query));return null===u.path&&(u.path=r.alwaysNormalize?a.normalizePath(s.path):s.path),a.buildURLFromParts(u)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(s,"");e.length!==(e=e.replace(o,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=a},"./node_modules/webworkify-webpack/index.js":function(e,t,r){function i(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r.oe=function(e){throw console.error(e),e};var i=r(r.s=ENTRY_MODULE);return i.default||i}var n="[\\.|\\-|\\+|\\w|/|@]+",s="\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)";function o(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e,t,i){var a={};a[i]=[];var c=t.toString(),u=c.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return a;for(var l,d=u[1],f=new RegExp("(\\\\n|\\W)"+o(d)+s,"g");l=f.exec(c);)"dll-reference"!==l[3]&&a[i].push(l[3]);for(f=new RegExp("\\("+o(d)+'\\("(dll-reference\\s('+n+'))"\\)\\)'+s,"g");l=f.exec(c);)e[l[2]]||(a[i].push(l[1]),e[l[2]]=r(l[1]).m),a[l[2]]=a[l[2]]||[],a[l[2]].push(l[4]);for(var h,p=Object.keys(a),g=0;g<p.length;g++)for(var y=0;y<a[p[g]].length;y++)h=a[p[g]][y],isNaN(1*h)||(a[p[g]][y]=1*a[p[g]][y]);return a}function c(e){return Object.keys(e).reduce((function(t,r){return t||e[r].length>0}),!1)}e.exports=function(e,t){t=t||{};var n={main:r.m},s=t.all?{main:Object.keys(n.main)}:function(e,t){for(var r={main:[t]},i={main:[]},n={main:{}};c(r);)for(var s=Object.keys(r),o=0;o<s.length;o++){var u=s[o],l=r[u].pop();if(n[u]=n[u]||{},!n[u][l]&&e[u][l]){n[u][l]=!0,i[u]=i[u]||[],i[u].push(l);for(var d=a(e,e[u][l],u),f=Object.keys(d),h=0;h<f.length;h++)r[f[h]]=r[f[h]]||[],r[f[h]]=r[f[h]].concat(d[f[h]])}}return i}(n,e),o="";Object.keys(s).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;s[e][t];)t++;s[e].push(t),n[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",o=o+"var "+e+" = ("+i.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+s[e].map((function(t){return JSON.stringify(t)+": "+n[e][t].toString()})).join(",")+"});\n"})),o=o+"new (("+i.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+s.main.map((function(e){return JSON.stringify(e)+": "+n.main[e].toString()})).join(",")+"}))(self);";var u=new window.Blob([o],{type:"text/javascript"});if(t.bare)return u;var l=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(u),d=new window.Worker(l);return d.objectURL=l,d}},"./src/crypt/decrypter.js":function(e,t,r){"use strict";r.r(t);var i=function(){function e(e,t){this.subtle=e,this.aesIV=t}return e.prototype.decrypt=function(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)},e}(),n=function(){function e(e,t){this.subtle=e,this.key=t}return e.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},e}(),s=function(){function e(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.initTable()}var t=e.prototype;return t.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),r=new Uint32Array(4),i=0;i<4;i++)r[i]=t.getUint32(4*i);return r},t.initTable=function(){var e=this.sBox,t=this.invSBox,r=this.subMix,i=r[0],n=r[1],s=r[2],o=r[3],a=this.invSubMix,c=a[0],u=a[1],l=a[2],d=a[3],f=new Uint32Array(256),h=0,p=0,g=0;for(g=0;g<256;g++)f[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var y=p^p<<1^p<<2^p<<3^p<<4;y=y>>>8^255&y^99,e[h]=y,t[y]=h;var m=f[h],b=f[m],v=f[b],w=257*f[y]^16843008*y;i[h]=w<<24|w>>>8,n[h]=w<<16|w>>>16,s[h]=w<<8|w>>>24,o[h]=w,w=16843009*v^65537*b^257*m^16843008*h,c[y]=w<<24|w>>>8,u[y]=w<<16|w>>>16,l[y]=w<<8|w>>>24,d[y]=w,h?(h=m^f[f[f[v^m]]],p^=f[f[p]]):h=p=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,i=0;i<t.length&&r;)r=t[i]===this.key[i],i++;if(!r){this.key=t;var n=this.keySize=t.length;if(4!==n&&6!==n&&8!==n)throw new Error("Invalid aes key size="+n);var s,o,a,c,u=this.ksRows=4*(n+6+1),l=this.keySchedule=new Uint32Array(u),d=this.invKeySchedule=new Uint32Array(u),f=this.sBox,h=this.rcon,p=this.invSubMix,g=p[0],y=p[1],m=p[2],b=p[3];for(s=0;s<u;s++)s<n?a=l[s]=t[s]:(c=a,s%n==0?(c=f[(c=c<<8|c>>>24)>>>24]<<24|f[c>>>16&255]<<16|f[c>>>8&255]<<8|f[255&c],c^=h[s/n|0]<<24):n>6&&s%n==4&&(c=f[c>>>24]<<24|f[c>>>16&255]<<16|f[c>>>8&255]<<8|f[255&c]),l[s]=a=(l[s-n]^c)>>>0);for(o=0;o<u;o++)s=u-o,c=3&o?l[s]:l[s-4],d[o]=o<4||s<=4?c:g[f[c>>>24]]^y[f[c>>>16&255]]^m[f[c>>>8&255]]^b[f[255&c]],d[o]=d[o]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,r,i){for(var n,s,o,a,c,u,l,d,f,h,p,g,y,m,b,v,w,_=this.keySize+6,E=this.invKeySchedule,S=this.invSBox,T=this.invSubMix,A=T[0],k=T[1],I=T[2],R=T[3],P=this.uint8ArrayToUint32Array_(r),O=P[0],C=P[1],j=P[2],D=P[3],M=new Int32Array(e),x=new Int32Array(M.length),B=this.networkToHostOrderSwap;t<M.length;){for(f=B(M[t]),h=B(M[t+1]),p=B(M[t+2]),g=B(M[t+3]),c=f^E[0],u=g^E[1],l=p^E[2],d=h^E[3],y=4,m=1;m<_;m++)n=A[c>>>24]^k[u>>16&255]^I[l>>8&255]^R[255&d]^E[y],s=A[u>>>24]^k[l>>16&255]^I[d>>8&255]^R[255&c]^E[y+1],o=A[l>>>24]^k[d>>16&255]^I[c>>8&255]^R[255&u]^E[y+2],a=A[d>>>24]^k[c>>16&255]^I[u>>8&255]^R[255&l]^E[y+3],c=n,u=s,l=o,d=a,y+=4;n=S[c>>>24]<<24^S[u>>16&255]<<16^S[l>>8&255]<<8^S[255&d]^E[y],s=S[u>>>24]<<24^S[l>>16&255]<<16^S[d>>8&255]<<8^S[255&c]^E[y+1],o=S[l>>>24]<<24^S[d>>16&255]<<16^S[c>>8&255]<<8^S[255&u]^E[y+2],a=S[d>>>24]<<24^S[c>>16&255]<<16^S[u>>8&255]<<8^S[255&l]^E[y+3],y+=3,x[t]=B(n^O),x[t+1]=B(a^C),x[t+2]=B(o^j),x[t+3]=B(s^D),O=f,C=h,j=p,D=g,t+=4}return i?(b=x.buffer,v=b.byteLength,(w=v&&new DataView(b).getUint8(v-1))?b.slice(0,v-w):b):x.buffer},t.destroy=function(){this.key=void 0,this.keySize=void 0,this.ksRows=void 0,this.sBox=void 0,this.invSBox=void 0,this.subMix=void 0,this.invSubMix=void 0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.rcon=void 0},e}(),o=r("./src/errors.ts"),a=r("./src/utils/logger.js"),c=r("./src/events.js"),u=r("./src/utils/get-self-scope.js"),l=Object(u.getSelfScope)(),d=function(){function e(e,t,r){var i=(void 0===r?{}:r).removePKCS7Padding,n=void 0===i||i;if(this.logEnabled=!0,this.observer=e,this.config=t,this.removePKCS7Padding=n,n)try{var s=l.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(e){}this.disableWebCrypto=!this.subtle}var t=e.prototype;return t.isSync=function(){return this.disableWebCrypto&&this.config.enableSoftwareAES},t.decrypt=function(e,t,r,o){var c=this;if(this.disableWebCrypto&&this.config.enableSoftwareAES){this.logEnabled&&(a.logger.log("JS AES decrypt"),this.logEnabled=!1);var u=this.decryptor;u||(this.decryptor=u=new s),u.expandKey(t),o(u.decrypt(e,0,r,this.removePKCS7Padding))}else{this.logEnabled&&(a.logger.log("WebCrypto AES decrypt"),this.logEnabled=!1);var l=this.subtle;this.key!==t&&(this.key=t,this.fastAesKey=new n(l,t)),this.fastAesKey.expandKey().then((function(n){new i(l,r).decrypt(e,n).catch((function(i){c.onWebCryptoError(i,e,t,r,o)})).then((function(e){o(e)}))})).catch((function(i){c.onWebCryptoError(i,e,t,r,o)}))}},t.onWebCryptoError=function(e,t,r,i,n){this.config.enableSoftwareAES?(a.logger.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(t,r,i,n)):(a.logger.error("decrypting error : "+e.message),this.observer.trigger(c.default.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!0,reason:e.message}))},t.destroy=function(){var e=this.decryptor;e&&(e.destroy(),this.decryptor=void 0)},e}();t.default=d},"./src/demux/demuxer-inline.js":function(e,t,r){"use strict";r.r(t);var i=r("./src/events.js"),n=r("./src/errors.ts"),s=r("./src/crypt/decrypter.js"),o=r("./src/polyfills/number.js"),a=r("./src/utils/logger.js"),c=r("./src/utils/get-self-scope.js");function u(e,t){return 255===e[t]&&240==(246&e[t+1])}function l(e,t){return 1&e[t+1]?7:9}function d(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function f(e,t){return!!(t+1<e.length&&u(e,t))}function h(e,t){if(f(e,t)){var r=l(e,t);if(t+r>=e.length)return!1;var i=d(e,t);if(i<=r)return!1;var n=t+i;if(n===e.length||n+1<e.length&&u(e,n))return!0}return!1}function p(e,t,r,s,o){if(!e.samplerate){var c=function(e,t,r,s){var o,c,u,l,d,f=navigator.userAgent.toLowerCase(),h=s,p=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];if(o=1+((192&t[r+2])>>>6),!((c=(60&t[r+2])>>>2)>p.length-1))return l=(1&t[r+2])<<2,l|=(192&t[r+3])>>>6,a.logger.log("manifest codec:"+s+",ADTS data:type:"+o+",sampleingIndex:"+c+"["+p[c]+"Hz],channelConfig:"+l),/firefox/i.test(f)?c>=6?(o=5,d=new Array(4),u=c-3):(o=2,d=new Array(2),u=c):-1!==f.indexOf("android")?(o=2,d=new Array(2),u=c):(o=5,d=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&c>=6?u=c-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(c>=6&&1===l||/vivaldi/i.test(f))||!s&&1===l)&&(o=2,d=new Array(2)),u=c)),d[0]=o<<3,d[0]|=(14&c)>>1,d[1]|=(1&c)<<7,d[1]|=l<<3,5===o&&(d[1]|=(14&u)>>1,d[2]=(1&u)<<7,d[2]|=8,d[3]=0),{config:d,samplerate:p[c],channelCount:l,codec:"mp4a.40."+o,manifestCodec:h};e.trigger(i.default.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+c})}(t,r,s,o);e.config=c.config,e.samplerate=c.samplerate,e.channelCount=c.channelCount,e.codec=c.codec,e.manifestCodec=c.manifestCodec,a.logger.log("parsed codec:"+e.codec+",rate:"+c.samplerate+",nb channel:"+c.channelCount)}}function g(e){return 9216e4/e}function y(e,t,r,i,n){var s=function(e,t,r,i,n){var s,o,a=e.length;if(s=l(e,t),o=d(e,t),(o-=s)>0&&t+s+o<=a)return{headerLength:s,frameLength:o,stamp:r+i*n}}(t,r,i,n,g(e.samplerate));if(s){var o=s.stamp,a=s.headerLength,c=s.frameLength,u={unit:t.subarray(r+a,r+a+c),pts:o,dts:o};return e.samples.push(u),{sample:u,length:c+a}}}var m=r("./src/demux/id3.js"),b=function(){function e(e,t,r){this.observer=e,this.config=r,this.remuxer=t}var t=e.prototype;return t.resetInitSegment=function(e,t,r,i){this._audioTrack={container:"audio/adts",type:"audio",id:0,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:t,duration:i,inputTimeScale:9e4}},t.resetTimeStamp=function(){},e.probe=function(e){if(!e)return!1;for(var t=(m.default.getID3Data(e,0)||[]).length,r=e.length;t<r;t++)if(h(e,t))return a.logger.log("ADTS sync word found !"),!0;return!1},t.append=function(e,t,r,i){for(var n=this._audioTrack,s=m.default.getID3Data(e,0)||[],c=m.default.getTimeStamp(s),u=Object(o.isFiniteNumber)(c)?90*c:9e4*t,l=0,d=u,h=e.length,g=s.length,b=[{pts:d,dts:d,data:s}];g<h-1;)if(f(e,g)&&g+5<h){p(n,this.observer,e,g,n.manifestCodec);var v=y(n,e,g,u,l);if(!v){a.logger.log("Unable to parse AAC frame");break}g+=v.length,d=v.sample.pts,l++}else m.default.isHeader(e,g)?(s=m.default.getID3Data(e,g),b.push({pts:d,dts:d,data:s}),g+=s.length):g++;this.remuxer.remux(n,{samples:[]},{samples:b,inputTimeScale:9e4},{samples:[]},t,r,i)},t.destroy=function(){},e}(),v=r("./src/demux/mp4demuxer.js"),w={BitratesMap:[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],SamplingRateMap:[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],SamplesCoefficients:[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],BytesInSlot:[0,1,1,4],appendFrame:function(e,t,r,i,n){if(!(r+24>t.length)){var s=this.parseHeader(t,r);if(s&&r+s.frameLength<=t.length){var o=i+n*(9e4*s.samplesPerFrame/s.sampleRate),a={unit:t.subarray(r,r+s.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=s.channelCount,e.samplerate=s.sampleRate,e.samples.push(a),{sample:a,length:s.frameLength}}}},parseHeader:function(e,t){var r=e[t+1]>>3&3,i=e[t+1]>>1&3,n=e[t+2]>>4&15,s=e[t+2]>>2&3,o=e[t+2]>>1&1;if(1!==r&&0!==n&&15!==n&&3!==s){var a=3===r?3-i:3===i?3:4,c=1e3*w.BitratesMap[14*a+n-1],u=3===r?0:2===r?1:2,l=w.SamplingRateMap[3*u+s],d=e[t+3]>>6==3?1:2,f=w.SamplesCoefficients[r][i],h=w.BytesInSlot[i],p=8*f*h;return{sampleRate:l,channelCount:d,frameLength:parseInt(f*c/l+o,10)*h,samplesPerFrame:p}}},isHeaderPattern:function(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])},isHeader:function(e,t){return!!(t+1<e.length&&this.isHeaderPattern(e,t))},probe:function(e,t){if(t+1<e.length&&this.isHeaderPattern(e,t)){var r=this.parseHeader(e,t),i=4;r&&r.frameLength&&(i=r.frameLength);var n=t+i;if(n===e.length||n+1<e.length&&this.isHeaderPattern(e,n))return!0}return!1}},_=w,E=function(){function e(e){this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var t=e.prototype;return t.loadWord=function(){var e=this.data,t=this.bytesAvailable,r=e.byteLength-t,i=new Uint8Array(4),n=Math.min(4,t);if(0===n)throw new Error("no bytes available");i.set(e.subarray(r,r+n)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*n,this.bytesAvailable-=n},t.skipBits=function(e){var t;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;return e>32&&a.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),(t=e-t)>0&&this.bitsAvailable?r<<t|this.readBits(t):r},t.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return 1===this.readBits(1)},t.readUByte=function(){return this.readBits(8)},t.readUShort=function(){return this.readBits(16)},t.readUInt=function(){return this.readBits(32)},t.skipScalingList=function(e){var t,r=8,i=8;for(t=0;t<e;t++)0!==i&&(i=(r+this.readEG()+256)%256),r=0===i?r:i},t.readSPS=function(){var e,t,r,i,n,s,o,a=0,c=0,u=0,l=0,d=this.readUByte.bind(this),f=this.readBits.bind(this),h=this.readUEG.bind(this),p=this.readBoolean.bind(this),g=this.skipBits.bind(this),y=this.skipEG.bind(this),m=this.skipUEG.bind(this),b=this.skipScalingList.bind(this);if(d(),e=d(),f(5),g(3),d(),m(),100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e){var v=h();if(3===v&&g(1),m(),m(),g(1),p())for(s=3!==v?8:12,o=0;o<s;o++)p()&&b(o<6?16:64)}m();var w=h();if(0===w)h();else if(1===w)for(g(1),y(),y(),t=h(),o=0;o<t;o++)y();m(),g(1),r=h(),i=h(),0===(n=f(1))&&g(1),g(1),p()&&(a=h(),c=h(),u=h(),l=h());var _=[1,1];if(p()&&p())switch(d()){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:_=[d()<<8|d(),d()<<8|d()]}return{width:Math.ceil(16*(r+1)-2*a-2*c),height:(2-n)*(i+1)*16-(n?2:4)*(u+l),pixelRatio:_}},t.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e}(),S=function(){function e(e,t,r,i){this.decryptdata=r,this.discardEPB=i,this.decrypter=new s.default(e,t,{removePKCS7Padding:!1})}var t=e.prototype;return t.decryptBuffer=function(e,t){this.decrypter.decrypt(e,this.decryptdata.key.buffer,this.decryptdata.iv.buffer,t)},t.decryptAacSample=function(e,t,r,i){var n=e[t].unit,s=n.subarray(16,n.length-n.length%16),o=s.buffer.slice(s.byteOffset,s.byteOffset+s.length),a=this;this.decryptBuffer(o,(function(s){s=new Uint8Array(s),n.set(s,16),i||a.decryptAacSamples(e,t+1,r)}))},t.decryptAacSamples=function(e,t,r){for(;;t++){if(t>=e.length)return void r();if(!(e[t].unit.length<32)){var i=this.decrypter.isSync();if(this.decryptAacSample(e,t,r,i),!i)return}}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,r=new Int8Array(t),i=0,n=32;n<=e.length-16;n+=160,i+=16)r.set(e.subarray(n,n+16),i);return r},t.getAvcDecryptedUnit=function(e,t){t=new Uint8Array(t);for(var r=0,i=32;i<=e.length-16;i+=160,r+=16)e.set(t.subarray(r,r+16),i);return e},t.decryptAvcSample=function(e,t,r,i,n,s){var o=this.discardEPB(n.data),a=this.getAvcEncryptedData(o),c=this;this.decryptBuffer(a.buffer,(function(a){n.data=c.getAvcDecryptedUnit(o,a),s||c.decryptAvcSamples(e,t,r+1,i)}))},t.decryptAvcSamples=function(e,t,r,i){for(;;t++,r=0){if(t>=e.length)return void i();for(var n=e[t].units;!(r>=n.length);r++){var s=n[r];if(!(s.data.length<=48||1!==s.type&&5!==s.type)){var o=this.decrypter.isSync();if(this.decryptAvcSample(e,t,r,i,s,o),!o)return}}}},e}(),T={video:1,audio:2,id3:3,text:4},A=function(){function e(e,t,r,i){this.observer=e,this.config=r,this.typeSupported=i,this.remuxer=t,this.sampleAes=null,this.pmtUnknownTypes={}}var t=e.prototype;return t.setDecryptData=function(e){null!=e&&null!=e.key&&"SAMPLE-AES"===e.method?this.sampleAes=new S(this.observer,this.config,e,this.discardEPB):this.sampleAes=null},e.probe=function(t){var r=e._syncOffset(t);return!(r<0||(r&&a.logger.warn("MPEG2-TS detected but first sync word found @ offset "+r+", junk ahead ?"),0))},e._syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),r=0;r<t;){if(71===e[r]&&71===e[r+188]&&71===e[r+376])return r;r++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:T[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:"video"===e?0:void 0,isAAC:"audio"===e||void 0,duration:"audio"===e?t:void 0}},t.resetInitSegment=function(t,r,i,n){this.pmtParsed=!1,this._pmtId=-1,this.pmtUnknownTypes={},this._avcTrack=e.createTrack("video",n),this._audioTrack=e.createTrack("audio",n),this._id3Track=e.createTrack("id3",n),this._txtTrack=e.createTrack("text",n),this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=r,this.videoCodec=i,this._duration=n},t.resetTimeStamp=function(){},t.append=function(t,r,s,o){var c,u,l,d,f,h=t.length,p=!1;this.pmtUnknownTypes={},this.contiguous=s;var g=this.pmtParsed,y=this._avcTrack,m=this._audioTrack,b=this._id3Track,v=y.pid,w=m.pid,_=b.pid,E=this._pmtId,S=y.pesData,T=m.pesData,A=b.pesData,k=this._parsePAT,I=this._parsePMT.bind(this),R=this._parsePES,P=this._parseAVCPES.bind(this),O=this._parseAACPES.bind(this),C=this._parseMPEGPES.bind(this),j=this._parseID3PES.bind(this),D=e._syncOffset(t);for(h-=(h+D)%188,c=D;c<h;c+=188)if(71===t[c]){if(u=!!(64&t[c+1]),l=((31&t[c+1])<<8)+t[c+2],(48&t[c+3])>>4>1){if((d=c+5+t[c+4])===c+188)continue}else d=c+4;switch(l){case v:u&&(S&&(f=R(S))&&P(f,!1),S={data:[],size:0}),S&&(S.data.push(t.subarray(d,c+188)),S.size+=c+188-d);break;case w:u&&(T&&(f=R(T))&&(m.isAAC?O(f):C(f)),T={data:[],size:0}),T&&(T.data.push(t.subarray(d,c+188)),T.size+=c+188-d);break;case _:u&&(A&&(f=R(A))&&j(f),A={data:[],size:0}),A&&(A.data.push(t.subarray(d,c+188)),A.size+=c+188-d);break;case 0:u&&(d+=t[d]+1),E=this._pmtId=k(t,d);break;case E:u&&(d+=t[d]+1);var M=I(t,d,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);(v=M.avc)>0&&(y.pid=v),(w=M.audio)>0&&(m.pid=w,m.isAAC=M.isAAC),(_=M.id3)>0&&(b.pid=_),p&&!g&&(a.logger.log("reparse from beginning"),p=!1,c=D-188),g=this.pmtParsed=!0;break;case 17:case 8191:break;default:p=!0}}else this.observer.trigger(i.default.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});S&&(f=R(S))?(P(f,!0),y.pesData=null):y.pesData=S,T&&(f=R(T))?(m.isAAC?O(f):C(f),m.pesData=null):(T&&T.size&&a.logger.log("last AAC PES packet truncated,might overlap between fragments"),m.pesData=T),A&&(f=R(A))?(j(f),b.pesData=null):b.pesData=A,null==this.sampleAes?this.remuxer.remux(m,y,b,this._txtTrack,r,s,o):this.decryptAndRemux(m,y,b,this._txtTrack,r,s,o)},t.decryptAndRemux=function(e,t,r,i,n,s,o){if(e.samples&&e.isAAC){var a=this;this.sampleAes.decryptAacSamples(e.samples,0,(function(){a.decryptAndRemuxAvc(e,t,r,i,n,s,o)}))}else this.decryptAndRemuxAvc(e,t,r,i,n,s,o)},t.decryptAndRemuxAvc=function(e,t,r,i,n,s,o){if(t.samples){var a=this;this.sampleAes.decryptAvcSamples(t.samples,0,0,(function(){a.remuxer.remux(e,t,r,i,n,s,o)}))}else this.remuxer.remux(e,t,r,i,n,s,o)},t.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},t._parsePAT=function(e,t){return(31&e[t+10])<<8|e[t+11]},t._trackUnknownPmt=function(e,t,r){var i=this.pmtUnknownTypes[e]||0;return 0===i&&(this.pmtUnknownTypes[e]=0,t.call(a.logger,r)),this.pmtUnknownTypes[e]++,i},t._parsePMT=function(e,t,r,i){var n,s,o={audio:-1,avc:-1,id3:-1,isAAC:!0};for(n=t+3+((15&e[t+1])<<8|e[t+2])-4,t+=12+((15&e[t+10])<<8|e[t+11]);t<n;){switch(s=(31&e[t+1])<<8|e[t+2],e[t]){case 207:if(!i){this._trackUnknownPmt(e[t],a.logger.warn,"ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:-1===o.audio&&(o.audio=s);break;case 21:-1===o.id3&&(o.id3=s);break;case 219:if(!i){this._trackUnknownPmt(e[t],a.logger.warn,"H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:-1===o.avc&&(o.avc=s);break;case 3:case 4:r?-1===o.audio&&(o.audio=s,o.isAAC=!1):this._trackUnknownPmt(e[t],a.logger.warn,"MPEG audio found, not supported in this browser");break;case 36:this._trackUnknownPmt(e[t],a.logger.warn,"Unsupported HEVC stream type found");break;default:this._trackUnknownPmt(e[t],a.logger.log,"Unknown stream type:"+e[t])}t+=5+((15&e[t+3])<<8|e[t+4])}return o},t._parsePES=function(e){var t,r,i,n,s,o,c,u,l=0,d=e.data;if(!e||0===e.size)return null;for(;d[0].length<19&&d.length>1;){var f=new Uint8Array(d[0].length+d[1].length);f.set(d[0]),f.set(d[1],d[0].length),d[0]=f,d.splice(1,1)}if(1===((t=d[0])[0]<<16)+(t[1]<<8)+t[2]){if((i=(t[4]<<8)+t[5])&&i>e.size-6)return null;if(192&(r=t[7])&&(o=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&r?o-(c=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>54e5&&(a.logger.warn(Math.round((o-c)/9e4)+"s delta between PTS and DTS, align them"),o=c):c=o),u=(n=t[8])+9,e.size<=u)return null;e.size-=u,s=new Uint8Array(e.size);for(var h=0,p=d.length;h<p;h++){var g=(t=d[h]).byteLength;if(u){if(u>g){u-=g;continue}t=t.subarray(u),g-=u,u=0}s.set(t,l),l+=g}return i&&(i-=n+3),{data:s,pts:o,dts:c,len:i}}return null},t.pushAccesUnit=function(e,t){if(e.units.length&&e.frame){var r=t.samples,i=r.length;if(isNaN(e.pts)){if(!i)return void t.dropped++;var n=r[i-1];e.pts=n.pts,e.dts=n.dts}!this.config.forceKeyFrameOnDiscontinuity||!0===e.key||t.sps&&(i||this.contiguous)?(e.id=i,r.push(e)):t.dropped++}e.debug.length&&a.logger.log(e.pts+"/"+e.dts+":"+e.debug)},t._parseAVCPES=function(e,t){var r,i,n,s=this,o=this._avcTrack,a=this._parseAVCNALu(e.data),c=this.avcSample,u=!1,l=this.pushAccesUnit.bind(this),d=function(e,t,r,i){return{key:e,pts:t,dts:r,units:[],debug:i}};e.data=null,c&&a.length&&!o.audFound&&(l(c,o),c=this.avcSample=d(!1,e.pts,e.dts,"")),a.forEach((function(t){switch(t.type){case 1:i=!0,c||(c=s.avcSample=d(!0,e.pts,e.dts,"")),c.frame=!0;var a=t.data;if(u&&a.length>4){var f=new E(a).readSliceType();2!==f&&4!==f&&7!==f&&9!==f||(c.key=!0)}break;case 5:i=!0,c||(c=s.avcSample=d(!0,e.pts,e.dts,"")),c.key=!0,c.frame=!0;break;case 6:i=!0,(r=new E(s.discardEPB(t.data))).readUByte();for(var h=0,p=0,g=!1,y=0;!g&&r.bytesAvailable>1;){h=0;do{h+=y=r.readUByte()}while(255===y);p=0;do{p+=y=r.readUByte()}while(255===y);if(4===h&&0!==r.bytesAvailable){if(g=!0,181===r.readUByte()&&49===r.readUShort()&&1195456820===r.readUInt()&&3===r.readUByte()){var b=r.readUByte(),v=31&b,w=[b,r.readUByte()];for(n=0;n<v;n++)w.push(r.readUByte()),w.push(r.readUByte()),w.push(r.readUByte());s._insertSampleInOrder(s._txtTrack.samples,{type:3,pts:e.pts,bytes:w})}}else if(5===h&&0!==r.bytesAvailable){if(g=!0,p>16){var _=[];for(n=0;n<16;n++)_.push(r.readUByte().toString(16)),3!==n&&5!==n&&7!==n&&9!==n||_.push("-");var S=p-16,T=new Uint8Array(S);for(n=0;n<S;n++)T[n]=r.readUByte();s._insertSampleInOrder(s._txtTrack.samples,{pts:e.pts,payloadType:h,uuid:_.join(""),userDataBytes:T,userData:Object(m.utf8ArrayToStr)(T.buffer)})}}else if(p<r.bytesAvailable)for(n=0;n<p;n++)r.readUByte()}break;case 7:if(i=!0,u=!0,!o.sps){var A=(r=new E(t.data)).readSPS();o.width=A.width,o.height=A.height,o.pixelRatio=A.pixelRatio,o.sps=[t.data],o.duration=s._duration;var k=t.data.subarray(1,4),I="avc1.";for(n=0;n<3;n++){var R=k[n].toString(16);R.length<2&&(R="0"+R),I+=R}o.codec=I}break;case 8:i=!0,o.pps||(o.pps=[t.data]);break;case 9:i=!1,o.audFound=!0,c&&l(c,o),c=s.avcSample=d(!1,e.pts,e.dts,"");break;case 12:i=!1;break;default:i=!1,c&&(c.debug+="unknown NAL "+t.type+" ")}c&&i&&c.units.push(t)})),t&&c&&(l(c,o),this.avcSample=null)},t._insertSampleInOrder=function(e,t){var r=e.length;if(r>0){if(t.pts>=e[r-1].pts)e.push(t);else for(var i=r-1;i>=0;i--)if(t.pts<e[i].pts){e.splice(i,0,t);break}}else e.push(t)},t._getLastNalUnit=function(){var e,t=this.avcSample;if(!t||0===t.units.length){var r=this._avcTrack.samples;t=r[r.length-1]}if(t){var i=t.units;e=i[i.length-1]}return e},t._parseAVCNALu=function(e){var t,r,i,n,s=0,o=e.byteLength,a=this._avcTrack,c=a.naluState||0,u=c,l=[],d=-1;for(-1===c&&(d=0,n=31&e[0],c=0,s=1);s<o;)if(t=e[s++],c)if(1!==c)if(t)if(1===t){if(d>=0)i={data:e.subarray(d,s-c-1),type:n},l.push(i);else{var f=this._getLastNalUnit();if(f&&(u&&s<=4-u&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-u)),(r=s-c-1)>0)){var h=new Uint8Array(f.data.byteLength+r);h.set(f.data,0),h.set(e.subarray(0,r),f.data.byteLength),f.data=h}}s<o?(d=s,n=31&e[s],c=0):c=-1}else c=0;else c=3;else c=t?0:2;else c=t?0:1;if(d>=0&&c>=0&&(i={data:e.subarray(d,o),type:n,state:c},l.push(i)),0===l.length){var p=this._getLastNalUnit();if(p){var g=new Uint8Array(p.data.byteLength+e.byteLength);g.set(p.data,0),g.set(e,p.data.byteLength),p.data=g}}return a.naluState=c,l},t.discardEPB=function(e){for(var t,r,i=e.byteLength,n=[],s=1;s<i-2;)0===e[s]&&0===e[s+1]&&3===e[s+2]?(n.push(s+2),s+=2):s++;if(0===n.length)return e;t=i-n.length,r=new Uint8Array(t);var o=0;for(s=0;s<t;o++,s++)o===n[0]&&(o++,n.shift()),r[s]=e[o];return r},t._parseAACPES=function(e){var t,r,s,o,c,u,l,d=this._audioTrack,h=e.data,m=e.pts,b=this.aacOverFlow,v=this.aacLastPTS;if(b){var w=new Uint8Array(b.byteLength+h.byteLength);w.set(b,0),w.set(h,b.byteLength),h=w}for(s=0,c=h.length;s<c-1&&!f(h,s);s++);if(!s||(s<c-1?(u="AAC PES did not start with ADTS header,offset:"+s,l=!1):(u="no ADTS header found in AAC PES",l=!0),a.logger.warn("parsing error:"+u),this.observer.trigger(i.default.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.FRAG_PARSING_ERROR,fatal:l,reason:u}),!l)){if(p(d,this.observer,h,s,this.audioCodec),r=0,t=g(d.samplerate),b&&v){var _=v+t;Math.abs(_-m)>1&&(a.logger.log("AAC: align PTS for overlapping frames by "+Math.round((_-m)/90)),m=_)}for(;s<c;){if(f(h,s)){if(s+5<c){var E=y(d,h,s,m,r);if(E){s+=E.length,o=E.sample.pts,r++;continue}}break}s++}b=s<c?h.subarray(s,c):null,this.aacOverFlow=b,this.aacLastPTS=o}},t._parseMPEGPES=function(e){for(var t=e.data,r=t.length,i=0,n=0,s=e.pts;n<r;)if(_.isHeader(t,n)){var o=_.appendFrame(this._audioTrack,t,n,s,i);if(!o)break;n+=o.length,i++}else n++},t._parseID3PES=function(e){this._id3Track.samples.push(e)},e}(),k=function(){function e(e,t,r){this.observer=e,this.config=r,this.remuxer=t}var t=e.prototype;return t.resetInitSegment=function(e,t,r,i){this._audioTrack={container:"audio/mpeg",type:"audio",id:-1,sequenceNumber:0,isAAC:!1,samples:[],len:0,manifestCodec:t,duration:i,inputTimeScale:9e4}},t.resetTimeStamp=function(){},e.probe=function(e){var t,r,i=m.default.getID3Data(e,0);if(i&&void 0!==m.default.getTimeStamp(i))for(t=i.length,r=Math.min(e.length-1,t+100);t<r;t++)if(_.probe(e,t))return a.logger.log("MPEG Audio sync word found !"),!0;return!1},t.append=function(e,t,r,i){for(var n=m.default.getID3Data(e,0)||[],s=m.default.getTimeStamp(n),o=void 0!==s?90*s:9e4*t,a=n.length,c=e.length,u=0,l=0,d=this._audioTrack,f=[{pts:o,dts:o,data:n}];a<c;)if(_.isHeader(e,a)){var h=_.appendFrame(d,e,a,o,u);if(!h)break;a+=h.length,l=h.sample.pts,u++}else m.default.isHeader(e,a)?(n=m.default.getID3Data(e,a),f.push({pts:l,dts:l,data:n}),a+=n.length):a++;this.remuxer.remux(d,{samples:[]},{samples:f,inputTimeScale:9e4},{samples:[]},t,r,i)},t.destroy=function(){},e}(),I=function(){function e(){}return e.getSilentFrame=function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},e}(),R=Math.pow(2,32)-1,P=function(){function e(){}return e.init=function(){var t;for(t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:r,audio:i};var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=s,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,o,c,o,a),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,n))},e.box=function(e){for(var t,r=Array.prototype.slice.call(arguments,1),i=8,n=r.length,s=n;n--;)i+=r[n].byteLength;for((t=new Uint8Array(i))[0]=i>>24&255,t[1]=i>>16&255,t[2]=i>>8&255,t[3]=255&i,t.set(e,4),n=0,i=8;n<s;n++)t.set(r[n],i),i+=r[n].byteLength;return t},e.hdlr=function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])},e.mdat=function(t){return e.box(e.types.mdat,t)},e.mdhd=function(t,r){r*=t;var i=Math.floor(r/(R+1)),n=Math.floor(r%(R+1));return e.box(e.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,r,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,r))},e.moov=function(t){for(var r=t.length,i=[];r--;)i[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))},e.mvex=function(t){for(var r=t.length,i=[];r--;)i[r]=e.trex(t[r]);return e.box.apply(null,[e.types.mvex].concat(i))},e.mvhd=function(t,r){r*=t;var i=Math.floor(r/(R+1)),n=Math.floor(r%(R+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,s)},e.sdtp=function(t){var r,i,n=t.samples||[],s=new Uint8Array(4+n.length);for(i=0;i<n.length;i++)r=n[i].flags,s[i+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return e.box(e.types.sdtp,s)},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))},e.avc1=function(t){var r,i,n,s=[],o=[];for(r=0;r<t.sps.length;r++)n=(i=t.sps[r]).byteLength,s.push(n>>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(i));for(r=0;r<t.pps.length;r++)n=(i=t.pps[r]).byteLength,o.push(n>>>8&255),o.push(255&n),o=o.concat(Array.prototype.slice.call(i));var a=e.box(e.types.avcC,new Uint8Array([1,s[3],s[4],s[5],255,224|t.sps.length].concat(s).concat([t.pps.length]).concat(o))),c=t.width,u=t.height,l=t.pixelRatio[0],d=t.pixelRatio[1];return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,255&c,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,255&l,d>>24,d>>16&255,d>>8&255,255&d])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},e.mp4a=function(t){var r=t.samplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){var r=t.samplerate;return e.box(e.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]))},e.stsd=function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.mp3(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var r=t.id,i=t.duration*t.timescale,n=t.width,s=t.height,o=Math.floor(i/(R+1)),a=Math.floor(i%(R+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,a>>24,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,s>>8&255,255&s,0,0]))},e.traf=function(t,r){var i=e.sdtp(t),n=t.id,s=Math.floor(r/(R+1)),o=Math.floor(r%(R+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,o>>24,o>>16&255,o>>8&255,255&o])),e.trun(t,i.length+16+20+8+16+8+8),i)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,r){var i,n,s,o,a,c,u=t.samples||[],l=u.length,d=12+16*l,f=new Uint8Array(d);for(r+=8+d,f.set([0,0,15,1,l>>>24&255,l>>>16&255,l>>>8&255,255&l,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),i=0;i<l;i++)s=(n=u[i]).duration,o=n.size,a=n.flags,c=n.cts,f.set([s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,61440&a.degradPrio,15&a.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*i);return e.box(e.types.trun,f)},e.initSegment=function(t){e.types||e.init();var r,i=e.moov(t);return(r=new Uint8Array(e.FTYP.byteLength+i.byteLength)).set(e.FTYP),r.set(i,e.FTYP.byteLength),r},e}(),O=P;function C(e,t,r,i){void 0===r&&(r=1),void 0===i&&(i=!1);var n=e*t*r;return i?Math.round(n):n}function j(e,t){return void 0===t&&(t=!1),C(e,1e3,1/9e4,t)}function D(e,t){return void 0===t&&(t=1),C(e,9e4,1/t)}var M=D(10),x=D(.2),B=null;function L(e,t){var r;if(void 0===t)return e;for(r=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}var N,U=function(){function e(e,t,r,i){if(this.observer=e,this.config=t,this.typeSupported=r,this.ISGenerated=!1,null===B){var n=navigator.userAgent.match(/Chrome\/(\d+)/i);B=n?parseInt(n[1]):0}}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){this._initPTS=this._initDTS=e},t.resetInitSegment=function(){this.ISGenerated=!1},t.getVideoStartPts=function(e){var t=!1,r=e.reduce((function(e,r){var i=r.pts-e;return i<-4294967296?(t=!0,L(e,r.pts)):i>0?e:r.pts}),e[0].pts);return t&&a.logger.debug("PTS rollover detected"),r},t.remux=function(e,t,r,n,s,o,c){if(this.ISGenerated||this.generateIS(e,t,s),this.ISGenerated){var u=e.samples.length,l=t.samples.length,d=s,f=s;if(u&&l){var h=this.getVideoStartPts(t.samples),p=(L(e.samples[0].pts,h)-h)/t.inputTimeScale;d+=Math.max(0,p),f+=Math.max(0,-p)}if(u){e.timescale||(a.logger.warn("regenerate InitSegment as audio detected"),this.generateIS(e,t,s));var g,y=this.remuxAudio(e,d,o,c);l&&(y&&(g=y.endPTS-y.startPTS),t.timescale||(a.logger.warn("regenerate InitSegment as video detected"),this.generateIS(e,t,s)),this.remuxVideo(t,f,o,g))}else if(l){var m=this.remuxVideo(t,f,o,0,c);m&&e.codec&&this.remuxEmptyAudio(e,d,o,m)}}r.samples.length&&this.remuxID3(r,s),n.samples.length&&this.remuxText(n,s),this.observer.trigger(i.default.FRAG_PARSED)},t.generateIS=function(e,t,r){var s,o,c=this.observer,u=e.samples,l=t.samples,d=this.typeSupported,f="audio/mp4",h={},p={tracks:h},g=void 0===this._initPTS;if(g&&(s=o=1/0),e.config&&u.length&&(e.timescale=e.samplerate,a.logger.log("audio sampling rate : "+e.samplerate),e.isAAC||(d.mpeg?(f="audio/mpeg",e.codec=""):d.mp3&&(e.codec="mp3")),h.audio={container:f,codec:e.codec,initSegment:!e.isAAC&&d.mpeg?new Uint8Array:O.initSegment([e]),metadata:{channelCount:e.channelCount}},g&&(s=o=u[0].pts-Math.round(e.inputTimeScale*r))),t.sps&&t.pps&&l.length){var y=t.inputTimeScale;if(t.timescale=y,h.video={container:"video/mp4",codec:t.codec,initSegment:O.initSegment([t]),metadata:{width:t.width,height:t.height}},g){var m=this.getVideoStartPts(l),b=Math.round(y*r);o=Math.min(o,L(l[0].dts,m)-b),s=Math.min(s,m-b),this.observer.trigger(i.default.INIT_PTS_FOUND,{initPTS:s})}}else g&&h.audio&&this.observer.trigger(i.default.INIT_PTS_FOUND,{initPTS:s});Object.keys(h).length?(c.trigger(i.default.FRAG_PARSING_INIT_SEGMENT,p),this.ISGenerated=!0,g&&(this._initPTS=s,this._initDTS=o)):c.trigger(i.default.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},t.remuxVideo=function(e,t,r,s){var o,c,u,l,d,f=e.timescale,h=e.samples,p=[],g=h.length,y=this._initPTS,m=8,b=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY,w=0,_=!1,E=this.nextAvcDts;if(0!==g){r||(E=t*f-(h[0].pts-L(h[0].dts,h[0].pts)));for(var S=0;S<g;S++){var T=h[S];T.pts=L(T.pts-y,E),T.dts=L(T.dts-y,E),T.dts>T.pts&&(w=Math.max(Math.min(w,T.pts-T.dts),-1*x)),T.dts<h[S>0?S-1:S].dts&&(_=!0)}_&&h.sort((function(e,t){var r=e.dts-t.dts,i=e.pts-t.pts;return r||i||e.id-t.id})),l=h[0].dts,d=h[g-1].dts;var A=Math.round((d-l)/(g-1));if(w<0){if(w<-2*A){a.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+j(-A,!0)+" ms");for(var k=w,I=0;I<g;I++)h[I].dts=k=Math.max(k,h[I].pts-A),h[I].pts=Math.max(k,h[I].pts)}else{a.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+j(w,!0)+" ms to overcome this issue");for(var R=0;R<g;R++)h[R].dts=h[R].dts+w}l=h[0].dts,d=h[g-1].dts}if(r){var P=l-E,C=P>A;if(C||P<-1){C?a.logger.warn("AVC: "+j(P,!0)+" ms ("+P+"dts) hole between fragments detected, filling it"):a.logger.warn("AVC: "+j(-P,!0)+" ms ("+P+"dts) overlapping between fragments detected"),l=E;var D=h[0].pts-P;h[0].dts=l,h[0].pts=D,a.logger.log("Video: First PTS/DTS adjusted: "+j(D,!0)+"/"+j(l,!0)+", delta: "+j(P,!0)+" ms")}}B&&B<75&&(l=Math.max(0,l));for(var M=0,N=0,U=0;U<g;U++){for(var F=h[U],K=F.units,z=K.length,V=0,q=0;q<z;q++)V+=K[q].data.length;N+=V,M+=z,F.length=V,F.dts=Math.max(F.dts,l),F.pts=Math.max(F.pts,F.dts,0),b=Math.min(F.pts,b),v=Math.max(F.pts,v)}d=h[g-1].dts;var G=N+4*M+8;try{c=new Uint8Array(G)}catch(e){return void this.observer.trigger(i.default.ERROR,{type:n.ErrorTypes.MUX_ERROR,details:n.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:G,reason:"fail allocating video mdat "+G})}var H=new DataView(c.buffer);H.setUint32(0,G),c.set(O.types.mdat,4);for(var $=0;$<g;$++){for(var W,Y=h[$],X=Y.units,Z=0,Q=0,J=X.length;Q<J;Q++){var ee=X[Q],te=ee.data,re=ee.data.byteLength;H.setUint32(m,re),m+=4,c.set(te,m),m+=re,Z+=4+re}if($<g-1)o=h[$+1].dts-Y.dts;else{var ie=this.config,ne=Y.dts-h[$>0?$-1:$].dts;if(ie.stretchShortVideoTrack){var se=ie.maxBufferHole,oe=Math.floor(se*f),ae=(s?b+s*f:this.nextAudioPts)-Y.pts;ae>oe?((o=ae-ne)<0&&(o=ne),a.logger.log("It is approximately "+j(ae,!1)+" ms to the next segment; using duration "+j(o,!1)+" ms for the last video frame.")):o=ne}else o=ne}W=Math.round(Y.pts-Y.dts),p.push({size:Z,duration:o,cts:W,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:Y.key?2:1,isNonSync:Y.key?0:1}})}this.nextAvcDts=d+o;var ce=e.dropped;if(e.nbNalu=0,e.dropped=0,p.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var ue=p[0].flags;ue.dependsOn=2,ue.isNonSync=0}e.samples=p,u=O.moof(e.sequenceNumber++,l,e),e.samples=[];var le={data1:u,data2:c,startPTS:b/f,endPTS:(v+o)/f,startDTS:l/f,endDTS:this.nextAvcDts/f,type:"video",hasAudio:!1,hasVideo:!0,nb:p.length,dropped:ce};return this.observer.trigger(i.default.FRAG_PARSING_DATA,le),le}},t.remuxAudio=function(e,t,r,s){var o,c,u,l,d,f,h=e.inputTimeScale,p=e.timescale,g=h/p,y=(e.isAAC?1024:1152)*g,m=this._initPTS,b=!e.isAAC&&this.typeSupported.mpeg,v=b?0:8,w=e.samples,_=[],E=this.nextAudioPts;if(r|=w.length&&E&&(s&&Math.abs(t-E/h)<.1||Math.abs(w[0].pts-E-m)<20*y),w.forEach((function(e){e.pts=e.dts=L(e.pts-m,t*h)})),0!==(w=w.filter((function(e){return e.pts>=0}))).length){if(r||(E=s?Math.max(0,t*h):w[0].pts),e.isAAC)for(var S=this.config.maxAudioFramesDrift,T=0,A=E;T<w.length;){var k=w[T],R=k.pts,P=R-A;if(P<=-S*y)r||T>0?(a.logger.warn("Dropping 1 audio frame @ "+j(A,!0)/1e3+"s due to "+j(P,!0)+" ms overlap."),w.splice(T,1)):(a.logger.warn("Audio frame @ "+j(R,!0)/1e3+"s overlaps nextAudioPts by "+j(P,!0)+" ms."),A=R+y,T++);else if(P>=S*y&&P<M&&A){var C=Math.round(P/y);a.logger.warn("Injecting "+C+" audio frames @ "+j(A,!0)/1e3+"s due to "+j(P,!0)+" ms gap.");for(var D=0;D<C;D++){var x=Math.max(A,0);(c=I.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(a.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),c=k.unit.subarray()),w.splice(T,0,{unit:c,pts:x,dts:x}),A+=y,T++}k.pts=k.dts=A,A+=y,T++}else k.pts=k.dts=A,A+=y,T++}for(var B=w.length,N=0;B--;)N+=w[B].unit.byteLength;for(var U=0,F=w.length;U<F;U++){var K=w[U],z=K.unit,V=K.pts;if(void 0!==f&&o)o.duration=Math.round((V-f)/g);else{var q=V-E,G=0;if(r&&e.isAAC&&q){if(q>0&&q<M)G=Math.round((V-E)/y),a.logger.log(j(q,!0)+" ms hole between AAC samples detected,filling it"),G>0&&((c=I.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(c=z.subarray()),N+=G*c.length);else if(q<-12){a.logger.log("drop overlapping AAC sample, expected/parsed/delta: "+j(E,!0)+" ms / "+j(V,!0)+" ms / "+j(-q,!0)+" ms"),N-=z.byteLength;continue}V=E}if(d=V,!(N>0))return;N+=v;try{u=new Uint8Array(N)}catch(e){return void this.observer.trigger(i.default.ERROR,{type:n.ErrorTypes.MUX_ERROR,details:n.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:N,reason:"fail allocating audio mdat "+N})}b||(new DataView(u.buffer).setUint32(0,N),u.set(O.types.mdat,4));for(var H=0;H<G;H++)(c=I.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(a.logger.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),c=z.subarray()),u.set(c,v),v+=c.byteLength,o={size:c.byteLength,cts:0,duration:1024,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},_.push(o)}u.set(z,v);var $=z.byteLength;v+=$,o={size:$,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},_.push(o),f=V}var W=0;if((B=_.length)>=2&&(W=_[B-2].duration,o.duration=W),B){this.nextAudioPts=E=f+g*W,e.samples=_,l=b?new Uint8Array:O.moof(e.sequenceNumber++,d/g,e),e.samples=[];var Y=d/h,X=E/h,Z={data1:l,data2:u,startPTS:Y,endPTS:X,startDTS:Y,endDTS:X,type:"audio",hasAudio:!0,hasVideo:!1,nb:B};return this.observer.trigger(i.default.FRAG_PARSING_DATA,Z),Z}return null}},t.remuxEmptyAudio=function(e,t,r,i){var n=e.inputTimeScale,s=n/(e.samplerate?e.samplerate:n),o=this.nextAudioPts,c=(void 0!==o?o:i.startDTS*n)+this._initDTS,u=i.endDTS*n+this._initDTS,l=1024*s,d=Math.ceil((u-c)/l),f=I.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(a.logger.warn("remux empty Audio"),f){for(var h=[],p=0;p<d;p++){var g=c+p*l;h.push({unit:f,pts:g,dts:g})}e.samples=h,this.remuxAudio(e,t,r)}else a.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!")},t.remuxID3=function(e,t){var r=e.samples.length;if(r){for(var n=e.inputTimeScale,s=this._initPTS,o=this._initDTS,a=0;a<r;a++){var c=e.samples[a];c.pts=L(c.pts-s,t*n)/n,c.dts=L(c.dts-o,t*n)/n}this.observer.trigger(i.default.FRAG_PARSING_METADATA,{samples:e.samples}),e.samples=[]}},t.remuxText=function(e,t){var r=e.samples.length,n=e.inputTimeScale,s=this._initPTS;if(r){for(var o=0;o<r;o++){var a=e.samples[o];a.pts=L(a.pts-s,t*n)/n}e.samples.sort((function(e,t){return e.pts-t.pts})),this.observer.trigger(i.default.FRAG_PARSING_USERDATA,{samples:e.samples})}e.samples=[]},e}(),F=function(){function e(e){this.observer=e}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(){},t.resetInitSegment=function(){},t.remux=function(e,t,r,n,s,o,a,c){var u=this.observer,l="";e&&(l+="audio"),t&&(l+="video"),u.trigger(i.default.FRAG_PARSING_DATA,{data1:c,startPTS:s,startDTS:s,type:l,hasAudio:!!e,hasVideo:!!t,nb:1,dropped:0}),u.trigger(i.default.FRAG_PARSED)},e}(),K=Object(c.getSelfScope)();try{N=K.performance.now.bind(K.performance)}catch(e){a.logger.debug("Unable to use Performance API on this environment"),N=K.Date.now}var z=function(){function e(e,t,r,i){this.observer=e,this.typeSupported=t,this.config=r,this.vendor=i}var t=e.prototype;return t.destroy=function(){var e=this.demuxer;e&&e.destroy()},t.push=function(e,t,r,n,o,a,c,u,l,d,f,h){var p=this;if(e.byteLength>0&&null!=t&&null!=t.key&&"AES-128"===t.method){var g=this.decrypter;null==g&&(g=this.decrypter=new s.default(this.observer,this.config));var y=N();g.decrypt(e,t.key.buffer,t.iv.buffer,(function(e){var s=N();p.observer.trigger(i.default.FRAG_DECRYPTED,{stats:{tstart:y,tdecrypt:s}}),p.pushDecrypted(new Uint8Array(e),t,new Uint8Array(r),n,o,a,c,u,l,d,f,h)}))}else this.pushDecrypted(new Uint8Array(e),t,new Uint8Array(r),n,o,a,c,u,l,d,f,h)},t.pushDecrypted=function(e,t,r,s,o,a,c,u,l,d,f,h){var p=this.demuxer,g=this.remuxer;if(!p||c||u){for(var y,m=this.observer,w=this.typeSupported,_=this.config,E=[{demux:A,remux:U},{demux:v.default,remux:F},{demux:b,remux:U},{demux:k,remux:U}],S=0,T=E.length;S<T&&!(y=E[S]).demux.probe(e);S++);if(!y)return void m.trigger(i.default.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});g&&g instanceof y.remux||(g=new y.remux(m,_,w,this.vendor)),p&&p instanceof y.demux||(p=new y.demux(m,g,_,w),this.probe=y.demux.probe),this.demuxer=p,this.remuxer=g}(c||u)&&(p.resetInitSegment(r,s,o,d),g.resetInitSegment()),c&&(p.resetTimeStamp(h),g.resetTimeStamp(h)),"function"==typeof p.setDecryptData&&p.setDecryptData(t),p.append(e,a,l,f)},e}();t.default=z},"./src/demux/demuxer-worker.js":function(e,t,r){"use strict";r.r(t);var i=r(/*! ../demux/demuxer-inline */"./src/demux/demuxer-inline.js"),n=r(/*! ../events */"./src/events.js"),s=r(/*! ../utils/logger */"./src/utils/logger.js"),o=r(/*! eventemitter3 */"./node_modules/eventemitter3/index.js");t.default=function(e){var t=new o.EventEmitter;t.trigger=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];t.emit.apply(t,[e,e].concat(i))},t.off=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];t.removeListener.apply(t,[e].concat(i))};var r=function(t,r){e.postMessage({event:t,data:r})};e.addEventListener("message",(function(n){var o=n.data;switch(o.cmd){case"init":var a=JSON.parse(o.config);e.demuxer=new i.default(t,o.typeSupported,a,o.vendor),Object(s.enableLogs)(a.debug),r("init",null);break;case"demux":e.demuxer.push(o.data,o.decryptdata,o.initSegment,o.audioCodec,o.videoCodec,o.timeOffset,o.discontinuity,o.trackSwitch,o.contiguous,o.duration,o.accurateTimeOffset,o.defaultInitPTS)}})),t.on(n.default.FRAG_DECRYPTED,r),t.on(n.default.FRAG_PARSING_INIT_SEGMENT,r),t.on(n.default.FRAG_PARSED,r),t.on(n.default.ERROR,r),t.on(n.default.FRAG_PARSING_METADATA,r),t.on(n.default.FRAG_PARSING_USERDATA,r),t.on(n.default.INIT_PTS_FOUND,r),t.on(n.default.FRAG_PARSING_DATA,(function(t,r){var i=[],n={event:t,data:r};r.data1&&(n.data1=r.data1.buffer,i.push(r.data1.buffer),delete r.data1),r.data2&&(n.data2=r.data2.buffer,i.push(r.data2.buffer),delete r.data2),e.postMessage(n,i)}))}},"./src/demux/id3.js":function(e,t,r){"use strict";r.r(t),r.d(t,"utf8ArrayToStr",(function(){return o}));var i,n=r(/*! ../utils/get-self-scope */"./src/utils/get-self-scope.js"),s=function(){function e(){}return e.isHeader=function(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},e.isFooter=function(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},e.getID3Data=function(t,r){for(var i=r,n=0;e.isHeader(t,r);)n+=10,n+=e._readSize(t,r+6),e.isFooter(t,r+10)&&(n+=10),r+=n;if(n>0)return t.subarray(i,i+n)},e._readSize=function(e,t){var r=0;return r=(127&e[t])<<21,r|=(127&e[t+1])<<14,r|=(127&e[t+2])<<7,r|=127&e[t+3]},e.getTimeStamp=function(t){for(var r=e.getID3Frames(t),i=0;i<r.length;i++){var n=r[i];if(e.isTimeStampFrame(n))return e._readTimeStamp(n)}},e.isTimeStampFrame=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},e._getFrameData=function(t){var r=String.fromCharCode(t[0],t[1],t[2],t[3]),i=e._readSize(t,4);return{type:r,size:i,data:t.subarray(10,10+i)}},e.getID3Frames=function(t){for(var r=0,i=[];e.isHeader(t,r);){for(var n=e._readSize(t,r+6),s=(r+=10)+n;r+8<s;){var o=e._getFrameData(t.subarray(r)),a=e._decodeFrame(o);a&&i.push(a),r+=o.size+10}e.isFooter(t,r)&&(r+=10)}return i},e._decodeFrame=function(t){return"PRIV"===t.type?e._decodePrivFrame(t):"W"===t.type[0]?e._decodeURLFrame(t):e._decodeTextFrame(t)},e._readTimeStamp=function(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),r=1&t[3],i=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return i/=45,r&&(i+=47721858.84),Math.round(i)}},e._decodePrivFrame=function(t){if(!(t.size<2)){var r=e._utf8ArrayToStr(t.data,!0),i=new Uint8Array(t.data.subarray(r.length+1));return{key:t.type,info:r,data:i.buffer}}},e._decodeTextFrame=function(t){if(!(t.size<2)){if("TXXX"===t.type){var r=1,i=e._utf8ArrayToStr(t.data.subarray(r),!0);r+=i.length+1;var n=e._utf8ArrayToStr(t.data.subarray(r));return{key:t.type,info:i,data:n}}var s=e._utf8ArrayToStr(t.data.subarray(1));return{key:t.type,data:s}}},e._decodeURLFrame=function(t){if("WXXX"===t.type){if(t.size<2)return;var r=1,i=e._utf8ArrayToStr(t.data.subarray(r),!0);r+=i.length+1;var n=e._utf8ArrayToStr(t.data.subarray(r));return{key:t.type,info:i,data:n}}var s=e._utf8ArrayToStr(t.data);return{key:t.type,data:s}},e._utf8ArrayToStr=function(e,t){void 0===t&&(t=!1);var r=function(){var e=Object(n.getSelfScope)();return i||void 0===e.TextDecoder||(i=new e.TextDecoder("utf-8")),i}();if(r){var s=r.decode(e);if(t){var o=s.indexOf("\0");return-1!==o?s.substring(0,o):s}return s.replace(/\0/g,"")}for(var a,c,u,l=e.length,d="",f=0;f<l;){if(0===(a=e[f++])&&t)return d;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:d+=String.fromCharCode(a);break;case 12:case 13:c=e[f++],d+=String.fromCharCode((31&a)<<6|63&c);break;case 14:c=e[f++],u=e[f++],d+=String.fromCharCode((15&a)<<12|(63&c)<<6|(63&u)<<0)}}return d},e}(),o=s._utf8ArrayToStr;t.default=s},"./src/demux/mp4demuxer.js":function(e,t,r){"use strict";r.r(t);var i=r(/*! ../utils/logger */"./src/utils/logger.js"),n=r(/*! ../events */"./src/events.js"),s=Math.pow(2,32)-1,o=function(){function e(e,t){this.observer=e,this.remuxer=t}var t=e.prototype;return t.resetTimeStamp=function(e){this.initPTS=e},t.resetInitSegment=function(t,r,i,s){if(t&&t.byteLength){var o=this.initData=e.parseInitSegment(t);null==r&&(r="mp4a.40.5"),null==i&&(i="avc1.42e01e");var a={};o.audio&&o.video?a.audiovideo={container:"video/mp4",codec:r+","+i,initSegment:s?t:null}:(o.audio&&(a.audio={container:"audio/mp4",codec:r,initSegment:s?t:null}),o.video&&(a.video={container:"video/mp4",codec:i,initSegment:s?t:null})),this.observer.trigger(n.default.FRAG_PARSING_INIT_SEGMENT,{tracks:a})}else r&&(this.audioCodec=r),i&&(this.videoCodec=i)},e.probe=function(t){return e.findBox({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length>0},e.bin2str=function(e){return String.fromCharCode.apply(null,e)},e.readUint16=function(e,t){e.data&&(t+=e.start,e=e.data);var r=e[t]<<8|e[t+1];return r<0?65536+r:r},e.readUint32=function(e,t){e.data&&(t+=e.start,e=e.data);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return r<0?4294967296+r:r},e.writeUint32=function(e,t,r){e.data&&(t+=e.start,e=e.data),e[t]=r>>24,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r},e.findBox=function(t,r){var i,n,s,o,a,c,u=[];if(t.data?(a=t.start,s=t.end,t=t.data):(a=0,s=t.byteLength),!r.length)return null;for(i=a;i<s;)c=(n=e.readUint32(t,i))>1?i+n:s,e.bin2str(t.subarray(i+4,i+8))===r[0]&&(1===r.length?u.push({data:t,start:i+8,end:c}):(o=e.findBox({data:t,start:i+8,end:c},r.slice(1))).length&&(u=u.concat(o))),i=c;return u},e.parseSegmentIndex=function(t){var r,i=e.findBox(t,["moov"])[0],n=i?i.end:null,s=0,o=e.findBox(t,["sidx"]);if(!o||!o[0])return null;r=[];var a=(o=o[0]).data[0];s=0===a?8:16;var c=e.readUint32(o,s);s+=4,s+=0===a?8:16,s+=2;var u=o.end+0,l=e.readUint16(o,s);s+=2;for(var d=0;d<l;d++){var f=s,h=e.readUint32(o,f);f+=4;var p=2147483647&h;if(1==(2147483648&h)>>>31)return void console.warn("SIDX has hierarchical references (not supported)");var g=e.readUint32(o,f);f+=4,r.push({referenceSize:p,subsegmentDuration:g,info:{duration:g/c,start:u,end:u+p-1}}),u+=p,s=f+=4}return{earliestPresentationTime:0,timescale:c,version:a,referencesCount:l,references:r,moovEndOffset:n}},e.parseInitSegment=function(t){var r=[];return e.findBox(t,["moov","trak"]).forEach((function(t){var n=e.findBox(t,["tkhd"])[0];if(n){var s=n.data[n.start],o=0===s?12:20,a=e.readUint32(n,o),c=e.findBox(t,["mdia","mdhd"])[0];if(c){o=0===(s=c.data[c.start])?12:20;var u=e.readUint32(c,o),l=e.findBox(t,["mdia","hdlr"])[0];if(l){var d={soun:"audio",vide:"video"}[e.bin2str(l.data.subarray(l.start+8,l.start+12))];if(d){var f=e.findBox(t,["mdia","minf","stbl","stsd"]);if(f.length){f=f[0];var h=e.bin2str(f.data.subarray(f.start+12,f.start+16));i.logger.log("MP4Demuxer:"+d+":"+h+" found")}r[a]={timescale:u,type:d},r[d]={timescale:u,id:a}}}}}})),r},e.getStartDTS=function(t,r){var i,n,s;return i=e.findBox(r,["moof","traf"]),n=[].concat.apply([],i.map((function(r){return e.findBox(r,["tfhd"]).map((function(i){var n,s;return n=e.readUint32(i,4),s=t[n].timescale||9e4,e.findBox(r,["tfdt"]).map((function(t){var r,i;return r=t.data[t.start],i=e.readUint32(t,4),1===r&&(i*=Math.pow(2,32),i+=e.readUint32(t,8)),i}))[0]/s}))}))),s=Math.min.apply(null,n),isFinite(s)?s:0},e.offsetStartDTS=function(t,r,i){e.findBox(r,["moof","traf"]).map((function(r){return e.findBox(r,["tfhd"]).map((function(n){var o=e.readUint32(n,4),a=t[o].timescale||9e4;e.findBox(r,["tfdt"]).map((function(t){var r=t.data[t.start],n=e.readUint32(t,4);if(0===r)e.writeUint32(t,4,n-i*a);else{n*=Math.pow(2,32),n+=e.readUint32(t,8),n-=i*a,n=Math.max(n,0);var o=Math.floor(n/(s+1)),c=Math.floor(n%(s+1));e.writeUint32(t,4,o),e.writeUint32(t,8,c)}}))}))}))},t.append=function(t,r,i,s){var o=this.initData;o||(this.resetInitSegment(t,this.audioCodec,this.videoCodec,!1),o=this.initData);var a,c=this.initPTS;if(void 0===c){var u=e.getStartDTS(o,t);this.initPTS=c=u-r,this.observer.trigger(n.default.INIT_PTS_FOUND,{initPTS:c})}e.offsetStartDTS(o,t,c),a=e.getStartDTS(o,t),this.remuxer.remux(o.audio,o.video,null,null,a,i,s,t)},t.destroy=function(){},e}();t.default=o},"./src/errors.ts":function(e,t,r){"use strict";var i,n,s,o;r.r(t),r.d(t,"ErrorTypes",(function(){return i})),r.d(t,"ErrorDetails",(function(){return s})),(n=i||(i={})).NETWORK_ERROR="networkError",n.MEDIA_ERROR="mediaError",n.KEY_SYSTEM_ERROR="keySystemError",n.MUX_ERROR="muxError",n.OTHER_ERROR="otherError",(o=s||(s={})).KEY_SYSTEM_NO_KEYS="keySystemNoKeys",o.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",o.KEY_SYSTEM_NO_SESSION="keySystemNoSession",o.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",o.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",o.MANIFEST_LOAD_ERROR="manifestLoadError",o.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",o.MANIFEST_PARSING_ERROR="manifestParsingError",o.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",o.LEVEL_EMPTY_ERROR="levelEmptyError",o.LEVEL_LOAD_ERROR="levelLoadError",o.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",o.LEVEL_SWITCH_ERROR="levelSwitchError",o.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",o.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",o.FRAG_LOAD_ERROR="fragLoadError",o.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",o.FRAG_DECRYPT_ERROR="fragDecryptError",o.FRAG_PARSING_ERROR="fragParsingError",o.REMUX_ALLOC_ERROR="remuxAllocError",o.KEY_LOAD_ERROR="keyLoadError",o.KEY_LOAD_TIMEOUT="keyLoadTimeOut",o.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",o.BUFFER_APPEND_ERROR="bufferAppendError",o.BUFFER_APPENDING_ERROR="bufferAppendingError",o.BUFFER_STALLED_ERROR="bufferStalledError",o.BUFFER_FULL_ERROR="bufferFullError",o.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",o.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",o.INTERNAL_EXCEPTION="internalException"},"./src/events.js":function(e,t,r){"use strict";r.r(t),t.default={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_SWITCHING:"hlsLevelSwitching",LEVEL_SWITCHED:"hlsLevelSwitched",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",LEVELS_UPDATED:"hlsLevelsUpdated",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCHING:"hlsAudioTrackSwitching",AUDIO_TRACK_SWITCHED:"hlsAudioTrackSwitched",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",SUBTITLE_TRACKS_UPDATED:"hlsSubtitleTracksUpdated",SUBTITLE_TRACK_SWITCH:"hlsSubtitleTrackSwitch",SUBTITLE_TRACK_LOADING:"hlsSubtitleTrackLoading",SUBTITLE_TRACK_LOADED:"hlsSubtitleTrackLoaded",SUBTITLE_FRAG_PROCESSED:"hlsSubtitleFragProcessed",CUES_PARSED:"hlsCuesParsed",NON_NATIVE_TEXT_TRACKS_FOUND:"hlsNonNativeTextTracksFound",INIT_PTS_FOUND:"hlsInitPtsFound",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_DECRYPTED:"hlsFragDecrypted",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition",LIVE_BACK_BUFFER_REACHED:"hlsLiveBackBufferReached"}},"./src/hls.ts":function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return hr}));var i={};r.r(i),r.d(i,"newCue",(function(){return mt}));var n,s,o,a,c=r("./node_modules/url-toolkit/src/url-toolkit.js"),u=r("./src/errors.ts"),l=r("./src/polyfills/number.js"),d=r("./src/events.js"),f=r("./src/utils/logger.js"),h={hlsEventGeneric:!0,hlsHandlerDestroying:!0,hlsHandlerDestroyed:!0},p=function(){function e(e){this.hls=void 0,this.handledEvents=void 0,this.useGenericHandler=void 0,this.hls=e,this.onEvent=this.onEvent.bind(this);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];this.handledEvents=r,this.useGenericHandler=!0,this.registerListeners()}var t=e.prototype;return t.destroy=function(){this.onHandlerDestroying(),this.unregisterListeners(),this.onHandlerDestroyed()},t.onHandlerDestroying=function(){},t.onHandlerDestroyed=function(){},t.isEventHandler=function(){return"object"==typeof this.handledEvents&&this.handledEvents.length&&"function"==typeof this.onEvent},t.registerListeners=function(){this.isEventHandler()&&this.handledEvents.forEach((function(e){if(h[e])throw new Error("Forbidden event-name: "+e);this.hls.on(e,this.onEvent)}),this)},t.unregisterListeners=function(){this.isEventHandler()&&this.handledEvents.forEach((function(e){this.hls.off(e,this.onEvent)}),this)},t.onEvent=function(e,t){this.onEventGeneric(e,t)},t.onEventGeneric=function(e,t){try{(function(e,t){var r="on"+e.replace("hls","");if("function"!=typeof this[r])throw new Error("Event "+e+" has no generic handler in this "+this.constructor.name+" class (tried "+r+")");return this[r].bind(this,t)}).call(this,e,t).call()}catch(t){f.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}},e}(),g=p;(s=n||(n={})).MANIFEST="manifest",s.LEVEL="level",s.AUDIO_TRACK="audioTrack",s.SUBTITLE_TRACK="subtitleTrack",(a=o||(o={})).MAIN="main",a.AUDIO="audio",a.SUBTITLE="subtitle";var y=r("./src/demux/mp4demuxer.js");function m(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var b,v,w=function(){function e(e,t){this._uri=null,this.baseuri=void 0,this.reluri=void 0,this.method=null,this.key=null,this.iv=null,this.baseuri=e,this.reluri=t}var t,r,i;return t=e,(r=[{key:"uri",get:function(){return!this._uri&&this.reluri&&(this._uri=Object(c.buildAbsoluteURL)(this.baseuri,this.reluri,{alwaysNormalize:!0})),this._uri}}])&&m(t.prototype,r),i&&m(t,i),e}();function _(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(v=b||(b={})).AUDIO="audio",v.VIDEO="video";var E=function(){function e(){var e;this._url=null,this._byteRange=null,this._decryptdata=null,this._elementaryStreams=((e={})[b.AUDIO]=!1,e[b.VIDEO]=!1,e),this.deltaPTS=0,this.rawProgramDateTime=null,this.programDateTime=null,this.title=null,this.tagList=[],this.cc=void 0,this.type=void 0,this.relurl=void 0,this.baseurl=void 0,this.duration=void 0,this.start=void 0,this.sn=0,this.urlId=0,this.level=0,this.levelkey=void 0,this.loader=void 0}var t,r,i,n=e.prototype;return n.setByteRange=function(e,t){var r=e.split("@",2),i=[];1===r.length?i[0]=t?t.byteRangeEndOffset:0:i[0]=parseInt(r[1]),i[1]=parseInt(r[0])+i[0],this._byteRange=i},n.addElementaryStream=function(e){this._elementaryStreams[e]=!0},n.hasElementaryStream=function(e){return!0===this._elementaryStreams[e]},n.createInitializationVector=function(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t},n.setDecryptDataFromLevelKey=function(e,t){var r=e;return(null==e?void 0:e.method)&&e.uri&&!e.iv&&((r=new w(e.baseuri,e.reluri)).method=e.method,r.iv=this.createInitializationVector(t)),r},t=e,(r=[{key:"url",get:function(){return!this._url&&this.relurl&&(this._url=Object(c.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url},set:function(e){this._url=e}},{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var e=this.sn;"number"!=typeof e&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&f.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),e=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,e)}return this._decryptdata}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!Object(l.isFiniteNumber)(this.programDateTime))return null;var e=Object(l.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){return!(!this.decryptdata||null===this.decryptdata.uri||null!==this.decryptdata.key)}}])&&_(t.prototype,r),i&&_(t,i),e}();function S(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var T=function(){function e(e){this.endCC=0,this.endSN=0,this.fragments=[],this.initSegment=null,this.live=!0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=e,this.version=null}var t,r,i;return t=e,(r=[{key:"hasProgramDateTime",get:function(){return!(!this.fragments[0]||!Object(l.isFiniteNumber)(this.fragments[0].programDateTime))}}])&&S(t.prototype,r),i&&S(t,i),e}(),A=/^(\d+)x(\d+)$/,k=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,I=function(){function e(t){for(var r in"string"==typeof t&&(t=e.parseAttrList(t)),t)t.hasOwnProperty(r)&&(this[r]=t[r])}var t=e.prototype;return t.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),i=0;i<t.length/2;i++)r[i]=parseInt(t.slice(2*i,2*i+2),16);return r}return null},t.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.enumeratedString=function(e){return this[e]},t.decimalResolution=function(e){var t=A.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,r={};for(k.lastIndex=0;null!==(t=k.exec(e));){var i=t[2];0===i.indexOf('"')&&i.lastIndexOf('"')===i.length-1&&(i=i.slice(1,-1)),r[t[1]]=i}return r},e}(),R={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0}};function P(e,t){return MediaSource.isTypeSupported((t||"video")+'/mp4;codecs="'+e+'"')}var O=/(?:#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)|#EXT-X-SESSION-DATA:([^\n\r]*)[\r\n]+)/g,C=/#EXT-X-MEDIA:(.*)/g,j=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/|(?!#)([\S+ ?]+)/.source,/|#EXT-X-BYTERANGE:*(.+)/.source,/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/|#.*/.source].join(""),"g"),D=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)([^:]*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/,M=/\.(mp4|m4s|m4v|m4a)$/i,x=function(){function e(){}return e.findGroup=function(e,t){for(var r=0;r<e.length;r++){var i=e[r];if(i.id===t)return i}},e.convertAVC1ToAVCOTI=function(e){var t,r=e.split(".");return r.length>2?(t=r.shift()+".",t+=parseInt(r.shift()).toString(16),t+=("000"+parseInt(r.shift()).toString(16)).substr(-4)):t=e,t},e.resolve=function(e,t){return c.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.parseMasterPlaylist=function(t,r){var i,n=[],s={},o=!1;function a(e,t){["video","audio"].forEach((function(r){var i=e.filter((function(e){return function(e,t){var r=R[t];return!!r&&!0===r[e.slice(0,4)]}(e,r)}));if(i.length){var n=i.filter((function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)}));t[r+"Codec"]=n.length>0?n[0]:i[0],e=e.filter((function(e){return-1===i.indexOf(e)}))}})),t.unknownCodecs=e}for(O.lastIndex=0;null!=(i=O.exec(t));)if(i[1]){var c={},u=c.attrs=new I(i[1]);c.url=e.resolve(i[2],r);var l=u.decimalResolution("RESOLUTION");l&&(c.width=l.width,c.height=l.height),c.bitrate=u.decimalInteger("AVERAGE-BANDWIDTH")||u.decimalInteger("BANDWIDTH"),c.name=u.NAME,a([].concat((u.CODECS||"").split(/[ ,]+/)),c),c.videoCodec&&-1!==c.videoCodec.indexOf("avc1")&&(c.videoCodec=e.convertAVC1ToAVCOTI(c.videoCodec)),n.push(c)}else if(i[3]){var d=new I(i[3]);d["DATA-ID"]&&(o=!0,s[d["DATA-ID"]]=d)}return{levels:n,sessionData:o?s:null}},e.parseMasterPlaylistMedia=function(t,r,i,n){var s;void 0===n&&(n=[]);var o=[],a=0;for(C.lastIndex=0;null!==(s=C.exec(t));){var c=new I(s[1]);if(c.TYPE===i){var u={attrs:c,id:a++,groupId:c["GROUP-ID"],instreamId:c["INSTREAM-ID"],name:c.NAME||c.LANGUAGE,type:i,default:"YES"===c.DEFAULT,autoselect:"YES"===c.AUTOSELECT,forced:"YES"===c.FORCED,lang:c.LANGUAGE};if(c.URI&&(u.url=e.resolve(c.URI,r)),n.length){var l=e.findGroup(n,u.groupId);u.audioCodec=l?l.codec:n[0].codec}o.push(u)}}return o},e.parseLevelPlaylist=function(e,t,r,i,n){var s,o,a,c=0,u=0,d=new T(t),h=0,p=null,g=new E,y=null;for(j.lastIndex=0;null!==(s=j.exec(e));){var m=s[1];if(m){g.duration=parseFloat(m);var b=(" "+s[2]).slice(1);g.title=b||null,g.tagList.push(b?["INF",m,b]:["INF",m])}else if(s[3]){if(Object(l.isFiniteNumber)(g.duration)){var v=c++;g.type=i,g.start=u,a&&(g.levelkey=a),g.sn=v,g.level=r,g.cc=h,g.urlId=n,g.baseurl=t,g.relurl=(" "+s[3]).slice(1),B(g,p),d.fragments.push(g),p=g,u+=g.duration,g=new E}}else if(s[4]){var _=(" "+s[4]).slice(1);p?g.setByteRange(_,p):g.setByteRange(_)}else if(s[5])g.rawProgramDateTime=(" "+s[5]).slice(1),g.tagList.push(["PROGRAM-DATE-TIME",g.rawProgramDateTime]),null===y&&(y=d.fragments.length);else{if(!(s=s[0].match(D))){f.logger.warn("No matches on slow regex match for level playlist!");continue}for(o=1;o<s.length&&void 0===s[o];o++);var S=(" "+s[o+1]).slice(1),A=(" "+s[o+2]).slice(1);switch(s[o]){case"#":g.tagList.push(A?[S,A]:[S]);break;case"PLAYLIST-TYPE":d.type=S.toUpperCase();break;case"MEDIA-SEQUENCE":c=d.startSN=parseInt(S);break;case"TARGETDURATION":d.targetduration=parseFloat(S);break;case"VERSION":d.version=parseInt(S);break;case"EXTM3U":break;case"ENDLIST":d.live=!1;break;case"DIS":h++,g.tagList.push(["DIS"]);break;case"DISCONTINUITY-SEQ":h=parseInt(S);break;case"KEY":var k=new I(S),R=k.enumeratedString("METHOD"),P=k.URI,O=k.hexadecimalInteger("IV");if("com.apple.streamingkeydelivery"===(k.KEYFORMAT||"identity")){f.logger.warn("Keyformat com.apple.streamingkeydelivery is not supported");continue}R&&(a=new w(t,P),P&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(R)>=0&&(a.method=R,a.key=null,a.iv=O));break;case"START":var C=new I(S).decimalFloatingPoint("TIME-OFFSET");Object(l.isFiniteNumber)(C)&&(d.startTimeOffset=C);break;case"MAP":var x=new I(S);g.relurl=x.URI,x.BYTERANGE&&g.setByteRange(x.BYTERANGE),g.baseurl=t,g.level=r,g.type=i,g.sn="initSegment",d.initSegment=g,(g=new E).rawProgramDateTime=d.initSegment.rawProgramDateTime;break;default:f.logger.warn("line parsed but not handled: "+s)}}}return(g=p)&&!g.relurl&&(d.fragments.pop(),u-=g.duration),d.totalduration=u,d.averagetargetduration=u/d.fragments.length,d.endSN=c-1,d.startCC=d.fragments[0]?d.fragments[0].cc:0,d.endCC=h,!d.initSegment&&d.fragments.length&&d.fragments.every((function(e){return M.test(e.relurl)}))&&(f.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(g=new E).relurl=d.fragments[0].relurl,g.baseurl=t,g.level=r,g.type=i,g.sn="initSegment",d.initSegment=g,d.needSidxRanges=!0),y&&function(e,t){for(var r=e[t],i=t-1;i>=0;i--){var n=e[i];n.programDateTime=r.programDateTime-1e3*n.duration,r=n}}(d.fragments,y),d},e}();function B(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):(null==t?void 0:t.programDateTime)&&(e.programDateTime=t.endProgramDateTime),Object(l.isFiniteNumber)(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}var L=window.performance,N=function(e){var t,r;function i(t){var r;return(r=e.call(this,t,d.default.MANIFEST_LOADING,d.default.LEVEL_LOADING,d.default.AUDIO_TRACK_LOADING,d.default.SUBTITLE_TRACK_LOADING)||this).loaders={},r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,i.canHaveQualityLevels=function(e){return e!==n.AUDIO_TRACK&&e!==n.SUBTITLE_TRACK},i.mapContextToLevelType=function(e){switch(e.type){case n.AUDIO_TRACK:return o.AUDIO;case n.SUBTITLE_TRACK:return o.SUBTITLE;default:return o.MAIN}},i.getResponseUrl=function(e,t){var r=e.url;return void 0!==r&&0!==r.indexOf("data:")||(r=t.url),r};var s=i.prototype;return s.createInternalLoader=function(e){var t=this.hls.config,r=t.pLoader,i=t.loader,n=new(r||i)(t);return e.loader=n,this.loaders[e.type]=n,n},s.getInternalLoader=function(e){return this.loaders[e.type]},s.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},s.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},s.destroy=function(){this.destroyInternalLoaders(),e.prototype.destroy.call(this)},s.onManifestLoading=function(e){this.load({url:e.url,type:n.MANIFEST,level:0,id:null,responseType:"text"})},s.onLevelLoading=function(e){this.load({url:e.url,type:n.LEVEL,level:e.level,id:e.id,responseType:"text"})},s.onAudioTrackLoading=function(e){this.load({url:e.url,type:n.AUDIO_TRACK,level:null,id:e.id,responseType:"text"})},s.onSubtitleTrackLoading=function(e){this.load({url:e.url,type:n.SUBTITLE_TRACK,level:null,id:e.id,responseType:"text"})},s.load=function(e){var t=this.hls.config;f.logger.debug("Loading playlist of type "+e.type+", level: "+e.level+", id: "+e.id);var r,i,s,o,a=this.getInternalLoader(e);if(a){var c=a.context;if(c&&c.url===e.url)return f.logger.trace("playlist request ongoing"),!1;f.logger.warn("aborting previous loader for type: "+e.type),a.abort()}switch(e.type){case n.MANIFEST:r=t.manifestLoadingMaxRetry,i=t.manifestLoadingTimeOut,s=t.manifestLoadingRetryDelay,o=t.manifestLoadingMaxRetryTimeout;break;case n.LEVEL:r=0,o=0,s=0,i=t.levelLoadingTimeOut;break;default:r=t.levelLoadingMaxRetry,i=t.levelLoadingTimeOut,s=t.levelLoadingRetryDelay,o=t.levelLoadingMaxRetryTimeout}a=this.createInternalLoader(e);var u={timeout:i,maxRetry:r,retryDelay:s,maxRetryDelay:o},l={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};return f.logger.debug("Calling internal loader delegate for URL: "+e.url),a.load(e,u,l),!0},s.loadsuccess=function(e,t,r,i){if(void 0===i&&(i=null),r.isSidxRequest)return this._handleSidxRequest(e,r),void this._handlePlaylistLoaded(e,t,r,i);if(this.resetInternalLoader(r.type),"string"!=typeof e.data)throw new Error('expected responseType of "text" for PlaylistLoader');var n=e.data;t.tload=L.now(),0===n.indexOf("#EXTM3U")?n.indexOf("#EXTINF:")>0||n.indexOf("#EXT-X-TARGETDURATION:")>0?this._handleTrackOrLevelPlaylist(e,t,r,i):this._handleMasterPlaylist(e,t,r,i):this._handleManifestParsingError(e,r,"no EXTM3U delimiter",i)},s.loaderror=function(e,t,r){void 0===r&&(r=null),this._handleNetworkError(t,r,!1,e)},s.loadtimeout=function(e,t,r){void 0===r&&(r=null),this._handleNetworkError(t,r,!0)},s._handleMasterPlaylist=function(e,t,r,n){var s=this.hls,o=e.data,a=i.getResponseUrl(e,r),c=x.parseMasterPlaylist(o,a),u=c.levels,l=c.sessionData;if(u.length){var h=u.map((function(e){return{id:e.attrs.AUDIO,codec:e.audioCodec}})),p=x.parseMasterPlaylistMedia(o,a,"AUDIO",h),g=x.parseMasterPlaylistMedia(o,a,"SUBTITLES"),y=x.parseMasterPlaylistMedia(o,a,"CLOSED-CAPTIONS");if(p.length){var m=!1;p.forEach((function(e){e.url||(m=!0)})),!1===m&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(f.logger.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:{},url:""}))}s.trigger(d.default.MANIFEST_LOADED,{levels:u,audioTracks:p,subtitles:g,captions:y,url:a,stats:t,networkDetails:n,sessionData:l})}else this._handleManifestParsingError(e,r,"no level found in manifest",n)},s._handleTrackOrLevelPlaylist=function(e,t,r,s){var o=this.hls,a=r.id,c=r.level,f=r.type,h=i.getResponseUrl(e,r),p=Object(l.isFiniteNumber)(a)?a:0,g=Object(l.isFiniteNumber)(c)?c:p,y=i.mapContextToLevelType(r),m=x.parseLevelPlaylist(e.data,h,g,y,p);if(m.tload=t.tload,m.fragments.length){if(f===n.MANIFEST){var b={url:h,details:m};o.trigger(d.default.MANIFEST_LOADED,{levels:[b],audioTracks:[],url:h,stats:t,networkDetails:s,sessionData:null})}if(t.tparsed=L.now(),m.needSidxRanges){var v=m.initSegment.url;this.load({url:v,isSidxRequest:!0,type:f,level:c,levelDetails:m,id:a,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer"})}else r.levelDetails=m,this._handlePlaylistLoaded(e,t,r,s)}else o.trigger(d.default.ERROR,{type:u.ErrorTypes.NETWORK_ERROR,details:u.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:"number"==typeof r.level?r.level:void 0})},s._handleSidxRequest=function(e,t){if("string"==typeof e.data)throw new Error("sidx request must be made with responseType of array buffer");var r=y.default.parseSegmentIndex(new Uint8Array(e.data));if(r){var i=r.references,n=t.levelDetails;i.forEach((function(e,t){var r=e.info;if(n){var i=n.fragments[t];0===i.byteRange.length&&i.setByteRange(String(1+r.end-r.start)+"@"+String(r.start))}})),n&&n.initSegment.setByteRange(String(r.moovEndOffset)+"@0")}},s._handleManifestParsingError=function(e,t,r,i){this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.NETWORK_ERROR,details:u.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:e.url,reason:r,networkDetails:i})},s._handleNetworkError=function(e,t,r,i){var s,o;void 0===r&&(r=!1),void 0===i&&(i=null),f.logger.info("A network error occured while loading a "+e.type+"-type playlist");var a=this.getInternalLoader(e);switch(e.type){case n.MANIFEST:s=r?u.ErrorDetails.MANIFEST_LOAD_TIMEOUT:u.ErrorDetails.MANIFEST_LOAD_ERROR,o=!0;break;case n.LEVEL:s=r?u.ErrorDetails.LEVEL_LOAD_TIMEOUT:u.ErrorDetails.LEVEL_LOAD_ERROR,o=!1;break;case n.AUDIO_TRACK:s=r?u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,o=!1;break;default:o=!1}a&&(a.abort(),this.resetInternalLoader(e.type));var c={type:u.ErrorTypes.NETWORK_ERROR,details:s,fatal:o,url:e.url,loader:a,context:e,networkDetails:t};i&&(c.response=i),this.hls.trigger(d.default.ERROR,c)},s._handlePlaylistLoaded=function(e,t,r,s){var o=r.type,a=r.level,c=r.id,u=r.levelDetails;if(u&&u.targetduration)if(i.canHaveQualityLevels(r.type))this.hls.trigger(d.default.LEVEL_LOADED,{details:u,level:a||0,id:c||0,stats:t,networkDetails:s});else switch(o){case n.AUDIO_TRACK:this.hls.trigger(d.default.AUDIO_TRACK_LOADED,{details:u,id:c,stats:t,networkDetails:s});break;case n.SUBTITLE_TRACK:this.hls.trigger(d.default.SUBTITLE_TRACK_LOADED,{details:u,id:c,stats:t,networkDetails:s})}else this._handleManifestParsingError(e,r,"invalid target duration",s)},i}(g),U=function(e){var t,r;function i(t){var r;return(r=e.call(this,t,d.default.FRAG_LOADING)||this).loaders={},r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n=i.prototype;return n.destroy=function(){var t=this.loaders;for(var r in t){var i=t[r];i&&i.destroy()}this.loaders={},e.prototype.destroy.call(this)},n.onFragLoading=function(e){var t=e.frag,r=t.type,i=this.loaders,n=this.hls.config,s=n.fLoader,o=n.loader;t.loaded=0;var a,c,u,d=i[r];d&&(f.logger.warn("abort previous fragment loader for type: "+r),d.abort()),d=i[r]=t.loader=n.fLoader?new s(n):new o(n),a={url:t.url,frag:t,responseType:"arraybuffer",progressData:!1};var h=t.byteRangeStartOffset,p=t.byteRangeEndOffset;Object(l.isFiniteNumber)(h)&&Object(l.isFiniteNumber)(p)&&(a.rangeStart=h,a.rangeEnd=p),c={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:n.fragLoadingMaxRetryTimeout},u={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},d.load(a,c,u)},n.loadsuccess=function(e,t,r,i){void 0===i&&(i=null);var n=e.data,s=r.frag;s.loader=void 0,this.loaders[s.type]=void 0,this.hls.trigger(d.default.FRAG_LOADED,{payload:n,frag:s,stats:t,networkDetails:i})},n.loaderror=function(e,t,r){void 0===r&&(r=null);var i=t.frag,n=i.loader;n&&n.abort(),this.loaders[i.type]=void 0,this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.NETWORK_ERROR,details:u.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t.frag,response:e,networkDetails:r})},n.loadtimeout=function(e,t,r){void 0===r&&(r=null);var i=t.frag,n=i.loader;n&&n.abort(),this.loaders[i.type]=void 0,this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.NETWORK_ERROR,details:u.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t.frag,networkDetails:r})},n.loadprogress=function(e,t,r,i){void 0===i&&(i=null);var n=t.frag;n.loaded=e.loaded,this.hls.trigger(d.default.FRAG_LOAD_PROGRESS,{frag:n,stats:e,networkDetails:i})},i}(g),F=function(e){var t,r;function i(t){var r;return(r=e.call(this,t,d.default.KEY_LOADING)||this).loaders={},r.decryptkey=null,r.decrypturl=null,r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n=i.prototype;return n.destroy=function(){for(var t in this.loaders){var r=this.loaders[t];r&&r.destroy()}this.loaders={},e.prototype.destroy.call(this)},n.onKeyLoading=function(e){var t=e.frag,r=t.type,i=this.loaders[r];if(t.decryptdata){var n=t.decryptdata.uri;if(n!==this.decrypturl||null===this.decryptkey){var s=this.hls.config;if(i&&(f.logger.warn("abort previous key loader for type:"+r),i.abort()),!n)return void f.logger.warn("key uri is falsy");t.loader=this.loaders[r]=new s.loader(s),this.decrypturl=n,this.decryptkey=null;var o={url:n,frag:t,responseType:"arraybuffer"},a={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout},c={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};t.loader.load(o,a,c)}else this.decryptkey&&(t.decryptdata.key=this.decryptkey,this.hls.trigger(d.default.KEY_LOADED,{frag:t}))}else f.logger.warn("Missing decryption data on fragment in onKeyLoading")},n.loadsuccess=function(e,t,r){var i=r.frag;i.decryptdata?(this.decryptkey=i.decryptdata.key=new Uint8Array(e.data),i.loader=void 0,delete this.loaders[i.type],this.hls.trigger(d.default.KEY_LOADED,{frag:i})):f.logger.error("after key load, decryptdata unset")},n.loaderror=function(e,t){var r=t.frag,i=r.loader;i&&i.abort(),delete this.loaders[r.type],this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.NETWORK_ERROR,details:u.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:r,response:e})},n.loadtimeout=function(e,t){var r=t.frag,i=r.loader;i&&i.abort(),delete this.loaders[r.type],this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.NETWORK_ERROR,details:u.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})},i}(g),K="NOT_LOADED",z="APPENDING",V="PARTIAL",q="OK",G=function(e){var t,r;function i(t){var r;return(r=e.call(this,t,d.default.BUFFER_APPENDED,d.default.FRAG_BUFFERED,d.default.FRAG_LOADED)||this).bufferPadding=.2,r.fragments=Object.create(null),r.timeRanges=Object.create(null),r.config=t.config,r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n=i.prototype;return n.destroy=function(){this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.config=null,g.prototype.destroy.call(this),e.prototype.destroy.call(this)},n.getBufferedFrag=function(e,t){var r=this.fragments,i=Object.keys(r).filter((function(i){var n=r[i];if(n.body.type!==t)return!1;if(!n.buffered)return!1;var s=n.body;return s.startPTS<=e&&e<=s.endPTS}));if(0===i.length)return null;var n=i.pop();return r[n].body},n.detectEvictedFragments=function(e,t){var r=this;Object.keys(this.fragments).forEach((function(i){var n=r.fragments[i];if(n&&n.buffered){var s=n.range[e];if(s)for(var o=s.time,a=0;a<o.length;a++){var c=o[a];if(!r.isTimeBuffered(c.startPTS,c.endPTS,t)){r.removeFragment(n.body);break}}}}))},n.detectPartialFragments=function(e){var t=this,r=this.getFragmentKey(e),i=this.fragments[r];i&&(i.buffered=!0,Object.keys(this.timeRanges).forEach((function(r){if(e.hasElementaryStream(r)){var n=t.timeRanges[r];i.range[r]=t.getBufferedTimes(e.startPTS,e.endPTS,n)}})))},n.getBufferedTimes=function(e,t,r){for(var i,n,s=[],o=!1,a=0;a<r.length;a++){if(i=r.start(a)-this.bufferPadding,n=r.end(a)+this.bufferPadding,e>=i&&t<=n){s.push({startPTS:Math.max(e,r.start(a)),endPTS:Math.min(t,r.end(a))});break}if(e<n&&t>i)s.push({startPTS:Math.max(e,r.start(a)),endPTS:Math.min(t,r.end(a))}),o=!0;else if(t<=i)break}return{time:s,partial:o}},n.getFragmentKey=function(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn},n.getPartialFragment=function(e){var t,r,i,n=this,s=null,o=0;return Object.keys(this.fragments).forEach((function(a){var c=n.fragments[a];n.isPartial(c)&&(r=c.body.startPTS-n.bufferPadding,i=c.body.endPTS+n.bufferPadding,e>=r&&e<=i&&(t=Math.min(e-r,i-e),o<=t&&(s=c.body,o=t)))})),s},n.getState=function(e){var t=this.getFragmentKey(e),r=this.fragments[t],i=K;return void 0!==r&&(i=r.buffered?!0===this.isPartial(r)?V:q:z),i},n.isPartial=function(e){return!0===e.buffered&&(void 0!==e.range.video&&!0===e.range.video.partial||void 0!==e.range.audio&&!0===e.range.audio.partial)},n.isTimeBuffered=function(e,t,r){for(var i,n,s=0;s<r.length;s++){if(i=r.start(s)-this.bufferPadding,n=r.end(s)+this.bufferPadding,e>=i&&t<=n)return!0;if(t<=i)return!1}return!1},n.onFragLoaded=function(e){var t=e.frag;Object(l.isFiniteNumber)(t.sn)&&!t.bitrateTest&&(this.fragments[this.getFragmentKey(t)]={body:t,range:Object.create(null),buffered:!1})},n.onBufferAppended=function(e){var t=this;this.timeRanges=e.timeRanges,Object.keys(this.timeRanges).forEach((function(e){var r=t.timeRanges[e];t.detectEvictedFragments(e,r)}))},n.onFragBuffered=function(e){this.detectPartialFragments(e.frag)},n.hasFragment=function(e){var t=this.getFragmentKey(e);return void 0!==this.fragments[t]},n.removeFragment=function(e){var t=this.getFragmentKey(e);delete this.fragments[t]},n.removeAllFragments=function(){this.fragments=Object.create(null)},i}(g),H={search:function(e,t){for(var r=0,i=e.length-1,n=null,s=null;r<=i;){var o=t(s=e[n=(r+i)/2|0]);if(o>0)r=n+1;else{if(!(o<0))return s;i=n-1}}return null}},$=function(){function e(){}return e.isBuffered=function(e,t){try{if(e)for(var r=e.buffered,i=0;i<r.length;i++)if(t>=r.start(i)&&t<=r.end(i))return!0}catch(e){}return!1},e.bufferInfo=function(e,t,r){try{if(e){var i,n=e.buffered,s=[];for(i=0;i<n.length;i++)s.push({start:n.start(i),end:n.end(i)});return this.bufferedInfo(s,t,r)}}catch(e){}return{len:0,start:t,end:t,nextStart:void 0}},e.bufferedInfo=function(e,t,r){e.sort((function(e,t){var r=e.start-t.start;return r||t.end-e.end}));var i=[];if(r)for(var n=0;n<e.length;n++){var s=i.length;if(s){var o=i[s-1].end;e[n].start-o<r?e[n].end>o&&(i[s-1].end=e[n].end):i.push(e[n])}else i.push(e[n])}else i=e;for(var a,c=0,u=t,l=t,d=0;d<i.length;d++){var f=i[d].start,h=i[d].end;if(t+r>=f&&t<h)u=f,c=(l=h)-t;else if(t+r<f){a=f;break}}return{len:c,start:u,end:l,nextStart:a}},e}(),W=r("./node_modules/eventemitter3/index.js"),Y=r("./node_modules/webworkify-webpack/index.js"),X=r("./src/demux/demuxer-inline.js");function Z(){return window.MediaSource||window.WebKitMediaSource}var Q=r("./src/utils/get-self-scope.js"),J=function(e){var t,r;function i(){return e.apply(this,arguments)||this}return r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,i.prototype.trigger=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];this.emit.apply(this,[e,e].concat(r))},i}(W.EventEmitter),ee=Object(Q.getSelfScope)(),te=Z()||{isTypeSupported:function(){return!1}},re=function(){function e(e,t){var r=this;this.hls=e,this.id=t;var i=this.observer=new J,n=e.config,s=function(t,i){(i=i||{}).frag=r.frag,i.id=r.id,e.trigger(t,i)};i.on(d.default.FRAG_DECRYPTED,s),i.on(d.default.FRAG_PARSING_INIT_SEGMENT,s),i.on(d.default.FRAG_PARSING_DATA,s),i.on(d.default.FRAG_PARSED,s),i.on(d.default.ERROR,s),i.on(d.default.FRAG_PARSING_METADATA,s),i.on(d.default.FRAG_PARSING_USERDATA,s),i.on(d.default.INIT_PTS_FOUND,s);var o={mp4:te.isTypeSupported("video/mp4"),mpeg:te.isTypeSupported("audio/mpeg"),mp3:te.isTypeSupported('audio/mp4; codecs="mp3"')},a=navigator.vendor;if(n.enableWorker&&"undefined"!=typeof Worker){var c;f.logger.log("demuxing in webworker");try{c=this.w=Y(/*! ../demux/demuxer-worker.js */"./src/demux/demuxer-worker.js"),this.onwmsg=this.onWorkerMessage.bind(this),c.addEventListener("message",this.onwmsg),c.onerror=function(t){e.trigger(d.default.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:t.message+" ("+t.filename+":"+t.lineno+")"}})},c.postMessage({cmd:"init",typeSupported:o,vendor:a,id:t,config:JSON.stringify(n)})}catch(e){f.logger.warn("Error in worker:",e),f.logger.error("Error while initializing DemuxerWorker, fallback on DemuxerInline"),c&&ee.URL.revokeObjectURL(c.objectURL),this.demuxer=new X.default(i,o,n,a),this.w=void 0}}else this.demuxer=new X.default(i,o,n,a)}var t=e.prototype;return t.destroy=function(){var e=this.w;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.w=null;else{var t=this.demuxer;t&&(t.destroy(),this.demuxer=null)}var r=this.observer;r&&(r.removeAllListeners(),this.observer=null)},t.push=function(e,t,r,i,n,s,o,a){var c=this.w,u=Object(l.isFiniteNumber)(n.startPTS)?n.startPTS:n.start,d=n.decryptdata,h=this.frag,p=!(h&&n.cc===h.cc),g=!(h&&n.level===h.level),y=h&&n.sn===h.sn+1,m=!g&&y;if(p&&f.logger.log(this.id+":discontinuity detected"),g&&f.logger.log(this.id+":switch detected"),this.frag=n,c)c.postMessage({cmd:"demux",data:e,decryptdata:d,initSegment:t,audioCodec:r,videoCodec:i,timeOffset:u,discontinuity:p,trackSwitch:g,contiguous:m,duration:s,accurateTimeOffset:o,defaultInitPTS:a},e instanceof ArrayBuffer?[e]:[]);else{var b=this.demuxer;b&&b.push(e,d,t,r,i,u,p,g,m,s,o,a)}},t.onWorkerMessage=function(e){var t=e.data,r=this.hls;switch(t.event){case"init":ee.URL.revokeObjectURL(this.w.objectURL);break;case d.default.FRAG_PARSING_DATA:t.data.data1=new Uint8Array(t.data1),t.data2&&(t.data.data2=new Uint8Array(t.data2));default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,r.trigger(t.event,t.data)}},e}();function ie(e,t,r){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(r);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(r)}}function ne(e,t,r){var i=e[t],n=e[r],s=n.startPTS;if(Object(l.isFiniteNumber)(s))r>t?(i.duration=s-i.start,i.duration<0&&f.logger.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):(n.duration=i.start-s,n.duration<0&&f.logger.warn("negative duration computed for frag "+n.sn+",level "+n.level+", there should be some duration drift between playlist and fragment!"));else if(r>t){var o=i.cc===n.cc;n.start=i.start+(o&&i.minEndPTS?i.minEndPTS-i.start:i.duration)}else n.start=Math.max(i.start-n.duration,0)}function se(e,t,r,i,n,s){var o=r,a=i;if(Object(l.isFiniteNumber)(t.startPTS)){var c=Math.abs(t.startPTS-r);Object(l.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(c,t.deltaPTS):t.deltaPTS=c,o=Math.max(r,t.startPTS),r=Math.min(r,t.startPTS),a=Math.min(i,t.endPTS),i=Math.max(i,t.endPTS),n=Math.min(n,t.startDTS),s=Math.max(s,t.endDTS)}var u=r-t.start;t.start=t.startPTS=r,t.maxStartPTS=o,t.endPTS=i,t.minEndPTS=a,t.startDTS=n,t.endDTS=s,t.duration=i-r;var d,f,h,p=t.sn;if(!e||p<e.startSN||p>e.endSN)return 0;for(d=p-e.startSN,(f=e.fragments)[d]=t,h=d;h>0;h--)ne(f,h,h-1);for(h=d;h<f.length-1;h++)ne(f,h,h+1);return e.PTSKnown=!0,u}function oe(e,t){t.initSegment&&e.initSegment&&(t.initSegment=e.initSegment);var r,i=0;if(ae(e,t,(function(e,n){i=e.cc-n.cc,Object(l.isFiniteNumber)(e.startPTS)&&(n.start=n.startPTS=e.startPTS,n.endPTS=e.endPTS,n.duration=e.duration,n.backtracked=e.backtracked,n.dropped=e.dropped,r=n),t.PTSKnown=!0})),t.PTSKnown){if(i){f.logger.log("discontinuity sliding from playlist, take drift into account");for(var n=t.fragments,s=0;s<n.length;s++)n[s].cc+=i}r?se(t,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):function(e,t){var r=t.startSN-e.startSN,i=e.fragments,n=t.fragments;if(!(r<0||r>i.length))for(var s=0;s<n.length;s++)n[s].start+=i[r].start}(e,t),t.PTSKnown=e.PTSKnown}}function ae(e,t,r){if(e&&t)for(var i=Math.max(e.startSN,t.startSN)-t.startSN,n=Math.min(e.endSN,t.endSN)-t.startSN,s=t.startSN-e.startSN,o=i;o<=n;o++){var a=e.fragments[s+o],c=t.fragments[o];if(!a||!c)break;r(a,c,o)}}function ce(e,t,r){var i=1e3*(t.averagetargetduration?t.averagetargetduration:t.targetduration),n=i/2;return e&&t.endSN===e.endSN&&(i=n),r&&(i=Math.max(n,i-(window.performance.now()-r))),Math.round(i)}var ue={toString:function(e){for(var t="",r=e.length,i=0;i<r;i++)t+="["+e.start(i).toFixed(3)+","+e.end(i).toFixed(3)+"]";return t}};function le(e,t){t.fragments.forEach((function(t){if(t){var r=t.start+e;t.start=t.startPTS=r,t.endPTS=r+t.duration}})),t.PTSKnown=!0}function de(e,t,r){!function(e,t,r){if(function(e,t,r){var i=!1;return t&&t.details&&r&&(r.endCC>r.startCC||e&&e.cc<r.startCC)&&(i=!0),i}(e,r,t)){var i=function(e,t){var r=e.fragments,i=t.fragments;if(i.length&&r.length){var n=function(e,t){for(var r=null,i=0;i<e.length;i+=1){var n=e[i];if(n&&n.cc===t){r=n;break}}return r}(r,i[0].cc);if(n&&(!n||n.startPTS))return n;f.logger.log("No frag in previous level to align on")}else f.logger.log("No fragments to align")}(r.details,t);i&&(f.logger.log("Adjusting PTS using last level due to CC increase within current level"),le(i.start,t))}}(e,r,t),!r.PTSKnown&&t&&function(e,t){if(t&&t.fragments.length){if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;var r=t.fragments[0].programDateTime,i=(e.fragments[0].programDateTime-r)/1e3+t.fragments[0].start;Object(l.isFiniteNumber)(i)&&(f.logger.log("adjusting PTS using programDateTime delta, sliding:"+i.toFixed(3)),le(i,e))}}(r,t.details)}function fe(e,t,r){if(null===t||!Array.isArray(e)||!e.length||!Object(l.isFiniteNumber)(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;r=r||0;for(var i=0;i<e.length;++i){var n=e[i];if(ge(t,r,n))return n}return null}function he(e,t,r,i){void 0===r&&(r=0),void 0===i&&(i=0);var n=null;if(e?n=t[e.sn-t[0].sn+1]:0===r&&0===t[0].start&&(n=t[0]),n&&0===pe(r,i,n))return n;var s=H.search(t,pe.bind(null,r,i));return s||n}function pe(e,t,r){void 0===e&&(e=0),void 0===t&&(t=0);var i=Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-i<=e?1:r.start-i>e&&r.start?-1:0}function ge(e,t,r){var i=1e3*Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-i>e}var ye=function(){function e(e,t,r,i){this.config=e,this.media=t,this.fragmentTracker=r,this.hls=i,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1}var t=e.prototype;return t.poll=function(e){var t=this.config,r=this.media,i=this.stalled,n=r.currentTime,s=r.seeking,o=this.seeking&&!s,a=!this.seeking&&s;if(this.seeking=s,n===e){if((a||o)&&(this.stalled=null),!r.paused&&!r.ended&&0!==r.playbackRate&&r.buffered.length){var c=$.bufferInfo(r,n,0),u=c.len>0,l=c.nextStart||0;if(u||l){if(s){var d=c.len>2,h=!l||l-n>2&&!this.fragmentTracker.getPartialFragment(n);if(d||h)return;this.moved=!1}if(!this.moved&&this.stalled){var p=Math.max(l,c.start||0)-n;if(p>0&&p<=2)return void this._trySkipBufferHole(null)}var g=self.performance.now();if(null!==i){var y=g-i;!s&&y>=250&&this._reportStall(c.len);var m=$.bufferInfo(r,n,t.maxBufferHole);this._tryFixBufferStall(m,y)}else this.stalled=g}}}else if(this.moved=!0,null!==i){if(this.stallReported){var b=self.performance.now()-i;f.logger.warn("playback not stuck anymore @"+n+", after "+Math.round(b)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}},t._tryFixBufferStall=function(e,t){var r=this.config,i=this.fragmentTracker,n=this.media.currentTime,s=i.getPartialFragment(n);s&&this._trySkipBufferHole(s)||e.len>r.maxBufferHole&&t>1e3*r.highBufferWatchdogPeriod&&(f.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,r=this.media;this.stallReported||(this.stallReported=!0,f.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer (buffer="+e+")"),t.trigger(d.default.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,r=this.hls,i=this.media,n=i.currentTime,s=0,o=0;o<i.buffered.length;o++){var a=i.buffered.start(o);if(n+t.maxBufferHole>=s&&n<a){var c=Math.max(a+.05,i.currentTime+.1);return f.logger.warn("skipping hole, adjusting currentTime from "+n+" to "+c),this.moved=!0,this.stalled=null,i.currentTime=c,e&&r.trigger(d.default.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+n+" to "+c,frag:e}),c}s=i.buffered.end(o)}return 0},t._tryNudgeBuffer=function(){var e=this.config,t=this.hls,r=this.media,i=r.currentTime,n=(this.nudgeRetry||0)+1;if(this.nudgeRetry=n,n<e.nudgeMaxRetry){var s=i+n*e.nudgeOffset;f.logger.warn("Nudging 'currentTime' from "+i+" to "+s),r.currentTime=s,t.trigger(d.default.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else f.logger.error("Playhead still not moving while enough data buffered @"+i+" after "+e.nudgeMaxRetry+" nudges"),t.trigger(d.default.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},e}();function me(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var be=function(e){var t,r;function i(t){for(var r,i=arguments.length,n=new Array(i>1?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];return(r=e.call.apply(e,[this,t].concat(n))||this)._boundTick=void 0,r._tickTimer=null,r._tickInterval=null,r._tickCallCount=0,r._boundTick=r.tick.bind(me(r)),r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n=i.prototype;return n.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},n.hasInterval=function(){return!!this._tickInterval},n.hasNextTick=function(){return!!this._tickTimer},n.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,e),!0)},n.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},n.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},n.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&(this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)),this._tickCallCount=0)},n.doTick=function(){},i}(g),ve="STOPPED",we="STARTING",_e="IDLE",Ee="PAUSED",Se="KEY_LOADING",Te="FRAG_LOADING",Ae="FRAG_LOADING_WAITING_RETRY",ke="WAITING_TRACK",Ie="PARSING",Re="PARSED",Pe="BUFFER_FLUSHING",Oe="ENDED",Ce="ERROR",je="WAITING_INIT_PTS",De="WAITING_LEVEL",Me=function(e){var t,r;function i(){return e.apply(this,arguments)||this}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n=i.prototype;return n.doTick=function(){},n.startLoad=function(){},n.stopLoad=function(){var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragmentTracker.removeFragment(e)),this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=ve},n._streamEnded=function(e,t){var r=this.fragCurrent,i=this.fragmentTracker;if(!t.live&&r&&!r.backtracked&&r.sn===t.endSN&&!e.nextStart){var n=i.getState(r);return n===V||n===q}return!1},n.onMediaSeeking=function(){var e=this.config,t=this.media,r=this.mediaBuffer,i=this.state,n=t?t.currentTime:null,s=$.bufferInfo(r||t,n,this.config.maxBufferHole);if(f.logger.log("media seeking to "+(Object(l.isFiniteNumber)(n)?n.toFixed(3):n)),i===Te){var o=this.fragCurrent;if(0===s.len&&o){var a=e.maxFragLookUpTolerance,c=o.start-a,u=o.start+o.duration+a;n<c||n>u?(o.loader&&(f.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),o.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=_e):f.logger.log("seeking outside of buffer but within currently loaded fragment range")}}else i===Oe&&(0===s.len&&(this.fragPrevious=null,this.fragCurrent=null),this.state=_e);t&&(this.lastCurrentTime=n),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=n),this.tick()},n.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},n.onHandlerDestroying=function(){this.stopLoad(),e.prototype.onHandlerDestroying.call(this)},n.onHandlerDestroyed=function(){this.state=ve,this.fragmentTracker=null},n.computeLivePosition=function(e,t){var r=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*t.targetduration;return e+Math.max(0,t.totalduration-r)},i}(be);function xe(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Be,Le=function(e){var t,r;function i(t,r){var i;return(i=e.call(this,t,d.default.MEDIA_ATTACHED,d.default.MEDIA_DETACHING,d.default.MANIFEST_LOADING,d.default.MANIFEST_PARSED,d.default.LEVEL_LOADED,d.default.LEVELS_UPDATED,d.default.KEY_LOADED,d.default.FRAG_LOADED,d.default.FRAG_LOAD_EMERGENCY_ABORTED,d.default.FRAG_PARSING_INIT_SEGMENT,d.default.FRAG_PARSING_DATA,d.default.FRAG_PARSED,d.default.ERROR,d.default.AUDIO_TRACK_SWITCHING,d.default.AUDIO_TRACK_SWITCHED,d.default.BUFFER_CREATED,d.default.BUFFER_APPENDED,d.default.BUFFER_FLUSHED)||this).fragmentTracker=r,i.config=t.config,i.audioCodecSwap=!1,i._state=ve,i.stallReported=!1,i.gapController=null,i.altAudio=!1,i.audioOnly=!1,i.bitrateTest=!1,i}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n,s,a,c=i.prototype;return c.startLoad=function(e){if(this.levels){var t=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var i=r.startLevel;-1===i&&(r.config.testBandwidth?(i=0,this.bitrateTest=!0):i=r.nextAutoLevel),this.level=r.nextLoadLevel=i,this.loadedmetadata=!1}t>0&&-1===e&&(f.logger.log("override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=_e,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this.forceStartLoad=!0,this.state=ve},c.stopLoad=function(){this.forceStartLoad=!1,e.prototype.stopLoad.call(this)},c.doTick=function(){switch(this.state){case Pe:this.fragLoadError=0;break;case _e:this._doTickIdle();break;case De:var e=this.levels[this.level];e&&e.details&&(this.state=_e);break;case Ae:var t=window.performance.now(),r=this.retryDate;(!r||t>=r||this.media&&this.media.seeking)&&(f.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=_e)}this._checkBuffer(),this._checkFragmentChanged()},c._doTickIdle=function(){var e=this.hls,t=e.config,r=this.media;if(void 0!==this.levelLastLoaded&&(r||!this.startFragRequested&&t.startFragPrefetch))if(this.altAudio&&this.audioOnly)this.demuxer.frag=null;else{var i;i=this.loadedmetadata?r.currentTime:this.nextLoadPosition;var n=e.nextLoadLevel,s=this.levels[n];if(s){var o,a=s.bitrate;o=a?Math.max(8*t.maxBufferSize/a,t.maxBufferLength):t.maxBufferLength,o=Math.min(o,t.maxMaxBufferLength);var c=i<t.maxBufferHole?Math.max(2,t.maxBufferHole):t.maxBufferHole,u=$.bufferInfo(this.mediaBuffer?this.mediaBuffer:r,i,c),l=u.len;if(!(l>=o)){f.logger.trace("buffer length of "+l.toFixed(3)+" is below max of "+o.toFixed(3)+". checking for more payload ..."),this.level=e.nextLoadLevel=n;var h=s.details;if(!h||h.live&&this.levelLastLoaded!==n)this.state=De;else{if(this._streamEnded(u,h)){var p={};return this.altAudio&&(p.type="video"),this.hls.trigger(d.default.BUFFER_EOS,p),void(this.state=Oe)}this._fetchPayloadOrEos(i,u,h)}}}}},c._fetchPayloadOrEos=function(e,t,r){var i=this.fragPrevious,n=(this.level,r.fragments),s=n.length;if(0!==s){var o,a=n[0].start,c=n[s-1].start+n[s-1].duration,u=t.end;if(r.initSegment&&!r.initSegment.data)o=r.initSegment;else if(r.live){var l=this.config.initialLiveManifestSize;if(s<l)return void f.logger.warn("Can not start playback of a level, reason: not enough fragments "+s+" < "+l);if(null===(o=this._ensureFragmentAtLivePoint(r,u,a,c,i,n)))return}else u<a&&(o=n[0]);o||(o=this._findFragment(a,i,s,n,u,c,r)),o&&(o.encrypted?this._loadKey(o,r):this._loadFragment(o,r,e,u))}},c._ensureFragmentAtLivePoint=function(e,t,r,i,n,s){var o,a=this.hls.config,c=this.media,u=1/0;if(void 0!==a.liveMaxLatencyDuration?u=a.liveMaxLatencyDuration:Object(l.isFiniteNumber)(a.liveMaxLatencyDurationCount)&&(u=a.liveMaxLatencyDurationCount*e.targetduration),t<Math.max(r-a.maxFragLookUpTolerance,i-u)){var d=this.liveSyncPosition=this.computeLivePosition(r,e);t=d,c&&!c.paused&&c.readyState&&c.duration>d&&d>c.currentTime&&(f.logger.log("buffer end: "+t.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+d.toFixed(3)),c.currentTime=d),this.nextLoadPosition=d}if(e.PTSKnown&&t>i&&c&&c.readyState)return null;if(this.startFragRequested&&!e.PTSKnown&&n)if(e.hasProgramDateTime)f.logger.log("live playlist, switching playlist, load frag with same PDT: "+n.programDateTime),o=fe(s,n.endProgramDateTime,a.maxFragLookUpTolerance);else{var h=n.sn+1;if(h>=e.startSN&&h<=e.endSN){var p=s[h-e.startSN];n.cc===p.cc&&(o=p,f.logger.log("live playlist, switching playlist, load frag with next SN: "+o.sn))}o||(o=H.search(s,(function(e){return n.cc-e.cc})))&&f.logger.log("live playlist, switching playlist, load frag with same CC: "+o.sn)}return o},c._findFragment=function(e,t,r,i,n,s,o){var a,c=this.hls.config;if(a=n<s?he(t,i,n,n>s-c.maxFragLookUpTolerance?0:c.maxFragLookUpTolerance):i[r-1]){var u=a.sn-o.startSN,l=t&&a.level===t.level,d=i[u-1],h=i[u+1];if(t&&a.sn===t.sn)if(l&&!a.backtracked)if(a.sn<o.endSN){var p=t.deltaPTS;p&&p>c.maxBufferHole&&t.dropped&&u?(a=d,f.logger.warn("Previous fragment was dropped with large PTS gap between audio and video. Maybe fragment is not starting with a keyframe? Loading previous one to try to overcome this")):(a=h,this.fragmentTracker.getState(a)!==q&&f.logger.log("Re-loading fragment with SN: "+a.sn))}else a=null;else a.backtracked&&(h&&h.backtracked?(f.logger.warn("Already backtracked from fragment "+h.sn+", will not backtrack to fragment "+a.sn+". Loading fragment "+h.sn),a=h):(f.logger.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),a.dropped=0,d?(a=d).backtracked=!0:u&&(a=null)))}return a},c._loadKey=function(e,t){f.logger.log("Loading key for "+e.sn+" of ["+t.startSN+"-"+t.endSN+"], level "+this.level),this.state=Se,this.hls.trigger(d.default.KEY_LOADING,{frag:e})},c._loadFragment=function(e,t,r,i){var n=this.fragmentTracker.getState(e);this.fragCurrent=e,"initSegment"!==e.sn&&(this.startFragRequested=!0),Object(l.isFiniteNumber)(e.sn)&&!e.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),e.backtracked||n===K||n===V?(e.autoLevel=this.hls.autoLevelEnabled,e.bitrateTest=this.bitrateTest,f.logger.log("Loading "+e.sn+" of ["+t.startSN+"-"+t.endSN+"], level "+this.level+", "+(this.loadedmetadata?"currentTime":"nextLoadPosition")+": "+parseFloat(r.toFixed(3))+", bufferEnd: "+parseFloat(i.toFixed(3))),this.hls.trigger(d.default.FRAG_LOADING,{frag:e}),this.demuxer||(this.demuxer=new re(this.hls,"main")),this.state=Te):n===z&&this._reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e)},c.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,o.MAIN)},c.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.endPTS+.5):null},c._checkFragmentChanged=function(){var e,t,r=this.media;if(r&&r.readyState&&!1===r.seeking&&((t=r.currentTime)>this.lastCurrentTime&&(this.lastCurrentTime=t),$.isBuffered(r,t)?e=this.getBufferedFrag(t):$.isBuffered(r,t+.1)&&(e=this.getBufferedFrag(t+.1)),e)){var i=e;if(i!==this.fragPlaying){this.hls.trigger(d.default.FRAG_CHANGED,{frag:i});var n=i.level;this.fragPlaying&&this.fragPlaying.level===n||this.hls.trigger(d.default.LEVEL_SWITCHED,{level:n}),this.fragPlaying=i}}},c.immediateLevelSwitch=function(){if(f.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var e,t=this.media;t?(e=t.paused)||t.pause():e=!0,this.previouslyPaused=e}var r=this.fragCurrent;r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},c.immediateLevelSwitchEnd=function(){var e=this.media;e&&e.buffered.length&&(this.immediateSwitch=!1,e.currentTime>0&&$.isBuffered(e,e.currentTime)&&(e.currentTime-=1e-4),this.previouslyPaused||e.play())},c.nextLevelSwitch=function(){var e=this.media;if(e&&e.readyState){var t,r=this.getBufferedFrag(e.currentTime);if(r&&r.startPTS>1&&this.flushMainBuffer(0,r.startPTS-1),e.paused)t=0;else{var i=this.hls.nextLoadLevel,n=this.levels[i],s=this.fragLastKbps;t=s&&this.fragCurrent?this.fragCurrent.duration*n.bitrate/(1e3*s)+1:0}var o=this.getBufferedFrag(e.currentTime+t);if(o){var a=this.followingBufferedFrag(o);if(a){var c=this.fragCurrent;c&&c.loader&&c.loader.abort(),this.fragCurrent=null;var u=Math.max(o.endPTS,a.maxStartPTS+Math.min(this.config.maxFragLookUpTolerance,a.duration));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}},c.flushMainBuffer=function(e,t){this.state=Pe;var r={startOffset:e,endOffset:t};this.altAudio&&(r.type="video"),this.hls.trigger(d.default.BUFFER_FLUSHING,r)},c.onMediaAttached=function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("seeked",this.onvseeked),t.addEventListener("ended",this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.hls.startLoad(r.startPosition),this.gapController=new ye(r,t,this.fragmentTracker,this.hls)},c.onMediaDetaching=function(){var e=this.media;e&&e.ended&&(f.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var t=this.levels;t&&t.forEach((function(e){e.details&&e.details.fragments.forEach((function(e){e.backtracked=void 0}))})),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("seeked",this.onvseeked),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.fragmentTracker.removeAllFragments(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()},c.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:void 0;Object(l.isFiniteNumber)(t)&&f.logger.log("media seeked to "+t.toFixed(3)),this.tick()},c.onManifestLoading=function(){f.logger.log("trigger BUFFER_RESET"),this.hls.trigger(d.default.BUFFER_RESET),this.fragmentTracker.removeAllFragments(),this.stalled=!1,this.startPosition=this.lastCurrentTime=0},c.onManifestParsed=function(e){var t,r=!1,i=!1;e.levels.forEach((function(e){(t=e.audioCodec)&&(-1!==t.indexOf("mp4a.40.2")&&(r=!0),-1!==t.indexOf("mp4a.40.5")&&(i=!0))})),this.audioCodecSwitch=r&&i,this.audioCodecSwitch&&f.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.altAudio=e.altAudio,this.levels=e.levels,this.startFragRequested=!1;var n=this.config;(n.autoStartLoad||this.forceStartLoad)&&this.hls.startLoad(n.startPosition)},c.onLevelLoaded=function(e){var t=e.details,r=e.level,i=this.levels[this.levelLastLoaded],n=this.levels[r],s=t.totalduration,o=0;if(f.logger.log("level "+r+" loaded ["+t.startSN+","+t.endSN+"],duration:"+s),t.live||n.details&&n.details.live){var a=n.details;a&&t.fragments.length>0?(oe(a,t),o=t.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(o,a),t.PTSKnown&&Object(l.isFiniteNumber)(o)?f.logger.log("live playlist sliding:"+o.toFixed(3)):(f.logger.log("live playlist - outdated PTS, unknown sliding"),de(this.fragPrevious,i,t))):(f.logger.log("live playlist - first load, unknown sliding"),t.PTSKnown=!1,de(this.fragPrevious,i,t))}else t.PTSKnown=!1;if(n.details=t,this.levelLastLoaded=r,this.hls.trigger(d.default.LEVEL_UPDATED,{details:t,level:r}),!1===this.startFragRequested){if(-1===this.startPosition||-1===this.lastCurrentTime){var c=t.startTimeOffset;Object(l.isFiniteNumber)(c)?(c<0&&(f.logger.log("negative start time offset "+c+", count from end of last fragment"),c=o+s+c),f.logger.log("start time offset found in playlist, adjust startPosition to "+c),this.startPosition=c):t.live?(this.startPosition=this.computeLivePosition(o,t),f.logger.log("configure startPosition to "+this.startPosition)):this.startPosition=0,this.lastCurrentTime=this.startPosition}this.nextLoadPosition=this.startPosition}this.state===De&&(this.state=_e),this.tick()},c.onKeyLoaded=function(){this.state===Se&&(this.state=_e,this.tick())},c.onFragLoaded=function(e){var t=this.fragCurrent,r=this.hls,i=this.levels,n=this.media,s=e.frag;if(this.state===Te&&t&&"main"===s.type&&s.level===t.level&&s.sn===t.sn){var o=e.stats,a=i[t.level],c=a.details;if(this.bitrateTest=!1,this.stats=o,f.logger.log("Loaded "+t.sn+" of ["+c.startSN+" ,"+c.endSN+"],level "+t.level),s.bitrateTest&&r.nextLoadLevel)this.state=_e,this.startFragRequested=!1,o.tparsed=o.tbuffered=window.performance.now(),r.trigger(d.default.FRAG_BUFFERED,{stats:o,frag:t,id:"main"}),this.tick();else if("initSegment"===s.sn)this.state=_e,o.tparsed=o.tbuffered=window.performance.now(),c.initSegment.data=e.payload,r.trigger(d.default.FRAG_BUFFERED,{stats:o,frag:t,id:"main"}),this.tick();else{f.logger.log("Parsing "+t.sn+" of ["+c.startSN+" ,"+c.endSN+"],level "+t.level+", cc "+t.cc),this.state=Ie,this.pendingBuffering=!0,this.appended=!1,s.bitrateTest&&(s.bitrateTest=!1,this.fragmentTracker.onFragLoaded({frag:s}));var u=!(n&&n.seeking)&&(c.PTSKnown||!c.live),l=c.initSegment?c.initSegment.data:[],h=this._getAudioCodec(a);(this.demuxer=this.demuxer||new re(this.hls,"main")).push(e.payload,l,h,a.videoCodec,t,c.totalduration,u)}}this.fragLoadError=0},c.onFragParsingInitSegment=function(e){var t=this.fragCurrent,r=e.frag;if(t&&"main"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===Ie){var i,n,s=e.tracks;if(this.audioOnly=s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio,n=s.audio){var o=this.levels[this.level].audioCodec,a=navigator.userAgent.toLowerCase();o&&this.audioCodecSwap&&(f.logger.log("swapping playlist audio codec"),o=-1!==o.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==n.metadata.channelCount&&-1===a.indexOf("firefox")&&(o="mp4a.40.5"),-1!==a.indexOf("android")&&"audio/mpeg"!==n.container&&(o="mp4a.40.2",f.logger.log("Android: force audio codec to "+o)),n.levelCodec=o,n.id=e.id}for(i in(n=s.video)&&(n.levelCodec=this.levels[this.level].videoCodec,n.id=e.id),this.hls.trigger(d.default.BUFFER_CODECS,s),s){n=s[i],f.logger.log("main track:"+i+",container:"+n.container+",codecs[level/parsed]=["+n.levelCodec+"/"+n.codec+"]");var c=n.initSegment;c&&(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(d.default.BUFFER_APPENDING,{type:i,data:c,parent:"main",content:"initSegment"}))}this.tick()}},c.onFragParsingData=function(e){var t=this,r=this.fragCurrent,i=e.frag;if(r&&"main"===e.id&&i.sn===r.sn&&i.level===r.level&&("audio"!==e.type||!this.altAudio)&&this.state===Ie){var n=this.levels[this.level],s=r;if(Object(l.isFiniteNumber)(e.endPTS)||(e.endPTS=e.startPTS+r.duration,e.endDTS=e.startDTS+r.duration),!0===e.hasAudio&&s.addElementaryStream(b.AUDIO),!0===e.hasVideo&&s.addElementaryStream(b.VIDEO),f.logger.log("Parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb+",dropped:"+(e.dropped||0)),"video"===e.type)if(s.dropped=e.dropped,s.dropped)if(s.backtracked)f.logger.warn("Already backtracked on this fragment, appending with the gap",s.sn);else{var o=n.details;if(!o||s.sn!==o.startSN)return f.logger.warn("missing video frame(s), backtracking fragment",s.sn),this.fragmentTracker.removeFragment(s),s.backtracked=!0,this.nextLoadPosition=e.startPTS,this.state=_e,this.fragPrevious=s,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),void this.tick();f.logger.warn("missing video frame(s) on first frag, appending with gap",s.sn)}else s.backtracked=!1;var a=se(n.details,s,e.startPTS,e.endPTS,e.startDTS,e.endDTS),c=this.hls;c.trigger(d.default.LEVEL_PTS_UPDATED,{details:n.details,level:this.level,drift:a,type:e.type,start:e.startPTS,end:e.endPTS}),[e.data1,e.data2].forEach((function(r){r&&r.length&&t.state===Ie&&(t.appended=!0,t.pendingBuffering=!0,c.trigger(d.default.BUFFER_APPENDING,{type:e.type,data:r,parent:"main",content:"data"}))})),this.tick()}},c.onFragParsed=function(e){var t=this.fragCurrent,r=e.frag;t&&"main"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===Ie&&(this.stats.tparsed=window.performance.now(),this.state=Re,this._checkAppendedParsed())},c.onAudioTrackSwitching=function(e){var t=this.altAudio,r=!!e.url,i=e.id;if(!r){if(this.mediaBuffer!==this.media){f.logger.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var n=this.fragCurrent;n.loader&&(f.logger.log("switching to main audio track, cancel main fragment load"),n.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=_e}var s=this.hls;t&&s.trigger(d.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),s.trigger(d.default.AUDIO_TRACK_SWITCHED,{id:i})}},c.onAudioTrackSwitched=function(e){var t=e.id,r=!!this.hls.audioTracks[t].url;if(r){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(f.logger.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=r,this.tick()},c.onBufferCreated=function(e){var t,r,i=e.tracks,n=!1;for(var s in i){var o=i[s];"main"===o.id?(r=s,t=o,"video"===s&&(this.videoBuffer=i[s].buffer)):n=!0}n&&t?(f.logger.log("alternate track found, use "+r+".buffered to schedule main fragment loading"),this.mediaBuffer=t.buffer):this.mediaBuffer=this.media},c.onBufferAppended=function(e){if("main"===e.parent){var t=this.state;t!==Ie&&t!==Re||(this.pendingBuffering=e.pending>0,this._checkAppendedParsed())}},c._checkAppendedParsed=function(){if(!(this.state!==Re||this.appended&&this.pendingBuffering)){var e=this.fragCurrent;if(e){var t=this.mediaBuffer?this.mediaBuffer:this.media;f.logger.log("main buffered : "+ue.toString(t.buffered)),this.fragPrevious=e;var r=this.stats;r.tbuffered=window.performance.now(),this.fragLastKbps=Math.round(8*r.total/(r.tbuffered-r.tfirst)),this.hls.trigger(d.default.FRAG_BUFFERED,{stats:r,frag:e,id:"main"}),this.state=_e}(this.loadedmetadata||this.startPosition<=0)&&this.tick()}},c.onError=function(e){var t=e.frag||this.fragCurrent;if(!t||"main"===t.type){var r=!!this.media&&$.isBuffered(this.media,this.media.currentTime)&&$.isBuffered(this.media,this.media.currentTime+.5);switch(e.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:if(!e.fatal)if(this.fragLoadError+1<=this.config.fragLoadingMaxRetry){var i=Math.min(Math.pow(2,this.fragLoadError)*this.config.fragLoadingRetryDelay,this.config.fragLoadingMaxRetryTimeout);f.logger.warn("mediaController: frag loading failed, retry in "+i+" ms"),this.retryDate=window.performance.now()+i,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.fragLoadError++,this.state=Ae}else f.logger.error("mediaController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.state=Ce;break;case u.ErrorDetails.LEVEL_LOAD_ERROR:case u.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==Ce&&(e.fatal?(this.state=Ce,f.logger.warn("streamController: "+e.details+",switch to "+this.state+" state ...")):e.levelRetry||this.state!==De||(this.state=_e));break;case u.ErrorDetails.BUFFER_FULL_ERROR:"main"!==e.parent||this.state!==Ie&&this.state!==Re||(r?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=_e):(f.logger.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)))}}},c._reduceMaxBufferLength=function(e){var t=this.config;return t.maxMaxBufferLength>=e&&(t.maxMaxBufferLength/=2,f.logger.warn("main:reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},c._checkBuffer=function(){var e=this.media;if(e&&0!==e.readyState){var t=(this.mediaBuffer?this.mediaBuffer:e).buffered;!this.loadedmetadata&&t.length?(this.loadedmetadata=!0,this._seekToStartPos()):this.immediateSwitch?this.immediateLevelSwitchEnd():this.gapController.poll(this.lastCurrentTime,t)}},c.onFragLoadEmergencyAborted=function(){this.state=_e,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},c.onBufferFlushed=function(){var e=this.mediaBuffer?this.mediaBuffer:this.media;if(e){var t=this.audioOnly?b.AUDIO:b.VIDEO;this.fragmentTracker.detectEvictedFragments(t,e.buffered)}this.state=_e,this.fragPrevious=null},c.onLevelsUpdated=function(e){this.levels=e.levels},c.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},c._seekToStartPos=function(){var e=this.media,t=e.currentTime,r=this.startPosition;if(t!==r&&r>=0){if(e.seeking)return void f.logger.log("could not seek to "+r+", already seeking at "+t);var i=(e.buffered.length?e.buffered.start(0):0)-r;i>0&&i<this.config.maxBufferHole&&(f.logger.log("adjusting start position by "+i+" to match buffer start"),r+=i,this.startPosition=r),f.logger.log("seek to target start position "+r+" from current time "+t+". ready state "+e.readyState),e.currentTime=r}},c._getAudioCodec=function(e){var t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&(f.logger.log("swapping playlist audio codec"),t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),t},n=i,(s=[{key:"state",set:function(e){if(this.state!==e){var t=this.state;this._state=e,f.logger.log("main stream-controller: "+t+"->"+e),this.hls.trigger(d.default.STREAM_STATE_TRANSITION,{previousState:t,nextState:e})}},get:function(){return this._state}},{key:"currentLevel",get:function(){var e=this.media;if(e){var t=this.getBufferedFrag(e.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var e=this.media;return e?this.followingBufferedFrag(this.getBufferedFrag(e.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"liveSyncPosition",get:function(){return this._liveSyncPosition},set:function(e){this._liveSyncPosition=e}}])&&xe(n.prototype,s),a&&xe(n,a),i}(Me);function Ne(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Ue=function(e){var t,r;function i(t){var r;return(r=e.call(this,t,d.default.MANIFEST_LOADED,d.default.LEVEL_LOADED,d.default.AUDIO_TRACK_SWITCHED,d.default.FRAG_LOADED,d.default.ERROR)||this).canload=!1,r.currentLevelIndex=null,r.manualLevelIndex=-1,r.timer=null,Be=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n,s,o,a=i.prototype;return a.onHandlerDestroying=function(){this.clearTimer(),this.manualLevelIndex=-1},a.clearTimer=function(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)},a.startLoad=function(){var e=this._levels;this.canload=!0,this.levelRetryCount=0,e&&e.forEach((function(e){e.loadError=0;var t=e.details;t&&t.live&&(e.details=void 0)})),null!==this.timer&&this.loadLevel()},a.stopLoad=function(){this.canload=!1},a.onManifestLoaded=function(e){var t,r=[],i=[],n={},s=null,o=!1,a=!1;if(e.levels.forEach((function(e){var t=e.attrs;e.loadError=0,e.fragmentError=!1,o=o||!!e.videoCodec,a=a||!!e.audioCodec,Be&&e.audioCodec&&-1!==e.audioCodec.indexOf("mp4a.40.34")&&(e.audioCodec=void 0),(s=n[e.bitrate])?s.url.push(e.url):(e.url=[e.url],e.urlId=0,n[e.bitrate]=e,r.push(e)),t&&(t.AUDIO&&ie(s||e,"audio",t.AUDIO),t.SUBTITLES&&ie(s||e,"text",t.SUBTITLES))})),o&&a&&(r=r.filter((function(e){return!!e.videoCodec}))),r=r.filter((function(e){var t=e.audioCodec,r=e.videoCodec;return(!t||P(t,"audio"))&&(!r||P(r,"video"))})),e.audioTracks&&(i=e.audioTracks.filter((function(e){return!e.audioCodec||P(e.audioCodec,"audio")}))).forEach((function(e,t){e.id=t})),r.length>0){t=r[0].bitrate,r.sort((function(e,t){return e.bitrate-t.bitrate})),this._levels=r;for(var c=0;c<r.length;c++)if(r[c].bitrate===t){this._firstLevel=c,f.logger.log("manifest loaded,"+r.length+" level(s) found, first bitrate:"+t);break}var l=a&&!o;this.hls.trigger(d.default.MANIFEST_PARSED,{levels:r,audioTracks:i,firstLevel:this._firstLevel,stats:e.stats,audio:a,video:o,altAudio:!l&&i.some((function(e){return!!e.url}))})}else this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:this.hls.url,reason:"no level with compatible codecs found in manifest"})},a.setLevelInternal=function(e){var t=this._levels,r=this.hls;if(e>=0&&e<t.length){if(this.clearTimer(),this.currentLevelIndex!==e){f.logger.log("switching to level "+e),this.currentLevelIndex=e;var i=t[e];i.level=e,r.trigger(d.default.LEVEL_SWITCHING,i)}var n=t[e],s=n.details;if(!s||s.live){var o=n.urlId;r.trigger(d.default.LEVEL_LOADING,{url:n.url[o],level:e,id:o})}}else r.trigger(d.default.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:!1,reason:"invalid level idx"})},a.onError=function(e){if(e.fatal)e.type===u.ErrorTypes.NETWORK_ERROR&&this.clearTimer();else{var t,r=!1,i=!1;switch(e.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:t=e.frag.level,i=!0;break;case u.ErrorDetails.LEVEL_LOAD_ERROR:case u.ErrorDetails.LEVEL_LOAD_TIMEOUT:t=e.context.level,r=!0;break;case u.ErrorDetails.REMUX_ALLOC_ERROR:t=e.level,r=!0}void 0!==t&&this.recoverLevel(e,t,r,i)}},a.recoverLevel=function(e,t,r,i){var n,s,o,a=this,c=this.hls.config,u=e.details,l=this._levels[t];if(l.loadError++,l.fragmentError=i,r){if(!(this.levelRetryCount+1<=c.levelLoadingMaxRetry))return f.logger.error("level controller, cannot recover from "+u+" error"),this.currentLevelIndex=null,this.clearTimer(),void(e.fatal=!0);s=Math.min(Math.pow(2,this.levelRetryCount)*c.levelLoadingRetryDelay,c.levelLoadingMaxRetryTimeout),this.timer=setTimeout((function(){return a.loadLevel()}),s),e.levelRetry=!0,this.levelRetryCount++,f.logger.warn("level controller, "+u+", retry in "+s+" ms, current retry count is "+this.levelRetryCount)}(r||i)&&((n=l.url.length)>1&&l.loadError<n?(l.urlId=(l.urlId+1)%n,l.details=void 0,f.logger.warn("level controller, "+u+" for level "+t+": switching to redundant URL-id "+l.urlId)):-1===this.manualLevelIndex?(o=0===t?this._levels.length-1:t-1,f.logger.warn("level controller, "+u+": switch to "+o),this.hls.nextAutoLevel=this.currentLevelIndex=o):i&&(f.logger.warn("level controller, "+u+": reload a fragment"),this.currentLevelIndex=null))},a.onFragLoaded=function(e){var t=e.frag;if(void 0!==t&&"main"===t.type){var r=this._levels[t.level];void 0!==r&&(r.fragmentError=!1,r.loadError=0,this.levelRetryCount=0)}},a.onLevelLoaded=function(e){var t=this,r=e.level,i=e.details;if(r===this.currentLevelIndex){var n=this._levels[r];if(n.fragmentError||(n.loadError=0,this.levelRetryCount=0),i.live){var s=ce(n.details,i,e.stats.trequest);f.logger.log("live playlist, reload in "+Math.round(s)+" ms"),this.timer=setTimeout((function(){return t.loadLevel()}),s)}else this.clearTimer()}},a.onAudioTrackSwitched=function(e){var t=this.hls.audioTracks[e.id].groupId,r=this.hls.levels[this.currentLevelIndex];if(r&&r.audioGroupIds){for(var i=-1,n=0;n<r.audioGroupIds.length;n++)if(r.audioGroupIds[n]===t){i=n;break}i!==r.urlId&&(r.urlId=i,this.startLoad())}},a.loadLevel=function(){if(f.logger.debug("call to loadLevel"),null!==this.currentLevelIndex&&this.canload){var e=this._levels[this.currentLevelIndex];if("object"==typeof e&&e.url.length>0){var t=this.currentLevelIndex,r=e.urlId,i=e.url[r];f.logger.log("Attempt loading level index "+t+" with URL-id "+r),this.hls.trigger(d.default.LEVEL_LOADING,{url:i,level:t,id:r})}}},a.removeLevel=function(e,t){var r=this.levels.filter((function(r,i){return i!==e||r.url.length>1&&void 0!==t&&(r.url=r.url.filter((function(e,r){return r!==t})),r.urlId=0,!0)})).map((function(e,t){var r=e.details;return r&&r.fragments&&r.fragments.forEach((function(e){e.level=t})),e}));this._levels=r,this.hls.trigger(d.default.LEVELS_UPDATED,{levels:r})},n=i,(s=[{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;t&&(e=Math.min(e,t.length-1),this.currentLevelIndex===e&&t[e].details||this.setLevelInternal(e))}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this._firstLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}])&&Ne(n.prototype,s),o&&Ne(n,o),i}(g),Fe=r("./src/demux/id3.js");function Ke(e,t){var r;try{r=new Event("addtrack")}catch(e){(r=document.createEvent("Event")).initEvent("addtrack",!1,!1)}r.track=e,t.dispatchEvent(r)}function ze(e){if(null==e?void 0:e.cues)for(;e.cues.length>0;)e.removeCue(e.cues[0])}var Ve=function(e){var t,r;function i(t){var r;return(r=e.call(this,t,d.default.MEDIA_ATTACHED,d.default.MEDIA_DETACHING,d.default.FRAG_PARSING_METADATA,d.default.LIVE_BACK_BUFFER_REACHED)||this).id3Track=void 0,r.media=void 0,r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n=i.prototype;return n.destroy=function(){g.prototype.destroy.call(this)},n.onMediaAttached=function(e){this.media=e.media,this.media},n.onMediaDetaching=function(){ze(this.id3Track),this.id3Track=void 0,this.media=void 0},n.getID3Track=function(e){for(var t=0;t<e.length;t++){var r=e[t];if("metadata"===r.kind&&"id3"===r.label)return Ke(r,this.media),r}return this.media.addTextTrack("metadata","id3")},n.onFragParsingMetadata=function(e){var t=e.frag,r=e.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var i=window.WebKitDataCue||window.VTTCue||window.TextTrackCue,n=0;n<r.length;n++){var s=Fe.default.getID3Frames(r[n].data);if(s){var o=Math.max(r[n].pts,0),a=n<r.length-1?r[n+1].pts:t.endPTS;a||(a=t.start+t.duration),a-o<=0&&(a=o+.25);for(var c=0;c<s.length;c++){var u=s[c];if(!Fe.default.isTimeStampFrame(u)){var l=new i(o,a,"");l.value=u,this.id3Track.addCue(l)}}}}},n.onLiveBackBufferReached=function(e){var t=e.bufferEnd,r=this.id3Track;if(r&&r.cues&&r.cues.length){var i=function(e,t){if(t<e[0].endTime)return e[0];if(t>e[e.length-1].endTime)return e[e.length-1];for(var r=0,i=e.length-1;r<=i;){var n=Math.floor((i+r)/2);if(t<e[n].endTime)i=n-1;else{if(!(t>e[n].endTime))return e[n];r=n+1}}return e[r].endTime-t<t-e[i].endTime?e[r]:e[i]}(r.cues,t);if(i)for(;r.cues[0]!==i;)r.removeCue(r.cues[0])}},i}(g),qe=function(){function e(e){this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=0,this.totalWeight_=0}var t=e.prototype;return t.sample=function(e,t){var r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e},t.getTotalWeight=function(){return this.totalWeight_},t.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/e}return this.estimate_},e}(),Ge=function(){function e(e,t,r,i){this.hls=void 0,this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.hls=e,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new qe(t),this.fast_=new qe(r)}var t=e.prototype;return t.sample=function(e,t){var r=(e=Math.max(e,this.minDelayMs_))/1e3,i=8*t/r;this.fast_.sample(r,i),this.slow_.sample(r,i)},t.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.destroy=function(){},e}();function He(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var $e=window.performance,We=function(e){var t,r;function i(t){var r;return(r=e.call(this,t,d.default.FRAG_LOADING,d.default.FRAG_LOADED,d.default.FRAG_BUFFERED,d.default.ERROR)||this).lastLoadedFragLevel=0,r._nextAutoLevel=-1,r.hls=t,r.timer=null,r._bwEstimator=null,r.onCheck=r._abandonRulesCheck.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r)),r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n,s,o,a=i.prototype;return a.destroy=function(){this.clearTimer(),g.prototype.destroy.call(this)},a.onFragLoading=function(e){var t=e.frag;if("main"===t.type&&(this.timer||(this.fragCurrent=t,this.timer=setInterval(this.onCheck,100)),!this._bwEstimator)){var r,i,n=this.hls,s=n.config,o=t.level;n.levels[o].details.live?(r=s.abrEwmaFastLive,i=s.abrEwmaSlowLive):(r=s.abrEwmaFastVoD,i=s.abrEwmaSlowVoD),this._bwEstimator=new Ge(n,i,r,s.abrEwmaDefaultEstimate)}},a._abandonRulesCheck=function(){var e=this.hls,t=e.media,r=this.fragCurrent;if(r){var i=r.loader;if(!i||i.stats&&i.stats.aborted)return f.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);var n=i.stats;if(t&&n&&(!t.paused&&0!==t.playbackRate||!t.readyState)&&r.autoLevel&&r.level){var s=$e.now()-n.trequest,o=Math.abs(t.playbackRate);if(s>500*r.duration/o){var a=e.levels,c=Math.max(1,n.bw?n.bw/8:1e3*n.loaded/s),u=a[r.level];if(!u)return;var l=u.realBitrate?Math.max(u.realBitrate,u.bitrate):u.bitrate,h=n.total?n.total:Math.max(n.loaded,Math.round(r.duration*l/8)),p=t.currentTime,g=(h-n.loaded)/c,y=($.bufferInfo(t,p,e.config.maxBufferHole).end-p)/o;if(y<2*r.duration/o&&g>y){var m,b,v=e.minAutoLevel;for(b=r.level-1;b>v;b--){var w=a[b].realBitrate?Math.max(a[b].realBitrate,a[b].bitrate):a[b].bitrate;if(r.duration*w/(6.4*c)<y)break}m<g&&(f.logger.warn("loading too slow, abort fragment loading and switch to level "+b+":fragLoadedDelay["+b+"]<fragLoadedDelay["+(r.level-1)+"];bufferStarvationDelay:"+m.toFixed(1)+"<"+g.toFixed(1)+":"+y.toFixed(1)),e.nextLoadLevel=b,this._bwEstimator.sample(s,n.loaded),i.abort(),this.clearTimer(),e.trigger(d.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,stats:n}))}}}}},a.onFragLoaded=function(e){var t=e.frag;if("main"===t.type&&Object(l.isFiniteNumber)(t.sn)){if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var r=this.hls.levels[t.level],i=(r.loaded?r.loaded.bytes:0)+e.stats.loaded,n=(r.loaded?r.loaded.duration:0)+e.frag.duration;r.loaded={bytes:i,duration:n},r.realBitrate=Math.round(8*i/n)}if(e.frag.bitrateTest){var s=e.stats;s.tparsed=s.tbuffered=s.tload,this.onFragBuffered(e)}}},a.onFragBuffered=function(e){var t=e.stats,r=e.frag;if(!0!==t.aborted&&"main"===r.type&&Object(l.isFiniteNumber)(r.sn)&&(!r.bitrateTest||t.tload===t.tbuffered)){var i=t.tparsed-t.trequest;f.logger.log("latency/loading/parsing/append/kbps:"+Math.round(t.tfirst-t.trequest)+"/"+Math.round(t.tload-t.tfirst)+"/"+Math.round(t.tparsed-t.tload)+"/"+Math.round(t.tbuffered-t.tparsed)+"/"+Math.round(8*t.loaded/(t.tbuffered-t.trequest))),this._bwEstimator.sample(i,t.loaded),t.bwEstimate=this._bwEstimator.getEstimate(),r.bitrateTest?this.bitrateTestDelay=i/1e3:this.bitrateTestDelay=0}},a.onError=function(e){switch(e.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},a.clearTimer=function(){clearInterval(this.timer),this.timer=null},a._findBestLevel=function(e,t,r,i,n,s,o,a,c){for(var u=n;u>=i;u--){var l=c[u];if(l){var d=l.details,h=d?d.totalduration/d.fragments.length:t,p=!!d&&d.live,g=void 0;g=u<=e?o*r:a*r;var y=c[u].realBitrate?Math.max(c[u].realBitrate,c[u].bitrate):c[u].bitrate,m=y*h/g;if(f.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(g)+"/"+y+"/"+h+"/"+s+"/"+m),g>y&&(!m||p&&!this.bitrateTestDelay||m<s))return u}}return-1},n=i,(s=[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this._bwEstimator;if(!(-1===e||t&&t.canEstimate()))return e;var r=this._nextABRAutoLevel;return-1!==e&&(r=Math.min(e,r)),r},set:function(e){this._nextAutoLevel=e}},{key:"_nextABRAutoLevel",get:function(){var e=this.hls,t=e.maxAutoLevel,r=e.levels,i=e.config,n=e.minAutoLevel,s=e.media,o=this.lastLoadedFragLevel,a=this.fragCurrent?this.fragCurrent.duration:0,c=s?s.currentTime:0,u=s&&0!==s.playbackRate?Math.abs(s.playbackRate):1,l=this._bwEstimator?this._bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,d=($.bufferInfo(s,c,i.maxBufferHole).end-c)/u,h=this._findBestLevel(o,a,l,n,t,d,i.abrBandWidthFactor,i.abrBandWidthUpFactor,r);if(h>=0)return h;f.logger.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var p=a?Math.min(a,i.maxStarvationDelay):i.maxStarvationDelay,g=i.abrBandWidthFactor,y=i.abrBandWidthUpFactor;if(0===d){var m=this.bitrateTestDelay;m&&(p=(a?Math.min(a,i.maxLoadingDelay):i.maxLoadingDelay)-m,f.logger.trace("bitrate test took "+Math.round(1e3*m)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*p)+" ms"),g=y=1)}return h=this._findBestLevel(o,a,l,n,t,d+p,g,y,r),Math.max(h,0)}}])&&He(n.prototype,s),o&&He(n,o),i}(g),Ye=Z(),Xe=function(e){var t,r;function i(t){var r;return(r=e.call(this,t,d.default.MEDIA_ATTACHING,d.default.MEDIA_DETACHING,d.default.MANIFEST_PARSED,d.default.BUFFER_RESET,d.default.BUFFER_APPENDING,d.default.BUFFER_CODECS,d.default.BUFFER_EOS,d.default.BUFFER_FLUSHING,d.default.LEVEL_PTS_UPDATED,d.default.LEVEL_UPDATED)||this)._msDuration=null,r._levelDuration=null,r._levelTargetDuration=10,r._live=null,r._objectUrl=null,r._needsFlush=!1,r._needsEos=!1,r.config=void 0,r.audioTimestampOffset=void 0,r.bufferCodecEventsExpected=0,r._bufferCodecEventsTotal=0,r.media=null,r.mediaSource=null,r.segments=[],r.parent=void 0,r.appending=!1,r.appended=0,r.appendError=0,r.flushBufferCounter=0,r.tracks={},r.pendingTracks={},r.sourceBuffer={},r.flushRange=[],r._onMediaSourceOpen=function(){f.logger.log("media source opened"),r.hls.trigger(d.default.MEDIA_ATTACHED,{media:r.media});var e=r.mediaSource;e&&e.removeEventListener("sourceopen",r._onMediaSourceOpen),r.checkPendingTracks()},r._onMediaSourceClose=function(){f.logger.log("media source closed")},r._onMediaSourceEnded=function(){f.logger.log("media source ended")},r._onSBUpdateEnd=function(){if(r.audioTimestampOffset&&r.sourceBuffer.audio){var e=r.sourceBuffer.audio;f.logger.warn("change mpeg audio timestamp offset from "+e.timestampOffset+" to "+r.audioTimestampOffset),e.timestampOffset=r.audioTimestampOffset,delete r.audioTimestampOffset}r._needsFlush&&r.doFlush(),r._needsEos&&r.checkEos(),r.appending=!1;var t=r.parent,i=r.segments.reduce((function(e,r){return r.parent===t?e+1:e}),0),n={},s=r.sourceBuffer;for(var o in s){var a=s[o];if(!a)throw Error("handling source buffer update end error: source buffer for "+o+" uninitilized and unable to update buffered TimeRanges.");n[o]=a.buffered}r.hls.trigger(d.default.BUFFER_APPENDED,{parent:t,pending:i,timeRanges:n}),r._needsFlush||r.doAppending(),r.updateMediaElementDuration(),0===i&&r.flushLiveBackBuffer()},r._onSBUpdateError=function(e){f.logger.error("sourceBuffer error:",e),r.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})},r.config=t.config,r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n=i.prototype;return n.destroy=function(){g.prototype.destroy.call(this)},n.onLevelPtsUpdated=function(e){var t=e.type,r=this.tracks.audio;if("audio"===t&&r&&"audio/mpeg"===r.container){var i=this.sourceBuffer.audio;if(!i)throw Error("Level PTS Updated and source buffer for audio uninitalized");if(Math.abs(i.timestampOffset-e.start)>.1){var n=i.updating;try{i.abort()}catch(e){f.logger.warn("can not abort audio buffer: "+e)}n?this.audioTimestampOffset=e.start:(f.logger.warn("change mpeg audio timestamp offset from "+i.timestampOffset+" to "+e.start),i.timestampOffset=e.start)}}},n.onManifestParsed=function(e){var t=2;(e.audio&&!e.video||!e.altAudio)&&(t=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=t,f.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},n.onMediaAttaching=function(e){var t=this.media=e.media;if(t&&Ye){var r=this.mediaSource=new Ye;r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),t.src=window.URL.createObjectURL(r),this._objectUrl=t.src}},n.onMediaDetaching=function(){f.logger.log("media source detaching");var e=this.mediaSource;if(e){if("open"===e.readyState)try{e.endOfStream()}catch(e){f.logger.warn("onMediaDetaching:"+e.message+" while calling endOfStream")}e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),this.media&&(this._objectUrl&&window.URL.revokeObjectURL(this._objectUrl),this.media.src===this._objectUrl?(this.media.removeAttribute("src"),this.media.load()):f.logger.warn("media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.hls.trigger(d.default.MEDIA_DETACHED)},n.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.pendingTracks,r=Object.keys(t).length;(r&&!e||2===r)&&(this.createSourceBuffers(t),this.pendingTracks={},this.doAppending())},n.onBufferReset=function(){var e=this.sourceBuffer;for(var t in e){var r=e[t];try{r&&(this.mediaSource&&this.mediaSource.removeSourceBuffer(r),r.removeEventListener("updateend",this._onSBUpdateEnd),r.removeEventListener("error",this._onSBUpdateError))}catch(e){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0},n.onBufferCodecs=function(e){var t=this;Object.keys(this.sourceBuffer).length||(Object.keys(e).forEach((function(r){t.pendingTracks[r]=e[r]})),this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},n.createSourceBuffers=function(e){var t=this.sourceBuffer,r=this.mediaSource;if(!r)throw Error("createSourceBuffers called when mediaSource was null");for(var i in e)if(!t[i]){var n=e[i];if(!n)throw Error("source buffer exists for track "+i+", however track does not");var s=n.levelCodec||n.codec,o=n.container+";codecs="+s;f.logger.log("creating sourceBuffer("+o+")");try{var a=t[i]=r.addSourceBuffer(o);a.addEventListener("updateend",this._onSBUpdateEnd),a.addEventListener("error",this._onSBUpdateError),this.tracks[i]={buffer:a,codec:s,id:n.id,container:n.container,levelCodec:n.levelCodec}}catch(e){f.logger.error("error while trying to add sourceBuffer:"+e.message),this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:e,mimeType:o})}}this.hls.trigger(d.default.BUFFER_CREATED,{tracks:this.tracks})},n.onBufferAppending=function(e){this._needsFlush||(this.segments?this.segments.push(e):this.segments=[e],this.doAppending())},n.onBufferEos=function(e){for(var t in this.sourceBuffer)if(!e.type||e.type===t){var r=this.sourceBuffer[t];r&&!r.ended&&(r.ended=!0,f.logger.log(t+" sourceBuffer now EOS"))}this.checkEos()},n.checkEos=function(){var e=this.sourceBuffer,t=this.mediaSource;if(t&&"open"===t.readyState){for(var r in e){var i=e[r];if(i){if(!i.ended)return;if(i.updating)return void(this._needsEos=!0)}}f.logger.log("all media data are available, signal endOfStream() to MediaSource and stop loading fragment");try{t.endOfStream()}catch(e){f.logger.warn("exception while calling mediaSource.endOfStream()")}this._needsEos=!1}else this._needsEos=!1},n.onBufferFlushing=function(e){e.type?this.flushRange.push({start:e.startOffset,end:e.endOffset,type:e.type}):(this.flushRange.push({start:e.startOffset,end:e.endOffset,type:"video"}),this.flushRange.push({start:e.startOffset,end:e.endOffset,type:"audio"})),this.flushBufferCounter=0,this.doFlush()},n.flushLiveBackBuffer=function(){if(this._live){var e=this.config.liveBackBufferLength;if(isFinite(e)&&!(e<0))if(this.media)for(var t=this.media.currentTime,r=this.sourceBuffer,i=Object.keys(r),n=t-Math.max(e,this._levelTargetDuration),s=i.length-1;s>=0;s--){var o=i[s],a=r[o];if(a){var c=a.buffered;c.length>0&&n>c.start(0)&&this.removeBufferRange(o,a,0,n)&&this.hls.trigger(d.default.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n})}}else f.logger.error("flushLiveBackBuffer called without attaching media")}},n.onLevelUpdated=function(e){var t=e.details;t.fragments.length>0&&(this._levelDuration=t.totalduration+t.fragments[0].start,this._levelTargetDuration=t.averagetargetduration||t.targetduration||10,this._live=t.live,this.updateMediaElementDuration())},n.updateMediaElementDuration=function(){var e,t=this.config;if(null!==this._levelDuration&&this.media&&this.mediaSource&&this.sourceBuffer&&0!==this.media.readyState&&"open"===this.mediaSource.readyState){for(var r in this.sourceBuffer){var i=this.sourceBuffer[r];if(i&&!0===i.updating)return}e=this.media.duration,null===this._msDuration&&(this._msDuration=this.mediaSource.duration),!0===this._live&&!0===t.liveDurationInfinity?(f.logger.log("Media Source duration is set to Infinity"),this._msDuration=this.mediaSource.duration=1/0):(this._levelDuration>this._msDuration&&this._levelDuration>e||!Object(l.isFiniteNumber)(e))&&(f.logger.log("Updating Media Source duration to "+this._levelDuration.toFixed(3)),this._msDuration=this.mediaSource.duration=this._levelDuration)}},n.doFlush=function(){for(;this.flushRange.length;){var e=this.flushRange[0];if(!this.flushBuffer(e.start,e.end,e.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var t=0,r=this.sourceBuffer;try{for(var i in r){var n=r[i];n&&(t+=n.buffered.length)}}catch(e){f.logger.error("error while accessing sourceBuffer.buffered")}this.appended=t,this.hls.trigger(d.default.BUFFER_FLUSHED)}},n.doAppending=function(){var e=this.config,t=this.hls,r=this.segments,i=this.sourceBuffer;if(Object.keys(i).length){if(!this.media||this.media.error)return this.segments=[],void f.logger.error("trying to append although a media error occured, flush segment and abort");if(!this.appending){var n=r.shift();if(n)try{var s=i[n.type];if(!s)return void this._onSBUpdateEnd();if(s.updating)return void r.unshift(n);s.ended=!1,this.parent=n.parent,s.appendBuffer(n.data),this.appendError=0,this.appended++,this.appending=!0}catch(i){f.logger.error("error while trying to append buffer:"+i.message),r.unshift(n);var o={type:u.ErrorTypes.MEDIA_ERROR,parent:n.parent,details:"",fatal:!1};22===i.code?(this.segments=[],o.details=u.ErrorDetails.BUFFER_FULL_ERROR):(this.appendError++,o.details=u.ErrorDetails.BUFFER_APPEND_ERROR,this.appendError>e.appendErrorMaxRetry&&(f.logger.log("fail "+e.appendErrorMaxRetry+" times to append segment in sourceBuffer"),this.segments=[],o.fatal=!0)),t.trigger(d.default.ERROR,o)}}}},n.flushBuffer=function(e,t,r){var i=this.sourceBuffer;if(!Object.keys(i).length)return!0;var n="null";if(this.media&&(n=this.media.currentTime.toFixed(3)),f.logger.log("flushBuffer,pos/start/end: "+n+"/"+e+"/"+t),this.flushBufferCounter>=this.appended)return f.logger.warn("abort flushing too many retries"),!0;var s=i[r];if(s){if(s.ended=!1,s.updating)return f.logger.warn("cannot flush, sb updating in progress"),!1;if(this.removeBufferRange(r,s,e,t))return this.flushBufferCounter++,!1}return f.logger.log("buffer flushed"),!0},n.removeBufferRange=function(e,t,r,i){try{for(var n=0;n<t.buffered.length;n++){var s=t.buffered.start(n),o=t.buffered.end(n),a=Math.max(s,r),c=Math.min(o,i);if(Math.min(c,o)-a>.5){var u="null";return this.media&&(u=this.media.currentTime.toString()),f.logger.log("sb remove "+e+" ["+a+","+c+"], of ["+s+","+o+"], pos:"+u),t.remove(a,c),!0}}}catch(e){f.logger.warn("removeBufferRange failed",e)}return!1},i}(g);function Ze(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Qe=function(e){var t,r;function i(t){var r;return(r=e.call(this,t,d.default.FPS_DROP_LEVEL_CAPPING,d.default.MEDIA_ATTACHING,d.default.MANIFEST_PARSED,d.default.LEVELS_UPDATED,d.default.BUFFER_CODECS,d.default.MEDIA_DETACHING)||this).autoLevelCapping=Number.POSITIVE_INFINITY,r.firstLevel=null,r.levels=[],r.media=null,r.restrictedLevels=[],r.timer=null,r.clientRect=null,r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n,s,o,a=i.prototype;return a.destroy=function(){this.hls.config.capLevelToPlayerSize&&(this.media=null,this.clientRect=null,this.stopCapping())},a.onFpsDropLevelCapping=function(e){i.isLevelAllowed(e.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(e.droppedLevel)},a.onMediaAttaching=function(e){this.media=e.media instanceof window.HTMLVideoElement?e.media:null},a.onManifestParsed=function(e){var t=this.hls;this.restrictedLevels=[],this.levels=e.levels,this.firstLevel=e.firstLevel,t.config.capLevelToPlayerSize&&e.video&&this.startCapping()},a.onBufferCodecs=function(e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()},a.onLevelsUpdated=function(e){this.levels=e.levels},a.onMediaDetaching=function(){this.stopCapping()},a.detectPlayerSize=function(){if(this.media){var e=this.levels?this.levels.length:0;if(e){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e-1),t.autoLevelCapping>this.autoLevelCapping&&t.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},a.getMaxLevel=function(e){var t=this;if(!this.levels)return-1;var r=this.levels.filter((function(r,n){return i.isLevelAllowed(n,t.restrictedLevels)&&n<=e}));return this.clientRect=null,i.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)},a.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},a.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer),this.timer=null)},a.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,t.width||t.height||(t.width=r.right-r.left||e.width||0,t.height=r.bottom-r.top||e.height||0)}return this.clientRect=t,t},i.isLevelAllowed=function(e,t){return void 0===t&&(t=[]),-1===t.indexOf(e)},i.getMaxLevelByMediaSize=function(e,t,r){if(!e||e&&!e.length)return-1;for(var i,n,s=e.length-1,o=0;o<e.length;o+=1){var a=e[o];if((a.width>=t||a.height>=r)&&(i=a,!(n=e[o+1])||i.width!==n.width||i.height!==n.height)){s=o;break}}return s},n=i,o=[{key:"contentScaleFactor",get:function(){var e=1;try{e=window.devicePixelRatio}catch(e){}return e}}],(s=[{key:"mediaWidth",get:function(){return this.getDimensions().width*i.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*i.contentScaleFactor}}])&&Ze(n.prototype,s),o&&Ze(n,o),i}(g),Je=window.performance,et=function(e){var t,r;function i(t){return e.call(this,t,d.default.MEDIA_ATTACHING)||this}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n=i.prototype;return n.destroy=function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1},n.onMediaAttaching=function(e){var t=this.hls.config;t.capLevelOnFPSDrop&&("function"==typeof(this.video=e.media instanceof window.HTMLVideoElement?e.media:null).getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),t.fpsDroppedMonitoringPeriod))},n.checkFPS=function(e,t,r){var i=Je.now();if(t){if(this.lastTime){var n=i-this.lastTime,s=r-this.lastDroppedFrames,o=t-this.lastDecodedFrames,a=1e3*s/n,c=this.hls;if(c.trigger(d.default.FPS_DROP,{currentDropped:s,currentDecoded:o,totalDroppedFrames:r}),a>0&&s>c.config.fpsDroppedMonitoringThreshold*o){var u=c.currentLevel;f.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(-1===c.autoLevelCapping||c.autoLevelCapping>=u)&&(u-=1,c.trigger(d.default.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:c.currentLevel}),c.autoLevelCapping=u,c.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=t}},n.checkFPSInterval=function(){var e=this.video;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},i}(g),tt=function(){function e(e){e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}var t=e.prototype;return t.destroy=function(){this.abort(),this.loader=null},t.abort=function(){var e=this.loader;e&&4!==e.readyState&&(this.stats.aborted=!0,e.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null},t.load=function(e,t,r){this.context=e,this.config=t,this.callbacks=r,this.stats={trequest:window.performance.now(),retry:0},this.retryDelay=t.retryDelay,this.loadInternal()},t.loadInternal=function(){var e,t=this.context;e=this.loader=new window.XMLHttpRequest;var r=this.stats;r.tfirst=0,r.loaded=0;var i=this.xhrSetup;try{if(i)try{i(e,t.url)}catch(r){e.open("GET",t.url,!0),i(e,t.url)}e.readyState||e.open("GET",t.url,!0)}catch(r){return void this.callbacks.onError({code:e.status,text:r.message},t,e)}t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),e.send()},t.readystatechange=function(e){var t=e.currentTarget,r=t.readyState,i=this.stats,n=this.context,s=this.config;if(!i.aborted&&r>=2)if(window.clearTimeout(this.requestTimeout),0===i.tfirst&&(i.tfirst=Math.max(window.performance.now(),i.trequest)),4===r){var o=t.status;if(o>=200&&o<300){var a,c;i.tload=Math.max(i.tfirst,window.performance.now()),c="arraybuffer"===n.responseType?(a=t.response).byteLength:(a=t.responseText).length,i.loaded=i.total=c;var u={url:t.responseURL,data:a};this.callbacks.onSuccess(u,i,n,t)}else i.retry>=s.maxRetry||o>=400&&o<499?(f.logger.error(o+" while loading "+n.url),this.callbacks.onError({code:o,text:t.statusText},n,t)):(f.logger.warn(o+" while loading "+n.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,s.maxRetryDelay),i.retry++)}else this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),s.timeout)},t.loadtimeout=function(){f.logger.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context,null)},t.loadprogress=function(e){var t=e.currentTarget,r=this.stats;r.loaded=e.loaded,e.lengthComputable&&(r.total=e.total);var i=this.callbacks.onProgress;i&&i(r,this.context,null,t)},e}();function rt(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var it=function(e){var t,r;function i(t){var r;return(r=e.call(this,t,d.default.MANIFEST_LOADING,d.default.MANIFEST_PARSED,d.default.AUDIO_TRACK_LOADED,d.default.AUDIO_TRACK_SWITCHED,d.default.LEVEL_LOADED,d.default.ERROR)||this)._trackId=-1,r._selectDefaultTrack=!0,r.tracks=[],r.trackIdBlacklist=Object.create(null),r.audioGroupId=null,r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n,s,o,a=i.prototype;return a.onManifestLoading=function(){this.tracks=[],this._trackId=-1,this._selectDefaultTrack=!0},a.onManifestParsed=function(e){var t=this.tracks=e.audioTracks||[];this.hls.trigger(d.default.AUDIO_TRACKS_UPDATED,{audioTracks:t}),this._selectAudioGroup(this.hls.nextLoadLevel)},a.onAudioTrackLoaded=function(e){if(e.id>=this.tracks.length)f.logger.warn("Invalid audio track id:",e.id);else{if(f.logger.log("audioTrack "+e.id+" loaded"),this.tracks[e.id].details=e.details,e.details.live&&!this.hasInterval()){var t=1e3*e.details.targetduration;this.setInterval(t)}!e.details.live&&this.hasInterval()&&this.clearInterval()}},a.onAudioTrackSwitched=function(e){var t=this.tracks[e.id].groupId;t&&this.audioGroupId!==t&&(this.audioGroupId=t)},a.onLevelLoaded=function(e){this._selectAudioGroup(e.level)},a.onError=function(e){e.type===u.ErrorTypes.NETWORK_ERROR&&(e.fatal&&this.clearInterval(),e.details===u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR&&(f.logger.warn("Network failure on audio-track id:",e.context.id),this._handleLoadError()))},a._setAudioTrack=function(e){if(this._trackId===e&&this.tracks[this._trackId].details)f.logger.debug("Same id as current audio-track passed, and track details available -> no-op");else if(e<0||e>=this.tracks.length)f.logger.warn("Invalid id passed to audio-track controller");else{var t=this.tracks[e];f.logger.log("Now switching to audio-track index "+e),this.clearInterval(),this._trackId=e;var r=t.url,i=t.type,n=t.id;this.hls.trigger(d.default.AUDIO_TRACK_SWITCHING,{id:n,type:i,url:r}),this._loadTrackDetailsIfNeeded(t)}},a.doTick=function(){this._updateTrack(this._trackId)},a._selectAudioGroup=function(e){var t=this.hls.levels[e];if(t&&t.audioGroupIds){var r=t.audioGroupIds[t.urlId];this.audioGroupId!==r&&(this.audioGroupId=r,this._selectInitialAudioTrack())}},a._selectInitialAudioTrack=function(){var e=this,t=this.tracks;if(t.length){var r=this.tracks[this._trackId],i=null;if(r&&(i=r.name),this._selectDefaultTrack){var n=t.filter((function(e){return e.default}));n.length?t=n:f.logger.warn("No default audio tracks defined")}var s=!1,o=function(){t.forEach((function(t){s||e.audioGroupId&&t.groupId!==e.audioGroupId||i&&i!==t.name||(e._setAudioTrack(t.id),s=!0)}))};o(),s||(i=null,o()),s||(f.logger.error("No track found for running audio group-ID: "+this.audioGroupId),this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))}},a._needsTrackLoading=function(e){var t=e.details,r=e.url;return!(t&&!t.live||!r)},a._loadTrackDetailsIfNeeded=function(e){if(this._needsTrackLoading(e)){var t=e.url,r=e.id;f.logger.log("loading audio-track playlist for id: "+r),this.hls.trigger(d.default.AUDIO_TRACK_LOADING,{url:t,id:r})}},a._updateTrack=function(e){if(!(e<0||e>=this.tracks.length)){this.clearInterval(),this._trackId=e,f.logger.log("trying to update audio-track "+e);var t=this.tracks[e];this._loadTrackDetailsIfNeeded(t)}},a._handleLoadError=function(){this.trackIdBlacklist[this._trackId]=!0;var e=this._trackId,t=this.tracks[e],r=t.name,i=t.language,n=t.groupId;f.logger.warn("Loading failed on audio track id: "+e+", group-id: "+n+', name/language: "'+r+'" / "'+i+'"');for(var s=e,o=0;o<this.tracks.length;o++)if(!this.trackIdBlacklist[o]&&this.tracks[o].name===r){s=o;break}s!==e?(f.logger.log("Attempting audio-track fallback id:",s,"group-id:",this.tracks[s].groupId),this._setAudioTrack(s)):f.logger.warn('No fallback audio-track found for name/language: "'+r+'" / "'+i+'"')},n=i,(s=[{key:"audioTracks",get:function(){return this.tracks}},{key:"audioTrack",get:function(){return this._trackId},set:function(e){this._setAudioTrack(e),this._selectDefaultTrack=!1}}])&&rt(n.prototype,s),o&&rt(n,o),i}(be);function nt(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var st=window.performance,ot=function(e){var t,r;function i(t,r){var i;return(i=e.call(this,t,d.default.MEDIA_ATTACHED,d.default.MEDIA_DETACHING,d.default.AUDIO_TRACKS_UPDATED,d.default.AUDIO_TRACK_SWITCHING,d.default.AUDIO_TRACK_LOADED,d.default.KEY_LOADED,d.default.FRAG_LOADED,d.default.FRAG_PARSING_INIT_SEGMENT,d.default.FRAG_PARSING_DATA,d.default.FRAG_PARSED,d.default.ERROR,d.default.BUFFER_RESET,d.default.BUFFER_CREATED,d.default.BUFFER_APPENDED,d.default.BUFFER_FLUSHED,d.default.INIT_PTS_FOUND)||this).fragmentTracker=r,i.config=t.config,i.audioCodecSwap=!1,i._state=ve,i.initPTS=[],i.waitingFragment=null,i.videoTrackCC=null,i.waitingVideoCC=null,i}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n,s,o,a=i.prototype;return a.onInitPtsFound=function(e){var t=e.id,r=e.frag.cc,i=e.initPTS;"main"===t&&(this.initPTS[r]=i,this.videoTrackCC=r,f.logger.log("InitPTS for cc: "+r+" found from main: "+i),this.state===je&&this.tick())},a.startLoad=function(e){if(this.tracks){var t=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,t>0&&-1===e?(f.logger.log("audio:override startPosition with lastCurrentTime @"+t.toFixed(3)),this.state=_e):(this.lastCurrentTime=this.startPosition?this.startPosition:e,this.state=we),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else this.startPosition=e,this.state=ve},a.doTick=function(){var e,t,r,i=this.hls,n=i.config;switch(this.state){case Ce:case Ee:case Pe:break;case we:this.state=ke,this.loadedmetadata=!1;break;case _e:var s=this.tracks;if(!s)break;if(!this.media&&(this.startFragRequested||!n.startFragPrefetch))break;if(this.loadedmetadata)e=this.media.currentTime;else if(void 0===(e=this.nextLoadPosition))break;var o=this.mediaBuffer?this.mediaBuffer:this.media,a=this.videoBuffer?this.videoBuffer:this.media,c=e<n.maxBufferHole?Math.max(2,n.maxBufferHole):n.maxBufferHole,u=$.bufferInfo(o,e,c),h=$.bufferInfo(a,e,c),p=u.len,g=u.end,y=this.fragPrevious,m=Math.min(n.maxBufferLength,n.maxMaxBufferLength),b=Math.max(m,h.len),v=this.audioSwitch,w=this.trackId;if((p<b||v)&&w<s.length){if(void 0===(r=s[w].details)){this.state=ke;break}if(!v&&this._streamEnded(u,r))return this.hls.trigger(d.default.BUFFER_EOS,{type:"audio"}),void(this.state=Oe);var _,E=r.fragments,S=E.length,T=E[0].start,A=E[S-1].start+E[S-1].duration;if(v)if(r.live&&!r.PTSKnown)f.logger.log("switching audiotrack, live stream, unknown PTS,load first fragment"),g=0;else if(g=e,r.PTSKnown&&e<T){if(!(u.end>T||u.nextStart))return;f.logger.log("alt audio track ahead of main track, seek to start of alt audio track"),this.media.currentTime=T+.05}if(r.initSegment&&!r.initSegment.data)_=r.initSegment;else if(g<=T){if(_=E[0],null!==this.videoTrackCC&&_.cc!==this.videoTrackCC&&(_=function(e,t){return H.search(e,(function(e){return e.cc<t?1:e.cc>t?-1:0}))}(E,this.videoTrackCC)),r.live&&_.loadIdx&&_.loadIdx===this.fragLoadIdx){var k=u.nextStart?u.nextStart:T;return f.logger.log("no alt audio available @currentTime:"+this.media.currentTime+", seeking @"+(k+.05)),void(this.media.currentTime=k+.05)}}else{var I,R=n.maxFragLookUpTolerance,P=y?E[y.sn-E[0].sn+1]:void 0;g<A?(g>A-R&&(R=0),I=P&&!pe(g,R,P)?P:H.search(E,(function(e){return pe(g,R,e)}))):I=E[S-1],I&&(_=I,T=I.start,y&&_.level===y.level&&_.sn===y.sn&&(_.sn<r.endSN?(_=E[_.sn+1-r.startSN],this.fragmentTracker.getState(_)!==q&&f.logger.log("SN just loaded, load next one: "+_.sn)):_=null))}_&&(_.encrypted?(f.logger.log("Loading key for "+_.sn+" of ["+r.startSN+" ,"+r.endSN+"],track "+w),this.state=Se,i.trigger(d.default.KEY_LOADING,{frag:_})):(this.fragCurrent=_,(v||this.fragmentTracker.getState(_)===K)&&(f.logger.log("Loading "+_.sn+", cc: "+_.cc+" of ["+r.startSN+" ,"+r.endSN+"],track "+w+", "+(this.loadedmetadata?"currentTime":"nextLoadPosition")+": "+e+", bufferEnd: "+g.toFixed(3)),"initSegment"!==_.sn&&(this.startFragRequested=!0),Object(l.isFiniteNumber)(_.sn)&&(this.nextLoadPosition=_.start+_.duration),i.trigger(d.default.FRAG_LOADING,{frag:_}),this.state=Te)))}break;case ke:(t=this.tracks[this.trackId])&&t.details&&(this.state=_e);break;case Ae:var O=st.now(),C=this.retryDate,j=(o=this.media)&&o.seeking;(!C||O>=C||j)&&(f.logger.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=_e);break;case je:var D=this.waitingFragment;if(D){var M=D.frag.cc;if(void 0!==this.initPTS[M])this.waitingFragment=null,this.state=Te,this.onFragLoaded(D);else if(this.videoTrackCC!==this.waitingVideoCC)f.logger.log("Waiting fragment cc ("+M+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var x=$.bufferInfo(this.mediaBuffer,this.media.currentTime,n.maxBufferHole);pe(x.end,n.maxFragLookUpTolerance,D.frag)<0&&(f.logger.log("Waiting fragment cc ("+M+") @ "+D.frag.start+" cancelled because another fragment at "+x.end+" is needed"),this.clearWaitingFragment())}}else this.state=_e}},a.clearWaitingFragment=function(){var e=this.waitingFragment;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingFragment=null,this.waitingVideoCC=null,this.state=_e)},a.onMediaAttached=function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended);var r=this.config;this.tracks&&r.autoStartLoad&&this.startLoad(r.startPosition)},a.onMediaDetaching=function(){var e=this.media;e&&e.ended&&(f.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onAudioTracksUpdated=function(e){f.logger.log("audio tracks updated"),this.tracks=e.audioTracks},a.onAudioTrackSwitching=function(e){var t=!!e.url;this.trackId=e.id,this.fragCurrent=null,this.clearWaitingFragment(),this.state=Ee,t?this.setInterval(100):this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),t&&(this.audioSwitch=!0,this.state=_e),this.tick()},a.onAudioTrackLoaded=function(e){var t=e.details,r=e.id,i=this.tracks[r],n=i.details,s=t.totalduration,o=0;if(f.logger.log("track "+r+" loaded ["+t.startSN+","+t.endSN+"],duration:"+s),t.live||n&&n.live?n&&t.fragments.length>0?(oe(n,t),o=t.fragments[0].start,t.PTSKnown?f.logger.log("live audio playlist sliding:"+o.toFixed(3)):f.logger.log("live audio playlist - outdated PTS, unknown sliding")):(t.PTSKnown=!1,f.logger.log("live audio playlist - first load, unknown sliding")):t.PTSKnown=!1,i.details=t,!this.startFragRequested){if(-1===this.startPosition){var a=t.startTimeOffset;Object(l.isFiniteNumber)(a)?(f.logger.log("start time offset found in playlist, adjust startPosition to "+a),this.startPosition=a):t.live?(this.startPosition=this.computeLivePosition(o,t),f.logger.log("compute startPosition for audio-track to "+this.startPosition)):this.startPosition=0}this.nextLoadPosition=this.startPosition}this.state===ke&&(this.state=_e),this.tick()},a.onKeyLoaded=function(){this.state===Se&&(this.state=_e,this.tick())},a.onFragLoaded=function(e){var t=this.fragCurrent,r=e.frag;if(this.state===Te&&t&&"audio"===r.type&&r.level===t.level&&r.sn===t.sn){var i=this.tracks[this.trackId],n=i.details,s=n.totalduration,o=t.level,a=t.sn,c=t.cc,u=this.config.defaultAudioCodec||i.audioCodec||"mp4a.40.2",l=this.stats=e.stats;if("initSegment"===a)this.state=_e,l.tparsed=l.tbuffered=st.now(),n.initSegment.data=e.payload,this.hls.trigger(d.default.FRAG_BUFFERED,{stats:l,frag:t,id:"audio"}),this.tick();else{this.state=Ie,this.appended=!1,this.demuxer||(this.demuxer=new re(this.hls,"audio"));var h=this.initPTS[c],p=n.initSegment?n.initSegment.data:[];void 0!==h?(this.pendingBuffering=!0,f.logger.log("Demuxing "+a+" of ["+n.startSN+" ,"+n.endSN+"],track "+o),this.demuxer.push(e.payload,p,u,null,t,s,!1,h)):(f.logger.log("Unknown video PTS for cc "+c+", waiting for video PTS before demuxing audio frag "+a+" of ["+n.startSN+" ,"+n.endSN+"],track "+o),this.waitingFragment=e,this.waitingVideoCC=this.videoTrackCC,this.state=je)}}this.fragLoadError=0},a.onFragParsingInitSegment=function(e){var t=this.fragCurrent,r=e.frag;if(t&&"audio"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===Ie){var i,n=e.tracks;if(n.video&&delete n.video,i=n.audio){i.levelCodec=i.codec,i.id=e.id,this.hls.trigger(d.default.BUFFER_CODECS,n),f.logger.log("audio track:audio,container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var s=i.initSegment;if(s){var o={type:"audio",data:s,parent:"audio",content:"initSegment"};this.audioSwitch?this.pendingData=[o]:(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(d.default.BUFFER_APPENDING,o))}this.tick()}}},a.onFragParsingData=function(e){var t=this,r=this.fragCurrent,i=e.frag;if(r&&"audio"===e.id&&"audio"===e.type&&i.sn===r.sn&&i.level===r.level&&this.state===Ie){var n=this.trackId,s=this.tracks[n],o=this.hls;Object(l.isFiniteNumber)(e.endPTS)||(e.endPTS=e.startPTS+r.duration,e.endDTS=e.startDTS+r.duration),r.addElementaryStream(b.AUDIO),f.logger.log("parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb),se(s.details,r,e.startPTS,e.endPTS);var a=this.media,c=!1;if(this.audioSwitch)if(a&&a.readyState){var h=a.currentTime;f.logger.log("switching audio track : currentTime:"+h),h>=e.startPTS&&(f.logger.log("switching audio track : flushing all audio"),this.state=Pe,o.trigger(d.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),c=!0,this.audioSwitch=!1,o.trigger(d.default.AUDIO_TRACK_SWITCHED,{id:n}))}else this.audioSwitch=!1,o.trigger(d.default.AUDIO_TRACK_SWITCHED,{id:n});var p=this.pendingData;if(!p)return f.logger.warn("Apparently attempt to enqueue media payload without codec initialization data upfront"),void o.trigger(d.default.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:null,fatal:!0});this.audioSwitch||([e.data1,e.data2].forEach((function(t){t&&t.length&&p.push({type:e.type,data:t,parent:"audio",content:"data"})})),!c&&p.length&&(p.forEach((function(e){t.state===Ie&&(t.pendingBuffering=!0,t.hls.trigger(d.default.BUFFER_APPENDING,e))})),this.pendingData=[],this.appended=!0)),this.tick()}},a.onFragParsed=function(e){var t=this.fragCurrent,r=e.frag;t&&"audio"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===Ie&&(this.stats.tparsed=st.now(),this.state=Re,this._checkAppendedParsed())},a.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},a.onBufferCreated=function(e){var t=e.tracks.audio;t&&(this.mediaBuffer=t.buffer,this.loadedmetadata=!0),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer)},a.onBufferAppended=function(e){if("audio"===e.parent){var t=this.state;t!==Ie&&t!==Re||(this.pendingBuffering=e.pending>0,this._checkAppendedParsed())}},a._checkAppendedParsed=function(){if(!(this.state!==Re||this.appended&&this.pendingBuffering)){var e=this.fragCurrent,t=this.stats,r=this.hls;if(e){this.fragPrevious=e,t.tbuffered=st.now(),r.trigger(d.default.FRAG_BUFFERED,{stats:t,frag:e,id:"audio"});var i=this.mediaBuffer?this.mediaBuffer:this.media;i&&f.logger.log("audio buffered : "+ue.toString(i.buffered)),this.audioSwitch&&this.appended&&(this.audioSwitch=!1,r.trigger(d.default.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.state=_e}this.tick()}},a.onError=function(e){var t=e.frag;if(!t||"audio"===t.type)switch(e.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:var r=e.frag;if(r&&"audio"!==r.type)break;if(!e.fatal){var i=this.fragLoadError;i?i++:i=1;var n=this.config;if(i<=n.fragLoadingMaxRetry){this.fragLoadError=i;var s=Math.min(Math.pow(2,i-1)*n.fragLoadingRetryDelay,n.fragLoadingMaxRetryTimeout);f.logger.warn("AudioStreamController: frag loading failed, retry in "+s+" ms"),this.retryDate=st.now()+s,this.state=Ae}else f.logger.error("AudioStreamController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.state=Ce}break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==Ce&&(this.state=e.fatal?Ce:_e,f.logger.warn("AudioStreamController: "+e.details+" while loading frag, now switching to "+this.state+" state ..."));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===e.parent&&(this.state===Ie||this.state===Re)){var o=this.mediaBuffer,a=this.media.currentTime;if(o&&$.isBuffered(o,a)&&$.isBuffered(o,a+.5)){var c=this.config;c.maxMaxBufferLength>=c.maxBufferLength&&(c.maxMaxBufferLength/=2,f.logger.warn("AudioStreamController: reduce max buffer length to "+c.maxMaxBufferLength+"s")),this.state=_e}else f.logger.warn("AudioStreamController: buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,this.state=Pe,this.hls.trigger(d.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"})}}},a.onBufferFlushed=function(){var e=this,t=this.pendingData;t&&t.length?(f.logger.log("AudioStreamController: appending pending audio data after buffer flushed"),t.forEach((function(t){e.hls.trigger(d.default.BUFFER_APPENDING,t)})),this.appended=!0,this.pendingData=[],this.state=Re):(this.state=_e,this.fragPrevious=null,this.tick())},n=i,(s=[{key:"state",set:function(e){if(this.state!==e){var t=this.state;this._state=e,f.logger.log("audio stream:"+t+"->"+e)}},get:function(){return this._state}}])&&nt(n.prototype,s),o&&nt(n,o),i}(Me),at=function(){if("undefined"!=typeof window&&window.VTTCue)return window.VTTCue;var e={"":!0,lr:!0,rl:!0},t={start:!0,middle:!0,end:!0,left:!0,right:!0};function r(e){return"string"==typeof e&&!!t[e.toLowerCase()]&&e.toLowerCase()}function i(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)e[i]=r[i]}return e}function n(t,n,s){var o=this,a={enumerable:!0};o.hasBeenReset=!1;var c="",u=!1,l=t,d=n,f=s,h=null,p="",g=!0,y="auto",m="start",b=50,v="middle",w=50,_="middle";Object.defineProperty(o,"id",i({},a,{get:function(){return c},set:function(e){c=""+e}})),Object.defineProperty(o,"pauseOnExit",i({},a,{get:function(){return u},set:function(e){u=!!e}})),Object.defineProperty(o,"startTime",i({},a,{get:function(){return l},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");l=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",i({},a,{get:function(){return d},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");d=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",i({},a,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",i({},a,{get:function(){return h},set:function(e){h=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",i({},a,{get:function(){return p},set:function(t){var r=function(t){return"string"==typeof t&&!!e[t.toLowerCase()]&&t.toLowerCase()}(t);if(!1===r)throw new SyntaxError("An invalid or illegal string was specified.");p=r,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",i({},a,{get:function(){return g},set:function(e){g=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",i({},a,{get:function(){return y},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",i({},a,{get:function(){return m},set:function(e){var t=r(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");m=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",i({},a,{get:function(){return b},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",i({},a,{get:function(){return v},set:function(e){var t=r(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");v=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",i({},a,{get:function(){return w},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");w=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",i({},a,{get:function(){return _},set:function(e){var t=r(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");_=t,this.hasBeenReset=!0}})),o.displayState=void 0}return n.prototype.getCueAsHTML=function(){return window.WebVTT.convertCueToDOMTree(window,this.text)},n}(),ct=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}};function ut(){this.window=window,this.state="INITIAL",this.buffer="",this.decoder=new ct,this.regionList=[]}function lt(){this.values=Object.create(null)}function dt(e,t,r,i){var n=i?e.split(i):[e];for(var s in n)if("string"==typeof n[s]){var o=n[s].split(r);2===o.length&&t(o[0],o[1])}}lt.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,r){return r?this.has(e)?this.values[e]:t[r]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,r){for(var i=0;i<r.length;++i)if(t===r[i]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var ft=new at(0,0,0),ht="middle"===ft.align?"middle":"center";function pt(e,t,r){var i=e;function n(){var t=function(e){function t(e,t,r,i){return 3600*(0|e)+60*(0|t)+(0|r)+(0|i)/1e3}var r=e.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return r?r[3]?t(r[1],r[2],r[3].replace(":",""),r[4]):r[1]>59?t(r[1],r[2],0,r[4]):t(0,r[1],r[2],r[4]):null}(e);if(null===t)throw new Error("Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function s(){e=e.replace(/^\s+/,"")}if(s(),t.startTime=n(),s(),"--\x3e"!==e.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.substr(3),s(),t.endTime=n(),s(),function(e,t){var i=new lt;dt(e,(function(e,t){switch(e){case"region":for(var n=r.length-1;n>=0;n--)if(r[n].id===t){i.set(e,r[n].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":var s=t.split(","),o=s[0];i.integer(e,o),i.percent(e,o)&&i.set("snapToLines",!1),i.alt(e,o,["auto"]),2===s.length&&i.alt("lineAlign",s[1],["start",ht,"end"]);break;case"position":s=t.split(","),i.percent(e,s[0]),2===s.length&&i.alt("positionAlign",s[1],["start",ht,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",ht,"end","left","right"])}}),/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");var n=i.get("line","auto");"auto"===n&&-1===ft.line&&(n=-1),t.line=n,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",ht);var s=i.get("position","auto");"auto"===s&&50===ft.position&&(s="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=s}(e,t)}function gt(e){return e.replace(/<br(?: \/)?>/gi,"\n")}ut.prototype={parse:function(e){var t=this;function r(){var e=t.buffer,r=0;for(e=gt(e);r<e.length&&"\r"!==e[r]&&"\n"!==e[r];)++r;var i=e.substr(0,r);return"\r"===e[r]&&++r,"\n"===e[r]&&++r,t.buffer=e.substr(r),i}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var i;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var n=(i=r()).match(/^()?WEBVTT([ \t].*)?$/);if(!n||!n[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var s=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(s?s=!1:i=r(),t.state){case"HEADER":/:/.test(i)?dt(i,(function(e,t){}),/:/):i||(t.state="ID");continue;case"NOTE":i||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){t.state="NOTE";break}if(!i)continue;if(t.cue=new at(0,0,""),t.state="CUE",-1===i.indexOf("--\x3e")){t.cue.id=i;continue}case"CUE":try{pt(i,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var o=-1!==i.indexOf("--\x3e");if(!i||o&&(s=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=i;continue;case"BADCUE":i||(t.state="ID");continue}}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),(e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new Error("Malformed WebVTT signature.")}catch(e){throw e}return e.onflush&&e.onflush(),this}};var yt=ut;function mt(e,t,r,i){for(var n,s,o,a,c,u=[],l=window.VTTCue||TextTrackCue,d=0;d<i.rows.length;d++)if(o=!0,a=0,c="",!(n=i.rows[d]).isEmpty()){for(var f=0;f<n.chars.length;f++)n.chars[f].uchar.match(/\s/)&&o?a++:(c+=n.chars[f].uchar,o=!1);n.cueStartTime=t,t===r&&(r+=1e-4),s=new l(t,r,gt(c.trim())),a>=16?a--:a++,navigator.userAgent.match(/Firefox\//)?s.line=d+1:s.line=d>7?d-2:d+1,s.align="left",s.position=Math.max(0,Math.min(100,a/32*100)),u.push(s),e&&e.addCue(s)}return u}var bt,vt,wt={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},_t=function(e){var t=e;return wt.hasOwnProperty(e)&&(t=wt[e]),String.fromCharCode(t)},Et=15,St=100,Tt={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},At={17:2,18:4,21:6,22:8,23:10,19:13,20:15},kt={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},It={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Rt=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];(vt=bt||(bt={}))[vt.ERROR=0]="ERROR",vt[vt.TEXT=1]="TEXT",vt[vt.WARNING=2]="WARNING",vt[vt.INFO=2]="INFO",vt[vt.DEBUG=3]="DEBUG",vt[vt.DATA=3]="DATA";var Pt=function(){function e(){this.time=null,this.verboseLevel=bt.ERROR}return e.prototype.log=function(e,t){this.verboseLevel>=e&&f.logger.log(this.time+" ["+e+"] "+t)},e}(),Ot=function(e){for(var t=[],r=0;r<e.length;r++)t.push(e[r].toString(16));return t},Ct=function(){function e(e,t,r,i,n){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=r||!1,this.background=i||"black",this.flash=n||!1}var t=e.prototype;return t.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},t.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],r=0;r<t.length;r++){var i=t[r];e.hasOwnProperty(i)&&(this[i]=e[i])}},t.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},t.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},t.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},t.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},e}(),jt=function(){function e(e,t,r,i,n,s){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new Ct(t,r,i,n,s)}var t=e.prototype;return t.reset=function(){this.uchar=" ",this.penState.reset()},t.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},t.setPenState=function(e){this.penState.copy(e)},t.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},t.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},t.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},e}(),Dt=function(){function e(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var t=0;t<St;t++)this.chars.push(new jt);this.logger=e,this.pos=0,this.currPenState=new Ct}var t=e.prototype;return t.equals=function(e){for(var t=!0,r=0;r<St;r++)if(!this.chars[r].equals(e.chars[r])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<St;t++)this.chars[t].copy(e.chars[t])},t.isEmpty=function(){for(var e=!0,t=0;t<St;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},t.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(bt.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>St&&(this.logger.log(bt.DEBUG,"Too large cursor position "+this.pos),this.pos=St)},t.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var r=this.pos+1;r<t+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(t)},t.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},t.insertChar=function(e){e>=144&&this.backSpace();var t=_t(e);this.pos>=St?this.logger.log(bt.ERROR,"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},t.clearFromPos=function(e){var t;for(t=e;t<St;t++)this.chars[t].reset()},t.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},t.clearToEndOfRow=function(){this.clearFromPos(this.pos)},t.getTextString=function(){for(var e=[],t=!0,r=0;r<St;r++){var i=this.chars[r].uchar;" "!==i&&(t=!1),e.push(i)}return t?"":e.join("")},t.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},e}(),Mt=function(){function e(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var t=0;t<Et;t++)this.rows.push(new Dt(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var t=e.prototype;return t.reset=function(){for(var e=0;e<Et;e++)this.rows[e].clear();this.currRow=14},t.equals=function(e){for(var t=!0,r=0;r<Et;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<Et;t++)this.rows[t].copy(e.rows[t])},t.isEmpty=function(){for(var e=!0,t=0;t<Et;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},t.backSpace=function(){this.rows[this.currRow].backSpace()},t.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},t.insertChar=function(e){this.rows[this.currRow].insertChar(e)},t.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},t.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},t.setCursor=function(e){this.logger.log(bt.INFO,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},t.setPAC=function(e){this.logger.log(bt.INFO,"pacData = "+JSON.stringify(e));var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var r=0;r<Et;r++)this.rows[r].clear();var i=this.currRow+1-this.nrRollUpRows,n=this.lastOutputScreen;if(n){var s=n.rows[i].cueStartTime,o=this.logger.time;if(s&&null!==o&&s<o)for(var a=0;a<this.nrRollUpRows;a++)this.rows[t-this.nrRollUpRows+a+1].copy(n.rows[i+a])}}this.currRow=t;var c=this.rows[this.currRow];if(null!==e.indent){var u=e.indent,l=Math.max(u-1,0);c.setCursor(e.indent),e.color=c.chars[l].penState.foreground}var d={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(d)},t.setBkgData=function(e){this.logger.log(bt.INFO,"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},t.setRollUpRows=function(e){this.nrRollUpRows=e},t.rollUp=function(){if(null!==this.nrRollUpRows){this.logger.log(bt.TEXT,this.getDisplayText());var e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(bt.INFO,"Rolling up")}else this.logger.log(bt.DEBUG,"roll_up but nrRollUpRows not set yet")},t.getDisplayText=function(e){e=e||!1;for(var t=[],r="",i=-1,n=0;n<Et;n++){var s=this.rows[n].getTextString();s&&(i=n+1,e?t.push("Row "+i+": '"+s+"'"):t.push(s.trim()))}return t.length>0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r},t.getTextAndFormat=function(){return this.rows},e}(),xt=function(){function e(e,t,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Mt(r),this.nonDisplayedMemory=new Mt(r),this.lastOutputScreen=new Mt(r),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}var t=e.prototype;return t.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},t.getHandler=function(){return this.outputFilter},t.setHandler=function(e){this.outputFilter=e},t.setPAC=function(e){this.writeScreen.setPAC(e)},t.setBkgData=function(e){this.writeScreen.setBkgData(e)},t.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(bt.INFO,"MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},t.insertChars=function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(bt.INFO,r+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(bt.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},t.ccRCL=function(){this.logger.log(bt.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},t.ccBS=function(){this.logger.log(bt.INFO,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},t.ccAOF=function(){},t.ccAON=function(){},t.ccDER=function(){this.logger.log(bt.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},t.ccRU=function(e){this.logger.log(bt.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},t.ccFON=function(){this.logger.log(bt.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},t.ccRDC=function(){this.logger.log(bt.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},t.ccTR=function(){this.logger.log(bt.INFO,"TR"),this.setMode("MODE_TEXT")},t.ccRTD=function(){this.logger.log(bt.INFO,"RTD"),this.setMode("MODE_TEXT")},t.ccEDM=function(){this.logger.log(bt.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},t.ccCR=function(){this.logger.log(bt.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},t.ccENM=function(){this.logger.log(bt.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},t.ccEOC=function(){if(this.logger.log(bt.INFO,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(bt.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},t.ccTO=function(e){this.logger.log(bt.INFO,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},t.ccMIDROW=function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var r=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][r]}this.logger.log(bt.INFO,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},t.outputDataUpdate=function(e){void 0===e&&(e=!1);var t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},t.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},e}();function Bt(e,t,r){r.a=e,r.b=t}function Lt(e,t,r){return r.a===e&&r.b===t}var Nt=function(){function e(e,t,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var i=new Pt;this.channels=[null,new xt(e,t,i),new xt(e+1,r,i)],this.cmdHistory={a:null,b:null},this.logger=i}var t=e.prototype;return t.getHandler=function(e){return this.channels[e].getHandler()},t.setHandler=function(e,t){this.channels[e].setHandler(t)},t.addData=function(e,t){var r,i,n,s=!1;this.logger.time=e;for(var o=0;o<t.length;o+=2)if(i=127&t[o],n=127&t[o+1],0!==i||0!==n){if(this.logger.log(bt.DATA,"["+Ot([t[o],t[o+1]])+"] -> ("+Ot([i,n])+")"),(r=this.parseCmd(i,n))||(r=this.parseMidrow(i,n)),r||(r=this.parsePAC(i,n)),r||(r=this.parseBackgroundAttributes(i,n)),!r&&(s=this.parseChars(i,n))){var a=this.currentChannel;a&&a>0?this.channels[a].insertChars(s):this.logger.log(bt.WARNING,"No channel found yet. TEXT-MODE?")}r||s||this.logger.log(bt.WARNING,"Couldn't parse cleaned data "+Ot([i,n])+" orig: "+Ot([t[o],t[o+1]]))}},t.parseCmd=function(e,t){var r=this.cmdHistory;if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;if(Lt(e,t,r))return Bt(null,null,r),this.logger.log(bt.DEBUG,"Repeated command ("+Ot([e,t])+") is dropped"),!0;var i=20===e||21===e||23===e?1:2,n=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?n.ccRCL():33===t?n.ccBS():34===t?n.ccAOF():35===t?n.ccAON():36===t?n.ccDER():37===t?n.ccRU(2):38===t?n.ccRU(3):39===t?n.ccRU(4):40===t?n.ccFON():41===t?n.ccRDC():42===t?n.ccTR():43===t?n.ccRTD():44===t?n.ccEDM():45===t?n.ccCR():46===t?n.ccENM():47===t&&n.ccEOC():n.ccTO(t-32),Bt(e,t,r),this.currentChannel=i,!0},t.parseMidrow=function(e,t){var r=0;if((17===e||25===e)&&t>=32&&t<=47){if((r=17===e?1:2)!==this.currentChannel)return this.logger.log(bt.ERROR,"Mismatch channel in midrow parsing"),!1;var i=this.channels[r];return!!i&&(i.ccMIDROW(t),this.logger.log(bt.DEBUG,"MIDROW ("+Ot([e,t])+")"),!0)}return!1},t.parsePAC=function(e,t){var r,i=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(16===e||24===e)&&t>=64&&t<=95))return!1;if(Lt(e,t,i))return Bt(null,null,i),!0;var n=e<=23?1:2;r=t>=64&&t<=95?1===n?Tt[e]:kt[e]:1===n?At[e]:It[e];var s=this.channels[n];return!!s&&(s.setPAC(this.interpretPAC(r,t)),Bt(e,t,i),this.currentChannel=n,!0)},t.interpretPAC=function(e,t){var r=t,i={color:null,italics:!1,indent:null,underline:!1,row:e};return r=t>95?t-96:t-64,i.underline=1==(1&r),r<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((r-16)/2),i},t.parseChars=function(e,t){var r,i=null,n=null;if(e>=25?(r=2,n=e-8):(r=1,n=e),n>=17&&n<=19){var s=t;s=17===n?t+80:18===n?t+112:t+144,this.logger.log(bt.INFO,"Special char '"+_t(s)+"' in channel "+r),i=[s]}else e>=32&&e<=127&&(i=0===t?[e]:[e,t]);if(i){var o=Ot(i);this.logger.log(bt.DEBUG,"Char codes = "+o.join(",")),Bt(e,t,this.cmdHistory)}return i},t.parseBackgroundAttributes=function(e,t){var r;if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;var i={};16===e||24===e?(r=Math.floor((t-32)/2),i.background=Rt[r],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0));var n=e<=23?1:2;return this.channels[n].setBkgData(i),Bt(e,t,this.cmdHistory),!0},t.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var t=this.channels[e];t&&t.reset()}this.cmdHistory={a:null,b:null}},t.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++){var r=this.channels[t];r&&r.cueSplitAtTime(e)}},e}(),Ut=function(){function e(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}var t=e.prototype;return t.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},t.newCue=function(e,t,r){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)},t.reset=function(){this.cueRanges=[]},e}(),Ft=function(e,t,r){return e.substr(r||0,t.length)===t},Kt=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return(t>>>0).toString()},zt={parse:function(e,t,r,i,n,s){var o,a=Object(Fe.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n"),c="00:00.000",u=0,d=0,f=0,h=[],p=!0,g=!1,y=new yt;y.oncue=function(e){var t=r[i],n=r.ccOffset;t&&t.new&&(void 0!==d?n=r.ccOffset=t.start:function(e,t,r){var i=e[t],n=e[i.prevCC];if(!n||!n.new&&i.new)return e.ccOffset=e.presentationOffset=i.start,void(i.new=!1);for(;n&&n.new;)e.ccOffset+=i.start-n.start,i.new=!1,n=e[(i=n).prevCC];e.presentationOffset=r}(r,i,f)),f&&(n=f-r.presentationOffset),g&&(e.startTime+=n-d,e.endTime+=n-d),e.id=Kt(e.startTime.toString())+Kt(e.endTime.toString())+Kt(e.text),e.text=decodeURIComponent(encodeURIComponent(e.text)),e.endTime>0&&h.push(e)},y.onparsingerror=function(e){o=e},y.onflush=function(){o&&s?s(o):n(h)},a.forEach((function(e){if(p){if(Ft(e,"X-TIMESTAMP-MAP=")){p=!1,g=!0,e.substr(16).split(",").forEach((function(e){Ft(e,"LOCAL:")?c=e.substr(6):Ft(e,"MPEGTS:")&&(u=parseInt(e.substr(7)))}));try{t+(9e4*r[i].start||0)<0&&(t+=8589934592),u-=t,d=function(e){var t=parseInt(e.substr(-3)),r=parseInt(e.substr(-6,2)),i=parseInt(e.substr(-9,2)),n=e.length>9?parseInt(e.substr(0,e.indexOf(":"))):0;if(!(Object(l.isFiniteNumber)(t)&&Object(l.isFiniteNumber)(r)&&Object(l.isFiniteNumber)(i)&&Object(l.isFiniteNumber)(n)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*r,(t+=6e4*i)+36e5*n}(c)/1e3,f=u/9e4}catch(e){g=!1,o=e}return}""===e&&(p=!1)}y.parse(e+"\n")})),y.flush()}};function Vt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qt(e,t){return e&&e.label===t.name&&!(e.textTrack1||e.textTrack2)}var Gt=function(e){var t,r;function i(t){var r;if((r=e.call(this,t,d.default.MEDIA_ATTACHING,d.default.MEDIA_DETACHING,d.default.FRAG_PARSING_USERDATA,d.default.FRAG_DECRYPTED,d.default.MANIFEST_LOADING,d.default.MANIFEST_LOADED,d.default.FRAG_LOADED,d.default.INIT_PTS_FOUND)||this).media=null,r.config=void 0,r.enabled=!0,r.Cues=void 0,r.textTracks=[],r.tracks=[],r.initPTS=[],r.unparsedVttFrags=[],r.captionsTracks={},r.nonNativeCaptionsTracks={},r.captionsProperties=void 0,r.cea608Parser1=void 0,r.cea608Parser2=void 0,r.lastSn=-1,r.prevCC=-1,r.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},r.hls=t,r.config=t.config,r.Cues=t.config.cueHandler,r.captionsProperties={textTrack1:{label:r.config.captionsTextTrack1Label,languageCode:r.config.captionsTextTrack1LanguageCode},textTrack2:{label:r.config.captionsTextTrack2Label,languageCode:r.config.captionsTextTrack2LanguageCode},textTrack3:{label:r.config.captionsTextTrack3Label,languageCode:r.config.captionsTextTrack3LanguageCode},textTrack4:{label:r.config.captionsTextTrack4Label,languageCode:r.config.captionsTextTrack4LanguageCode}},r.config.enableCEA708Captions){var i=new Ut(Vt(r),"textTrack1"),n=new Ut(Vt(r),"textTrack2"),s=new Ut(Vt(r),"textTrack3"),o=new Ut(Vt(r),"textTrack4");r.cea608Parser1=new Nt(1,i,n),r.cea608Parser2=new Nt(3,s,o)}return r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n=i.prototype;return n.addCues=function(e,t,r,i,n){for(var s,o,a,c,u=!1,l=n.length;l--;){var f=n[l],h=(s=f[0],o=f[1],a=t,c=r,Math.min(o,c)-Math.max(s,a));if(h>=0&&(f[0]=Math.min(f[0],t),f[1]=Math.max(f[1],r),u=!0,h/(r-t)>.5))return}if(u||n.push([t,r]),this.config.renderTextTracksNatively)this.Cues.newCue(this.captionsTracks[e],t,r,i);else{var p=this.Cues.newCue(null,t,r,i);this.hls.trigger(d.default.CUES_PARSED,{type:"captions",cues:p,track:e})}},n.onInitPtsFound=function(e){var t=this,r=e.frag,i=e.id,n=e.initPTS,s=this.unparsedVttFrags;"main"===i&&(this.initPTS[r.cc]=n),s.length&&(this.unparsedVttFrags=[],s.forEach((function(e){t.onFragLoaded(e)})))},n.getExistingTrack=function(e){var t=this.media;if(t)for(var r=0;r<t.textTracks.length;r++){var i=t.textTracks[r];if(i[e])return i}return null},n.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},n.createNativeTrack=function(e){if(!this.captionsTracks[e]){var t=this.captionsProperties,r=this.captionsTracks,i=this.media,n=t[e],s=n.label,o=n.languageCode,a=this.getExistingTrack(e);if(a)r[e]=a,ze(r[e]),Ke(r[e],i);else{var c=this.createTextTrack("captions",s,o);c&&(c[e]=!0,r[e]=c)}}},n.createNonNativeTrack=function(e){if(!this.nonNativeCaptionsTracks[e]){var t=this.captionsProperties[e];if(t){var r={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(d.default.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}}},n.createTextTrack=function(e,t,r){var i=this.media;if(i)return i.addTextTrack(e,t,r)},n.destroy=function(){e.prototype.destroy.call(this)},n.onMediaAttaching=function(e){this.media=e.media,this._cleanTracks()},n.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach((function(t){ze(e[t]),delete e[t]})),this.nonNativeCaptionsTracks={}},n.onManifestLoading=function(){this.lastSn=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={}},n._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var r=0;r<t.length;r++)ze(t[r])}},n.onManifestLoaded=function(e){var t=this;if(this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset()),this.config.enableWebVTT){var r=e.subtitles||[],i=this.tracks&&r&&this.tracks.length===r.length;if(this.tracks=e.subtitles||[],this.config.renderTextTracksNatively){var n=this.media?this.media.textTracks:[];this.tracks.forEach((function(e,r){var i;if(r<n.length){for(var s=null,o=0;o<n.length;o++)if(qt(n[o],e)){s=n[o];break}s&&(i=s)}i||(i=t.createTextTrack("subtitles",e.name,e.lang)),e.default?i.mode=t.hls.subtitleDisplay?"showing":"hidden":i.mode="disabled",t.textTracks.push(i)}))}else if(!i&&this.tracks&&this.tracks.length){var s=this.tracks.map((function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}}));this.hls.trigger(d.default.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:s})}}this.config.enableCEA708Captions&&e.captions&&e.captions.forEach((function(e){var r=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(r){var i="textTrack"+r[1],n=t.captionsProperties[i];n&&(n.label=e.name,e.lang&&(n.languageCode=e.lang),n.media=e)}}))},n.onFragLoaded=function(e){var t=e.frag,r=e.payload,i=this.cea608Parser1,n=this.cea608Parser2,s=this.initPTS,o=this.lastSn,a=this.unparsedVttFrags;if("main"===t.type){var c=t.sn;t.sn!==o+1&&i&&n&&(i.reset(),n.reset()),this.lastSn=c}else if("subtitle"===t.type)if(r.byteLength){if(!Object(l.isFiniteNumber)(s[t.cc]))return a.push(e),void(s.length&&this.hls.trigger(d.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t}));var u=t.decryptdata;null!=u&&null!=u.key&&"AES-128"===u.method||this._parseVTTs(t,r)}else this.hls.trigger(d.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t})},n._parseVTTs=function(e,t){var r=this,i=this.hls,n=this.prevCC,s=this.textTracks,o=this.vttCCs;o[e.cc]||(o[e.cc]={start:e.start,prevCC:n,new:!0},this.prevCC=e.cc),zt.parse(t,this.initPTS[e.cc],o,e.cc,(function(t){if(r.config.renderTextTracksNatively){var n=s[e.level];if("disabled"===n.mode)return void i.trigger(d.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e});t.forEach((function(e){if(!n.cues.getCueById(e.id))try{if(n.addCue(e),!n.cues.getCueById(e.id))throw new Error("addCue is failed for: "+e)}catch(r){f.logger.debug("Failed occurred on adding cues: "+r);var t=new window.TextTrackCue(e.startTime,e.endTime,e.text);t.id=e.id,n.addCue(t)}}))}else{var o=r.tracks[e.level].default?"default":"subtitles"+e.level;i.trigger(d.default.CUES_PARSED,{type:"subtitles",cues:t,track:o})}i.trigger(d.default.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(t){f.logger.log("Failed to parse VTT cue: "+t),i.trigger(d.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e})}))},n.onFragDecrypted=function(e){var t=e.frag,r=e.payload;if("subtitle"===t.type){if(!Object(l.isFiniteNumber)(this.initPTS[t.cc]))return void this.unparsedVttFrags.push(e);this._parseVTTs(t,r)}},n.onFragParsingUserdata=function(e){var t=this.cea608Parser1,r=this.cea608Parser2;if(this.enabled&&t&&r)for(var i=0;i<e.samples.length;i++){var n=e.samples[i].bytes;if(n){var s=this.extractCea608Data(n);t.addData(e.samples[i].pts,s[0]),r.addData(e.samples[i].pts,s[1])}}},n.extractCea608Data=function(e){for(var t=31&e[0],r=2,i=[[],[]],n=0;n<t;n++){var s=e[r++],o=127&e[r++],a=127&e[r++],c=3&s;0===o&&0===a||0!=(4&s)&&(0!==c&&1!==c||(i[c].push(o),i[c].push(a)))}return i},i}(g);function Ht(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function $t(e){for(var t=[],r=0;r<e.length;r++){var i=e[r];"subtitles"===i.kind&&i.label&&t.push(e[r])}return t}var Wt,Yt,Xt=function(e){var t,r;function i(t){var r;return(r=e.call(this,t,d.default.MEDIA_ATTACHED,d.default.MEDIA_DETACHING,d.default.MANIFEST_LOADED,d.default.SUBTITLE_TRACK_LOADED)||this).tracks=[],r.trackId=-1,r.media=null,r.stopped=!0,r.subtitleDisplay=!0,r.queuedDefaultTrack=null,r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n,s,o,a=i.prototype;return a.destroy=function(){g.prototype.destroy.call(this)},a.onMediaAttached=function(e){var t=this;this.media=e.media,this.media&&(Object(l.isFiniteNumber)(this.queuedDefaultTrack)&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=null),this.trackChangeListener=this._onTextTracksChanged.bind(this),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.subtitlePollingInterval=setInterval((function(){t.trackChangeListener()}),500):this.media.textTracks.addEventListener("change",this.trackChangeListener))},a.onMediaDetaching=function(){this.media&&(this.useTextTrackPolling?clearInterval(this.subtitlePollingInterval):this.media.textTracks.removeEventListener("change",this.trackChangeListener),Object(l.isFiniteNumber)(this.subtitleTrack)&&(this.queuedDefaultTrack=this.subtitleTrack),$t(this.media.textTracks).forEach((function(e){ze(e)})),this.subtitleTrack=-1,this.media=null)},a.onManifestLoaded=function(e){var t=this,r=e.subtitles||[];this.tracks=r,this.hls.trigger(d.default.SUBTITLE_TRACKS_UPDATED,{subtitleTracks:r}),r.forEach((function(e){e.default&&(t.media?t.subtitleTrack=e.id:t.queuedDefaultTrack=e.id)}))},a.onSubtitleTrackLoaded=function(e){var t=this,r=e.id,i=e.details,n=this.trackId,s=this.tracks,o=s[n];if(r>=s.length||r!==n||!o||this.stopped)this._clearReloadTimer();else if(f.logger.log("subtitle track "+r+" loaded"),i.live){var a=ce(o.details,i,e.stats.trequest);f.logger.log("Reloading live subtitle playlist in "+a+"ms"),this.timer=setTimeout((function(){t._loadCurrentTrack()}),a)}else this._clearReloadTimer()},a.startLoad=function(){this.stopped=!1,this._loadCurrentTrack()},a.stopLoad=function(){this.stopped=!0,this._clearReloadTimer()},a._clearReloadTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},a._loadCurrentTrack=function(){var e=this.trackId,t=this.tracks,r=this.hls,i=t[e];e<0||!i||i.details&&!i.details.live||(f.logger.log("Loading subtitle track "+e),r.trigger(d.default.SUBTITLE_TRACK_LOADING,{url:i.url,id:e}))},a._toggleTrackModes=function(e){var t=this.media,r=this.subtitleDisplay,i=this.trackId;if(t){var n=$t(t.textTracks);if(-1===e)[].slice.call(n).forEach((function(e){e.mode="disabled"}));else{var s=n[i];s&&(s.mode="disabled")}var o=n[e];o&&(o.mode=r?"showing":"hidden")}},a._setSubtitleTrackInternal=function(e){var t=this.hls,r=this.tracks;!Object(l.isFiniteNumber)(e)||e<-1||e>=r.length||(this.trackId=e,f.logger.log("Switching to subtitle track "+e),t.trigger(d.default.SUBTITLE_TRACK_SWITCH,{id:e}),this._loadCurrentTrack())},a._onTextTracksChanged=function(){if(this.media&&this.hls.config.renderTextTracksNatively){for(var e=-1,t=$t(this.media.textTracks),r=0;r<t.length;r++)if("hidden"===t[r].mode)e=r;else if("showing"===t[r].mode){e=r;break}this.subtitleTrack=e}},n=i,(s=[{key:"subtitleTracks",get:function(){return this.tracks}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.trackId!==e&&(this._toggleTrackModes(e),this._setSubtitleTrackInternal(e))}}])&&Ht(n.prototype,s),o&&Ht(n,o),i}(g),Zt=r("./src/crypt/decrypter.js"),Qt=window.performance,Jt=function(e){var t,r;function i(t,r){var i;return(i=e.call(this,t,d.default.MEDIA_ATTACHED,d.default.MEDIA_DETACHING,d.default.ERROR,d.default.KEY_LOADED,d.default.FRAG_LOADED,d.default.SUBTITLE_TRACKS_UPDATED,d.default.SUBTITLE_TRACK_SWITCH,d.default.SUBTITLE_TRACK_LOADED,d.default.SUBTITLE_FRAG_PROCESSED,d.default.LEVEL_UPDATED)||this).fragmentTracker=r,i.config=t.config,i.state=ve,i.tracks=[],i.tracksBuffered=[],i.currentTrackId=-1,i.decrypter=new Zt.default(t,t.config),i.lastAVStart=0,i._onMediaSeeking=i.onMediaSeeking.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i)),i}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n=i.prototype;return n.startLoad=function(){this.stopLoad(),this.state=_e;var e=this.tracks[this.currentTrackId];e&&e.details&&(this.setInterval(500),this.tick())},n.onSubtitleFragProcessed=function(e){var t=e.frag,r=e.success;if(this.fragPrevious=t,this.state=_e,r){var i=this.tracksBuffered[this.currentTrackId];if(i){for(var n,s=t.start,o=0;o<i.length;o++)if(s>=i[o].start&&s<=i[o].end){n=i[o];break}var a=t.start+t.duration;n?n.end=a:(n={start:s,end:a},i.push(n))}}},n.onMediaAttached=function(e){var t=e.media;this.media=t,t.addEventListener("seeking",this._onMediaSeeking),this.state=_e},n.onMediaDetaching=function(){var e=this;this.media&&(this.media.removeEventListener("seeking",this._onMediaSeeking),this.fragmentTracker.removeAllFragments(),this.currentTrackId=-1,this.tracks.forEach((function(t){e.tracksBuffered[t.id]=[]})),this.media=null,this.state=ve)},n.onError=function(e){var t=e.frag;t&&"subtitle"===t.type&&(this.fragCurrent&&this.fragCurrent.loader&&this.fragCurrent.loader.abort(),this.state=_e)},n.onSubtitleTracksUpdated=function(e){var t=this;f.logger.log("subtitle tracks updated"),this.tracksBuffered=[],this.tracks=e.subtitleTracks,this.tracks.forEach((function(e){t.tracksBuffered[e.id]=[]}))},n.onSubtitleTrackSwitch=function(e){if(this.currentTrackId=e.id,this.tracks&&this.tracks.length&&-1!==this.currentTrackId){var t=this.tracks[this.currentTrackId];t&&t.details&&this.setInterval(500)}else this.clearInterval()},n.onSubtitleTrackLoaded=function(e){var t=e.id,r=e.details,i=this.currentTrackId,n=this.tracks,s=n[i];t>=n.length||t!==i||!s||(r.live&&function(e,t,r){void 0===r&&(r=0);var i=-1;ae(e,t,(function(e,t,r){t.start=e.start,i=r}));var n=t.fragments;if(i<0)n.forEach((function(e){e.start+=r}));else for(var s=i+1;s<n.length;s++)n[s].start=n[s-1].start+n[s-1].duration}(s.details,r,this.lastAVStart),s.details=r,this.setInterval(500))},n.onKeyLoaded=function(){this.state===Se&&(this.state=_e)},n.onFragLoaded=function(e){var t=this.fragCurrent,r=e.frag.decryptdata,i=e.frag,n=this.hls;if(this.state===Te&&t&&"subtitle"===e.frag.type&&t.sn===e.frag.sn&&e.payload.byteLength>0&&r&&r.key&&"AES-128"===r.method){var s=Qt.now();this.decrypter.decrypt(e.payload,r.key.buffer,r.iv.buffer,(function(e){var t=Qt.now();n.trigger(d.default.FRAG_DECRYPTED,{frag:i,payload:e,stats:{tstart:s,tdecrypt:t}})}))}},n.onLevelUpdated=function(e){var t=e.details.fragments;this.lastAVStart=t.length?t[0].start:0},n.doTick=function(){if(this.media)switch(this.state){case _e:var e=this.config,t=this.currentTrackId,r=this.fragmentTracker,i=this.media,n=this.tracks;if(!n||!n[t]||!n[t].details)break;var s,o=e.maxBufferHole,a=e.maxFragLookUpTolerance,c=Math.min(e.maxBufferLength,e.maxMaxBufferLength),u=$.bufferedInfo(this._getBuffered(),i.currentTime,o),l=u.end,h=u.len,p=n[t].details,g=p.fragments,y=g.length,m=g[y-1].start+g[y-1].duration;if(h>c)return;var b=this.fragPrevious;l<m?(b&&p.hasProgramDateTime&&(s=fe(g,b.endProgramDateTime,a)),s||(s=he(b,g,l,a))):s=g[y-1],s&&s.encrypted?(f.logger.log("Loading key for "+s.sn),this.state=Se,this.hls.trigger(d.default.KEY_LOADING,{frag:s})):s&&r.getState(s)===K&&(this.fragCurrent=s,this.state=Te,this.hls.trigger(d.default.FRAG_LOADING,{frag:s}))}else this.state=_e},n.stopLoad=function(){this.lastAVStart=0,this.fragPrevious=null,e.prototype.stopLoad.call(this)},n._getBuffered=function(){return this.tracksBuffered[this.currentTrackId]||[]},n.onMediaSeeking=function(){if(this.fragCurrent){var e=this.media?this.media.currentTime:0,t=this.config.maxFragLookUpTolerance,r=this.fragCurrent.start-t,i=this.fragCurrent.start+this.fragCurrent.duration+t;(e<r||e>i)&&(this.fragCurrent.loader&&this.fragCurrent.loader.abort(),this.fragmentTracker.removeFragment(this.fragCurrent),this.fragCurrent=null,this.fragPrevious=null,this.state=_e,this.tick())}},i}(Me);(Yt=Wt||(Wt={})).WIDEVINE="com.widevine.alpha",Yt.PLAYREADY="com.microsoft.playready";var er="undefined"!=typeof window&&window.navigator&&window.navigator.requestMediaKeySystemAccess?window.navigator.requestMediaKeySystemAccess.bind(window.navigator):null;function tr(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var rr=function(e){var t,r;function i(t){var r;return(r=e.call(this,t,d.default.MEDIA_ATTACHED,d.default.MEDIA_DETACHED,d.default.MANIFEST_PARSED)||this)._widevineLicenseUrl=void 0,r._licenseXhrSetup=void 0,r._emeEnabled=void 0,r._requestMediaKeySystemAccess=void 0,r._drmSystemOptions=void 0,r._config=void 0,r._mediaKeysList=[],r._media=null,r._hasSetMediaKeys=!1,r._requestLicenseFailureCount=0,r.mediaKeysPromise=null,r._onMediaEncrypted=function(e){if(f.logger.log('Media is encrypted using "'+e.initDataType+'" init data type'),!r.mediaKeysPromise)return f.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),void r.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.KEY_SYSTEM_ERROR,details:u.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});var t=function(t){r._media&&(r._attemptSetMediaKeys(t),r._generateRequestWithPreferredKeySession(e.initDataType,e.initData))};r.mediaKeysPromise.then(t).catch(t)},r._config=t.config,r._widevineLicenseUrl=r._config.widevineLicenseUrl,r._licenseXhrSetup=r._config.licenseXhrSetup,r._emeEnabled=r._config.emeEnabled,r._requestMediaKeySystemAccess=r._config.requestMediaKeySystemAccessFunc,r._drmSystemOptions=t.config.drmSystemOptions,r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var n,s,o,a=i.prototype;return a.getLicenseServerUrl=function(e){switch(e){case Wt.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+e+'"')},a._attemptKeySystemAccess=function(e,t,r){var i=this,n=function(e,t,r,i){if(e===Wt.WIDEVINE)return function(e,t,r){var i={audioCapabilities:[],videoCapabilities:[]};return e.forEach((function(e){i.audioCapabilities.push({contentType:'audio/mp4; codecs="'+e+'"',robustness:r.audioRobustness||""})})),t.forEach((function(e){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+e+'"',robustness:r.videoRobustness||""})})),[i]}(t,r,i);throw new Error("Unknown key-system: "+e)}(e,t,r,this._drmSystemOptions);f.logger.log("Requesting encrypted media key-system access");var s=this.requestMediaKeySystemAccess(e,n);this.mediaKeysPromise=s.then((function(t){return i._onMediaKeySystemAccessObtained(e,t)})),s.catch((function(t){f.logger.error('Failed to obtain key-system "'+e+'" access:',t)}))},a._onMediaKeySystemAccessObtained=function(e,t){var r=this;f.logger.log('Access for key-system "'+e+'" obtained');var i={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:e};this._mediaKeysList.push(i);var n=Promise.resolve().then((function(){return t.createMediaKeys()})).then((function(t){return i.mediaKeys=t,f.logger.log('Media-keys created for key-system "'+e+'"'),r._onMediaKeysCreated(),t}));return n.catch((function(e){f.logger.error("Failed to create media-keys:",e)})),n},a._onMediaKeysCreated=function(){var e=this;this._mediaKeysList.forEach((function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),e._onNewMediaKeySession(t.mediaKeysSession))}))},a._onNewMediaKeySession=function(e){var t=this;f.logger.log("New key-system session "+e.sessionId),e.addEventListener("message",(function(r){t._onKeySessionMessage(e,r.message)}),!1)},a._onKeySessionMessage=function(e,t){f.logger.log("Got EME message event, creating license request"),this._requestLicense(t,(function(t){f.logger.log("Received license data (length: "+(t?t.byteLength:t)+"), updating key-session"),e.update(t)}))},a._attemptSetMediaKeys=function(e){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var t=this._mediaKeysList[0];if(!t||!t.mediaKeys)return f.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),void this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.KEY_SYSTEM_ERROR,details:u.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});f.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0}},a._generateRequestWithPreferredKeySession=function(e,t){var r=this,i=this._mediaKeysList[0];if(!i)return f.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.KEY_SYSTEM_ERROR,details:u.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(i.mediaKeysSessionInitialized)f.logger.warn("Key-Session already initialized but requested again");else{var n=i.mediaKeysSession;if(!n)return f.logger.error("Fatal: Media is encrypted but no key-session existing"),void this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.KEY_SYSTEM_ERROR,details:u.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});if(!t)return f.logger.warn("Fatal: initData required for generating a key session is null"),void this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.KEY_SYSTEM_ERROR,details:u.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});f.logger.log('Generating key-session request for "'+e+'" init data type'),i.mediaKeysSessionInitialized=!0,n.generateRequest(e,t).then((function(){f.logger.debug("Key-session generation succeeded")})).catch((function(e){f.logger.error("Error generating key-session request:",e),r.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.KEY_SYSTEM_ERROR,details:u.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})}))}},a._createLicenseXhr=function(e,t,r){var i=new XMLHttpRequest,n=this._licenseXhrSetup;try{if(n)try{n(i,e)}catch(t){i.open("POST",e,!0),n(i,e)}i.readyState||i.open("POST",e,!0)}catch(e){throw new Error("issue setting up KeySystem license XHR "+e)}return i.responseType="arraybuffer",i.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,i,e,t,r),i},a._onLicenseRequestReadyStageChange=function(e,t,r,i){if(4===e.readyState)if(200===e.status)this._requestLicenseFailureCount=0,f.logger.log("License request succeeded"),"arraybuffer"!==e.responseType&&f.logger.warn("xhr response type was not set to the expected arraybuffer for license request"),i(e.response);else{if(f.logger.error("License Request XHR failed ("+t+"). Status: "+e.status+" ("+e.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>3)return void this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.KEY_SYSTEM_ERROR,details:u.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var n=3-this._requestLicenseFailureCount+1;f.logger.warn("Retrying license request, "+n+" attempts left"),this._requestLicense(r,i)}},a._generateLicenseRequestChallenge=function(e,t){if(e.mediaKeySystemDomain===Wt.WIDEVINE)return t;throw new Error("unsupported key-system: "+e.mediaKeySystemDomain)},a._requestLicense=function(e,t){f.logger.log("Requesting content license for key-system");var r=this._mediaKeysList[0];if(!r)return f.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.KEY_SYSTEM_ERROR,details:u.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var i=this.getLicenseServerUrl(r.mediaKeySystemDomain),n=this._createLicenseXhr(i,e,t);f.logger.log("Sending license request to URL: "+i);var s=this._generateLicenseRequestChallenge(r,e);n.send(s)}catch(e){f.logger.error("Failure requesting DRM license: "+e),this.hls.trigger(d.default.ERROR,{type:u.ErrorTypes.KEY_SYSTEM_ERROR,details:u.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},a.onMediaAttached=function(e){if(this._emeEnabled){var t=e.media;this._media=t,t.addEventListener("encrypted",this._onMediaEncrypted)}},a.onMediaDetached=function(){var e=this._media,t=this._mediaKeysList;e&&(e.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(t.map((function(e){if(e.mediaKeysSession)return e.mediaKeysSession.close().catch((function(){}))}))).then((function(){return e.setMediaKeys(null)})).catch((function(){})))},a.onManifestParsed=function(e){if(this._emeEnabled){var t=e.levels.map((function(e){return e.audioCodec})),r=e.levels.map((function(e){return e.videoCodec}));this._attemptKeySystemAccess(Wt.WIDEVINE,t,r)}},n=i,(s=[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}])&&tr(n.prototype,s),o&&tr(n,o),i}(g);function ir(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function nr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ir(Object(r),!0).forEach((function(t){sr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ir(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function sr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var or=nr(nr({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,lowBufferWatchdogPeriod:.5,highBufferWatchdogPeriod:3,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,liveDurationInfinity:!1,liveBackBufferLength:1/0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:tt,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,abrController:We,bufferController:Xe,capLevelController:Qe,fpsController:et,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:er,testBandwidth:!0},{cueHandler:i,enableCEA708Captions:!0,enableWebVTT:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:Jt,subtitleTrackController:Xt,timelineController:Gt,audioStreamController:ot,audioTrackController:it,emeController:rr});function ar(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function cr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ar(Object(r),!0).forEach((function(t){ur(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ar(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ur(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dr(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function fr(e,t,r){return t&&dr(e.prototype,t),r&&dr(e,r),e}var hr=function(e){var t,r;function i(t){var r;void 0===t&&(t={}),(r=e.call(this)||this).config=void 0,r._autoLevelCapping=void 0,r.abrController=void 0,r.capLevelController=void 0,r.levelController=void 0,r.streamController=void 0,r.networkControllers=void 0,r.audioTrackController=void 0,r.subtitleTrackController=void 0,r.emeController=void 0,r.coreComponents=void 0,r.media=null,r.url=null;var n=i.DefaultConfig;if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");r.config=cr(cr({},n),t);var s=lr(r).config;if(void 0!==s.liveMaxLatencyDurationCount&&s.liveMaxLatencyDurationCount<=s.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==s.liveMaxLatencyDuration&&(void 0===s.liveSyncDuration||s.liveMaxLatencyDuration<=s.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');Object(f.enableLogs)(s.debug),r._autoLevelCapping=-1;var o=r.abrController=new s.abrController(lr(r)),a=new s.bufferController(lr(r)),c=r.capLevelController=new s.capLevelController(lr(r)),u=new s.fpsController(lr(r)),l=new N(lr(r)),d=new U(lr(r)),h=new F(lr(r)),p=new Ve(lr(r)),g=r.levelController=new Ue(lr(r)),y=new G(lr(r)),m=[g,r.streamController=new Le(lr(r),y)],b=s.audioStreamController;b&&m.push(new b(lr(r),y)),r.networkControllers=m;var v=[l,d,h,o,a,c,u,p,y];if(b=s.audioTrackController){var w=new b(lr(r));r.audioTrackController=w,v.push(w)}if(b=s.subtitleTrackController){var _=new b(lr(r));r.subtitleTrackController=_,m.push(_)}if(b=s.emeController){var E=new b(lr(r));r.emeController=E,v.push(E)}return(b=s.subtitleStreamController)&&m.push(new b(lr(r),y)),(b=s.timelineController)&&v.push(new b(lr(r))),r.coreComponents=v,r}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,i.isSupported=function(){return function(){var e=Z();if(!e)return!1;var t=self.SourceBuffer||self.WebKitSourceBuffer,r=e&&"function"==typeof e.isTypeSupported&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),i=!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove;return!!r&&!!i}()},fr(i,null,[{key:"version",get:function(){return"0.14.17"}},{key:"Events",get:function(){return d.default}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return i.defaultConfig?i.defaultConfig:or},set:function(e){i.defaultConfig=e}}]);var n=i.prototype;return n.destroy=function(){f.logger.log("destroy"),this.trigger(d.default.DESTROYING),this.detachMedia(),this.coreComponents.concat(this.networkControllers).forEach((function(e){e.destroy()})),this.url=null,this.removeAllListeners(),this._autoLevelCapping=-1},n.attachMedia=function(e){f.logger.log("attachMedia"),this.media=e,this.trigger(d.default.MEDIA_ATTACHING,{media:e})},n.detachMedia=function(){f.logger.log("detachMedia"),this.trigger(d.default.MEDIA_DETACHING),this.media=null},n.loadSource=function(e){e=c.buildAbsoluteURL(window.location.href,e,{alwaysNormalize:!0}),f.logger.log("loadSource:"+e),this.url=e,this.trigger(d.default.MANIFEST_LOADING,{url:e})},n.startLoad=function(e){void 0===e&&(e=-1),f.logger.log("startLoad("+e+")"),this.networkControllers.forEach((function(t){t.startLoad(e)}))},n.stopLoad=function(){f.logger.log("stopLoad"),this.networkControllers.forEach((function(e){e.stopLoad()}))},n.swapAudioCodec=function(){f.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},n.recoverMediaError=function(){f.logger.log("recoverMediaError");var e=this.media;this.detachMedia(),e&&this.attachMedia(e)},n.removeLevel=function(e,t){void 0===t&&(t=0),this.levelController.removeLevel(e,t)},fr(i,[{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){f.logger.log("set currentLevel:"+e),this.loadLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){f.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){f.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){f.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){f.logger.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){f.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e}},{key:"bandwidthEstimate",get:function(){var e=this.abrController._bwEstimator;return e?e.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){for(var e=this.levels,t=this.config.minAutoBitrate,r=e?e.length:0,i=0;i<r;i++)if((e[i].realBitrate?Math.max(e[i].realBitrate,e[i].bitrate):e[i].bitrate)>t)return i;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}}]),i}(J);hr.defaultConfig=void 0},"./src/polyfills/number.js":function(e,t,r){"use strict";r.r(t),r.d(t,"isFiniteNumber",(function(){return i})),r.d(t,"MAX_SAFE_INTEGER",(function(){return n}));var i=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},n=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/utils/get-self-scope.js":function(e,t,r){"use strict";function i(){return"undefined"==typeof window?self:window}r.r(t),r.d(t,"getSelfScope",(function(){return i}))},"./src/utils/logger.js":function(e,t,r){"use strict";r.r(t),r.d(t,"enableLogs",(function(){return l})),r.d(t,"logger",(function(){return d}));var i=r(/*! ./get-self-scope */"./src/utils/get-self-scope.js");function n(){}var s={trace:n,debug:n,log:n,warn:n,info:n,error:n},o=s;function a(e,t){return t="["+e+"] > "+t}var c=Object(i.getSelfScope)();function u(e){var t=c.console[e];return t?function(){for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];i[0]&&(i[0]=a(e,i[0])),t.apply(c.console,i)}:n}var l=function(e){if(c.console&&!0===e||"object"==typeof e){!function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];r.forEach((function(t){o[t]=e[t]?e[t].bind(e):u(t)}))}(e,"debug","log","info","warn","error");try{o.log()}catch(e){o=s}}else o=s},d=o}}).default},"object"==typeof r&&"object"==typeof t?t.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof r?r.Hls=n():i.Hls=n())},{}],"1xTo6":[function(e,t,r){var i=e("buffer").Buffer;function n(e){return(new TextDecoder).decode(e)}t.exports=class{constructor(e){this._abortFlag=[!1],this.ipfs=e.ipfs,this.hash=e.ipfsHash,!1===e.debug?this.debug=function(){}:!0===e.debug?this.debug=console.log:this.debug=e.debug,e.m3u8provider?this.m3u8provider=e.m3u8provider:this.m3u8provider=null,e.tsListProvider?this.tsListProvider=e.tsListProvider:this.tsListProvider=null}destroy(){}abort(){this._abortFlag[0]=!0}load(e,t,r){this.context=e,this.config=t,this.callbacks=r,this.stats={trequest:performance.now(),retry:0},this.retryDelay=t.retryDelay,this.loadInternal()}setM3U8Provider(e){this.m3u8provider=e}setTsListProvider(e){this.tsListProvider=e}loadInternal(){const{stats:e,context:t,callbacks:r}=this;e.tfirst=Math.max(performance.now(),e.trequest),e.loaded=0;const s=window.location.href.split("/");""!==s[s.length-1]&&(s[s.length-1]="");const o=t.url.replace(s.join("/"),""),a={};if(Number.isFinite(t.rangeStart)&&(a.offset=t.rangeStart,Number.isFinite(t.rangeEnd)&&(a.length=t.rangeEnd-t.rangeStart)),"m3u8"!==o.split(".")[1]||null===this.m3u8provider)if("m3u8"!==o.split(".")[1]||null===this.tsListProvider)this._abortFlag[0]=!1,async function(e,t,r,i,n,s){n(`Fetching hash for '${t}/${r}'`);const o=`${t}/${r}`;try{return await async function(e,t,r,i,n){const s=[];let o=0,a=0;for await(const a of r.cat(e,t))if(s.push(a),o+=a.length,n[0]){i("Cancel reading from ipfs");break}const c=new Uint8Array(o);for(const e of s)c.set(e,a),a+=e.length;return i(`Received data for file '${e}' size: ${c.length} in ${s.length} blocks`),c}(o,i,e,n,s)}catch(e){throw new Error(`File not found: ${t}/${r}`)}}(this.ipfs,this.hash,o,a,this.debug,this._abortFlag).then((i=>{const s="arraybuffer"===t.responseType?i:n(i);e.loaded=e.total=s.length,e.tload=Math.max(e.tfirst,performance.now());const o={url:t.url,data:s};r.onSuccess(o,e,t)}),console.error);else{var c=this.tsListProvider()[o];c&&this.cat(c).then((s=>{let o;o=i.isBuffer(s)?n(s):s,e.loaded=e.total=o.length,e.tload=Math.max(e.tfirst,performance.now());const a={url:t.url,data:o};r.onSuccess(a,e,t)}))}else{const s=this.m3u8provider();let o;o=i.isBuffer(s)?n(s):s;const a={url:t.url,data:o};r.onSuccess(a,e,t)}}}},{buffer:"etowf"}]},["fsddd"],"fsddd");
//# sourceMappingURL=index.ed2f3c79.js.map