Comparing version 4.9.0 to 4.9.1
@@ -114,3 +114,3 @@ (function (global, factory) { | ||
if (typeof value === 'string') { | ||
let BI; | ||
let BI; // This is a type alias for JSBI/BigInt | ||
if (typeof BigInt === 'undefined' || forceJSBI) { | ||
@@ -124,3 +124,3 @@ BI = JSBI__default['default'].BigInt; | ||
parseInt(value, 10) > 0xffffffff || parseInt(value, 10) < -0x80000000 | ||
? BI(value) | ||
? BI(value) // eslint-disable-line new-cap | ||
: parseInt(value, 10); | ||
@@ -352,3 +352,3 @@ } | ||
let lowNum = 0; | ||
if (str[0] === '-') { | ||
if (str.startsWith('-')) { | ||
pos++; | ||
@@ -1519,3 +1519,3 @@ } | ||
// Copyright (c) 2018, Arista Networks, Inc. | ||
/* eslint-disable @typescript-eslint/prefer-for-of */ | ||
function createBaseType(value) { | ||
@@ -1542,3 +1542,3 @@ const type = typeof value; | ||
if (Object.getPrototypeOf(value) === proto) { | ||
// eslint-disable-next-line no-use-before-define | ||
// eslint-disable-next-line @typescript-eslint/no-use-before-define | ||
return createTypedMap(value); | ||
@@ -1545,0 +1545,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jsbi"),require("base64-js")):"function"==typeof define&&define.amd?define(["exports","jsbi","base64-js"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["a-msgpack"]={},t.jsbi,t.base64Js)}(this,(function(t,e,i){"use strict";function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=s(e);class r{constructor(t,e){this.type=t,this.data=e,this.type=t,this.data=e}}class o{constructor(){this.encoders=[],this.decoders=[],this.identifiers=[]}register({type:t,identifier:e,encode:i,decode:s}){this.encoders[t]=i,this.decoders[t]=s,this.identifiers.push(e)}encode(t){let e=null;for(let i=0;i<this.identifiers.length;i++){(0,this.identifiers[i])(t)&&(e=i)}if(null===e)throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`);const i=(0,this.encoders[e])(t);return new r(e,i)}decode(t,e){return(0,this.decoders[e])(t,e)}}function h(t){return Array.isArray(t)&&"__clzmsd"in t}o.defaultCodec=new o;class a{constructor(t){this.type=a.type,this.value=t?parseFloat(String(t)):0}toString(){const t=this.value.toString();return t.includes(".")?t:this.value.toFixed(1)}}a.type="float32";class c{constructor(t){this.type=c.type,this.value=t?parseFloat(String(t)):0}toString(){const t=this.value.toString();return t.includes(".")?t:this.value.toFixed(1)}}c.type="float64";class f{constructor(t,e=!1){if(this.type=f.type,"string"==typeof t){let i;i="undefined"==typeof BigInt||e?n.default.BigInt:BigInt,this.value=parseInt(t,10)>4294967295||parseInt(t,10)<-2147483648?i(t):parseInt(t,10)}else"bigint"==typeof t||h(t)?this.value=t:this.value=parseInt(String(t),10)}toString(){return this.value.toString()}}f.type="int";class u{constructor(t){this.type=u.type,this.value=!!t}toString(){return this.value?"true":"false"}}u.type="bool";class l{constructor(){this.type=l.type,this.value=null}toString(){return"null"}}l.type="nil";class d{constructor(t){switch(this.type=d.type,typeof t){case"string":this.value=t;break;case"bigint":this.value=t.toString();break;case"undefined":this.value="";break;default:this.value=JSON.stringify(t)}h(t)&&(this.value=t.toString())}toString(){return this.value}}d.type="str";class p{constructor(t=[]){let e;if(this.delimiter="/",this.type=p.type,Array.isArray(t))this.value=t;else{e="string"!=typeof t?JSON.stringify(t):t;const i=e.split(this.delimiter);for(;""===i[0];)i.shift();this.value=i.map((t=>{try{return JSON.parse(t)}catch(t){}return t}))}}toString(){return this.value.map((t=>"string"==typeof t?t:JSON.stringify(t))).join(this.delimiter)}}p.type="ptr";class y{constructor(){this.type=y.type,this.value=null}toString(){return"*"}}function g(t){if("object"==typeof t&&null!==t&&2===Object.keys(t).length&&"type"in t&&"value"in t){const e=t;return[u.type,a.type,c.type,f.type,l.type,d.type].includes(e.type)}return!1}function w(t,e){return function(t,e){const i=Math.min(t.length,e.length);if(t===e)return 0;for(let s=0;s<i;s+=1)if(t[s]!==e[s])return t[s]-e[s];return t.length-e.length}(t[0],e[0])}y.type="*";class U{static serialize(t){return{__neatTypeClass:t.type,value:t.value}}static deserialize(t){return new U.NEAT_TYPE_MAP[t.__neatTypeClass](t.value)}}function b(t,e,i){let s=t,n=e;const r=!i&&2147483648&t;r&&(s=~t,n=4294967296-e);let o="";for(;;){const t=s%10*4294967296+n;if(s=Math.floor(s/10),n=Math.floor(t/10),o=(t%10).toString(10)+o,!s&&!n)break}return r&&(o="-"+o),o}function S(t,e,i){let s=0;const n=i.length;let r=0,o=0;"-"===i[0]&&s++;const h=s;for(;s<n;){const t=parseInt(i[s++],10);if(Number.isNaN(t)||t<0)break;o=10*o+t,r=10*r+Math.floor(o/4294967296),o%=4294967296}h&&(r=~r,o?o=4294967296-o:r++),t.setUint32(e,r),t.setUint32(e+4,o)}function v(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new Uint8Array(t):Uint8Array.from(t)}U.NEAT_TYPE_MAP={float32:a,float64:c,int:f,ptr:p,str:d,nil:l,bool:u};const x="never"!==process.env.TEXT_ENCODING&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function B(t){const e=t.length;let i=0,s=0;for(;s<e;){let n=t.charCodeAt(s++);if(0!=(4294967168&n))if(0==(4294965248&n))i+=2;else{if(n>=55296&&n<=56319&&s<e){const e=t.charCodeAt(s);56320==(64512&e)&&(++s,n=((1023&n)<<10)+(1023&e)+65536)}i+=0==(4294901760&n)?3:4}else i++}return i}const m=x?new TextEncoder:void 0,I="force"!==process.env.TEXT_ENCODING?200:0;const E=(null==m?void 0:m.encodeInto)?function(t,e,i){m.encodeInto(t,e.subarray(i))}:function(t,e,i){e.set(m.encode(t),i)};function A(t,e,i){let s=e;const n=s+i,r=[];let o="";for(;s<n;){const e=t[s++];if(0==(128&e))r.push(e);else if(192==(224&e)){const i=63&t[s++];r.push((31&e)<<6|i)}else if(224==(240&e)){const i=63&t[s++],n=63&t[s++];r.push((31&e)<<12|i<<6|n)}else if(240==(248&e)){let i=(7&e)<<18|(63&t[s++])<<12|(63&t[s++])<<6|63&t[s++];i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i)}else r.push(e);r.length>=4096&&(o+=String.fromCharCode(...r),r.length=0)}return r.length>0&&(o+=String.fromCharCode(...r)),o}const k=x?new TextDecoder:null,L="force"!==process.env.TEXT_DECODER?200:0;class T{constructor(t=o.defaultCodec,e=100,i=2048){this.pos=0,this.extensionCodec=t,this.maxDepth=e,this.initialBufferSize=i,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}keyEncoder(t,e){const i=new T(this.extensionCodec,this.maxDepth,this.initialBufferSize);return i.encode(t,e),i.getUint8Array()}encode(t,e){if(e>this.maxDepth)throw new Error(`Too deep objects in depth ${e}`);null==t?this.encodeNil():"boolean"==typeof t?this.encodeBoolean(t):"number"==typeof t?this.encodeNumber(t):"string"==typeof t?this.encodeString(t):this.encodeObject(t,e)}getUint8Array(){return this.bytes.subarray(0,this.pos)}ensureBufferSizeToWrite(t){const e=this.pos+t;this.view.byteLength<e&&this.resizeBuffer(2*e)}resizeBuffer(t){const e=new ArrayBuffer(t),i=new Uint8Array(e),s=new DataView(e);i.set(this.bytes),this.view=s,this.bytes=i}encodeNil(){this.writeU8(192)}encodeBoolean(t){!1===t?this.writeU8(194):this.writeU8(195)}encodeNumber(t){Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):(this.writeU8(211),this.writeI64(t)):(this.writeU8(203),this.writeF64(t))}writeStringHeader(t){t<256?(this.writeU8(196),this.writeU8(t)):t<65536?(this.writeU8(197),this.writeU16(t)):(this.writeU8(198),this.writeU32(t))}encodeString(t){const e=t.length;if(x&&e>I){const e=B(t);this.ensureBufferSizeToWrite(5+e),this.writeStringHeader(e),E(t,this.bytes,this.pos),this.pos+=e}else{const e=B(t);this.ensureBufferSizeToWrite(5+e),this.writeStringHeader(e),function(t,e,i){const s=t.length;let n=i,r=0;for(;r<s;){let i=t.charCodeAt(r++);if(0!=(4294967168&i)){if(0==(4294965248&i))e[n++]=i>>6&31|192;else{if(i>=55296&&i<=56319&&r<s){const e=t.charCodeAt(r);56320==(64512&e)&&(++r,i=((1023&i)<<10)+(1023&e)+65536)}0==(4294901760&i)?(e[n++]=i>>12&15|224,e[n++]=i>>6&63|128):(e[n++]=i>>18&7|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128)}e[n++]=63&i|128}else e[n++]=i}}(t,this.bytes,this.pos),this.pos+=e}}encodeObject(t,e){if(Array.isArray(t))h(t)?this.encodeJSBI(t):this.encodeArray(t,e);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if("bigint"==typeof t)this.encodeBigInt(t);else if(t instanceof Map)this.encodeMap(t,e);else if("object"==typeof t)g(t)?this.encodeNeatClass(t):!function(t){if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}(t)?this.encodeExtension(this.extensionCodec.encode(t)):this.encodePlainObject(t,e);else{if("function"!=typeof t)throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`);this.encodeNil()}}encodeNeatClass(t){t instanceof a?(this.writeU8(202),this.writeF32(t.value)):t instanceof c?(this.writeU8(203),this.writeF64(t.value)):t instanceof f?"bigint"==typeof t.value?this.encodeBigInt(t.value):h(t.value)?this.encodeJSBI(t.value):this.encodeNumber(t.value):t instanceof d?this.encodeString(t.value):t instanceof u?this.encodeBoolean(t.value):this.encodeNil()}encodeBigInt(t){t===BigInt(0)||BigInt.asIntN(32,t)>0||t<0&&BigInt.asUintN(32,t)===t*BigInt(-1)?this.encodeNumber(Number(t)):t<0?(this.writeU8(211),this.writeI64(t)):(this.writeU8(207),this.writeU64(t))}encodeJSBI(t){const e=t.toString();"0"===e||n.default.LE(t,2147483647)&&n.default.GE(t,-4294967295)||e<"0"&&n.default.GE(t,-4294967295)?this.encodeNumber(Number(t)):e<"0"?(this.writeU8(211),this.writeI64(e)):(this.writeU8(207),this.writeU64(e))}encodeBinary(t){const e=t.byteLength;e<256?(this.writeU8(196),this.writeU8(e)):e<65536?(this.writeU8(197),this.writeU16(e)):(this.writeU8(198),this.writeU32(e));const i=v(t);this.writeU8a(i)}encodeArray(t,e){const i=t.length;i<16?this.writeU8(144+i):i<65536?(this.writeU8(220),this.writeU16(i)):(this.writeU8(221),this.writeU32(i));for(const i of t)this.encode(i,e+1)}encodeMap(t,e){const i=t.size,s=[];i<16?this.writeU8(128+i):i<65536?(this.writeU8(222),this.writeU16(i)):(this.writeU8(223),this.writeU32(i)),t.forEach(((t,i)=>{const n=this.keyEncoder(i,e+1);s.push([n,t])})),s.sort(w),s.forEach((t=>{this.writeU8a(t[0]),this.encode(t[1],e+1)}))}encodePlainObject(t,e){this.encodeMap(new Map(Object.entries(t)),e)}encodeExtension(t){const e=t.data.length;1===e?this.writeU8(212):2===e?this.writeU8(213):4===e?this.writeU8(214):8===e?this.writeU8(215):16===e?this.writeU8(216):e<256?(this.writeU8(199),this.writeU8(e)):e<65536?(this.writeU8(200),this.writeU16(e)):(this.writeU8(201),this.writeU32(e)),this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){const e=t.length;this.ensureBufferSizeToWrite(e),this.bytes.set(t,this.pos),this.pos+=e}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),function(t,e,i){if("number"==typeof i){const s=i/4294967296,n=i;t.setUint32(e,s),t.setUint32(e+4,n)}else"bigint"==typeof i?t.setBigUint64(e,i):"string"==typeof i&&S(t,e,i)}(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),function(t,e,i){if("number"==typeof i){const s=Math.floor(i/4294967296),n=i;t.setUint32(e,s),t.setUint32(e+4,n)}else"bigint"==typeof i?t.setBigInt64(e,i):"string"==typeof i&&S(t,e,i)}(this.view,this.pos,t),this.pos+=8}}const N={};function C(t,e=N){const i=new T(e.extensionCodec,e.maxDepth,e.initialBufferSize);return i.encode(t,1),i.getUint8Array()}const O=new DataView(new ArrayBuffer(0)),j=new Uint8Array(O.buffer),z=new class{constructor(t=16,e=16){this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let t=0;t<this.maxKeyLength;t++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}get(t,e,i){const s=this.caches[i-1],n=s.length;t:for(let r=0;r<n;r++){const n=s[r],o=n.bytes;for(let s=0;s<i;s++)if(o[s]!==t[e+s])continue t;return n.value}return null}store(t,e){const i=this.caches[t.length-1],s={bytes:t,value:e};i.length>=this.maxLengthPerKey?i[Math.random()*i.length|0]=s:i.push(s)}decode(t,e,i){const s=this.get(t,e,i);if(s)return s;const n=A(t,e,i),r=Uint8Array.prototype.slice.call(t,e,e+i);return this.store(r,n),n}};class M{constructor(t=o.defaultCodec,e=!1,i=4294967295,s=4294967295,n=4294967295,r=4294967295,h=4294967295,a=z){this.totalPos=0,this.pos=0,this.view=O,this.bytes=j,this.stack=[],this.extensionCodec=t,this.cachedKeyDecoder=a,this.useJSBI=e,this.maxStrLength=i,this.maxBinLength=s,this.maxArrayLength=n,this.maxMapLength=r,this.maxExtLength=h}setBuffer(t){this.bytes=v(t),this.view=function(t){if(t instanceof ArrayBuffer)return new DataView(t);const e=v(t);return new DataView(e.buffer,e.byteOffset,e.byteLength)}(this.bytes),this.pos=0}hasRemaining(t=1){return this.view.byteLength-this.pos>=t}createNoExtraBytesError(t){const{view:e,pos:i}=this;return new RangeError(`Extra ${e.byteLength-i} byte(s) found at buffer[${t}]`)}decodeSingleSync(){const t=this.decodeSync();if(this.hasRemaining())throw this.createNoExtraBytesError(this.pos);return t}decodeSync(){t:for(;;){const e=this.readU8();let s;if(e>=224)s=e-256;else if(e<192)if(e<128)s=e;else if(e<144){const t=e-128;if(0!==t){this.pushMapState(t);continue t}s={}}else{const t=e-144;if(0!==t){this.pushArrayState(t);continue t}s=[]}else if(192===e)s=null;else if(194===e)s=!1;else if(195===e)s=!0;else if(202===e)s=this.readF32();else if(203===e)s=this.readF64();else if(204===e)s=this.readU8();else if(205===e)s=this.readU16();else if(206===e)s=this.readU32();else if(207===e)s=this.readU64();else if(208===e)s=this.readI8();else if(209===e)s=this.readI16();else if(210===e)s=this.readI32();else if(211===e)s=this.readI64();else{if(220===e){const t=this.readU16();this.pushArrayState(t);continue t}if(221===e){const t=this.readU32();this.pushArrayState(t);continue t}if(222===e){const t=this.readU16();this.pushMapState(t);continue t}if(223===e){const t=this.readU32();this.pushMapState(t);continue t}if(196===e){const t=this.lookU8();s=this.decodeUtf8String(t,1)}else if(197===e){const t=this.lookU16();s=this.decodeUtf8String(t,2)}else if(198===e){const t=this.lookU32();s=this.decodeUtf8String(t,4)}else if(212===e)s=this.decodeExtension(1,0);else if(213===e)s=this.decodeExtension(2,0);else if(214===e)s=this.decodeExtension(4,0);else if(215===e)s=this.decodeExtension(8,0);else if(216===e)s=this.decodeExtension(16,0);else if(199===e){const t=this.lookU8();s=this.decodeExtension(t,1)}else if(200===e){const t=this.lookU16();s=this.decodeExtension(t,2)}else{if(201!==e)throw new Error("Unrecognized type byte: "+`${(t=e)<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`);{const t=this.lookU32();s=this.decodeExtension(t,4)}}}const n=this.stack;for(;n.length>0;){const t=n[n.length-1];if(0===t.type){if(t.array[t.position]=s,t.position++,t.position!==t.size)continue t;n.pop(),s=t.array}else{if(1===t.type){t.keyEnd=this.pos,t.key=s,t.type=2;continue t}if("string"!=typeof t.key){const e=i.fromByteArray(this.bytes.slice(t.keyStart,t.keyEnd));t.map[e]={_key:t.key,_value:s}}else t.map[t.key]=s;if(t.readCount++,t.readCount!==t.size){t.key=null,t.type=1,n[n.length-1].keyStart=this.pos;continue t}n.pop(),s=t.map}}return s}var t}pushMapState(t){if(t>this.maxMapLength)throw new Error(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.push({type:1,size:t,keyStart:this.pos,keyEnd:this.pos,key:null,serializedKey:null,readCount:0,map:{}})}pushArrayState(t){if(t>this.maxArrayLength)throw new Error(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.push({type:0,size:t,keyStart:1,array:new Array(t),position:0})}decodeUtf8String(t,e){var i;if(t>this.maxStrLength)throw new Error(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw new RangeError("Insufficient data");const s=this.pos+e;let n;return n=this.stateIsMapKey()&&(null===(i=this.cachedKeyDecoder)||void 0===i?void 0:i.canBeCached(t))?this.cachedKeyDecoder.decode(this.bytes,s,t):x&&t>L?function(t,e,i){const s=t.subarray(e,e+i);return k.decode(s)}(this.bytes,s,t):A(this.bytes,s,t),this.pos+=e+t,n}stateIsMapKey(){if(this.stack.length>0){return 1===this.stack[this.stack.length-1].type}return!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new Error(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw new RangeError("Insufficient data");const i=this.pos+e,s=this.bytes.subarray(i,i+t);return this.pos+=e+t,s}decodeExtension(t,e){if(t>this.maxExtLength)throw new Error(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const i=this.view.getInt8(this.pos+e),s=this.decodeBinary(t,e+1);return this.extensionCodec.decode(s,i)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=function(t,e,i){if(!t.getBigUint64||i){const i=t.getUint32(e),s=t.getUint32(e+4);return n.default.BigInt(b(i,s,!0))}return t.getBigUint64(e)}(this.view,this.pos,this.useJSBI);return this.pos+=8,t}readI64(){const t=function(t,e,i){if(!t.getBigInt64||i){const i=t.getInt32(e),s=t.getUint32(e+4);return n.default.BigInt(b(i,s,!1))}return t.getBigInt64(e)}(this.view,this.pos,this.useJSBI);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}const F={};function D(t,e=F){const i=new M(e.extensionCodec,e.useJSBI,e.maxStrLength,e.maxBinLength,e.maxArrayLength,e.maxMapLength,e.maxExtLength,e.cachedKeyDecoder);return i.setBuffer(t),i.decodeSingleSync()}function P(t){const e=typeof t;if("number"===e){return String(t).split(".").length>1?new c(t):new f(t)}if("boolean"===e)return new u(t);if("string"===e)return new d(t);if(null!==t&&"object"===e){let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);if(Object.getPrototypeOf(t)===e)return function(t){const e=new Map,i=Object.keys(t);for(let s=0;s<i.length;s+=1){const n=i[s],r=t[n],o=P(n),h=P(r);e.set(o,h)}return e}(t)}return new l}const $={Bool:u,Float32:a,Float64:c,Int:f,Nil:l,Pointer:p,Str:d,Wildcard:y},_=new o;var W;_.register({type:0,identifier:t=>t instanceof p,encode:(W=_,t=>C(t.value,{extensionCodec:W})),decode:function(t){return e=>{const i=D(e,{extensionCodec:t});return Array.isArray(i)?new p(i):new p}}(_)}),_.register({type:1,identifier:t=>t instanceof y,encode:()=>new Uint8Array,decode:()=>new y}),t.Bool=u,t.Codec=_,t.ExtData=r,t.ExtensionCodec=o,t.Float32=a,t.Float64=c,t.Int=f,t.NeatTypeSerializer=U,t.NeatTypes=$,t.Nil=l,t.Pointer=p,t.Str=d,t.createBaseType=P,t.decode=D,t.encode=C,t.isJsbi=h,t.isNeatType=function(t){if("object"==typeof t&&null!==t){if(g(t))return!0;if(3===Object.keys(t).length&&"type"in t&&"value"in t&&"delimiter"in t){return t.type===p.type}}return!1},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jsbi"),require("base64-js")):"function"==typeof define&&define.amd?define(["exports","jsbi","base64-js"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["a-msgpack"]={},t.jsbi,t.base64Js)}(this,(function(t,e,i){"use strict";function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=s(e);class r{constructor(t,e){this.type=t,this.data=e,this.type=t,this.data=e}}class o{constructor(){this.encoders=[],this.decoders=[],this.identifiers=[]}register({type:t,identifier:e,encode:i,decode:s}){this.encoders[t]=i,this.decoders[t]=s,this.identifiers.push(e)}encode(t){let e=null;for(let i=0;i<this.identifiers.length;i++){(0,this.identifiers[i])(t)&&(e=i)}if(null===e)throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`);const i=(0,this.encoders[e])(t);return new r(e,i)}decode(t,e){return(0,this.decoders[e])(t,e)}}function h(t){return Array.isArray(t)&&"__clzmsd"in t}o.defaultCodec=new o;class a{constructor(t){this.type=a.type,this.value=t?parseFloat(String(t)):0}toString(){const t=this.value.toString();return t.includes(".")?t:this.value.toFixed(1)}}a.type="float32";class c{constructor(t){this.type=c.type,this.value=t?parseFloat(String(t)):0}toString(){const t=this.value.toString();return t.includes(".")?t:this.value.toFixed(1)}}c.type="float64";class f{constructor(t,e=!1){if(this.type=f.type,"string"==typeof t){let i;i="undefined"==typeof BigInt||e?n.default.BigInt:BigInt,this.value=parseInt(t,10)>4294967295||parseInt(t,10)<-2147483648?i(t):parseInt(t,10)}else"bigint"==typeof t||h(t)?this.value=t:this.value=parseInt(String(t),10)}toString(){return this.value.toString()}}f.type="int";class u{constructor(t){this.type=u.type,this.value=!!t}toString(){return this.value?"true":"false"}}u.type="bool";class l{constructor(){this.type=l.type,this.value=null}toString(){return"null"}}l.type="nil";class d{constructor(t){switch(this.type=d.type,typeof t){case"string":this.value=t;break;case"bigint":this.value=t.toString();break;case"undefined":this.value="";break;default:this.value=JSON.stringify(t)}h(t)&&(this.value=t.toString())}toString(){return this.value}}d.type="str";class p{constructor(t=[]){let e;if(this.delimiter="/",this.type=p.type,Array.isArray(t))this.value=t;else{e="string"!=typeof t?JSON.stringify(t):t;const i=e.split(this.delimiter);for(;""===i[0];)i.shift();this.value=i.map((t=>{try{return JSON.parse(t)}catch(t){}return t}))}}toString(){return this.value.map((t=>"string"==typeof t?t:JSON.stringify(t))).join(this.delimiter)}}p.type="ptr";class y{constructor(){this.type=y.type,this.value=null}toString(){return"*"}}function g(t){if("object"==typeof t&&null!==t&&2===Object.keys(t).length&&"type"in t&&"value"in t){const e=t;return[u.type,a.type,c.type,f.type,l.type,d.type].includes(e.type)}return!1}function w(t,e){return function(t,e){const i=Math.min(t.length,e.length);if(t===e)return 0;for(let s=0;s<i;s+=1)if(t[s]!==e[s])return t[s]-e[s];return t.length-e.length}(t[0],e[0])}y.type="*";class U{static serialize(t){return{__neatTypeClass:t.type,value:t.value}}static deserialize(t){return new U.NEAT_TYPE_MAP[t.__neatTypeClass](t.value)}}function b(t,e,i){let s=t,n=e;const r=!i&&2147483648&t;r&&(s=~t,n=4294967296-e);let o="";for(;;){const t=s%10*4294967296+n;if(s=Math.floor(s/10),n=Math.floor(t/10),o=(t%10).toString(10)+o,!s&&!n)break}return r&&(o="-"+o),o}function S(t,e,i){let s=0;const n=i.length;let r=0,o=0;i.startsWith("-")&&s++;const h=s;for(;s<n;){const t=parseInt(i[s++],10);if(Number.isNaN(t)||t<0)break;o=10*o+t,r=10*r+Math.floor(o/4294967296),o%=4294967296}h&&(r=~r,o?o=4294967296-o:r++),t.setUint32(e,r),t.setUint32(e+4,o)}function v(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new Uint8Array(t):Uint8Array.from(t)}U.NEAT_TYPE_MAP={float32:a,float64:c,int:f,ptr:p,str:d,nil:l,bool:u};const x="never"!==process.env.TEXT_ENCODING&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function B(t){const e=t.length;let i=0,s=0;for(;s<e;){let n=t.charCodeAt(s++);if(0!=(4294967168&n))if(0==(4294965248&n))i+=2;else{if(n>=55296&&n<=56319&&s<e){const e=t.charCodeAt(s);56320==(64512&e)&&(++s,n=((1023&n)<<10)+(1023&e)+65536)}i+=0==(4294901760&n)?3:4}else i++}return i}const m=x?new TextEncoder:void 0,I="force"!==process.env.TEXT_ENCODING?200:0;const E=(null==m?void 0:m.encodeInto)?function(t,e,i){m.encodeInto(t,e.subarray(i))}:function(t,e,i){e.set(m.encode(t),i)};function A(t,e,i){let s=e;const n=s+i,r=[];let o="";for(;s<n;){const e=t[s++];if(0==(128&e))r.push(e);else if(192==(224&e)){const i=63&t[s++];r.push((31&e)<<6|i)}else if(224==(240&e)){const i=63&t[s++],n=63&t[s++];r.push((31&e)<<12|i<<6|n)}else if(240==(248&e)){let i=(7&e)<<18|(63&t[s++])<<12|(63&t[s++])<<6|63&t[s++];i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i)}else r.push(e);r.length>=4096&&(o+=String.fromCharCode(...r),r.length=0)}return r.length>0&&(o+=String.fromCharCode(...r)),o}const k=x?new TextDecoder:null,L="force"!==process.env.TEXT_DECODER?200:0;class T{constructor(t=o.defaultCodec,e=100,i=2048){this.pos=0,this.extensionCodec=t,this.maxDepth=e,this.initialBufferSize=i,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}keyEncoder(t,e){const i=new T(this.extensionCodec,this.maxDepth,this.initialBufferSize);return i.encode(t,e),i.getUint8Array()}encode(t,e){if(e>this.maxDepth)throw new Error(`Too deep objects in depth ${e}`);null==t?this.encodeNil():"boolean"==typeof t?this.encodeBoolean(t):"number"==typeof t?this.encodeNumber(t):"string"==typeof t?this.encodeString(t):this.encodeObject(t,e)}getUint8Array(){return this.bytes.subarray(0,this.pos)}ensureBufferSizeToWrite(t){const e=this.pos+t;this.view.byteLength<e&&this.resizeBuffer(2*e)}resizeBuffer(t){const e=new ArrayBuffer(t),i=new Uint8Array(e),s=new DataView(e);i.set(this.bytes),this.view=s,this.bytes=i}encodeNil(){this.writeU8(192)}encodeBoolean(t){!1===t?this.writeU8(194):this.writeU8(195)}encodeNumber(t){Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):(this.writeU8(211),this.writeI64(t)):(this.writeU8(203),this.writeF64(t))}writeStringHeader(t){t<256?(this.writeU8(196),this.writeU8(t)):t<65536?(this.writeU8(197),this.writeU16(t)):(this.writeU8(198),this.writeU32(t))}encodeString(t){const e=t.length;if(x&&e>I){const e=B(t);this.ensureBufferSizeToWrite(5+e),this.writeStringHeader(e),E(t,this.bytes,this.pos),this.pos+=e}else{const e=B(t);this.ensureBufferSizeToWrite(5+e),this.writeStringHeader(e),function(t,e,i){const s=t.length;let n=i,r=0;for(;r<s;){let i=t.charCodeAt(r++);if(0!=(4294967168&i)){if(0==(4294965248&i))e[n++]=i>>6&31|192;else{if(i>=55296&&i<=56319&&r<s){const e=t.charCodeAt(r);56320==(64512&e)&&(++r,i=((1023&i)<<10)+(1023&e)+65536)}0==(4294901760&i)?(e[n++]=i>>12&15|224,e[n++]=i>>6&63|128):(e[n++]=i>>18&7|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128)}e[n++]=63&i|128}else e[n++]=i}}(t,this.bytes,this.pos),this.pos+=e}}encodeObject(t,e){if(Array.isArray(t))h(t)?this.encodeJSBI(t):this.encodeArray(t,e);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if("bigint"==typeof t)this.encodeBigInt(t);else if(t instanceof Map)this.encodeMap(t,e);else if("object"==typeof t)g(t)?this.encodeNeatClass(t):!function(t){if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}(t)?this.encodeExtension(this.extensionCodec.encode(t)):this.encodePlainObject(t,e);else{if("function"!=typeof t)throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`);this.encodeNil()}}encodeNeatClass(t){t instanceof a?(this.writeU8(202),this.writeF32(t.value)):t instanceof c?(this.writeU8(203),this.writeF64(t.value)):t instanceof f?"bigint"==typeof t.value?this.encodeBigInt(t.value):h(t.value)?this.encodeJSBI(t.value):this.encodeNumber(t.value):t instanceof d?this.encodeString(t.value):t instanceof u?this.encodeBoolean(t.value):this.encodeNil()}encodeBigInt(t){t===BigInt(0)||BigInt.asIntN(32,t)>0||t<0&&BigInt.asUintN(32,t)===t*BigInt(-1)?this.encodeNumber(Number(t)):t<0?(this.writeU8(211),this.writeI64(t)):(this.writeU8(207),this.writeU64(t))}encodeJSBI(t){const e=t.toString();"0"===e||n.default.LE(t,2147483647)&&n.default.GE(t,-4294967295)||e<"0"&&n.default.GE(t,-4294967295)?this.encodeNumber(Number(t)):e<"0"?(this.writeU8(211),this.writeI64(e)):(this.writeU8(207),this.writeU64(e))}encodeBinary(t){const e=t.byteLength;e<256?(this.writeU8(196),this.writeU8(e)):e<65536?(this.writeU8(197),this.writeU16(e)):(this.writeU8(198),this.writeU32(e));const i=v(t);this.writeU8a(i)}encodeArray(t,e){const i=t.length;i<16?this.writeU8(144+i):i<65536?(this.writeU8(220),this.writeU16(i)):(this.writeU8(221),this.writeU32(i));for(const i of t)this.encode(i,e+1)}encodeMap(t,e){const i=t.size,s=[];i<16?this.writeU8(128+i):i<65536?(this.writeU8(222),this.writeU16(i)):(this.writeU8(223),this.writeU32(i)),t.forEach(((t,i)=>{const n=this.keyEncoder(i,e+1);s.push([n,t])})),s.sort(w),s.forEach((t=>{this.writeU8a(t[0]),this.encode(t[1],e+1)}))}encodePlainObject(t,e){this.encodeMap(new Map(Object.entries(t)),e)}encodeExtension(t){const e=t.data.length;1===e?this.writeU8(212):2===e?this.writeU8(213):4===e?this.writeU8(214):8===e?this.writeU8(215):16===e?this.writeU8(216):e<256?(this.writeU8(199),this.writeU8(e)):e<65536?(this.writeU8(200),this.writeU16(e)):(this.writeU8(201),this.writeU32(e)),this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){const e=t.length;this.ensureBufferSizeToWrite(e),this.bytes.set(t,this.pos),this.pos+=e}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),function(t,e,i){if("number"==typeof i){const s=i/4294967296,n=i;t.setUint32(e,s),t.setUint32(e+4,n)}else"bigint"==typeof i?t.setBigUint64(e,i):"string"==typeof i&&S(t,e,i)}(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),function(t,e,i){if("number"==typeof i){const s=Math.floor(i/4294967296),n=i;t.setUint32(e,s),t.setUint32(e+4,n)}else"bigint"==typeof i?t.setBigInt64(e,i):"string"==typeof i&&S(t,e,i)}(this.view,this.pos,t),this.pos+=8}}const N={};function C(t,e=N){const i=new T(e.extensionCodec,e.maxDepth,e.initialBufferSize);return i.encode(t,1),i.getUint8Array()}const O=new DataView(new ArrayBuffer(0)),j=new Uint8Array(O.buffer),z=new class{constructor(t=16,e=16){this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let t=0;t<this.maxKeyLength;t++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}get(t,e,i){const s=this.caches[i-1],n=s.length;t:for(let r=0;r<n;r++){const n=s[r],o=n.bytes;for(let s=0;s<i;s++)if(o[s]!==t[e+s])continue t;return n.value}return null}store(t,e){const i=this.caches[t.length-1],s={bytes:t,value:e};i.length>=this.maxLengthPerKey?i[Math.random()*i.length|0]=s:i.push(s)}decode(t,e,i){const s=this.get(t,e,i);if(s)return s;const n=A(t,e,i),r=Uint8Array.prototype.slice.call(t,e,e+i);return this.store(r,n),n}};class M{constructor(t=o.defaultCodec,e=!1,i=4294967295,s=4294967295,n=4294967295,r=4294967295,h=4294967295,a=z){this.totalPos=0,this.pos=0,this.view=O,this.bytes=j,this.stack=[],this.extensionCodec=t,this.cachedKeyDecoder=a,this.useJSBI=e,this.maxStrLength=i,this.maxBinLength=s,this.maxArrayLength=n,this.maxMapLength=r,this.maxExtLength=h}setBuffer(t){this.bytes=v(t),this.view=function(t){if(t instanceof ArrayBuffer)return new DataView(t);const e=v(t);return new DataView(e.buffer,e.byteOffset,e.byteLength)}(this.bytes),this.pos=0}hasRemaining(t=1){return this.view.byteLength-this.pos>=t}createNoExtraBytesError(t){const{view:e,pos:i}=this;return new RangeError(`Extra ${e.byteLength-i} byte(s) found at buffer[${t}]`)}decodeSingleSync(){const t=this.decodeSync();if(this.hasRemaining())throw this.createNoExtraBytesError(this.pos);return t}decodeSync(){t:for(;;){const e=this.readU8();let s;if(e>=224)s=e-256;else if(e<192)if(e<128)s=e;else if(e<144){const t=e-128;if(0!==t){this.pushMapState(t);continue t}s={}}else{const t=e-144;if(0!==t){this.pushArrayState(t);continue t}s=[]}else if(192===e)s=null;else if(194===e)s=!1;else if(195===e)s=!0;else if(202===e)s=this.readF32();else if(203===e)s=this.readF64();else if(204===e)s=this.readU8();else if(205===e)s=this.readU16();else if(206===e)s=this.readU32();else if(207===e)s=this.readU64();else if(208===e)s=this.readI8();else if(209===e)s=this.readI16();else if(210===e)s=this.readI32();else if(211===e)s=this.readI64();else{if(220===e){const t=this.readU16();this.pushArrayState(t);continue t}if(221===e){const t=this.readU32();this.pushArrayState(t);continue t}if(222===e){const t=this.readU16();this.pushMapState(t);continue t}if(223===e){const t=this.readU32();this.pushMapState(t);continue t}if(196===e){const t=this.lookU8();s=this.decodeUtf8String(t,1)}else if(197===e){const t=this.lookU16();s=this.decodeUtf8String(t,2)}else if(198===e){const t=this.lookU32();s=this.decodeUtf8String(t,4)}else if(212===e)s=this.decodeExtension(1,0);else if(213===e)s=this.decodeExtension(2,0);else if(214===e)s=this.decodeExtension(4,0);else if(215===e)s=this.decodeExtension(8,0);else if(216===e)s=this.decodeExtension(16,0);else if(199===e){const t=this.lookU8();s=this.decodeExtension(t,1)}else if(200===e){const t=this.lookU16();s=this.decodeExtension(t,2)}else{if(201!==e)throw new Error("Unrecognized type byte: "+`${(t=e)<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`);{const t=this.lookU32();s=this.decodeExtension(t,4)}}}const n=this.stack;for(;n.length>0;){const t=n[n.length-1];if(0===t.type){if(t.array[t.position]=s,t.position++,t.position!==t.size)continue t;n.pop(),s=t.array}else{if(1===t.type){t.keyEnd=this.pos,t.key=s,t.type=2;continue t}if("string"!=typeof t.key){const e=i.fromByteArray(this.bytes.slice(t.keyStart,t.keyEnd));t.map[e]={_key:t.key,_value:s}}else t.map[t.key]=s;if(t.readCount++,t.readCount!==t.size){t.key=null,t.type=1,n[n.length-1].keyStart=this.pos;continue t}n.pop(),s=t.map}}return s}var t}pushMapState(t){if(t>this.maxMapLength)throw new Error(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.push({type:1,size:t,keyStart:this.pos,keyEnd:this.pos,key:null,serializedKey:null,readCount:0,map:{}})}pushArrayState(t){if(t>this.maxArrayLength)throw new Error(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.push({type:0,size:t,keyStart:1,array:new Array(t),position:0})}decodeUtf8String(t,e){var i;if(t>this.maxStrLength)throw new Error(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw new RangeError("Insufficient data");const s=this.pos+e;let n;return n=this.stateIsMapKey()&&(null===(i=this.cachedKeyDecoder)||void 0===i?void 0:i.canBeCached(t))?this.cachedKeyDecoder.decode(this.bytes,s,t):x&&t>L?function(t,e,i){const s=t.subarray(e,e+i);return k.decode(s)}(this.bytes,s,t):A(this.bytes,s,t),this.pos+=e+t,n}stateIsMapKey(){if(this.stack.length>0){return 1===this.stack[this.stack.length-1].type}return!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new Error(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw new RangeError("Insufficient data");const i=this.pos+e,s=this.bytes.subarray(i,i+t);return this.pos+=e+t,s}decodeExtension(t,e){if(t>this.maxExtLength)throw new Error(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const i=this.view.getInt8(this.pos+e),s=this.decodeBinary(t,e+1);return this.extensionCodec.decode(s,i)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=function(t,e,i){if(!t.getBigUint64||i){const i=t.getUint32(e),s=t.getUint32(e+4);return n.default.BigInt(b(i,s,!0))}return t.getBigUint64(e)}(this.view,this.pos,this.useJSBI);return this.pos+=8,t}readI64(){const t=function(t,e,i){if(!t.getBigInt64||i){const i=t.getInt32(e),s=t.getUint32(e+4);return n.default.BigInt(b(i,s,!1))}return t.getBigInt64(e)}(this.view,this.pos,this.useJSBI);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}const F={};function D(t,e=F){const i=new M(e.extensionCodec,e.useJSBI,e.maxStrLength,e.maxBinLength,e.maxArrayLength,e.maxMapLength,e.maxExtLength,e.cachedKeyDecoder);return i.setBuffer(t),i.decodeSingleSync()}function P(t){const e=typeof t;if("number"===e){return String(t).split(".").length>1?new c(t):new f(t)}if("boolean"===e)return new u(t);if("string"===e)return new d(t);if(null!==t&&"object"===e){let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);if(Object.getPrototypeOf(t)===e)return function(t){const e=new Map,i=Object.keys(t);for(let s=0;s<i.length;s+=1){const n=i[s],r=t[n],o=P(n),h=P(r);e.set(o,h)}return e}(t)}return new l}const $={Bool:u,Float32:a,Float64:c,Int:f,Nil:l,Pointer:p,Str:d,Wildcard:y},_=new o;var W;_.register({type:0,identifier:t=>t instanceof p,encode:(W=_,t=>C(t.value,{extensionCodec:W})),decode:function(t){return e=>{const i=D(e,{extensionCodec:t});return Array.isArray(i)?new p(i):new p}}(_)}),_.register({type:1,identifier:t=>t instanceof y,encode:()=>new Uint8Array,decode:()=>new y}),t.Bool=u,t.Codec=_,t.ExtData=r,t.ExtensionCodec=o,t.Float32=a,t.Float64=c,t.Int=f,t.NeatTypeSerializer=U,t.NeatTypes=$,t.Nil=l,t.Pointer=p,t.Str=d,t.createBaseType=P,t.decode=D,t.encode=C,t.isJsbi=h,t.isNeatType=function(t){if("object"==typeof t&&null!==t){if(g(t))return!0;if(3===Object.keys(t).length&&"type"in t&&"value"in t&&"delimiter"in t){return t.type===p.type}}return!1},Object.defineProperty(t,"__esModule",{value:!0})})); |
@@ -107,3 +107,3 @@ import JSBI from 'jsbi'; | ||
if (typeof value === 'string') { | ||
let BI; | ||
let BI; // This is a type alias for JSBI/BigInt | ||
if (typeof BigInt === 'undefined' || forceJSBI) { | ||
@@ -117,3 +117,3 @@ BI = JSBI.BigInt; | ||
parseInt(value, 10) > 0xffffffff || parseInt(value, 10) < -0x80000000 | ||
? BI(value) | ||
? BI(value) // eslint-disable-line new-cap | ||
: parseInt(value, 10); | ||
@@ -345,3 +345,3 @@ } | ||
let lowNum = 0; | ||
if (str[0] === '-') { | ||
if (str.startsWith('-')) { | ||
pos++; | ||
@@ -1512,3 +1512,3 @@ } | ||
// Copyright (c) 2018, Arista Networks, Inc. | ||
/* eslint-disable @typescript-eslint/prefer-for-of */ | ||
function createBaseType(value) { | ||
@@ -1535,3 +1535,3 @@ const type = typeof value; | ||
if (Object.getPrototypeOf(value) === proto) { | ||
// eslint-disable-next-line no-use-before-define | ||
// eslint-disable-next-line @typescript-eslint/no-use-before-define | ||
return createTypedMap(value); | ||
@@ -1538,0 +1538,0 @@ } |
@@ -115,3 +115,3 @@ 'use strict'; | ||
if (typeof value === 'string') { | ||
let BI; | ||
let BI; // This is a type alias for JSBI/BigInt | ||
if (typeof BigInt === 'undefined' || forceJSBI) { | ||
@@ -125,3 +125,3 @@ BI = JSBI__default['default'].BigInt; | ||
parseInt(value, 10) > 0xffffffff || parseInt(value, 10) < -0x80000000 | ||
? BI(value) | ||
? BI(value) // eslint-disable-line new-cap | ||
: parseInt(value, 10); | ||
@@ -353,3 +353,3 @@ } | ||
let lowNum = 0; | ||
if (str[0] === '-') { | ||
if (str.startsWith('-')) { | ||
pos++; | ||
@@ -1520,3 +1520,3 @@ } | ||
// Copyright (c) 2018, Arista Networks, Inc. | ||
/* eslint-disable @typescript-eslint/prefer-for-of */ | ||
function createBaseType(value) { | ||
@@ -1543,3 +1543,3 @@ const type = typeof value; | ||
if (Object.getPrototypeOf(value) === proto) { | ||
// eslint-disable-next-line no-use-before-define | ||
// eslint-disable-next-line @typescript-eslint/no-use-before-define | ||
return createTypedMap(value); | ||
@@ -1546,0 +1546,0 @@ } |
{ | ||
"name": "a-msgpack", | ||
"version": "4.9.0", | ||
"version": "4.9.1", | ||
"description": "A minimalistic NEAT (MessagePack based) encoder and decoder for JavaScript.", | ||
@@ -59,3 +59,3 @@ "author": "Stephane Rufer <stephane@arista.com>", | ||
"base64-js": "1.5.1", | ||
"jsbi": "3.1.4" | ||
"jsbi": "3.1.5" | ||
}, | ||
@@ -65,22 +65,24 @@ "devDependencies": { | ||
"@rollup/plugin-commonjs": "18.1.0", | ||
"@rollup/plugin-node-resolve": "11.2.1", | ||
"@rollup/plugin-typescript": "8.2.1", | ||
"@rollup/plugin-node-resolve": "13.0.2", | ||
"@rollup/plugin-typescript": "8.2.3", | ||
"@types/base64-js": "1.3.0", | ||
"@types/jest": "25.2.3", | ||
"@types/js-yaml": "3.12.6", | ||
"@types/jest": "26.0.24", | ||
"@types/js-yaml": "4.0.2", | ||
"@typescript-eslint/eslint-plugin": "4.22.1", | ||
"@typescript-eslint/parser": "4.22.1", | ||
"babel-eslint": "10.1.0", | ||
"cross-env": "7.0.3", | ||
"eslint": "6.8.0", | ||
"eslint-config-airbnb-base": "14.2.1", | ||
"eslint-config-arista-js": "1.1.36", | ||
"eslint-config-arista-ts": "1.4.6", | ||
"eslint": "7.31.0", | ||
"eslint-config-arista-js": "2.0.1", | ||
"eslint-config-arista-ts": "2.0.0", | ||
"eslint-plugin-arista": "0.2.2", | ||
"eslint-plugin-import": "2.23.3", | ||
"jest": "26.6.3", | ||
"js-yaml": "3.14.1", | ||
"prettier": "2.2.1", | ||
"jest": "27.0.6", | ||
"js-yaml": "4.1.0", | ||
"prettier": "2.3.2", | ||
"rimraf": "3.0.2", | ||
"rollup": "2.49.0", | ||
"rollup-plugin-terser": "7.0.2", | ||
"ts-jest": "26.5.6", | ||
"tslib": "2.2.0", | ||
"ts-jest": "27.0.4", | ||
"tslib": "2.3.0", | ||
"typedoc": "0.19.2", | ||
@@ -91,3 +93,3 @@ "typedoc-neo-theme": "1.1.1", | ||
}, | ||
"gitHead": "5de072465413fe68300d24e888cbb55baf32194c" | ||
"gitHead": "46034d89fa66434a5471797f64ad174873db8f83" | ||
} |
@@ -82,3 +82,3 @@ // Copyright (c) 2018, Arista Networks, Inc. | ||
if (typeof value === 'string') { | ||
let BI; | ||
let BI; // This is a type alias for JSBI/BigInt | ||
if (typeof BigInt === 'undefined' || forceJSBI) { | ||
@@ -92,3 +92,3 @@ BI = JSBI.BigInt; | ||
parseInt(value, 10) > 0xffffffff || parseInt(value, 10) < -0x80000000 | ||
? BI(value) | ||
? BI(value) // eslint-disable-line new-cap | ||
: parseInt(value, 10); | ||
@@ -211,13 +211,11 @@ } else if (typeof value === 'bigint' || isJsbi(value)) { | ||
} | ||
this.value = ptrArray.map( | ||
(pathEl): Element => { | ||
try { | ||
return JSON.parse(pathEl); | ||
} catch (e) { | ||
// ignore errors, these are just regular strings | ||
} | ||
this.value = ptrArray.map((pathEl): Element => { | ||
try { | ||
return JSON.parse(pathEl); | ||
} catch (e) { | ||
// ignore errors, these are just regular strings | ||
} | ||
return pathEl; | ||
}, | ||
); | ||
return pathEl; | ||
}); | ||
} else { | ||
@@ -224,0 +222,0 @@ this.value = value; |
@@ -0,1 +1,4 @@ | ||
/* eslint-disable @typescript-eslint/prefer-for-of */ | ||
// Allow usage of for loops, since here performance is paramount | ||
// Copyright (c) 2018, Arista Networks, Inc. | ||
@@ -48,3 +51,3 @@ // | ||
if (Object.getPrototypeOf(value) === proto) { | ||
// eslint-disable-next-line no-use-before-define | ||
// eslint-disable-next-line @typescript-eslint/no-use-before-define | ||
return createTypedMap(value as PlainObject<unknown>); | ||
@@ -51,0 +54,0 @@ } |
@@ -40,3 +40,3 @@ import JSBI from 'jsbi'; | ||
let lowNum = 0; | ||
if (str[0] === '-') { | ||
if (str.startsWith('-')) { | ||
pos++; | ||
@@ -43,0 +43,0 @@ } |
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
251566
28
46
+ Addedjsbi@3.1.5(transitive)
- Removedjsbi@3.1.4(transitive)
Updatedjsbi@3.1.5