msgpackr 1.6.1 → 1.7.0-alpha2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,82 +1,83 @@
1
- (function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):(e=e||self,t(e.msgpackr={}))})(this,function(e){'use strict';var t=Math.floor;function n(){try{if(!D.trusted&&!Y){let e=M.sharedLength||0;e<M.length&&(M.length=e)}let e=r();if(B&&(// bundled strings to skip past
2
- P=B.postBundlePosition),P==E)M.restoreStructures&&s(),M=null,R=null,C&&(C=null);else if(P>E)// over read
3
- throw new Error("Unexpected end of MessagePack data");else if(!Y)throw new Error("Data read, but end of buffer not reached "+JSON.stringify(e).slice(0,100));// else more to read, but we are reading sequentially, so don't clear source yet
4
- return e}catch(e){throw M.restoreStructures&&s(),m(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||P>E)&&(e.incomplete=!0),e}}function s(){for(let e in M.restoreStructures)M[e]=M.restoreStructures[e];M.restoreStructures=null}function r(){let e=R[P++];if(160>e){if(!(128>e)){if(!(144>e)){e-=144;let t=Array(e);for(let n=0;n<e;n++)t[n]=r();return t}if(e-=128,D.mapsAsObjects){let t={};for(let n=0;n<e;n++)t[h()]=r();return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(r(),r());return t}}else if(64>e)return e;else{let t=M[63&e]||D.getStructures&&o()[63&e];return t?(t.read||(t.read=i(t,63&e)),t.read()):e}}else if(192>e){// fixstr
5
- let t=e-160;if(v>=P)return _.slice(P-F,(P+=t)-F);if(0==v&&140>E){// for small blocks, avoiding the overhead of the extract call is helpful
6
- let e=16>t?g(t):c(t);if(null!=e)return e}return H(t)}else{let t;switch(e){case 192:return null;case 193:return B?(t=r(),0<t?B[1].slice(B.position1,B.position1+=t):B[0].slice(B.position0,B.position0-=t)):W;// "never-used", return special object to denote that
7
- case 194:return!1;case 195:return!0;case 196:if(t=R[P++],void 0===t)throw new Error("Unexpected end of buffer");return p(t);case 197:return t=T.getUint16(P),P+=2,p(t);case 198:return t=T.getUint32(P),P+=4,p(t);case 199:// ext 8
8
- return f(R[P++]);case 200:return t=T.getUint16(P),P+=2,f(t);case 201:return t=T.getUint32(P),P+=4,f(t);case 202:if(t=T.getFloat32(P),2<D.useFloat32){// this does rounding of numbers that were encoded in 32-bit float to nearest significant decimal digit that could be preserved
9
- let e=se[(127&R[P])<<1|R[P+1]>>7];return P+=4,(e*t+(0<t?.5:-.5)>>0)/e}return P+=4,t;case 203:return t=T.getFloat64(P),P+=8,t;// uint handlers
10
- case 204:return R[P++];case 205:return t=T.getUint16(P),P+=2,t;case 206:return t=T.getUint32(P),P+=4,t;case 207:return D.int64AsNumber?(t=4294967296*T.getUint32(P),t+=T.getUint32(P+4)):t=T.getBigUint64(P),P+=8,t;// int handlers
11
- case 208:return T.getInt8(P++);case 209:return t=T.getInt16(P),P+=2,t;case 210:return t=T.getInt32(P),P+=4,t;case 211:return D.int64AsNumber?(t=4294967296*T.getInt32(P),t+=T.getUint32(P+4)):t=T.getBigInt64(P),P+=8,t;case 212:if(t=R[P++],114==t)return ee(63&R[P++]);else{let e=j[t];if(e)return e.read?(P++,e.read(r())):e.noBuffer?(P++,e()):e(R.subarray(P,++P));throw new Error("Unknown extension "+t)}case 213:return t=R[P],114==t?(P++,ee(63&R[P++],R[P++])):f(2);case 214:// fixext 4
12
- return f(4);case 215:// fixext 8
13
- return f(8);case 216:// fixext 16
14
- return f(16);case 217:return t=R[P++],v>=P?_.slice(P-F,(P+=t)-F):J(t);case 218:return t=T.getUint16(P),P+=2,v>=P?_.slice(P-F,(P+=t)-F):K(t);case 219:return t=T.getUint32(P),P+=4,v>=P?_.slice(P-F,(P+=t)-F):Q(t);case 220:return t=T.getUint16(P),P+=2,u(t);case 221:return t=T.getUint32(P),P+=4,u(t);case 222:return t=T.getUint16(P),P+=2,d(t);case 223:return t=T.getUint32(P),P+=4,d(t);default:// negative int
15
- if(224<=e)return e-256;if(void 0===e){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+e);}}}function i(e,t){function n(){// This initial function is quick to instantiate, but runs slower. After several iterations pay the cost to build the faster function
16
- if(n.count++>z){let n=e.read=new Function("r","return function(){return {"+e.map(e=>q.test(e)?e+":r()":"["+JSON.stringify(e)+"]:r()").join(",")+"}}")(r);return 0===e.highByte&&(e.read=G(t,e.read)),n();// second byte is already read, if there is one so immediately read object
17
- }let s={};for(let t,n=0,i=e.length;n<i;n++)t=e[n],s[t]=r();return s}return n.count=0,0===e.highByte?G(t,n):n}function o(){let e=y(()=>(R=null,D.getStructures()));return M=D._mergeStructures(e,M)}function a(e){let t;if(16>e&&(t=g(e)))return t;if(64<e&&L)return L.decode(R.subarray(P,P+=e));const n=P+e,s=[];for(t="";P<n;){const e=R[P++];if(0==(128&e))s.push(e);else if(192==(224&e)){// 2 bytes
18
- const t=63&R[P++];s.push((31&e)<<6|t)}else if(224==(240&e)){// 3 bytes
19
- const t=63&R[P++],n=63&R[P++];s.push((31&e)<<12|t<<6|n)}else if(240==(248&e)){// 4 bytes
20
- const t=63&R[P++],n=63&R[P++],r=63&R[P++];let i=(7&e)<<18|t<<12|n<<6|r;65535<i&&(i-=65536,s.push(55296|1023&i>>>10),i=56320|1023&i),s.push(i)}else s.push(e);4096<=s.length&&(t+=X.apply(String,s),s.length=0)}return 0<s.length&&(t+=X.apply(String,s)),t}function u(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=r();return t}function d(e){if(D.mapsAsObjects){let t={};for(let n=0;n<e;n++)t[h()]=r();return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(r(),r());return t}}function c(e){let t=P,n=Array(e);for(let s=0;s<e;s++){const e=R[P++];if(0<(128&e))return void(P=t);n[s]=e}return X.apply(String,n)}function g(t){if(4>t){if(!(2>t)){let e=R[P++],n=R[P++];if(0<(128&e)||0<(128&n))return void(P-=2);if(3>t)return X(e,n);let s=R[P++];return 0<(128&s)?void(P-=3):X(e,n,s)}if(0===t)return"";else{let e=R[P++];return 1<(128&e)?void(P-=1):X(e)}}else{let s=R[P++],r=R[P++],a=R[P++],u=R[P++];if(0<(128&s)||0<(128&r)||0<(128&a)||0<(128&u))return void(P-=4);if(6>t){if(4===t)return X(s,r,a,u);else{let t=R[P++];return 0<(128&t)?void(P-=5):X(s,r,a,u,t)}}else if(8>t){let n=R[P++],e=R[P++];if(0<(128&n)||0<(128&e))return void(P-=6);if(7>t)return X(s,r,a,u,n,e);let i=R[P++];return 0<(128&i)?void(P-=7):X(s,r,a,u,n,e,i)}else{let d=R[P++],e=R[P++],c=R[P++],g=R[P++];if(0<(128&d)||0<(128&e)||0<(128&c)||0<(128&g))return void(P-=8);if(10>t){if(8===t)return X(s,r,a,u,d,e,c,g);else{let t=R[P++];return 0<(128&t)?void(P-=9):X(s,r,a,u,d,e,c,g,t)}}else if(12>t){let n=R[P++],i=R[P++];if(0<(128&n)||0<(128&i))return void(P-=10);if(11>t)return X(s,r,a,u,d,e,c,g,n,i);let o=R[P++];return 0<(128&o)?void(P-=11):X(s,r,a,u,d,e,c,g,n,i,o)}else{let p=R[P++],i=R[P++],f=R[P++],h=R[P++];if(0<(128&p)||0<(128&i)||0<(128&f)||0<(128&h))return void(P-=12);if(!(14>t)){let l=R[P++],y=R[P++];if(0<(128&l)||0<(128&y))return void(P-=14);if(15>t)return X(s,r,a,u,d,e,c,g,p,i,f,h,l,y);let n=R[P++];return 0<(128&n)?void(P-=15):X(s,r,a,u,d,e,c,g,p,i,f,h,l,y,n)}if(12===t)return X(s,r,a,u,d,e,c,g,p,i,f,h);else{let t=R[P++];return 0<(128&t)?void(P-=13):X(s,r,a,u,d,e,c,g,p,i,f,h,t)}}}}}function l(){let e,t=R[P++];if(192>t)// fixstr
21
- e=t-160;else switch(t){case 217:e=R[P++];break;case 218:e=T.getUint16(P),P+=2;break;case 219:e=T.getUint32(P),P+=4;break;default:throw new Error("Expected string");}return a(e)}function p(e){return D.copyBuffers?// specifically use the copying slice (not the node one)
22
- Uint8Array.prototype.slice.call(R,P,P+=e):R.subarray(P,P+=e)}function f(e){let t=R[P++];if(j[t])return j[t](R.subarray(P,P+=e));throw new Error("Unknown extension type "+t)}function h(){let e=R[P++];if(160<=e&&192>e){if(e-=160,v>=P)// if it has been extracted, must use it (and faster anyway)
23
- return _.slice(P-F,(P+=e)-F);if(!(0==v&&180>E))return H(e)}else return P--,r();let t,n=4095&(e<<5^(1<e?T.getUint16(P):0<e?R[P]:0)),s=Z[n],o=P,a=P+e-3,u=0;if(s&&s.bytes==e){for(;o<a;){if(t=T.getUint32(o),t!=s[u++]){o=1879048192;break}o+=4}for(a+=3;o<a;)if(t=R[o++],t!=s[u++]){o=1879048192;break}if(o===a)return P=o,s.string;a-=3,o=P}for(s=[],Z[n]=s,s.bytes=e;o<a;)t=T.getUint32(o),s.push(t),o+=4;for(a+=3;o<a;)t=R[o++],s.push(t);// for small blocks, avoiding the overhead of the extract call is helpful
24
- let d=16>e?g(e):c(e);return null==d?s.string=H(e):s.string=d}// the registration of the record definition extension (as "r")
1
+ (function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):(a=a||self,b(a.msgpackr={}))})(this,function(a){"use strict";var b=Math.floor;function c(){try{if(!K.trusted&&!S){let a=E.sharedLength||0;a<E.length&&(E.length=a)}let a;if(K.randomAccessStructure&&64>C[J]&&R){let b=(C[J++]<<8)+C[J++];a=R(C,J,D,E[b-64]||g()[b-64],K),J=D}else a=e();if(G&&(// bundled strings to skip past
2
+ J=G.postBundlePosition),J==D)E.restoreStructures&&d(),E=null,C=null,H&&(H=null);else if(J>D)// over read
3
+ throw new Error("Unexpected end of MessagePack data");else if(!S)throw new Error("Data read, but end of buffer not reached "+JSON.stringify(a).slice(0,100));// else more to read, but we are reading sequentially, so don't clear source yet
4
+ return a}catch(a){throw E.restoreStructures&&d(),r(),(a instanceof RangeError||a.message.startsWith("Unexpected end of buffer")||J>D)&&(a.incomplete=!0),a}}function d(){for(let a in E.restoreStructures)E[a]=E.restoreStructures[a];E.restoreStructures=null}function e(){let a=C[J++];if(160>a){if(!(128>a)){if(!(144>a)){a-=144;let b=Array(a);for(let c=0;c<a;c++)b[c]=e();return K.freezeData?Object.freeze(b):b}if(a-=128,K.mapsAsObjects){let b={};for(let c=0;c<a;c++)b[p()]=e();return b}else{let b=new Map;for(let c=0;c<a;c++)b.set(e(),e());return b}}else if(64>a)return a;else{let b=E[63&a]||K.getStructures&&g()[63&a];return b?(b.read||(b.read=f(b,63&a)),b.read()):a}}else if(192>a){// fixstr
5
+ let b=a-160;if(M>=J)return F.slice(J-L,(J+=b)-L);if(0==M&&140>D){// for small blocks, avoiding the overhead of the extract call is helpful
6
+ let a=16>b?l(b):k(b);if(null!=a)return a}return X(b)}else{let b;switch(a){case 192:return null;case 193:return G?(b=e(),0<b?G[1].slice(G.position1,G.position1+=b):G[0].slice(G.position0,G.position0-=b)):Q;// "never-used", return special object to denote that
7
+ case 194:return!1;case 195:return!0;case 196:if(b=C[J++],void 0===b)throw new Error("Unexpected end of buffer");return n(b);case 197:return b=I.getUint16(J),J+=2,n(b);case 198:return b=I.getUint32(J),J+=4,n(b);case 199:// ext 8
8
+ return o(C[J++]);case 200:return b=I.getUint16(J),J+=2,o(b);case 201:return b=I.getUint32(J),J+=4,o(b);case 202:if(b=I.getFloat32(J),2<K.useFloat32){// this does rounding of numbers that were encoded in 32-bit float to nearest significant decimal digit that could be preserved
9
+ let a=ea[(127&C[J])<<1|C[J+1]>>7];return J+=4,(a*b+(0<b?.5:-.5)>>0)/a}return J+=4,b;case 203:return b=I.getFloat64(J),J+=8,b;// uint handlers
10
+ case 204:return C[J++];case 205:return b=I.getUint16(J),J+=2,b;case 206:return b=I.getUint32(J),J+=4,b;case 207:return K.int64AsNumber?(b=4294967296*I.getUint32(J),b+=I.getUint32(J+4)):b=I.getBigUint64(J),J+=8,b;// int handlers
11
+ case 208:return I.getInt8(J++);case 209:return b=I.getInt16(J),J+=2,b;case 210:return b=I.getInt32(J),J+=4,b;case 211:return K.int64AsNumber?(b=4294967296*I.getInt32(J),b+=I.getUint32(J+4)):b=I.getBigInt64(J),J+=8,b;case 212:if(b=C[J++],114==b)return ba(63&C[J++]);else{let a=N[b];if(a)return a.read?(J++,a.read(e())):a.noBuffer?(J++,a()):a(C.subarray(J,++J));throw new Error("Unknown extension "+b)}case 213:return b=C[J],114==b?(J++,ba(63&C[J++],C[J++])):o(2);case 214:// fixext 4
12
+ return o(4);case 215:// fixext 8
13
+ return o(8);case 216:// fixext 16
14
+ return o(16);case 217:return b=C[J++],M>=J?F.slice(J-L,(J+=b)-L):Y(b);case 218:return b=I.getUint16(J),J+=2,M>=J?F.slice(J-L,(J+=b)-L):Z(b);case 219:return b=I.getUint32(J),J+=4,M>=J?F.slice(J-L,(J+=b)-L):$(b);case 220:return b=I.getUint16(J),J+=2,i(b);case 221:return b=I.getUint32(J),J+=4,i(b);case 222:return b=I.getUint16(J),J+=2,j(b);case 223:return b=I.getUint32(J),J+=4,j(b);default:// negative int
15
+ if(224<=a)return a-256;if(void 0===a){let a=new Error("Unexpected end of MessagePack data");throw a.incomplete=!0,a}throw new Error("Unknown MessagePack token "+a);}}}function f(a,b){function c(){// This initial function is quick to instantiate, but runs slower. After several iterations pay the cost to build the faster function
16
+ if(c.count++>T){let c=a.read=new Function("r","return function(){return "+(K.freezeData?"Object.freeze":"")+"({"+a.map(a=>V.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(e);return 0===a.highByte&&(a.read=W(b,a.read)),c();// second byte is already read, if there is one so immediately read object
17
+ }let d={};for(let b,c=0,f=a.length;c<f;c++)b=a[c],d[b]=e();return K.freezeData?Object.freeze(d):d}return c.count=0,0===a.highByte?W(b,c):c}function g(){let a=q(()=>(C=null,K.getStructures()));return E=K._mergeStructures(a,E)}function h(a){let b;if(16>a&&(b=l(a)))return b;if(64<a&&B)return B.decode(C.subarray(J,J+=a));const c=J+a,d=[];for(b="";J<c;){const a=C[J++];if(0==(128&a))d.push(a);else if(192==(224&a)){// 2 bytes
18
+ const b=63&C[J++];d.push((31&a)<<6|b)}else if(224==(240&a)){// 3 bytes
19
+ const b=63&C[J++],c=63&C[J++];d.push((31&a)<<12|b<<6|c)}else if(240==(248&a)){// 4 bytes
20
+ const b=63&C[J++],c=63&C[J++],e=63&C[J++];let f=(7&a)<<18|b<<12|c<<6|e;65535<f&&(f-=65536,d.push(55296|1023&f>>>10),f=56320|1023&f),d.push(f)}else d.push(a);4096<=d.length&&(b+=_.apply(String,d),d.length=0)}return 0<d.length&&(b+=_.apply(String,d)),b}function i(a){let b=Array(a);for(let c=0;c<a;c++)b[c]=e();return K.freezeData?Object.freeze(b):b}function j(a){if(K.mapsAsObjects){let b={};for(let c=0;c<a;c++)b[p()]=e();return b}else{let b=new Map;for(let c=0;c<a;c++)b.set(e(),e());return b}}function k(a){let b=J,c=Array(a);for(let d=0;d<a;d++){const a=C[J++];if(0<(128&a))return void(J=b);c[d]=a}return _.apply(String,c)}function l(p){if(4>p){if(!(2>p)){let d=C[J++],a=C[J++];if(0<(128&d)||0<(128&a))return void(J-=2);if(3>p)return _(d,a);let b=C[J++];return 0<(128&b)?void(J-=3):_(d,a,b)}if(0===p)return"";else{let b=C[J++];return 1<(128&b)?void(J-=1):_(b)}}else{let q=C[J++],a=C[J++],b=C[J++],c=C[J++];if(0<(128&q)||0<(128&a)||0<(128&b)||0<(128&c))return void(J-=4);if(6>p){if(4===p)return _(q,a,b,c);else{let d=C[J++];return 0<(128&d)?void(J-=5):_(q,a,b,c,d)}}else if(8>p){let d=C[J++],e=C[J++];if(0<(128&d)||0<(128&e))return void(J-=6);if(7>p)return _(q,a,b,c,d,e);let f=C[J++];return 0<(128&f)?void(J-=7):_(q,a,b,c,d,e,f)}else{let d=C[J++],e=C[J++],f=C[J++],g=C[J++];if(0<(128&d)||0<(128&e)||0<(128&f)||0<(128&g))return void(J-=8);if(10>p){if(8===p)return _(q,a,b,c,d,e,f,g);else{let h=C[J++];return 0<(128&h)?void(J-=9):_(q,a,b,c,d,e,f,g,h)}}else if(12>p){let h=C[J++],i=C[J++];if(0<(128&h)||0<(128&i))return void(J-=10);if(11>p)return _(q,a,b,c,d,e,f,g,h,i);let j=C[J++];return 0<(128&j)?void(J-=11):_(q,a,b,c,d,e,f,g,h,i,j)}else{let h=C[J++],i=C[J++],j=C[J++],k=C[J++];if(0<(128&h)||0<(128&i)||0<(128&j)||0<(128&k))return void(J-=12);if(!(14>p)){let l=C[J++],m=C[J++];if(0<(128&l)||0<(128&m))return void(J-=14);if(15>p)return _(q,a,b,c,d,e,f,g,h,i,j,k,l,m);let n=C[J++];return 0<(128&n)?void(J-=15):_(q,a,b,c,d,e,f,g,h,i,j,k,l,m,n)}if(12===p)return _(q,a,b,c,d,e,f,g,h,i,j,k);else{let l=C[J++];return 0<(128&l)?void(J-=13):_(q,a,b,c,d,e,f,g,h,i,j,k,l)}}}}}function m(){let a,b=C[J++];if(192>b)// fixstr
21
+ a=b-160;else switch(b){case 217:a=C[J++];break;case 218:a=I.getUint16(J),J+=2;break;case 219:a=I.getUint32(J),J+=4;break;default:throw new Error("Expected string");}return h(a)}function n(a){return K.copyBuffers?// specifically use the copying slice (not the node one)
22
+ Uint8Array.prototype.slice.call(C,J,J+=a):C.subarray(J,J+=a)}function o(a){let b=C[J++];if(N[b])return N[b](C.subarray(J,J+=a));throw new Error("Unknown extension type "+b)}function p(){let a=C[J++];if(160<=a&&192>a){if(a-=160,M>=J)// if it has been extracted, must use it (and faster anyway)
23
+ return F.slice(J-L,(J+=a)-L);if(!(0==M&&180>D))return X(a)}else return J--,e();let b,c=4095&(a<<5^(1<a?I.getUint16(J):0<a?C[J]:0)),d=aa[c],f=J,g=J+a-3,h=0;if(d&&d.bytes==a){for(;f<g;){if(b=I.getUint32(f),b!=d[h++]){f=1879048192;break}f+=4}for(g+=3;f<g;)if(b=C[f++],b!=d[h++]){f=1879048192;break}if(f===g)return J=f,d.string;g-=3,f=J}for(d=[],aa[c]=d,d.bytes=a;f<g;)b=I.getUint32(f),d.push(b),f+=4;for(g+=3;f<g;)b=C[f++],d.push(b);// for small blocks, avoiding the overhead of the extract call is helpful
24
+ let j=16>a?l(a):k(a);return null==j?d.string=X(a):d.string=j}// the registration of the record definition extension (as "r")
25
25
  // notepack defines extension 0 to mean undefined, so use that as the default here
26
26
  // registration of bulk record definition?
27
27
  // currentExtensions[0x52] = () =>
28
- function y(e){let t=E,n=P,s=F,r=v,i=_,o=C,a=B,u=new Uint8Array(R.slice(0,E)),d=M,c=M.slice(0,M.length),g=D,l=Y,p=e();return E=t,P=n,F=s,v=r,_=i,C=o,B=a,R=u,Y=l,M=d,M.splice(0,M.length,...c),D=g,T=new DataView(R.buffer,R.byteOffset,R.byteLength),p}function m(){R=null,C=null,M=null}function b(e){j[e.type]=e.unpack?e.unpack:e}function U(e,t,n){let s=e.byteLength;if(256>s+1){var{target:r,position:i}=n(4+s);r[i++]=199,r[i++]=s+1}else if(65536>s+1){var{target:r,position:i}=n(5+s);r[i++]=200,r[i++]=s+1>>8,r[i++]=255&s+1}else{var{target:r,position:i,targetView:o}=n(7+s);// plus one for the type byte
29
- r[i++]=201,o.setUint32(i,s+1),i+=4}// "t" for typed array
30
- r[i++]=116,r[i++]=t,r.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i)}function k(e,t){let n=e.byteLength;var s,r;if(256>n){var{target:s,position:r}=t(n+2);s[r++]=196,s[r++]=n}else if(65536>n){var{target:s,position:r}=t(n+3);s[r++]=197,s[r++]=n>>8,s[r++]=255&n}else{var{target:s,position:r,targetView:i}=t(n+5);s[r++]=198,i.setUint32(r,n),r+=4}s.set(e,r)}function I(e,t,n,s){let r=e.length;return 1===r?t[n++]=212:2===r?t[n++]=213:4===r?t[n++]=214:8===r?t[n++]=215:16===r?t[n++]=216:256>r?(t[n++]=199,t[n++]=r):65536>r?(t[n++]=200,t[n++]=r>>8,t[n++]=255&r):(t[n++]=201,t[n++]=r>>24,t[n++]=255&r>>16,t[n++]=255&r>>8,t[n++]=255&r),t[n++]=s,t.set(e,n),n+=r,n}function S(e,t){// insert the ids that need to be referenced for structured clones
31
- let n,s=6*t.length,r=e.length-s;for(t.sort((e,t)=>e.offset>t.offset?1:-1);n=t.pop();){let t=n.offset,i=n.id;e.copyWithin(t+s,t,r),s-=6;let o=t+s;// 'i'
32
- e[o++]=214,e[o++]=105,e[o++]=i>>24,e[o++]=255&i>>16,e[o++]=255&i>>8,e[o++]=255&i,r=t}return e}function O(e,t){ke.setUint32(Oe.position+e,Se-Oe.position-e);let n=Oe;Oe=null,t(n[0]),t(n[1])}function A(e){if(e.Class){if(!e.pack&&!e.write)throw new Error("Extension has no pack or write function");if(e.pack&&!e.type)throw new Error("Extension has no type (numeric code to identify the extension)");pe.unshift(e.Class),le.unshift(e)}b(e)}function*w(e,t){const n=new we(t);for(const s of e)yield n.pack(s)}async function*x(e,t){const n=new we(t);for await(const s of e)yield n.pack(s)}/**
28
+ function q(a){let b=D,c=J,d=L,e=M,f=F,g=H,h=G,i=new Uint8Array(C.slice(0,D)),j=E,k=E.slice(0,E.length),l=K,m=S,n=a();return D=b,J=c,L=d,M=e,F=f,H=g,G=h,C=i,S=m,E=j,E.splice(0,E.length,...k),K=l,I=new DataView(C.buffer,C.byteOffset,C.byteLength),n}function r(){C=null,H=null,E=null}function s(a){N[a.type]=a.unpack?a.unpack:a}function t(a,b,c){let d=a.byteLength;if(256>d+1){var{target:e,position:f}=c(4+d);e[f++]=199,e[f++]=d+1}else if(65536>d+1){var{target:e,position:f}=c(5+d);e[f++]=200,e[f++]=d+1>>8,e[f++]=255&d+1}else{var{target:e,position:f,targetView:g}=c(7+d);// plus one for the type byte
29
+ e[f++]=201,g.setUint32(f,d+1),f+=4}// "t" for typed array
30
+ e[f++]=116,e[f++]=b,e.set(new Uint8Array(a.buffer,a.byteOffset,a.byteLength),f)}function u(a,b){let c=a.byteLength;var d,e;if(256>c){var{target:d,position:e}=b(c+2);d[e++]=196,d[e++]=c}else if(65536>c){var{target:d,position:e}=b(c+3);d[e++]=197,d[e++]=c>>8,d[e++]=255&c}else{var{target:d,position:e,targetView:f}=b(c+5);d[e++]=198,f.setUint32(e,c),e+=4}d.set(a,e)}function v(a,b,c,d){let e=a.length;return 1===e?b[c++]=212:2===e?b[c++]=213:4===e?b[c++]=214:8===e?b[c++]=215:16===e?b[c++]=216:256>e?(b[c++]=199,b[c++]=e):65536>e?(b[c++]=200,b[c++]=e>>8,b[c++]=255&e):(b[c++]=201,b[c++]=e>>24,b[c++]=255&e>>16,b[c++]=255&e>>8,b[c++]=255&e),b[c++]=d,b.set(a,c),c+=e,c}function w(a,b){// insert the ids that need to be referenced for structured clones
31
+ let c,d=6*b.length,e=a.length-d;for(b.sort((c,a)=>c.offset>a.offset?1:-1);c=b.pop();){let b=c.offset,f=c.id;a.copyWithin(b+d,b,e),d-=6;let g=b+d;// 'i'
32
+ a[g++]=214,a[g++]=105,a[g++]=f>>24,a[g++]=255&f>>16,a[g++]=255&f>>8,a[g++]=255&f,e=b}return a}function x(a,b){if(0<za.length){va.setUint32(za.position+a,ya-za.position-a);let c=za;za=null,b(c[0]),b(c[1])}}function y(a){if(a.Class){if(!a.pack&&!a.write)throw new Error("Extension has no pack or write function");if(a.pack&&!a.type)throw new Error("Extension has no type (numeric code to identify the extension)");oa.unshift(a.Class),na.unshift(a)}s(a)}function*z(a,b){const c=new Ba(b);for(const d of a)yield c.pack(d)}async function*A(a,b){const c=new Ba(b);for await(const d of a)yield c.pack(d)}/**
33
33
  * Given an Iterable/Iterator input which yields buffers, returns an IterableIterator which yields sync decoded objects
34
34
  * Or, given an Async Iterable/Iterator which yields promises resolving in buffers, returns an AsyncIterableIterator.
35
35
  * @param {Iterable|Iterator|AsyncIterable|AsyncIterableIterator} bufferIterator
36
36
  * @param {object} [options] - unpackr options
37
37
  * @returns {IterableIterator|Promise.<AsyncIterableIterator}
38
- */var L;try{L=new TextDecoder}catch(e){}var R,E,M,_,B,C,T,P=0,D={},F=0,v=0,j=[],N={useRecords:!1,mapsAsObjects:!0};class V{}const W=new V;W.name="MessagePack 0xC1";var Y=!1,z=2;try{new Function("")}catch(e){// if eval variants are not supported, do not create inline object readers ever
39
- z=1/0}class ${constructor(e){e&&(!1===e.useRecords&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0)),Object.assign(this,e)}unpack(e,t){if(R)// re-entrant execution, save the state and restore it after we do this unpack
40
- return y(()=>(m(),this?this.unpack(e,t):$.prototype.unpack.call(N,e,t)));E=-1<t?t:e.length,P=0,v=0,_=null,B=null,R=e;// this provides cached access to the data view for a buffer if it is getting reused, which is a recommend
38
+ */var B;try{B=new TextDecoder}catch(a){}var C,D,E,F,G,H,I,J=0,K={},L=0,M=0,N=[],O={useRecords:!1,mapsAsObjects:!0};class P{}const Q=new P;Q.name="MessagePack 0xC1";var R,S=!1,T=2;try{new Function("")}catch(a){// if eval variants are not supported, do not create inline object readers ever
39
+ T=1/0}class U{constructor(a){a&&(!1===a.useRecords&&a.mapsAsObjects===void 0&&(a.mapsAsObjects=!0),a.sequential&&!1!==a.trusted&&(a.trusted=!0,!a.structures&&!1!=a.useRecords&&(a.structures=[],!a.maxSharedStructures&&(a.maxSharedStructures=0))),a.structures?a.structures.sharedLength=a.structures.length:a.getStructures&&((a.structures=[]).uninitialized=!0,a.structures.sharedLength=0)),Object.assign(this,a)}unpack(a,b){if(C)// re-entrant execution, save the state and restore it after we do this unpack
40
+ return q(()=>(r(),this?this.unpack(a,b):U.prototype.unpack.call(O,a,b)));D=-1<b?b:a.length,J=0,M=0,F=null,G=null,C=a;// this provides cached access to the data view for a buffer if it is getting reused, which is a recommend
41
41
  // technique for getting data from a database where it can be copied into an existing buffer instead of creating
42
42
  // new ones
43
- try{T=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 $){if(D=this,this.structures)return M=this.structures,n();(!M||0<M.length)&&(M=[])}else D=N,(!M||0<M.length)&&(M=[]);return n()}unpackMultiple(e,t){let s,r=0;try{Y=!0;let i=e.length,o=this?this.unpack(e,i):re.unpack(e,i);if(t){for(t(o);P<i;)if(r=P,!1===t(n()))return;}else{for(s=[o];P<i;)r=P,s.push(n());return s}}catch(e){throw e.lastPosition=r,e.values=s,e}finally{Y=!1,m()}}_mergeStructures(e,t){e=e||[];for(let n,s=0,r=e.length;s<r;s++)n=e[s],n&&(n.isShared=!0,32<=s&&(n.highByte=s-32>>5));for(let n in e.sharedLength=e.length,t||[])if(0<=n){let s=e[n],r=t[n];r&&(s&&((e.restoreStructures||(e.restoreStructures=[]))[n]=s),e[n]=r)}return this.structures=e}decode(e,t){return this.unpack(e,t)}}const q=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,G=(e,t)=>function(){let n=R[P++];if(0===n)return t();let s=32>e?-(e+(n<<5)):e+(n<<5),r=M[s]||o()[s];if(!r)throw new Error("Record id is not defined for "+s);return r.read||(r.read=i(r,e)),r.read()};var H=a,J=a,K=a,Q=a;var X=String.fromCharCode,Z=Array(4096);const ee=(e,t)=>{var n=r();let s=e;void 0!==t&&(e=32>e?-((t<<5)+e):(t<<5)+e,n.highByte=t);let o=M[e];return o&&o.isShared&&((M.restoreStructures||(M.restoreStructures=[]))[e]=o),M[e]=n,n.read=i(n,s),n.read()};j[0]=()=>{},j[0].noBuffer=!0,j[101]=()=>{let e=r();return(globalThis[e[0]]||Error)(e[1])},j[105]=()=>{// id extension (for structured clones)
44
- let e=T.getUint32(P-4);C||(C=new Map);let t,n=R[P];t=144<=n&&160>n||220==n||221==n?[]:{};let s={target:t};// a placeholder object
45
- C.set(e,s);let i=r();// read the next value as the target object to id
46
- return s.used?Object.assign(t,i):(s.target=i,i);// no cycle, can just use the returned read object
47
- },j[112]=()=>{// pointer extension (for structured clones)
48
- let e=T.getUint32(P-4),t=C.get(e);return t.used=!0,t.target},j[115]=()=>new Set(r());const te=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array");j[116]=e=>{let t=e[0],n=te[t];if(!n)throw new Error("Could not find typed array for code "+t);// we have to always slice/copy here to get a new ArrayBuffer that is word/byte aligned
49
- return new globalThis[n](Uint8Array.prototype.slice.call(e,1).buffer)},j[120]=()=>{let e=r();return new RegExp(e[0],e[1])};const ne=[];j[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=P;return P+=t-e.length,B=ne,B=[l(),l()],B.position0=0,B.position1=0,B.postBundlePosition=P,P=n,r()},j[255]=e=>4==e.length?new Date(1e3*(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3])):8==e.length?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+1e3*(4294967296*(3&e[3])+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7])):12==e.length?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+1e3*((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11])):new Date("invalid");const se=Array(147);// this is a table matching binary exponents to the multiplier to determine significant digit rounding
50
- for(let n=0;256>n;n++)se[n]=+("1e"+t(45.15-.30103*n));var re=new $({useRecords:!1});const ie=re.unpack,oe=re.unpackMultiple,ae=re.unpack,ue={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};let de,ce=new Float32Array(1),ge=new Uint8Array(ce.buffer,0,4);try{de=new TextEncoder}catch(e){}let le,pe;const fe="undefined"!=typeof Buffer,he=fe?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,ye=fe?Buffer:Uint8Array,me=fe?4294967296:2144337920;let be,Ue,ke,Ie,Se=0,Oe=null;const Ae=Symbol("record-id");class we extends ${constructor(e){super(e),this.offset=0;let t,n,s,r,i=0,o=ye.prototype.utf8Write?function(e,t){return be.utf8Write(e,t,4294967295)}:!!(de&&de.encodeInto)&&function(e,t){return de.encodeInto(e,be.subarray(t)).written},a=this;e||(e={});let u=e&&e.sequential,d=e.structures||e.saveStructures,c=e.maxSharedStructures;if(null==c&&(c=d?32:0),8160<c)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&null==e.moreTypes&&(e.moreTypes=!0);let g=e.maxOwnStructures;null==g&&(g=d?32:64),this.structures||!1==e.useRecords||(this.structures=[]);// two byte record ids for shared structures
51
- let l=32<c||64<g+c,p=c+64,f=c+g+64;if(8256<f)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let h=[],y=0,m=0;this.pack=this.encode=function(e,o){if(be||(be=new he(8192),ke=new DataView(be.buffer,0,8192),Se=0),Ie=be.length-10,2048>Ie-Se?(be=new he(be.length),ke=new DataView(be.buffer,0,be.length),Ie=be.length-10,Se=0):Se=2147483640&Se+7,t=Se,r=a.structuredClone?new Map:null,a.bundleStrings&&"string"!=typeof e?(Oe=[],Oe.size=1/0):Oe=null,s=a.structures,s){s.uninitialized&&(s=a._mergeStructures(a.getStructures()));let e=s.sharedLength||0;if(e>c)//if (maxSharedStructures <= 32 && structures.sharedLength > 32) // TODO: could support this, but would need to update the limit ids
52
- throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+s.sharedLength);if(!s.transitions){s.transitions=Object.create(null);for(let t,n=0;n<e;n++){if(t=s[n],!t)continue;let e,r=s.transitions;for(let n,s=0,i=t.length;s<i;s++)n=t[s],e=r[n],e||(e=r[n]=Object.create(null)),r=e;r[Ae]=n+64}i=e}u||(s.nextId=e+64)}n&&(n=!1);try{// update the offset so next serialization doesn't write over our buffer, but can continue writing to same buffer sequentially
53
- if(b(e),Oe&&O(t,b),a.offset=Se,r&&r.idsToInsert){Se+=6*r.idsToInsert.length,Se>Ie&&k(Se),a.offset=Se;let e=S(be.subarray(t,Se),r.idsToInsert);return r=null,e}return o&Ce?(be.start=t,be.end=Se,be):be.subarray(t,Se);// position can change if we call pack again in saveStructures, so we get the buffer now
54
- }finally{if(s){10>m&&m++;let r=s.sharedLength||c;if(s.length>r&&(s.length=r),1e4<y)s.transitions=null,m=0,y=0,0<h.length&&(h=[]);else if(0<h.length&&!u){for(let e=0,t=h.length;e<t;e++)h[e][Ae]=0;h=[]}if(n&&a.saveStructures){// we can't rely on start/end with REUSE_BUFFER_MODE since they will (probably) change when we save
55
- let n=be.subarray(t,Se);return!1===a.saveStructures(s,i)?(a._mergeStructures(a.getStructures()),a.pack(e)):(i=r,n)}}o&Te&&(Se=t)}};const b=e=>{Se>Ie&&(be=k(Se));var n,s=typeof e;if("string"==s){let s=e.length;if(Oe&&4<=s&&4096>s){if((Oe.size+=s)>61440){let e,n=(Oe[0]?3*Oe[0].length+Oe[1].length:0)+10;Se+n>Ie&&(be=k(Se+n)),Oe.position?(be[Se]=200,Se+=3,be[Se++]=98,e=Se-t,Se+=4,O(t,b),ke.setUint16(e+t-3,Se-t-e)):(be[Se++]=214,be[Se++]=98,e=Se-t,Se+=4),Oe=["",""],Oe.size=0,Oe.position=e}let n=/[\u0080-\uFFFF]/.test(e);return Oe[n?0:1]+=e,be[Se++]=193,void b(n?-s:s)}let r=32>s?1:256>s?2:65536>s?3:5;// first we estimate the header size, so we can write to the correct location
56
- let i=3*s;if(Se+i>Ie&&(be=k(Se+i)),64>s||!o){let t,i,o,a=Se+r;for(t=0;t<s;t++)i=e.charCodeAt(t),128>i?be[a++]=i:2048>i?(be[a++]=192|i>>6,be[a++]=128|63&i):55296==(64512&i)&&56320==(64512&(o=e.charCodeAt(t+1)))?(i=65536+((1023&i)<<10)+(1023&o),t++,be[a++]=240|i>>18,be[a++]=128|63&i>>12,be[a++]=128|63&i>>6,be[a++]=128|63&i):(be[a++]=224|i>>12,be[a++]=128|63&i>>6,be[a++]=128|63&i);n=a-Se-r}else n=o(e,Se+r);32>n?be[Se++]=160|n:256>n?(2>r&&be.copyWithin(Se+2,Se+1,Se+1+n),be[Se++]=217,be[Se++]=n):65536>n?(3>r&&be.copyWithin(Se+3,Se+2,Se+2+n),be[Se++]=218,be[Se++]=n>>8,be[Se++]=255&n):(5>r&&be.copyWithin(Se+5,Se+3,Se+3+n),be[Se++]=219,ke.setUint32(Se,n),Se+=4),Se+=n}else if("number"===s){if(e>>>0===e)64>e?be[Se++]=e:256>e?(be[Se++]=204,be[Se++]=e):65536>e?(be[Se++]=205,be[Se++]=e>>8,be[Se++]=255&e):(be[Se++]=206,ke.setUint32(Se,e),Se+=4);else if(e>>0===e)-32<=e?be[Se++]=256+e:-128<=e?(be[Se++]=208,be[Se++]=e+256):-32768<=e?(be[Se++]=209,ke.setInt16(Se,e),Se+=2):(be[Se++]=210,ke.setInt32(Se,e),Se+=4);else{let t;if(0<(t=this.useFloat32)&&4294967296>e&&-2147483648<=e){be[Se++]=202,ke.setFloat32(Se,e);let n;if(4>t||// this checks for rounding of numbers that were encoded in 32-bit float to nearest significant decimal digit that could be preserved
57
- (n=e*se[(127&be[Se])<<1|be[Se+1]>>7])>>0===n)return void(Se+=4);// move back into position for writing a double
58
- Se--}be[Se++]=203,ke.setFloat64(Se,e),Se+=8}}else if("object"===s){if(!e)be[Se++]=192;else{if(r){let n=r.get(e);if(n){if(!n.id){let e=r.idsToInsert||(r.idsToInsert=[]);n.id=e.push(n)}return be[Se++]=214,be[Se++]=112,ke.setUint32(Se,n.id),void(Se+=4)}r.set(e,{offset:Se-t})}let s=e.constructor;if(s===Object)U(e,!0);else if(s===Array){n=e.length,16>n?be[Se++]=144|n:65536>n?(be[Se++]=220,be[Se++]=n>>8,be[Se++]=255&n):(be[Se++]=221,ke.setUint32(Se,n),Se+=4);for(let t=0;t<n;t++)b(e[t])}else if(s===Map){n=e.size,16>n?be[Se++]=128|n:65536>n?(be[Se++]=222,be[Se++]=n>>8,be[Se++]=255&n):(be[Se++]=223,ke.setUint32(Se,n),Se+=4);for(let[t,n]of e)b(t),b(n)}else{for(let t,n=0,s=le.length;n<s;n++)if(t=pe[n],e instanceof t){let t=le[n];if(t.write)return t.type&&(be[Se++]=212,be[Se++]=t.type,be[Se++]=0),void b(t.write.call(this,e));let s=be,r=ke,i=Se;be=null;let o;try{o=t.pack.call(this,e,e=>(be=s,s=null,Se+=e,Se>Ie&&k(Se),{target:be,targetView:ke,position:Se-e}),b)}finally{s&&(be=s,ke=r,Se=i,Ie=be.length-10)}return void(o&&(o.length+Se>Ie&&k(o.length+Se),Se=I(o,be,Se,t.type)))}// no extension found, write as object
59
- U(e,!e.hasOwnProperty)}}}else if("boolean"===s)be[Se++]=e?195:194;else if("bigint"===s){if(e<BigInt(1)<<BigInt(63)&&e>=-(BigInt(1)<<BigInt(63)))be[Se++]=211,ke.setBigInt64(Se,e);else if(e<BigInt(1)<<BigInt(64)&&0<e)be[Se++]=207,ke.setBigUint64(Se,e);else// overflow
60
- if(this.largeBigIntToFloat)be[Se++]=203,ke.setFloat64(Se,+e);else throw new RangeError(e+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");Se+=8}else if("undefined"===s)this.encodeUndefinedAsNil?be[Se++]=192:(be[Se++]=212,be[Se++]=0,be[Se++]=0);else if("function"===s)b(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+s)},U=!1===this.useRecords?this.variableMapSize?e=>{// this method is slightly slower, but generates "preferred serialization" (optimally small for smaller objects)
61
- let t=Object.keys(e),n=t.length;16>n?be[Se++]=128|n:65536>n?(be[Se++]=222,be[Se++]=n>>8,be[Se++]=255&n):(be[Se++]=223,ke.setUint32(Se,n),Se+=4);let s;for(let r=0;r<n;r++)b(s=t[r]),b(e[s])}:(e,n)=>{be[Se++]=222;// always using map 16, so we can preallocate and set the length afterwards
62
- let s=Se-t;Se+=2;let r=0;for(let t in e)(n||e.hasOwnProperty(t))&&(b(t),b(e[t]),r++);be[s++ +t]=r>>8,be[s+t]=255&r}:e.progressiveRecords&&!l?// this is about 2% faster for highly stable structures, since it only requires one for-in loop (but much more expensive when new structure needs to be written)
63
- (e,n)=>{let r,i,o=s.transitions||(s.transitions=Object.create(null)),a=Se++-t;for(let u in e)if(n||e.hasOwnProperty(u)){if(r=o[u],r)o=r;else{// record doesn't exist, create full new record and insert it
64
- let n=Object.keys(e),d=o;o=s.transitions;let c=0;for(let e,t=0,s=n.length;t<s;t++)e=n[t],r=o[e],r||(r=o[e]=Object.create(null),c++),o=r;a+t+1==Se?(Se--,A(o,n,c)):// otherwise we need to insert the record, moving existing data after the record
65
- w(o,n,a,c),i=!0,o=d[u]}b(e[u])}if(!i){let n=o[Ae];n?be[a+t]=n:w(o,Object.keys(e),a,0)}}:(e,t)=>{let n,r=s.transitions||(s.transitions=Object.create(null)),i=0;for(let s in e)(t||e.hasOwnProperty(s))&&(n=r[s],n||(n=r[s]=Object.create(null),i++),r=n);let o=r[Ae];// now write the values
66
- for(let n in o?96<=o&&l?(be[Se++]=(31&(o-=96))+96,be[Se++]=o>>5):be[Se++]=o:A(r,r.__keys__||Object.keys(e),i),e)(t||e.hasOwnProperty(n))&&b(e[n])},k=e=>{var n=Math.min,s=Math.round,r=Math.max;let i;if(16777216<e){// special handling for really large buffers
67
- if(e-t>me)throw new Error("Packed buffer would be larger than maximum buffer size");i=n(me,4096*s(r((e-t)*(67108864<e?1.25:2),4194304)/4096))}else// faster handling for smaller buffers
68
- i=(r(e-t<<2,be.length-1)>>12)+1<<12;let o=new he(i);return ke=new DataView(o.buffer,0,i),e=n(e,be.length),be.copy?be.copy(o,0,t,e):o.set(be.slice(t,e)),Se-=t,t=0,Ie=o.length-10,be=o},A=(e,t,r)=>{let i=s.nextId;i||(i=64),i<p&&this.shouldShareStructure&&!this.shouldShareStructure(t)?(i=s.nextOwnId,!(i<f)&&(i=p),s.nextOwnId=i+1):(i>=f&&(// cycle back around
69
- i=p),s.nextId=i+1);let o=t.highByte=96<=i&&l?i-96>>5:-1;e[Ae]=i,e.__keys__=t,s[i-64]=t,i<p?(t.isShared=!0,s.sharedLength=i-63,n=!0,0<=o?(be[Se++]=(31&i)+96,be[Se++]=o):be[Se++]=i):(0<=o?(be[Se++]=213,be[Se++]=114,be[Se++]=(31&i)+96,be[Se++]=o):(be[Se++]=212,be[Se++]=114,be[Se++]=i),r&&(y+=m*r),h.length>=g&&(h.shift()[Ae]=0),h.push(e),b(t))},w=(e,n,s,r)=>{let i=be,o=Se,a=Ie,u=t;be=Ue,Se=0,t=0,be||(Ue=be=new he(8192)),Ie=be.length-10,A(e,n,r),Ue=be;let d=Se;if(be=i,Se=o,Ie=a,t=u,1<d){let e=Se+d-1;e>Ie&&k(e);let n=s+t;be.copyWithin(n+d,n+1,Se),be.set(Ue.slice(0,d),n),Se=e}else be[s+t]=Ue[0]}}useBuffer(e){// this means we are finished using our own buffer and we can write over it safely
70
- be=e,ke=new DataView(be.buffer,be.byteOffset,be.byteLength),Se=0}clearSharedData(){this.structures&&(this.structures=[])}}pe=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor/*TypedArray*/,V],le=[{pack(e,n,s){let r=e.getTime()/1e3;if((this.useTimestamp32||0===e.getMilliseconds())&&0<=r&&4294967296>r){// Timestamp 32
71
- let{target:e,targetView:t,position:s}=n(6);e[s++]=214,e[s++]=255,t.setUint32(s,r)}else if(0<r&&4294967296>r){// Timestamp 64
72
- let{target:t,targetView:s,position:i}=n(10);t[i++]=215,t[i++]=255,s.setUint32(i,4e6*e.getMilliseconds()+(r/1e3/4294967296>>0)),s.setUint32(i+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return n(0),s(this.onInvalidDate());// Intentionally invalid timestamp
73
- let{target:e,targetView:t,position:r}=n(3);e[r++]=212,e[r++]=255,e[r++]=255}else{// Timestamp 96
74
- let{target:s,targetView:i,position:o}=n(15);s[o++]=199,s[o++]=12,s[o++]=255,i.setUint32(o,1e6*e.getMilliseconds()),i.setBigInt64(o+4,BigInt(t(r)))}}},{pack(e,t,n){let s=Array.from(e),{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=115,r[i++]=0),n(s)}},{pack(e,t,n){let{target:s,position:r}=t(this.moreTypes?3:0);this.moreTypes&&(s[r++]=212,s[r++]=101,s[r++]=0),n([e.name,e.message])}},{pack(e,t,n){let{target:s,position:r}=t(this.moreTypes?3:0);this.moreTypes&&(s[r++]=212,s[r++]=120,s[r++]=0),n([e.source,e.flags])}},{pack(e,t){this.moreTypes?U(e,16,t):k(fe?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==ye&&this.moreTypes?U(e,te.indexOf(n.name),t):k(e,t)}},{pack(e,t){// specific 0xC1 object
75
- let{target:n,position:s}=t(1);n[s]=193}}];let xe=new we({useRecords:!1});const Le=xe.pack,Re=xe.pack,{NEVER:Ee,ALWAYS:Me,DECIMAL_ROUND:_e,DECIMAL_FIT:Be}=ue,Ce=512,Te=1024;e.ALWAYS=Me,e.C1=W,e.DECIMAL_FIT=Be,e.DECIMAL_ROUND=_e,e.Decoder=$,e.Encoder=we,e.FLOAT32_OPTIONS=ue,e.NEVER=Ee,e.Packr=we,e.REUSE_BUFFER_MODE=Ce,e.Unpackr=$,e.addExtension=A,e.clearSource=m,e.decode=ae,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 n=new $(t);let s;const r=e=>{let t;// if there's incomplete data from previous chunk, concatinate and try again
76
- s&&(e=Buffer.concat([s,e]),s=void 0);try{t=n.unpackMultiple(e)}catch(n){if(n.incomplete)s=e.slice(n.lastPosition),t=n.values;else throw n}return t};if("function"==typeof e[Symbol.iterator])return function*(){for(const t of e)yield*r(t)}();return"function"==typeof e[Symbol.asyncIterator]?async function*(){for await(const t of e)yield*r(t)}():void 0},e.encode=Re,e.encodeIter=/**
43
+ try{I=a.dataView||(a.dataView=new DataView(a.buffer,a.byteOffset,a.byteLength))}catch(b){if(C=null,a instanceof Uint8Array)throw b;throw new Error("Source must be a Uint8Array or Buffer but was a "+(a&&"object"==typeof a?a.constructor.name:typeof a))}if(this instanceof U){if(K=this,this.structures)return E=this.structures,c();(!E||0<E.length)&&(E=[])}else K=O,(!E||0<E.length)&&(E=[]);return c()}unpackMultiple(a,b){let d,e=0;try{S=!0;let f=a.length,g=this?this.unpack(a,f):fa.unpack(a,f);if(b){for(b(g);J<f;)if(e=J,!1===b(c()))return;}else{for(d=[g];J<f;)e=J,d.push(c());return d}}catch(a){throw a.lastPosition=e,a.values=d,a}finally{S=!1,r()}}_mergeStructures(a,b){a=a||[];for(let c,d=0,e=a.length;d<e;d++)c=a[d],c&&(c.isShared=!0,32<=d&&(c.highByte=d-32>>5));for(let c in a.sharedLength=a.length,b||[])if(0<=c){let d=a[c],e=b[c];e&&(d&&((a.restoreStructures||(a.restoreStructures=[]))[c]=d),a[c]=e)}return this.structures=a}decode(a,b){return this.unpack(a,b)}}const V=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,W=(a,b)=>function(){let c=C[J++];if(0===c)return b();let d=32>a?-(a+(c<<5)):a+(c<<5),e=E[d]||g()[d];if(!e)throw new Error("Record id is not defined for "+d);return e.read||(e.read=f(e,a)),e.read()};var X=h,Y=h,Z=h,$=h;var _=String.fromCharCode,aa=Array(4096);const ba=(a,b)=>{var c=e();let d=a;void 0!==b&&(a=32>a?-((b<<5)+a):(b<<5)+a,c.highByte=b);let g=E[a];return g&&g.isShared&&((E.restoreStructures||(E.restoreStructures=[]))[a]=g),E[a]=c,c.read=f(c,d),c.read()};N[0]=()=>{},N[0].noBuffer=!0,N[101]=()=>{let a=e();return(globalThis[a[0]]||Error)(a[1])},N[105]=()=>{// id extension (for structured clones)
44
+ let a=I.getUint32(J-4);H||(H=new Map);let b,c=C[J];b=144<=c&&160>c||220==c||221==c?[]:{};let d={target:b};// a placeholder object
45
+ H.set(a,d);let f=e();// read the next value as the target object to id
46
+ return d.used?Object.assign(b,f):(d.target=f,f);// no cycle, can just use the returned read object
47
+ },N[112]=()=>{// pointer extension (for structured clones)
48
+ let a=I.getUint32(J-4),b=H.get(a);return b.used=!0,b.target},N[115]=()=>new Set(e());const ca=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(a=>a+"Array");N[116]=a=>{let b=a[0],c=ca[b];if(!c)throw new Error("Could not find typed array for code "+b);// we have to always slice/copy here to get a new ArrayBuffer that is word/byte aligned
49
+ return new globalThis[c](Uint8Array.prototype.slice.call(a,1).buffer)},N[120]=()=>{let a=e();return new RegExp(a[0],a[1])};const da=[];N[98]=a=>{let b=(a[0]<<24)+(a[1]<<16)+(a[2]<<8)+a[3],c=J;return J+=b-a.length,G=da,G=[m(),m()],G.position0=0,G.position1=0,G.postBundlePosition=J,J=c,e()},N[255]=a=>4==a.length?new Date(1e3*(16777216*a[0]+(a[1]<<16)+(a[2]<<8)+a[3])):8==a.length?new Date(((a[0]<<22)+(a[1]<<14)+(a[2]<<6)+(a[3]>>2))/1e6+1e3*(4294967296*(3&a[3])+16777216*a[4]+(a[5]<<16)+(a[6]<<8)+a[7])):12==a.length?new Date(((a[0]<<24)+(a[1]<<16)+(a[2]<<8)+a[3])/1e6+1e3*((128&a[4]?-281474976710656:0)+1099511627776*a[6]+4294967296*a[7]+16777216*a[8]+(a[9]<<16)+(a[10]<<8)+a[11])):new Date("invalid");const ea=Array(147);// this is a table matching binary exponents to the multiplier to determine significant digit rounding
50
+ for(let c=0;256>c;c++)ea[c]=+("1e"+b(45.15-.30103*c));var fa=new U({useRecords:!1});const ga=fa.unpack,ha=fa.unpackMultiple,ia=fa.unpack,ja={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};let ka,la=new Float32Array(1),ma=new Uint8Array(la.buffer,0,4);try{ka=new TextEncoder}catch(a){}let na,oa;const pa="undefined"!=typeof Buffer,qa=pa?function(a){return Buffer.allocUnsafeSlow(a)}:Uint8Array,ra=pa?Buffer:Uint8Array,sa=pa?4294967296:2144337920;let ta,ua,va,wa,xa,ya=0,za=null;const Aa=Symbol("record-id");class Ba extends U{constructor(a){super(a),this.offset=0;let b,c,d,e,f=0,g=ra.prototype.utf8Write?function(a,b){return ta.utf8Write(a,b,4294967295)}:!!(ka&&ka.encodeInto)&&function(a,b){return ka.encodeInto(a,ta.subarray(b)).written},h=this;a||(a={});let i=a&&a.sequential,j=a.structures||a.saveStructures,k=a.maxSharedStructures;if(null==k&&(k=j?32:0),8160<k)throw new Error("Maximum maxSharedStructure is 8160");a.structuredClone&&null==a.moreTypes&&(a.moreTypes=!0);let l=a.maxOwnStructures;null==l&&(l=j?32:64),this.structures||!1==a.useRecords||(this.structures=[]);// two byte record ids for shared structures
51
+ let m=32<k||64<l+k,n=k+64,o=k+l+64;if(8256<o)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let p=[],q=0,r=0;this.pack=this.encode=function(a,g){if(ta||(ta=new qa(8192),va=ta.dataView=new DataView(ta.buffer,0,8192),ya=0),wa=ta.length-10,2048>wa-ya?(ta=new qa(ta.length),va=ta.dataView=new DataView(ta.buffer,0,ta.length),wa=ta.length-10,ya=0):ya=2147483640&ya+7,b=ya,e=h.structuredClone?new Map:null,h.bundleStrings&&"string"!=typeof a?(za=[],za.size=1/0):za=null,d=h.structures,d){d.uninitialized&&(d=h._mergeStructures(h.getStructures()));let a=d.sharedLength||0;if(a>k)//if (maxSharedStructures <= 32 && structures.sharedLength > 32) // TODO: could support this, but would need to update the limit ids
52
+ throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+d.sharedLength);if(!d.transitions){d.transitions=Object.create(null);for(let b,c=0;c<a;c++){if(b=d[c],!b)continue;let a,e=d.transitions;for(let c,d=0,f=b.length;d<f;d++)c=b[d],a=e[c],a||(a=e[c]=Object.create(null)),e=a;e[Aa]=c+64}f=a}i||(d.nextId=a+64)}c&&(c=!1);try{// update the offset so next serialization doesn't write over our buffer, but can continue writing to same buffer sequentially
53
+ if(h.randomAccessStructure&&a.constructor&&a.constructor===Object?A(a):s(a),za&&x(b,s),h.offset=ya,e&&e.idsToInsert){ya+=6*e.idsToInsert.length,ya>wa&&u(ya),h.offset=ya;let a=w(ta.subarray(b,ya),e.idsToInsert);return e=null,a}return g&Ja?(ta.start=b,ta.end=ya,ta):ta.subarray(b,ya);// position can change if we call pack again in saveStructures, so we get the buffer now
54
+ }finally{if(d){10>r&&r++;let e=d.sharedLength||k;if(d.length>e&&(d.length=e),1e4<q)d.transitions=null,r=0,q=0,0<p.length&&(p=[]);else if(0<p.length&&!i){for(let a=0,b=p.length;a<b;a++)p[a][Aa]=0;p=[]}if(c&&h.saveStructures){// we can't rely on start/end with REUSE_BUFFER_MODE since they will (probably) change when we save
55
+ let c=ta.subarray(b,ya);return!1===h.saveStructures(d,f)?(h._mergeStructures(h.getStructures()),h.pack(a)):(f=e,c)}}g&Ka&&(ya=b)}};const s=a=>{ya>wa&&(ta=u(ya));var c,d=typeof a;if("string"==d){let d=a.length;if(za&&4<=d&&4096>d){if((za.size+=d)>61440){let a,c=(za[0]?3*za[0].length+za[1].length:0)+10;ya+c>wa&&(ta=u(ya+c)),za.position?(ta[ya]=200,ya+=3,ta[ya++]=98,a=ya-b,ya+=4,x(b,s),va.setUint16(a+b-3,ya-b-a)):(ta[ya++]=214,ta[ya++]=98,a=ya-b,ya+=4),za=["",""],za.size=0,za.position=a}let c=/[\u0080-\uFFFF]/.test(a);return za[c?0:1]+=a,ta[ya++]=193,void s(c?-d:d)}let e=32>d?1:256>d?2:65536>d?3:5;// first we estimate the header size, so we can write to the correct location
56
+ let f=3*d;if(ya+f>wa&&(ta=u(ya+f)),64>d||!g){let b,f,g,h=ya+e;for(b=0;b<d;b++)f=a.charCodeAt(b),128>f?ta[h++]=f:2048>f?(ta[h++]=192|f>>6,ta[h++]=128|63&f):55296==(64512&f)&&56320==(64512&(g=a.charCodeAt(b+1)))?(f=65536+((1023&f)<<10)+(1023&g),b++,ta[h++]=240|f>>18,ta[h++]=128|63&f>>12,ta[h++]=128|63&f>>6,ta[h++]=128|63&f):(ta[h++]=224|f>>12,ta[h++]=128|63&f>>6,ta[h++]=128|63&f);c=h-ya-e}else c=g(a,ya+e);32>c?ta[ya++]=160|c:256>c?(2>e&&ta.copyWithin(ya+2,ya+1,ya+1+c),ta[ya++]=217,ta[ya++]=c):65536>c?(3>e&&ta.copyWithin(ya+3,ya+2,ya+2+c),ta[ya++]=218,ta[ya++]=c>>8,ta[ya++]=255&c):(5>e&&ta.copyWithin(ya+5,ya+3,ya+3+c),ta[ya++]=219,va.setUint32(ya,c),ya+=4),ya+=c}else if("number"===d){if(a>>>0===a)64>a||128>a&&!1===this.useRecords?ta[ya++]=a:256>a?(ta[ya++]=204,ta[ya++]=a):65536>a?(ta[ya++]=205,ta[ya++]=a>>8,ta[ya++]=255&a):(ta[ya++]=206,va.setUint32(ya,a),ya+=4);else if(a>>0===a)-32<=a?ta[ya++]=256+a:-128<=a?(ta[ya++]=208,ta[ya++]=a+256):-32768<=a?(ta[ya++]=209,va.setInt16(ya,a),ya+=2):(ta[ya++]=210,va.setInt32(ya,a),ya+=4);else{let b;if(0<(b=this.useFloat32)&&4294967296>a&&-2147483648<=a){ta[ya++]=202,va.setFloat32(ya,a);let c;if(4>b||// this checks for rounding of numbers that were encoded in 32-bit float to nearest significant decimal digit that could be preserved
57
+ (c=a*ea[(127&ta[ya])<<1|ta[ya+1]>>7])>>0===c)return void(ya+=4);// move back into position for writing a double
58
+ ya--}ta[ya++]=203,va.setFloat64(ya,a),ya+=8}}else if("object"===d){if(!a)ta[ya++]=192;else{if(e){let c=e.get(a);if(c){if(!c.id){let a=e.idsToInsert||(e.idsToInsert=[]);c.id=a.push(c)}return ta[ya++]=214,ta[ya++]=112,va.setUint32(ya,c.id),void(ya+=4)}e.set(a,{offset:ya-b})}let d=a.constructor;if(d===Object)t(a,!0);else if(d===Array){c=a.length,16>c?ta[ya++]=144|c:65536>c?(ta[ya++]=220,ta[ya++]=c>>8,ta[ya++]=255&c):(ta[ya++]=221,va.setUint32(ya,c),ya+=4);for(let b=0;b<c;b++)s(a[b])}else if(d===Map){c=a.size,16>c?ta[ya++]=128|c:65536>c?(ta[ya++]=222,ta[ya++]=c>>8,ta[ya++]=255&c):(ta[ya++]=223,va.setUint32(ya,c),ya+=4);for(let[b,c]of a)s(b),s(c)}else{for(let b,c=0,d=na.length;c<d;c++)if(b=oa[c],a instanceof b){let b=na[c];if(b.write)return b.type&&(ta[ya++]=212,ta[ya++]=b.type,ta[ya++]=0),void s(b.write.call(this,a));let d=ta,e=va,f=ya;ta=null;let g;try{g=b.pack.call(this,a,a=>(ta=d,d=null,ya+=a,ya>wa&&u(ya),{target:ta,targetView:va,position:ya-a}),s)}finally{d&&(ta=d,va=e,ya=f,wa=ta.length-10)}return void(g&&(g.length+ya>wa&&u(g.length+ya),ya=v(g,ta,ya,b.type)))}// no extension found, write as object
59
+ t(a,!a.hasOwnProperty)}}}else if("boolean"===d)ta[ya++]=a?195:194;else if("bigint"===d){if(a<BigInt(1)<<BigInt(63)&&a>=-(BigInt(1)<<BigInt(63)))ta[ya++]=211,va.setBigInt64(ya,a);else if(a<BigInt(1)<<BigInt(64)&&0<a)ta[ya++]=207,va.setBigUint64(ya,a);else// overflow
60
+ if(this.largeBigIntToFloat)ta[ya++]=203,va.setFloat64(ya,+a);else throw new RangeError(a+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");ya+=8}else if("undefined"===d)this.encodeUndefinedAsNil?ta[ya++]=192:(ta[ya++]=212,ta[ya++]=0,ta[ya++]=0);else if("function"===d)s(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+d)},t=!1===this.useRecords?this.variableMapSize?a=>{// this method is slightly slower, but generates "preferred serialization" (optimally small for smaller objects)
61
+ let b=Object.keys(a),c=b.length;16>c?ta[ya++]=128|c:65536>c?(ta[ya++]=222,ta[ya++]=c>>8,ta[ya++]=255&c):(ta[ya++]=223,va.setUint32(ya,c),ya+=4);let d;for(let e=0;e<c;e++)s(d=b[e]),s(a[d])}:(a,c)=>{ta[ya++]=222;// always using map 16, so we can preallocate and set the length afterwards
62
+ let d=ya-b;ya+=2;let e=0;for(let b in a)(c||a.hasOwnProperty(b))&&(s(b),s(a[b]),e++);ta[d++ +b]=e>>8,ta[d+b]=255&e}:a.progressiveRecords&&!m?// this is about 2% faster for highly stable structures, since it only requires one for-in loop (but much more expensive when new structure needs to be written)
63
+ (a,c)=>{let e,f,g=d.transitions||(d.transitions=Object.create(null)),h=ya++-b;for(let i in a)if(c||a.hasOwnProperty(i)){if(e=g[i],e)g=e;else{// record doesn't exist, create full new record and insert it
64
+ let c=Object.keys(a),j=g;g=d.transitions;let k=0;for(let a,b=0,d=c.length;b<d;b++)a=c[b],e=g[a],e||(e=g[a]=Object.create(null),k++),g=e;h+b+1==ya?(ya--,y(g,c,k)):// otherwise we need to insert the record, moving existing data after the record
65
+ z(g,c,h,k),f=!0,g=j[i]}s(a[i])}if(!f){let c=g[Aa];c?ta[h+b]=c:z(g,Object.keys(a),h,0)}}:(a,b)=>{let c,e=d.transitions||(d.transitions=Object.create(null)),f=0;for(let d in a)(b||a.hasOwnProperty(d))&&(c=e[d],c||(c=e[d]=Object.create(null),f++),e=c);let g=e[Aa];// now write the values
66
+ for(let c in g?96<=g&&m?(ta[ya++]=(31&(g-=96))+96,ta[ya++]=g>>5):ta[ya++]=g:y(e,e.__keys__||Object.keys(a),f),a)(b||a.hasOwnProperty(c))&&s(a[c])},u=a=>{var c=Math.min,d=Math.round,e=Math.max;let f;if(16777216<a){// special handling for really large buffers
67
+ if(a-b>sa)throw new Error("Packed buffer would be larger than maximum buffer size");f=c(sa,4096*d(e((a-b)*(67108864<a?1.25:2),4194304)/4096))}else// faster handling for smaller buffers
68
+ f=(e(a-b<<2,ta.length-1)>>12)+1<<12;let g=new qa(f);return va=g.dataView=new DataView(g.buffer,0,f),a=c(a,ta.length),ta.copy?ta.copy(g,0,b,a):g.set(ta.slice(b,a)),ya-=b,b=0,wa=g.length-10,ta=g},y=(a,b,e)=>{let f=d.nextId;f||(f=64),f<n&&this.shouldShareStructure&&!this.shouldShareStructure(b)?(f=d.nextOwnId,!(f<o)&&(f=n),d.nextOwnId=f+1):(f>=o&&(// cycle back around
69
+ f=n),d.nextId=f+1);let g=b.highByte=96<=f&&m?f-96>>5:-1;a[Aa]=f,a.__keys__=b,d[f-64]=b,f<n?(b.isShared=!0,d.sharedLength=f-63,c=!0,0<=g?(ta[ya++]=(31&f)+96,ta[ya++]=g):ta[ya++]=f):(0<=g?(ta[ya++]=213,ta[ya++]=114,ta[ya++]=(31&f)+96,ta[ya++]=g):(ta[ya++]=212,ta[ya++]=114,ta[ya++]=f),e&&(q+=r*e),p.length>=l&&(p.shift()[Aa]=0),p.push(a),s(b))},z=(a,c,d,e)=>{let f=ta,g=ya,h=wa,i=b;ta=ua,ya=0,b=0,ta||(ua=ta=new qa(8192)),wa=ta.length-10,y(a,c,e),ua=ta;let j=ya;if(ta=f,ya=g,wa=h,b=i,1<j){let a=ya+j-1;a>wa&&u(a);let c=d+b;ta.copyWithin(c+j,c+1,ya),ta.set(ua.slice(0,j),c),ya=a}else ta[d+b]=ua[0]},A=a=>{let b=xa();return 0===b?t(a,!0):void(ya=b)}}useBuffer(a){// this means we are finished using our own buffer and we can write over it safely
70
+ ta=a,va=new DataView(ta.buffer,ta.byteOffset,ta.byteLength),ya=0}clearSharedData(){this.structures&&(this.structures=[])}}oa=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor/*TypedArray*/,P],na=[{pack(a,c,d){let e=a.getTime()/1e3;if((this.useTimestamp32||0===a.getMilliseconds())&&0<=e&&4294967296>e){// Timestamp 32
71
+ let{target:a,targetView:b,position:d}=c(6);a[d++]=214,a[d++]=255,b.setUint32(d,e)}else if(0<e&&4294967296>e){// Timestamp 64
72
+ let{target:b,targetView:d,position:f}=c(10);b[f++]=215,b[f++]=255,d.setUint32(f,4e6*a.getMilliseconds()+(e/1e3/4294967296>>0)),d.setUint32(f+4,e)}else if(isNaN(e)){if(this.onInvalidDate)return c(0),d(this.onInvalidDate());// Intentionally invalid timestamp
73
+ let{target:a,targetView:b,position:e}=c(3);a[e++]=212,a[e++]=255,a[e++]=255}else{// Timestamp 96
74
+ let{target:d,targetView:f,position:g}=c(15);d[g++]=199,d[g++]=12,d[g++]=255,f.setUint32(g,1e6*a.getMilliseconds()),f.setBigInt64(g+4,BigInt(b(e)))}}},{pack(a,b,c){let d=Array.from(a),{target:e,position:f}=b(this.moreTypes?3:0);this.moreTypes&&(e[f++]=212,e[f++]=115,e[f++]=0),c(d)}},{pack(a,b,c){let{target:d,position:e}=b(this.moreTypes?3:0);this.moreTypes&&(d[e++]=212,d[e++]=101,d[e++]=0),c([a.name,a.message])}},{pack(a,b,c){let{target:d,position:e}=b(this.moreTypes?3:0);this.moreTypes&&(d[e++]=212,d[e++]=120,d[e++]=0),c([a.source,a.flags])}},{pack(a,b){this.moreTypes?t(a,16,b):u(pa?Buffer.from(a):new Uint8Array(a),b)}},{pack(a,b){let c=a.constructor;c!==ra&&this.moreTypes?t(a,ca.indexOf(c.name),b):u(a,b)}},{pack(a,b){// specific 0xC1 object
75
+ let{target:c,position:d}=b(1);c[d]=193}}];let Ca=new Ba({useRecords:!1});const Da=Ca.pack,Ea=Ca.pack,{NEVER:Fa,ALWAYS:Ga,DECIMAL_ROUND:Ha,DECIMAL_FIT:Ia}=ja,Ja=512,Ka=1024;a.ALWAYS=Ga,a.C1=Q,a.DECIMAL_FIT=Ia,a.DECIMAL_ROUND=Ha,a.Decoder=U,a.Encoder=Ba,a.FLOAT32_OPTIONS=ja,a.NEVER=Fa,a.Packr=Ba,a.REUSE_BUFFER_MODE=Ja,a.Unpackr=U,a.addExtension=y,a.clearSource=r,a.decode=ia,a.decodeIter=function(a,b={}){if(!a||"object"!=typeof a)throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a promise");const c=new U(b);let d;const e=a=>{let b;// if there's incomplete data from previous chunk, concatinate and try again
76
+ d&&(a=Buffer.concat([d,a]),d=void 0);try{b=c.unpackMultiple(a)}catch(c){if(c.incomplete)d=a.slice(c.lastPosition),b=c.values;else throw c}return b};if("function"==typeof a[Symbol.iterator])return function*(){for(const b of a)yield*e(b)}();return"function"==typeof a[Symbol.asyncIterator]?async function*(){for await(const b of a)yield*e(b)}():void 0},a.encode=Ea,a.encodeIter=/**
77
77
  * Given an Iterable first argument, returns an Iterable where each value is packed as a Buffer
78
78
  * If the argument is only Async Iterable, the return value will be an Async Iterable.
79
79
  * @param {Iterable|Iterator|AsyncIterable|AsyncIterator} objectIterator - iterable source, like a Readable object stream, an array, Set, or custom object
80
80
  * @param {options} [options] - msgpackr pack options
81
81
  * @returns {IterableIterator|Promise.<AsyncIterableIterator>}
82
- */function(e,t={}){if(!e||"object"!=typeof e)throw new Error("first argument must be an Iterable, Async Iterable, or a Promise for an Async Iterable");else{if("function"==typeof e[Symbol.iterator])return w(e,t);if("function"==typeof e.then||"function"==typeof e[Symbol.asyncIterator])return x(e,t);throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a Promise")}},e.isNativeAccelerationEnabled=!1,e.mapsAsObjects=!0,e.pack=Le,e.roundFloat32=function(e){ce[0]=e;let t=se[(127&ge[3])<<1|ge[2]>>7];return(t*e+(0<e?.5:-.5)>>0)/t},e.unpack=ie,e.unpackMultiple=oe,e.useRecords=!1,Object.defineProperty(e,"__esModule",{value:!0})});
82
+ */function(a,b={}){if(!a||"object"!=typeof a)throw new Error("first argument must be an Iterable, Async Iterable, or a Promise for an Async Iterable");else{if("function"==typeof a[Symbol.iterator])return z(a,b);if("function"==typeof a.then||"function"==typeof a[Symbol.asyncIterator])return A(a,b);throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a Promise")}},a.isNativeAccelerationEnabled=!1,a.mapsAsObjects=!0,a.pack=Da,a.roundFloat32=function(a){la[0]=a;let b=ea[(127&ma[3])<<1|ma[2]>>7];return(b*a+(0<a?.5:-.5)>>0)/b},a.unpack=ga,a.unpackMultiple=ha,a.useRecords=!1,Object.defineProperty(a,"__esModule",{value:!0})});
83
+ //# sourceMappingURL=index.min.js.map