Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

it-ws

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

it-ws - npm Package Compare versions

Comparing version 6.0.0 to 6.0.1

2

dist/index.min.js
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.ItWs = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var ItWs=(()=>{var Dt=Object.create;var H=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var $t=Object.getOwnPropertyNames;var Wt=Object.getPrototypeOf,Ft=Object.prototype.hasOwnProperty;var P=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),w=(t,e)=>{for(var r in e)H(t,r,{get:e[r],enumerable:!0})},Me=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of $t(e))!Ft.call(t,o)&&o!==r&&H(t,o,{get:()=>e[o],enumerable:!(n=It(e,o))||n.enumerable});return t};var W=(t,e,r)=>(r=t!=null?Dt(Wt(t)):{},Me(e||!t||!t.__esModule?H(r,"default",{value:t,enumerable:!0}):r,t)),Qt=t=>Me(H({},"__esModule",{value:!0}),t);var Re=P(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});var ne=class{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(e){if(this.isStopped)return;let r={value:e,done:!1};if(this.pullQueue.length){let n=this.pullQueue.shift();n&&n.resolve(r)}else this.pushQueue.push(Promise.resolve(r)),this.highWaterMark!==void 0&&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(let 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(let r of this.pullQueue)r.reject(e);this.pullQueue.length=0}else{let r=Promise.reject(e);r.catch(()=>{}),this.pushQueue.push(r)}}remove(){Promise.resolve().then(()=>{this.removeCallback&&this.removeCallback()})}[Symbol.asyncIterator](){return{next:e=>{let r=this.pushQueue.shift();return r?(this.lowWaterMark!==void 0&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),r):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise((n,o)=>{this.pullQueue.push({resolve:n,reject:o})})},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}},K=class{constructor(e,{highWaterMark:r=100,lowWaterMark:n=1}={}){let o=new ne;o.highWaterMark=r,o.lowWaterMark=n,o.removeCallback=e({push:s=>o.push(s),stop:()=>o.stop(),fail:s=>o.fail(s),on:(s,i)=>{o.eventHandlers[s]=i}})||(()=>{}),this[Symbol.asyncIterator]=()=>o[Symbol.asyncIterator](),Object.freeze(this)}};X.EventIterator=K;X.default=K});var Te=P(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});var oe=Re();F.EventIterator=oe.EventIterator;function Vt(t,e,r){return new oe.EventIterator(({push:n})=>(this.addEventListener(t,n,e),()=>this.removeEventListener(t,n,e)),r)}F.subscribe=Vt;F.default=oe.EventIterator});var at=P(()=>{});var ct=P(()=>{});var yt=P((Lo,Oe)=>{"use strict";var $=typeof Reflect=="object"?Reflect:null,ut=$&&typeof $.apply=="function"?$.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},te;$&&typeof $.ownKeys=="function"?te=$.ownKeys:Object.getOwnPropertySymbols?te=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:te=function(e){return Object.getOwnPropertyNames(e)};function Zr(t){console&&console.warn&&console.warn(t)}var ht=Number.isNaN||function(e){return e!==e};function c(){c.init.call(this)}Oe.exports=c;Oe.exports.once=rn;c.EventEmitter=c;c.prototype._events=void 0;c.prototype._eventsCount=0;c.prototype._maxListeners=void 0;var ft=10;function re(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(c,"defaultMaxListeners",{enumerable:!0,get:function(){return ft},set:function(t){if(typeof t!="number"||t<0||ht(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ft=t}});c.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};c.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ht(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};function dt(t){return t._maxListeners===void 0?c.defaultMaxListeners:t._maxListeners}c.prototype.getMaxListeners=function(){return dt(this)};c.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var o=e==="error",s=this._events;if(s!==void 0)o=o&&s.error===void 0;else if(!o)return!1;if(o){var i;if(r.length>0&&(i=r[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")ut(u,this,r);else for(var p=u.length,h=wt(u,p),n=0;n<p;++n)ut(h[n],this,r);return!0};function lt(t,e,r,n){var o,s,i;if(re(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),i=s[e]),i===void 0)i=s[e]=r,++t._eventsCount;else if(typeof i=="function"?i=s[e]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),o=dt(t),o>0&&i.length>o&&!i.warned){i.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=i.length,Zr(a)}return t}c.prototype.addListener=function(e,r){return lt(this,e,r,!1)};c.prototype.on=c.prototype.addListener;c.prototype.prependListener=function(e,r){return lt(this,e,r,!0)};function Yr(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function pt(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=Yr.bind(n);return o.listener=r,n.wrapFn=o,o}c.prototype.once=function(e,r){return re(r),this.on(e,pt(this,e,r)),this};c.prototype.prependOnceListener=function(e,r){return re(r),this.prependListener(e,pt(this,e,r)),this};c.prototype.removeListener=function(e,r){var n,o,s,i,a;if(re(r),o=this._events,o===void 0)return this;if(n=o[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,i=n.length-1;i>=0;i--)if(n[i]===r||n[i].listener===r){a=n[i].listener,s=i;break}if(s<0)return this;s===0?n.shift():en(n,s),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};c.prototype.off=c.prototype.removeListener;c.prototype.removeAllListeners=function(e){var r,n,o;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),i;for(o=0;o<s.length;++o)i=s[o],i!=="removeListener"&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(o=r.length-1;o>=0;o--)this.removeListener(e,r[o]);return this};function mt(t,e,r){var n=t._events;if(n===void 0)return[];var o=n[e];return o===void 0?[]:typeof o=="function"?r?[o.listener||o]:[o]:r?tn(o):wt(o,o.length)}c.prototype.listeners=function(e){return mt(this,e,!0)};c.prototype.rawListeners=function(e){return mt(this,e,!1)};c.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):vt.call(t,e)};c.prototype.listenerCount=vt;function vt(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}c.prototype.eventNames=function(){return this._eventsCount>0?te(this._events):[]};function wt(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function en(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function tn(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function rn(t,e){return new Promise(function(r,n){function o(i){t.removeListener(e,s),n(i)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",o),r([].slice.call(arguments))}bt(t,e,s,{once:!0}),e!=="error"&&nn(t,o,{once:!0})})}function nn(t,e,r){typeof t.on=="function"&&bt(t,"error",e,r)}function bt(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function o(s){n.once&&t.removeEventListener(e,o),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var Ne=P((Oo,Ot)=>{"use strict";var on=typeof navigator<"u"&&navigator.product==="ReactNative";function sn(){return on?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:""}var J=self.URL,Ct=sn(),Pe=class{constructor(e="",r=Ct){this.super=new J(e,r),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 J.createObjectURL(e)}static revokeObjectURL(e){J.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function an(t){if(typeof t=="string")return new J(t).toString();if(!(t instanceof J)){let e=t.username&&t.password?`${t.username}:${t.password}@`:"",r=t.auth?t.auth+"@":"",n=t.port?":"+t.port:"",o=t.protocol?t.protocol+"//":"",s=t.host||"",i=t.hostname||"",a=t.search||(t.query?"?"+t.query:""),u=t.hash||"",p=t.pathname||"",h=t.path||p+a;return`${o}${e||r}${s||i+n}${h}${u}`}}Ot.exports={URLWithLegacySupport:Pe,URLSearchParams:self.URLSearchParams,defaultBase:Ct,format:an}});var Nt=P((Uo,Pt)=>{"use strict";var{URLWithLegacySupport:Ut,format:cn}=Ne();Pt.exports=(t,e={},r={},n)=>{let o=e.protocol?e.protocol.replace(":",""):"http";o=(r[o]||n||o)+":";let s;try{s=new Ut(t)}catch{s={}}let i=Object.assign({},e,{protocol:o||s.protocol,host:e.host||s.host});return new Ut(t,cn(i)).toString()}});var Rt=P((Po,Mt)=>{"use strict";var{URLWithLegacySupport:un,format:fn,URLSearchParams:hn,defaultBase:dn}=Ne(),ln=Nt();Mt.exports={URL:un,URLSearchParams:hn,format:fn,relative:ln,defaultBase:dn}});var vn={};w(vn,{connect:()=>_t,createServer:()=>St,duplex:()=>I,sink:()=>ee,source:()=>Y});var st=W(Te(),1);var ue={};w(ue,{identity:()=>Kt});function qt(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var s=t.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var a=t.length,u=t.charAt(0),p=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function m(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var v=0,M=0,y=0,E=f.length;y!==E&&f[y]===0;)y++,v++;for(var L=(E-y)*h+1>>>0,b=new Uint8Array(L);y!==E;){for(var S=f[y],U=0,g=L-1;(S!==0||U<M)&&g!==-1;g--,U++)S+=256*b[g]>>>0,b[g]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");M=U,y++}for(var C=L-M;C!==L&&b[C]===0;)C++;for(var k=u.repeat(v);C<L;++C)k+=t.charAt(b[C]);return k}function x(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var v=0;if(f[v]!==" "){for(var M=0,y=0;f[v]===u;)M++,v++;for(var E=(f.length-v)*p+1>>>0,L=new Uint8Array(E);f[v];){var b=r[f.charCodeAt(v)];if(b===255)return;for(var S=0,U=E-1;(b!==0||S<y)&&U!==-1;U--,S++)b+=a*L[U]>>>0,L[U]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");y=S,v++}if(f[v]!==" "){for(var g=E-y;g!==E&&L[g]===0;)g++;for(var C=new Uint8Array(M+(E-g)),k=M;g!==E;)C[k++]=L[g++];return C}}}function zt(f){var v=x(f);if(v)return v;throw new Error(`Non-${e} character`)}return{encode:m,decodeUnsafe:x,decode:zt}}var jt=qt,Jt=jt,Be=Jt;var xn=new Uint8Array(0);var _e=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},O=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var ze=t=>new TextEncoder().encode(t),De=t=>new TextDecoder().decode(t);var se=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},ie=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return $e(this,e)}},ae=class{constructor(e){this.decoders=e}or(e){return $e(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},$e=(t,e)=>new ae({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),ce=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new se(e,r,n),this.decoder=new ie(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},T=({name:t,prefix:e,encode:r,decode:n})=>new ce(t,e,r,n),N=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=Be(r,e);return T({prefix:t,name:e,encode:n,decode:s=>O(o(s))})},kt=(t,e,r,n)=>{let o={};for(let h=0;h<e.length;++h)o[e[h]]=h;let s=t.length;for(;t[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),a=0,u=0,p=0;for(let h=0;h<s;++h){let m=o[t[h]];if(m===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|m,a+=r,a>=8&&(a-=8,i[p++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return i},Ht=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,s="",i=0,a=0;for(let u=0;u<t.length;++u)for(a=a<<8|t[u],i+=8;i>r;)i-=r,s+=e[o&a>>i];if(i&&(s+=e[o&a<<r-i]),n)for(;s.length*r&7;)s+="=";return s},d=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>T({prefix:e,name:t,encode(o){return Ht(o,n,r)},decode(o){return kt(o,n,r,t)}});var Kt=T({prefix:"\0",name:"identity",encode:t=>De(t),decode:t=>ze(t)});var fe={};w(fe,{base2:()=>Xt});var Xt=d({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var he={};w(he,{base8:()=>Gt});var Gt=d({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var de={};w(de,{base10:()=>Zt});var Zt=N({prefix:"9",name:"base10",alphabet:"0123456789"});var le={};w(le,{base16:()=>Yt,base16upper:()=>er});var Yt=d({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),er=d({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var pe={};w(pe,{base32:()=>B,base32hex:()=>or,base32hexpad:()=>ir,base32hexpadupper:()=>ar,base32hexupper:()=>sr,base32pad:()=>rr,base32padupper:()=>nr,base32upper:()=>tr,base32z:()=>cr});var B=d({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),tr=d({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rr=d({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nr=d({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),or=d({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),sr=d({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ir=d({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ar=d({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),cr=d({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var me={};w(me,{base36:()=>ur,base36upper:()=>fr});var ur=N({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fr=N({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ve={};w(ve,{base58btc:()=>A,base58flickr:()=>hr});var A=N({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),hr=N({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var we={};w(we,{base64:()=>dr,base64pad:()=>lr,base64url:()=>pr,base64urlpad:()=>mr});var dr=d({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),lr=d({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),pr=d({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mr=d({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var be={};w(be,{base256emoji:()=>gr});var We=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),vr=We.reduce((t,e,r)=>(t[r]=e,t),[]),wr=We.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function br(t){return t.reduce((e,r)=>(e+=vr[r],e),"")}function yr(t){let e=[];for(let r of t){let n=wr[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var gr=T({prefix:"\u{1F680}",name:"base256emoji",encode:br,decode:yr});var Ee={};w(Ee,{sha256:()=>$r,sha512:()=>Wr});var xr=Ve,Fe=128,Er=127,Lr=~Er,Sr=Math.pow(2,31);function Ve(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Sr;)e[r++]=t&255|Fe,t/=128;for(;t&Lr;)e[r++]=t&255|Fe,t>>>=7;return e[r]=t|0,Ve.bytes=r-n+1,e}var Ar=ye,Cr=128,Qe=127;function ye(t,n){var r=0,n=n||0,o=0,s=n,i,a=t.length;do{if(s>=a)throw ye.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&Qe)<<o:(i&Qe)*Math.pow(2,o),o+=7}while(i>=Cr);return ye.bytes=s-n,r}var Or=Math.pow(2,7),Ur=Math.pow(2,14),Pr=Math.pow(2,21),Nr=Math.pow(2,28),Mr=Math.pow(2,35),Rr=Math.pow(2,42),Tr=Math.pow(2,49),Br=Math.pow(2,56),_r=Math.pow(2,63),zr=function(t){return t<Or?1:t<Ur?2:t<Pr?3:t<Nr?4:t<Mr?5:t<Rr?6:t<Tr?7:t<Br?8:t<_r?9:10},Dr={encode:xr,decode:Ar,encodingLength:zr},Ir=Dr,Q=Ir;var V=(t,e=0)=>[Q.decode(t,e),Q.decode.bytes],_=(t,e,r=0)=>(Q.encode(t,e,r),e),z=t=>Q.encodingLength(t);var R=(t,e)=>{let r=e.byteLength,n=z(t),o=n+z(r),s=new Uint8Array(o+r);return _(t,s,0),_(r,s,n),s.set(e,o),new D(t,r,e,s)},qe=t=>{let e=O(t),[r,n]=V(e),[o,s]=V(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new D(r,o,i,e)},je=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&_e(t.bytes,r.bytes)}},D=class{constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var xe=({name:t,code:e,encode:r})=>new ge(t,e,r),ge=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?R(this.code,r):r.then(n=>R(this.code,n))}else throw Error("Unknown type, must be binary type")}};var ke=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),$r=xe({name:"sha2-256",code:18,encode:ke("SHA-256")}),Wr=xe({name:"sha2-512",code:19,encode:ke("SHA-512")});var Le={};w(Le,{identity:()=>Vr});var He=0,Fr="identity",Ke=O,Qr=t=>R(He,Ke(t)),Vr={code:He,name:Fr,encode:Ke,digest:Qr};var Qn=new TextEncoder,Vn=new TextDecoder;var Xe=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return kr(r,Se(t),e||A.encoder);default:return Hr(r,Se(t),e||B.encoder)}};var Ge=new WeakMap,Se=t=>{let e=Ge.get(t);if(e==null){let r=new Map;return Ge.set(t,r),r}return e},l=class{constructor(e,r,n,o){this.code=r,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==j)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Kr)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return l.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=R(e,r);return l.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return l.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&je(e.multihash,n.multihash)}toString(e){return Xe(this,e)}toJSON(){return{"/":Xe(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof l)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:i}=r;return new l(n,o,s,i||Ze(n,o,s.bytes))}else if(r[Xr]===!0){let{version:n,multihash:o,code:s}=r,i=qe(o);return l.create(n,s,i)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==j)throw new Error(`Version 0 CID must use dag-pb (code: ${j}) block encoding`);return new l(e,r,n,n.bytes)}case 1:{let o=Ze(e,r,n.bytes);return new l(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return l.create(0,j,e)}static createV1(e,r){return l.create(1,e,r)}static decode(e){let[r,n]=l.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=l.inspectBytes(e),n=r.size-r.multihashSize,o=O(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),i=new D(r.multihashCode,r.digestSize,s,o);return[r.version===0?l.createV0(i):l.createV1(r.codec,i),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[m,x]=V(e.subarray(r));return r+=x,m},o=n(),s=j;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=r,a=n(),u=n(),p=r+u,h=p-i;return{version:o,codec:s,multihashCode:a,digestSize:u,multihashSize:h,size:p}}static parse(e,r){let[n,o]=Jr(e,r),s=l.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Se(s).set(n,e),s}},Jr=(t,e)=>{switch(t[0]){case"Q":{let r=e||A;return[A.prefix,r.decode(`${A.prefix}${t}`)]}case A.prefix:{let r=e||A;return[A.prefix,r.decode(t)]}case B.prefix:{let r=e||B;return[B.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},kr=(t,e,r)=>{let{prefix:n}=r;if(n!==A.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return o},Hr=(t,e,r)=>{let{prefix:n}=r,o=e.get(n);if(o==null){let s=r.encode(t);return e.set(n,s),s}else return o},j=112,Kr=18,Ze=(t,e,r)=>{let n=z(t),o=n+z(e),s=new Uint8Array(o+r.byteLength);return _(t,s,0),_(e,s,n),s.set(r,o),s},Xr=Symbol.for("@ipld/js-cid/CID");var Ae={...ue,...fe,...he,...de,...le,...pe,...me,...ve,...we,...be},Yn={...Ee,...Le};function Z(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Ye(t=0){return globalThis.Buffer?.allocUnsafe!=null?Z(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function tt(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var et=tt("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Ce=tt("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=Ye(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Gr={utf8:et,"utf-8":et,hex:Ae.base16,latin1:Ce,ascii:Ce,binary:Ce,...Ae},rt=Gr;function nt(t,e="utf8"){let r=rt[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Z(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function ot(t){return t instanceof ArrayBuffer||t?.constructor?.name==="ArrayBuffer"&&typeof t?.byteLength=="number"}var Y=t=>{t.binaryType="arraybuffer";let e=async()=>{await new Promise((s,i)=>{if(n){s();return}if(o!=null){i(o);return}let a=h=>{t.removeEventListener("open",u),t.removeEventListener("error",p),h()},u=()=>{a(s)},p=h=>{a(()=>{i(h.error??new Error(`connect ECONNREFUSED ${t.url}`))})};t.addEventListener("open",u),t.addEventListener("error",p)})},r=async function*(){let s=new st.EventIterator(({push:i,stop:a,fail:u})=>{let p=m=>{let x=null;typeof m.data=="string"&&(x=nt(m.data)),ot(m.data)&&(x=new Uint8Array(m.data)),m.data instanceof Uint8Array&&(x=m.data),x!=null&&i(x)},h=m=>{u(m.error??new Error("Socket error"))};return t.addEventListener("message",p),t.addEventListener("error",h),t.addEventListener("close",a),()=>{t.removeEventListener("message",p),t.removeEventListener("error",h),t.removeEventListener("close",a)}},{highWaterMark:1/0});await e();for await(let i of s)yield ot(i)?new Uint8Array(i):i}(),n=t.readyState===1,o;return t.addEventListener("open",()=>{n=!0,o=null}),t.addEventListener("close",()=>{n=!1,o=null}),t.addEventListener("error",s=>{n||(o=s.error??new Error(`connect ECONNREFUSED ${t.url}`))}),Object.assign(r,{connected:e})};var it=async t=>{if(t.readyState>=2)throw new Error("socket closed");t.readyState!==1&&await new Promise((e,r)=>{function n(){t.removeEventListener("open",o),t.removeEventListener("error",s)}function o(){n(),e()}function s(i){n(),r(i.error??new Error(`connect ECONNREFUSED ${t.url}`))}t.addEventListener("open",o),t.addEventListener("error",s)})};var ee=(t,e)=>(e=e??{},e.closeOnEnd=e.closeOnEnd!==!1,async n=>{for await(let o of n){try{await it(t)}catch(s){if(s.message==="socket closed")break;throw s}t.send(o)}e.closeOnEnd!=null&&t.readyState<=1&&await new Promise((o,s)=>{t.addEventListener("close",i=>{if(i.wasClean||i.code===1006)o();else{let a=Object.assign(new Error("ws error"),{event:i});s(a)}}),setTimeout(()=>{t.close()})})});var I=(t,e)=>{e=e??{};let r=Y(t),n=e.remoteAddress,o=e.remotePort;if(t.url!=null)try{let i=new URL(t.url);n=i.hostname,o=parseInt(i.port,10)}catch{}if(n==null||o==null)throw new Error("Remote connection did not have address and/or port");return{sink:ee(t,e),source:r,connected:async()=>{await r.connected()},close:async()=>{(t.readyState===t.CONNECTING||t.readyState===t.OPEN)&&await new Promise(i=>{t.addEventListener("close",()=>{i()}),t.close()})},destroy:()=>{t.terminate!=null?t.terminate():t.close()},remoteAddress:n,remotePort:o,socket:t}};var xt=W(at(),1),Et=W(ct(),1),Lt=W(yt(),1),Ue=class extends Lt.EventEmitter{constructor(e,r){super(),r=r??{},this.server=e,this.wsServer=new(void 0)({server:e,perMessageDeflate:!1,verifyClient:r.verifyClient}),this.wsServer.on("connection",this.onWsServerConnection.bind(this))}async listen(e){return await new Promise((r,n)=>{this.wsServer.once("error",o=>{n(o)}),this.wsServer.once("listening",()=>{r(this)}),this.server.listen(typeof e=="number"?e:e.port)})}async close(){await new Promise((e,r)=>{this.server.close(n=>{if(n!=null){r(n);return}e()})})}address(){return this.server.address()}onWsServerConnection(e,r){let n=this.wsServer.address();if(typeof n=="string"){this.emit("error",new Error("Cannot listen on unix sockets"));return}if(r.socket.remoteAddress==null||r.socket.remotePort==null){this.emit("error",new Error("Remote connection did not have address and/or port"));return}let o={...I(e,{remoteAddress:r.socket.remoteAddress,remotePort:r.socket.remotePort}),localAddress:n.address,localPort:n.port};this.emit("connection",o,r)}};function St(t){t=t??{};let e=t.server??(t.key!=null&&t.cert!=null?Et.default.createServer(t):xt.default.createServer()),r=new Ue(e);t.onConnection!=null&&r.on("connection",t.onConnection);function n(o,s){return o.on(s,(...i)=>{r.emit(s,...i)})}return n(e,"listening"),n(e,"request"),n(e,"close"),r}var At=WebSocket;var Tt=W(Rt(),1),pn={http:"ws",https:"wss"},mn="ws",Bt=(t,e)=>(0,Tt.relative)(t,e,pn,mn);function _t(t,e){let r=typeof window>"u"?"":window.location;e=e??{};let n=Bt(t,r.toString()),o=new At(n,e.websocket);return I(o,e)}return Qt(vn);})();
"use strict";var ItWs=(()=>{var lt=Object.create;var J=Object.defineProperty;var mt=Object.getOwnPropertyDescriptor;var bt=Object.getOwnPropertyNames;var wt=Object.getPrototypeOf,gt=Object.prototype.hasOwnProperty;var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),b=(t,e)=>{for(var r in e)J(t,r,{get:e[r],enumerable:!0})},Ae=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of bt(e))!gt.call(t,o)&&o!==r&&J(t,o,{get:()=>e[o],enumerable:!(n=mt(e,o))||n.enumerable});return t};var Ue=(t,e,r)=>(r=t!=null?lt(wt(t)):{},Ae(e||!t||!t.__esModule?J(r,"default",{value:t,enumerable:!0}):r,t)),yt=t=>Ae(J({},"__esModule",{value:!0}),t);var Le=R(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});var Y=class{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(e){if(this.isStopped)return;let r={value:e,done:!1};if(this.pullQueue.length){let n=this.pullQueue.shift();n&&n.resolve(r)}else this.pushQueue.push(Promise.resolve(r)),this.highWaterMark!==void 0&&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(let 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(let r of this.pullQueue)r.reject(e);this.pullQueue.length=0}else{let r=Promise.reject(e);r.catch(()=>{}),this.pushQueue.push(r)}}remove(){Promise.resolve().then(()=>{this.removeCallback&&this.removeCallback()})}[Symbol.asyncIterator](){return{next:e=>{let r=this.pushQueue.shift();return r?(this.lowWaterMark!==void 0&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),r):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise((n,o)=>{this.pullQueue.push({resolve:n,reject:o})})},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}},H=class{constructor(e,{highWaterMark:r=100,lowWaterMark:n=1}={}){let o=new Y;o.highWaterMark=r,o.lowWaterMark=n,o.removeCallback=e({push:s=>o.push(s),stop:()=>o.stop(),fail:s=>o.fail(s),on:(s,a)=>{o.eventHandlers[s]=a}})||(()=>{}),this[Symbol.asyncIterator]=()=>o[Symbol.asyncIterator](),Object.freeze(this)}};X.EventIterator=H;X.default=H});var Ce=R(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});var _=Le();I.EventIterator=_.EventIterator;function xt(t,e,r){return new _.EventIterator(({push:n})=>(this.addEventListener(t,n,e),()=>this.removeEventListener(t,n,e)),r)}I.subscribe=xt;I.default=_.EventIterator});var Se=R((Jn,nt)=>{"use strict";var Pr=typeof navigator<"u"&&navigator.product==="ReactNative";function Nr(){return Pr?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:""}var F=self.URL,rt=Nr(),Ee=class{constructor(e="",r=rt){this.super=new F(e,r),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 F.createObjectURL(e)}static revokeObjectURL(e){F.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function Br(t){if(typeof t=="string")return new F(t).toString();if(!(t instanceof F)){let e=t.username&&t.password?`${t.username}:${t.password}@`:"",r=t.auth?t.auth+"@":"",n=t.port?":"+t.port:"",o=t.protocol?t.protocol+"//":"",s=t.host||"",a=t.hostname||"",i=t.search||(t.query?"?"+t.query:""),u=t.hash||"",l=t.pathname||"",f=t.path||l+i;return`${o}${e||r}${s||a+n}${f}${u}`}}nt.exports={URLWithLegacySupport:Ee,URLSearchParams:self.URLSearchParams,defaultBase:rt,format:Br}});var at=R((Hn,st)=>{"use strict";var{URLWithLegacySupport:ot,format:Tr}=Se();st.exports=(t,e={},r={},n)=>{let o=e.protocol?e.protocol.replace(":",""):"http";o=(r[o]||n||o)+":";let s;try{s=new ot(t)}catch{s={}}let a=Object.assign({},e,{protocol:o||s.protocol,host:e.host||s.host});return new ot(t,Tr(a)).toString()}});var ct=R((Xn,it)=>{"use strict";var{URLWithLegacySupport:Mr,format:zr,URLSearchParams:Dr,defaultBase:Rr}=Se(),Ir=at();it.exports={URL:Mr,URLSearchParams:Dr,format:zr,relative:Ir,defaultBase:Rr}});var Qr={};b(Qr,{connect:()=>ft,createServer:()=>void 0,duplex:()=>k,sink:()=>Z,source:()=>j});var _e=Ue(Ce(),1);var oe={};b(oe,{identity:()=>Lt});function vt(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var s=t.charAt(o),a=s.charCodeAt(0);if(r[a]!==255)throw new TypeError(s+" is ambiguous");r[a]=o}var i=t.length,u=t.charAt(0),l=Math.log(i)/Math.log(256),f=Math.log(256)/Math.log(i);function p(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var m=0,P=0,g=0,v=c.length;g!==v&&c[g]===0;)g++,m++;for(var E=(v-g)*f+1>>>0,w=new Uint8Array(E);g!==v;){for(var S=c[g],C=0,y=E-1;(S!==0||C<P)&&y!==-1;y--,C++)S+=256*w[y]>>>0,w[y]=S%i>>>0,S=S/i>>>0;if(S!==0)throw new Error("Non-zero carry");P=C,g++}for(var U=E-P;U!==E&&w[U]===0;)U++;for(var W=u.repeat(m);U<E;++U)W+=t.charAt(w[U]);return W}function x(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var m=0;if(c[m]!==" "){for(var P=0,g=0;c[m]===u;)P++,m++;for(var v=(c.length-m)*l+1>>>0,E=new Uint8Array(v);c[m];){var w=r[c.charCodeAt(m)];if(w===255)return;for(var S=0,C=v-1;(w!==0||S<g)&&C!==-1;C--,S++)w+=i*E[C]>>>0,E[C]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");g=S,m++}if(c[m]!==" "){for(var y=v-g;y!==v&&E[y]===0;)y++;for(var U=new Uint8Array(P+(v-y)),W=P;y!==v;)U[W++]=E[y++];return U}}}function pt(c){var m=x(c);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:x,decode:pt}}var Et=vt,St=Et,Oe=St;var Hr=new Uint8Array(0);var Pe=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},L=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var Ne=t=>new TextEncoder().encode(t),Be=t=>new TextDecoder().decode(t);var ee=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},te=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Me(this,e)}},re=class{constructor(e){this.decoders=e}or(e){return Me(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Me=(t,e)=>new re({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),ne=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new ee(e,r,n),this.decoder=new te(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},B=({name:t,prefix:e,encode:r,decode:n})=>new ne(t,e,r,n),O=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=Oe(r,e);return B({prefix:t,name:e,encode:n,decode:s=>L(o(s))})},At=(t,e,r,n)=>{let o={};for(let f=0;f<e.length;++f)o[e[f]]=f;let s=t.length;for(;t[s-1]==="=";)--s;let a=new Uint8Array(s*r/8|0),i=0,u=0,l=0;for(let f=0;f<s;++f){let p=o[t[f]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|p,i+=r,i>=8&&(i-=8,a[l++]=255&u>>i)}if(i>=r||255&u<<8-i)throw new SyntaxError("Unexpected end of data");return a},Ut=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,s="",a=0,i=0;for(let u=0;u<t.length;++u)for(i=i<<8|t[u],a+=8;a>r;)a-=r,s+=e[o&i>>a];if(a&&(s+=e[o&i<<r-a]),n)for(;s.length*r&7;)s+="=";return s},h=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>B({prefix:e,name:t,encode(o){return Ut(o,n,r)},decode(o){return At(o,n,r,t)}});var Lt=B({prefix:"\0",name:"identity",encode:t=>Be(t),decode:t=>Ne(t)});var se={};b(se,{base2:()=>Ct});var Ct=h({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ae={};b(ae,{base8:()=>Ot});var Ot=h({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ie={};b(ie,{base10:()=>Pt});var Pt=O({prefix:"9",name:"base10",alphabet:"0123456789"});var ce={};b(ce,{base16:()=>Nt,base16upper:()=>Bt});var Nt=h({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Bt=h({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var he={};b(he,{base32:()=>T,base32hex:()=>Dt,base32hexpad:()=>It,base32hexpadupper:()=>$t,base32hexupper:()=>Rt,base32pad:()=>Mt,base32padupper:()=>zt,base32upper:()=>Tt,base32z:()=>qt});var T=h({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Tt=h({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Mt=h({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),zt=h({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Dt=h({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Rt=h({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),It=h({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$t=h({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),qt=h({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ue={};b(ue,{base36:()=>Qt,base36upper:()=>Vt});var Qt=O({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Vt=O({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var fe={};b(fe,{base58btc:()=>A,base58flickr:()=>Ft});var A=O({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ft=O({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var de={};b(de,{base64:()=>Wt,base64pad:()=>Jt,base64url:()=>Ht,base64urlpad:()=>Xt});var Wt=h({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Jt=h({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ht=h({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Xt=h({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var pe={};b(pe,{base256emoji:()=>kt});var ze=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Gt=ze.reduce((t,e,r)=>(t[r]=e,t),[]),Kt=ze.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function jt(t){return t.reduce((e,r)=>(e+=Gt[r],e),"")}function Zt(t){let e=[];for(let r of t){let n=Kt[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var kt=B({prefix:"\u{1F680}",name:"base256emoji",encode:jt,decode:Zt});var we={};b(we,{sha256:()=>br,sha512:()=>wr});var Yt=Ie,De=128,_t=127,er=~_t,tr=Math.pow(2,31);function Ie(t,e,r){e=e||[],r=r||0;for(var n=r;t>=tr;)e[r++]=t&255|De,t/=128;for(;t&er;)e[r++]=t&255|De,t>>>=7;return e[r]=t|0,Ie.bytes=r-n+1,e}var rr=le,nr=128,Re=127;function le(t,n){var r=0,n=n||0,o=0,s=n,a,i=t.length;do{if(s>=i)throw le.bytes=0,new RangeError("Could not decode varint");a=t[s++],r+=o<28?(a&Re)<<o:(a&Re)*Math.pow(2,o),o+=7}while(a>=nr);return le.bytes=s-n,r}var or=Math.pow(2,7),sr=Math.pow(2,14),ar=Math.pow(2,21),ir=Math.pow(2,28),cr=Math.pow(2,35),hr=Math.pow(2,42),ur=Math.pow(2,49),fr=Math.pow(2,56),dr=Math.pow(2,63),pr=function(t){return t<or?1:t<sr?2:t<ar?3:t<ir?4:t<cr?5:t<hr?6:t<ur?7:t<fr?8:t<dr?9:10},lr={encode:Yt,decode:rr,encodingLength:pr},mr=lr,$=mr;var q=(t,e=0)=>[$.decode(t,e),$.decode.bytes],M=(t,e,r=0)=>($.encode(t,e,r),e),z=t=>$.encodingLength(t);var N=(t,e)=>{let r=e.byteLength,n=z(t),o=n+z(r),s=new Uint8Array(o+r);return M(t,s,0),M(r,s,n),s.set(e,o),new D(t,r,e,s)},$e=t=>{let e=L(t),[r,n]=q(e),[o,s]=q(e.subarray(n)),a=e.subarray(n+s);if(a.byteLength!==o)throw new Error("Incorrect length");return new D(r,o,a,e)},qe=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Pe(t.bytes,r.bytes)}},D=class{constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var be=({name:t,code:e,encode:r})=>new me(t,e,r),me=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?N(this.code,r):r.then(n=>N(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Ve=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),br=be({name:"sha2-256",code:18,encode:Ve("SHA-256")}),wr=be({name:"sha2-512",code:19,encode:Ve("SHA-512")});var ge={};b(ge,{identity:()=>xr});var Fe=0,gr="identity",We=L,yr=t=>N(Fe,We(t)),xr={code:Fe,name:gr,encode:We,digest:yr};var pn=new TextEncoder,ln=new TextDecoder;var Je=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return Ar(r,ye(t),e||A.encoder);default:return Ur(r,ye(t),e||T.encoder)}};var He=new WeakMap,ye=t=>{let e=He.get(t);if(e==null){let r=new Map;return He.set(t,r),r}return e},d=class{constructor(e,r,n,o){this.code=r,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==V)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Lr)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return d.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=N(e,r);return d.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return d.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&qe(e.multihash,n.multihash)}toString(e){return Je(this,e)}toJSON(){return{"/":Je(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof d)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:a}=r;return new d(n,o,s,a||Xe(n,o,s.bytes))}else if(r[Cr]===!0){let{version:n,multihash:o,code:s}=r,a=$e(o);return d.create(n,s,a)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==V)throw new Error(`Version 0 CID must use dag-pb (code: ${V}) block encoding`);return new d(e,r,n,n.bytes)}case 1:{let o=Xe(e,r,n.bytes);return new d(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return d.create(0,V,e)}static createV1(e,r){return d.create(1,e,r)}static decode(e){let[r,n]=d.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=d.inspectBytes(e),n=r.size-r.multihashSize,o=L(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),a=new D(r.multihashCode,r.digestSize,s,o);return[r.version===0?d.createV0(a):d.createV1(r.codec,a),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[p,x]=q(e.subarray(r));return r+=x,p},o=n(),s=V;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let a=r,i=n(),u=n(),l=r+u,f=l-a;return{version:o,codec:s,multihashCode:i,digestSize:u,multihashSize:f,size:l}}static parse(e,r){let[n,o]=Sr(e,r),s=d.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ye(s).set(n,e),s}},Sr=(t,e)=>{switch(t[0]){case"Q":{let r=e||A;return[A.prefix,r.decode(`${A.prefix}${t}`)]}case A.prefix:{let r=e||A;return[A.prefix,r.decode(t)]}case T.prefix:{let r=e||T;return[T.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},Ar=(t,e,r)=>{let{prefix:n}=r;if(n!==A.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return o},Ur=(t,e,r)=>{let{prefix:n}=r,o=e.get(n);if(o==null){let s=r.encode(t);return e.set(n,s),s}else return o},V=112,Lr=18,Xe=(t,e,r)=>{let n=z(t),o=n+z(e),s=new Uint8Array(o+r.byteLength);return M(t,s,0),M(e,s,n),s.set(r,o),s},Cr=Symbol.for("@ipld/js-cid/CID");var xe={...oe,...se,...ae,...ie,...ce,...he,...ue,...fe,...de,...pe},An={...we,...ge};function K(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Ge(t=0){return globalThis.Buffer?.allocUnsafe!=null?K(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function je(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Ke=je("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ve=je("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=Ge(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Or={utf8:Ke,"utf-8":Ke,hex:xe.base16,latin1:ve,ascii:ve,binary:ve,...xe},Ze=Or;function ke(t,e="utf8"){let r=Ze[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?K(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function Ye(t){return t instanceof ArrayBuffer||t?.constructor?.name==="ArrayBuffer"&&typeof t?.byteLength=="number"}var j=t=>{t.binaryType="arraybuffer";let e=async()=>{await new Promise((s,a)=>{if(n){s();return}if(o!=null){a(o);return}let i=f=>{t.removeEventListener("open",u),t.removeEventListener("error",l),f()},u=()=>{i(s)},l=f=>{i(()=>{a(f.error??new Error(`connect ECONNREFUSED ${t.url}`))})};t.addEventListener("open",u),t.addEventListener("error",l)})},r=async function*(){let s=new _e.EventIterator(({push:a,stop:i,fail:u})=>{let l=p=>{let x=null;typeof p.data=="string"&&(x=ke(p.data)),Ye(p.data)&&(x=new Uint8Array(p.data)),p.data instanceof Uint8Array&&(x=p.data),x!=null&&a(x)},f=p=>{u(p.error??new Error("Socket error"))};return t.addEventListener("message",l),t.addEventListener("error",f),t.addEventListener("close",i),()=>{t.removeEventListener("message",l),t.removeEventListener("error",f),t.removeEventListener("close",i)}},{highWaterMark:1/0});await e();for await(let a of s)yield Ye(a)?new Uint8Array(a):a}(),n=t.readyState===1,o;return t.addEventListener("open",()=>{n=!0,o=null}),t.addEventListener("close",()=>{n=!1,o=null}),t.addEventListener("error",s=>{n||(o=s.error??new Error(`connect ECONNREFUSED ${t.url}`))}),Object.assign(r,{connected:e})};var et=async t=>{if(t.readyState>=2)throw new Error("socket closed");t.readyState!==1&&await new Promise((e,r)=>{function n(){t.removeEventListener("open",o),t.removeEventListener("error",s)}function o(){n(),e()}function s(a){n(),r(a.error??new Error(`connect ECONNREFUSED ${t.url}`))}t.addEventListener("open",o),t.addEventListener("error",s)})};var Z=(t,e)=>(e=e??{},e.closeOnEnd=e.closeOnEnd!==!1,async n=>{for await(let o of n){try{await et(t)}catch(s){if(s.message==="socket closed")break;throw s}t.send(o)}e.closeOnEnd!=null&&t.readyState<=1&&await new Promise((o,s)=>{t.addEventListener("close",a=>{if(a.wasClean||a.code===1006)o();else{let i=Object.assign(new Error("ws error"),{event:a});s(i)}}),setTimeout(()=>{t.close()})})});var k=(t,e)=>{e=e??{};let r=j(t),n=e.remoteAddress,o=e.remotePort;if(t.url!=null)try{let a=new URL(t.url);n=a.hostname,o=parseInt(a.port,10)}catch{}if(n==null||o==null)throw new Error("Remote connection did not have address and/or port");return{sink:Z(t,e),source:r,connected:async()=>{await r.connected()},close:async()=>{(t.readyState===t.CONNECTING||t.readyState===t.OPEN)&&await new Promise(a=>{t.addEventListener("close",()=>{a()}),t.close()})},destroy:()=>{t.terminate!=null?t.terminate():t.close()},remoteAddress:n,remotePort:o,socket:t}};var tt=WebSocket;var ht=Ue(ct(),1),$r={http:"ws",https:"wss"},qr="ws",ut=(t,e)=>(0,ht.relative)(t,e,$r,qr);function ft(t,e){let r=typeof window>"u"?"":window.location;e=e??{};let n=ut(t,r.toString()),o=new tt(n,e.websocket);return k(o,e)}return yt(Qr);})();
return ItWs}));
{
"name": "it-ws",
"version": "6.0.0",
"version": "6.0.1",
"description": "Simple async iterables for websocket client connections",

@@ -206,3 +206,3 @@ "author": "Alan Shaw",

"./dist/src/web-socket.js": "./dist/src/web-socket.browser.js",
"./server": false,
"./dist/src/server.js": false,
"ws": false,

@@ -209,0 +209,0 @@ "http": false,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc