Comparing version 1.5.9 to 1.6.0
export { decode, decodeMultiple, Decoder, addExtension, clearSource,roundFloat32, isNativeAccelerationEnabled, | ||
Extension, Options, FLOAT32_OPTIONS} from '.' | ||
Extension, Options, FLOAT32_OPTIONS, setMaxLimits, MAX_LIMITS_OPTIONS } from '.' |
@@ -17,2 +17,9 @@ let decoder | ||
const STOP_CODE = {} | ||
let maxArraySize = 112810000 // This is the maximum array size in V8. We would potentially detect and set it higher | ||
// for JSC, but this is pretty large and should be sufficient for most use cases | ||
let maxMapSize = 16810000 // JavaScript has a fixed maximum map size of about 16710000, but JS itself enforces this, | ||
// so we don't need to | ||
let maxObjectSize = 16710000; // This is the maximum number of keys in a Map. It takes over a minute to create this | ||
// many keys in an object, so also probably a reasonable choice there. | ||
let strings = EMPTY_ARRAY | ||
@@ -298,2 +305,3 @@ let stringPosition = 0 | ||
while ((value = read()) != STOP_CODE) { | ||
if (i >= maxArraySize) throw new Error(`Array length exceeds ${maxArraySize}`) | ||
array[i++] = value | ||
@@ -306,4 +314,15 @@ } | ||
let object = {} | ||
if (currentDecoder.keyMap) while((key = read()) != STOP_CODE) object[safeKey(currentDecoder.decodeKey(key))] = read() | ||
else while ((key = read()) != STOP_CODE) object[safeKey(key)] = read() | ||
let i = 0; | ||
if (currentDecoder.keyMap) { | ||
while((key = read()) != STOP_CODE) { | ||
if (i++ >= maxMapSize) throw new Error(`Property count exceeds ${maxMapSize}`) | ||
object[safeKey(currentDecoder.decodeKey(key))] = read() | ||
} | ||
} | ||
else { | ||
while ((key = read()) != STOP_CODE) { | ||
if (i++ >= maxMapSize) throw new Error(`Property count exceeds ${maxMapSize}`) | ||
object[safeKey(key)] = read() | ||
} | ||
} | ||
return object | ||
@@ -316,4 +335,20 @@ } else { | ||
let map = new Map() | ||
if (currentDecoder.keyMap) while((key = read()) != STOP_CODE) map.set(currentDecoder.decodeKey(key), read()) | ||
else while ((key = read()) != STOP_CODE) map.set(key, read()) | ||
if (currentDecoder.keyMap) { | ||
let i = 0; | ||
while((key = read()) != STOP_CODE) { | ||
if (i++ >= maxMapSize) { | ||
throw new Error(`Map size exceeds ${maxMapSize}`); | ||
} | ||
map.set(currentDecoder.decodeKey(key), read()) | ||
} | ||
} | ||
else { | ||
let i = 0; | ||
while ((key = read()) != STOP_CODE) { | ||
if (i++ >= maxMapSize) { | ||
throw new Error(`Map size exceeds ${maxMapSize}`); | ||
} | ||
map.set(key, read()) | ||
} | ||
} | ||
return map | ||
@@ -349,2 +384,3 @@ } | ||
case 4: // array | ||
if (token >= maxArraySize) throw new Error(`Array length exceeds ${maxArraySize}`) | ||
let array = new Array(token) | ||
@@ -356,2 +392,3 @@ //if (currentDecoder.keyMap) for (let i = 0; i < token; i++) array[i] = currentDecoder.decodeKey(read()) | ||
case 5: // map | ||
if (token >= maxMapSize) throw new Error(`Map size exceeds ${maxArraySize}`) | ||
if (currentDecoder.mapsAsObjects) { | ||
@@ -458,2 +495,3 @@ let object = {} | ||
function createStructureReader(structure) { | ||
if (!structure) throw new Error('Structure is required in record definition'); | ||
function readObject() { | ||
@@ -896,3 +934,3 @@ // get the array size from the header | ||
for (let i = 0, l = buffer.byteLength; i < l; i++) { | ||
value = BigInt(buffer[i]) + value << BigInt(8) | ||
value = BigInt(buffer[i]) + (value << BigInt(8)) | ||
} | ||
@@ -1247,2 +1285,8 @@ return value | ||
export function setSizeLimits(limits) { | ||
if (limits.maxMapSize) maxMapSize = limits.maxMapSize; | ||
if (limits.maxArraySize) maxArraySize = limits.maxArraySize; | ||
if (limits.maxObjectSize) maxObjectSize = limits.maxObjectSize; | ||
} | ||
export const mult10 = new Array(147) // this is a table matching binary exponents to the multiplier to determine significant digit rounding | ||
@@ -1249,0 +1293,0 @@ for (let i = 0; i < 256; i++) { |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CBOR={})}(this,(function(e){"use strict";let t,r,n;try{t=new TextDecoder}catch(e){}let i=0;const s={};let o,a,l,f,u,c,d,h={},y=0,p=0,g=[],b=[],w={useRecords:!1,mapsAsObjects:!0},m=!1,A=2;var v;try{new v("")}catch(e){A=1/0}class O{constructor(e){if(e&&(!e.keyMap&&!e._keyMap||e.useRecords||(e.useRecords=!1,e.mapsAsObjects=!0),!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.getStructures&&(e.getShared=e.getStructures),e.getShared&&!e.structures&&((e.structures=[]).uninitialized=!0),e.keyMap)){this.mapKey=new Map;for(let[t,r]of Object.entries(e.keyMap))this.mapKey.set(r,t)}Object.assign(this,e)}decodeKey(e){return this.keyMap&&this.mapKey.get(e)||e}encodeKey(e){return this.keyMap&&this.keyMap.hasOwnProperty(e)?this.keyMap[e]:e}encodeKeys(e){if(!this._keyMap)return e;let t=new Map;for(let[r,n]of Object.entries(e))t.set(this._keyMap.hasOwnProperty(r)?this._keyMap[r]:r,n);return t}decodeKeys(e){if(!this._keyMap||"Map"!=e.constructor.name)return e;if(!this._mapKey){this._mapKey=new Map;for(let[e,t]of Object.entries(this._keyMap))this._mapKey.set(t,e)}let t={};return e.forEach(((e,r)=>t[M(this._mapKey.has(r)?this._mapKey.get(r):r)]=e)),t}mapDecode(e,t){let r=this.decode(e);return this._keyMap&&"Array"===r.constructor.name?r.map((e=>this.decodeKeys(e))):r}decode(e,t){if(r)return H((()=>(Y(),this?this.decode(e,t):O.prototype.decode.call(w,e,t))));n=t>-1?t:e.length,i=0,p=0,a=null,l=null,r=e;try{c=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(t){if(r=null,e instanceof Uint8Array)throw t;throw new Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}if(this instanceof O){if(h=this,u=this.sharedValues&&(this.pack?new Array(this.maxPrivatePackedValues||16).concat(this.sharedValues):this.sharedValues),this.structures)return o=this.structures,k();(!o||o.length>0)&&(o=[])}else h=w,(!o||o.length>0)&&(o=[]),u=null;return k()}decodeMultiple(e,t){let r,n=0;try{let s=e.length;m=!0;let o=this?this.decode(e,s):Z.decode(e,s);if(!t){for(r=[o];i<s;)n=i,r.push(k());return r}if(!1===t(o))return;for(;i<s;)if(n=i,!1===t(k()))return}catch(e){throw e.lastPosition=n,e.values=r,e}finally{m=!1,Y()}}}function k(){try{let e=U();if(l){if(i>=l.postBundlePosition){let e=new Error("Unexpected bundle position");throw e.incomplete=!0,e}i=l.postBundlePosition,l=null}if(i==n)o=null,r=null,f&&(f=null);else{if(i>n){let e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}if(!m)throw new Error("Data read, but end of buffer not reached")}return e}catch(e){throw Y(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer"))&&(e.incomplete=!0),e}}function U(){let e=r[i++],t=e>>5;if(e&=31,e>23)switch(e){case 24:e=r[i++];break;case 25:if(7==t)return function(){let e=r[i++],t=r[i++],n=(127&e)>>2;if(31===n)return t||3&e?NaN:128&e?-1/0:1/0;if(0===n){let r=((3&e)<<8|t)/(1<<24);return 128&e?-r:r}return _[3]=128&e|56+(n>>1),_[2]=(7&e)<<5|t>>3,_[1]=t<<5,_[0]=0,V[0]}();e=c.getUint16(i),i+=2;break;case 26:if(7==t){let e=c.getFloat32(i);if(h.useFloat32>2){let t=$[(127&r[i])<<1|r[i+1]>>7];return i+=4,(t*e+(e>0?.5:-.5)>>0)/t}return i+=4,e}e=c.getUint32(i),i+=4;break;case 27:if(7==t){let e=c.getFloat64(i);return i+=8,e}if(t>1){if(c.getUint32(i)>0)throw new Error("JavaScript does not support arrays, maps, or strings with length over 4294967295");e=c.getUint32(i+4)}else h.int64AsNumber?(e=4294967296*c.getUint32(i),e+=c.getUint32(i+4)):e=c.getBigUint64(i);i+=8;break;case 31:switch(t){case 2:case 3:throw new Error("Indefinite length not supported for byte or text strings");case 4:let e,r=[],n=0;for(;(e=U())!=s;)r[n++]=e;return 4==t?r:3==t?r.join(""):Buffer.concat(r);case 5:let i;if(h.mapsAsObjects){let e={};if(h.keyMap)for(;(i=U())!=s;)e[M(h.decodeKey(i))]=U();else for(;(i=U())!=s;)e[M(i)]=U();return e}{d&&(h.mapsAsObjects=!0,d=!1);let e=new Map;if(h.keyMap)for(;(i=U())!=s;)e.set(h.decodeKey(i),U());else for(;(i=U())!=s;)e.set(i,U());return e}case 7:return s;default:throw new Error("Invalid major type for indefinite length "+t)}default:throw new Error("Unknown token "+e)}switch(t){case 0:return e;case 1:return~e;case 2:return f=e,h.copyBuffers?Uint8Array.prototype.slice.call(r,i,i+=f):r.subarray(i,i+=f);case 3:if(p>=i)return a.slice(i-y,(i+=e)-y);if(0==p&&n<140&&e<32){let t=e<16?B(e):function(e){let t=i,n=new Array(e);for(let s=0;s<e;s++){const e=r[i++];if((128&e)>0)return void(i=t);n[s]=e}return x.apply(String,n)}(e);if(null!=t)return t}return S(e);case 4:let t=new Array(e);for(let r=0;r<e;r++)t[r]=U();return t;case 5:if(h.mapsAsObjects){let t={};if(h.keyMap)for(let r=0;r<e;r++)t[M(h.decodeKey(U()))]=U();else for(let r=0;r<e;r++)t[M(U())]=U();return t}{d&&(h.mapsAsObjects=!0,d=!1);let t=new Map;if(h.keyMap)for(let r=0;r<e;r++)t.set(h.decodeKey(U()),U());else for(let r=0;r<e;r++)t.set(U(),U());return t}case 6:if(e>=57337){let t=o[8191&e];if(t)return t.read||(t.read=E(t)),t.read();if(e<65536){if(57343==e){let e=W(),t=U(),r=U();R(t,r);let n={};if(h.keyMap)for(let t=2;t<e;t++){n[M(h.decodeKey(r[t-2]))]=U()}else for(let t=2;t<e;t++){n[M(r[t-2])]=U()}return n}if(57342==e){let e=W(),t=U();for(let r=2;r<e;r++)R(t++,U());return U()}if(57337==e)return function(){let e=W(),t=i+U();for(let t=2;t<e;t++){let e=W();i+=e}let r=i;return i=t,l=[j(W()),j(W())],l.position0=0,l.position1=0,l.postBundlePosition=i,i=r,U()}();if(h.getShared&&(J(),t=o[8191&e],t))return t.read||(t.read=E(t)),t.read()}}let s=g[e];if(s)return s.handlesRead?s(U):s(U());{let t=U();for(let r=0;r<b.length;r++){let n=b[r](e,t);if(void 0!==n)return n}return new P(t,e)}case 7:switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:let t=(u||C())[e];if(void 0!==t)return t;throw new Error("Unknown token "+e)}default:if(isNaN(e)){let e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}throw new Error("Unknown CBOR token "+e)}var f}const I=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function E(e){return e.slowReads=0,function(){let e=r[i++];if(e&=31,e>23)switch(e){case 24:e=r[i++];break;case 25:e=c.getUint16(i),i+=2;break;case 26:e=c.getUint32(i),i+=4;break;default:throw new Error("Expected array header, but got "+r[i-1])}let t=this.compiledReader;for(;t;){if(t.propertyCount===e)return t(U);t=t.next}if(this.slowReads++>=A){let r=this.length==e?this:this.slice(0,e);return t=h.keyMap?new v("r","return {"+r.map((e=>h.decodeKey(e))).map((e=>I.test(e)?M(e)+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"}"):new v("r","return {"+r.map((e=>I.test(e)?M(e)+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"}"),this.compiledReader&&(t.next=this.compiledReader),t.propertyCount=e,this.compiledReader=t,t(U)}let n={};if(h.keyMap)for(let t=0;t<e;t++)n[M(h.decodeKey(this[t]))]=U();else for(let t=0;t<e;t++)n[M(this[t])]=U();return n}}function M(e){if("string"==typeof e)return"__proto__"===e?"__proto_":e;if("number"==typeof e||"boolean"==typeof e||"bigint"==typeof e)return e.toString();if(null==e)return e+"";throw new Error("Invalid property name type "+typeof e)}let S=j;function j(e){let n;if(e<16&&(n=B(e)))return n;if(e>64&&t)return t.decode(r.subarray(i,i+=e));const s=i+e,o=[];for(n="";i<s;){const e=r[i++];if(0==(128&e))o.push(e);else if(192==(224&e)){const t=63&r[i++];o.push((31&e)<<6|t)}else if(224==(240&e)){const t=63&r[i++],n=63&r[i++];o.push((31&e)<<12|t<<6|n)}else if(240==(248&e)){let t=(7&e)<<18|(63&r[i++])<<12|(63&r[i++])<<6|63&r[i++];t>65535&&(t-=65536,o.push(t>>>10&1023|55296),t=56320|1023&t),o.push(t)}else o.push(e);o.length>=4096&&(n+=x.apply(String,o),o.length=0)}return o.length>0&&(n+=x.apply(String,o)),n}let x=String.fromCharCode;function B(e){if(e<4){if(e<2){if(0===e)return"";{let e=r[i++];return(128&e)>1?void(i-=1):x(e)}}{let t=r[i++],n=r[i++];if((128&t)>0||(128&n)>0)return void(i-=2);if(e<3)return x(t,n);let s=r[i++];return(128&s)>0?void(i-=3):x(t,n,s)}}{let t=r[i++],n=r[i++],s=r[i++],o=r[i++];if((128&t)>0||(128&n)>0||(128&s)>0||(128&o)>0)return void(i-=4);if(e<6){if(4===e)return x(t,n,s,o);{let e=r[i++];return(128&e)>0?void(i-=5):x(t,n,s,o,e)}}if(e<8){let a=r[i++],l=r[i++];if((128&a)>0||(128&l)>0)return void(i-=6);if(e<7)return x(t,n,s,o,a,l);let f=r[i++];return(128&f)>0?void(i-=7):x(t,n,s,o,a,l,f)}{let a=r[i++],l=r[i++],f=r[i++],u=r[i++];if((128&a)>0||(128&l)>0||(128&f)>0||(128&u)>0)return void(i-=8);if(e<10){if(8===e)return x(t,n,s,o,a,l,f,u);{let e=r[i++];return(128&e)>0?void(i-=9):x(t,n,s,o,a,l,f,u,e)}}if(e<12){let c=r[i++],d=r[i++];if((128&c)>0||(128&d)>0)return void(i-=10);if(e<11)return x(t,n,s,o,a,l,f,u,c,d);let h=r[i++];return(128&h)>0?void(i-=11):x(t,n,s,o,a,l,f,u,c,d,h)}{let c=r[i++],d=r[i++],h=r[i++],y=r[i++];if((128&c)>0||(128&d)>0||(128&h)>0||(128&y)>0)return void(i-=12);if(e<14){if(12===e)return x(t,n,s,o,a,l,f,u,c,d,h,y);{let e=r[i++];return(128&e)>0?void(i-=13):x(t,n,s,o,a,l,f,u,c,d,h,y,e)}}{let p=r[i++],g=r[i++];if((128&p)>0||(128&g)>0)return void(i-=14);if(e<15)return x(t,n,s,o,a,l,f,u,c,d,h,y,p,g);let b=r[i++];return(128&b)>0?void(i-=15):x(t,n,s,o,a,l,f,u,c,d,h,y,p,g,b)}}}}}let V=new Float32Array(1),_=new Uint8Array(V.buffer,0,4);new Array(4096);class P{constructor(e,t){this.value=e,this.tag=t}}g[0]=e=>new Date(e),g[1]=e=>new Date(Math.round(1e3*e)),g[2]=e=>{let t=BigInt(0);for(let r=0,n=e.byteLength;r<n;r++)t=BigInt(e[r])+t<<BigInt(8);return t},g[3]=e=>BigInt(-1)-g[2](e),g[4]=e=>+(e[1]+"e"+e[0]),g[5]=e=>e[1]*Math.exp(e[0]*Math.log(2));const R=(e,t)=>{let r=o[e-=57344];r&&r.isShared&&((o.restoreStructures||(o.restoreStructures=[]))[e]=r),o[e]=t,t.read=E(t)};g[105]=e=>{let t=e.length,r=e[1];R(e[0],r);let n={};for(let i=2;i<t;i++){n[M(r[i-2])]=e[i]}return n},g[14]=e=>l?l[0].slice(l.position0,l.position0+=e):new P(e,14),g[15]=e=>l?l[1].slice(l.position1,l.position1+=e):new P(e,15);let T={Error:Error,RegExp:RegExp};g[27]=e=>(T[e[0]]||Error)(e[1],e[2]);const F=e=>{if(132!=r[i++]){let e=new Error("Packed values structure must be followed by a 4 element array");throw r.length<i&&(e.incomplete=!0),e}let t=e();if(!t||!t.length){let e=new Error("Packed values structure must be followed by a 4 element array");throw e.incomplete=!0,e}return u=u?t.concat(u.slice(t.length)):t,u.prefixes=e(),u.suffixes=e(),e()};function D(e,t){return"string"==typeof e?e+t:e instanceof Array?e.concat(t):Object.assign({},e,t)}function C(){if(!u){if(!h.getShared)throw new Error("No packed values available");J()}return u}F.handlesRead=!0,g[51]=F,g[6]=e=>{if(!u){if(!h.getShared)return new P(e,6);J()}if("number"==typeof e)return u[16+(e>=0?2*e:-2*e-1)];let t=new Error("No support for non-integer packed references yet");throw void 0===e&&(t.incomplete=!0),t},g[28]=e=>{f||(f=new Map,f.id=0);let t,n=f.id++,s=i;t=r[i]>>5==4?[]:{};let o={target:t};f.set(n,o);let a=e();return o.used?(Object.getPrototypeOf(t)!==Object.getPrototypeOf(a)&&(i=s,t=a,f.set(n,{target:t}),a=e()),Object.assign(t,a)):(o.target=a,a)},g[28].handlesRead=!0,g[29]=e=>{let t=f.get(e);return t.used=!0,t.target},g[258]=e=>new Set(e),(g[259]=e=>(h.mapsAsObjects&&(h.mapsAsObjects=!1,d=!0),e())).handlesRead=!0;b.push(((e,t)=>e>=225&&e<=255?D(C().prefixes[e-224],t):e>=28704&&e<=32767?D(C().prefixes[e-28672],t):e>=1879052288&&e<=2147483647?D(C().prefixes[e-1879048192],t):e>=216&&e<=223?D(t,C().suffixes[e-216]):e>=27647&&e<=28671?D(t,C().suffixes[e-27639]):e>=1811940352&&e<=1879048191?D(t,C().suffixes[e-1811939328]):1399353956==e?{packedValues:u,structures:o.slice(0),version:t}:55799==e?t:void 0));const K=1==new Uint8Array(new Uint16Array([1]).buffer)[0],N=[Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,"undefined"==typeof BigUint64Array?{name:"BigUint64Array"}:BigUint64Array,Int8Array,Int16Array,Int32Array,"undefined"==typeof BigInt64Array?{name:"BigInt64Array"}:BigInt64Array,Float32Array,Float64Array],L=[64,68,69,70,71,72,77,78,79,85,86];for(let e=0;e<N.length;e++)z(N[e],L[e]);function z(e,t){let r,n="get"+e.name.slice(0,-5);"function"==typeof e?r=e.BYTES_PER_ELEMENT:e=null;for(let i=0;i<2;i++){if(!i&&1==r)continue;let s=2==r?1:4==r?2:8==r?3:0;g[i?t:t-4]=1==r||i==K?n=>{if(!e)throw new Error("Could not find typed array for code "+t);return h.copyBuffers||1!==r&&(2!==r||1&n.byteOffset)&&(4!==r||3&n.byteOffset)&&(8!==r||7&n.byteOffset)?new e(Uint8Array.prototype.slice.call(n,0).buffer):new e(n.buffer,n.byteOffset,n.byteLength>>s)}:r=>{if(!e)throw new Error("Could not find typed array for code "+t);let o=new DataView(r.buffer,r.byteOffset,r.byteLength),a=r.length>>s,l=new e(a),f=o[n];for(let e=0;e<a;e++)l[e]=f.call(o,e<<s,i);return l}}}function W(){let e=31&r[i++];if(e>23)switch(e){case 24:e=r[i++];break;case 25:e=c.getUint16(i),i+=2;break;case 26:e=c.getUint32(i),i+=4}return e}function J(){if(h.getShared){let e=H((()=>(r=null,h.getShared())))||{},t=e.structures||[];h.sharedVersion=e.version,u=h.sharedValues=e.packedValues,!0===o?h.structures=o=t:o.splice.apply(o,[0,t.length].concat(t))}}function H(e){let t=n,s=i,u=y,d=p,g=a,b=f,w=l,A=new Uint8Array(r.slice(0,n)),v=o,O=h,k=m,U=e();return n=t,i=s,y=u,p=d,a=g,f=b,l=w,r=A,m=k,o=v,h=O,c=new DataView(r.buffer,r.byteOffset,r.byteLength),U}function Y(){r=null,f=null,o=null}const $=new Array(147);for(let e=0;e<256;e++)$[e]=+("1e"+Math.floor(45.15-.30103*e));let Z=new O({useRecords:!1});const q=Z.decode,G=Z.decodeMultiple,Q={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};let X,ee,te;try{X=new TextEncoder}catch(e){}const re="object"==typeof globalThis&&globalThis.Buffer,ne=void 0!==re,ie=ne?re.allocUnsafeSlow:Uint8Array,se=ne?re:Uint8Array,oe=ne?4294967296:2144337920;let ae,le,fe,ue,ce=0,de=null;const he=/[\u0080-\uFFFF]/,ye=Symbol("record-id");class pe extends O{constructor(e){let t,r,n,i,s;super(e),this.offset=0,e=e||{};let o=se.prototype.utf8Write?function(e,t,r){return le.utf8Write(e,t,r)}:!(!X||!X.encodeInto)&&function(e,t){return X.encodeInto(e,le.subarray(t)).written},a=this,l=e.structures||e.saveStructures,f=e.maxSharedStructures;if(null==f&&(f=l?128:0),f>8190)throw new Error("Maximum maxSharedStructure is 8190");let u=e.sequential;u&&(f=0),this.structures||(this.structures=[]),this.saveStructures&&(this.saveShared=this.saveStructures);let c,d,h,y=e.sharedValues;if(y){h=Object.create(null);for(let e=0,t=y.length;e<t;e++)h[y[e]]=e}let p=[],g=0,b=0;this.mapEncode=function(e,t){if(this._keyMap&&!this._mapped&&"Array"===e.constructor.name)e=e.map((e=>this.encodeKeys(e)));return this.encode(e,t)},this.encode=function(o,l){if(le||(le=new ie(8192),fe=new DataView(le.buffer,0,8192),ce=0),ue=le.length-10,ue-ce<2048?(le=new ie(le.length),fe=new DataView(le.buffer,0,le.length),ue=le.length-10,ce=0):l===Pe&&(ce=ce+7&2147483640),t=ce,a.useSelfDescribedHeader&&(fe.setUint32(ce,3654940416),ce+=3),s=a.structuredClone?new Map:null,a.bundleStrings&&"string"!=typeof o?(de=[],de.size=1/0):de=null,r=a.structures,r){if(r.uninitialized){let e=a.getShared()||{};a.structures=r=e.structures||[],a.sharedVersion=e.version;let t=a.sharedValues=e.packedValues;if(t){h={};for(let e=0,r=t.length;e<r;e++)h[t[e]]=e}}let e=r.length;if(e>f&&!u&&(e=f),!r.transitions){r.transitions=Object.create(null);for(let t=0;t<e;t++){let e=r[t];if(!e)continue;let n,i=r.transitions;for(let r=0,s=e.length;r<s;r++){void 0===i[ye]&&(i[ye]=t);let s=e[r];n=i[s],n||(n=i[s]=Object.create(null)),i=n}i[ye]=1048576|t}}u||(r.nextId=e)}if(n&&(n=!1),i=r||[],d=h,e.pack){let t=new Map;if(t.values=[],t.encoder=a,t.maxValues=e.maxPrivatePackedValues||(h?16:1/0),t.objectMap=h||!1,t.samplingPackedValues=c,ve(o,t),t.values.length>0){le[ce++]=216,le[ce++]=51,we(4);let e=t.values;w(e),we(0),we(0),d=Object.create(h||null);for(let t=0,r=e.length;t<r;t++)d[e[t]]=t}}ae=l&Te;try{if(ae)return;if(w(o),de&&Ie(t,w),a.offset=ce,s&&s.idsToInsert){ce+=2*s.idsToInsert.length,ce>ue&&A(ce),a.offset=ce;let e=function(e,t){let r,n=2*t.length,i=e.length-n;t.sort(((e,t)=>e.offset>t.offset?1:-1));for(let r=0;r<t.length;r++){let n=t[r];n.id=r;for(let t of n.references)e[t++]=r>>8,e[t]=255&r}for(;r=t.pop();){let t=r.offset;e.copyWithin(t+n,t,i),n-=2;let s=t+n;e[s++]=216,e[s++]=28,i=t}return e}(le.subarray(t,ce),s.idsToInsert);return s=null,e}return l&Pe?(le.start=t,le.end=ce,le):le.subarray(t,ce)}finally{if(r)if(b<10&&b++,r.length>f&&(r.length=f),g>1e4)r.transitions=null,b=0,g=0,p.length>0&&(p=[]);else if(p.length>0&&!u){for(let e=0,t=p.length;e<t;e++)p[e][ye]=void 0;p=[]}if(n&&a.saveShared){a.structures.length>f&&(a.structures=a.structures.slice(0,f));let e=le.subarray(t,ce);return!1===a.updateSharedData()?a.encode(o):e}l&Re&&(ce=t)}},this.findCommonStringsToPack=()=>(c=new Map,h||(h=Object.create(null)),e=>{let t=e&&e.threshold||4,r=this.pack?e.maxPrivatePackedValues||16:0;y||(y=this.sharedValues=[]);for(let[e,i]of c)i.count>t&&(h[e]=r++,y.push(e),n=!0);for(;this.saveShared&&!1===this.updateSharedData(););c=null});const w=r=>{ce>ue&&(le=A(ce));var n,i=typeof r;if("string"===i){if(d){let t=d[r];if(t>=0)return void(t<16?le[ce++]=t+224:(le[ce++]=198,w(1&t?15-t>>1:t-16>>1)));if(c&&!e.pack){let e=c.get(r);e?e.count++:c.set(r,{count:1})}}let i,s=r.length;if(de&&s>=4&&s<1024){if((de.size+=s)>61440){let e,r=(de[0]?3*de[0].length+de[1].length:0)+10;ce+r>ue&&(le=A(ce+r)),le[ce++]=217,le[ce++]=223,le[ce++]=249,le[ce++]=de.position?132:130,le[ce++]=26,e=ce-t,ce+=4,de.position&&Ie(t,w),de=["",""],de.size=0,de.position=e}let e=he.test(r);return de[e?0:1]+=r,le[ce++]=e?206:207,void w(s)}i=s<32?1:s<256?2:s<65536?3:5;let a=3*s;if(ce+a>ue&&(le=A(ce+a)),s<64||!o){let e,t,o,a=ce+i;for(e=0;e<s;e++)t=r.charCodeAt(e),t<128?le[a++]=t:t<2048?(le[a++]=t>>6|192,le[a++]=63&t|128):55296==(64512&t)&&56320==(64512&(o=r.charCodeAt(e+1)))?(t=65536+((1023&t)<<10)+(1023&o),e++,le[a++]=t>>18|240,le[a++]=t>>12&63|128,le[a++]=t>>6&63|128,le[a++]=63&t|128):(le[a++]=t>>12|224,le[a++]=t>>6&63|128,le[a++]=63&t|128);n=a-ce-i}else n=o(r,ce+i,a);n<24?le[ce++]=96|n:n<256?(i<2&&le.copyWithin(ce+2,ce+1,ce+1+n),le[ce++]=120,le[ce++]=n):n<65536?(i<3&&le.copyWithin(ce+3,ce+2,ce+2+n),le[ce++]=121,le[ce++]=n>>8,le[ce++]=255&n):(i<5&&le.copyWithin(ce+5,ce+3,ce+3+n),le[ce++]=122,fe.setUint32(ce,n),ce+=4),ce+=n}else if("number"===i)if(this.alwaysUseFloat||r>>>0!==r)if(this.alwaysUseFloat||r>>0!==r){let e;if((e=this.useFloat32)>0&&r<4294967296&&r>=-2147483648){let t;if(le[ce++]=250,fe.setFloat32(ce,r),e<4||(t=r*$[(127&le[ce])<<1|le[ce+1]>>7])>>0===t)return void(ce+=4);ce--}le[ce++]=251,fe.setFloat64(ce,r),ce+=8}else r>=-24?le[ce++]=31-r:r>=-256?(le[ce++]=56,le[ce++]=~r):r>=-65536?(le[ce++]=57,fe.setUint16(ce,~r),ce+=2):(le[ce++]=58,fe.setUint32(ce,~r),ce+=4);else r<24?le[ce++]=r:r<256?(le[ce++]=24,le[ce++]=r):r<65536?(le[ce++]=25,le[ce++]=r>>8,le[ce++]=255&r):(le[ce++]=26,fe.setUint32(ce,r),ce+=4);else if("object"===i)if(r){if(s){let e=s.get(r);if(e){if(le[ce++]=216,le[ce++]=29,le[ce++]=25,!e.references){let t=s.idsToInsert||(s.idsToInsert=[]);e.references=[],t.push(e)}return e.references.push(ce-t),void(ce+=2)}s.set(r,{offset:ce-t})}let e=r.constructor;if(e===Object)m(r);else if(e===Array){(n=r.length)<24?le[ce++]=128|n:we(n);for(let e=0;e<n;e++)w(r[e])}else if(e===Map)if((this.mapsAsObjects?!1!==this.useTag259ForMaps:this.useTag259ForMaps)&&(le[ce++]=217,le[ce++]=1,le[ce++]=3),(n=r.size)<24?le[ce++]=160|n:n<256?(le[ce++]=184,le[ce++]=n):n<65536?(le[ce++]=185,le[ce++]=n>>8,le[ce++]=255&n):(le[ce++]=186,fe.setUint32(ce,n),ce+=4),a.keyMap)for(let[e,t]of r)w(a.encodeKey(e)),w(t);else for(let[e,t]of r)w(e),w(t);else{for(let e=0,t=ee.length;e<t;e++){if(r instanceof te[e]){let t=ee[e],n=t.tag;return null==n&&(n=t.getTag&&t.getTag.call(this,r)),n<24?le[ce++]=192|n:n<256?(le[ce++]=216,le[ce++]=n):n<65536?(le[ce++]=217,le[ce++]=n>>8,le[ce++]=255&n):n>-1&&(le[ce++]=218,fe.setUint32(ce,n),ce+=4),void t.encode.call(this,r,w,A)}}if(r[Symbol.iterator]){if(ae){let e=new Error("Iterable should be serialized as iterator");throw e.iteratorNotHandled=!0,e}le[ce++]=159;for(let e of r)w(e);return void(le[ce++]=255)}if(r[Symbol.asyncIterator]||Ae(r)){let e=new Error("Iterable/blob should be serialized as iterator");throw e.iteratorNotHandled=!0,e}if(this.useToJSON&&r.toJSON){const e=r.toJSON();if(e!==r)return w(e)}m(r)}}else le[ce++]=246;else if("boolean"===i)le[ce++]=r?245:244;else if("bigint"===i){if(r<BigInt(1)<<BigInt(64)&&r>=0)le[ce++]=27,fe.setBigUint64(ce,r);else if(r>-(BigInt(1)<<BigInt(64))&&r<0)le[ce++]=59,fe.setBigUint64(ce,-r-BigInt(1));else{if(!this.largeBigIntToFloat)throw new RangeError(r+" was too large to fit in CBOR 64-bit integer format, set largeBigIntToFloat to convert to float-64");le[ce++]=251,fe.setFloat64(ce,Number(r))}ce+=8}else{if("undefined"!==i)throw new Error("Unknown type: "+i);le[ce++]=247}},m=!1===this.useRecords?this.variableMapSize?e=>{let t=Object.keys(e),r=Object.values(e),n=t.length;if(n<24?le[ce++]=160|n:n<256?(le[ce++]=184,le[ce++]=n):n<65536?(le[ce++]=185,le[ce++]=n>>8,le[ce++]=255&n):(le[ce++]=186,fe.setUint32(ce,n),ce+=4),a.keyMap)for(let e=0;e<n;e++)w(a.encodeKey(t[e])),w(r[e]);else for(let e=0;e<n;e++)w(t[e]),w(r[e])}:e=>{le[ce++]=185;let r=ce-t;ce+=2;let n=0;if(a.keyMap)for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(w(a.encodeKey(t)),w(e[t]),n++);else for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(w(t),w(e[t]),n++);le[r+++t]=n>>8,le[r+t]=255&n}:(e,t)=>{let r,s,o,a=i.transitions||(i.transitions=Object.create(null)),l=0,u=0;if(this.keyMap){o=Object.keys(e).map((e=>this.encodeKey(e))),u=o.length;for(let e=0;e<u;e++){let t=o[e];r=a[t],r||(r=a[t]=Object.create(null),l++),a=r}}else for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(r=a[t],r||(1048576&a[ye]&&(s=65535&a[ye]),r=a[t]=Object.create(null),l++),a=r,u++);let c=a[ye];if(void 0!==c)c&=65535,le[ce++]=217,le[ce++]=c>>8|224,le[ce++]=255&c;else{if(o||(o=a.__keys__||(a.__keys__=Object.keys(e))),void 0===s?(c=i.nextId++,c||(c=0,i.nextId=1),c>=256&&(i.nextId=(c=f)+1)):c=s,i[c]=o,!(c<f)){if(a[ye]=c,fe.setUint32(ce,3655335680),ce+=3,l&&(g+=b*l),p.length>=256-f&&(p.shift()[ye]=void 0),p.push(a),we(u+2),w(57344+c),w(o),t)return;for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&w(e[t]);return}le[ce++]=217,le[ce++]=c>>8|224,le[ce++]=255&c,a=i.transitions;for(let e=0;e<u;e++)(void 0===a[ye]||1048576&a[ye])&&(a[ye]=c),a=a[o[e]];a[ye]=1048576|c,n=!0}if(u<24?le[ce++]=128|u:we(u),!t)for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&w(e[t])},A=e=>{let r;if(e>16777216){if(e-t>oe)throw new Error("Encoded buffer would be larger than maximum buffer size");r=Math.min(oe,4096*Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096))}else r=1+(Math.max(e-t<<2,le.length-1)>>12)<<12;let n=new ie(r);return fe=new DataView(n.buffer,0,r),le.copy?le.copy(n,0,t,e):n.set(le.slice(t,e)),ce-=t,t=0,ue=n.length-10,le=n};let v=100,O=1e3;function*k(e,r,n){let i=e.constructor;if(i===Object){let t=!1!==a.useRecords;t?m(e,!0):ge(Object.keys(e).length,160);for(let n in e){let i=e[n];t||w(n),i&&"object"==typeof i?r[n]?yield*k(i,r[n]):yield*U(i,r,n):w(i)}}else if(i===Array){let n=e.length;we(n);for(let i=0;i<n;i++){let n=e[i];n&&("object"==typeof n||ce-t>v)?r.element?yield*k(n,r.element):yield*U(n,r,"element"):w(n)}}else if(e[Symbol.iterator]){le[ce++]=159;for(let n of e)n&&("object"==typeof n||ce-t>v)?r.element?yield*k(n,r.element):yield*U(n,r,"element"):w(n);le[ce++]=255}else Ae(e)?(ge(e.size,64),yield le.subarray(t,ce),yield e,I()):e[Symbol.asyncIterator]?(le[ce++]=159,yield le.subarray(t,ce),yield e,I(),le[ce++]=255):w(e);n&&ce>t?yield le.subarray(t,ce):ce-t>v&&(yield le.subarray(t,ce),I())}function*U(e,r,n){let i=ce-t;try{w(e),ce-t>v&&(yield le.subarray(t,ce),I())}catch(s){if(!s.iteratorNotHandled)throw s;r[n]={},ce=t+i,yield*k.call(this,e,r[n])}}function I(){v=O,a.encode(null,Te)}function E(e,t,r){return v=t&&t.chunkThreshold?O=t.chunkThreshold:100,e&&"object"==typeof e?(a.encode(null,Te),r(e,a.iterateProperties||(a.iterateProperties={}),!0)):[a.encode(e)]}async function*M(e,t){for(let r of k(e,t,!0)){let e=r.constructor;if(e===se||e===Uint8Array)yield r;else if(Ae(r)){let e,t=r.stream().getReader();for(;!(e=await t.read()).done;)yield e.value}else if(r[Symbol.asyncIterator])for await(let e of r)I(),e?yield*M(e,t.async||(t.async={})):yield a.encode(e);else yield r}}this.encodeAsIterable=function(e,t){return E(e,t,k)},this.encodeAsAsyncIterable=function(e,t){return E(e,t,M)}}useBuffer(e){le=e,fe=new DataView(le.buffer,le.byteOffset,le.byteLength),ce=0}clearSharedData(){this.structures&&(this.structures=[]),this.sharedValues&&(this.sharedValues=void 0)}updateSharedData(){let e=this.sharedVersion||0;this.sharedVersion=e+1;let t=this.structures.slice(0),r=new be(t,this.sharedValues,this.sharedVersion),n=this.saveShared(r,(t=>(t&&t.version||0)==e));return!1===n?(r=this.getShared()||{},this.structures=r.structures||[],this.sharedValues=r.packedValues,this.sharedVersion=r.version,this.structures.nextId=this.structures.length):t.forEach(((e,t)=>this.structures[t]=e)),n}}function ge(e,t){e<24?le[ce++]=t|e:e<256?(le[ce++]=24|t,le[ce++]=e):e<65536?(le[ce++]=25|t,le[ce++]=e>>8,le[ce++]=255&e):(le[ce++]=26|t,fe.setUint32(ce,e),ce+=4)}class be{constructor(e,t,r){this.structures=e,this.packedValues=t,this.version=r}}function we(e){e<24?le[ce++]=128|e:e<256?(le[ce++]=152,le[ce++]=e):e<65536?(le[ce++]=153,le[ce++]=e>>8,le[ce++]=255&e):(le[ce++]=154,fe.setUint32(ce,e),ce+=4)}const me="undefined"==typeof Blob?function(){}:Blob;function Ae(e){if(e instanceof me)return!0;let t=e[Symbol.toStringTag];return"Blob"===t||"File"===t}function ve(e,t){switch(typeof e){case"string":if(e.length>3){if(t.objectMap[e]>-1||t.values.length>=t.maxValues)return;let r=t.get(e);if(r)2==++r.count&&t.values.push(e);else if(t.set(e,{count:1}),t.samplingPackedValues){let r=t.samplingPackedValues.get(e);r?r.count++:t.samplingPackedValues.set(e,{count:1})}}break;case"object":if(e)if(e instanceof Array)for(let r=0,n=e.length;r<n;r++)ve(e[r],t);else{let n=!t.encoder.useRecords;for(var r in e)e.hasOwnProperty(r)&&(n&&ve(r,t),ve(e[r],t))}break;case"function":console.log(e)}}const Oe=1==new Uint8Array(new Uint16Array([1]).buffer)[0];function ke(e,t){return!Oe&&t>1&&(e-=4),{tag:e,encode:function(e,t){let r=e.byteLength,n=e.byteOffset||0,i=e.buffer||e;t(ne?re.from(i,n,r):new Uint8Array(i,n,r))}}}function Ue(e,t){let r=e.byteLength;r<24?le[ce++]=64+r:r<256?(le[ce++]=88,le[ce++]=r):r<65536?(le[ce++]=89,le[ce++]=r>>8,le[ce++]=255&r):(le[ce++]=90,fe.setUint32(ce,r),ce+=4),ce+r>=le.length&&t(ce+r),le.set(e.buffer?e:new Uint8Array(e),ce),ce+=r}function Ie(e,t){fe.setUint32(de.position+e,ce-de.position-e+1);let r=de;de=null,t(r[0]),t(r[1])}te=[Date,Set,Error,RegExp,P,ArrayBuffer,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,"undefined"==typeof BigUint64Array?function(){}:BigUint64Array,Int8Array,Int16Array,Int32Array,"undefined"==typeof BigInt64Array?function(){}:BigInt64Array,Float32Array,Float64Array,be],ee=[{tag:1,encode(e,t){let r=e.getTime()/1e3;(this.useTimestamp32||0===e.getMilliseconds())&&r>=0&&r<4294967296?(le[ce++]=26,fe.setUint32(ce,r),ce+=4):(le[ce++]=251,fe.setFloat64(ce,r),ce+=8)}},{tag:258,encode(e,t){t(Array.from(e))}},{tag:27,encode(e,t){t([e.name,e.message])}},{tag:27,encode(e,t){t(["RegExp",e.source,e.flags])}},{getTag:e=>e.tag,encode(e,t){t(e.value)}},{encode(e,t,r){Ue(e,r)}},{getTag(e){if(e.constructor===Uint8Array&&(this.tagUint8Array||ne&&!1!==this.tagUint8Array))return 64},encode(e,t,r){Ue(e,r)}},ke(68,1),ke(69,2),ke(70,4),ke(71,8),ke(72,1),ke(77,2),ke(78,4),ke(79,8),ke(85,4),ke(86,8),{encode(e,t){let r=e.packedValues||[],n=e.structures||[];if(r.values.length>0){le[ce++]=216,le[ce++]=51,we(4);let e=r.values;t(e),we(0),we(0),packedObjectMap=Object.create(sharedPackedObjectMap||null);for(let t=0,r=e.length;t<r;t++)packedObjectMap[e[t]]=t}if(n){fe.setUint32(ce,3655335424),ce+=3;let r=n.slice(0);r.unshift(57344),r.push(new P(e.version,1399353956)),t(r)}else t(new P(e.version,1399353956))}}];let Ee=new pe({useRecords:!1});const Me=Ee.encode,Se=Ee.encodeAsIterable,je=Ee.encodeAsAsyncIterable,{NEVER:xe,ALWAYS:Be,DECIMAL_ROUND:Ve,DECIMAL_FIT:_e}=Q,Pe=512,Re=1024,Te=2048;e.ALWAYS=Be,e.DECIMAL_FIT=_e,e.DECIMAL_ROUND=Ve,e.Decoder=O,e.Encoder=pe,e.FLOAT32_OPTIONS=Q,e.NEVER=xe,e.REUSE_BUFFER_MODE=Pe,e.Tag=P,e.addExtension=function(e){if(e.Class){if(!e.encode)throw new Error("Extension has no encode function");te.unshift(e.Class),ee.unshift(e)}!function(e){g[e.tag]=e.decode}(e)},e.clearSource=Y,e.decode=q,e.decodeIter=function(e,t={}){if(!e||"object"!=typeof e)throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a promise");const r=new O(t);let n;const i=e=>{let t;n&&(e=Buffer.concat([n,e]),n=void 0);try{t=r.decodeMultiple(e)}catch(r){if(!r.incomplete)throw r;n=e.slice(r.lastPosition),t=r.values}return t};return"function"==typeof e[Symbol.iterator]?function*(){for(const t of e)yield*i(t)}():"function"==typeof e[Symbol.asyncIterator]?async function*(){for await(const t of e)yield*i(t)}():void 0},e.decodeMultiple=G,e.encode=Me,e.encodeAsAsyncIterable=je,e.encodeAsIterable=Se,e.encodeIter=function(e,t={}){if(e&&"object"==typeof e){if("function"==typeof e[Symbol.iterator])return function*(e,t){const r=new pe(t);for(const t of e)yield r.encode(t)}(e,t);if("function"==typeof e.then||"function"==typeof e[Symbol.asyncIterator])return async function*(e,t){const r=new pe(t);for await(const t of e)yield r.encode(t)}(e,t);throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a Promise")}throw new Error("first argument must be an Iterable, Async Iterable, or a Promise for an Async Iterable")},e.isNativeAccelerationEnabled=!1,e.roundFloat32=function(e){V[0]=e;let t=$[(127&_[3])<<1|_[2]>>7];return(t*e+(e>0?.5:-.5)>>0)/t}})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CBOR={})}(this,(function(e){"use strict";let t,r,n;try{t=new TextDecoder}catch(e){}let i=0;const s={};let o,a,l,f,u,c,d,h=11281e4,y=1681e4,p={},g=0,w=0,b=[],m=[],A={useRecords:!1,mapsAsObjects:!0},v=!1,O=2;var k;try{new k("")}catch(e){O=1/0}class E{constructor(e){if(e&&(!e.keyMap&&!e._keyMap||e.useRecords||(e.useRecords=!1,e.mapsAsObjects=!0),!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.getStructures&&(e.getShared=e.getStructures),e.getShared&&!e.structures&&((e.structures=[]).uninitialized=!0),e.keyMap)){this.mapKey=new Map;for(let[t,r]of Object.entries(e.keyMap))this.mapKey.set(r,t)}Object.assign(this,e)}decodeKey(e){return this.keyMap&&this.mapKey.get(e)||e}encodeKey(e){return this.keyMap&&this.keyMap.hasOwnProperty(e)?this.keyMap[e]:e}encodeKeys(e){if(!this._keyMap)return e;let t=new Map;for(let[r,n]of Object.entries(e))t.set(this._keyMap.hasOwnProperty(r)?this._keyMap[r]:r,n);return t}decodeKeys(e){if(!this._keyMap||"Map"!=e.constructor.name)return e;if(!this._mapKey){this._mapKey=new Map;for(let[e,t]of Object.entries(this._keyMap))this._mapKey.set(t,e)}let t={};return e.forEach(((e,r)=>t[x(this._mapKey.has(r)?this._mapKey.get(r):r)]=e)),t}mapDecode(e,t){let r=this.decode(e);return this._keyMap&&"Array"===r.constructor.name?r.map((e=>this.decodeKeys(e))):r}decode(e,t){if(r)return Y((()=>(q(),this?this.decode(e,t):E.prototype.decode.call(A,e,t))));n=t>-1?t:e.length,i=0,w=0,a=null,l=null,r=e;try{c=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(t){if(r=null,e instanceof Uint8Array)throw t;throw new Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}if(this instanceof E){if(p=this,u=this.sharedValues&&(this.pack?new Array(this.maxPrivatePackedValues||16).concat(this.sharedValues):this.sharedValues),this.structures)return o=this.structures,I();(!o||o.length>0)&&(o=[])}else p=A,(!o||o.length>0)&&(o=[]),u=null;return I()}decodeMultiple(e,t){let r,n=0;try{let s=e.length;v=!0;let o=this?this.decode(e,s):G.decode(e,s);if(!t){for(r=[o];i<s;)n=i,r.push(I());return r}if(!1===t(o))return;for(;i<s;)if(n=i,!1===t(I()))return}catch(e){throw e.lastPosition=n,e.values=r,e}finally{v=!1,q()}}}function I(){try{let e=U();if(l){if(i>=l.postBundlePosition){let e=new Error("Unexpected bundle position");throw e.incomplete=!0,e}i=l.postBundlePosition,l=null}if(i==n)o=null,r=null,f&&(f=null);else{if(i>n){let e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}if(!v)throw new Error("Data read, but end of buffer not reached")}return e}catch(e){throw q(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer"))&&(e.incomplete=!0),e}}function U(){let e=r[i++],t=e>>5;if(e&=31,e>23)switch(e){case 24:e=r[i++];break;case 25:if(7==t)return function(){let e=r[i++],t=r[i++],n=(127&e)>>2;if(31===n)return t||3&e?NaN:128&e?-1/0:1/0;if(0===n){let r=((3&e)<<8|t)/(1<<24);return 128&e?-r:r}return R[3]=128&e|56+(n>>1),R[2]=(7&e)<<5|t>>3,R[1]=t<<5,R[0]=0,_[0]}();e=c.getUint16(i),i+=2;break;case 26:if(7==t){let e=c.getFloat32(i);if(p.useFloat32>2){let t=Z[(127&r[i])<<1|r[i+1]>>7];return i+=4,(t*e+(e>0?.5:-.5)>>0)/t}return i+=4,e}e=c.getUint32(i),i+=4;break;case 27:if(7==t){let e=c.getFloat64(i);return i+=8,e}if(t>1){if(c.getUint32(i)>0)throw new Error("JavaScript does not support arrays, maps, or strings with length over 4294967295");e=c.getUint32(i+4)}else p.int64AsNumber?(e=4294967296*c.getUint32(i),e+=c.getUint32(i+4)):e=c.getBigUint64(i);i+=8;break;case 31:switch(t){case 2:case 3:throw new Error("Indefinite length not supported for byte or text strings");case 4:let e,r=[],n=0;for(;(e=U())!=s;){if(n>=h)throw new Error(`Array length exceeds ${h}`);r[n++]=e}return 4==t?r:3==t?r.join(""):Buffer.concat(r);case 5:let i;if(p.mapsAsObjects){let e={},t=0;if(p.keyMap)for(;(i=U())!=s;){if(t++>=y)throw new Error(`Property count exceeds ${y}`);e[x(p.decodeKey(i))]=U()}else for(;(i=U())!=s;){if(t++>=y)throw new Error(`Property count exceeds ${y}`);e[x(i)]=U()}return e}{d&&(p.mapsAsObjects=!0,d=!1);let e=new Map;if(p.keyMap){let t=0;for(;(i=U())!=s;){if(t++>=y)throw new Error(`Map size exceeds ${y}`);e.set(p.decodeKey(i),U())}}else{let t=0;for(;(i=U())!=s;){if(t++>=y)throw new Error(`Map size exceeds ${y}`);e.set(i,U())}}return e}case 7:return s;default:throw new Error("Invalid major type for indefinite length "+t)}default:throw new Error("Unknown token "+e)}switch(t){case 0:return e;case 1:return~e;case 2:return f=e,p.copyBuffers?Uint8Array.prototype.slice.call(r,i,i+=f):r.subarray(i,i+=f);case 3:if(w>=i)return a.slice(i-g,(i+=e)-g);if(0==w&&n<140&&e<32){let t=e<16?P(e):function(e){let t=i,n=new Array(e);for(let s=0;s<e;s++){const e=r[i++];if((128&e)>0)return void(i=t);n[s]=e}return V.apply(String,n)}(e);if(null!=t)return t}return j(e);case 4:if(e>=h)throw new Error(`Array length exceeds ${h}`);let t=new Array(e);for(let r=0;r<e;r++)t[r]=U();return t;case 5:if(e>=y)throw new Error(`Map size exceeds ${h}`);if(p.mapsAsObjects){let t={};if(p.keyMap)for(let r=0;r<e;r++)t[x(p.decodeKey(U()))]=U();else for(let r=0;r<e;r++)t[x(U())]=U();return t}{d&&(p.mapsAsObjects=!0,d=!1);let t=new Map;if(p.keyMap)for(let r=0;r<e;r++)t.set(p.decodeKey(U()),U());else for(let r=0;r<e;r++)t.set(U(),U());return t}case 6:if(e>=57337){let t=o[8191&e];if(t)return t.read||(t.read=M(t)),t.read();if(e<65536){if(57343==e){let e=J(),t=U(),r=U();F(t,r);let n={};if(p.keyMap)for(let t=2;t<e;t++){n[x(p.decodeKey(r[t-2]))]=U()}else for(let t=2;t<e;t++){n[x(r[t-2])]=U()}return n}if(57342==e){let e=J(),t=U();for(let r=2;r<e;r++)F(t++,U());return U()}if(57337==e)return function(){let e=J(),t=i+U();for(let t=2;t<e;t++){let e=J();i+=e}let r=i;return i=t,l=[B(J()),B(J())],l.position0=0,l.position1=0,l.postBundlePosition=i,i=r,U()}();if(p.getShared&&(H(),t=o[8191&e],t))return t.read||(t.read=M(t)),t.read()}}let s=b[e];if(s)return s.handlesRead?s(U):s(U());{let t=U();for(let r=0;r<m.length;r++){let n=m[r](e,t);if(void 0!==n)return n}return new T(t,e)}case 7:switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:let t=(u||C())[e];if(void 0!==t)return t;throw new Error("Unknown token "+e)}default:if(isNaN(e)){let e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}throw new Error("Unknown CBOR token "+e)}var f}const S=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function M(e){if(!e)throw new Error("Structure is required in record definition");return e.slowReads=0,function(){let e=r[i++];if(e&=31,e>23)switch(e){case 24:e=r[i++];break;case 25:e=c.getUint16(i),i+=2;break;case 26:e=c.getUint32(i),i+=4;break;default:throw new Error("Expected array header, but got "+r[i-1])}let t=this.compiledReader;for(;t;){if(t.propertyCount===e)return t(U);t=t.next}if(this.slowReads++>=O){let r=this.length==e?this:this.slice(0,e);return t=p.keyMap?new k("r","return {"+r.map((e=>p.decodeKey(e))).map((e=>S.test(e)?x(e)+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"}"):new k("r","return {"+r.map((e=>S.test(e)?x(e)+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"}"),this.compiledReader&&(t.next=this.compiledReader),t.propertyCount=e,this.compiledReader=t,t(U)}let n={};if(p.keyMap)for(let t=0;t<e;t++)n[x(p.decodeKey(this[t]))]=U();else for(let t=0;t<e;t++)n[x(this[t])]=U();return n}}function x(e){if("string"==typeof e)return"__proto__"===e?"__proto_":e;if("number"==typeof e||"boolean"==typeof e||"bigint"==typeof e)return e.toString();if(null==e)return e+"";throw new Error("Invalid property name type "+typeof e)}let j=B;function B(e){let n;if(e<16&&(n=P(e)))return n;if(e>64&&t)return t.decode(r.subarray(i,i+=e));const s=i+e,o=[];for(n="";i<s;){const e=r[i++];if(0==(128&e))o.push(e);else if(192==(224&e)){const t=63&r[i++];o.push((31&e)<<6|t)}else if(224==(240&e)){const t=63&r[i++],n=63&r[i++];o.push((31&e)<<12|t<<6|n)}else if(240==(248&e)){let t=(7&e)<<18|(63&r[i++])<<12|(63&r[i++])<<6|63&r[i++];t>65535&&(t-=65536,o.push(t>>>10&1023|55296),t=56320|1023&t),o.push(t)}else o.push(e);o.length>=4096&&(n+=V.apply(String,o),o.length=0)}return o.length>0&&(n+=V.apply(String,o)),n}let V=String.fromCharCode;function P(e){if(e<4){if(e<2){if(0===e)return"";{let e=r[i++];return(128&e)>1?void(i-=1):V(e)}}{let t=r[i++],n=r[i++];if((128&t)>0||(128&n)>0)return void(i-=2);if(e<3)return V(t,n);let s=r[i++];return(128&s)>0?void(i-=3):V(t,n,s)}}{let t=r[i++],n=r[i++],s=r[i++],o=r[i++];if((128&t)>0||(128&n)>0||(128&s)>0||(128&o)>0)return void(i-=4);if(e<6){if(4===e)return V(t,n,s,o);{let e=r[i++];return(128&e)>0?void(i-=5):V(t,n,s,o,e)}}if(e<8){let a=r[i++],l=r[i++];if((128&a)>0||(128&l)>0)return void(i-=6);if(e<7)return V(t,n,s,o,a,l);let f=r[i++];return(128&f)>0?void(i-=7):V(t,n,s,o,a,l,f)}{let a=r[i++],l=r[i++],f=r[i++],u=r[i++];if((128&a)>0||(128&l)>0||(128&f)>0||(128&u)>0)return void(i-=8);if(e<10){if(8===e)return V(t,n,s,o,a,l,f,u);{let e=r[i++];return(128&e)>0?void(i-=9):V(t,n,s,o,a,l,f,u,e)}}if(e<12){let c=r[i++],d=r[i++];if((128&c)>0||(128&d)>0)return void(i-=10);if(e<11)return V(t,n,s,o,a,l,f,u,c,d);let h=r[i++];return(128&h)>0?void(i-=11):V(t,n,s,o,a,l,f,u,c,d,h)}{let c=r[i++],d=r[i++],h=r[i++],y=r[i++];if((128&c)>0||(128&d)>0||(128&h)>0||(128&y)>0)return void(i-=12);if(e<14){if(12===e)return V(t,n,s,o,a,l,f,u,c,d,h,y);{let e=r[i++];return(128&e)>0?void(i-=13):V(t,n,s,o,a,l,f,u,c,d,h,y,e)}}{let p=r[i++],g=r[i++];if((128&p)>0||(128&g)>0)return void(i-=14);if(e<15)return V(t,n,s,o,a,l,f,u,c,d,h,y,p,g);let w=r[i++];return(128&w)>0?void(i-=15):V(t,n,s,o,a,l,f,u,c,d,h,y,p,g,w)}}}}}let _=new Float32Array(1),R=new Uint8Array(_.buffer,0,4);new Array(4096);class T{constructor(e,t){this.value=e,this.tag=t}}b[0]=e=>new Date(e),b[1]=e=>new Date(Math.round(1e3*e)),b[2]=e=>{let t=BigInt(0);for(let r=0,n=e.byteLength;r<n;r++)t=BigInt(e[r])+(t<<BigInt(8));return t},b[3]=e=>BigInt(-1)-b[2](e),b[4]=e=>+(e[1]+"e"+e[0]),b[5]=e=>e[1]*Math.exp(e[0]*Math.log(2));const F=(e,t)=>{let r=o[e-=57344];r&&r.isShared&&((o.restoreStructures||(o.restoreStructures=[]))[e]=r),o[e]=t,t.read=M(t)};b[105]=e=>{let t=e.length,r=e[1];F(e[0],r);let n={};for(let i=2;i<t;i++){n[x(r[i-2])]=e[i]}return n},b[14]=e=>l?l[0].slice(l.position0,l.position0+=e):new T(e,14),b[15]=e=>l?l[1].slice(l.position1,l.position1+=e):new T(e,15);let D={Error:Error,RegExp:RegExp};b[27]=e=>(D[e[0]]||Error)(e[1],e[2]);const N=e=>{if(132!=r[i++]){let e=new Error("Packed values structure must be followed by a 4 element array");throw r.length<i&&(e.incomplete=!0),e}let t=e();if(!t||!t.length){let e=new Error("Packed values structure must be followed by a 4 element array");throw e.incomplete=!0,e}return u=u?t.concat(u.slice(t.length)):t,u.prefixes=e(),u.suffixes=e(),e()};function K(e,t){return"string"==typeof e?e+t:e instanceof Array?e.concat(t):Object.assign({},e,t)}function C(){if(!u){if(!p.getShared)throw new Error("No packed values available");H()}return u}N.handlesRead=!0,b[51]=N,b[6]=e=>{if(!u){if(!p.getShared)return new T(e,6);H()}if("number"==typeof e)return u[16+(e>=0?2*e:-2*e-1)];let t=new Error("No support for non-integer packed references yet");throw void 0===e&&(t.incomplete=!0),t},b[28]=e=>{f||(f=new Map,f.id=0);let t,n=f.id++,s=i;t=r[i]>>5==4?[]:{};let o={target:t};f.set(n,o);let a=e();return o.used?(Object.getPrototypeOf(t)!==Object.getPrototypeOf(a)&&(i=s,t=a,f.set(n,{target:t}),a=e()),Object.assign(t,a)):(o.target=a,a)},b[28].handlesRead=!0,b[29]=e=>{let t=f.get(e);return t.used=!0,t.target},b[258]=e=>new Set(e),(b[259]=e=>(p.mapsAsObjects&&(p.mapsAsObjects=!1,d=!0),e())).handlesRead=!0;m.push(((e,t)=>e>=225&&e<=255?K(C().prefixes[e-224],t):e>=28704&&e<=32767?K(C().prefixes[e-28672],t):e>=1879052288&&e<=2147483647?K(C().prefixes[e-1879048192],t):e>=216&&e<=223?K(t,C().suffixes[e-216]):e>=27647&&e<=28671?K(t,C().suffixes[e-27639]):e>=1811940352&&e<=1879048191?K(t,C().suffixes[e-1811939328]):1399353956==e?{packedValues:u,structures:o.slice(0),version:t}:55799==e?t:void 0));const z=1==new Uint8Array(new Uint16Array([1]).buffer)[0],L=[Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,"undefined"==typeof BigUint64Array?{name:"BigUint64Array"}:BigUint64Array,Int8Array,Int16Array,Int32Array,"undefined"==typeof BigInt64Array?{name:"BigInt64Array"}:BigInt64Array,Float32Array,Float64Array],W=[64,68,69,70,71,72,77,78,79,85,86];for(let e=0;e<L.length;e++)$(L[e],W[e]);function $(e,t){let r,n="get"+e.name.slice(0,-5);"function"==typeof e?r=e.BYTES_PER_ELEMENT:e=null;for(let i=0;i<2;i++){if(!i&&1==r)continue;let s=2==r?1:4==r?2:8==r?3:0;b[i?t:t-4]=1==r||i==z?n=>{if(!e)throw new Error("Could not find typed array for code "+t);return p.copyBuffers||1!==r&&(2!==r||1&n.byteOffset)&&(4!==r||3&n.byteOffset)&&(8!==r||7&n.byteOffset)?new e(Uint8Array.prototype.slice.call(n,0).buffer):new e(n.buffer,n.byteOffset,n.byteLength>>s)}:r=>{if(!e)throw new Error("Could not find typed array for code "+t);let o=new DataView(r.buffer,r.byteOffset,r.byteLength),a=r.length>>s,l=new e(a),f=o[n];for(let e=0;e<a;e++)l[e]=f.call(o,e<<s,i);return l}}}function J(){let e=31&r[i++];if(e>23)switch(e){case 24:e=r[i++];break;case 25:e=c.getUint16(i),i+=2;break;case 26:e=c.getUint32(i),i+=4}return e}function H(){if(p.getShared){let e=Y((()=>(r=null,p.getShared())))||{},t=e.structures||[];p.sharedVersion=e.version,u=p.sharedValues=e.packedValues,!0===o?p.structures=o=t:o.splice.apply(o,[0,t.length].concat(t))}}function Y(e){let t=n,s=i,u=g,d=w,h=a,y=f,b=l,m=new Uint8Array(r.slice(0,n)),A=o,O=p,k=v,E=e();return n=t,i=s,g=u,w=d,a=h,f=y,l=b,r=m,v=k,o=A,p=O,c=new DataView(r.buffer,r.byteOffset,r.byteLength),E}function q(){r=null,f=null,o=null}const Z=new Array(147);for(let e=0;e<256;e++)Z[e]=+("1e"+Math.floor(45.15-.30103*e));let G=new E({useRecords:!1});const Q=G.decode,X=G.decodeMultiple,ee={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};let te,re,ne;try{te=new TextEncoder}catch(e){}const ie="object"==typeof globalThis&&globalThis.Buffer,se=void 0!==ie,oe=se?ie.allocUnsafeSlow:Uint8Array,ae=se?ie:Uint8Array,le=se?4294967296:2144337920;let fe,ue,ce,de,he=0,ye=null;const pe=/[\u0080-\uFFFF]/,ge=Symbol("record-id");class we extends E{constructor(e){let t,r,n,i,s;super(e),this.offset=0,e=e||{};let o=ae.prototype.utf8Write?function(e,t,r){return ue.utf8Write(e,t,r)}:!(!te||!te.encodeInto)&&function(e,t){return te.encodeInto(e,ue.subarray(t)).written},a=this,l=e.structures||e.saveStructures,f=e.maxSharedStructures;if(null==f&&(f=l?128:0),f>8190)throw new Error("Maximum maxSharedStructure is 8190");let u=e.sequential;u&&(f=0),this.structures||(this.structures=[]),this.saveStructures&&(this.saveShared=this.saveStructures);let c,d,h,y=e.sharedValues;if(y){h=Object.create(null);for(let e=0,t=y.length;e<t;e++)h[y[e]]=e}let p=[],g=0,w=0;this.mapEncode=function(e,t){if(this._keyMap&&!this._mapped&&"Array"===e.constructor.name)e=e.map((e=>this.encodeKeys(e)));return this.encode(e,t)},this.encode=function(o,l){if(ue||(ue=new oe(8192),ce=new DataView(ue.buffer,0,8192),he=0),de=ue.length-10,de-he<2048?(ue=new oe(ue.length),ce=new DataView(ue.buffer,0,ue.length),de=ue.length-10,he=0):l===Te&&(he=he+7&2147483640),t=he,a.useSelfDescribedHeader&&(ce.setUint32(he,3654940416),he+=3),s=a.structuredClone?new Map:null,a.bundleStrings&&"string"!=typeof o?(ye=[],ye.size=1/0):ye=null,r=a.structures,r){if(r.uninitialized){let e=a.getShared()||{};a.structures=r=e.structures||[],a.sharedVersion=e.version;let t=a.sharedValues=e.packedValues;if(t){h={};for(let e=0,r=t.length;e<r;e++)h[t[e]]=e}}let e=r.length;if(e>f&&!u&&(e=f),!r.transitions){r.transitions=Object.create(null);for(let t=0;t<e;t++){let e=r[t];if(!e)continue;let n,i=r.transitions;for(let r=0,s=e.length;r<s;r++){void 0===i[ge]&&(i[ge]=t);let s=e[r];n=i[s],n||(n=i[s]=Object.create(null)),i=n}i[ge]=1048576|t}}u||(r.nextId=e)}if(n&&(n=!1),i=r||[],d=h,e.pack){let t=new Map;if(t.values=[],t.encoder=a,t.maxValues=e.maxPrivatePackedValues||(h?16:1/0),t.objectMap=h||!1,t.samplingPackedValues=c,ke(o,t),t.values.length>0){ue[he++]=216,ue[he++]=51,Ae(4);let e=t.values;b(e),Ae(0),Ae(0),d=Object.create(h||null);for(let t=0,r=e.length;t<r;t++)d[e[t]]=t}}fe=l&De;try{if(fe)return;if(b(o),ye&&Se(t,b),a.offset=he,s&&s.idsToInsert){he+=2*s.idsToInsert.length,he>de&&A(he),a.offset=he;let e=function(e,t){let r,n=2*t.length,i=e.length-n;t.sort(((e,t)=>e.offset>t.offset?1:-1));for(let r=0;r<t.length;r++){let n=t[r];n.id=r;for(let t of n.references)e[t++]=r>>8,e[t]=255&r}for(;r=t.pop();){let t=r.offset;e.copyWithin(t+n,t,i),n-=2;let s=t+n;e[s++]=216,e[s++]=28,i=t}return e}(ue.subarray(t,he),s.idsToInsert);return s=null,e}return l&Te?(ue.start=t,ue.end=he,ue):ue.subarray(t,he)}finally{if(r)if(w<10&&w++,r.length>f&&(r.length=f),g>1e4)r.transitions=null,w=0,g=0,p.length>0&&(p=[]);else if(p.length>0&&!u){for(let e=0,t=p.length;e<t;e++)p[e][ge]=void 0;p=[]}if(n&&a.saveShared){a.structures.length>f&&(a.structures=a.structures.slice(0,f));let e=ue.subarray(t,he);return!1===a.updateSharedData()?a.encode(o):e}l&Fe&&(he=t)}},this.findCommonStringsToPack=()=>(c=new Map,h||(h=Object.create(null)),e=>{let t=e&&e.threshold||4,r=this.pack?e.maxPrivatePackedValues||16:0;y||(y=this.sharedValues=[]);for(let[e,i]of c)i.count>t&&(h[e]=r++,y.push(e),n=!0);for(;this.saveShared&&!1===this.updateSharedData(););c=null});const b=r=>{he>de&&(ue=A(he));var n,i=typeof r;if("string"===i){if(d){let t=d[r];if(t>=0)return void(t<16?ue[he++]=t+224:(ue[he++]=198,b(1&t?15-t>>1:t-16>>1)));if(c&&!e.pack){let e=c.get(r);e?e.count++:c.set(r,{count:1})}}let i,s=r.length;if(ye&&s>=4&&s<1024){if((ye.size+=s)>61440){let e,r=(ye[0]?3*ye[0].length+ye[1].length:0)+10;he+r>de&&(ue=A(he+r)),ue[he++]=217,ue[he++]=223,ue[he++]=249,ue[he++]=ye.position?132:130,ue[he++]=26,e=he-t,he+=4,ye.position&&Se(t,b),ye=["",""],ye.size=0,ye.position=e}let e=pe.test(r);return ye[e?0:1]+=r,ue[he++]=e?206:207,void b(s)}i=s<32?1:s<256?2:s<65536?3:5;let a=3*s;if(he+a>de&&(ue=A(he+a)),s<64||!o){let e,t,o,a=he+i;for(e=0;e<s;e++)t=r.charCodeAt(e),t<128?ue[a++]=t:t<2048?(ue[a++]=t>>6|192,ue[a++]=63&t|128):55296==(64512&t)&&56320==(64512&(o=r.charCodeAt(e+1)))?(t=65536+((1023&t)<<10)+(1023&o),e++,ue[a++]=t>>18|240,ue[a++]=t>>12&63|128,ue[a++]=t>>6&63|128,ue[a++]=63&t|128):(ue[a++]=t>>12|224,ue[a++]=t>>6&63|128,ue[a++]=63&t|128);n=a-he-i}else n=o(r,he+i,a);n<24?ue[he++]=96|n:n<256?(i<2&&ue.copyWithin(he+2,he+1,he+1+n),ue[he++]=120,ue[he++]=n):n<65536?(i<3&&ue.copyWithin(he+3,he+2,he+2+n),ue[he++]=121,ue[he++]=n>>8,ue[he++]=255&n):(i<5&&ue.copyWithin(he+5,he+3,he+3+n),ue[he++]=122,ce.setUint32(he,n),he+=4),he+=n}else if("number"===i)if(this.alwaysUseFloat||r>>>0!==r)if(this.alwaysUseFloat||r>>0!==r){let e;if((e=this.useFloat32)>0&&r<4294967296&&r>=-2147483648){let t;if(ue[he++]=250,ce.setFloat32(he,r),e<4||(t=r*Z[(127&ue[he])<<1|ue[he+1]>>7])>>0===t)return void(he+=4);he--}ue[he++]=251,ce.setFloat64(he,r),he+=8}else r>=-24?ue[he++]=31-r:r>=-256?(ue[he++]=56,ue[he++]=~r):r>=-65536?(ue[he++]=57,ce.setUint16(he,~r),he+=2):(ue[he++]=58,ce.setUint32(he,~r),he+=4);else r<24?ue[he++]=r:r<256?(ue[he++]=24,ue[he++]=r):r<65536?(ue[he++]=25,ue[he++]=r>>8,ue[he++]=255&r):(ue[he++]=26,ce.setUint32(he,r),he+=4);else if("object"===i)if(r){if(s){let e=s.get(r);if(e){if(ue[he++]=216,ue[he++]=29,ue[he++]=25,!e.references){let t=s.idsToInsert||(s.idsToInsert=[]);e.references=[],t.push(e)}return e.references.push(he-t),void(he+=2)}s.set(r,{offset:he-t})}let e=r.constructor;if(e===Object)m(r);else if(e===Array){(n=r.length)<24?ue[he++]=128|n:Ae(n);for(let e=0;e<n;e++)b(r[e])}else if(e===Map)if((this.mapsAsObjects?!1!==this.useTag259ForMaps:this.useTag259ForMaps)&&(ue[he++]=217,ue[he++]=1,ue[he++]=3),(n=r.size)<24?ue[he++]=160|n:n<256?(ue[he++]=184,ue[he++]=n):n<65536?(ue[he++]=185,ue[he++]=n>>8,ue[he++]=255&n):(ue[he++]=186,ce.setUint32(he,n),he+=4),a.keyMap)for(let[e,t]of r)b(a.encodeKey(e)),b(t);else for(let[e,t]of r)b(e),b(t);else{for(let e=0,t=re.length;e<t;e++){if(r instanceof ne[e]){let t=re[e],n=t.tag;return null==n&&(n=t.getTag&&t.getTag.call(this,r)),n<24?ue[he++]=192|n:n<256?(ue[he++]=216,ue[he++]=n):n<65536?(ue[he++]=217,ue[he++]=n>>8,ue[he++]=255&n):n>-1&&(ue[he++]=218,ce.setUint32(he,n),he+=4),void t.encode.call(this,r,b,A)}}if(r[Symbol.iterator]){if(fe){let e=new Error("Iterable should be serialized as iterator");throw e.iteratorNotHandled=!0,e}ue[he++]=159;for(let e of r)b(e);return void(ue[he++]=255)}if(r[Symbol.asyncIterator]||Oe(r)){let e=new Error("Iterable/blob should be serialized as iterator");throw e.iteratorNotHandled=!0,e}if(this.useToJSON&&r.toJSON){const e=r.toJSON();if(e!==r)return b(e)}m(r)}}else ue[he++]=246;else if("boolean"===i)ue[he++]=r?245:244;else if("bigint"===i){if(r<BigInt(1)<<BigInt(64)&&r>=0)ue[he++]=27,ce.setBigUint64(he,r);else if(r>-(BigInt(1)<<BigInt(64))&&r<0)ue[he++]=59,ce.setBigUint64(he,-r-BigInt(1));else{if(!this.largeBigIntToFloat){r>=BigInt(0)?ue[he++]=194:(ue[he++]=195,r=BigInt(-1)-r);let e=[];for(;r;)e.push(Number(r&BigInt(255))),r>>=BigInt(8);return void Ue(new Uint8Array(e.reverse()),A)}ue[he++]=251,ce.setFloat64(he,Number(r))}he+=8}else{if("undefined"!==i)throw new Error("Unknown type: "+i);ue[he++]=247}},m=!1===this.useRecords?this.variableMapSize?e=>{let t=Object.keys(e),r=Object.values(e),n=t.length;if(n<24?ue[he++]=160|n:n<256?(ue[he++]=184,ue[he++]=n):n<65536?(ue[he++]=185,ue[he++]=n>>8,ue[he++]=255&n):(ue[he++]=186,ce.setUint32(he,n),he+=4),a.keyMap)for(let e=0;e<n;e++)b(a.encodeKey(t[e])),b(r[e]);else for(let e=0;e<n;e++)b(t[e]),b(r[e])}:e=>{ue[he++]=185;let r=he-t;he+=2;let n=0;if(a.keyMap)for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(b(a.encodeKey(t)),b(e[t]),n++);else for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(b(t),b(e[t]),n++);ue[r+++t]=n>>8,ue[r+t]=255&n}:(e,t)=>{let r,s,o,a=i.transitions||(i.transitions=Object.create(null)),l=0,u=0;if(this.keyMap){o=Object.keys(e).map((e=>this.encodeKey(e))),u=o.length;for(let e=0;e<u;e++){let t=o[e];r=a[t],r||(r=a[t]=Object.create(null),l++),a=r}}else for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(r=a[t],r||(1048576&a[ge]&&(s=65535&a[ge]),r=a[t]=Object.create(null),l++),a=r,u++);let c=a[ge];if(void 0!==c)c&=65535,ue[he++]=217,ue[he++]=c>>8|224,ue[he++]=255&c;else{if(o||(o=a.__keys__||(a.__keys__=Object.keys(e))),void 0===s?(c=i.nextId++,c||(c=0,i.nextId=1),c>=256&&(i.nextId=(c=f)+1)):c=s,i[c]=o,!(c<f)){if(a[ge]=c,ce.setUint32(he,3655335680),he+=3,l&&(g+=w*l),p.length>=256-f&&(p.shift()[ge]=void 0),p.push(a),Ae(u+2),b(57344+c),b(o),t)return;for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&b(e[t]);return}ue[he++]=217,ue[he++]=c>>8|224,ue[he++]=255&c,a=i.transitions;for(let e=0;e<u;e++)(void 0===a[ge]||1048576&a[ge])&&(a[ge]=c),a=a[o[e]];a[ge]=1048576|c,n=!0}if(u<24?ue[he++]=128|u:Ae(u),!t)for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&b(e[t])},A=e=>{let r;if(e>16777216){if(e-t>le)throw new Error("Encoded buffer would be larger than maximum buffer size");r=Math.min(le,4096*Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096))}else r=1+(Math.max(e-t<<2,ue.length-1)>>12)<<12;let n=new oe(r);return ce=new DataView(n.buffer,0,r),ue.copy?ue.copy(n,0,t,e):n.set(ue.slice(t,e)),he-=t,t=0,de=n.length-10,ue=n};let v=100,O=1e3;function*k(e,r,n){let i=e.constructor;if(i===Object){let t=!1!==a.useRecords;t?m(e,!0):be(Object.keys(e).length,160);for(let n in e){let i=e[n];t||b(n),i&&"object"==typeof i?r[n]?yield*k(i,r[n]):yield*E(i,r,n):b(i)}}else if(i===Array){let n=e.length;Ae(n);for(let i=0;i<n;i++){let n=e[i];n&&("object"==typeof n||he-t>v)?r.element?yield*k(n,r.element):yield*E(n,r,"element"):b(n)}}else if(e[Symbol.iterator]&&!e.buffer){ue[he++]=159;for(let n of e)n&&("object"==typeof n||he-t>v)?r.element?yield*k(n,r.element):yield*E(n,r,"element"):b(n);ue[he++]=255}else Oe(e)?(be(e.size,64),yield ue.subarray(t,he),yield e,I()):e[Symbol.asyncIterator]?(ue[he++]=159,yield ue.subarray(t,he),yield e,I(),ue[he++]=255):b(e);n&&he>t?yield ue.subarray(t,he):he-t>v&&(yield ue.subarray(t,he),I())}function*E(e,r,n){let i=he-t;try{b(e),he-t>v&&(yield ue.subarray(t,he),I())}catch(s){if(!s.iteratorNotHandled)throw s;r[n]={},he=t+i,yield*k.call(this,e,r[n])}}function I(){v=O,a.encode(null,De)}function U(e,t,r){return v=t&&t.chunkThreshold?O=t.chunkThreshold:100,e&&"object"==typeof e?(a.encode(null,De),r(e,a.iterateProperties||(a.iterateProperties={}),!0)):[a.encode(e)]}async function*S(e,t){for(let r of k(e,t,!0)){let e=r.constructor;if(e===ae||e===Uint8Array)yield r;else if(Oe(r)){let e,t=r.stream().getReader();for(;!(e=await t.read()).done;)yield e.value}else if(r[Symbol.asyncIterator])for await(let e of r)I(),e?yield*S(e,t.async||(t.async={})):yield a.encode(e);else yield r}}this.encodeAsIterable=function(e,t){return U(e,t,k)},this.encodeAsAsyncIterable=function(e,t){return U(e,t,S)}}useBuffer(e){ue=e,ce=new DataView(ue.buffer,ue.byteOffset,ue.byteLength),he=0}clearSharedData(){this.structures&&(this.structures=[]),this.sharedValues&&(this.sharedValues=void 0)}updateSharedData(){let e=this.sharedVersion||0;this.sharedVersion=e+1;let t=this.structures.slice(0),r=new me(t,this.sharedValues,this.sharedVersion),n=this.saveShared(r,(t=>(t&&t.version||0)==e));return!1===n?(r=this.getShared()||{},this.structures=r.structures||[],this.sharedValues=r.packedValues,this.sharedVersion=r.version,this.structures.nextId=this.structures.length):t.forEach(((e,t)=>this.structures[t]=e)),n}}function be(e,t){e<24?ue[he++]=t|e:e<256?(ue[he++]=24|t,ue[he++]=e):e<65536?(ue[he++]=25|t,ue[he++]=e>>8,ue[he++]=255&e):(ue[he++]=26|t,ce.setUint32(he,e),he+=4)}class me{constructor(e,t,r){this.structures=e,this.packedValues=t,this.version=r}}function Ae(e){e<24?ue[he++]=128|e:e<256?(ue[he++]=152,ue[he++]=e):e<65536?(ue[he++]=153,ue[he++]=e>>8,ue[he++]=255&e):(ue[he++]=154,ce.setUint32(he,e),he+=4)}const ve="undefined"==typeof Blob?function(){}:Blob;function Oe(e){if(e instanceof ve)return!0;let t=e[Symbol.toStringTag];return"Blob"===t||"File"===t}function ke(e,t){switch(typeof e){case"string":if(e.length>3){if(t.objectMap[e]>-1||t.values.length>=t.maxValues)return;let r=t.get(e);if(r)2==++r.count&&t.values.push(e);else if(t.set(e,{count:1}),t.samplingPackedValues){let r=t.samplingPackedValues.get(e);r?r.count++:t.samplingPackedValues.set(e,{count:1})}}break;case"object":if(e)if(e instanceof Array)for(let r=0,n=e.length;r<n;r++)ke(e[r],t);else{let n=!t.encoder.useRecords;for(var r in e)e.hasOwnProperty(r)&&(n&&ke(r,t),ke(e[r],t))}break;case"function":console.log(e)}}const Ee=1==new Uint8Array(new Uint16Array([1]).buffer)[0];function Ie(e,t){return!Ee&&t>1&&(e-=4),{tag:e,encode:function(e,t){let r=e.byteLength,n=e.byteOffset||0,i=e.buffer||e;t(se?ie.from(i,n,r):new Uint8Array(i,n,r))}}}function Ue(e,t){let r=e.byteLength;r<24?ue[he++]=64+r:r<256?(ue[he++]=88,ue[he++]=r):r<65536?(ue[he++]=89,ue[he++]=r>>8,ue[he++]=255&r):(ue[he++]=90,ce.setUint32(he,r),he+=4),he+r>=ue.length&&t(he+r),ue.set(e.buffer?e:new Uint8Array(e),he),he+=r}function Se(e,t){ce.setUint32(ye.position+e,he-ye.position-e+1);let r=ye;ye=null,t(r[0]),t(r[1])}ne=[Date,Set,Error,RegExp,T,ArrayBuffer,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,"undefined"==typeof BigUint64Array?function(){}:BigUint64Array,Int8Array,Int16Array,Int32Array,"undefined"==typeof BigInt64Array?function(){}:BigInt64Array,Float32Array,Float64Array,me],re=[{tag:1,encode(e,t){let r=e.getTime()/1e3;(this.useTimestamp32||0===e.getMilliseconds())&&r>=0&&r<4294967296?(ue[he++]=26,ce.setUint32(he,r),he+=4):(ue[he++]=251,ce.setFloat64(he,r),he+=8)}},{tag:258,encode(e,t){t(Array.from(e))}},{tag:27,encode(e,t){t([e.name,e.message])}},{tag:27,encode(e,t){t(["RegExp",e.source,e.flags])}},{getTag:e=>e.tag,encode(e,t){t(e.value)}},{encode(e,t,r){Ue(e,r)}},{getTag(e){if(e.constructor===Uint8Array&&(this.tagUint8Array||se&&!1!==this.tagUint8Array))return 64},encode(e,t,r){Ue(e,r)}},Ie(68,1),Ie(69,2),Ie(70,4),Ie(71,8),Ie(72,1),Ie(77,2),Ie(78,4),Ie(79,8),Ie(85,4),Ie(86,8),{encode(e,t){let r=e.packedValues||[],n=e.structures||[];if(r.values.length>0){ue[he++]=216,ue[he++]=51,Ae(4);let e=r.values;t(e),Ae(0),Ae(0),packedObjectMap=Object.create(sharedPackedObjectMap||null);for(let t=0,r=e.length;t<r;t++)packedObjectMap[e[t]]=t}if(n){ce.setUint32(he,3655335424),he+=3;let r=n.slice(0);r.unshift(57344),r.push(new T(e.version,1399353956)),t(r)}else t(new T(e.version,1399353956))}}];let Me=new we({useRecords:!1});const xe=Me.encode,je=Me.encodeAsIterable,Be=Me.encodeAsAsyncIterable,{NEVER:Ve,ALWAYS:Pe,DECIMAL_ROUND:_e,DECIMAL_FIT:Re}=ee,Te=512,Fe=1024,De=2048;e.ALWAYS=Pe,e.DECIMAL_FIT=Re,e.DECIMAL_ROUND=_e,e.Decoder=E,e.Encoder=we,e.FLOAT32_OPTIONS=ee,e.NEVER=Ve,e.REUSE_BUFFER_MODE=Te,e.Tag=T,e.addExtension=function(e){if(e.Class){if(!e.encode)throw new Error("Extension has no encode function");ne.unshift(e.Class),re.unshift(e)}!function(e){b[e.tag]=e.decode}(e)},e.clearSource=q,e.decode=Q,e.decodeIter=function(e,t={}){if(!e||"object"!=typeof e)throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a promise");const r=new E(t);let n;const i=e=>{let t;n&&(e=Buffer.concat([n,e]),n=void 0);try{t=r.decodeMultiple(e)}catch(r){if(!r.incomplete)throw r;n=e.slice(r.lastPosition),t=r.values}return t};return"function"==typeof e[Symbol.iterator]?function*(){for(const t of e)yield*i(t)}():"function"==typeof e[Symbol.asyncIterator]?async function*(){for await(const t of e)yield*i(t)}():void 0},e.decodeMultiple=X,e.encode=xe,e.encodeAsAsyncIterable=Be,e.encodeAsIterable=je,e.encodeIter=function(e,t={}){if(e&&"object"==typeof e){if("function"==typeof e[Symbol.iterator])return function*(e,t){const r=new we(t);for(const t of e)yield r.encode(t)}(e,t);if("function"==typeof e.then||"function"==typeof e[Symbol.asyncIterator])return async function*(e,t){const r=new we(t);for await(const t of e)yield r.encode(t)}(e,t);throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a Promise")}throw new Error("first argument must be an Iterable, Async Iterable, or a Promise for an Async Iterable")},e.isNativeAccelerationEnabled=!1,e.roundFloat32=function(e){_[0]=e;let t=Z[(127&R[3])<<1|R[2]>>7];return(t*e+(e>0?.5:-.5)>>0)/t},e.setSizeLimits=function(e){e.maxMapSize&&(y=e.maxMapSize),e.maxArraySize&&(h=e.maxArraySize),e.maxObjectSize&&e.maxObjectSize}})); | ||
//# sourceMappingURL=index-no-eval.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CBOR={})}(this,(function(e){"use strict";let t,r,n;try{t=new TextDecoder}catch(e){}let i=0;const s={};let o,a,l,f,u,c,d,h={},y=0,p=0,g=[],b=[],w={useRecords:!1,mapsAsObjects:!0},m=!1,A=2;try{new Function("")}catch(e){A=1/0}class v{constructor(e){if(e&&(!e.keyMap&&!e._keyMap||e.useRecords||(e.useRecords=!1,e.mapsAsObjects=!0),!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.getStructures&&(e.getShared=e.getStructures),e.getShared&&!e.structures&&((e.structures=[]).uninitialized=!0),e.keyMap)){this.mapKey=new Map;for(let[t,r]of Object.entries(e.keyMap))this.mapKey.set(r,t)}Object.assign(this,e)}decodeKey(e){return this.keyMap&&this.mapKey.get(e)||e}encodeKey(e){return this.keyMap&&this.keyMap.hasOwnProperty(e)?this.keyMap[e]:e}encodeKeys(e){if(!this._keyMap)return e;let t=new Map;for(let[r,n]of Object.entries(e))t.set(this._keyMap.hasOwnProperty(r)?this._keyMap[r]:r,n);return t}decodeKeys(e){if(!this._keyMap||"Map"!=e.constructor.name)return e;if(!this._mapKey){this._mapKey=new Map;for(let[e,t]of Object.entries(this._keyMap))this._mapKey.set(t,e)}let t={};return e.forEach(((e,r)=>t[E(this._mapKey.has(r)?this._mapKey.get(r):r)]=e)),t}mapDecode(e,t){let r=this.decode(e);return this._keyMap&&"Array"===r.constructor.name?r.map((e=>this.decodeKeys(e))):r}decode(e,t){if(r)return J((()=>(H(),this?this.decode(e,t):v.prototype.decode.call(w,e,t))));n=t>-1?t:e.length,i=0,p=0,a=null,l=null,r=e;try{c=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(t){if(r=null,e instanceof Uint8Array)throw t;throw new Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}if(this instanceof v){if(h=this,u=this.sharedValues&&(this.pack?new Array(this.maxPrivatePackedValues||16).concat(this.sharedValues):this.sharedValues),this.structures)return o=this.structures,O();(!o||o.length>0)&&(o=[])}else h=w,(!o||o.length>0)&&(o=[]),u=null;return O()}decodeMultiple(e,t){let r,n=0;try{let s=e.length;m=!0;let o=this?this.decode(e,s):$.decode(e,s);if(!t){for(r=[o];i<s;)n=i,r.push(O());return r}if(!1===t(o))return;for(;i<s;)if(n=i,!1===t(O()))return}catch(e){throw e.lastPosition=n,e.values=r,e}finally{m=!1,H()}}}function O(){try{let e=k();if(l){if(i>=l.postBundlePosition){let e=new Error("Unexpected bundle position");throw e.incomplete=!0,e}i=l.postBundlePosition,l=null}if(i==n)o=null,r=null,f&&(f=null);else{if(i>n){let e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}if(!m)throw new Error("Data read, but end of buffer not reached")}return e}catch(e){throw H(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer"))&&(e.incomplete=!0),e}}function k(){let e=r[i++],t=e>>5;if(e&=31,e>23)switch(e){case 24:e=r[i++];break;case 25:if(7==t)return function(){let e=r[i++],t=r[i++],n=(127&e)>>2;if(31===n)return t||3&e?NaN:128&e?-1/0:1/0;if(0===n){let r=((3&e)<<8|t)/(1<<24);return 128&e?-r:r}return V[3]=128&e|56+(n>>1),V[2]=(7&e)<<5|t>>3,V[1]=t<<5,V[0]=0,B[0]}();e=c.getUint16(i),i+=2;break;case 26:if(7==t){let e=c.getFloat32(i);if(h.useFloat32>2){let t=Y[(127&r[i])<<1|r[i+1]>>7];return i+=4,(t*e+(e>0?.5:-.5)>>0)/t}return i+=4,e}e=c.getUint32(i),i+=4;break;case 27:if(7==t){let e=c.getFloat64(i);return i+=8,e}if(t>1){if(c.getUint32(i)>0)throw new Error("JavaScript does not support arrays, maps, or strings with length over 4294967295");e=c.getUint32(i+4)}else h.int64AsNumber?(e=4294967296*c.getUint32(i),e+=c.getUint32(i+4)):e=c.getBigUint64(i);i+=8;break;case 31:switch(t){case 2:case 3:throw new Error("Indefinite length not supported for byte or text strings");case 4:let e,r=[],n=0;for(;(e=k())!=s;)r[n++]=e;return 4==t?r:3==t?r.join(""):Buffer.concat(r);case 5:let i;if(h.mapsAsObjects){let e={};if(h.keyMap)for(;(i=k())!=s;)e[E(h.decodeKey(i))]=k();else for(;(i=k())!=s;)e[E(i)]=k();return e}{d&&(h.mapsAsObjects=!0,d=!1);let e=new Map;if(h.keyMap)for(;(i=k())!=s;)e.set(h.decodeKey(i),k());else for(;(i=k())!=s;)e.set(i,k());return e}case 7:return s;default:throw new Error("Invalid major type for indefinite length "+t)}default:throw new Error("Unknown token "+e)}switch(t){case 0:return e;case 1:return~e;case 2:return f=e,h.copyBuffers?Uint8Array.prototype.slice.call(r,i,i+=f):r.subarray(i,i+=f);case 3:if(p>=i)return a.slice(i-y,(i+=e)-y);if(0==p&&n<140&&e<32){let t=e<16?x(e):function(e){let t=i,n=new Array(e);for(let s=0;s<e;s++){const e=r[i++];if((128&e)>0)return void(i=t);n[s]=e}return j.apply(String,n)}(e);if(null!=t)return t}return M(e);case 4:let t=new Array(e);for(let r=0;r<e;r++)t[r]=k();return t;case 5:if(h.mapsAsObjects){let t={};if(h.keyMap)for(let r=0;r<e;r++)t[E(h.decodeKey(k()))]=k();else for(let r=0;r<e;r++)t[E(k())]=k();return t}{d&&(h.mapsAsObjects=!0,d=!1);let t=new Map;if(h.keyMap)for(let r=0;r<e;r++)t.set(h.decodeKey(k()),k());else for(let r=0;r<e;r++)t.set(k(),k());return t}case 6:if(e>=57337){let t=o[8191&e];if(t)return t.read||(t.read=I(t)),t.read();if(e<65536){if(57343==e){let e=z(),t=k(),r=k();P(t,r);let n={};if(h.keyMap)for(let t=2;t<e;t++){n[E(h.decodeKey(r[t-2]))]=k()}else for(let t=2;t<e;t++){n[E(r[t-2])]=k()}return n}if(57342==e){let e=z(),t=k();for(let r=2;r<e;r++)P(t++,k());return k()}if(57337==e)return function(){let e=z(),t=i+k();for(let t=2;t<e;t++){let e=z();i+=e}let r=i;return i=t,l=[S(z()),S(z())],l.position0=0,l.position1=0,l.postBundlePosition=i,i=r,k()}();if(h.getShared&&(W(),t=o[8191&e],t))return t.read||(t.read=I(t)),t.read()}}let s=g[e];if(s)return s.handlesRead?s(k):s(k());{let t=k();for(let r=0;r<b.length;r++){let n=b[r](e,t);if(void 0!==n)return n}return new _(t,e)}case 7:switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:let t=(u||D())[e];if(void 0!==t)return t;throw new Error("Unknown token "+e)}default:if(isNaN(e)){let e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}throw new Error("Unknown CBOR token "+e)}var f}const U=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function I(e){return e.slowReads=0,function(){let e=r[i++];if(e&=31,e>23)switch(e){case 24:e=r[i++];break;case 25:e=c.getUint16(i),i+=2;break;case 26:e=c.getUint32(i),i+=4;break;default:throw new Error("Expected array header, but got "+r[i-1])}let t=this.compiledReader;for(;t;){if(t.propertyCount===e)return t(k);t=t.next}if(this.slowReads++>=A){let r=this.length==e?this:this.slice(0,e);return t=h.keyMap?new Function("r","return {"+r.map((e=>h.decodeKey(e))).map((e=>U.test(e)?E(e)+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"}"):new Function("r","return {"+r.map((e=>U.test(e)?E(e)+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"}"),this.compiledReader&&(t.next=this.compiledReader),t.propertyCount=e,this.compiledReader=t,t(k)}let n={};if(h.keyMap)for(let t=0;t<e;t++)n[E(h.decodeKey(this[t]))]=k();else for(let t=0;t<e;t++)n[E(this[t])]=k();return n}}function E(e){if("string"==typeof e)return"__proto__"===e?"__proto_":e;if("number"==typeof e||"boolean"==typeof e||"bigint"==typeof e)return e.toString();if(null==e)return e+"";throw new Error("Invalid property name type "+typeof e)}let M=S;function S(e){let n;if(e<16&&(n=x(e)))return n;if(e>64&&t)return t.decode(r.subarray(i,i+=e));const s=i+e,o=[];for(n="";i<s;){const e=r[i++];if(0==(128&e))o.push(e);else if(192==(224&e)){const t=63&r[i++];o.push((31&e)<<6|t)}else if(224==(240&e)){const t=63&r[i++],n=63&r[i++];o.push((31&e)<<12|t<<6|n)}else if(240==(248&e)){let t=(7&e)<<18|(63&r[i++])<<12|(63&r[i++])<<6|63&r[i++];t>65535&&(t-=65536,o.push(t>>>10&1023|55296),t=56320|1023&t),o.push(t)}else o.push(e);o.length>=4096&&(n+=j.apply(String,o),o.length=0)}return o.length>0&&(n+=j.apply(String,o)),n}let j=String.fromCharCode;function x(e){if(e<4){if(e<2){if(0===e)return"";{let e=r[i++];return(128&e)>1?void(i-=1):j(e)}}{let t=r[i++],n=r[i++];if((128&t)>0||(128&n)>0)return void(i-=2);if(e<3)return j(t,n);let s=r[i++];return(128&s)>0?void(i-=3):j(t,n,s)}}{let t=r[i++],n=r[i++],s=r[i++],o=r[i++];if((128&t)>0||(128&n)>0||(128&s)>0||(128&o)>0)return void(i-=4);if(e<6){if(4===e)return j(t,n,s,o);{let e=r[i++];return(128&e)>0?void(i-=5):j(t,n,s,o,e)}}if(e<8){let a=r[i++],l=r[i++];if((128&a)>0||(128&l)>0)return void(i-=6);if(e<7)return j(t,n,s,o,a,l);let f=r[i++];return(128&f)>0?void(i-=7):j(t,n,s,o,a,l,f)}{let a=r[i++],l=r[i++],f=r[i++],u=r[i++];if((128&a)>0||(128&l)>0||(128&f)>0||(128&u)>0)return void(i-=8);if(e<10){if(8===e)return j(t,n,s,o,a,l,f,u);{let e=r[i++];return(128&e)>0?void(i-=9):j(t,n,s,o,a,l,f,u,e)}}if(e<12){let c=r[i++],d=r[i++];if((128&c)>0||(128&d)>0)return void(i-=10);if(e<11)return j(t,n,s,o,a,l,f,u,c,d);let h=r[i++];return(128&h)>0?void(i-=11):j(t,n,s,o,a,l,f,u,c,d,h)}{let c=r[i++],d=r[i++],h=r[i++],y=r[i++];if((128&c)>0||(128&d)>0||(128&h)>0||(128&y)>0)return void(i-=12);if(e<14){if(12===e)return j(t,n,s,o,a,l,f,u,c,d,h,y);{let e=r[i++];return(128&e)>0?void(i-=13):j(t,n,s,o,a,l,f,u,c,d,h,y,e)}}{let p=r[i++],g=r[i++];if((128&p)>0||(128&g)>0)return void(i-=14);if(e<15)return j(t,n,s,o,a,l,f,u,c,d,h,y,p,g);let b=r[i++];return(128&b)>0?void(i-=15):j(t,n,s,o,a,l,f,u,c,d,h,y,p,g,b)}}}}}let B=new Float32Array(1),V=new Uint8Array(B.buffer,0,4);new Array(4096);class _{constructor(e,t){this.value=e,this.tag=t}}g[0]=e=>new Date(e),g[1]=e=>new Date(Math.round(1e3*e)),g[2]=e=>{let t=BigInt(0);for(let r=0,n=e.byteLength;r<n;r++)t=BigInt(e[r])+t<<BigInt(8);return t},g[3]=e=>BigInt(-1)-g[2](e),g[4]=e=>+(e[1]+"e"+e[0]),g[5]=e=>e[1]*Math.exp(e[0]*Math.log(2));const P=(e,t)=>{let r=o[e-=57344];r&&r.isShared&&((o.restoreStructures||(o.restoreStructures=[]))[e]=r),o[e]=t,t.read=I(t)};g[105]=e=>{let t=e.length,r=e[1];P(e[0],r);let n={};for(let i=2;i<t;i++){n[E(r[i-2])]=e[i]}return n},g[14]=e=>l?l[0].slice(l.position0,l.position0+=e):new _(e,14),g[15]=e=>l?l[1].slice(l.position1,l.position1+=e):new _(e,15);let R={Error:Error,RegExp:RegExp};g[27]=e=>(R[e[0]]||Error)(e[1],e[2]);const F=e=>{if(132!=r[i++]){let e=new Error("Packed values structure must be followed by a 4 element array");throw r.length<i&&(e.incomplete=!0),e}let t=e();if(!t||!t.length){let e=new Error("Packed values structure must be followed by a 4 element array");throw e.incomplete=!0,e}return u=u?t.concat(u.slice(t.length)):t,u.prefixes=e(),u.suffixes=e(),e()};function T(e,t){return"string"==typeof e?e+t:e instanceof Array?e.concat(t):Object.assign({},e,t)}function D(){if(!u){if(!h.getShared)throw new Error("No packed values available");W()}return u}F.handlesRead=!0,g[51]=F,g[6]=e=>{if(!u){if(!h.getShared)return new _(e,6);W()}if("number"==typeof e)return u[16+(e>=0?2*e:-2*e-1)];let t=new Error("No support for non-integer packed references yet");throw void 0===e&&(t.incomplete=!0),t},g[28]=e=>{f||(f=new Map,f.id=0);let t,n=f.id++,s=i;t=r[i]>>5==4?[]:{};let o={target:t};f.set(n,o);let a=e();return o.used?(Object.getPrototypeOf(t)!==Object.getPrototypeOf(a)&&(i=s,t=a,f.set(n,{target:t}),a=e()),Object.assign(t,a)):(o.target=a,a)},g[28].handlesRead=!0,g[29]=e=>{let t=f.get(e);return t.used=!0,t.target},g[258]=e=>new Set(e),(g[259]=e=>(h.mapsAsObjects&&(h.mapsAsObjects=!1,d=!0),e())).handlesRead=!0;b.push(((e,t)=>e>=225&&e<=255?T(D().prefixes[e-224],t):e>=28704&&e<=32767?T(D().prefixes[e-28672],t):e>=1879052288&&e<=2147483647?T(D().prefixes[e-1879048192],t):e>=216&&e<=223?T(t,D().suffixes[e-216]):e>=27647&&e<=28671?T(t,D().suffixes[e-27639]):e>=1811940352&&e<=1879048191?T(t,D().suffixes[e-1811939328]):1399353956==e?{packedValues:u,structures:o.slice(0),version:t}:55799==e?t:void 0));const C=1==new Uint8Array(new Uint16Array([1]).buffer)[0],K=[Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,"undefined"==typeof BigUint64Array?{name:"BigUint64Array"}:BigUint64Array,Int8Array,Int16Array,Int32Array,"undefined"==typeof BigInt64Array?{name:"BigInt64Array"}:BigInt64Array,Float32Array,Float64Array],N=[64,68,69,70,71,72,77,78,79,85,86];for(let e=0;e<K.length;e++)L(K[e],N[e]);function L(e,t){let r,n="get"+e.name.slice(0,-5);"function"==typeof e?r=e.BYTES_PER_ELEMENT:e=null;for(let i=0;i<2;i++){if(!i&&1==r)continue;let s=2==r?1:4==r?2:8==r?3:0;g[i?t:t-4]=1==r||i==C?n=>{if(!e)throw new Error("Could not find typed array for code "+t);return h.copyBuffers||1!==r&&(2!==r||1&n.byteOffset)&&(4!==r||3&n.byteOffset)&&(8!==r||7&n.byteOffset)?new e(Uint8Array.prototype.slice.call(n,0).buffer):new e(n.buffer,n.byteOffset,n.byteLength>>s)}:r=>{if(!e)throw new Error("Could not find typed array for code "+t);let o=new DataView(r.buffer,r.byteOffset,r.byteLength),a=r.length>>s,l=new e(a),f=o[n];for(let e=0;e<a;e++)l[e]=f.call(o,e<<s,i);return l}}}function z(){let e=31&r[i++];if(e>23)switch(e){case 24:e=r[i++];break;case 25:e=c.getUint16(i),i+=2;break;case 26:e=c.getUint32(i),i+=4}return e}function W(){if(h.getShared){let e=J((()=>(r=null,h.getShared())))||{},t=e.structures||[];h.sharedVersion=e.version,u=h.sharedValues=e.packedValues,!0===o?h.structures=o=t:o.splice.apply(o,[0,t.length].concat(t))}}function J(e){let t=n,s=i,u=y,d=p,g=a,b=f,w=l,A=new Uint8Array(r.slice(0,n)),v=o,O=h,k=m,U=e();return n=t,i=s,y=u,p=d,a=g,f=b,l=w,r=A,m=k,o=v,h=O,c=new DataView(r.buffer,r.byteOffset,r.byteLength),U}function H(){r=null,f=null,o=null}const Y=new Array(147);for(let e=0;e<256;e++)Y[e]=+("1e"+Math.floor(45.15-.30103*e));let $=new v({useRecords:!1});const Z=$.decode,q=$.decodeMultiple,G={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};let Q,X,ee;try{Q=new TextEncoder}catch(e){}const te="object"==typeof globalThis&&globalThis.Buffer,re=void 0!==te,ne=re?te.allocUnsafeSlow:Uint8Array,ie=re?te:Uint8Array,se=re?4294967296:2144337920;let oe,ae,le,fe,ue=0,ce=null;const de=/[\u0080-\uFFFF]/,he=Symbol("record-id");class ye extends v{constructor(e){let t,r,n,i,s;super(e),this.offset=0,e=e||{};let o=ie.prototype.utf8Write?function(e,t,r){return ae.utf8Write(e,t,r)}:!(!Q||!Q.encodeInto)&&function(e,t){return Q.encodeInto(e,ae.subarray(t)).written},a=this,l=e.structures||e.saveStructures,f=e.maxSharedStructures;if(null==f&&(f=l?128:0),f>8190)throw new Error("Maximum maxSharedStructure is 8190");let u=e.sequential;u&&(f=0),this.structures||(this.structures=[]),this.saveStructures&&(this.saveShared=this.saveStructures);let c,d,h,y=e.sharedValues;if(y){h=Object.create(null);for(let e=0,t=y.length;e<t;e++)h[y[e]]=e}let p=[],g=0,b=0;this.mapEncode=function(e,t){if(this._keyMap&&!this._mapped&&"Array"===e.constructor.name)e=e.map((e=>this.encodeKeys(e)));return this.encode(e,t)},this.encode=function(o,l){if(ae||(ae=new ne(8192),le=new DataView(ae.buffer,0,8192),ue=0),fe=ae.length-10,fe-ue<2048?(ae=new ne(ae.length),le=new DataView(ae.buffer,0,ae.length),fe=ae.length-10,ue=0):l===_e&&(ue=ue+7&2147483640),t=ue,a.useSelfDescribedHeader&&(le.setUint32(ue,3654940416),ue+=3),s=a.structuredClone?new Map:null,a.bundleStrings&&"string"!=typeof o?(ce=[],ce.size=1/0):ce=null,r=a.structures,r){if(r.uninitialized){let e=a.getShared()||{};a.structures=r=e.structures||[],a.sharedVersion=e.version;let t=a.sharedValues=e.packedValues;if(t){h={};for(let e=0,r=t.length;e<r;e++)h[t[e]]=e}}let e=r.length;if(e>f&&!u&&(e=f),!r.transitions){r.transitions=Object.create(null);for(let t=0;t<e;t++){let e=r[t];if(!e)continue;let n,i=r.transitions;for(let r=0,s=e.length;r<s;r++){void 0===i[he]&&(i[he]=t);let s=e[r];n=i[s],n||(n=i[s]=Object.create(null)),i=n}i[he]=1048576|t}}u||(r.nextId=e)}if(n&&(n=!1),i=r||[],d=h,e.pack){let t=new Map;if(t.values=[],t.encoder=a,t.maxValues=e.maxPrivatePackedValues||(h?16:1/0),t.objectMap=h||!1,t.samplingPackedValues=c,Ae(o,t),t.values.length>0){ae[ue++]=216,ae[ue++]=51,be(4);let e=t.values;w(e),be(0),be(0),d=Object.create(h||null);for(let t=0,r=e.length;t<r;t++)d[e[t]]=t}}oe=lℜtry{if(oe)return;if(w(o),ce&&Ue(t,w),a.offset=ue,s&&s.idsToInsert){ue+=2*s.idsToInsert.length,ue>fe&&A(ue),a.offset=ue;let e=function(e,t){let r,n=2*t.length,i=e.length-n;t.sort(((e,t)=>e.offset>t.offset?1:-1));for(let r=0;r<t.length;r++){let n=t[r];n.id=r;for(let t of n.references)e[t++]=r>>8,e[t]=255&r}for(;r=t.pop();){let t=r.offset;e.copyWithin(t+n,t,i),n-=2;let s=t+n;e[s++]=216,e[s++]=28,i=t}return e}(ae.subarray(t,ue),s.idsToInsert);return s=null,e}return l&_e?(ae.start=t,ae.end=ue,ae):ae.subarray(t,ue)}finally{if(r)if(b<10&&b++,r.length>f&&(r.length=f),g>1e4)r.transitions=null,b=0,g=0,p.length>0&&(p=[]);else if(p.length>0&&!u){for(let e=0,t=p.length;e<t;e++)p[e][he]=void 0;p=[]}if(n&&a.saveShared){a.structures.length>f&&(a.structures=a.structures.slice(0,f));let e=ae.subarray(t,ue);return!1===a.updateSharedData()?a.encode(o):e}l&Pe&&(ue=t)}},this.findCommonStringsToPack=()=>(c=new Map,h||(h=Object.create(null)),e=>{let t=e&&e.threshold||4,r=this.pack?e.maxPrivatePackedValues||16:0;y||(y=this.sharedValues=[]);for(let[e,i]of c)i.count>t&&(h[e]=r++,y.push(e),n=!0);for(;this.saveShared&&!1===this.updateSharedData(););c=null});const w=r=>{ue>fe&&(ae=A(ue));var n,i=typeof r;if("string"===i){if(d){let t=d[r];if(t>=0)return void(t<16?ae[ue++]=t+224:(ae[ue++]=198,w(1&t?15-t>>1:t-16>>1)));if(c&&!e.pack){let e=c.get(r);e?e.count++:c.set(r,{count:1})}}let i,s=r.length;if(ce&&s>=4&&s<1024){if((ce.size+=s)>61440){let e,r=(ce[0]?3*ce[0].length+ce[1].length:0)+10;ue+r>fe&&(ae=A(ue+r)),ae[ue++]=217,ae[ue++]=223,ae[ue++]=249,ae[ue++]=ce.position?132:130,ae[ue++]=26,e=ue-t,ue+=4,ce.position&&Ue(t,w),ce=["",""],ce.size=0,ce.position=e}let e=de.test(r);return ce[e?0:1]+=r,ae[ue++]=e?206:207,void w(s)}i=s<32?1:s<256?2:s<65536?3:5;let a=3*s;if(ue+a>fe&&(ae=A(ue+a)),s<64||!o){let e,t,o,a=ue+i;for(e=0;e<s;e++)t=r.charCodeAt(e),t<128?ae[a++]=t:t<2048?(ae[a++]=t>>6|192,ae[a++]=63&t|128):55296==(64512&t)&&56320==(64512&(o=r.charCodeAt(e+1)))?(t=65536+((1023&t)<<10)+(1023&o),e++,ae[a++]=t>>18|240,ae[a++]=t>>12&63|128,ae[a++]=t>>6&63|128,ae[a++]=63&t|128):(ae[a++]=t>>12|224,ae[a++]=t>>6&63|128,ae[a++]=63&t|128);n=a-ue-i}else n=o(r,ue+i,a);n<24?ae[ue++]=96|n:n<256?(i<2&&ae.copyWithin(ue+2,ue+1,ue+1+n),ae[ue++]=120,ae[ue++]=n):n<65536?(i<3&&ae.copyWithin(ue+3,ue+2,ue+2+n),ae[ue++]=121,ae[ue++]=n>>8,ae[ue++]=255&n):(i<5&&ae.copyWithin(ue+5,ue+3,ue+3+n),ae[ue++]=122,le.setUint32(ue,n),ue+=4),ue+=n}else if("number"===i)if(this.alwaysUseFloat||r>>>0!==r)if(this.alwaysUseFloat||r>>0!==r){let e;if((e=this.useFloat32)>0&&r<4294967296&&r>=-2147483648){let t;if(ae[ue++]=250,le.setFloat32(ue,r),e<4||(t=r*Y[(127&ae[ue])<<1|ae[ue+1]>>7])>>0===t)return void(ue+=4);ue--}ae[ue++]=251,le.setFloat64(ue,r),ue+=8}else r>=-24?ae[ue++]=31-r:r>=-256?(ae[ue++]=56,ae[ue++]=~r):r>=-65536?(ae[ue++]=57,le.setUint16(ue,~r),ue+=2):(ae[ue++]=58,le.setUint32(ue,~r),ue+=4);else r<24?ae[ue++]=r:r<256?(ae[ue++]=24,ae[ue++]=r):r<65536?(ae[ue++]=25,ae[ue++]=r>>8,ae[ue++]=255&r):(ae[ue++]=26,le.setUint32(ue,r),ue+=4);else if("object"===i)if(r){if(s){let e=s.get(r);if(e){if(ae[ue++]=216,ae[ue++]=29,ae[ue++]=25,!e.references){let t=s.idsToInsert||(s.idsToInsert=[]);e.references=[],t.push(e)}return e.references.push(ue-t),void(ue+=2)}s.set(r,{offset:ue-t})}let e=r.constructor;if(e===Object)m(r);else if(e===Array){(n=r.length)<24?ae[ue++]=128|n:be(n);for(let e=0;e<n;e++)w(r[e])}else if(e===Map)if((this.mapsAsObjects?!1!==this.useTag259ForMaps:this.useTag259ForMaps)&&(ae[ue++]=217,ae[ue++]=1,ae[ue++]=3),(n=r.size)<24?ae[ue++]=160|n:n<256?(ae[ue++]=184,ae[ue++]=n):n<65536?(ae[ue++]=185,ae[ue++]=n>>8,ae[ue++]=255&n):(ae[ue++]=186,le.setUint32(ue,n),ue+=4),a.keyMap)for(let[e,t]of r)w(a.encodeKey(e)),w(t);else for(let[e,t]of r)w(e),w(t);else{for(let e=0,t=X.length;e<t;e++){if(r instanceof ee[e]){let t=X[e],n=t.tag;return null==n&&(n=t.getTag&&t.getTag.call(this,r)),n<24?ae[ue++]=192|n:n<256?(ae[ue++]=216,ae[ue++]=n):n<65536?(ae[ue++]=217,ae[ue++]=n>>8,ae[ue++]=255&n):n>-1&&(ae[ue++]=218,le.setUint32(ue,n),ue+=4),void t.encode.call(this,r,w,A)}}if(r[Symbol.iterator]){if(oe){let e=new Error("Iterable should be serialized as iterator");throw e.iteratorNotHandled=!0,e}ae[ue++]=159;for(let e of r)w(e);return void(ae[ue++]=255)}if(r[Symbol.asyncIterator]||me(r)){let e=new Error("Iterable/blob should be serialized as iterator");throw e.iteratorNotHandled=!0,e}if(this.useToJSON&&r.toJSON){const e=r.toJSON();if(e!==r)return w(e)}m(r)}}else ae[ue++]=246;else if("boolean"===i)ae[ue++]=r?245:244;else if("bigint"===i){if(r<BigInt(1)<<BigInt(64)&&r>=0)ae[ue++]=27,le.setBigUint64(ue,r);else if(r>-(BigInt(1)<<BigInt(64))&&r<0)ae[ue++]=59,le.setBigUint64(ue,-r-BigInt(1));else{if(!this.largeBigIntToFloat)throw new RangeError(r+" was too large to fit in CBOR 64-bit integer format, set largeBigIntToFloat to convert to float-64");ae[ue++]=251,le.setFloat64(ue,Number(r))}ue+=8}else{if("undefined"!==i)throw new Error("Unknown type: "+i);ae[ue++]=247}},m=!1===this.useRecords?this.variableMapSize?e=>{let t=Object.keys(e),r=Object.values(e),n=t.length;if(n<24?ae[ue++]=160|n:n<256?(ae[ue++]=184,ae[ue++]=n):n<65536?(ae[ue++]=185,ae[ue++]=n>>8,ae[ue++]=255&n):(ae[ue++]=186,le.setUint32(ue,n),ue+=4),a.keyMap)for(let e=0;e<n;e++)w(a.encodeKey(t[e])),w(r[e]);else for(let e=0;e<n;e++)w(t[e]),w(r[e])}:e=>{ae[ue++]=185;let r=ue-t;ue+=2;let n=0;if(a.keyMap)for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(w(a.encodeKey(t)),w(e[t]),n++);else for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(w(t),w(e[t]),n++);ae[r+++t]=n>>8,ae[r+t]=255&n}:(e,t)=>{let r,s,o,a=i.transitions||(i.transitions=Object.create(null)),l=0,u=0;if(this.keyMap){o=Object.keys(e).map((e=>this.encodeKey(e))),u=o.length;for(let e=0;e<u;e++){let t=o[e];r=a[t],r||(r=a[t]=Object.create(null),l++),a=r}}else for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(r=a[t],r||(1048576&a[he]&&(s=65535&a[he]),r=a[t]=Object.create(null),l++),a=r,u++);let c=a[he];if(void 0!==c)c&=65535,ae[ue++]=217,ae[ue++]=c>>8|224,ae[ue++]=255&c;else{if(o||(o=a.__keys__||(a.__keys__=Object.keys(e))),void 0===s?(c=i.nextId++,c||(c=0,i.nextId=1),c>=256&&(i.nextId=(c=f)+1)):c=s,i[c]=o,!(c<f)){if(a[he]=c,le.setUint32(ue,3655335680),ue+=3,l&&(g+=b*l),p.length>=256-f&&(p.shift()[he]=void 0),p.push(a),be(u+2),w(57344+c),w(o),t)return;for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&w(e[t]);return}ae[ue++]=217,ae[ue++]=c>>8|224,ae[ue++]=255&c,a=i.transitions;for(let e=0;e<u;e++)(void 0===a[he]||1048576&a[he])&&(a[he]=c),a=a[o[e]];a[he]=1048576|c,n=!0}if(u<24?ae[ue++]=128|u:be(u),!t)for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&w(e[t])},A=e=>{let r;if(e>16777216){if(e-t>se)throw new Error("Encoded buffer would be larger than maximum buffer size");r=Math.min(se,4096*Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096))}else r=1+(Math.max(e-t<<2,ae.length-1)>>12)<<12;let n=new ne(r);return le=new DataView(n.buffer,0,r),ae.copy?ae.copy(n,0,t,e):n.set(ae.slice(t,e)),ue-=t,t=0,fe=n.length-10,ae=n};let v=100,O=1e3;function*k(e,r,n){let i=e.constructor;if(i===Object){let t=!1!==a.useRecords;t?m(e,!0):pe(Object.keys(e).length,160);for(let n in e){let i=e[n];t||w(n),i&&"object"==typeof i?r[n]?yield*k(i,r[n]):yield*U(i,r,n):w(i)}}else if(i===Array){let n=e.length;be(n);for(let i=0;i<n;i++){let n=e[i];n&&("object"==typeof n||ue-t>v)?r.element?yield*k(n,r.element):yield*U(n,r,"element"):w(n)}}else if(e[Symbol.iterator]){ae[ue++]=159;for(let n of e)n&&("object"==typeof n||ue-t>v)?r.element?yield*k(n,r.element):yield*U(n,r,"element"):w(n);ae[ue++]=255}else me(e)?(pe(e.size,64),yield ae.subarray(t,ue),yield e,I()):e[Symbol.asyncIterator]?(ae[ue++]=159,yield ae.subarray(t,ue),yield e,I(),ae[ue++]=255):w(e);n&&ue>t?yield ae.subarray(t,ue):ue-t>v&&(yield ae.subarray(t,ue),I())}function*U(e,r,n){let i=ue-t;try{w(e),ue-t>v&&(yield ae.subarray(t,ue),I())}catch(s){if(!s.iteratorNotHandled)throw s;r[n]={},ue=t+i,yield*k.call(this,e,r[n])}}function I(){v=O,a.encode(null,Re)}function E(e,t,r){return v=t&&t.chunkThreshold?O=t.chunkThreshold:100,e&&"object"==typeof e?(a.encode(null,Re),r(e,a.iterateProperties||(a.iterateProperties={}),!0)):[a.encode(e)]}async function*M(e,t){for(let r of k(e,t,!0)){let e=r.constructor;if(e===ie||e===Uint8Array)yield r;else if(me(r)){let e,t=r.stream().getReader();for(;!(e=await t.read()).done;)yield e.value}else if(r[Symbol.asyncIterator])for await(let e of r)I(),e?yield*M(e,t.async||(t.async={})):yield a.encode(e);else yield r}}this.encodeAsIterable=function(e,t){return E(e,t,k)},this.encodeAsAsyncIterable=function(e,t){return E(e,t,M)}}useBuffer(e){ae=e,le=new DataView(ae.buffer,ae.byteOffset,ae.byteLength),ue=0}clearSharedData(){this.structures&&(this.structures=[]),this.sharedValues&&(this.sharedValues=void 0)}updateSharedData(){let e=this.sharedVersion||0;this.sharedVersion=e+1;let t=this.structures.slice(0),r=new ge(t,this.sharedValues,this.sharedVersion),n=this.saveShared(r,(t=>(t&&t.version||0)==e));return!1===n?(r=this.getShared()||{},this.structures=r.structures||[],this.sharedValues=r.packedValues,this.sharedVersion=r.version,this.structures.nextId=this.structures.length):t.forEach(((e,t)=>this.structures[t]=e)),n}}function pe(e,t){e<24?ae[ue++]=t|e:e<256?(ae[ue++]=24|t,ae[ue++]=e):e<65536?(ae[ue++]=25|t,ae[ue++]=e>>8,ae[ue++]=255&e):(ae[ue++]=26|t,le.setUint32(ue,e),ue+=4)}class ge{constructor(e,t,r){this.structures=e,this.packedValues=t,this.version=r}}function be(e){e<24?ae[ue++]=128|e:e<256?(ae[ue++]=152,ae[ue++]=e):e<65536?(ae[ue++]=153,ae[ue++]=e>>8,ae[ue++]=255&e):(ae[ue++]=154,le.setUint32(ue,e),ue+=4)}const we="undefined"==typeof Blob?function(){}:Blob;function me(e){if(e instanceof we)return!0;let t=e[Symbol.toStringTag];return"Blob"===t||"File"===t}function Ae(e,t){switch(typeof e){case"string":if(e.length>3){if(t.objectMap[e]>-1||t.values.length>=t.maxValues)return;let r=t.get(e);if(r)2==++r.count&&t.values.push(e);else if(t.set(e,{count:1}),t.samplingPackedValues){let r=t.samplingPackedValues.get(e);r?r.count++:t.samplingPackedValues.set(e,{count:1})}}break;case"object":if(e)if(e instanceof Array)for(let r=0,n=e.length;r<n;r++)Ae(e[r],t);else{let n=!t.encoder.useRecords;for(var r in e)e.hasOwnProperty(r)&&(n&&Ae(r,t),Ae(e[r],t))}break;case"function":console.log(e)}}const ve=1==new Uint8Array(new Uint16Array([1]).buffer)[0];function Oe(e,t){return!ve&&t>1&&(e-=4),{tag:e,encode:function(e,t){let r=e.byteLength,n=e.byteOffset||0,i=e.buffer||e;t(re?te.from(i,n,r):new Uint8Array(i,n,r))}}}function ke(e,t){let r=e.byteLength;r<24?ae[ue++]=64+r:r<256?(ae[ue++]=88,ae[ue++]=r):r<65536?(ae[ue++]=89,ae[ue++]=r>>8,ae[ue++]=255&r):(ae[ue++]=90,le.setUint32(ue,r),ue+=4),ue+r>=ae.length&&t(ue+r),ae.set(e.buffer?e:new Uint8Array(e),ue),ue+=r}function Ue(e,t){le.setUint32(ce.position+e,ue-ce.position-e+1);let r=ce;ce=null,t(r[0]),t(r[1])}ee=[Date,Set,Error,RegExp,_,ArrayBuffer,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,"undefined"==typeof BigUint64Array?function(){}:BigUint64Array,Int8Array,Int16Array,Int32Array,"undefined"==typeof BigInt64Array?function(){}:BigInt64Array,Float32Array,Float64Array,ge],X=[{tag:1,encode(e,t){let r=e.getTime()/1e3;(this.useTimestamp32||0===e.getMilliseconds())&&r>=0&&r<4294967296?(ae[ue++]=26,le.setUint32(ue,r),ue+=4):(ae[ue++]=251,le.setFloat64(ue,r),ue+=8)}},{tag:258,encode(e,t){t(Array.from(e))}},{tag:27,encode(e,t){t([e.name,e.message])}},{tag:27,encode(e,t){t(["RegExp",e.source,e.flags])}},{getTag:e=>e.tag,encode(e,t){t(e.value)}},{encode(e,t,r){ke(e,r)}},{getTag(e){if(e.constructor===Uint8Array&&(this.tagUint8Array||re&&!1!==this.tagUint8Array))return 64},encode(e,t,r){ke(e,r)}},Oe(68,1),Oe(69,2),Oe(70,4),Oe(71,8),Oe(72,1),Oe(77,2),Oe(78,4),Oe(79,8),Oe(85,4),Oe(86,8),{encode(e,t){let r=e.packedValues||[],n=e.structures||[];if(r.values.length>0){ae[ue++]=216,ae[ue++]=51,be(4);let e=r.values;t(e),be(0),be(0),packedObjectMap=Object.create(sharedPackedObjectMap||null);for(let t=0,r=e.length;t<r;t++)packedObjectMap[e[t]]=t}if(n){le.setUint32(ue,3655335424),ue+=3;let r=n.slice(0);r.unshift(57344),r.push(new _(e.version,1399353956)),t(r)}else t(new _(e.version,1399353956))}}];let Ie=new ye({useRecords:!1});const Ee=Ie.encode,Me=Ie.encodeAsIterable,Se=Ie.encodeAsAsyncIterable,{NEVER:je,ALWAYS:xe,DECIMAL_ROUND:Be,DECIMAL_FIT:Ve}=G,_e=512,Pe=1024,Re=2048;e.ALWAYS=xe,e.DECIMAL_FIT=Ve,e.DECIMAL_ROUND=Be,e.Decoder=v,e.Encoder=ye,e.FLOAT32_OPTIONS=G,e.NEVER=je,e.REUSE_BUFFER_MODE=_e,e.Tag=_,e.addExtension=function(e){if(e.Class){if(!e.encode)throw new Error("Extension has no encode function");ee.unshift(e.Class),X.unshift(e)}!function(e){g[e.tag]=e.decode}(e)},e.clearSource=H,e.decode=Z,e.decodeIter=function(e,t={}){if(!e||"object"!=typeof e)throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a promise");const r=new v(t);let n;const i=e=>{let t;n&&(e=Buffer.concat([n,e]),n=void 0);try{t=r.decodeMultiple(e)}catch(r){if(!r.incomplete)throw r;n=e.slice(r.lastPosition),t=r.values}return t};return"function"==typeof e[Symbol.iterator]?function*(){for(const t of e)yield*i(t)}():"function"==typeof e[Symbol.asyncIterator]?async function*(){for await(const t of e)yield*i(t)}():void 0},e.decodeMultiple=q,e.encode=Ee,e.encodeAsAsyncIterable=Se,e.encodeAsIterable=Me,e.encodeIter=function(e,t={}){if(e&&"object"==typeof e){if("function"==typeof e[Symbol.iterator])return function*(e,t){const r=new ye(t);for(const t of e)yield r.encode(t)}(e,t);if("function"==typeof e.then||"function"==typeof e[Symbol.asyncIterator])return async function*(e,t){const r=new ye(t);for await(const t of e)yield r.encode(t)}(e,t);throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a Promise")}throw new Error("first argument must be an Iterable, Async Iterable, or a Promise for an Async Iterable")},e.isNativeAccelerationEnabled=!1,e.roundFloat32=function(e){B[0]=e;let t=Y[(127&V[3])<<1|V[2]>>7];return(t*e+(e>0?.5:-.5)>>0)/t}})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CBOR={})}(this,(function(e){"use strict";let t,r,n;try{t=new TextDecoder}catch(e){}let i=0;const s={};let o,a,l,f,u,c,d,h=11281e4,y=1681e4,p={},g=0,w=0,b=[],m=[],A={useRecords:!1,mapsAsObjects:!0},v=!1,O=2;try{new Function("")}catch(e){O=1/0}class k{constructor(e){if(e&&(!e.keyMap&&!e._keyMap||e.useRecords||(e.useRecords=!1,e.mapsAsObjects=!0),!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.getStructures&&(e.getShared=e.getStructures),e.getShared&&!e.structures&&((e.structures=[]).uninitialized=!0),e.keyMap)){this.mapKey=new Map;for(let[t,r]of Object.entries(e.keyMap))this.mapKey.set(r,t)}Object.assign(this,e)}decodeKey(e){return this.keyMap&&this.mapKey.get(e)||e}encodeKey(e){return this.keyMap&&this.keyMap.hasOwnProperty(e)?this.keyMap[e]:e}encodeKeys(e){if(!this._keyMap)return e;let t=new Map;for(let[r,n]of Object.entries(e))t.set(this._keyMap.hasOwnProperty(r)?this._keyMap[r]:r,n);return t}decodeKeys(e){if(!this._keyMap||"Map"!=e.constructor.name)return e;if(!this._mapKey){this._mapKey=new Map;for(let[e,t]of Object.entries(this._keyMap))this._mapKey.set(t,e)}let t={};return e.forEach(((e,r)=>t[M(this._mapKey.has(r)?this._mapKey.get(r):r)]=e)),t}mapDecode(e,t){let r=this.decode(e);return this._keyMap&&"Array"===r.constructor.name?r.map((e=>this.decodeKeys(e))):r}decode(e,t){if(r)return H((()=>(Y(),this?this.decode(e,t):k.prototype.decode.call(A,e,t))));n=t>-1?t:e.length,i=0,w=0,a=null,l=null,r=e;try{c=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(t){if(r=null,e instanceof Uint8Array)throw t;throw new Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}if(this instanceof k){if(p=this,u=this.sharedValues&&(this.pack?new Array(this.maxPrivatePackedValues||16).concat(this.sharedValues):this.sharedValues),this.structures)return o=this.structures,E();(!o||o.length>0)&&(o=[])}else p=A,(!o||o.length>0)&&(o=[]),u=null;return E()}decodeMultiple(e,t){let r,n=0;try{let s=e.length;v=!0;let o=this?this.decode(e,s):Z.decode(e,s);if(!t){for(r=[o];i<s;)n=i,r.push(E());return r}if(!1===t(o))return;for(;i<s;)if(n=i,!1===t(E()))return}catch(e){throw e.lastPosition=n,e.values=r,e}finally{v=!1,Y()}}}function E(){try{let e=I();if(l){if(i>=l.postBundlePosition){let e=new Error("Unexpected bundle position");throw e.incomplete=!0,e}i=l.postBundlePosition,l=null}if(i==n)o=null,r=null,f&&(f=null);else{if(i>n){let e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}if(!v)throw new Error("Data read, but end of buffer not reached")}return e}catch(e){throw Y(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer"))&&(e.incomplete=!0),e}}function I(){let e=r[i++],t=e>>5;if(e&=31,e>23)switch(e){case 24:e=r[i++];break;case 25:if(7==t)return function(){let e=r[i++],t=r[i++],n=(127&e)>>2;if(31===n)return t||3&e?NaN:128&e?-1/0:1/0;if(0===n){let r=((3&e)<<8|t)/(1<<24);return 128&e?-r:r}return _[3]=128&e|56+(n>>1),_[2]=(7&e)<<5|t>>3,_[1]=t<<5,_[0]=0,P[0]}();e=c.getUint16(i),i+=2;break;case 26:if(7==t){let e=c.getFloat32(i);if(p.useFloat32>2){let t=q[(127&r[i])<<1|r[i+1]>>7];return i+=4,(t*e+(e>0?.5:-.5)>>0)/t}return i+=4,e}e=c.getUint32(i),i+=4;break;case 27:if(7==t){let e=c.getFloat64(i);return i+=8,e}if(t>1){if(c.getUint32(i)>0)throw new Error("JavaScript does not support arrays, maps, or strings with length over 4294967295");e=c.getUint32(i+4)}else p.int64AsNumber?(e=4294967296*c.getUint32(i),e+=c.getUint32(i+4)):e=c.getBigUint64(i);i+=8;break;case 31:switch(t){case 2:case 3:throw new Error("Indefinite length not supported for byte or text strings");case 4:let e,r=[],n=0;for(;(e=I())!=s;){if(n>=h)throw new Error(`Array length exceeds ${h}`);r[n++]=e}return 4==t?r:3==t?r.join(""):Buffer.concat(r);case 5:let i;if(p.mapsAsObjects){let e={},t=0;if(p.keyMap)for(;(i=I())!=s;){if(t++>=y)throw new Error(`Property count exceeds ${y}`);e[M(p.decodeKey(i))]=I()}else for(;(i=I())!=s;){if(t++>=y)throw new Error(`Property count exceeds ${y}`);e[M(i)]=I()}return e}{d&&(p.mapsAsObjects=!0,d=!1);let e=new Map;if(p.keyMap){let t=0;for(;(i=I())!=s;){if(t++>=y)throw new Error(`Map size exceeds ${y}`);e.set(p.decodeKey(i),I())}}else{let t=0;for(;(i=I())!=s;){if(t++>=y)throw new Error(`Map size exceeds ${y}`);e.set(i,I())}}return e}case 7:return s;default:throw new Error("Invalid major type for indefinite length "+t)}default:throw new Error("Unknown token "+e)}switch(t){case 0:return e;case 1:return~e;case 2:return f=e,p.copyBuffers?Uint8Array.prototype.slice.call(r,i,i+=f):r.subarray(i,i+=f);case 3:if(w>=i)return a.slice(i-g,(i+=e)-g);if(0==w&&n<140&&e<32){let t=e<16?V(e):function(e){let t=i,n=new Array(e);for(let s=0;s<e;s++){const e=r[i++];if((128&e)>0)return void(i=t);n[s]=e}return B.apply(String,n)}(e);if(null!=t)return t}return x(e);case 4:if(e>=h)throw new Error(`Array length exceeds ${h}`);let t=new Array(e);for(let r=0;r<e;r++)t[r]=I();return t;case 5:if(e>=y)throw new Error(`Map size exceeds ${h}`);if(p.mapsAsObjects){let t={};if(p.keyMap)for(let r=0;r<e;r++)t[M(p.decodeKey(I()))]=I();else for(let r=0;r<e;r++)t[M(I())]=I();return t}{d&&(p.mapsAsObjects=!0,d=!1);let t=new Map;if(p.keyMap)for(let r=0;r<e;r++)t.set(p.decodeKey(I()),I());else for(let r=0;r<e;r++)t.set(I(),I());return t}case 6:if(e>=57337){let t=o[8191&e];if(t)return t.read||(t.read=S(t)),t.read();if(e<65536){if(57343==e){let e=$(),t=I(),r=I();F(t,r);let n={};if(p.keyMap)for(let t=2;t<e;t++){n[M(p.decodeKey(r[t-2]))]=I()}else for(let t=2;t<e;t++){n[M(r[t-2])]=I()}return n}if(57342==e){let e=$(),t=I();for(let r=2;r<e;r++)F(t++,I());return I()}if(57337==e)return function(){let e=$(),t=i+I();for(let t=2;t<e;t++){let e=$();i+=e}let r=i;return i=t,l=[j($()),j($())],l.position0=0,l.position1=0,l.postBundlePosition=i,i=r,I()}();if(p.getShared&&(J(),t=o[8191&e],t))return t.read||(t.read=S(t)),t.read()}}let s=b[e];if(s)return s.handlesRead?s(I):s(I());{let t=I();for(let r=0;r<m.length;r++){let n=m[r](e,t);if(void 0!==n)return n}return new R(t,e)}case 7:switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:let t=(u||K())[e];if(void 0!==t)return t;throw new Error("Unknown token "+e)}default:if(isNaN(e)){let e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}throw new Error("Unknown CBOR token "+e)}var f}const U=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function S(e){if(!e)throw new Error("Structure is required in record definition");return e.slowReads=0,function(){let e=r[i++];if(e&=31,e>23)switch(e){case 24:e=r[i++];break;case 25:e=c.getUint16(i),i+=2;break;case 26:e=c.getUint32(i),i+=4;break;default:throw new Error("Expected array header, but got "+r[i-1])}let t=this.compiledReader;for(;t;){if(t.propertyCount===e)return t(I);t=t.next}if(this.slowReads++>=O){let r=this.length==e?this:this.slice(0,e);return t=p.keyMap?new Function("r","return {"+r.map((e=>p.decodeKey(e))).map((e=>U.test(e)?M(e)+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"}"):new Function("r","return {"+r.map((e=>U.test(e)?M(e)+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"}"),this.compiledReader&&(t.next=this.compiledReader),t.propertyCount=e,this.compiledReader=t,t(I)}let n={};if(p.keyMap)for(let t=0;t<e;t++)n[M(p.decodeKey(this[t]))]=I();else for(let t=0;t<e;t++)n[M(this[t])]=I();return n}}function M(e){if("string"==typeof e)return"__proto__"===e?"__proto_":e;if("number"==typeof e||"boolean"==typeof e||"bigint"==typeof e)return e.toString();if(null==e)return e+"";throw new Error("Invalid property name type "+typeof e)}let x=j;function j(e){let n;if(e<16&&(n=V(e)))return n;if(e>64&&t)return t.decode(r.subarray(i,i+=e));const s=i+e,o=[];for(n="";i<s;){const e=r[i++];if(0==(128&e))o.push(e);else if(192==(224&e)){const t=63&r[i++];o.push((31&e)<<6|t)}else if(224==(240&e)){const t=63&r[i++],n=63&r[i++];o.push((31&e)<<12|t<<6|n)}else if(240==(248&e)){let t=(7&e)<<18|(63&r[i++])<<12|(63&r[i++])<<6|63&r[i++];t>65535&&(t-=65536,o.push(t>>>10&1023|55296),t=56320|1023&t),o.push(t)}else o.push(e);o.length>=4096&&(n+=B.apply(String,o),o.length=0)}return o.length>0&&(n+=B.apply(String,o)),n}let B=String.fromCharCode;function V(e){if(e<4){if(e<2){if(0===e)return"";{let e=r[i++];return(128&e)>1?void(i-=1):B(e)}}{let t=r[i++],n=r[i++];if((128&t)>0||(128&n)>0)return void(i-=2);if(e<3)return B(t,n);let s=r[i++];return(128&s)>0?void(i-=3):B(t,n,s)}}{let t=r[i++],n=r[i++],s=r[i++],o=r[i++];if((128&t)>0||(128&n)>0||(128&s)>0||(128&o)>0)return void(i-=4);if(e<6){if(4===e)return B(t,n,s,o);{let e=r[i++];return(128&e)>0?void(i-=5):B(t,n,s,o,e)}}if(e<8){let a=r[i++],l=r[i++];if((128&a)>0||(128&l)>0)return void(i-=6);if(e<7)return B(t,n,s,o,a,l);let f=r[i++];return(128&f)>0?void(i-=7):B(t,n,s,o,a,l,f)}{let a=r[i++],l=r[i++],f=r[i++],u=r[i++];if((128&a)>0||(128&l)>0||(128&f)>0||(128&u)>0)return void(i-=8);if(e<10){if(8===e)return B(t,n,s,o,a,l,f,u);{let e=r[i++];return(128&e)>0?void(i-=9):B(t,n,s,o,a,l,f,u,e)}}if(e<12){let c=r[i++],d=r[i++];if((128&c)>0||(128&d)>0)return void(i-=10);if(e<11)return B(t,n,s,o,a,l,f,u,c,d);let h=r[i++];return(128&h)>0?void(i-=11):B(t,n,s,o,a,l,f,u,c,d,h)}{let c=r[i++],d=r[i++],h=r[i++],y=r[i++];if((128&c)>0||(128&d)>0||(128&h)>0||(128&y)>0)return void(i-=12);if(e<14){if(12===e)return B(t,n,s,o,a,l,f,u,c,d,h,y);{let e=r[i++];return(128&e)>0?void(i-=13):B(t,n,s,o,a,l,f,u,c,d,h,y,e)}}{let p=r[i++],g=r[i++];if((128&p)>0||(128&g)>0)return void(i-=14);if(e<15)return B(t,n,s,o,a,l,f,u,c,d,h,y,p,g);let w=r[i++];return(128&w)>0?void(i-=15):B(t,n,s,o,a,l,f,u,c,d,h,y,p,g,w)}}}}}let P=new Float32Array(1),_=new Uint8Array(P.buffer,0,4);new Array(4096);class R{constructor(e,t){this.value=e,this.tag=t}}b[0]=e=>new Date(e),b[1]=e=>new Date(Math.round(1e3*e)),b[2]=e=>{let t=BigInt(0);for(let r=0,n=e.byteLength;r<n;r++)t=BigInt(e[r])+(t<<BigInt(8));return t},b[3]=e=>BigInt(-1)-b[2](e),b[4]=e=>+(e[1]+"e"+e[0]),b[5]=e=>e[1]*Math.exp(e[0]*Math.log(2));const F=(e,t)=>{let r=o[e-=57344];r&&r.isShared&&((o.restoreStructures||(o.restoreStructures=[]))[e]=r),o[e]=t,t.read=S(t)};b[105]=e=>{let t=e.length,r=e[1];F(e[0],r);let n={};for(let i=2;i<t;i++){n[M(r[i-2])]=e[i]}return n},b[14]=e=>l?l[0].slice(l.position0,l.position0+=e):new R(e,14),b[15]=e=>l?l[1].slice(l.position1,l.position1+=e):new R(e,15);let T={Error:Error,RegExp:RegExp};b[27]=e=>(T[e[0]]||Error)(e[1],e[2]);const D=e=>{if(132!=r[i++]){let e=new Error("Packed values structure must be followed by a 4 element array");throw r.length<i&&(e.incomplete=!0),e}let t=e();if(!t||!t.length){let e=new Error("Packed values structure must be followed by a 4 element array");throw e.incomplete=!0,e}return u=u?t.concat(u.slice(t.length)):t,u.prefixes=e(),u.suffixes=e(),e()};function N(e,t){return"string"==typeof e?e+t:e instanceof Array?e.concat(t):Object.assign({},e,t)}function K(){if(!u){if(!p.getShared)throw new Error("No packed values available");J()}return u}D.handlesRead=!0,b[51]=D,b[6]=e=>{if(!u){if(!p.getShared)return new R(e,6);J()}if("number"==typeof e)return u[16+(e>=0?2*e:-2*e-1)];let t=new Error("No support for non-integer packed references yet");throw void 0===e&&(t.incomplete=!0),t},b[28]=e=>{f||(f=new Map,f.id=0);let t,n=f.id++,s=i;t=r[i]>>5==4?[]:{};let o={target:t};f.set(n,o);let a=e();return o.used?(Object.getPrototypeOf(t)!==Object.getPrototypeOf(a)&&(i=s,t=a,f.set(n,{target:t}),a=e()),Object.assign(t,a)):(o.target=a,a)},b[28].handlesRead=!0,b[29]=e=>{let t=f.get(e);return t.used=!0,t.target},b[258]=e=>new Set(e),(b[259]=e=>(p.mapsAsObjects&&(p.mapsAsObjects=!1,d=!0),e())).handlesRead=!0;m.push(((e,t)=>e>=225&&e<=255?N(K().prefixes[e-224],t):e>=28704&&e<=32767?N(K().prefixes[e-28672],t):e>=1879052288&&e<=2147483647?N(K().prefixes[e-1879048192],t):e>=216&&e<=223?N(t,K().suffixes[e-216]):e>=27647&&e<=28671?N(t,K().suffixes[e-27639]):e>=1811940352&&e<=1879048191?N(t,K().suffixes[e-1811939328]):1399353956==e?{packedValues:u,structures:o.slice(0),version:t}:55799==e?t:void 0));const C=1==new Uint8Array(new Uint16Array([1]).buffer)[0],z=[Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,"undefined"==typeof BigUint64Array?{name:"BigUint64Array"}:BigUint64Array,Int8Array,Int16Array,Int32Array,"undefined"==typeof BigInt64Array?{name:"BigInt64Array"}:BigInt64Array,Float32Array,Float64Array],L=[64,68,69,70,71,72,77,78,79,85,86];for(let e=0;e<z.length;e++)W(z[e],L[e]);function W(e,t){let r,n="get"+e.name.slice(0,-5);"function"==typeof e?r=e.BYTES_PER_ELEMENT:e=null;for(let i=0;i<2;i++){if(!i&&1==r)continue;let s=2==r?1:4==r?2:8==r?3:0;b[i?t:t-4]=1==r||i==C?n=>{if(!e)throw new Error("Could not find typed array for code "+t);return p.copyBuffers||1!==r&&(2!==r||1&n.byteOffset)&&(4!==r||3&n.byteOffset)&&(8!==r||7&n.byteOffset)?new e(Uint8Array.prototype.slice.call(n,0).buffer):new e(n.buffer,n.byteOffset,n.byteLength>>s)}:r=>{if(!e)throw new Error("Could not find typed array for code "+t);let o=new DataView(r.buffer,r.byteOffset,r.byteLength),a=r.length>>s,l=new e(a),f=o[n];for(let e=0;e<a;e++)l[e]=f.call(o,e<<s,i);return l}}}function $(){let e=31&r[i++];if(e>23)switch(e){case 24:e=r[i++];break;case 25:e=c.getUint16(i),i+=2;break;case 26:e=c.getUint32(i),i+=4}return e}function J(){if(p.getShared){let e=H((()=>(r=null,p.getShared())))||{},t=e.structures||[];p.sharedVersion=e.version,u=p.sharedValues=e.packedValues,!0===o?p.structures=o=t:o.splice.apply(o,[0,t.length].concat(t))}}function H(e){let t=n,s=i,u=g,d=w,h=a,y=f,b=l,m=new Uint8Array(r.slice(0,n)),A=o,O=p,k=v,E=e();return n=t,i=s,g=u,w=d,a=h,f=y,l=b,r=m,v=k,o=A,p=O,c=new DataView(r.buffer,r.byteOffset,r.byteLength),E}function Y(){r=null,f=null,o=null}const q=new Array(147);for(let e=0;e<256;e++)q[e]=+("1e"+Math.floor(45.15-.30103*e));let Z=new k({useRecords:!1});const G=Z.decode,Q=Z.decodeMultiple,X={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};let ee,te,re;try{ee=new TextEncoder}catch(e){}const ne="object"==typeof globalThis&&globalThis.Buffer,ie=void 0!==ne,se=ie?ne.allocUnsafeSlow:Uint8Array,oe=ie?ne:Uint8Array,ae=ie?4294967296:2144337920;let le,fe,ue,ce,de=0,he=null;const ye=/[\u0080-\uFFFF]/,pe=Symbol("record-id");class ge extends k{constructor(e){let t,r,n,i,s;super(e),this.offset=0,e=e||{};let o=oe.prototype.utf8Write?function(e,t,r){return fe.utf8Write(e,t,r)}:!(!ee||!ee.encodeInto)&&function(e,t){return ee.encodeInto(e,fe.subarray(t)).written},a=this,l=e.structures||e.saveStructures,f=e.maxSharedStructures;if(null==f&&(f=l?128:0),f>8190)throw new Error("Maximum maxSharedStructure is 8190");let u=e.sequential;u&&(f=0),this.structures||(this.structures=[]),this.saveStructures&&(this.saveShared=this.saveStructures);let c,d,h,y=e.sharedValues;if(y){h=Object.create(null);for(let e=0,t=y.length;e<t;e++)h[y[e]]=e}let p=[],g=0,w=0;this.mapEncode=function(e,t){if(this._keyMap&&!this._mapped&&"Array"===e.constructor.name)e=e.map((e=>this.encodeKeys(e)));return this.encode(e,t)},this.encode=function(o,l){if(fe||(fe=new se(8192),ue=new DataView(fe.buffer,0,8192),de=0),ce=fe.length-10,ce-de<2048?(fe=new se(fe.length),ue=new DataView(fe.buffer,0,fe.length),ce=fe.length-10,de=0):l===Re&&(de=de+7&2147483640),t=de,a.useSelfDescribedHeader&&(ue.setUint32(de,3654940416),de+=3),s=a.structuredClone?new Map:null,a.bundleStrings&&"string"!=typeof o?(he=[],he.size=1/0):he=null,r=a.structures,r){if(r.uninitialized){let e=a.getShared()||{};a.structures=r=e.structures||[],a.sharedVersion=e.version;let t=a.sharedValues=e.packedValues;if(t){h={};for(let e=0,r=t.length;e<r;e++)h[t[e]]=e}}let e=r.length;if(e>f&&!u&&(e=f),!r.transitions){r.transitions=Object.create(null);for(let t=0;t<e;t++){let e=r[t];if(!e)continue;let n,i=r.transitions;for(let r=0,s=e.length;r<s;r++){void 0===i[pe]&&(i[pe]=t);let s=e[r];n=i[s],n||(n=i[s]=Object.create(null)),i=n}i[pe]=1048576|t}}u||(r.nextId=e)}if(n&&(n=!1),i=r||[],d=h,e.pack){let t=new Map;if(t.values=[],t.encoder=a,t.maxValues=e.maxPrivatePackedValues||(h?16:1/0),t.objectMap=h||!1,t.samplingPackedValues=c,Oe(o,t),t.values.length>0){fe[de++]=216,fe[de++]=51,me(4);let e=t.values;b(e),me(0),me(0),d=Object.create(h||null);for(let t=0,r=e.length;t<r;t++)d[e[t]]=t}}le=l&Te;try{if(le)return;if(b(o),he&&Ue(t,b),a.offset=de,s&&s.idsToInsert){de+=2*s.idsToInsert.length,de>ce&&A(de),a.offset=de;let e=function(e,t){let r,n=2*t.length,i=e.length-n;t.sort(((e,t)=>e.offset>t.offset?1:-1));for(let r=0;r<t.length;r++){let n=t[r];n.id=r;for(let t of n.references)e[t++]=r>>8,e[t]=255&r}for(;r=t.pop();){let t=r.offset;e.copyWithin(t+n,t,i),n-=2;let s=t+n;e[s++]=216,e[s++]=28,i=t}return e}(fe.subarray(t,de),s.idsToInsert);return s=null,e}return l&Re?(fe.start=t,fe.end=de,fe):fe.subarray(t,de)}finally{if(r)if(w<10&&w++,r.length>f&&(r.length=f),g>1e4)r.transitions=null,w=0,g=0,p.length>0&&(p=[]);else if(p.length>0&&!u){for(let e=0,t=p.length;e<t;e++)p[e][pe]=void 0;p=[]}if(n&&a.saveShared){a.structures.length>f&&(a.structures=a.structures.slice(0,f));let e=fe.subarray(t,de);return!1===a.updateSharedData()?a.encode(o):e}l&Fe&&(de=t)}},this.findCommonStringsToPack=()=>(c=new Map,h||(h=Object.create(null)),e=>{let t=e&&e.threshold||4,r=this.pack?e.maxPrivatePackedValues||16:0;y||(y=this.sharedValues=[]);for(let[e,i]of c)i.count>t&&(h[e]=r++,y.push(e),n=!0);for(;this.saveShared&&!1===this.updateSharedData(););c=null});const b=r=>{de>ce&&(fe=A(de));var n,i=typeof r;if("string"===i){if(d){let t=d[r];if(t>=0)return void(t<16?fe[de++]=t+224:(fe[de++]=198,b(1&t?15-t>>1:t-16>>1)));if(c&&!e.pack){let e=c.get(r);e?e.count++:c.set(r,{count:1})}}let i,s=r.length;if(he&&s>=4&&s<1024){if((he.size+=s)>61440){let e,r=(he[0]?3*he[0].length+he[1].length:0)+10;de+r>ce&&(fe=A(de+r)),fe[de++]=217,fe[de++]=223,fe[de++]=249,fe[de++]=he.position?132:130,fe[de++]=26,e=de-t,de+=4,he.position&&Ue(t,b),he=["",""],he.size=0,he.position=e}let e=ye.test(r);return he[e?0:1]+=r,fe[de++]=e?206:207,void b(s)}i=s<32?1:s<256?2:s<65536?3:5;let a=3*s;if(de+a>ce&&(fe=A(de+a)),s<64||!o){let e,t,o,a=de+i;for(e=0;e<s;e++)t=r.charCodeAt(e),t<128?fe[a++]=t:t<2048?(fe[a++]=t>>6|192,fe[a++]=63&t|128):55296==(64512&t)&&56320==(64512&(o=r.charCodeAt(e+1)))?(t=65536+((1023&t)<<10)+(1023&o),e++,fe[a++]=t>>18|240,fe[a++]=t>>12&63|128,fe[a++]=t>>6&63|128,fe[a++]=63&t|128):(fe[a++]=t>>12|224,fe[a++]=t>>6&63|128,fe[a++]=63&t|128);n=a-de-i}else n=o(r,de+i,a);n<24?fe[de++]=96|n:n<256?(i<2&&fe.copyWithin(de+2,de+1,de+1+n),fe[de++]=120,fe[de++]=n):n<65536?(i<3&&fe.copyWithin(de+3,de+2,de+2+n),fe[de++]=121,fe[de++]=n>>8,fe[de++]=255&n):(i<5&&fe.copyWithin(de+5,de+3,de+3+n),fe[de++]=122,ue.setUint32(de,n),de+=4),de+=n}else if("number"===i)if(this.alwaysUseFloat||r>>>0!==r)if(this.alwaysUseFloat||r>>0!==r){let e;if((e=this.useFloat32)>0&&r<4294967296&&r>=-2147483648){let t;if(fe[de++]=250,ue.setFloat32(de,r),e<4||(t=r*q[(127&fe[de])<<1|fe[de+1]>>7])>>0===t)return void(de+=4);de--}fe[de++]=251,ue.setFloat64(de,r),de+=8}else r>=-24?fe[de++]=31-r:r>=-256?(fe[de++]=56,fe[de++]=~r):r>=-65536?(fe[de++]=57,ue.setUint16(de,~r),de+=2):(fe[de++]=58,ue.setUint32(de,~r),de+=4);else r<24?fe[de++]=r:r<256?(fe[de++]=24,fe[de++]=r):r<65536?(fe[de++]=25,fe[de++]=r>>8,fe[de++]=255&r):(fe[de++]=26,ue.setUint32(de,r),de+=4);else if("object"===i)if(r){if(s){let e=s.get(r);if(e){if(fe[de++]=216,fe[de++]=29,fe[de++]=25,!e.references){let t=s.idsToInsert||(s.idsToInsert=[]);e.references=[],t.push(e)}return e.references.push(de-t),void(de+=2)}s.set(r,{offset:de-t})}let e=r.constructor;if(e===Object)m(r);else if(e===Array){(n=r.length)<24?fe[de++]=128|n:me(n);for(let e=0;e<n;e++)b(r[e])}else if(e===Map)if((this.mapsAsObjects?!1!==this.useTag259ForMaps:this.useTag259ForMaps)&&(fe[de++]=217,fe[de++]=1,fe[de++]=3),(n=r.size)<24?fe[de++]=160|n:n<256?(fe[de++]=184,fe[de++]=n):n<65536?(fe[de++]=185,fe[de++]=n>>8,fe[de++]=255&n):(fe[de++]=186,ue.setUint32(de,n),de+=4),a.keyMap)for(let[e,t]of r)b(a.encodeKey(e)),b(t);else for(let[e,t]of r)b(e),b(t);else{for(let e=0,t=te.length;e<t;e++){if(r instanceof re[e]){let t=te[e],n=t.tag;return null==n&&(n=t.getTag&&t.getTag.call(this,r)),n<24?fe[de++]=192|n:n<256?(fe[de++]=216,fe[de++]=n):n<65536?(fe[de++]=217,fe[de++]=n>>8,fe[de++]=255&n):n>-1&&(fe[de++]=218,ue.setUint32(de,n),de+=4),void t.encode.call(this,r,b,A)}}if(r[Symbol.iterator]){if(le){let e=new Error("Iterable should be serialized as iterator");throw e.iteratorNotHandled=!0,e}fe[de++]=159;for(let e of r)b(e);return void(fe[de++]=255)}if(r[Symbol.asyncIterator]||ve(r)){let e=new Error("Iterable/blob should be serialized as iterator");throw e.iteratorNotHandled=!0,e}if(this.useToJSON&&r.toJSON){const e=r.toJSON();if(e!==r)return b(e)}m(r)}}else fe[de++]=246;else if("boolean"===i)fe[de++]=r?245:244;else if("bigint"===i){if(r<BigInt(1)<<BigInt(64)&&r>=0)fe[de++]=27,ue.setBigUint64(de,r);else if(r>-(BigInt(1)<<BigInt(64))&&r<0)fe[de++]=59,ue.setBigUint64(de,-r-BigInt(1));else{if(!this.largeBigIntToFloat){r>=BigInt(0)?fe[de++]=194:(fe[de++]=195,r=BigInt(-1)-r);let e=[];for(;r;)e.push(Number(r&BigInt(255))),r>>=BigInt(8);return void Ie(new Uint8Array(e.reverse()),A)}fe[de++]=251,ue.setFloat64(de,Number(r))}de+=8}else{if("undefined"!==i)throw new Error("Unknown type: "+i);fe[de++]=247}},m=!1===this.useRecords?this.variableMapSize?e=>{let t=Object.keys(e),r=Object.values(e),n=t.length;if(n<24?fe[de++]=160|n:n<256?(fe[de++]=184,fe[de++]=n):n<65536?(fe[de++]=185,fe[de++]=n>>8,fe[de++]=255&n):(fe[de++]=186,ue.setUint32(de,n),de+=4),a.keyMap)for(let e=0;e<n;e++)b(a.encodeKey(t[e])),b(r[e]);else for(let e=0;e<n;e++)b(t[e]),b(r[e])}:e=>{fe[de++]=185;let r=de-t;de+=2;let n=0;if(a.keyMap)for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(b(a.encodeKey(t)),b(e[t]),n++);else for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(b(t),b(e[t]),n++);fe[r+++t]=n>>8,fe[r+t]=255&n}:(e,t)=>{let r,s,o,a=i.transitions||(i.transitions=Object.create(null)),l=0,u=0;if(this.keyMap){o=Object.keys(e).map((e=>this.encodeKey(e))),u=o.length;for(let e=0;e<u;e++){let t=o[e];r=a[t],r||(r=a[t]=Object.create(null),l++),a=r}}else for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(r=a[t],r||(1048576&a[pe]&&(s=65535&a[pe]),r=a[t]=Object.create(null),l++),a=r,u++);let c=a[pe];if(void 0!==c)c&=65535,fe[de++]=217,fe[de++]=c>>8|224,fe[de++]=255&c;else{if(o||(o=a.__keys__||(a.__keys__=Object.keys(e))),void 0===s?(c=i.nextId++,c||(c=0,i.nextId=1),c>=256&&(i.nextId=(c=f)+1)):c=s,i[c]=o,!(c<f)){if(a[pe]=c,ue.setUint32(de,3655335680),de+=3,l&&(g+=w*l),p.length>=256-f&&(p.shift()[pe]=void 0),p.push(a),me(u+2),b(57344+c),b(o),t)return;for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&b(e[t]);return}fe[de++]=217,fe[de++]=c>>8|224,fe[de++]=255&c,a=i.transitions;for(let e=0;e<u;e++)(void 0===a[pe]||1048576&a[pe])&&(a[pe]=c),a=a[o[e]];a[pe]=1048576|c,n=!0}if(u<24?fe[de++]=128|u:me(u),!t)for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&b(e[t])},A=e=>{let r;if(e>16777216){if(e-t>ae)throw new Error("Encoded buffer would be larger than maximum buffer size");r=Math.min(ae,4096*Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096))}else r=1+(Math.max(e-t<<2,fe.length-1)>>12)<<12;let n=new se(r);return ue=new DataView(n.buffer,0,r),fe.copy?fe.copy(n,0,t,e):n.set(fe.slice(t,e)),de-=t,t=0,ce=n.length-10,fe=n};let v=100,O=1e3;function*k(e,r,n){let i=e.constructor;if(i===Object){let t=!1!==a.useRecords;t?m(e,!0):we(Object.keys(e).length,160);for(let n in e){let i=e[n];t||b(n),i&&"object"==typeof i?r[n]?yield*k(i,r[n]):yield*E(i,r,n):b(i)}}else if(i===Array){let n=e.length;me(n);for(let i=0;i<n;i++){let n=e[i];n&&("object"==typeof n||de-t>v)?r.element?yield*k(n,r.element):yield*E(n,r,"element"):b(n)}}else if(e[Symbol.iterator]&&!e.buffer){fe[de++]=159;for(let n of e)n&&("object"==typeof n||de-t>v)?r.element?yield*k(n,r.element):yield*E(n,r,"element"):b(n);fe[de++]=255}else ve(e)?(we(e.size,64),yield fe.subarray(t,de),yield e,I()):e[Symbol.asyncIterator]?(fe[de++]=159,yield fe.subarray(t,de),yield e,I(),fe[de++]=255):b(e);n&&de>t?yield fe.subarray(t,de):de-t>v&&(yield fe.subarray(t,de),I())}function*E(e,r,n){let i=de-t;try{b(e),de-t>v&&(yield fe.subarray(t,de),I())}catch(s){if(!s.iteratorNotHandled)throw s;r[n]={},de=t+i,yield*k.call(this,e,r[n])}}function I(){v=O,a.encode(null,Te)}function U(e,t,r){return v=t&&t.chunkThreshold?O=t.chunkThreshold:100,e&&"object"==typeof e?(a.encode(null,Te),r(e,a.iterateProperties||(a.iterateProperties={}),!0)):[a.encode(e)]}async function*S(e,t){for(let r of k(e,t,!0)){let e=r.constructor;if(e===oe||e===Uint8Array)yield r;else if(ve(r)){let e,t=r.stream().getReader();for(;!(e=await t.read()).done;)yield e.value}else if(r[Symbol.asyncIterator])for await(let e of r)I(),e?yield*S(e,t.async||(t.async={})):yield a.encode(e);else yield r}}this.encodeAsIterable=function(e,t){return U(e,t,k)},this.encodeAsAsyncIterable=function(e,t){return U(e,t,S)}}useBuffer(e){fe=e,ue=new DataView(fe.buffer,fe.byteOffset,fe.byteLength),de=0}clearSharedData(){this.structures&&(this.structures=[]),this.sharedValues&&(this.sharedValues=void 0)}updateSharedData(){let e=this.sharedVersion||0;this.sharedVersion=e+1;let t=this.structures.slice(0),r=new be(t,this.sharedValues,this.sharedVersion),n=this.saveShared(r,(t=>(t&&t.version||0)==e));return!1===n?(r=this.getShared()||{},this.structures=r.structures||[],this.sharedValues=r.packedValues,this.sharedVersion=r.version,this.structures.nextId=this.structures.length):t.forEach(((e,t)=>this.structures[t]=e)),n}}function we(e,t){e<24?fe[de++]=t|e:e<256?(fe[de++]=24|t,fe[de++]=e):e<65536?(fe[de++]=25|t,fe[de++]=e>>8,fe[de++]=255&e):(fe[de++]=26|t,ue.setUint32(de,e),de+=4)}class be{constructor(e,t,r){this.structures=e,this.packedValues=t,this.version=r}}function me(e){e<24?fe[de++]=128|e:e<256?(fe[de++]=152,fe[de++]=e):e<65536?(fe[de++]=153,fe[de++]=e>>8,fe[de++]=255&e):(fe[de++]=154,ue.setUint32(de,e),de+=4)}const Ae="undefined"==typeof Blob?function(){}:Blob;function ve(e){if(e instanceof Ae)return!0;let t=e[Symbol.toStringTag];return"Blob"===t||"File"===t}function Oe(e,t){switch(typeof e){case"string":if(e.length>3){if(t.objectMap[e]>-1||t.values.length>=t.maxValues)return;let r=t.get(e);if(r)2==++r.count&&t.values.push(e);else if(t.set(e,{count:1}),t.samplingPackedValues){let r=t.samplingPackedValues.get(e);r?r.count++:t.samplingPackedValues.set(e,{count:1})}}break;case"object":if(e)if(e instanceof Array)for(let r=0,n=e.length;r<n;r++)Oe(e[r],t);else{let n=!t.encoder.useRecords;for(var r in e)e.hasOwnProperty(r)&&(n&&Oe(r,t),Oe(e[r],t))}break;case"function":console.log(e)}}const ke=1==new Uint8Array(new Uint16Array([1]).buffer)[0];function Ee(e,t){return!ke&&t>1&&(e-=4),{tag:e,encode:function(e,t){let r=e.byteLength,n=e.byteOffset||0,i=e.buffer||e;t(ie?ne.from(i,n,r):new Uint8Array(i,n,r))}}}function Ie(e,t){let r=e.byteLength;r<24?fe[de++]=64+r:r<256?(fe[de++]=88,fe[de++]=r):r<65536?(fe[de++]=89,fe[de++]=r>>8,fe[de++]=255&r):(fe[de++]=90,ue.setUint32(de,r),de+=4),de+r>=fe.length&&t(de+r),fe.set(e.buffer?e:new Uint8Array(e),de),de+=r}function Ue(e,t){ue.setUint32(he.position+e,de-he.position-e+1);let r=he;he=null,t(r[0]),t(r[1])}re=[Date,Set,Error,RegExp,R,ArrayBuffer,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,"undefined"==typeof BigUint64Array?function(){}:BigUint64Array,Int8Array,Int16Array,Int32Array,"undefined"==typeof BigInt64Array?function(){}:BigInt64Array,Float32Array,Float64Array,be],te=[{tag:1,encode(e,t){let r=e.getTime()/1e3;(this.useTimestamp32||0===e.getMilliseconds())&&r>=0&&r<4294967296?(fe[de++]=26,ue.setUint32(de,r),de+=4):(fe[de++]=251,ue.setFloat64(de,r),de+=8)}},{tag:258,encode(e,t){t(Array.from(e))}},{tag:27,encode(e,t){t([e.name,e.message])}},{tag:27,encode(e,t){t(["RegExp",e.source,e.flags])}},{getTag:e=>e.tag,encode(e,t){t(e.value)}},{encode(e,t,r){Ie(e,r)}},{getTag(e){if(e.constructor===Uint8Array&&(this.tagUint8Array||ie&&!1!==this.tagUint8Array))return 64},encode(e,t,r){Ie(e,r)}},Ee(68,1),Ee(69,2),Ee(70,4),Ee(71,8),Ee(72,1),Ee(77,2),Ee(78,4),Ee(79,8),Ee(85,4),Ee(86,8),{encode(e,t){let r=e.packedValues||[],n=e.structures||[];if(r.values.length>0){fe[de++]=216,fe[de++]=51,me(4);let e=r.values;t(e),me(0),me(0),packedObjectMap=Object.create(sharedPackedObjectMap||null);for(let t=0,r=e.length;t<r;t++)packedObjectMap[e[t]]=t}if(n){ue.setUint32(de,3655335424),de+=3;let r=n.slice(0);r.unshift(57344),r.push(new R(e.version,1399353956)),t(r)}else t(new R(e.version,1399353956))}}];let Se=new ge({useRecords:!1});const Me=Se.encode,xe=Se.encodeAsIterable,je=Se.encodeAsAsyncIterable,{NEVER:Be,ALWAYS:Ve,DECIMAL_ROUND:Pe,DECIMAL_FIT:_e}=X,Re=512,Fe=1024,Te=2048;e.ALWAYS=Ve,e.DECIMAL_FIT=_e,e.DECIMAL_ROUND=Pe,e.Decoder=k,e.Encoder=ge,e.FLOAT32_OPTIONS=X,e.NEVER=Be,e.REUSE_BUFFER_MODE=Re,e.Tag=R,e.addExtension=function(e){if(e.Class){if(!e.encode)throw new Error("Extension has no encode function");re.unshift(e.Class),te.unshift(e)}!function(e){b[e.tag]=e.decode}(e)},e.clearSource=Y,e.decode=G,e.decodeIter=function(e,t={}){if(!e||"object"!=typeof e)throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a promise");const r=new k(t);let n;const i=e=>{let t;n&&(e=Buffer.concat([n,e]),n=void 0);try{t=r.decodeMultiple(e)}catch(r){if(!r.incomplete)throw r;n=e.slice(r.lastPosition),t=r.values}return t};return"function"==typeof e[Symbol.iterator]?function*(){for(const t of e)yield*i(t)}():"function"==typeof e[Symbol.asyncIterator]?async function*(){for await(const t of e)yield*i(t)}():void 0},e.decodeMultiple=Q,e.encode=Me,e.encodeAsAsyncIterable=je,e.encodeAsIterable=xe,e.encodeIter=function(e,t={}){if(e&&"object"==typeof e){if("function"==typeof e[Symbol.iterator])return function*(e,t){const r=new ge(t);for(const t of e)yield r.encode(t)}(e,t);if("function"==typeof e.then||"function"==typeof e[Symbol.asyncIterator])return async function*(e,t){const r=new ge(t);for await(const t of e)yield r.encode(t)}(e,t);throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a Promise")}throw new Error("first argument must be an Iterable, Async Iterable, or a Promise for an Async Iterable")},e.isNativeAccelerationEnabled=!1,e.roundFloat32=function(e){P[0]=e;let t=q[(127&_[3])<<1|_[2]>>7];return(t*e+(e>0?.5:-.5)>>0)/t},e.setSizeLimits=function(e){e.maxMapSize&&(y=e.maxMapSize),e.maxArraySize&&(h=e.maxArraySize),e.maxObjectSize&&e.maxObjectSize}})); | ||
//# sourceMappingURL=index.min.js.map |
@@ -588,3 +588,15 @@ import { Decoder, mult10, Tag, typedArrays, addExtension as decodeAddExtension } from './decode.js' | ||
} else { | ||
throw new RangeError(value + ' was too large to fit in CBOR 64-bit integer format, set largeBigIntToFloat to convert to float-64') | ||
if (value >= BigInt(0)) | ||
target[position++] = 0xc2 // tag 2 | ||
else { | ||
target[position++] = 0xc3 // tag 2 | ||
value = BigInt(-1) - value; | ||
} | ||
let bytes = []; | ||
while (value) { | ||
bytes.push(Number(value & BigInt(0xff))); | ||
value >>= BigInt(8); | ||
} | ||
writeBuffer(new Uint8Array(bytes.reverse()), makeRoom); | ||
return; | ||
} | ||
@@ -637,3 +649,3 @@ } | ||
let size = 0 | ||
if (encoder.keyMap) { | ||
if (encoder.keyMap) { | ||
for (let key in object) if (typeof object.hasOwnProperty !== 'function' || object.hasOwnProperty(key)) { | ||
@@ -810,3 +822,3 @@ encode(encoder.encodeKey(key)) | ||
} | ||
} else if (object[Symbol.iterator]) { | ||
} else if (object[Symbol.iterator] && !object.buffer) { // iterator, but exclude typed arrays | ||
target[position++] = 0x9f; // start indefinite array | ||
@@ -813,0 +825,0 @@ for (let value of object) { |
@@ -7,3 +7,7 @@ export enum FLOAT32_OPTIONS { | ||
} | ||
export interface SizeLimitOptions { | ||
maxArraySize: number; | ||
maxMapSize: number; | ||
maxObjectSize: number; | ||
} | ||
export interface Options { | ||
@@ -47,2 +51,3 @@ alwaysUseFloat?: boolean | ||
} | ||
export function setMaxLimits(options: SizeLimitOptions): void | ||
export function decode(messagePack: Buffer | Uint8Array): any | ||
@@ -49,0 +54,0 @@ export function decodeMultiple(messagePack: Buffer | Uint8Array, forEach?: (value: any) => any): [] | void |
export { Encoder, addExtension, encode, encodeAsIterable, encodeAsAsyncIterable, NEVER, ALWAYS, DECIMAL_ROUND, DECIMAL_FIT, REUSE_BUFFER_MODE } from './encode.js' | ||
export { Tag, Decoder, decodeMultiple, decode, FLOAT32_OPTIONS, clearSource, roundFloat32, isNativeAccelerationEnabled } from './decode.js' | ||
export { Tag, Decoder, decodeMultiple, decode, FLOAT32_OPTIONS, clearSource, roundFloat32, isNativeAccelerationEnabled, setSizeLimits } from './decode.js' | ||
export { decodeIter, encodeIter } from './iterators.js' |
export { Encoder, addExtension, encode, encodeAsIterable, encodeAsAsyncIterable, NEVER, ALWAYS, DECIMAL_ROUND, DECIMAL_FIT, REUSE_BUFFER_MODE } from './encode.js' | ||
export { Tag, Decoder, decodeMultiple, decode, FLOAT32_OPTIONS, clearSource, roundFloat32, isNativeAccelerationEnabled } from './decode.js' | ||
export { Tag, Decoder, decodeMultiple, decode, FLOAT32_OPTIONS, clearSource, roundFloat32, isNativeAccelerationEnabled, setSizeLimits } from './decode.js' | ||
export { EncoderStream, DecoderStream } from './stream.js' | ||
@@ -4,0 +4,0 @@ export { decodeIter, encodeIter } from './iterators.js' |
{ | ||
"name": "cbor-x", | ||
"author": "Kris Zyp", | ||
"version": "1.5.9", | ||
"version": "1.6.0", | ||
"description": "Ultra-fast and conformant CBOR (RFC 8949) implementation with support for numerous tag extensions including records and structured cloning", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -231,2 +231,14 @@ # cbor-x | ||
### Setting Size Limits | ||
You can set size limits on objects, arrays, and maps to prevent resource exhaustion when decoding. This can be done by calling the setMaxLimits export. Each of the properties are optional (only provide | ||
the properties you want to change), for example (with the defaults): | ||
```JavaScript | ||
import { setMaxLimits } from 'cbor-x'; | ||
setMaxLimits({ | ||
maxArraySize: 112810000, | ||
maxMapSize: 16810000, | ||
maxObjectSize : 16710000 | ||
}); | ||
``` | ||
## Performance | ||
@@ -233,0 +245,0 @@ Cbor-x is fast. Really fast. Here is comparison with the next fastest JS projects using the benchmark tool from `msgpack-lite` (and the sample data is from some clinical research data we use that has a good mix of different value types and structures). It also includes comparison to V8 native JSON functionality, and JavaScript Avro (`avsc`, a very optimized Avro implementation): |
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
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
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
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
1822536
14921
381