seroval 1.0.2 → 1.0.3

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.
@@ -1,3 +1,3 @@
1
1
  "use strict";var Ie=Object.defineProperty;var ir=Object.getOwnPropertyDescriptor;var ar=Object.getOwnPropertyNames;var lr=Object.prototype.hasOwnProperty;var dr=(n,e)=>{for(var r in e)Ie(n,r,{get:e[r],enumerable:!0})},ur=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ar(e))!lr.call(n,s)&&s!==r&&Ie(n,s,{get:()=>e[s],enumerable:!(t=ir(e,s))||t.enumerable});return n};var cr=n=>ur(Ie({},"__esModule",{value:!0}),n);var _r={};dr(_r,{Feature:()=>b,Serializer:()=>q,compileJSON:()=>Tr,createPlugin:()=>gr,createReference:()=>Te,createStream:()=>E,crossSerialize:()=>Fr,crossSerializeAsync:()=>Dr,crossSerializeStream:()=>Oe,deserialize:()=>Cr,fromCrossJSON:()=>Mr,fromJSON:()=>kr,getCrossReferenceHeader:()=>ze,resolvePlugins:()=>c,serialize:()=>wr,serializeAsync:()=>Pr,toCrossJSON:()=>Vr,toCrossJSONAsync:()=>Br,toCrossJSONStream:()=>jr,toJSON:()=>Or,toJSONAsync:()=>zr});module.exports=cr(_r);var b=(o=>(o[o.AggregateError=1]="AggregateError",o[o.ArrowFunction=2]="ArrowFunction",o[o.ErrorPrototypeStack=4]="ErrorPrototypeStack",o[o.ObjectAssign=8]="ObjectAssign",o[o.BigIntTypedArray=16]="BigIntTypedArray",o))(b||{});function f(n,e){if(!n)throw e}function fr(n){switch(n){case'"':return'\\"';case"\\":return"\\\\";case`
2
2
  `:return"\\n";case"\r":return"\\r";case"\b":return"\\b";case" ":return"\\t";case"\f":return"\\f";case"<":return"\\x3C";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:return}}function u(n){let e="",r=0,t;for(let s=0,o=n.length;s<o;s++)t=fr(n[s]),t&&(e+=n.slice(r,s)+t,r=s+1);return r===0?e=n:e+=n.slice(r),e}function pr(n){switch(n){case"\\\\":return"\\";case'\\"':return'"';case"\\n":return`
3
- `;case"\\r":return"\r";case"\\b":return"\b";case"\\t":return" ";case"\\f":return"\f";case"\\x3C":return"<";case"\\u2028":return"\u2028";case"\\u2029":return"\u2029";default:return n}}function S(n){return n.replace(/(\\\\|\\"|\\n|\\r|\\b|\\t|\\f|\\u2028|\\u2029|\\x3C)/g,pr)}var x="__SEROVAL_REFS__",K="$R",Z=`self.${K}`;function ze(n){return n==null?`${Z}=${Z}||[]`:`(${Z}=${Z}||{})["${u(n)}"]=[]`}var Ee=new Map,A=new Map;function Te(n,e){return Ee.set(e,n),A.set(n,e),e}function X(n){return Ee.has(n)}function mr(n){return A.has(n)}function ke(n){return f(X(n),new Error("Missing reference id")),Ee.get(n)}function Fe(n){return f(mr(n),new Error("Missing reference for id:"+n)),A.get(n)}typeof globalThis!="undefined"?Object.defineProperty(globalThis,x,{value:A,configurable:!0,writable:!1,enumerable:!1}):typeof window!="undefined"?Object.defineProperty(window,x,{value:A,configurable:!0,writable:!1,enumerable:!1}):typeof self!="undefined"?Object.defineProperty(self,x,{value:A,configurable:!0,writable:!1,enumerable:!1}):typeof global!="undefined"&&Object.defineProperty(global,x,{value:A,configurable:!0,writable:!1,enumerable:!1});function gr(n){return n}function De(n,e){for(let r=0,t=e.length;r<t;r++){let s=e[r];n.has(s)||(n.add(s),s.extends&&De(n,s.extends))}}function c(n){if(n){let e=new Set;return De(e,n),[...e]}}var{toString:Sr}=Object.prototype,p=class extends Error{constructor(r){super('Unsupported type "'+Sr.call(r)+'"');this.value=r}};var Ve={0:"Symbol.asyncIterator",1:"Symbol.hasInstance",2:"Symbol.isConcatSpreadable",3:"Symbol.iterator",4:"Symbol.match",5:"Symbol.matchAll",6:"Symbol.replace",7:"Symbol.search",8:"Symbol.species",9:"Symbol.split",10:"Symbol.toPrimitive",11:"Symbol.toStringTag",12:"Symbol.unscopables"},L={[Symbol.asyncIterator]:0,[Symbol.hasInstance]:1,[Symbol.isConcatSpreadable]:2,[Symbol.iterator]:3,[Symbol.match]:4,[Symbol.matchAll]:5,[Symbol.replace]:6,[Symbol.search]:7,[Symbol.species]:8,[Symbol.split]:9,[Symbol.toPrimitive]:10,[Symbol.toStringTag]:11,[Symbol.unscopables]:12},Be={0:Symbol.asyncIterator,1:Symbol.hasInstance,2:Symbol.isConcatSpreadable,3:Symbol.iterator,4:Symbol.match,5:Symbol.matchAll,6:Symbol.replace,7:Symbol.search,8:Symbol.species,9:Symbol.split,10:Symbol.toPrimitive,11:Symbol.toStringTag,12:Symbol.unscopables},je={2:"!0",3:"!1",1:"void 0",0:"null",4:"-0",5:"1/0",6:"-1/0",7:"0/0"},Me={2:!0,3:!1,1:void 0,0:null,4:-0,5:1/0,6:-1/0,7:NaN};var Q={0:"Error",1:"EvalError",2:"RangeError",3:"ReferenceError",4:"SyntaxError",5:"TypeError",6:"URIError"},_e={0:Error,1:EvalError,2:RangeError,3:ReferenceError,4:SyntaxError,5:TypeError,6:URIError};function h(n){return{t:2,i:void 0,s:n,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}var y=h(2),v=h(3),ee=h(1),re=h(0),Ue=h(4),We=h(5),Ke=h(6),Le=h(7);function te(n){return n instanceof EvalError?1:n instanceof RangeError?2:n instanceof ReferenceError?3:n instanceof SyntaxError?4:n instanceof TypeError?5:n instanceof URIError?6:0}function hr(n){let e=Q[te(n)];return n.name!==e?{name:n.name}:n.constructor.name!==e?{name:n.constructor.name}:{}}function z(n,e){let r=hr(n),t=Object.getOwnPropertyNames(n);for(let s=0,o=t.length,i;s<o;s++)i=t[s],i!=="name"&&i!=="message"&&(i==="stack"?e&4&&(r=r||{},r[i]=n[i]):(r=r||{},r[i]=n[i]));return r}function ne(n){return Object.isFrozen(n)?3:Object.isSealed(n)?2:Object.isExtensible(n)?0:1}function se(n){switch(n){case 1/0:return We;case-1/0:return Ke}return n!==n?Le:Object.is(n,-0)?Ue:{t:0,i:void 0,s:n,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function N(n){return{t:1,i:void 0,s:u(n),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function oe(n){return{t:3,i:void 0,s:""+n,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Ye(n){return{t:4,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function ie(n,e){return{t:5,i:n,s:e.toISOString(),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:void 0,b:void 0,o:void 0}}function ae(n,e){return{t:6,i:n,s:void 0,l:void 0,c:u(e.source),m:e.flags,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function le(n,e){let r=new Uint8Array(e),t=r.length,s=new Array(t);for(let o=0;o<t;o++)s[o]=r[o];return{t:19,i:n,s,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Ge(n,e){return f(e in L,new Error("Only well-known symbols are supported.")),{t:17,i:n,s:L[e],l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Re(n,e){return{t:18,i:n,s:u(ke(e)),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function T(n,e,r){return{t:25,i:n,s:r,l:void 0,c:u(e),m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function de(n,e,r){return{t:9,i:n,s:void 0,l:e.length,c:void 0,m:void 0,p:void 0,e:void 0,a:r,f:void 0,b:void 0,o:ne(e)}}function ue(n,e){return{t:21,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function ce(n,e,r){return{t:15,i:n,s:void 0,l:e.length,c:e.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:e.byteOffset,o:void 0}}function fe(n,e,r){return{t:16,i:n,s:void 0,l:e.length,c:e.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:e.byteOffset,o:void 0}}function pe(n,e,r){return{t:20,i:n,s:void 0,l:e.byteLength,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:e.byteOffset,o:void 0}}function me(n,e,r){return{t:13,i:n,s:te(e),l:void 0,c:void 0,m:u(e.message),p:r,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function ge(n,e,r){return{t:14,i:n,s:te(e),l:void 0,c:void 0,m:u(e.message),p:r,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Se(n,e,r){return{t:7,i:n,s:void 0,l:e,c:void 0,m:void 0,p:void 0,e:void 0,a:r,f:void 0,b:void 0,o:void 0}}function k(n,e){return{t:28,i:void 0,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[n,e],f:void 0,b:void 0,o:void 0}}function F(n,e){return{t:30,i:void 0,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[n,e],f:void 0,b:void 0,o:void 0}}function D(n,e,r){return{t:31,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:r,f:e,b:void 0,o:void 0}}function he(n,e){return{t:32,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function ye(n,e){return{t:33,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function ve(n,e){return{t:34,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function V(n){let e=[],r=-1,t=-1,s=n[Symbol.iterator]();for(;;)try{let o=s.next();if(e.push(o.value),o.done){t=e.length-1;break}}catch(o){r=e.length,e.push(o)}return{v:e,t:r,d:t}}function He(n){return()=>{let e=0;return{[Symbol.iterator](){return this},next(){if(e>n.d)return{done:!0,value:void 0};let r=e++,t=n.v[r];if(r===n.t)throw t;return{done:r===n.d,value:t}}}}}var $e={},qe={};var Ze={0:{},1:{},2:{},3:{},4:{}};var B=class{constructor(e){this.marked=new Set;this.plugins=e.plugins,this.features=31^(e.disabledFeatures||0),this.refs=e.refs||new Map}markRef(e){this.marked.add(e)}isMarked(e){return this.marked.has(e)}getIndexedValue(e){let r=this.refs.get(e);if(r!=null)return this.markRef(r),{type:1,value:Ye(r)};let t=this.refs.size;return this.refs.set(e,t),{type:0,value:t}}getReference(e){let r=this.getIndexedValue(e);return r.type===1?r:X(e)?{type:2,value:Re(r.value,e)}:r}getStrictReference(e){f(X(e),new Error("Cannot serialize "+typeof e+" without reference ID."));let r=this.getIndexedValue(e);return r.type===1?r.value:Re(r.value,e)}parseFunction(e){return this.getStrictReference(e)}parseWellKnownSymbol(e){let r=this.getReference(e);return r.type!==0?r.value:(f(e in L,new Error("Cannot serialized unsupported symbol.")),Ge(r.value,e))}parseSpecialReference(e){let r=this.getIndexedValue(Ze[e]);return r.type===1?r.value:{t:26,i:r.value,s:e,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}parseIteratorFactory(){let e=this.getIndexedValue($e);return e.type===1?e.value:{t:27,i:e.value,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parseWellKnownSymbol(Symbol.iterator),b:void 0,o:void 0}}parseAsyncIteratorFactory(){let e=this.getIndexedValue(qe);return e.type===1?e.value:{t:29,i:e.value,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(1),this.parseWellKnownSymbol(Symbol.asyncIterator)],f:void 0,b:void 0,o:void 0}}createObjectNode(e,r,t,s){return{t:t?11:10,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:s,e:void 0,a:void 0,f:void 0,b:void 0,o:ne(r)}}createMapNode(e,r,t,s){return{t:8,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:{k:r,v:t,s},a:void 0,f:this.parseSpecialReference(0),b:void 0,o:void 0}}createPromiseConstructorNode(e){return{t:22,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parseSpecialReference(1),b:void 0,o:void 0}}};async function we(n){try{return[1,await n]}catch(e){return[0,e]}}function J(){let n,e;return{promise:new Promise((r,t)=>{n=r,e=t}),resolve(r){n(r)},reject(r){e(r)}}}function be(n){return"__SEROVAL_STREAM__"in n}function E(){let n=new Set,e=[],r=!0,t=!1;function s(a){for(let l of n.keys())l.next(a)}function o(a){for(let l of n.keys())l.throw(a)}function i(a){for(let l of n.keys())l.return(a)}return{__SEROVAL_STREAM__:!0,on(a){r&&n.add(a);for(let l=0,d=e.length;l<d;l++){let g=e[l];l===d-1?t?a.return(g):a.throw(g):a.next(g)}return()=>{r&&n.delete(a)}},next(a){r&&(e.push(a),s(a))},throw(a){r&&(e.push(a),o(a),r=!1,t=!1,n.clear())},return(a){r&&(e.push(a),i(a),r=!1,t=!0,n.clear())}}}function xe(n){let e=E(),r=n[Symbol.asyncIterator]();async function t(){try{let s=await r.next();s.done?e.return(s.value):(e.next(s.value),await t())}catch(s){e.throw(s)}}return t().catch(()=>{}),e}function Xe(n){return()=>{let e=[],r=[],t=0,s=-1,o=!1;function i(){for(let l=0,d=r.length;l<d;l++)r[l].resolve({done:!0,value:void 0})}n.on({next(l){let d=r.shift();d&&d.resolve({done:!1,value:l}),e.push(l)},throw(l){let d=r.shift();d&&d.reject(l),i(),s=e.length,e.push(l),o=!0},return(l){let d=r.shift();d&&d.resolve({done:!0,value:l}),i(),s=e.length,e.push(l)}});function a(){let l=t++,d=e[l];if(l!==s)return{done:!1,value:d};if(o)throw d;return{done:!0,value:d}}return{[Symbol.asyncIterator](){return this},async next(){if(s===-1){let l=t++;if(l>=e.length){let d=J();return r.push(d),await d.promise}return{done:!1,value:e[l]}}return t>s?{done:!0,value:void 0}:a()}}}}var R=class extends B{async parseItems(e){let r=[];for(let t=0,s=e.length;t<s;t++)t in e&&(r[t]=await this.parse(e[t]));return r}async parseArray(e,r){return de(e,r,await this.parseItems(r))}async parseProperties(e){let r=Object.entries(e),t=[],s=[];for(let i=0,a=r.length;i<a;i++)t.push(u(r[i][0])),s.push(await this.parse(r[i][1]));let o=Symbol.iterator;return o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(k(this.parseIteratorFactory(),await this.parse(V(e))))),o=Symbol.asyncIterator,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(F(this.parseAsyncIteratorFactory(),await this.parse(xe(e))))),o=Symbol.toStringTag,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(N(e[o]))),o=Symbol.isConcatSpreadable,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(e[o]?y:v)),{k:t,v:s,s:t.length}}async parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,await this.parseProperties(r))}async parseBoxed(e,r){return ue(e,await this.parse(r.valueOf()))}async parseTypedArray(e,r){return ce(e,r,await this.parse(r.buffer))}async parseBigIntTypedArray(e,r){return fe(e,r,await this.parse(r.buffer))}async parseDataView(e,r){return pe(e,r,await this.parse(r.buffer))}async parseError(e,r){let t=z(r,this.features);return me(e,r,t?await this.parseProperties(t):void 0)}async parseAggregateError(e,r){let t=z(r,this.features);return ge(e,r,t?await this.parseProperties(t):void 0)}async parseMap(e,r){let t=[],s=[];for(let[o,i]of r.entries())t.push(await this.parse(o)),s.push(await this.parse(i));return this.createMapNode(e,t,s,r.size)}async parseSet(e,r){let t=[];for(let s of r.keys())t.push(await this.parse(s));return Se(e,r.size,t)}async parsePromise(e,r){let[t,s]=await we(r);return{t:12,i:e,s:t,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(s),b:void 0,o:void 0}}async parsePlugin(e,r){let t=this.plugins;if(t)for(let s=0,o=t.length;s<o;s++){let i=t[s];if(i.parse.async&&i.test(r))return T(e,i.tag,await i.parse.async(r,this,{id:e}))}}async parseStream(e,r){return D(e,this.parseSpecialReference(4),await new Promise((t,s)=>{let o=[],i=r.on({next:a=>{this.markRef(e),this.parse(a).then(l=>{o.push(he(e,l))},l=>{s(l),i()})},throw:a=>{this.markRef(e),this.parse(a).then(l=>{o.push(ye(e,l)),t(o),i()},l=>{s(l),i()})},return:a=>{this.markRef(e),this.parse(a).then(l=>{o.push(ve(e,l)),t(o),i()},l=>{s(l),i()})}})}))}async parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);if(be(r))return this.parseStream(e,r);let t=await this.parsePlugin(e,r);if(t)return t;let s=r.constructor;switch(s){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return ie(e,r);case RegExp:return ae(e,r);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return this.parseError(e,r);case Number:case Boolean:case String:case BigInt:return this.parseBoxed(e,r);case ArrayBuffer:return le(e,r);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return this.parseTypedArray(e,r);case DataView:return this.parseDataView(e,r);case Map:return this.parseMap(e,r);case Set:return this.parseSet(e,r);default:break}if(s===Promise||r instanceof Promise)return this.parsePromise(e,r);let o=this.features;if(o&16)switch(s){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(o&1&&typeof AggregateError!="undefined"&&(s===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(Symbol.iterator in r||Symbol.asyncIterator in r)return this.parsePlainObject(e,r,!!s);throw new p(r)}async parse(e){switch(typeof e){case"boolean":return e?y:v;case"undefined":return ee;case"string":return N(e);case"number":return se(e);case"bigint":return oe(e);case"object":{if(e){let r=this.getReference(e);return r.type===0?await this.parseObject(r.value,e):r.value}return re}case"symbol":return this.parseWellKnownSymbol(e);case"function":return this.parseFunction(e);default:throw new p(e)}}};var j=class extends R{constructor(){super(...arguments);this.mode="vanilla"}};function Qe(n){switch(n){case"Int8Array":return Int8Array;case"Int16Array":return Int16Array;case"Int32Array":return Int32Array;case"Uint8Array":return Uint8Array;case"Uint16Array":return Uint16Array;case"Uint32Array":return Uint32Array;case"Uint8ClampedArray":return Uint8ClampedArray;case"Float32Array":return Float32Array;case"Float64Array":return Float64Array;case"BigInt64Array":return BigInt64Array;case"BigUint64Array":return BigUint64Array;default:throw new Error(`Unknown TypedArray "${n}"`)}}function er(n,e){switch(e){case 3:return Object.freeze(n);case 1:return Object.preventExtensions(n);case 2:return Object.seal(n);default:return n}}var w=class{constructor(e){this.plugins=e.plugins,this.refs=e.refs||new Map}deserializeReference(e){return this.assignIndexedValue(e.i,Fe(S(e.s)))}deserializeArray(e){let r=e.l,t=this.assignIndexedValue(e.i,new Array(r)),s;for(let o=0;o<r;o++)s=e.a[o],s&&(t[o]=this.deserialize(s));return er(t,e.o),t}deserializeProperties(e,r){let t=e.s;if(t){let s=e.k,o=e.v;for(let i=0,a;i<t;i++)a=s[i],typeof a=="string"?r[S(a)]=this.deserialize(o[i]):r[this.deserialize(a)]=this.deserialize(o[i])}return r}deserializeObject(e){let r=this.assignIndexedValue(e.i,e.t===10?{}:Object.create(null));return this.deserializeProperties(e.p,r),er(r,e.o),r}deserializeDate(e){return this.assignIndexedValue(e.i,new Date(e.s))}deserializeRegExp(e){return this.assignIndexedValue(e.i,new RegExp(S(e.c),e.m))}deserializeSet(e){let r=this.assignIndexedValue(e.i,new Set),t=e.a;for(let s=0,o=e.l;s<o;s++)r.add(this.deserialize(t[s]));return r}deserializeMap(e){let r=this.assignIndexedValue(e.i,new Map),t=e.e.k,s=e.e.v;for(let o=0,i=e.e.s;o<i;o++)r.set(this.deserialize(t[o]),this.deserialize(s[o]));return r}deserializeArrayBuffer(e){let r=new Uint8Array(e.s);return this.assignIndexedValue(e.i,r.buffer)}deserializeTypedArray(e){let r=Qe(e.c),t=this.deserialize(e.f);return this.assignIndexedValue(e.i,new r(t,e.b,e.l))}deserializeDataView(e){let r=this.deserialize(e.f);return this.assignIndexedValue(e.i,new DataView(r,e.b,e.l))}deserializeDictionary(e,r){if(e.p){let t=this.deserializeProperties(e.p,{});Object.assign(r,t)}return r}deserializeAggregateError(e){let r=this.assignIndexedValue(e.i,new AggregateError([],S(e.m)));return this.deserializeDictionary(e,r)}deserializeError(e){let r=_e[e.s],t=this.assignIndexedValue(e.i,new r(S(e.m)));return this.deserializeDictionary(e,t)}deserializePromise(e){let r=J(),t=this.assignIndexedValue(e.i,r),s=this.deserialize(e.f);return e.s?r.resolve(s):r.reject(s),t.promise}deserializeBoxed(e){return this.assignIndexedValue(e.i,Object(this.deserialize(e.f)))}deserializePlugin(e){let r=this.plugins;if(r){let t=S(e.c);for(let s=0,o=r.length;s<o;s++){let i=r[s];if(i.tag===t)return this.assignIndexedValue(e.i,i.deserialize(e.s,this,{id:e.i}))}}throw new Error('Missing plugin for tag "'+e.c+'".')}deserializePromiseConstructor(e){return this.assignIndexedValue(e.i,J()).promise}deserializePromiseResolve(e){let r=this.refs.get(e.i);f(r,new Error("Missing Promise instance.")),r.resolve(this.deserialize(e.a[1]))}deserializePromiseReject(e){let r=this.refs.get(e.i);f(r,new Error("Missing Promise instance.")),r.reject(this.deserialize(e.a[1]))}deserializeIteratorFactoryInstance(e){this.deserialize(e.a[0]);let r=this.deserialize(e.a[1]);return He(r)}deserializeAsyncIteratorFactoryInstance(e){this.deserialize(e.a[0]);let r=this.deserialize(e.a[1]);return Xe(r)}deserializeStreamConstructor(e){let r=this.assignIndexedValue(e.i,E()),t=e.a.length;if(t)for(let s=0;s<t;s++)this.deserialize(e.a[s]);return r}deserializeStreamNext(e){let r=this.refs.get(e.i);f(r,new Error("Missing Stream instance.")),r.next(this.deserialize(e.f))}deserializeStreamThrow(e){let r=this.refs.get(e.i);f(r,new Error("Missing Stream instance.")),r.throw(this.deserialize(e.f))}deserializeStreamReturn(e){let r=this.refs.get(e.i);f(r,new Error("Missing Stream instance.")),r.return(this.deserialize(e.f))}deserializeIteratorFactory(e){this.deserialize(e.f)}deserializeAsyncIteratorFactory(e){this.deserialize(e.a[1])}deserialize(e){switch(e.t){case 2:return Me[e.s];case 0:return e.s;case 1:return S(e.s);case 3:return BigInt(e.s);case 4:return this.refs.get(e.i);case 18:return this.deserializeReference(e);case 9:return this.deserializeArray(e);case 10:case 11:return this.deserializeObject(e);case 5:return this.deserializeDate(e);case 6:return this.deserializeRegExp(e);case 7:return this.deserializeSet(e);case 8:return this.deserializeMap(e);case 19:return this.deserializeArrayBuffer(e);case 16:case 15:return this.deserializeTypedArray(e);case 20:return this.deserializeDataView(e);case 14:return this.deserializeAggregateError(e);case 13:return this.deserializeError(e);case 12:return this.deserializePromise(e);case 17:return Be[e.s];case 21:return this.deserializeBoxed(e);case 25:return this.deserializePlugin(e);case 22:return this.deserializePromiseConstructor(e);case 23:return this.deserializePromiseResolve(e);case 24:return this.deserializePromiseReject(e);case 28:return this.deserializeIteratorFactoryInstance(e);case 30:return this.deserializeAsyncIteratorFactoryInstance(e);case 31:return this.deserializeStreamConstructor(e);case 32:return this.deserializeStreamNext(e);case 33:return this.deserializeStreamThrow(e);case 34:return this.deserializeStreamReturn(e);case 27:return this.deserializeIteratorFactory(e);case 29:return this.deserializeAsyncIteratorFactory(e);default:throw new Error("invariant")}}};var Y=class extends w{constructor(r){super(r);this.mode="vanilla";this.marked=new Set(r.markedRefs)}assignIndexedValue(r,t){return this.marked.has(r)&&this.refs.set(r,t),t}};var vr=/^[$A-Z_][0-9A-Z_$]*$/i;function Pe(n){let e=n[0];return(e==="$"||e==="_"||e>="A"&&e<="Z"||e>="a"&&e<="z")&&vr.test(n)}function G(n){switch(n.t){case 0:return n.s+"="+n.v;case 2:return n.s+".set("+n.k+","+n.v+")";case 1:return n.s+".add("+n.v+")";case 3:return n.s+".delete("+n.k+")"}}function Nr(n){let e=[],r=n[0];for(let t=1,s=n.length,o,i=r;t<s;t++)o=n[t],o.t===0&&o.v===i.v?r={t:0,s:o.s,k:void 0,v:G(r)}:o.t===2&&o.s===i.s?r={t:2,s:G(r),k:o.k,v:o.v}:o.t===1&&o.s===i.s?r={t:1,s:G(r),k:void 0,v:o.v}:o.t===3&&o.s===i.s?r={t:3,s:G(r),k:o.k,v:void 0}:(e.push(r),r=o),i=o;return e.push(r),e}function rr(n){if(n.length){let e="",r=Nr(n);for(let t=0,s=r.length;t<s;t++)e+=G(r[t])+",";return e}}var br="Object.create(null)",xr="new Set",Ar="new Map",Ir="Promise.resolve",Er="Promise.reject",Rr={3:"Object.freeze",2:"Object.seal",1:"Object.preventExtensions",0:void 0},P=class{constructor(e){this.stack=[];this.flags=[];this.assignments=[];this.plugins=e.plugins,this.features=e.features,this.marked=new Set(e.markedRefs)}createFunction(e,r){return this.features&2?(e.length===1?e[0]:"("+e.join(",")+")")+"=>"+r:"function("+e.join(",")+"){return "+r+"}"}createEffectfulFunction(e,r){return this.features&2?(e.length===1?e[0]:"("+e.join(",")+")")+"=>{"+r+"}":"function("+e.join(",")+"){"+r+"}"}markRef(e){this.marked.add(e)}isMarked(e){return this.marked.has(e)}pushObjectFlag(e,r){e!==0&&(this.markRef(r),this.flags.push({type:e,value:this.getRefParam(r)}))}resolveFlags(){let e="";for(let r=0,t=this.flags,s=t.length;r<s;r++){let o=t[r];e+=Rr[o.type]+"("+o.value+"),"}return e}resolvePatches(){let e=rr(this.assignments),r=this.resolveFlags();return e?r?e+r:e:r}createAssignment(e,r){this.assignments.push({t:0,s:e,k:void 0,v:r})}createAddAssignment(e,r){this.assignments.push({t:1,s:this.getRefParam(e),k:void 0,v:r})}createSetAssignment(e,r,t){this.assignments.push({t:2,s:this.getRefParam(e),k:r,v:t})}createDeleteAssignment(e,r){this.assignments.push({t:3,s:this.getRefParam(e),k:r,v:void 0})}createArrayAssign(e,r,t){this.createAssignment(this.getRefParam(e)+"["+r+"]",t)}createObjectAssign(e,r,t){this.createAssignment(this.getRefParam(e)+"."+r,t)}isIndexedValueInStack(e){return e.t===4&&this.stack.includes(e.i)}serializeReference(e){return this.assignIndexedValue(e.i,x+'.get("'+e.s+'")')}serializeArrayItem(e,r,t){return r?this.isIndexedValueInStack(r)?(this.markRef(e),this.createArrayAssign(e,t,this.getRefParam(r.i)),""):this.serialize(r):""}serializeArray(e){let r=e.i;if(e.l){this.stack.push(r);let t=e.a,s=this.serializeArrayItem(r,t[0],0),o=s==="";for(let i=1,a=e.l,l;i<a;i++)l=this.serializeArrayItem(r,t[i],i),s+=","+l,o=l==="";return this.stack.pop(),this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(r,"["+s+(o?",]":"]"))}return this.assignIndexedValue(r,"[]")}serializeProperty(e,r,t){if(typeof r=="string"){let s=Number(r),o=s>=0||Pe(r);if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);return this.markRef(e.i),o&&s!==s?this.createObjectAssign(e.i,r,i):this.createArrayAssign(e.i,o?r:'"'+r+'"',i),""}return(o?r:'"'+r+'"')+":"+this.serialize(t)}return"["+this.serialize(r)+"]:"+this.serialize(t)}serializeProperties(e,r){let t=r.s;if(t){let s=r.k,o=r.v;this.stack.push(e.i);let i=this.serializeProperty(e,s[0],o[0]);for(let a=1,l=i;a<t;a++)l=this.serializeProperty(e,s[a],o[a]),i+=(l&&i&&",")+l;return this.stack.pop(),"{"+i+"}"}return"{}"}serializeObject(e){return this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(e.i,this.serializeProperties(e,e.p))}serializeWithObjectAssign(e,r,t){let s=this.serializeProperties(e,r);return s!=="{}"?"Object.assign("+t+","+s+")":t}serializeStringKeyAssignment(e,r,t,s){let o=this.serialize(s),i=Number(t),a=i>=0||Pe(t);if(this.isIndexedValueInStack(s))a&&i!==i?this.createObjectAssign(e.i,t,o):this.createArrayAssign(e.i,a?t:'"'+t+'"',o);else{let l=this.assignments;this.assignments=r,a?this.createObjectAssign(e.i,t,o):this.createArrayAssign(e.i,a?t:'"'+t+'"',o),this.assignments=l}}serializeAssignment(e,r,t,s){if(typeof t=="string")this.serializeStringKeyAssignment(e,r,t,s);else{let o=this.stack;this.stack=[];let i=this.serialize(s);this.stack=o;let a=this.assignments;this.assignments=r,this.createArrayAssign(e.i,this.serialize(t),i),this.assignments=a}}serializeAssignments(e,r){let t=r.s;if(t){let s=[],o=r.k,i=r.v;this.stack.push(e.i);for(let a=0;a<t;a++)this.serializeAssignment(e,s,o[a],i[a]);return this.stack.pop(),rr(s)}}serializeDictionary(e,r){if(e.p)if(this.features&8)r=this.serializeWithObjectAssign(e,e.p,r);else{this.markRef(e.i);let t=this.serializeAssignments(e,e.p);if(t)return"("+this.assignIndexedValue(e.i,r)+","+t+this.getRefParam(e.i)+")"}return this.assignIndexedValue(e.i,r)}serializeNullConstructor(e){return this.pushObjectFlag(e.o,e.i),this.serializeDictionary(e,br)}serializeDate(e){return this.assignIndexedValue(e.i,'new Date("'+e.s+'")')}serializeRegExp(e){return this.assignIndexedValue(e.i,"/"+e.c+"/"+e.m)}serializeSetItem(e,r){return this.isIndexedValueInStack(r)?(this.markRef(e),this.createAddAssignment(e,this.getRefParam(r.i)),""):this.serialize(r)}serializeSet(e){let r=xr,t=e.l,s=e.i;if(t){let o=e.a;this.stack.push(s);let i=this.serializeSetItem(s,o[0]);for(let a=1,l=i;a<t;a++)l=this.serializeSetItem(s,o[a]),i+=(l&&i&&",")+l;this.stack.pop(),i&&(r+="(["+i+"])")}return this.assignIndexedValue(s,r)}serializeMapEntry(e,r,t,s){if(this.isIndexedValueInStack(r)){let o=this.getRefParam(r.i);if(this.markRef(e),this.isIndexedValueInStack(t)){let a=this.getRefParam(t.i);return this.createSetAssignment(e,o,a),""}if(t.t!==4&&t.i!=null&&this.isMarked(t.i)){let a="("+this.serialize(t)+",["+s+","+s+"])";return this.createSetAssignment(e,o,this.getRefParam(t.i)),this.createDeleteAssignment(e,s),a}let i=this.stack;return this.stack=[],this.createSetAssignment(e,o,this.serialize(t)),this.stack=i,""}if(this.isIndexedValueInStack(t)){let o=this.getRefParam(t.i);if(this.markRef(e),r.t!==4&&r.i!=null&&this.isMarked(r.i)){let a="("+this.serialize(r)+",["+s+","+s+"])";return this.createSetAssignment(e,this.getRefParam(r.i),o),this.createDeleteAssignment(e,s),a}let i=this.stack;return this.stack=[],this.createSetAssignment(e,this.serialize(r),o),this.stack=i,""}return"["+this.serialize(r)+","+this.serialize(t)+"]"}serializeMap(e){let r=Ar,t=e.e.s,s=e.i,o=e.f,i=this.getRefParam(o.i);if(t){let a=e.e.k,l=e.e.v;this.stack.push(s);let d=this.serializeMapEntry(s,a[0],l[0],i);for(let g=1,Ae=d;g<t;g++)Ae=this.serializeMapEntry(s,a[g],l[g],i),d+=(Ae&&d&&",")+Ae;this.stack.pop(),d&&(r+="(["+d+"])")}return o.t===26&&(this.markRef(o.i),r="("+this.serialize(o)+","+r+")"),this.assignIndexedValue(s,r)}serializeArrayBuffer(e){let r="new Uint8Array(",t=e.s,s=t.length;if(s){r+="["+t[0];for(let o=1;o<s;o++)r+=","+t[o];r+="]"}return this.assignIndexedValue(e.i,r+").buffer")}serializeTypedArray(e){return this.assignIndexedValue(e.i,"new "+e.c+"("+this.serialize(e.f)+","+e.b+","+e.l+")")}serializeDataView(e){return this.assignIndexedValue(e.i,"new DataView("+this.serialize(e.f)+","+e.b+","+e.l+")")}serializeAggregateError(e){let r=e.i;this.stack.push(r);let t=this.serializeDictionary(e,'new AggregateError([],"'+e.m+'")');return this.stack.pop(),t}serializeError(e){return this.serializeDictionary(e,"new "+Q[e.s]+'("'+e.m+'")')}serializePromise(e){let r,t=e.f,s=e.i,o=e.s?Ir:Er;if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);r=o+(e.s?"().then("+this.createFunction([],i)+")":"().catch("+this.createEffectfulFunction([],"throw "+i)+")")}else{this.stack.push(s);let i=this.serialize(t);this.stack.pop(),r=o+"("+i+")"}return this.assignIndexedValue(s,r)}serializeWellKnownSymbol(e){return this.assignIndexedValue(e.i,Ve[e.s])}serializeBoxed(e){return this.assignIndexedValue(e.i,"Object("+this.serialize(e.f)+")")}serializePlugin(e){let r=this.plugins;if(r)for(let t=0,s=r.length;t<s;t++){let o=r[t];if(o.tag===e.c)return this.assignIndexedValue(e.i,o.serialize(e.s,this,{id:e.i}))}throw new Error('Missing plugin for tag "'+e.c+'".')}getConstructor(e){let r=this.serialize(e);return r===this.getRefParam(e.i)?r:"("+r+")"}serializePromiseConstructor(e){return this.assignIndexedValue(e.i,this.getConstructor(e.f)+"()")}serializePromiseResolve(e){return this.getConstructor(e.a[0])+"("+this.getRefParam(e.i)+","+this.serialize(e.a[1])+")"}serializePromiseReject(e){return this.getConstructor(e.a[0])+"("+this.getRefParam(e.i)+","+this.serialize(e.a[1])+")"}serializeSpecialReferenceValue(e){switch(e){case 0:return"[]";case 1:return this.createFunction(["s","f","p"],"((p=new Promise("+this.createEffectfulFunction(["a","b"],"s=a,f=b")+")).s=s,p.f=f,p)");case 2:return this.createEffectfulFunction(["p","d"],'p.s(d),p.status="success",p.value=d;delete p.s;delete p.f');case 3:return this.createEffectfulFunction(["p","d"],'p.f(d),p.status="failure",p.value=d;delete p.s;delete p.f');case 4:return this.createFunction(["b","a","s","l","p","f","e","n"],"(b=[],a=!0,s=!1,l=[],p=0,f="+this.createEffectfulFunction(["v","m","x"],"for(x=0;x<p;x++)l[x]&&l[x][m](v)")+",n="+this.createEffectfulFunction(["o","x","z","c"],'for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))')+",e="+this.createFunction(["o","t"],"(a&&(l[t=p++]=o),n(o),"+this.createEffectfulFunction([],"a&&(l[t]=void 0)")+")")+",{__SEROVAL_STREAM__:!0,on:"+this.createFunction(["o"],"e(o)")+",next:"+this.createEffectfulFunction(["v"],'a&&(b.push(v),f(v,"next"))')+",throw:"+this.createEffectfulFunction(["v"],'a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)')+",return:"+this.createEffectfulFunction(["v"],'a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)')+"})");default:return""}}serializeSpecialReference(e){return this.assignIndexedValue(e.i,this.serializeSpecialReferenceValue(e.s))}serializeIteratorFactory(e){let r="",t=!1;return e.f.t!==4&&(this.markRef(e.f.i),r="("+this.serialize(e.f)+",",t=!0),r+=this.assignIndexedValue(e.i,this.createFunction(["s"],this.createFunction(["i","c","d","t"],"(i=0,t={["+this.getRefParam(e.f.i)+"]:"+this.createFunction([],"t")+",next:"+this.createEffectfulFunction([],"if(i>s.d)return{done:!0,value:void 0};if(d=s.v[c=i++],c===s.t)throw d;return{done:c===s.d,value:d}")+"})"))),t&&(r+=")"),r}serializeIteratorFactoryInstance(e){return this.getConstructor(e.a[0])+"("+this.serialize(e.a[1])+")"}serializeAsyncIteratorFactory(e){let r=e.a[0],t=e.a[1],s="";r.t!==4&&(this.markRef(r.i),s+="("+this.serialize(r)),t.t!==4&&(this.markRef(t.i),s+=(s?",":"(")+this.serialize(t)),s&&(s+=",");let o=this.assignIndexedValue(e.i,this.createFunction(["s"],this.createFunction(["b","c","p","d","e","t","f"],"(b=[],c=0,p=[],d=-1,e=!1,f="+this.createEffectfulFunction(["i","l"],"for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})")+",s.on({next:"+this.createEffectfulFunction(["v","t"],"if(t=p.shift())t.s({done:!1,value:v});b.push(v)")+",throw:"+this.createEffectfulFunction(["v","t"],"if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)")+",return:"+this.createEffectfulFunction(["v","t"],"if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)")+"}),t={["+this.getRefParam(t.i)+"]:"+this.createFunction([],"t")+",next:"+this.createEffectfulFunction(["i","t","v"],"if(d===-1){return((i=c++)>=b.length)?(p.push(t="+this.getRefParam(r.i)+"()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],i!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}")+"})")));return s?s+o+")":o}serializeAsyncIteratorFactoryInstance(e){return this.getConstructor(e.a[0])+"("+this.serialize(e.a[1])+")"}serializeStreamConstructor(e){let r=this.assignIndexedValue(e.i,this.getConstructor(e.f)+"()"),t=e.a.length;if(t){let s=this.serialize(e.a[0]);for(let o=1;o<t;o++)s+=","+this.serialize(e.a[o]);return"("+r+","+s+","+this.getRefParam(e.i)+")"}return r}serializeStreamNext(e){return this.getRefParam(e.i)+".next("+this.serialize(e.f)+")"}serializeStreamThrow(e){return this.getRefParam(e.i)+".throw("+this.serialize(e.f)+")"}serializeStreamReturn(e){return this.getRefParam(e.i)+".return("+this.serialize(e.f)+")"}serialize(e){switch(e.t){case 2:return je[e.s];case 0:return""+e.s;case 1:return'"'+e.s+'"';case 3:return e.s+"n";case 4:return this.getRefParam(e.i);case 18:return this.serializeReference(e);case 9:return this.serializeArray(e);case 10:return this.serializeObject(e);case 11:return this.serializeNullConstructor(e);case 5:return this.serializeDate(e);case 6:return this.serializeRegExp(e);case 7:return this.serializeSet(e);case 8:return this.serializeMap(e);case 19:return this.serializeArrayBuffer(e);case 16:case 15:return this.serializeTypedArray(e);case 20:return this.serializeDataView(e);case 14:return this.serializeAggregateError(e);case 13:return this.serializeError(e);case 12:return this.serializePromise(e);case 17:return this.serializeWellKnownSymbol(e);case 21:return this.serializeBoxed(e);case 22:return this.serializePromiseConstructor(e);case 23:return this.serializePromiseResolve(e);case 24:return this.serializePromiseReject(e);case 25:return this.serializePlugin(e);case 26:return this.serializeSpecialReference(e);case 27:return this.serializeIteratorFactory(e);case 28:return this.serializeIteratorFactoryInstance(e);case 29:return this.serializeAsyncIteratorFactory(e);case 30:return this.serializeAsyncIteratorFactoryInstance(e);case 31:return this.serializeStreamConstructor(e);case 32:return this.serializeStreamNext(e);case 33:return this.serializeStreamThrow(e);case 34:return this.serializeStreamReturn(e);default:throw new Error("invariant")}}};var sr="hjkmoquxzABCDEFGHIJKLNPQRTUVWXYZ$_",tr=sr.length,or="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_",nr=or.length;function Ce(n){let e=n%tr,r=sr[e];for(n=(n-e)/tr;n>0;)e=n%nr,r+=or[e],n=(n-e)/nr;return r}var C=class extends P{constructor(){super(...arguments);this.mode="vanilla";this.valid=new Map;this.vars=[]}getRefParam(r){let t=this.valid.get(r);t==null&&(t=this.valid.size,this.valid.set(r,t));let s=this.vars[t];return s==null&&(s=Ce(t),this.vars[t]=s),s}assignIndexedValue(r,t){return this.isMarked(r)?this.getRefParam(r)+"="+t:t}serializePromiseConstructor(r){throw new Error('Unsupported node type "'+r.t+'".')}serializePromiseResolve(r){throw new Error('Unsupported node type "'+r.t+'".')}serializePromiseReject(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeTop(r){let t=this.serialize(r);if(r.i!=null&&this.vars.length){let s=this.resolvePatches(),o=t;if(s){let i=this.getRefParam(r.i);o=t+","+s+i,t.startsWith(i+"=")||(o=i+"="+o)}return"("+this.createFunction(this.vars,"("+o+")")+")()"}return r.t===10?"("+t+")":t}};var m=class extends B{parseItems(e){let r=[];for(let t=0,s=e.length;t<s;t++)t in e&&(r[t]=this.parse(e[t]));return r}parseArray(e,r){return de(e,r,this.parseItems(r))}parseProperties(e){let r=Object.entries(e),t=[],s=[];for(let i=0,a=r.length;i<a;i++)t.push(u(r[i][0])),s.push(this.parse(r[i][1]));let o=Symbol.iterator;return o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(k(this.parseIteratorFactory(),this.parse(V(e))))),o=Symbol.asyncIterator,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(F(this.parseAsyncIteratorFactory(),this.parse(E())))),o=Symbol.toStringTag,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(N(e[o]))),o=Symbol.isConcatSpreadable,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(e[o]?y:v)),{k:t,v:s,s:t.length}}parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,this.parseProperties(r))}parseBoxed(e,r){return ue(e,this.parse(r.valueOf()))}parseTypedArray(e,r){return ce(e,r,this.parse(r.buffer))}parseBigIntTypedArray(e,r){return fe(e,r,this.parse(r.buffer))}parseDataView(e,r){return pe(e,r,this.parse(r.buffer))}parseError(e,r){let t=z(r,this.features);return me(e,r,t?this.parseProperties(t):void 0)}parseAggregateError(e,r){let t=z(r,this.features);return ge(e,r,t?this.parseProperties(t):void 0)}parseMap(e,r){let t=[],s=[];for(let[o,i]of r.entries())t.push(this.parse(o)),s.push(this.parse(i));return this.createMapNode(e,t,s,r.size)}parseSet(e,r){let t=[];for(let s of r.keys())t.push(this.parse(s));return Se(e,r.size,t)}parsePlugin(e,r){let t=this.plugins;if(t)for(let s=0,o=t.length;s<o;s++){let i=t[s];if(i.parse.sync&&i.test(r))return T(e,i.tag,i.parse.sync(r,this,{id:e}))}}parseStream(e,r){return D(e,this.parseSpecialReference(4),[])}parsePromise(e,r){return this.createPromiseConstructorNode(e)}parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);if(be(r))return this.parseStream(e,r);let t=this.parsePlugin(e,r);if(t)return t;let s=r.constructor;switch(s){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return ie(e,r);case RegExp:return ae(e,r);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return this.parseError(e,r);case Number:case Boolean:case String:case BigInt:return this.parseBoxed(e,r);case ArrayBuffer:return le(e,r);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return this.parseTypedArray(e,r);case DataView:return this.parseDataView(e,r);case Map:return this.parseMap(e,r);case Set:return this.parseSet(e,r);default:break}if(s===Promise||r instanceof Promise)return this.parsePromise(e,r);let o=this.features;if(o&16)switch(s){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(o&1&&typeof AggregateError!="undefined"&&(s===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(Symbol.iterator in r||Symbol.asyncIterator in r)return this.parsePlainObject(e,r,!!s);throw new p(r)}parse(e){switch(typeof e){case"boolean":return e?y:v;case"undefined":return ee;case"string":return N(e);case"number":return se(e);case"bigint":return oe(e);case"object":{if(e){let r=this.getReference(e);return r.type===0?this.parseObject(r.value,e):r.value}return re}case"symbol":return this.parseWellKnownSymbol(e);case"function":return this.parseFunction(e);default:throw new p(e)}}};var M=class extends m{constructor(){super(...arguments);this.mode="vanilla"}};function wr(n,e={}){let r=c(e.plugins),t=new M({plugins:r,disabledFeatures:e.disabledFeatures}),s=t.parse(n);return new C({plugins:r,features:t.features,markedRefs:t.marked}).serializeTop(s)}async function Pr(n,e={}){let r=c(e.plugins),t=new j({plugins:r,disabledFeatures:e.disabledFeatures}),s=await t.parse(n);return new C({plugins:r,features:t.features,markedRefs:t.marked}).serializeTop(s)}function Cr(n){return(0,eval)(n)}function Or(n,e={}){let r=c(e.plugins),t=new M({plugins:r,disabledFeatures:e.disabledFeatures});return{t:t.parse(n),f:t.features,m:Array.from(t.marked)}}async function zr(n,e={}){let r=c(e.plugins),t=new j({plugins:r,disabledFeatures:e.disabledFeatures});return{t:await t.parse(n),f:t.features,m:Array.from(t.marked)}}function Tr(n,e={}){let r=c(e.plugins);return new C({plugins:r,features:n.f,markedRefs:n.m}).serializeTop(n.t)}function kr(n,e={}){let r=c(e.plugins);return new Y({plugins:r,markedRefs:n.m}).deserialize(n.t)}var _=class extends R{constructor(){super(...arguments);this.mode="cross"}};var H=class extends w{constructor(){super(...arguments);this.mode="cross"}assignIndexedValue(r,t){return this.refs.has(r)||this.refs.set(r,t),t}};var O=class extends P{constructor(r){super(r);this.mode="cross";this.scopeId=r.scopeId}getRefParam(r){return K+"["+r+"]"}assignIndexedValue(r,t){return this.getRefParam(r)+"="+t}serializeTop(r){let t=this.serialize(r),s=r.i;if(s==null)return t;let o=this.resolvePatches(),i=this.getRefParam(s),a=this.scopeId==null?"":K,l=o?t+","+o+i:t;if(a==="")return o?"("+l+")":l;let d=this.scopeId==null?"()":"("+K+'["'+u(this.scopeId)+'"])';return"("+this.createFunction([a],l)+")"+d}};var $=class extends m{constructor(r){super(r);this.alive=!0;this.pending=0;this.initial=!0;this.buffer=[];this.onParseCallback=r.onParse,this.onErrorCallback=r.onError,this.onDoneCallback=r.onDone}onParseInternal(r,t){try{this.onParseCallback(r,t)}catch(s){this.onError(s)}}flush(){for(let r=0,t=this.buffer.length;r<t;r++)this.onParseInternal(this.buffer[r],!1)}onParse(r){this.initial?this.buffer.push(r):this.onParseInternal(r,!1)}onError(r){if(this.onErrorCallback)this.onErrorCallback(r);else throw r}onDone(){this.onDoneCallback&&this.onDoneCallback()}pushPendingState(){this.pending++}popPendingState(){--this.pending<=0&&this.onDone()}parseProperties(r){let t=Object.entries(r),s=[],o=[];for(let a=0,l=t.length;a<l;a++)s.push(u(t[a][0])),o.push(this.parse(t[a][1]));let i=Symbol.iterator;return i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(k(this.parseIteratorFactory(),this.parse(V(r))))),i=Symbol.asyncIterator,i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(F(this.parseAsyncIteratorFactory(),this.parse(xe(r))))),i=Symbol.toStringTag,i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(N(r[i]))),i=Symbol.isConcatSpreadable,i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(r[i]?y:v)),{k:s,v:o,s:s.length}}parsePromise(r,t){return t.then(s=>{let o=this.parseWithError(s);o&&this.onParse({t:23,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(2),o],f:void 0,b:void 0,o:void 0}),this.popPendingState()},s=>{if(this.alive){let o=this.parseWithError(s);o&&this.onParse({t:24,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(3),o],f:void 0,b:void 0,o:void 0})}this.popPendingState()}),this.pushPendingState(),this.createPromiseConstructorNode(r)}parsePlugin(r,t){let s=this.plugins;if(s)for(let o=0,i=s.length;o<i;o++){let a=s[o];if(a.parse.stream&&a.test(t))return T(r,a.tag,a.parse.stream(t,this,{id:r}))}}parseStream(r,t){let s=D(r,this.parseSpecialReference(4),[]);return this.pushPendingState(),t.on({next:o=>{if(this.alive){let i=this.parseWithError(o);i&&this.onParse(he(r,i))}},throw:o=>{if(this.alive){let i=this.parseWithError(o);i&&this.onParse(ye(r,i))}this.popPendingState()},return:o=>{if(this.alive){let i=this.parseWithError(o);i&&this.onParse(ve(r,i))}this.popPendingState()}}),s}parseWithError(r){try{return this.parse(r)}catch(t){this.onError(t);return}}start(r){let t=this.parseWithError(r);t&&(this.onParseInternal(t,!0),this.initial=!1,this.flush(),this.pending<=0&&this.destroy())}destroy(){this.alive&&(this.onDone(),this.alive=!1)}isAlive(){return this.alive}};var U=class extends ${constructor(){super(...arguments);this.mode="cross"}};var W=class extends m{constructor(){super(...arguments);this.mode="cross"}};function Fr(n,e={}){let r=c(e.plugins),t=new W({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}),s=t.parse(n);return new O({plugins:r,features:t.features,scopeId:e.scopeId,markedRefs:t.marked}).serializeTop(s)}async function Dr(n,e={}){let r=c(e.plugins),t=new _({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}),s=await t.parse(n);return new O({plugins:r,features:t.features,scopeId:e.scopeId,markedRefs:t.marked}).serializeTop(s)}function Vr(n,e={}){let r=c(e.plugins);return new W({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}async function Br(n,e={}){let r=c(e.plugins);return await new _({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}function Oe(n,e){let r=c(e.plugins),t=new U({plugins:r,refs:e.refs,disabledFeatures:e.disabledFeatures,onParse(s,o){let i=new O({plugins:r,features:t.features,scopeId:e.scopeId,markedRefs:t.marked}),a;try{a=i.serializeTop(s)}catch(l){e.onError&&e.onError(l);return}e.onSerialize(a,o)},onError:e.onError,onDone:e.onDone});return t.start(n),()=>{t.destroy()}}function jr(n,e){let r=c(e.plugins),t=new U({plugins:r,refs:e.refs,disabledFeatures:e.disabledFeatures,onParse:e.onParse,onError:e.onError,onDone:e.onDone});return t.start(n),()=>{t.destroy()}}function Mr(n,e){let r=c(e.plugins);return new H({plugins:r,refs:e.refs}).deserialize(n)}var q=class{constructor(e){this.options=e;this.alive=!0;this.flushed=!1;this.done=!1;this.pending=0;this.cleanups=[];this.refs=new Map;this.keys=new Set;this.ids=0;this.plugins=c(e.plugins)}write(e,r){this.alive&&!this.flushed&&(this.pending++,this.keys.add(e),this.cleanups.push(Oe(r,{plugins:this.plugins,scopeId:this.options.scopeId,refs:this.refs,disabledFeatures:this.options.disabledFeatures,onError:this.options.onError,onSerialize:(t,s)=>{this.alive&&this.options.onData(s?this.options.globalIdentifier+'["'+u(e)+'"]='+t:t)},onDone:()=>{this.alive&&(this.pending--,this.pending<=0&&this.flushed&&!this.done&&this.options.onDone&&(this.options.onDone(),this.done=!0))}})))}getNextID(){for(;this.keys.has(""+this.ids);)this.ids++;return""+this.ids}push(e){let r=this.getNextID();return this.write(r,e),r}flush(){this.alive&&(this.flushed=!0,this.pending<=0&&!this.done&&this.options.onDone&&(this.options.onDone(),this.done=!0))}close(){if(this.alive){for(let e=0,r=this.cleanups.length;e<r;e++)this.cleanups[e]();!this.done&&this.options.onDone&&(this.options.onDone(),this.done=!0),this.alive=!1}}};
3
+ `;case"\\r":return"\r";case"\\b":return"\b";case"\\t":return" ";case"\\f":return"\f";case"\\x3C":return"<";case"\\u2028":return"\u2028";case"\\u2029":return"\u2029";default:return n}}function S(n){return n.replace(/(\\\\|\\"|\\n|\\r|\\b|\\t|\\f|\\u2028|\\u2029|\\x3C)/g,pr)}var x="__SEROVAL_REFS__",K="$R",Z=`self.${K}`;function ze(n){return n==null?`${Z}=${Z}||[]`:`(${Z}=${Z}||{})["${u(n)}"]=[]`}var Ee=new Map,A=new Map;function Te(n,e){return Ee.set(e,n),A.set(n,e),e}function X(n){return Ee.has(n)}function mr(n){return A.has(n)}function ke(n){return f(X(n),new Error("Missing reference id")),Ee.get(n)}function Fe(n){return f(mr(n),new Error("Missing reference for id:"+n)),A.get(n)}typeof globalThis!="undefined"?Object.defineProperty(globalThis,x,{value:A,configurable:!0,writable:!1,enumerable:!1}):typeof window!="undefined"?Object.defineProperty(window,x,{value:A,configurable:!0,writable:!1,enumerable:!1}):typeof self!="undefined"?Object.defineProperty(self,x,{value:A,configurable:!0,writable:!1,enumerable:!1}):typeof global!="undefined"&&Object.defineProperty(global,x,{value:A,configurable:!0,writable:!1,enumerable:!1});function gr(n){return n}function De(n,e){for(let r=0,t=e.length;r<t;r++){let s=e[r];n.has(s)||(n.add(s),s.extends&&De(n,s.extends))}}function c(n){if(n){let e=new Set;return De(e,n),[...e]}}var{toString:Sr}=Object.prototype,p=class extends Error{constructor(r){super('Unsupported type "'+Sr.call(r)+'"');this.value=r}};var Ve={0:"Symbol.asyncIterator",1:"Symbol.hasInstance",2:"Symbol.isConcatSpreadable",3:"Symbol.iterator",4:"Symbol.match",5:"Symbol.matchAll",6:"Symbol.replace",7:"Symbol.search",8:"Symbol.species",9:"Symbol.split",10:"Symbol.toPrimitive",11:"Symbol.toStringTag",12:"Symbol.unscopables"},L={[Symbol.asyncIterator]:0,[Symbol.hasInstance]:1,[Symbol.isConcatSpreadable]:2,[Symbol.iterator]:3,[Symbol.match]:4,[Symbol.matchAll]:5,[Symbol.replace]:6,[Symbol.search]:7,[Symbol.species]:8,[Symbol.split]:9,[Symbol.toPrimitive]:10,[Symbol.toStringTag]:11,[Symbol.unscopables]:12},Be={0:Symbol.asyncIterator,1:Symbol.hasInstance,2:Symbol.isConcatSpreadable,3:Symbol.iterator,4:Symbol.match,5:Symbol.matchAll,6:Symbol.replace,7:Symbol.search,8:Symbol.species,9:Symbol.split,10:Symbol.toPrimitive,11:Symbol.toStringTag,12:Symbol.unscopables},je={2:"!0",3:"!1",1:"void 0",0:"null",4:"-0",5:"1/0",6:"-1/0",7:"0/0"},Me={2:!0,3:!1,1:void 0,0:null,4:-0,5:1/0,6:-1/0,7:NaN};var Q={0:"Error",1:"EvalError",2:"RangeError",3:"ReferenceError",4:"SyntaxError",5:"TypeError",6:"URIError"},_e={0:Error,1:EvalError,2:RangeError,3:ReferenceError,4:SyntaxError,5:TypeError,6:URIError};function h(n){return{t:2,i:void 0,s:n,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}var y=h(2),v=h(3),ee=h(1),re=h(0),Ue=h(4),We=h(5),Ke=h(6),Le=h(7);function te(n){return n instanceof EvalError?1:n instanceof RangeError?2:n instanceof ReferenceError?3:n instanceof SyntaxError?4:n instanceof TypeError?5:n instanceof URIError?6:0}function hr(n){let e=Q[te(n)];return n.name!==e?{name:n.name}:n.constructor.name!==e?{name:n.constructor.name}:{}}function z(n,e){let r=hr(n),t=Object.getOwnPropertyNames(n);for(let s=0,o=t.length,i;s<o;s++)i=t[s],i!=="name"&&i!=="message"&&(i==="stack"?e&4&&(r=r||{},r[i]=n[i]):(r=r||{},r[i]=n[i]));return r}function ne(n){return Object.isFrozen(n)?3:Object.isSealed(n)?2:Object.isExtensible(n)?0:1}function se(n){switch(n){case 1/0:return We;case-1/0:return Ke}return n!==n?Le:Object.is(n,-0)?Ue:{t:0,i:void 0,s:n,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function N(n){return{t:1,i:void 0,s:u(n),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function oe(n){return{t:3,i:void 0,s:""+n,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Ye(n){return{t:4,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function ie(n,e){return{t:5,i:n,s:e.toISOString(),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:void 0,b:void 0,o:void 0}}function ae(n,e){return{t:6,i:n,s:void 0,l:void 0,c:u(e.source),m:e.flags,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function le(n,e){let r=new Uint8Array(e),t=r.length,s=new Array(t);for(let o=0;o<t;o++)s[o]=r[o];return{t:19,i:n,s,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Ge(n,e){return f(e in L,new Error("Only well-known symbols are supported.")),{t:17,i:n,s:L[e],l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Re(n,e){return{t:18,i:n,s:u(ke(e)),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function T(n,e,r){return{t:25,i:n,s:r,l:void 0,c:u(e),m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function de(n,e,r){return{t:9,i:n,s:void 0,l:e.length,c:void 0,m:void 0,p:void 0,e:void 0,a:r,f:void 0,b:void 0,o:ne(e)}}function ue(n,e){return{t:21,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function ce(n,e,r){return{t:15,i:n,s:void 0,l:e.length,c:e.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:e.byteOffset,o:void 0}}function fe(n,e,r){return{t:16,i:n,s:void 0,l:e.length,c:e.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:e.byteOffset,o:void 0}}function pe(n,e,r){return{t:20,i:n,s:void 0,l:e.byteLength,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:e.byteOffset,o:void 0}}function me(n,e,r){return{t:13,i:n,s:te(e),l:void 0,c:void 0,m:u(e.message),p:r,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function ge(n,e,r){return{t:14,i:n,s:te(e),l:void 0,c:void 0,m:u(e.message),p:r,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Se(n,e,r){return{t:7,i:n,s:void 0,l:e,c:void 0,m:void 0,p:void 0,e:void 0,a:r,f:void 0,b:void 0,o:void 0}}function k(n,e){return{t:28,i:void 0,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[n,e],f:void 0,b:void 0,o:void 0}}function F(n,e){return{t:30,i:void 0,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[n,e],f:void 0,b:void 0,o:void 0}}function D(n,e,r){return{t:31,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:r,f:e,b:void 0,o:void 0}}function he(n,e){return{t:32,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function ye(n,e){return{t:33,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function ve(n,e){return{t:34,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function V(n){let e=[],r=-1,t=-1,s=n[Symbol.iterator]();for(;;)try{let o=s.next();if(e.push(o.value),o.done){t=e.length-1;break}}catch(o){r=e.length,e.push(o)}return{v:e,t:r,d:t}}function He(n){return()=>{let e=0;return{[Symbol.iterator](){return this},next(){if(e>n.d)return{done:!0,value:void 0};let r=e++,t=n.v[r];if(r===n.t)throw t;return{done:r===n.d,value:t}}}}}var $e={},qe={};var Ze={0:{},1:{},2:{},3:{},4:{}};var B=class{constructor(e){this.marked=new Set;this.plugins=e.plugins,this.features=31^(e.disabledFeatures||0),this.refs=e.refs||new Map}markRef(e){this.marked.add(e)}isMarked(e){return this.marked.has(e)}getIndexedValue(e){let r=this.refs.get(e);if(r!=null)return this.markRef(r),{type:1,value:Ye(r)};let t=this.refs.size;return this.refs.set(e,t),{type:0,value:t}}getReference(e){let r=this.getIndexedValue(e);return r.type===1?r:X(e)?{type:2,value:Re(r.value,e)}:r}getStrictReference(e){f(X(e),new Error("Cannot serialize "+typeof e+" without reference ID."));let r=this.getIndexedValue(e);return r.type===1?r.value:Re(r.value,e)}parseFunction(e){return this.getStrictReference(e)}parseWellKnownSymbol(e){let r=this.getReference(e);return r.type!==0?r.value:(f(e in L,new Error("Cannot serialized unsupported symbol.")),Ge(r.value,e))}parseSpecialReference(e){let r=this.getIndexedValue(Ze[e]);return r.type===1?r.value:{t:26,i:r.value,s:e,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}parseIteratorFactory(){let e=this.getIndexedValue($e);return e.type===1?e.value:{t:27,i:e.value,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parseWellKnownSymbol(Symbol.iterator),b:void 0,o:void 0}}parseAsyncIteratorFactory(){let e=this.getIndexedValue(qe);return e.type===1?e.value:{t:29,i:e.value,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(1),this.parseWellKnownSymbol(Symbol.asyncIterator)],f:void 0,b:void 0,o:void 0}}createObjectNode(e,r,t,s){return{t:t?11:10,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:s,e:void 0,a:void 0,f:void 0,b:void 0,o:ne(r)}}createMapNode(e,r,t,s){return{t:8,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:{k:r,v:t,s},a:void 0,f:this.parseSpecialReference(0),b:void 0,o:void 0}}createPromiseConstructorNode(e){return{t:22,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parseSpecialReference(1),b:void 0,o:void 0}}};async function we(n){try{return[1,await n]}catch(e){return[0,e]}}function J(){let n,e;return{promise:new Promise((r,t)=>{n=r,e=t}),resolve(r){n(r)},reject(r){e(r)}}}function be(n){return"__SEROVAL_STREAM__"in n}function E(){let n=new Set,e=[],r=!0,t=!1;function s(a){for(let l of n.keys())l.next(a)}function o(a){for(let l of n.keys())l.throw(a)}function i(a){for(let l of n.keys())l.return(a)}return{__SEROVAL_STREAM__:!0,on(a){r&&n.add(a);for(let l=0,d=e.length;l<d;l++){let g=e[l];l===d-1?t?a.return(g):a.throw(g):a.next(g)}return()=>{r&&n.delete(a)}},next(a){r&&(e.push(a),s(a))},throw(a){r&&(e.push(a),o(a),r=!1,t=!1,n.clear())},return(a){r&&(e.push(a),i(a),r=!1,t=!0,n.clear())}}}function xe(n){let e=E(),r=n[Symbol.asyncIterator]();async function t(){try{let s=await r.next();s.done?e.return(s.value):(e.next(s.value),await t())}catch(s){e.throw(s)}}return t().catch(()=>{}),e}function Xe(n){return()=>{let e=[],r=[],t=0,s=-1,o=!1;function i(){for(let l=0,d=r.length;l<d;l++)r[l].resolve({done:!0,value:void 0})}n.on({next(l){let d=r.shift();d&&d.resolve({done:!1,value:l}),e.push(l)},throw(l){let d=r.shift();d&&d.reject(l),i(),s=e.length,e.push(l),o=!0},return(l){let d=r.shift();d&&d.resolve({done:!0,value:l}),i(),s=e.length,e.push(l)}});function a(){let l=t++,d=e[l];if(l!==s)return{done:!1,value:d};if(o)throw d;return{done:!0,value:d}}return{[Symbol.asyncIterator](){return this},async next(){if(s===-1){let l=t++;if(l>=e.length){let d=J();return r.push(d),await d.promise}return{done:!1,value:e[l]}}return t>s?{done:!0,value:void 0}:a()}}}}var R=class extends B{async parseItems(e){let r=[];for(let t=0,s=e.length;t<s;t++)t in e&&(r[t]=await this.parse(e[t]));return r}async parseArray(e,r){return de(e,r,await this.parseItems(r))}async parseProperties(e){let r=Object.entries(e),t=[],s=[];for(let i=0,a=r.length;i<a;i++)t.push(u(r[i][0])),s.push(await this.parse(r[i][1]));let o=Symbol.iterator;return o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(k(this.parseIteratorFactory(),await this.parse(V(e))))),o=Symbol.asyncIterator,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(F(this.parseAsyncIteratorFactory(),await this.parse(xe(e))))),o=Symbol.toStringTag,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(N(e[o]))),o=Symbol.isConcatSpreadable,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(e[o]?y:v)),{k:t,v:s,s:t.length}}async parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,await this.parseProperties(r))}async parseBoxed(e,r){return ue(e,await this.parse(r.valueOf()))}async parseTypedArray(e,r){return ce(e,r,await this.parse(r.buffer))}async parseBigIntTypedArray(e,r){return fe(e,r,await this.parse(r.buffer))}async parseDataView(e,r){return pe(e,r,await this.parse(r.buffer))}async parseError(e,r){let t=z(r,this.features);return me(e,r,t?await this.parseProperties(t):void 0)}async parseAggregateError(e,r){let t=z(r,this.features);return ge(e,r,t?await this.parseProperties(t):void 0)}async parseMap(e,r){let t=[],s=[];for(let[o,i]of r.entries())t.push(await this.parse(o)),s.push(await this.parse(i));return this.createMapNode(e,t,s,r.size)}async parseSet(e,r){let t=[];for(let s of r.keys())t.push(await this.parse(s));return Se(e,r.size,t)}async parsePromise(e,r){let[t,s]=await we(r);return{t:12,i:e,s:t,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(s),b:void 0,o:void 0}}async parsePlugin(e,r){let t=this.plugins;if(t)for(let s=0,o=t.length;s<o;s++){let i=t[s];if(i.parse.async&&i.test(r))return T(e,i.tag,await i.parse.async(r,this,{id:e}))}}async parseStream(e,r){return D(e,this.parseSpecialReference(4),await new Promise((t,s)=>{let o=[],i=r.on({next:a=>{this.markRef(e),this.parse(a).then(l=>{o.push(he(e,l))},l=>{s(l),i()})},throw:a=>{this.markRef(e),this.parse(a).then(l=>{o.push(ye(e,l)),t(o),i()},l=>{s(l),i()})},return:a=>{this.markRef(e),this.parse(a).then(l=>{o.push(ve(e,l)),t(o),i()},l=>{s(l),i()})}})}))}async parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);if(be(r))return this.parseStream(e,r);let t=await this.parsePlugin(e,r);if(t)return t;let s=r.constructor;switch(s){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return ie(e,r);case RegExp:return ae(e,r);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return this.parseError(e,r);case Number:case Boolean:case String:case BigInt:return this.parseBoxed(e,r);case ArrayBuffer:return le(e,r);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return this.parseTypedArray(e,r);case DataView:return this.parseDataView(e,r);case Map:return this.parseMap(e,r);case Set:return this.parseSet(e,r);default:break}if(s===Promise||r instanceof Promise)return this.parsePromise(e,r);let o=this.features;if(o&16)switch(s){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(o&1&&typeof AggregateError!="undefined"&&(s===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(Symbol.iterator in r||Symbol.asyncIterator in r)return this.parsePlainObject(e,r,!!s);throw new p(r)}async parse(e){switch(typeof e){case"boolean":return e?y:v;case"undefined":return ee;case"string":return N(e);case"number":return se(e);case"bigint":return oe(e);case"object":{if(e){let r=this.getReference(e);return r.type===0?await this.parseObject(r.value,e):r.value}return re}case"symbol":return this.parseWellKnownSymbol(e);case"function":return this.parseFunction(e);default:throw new p(e)}}};var j=class extends R{constructor(){super(...arguments);this.mode="vanilla"}};function Qe(n){switch(n){case"Int8Array":return Int8Array;case"Int16Array":return Int16Array;case"Int32Array":return Int32Array;case"Uint8Array":return Uint8Array;case"Uint16Array":return Uint16Array;case"Uint32Array":return Uint32Array;case"Uint8ClampedArray":return Uint8ClampedArray;case"Float32Array":return Float32Array;case"Float64Array":return Float64Array;case"BigInt64Array":return BigInt64Array;case"BigUint64Array":return BigUint64Array;default:throw new Error(`Unknown TypedArray "${n}"`)}}function er(n,e){switch(e){case 3:return Object.freeze(n);case 1:return Object.preventExtensions(n);case 2:return Object.seal(n);default:return n}}var w=class{constructor(e){this.plugins=e.plugins,this.refs=e.refs||new Map}deserializeReference(e){return this.assignIndexedValue(e.i,Fe(S(e.s)))}deserializeArray(e){let r=e.l,t=this.assignIndexedValue(e.i,new Array(r)),s;for(let o=0;o<r;o++)s=e.a[o],s&&(t[o]=this.deserialize(s));return er(t,e.o),t}deserializeProperties(e,r){let t=e.s;if(t){let s=e.k,o=e.v;for(let i=0,a;i<t;i++)a=s[i],typeof a=="string"?r[S(a)]=this.deserialize(o[i]):r[this.deserialize(a)]=this.deserialize(o[i])}return r}deserializeObject(e){let r=this.assignIndexedValue(e.i,e.t===10?{}:Object.create(null));return this.deserializeProperties(e.p,r),er(r,e.o),r}deserializeDate(e){return this.assignIndexedValue(e.i,new Date(e.s))}deserializeRegExp(e){return this.assignIndexedValue(e.i,new RegExp(S(e.c),e.m))}deserializeSet(e){let r=this.assignIndexedValue(e.i,new Set),t=e.a;for(let s=0,o=e.l;s<o;s++)r.add(this.deserialize(t[s]));return r}deserializeMap(e){let r=this.assignIndexedValue(e.i,new Map),t=e.e.k,s=e.e.v;for(let o=0,i=e.e.s;o<i;o++)r.set(this.deserialize(t[o]),this.deserialize(s[o]));return r}deserializeArrayBuffer(e){let r=new Uint8Array(e.s);return this.assignIndexedValue(e.i,r.buffer)}deserializeTypedArray(e){let r=Qe(e.c),t=this.deserialize(e.f);return this.assignIndexedValue(e.i,new r(t,e.b,e.l))}deserializeDataView(e){let r=this.deserialize(e.f);return this.assignIndexedValue(e.i,new DataView(r,e.b,e.l))}deserializeDictionary(e,r){if(e.p){let t=this.deserializeProperties(e.p,{});Object.assign(r,t)}return r}deserializeAggregateError(e){let r=this.assignIndexedValue(e.i,new AggregateError([],S(e.m)));return this.deserializeDictionary(e,r)}deserializeError(e){let r=_e[e.s],t=this.assignIndexedValue(e.i,new r(S(e.m)));return this.deserializeDictionary(e,t)}deserializePromise(e){let r=J(),t=this.assignIndexedValue(e.i,r),s=this.deserialize(e.f);return e.s?r.resolve(s):r.reject(s),t.promise}deserializeBoxed(e){return this.assignIndexedValue(e.i,Object(this.deserialize(e.f)))}deserializePlugin(e){let r=this.plugins;if(r){let t=S(e.c);for(let s=0,o=r.length;s<o;s++){let i=r[s];if(i.tag===t)return this.assignIndexedValue(e.i,i.deserialize(e.s,this,{id:e.i}))}}throw new Error('Missing plugin for tag "'+e.c+'".')}deserializePromiseConstructor(e){return this.assignIndexedValue(e.i,J()).promise}deserializePromiseResolve(e){let r=this.refs.get(e.i);f(r,new Error("Missing Promise instance.")),r.resolve(this.deserialize(e.a[1]))}deserializePromiseReject(e){let r=this.refs.get(e.i);f(r,new Error("Missing Promise instance.")),r.reject(this.deserialize(e.a[1]))}deserializeIteratorFactoryInstance(e){this.deserialize(e.a[0]);let r=this.deserialize(e.a[1]);return He(r)}deserializeAsyncIteratorFactoryInstance(e){this.deserialize(e.a[0]);let r=this.deserialize(e.a[1]);return Xe(r)}deserializeStreamConstructor(e){let r=this.assignIndexedValue(e.i,E()),t=e.a.length;if(t)for(let s=0;s<t;s++)this.deserialize(e.a[s]);return r}deserializeStreamNext(e){let r=this.refs.get(e.i);f(r,new Error("Missing Stream instance.")),r.next(this.deserialize(e.f))}deserializeStreamThrow(e){let r=this.refs.get(e.i);f(r,new Error("Missing Stream instance.")),r.throw(this.deserialize(e.f))}deserializeStreamReturn(e){let r=this.refs.get(e.i);f(r,new Error("Missing Stream instance.")),r.return(this.deserialize(e.f))}deserializeIteratorFactory(e){this.deserialize(e.f)}deserializeAsyncIteratorFactory(e){this.deserialize(e.a[1])}deserialize(e){switch(e.t){case 2:return Me[e.s];case 0:return e.s;case 1:return S(e.s);case 3:return BigInt(e.s);case 4:return this.refs.get(e.i);case 18:return this.deserializeReference(e);case 9:return this.deserializeArray(e);case 10:case 11:return this.deserializeObject(e);case 5:return this.deserializeDate(e);case 6:return this.deserializeRegExp(e);case 7:return this.deserializeSet(e);case 8:return this.deserializeMap(e);case 19:return this.deserializeArrayBuffer(e);case 16:case 15:return this.deserializeTypedArray(e);case 20:return this.deserializeDataView(e);case 14:return this.deserializeAggregateError(e);case 13:return this.deserializeError(e);case 12:return this.deserializePromise(e);case 17:return Be[e.s];case 21:return this.deserializeBoxed(e);case 25:return this.deserializePlugin(e);case 22:return this.deserializePromiseConstructor(e);case 23:return this.deserializePromiseResolve(e);case 24:return this.deserializePromiseReject(e);case 28:return this.deserializeIteratorFactoryInstance(e);case 30:return this.deserializeAsyncIteratorFactoryInstance(e);case 31:return this.deserializeStreamConstructor(e);case 32:return this.deserializeStreamNext(e);case 33:return this.deserializeStreamThrow(e);case 34:return this.deserializeStreamReturn(e);case 27:return this.deserializeIteratorFactory(e);case 29:return this.deserializeAsyncIteratorFactory(e);default:throw new Error("invariant")}}};var Y=class extends w{constructor(r){super(r);this.mode="vanilla";this.marked=new Set(r.markedRefs)}assignIndexedValue(r,t){return this.marked.has(r)&&this.refs.set(r,t),t}};var vr=/^[$A-Z_][0-9A-Z_$]*$/i;function Pe(n){let e=n[0];return(e==="$"||e==="_"||e>="A"&&e<="Z"||e>="a"&&e<="z")&&vr.test(n)}function G(n){switch(n.t){case 0:return n.s+"="+n.v;case 2:return n.s+".set("+n.k+","+n.v+")";case 1:return n.s+".add("+n.v+")";case 3:return n.s+".delete("+n.k+")"}}function Nr(n){let e=[],r=n[0];for(let t=1,s=n.length,o,i=r;t<s;t++)o=n[t],o.t===0&&o.v===i.v?r={t:0,s:o.s,k:void 0,v:G(r)}:o.t===2&&o.s===i.s?r={t:2,s:G(r),k:o.k,v:o.v}:o.t===1&&o.s===i.s?r={t:1,s:G(r),k:void 0,v:o.v}:o.t===3&&o.s===i.s?r={t:3,s:G(r),k:o.k,v:void 0}:(e.push(r),r=o),i=o;return e.push(r),e}function rr(n){if(n.length){let e="",r=Nr(n);for(let t=0,s=r.length;t<s;t++)e+=G(r[t])+",";return e}}var br="Object.create(null)",xr="new Set",Ar="new Map",Ir="Promise.resolve",Er="Promise.reject",Rr={3:"Object.freeze",2:"Object.seal",1:"Object.preventExtensions",0:void 0},P=class{constructor(e){this.stack=[];this.flags=[];this.assignments=[];this.plugins=e.plugins,this.features=e.features,this.marked=new Set(e.markedRefs)}createFunction(e,r){return this.features&2?(e.length===1?e[0]:"("+e.join(",")+")")+"=>"+r:"function("+e.join(",")+"){return "+r+"}"}createEffectfulFunction(e,r){return this.features&2?(e.length===1?e[0]:"("+e.join(",")+")")+"=>{"+r+"}":"function("+e.join(",")+"){"+r+"}"}markRef(e){this.marked.add(e)}isMarked(e){return this.marked.has(e)}pushObjectFlag(e,r){e!==0&&(this.markRef(r),this.flags.push({type:e,value:this.getRefParam(r)}))}resolveFlags(){let e="";for(let r=0,t=this.flags,s=t.length;r<s;r++){let o=t[r];e+=Rr[o.type]+"("+o.value+"),"}return e}resolvePatches(){let e=rr(this.assignments),r=this.resolveFlags();return e?r?e+r:e:r}createAssignment(e,r){this.assignments.push({t:0,s:e,k:void 0,v:r})}createAddAssignment(e,r){this.assignments.push({t:1,s:this.getRefParam(e),k:void 0,v:r})}createSetAssignment(e,r,t){this.assignments.push({t:2,s:this.getRefParam(e),k:r,v:t})}createDeleteAssignment(e,r){this.assignments.push({t:3,s:this.getRefParam(e),k:r,v:void 0})}createArrayAssign(e,r,t){this.createAssignment(this.getRefParam(e)+"["+r+"]",t)}createObjectAssign(e,r,t){this.createAssignment(this.getRefParam(e)+"."+r,t)}isIndexedValueInStack(e){return e.t===4&&this.stack.includes(e.i)}serializeReference(e){return this.assignIndexedValue(e.i,x+'.get("'+e.s+'")')}serializeArrayItem(e,r,t){return r?this.isIndexedValueInStack(r)?(this.markRef(e),this.createArrayAssign(e,t,this.getRefParam(r.i)),""):this.serialize(r):""}serializeArray(e){let r=e.i;if(e.l){this.stack.push(r);let t=e.a,s=this.serializeArrayItem(r,t[0],0),o=s==="";for(let i=1,a=e.l,l;i<a;i++)l=this.serializeArrayItem(r,t[i],i),s+=","+l,o=l==="";return this.stack.pop(),this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(r,"["+s+(o?",]":"]"))}return this.assignIndexedValue(r,"[]")}serializeProperty(e,r,t){if(typeof r=="string"){let s=Number(r),o=s>=0&&s.toString()===r||Pe(r);if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);return this.markRef(e.i),o&&s!==s?this.createObjectAssign(e.i,r,i):this.createArrayAssign(e.i,o?r:'"'+r+'"',i),""}return(o?r:'"'+r+'"')+":"+this.serialize(t)}return"["+this.serialize(r)+"]:"+this.serialize(t)}serializeProperties(e,r){let t=r.s;if(t){let s=r.k,o=r.v;this.stack.push(e.i);let i=this.serializeProperty(e,s[0],o[0]);for(let a=1,l=i;a<t;a++)l=this.serializeProperty(e,s[a],o[a]),i+=(l&&i&&",")+l;return this.stack.pop(),"{"+i+"}"}return"{}"}serializeObject(e){return this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(e.i,this.serializeProperties(e,e.p))}serializeWithObjectAssign(e,r,t){let s=this.serializeProperties(e,r);return s!=="{}"?"Object.assign("+t+","+s+")":t}serializeStringKeyAssignment(e,r,t,s){let o=this.serialize(s),i=Number(t),a=i>=0&&i.toString()===t||Pe(t);if(this.isIndexedValueInStack(s))a&&i!==i?this.createObjectAssign(e.i,t,o):this.createArrayAssign(e.i,a?t:'"'+t+'"',o);else{let l=this.assignments;this.assignments=r,a&&i!==i?this.createObjectAssign(e.i,t,o):this.createArrayAssign(e.i,a?t:'"'+t+'"',o),this.assignments=l}}serializeAssignment(e,r,t,s){if(typeof t=="string")this.serializeStringKeyAssignment(e,r,t,s);else{let o=this.stack;this.stack=[];let i=this.serialize(s);this.stack=o;let a=this.assignments;this.assignments=r,this.createArrayAssign(e.i,this.serialize(t),i),this.assignments=a}}serializeAssignments(e,r){let t=r.s;if(t){let s=[],o=r.k,i=r.v;this.stack.push(e.i);for(let a=0;a<t;a++)this.serializeAssignment(e,s,o[a],i[a]);return this.stack.pop(),rr(s)}}serializeDictionary(e,r){if(e.p)if(this.features&8)r=this.serializeWithObjectAssign(e,e.p,r);else{this.markRef(e.i);let t=this.serializeAssignments(e,e.p);if(t)return"("+this.assignIndexedValue(e.i,r)+","+t+this.getRefParam(e.i)+")"}return this.assignIndexedValue(e.i,r)}serializeNullConstructor(e){return this.pushObjectFlag(e.o,e.i),this.serializeDictionary(e,br)}serializeDate(e){return this.assignIndexedValue(e.i,'new Date("'+e.s+'")')}serializeRegExp(e){return this.assignIndexedValue(e.i,"/"+e.c+"/"+e.m)}serializeSetItem(e,r){return this.isIndexedValueInStack(r)?(this.markRef(e),this.createAddAssignment(e,this.getRefParam(r.i)),""):this.serialize(r)}serializeSet(e){let r=xr,t=e.l,s=e.i;if(t){let o=e.a;this.stack.push(s);let i=this.serializeSetItem(s,o[0]);for(let a=1,l=i;a<t;a++)l=this.serializeSetItem(s,o[a]),i+=(l&&i&&",")+l;this.stack.pop(),i&&(r+="(["+i+"])")}return this.assignIndexedValue(s,r)}serializeMapEntry(e,r,t,s){if(this.isIndexedValueInStack(r)){let o=this.getRefParam(r.i);if(this.markRef(e),this.isIndexedValueInStack(t)){let a=this.getRefParam(t.i);return this.createSetAssignment(e,o,a),""}if(t.t!==4&&t.i!=null&&this.isMarked(t.i)){let a="("+this.serialize(t)+",["+s+","+s+"])";return this.createSetAssignment(e,o,this.getRefParam(t.i)),this.createDeleteAssignment(e,s),a}let i=this.stack;return this.stack=[],this.createSetAssignment(e,o,this.serialize(t)),this.stack=i,""}if(this.isIndexedValueInStack(t)){let o=this.getRefParam(t.i);if(this.markRef(e),r.t!==4&&r.i!=null&&this.isMarked(r.i)){let a="("+this.serialize(r)+",["+s+","+s+"])";return this.createSetAssignment(e,this.getRefParam(r.i),o),this.createDeleteAssignment(e,s),a}let i=this.stack;return this.stack=[],this.createSetAssignment(e,this.serialize(r),o),this.stack=i,""}return"["+this.serialize(r)+","+this.serialize(t)+"]"}serializeMap(e){let r=Ar,t=e.e.s,s=e.i,o=e.f,i=this.getRefParam(o.i);if(t){let a=e.e.k,l=e.e.v;this.stack.push(s);let d=this.serializeMapEntry(s,a[0],l[0],i);for(let g=1,Ae=d;g<t;g++)Ae=this.serializeMapEntry(s,a[g],l[g],i),d+=(Ae&&d&&",")+Ae;this.stack.pop(),d&&(r+="(["+d+"])")}return o.t===26&&(this.markRef(o.i),r="("+this.serialize(o)+","+r+")"),this.assignIndexedValue(s,r)}serializeArrayBuffer(e){let r="new Uint8Array(",t=e.s,s=t.length;if(s){r+="["+t[0];for(let o=1;o<s;o++)r+=","+t[o];r+="]"}return this.assignIndexedValue(e.i,r+").buffer")}serializeTypedArray(e){return this.assignIndexedValue(e.i,"new "+e.c+"("+this.serialize(e.f)+","+e.b+","+e.l+")")}serializeDataView(e){return this.assignIndexedValue(e.i,"new DataView("+this.serialize(e.f)+","+e.b+","+e.l+")")}serializeAggregateError(e){let r=e.i;this.stack.push(r);let t=this.serializeDictionary(e,'new AggregateError([],"'+e.m+'")');return this.stack.pop(),t}serializeError(e){return this.serializeDictionary(e,"new "+Q[e.s]+'("'+e.m+'")')}serializePromise(e){let r,t=e.f,s=e.i,o=e.s?Ir:Er;if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);r=o+(e.s?"().then("+this.createFunction([],i)+")":"().catch("+this.createEffectfulFunction([],"throw "+i)+")")}else{this.stack.push(s);let i=this.serialize(t);this.stack.pop(),r=o+"("+i+")"}return this.assignIndexedValue(s,r)}serializeWellKnownSymbol(e){return this.assignIndexedValue(e.i,Ve[e.s])}serializeBoxed(e){return this.assignIndexedValue(e.i,"Object("+this.serialize(e.f)+")")}serializePlugin(e){let r=this.plugins;if(r)for(let t=0,s=r.length;t<s;t++){let o=r[t];if(o.tag===e.c)return this.assignIndexedValue(e.i,o.serialize(e.s,this,{id:e.i}))}throw new Error('Missing plugin for tag "'+e.c+'".')}getConstructor(e){let r=this.serialize(e);return r===this.getRefParam(e.i)?r:"("+r+")"}serializePromiseConstructor(e){return this.assignIndexedValue(e.i,this.getConstructor(e.f)+"()")}serializePromiseResolve(e){return this.getConstructor(e.a[0])+"("+this.getRefParam(e.i)+","+this.serialize(e.a[1])+")"}serializePromiseReject(e){return this.getConstructor(e.a[0])+"("+this.getRefParam(e.i)+","+this.serialize(e.a[1])+")"}serializeSpecialReferenceValue(e){switch(e){case 0:return"[]";case 1:return this.createFunction(["s","f","p"],"((p=new Promise("+this.createEffectfulFunction(["a","b"],"s=a,f=b")+")).s=s,p.f=f,p)");case 2:return this.createEffectfulFunction(["p","d"],'p.s(d),p.status="success",p.value=d;delete p.s;delete p.f');case 3:return this.createEffectfulFunction(["p","d"],'p.f(d),p.status="failure",p.value=d;delete p.s;delete p.f');case 4:return this.createFunction(["b","a","s","l","p","f","e","n"],"(b=[],a=!0,s=!1,l=[],p=0,f="+this.createEffectfulFunction(["v","m","x"],"for(x=0;x<p;x++)l[x]&&l[x][m](v)")+",n="+this.createEffectfulFunction(["o","x","z","c"],'for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))')+",e="+this.createFunction(["o","t"],"(a&&(l[t=p++]=o),n(o),"+this.createEffectfulFunction([],"a&&(l[t]=void 0)")+")")+",{__SEROVAL_STREAM__:!0,on:"+this.createFunction(["o"],"e(o)")+",next:"+this.createEffectfulFunction(["v"],'a&&(b.push(v),f(v,"next"))')+",throw:"+this.createEffectfulFunction(["v"],'a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)')+",return:"+this.createEffectfulFunction(["v"],'a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)')+"})");default:return""}}serializeSpecialReference(e){return this.assignIndexedValue(e.i,this.serializeSpecialReferenceValue(e.s))}serializeIteratorFactory(e){let r="",t=!1;return e.f.t!==4&&(this.markRef(e.f.i),r="("+this.serialize(e.f)+",",t=!0),r+=this.assignIndexedValue(e.i,this.createFunction(["s"],this.createFunction(["i","c","d","t"],"(i=0,t={["+this.getRefParam(e.f.i)+"]:"+this.createFunction([],"t")+",next:"+this.createEffectfulFunction([],"if(i>s.d)return{done:!0,value:void 0};if(d=s.v[c=i++],c===s.t)throw d;return{done:c===s.d,value:d}")+"})"))),t&&(r+=")"),r}serializeIteratorFactoryInstance(e){return this.getConstructor(e.a[0])+"("+this.serialize(e.a[1])+")"}serializeAsyncIteratorFactory(e){let r=e.a[0],t=e.a[1],s="";r.t!==4&&(this.markRef(r.i),s+="("+this.serialize(r)),t.t!==4&&(this.markRef(t.i),s+=(s?",":"(")+this.serialize(t)),s&&(s+=",");let o=this.assignIndexedValue(e.i,this.createFunction(["s"],this.createFunction(["b","c","p","d","e","t","f"],"(b=[],c=0,p=[],d=-1,e=!1,f="+this.createEffectfulFunction(["i","l"],"for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})")+",s.on({next:"+this.createEffectfulFunction(["v","t"],"if(t=p.shift())t.s({done:!1,value:v});b.push(v)")+",throw:"+this.createEffectfulFunction(["v","t"],"if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)")+",return:"+this.createEffectfulFunction(["v","t"],"if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)")+"}),t={["+this.getRefParam(t.i)+"]:"+this.createFunction([],"t")+",next:"+this.createEffectfulFunction(["i","t","v"],"if(d===-1){return((i=c++)>=b.length)?(p.push(t="+this.getRefParam(r.i)+"()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],i!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}")+"})")));return s?s+o+")":o}serializeAsyncIteratorFactoryInstance(e){return this.getConstructor(e.a[0])+"("+this.serialize(e.a[1])+")"}serializeStreamConstructor(e){let r=this.assignIndexedValue(e.i,this.getConstructor(e.f)+"()"),t=e.a.length;if(t){let s=this.serialize(e.a[0]);for(let o=1;o<t;o++)s+=","+this.serialize(e.a[o]);return"("+r+","+s+","+this.getRefParam(e.i)+")"}return r}serializeStreamNext(e){return this.getRefParam(e.i)+".next("+this.serialize(e.f)+")"}serializeStreamThrow(e){return this.getRefParam(e.i)+".throw("+this.serialize(e.f)+")"}serializeStreamReturn(e){return this.getRefParam(e.i)+".return("+this.serialize(e.f)+")"}serialize(e){switch(e.t){case 2:return je[e.s];case 0:return""+e.s;case 1:return'"'+e.s+'"';case 3:return e.s+"n";case 4:return this.getRefParam(e.i);case 18:return this.serializeReference(e);case 9:return this.serializeArray(e);case 10:return this.serializeObject(e);case 11:return this.serializeNullConstructor(e);case 5:return this.serializeDate(e);case 6:return this.serializeRegExp(e);case 7:return this.serializeSet(e);case 8:return this.serializeMap(e);case 19:return this.serializeArrayBuffer(e);case 16:case 15:return this.serializeTypedArray(e);case 20:return this.serializeDataView(e);case 14:return this.serializeAggregateError(e);case 13:return this.serializeError(e);case 12:return this.serializePromise(e);case 17:return this.serializeWellKnownSymbol(e);case 21:return this.serializeBoxed(e);case 22:return this.serializePromiseConstructor(e);case 23:return this.serializePromiseResolve(e);case 24:return this.serializePromiseReject(e);case 25:return this.serializePlugin(e);case 26:return this.serializeSpecialReference(e);case 27:return this.serializeIteratorFactory(e);case 28:return this.serializeIteratorFactoryInstance(e);case 29:return this.serializeAsyncIteratorFactory(e);case 30:return this.serializeAsyncIteratorFactoryInstance(e);case 31:return this.serializeStreamConstructor(e);case 32:return this.serializeStreamNext(e);case 33:return this.serializeStreamThrow(e);case 34:return this.serializeStreamReturn(e);default:throw new Error("invariant")}}};var sr="hjkmoquxzABCDEFGHIJKLNPQRTUVWXYZ$_",tr=sr.length,or="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_",nr=or.length;function Ce(n){let e=n%tr,r=sr[e];for(n=(n-e)/tr;n>0;)e=n%nr,r+=or[e],n=(n-e)/nr;return r}var C=class extends P{constructor(){super(...arguments);this.mode="vanilla";this.valid=new Map;this.vars=[]}getRefParam(r){let t=this.valid.get(r);t==null&&(t=this.valid.size,this.valid.set(r,t));let s=this.vars[t];return s==null&&(s=Ce(t),this.vars[t]=s),s}assignIndexedValue(r,t){return this.isMarked(r)?this.getRefParam(r)+"="+t:t}serializePromiseConstructor(r){throw new Error('Unsupported node type "'+r.t+'".')}serializePromiseResolve(r){throw new Error('Unsupported node type "'+r.t+'".')}serializePromiseReject(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeTop(r){let t=this.serialize(r);if(r.i!=null&&this.vars.length){let s=this.resolvePatches(),o=t;if(s){let i=this.getRefParam(r.i);o=t+","+s+i,t.startsWith(i+"=")||(o=i+"="+o)}return"("+this.createFunction(this.vars,"("+o+")")+")()"}return r.t===10?"("+t+")":t}};var m=class extends B{parseItems(e){let r=[];for(let t=0,s=e.length;t<s;t++)t in e&&(r[t]=this.parse(e[t]));return r}parseArray(e,r){return de(e,r,this.parseItems(r))}parseProperties(e){let r=Object.entries(e),t=[],s=[];for(let i=0,a=r.length;i<a;i++)t.push(u(r[i][0])),s.push(this.parse(r[i][1]));let o=Symbol.iterator;return o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(k(this.parseIteratorFactory(),this.parse(V(e))))),o=Symbol.asyncIterator,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(F(this.parseAsyncIteratorFactory(),this.parse(E())))),o=Symbol.toStringTag,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(N(e[o]))),o=Symbol.isConcatSpreadable,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(e[o]?y:v)),{k:t,v:s,s:t.length}}parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,this.parseProperties(r))}parseBoxed(e,r){return ue(e,this.parse(r.valueOf()))}parseTypedArray(e,r){return ce(e,r,this.parse(r.buffer))}parseBigIntTypedArray(e,r){return fe(e,r,this.parse(r.buffer))}parseDataView(e,r){return pe(e,r,this.parse(r.buffer))}parseError(e,r){let t=z(r,this.features);return me(e,r,t?this.parseProperties(t):void 0)}parseAggregateError(e,r){let t=z(r,this.features);return ge(e,r,t?this.parseProperties(t):void 0)}parseMap(e,r){let t=[],s=[];for(let[o,i]of r.entries())t.push(this.parse(o)),s.push(this.parse(i));return this.createMapNode(e,t,s,r.size)}parseSet(e,r){let t=[];for(let s of r.keys())t.push(this.parse(s));return Se(e,r.size,t)}parsePlugin(e,r){let t=this.plugins;if(t)for(let s=0,o=t.length;s<o;s++){let i=t[s];if(i.parse.sync&&i.test(r))return T(e,i.tag,i.parse.sync(r,this,{id:e}))}}parseStream(e,r){return D(e,this.parseSpecialReference(4),[])}parsePromise(e,r){return this.createPromiseConstructorNode(e)}parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);if(be(r))return this.parseStream(e,r);let t=this.parsePlugin(e,r);if(t)return t;let s=r.constructor;switch(s){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return ie(e,r);case RegExp:return ae(e,r);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return this.parseError(e,r);case Number:case Boolean:case String:case BigInt:return this.parseBoxed(e,r);case ArrayBuffer:return le(e,r);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return this.parseTypedArray(e,r);case DataView:return this.parseDataView(e,r);case Map:return this.parseMap(e,r);case Set:return this.parseSet(e,r);default:break}if(s===Promise||r instanceof Promise)return this.parsePromise(e,r);let o=this.features;if(o&16)switch(s){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(o&1&&typeof AggregateError!="undefined"&&(s===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(Symbol.iterator in r||Symbol.asyncIterator in r)return this.parsePlainObject(e,r,!!s);throw new p(r)}parse(e){switch(typeof e){case"boolean":return e?y:v;case"undefined":return ee;case"string":return N(e);case"number":return se(e);case"bigint":return oe(e);case"object":{if(e){let r=this.getReference(e);return r.type===0?this.parseObject(r.value,e):r.value}return re}case"symbol":return this.parseWellKnownSymbol(e);case"function":return this.parseFunction(e);default:throw new p(e)}}};var M=class extends m{constructor(){super(...arguments);this.mode="vanilla"}};function wr(n,e={}){let r=c(e.plugins),t=new M({plugins:r,disabledFeatures:e.disabledFeatures}),s=t.parse(n);return new C({plugins:r,features:t.features,markedRefs:t.marked}).serializeTop(s)}async function Pr(n,e={}){let r=c(e.plugins),t=new j({plugins:r,disabledFeatures:e.disabledFeatures}),s=await t.parse(n);return new C({plugins:r,features:t.features,markedRefs:t.marked}).serializeTop(s)}function Cr(n){return(0,eval)(n)}function Or(n,e={}){let r=c(e.plugins),t=new M({plugins:r,disabledFeatures:e.disabledFeatures});return{t:t.parse(n),f:t.features,m:Array.from(t.marked)}}async function zr(n,e={}){let r=c(e.plugins),t=new j({plugins:r,disabledFeatures:e.disabledFeatures});return{t:await t.parse(n),f:t.features,m:Array.from(t.marked)}}function Tr(n,e={}){let r=c(e.plugins);return new C({plugins:r,features:n.f,markedRefs:n.m}).serializeTop(n.t)}function kr(n,e={}){let r=c(e.plugins);return new Y({plugins:r,markedRefs:n.m}).deserialize(n.t)}var _=class extends R{constructor(){super(...arguments);this.mode="cross"}};var H=class extends w{constructor(){super(...arguments);this.mode="cross"}assignIndexedValue(r,t){return this.refs.has(r)||this.refs.set(r,t),t}};var O=class extends P{constructor(r){super(r);this.mode="cross";this.scopeId=r.scopeId}getRefParam(r){return K+"["+r+"]"}assignIndexedValue(r,t){return this.getRefParam(r)+"="+t}serializeTop(r){let t=this.serialize(r),s=r.i;if(s==null)return t;let o=this.resolvePatches(),i=this.getRefParam(s),a=this.scopeId==null?"":K,l=o?t+","+o+i:t;if(a==="")return o?"("+l+")":l;let d=this.scopeId==null?"()":"("+K+'["'+u(this.scopeId)+'"])';return"("+this.createFunction([a],l)+")"+d}};var $=class extends m{constructor(r){super(r);this.alive=!0;this.pending=0;this.initial=!0;this.buffer=[];this.onParseCallback=r.onParse,this.onErrorCallback=r.onError,this.onDoneCallback=r.onDone}onParseInternal(r,t){try{this.onParseCallback(r,t)}catch(s){this.onError(s)}}flush(){for(let r=0,t=this.buffer.length;r<t;r++)this.onParseInternal(this.buffer[r],!1)}onParse(r){this.initial?this.buffer.push(r):this.onParseInternal(r,!1)}onError(r){if(this.onErrorCallback)this.onErrorCallback(r);else throw r}onDone(){this.onDoneCallback&&this.onDoneCallback()}pushPendingState(){this.pending++}popPendingState(){--this.pending<=0&&this.onDone()}parseProperties(r){let t=Object.entries(r),s=[],o=[];for(let a=0,l=t.length;a<l;a++)s.push(u(t[a][0])),o.push(this.parse(t[a][1]));let i=Symbol.iterator;return i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(k(this.parseIteratorFactory(),this.parse(V(r))))),i=Symbol.asyncIterator,i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(F(this.parseAsyncIteratorFactory(),this.parse(xe(r))))),i=Symbol.toStringTag,i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(N(r[i]))),i=Symbol.isConcatSpreadable,i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(r[i]?y:v)),{k:s,v:o,s:s.length}}parsePromise(r,t){return t.then(s=>{let o=this.parseWithError(s);o&&this.onParse({t:23,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(2),o],f:void 0,b:void 0,o:void 0}),this.popPendingState()},s=>{if(this.alive){let o=this.parseWithError(s);o&&this.onParse({t:24,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(3),o],f:void 0,b:void 0,o:void 0})}this.popPendingState()}),this.pushPendingState(),this.createPromiseConstructorNode(r)}parsePlugin(r,t){let s=this.plugins;if(s)for(let o=0,i=s.length;o<i;o++){let a=s[o];if(a.parse.stream&&a.test(t))return T(r,a.tag,a.parse.stream(t,this,{id:r}))}}parseStream(r,t){let s=D(r,this.parseSpecialReference(4),[]);return this.pushPendingState(),t.on({next:o=>{if(this.alive){let i=this.parseWithError(o);i&&this.onParse(he(r,i))}},throw:o=>{if(this.alive){let i=this.parseWithError(o);i&&this.onParse(ye(r,i))}this.popPendingState()},return:o=>{if(this.alive){let i=this.parseWithError(o);i&&this.onParse(ve(r,i))}this.popPendingState()}}),s}parseWithError(r){try{return this.parse(r)}catch(t){this.onError(t);return}}start(r){let t=this.parseWithError(r);t&&(this.onParseInternal(t,!0),this.initial=!1,this.flush(),this.pending<=0&&this.destroy())}destroy(){this.alive&&(this.onDone(),this.alive=!1)}isAlive(){return this.alive}};var U=class extends ${constructor(){super(...arguments);this.mode="cross"}};var W=class extends m{constructor(){super(...arguments);this.mode="cross"}};function Fr(n,e={}){let r=c(e.plugins),t=new W({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}),s=t.parse(n);return new O({plugins:r,features:t.features,scopeId:e.scopeId,markedRefs:t.marked}).serializeTop(s)}async function Dr(n,e={}){let r=c(e.plugins),t=new _({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}),s=await t.parse(n);return new O({plugins:r,features:t.features,scopeId:e.scopeId,markedRefs:t.marked}).serializeTop(s)}function Vr(n,e={}){let r=c(e.plugins);return new W({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}async function Br(n,e={}){let r=c(e.plugins);return await new _({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}function Oe(n,e){let r=c(e.plugins),t=new U({plugins:r,refs:e.refs,disabledFeatures:e.disabledFeatures,onParse(s,o){let i=new O({plugins:r,features:t.features,scopeId:e.scopeId,markedRefs:t.marked}),a;try{a=i.serializeTop(s)}catch(l){e.onError&&e.onError(l);return}e.onSerialize(a,o)},onError:e.onError,onDone:e.onDone});return t.start(n),()=>{t.destroy()}}function jr(n,e){let r=c(e.plugins),t=new U({plugins:r,refs:e.refs,disabledFeatures:e.disabledFeatures,onParse:e.onParse,onError:e.onError,onDone:e.onDone});return t.start(n),()=>{t.destroy()}}function Mr(n,e){let r=c(e.plugins);return new H({plugins:r,refs:e.refs}).deserialize(n)}var q=class{constructor(e){this.options=e;this.alive=!0;this.flushed=!1;this.done=!1;this.pending=0;this.cleanups=[];this.refs=new Map;this.keys=new Set;this.ids=0;this.plugins=c(e.plugins)}write(e,r){this.alive&&!this.flushed&&(this.pending++,this.keys.add(e),this.cleanups.push(Oe(r,{plugins:this.plugins,scopeId:this.options.scopeId,refs:this.refs,disabledFeatures:this.options.disabledFeatures,onError:this.options.onError,onSerialize:(t,s)=>{this.alive&&this.options.onData(s?this.options.globalIdentifier+'["'+u(e)+'"]='+t:t)},onDone:()=>{this.alive&&(this.pending--,this.pending<=0&&this.flushed&&!this.done&&this.options.onDone&&(this.options.onDone(),this.done=!0))}})))}getNextID(){for(;this.keys.has(""+this.ids);)this.ids++;return""+this.ids}push(e){let r=this.getNextID();return this.write(r,e),r}flush(){this.alive&&(this.flushed=!0,this.pending<=0&&!this.done&&this.options.onDone&&(this.options.onDone(),this.done=!0))}close(){if(this.alive){for(let e=0,r=this.cleanups.length;e<r;e++)this.cleanups[e]();!this.done&&this.options.onDone&&(this.options.onDone(),this.done=!0),this.alive=!1}}};
@@ -2164,7 +2164,11 @@ var BaseSerializerContext = class {
2164
2164
  serializeProperty(source, key, val) {
2165
2165
  if (typeof key === "string") {
2166
2166
  const check = Number(key);
2167
- const isIdentifier = check >= 0 || isValidIdentifier(key);
2167
+ const isIdentifier = (
2168
+ // Test if key is a valid positive number or JS identifier
2169
+ // so that we don't have to serialize the key and wrap with brackets
2170
+ check >= 0 && check.toString() === key || isValidIdentifier(key)
2171
+ );
2168
2172
  if (this.isIndexedValueInStack(val)) {
2169
2173
  const refParam = this.getRefParam(val.i);
2170
2174
  this.markRef(source.i);
@@ -2216,7 +2220,11 @@ var BaseSerializerContext = class {
2216
2220
  serializeStringKeyAssignment(source, mainAssignments, key, value) {
2217
2221
  const serialized = this.serialize(value);
2218
2222
  const check = Number(key);
2219
- const isIdentifier = check >= 0 || isValidIdentifier(key);
2223
+ const isIdentifier = (
2224
+ // Test if key is a valid positive number or JS identifier
2225
+ // so that we don't have to serialize the key and wrap with brackets
2226
+ check >= 0 && check.toString() === key || isValidIdentifier(key)
2227
+ );
2220
2228
  if (this.isIndexedValueInStack(value)) {
2221
2229
  if (isIdentifier && check !== check) {
2222
2230
  this.createObjectAssign(source.i, key, serialized);
@@ -2230,7 +2238,7 @@ var BaseSerializerContext = class {
2230
2238
  } else {
2231
2239
  const parentAssignment = this.assignments;
2232
2240
  this.assignments = mainAssignments;
2233
- if (isIdentifier) {
2241
+ if (isIdentifier && check !== check) {
2234
2242
  this.createObjectAssign(source.i, key, serialized);
2235
2243
  } else {
2236
2244
  this.createArrayAssign(