@eyhn/msgpack-stream
Advanced tools
Comparing version 2.8.1 to 2.8.2
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MessagePack=t():e.MessagePack=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{DataViewIndexOutOfBoundsError:()=>$,DecodeError:()=>E,Decoder:()=>re,EXT_TIMESTAMP:()=>I,Encoder:()=>C,ExtData:()=>B,ExtensionCodec:()=>M,decode:()=>pe,decodeArrayStream:()=>Se,decodeAsync:()=>Be,decodeMulti:()=>we,decodeMultiStream:()=>Ee,decodeStream:()=>ve,decodeTimestampExtension:()=>k,decodeTimestampToTimeSpec:()=>A,encode:()=>W,encodeDateToTimeSpec:()=>F,encodeStream:()=>K,encodeTimeSpecToTimestamp:()=>L,encodeTimestampExtension:()=>T});var r=4294967295;function n(e,t,r){var n=r/4294967296,i=r;e.setUint32(t,n),e.setUint32(t+4,i)}function i(e,t,r){var n=Math.floor(r/4294967296),i=r;e.setUint32(t,n),e.setUint32(t+4,i)}function o(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}function s(e,t){return 4294967296*e.getUint32(t)+e.getUint32(t+4)}var a,u,c,h=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},f=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},l=("undefined"==typeof process||"never"!==(null===(a=null===process||void 0===process?void 0:process.env)||void 0===a?void 0:a.TEXT_ENCODING))&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function d(e){for(var t=e.length,r=0,n=0;n<t;){var i=e.charCodeAt(n++);if(0!=(4294967168&i))if(0==(4294965248&i))r+=2;else{if(i>=55296&&i<=56319&&n<t){var o=e.charCodeAt(n);56320==(64512&o)&&(++n,i=((1023&i)<<10)+(1023&o)+65536)}r+=0==(4294901760&i)?3:4}else r++}return r}function y(e,t,r){for(var n=e.length,i=r,o=0;o<n;){var s=e.charCodeAt(o++);if(0!=(4294967168&s)){if(0==(4294965248&s))t[i++]=s>>6&31|192;else{if(s>=55296&&s<=56319&&o<n){var a=e.charCodeAt(o);56320==(64512&a)&&(++o,s=((1023&s)<<10)+(1023&a)+65536)}0==(4294901760&s)?(t[i++]=s>>12&15|224,t[i++]=s>>6&63|128):(t[i++]=s>>18&7|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128)}t[i++]=63&s|128}else t[i++]=s}}var p=l?new TextEncoder:void 0,w=l?"undefined"!=typeof process&&"force"!==(null===(u=null===process||void 0===process?void 0:process.env)||void 0===u?void 0:u.TEXT_ENCODING)?200:0:r,v=(null==p?void 0:p.encodeInto)?function(e,t,r){p.encodeInto(e,t.subarray(r))}:function(e,t,r){t.set(p.encode(e),r)};function b(e,t,r){for(var n=t,i=n+r,o=[],s="";n<i;){var a=e[n++];if(0==(128&a))o.push(a);else if(192==(224&a)){var u=63&e[n++];o.push((31&a)<<6|u)}else if(224==(240&a)){u=63&e[n++];var c=63&e[n++];o.push((31&a)<<12|u<<6|c)}else if(240==(248&a)){var l=(7&a)<<18|(u=63&e[n++])<<12|(c=63&e[n++])<<6|63&e[n++];l>65535&&(l-=65536,o.push(l>>>10&1023|55296),l=56320|1023&l),o.push(l)}else o.push(a);o.length>=4096&&(s+=String.fromCharCode.apply(String,f([],h(o),!1)),o.length=0)}return o.length>0&&(s+=String.fromCharCode.apply(String,f([],h(o),!1))),s}var g=l?new TextDecoder:null,U=l?"undefined"!=typeof process&&"force"!==(null===(c=null===process||void 0===process?void 0:process.env)||void 0===c?void 0:c.TEXT_DECODER)?200:0:r;function m(e,t,r){var n=e.subarray(t,t+r);return g.decode(n)}var x,B=function(e,t){this.type=e,this.data=t},S=(x=function(e,t){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},x(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}x(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),E=function(e){function t(r){var n=e.call(this,r)||this,i=Object.create(t.prototype);return Object.setPrototypeOf(n,i),Object.defineProperty(n,"name",{configurable:!0,enumerable:!1,value:t.name}),n}return S(t,e),t}(Error),I=-1;function L(e){var t,r=e.sec,n=e.nsec;if(r>=0&&n>=0&&r<=17179869183){if(0===n&&r<=4294967295){var o=new Uint8Array(4);return(t=new DataView(o.buffer)).setUint32(0,r),o}var s=r/4294967296,a=4294967295&r;return o=new Uint8Array(8),(t=new DataView(o.buffer)).setUint32(0,n<<2|3&s),t.setUint32(4,a),o}return o=new Uint8Array(12),(t=new DataView(o.buffer)).setUint32(0,n),i(t,4,r),o}function F(e){var t=e.getTime(),r=Math.floor(t/1e3),n=1e6*(t-1e3*r),i=Math.floor(n/1e9);return{sec:r+i,nsec:n-1e9*i}}function T(e){return e instanceof Date?L(F(e)):null}function A(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:var r=t.getUint32(0);return{sec:4294967296*(3&r)+t.getUint32(4),nsec:r>>>2};case 12:return{sec:o(t,4),nsec:t.getUint32(0)};default:throw new E("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}function k(e){var t=A(e);return new Date(1e3*t.sec+t.nsec/1e6)}var D={type:I,encode:T,decode:k},M=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(D)}return e.prototype.register=function(e){var t=e.type,r=e.encode,n=e.decode;if(t>=0)this.encoders[t]=r,this.decoders[t]=n;else{var i=1+t;this.builtInEncoders[i]=r,this.builtInDecoders[i]=n}},e.prototype.tryToEncode=function(e,t){for(var r=0;r<this.builtInEncoders.length;r++)if(null!=(n=this.builtInEncoders[r])&&null!=(i=n(e,t)))return new B(-1-r,i);for(r=0;r<this.encoders.length;r++){var n,i;if(null!=(n=this.encoders[r])&&null!=(i=n(e,t)))return new B(r,i)}return e instanceof B?e:null},e.prototype.decode=function(e,t,r){var n=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return n?n(e,t,r):new B(t,e)},e.defaultCodec=new e,e}();function z(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?new Uint8Array(e):Uint8Array.from(e)}var O=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},C=function(){function e(e,t,r,n,i,o,s,a){void 0===e&&(e=M.defaultCodec),void 0===t&&(t=void 0),void 0===r&&(r=100),void 0===n&&(n=2048),void 0===i&&(i=!1),void 0===o&&(o=!1),void 0===s&&(s=!1),void 0===a&&(a=!1),this.extensionCodec=e,this.context=t,this.maxDepth=r,this.initialBufferSize=n,this.sortKeys=i,this.forceFloat32=o,this.ignoreUndefined=s,this.forceIntegerToFloat=a,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return e.prototype.reinitializeState=function(){this.pos=0},e.prototype.encodeSharedRef=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)},e.prototype.encode=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)},e.prototype.doEncode=function(e,t){if(t>this.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(2*t)},e.prototype.resizeBuffer=function(e){var t=new ArrayBuffer(e),r=new Uint8Array(t),n=new DataView(t);r.set(this.bytes),this.view=n,this.bytes=r},e.prototype.encodeNil=function(){this.writeU8(192)},e.prototype.encodeBoolean=function(e){!1===e?this.writeU8(194):this.writeU8(195)},e.prototype.encodeNumber=function(e){Number.isSafeInteger(e)&&!this.forceIntegerToFloat?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>w){var t=d(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),v(e,this.bytes,this.pos),this.pos+=t}else t=d(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),y(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var r=this.extensionCodec.tryToEncode(e,this.context);if(null!=r)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var r=z(e);this.writeU8a(r)},e.prototype.encodeArray=function(e,t){var r,n,i=e.length;if(i<16)this.writeU8(144+i);else if(i<65536)this.writeU8(220),this.writeU16(i);else{if(!(i<4294967296))throw new Error("Too large array: ".concat(i));this.writeU8(221),this.writeU32(i)}try{for(var o=O(e),s=o.next();!s.done;s=o.next()){var a=s.value;this.doEncode(a,t+1)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype.countWithoutUndefined=function(e,t){var r,n,i=0;try{for(var o=O(t),s=o.next();!s.done;s=o.next())void 0!==e[s.value]&&i++}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},e.prototype.encodeMap=function(e,t){var r,n,i=Object.keys(e);this.sortKeys&&i.sort();var o=this.ignoreUndefined?this.countWithoutUndefined(e,i):i.length;if(o<16)this.writeU8(128+o);else if(o<65536)this.writeU8(222),this.writeU16(o);else{if(!(o<4294967296))throw new Error("Too large map object: ".concat(o));this.writeU8(223),this.writeU32(o)}try{for(var s=O(i),a=s.next();!a.done;a=s.next()){var u=a.value,c=e[u];this.ignoreUndefined&&void 0===c||(this.encodeString(u),this.doEncode(c,t+1))}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}},e.prototype.encodeExtension=function(e){var t=e.data.length;if(1===t)this.writeU8(212);else if(2===t)this.writeU8(213);else if(4===t)this.writeU8(214);else if(8===t)this.writeU8(215);else if(16===t)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large extension object: ".concat(t));this.writeU8(201),this.writeU32(t)}this.writeI8(e.type),this.writeU8a(e.data)},e.prototype.writeU8=function(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++},e.prototype.writeU8a=function(e){var t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t},e.prototype.writeI8=function(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++},e.prototype.writeU16=function(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2},e.prototype.writeI16=function(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2},e.prototype.writeU32=function(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4},e.prototype.writeI32=function(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4},e.prototype.writeF32=function(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4},e.prototype.writeF64=function(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8},e.prototype.writeU64=function(e){this.ensureBufferSizeToWrite(8),n(this.view,this.pos,e),this.pos+=8},e.prototype.writeI64=function(e){this.ensureBufferSizeToWrite(8),i(this.view,this.pos,e),this.pos+=8},e}(),V=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},_=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},j=function(){function e(e,t,r,n,i,o,s,a){void 0===e&&(e=M.defaultCodec),void 0===t&&(t=void 0),void 0===r&&(r=100),void 0===n&&(n=2048),void 0===i&&(i=!1),void 0===o&&(o=!1),void 0===s&&(s=!1),void 0===a&&(a=!1),this.extensionCodec=e,this.context=t,this.maxDepth=r,this.bufferSize=n,this.sortKeys=i,this.forceFloat32=o,this.ignoreUndefined=s,this.forceIntegerToFloat=a,this.view=new DataView(new ArrayBuffer(2048)),this.bytes=new Uint8Array(this.view.buffer)}return e.prototype.encode=function(e){var t,r,n,i,o,s,a,u,c,h;return V(this,(function(f){switch(f.label){case 0:t=new Uint8Array(this.bufferSize),r=0,f.label=1;case 1:f.trys.push([1,11,12,13]),n=_(this.doEncode(e,1)),i=n.next(),f.label=2;case 2:return i.done?[3,10]:(o=i.value).length>=t.length?r>=0?[4,t.slice(0,r)]:[3,4]:[3,6];case 3:f.sent(),f.label=4;case 4:return r=0,[4,o.slice(0,r)];case 5:return f.sent(),[3,9];case 6:return o.length>0?(s=Math.min(t.length-r,o.length),a=o.subarray(0,s),t.set(a,r),(r+=a.length)!==t.length?[3,8]:[4,t.slice()]):[3,9];case 7:f.sent(),r=0,f.label=8;case 8:return o=o.subarray(s,o.length),[3,6];case 9:return i=n.next(),[3,2];case 10:return[3,13];case 11:return u=f.sent(),c={error:u},[3,13];case 12:try{i&&!i.done&&(h=n.return)&&h.call(n)}finally{if(c)throw c.error}return[7];case 13:return r>=0?[4,t.subarray(0,r)]:[3,15];case 14:f.sent(),f.label=15;case 15:return[2]}}))},e.prototype.doEncode=function(e,t){if(t>this.maxDepth)throw new Error("Too deep objects in depth ".concat(t));return null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){this.view.byteLength<e&&this.resizeBuffer(2*this.view.byteLength)},e.prototype.resizeBuffer=function(e){var t=new ArrayBuffer(e),r=new Uint8Array(t),n=new DataView(t);this.view=n,this.bytes=r},e.prototype.encodeNil=function(){return this.writeU8(192)},e.prototype.encodeBoolean=function(e){return!1===e?this.writeU8(194):this.writeU8(195)},e.prototype.encodeNumber=function(e){return Number.isSafeInteger(e)&&!this.forceIntegerToFloat?e>=0?e<128?this.writeU8(e):e<256?this.writeU8U8(204,e):e<65536?this.writeU8U16(205,e):e<4294967296?this.writeU8U32(206,e):this.writeU8U64(207,e):e>=-32?this.writeU8(224|e+32):e>=-128?this.writeU8I8(208,e):e>=-32768?this.writeU8I16(209,e):e>=-2147483648?this.writeU8I32(210,e):this.writeU8I64(211,e):this.forceFloat32?this.writeU8F32(202,e):this.writeU8F64(203,e)},e.prototype.buildStringHeader=function(e){if(e<32)return[160+e];if(e<256)return[217,e];var t;if(e<65536)return(t=new DataView(new ArrayBuffer(3))).setUint8(0,218),t.setUint16(1,e),new Uint8Array(t.buffer);if(e<4294967296)return(t=new DataView(new ArrayBuffer(5))).setUint8(0,219),t.setUint32(1,e),new Uint8Array(t.buffer);throw new Error("Too long string: ".concat(e," bytes in UTF-8"))},e.prototype.encodeString=function(e){if(e.length>w){var t=d(e);this.ensureBufferSizeToWrite(5+t);var r=this.buildStringHeader(t);return this.bytes.set(r,0),v(e,this.bytes,r.length),this.writeBuffer(t+r.length)}return t=d(e),this.ensureBufferSizeToWrite(5+t),r=this.buildStringHeader(t),this.bytes.set(r,0),y(e,this.bytes,r.length),this.writeBuffer(t+r.length)},e.prototype.encodeObject=function(e,t){var r=this.extensionCodec.tryToEncode(e,this.context);if(null!=r)return this.encodeExtension(r);if(Array.isArray(e))return this.encodeArray(e,t);if(ArrayBuffer.isView(e))return this.encodeBinary(e);if("object"==typeof e)return this.encodeMap(e,t);throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)))},e.prototype.encodeBinary=function(e){var t,r;return V(this,(function(n){switch(n.label){case 0:return(t=e.byteLength)<256?[5,_(this.writeU8U8(196,t))]:[3,2];case 1:case 3:case 5:return n.sent(),[3,7];case 2:return t<65536?[5,_(this.writeU8U16(197,t))]:[3,4];case 4:return t<4294967296?[5,_(this.writeU8U32(198,t))]:[3,6];case 6:throw new Error("Too large binary: ".concat(t));case 7:return r=z(e),[5,_(this.writeU8a(r))];case 8:return n.sent(),[2]}}))},e.prototype.encodeArray=function(e,t){var r,n,i,o,s,a,u;return V(this,(function(c){switch(c.label){case 0:return(r=e.length)<16?[5,_(this.writeU8(144+r))]:[3,2];case 1:return c.sent(),[3,7];case 2:return r<65536?[5,_(this.writeU8U16(220,r))]:[3,4];case 3:return c.sent(),[3,7];case 4:return r<4294967296?[5,_(this.writeU8U32(221,r))]:[3,6];case 5:return c.sent(),[3,7];case 6:throw new Error("Too large array: ".concat(r));case 7:c.trys.push([7,12,13,14]),n=_(e),i=n.next(),c.label=8;case 8:return i.done?[3,11]:(o=i.value,[5,_(this.doEncode(o,t+1))]);case 9:c.sent(),c.label=10;case 10:return i=n.next(),[3,8];case 11:return[3,14];case 12:return s=c.sent(),a={error:s},[3,14];case 13:try{i&&!i.done&&(u=n.return)&&u.call(n)}finally{if(a)throw a.error}return[7];case 14:return[2]}}))},e.prototype.countWithoutUndefined=function(e,t){var r,n,i=0;try{for(var o=_(t),s=o.next();!s.done;s=o.next())void 0!==e[s.value]&&i++}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},e.prototype.encodeMap=function(e,t){var r,n,i,o,s,a,u,c,h;return V(this,(function(f){switch(f.label){case 0:return r=Object.keys(e),this.sortKeys&&r.sort(),(n=this.ignoreUndefined?this.countWithoutUndefined(e,r):r.length)<16?[5,_(this.writeU8(128+n))]:[3,2];case 1:return f.sent(),[3,7];case 2:return n<65536?[5,_(this.writeU8U16(222,n))]:[3,4];case 3:return f.sent(),[3,7];case 4:return n<4294967296?[5,_(this.writeU8U32(223,n))]:[3,6];case 5:return f.sent(),[3,7];case 6:throw new Error("Too large map object: ".concat(n));case 7:f.trys.push([7,13,14,15]),i=_(r),o=i.next(),f.label=8;case 8:return o.done?[3,12]:(s=o.value,a=e[s],this.ignoreUndefined&&void 0===a?[3,11]:[5,_(this.encodeString(s))]);case 9:return f.sent(),[5,_(this.doEncode(a,t+1))];case 10:f.sent(),f.label=11;case 11:return o=i.next(),[3,8];case 12:return[3,15];case 13:return u=f.sent(),c={error:u},[3,15];case 14:try{o&&!o.done&&(h=i.return)&&h.call(i)}finally{if(c)throw c.error}return[7];case 15:return[2]}}))},e.prototype.encodeExtension=function(e){var t;return V(this,(function(r){switch(r.label){case 0:return 1!==(t=e.data.length)?[3,2]:[5,_(this.writeU8(212))];case 1:case 3:case 5:case 7:case 9:case 11:case 13:case 15:return r.sent(),[3,17];case 2:return 2!==t?[3,4]:[5,_(this.writeU8(213))];case 4:return 4!==t?[3,6]:[5,_(this.writeU8(214))];case 6:return 8!==t?[3,8]:[5,_(this.writeU8(215))];case 8:return 16!==t?[3,10]:[5,_(this.writeU8(216))];case 10:return t<256?[5,_(this.writeU8U8(199,t))]:[3,12];case 12:return t<65536?[5,_(this.writeU8U16(200,t))]:[3,14];case 14:return t<4294967296?[5,_(this.writeU8U32(201,t))]:[3,16];case 16:throw new Error("Too large extension object: ".concat(t));case 17:return[5,_(this.writeI8(e.type))];case 18:return r.sent(),[5,_(this.writeU8a(e.data))];case 19:return r.sent(),[2]}}))},e.prototype.writeU8=function(e){return this.view.setUint8(0,e),this.writeBuffer(1)},e.prototype.writeU8a=function(e){var t=e.length;return this.ensureBufferSizeToWrite(t),this.bytes.set(e,0),this.writeBuffer(t)},e.prototype.writeI8=function(e){return this.view.setInt8(0,e),this.writeBuffer(1)},e.prototype.writeU16=function(e){return this.view.setUint16(0,e),this.writeBuffer(2)},e.prototype.writeI16=function(e){return this.view.setInt16(0,e),this.writeBuffer(2)},e.prototype.writeU32=function(e){return this.view.setUint32(0,e),this.writeBuffer(4)},e.prototype.writeI32=function(e){return this.view.setInt32(0,e),this.writeBuffer(4)},e.prototype.writeF32=function(e){return this.view.setFloat32(0,e),this.writeBuffer(4)},e.prototype.writeF64=function(e){return this.view.setFloat64(0,e),this.writeBuffer(8)},e.prototype.writeU64=function(e){return n(this.view,0,e),this.writeBuffer(8)},e.prototype.writeI64=function(e){return i(this.view,0,e),this.writeBuffer(8)},e.prototype.writeU8U8=function(e,t){return this.view.setUint8(0,e),this.view.setUint8(1,t),this.writeBuffer(2)},e.prototype.writeU8U16=function(e,t){return this.view.setUint8(0,e),this.view.setUint16(1,t),this.writeBuffer(3)},e.prototype.writeU8U32=function(e,t){return this.view.setUint8(0,e),this.view.setUint32(1,t),this.writeBuffer(5)},e.prototype.writeU8U64=function(e,t){return this.view.setUint8(0,e),n(this.view,1,t),this.writeBuffer(9)},e.prototype.writeU8I8=function(e,t){return this.view.setUint8(0,e),this.view.setInt8(1,t),this.writeBuffer(2)},e.prototype.writeU8I16=function(e,t){return this.view.setUint8(0,e),this.view.setInt16(1,t),this.writeBuffer(3)},e.prototype.writeU8I32=function(e,t){return this.view.setUint8(0,e),this.view.setInt32(1,t),this.writeBuffer(5)},e.prototype.writeU8I64=function(e,t){return this.view.setUint8(0,e),i(this.view,1,t),this.writeBuffer(9)},e.prototype.writeU8F32=function(e,t){return this.view.setUint8(0,e),this.view.setFloat32(1,t),this.writeBuffer(5)},e.prototype.writeU8F64=function(e,t){return this.view.setUint8(0,e),this.view.setFloat64(1,t),this.writeBuffer(9)},e.prototype.writeBuffer=function(e){return V(this,(function(t){switch(t.label){case 0:return[4,this.bytes.subarray(0,e)];case 1:return t.sent(),[2]}}))},e}(),P={};function W(e,t){return void 0===t&&(t=P),new C(t.extensionCodec,t.context,t.maxDepth,t.initialBufferSize,t.sortKeys,t.forceFloat32,t.ignoreUndefined,t.forceIntegerToFloat).encodeSharedRef(e)}function K(e,t){return void 0===t&&(t=P),new j(t.extensionCodec,t.context,t.maxDepth,t.streamBufferSize,t.sortKeys,t.forceFloat32,t.ignoreUndefined,t.forceIntegerToFloat).encode(e)}function N(e){return"".concat(e<0?"-":"","0x").concat(Math.abs(e).toString(16).padStart(2,"0"))}var H=function(){function e(e,t){void 0===e&&(e=16),void 0===t&&(t=16),this.maxKeyLength=e,this.maxLengthPerKey=t,this.hit=0,this.miss=0,this.caches=[];for(var r=0;r<this.maxKeyLength;r++)this.caches.push([])}return e.prototype.canBeCached=function(e){return e>0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,r){var n,i,o=this.caches[r-1];try{e:for(var s=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(o),a=s.next();!a.done;a=s.next()){for(var u=a.value,c=u.bytes,h=0;h<r;h++)if(c[h]!==e[t+h])continue e;return u.str}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return null},e.prototype.store=function(e,t){var r=this.caches[e.length-1],n={bytes:e,str:t};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=n:r.push(n)},e.prototype.decode=function(e,t,r){var n=this.find(e,t,r);if(null!=n)return this.hit++,n;this.miss++;var i=b(e,t,r),o=Uint8Array.prototype.slice.call(e,t,t+r);return this.store(o,i),i},e}(),R=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},G=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){!function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,i,(t=e[r](t)).done,t.value)}))}}},X=function(e){return this instanceof X?(this.v=e,this):new X(e)},q=function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),o=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(e){i[e]&&(n[e]=function(t){return new Promise((function(r,n){o.push([e,t,r,n])>1||a(e,t)}))})}function a(e,t){try{(r=i[e](t)).value instanceof X?Promise.resolve(r.value.v).then(u,c):h(o[0][2],r)}catch(e){h(o[0][3],e)}var r}function u(e){a("next",e)}function c(e){a("throw",e)}function h(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}},J="array",Q="map_key",Y=new DataView(new ArrayBuffer(0)),Z=new Uint8Array(Y.buffer),$=function(){try{Y.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),ee=new $("Insufficient data"),te=new H,re=function(){function e(e,t,n,i,o,s,a,u){void 0===e&&(e=M.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=r),void 0===i&&(i=r),void 0===o&&(o=r),void 0===s&&(s=r),void 0===a&&(a=r),void 0===u&&(u=te),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=i,this.maxArrayLength=o,this.maxMapLength=s,this.maxExtLength=a,this.keyDecoder=u,this.totalPos=0,this.pos=0,this.view=Y,this.bytes=Z,this.headByte=-1,this.stack=[]}return e.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1,this.stack.length=0},e.prototype.setBuffer=function(e){this.bytes=z(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=z(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes),this.pos=0},e.prototype.appendBuffer=function(e){if(-1!==this.headByte||this.hasRemaining(1)){var t=this.bytes.subarray(this.pos),r=z(e),n=new Uint8Array(t.length+r.length);n.set(t),n.set(r,t.length),this.setBuffer(n)}else this.setBuffer(e)},e.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},e.prototype.createExtraByteError=function(e){var t=this.view,r=this.pos;return new RangeError("Extra ".concat(t.byteLength-r," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return R(this,(function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))},e.prototype.decodeAsync=function(e){var t,r,n,i,o,s,a,u;return o=this,s=void 0,u=function(){var o,s,a,u,c,h,f,l;return R(this,(function(d){switch(d.label){case 0:o=!1,d.label=1;case 1:d.trys.push([1,6,7,12]),t=G(e),d.label=2;case 2:return[4,t.next()];case 3:if((r=d.sent()).done)return[3,5];if(a=r.value,o)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{s=this.doDecodeSync(),o=!0}catch(e){if(!(e instanceof $))throw e}this.totalPos+=this.pos,d.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return u=d.sent(),n={error:u},[3,12];case 7:return d.trys.push([7,,10,11]),r&&!r.done&&(i=t.return)?[4,i.call(t)]:[3,9];case 8:d.sent(),d.label=9;case 9:return[3,11];case 10:if(n)throw n.error;return[7];case 11:return[7];case 12:if(o){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,s]}throw h=(c=this).headByte,f=c.pos,l=c.totalPos,new RangeError("Insufficient data in parsing ".concat(N(h)," at ").concat(l," (").concat(f," in the current buffer)"))}}))},new((a=void 0)||(a=Promise))((function(e,t){function r(e){try{i(u.next(e))}catch(e){t(e)}}function n(e){try{i(u.throw(e))}catch(e){t(e)}}function i(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(r,n)}i((u=u.apply(o,s||[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return q(this,arguments,(function(){var r,n,i,o,s,a,u,c,h;return R(this,(function(f){switch(f.label){case 0:r=t,n=-1,f.label=1;case 1:f.trys.push([1,13,14,19]),i=G(e),f.label=2;case 2:return[4,X(i.next())];case 3:if((o=f.sent()).done)return[3,12];if(s=o.value,t&&0===n)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),r&&(n=this.readArraySize(),r=!1,this.complete()),f.label=4;case 4:f.trys.push([4,9,,10]),f.label=5;case 5:return[4,X(this.doDecodeSync())];case 6:return[4,f.sent()];case 7:return f.sent(),0==--n?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=f.sent())instanceof $))throw a;return[3,10];case 10:this.totalPos+=this.pos,f.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return u=f.sent(),c={error:u},[3,19];case 14:return f.trys.push([14,,17,18]),o&&!o.done&&(h=i.return)?[4,X(h.call(i))]:[3,16];case 15:f.sent(),f.label=16;case 16:return[3,18];case 17:if(c)throw c.error;return[7];case 18:return[7];case 19:return[2]}}))}))},e.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){if(0!=(n=e-128)){this.pushMapState(n),this.complete();continue e}t={}}else if(e<160){if(0!=(n=e-144)){this.pushArrayState(n),this.complete();continue e}t=[]}else{var r=e-160;t=this.decodeUtf8String(r,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.readI64();else if(217===e)r=this.lookU8(),t=this.decodeUtf8String(r,1);else if(218===e)r=this.lookU16(),t=this.decodeUtf8String(r,2);else if(219===e)r=this.lookU32(),t=this.decodeUtf8String(r,4);else if(220===e){if(0!==(n=this.readU16())){this.pushArrayState(n),this.complete();continue e}t=[]}else if(221===e){if(0!==(n=this.readU32())){this.pushArrayState(n),this.complete();continue e}t=[]}else if(222===e){if(0!==(n=this.readU16())){this.pushMapState(n),this.complete();continue e}t={}}else if(223===e){if(0!==(n=this.readU32())){this.pushMapState(n),this.complete();continue e}t={}}else if(196===e){var n=this.lookU8();t=this.decodeBinary(n,1)}else if(197===e)n=this.lookU16(),t=this.decodeBinary(n,2);else if(198===e)n=this.lookU32(),t=this.decodeBinary(n,4);else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e)n=this.lookU8(),t=this.decodeExtension(n,1);else if(200===e)n=this.lookU16(),t=this.decodeExtension(n,2);else{if(201!==e)throw new E("Unrecognized type byte: ".concat(N(e)));n=this.lookU32(),t=this.decodeExtension(n,4)}this.complete();for(var i=this.stack;i.length>0;){var o=i[i.length-1];if(o.type===J){if(o.array[o.position]=t,o.position++,o.position!==o.size)continue e;i.pop(),t=o.array}else{if(o.type===Q){if(void 0,"string"!=(s=typeof t)&&"number"!==s)throw new E("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new E("The key __proto__ is not allowed");o.key=t,o.type="map_value";continue e}if(o.map[o.key]=t,o.readCount++,o.readCount!==o.size){o.key=null,o.type=Q;continue e}i.pop(),t=o.map}}return t}var s},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new E("Unrecognized array type byte: ".concat(N(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new E("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:Q,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new E("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:J,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var r;if(e>this.maxStrLength)throw new E("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLength<this.pos+t+e)throw ee;var n,i=this.pos+t;return n=this.stateIsMapKey()&&(null===(r=this.keyDecoder)||void 0===r?void 0:r.canBeCached(e))?this.keyDecoder.decode(this.bytes,i,e):e>U?m(this.bytes,i,e):b(this.bytes,i,e),this.pos+=t+e,n},e.prototype.stateIsMapKey=function(){return this.stack.length>0&&this.stack[this.stack.length-1].type===Q},e.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new E("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw ee;var r=this.pos+t,n=this.bytes.subarray(r,r+e);return this.pos+=t+e,n},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new E("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var r=this.view.getInt8(this.pos+t),n=this.decodeBinary(e,t+1);return this.extensionCodec.decode(n,r,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e=s(this.view,this.pos);return this.pos+=8,e},e.prototype.readI64=function(){var e=o(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}(),ne=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},ie=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},oe=function(e){return this instanceof oe?(this.v=e,this):new oe(e)},se=function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),o=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(e){i[e]&&(n[e]=function(t){return new Promise((function(r,n){o.push([e,t,r,n])>1||a(e,t)}))})}function a(e,t){try{(r=i[e](t)).value instanceof oe?Promise.resolve(r.value.v).then(u,c):h(o[0][2],r)}catch(e){h(o[0][3],e)}var r}function u(e){a("next",e)}function c(e){a("throw",e)}function h(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}},ae="array",ue="map_key",ce=new DataView(new ArrayBuffer(0)),he=function(){try{ce.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),fe=new H,le=new he("Insufficient data"),de=function(){function e(e,t,n,i,o,s,a,u,c,h){void 0===t&&(t=M.defaultCodec),void 0===n&&(n=void 0),void 0===i&&(i=r),void 0===o&&(o=r),void 0===s&&(s=r),void 0===a&&(a=r),void 0===u&&(u=r),void 0===c&&(c=fe),void 0===h&&(h=2048),this.readIterable=e,this.extensionCodec=t,this.context=n,this.maxStrLength=i,this.maxBinLength=o,this.maxArrayLength=s,this.maxMapLength=a,this.maxExtLength=u,this.keyDecoder=c,this.bufferSize=h,this.headByte=-1,this.stack=[],this.buffer=null,this.readStream=e[Symbol.asyncIterator]()}return e.prototype.reinitializeState=function(){this.headByte=-1,this.stack.length=0},e.prototype.createExtraByteError=function(){return new RangeError("Extra bytes found")},e.prototype.decode=function(){return this.reinitializeState(),this.doDecodeSync()},e.prototype.decodeMulti=function(){return se(this,arguments,(function(){return ie(this,(function(e){switch(e.label){case 0:this.reinitializeState(),e.label=1;case 1:return[4,oe(this.doDecodeSync())];case 2:return[4,oe.apply(void 0,[e.sent()])];case 3:return[4,e.sent()];case 4:return e.sent(),[3,1];case 5:return[2]}}))}))},e.prototype.doDecodeSync=function(){var e,t,r,n,i,o,s,a,u,c,h,f,l,d,y,p,w,v,b,g,U,m,x,B,S,I,L,F;return ne(this,void 0,void 0,(function(){var T,A,k,D,M,z,O,C,V,_,j,P,W,K,H,R,G,X,q,J,Q,Y,Z,$,ee,te,re,ne,oe,se,ce,he,fe,le;return ie(this,(function(ie){switch(ie.label){case 0:return null===(e=this.readHeadByteFromBuffer())||void 0===e?[3,1]:(A=e,[3,3]);case 1:return[4,this.readHeadByte()];case 2:A=ie.sent(),ie.label=3;case 3:return k=void 0,(T=A)>=224?(k=T-256,[3,133]):[3,4];case 4:return T<192?T<128?(k=T,[3,11]):[3,5]:[3,12];case 5:return T<144?0!=(ce=T-128)?(this.pushMapState(ce),this.complete(),[3,0]):(k={},[3,11]):[3,6];case 6:return T<160?0!=(ce=T-144)?(this.pushArrayState(ce),this.complete(),[3,0]):(k=[],[3,11]):[3,7];case 7:return q=T-160,null===(t=this.decodeUtf8StringFromBuffer(q))||void 0===t?[3,8]:(D=t,[3,10]);case 8:return[4,this.decodeUtf8String(q)];case 9:D=ie.sent(),ie.label=10;case 10:k=D,ie.label=11;case 11:return[3,133];case 12:return 192!==T?[3,13]:(k=null,[3,133]);case 13:return 194!==T?[3,14]:(k=!1,[3,133]);case 14:return 195!==T?[3,15]:(k=!0,[3,133]);case 15:return 202!==T?[3,19]:null===(r=this.readF32FromBuffer())||void 0===r?[3,16]:(M=r,[3,18]);case 16:return[4,this.readF32()];case 17:M=ie.sent(),ie.label=18;case 18:return k=M,[3,133];case 19:return 203!==T?[3,23]:null===(n=this.readF64FromBuffer())||void 0===n?[3,20]:(z=n,[3,22]);case 20:return[4,this.readF64()];case 21:z=ie.sent(),ie.label=22;case 22:return k=z,[3,133];case 23:return 204!==T?[3,27]:null===(i=this.readU8FromBuffer())||void 0===i?[3,24]:(O=i,[3,26]);case 24:return[4,this.readU8()];case 25:O=ie.sent(),ie.label=26;case 26:return k=O,[3,133];case 27:return 205!==T?[3,31]:null===(o=this.readU16FromBuffer())||void 0===o?[3,28]:(C=o,[3,30]);case 28:return[4,this.readU16()];case 29:C=ie.sent(),ie.label=30;case 30:return k=C,[3,133];case 31:return 206!==T?[3,35]:null===(s=this.readU32FromBuffer())||void 0===s?[3,32]:(V=s,[3,34]);case 32:return[4,this.readU32()];case 33:V=ie.sent(),ie.label=34;case 34:return k=V,[3,133];case 35:return 207!==T?[3,39]:null===(a=this.readU64FromBuffer())||void 0===a?[3,36]:(_=a,[3,38]);case 36:return[4,this.readU64()];case 37:_=ie.sent(),ie.label=38;case 38:return k=_,[3,133];case 39:return 208!==T?[3,43]:null===(u=this.readI8FromBuffer())||void 0===u?[3,40]:(j=u,[3,42]);case 40:return[4,this.readI8()];case 41:j=ie.sent(),ie.label=42;case 42:return k=j,[3,133];case 43:return 209!==T?[3,47]:null===(c=this.readI16FromBuffer())||void 0===c?[3,44]:(P=c,[3,46]);case 44:return[4,this.readI16()];case 45:P=ie.sent(),ie.label=46;case 46:return k=P,[3,133];case 47:return 210!==T?[3,51]:null===(h=this.readI32FromBuffer())||void 0===h?[3,48]:(W=h,[3,50]);case 48:return[4,this.readI32()];case 49:W=ie.sent(),ie.label=50;case 50:return k=W,[3,133];case 51:return 211!==T?[3,55]:null===(f=this.readI64FromBuffer())||void 0===f?[3,52]:(K=f,[3,54]);case 52:return[4,this.readI64()];case 53:K=ie.sent(),ie.label=54;case 54:return k=K,[3,133];case 55:return 217!==T?[3,62]:null===(l=this.readU8FromBuffer())||void 0===l?[3,56]:(H=l,[3,58]);case 56:return[4,this.readU8()];case 57:H=ie.sent(),ie.label=58;case 58:return q=H,null===(d=this.decodeUtf8StringFromBuffer(q))||void 0===d?[3,59]:(R=d,[3,61]);case 59:return[4,this.decodeUtf8String(q)];case 60:R=ie.sent(),ie.label=61;case 61:return k=R,[3,133];case 62:return 218!==T?[3,69]:null===(y=this.readU16FromBuffer())||void 0===y?[3,63]:(G=y,[3,65]);case 63:return[4,this.readU16()];case 64:G=ie.sent(),ie.label=65;case 65:return q=G,null===(p=this.decodeUtf8StringFromBuffer(q))||void 0===p?[3,66]:(X=p,[3,68]);case 66:return[4,this.decodeUtf8String(q)];case 67:X=ie.sent(),ie.label=68;case 68:return k=X,[3,133];case 69:return 219!==T?[3,76]:null===(w=this.readU32FromBuffer())||void 0===w?[3,70]:(J=w,[3,72]);case 70:return[4,this.readU32()];case 71:J=ie.sent(),ie.label=72;case 72:return q=J,null===(v=this.decodeUtf8StringFromBuffer(q))||void 0===v?[3,73]:(Q=v,[3,75]);case 73:return[4,this.decodeUtf8String(q)];case 74:Q=ie.sent(),ie.label=75;case 75:return k=Q,[3,133];case 76:return 220!==T?[3,80]:null===(b=this.readU16FromBuffer())||void 0===b?[3,77]:(Y=b,[3,79]);case 77:return[4,this.readU16()];case 78:Y=ie.sent(),ie.label=79;case 79:return 0!==(ce=Y)?(this.pushArrayState(ce),this.complete(),[3,0]):(k=[],[3,133]);case 80:return 221!==T?[3,84]:null===(g=this.readU32FromBuffer())||void 0===g?[3,81]:(Z=g,[3,83]);case 81:return[4,this.readU32()];case 82:Z=ie.sent(),ie.label=83;case 83:return 0!==(ce=Z)?(this.pushArrayState(ce),this.complete(),[3,0]):(k=[],[3,133]);case 84:return 222!==T?[3,88]:null===(U=this.readU16FromBuffer())||void 0===U?[3,85]:($=U,[3,87]);case 85:return[4,this.readU16()];case 86:$=ie.sent(),ie.label=87;case 87:return 0!==(ce=$)?(this.pushMapState(ce),this.complete(),[3,0]):(k={},[3,133]);case 88:return 223!==T?[3,92]:null===(m=this.readU32FromBuffer())||void 0===m?[3,89]:(ee=m,[3,91]);case 89:return[4,this.readU32()];case 90:ee=ie.sent(),ie.label=91;case 91:return 0!==(ce=ee)?(this.pushMapState(ce),this.complete(),[3,0]):(k={},[3,133]);case 92:return 196!==T?[3,97]:null===(x=this.readU8FromBuffer())||void 0===x?[3,93]:(te=x,[3,95]);case 93:return[4,this.readU8()];case 94:te=ie.sent(),ie.label=95;case 95:return ce=te,[4,this.decodeBinary(ce)];case 96:return k=ie.sent(),[3,133];case 97:return 197!==T?[3,102]:null===(B=this.readU16FromBuffer())||void 0===B?[3,98]:(re=B,[3,100]);case 98:return[4,this.readU16()];case 99:re=ie.sent(),ie.label=100;case 100:return ce=re,[4,this.decodeBinary(ce)];case 101:return k=ie.sent(),[3,133];case 102:return 198!==T?[3,107]:null===(S=this.readU32FromBuffer())||void 0===S?[3,103]:(ne=S,[3,105]);case 103:return[4,this.readU32()];case 104:ne=ie.sent(),ie.label=105;case 105:return ce=ne,[4,this.decodeBinary(ce)];case 106:return k=ie.sent(),[3,133];case 107:return 212!==T?[3,109]:[4,this.decodeExtension(1)];case 108:return k=ie.sent(),[3,133];case 109:return 213!==T?[3,111]:[4,this.decodeExtension(2)];case 110:return k=ie.sent(),[3,133];case 111:return 214!==T?[3,113]:[4,this.decodeExtension(4)];case 112:return k=ie.sent(),[3,133];case 113:return 215!==T?[3,115]:[4,this.decodeExtension(8)];case 114:return k=ie.sent(),[3,133];case 115:return 216!==T?[3,117]:[4,this.decodeExtension(16)];case 116:return k=ie.sent(),[3,133];case 117:return 199!==T?[3,122]:null===(I=this.readU8FromBuffer())||void 0===I?[3,118]:(oe=I,[3,120]);case 118:return[4,this.readU8()];case 119:oe=ie.sent(),ie.label=120;case 120:return ce=oe,[4,this.decodeExtension(ce)];case 121:return k=ie.sent(),[3,133];case 122:return 200!==T?[3,127]:null===(L=this.readU16FromBuffer())||void 0===L?[3,123]:(se=L,[3,125]);case 123:return[4,this.readU16()];case 124:se=ie.sent(),ie.label=125;case 125:return ce=se,[4,this.decodeExtension(ce)];case 126:return k=ie.sent(),[3,133];case 127:return 201!==T?[3,132]:null===(F=this.readU32FromBuffer())||void 0===F?[3,128]:(he=F,[3,130]);case 128:return[4,this.readU32()];case 129:he=ie.sent(),ie.label=130;case 130:return ce=he,[4,this.decodeExtension(ce)];case 131:return k=ie.sent(),[3,133];case 132:throw new E("Unrecognized type byte: ".concat(N(T)));case 133:for(this.complete(),fe=this.stack;fe.length>0;)if((le=fe[fe.length-1]).type===ae){if(le.array[le.position]=k,le.position++,le.position!==le.size)return[3,0];fe.pop(),k=le.array}else{if(le.type===ue){if(void 0,"string"!=(de=typeof k)&&"number"!==de)throw new E("The type of key must be string or number but "+typeof k);if("__proto__"===k)throw new E("The key __proto__ is not allowed");return le.key=k,le.type="map_value",[3,0]}if(le.map[le.key]=k,le.readCount++,le.readCount!==le.size)return le.key=null,le.type=ue,[3,0];fe.pop(),k=le.map}return[2,k];case 134:return[2]}var de}))}))},e.prototype.readHeadByteFromBuffer=function(){var e=this.readU8FromBuffer();return null===e?null:(-1===this.headByte&&(this.headByte=e),this.headByte)},e.prototype.readHeadByte=function(){return ne(this,void 0,void 0,(function(){var e;return ie(this,(function(t){switch(t.label){case 0:return-1!==this.headByte?[3,2]:(e=this,[4,this.readU8()]);case 1:e.headByte=t.sent(),t.label=2;case 2:return[2,this.headByte]}}))}))},e.prototype.complete=function(){this.headByte=-1},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new E("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:ue,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new E("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:ae,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8StringFromBuffer=function(e){var t;if(e>this.maxStrLength)throw new E("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));var r=this.readBytesFromBuffer(e);return null===r?null:this.stateIsMapKey()&&(null===(t=this.keyDecoder)||void 0===t?void 0:t.canBeCached(e))?this.keyDecoder.decode(r,0,e):e>U?m(r,0,e):b(r,0,e)},e.prototype.decodeUtf8String=function(e){var t;return ne(this,void 0,void 0,(function(){var r;return ie(this,(function(n){switch(n.label){case 0:if(e>this.maxStrLength)throw new E("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));return[4,this.readBytes(e)];case 1:return r=n.sent(),[2,this.stateIsMapKey()&&(null===(t=this.keyDecoder)||void 0===t?void 0:t.canBeCached(e))?this.keyDecoder.decode(r,0,e):e>U?m(r,0,e):b(r,0,e)]}}))}))},e.prototype.stateIsMapKey=function(){return this.stack.length>0&&this.stack[this.stack.length-1].type===ue},e.prototype.decodeBinary=function(e){return ne(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:if(e>this.maxBinLength)throw new E("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));return[4,this.readBytes(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.decodeExtension=function(e){return ne(this,void 0,void 0,(function(){var t,r;return ie(this,(function(n){switch(n.label){case 0:if(e>this.maxExtLength)throw new E("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));return[4,this.readI8()];case 1:return t=n.sent(),[4,this.decodeBinary(e)];case 2:return r=n.sent(),[2,this.extensionCodec.decode(r,t,this.context)]}}))}))},e.prototype.readU8=function(){return ne(this,void 0,void 0,(function(){var e;return ie(this,(function(t){switch(t.label){case 0:return[4,this.readBytes(1)];case 1:return e=t.sent(),[2,new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0)]}}))}))},e.prototype.readI8=function(){return ne(this,void 0,void 0,(function(){var e;return ie(this,(function(t){switch(t.label){case 0:return[4,this.readBytes(1)];case 1:return e=t.sent(),[2,new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0)]}}))}))},e.prototype.readU16=function(){return ne(this,void 0,void 0,(function(){var e;return ie(this,(function(t){switch(t.label){case 0:return[4,this.readBytes(2)];case 1:return e=t.sent(),[2,new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(0)]}}))}))},e.prototype.readI16=function(){return ne(this,void 0,void 0,(function(){var e;return ie(this,(function(t){switch(t.label){case 0:return[4,this.readBytes(2)];case 1:return e=t.sent(),[2,new DataView(e.buffer,e.byteOffset,e.byteLength).getInt16(0)]}}))}))},e.prototype.readU32=function(){return ne(this,void 0,void 0,(function(){var e;return ie(this,(function(t){switch(t.label){case 0:return[4,this.readBytes(4)];case 1:return e=t.sent(),[2,new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0)]}}))}))},e.prototype.readI32=function(){return ne(this,void 0,void 0,(function(){var e;return ie(this,(function(t){switch(t.label){case 0:return[4,this.readBytes(4)];case 1:return e=t.sent(),[2,new DataView(e.buffer,e.byteOffset,e.byteLength).getInt32(0)]}}))}))},e.prototype.readU64=function(){return ne(this,void 0,void 0,(function(){var e;return ie(this,(function(t){switch(t.label){case 0:return[4,this.readBytes(8)];case 1:return e=t.sent(),[2,s(new DataView(e.buffer,e.byteOffset,e.byteLength),0)]}}))}))},e.prototype.readI64=function(){return ne(this,void 0,void 0,(function(){var e;return ie(this,(function(t){switch(t.label){case 0:return[4,this.readBytes(8)];case 1:return e=t.sent(),[2,o(new DataView(e.buffer,e.byteOffset,e.byteLength),0)]}}))}))},e.prototype.readF32=function(){return ne(this,void 0,void 0,(function(){var e;return ie(this,(function(t){switch(t.label){case 0:return[4,this.readBytes(4)];case 1:return e=t.sent(),[2,new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(0)]}}))}))},e.prototype.readF64=function(){return ne(this,void 0,void 0,(function(){var e;return ie(this,(function(t){switch(t.label){case 0:return[4,this.readBytes(8)];case 1:return e=t.sent(),[2,new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(0)]}}))}))},e.prototype.readU8FromBuffer=function(){var e=this.readBytesFromBuffer(1);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0):null},e.prototype.readI8FromBuffer=function(){var e=this.readBytesFromBuffer(1);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0):null},e.prototype.readU16FromBuffer=function(){var e=this.readBytesFromBuffer(2);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(0):null},e.prototype.readI16FromBuffer=function(){var e=this.readBytesFromBuffer(2);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getInt16(0):null},e.prototype.readU32FromBuffer=function(){var e=this.readBytesFromBuffer(4);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0):null},e.prototype.readI32FromBuffer=function(){var e=this.readBytesFromBuffer(4);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getInt32(0):null},e.prototype.readU64FromBuffer=function(){var e=this.readBytesFromBuffer(8);return e?s(new DataView(e.buffer,e.byteOffset,e.byteLength),0):null},e.prototype.readI64FromBuffer=function(){var e=this.readBytesFromBuffer(8);return e?o(new DataView(e.buffer,e.byteOffset,e.byteLength),0):null},e.prototype.readF32FromBuffer=function(){var e=this.readBytesFromBuffer(4);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(0):null},e.prototype.readF64FromBuffer=function(){var e=this.readBytesFromBuffer(8);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(0):null},e.prototype.readBytesFromBuffer=function(e){if(this.buffer&&this.buffer.length>=e){var t=this.buffer.subarray(0,e);return this.buffer=this.buffer.subarray(e),t}return null},e.prototype.readBytes=function(e){var t,r;return ne(this,void 0,void 0,(function(){var n,i,o,s;return ie(this,(function(a){switch(a.label){case 0:return this.buffer&&e<=this.buffer.length?(o=this.buffer.subarray(0,e),this.buffer=this.buffer.subarray(e),[2,o]):[3,1];case 1:return n=null!==(r=null===(t=this.buffer)||void 0===t?void 0:t.length)&&void 0!==r?r:0,i=e-n,o=new Uint8Array(e),this.buffer&&o.set(this.buffer,0),i<this.bufferSize?[4,this.readToBuffer(this.bufferSize)]:[3,3];case 2:if((s=a.sent()).length<i)throw le;return o.set(s.subarray(0,i),n),this.buffer=this.buffer.subarray(i),[3,5];case 3:return[4,this.readToBuffer(i)];case 4:if((s=a.sent()).length<i)throw le;o.set(s,n),this.buffer=new Uint8Array,a.label=5;case 5:return[2,o]}}))}))},e.prototype.readToBuffer=function(e){return ne(this,void 0,void 0,(function(){var t,r,n,i,o,s,a,u,c;return ie(this,(function(h){switch(h.label){case 0:t=[],r=0,h.label=1;case 1:return r<e?[4,this.readStream.next(this.bufferSize)]:[3,3];case 2:return(n=h.sent()).done?[3,3]:(t.push(n.value),r+=n.value.length,[3,1]);case 3:if(1==t.length)return this.buffer=t[0],[2,t[0]];this.buffer=new Uint8Array(r),i=0;try{for(o=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(t),s=o.next();!s.done;s=o.next())a=s.value,this.buffer.set(a,i),i+=a.length}catch(e){u={error:e}}finally{try{s&&!s.done&&(c=o.return)&&c.call(o)}finally{if(u)throw u.error}}return[2,this.buffer]}}))}))},e}(),ye={};function pe(e,t){return void 0===t&&(t=ye),new re(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decode(e)}function we(e,t){return void 0===t&&(t=ye),new re(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeMulti(e)}function ve(e,t){return void 0===t&&(t=ye),new de(e,t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decode()}var be=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ge=function(e){return this instanceof ge?(this.v=e,this):new ge(e)},Ue=function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),o=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(e){i[e]&&(n[e]=function(t){return new Promise((function(r,n){o.push([e,t,r,n])>1||a(e,t)}))})}function a(e,t){try{(r=i[e](t)).value instanceof ge?Promise.resolve(r.value.v).then(u,c):h(o[0][2],r)}catch(e){h(o[0][3],e)}var r}function u(e){a("next",e)}function c(e){a("throw",e)}function h(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}};function me(e){if(null==e)throw new Error("Assertion Failure: value must not be null nor undefined")}function xe(e){return null!=e[Symbol.asyncIterator]?e:function(e){return Ue(this,arguments,(function(){var t,r,n,i;return be(this,(function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,ge(t.read())];case 3:return r=o.sent(),n=r.done,i=r.value,n?[4,ge(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return me(i),[4,ge(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}(e)}function Be(e,t){return void 0===t&&(t=ye),r=this,n=void 0,o=function(){var r;return function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(n){return r=xe(e),[2,new re(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeAsync(r)]}))},new((i=void 0)||(i=Promise))((function(e,t){function s(e){try{u(o.next(e))}catch(e){t(e)}}function a(e){try{u(o.throw(e))}catch(e){t(e)}}function u(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(s,a)}u((o=o.apply(r,n||[])).next())}));var r,n,i,o}function Se(e,t){void 0===t&&(t=ye);var r=xe(e);return new re(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeArrayStream(r)}function Ee(e,t){void 0===t&&(t=ye);var r=xe(e);return new re(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeStream(r)}return t})())); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MessagePack=t():e.MessagePack=t()}(this,(()=>(()=>{"use strict";var e={d:(t,i)=>{for(var r in i)e.o(i,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:i[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{DataViewIndexOutOfBoundsError:()=>H,DecodeError:()=>v,Decoder:()=>G,EXT_TIMESTAMP:()=>B,Encoder:()=>D,ExtData:()=>b,ExtensionCodec:()=>A,decode:()=>oe,decodeArrayStream:()=>ye,decodeAsync:()=>le,decodeMulti:()=>he,decodeMultiStream:()=>we,decodeStream:()=>ae,decodeTimestampExtension:()=>E,decodeTimestampToTimeSpec:()=>L,encode:()=>k,encodeDateToTimeSpec:()=>S,encodeStream:()=>$,encodeTimeSpecToTimestamp:()=>x,encodeTimestampExtension:()=>I});const i=4294967295;function r(e,t,i){const r=i/4294967296,n=i;e.setUint32(t,r),e.setUint32(t+4,n)}function n(e,t,i){const r=Math.floor(i/4294967296),n=i;e.setUint32(t,r),e.setUint32(t+4,n)}function s(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}function o(e,t){return 4294967296*e.getUint32(t)+e.getUint32(t+4)}var h,a,f;const d=("undefined"==typeof process||"never"!==(null===(h=null===process||void 0===process?void 0:process.env)||void 0===h?void 0:h.TEXT_ENCODING))&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function c(e){const t=e.length;let i=0,r=0;for(;r<t;){let n=e.charCodeAt(r++);if(0!=(4294967168&n))if(0==(4294965248&n))i+=2;else{if(n>=55296&&n<=56319&&r<t){const t=e.charCodeAt(r);56320==(64512&t)&&(++r,n=((1023&n)<<10)+(1023&t)+65536)}i+=0==(4294901760&n)?3:4}else i++}return i}function u(e,t,i){const r=e.length;let n=i,s=0;for(;s<r;){let i=e.charCodeAt(s++);if(0!=(4294967168&i)){if(0==(4294965248&i))t[n++]=i>>6&31|192;else{if(i>=55296&&i<=56319&&s<r){const t=e.charCodeAt(s);56320==(64512&t)&&(++s,i=((1023&i)<<10)+(1023&t)+65536)}0==(4294901760&i)?(t[n++]=i>>12&15|224,t[n++]=i>>6&63|128):(t[n++]=i>>18&7|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128)}t[n++]=63&i|128}else t[n++]=i}}const l=d?new TextEncoder:void 0,y=d?"undefined"!=typeof process&&"force"!==(null===(a=null===process||void 0===process?void 0:process.env)||void 0===a?void 0:a.TEXT_ENCODING)?200:0:i,w=(null==l?void 0:l.encodeInto)?function(e,t,i){l.encodeInto(e,t.subarray(i))}:function(e,t,i){t.set(l.encode(e),i)};function g(e,t,i){let r=t;const n=r+i,s=[];let o="";for(;r<n;){const t=e[r++];if(0==(128&t))s.push(t);else if(192==(224&t)){const i=63&e[r++];s.push((31&t)<<6|i)}else if(224==(240&t)){const i=63&e[r++],n=63&e[r++];s.push((31&t)<<12|i<<6|n)}else if(240==(248&t)){let i=(7&t)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++];i>65535&&(i-=65536,s.push(i>>>10&1023|55296),i=56320|1023&i),s.push(i)}else s.push(t);s.length>=4096&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const p=d?new TextDecoder:null,U=d?"undefined"!=typeof process&&"force"!==(null===(f=null===process||void 0===process?void 0:process.env)||void 0===f?void 0:f.TEXT_DECODER)?200:0:i;function m(e,t,i){const r=e.subarray(t,t+i);return p.decode(r)}class b{constructor(e,t){this.type=e,this.data=t}}class v extends Error{constructor(e){super(e);const t=Object.create(v.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:v.name})}}const B=-1;function x({sec:e,nsec:t}){if(e>=0&&t>=0&&e<=17179869183){if(0===t&&e<=4294967295){const t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e),t}{const i=e/4294967296,r=4294967295&e,n=new Uint8Array(8),s=new DataView(n.buffer);return s.setUint32(0,t<<2|3&i),s.setUint32(4,r),n}}{const i=new Uint8Array(12),r=new DataView(i.buffer);return r.setUint32(0,t),n(r,4,e),i}}function S(e){const t=e.getTime(),i=Math.floor(t/1e3),r=1e6*(t-1e3*i),n=Math.floor(r/1e9);return{sec:i+n,nsec:r-1e9*n}}function I(e){return e instanceof Date?x(S(e)):null}function L(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0);return{sec:4294967296*(3&e)+t.getUint32(4),nsec:e>>>2}}case 12:return{sec:s(t,4),nsec:t.getUint32(0)};default:throw new v(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${e.length}`)}}function E(e){const t=L(e);return new Date(1e3*t.sec+t.nsec/1e6)}const F={type:B,encode:I,decode:E};class A{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(F)}register({type:e,encode:t,decode:i}){if(e>=0)this.encoders[e]=t,this.decoders[e]=i;else{const r=1+e;this.builtInEncoders[r]=t,this.builtInDecoders[r]=i}}tryToEncode(e,t){for(let i=0;i<this.builtInEncoders.length;i++){const r=this.builtInEncoders[i];if(null!=r){const n=r(e,t);if(null!=n)return new b(-1-i,n)}}for(let i=0;i<this.encoders.length;i++){const r=this.encoders[i];if(null!=r){const n=r(e,t);if(null!=n)return new b(i,n)}}return e instanceof b?e:null}decode(e,t,i){const r=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return r?r(e,t,i):new b(t,e)}}function T(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?new Uint8Array(e):Uint8Array.from(e)}A.defaultCodec=new A;class D{constructor(e=A.defaultCodec,t,i=100,r=2048,n=!1,s=!1,o=!1,h=!1){this.extensionCodec=e,this.context=t,this.maxDepth=i,this.initialBufferSize=r,this.sortKeys=n,this.forceFloat32=s,this.ignoreUndefined=o,this.forceIntegerToFloat=h,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}reinitializeState(){this.pos=0}encodeSharedRef(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}encode(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}doEncode(e,t){if(t>this.maxDepth)throw new Error(`Too deep objects in depth ${t}`);null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)}ensureBufferSizeToWrite(e){const t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(2*t)}resizeBuffer(e){const t=new ArrayBuffer(e),i=new Uint8Array(t),r=new DataView(t);i.set(this.bytes),this.view=r,this.bytes=i}encodeNil(){this.writeU8(192)}encodeBoolean(e){!1===e?this.writeU8(194):this.writeU8(195)}encodeNumber(e){Number.isSafeInteger(e)&&!this.forceIntegerToFloat?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error(`Too long string: ${e} bytes in UTF-8`);this.writeU8(219),this.writeU32(e)}}encodeString(e){if(e.length>y){const t=c(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),w(e,this.bytes,this.pos),this.pos+=t}else{const t=c(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),u(e,this.bytes,this.pos),this.pos+=t}}encodeObject(e,t){const i=this.extensionCodec.tryToEncode(e,this.context);if(null!=i)this.encodeExtension(i);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`);this.encodeMap(e,t)}}encodeBinary(e){const t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error(`Too large binary: ${t}`);this.writeU8(198),this.writeU32(t)}const i=T(e);this.writeU8a(i)}encodeArray(e,t){const i=e.length;if(i<16)this.writeU8(144+i);else if(i<65536)this.writeU8(220),this.writeU16(i);else{if(!(i<4294967296))throw new Error(`Too large array: ${i}`);this.writeU8(221),this.writeU32(i)}for(const i of e)this.doEncode(i,t+1)}countWithoutUndefined(e,t){let i=0;for(const r of t)void 0!==e[r]&&i++;return i}encodeMap(e,t){const i=Object.keys(e);this.sortKeys&&i.sort();const r=this.ignoreUndefined?this.countWithoutUndefined(e,i):i.length;if(r<16)this.writeU8(128+r);else if(r<65536)this.writeU8(222),this.writeU16(r);else{if(!(r<4294967296))throw new Error(`Too large map object: ${r}`);this.writeU8(223),this.writeU32(r)}for(const r of i){const i=e[r];this.ignoreUndefined&&void 0===i||(this.encodeString(r),this.doEncode(i,t+1))}}encodeExtension(e){const t=e.data.length;if(1===t)this.writeU8(212);else if(2===t)this.writeU8(213);else if(4===t)this.writeU8(214);else if(8===t)this.writeU8(215);else if(16===t)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else{if(!(t<4294967296))throw new Error(`Too large extension object: ${t}`);this.writeU8(201),this.writeU32(t)}this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),r(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),n(this.view,this.pos,e),this.pos+=8}}class M{constructor(e=A.defaultCodec,t,i=100,r=2048,n=!1,s=!1,o=!1,h=!1){this.extensionCodec=e,this.context=t,this.maxDepth=i,this.bufferSize=r,this.sortKeys=n,this.forceFloat32=s,this.ignoreUndefined=o,this.forceIntegerToFloat=h,this.view=new DataView(new ArrayBuffer(2048)),this.bytes=new Uint8Array(this.view.buffer)}*encode(e){const t=new Uint8Array(this.bufferSize);let i=0;for(let r of this.doEncode(e,1))if(r.length>=t.length)i>=0&&(yield t.slice(0,i)),i=0,yield r.slice(0,i);else for(;r.length>0;){const e=Math.min(t.length-i,r.length),n=r.subarray(0,e);t.set(n,i),i+=n.length,i===t.length&&(yield t.slice(),i=0),r=r.subarray(e,r.length)}i>=0&&(yield t.subarray(0,i))}doEncode(e,t){if(t>this.maxDepth)throw new Error(`Too deep objects in depth ${t}`);return null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)}ensureBufferSizeToWrite(e){this.view.byteLength<e&&this.resizeBuffer(2*this.view.byteLength)}resizeBuffer(e){const t=new ArrayBuffer(e),i=new Uint8Array(t),r=new DataView(t);this.view=r,this.bytes=i}encodeNil(){return this.writeU8(192)}encodeBoolean(e){return!1===e?this.writeU8(194):this.writeU8(195)}encodeNumber(e){return Number.isSafeInteger(e)&&!this.forceIntegerToFloat?e>=0?e<128?this.writeU8(e):e<256?this.writeU8U8(204,e):e<65536?this.writeU8U16(205,e):e<4294967296?this.writeU8U32(206,e):this.writeU8U64(207,e):e>=-32?this.writeU8(224|e+32):e>=-128?this.writeU8I8(208,e):e>=-32768?this.writeU8I16(209,e):e>=-2147483648?this.writeU8I32(210,e):this.writeU8I64(211,e):this.forceFloat32?this.writeU8F32(202,e):this.writeU8F64(203,e)}buildStringHeader(e){if(e<32)return[160+e];if(e<256)return[217,e];if(e<65536){const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,218),t.setUint16(1,e),new Uint8Array(t.buffer)}if(e<4294967296){const t=new DataView(new ArrayBuffer(5));return t.setUint8(0,219),t.setUint32(1,e),new Uint8Array(t.buffer)}throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){if(e.length>y){const t=c(e);this.ensureBufferSizeToWrite(5+t);const i=this.buildStringHeader(t);return this.bytes.set(i,0),w(e,this.bytes,i.length),this.writeBuffer(t+i.length)}{const t=c(e);this.ensureBufferSizeToWrite(5+t);const i=this.buildStringHeader(t);return this.bytes.set(i,0),u(e,this.bytes,i.length),this.writeBuffer(t+i.length)}}encodeObject(e,t){const i=this.extensionCodec.tryToEncode(e,this.context);if(null!=i)return this.encodeExtension(i);if(Array.isArray(e))return this.encodeArray(e,t);if(ArrayBuffer.isView(e))return this.encodeBinary(e);if("object"==typeof e)return this.encodeMap(e,t);throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}*encodeBinary(e){const t=e.byteLength;if(t<256)yield*this.writeU8U8(196,t);else if(t<65536)yield*this.writeU8U16(197,t);else{if(!(t<4294967296))throw new Error(`Too large binary: ${t}`);yield*this.writeU8U32(198,t)}const i=T(e);yield*this.writeU8a(i)}*encodeArray(e,t){const i=e.length;if(i<16)yield*this.writeU8(144+i);else if(i<65536)yield*this.writeU8U16(220,i);else{if(!(i<4294967296))throw new Error(`Too large array: ${i}`);yield*this.writeU8U32(221,i)}for(const i of e)yield*this.doEncode(i,t+1)}countWithoutUndefined(e,t){let i=0;for(const r of t)void 0!==e[r]&&i++;return i}*encodeMap(e,t){const i=Object.keys(e);this.sortKeys&&i.sort();const r=this.ignoreUndefined?this.countWithoutUndefined(e,i):i.length;if(r<16)yield*this.writeU8(128+r);else if(r<65536)yield*this.writeU8U16(222,r);else{if(!(r<4294967296))throw new Error(`Too large map object: ${r}`);yield*this.writeU8U32(223,r)}for(const r of i){const i=e[r];this.ignoreUndefined&&void 0===i||(yield*this.encodeString(r),yield*this.doEncode(i,t+1))}}*encodeExtension(e){const t=e.data.length;if(1===t)yield*this.writeU8(212);else if(2===t)yield*this.writeU8(213);else if(4===t)yield*this.writeU8(214);else if(8===t)yield*this.writeU8(215);else if(16===t)yield*this.writeU8(216);else if(t<256)yield*this.writeU8U8(199,t);else if(t<65536)yield*this.writeU8U16(200,t);else{if(!(t<4294967296))throw new Error(`Too large extension object: ${t}`);yield*this.writeU8U32(201,t)}yield*this.writeI8(e.type),yield*this.writeU8a(e.data)}writeU8(e){return this.view.setUint8(0,e),this.writeBuffer(1)}writeU8a(e){const t=e.length;return this.ensureBufferSizeToWrite(t),this.bytes.set(e,0),this.writeBuffer(t)}writeI8(e){return this.view.setInt8(0,e),this.writeBuffer(1)}writeU16(e){return this.view.setUint16(0,e),this.writeBuffer(2)}writeI16(e){return this.view.setInt16(0,e),this.writeBuffer(2)}writeU32(e){return this.view.setUint32(0,e),this.writeBuffer(4)}writeI32(e){return this.view.setInt32(0,e),this.writeBuffer(4)}writeF32(e){return this.view.setFloat32(0,e),this.writeBuffer(4)}writeF64(e){return this.view.setFloat64(0,e),this.writeBuffer(8)}writeU64(e){return r(this.view,0,e),this.writeBuffer(8)}writeI64(e){return n(this.view,0,e),this.writeBuffer(8)}writeU8U8(e,t){return this.view.setUint8(0,e),this.view.setUint8(1,t),this.writeBuffer(2)}writeU8U16(e,t){return this.view.setUint8(0,e),this.view.setUint16(1,t),this.writeBuffer(3)}writeU8U32(e,t){return this.view.setUint8(0,e),this.view.setUint32(1,t),this.writeBuffer(5)}writeU8U64(e,t){return this.view.setUint8(0,e),r(this.view,1,t),this.writeBuffer(9)}writeU8I8(e,t){return this.view.setUint8(0,e),this.view.setInt8(1,t),this.writeBuffer(2)}writeU8I16(e,t){return this.view.setUint8(0,e),this.view.setInt16(1,t),this.writeBuffer(3)}writeU8I32(e,t){return this.view.setUint8(0,e),this.view.setInt32(1,t),this.writeBuffer(5)}writeU8I64(e,t){return this.view.setUint8(0,e),n(this.view,1,t),this.writeBuffer(9)}writeU8F32(e,t){return this.view.setUint8(0,e),this.view.setFloat32(1,t),this.writeBuffer(5)}writeU8F64(e,t){return this.view.setUint8(0,e),this.view.setFloat64(1,t),this.writeBuffer(9)}*writeBuffer(e){yield this.bytes.subarray(0,e)}}const z={};function k(e,t=z){return new D(t.extensionCodec,t.context,t.maxDepth,t.initialBufferSize,t.sortKeys,t.forceFloat32,t.ignoreUndefined,t.forceIntegerToFloat).encodeSharedRef(e)}function $(e,t=z){return new M(t.extensionCodec,t.context,t.maxDepth,t.streamBufferSize,t.sortKeys,t.forceFloat32,t.ignoreUndefined,t.forceIntegerToFloat).encode(e)}function O(e){return`${e<0?"-":""}0x${Math.abs(e).toString(16).padStart(2,"0")}`}class C{constructor(e=16,t=16){this.maxKeyLength=e,this.maxLengthPerKey=t,this.hit=0,this.miss=0,this.caches=[];for(let e=0;e<this.maxKeyLength;e++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,t,i){const r=this.caches[i-1];e:for(const n of r){const r=n.bytes;for(let n=0;n<i;n++)if(r[n]!==e[t+n])continue e;return n.str}return null}store(e,t){const i=this.caches[e.length-1],r={bytes:e,str:t};i.length>=this.maxLengthPerKey?i[Math.random()*i.length|0]=r:i.push(r)}decode(e,t,i){const r=this.find(e,t,i);if(null!=r)return this.hit++,r;this.miss++;const n=g(e,t,i),s=Uint8Array.prototype.slice.call(e,t,t+i);return this.store(s,n),n}}var V=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(i){t[i]=e[i]&&function(t){return new Promise((function(r,n){!function(e,t,i,r){Promise.resolve(r).then((function(t){e({value:t,done:i})}),t)}(r,n,(t=e[i](t)).done,t.value)}))}}},P=function(e){return this instanceof P?(this.v=e,this):new P(e)};const _="array",j="map_key",W=e=>{const t=typeof e;return"string"===t||"number"===t},K=new DataView(new ArrayBuffer(0)),N=new Uint8Array(K.buffer),H=(()=>{try{K.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")})(),R=new H("Insufficient data"),X=new C;class G{constructor(e=A.defaultCodec,t,i=4294967295,r=4294967295,n=4294967295,s=4294967295,o=4294967295,h=X){this.extensionCodec=e,this.context=t,this.maxStrLength=i,this.maxBinLength=r,this.maxArrayLength=n,this.maxMapLength=s,this.maxExtLength=o,this.keyDecoder=h,this.totalPos=0,this.pos=0,this.view=K,this.bytes=N,this.headByte=-1,this.stack=[]}reinitializeState(){this.totalPos=0,this.headByte=-1,this.stack.length=0}setBuffer(e){this.bytes=T(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);const t=T(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes),this.pos=0}appendBuffer(e){if(-1!==this.headByte||this.hasRemaining(1)){const t=this.bytes.subarray(this.pos),i=T(e),r=new Uint8Array(t.length+i.length);r.set(t),r.set(i,t.length),this.setBuffer(r)}else this.setBuffer(e)}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:t,pos:i}=this;return new RangeError(`Extra ${t.byteLength-i} of ${t.byteLength} byte(s) found at buffer[${e}]`)}decode(e){this.reinitializeState(),this.setBuffer(e);const t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}*decodeMulti(e){for(this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}decodeAsync(e){var t,i,r,n,s,o,h,a;return s=this,o=void 0,a=function*(){let s,o=!1;try{for(t=V(e);!(i=yield t.next()).done;){const e=i.value;if(o)throw this.createExtraByteError(this.totalPos);this.appendBuffer(e);try{s=this.doDecodeSync(),o=!0}catch(e){if(!(e instanceof H))throw e}this.totalPos+=this.pos}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=t.return)&&(yield n.call(t))}finally{if(r)throw r.error}}if(o){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return s}const{headByte:h,pos:a,totalPos:f}=this;throw new RangeError(`Insufficient data in parsing ${O(h)} at ${f} (${a} in the current buffer)`)},new((h=void 0)||(h=Promise))((function(e,t){function i(e){try{n(a.next(e))}catch(e){t(e)}}function r(e){try{n(a.throw(e))}catch(e){t(e)}}function n(t){var n;t.done?e(t.value):(n=t.value,n instanceof h?n:new h((function(e){e(n)}))).then(i,r)}n((a=a.apply(s,o||[])).next())}))}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}decodeMultiAsync(e,t){return function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,n=i.apply(e,t||[]),s=[];return r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r;function o(e){n[e]&&(r[e]=function(t){return new Promise((function(i,r){s.push([e,t,i,r])>1||h(e,t)}))})}function h(e,t){try{(i=n[e](t)).value instanceof P?Promise.resolve(i.value.v).then(a,f):d(s[0][2],i)}catch(e){d(s[0][3],e)}var i}function a(e){h("next",e)}function f(e){h("throw",e)}function d(e,t){e(t),s.shift(),s.length&&h(s[0][0],s[0][1])}}(this,arguments,(function*(){var i,r;let n=t,s=-1;try{for(var o,h=V(e);!(o=yield P(h.next())).done;){const e=o.value;if(t&&0===s)throw this.createExtraByteError(this.totalPos);this.appendBuffer(e),n&&(s=this.readArraySize(),n=!1,this.complete());try{for(;yield yield P(this.doDecodeSync()),0!=--s;);}catch(e){if(!(e instanceof H))throw e}this.totalPos+=this.pos}}catch(e){i={error:e}}finally{try{o&&!o.done&&(r=h.return)&&(yield P(r.call(h)))}finally{if(i)throw i.error}}}))}doDecodeSync(){e:for(;;){const e=this.readHeadByte();let t;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){const i=e-128;if(0!==i){this.pushMapState(i),this.complete();continue e}t={}}else if(e<160){const i=e-144;if(0!==i){this.pushArrayState(i),this.complete();continue e}t=[]}else{const i=e-160;t=this.decodeUtf8String(i,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.readI64();else if(217===e){const e=this.lookU8();t=this.decodeUtf8String(e,1)}else if(218===e){const e=this.lookU16();t=this.decodeUtf8String(e,2)}else if(219===e){const e=this.lookU32();t=this.decodeUtf8String(e,4)}else if(220===e){const e=this.readU16();if(0!==e){this.pushArrayState(e),this.complete();continue e}t=[]}else if(221===e){const e=this.readU32();if(0!==e){this.pushArrayState(e),this.complete();continue e}t=[]}else if(222===e){const e=this.readU16();if(0!==e){this.pushMapState(e),this.complete();continue e}t={}}else if(223===e){const e=this.readU32();if(0!==e){this.pushMapState(e),this.complete();continue e}t={}}else if(196===e){const e=this.lookU8();t=this.decodeBinary(e,1)}else if(197===e){const e=this.lookU16();t=this.decodeBinary(e,2)}else if(198===e){const e=this.lookU32();t=this.decodeBinary(e,4)}else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e){const e=this.lookU8();t=this.decodeExtension(e,1)}else if(200===e){const e=this.lookU16();t=this.decodeExtension(e,2)}else{if(201!==e)throw new v(`Unrecognized type byte: ${O(e)}`);{const e=this.lookU32();t=this.decodeExtension(e,4)}}this.complete();const i=this.stack;for(;i.length>0;){const e=i[i.length-1];if(e.type===_){if(e.array[e.position]=t,e.position++,e.position!==e.size)continue e;i.pop(),t=e.array}else{if(e.type===j){if(!W(t))throw new v("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new v("The key __proto__ is not allowed");e.key=t,e.type="map_value";continue e}if(e.map[e.key]=t,e.readCount++,e.readCount!==e.size){e.key=null,e.type=j;continue e}i.pop(),t=e.map}}return t}}readHeadByte(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=-1}readArraySize(){const e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new v(`Unrecognized array type byte: ${O(e)}`)}}pushMapState(e){if(e>this.maxMapLength)throw new v(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.push({type:j,size:e,key:null,readCount:0,map:{}})}pushArrayState(e){if(e>this.maxArrayLength)throw new v(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.push({type:_,size:e,array:new Array(e),position:0})}decodeUtf8String(e,t){var i;if(e>this.maxStrLength)throw new v(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw R;const r=this.pos+t;let n;return n=this.stateIsMapKey()&&(null===(i=this.keyDecoder)||void 0===i?void 0:i.canBeCached(e))?this.keyDecoder.decode(this.bytes,r,e):e>U?m(this.bytes,r,e):g(this.bytes,r,e),this.pos+=t+e,n}stateIsMapKey(){return this.stack.length>0&&this.stack[this.stack.length-1].type===j}decodeBinary(e,t){if(e>this.maxBinLength)throw new v(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw R;const i=this.pos+t,r=this.bytes.subarray(i,i+e);return this.pos+=t+e,r}decodeExtension(e,t){if(e>this.maxExtLength)throw new v(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const i=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,i,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){const e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){const e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){const e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){const e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){const e=o(this.view,this.pos);return this.pos+=8,e}readI64(){const e=s(this.view,this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(this.pos);return this.pos+=8,e}}var q=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{a(r.next(e))}catch(e){s(e)}}function h(e){try{a(r.throw(e))}catch(e){s(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,h)}a((r=r.apply(e,t||[])).next())}))},J=function(e){return this instanceof J?(this.v=e,this):new J(e)};const Q="array",Y="map_key",Z=e=>{const t=typeof e;return"string"===t||"number"===t},ee=new DataView(new ArrayBuffer(0)),te=(()=>{try{ee.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")})(),ie=new C,re=new te("Insufficient data");class ne{constructor(e,t=A.defaultCodec,i,r=4294967295,n=4294967295,s=4294967295,o=4294967295,h=4294967295,a=ie,f=2048){this.readIterable=e,this.extensionCodec=t,this.context=i,this.maxStrLength=r,this.maxBinLength=n,this.maxArrayLength=s,this.maxMapLength=o,this.maxExtLength=h,this.keyDecoder=a,this.bufferSize=f,this.headByte=-1,this.stack=[],this.buffer=null,this.readStream=e[Symbol.asyncIterator]()}reinitializeState(){this.headByte=-1,this.stack.length=0}createExtraByteError(){return new RangeError("Extra bytes found")}decode(){return this.reinitializeState(),this.doDecodeSync()}decodeMulti(){return function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,n=i.apply(e,t||[]),s=[];return r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r;function o(e){n[e]&&(r[e]=function(t){return new Promise((function(i,r){s.push([e,t,i,r])>1||h(e,t)}))})}function h(e,t){try{(i=n[e](t)).value instanceof J?Promise.resolve(i.value.v).then(a,f):d(s[0][2],i)}catch(e){d(s[0][3],e)}var i}function a(e){h("next",e)}function f(e){h("throw",e)}function d(e,t){e(t),s.shift(),s.length&&h(s[0][0],s[0][1])}}(this,arguments,(function*(){for(this.reinitializeState();;)yield yield J(yield J(this.doDecodeSync()))}))}doDecodeSync(){var e,t,i,r,n,s,o,h,a,f,d,c,u,l,y,w,g,p,U,m,b,B,x,S,I,L,E,F;return q(this,void 0,void 0,(function*(){e:for(;;){const A=null!==(e=this.readHeadByteFromBuffer())&&void 0!==e?e:yield this.readHeadByte();let T;if(A>=224)T=A-256;else if(A<192)if(A<128)T=A;else if(A<144){const e=A-128;if(0!==e){this.pushMapState(e),this.complete();continue e}T={}}else if(A<160){const e=A-144;if(0!==e){this.pushArrayState(e),this.complete();continue e}T=[]}else{const e=A-160;T=null!==(t=this.decodeUtf8StringFromBuffer(e))&&void 0!==t?t:yield this.decodeUtf8String(e)}else if(192===A)T=null;else if(194===A)T=!1;else if(195===A)T=!0;else if(202===A)T=null!==(i=this.readF32FromBuffer())&&void 0!==i?i:yield this.readF32();else if(203===A)T=null!==(r=this.readF64FromBuffer())&&void 0!==r?r:yield this.readF64();else if(204===A)T=null!==(n=this.readU8FromBuffer())&&void 0!==n?n:yield this.readU8();else if(205===A)T=null!==(s=this.readU16FromBuffer())&&void 0!==s?s:yield this.readU16();else if(206===A)T=null!==(o=this.readU32FromBuffer())&&void 0!==o?o:yield this.readU32();else if(207===A)T=null!==(h=this.readU64FromBuffer())&&void 0!==h?h:yield this.readU64();else if(208===A)T=null!==(a=this.readI8FromBuffer())&&void 0!==a?a:yield this.readI8();else if(209===A)T=null!==(f=this.readI16FromBuffer())&&void 0!==f?f:yield this.readI16();else if(210===A)T=null!==(d=this.readI32FromBuffer())&&void 0!==d?d:yield this.readI32();else if(211===A)T=null!==(c=this.readI64FromBuffer())&&void 0!==c?c:yield this.readI64();else if(217===A){const e=null!==(u=this.readU8FromBuffer())&&void 0!==u?u:yield this.readU8();T=null!==(l=this.decodeUtf8StringFromBuffer(e))&&void 0!==l?l:yield this.decodeUtf8String(e)}else if(218===A){const e=null!==(y=this.readU16FromBuffer())&&void 0!==y?y:yield this.readU16();T=null!==(w=this.decodeUtf8StringFromBuffer(e))&&void 0!==w?w:yield this.decodeUtf8String(e)}else if(219===A){const e=null!==(g=this.readU32FromBuffer())&&void 0!==g?g:yield this.readU32();T=null!==(p=this.decodeUtf8StringFromBuffer(e))&&void 0!==p?p:yield this.decodeUtf8String(e)}else if(220===A){const e=null!==(U=this.readU16FromBuffer())&&void 0!==U?U:yield this.readU16();if(0!==e){this.pushArrayState(e),this.complete();continue e}T=[]}else if(221===A){const e=null!==(m=this.readU32FromBuffer())&&void 0!==m?m:yield this.readU32();if(0!==e){this.pushArrayState(e),this.complete();continue e}T=[]}else if(222===A){const e=null!==(b=this.readU16FromBuffer())&&void 0!==b?b:yield this.readU16();if(0!==e){this.pushMapState(e),this.complete();continue e}T={}}else if(223===A){const e=null!==(B=this.readU32FromBuffer())&&void 0!==B?B:yield this.readU32();if(0!==e){this.pushMapState(e),this.complete();continue e}T={}}else if(196===A){const e=null!==(x=this.readU8FromBuffer())&&void 0!==x?x:yield this.readU8();T=yield this.decodeBinary(e)}else if(197===A){const e=null!==(S=this.readU16FromBuffer())&&void 0!==S?S:yield this.readU16();T=yield this.decodeBinary(e)}else if(198===A){const e=null!==(I=this.readU32FromBuffer())&&void 0!==I?I:yield this.readU32();T=yield this.decodeBinary(e)}else if(212===A)T=yield this.decodeExtension(1);else if(213===A)T=yield this.decodeExtension(2);else if(214===A)T=yield this.decodeExtension(4);else if(215===A)T=yield this.decodeExtension(8);else if(216===A)T=yield this.decodeExtension(16);else if(199===A){const e=null!==(L=this.readU8FromBuffer())&&void 0!==L?L:yield this.readU8();T=yield this.decodeExtension(e)}else if(200===A){const e=null!==(E=this.readU16FromBuffer())&&void 0!==E?E:yield this.readU16();T=yield this.decodeExtension(e)}else{if(201!==A)throw new v(`Unrecognized type byte: ${O(A)}`);{const e=null!==(F=this.readU32FromBuffer())&&void 0!==F?F:yield this.readU32();T=yield this.decodeExtension(e)}}this.complete();const D=this.stack;for(;D.length>0;){const e=D[D.length-1];if(e.type===Q){if(e.array[e.position]=T,e.position++,e.position!==e.size)continue e;D.pop(),T=e.array}else{if(e.type===Y){if(!Z(T))throw new v("The type of key must be string or number but "+typeof T);if("__proto__"===T)throw new v("The key __proto__ is not allowed");e.key=T,e.type="map_value";continue e}if(e.map[e.key]=T,e.readCount++,e.readCount!==e.size){e.key=null,e.type=Y;continue e}D.pop(),T=e.map}}return T}}))}readHeadByteFromBuffer(){const e=this.readU8FromBuffer();return null===e?null:(-1===this.headByte&&(this.headByte=e),this.headByte)}readHeadByte(){return q(this,void 0,void 0,(function*(){return-1===this.headByte&&(this.headByte=yield this.readU8()),this.headByte}))}complete(){this.headByte=-1}pushMapState(e){if(e>this.maxMapLength)throw new v(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.push({type:Y,size:e,key:null,readCount:0,map:{}})}pushArrayState(e){if(e>this.maxArrayLength)throw new v(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.push({type:Q,size:e,array:new Array(e),position:0})}decodeUtf8StringFromBuffer(e){var t;if(e>this.maxStrLength)throw new v(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);const i=this.readBytesFromBuffer(e);if(null===i)return null;let r;return r=this.stateIsMapKey()&&(null===(t=this.keyDecoder)||void 0===t?void 0:t.canBeCached(e))?this.keyDecoder.decode(i,0,e):e>U?m(i,0,e):g(i,0,e),r}decodeUtf8String(e){var t;return q(this,void 0,void 0,(function*(){if(e>this.maxStrLength)throw new v(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);const i=yield this.readBytes(e);let r;return r=this.stateIsMapKey()&&(null===(t=this.keyDecoder)||void 0===t?void 0:t.canBeCached(e))?this.keyDecoder.decode(i,0,e):e>U?m(i,0,e):g(i,0,e),r}))}stateIsMapKey(){return this.stack.length>0&&this.stack[this.stack.length-1].type===Y}decodeBinary(e){return q(this,void 0,void 0,(function*(){if(e>this.maxBinLength)throw new v(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);return yield this.readBytes(e)}))}decodeExtension(e){return q(this,void 0,void 0,(function*(){if(e>this.maxExtLength)throw new v(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const t=yield this.readI8(),i=yield this.decodeBinary(e);return this.extensionCodec.decode(i,t,this.context)}))}readU8(){return q(this,void 0,void 0,(function*(){const e=yield this.readBytes(1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0)}))}readI8(){return q(this,void 0,void 0,(function*(){const e=yield this.readBytes(1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0)}))}readU16(){return q(this,void 0,void 0,(function*(){const e=yield this.readBytes(2);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(0)}))}readI16(){return q(this,void 0,void 0,(function*(){const e=yield this.readBytes(2);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt16(0)}))}readU32(){return q(this,void 0,void 0,(function*(){const e=yield this.readBytes(4);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0)}))}readI32(){return q(this,void 0,void 0,(function*(){const e=yield this.readBytes(4);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt32(0)}))}readU64(){return q(this,void 0,void 0,(function*(){const e=yield this.readBytes(8);return o(new DataView(e.buffer,e.byteOffset,e.byteLength),0)}))}readI64(){return q(this,void 0,void 0,(function*(){const e=yield this.readBytes(8);return s(new DataView(e.buffer,e.byteOffset,e.byteLength),0)}))}readF32(){return q(this,void 0,void 0,(function*(){const e=yield this.readBytes(4);return new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(0)}))}readF64(){return q(this,void 0,void 0,(function*(){const e=yield this.readBytes(8);return new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(0)}))}readU8FromBuffer(){const e=this.readBytesFromBuffer(1);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0):null}readI8FromBuffer(){const e=this.readBytesFromBuffer(1);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0):null}readU16FromBuffer(){const e=this.readBytesFromBuffer(2);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(0):null}readI16FromBuffer(){const e=this.readBytesFromBuffer(2);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getInt16(0):null}readU32FromBuffer(){const e=this.readBytesFromBuffer(4);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0):null}readI32FromBuffer(){const e=this.readBytesFromBuffer(4);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getInt32(0):null}readU64FromBuffer(){const e=this.readBytesFromBuffer(8);return e?o(new DataView(e.buffer,e.byteOffset,e.byteLength),0):null}readI64FromBuffer(){const e=this.readBytesFromBuffer(8);return e?s(new DataView(e.buffer,e.byteOffset,e.byteLength),0):null}readF32FromBuffer(){const e=this.readBytesFromBuffer(4);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(0):null}readF64FromBuffer(){const e=this.readBytesFromBuffer(8);return e?new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(0):null}readBytesFromBuffer(e){if(this.buffer&&this.buffer.length>=e){const t=this.buffer.subarray(0,e);return this.buffer=this.buffer.subarray(e),t}return null}readBytes(e){var t,i;return q(this,void 0,void 0,(function*(){if(this.buffer&&e<=this.buffer.length){const t=this.buffer.subarray(0,e);return this.buffer=this.buffer.subarray(e),t}{const r=null!==(i=null===(t=this.buffer)||void 0===t?void 0:t.length)&&void 0!==i?i:0,n=e-r,s=new Uint8Array(e);if(this.buffer&&s.set(this.buffer,0),n<this.bufferSize){const e=yield this.readToBuffer(this.bufferSize);if(e.length<n)throw re;s.set(e.subarray(0,n),r),this.buffer=this.buffer.subarray(n)}else{const e=yield this.readToBuffer(n);if(e.length<n)throw re;s.set(e.subarray(0,n),r),this.buffer=this.buffer.subarray(n)}return s}}))}readToBuffer(e){return q(this,void 0,void 0,(function*(){const t=[];let i=0;for(;i<e;){const e=yield this.readStream.next(this.bufferSize);if(e.done)break;t.push(e.value),i+=e.value.length}if(1==t.length)return this.buffer=t[0],t[0];this.buffer=new Uint8Array(i);let r=0;for(const e of t)this.buffer.set(e,r),r+=e.length;return this.buffer}))}}const se={};function oe(e,t=se){return new G(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decode(e)}function he(e,t=se){return new G(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeMulti(e)}function ae(e,t=se){return new ne(e,t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decode()}var fe=function(e){return this instanceof fe?(this.v=e,this):new fe(e)},de=function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,n=i.apply(e,t||[]),s=[];return r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r;function o(e){n[e]&&(r[e]=function(t){return new Promise((function(i,r){s.push([e,t,i,r])>1||h(e,t)}))})}function h(e,t){try{(i=n[e](t)).value instanceof fe?Promise.resolve(i.value.v).then(a,f):d(s[0][2],i)}catch(e){d(s[0][3],e)}var i}function a(e){h("next",e)}function f(e){h("throw",e)}function d(e,t){e(t),s.shift(),s.length&&h(s[0][0],s[0][1])}};function ce(e){if(null==e)throw new Error("Assertion Failure: value must not be null nor undefined")}function ue(e){return null!=e[Symbol.asyncIterator]?e:function(e){return de(this,arguments,(function*(){const t=e.getReader();try{for(;;){const{done:e,value:i}=yield fe(t.read());if(e)return yield fe(void 0);ce(i),yield yield fe(i)}}finally{t.releaseLock()}}))}(e)}function le(e,t=se){return i=this,r=void 0,s=function*(){const i=ue(e);return new G(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeAsync(i)},new((n=void 0)||(n=Promise))((function(e,t){function o(e){try{a(s.next(e))}catch(e){t(e)}}function h(e){try{a(s.throw(e))}catch(e){t(e)}}function a(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(o,h)}a((s=s.apply(i,r||[])).next())}));var i,r,n,s}function ye(e,t=se){const i=ue(e);return new G(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeArrayStream(i)}function we(e,t=se){const i=ue(e);return new G(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeStream(i)}return t})())); | ||
//# sourceMappingURL=msgpack.min.js.map |
@@ -599,4 +599,4 @@ "use strict"; | ||
} | ||
result.set(next, hasData); | ||
this.buffer = new Uint8Array(); | ||
result.set(next.subarray(0, needData), hasData); | ||
this.buffer = this.buffer.subarray(needData); | ||
} | ||
@@ -603,0 +603,0 @@ return result; |
{ | ||
"name": "@eyhn/msgpack-stream", | ||
"version": "2.8.1", | ||
"version": "2.8.2", | ||
"description": "MessagePack for ECMA-262/JavaScript/TypeScript", | ||
@@ -5,0 +5,0 @@ "author": "The MessagePack community", |
@@ -631,4 +631,4 @@ import { prettyByte } from "./utils/prettyByte"; | ||
} | ||
result.set(next, hasData); | ||
this.buffer = new Uint8Array(); | ||
result.set(next.subarray(0, needData), hasData); | ||
this.buffer = this.buffer!.subarray(needData); | ||
} | ||
@@ -635,0 +635,0 @@ return result; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
979379
11675