seroval 0.15.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/cjs/development/index.cjs +1278 -1929
- package/dist/cjs/development/index.cjs.map +3 -3
- package/dist/cjs/production/index.cjs +3 -3
- package/dist/esm/development/index.mjs +1278 -1929
- package/dist/esm/development/index.mjs.map +3 -3
- package/dist/esm/production/index.mjs +3 -3
- package/dist/types/core/Serializer.d.ts +2 -1
- package/dist/types/core/Serializer.d.ts.map +1 -1
- package/dist/types/core/UnsupportedTypeError.d.ts.map +1 -1
- package/dist/types/core/base-primitives.d.ts +6 -2
- package/dist/types/core/base-primitives.d.ts.map +1 -1
- package/dist/types/core/compat.d.ts +5 -13
- package/dist/types/core/compat.d.ts.map +1 -1
- package/dist/types/core/constants.d.ts +17 -29
- package/dist/types/core/constants.d.ts.map +1 -1
- package/dist/types/core/context/deserializer.d.ts +6 -16
- package/dist/types/core/context/deserializer.d.ts.map +1 -1
- package/dist/types/core/context/parser/async.d.ts +2 -11
- package/dist/types/core/context/parser/async.d.ts.map +1 -1
- package/dist/types/core/context/parser/stream.d.ts +10 -10
- package/dist/types/core/context/parser/stream.d.ts.map +1 -1
- package/dist/types/core/context/parser/sync.d.ts +5 -7
- package/dist/types/core/context/parser/sync.d.ts.map +1 -1
- package/dist/types/core/context/parser.d.ts +19 -4
- package/dist/types/core/context/parser.d.ts.map +1 -1
- package/dist/types/core/context/serializer.d.ts +11 -25
- package/dist/types/core/context/serializer.d.ts.map +1 -1
- package/dist/types/core/cross/async.d.ts.map +1 -1
- package/dist/types/core/cross/deserializer.d.ts.map +1 -1
- package/dist/types/core/cross/index.d.ts.map +1 -1
- package/dist/types/core/cross/parser.d.ts.map +1 -1
- package/dist/types/core/cross/serializer.d.ts +1 -1
- package/dist/types/core/cross/serializer.d.ts.map +1 -1
- package/dist/types/core/cross/stream.d.ts.map +1 -1
- package/dist/types/core/cross/sync.d.ts.map +1 -1
- package/dist/types/core/keys.d.ts.map +1 -1
- package/dist/types/core/literals.d.ts.map +1 -1
- package/dist/types/core/plugin.d.ts +21 -0
- package/dist/types/core/plugin.d.ts.map +1 -1
- package/dist/types/core/reference.d.ts.map +1 -1
- package/dist/types/core/special-reference.d.ts +4 -9
- package/dist/types/core/special-reference.d.ts.map +1 -1
- package/dist/types/core/stream.d.ts +18 -0
- package/dist/types/core/stream.d.ts.map +1 -0
- package/dist/types/core/string.d.ts.map +1 -1
- package/dist/types/core/tree/async.d.ts.map +1 -1
- package/dist/types/core/tree/deserializer.d.ts.map +1 -1
- package/dist/types/core/tree/index.d.ts +1 -1
- package/dist/types/core/tree/index.d.ts.map +1 -1
- package/dist/types/core/tree/serializer.d.ts +3 -11
- package/dist/types/core/tree/serializer.d.ts.map +1 -1
- package/dist/types/core/types.d.ts +28 -122
- package/dist/types/core/types.d.ts.map +1 -1
- package/dist/types/core/utils/deferred.d.ts +0 -7
- package/dist/types/core/utils/deferred.d.ts.map +1 -1
- package/dist/types/core/utils/error.d.ts +2 -1
- package/dist/types/core/utils/error.d.ts.map +1 -1
- package/dist/types/core/utils/get-identifier.d.ts.map +1 -1
- package/dist/types/core/utils/is-valid-identifier.d.ts.map +1 -1
- package/dist/types/core/utils/iterator-to-sequence.d.ts +0 -12
- package/dist/types/core/utils/iterator-to-sequence.d.ts.map +1 -1
- package/dist/types/core/utils/typed-array.d.ts +2 -0
- package/dist/types/core/utils/typed-array.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/core/Serializer.ts +44 -28
- package/src/core/UnsupportedTypeError.ts +2 -3
- package/src/core/base-primitives.ts +124 -38
- package/src/core/compat.ts +5 -14
- package/src/core/constants.ts +28 -39
- package/src/core/context/deserializer.ts +122 -308
- package/src/core/context/parser/async.ts +163 -375
- package/src/core/context/parser/stream.ts +109 -367
- package/src/core/context/parser/sync.ts +139 -266
- package/src/core/context/parser.ts +93 -68
- package/src/core/context/serializer.ts +370 -439
- package/src/core/cross/async.ts +1 -1
- package/src/core/cross/deserializer.ts +1 -4
- package/src/core/cross/index.ts +28 -31
- package/src/core/cross/parser.ts +1 -1
- package/src/core/cross/serializer.ts +30 -20
- package/src/core/cross/stream.ts +1 -1
- package/src/core/cross/sync.ts +1 -1
- package/src/core/keys.ts +3 -1
- package/src/core/literals.ts +22 -8
- package/src/core/plugin.ts +48 -10
- package/src/core/reference.ts +4 -5
- package/src/core/special-reference.ts +5 -15
- package/src/core/stream.ts +205 -0
- package/src/core/string.ts +53 -22
- package/src/core/tree/async.ts +1 -1
- package/src/core/tree/deserializer.ts +4 -9
- package/src/core/tree/index.ts +15 -10
- package/src/core/tree/serializer.ts +6 -50
- package/src/core/types.ts +39 -179
- package/src/core/utils/deferred.ts +0 -27
- package/src/core/utils/error.ts +26 -15
- package/src/core/utils/get-identifier.ts +5 -4
- package/src/core/utils/is-valid-identifier.ts +6 -5
- package/src/core/utils/iterator-to-sequence.ts +0 -174
- package/src/core/utils/typed-array.ts +35 -11
- package/src/index.ts +5 -12
- package/dist/types/core/utils/constructors.d.ts +0 -5
- package/dist/types/core/utils/constructors.d.ts.map +0 -1
- package/dist/types/core/web-api.d.ts +0 -8
- package/dist/types/core/web-api.d.ts.map +0 -1
- package/dist/types/types.d.ts +0 -21
- package/dist/types/types.d.ts.map +0 -1
- package/src/core/utils/constructors.ts +0 -49
- package/src/core/web-api.ts +0 -138
- package/src/example.ts +0 -25
- package/src/types.ts +0 -84
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var
|
|
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 d(n){let e="",r=0,t;for(let s=0,
|
|
3
|
-
`).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\t/g," ").replace(/\\f/g,"\f").replace(/\\x3C/g,"<").replace(/\\u2028/g,"\u2028").replace(/\\u2029/g,"\u2029")}var I="__SEROVAL_REFS__",B="$R",ie=`self.${B}`;function $e(n){return n==null?`${ie}=${ie}||[]`:`(${ie}=${ie}||{})["${d(n)}"]=[]`}var ze=new Map,A=new Map;function Ze(n,e){return ze.set(e,n),A.set(n,e),e}function w(n){return ze.has(n)}function Ar(n){return A.has(n)}function Xe(n){return f(w(n),new Error("Missing reference id")),ze.get(n)}function Qe(n){return f(Ar(n),new Error("Missing reference for id:"+n)),A.get(n)}typeof globalThis!==void 0?Object.defineProperty(globalThis,I,{value:A,configurable:!0,writable:!1,enumerable:!1}):typeof window!==void 0?Object.defineProperty(window,I,{value:A,configurable:!0,writable:!1,enumerable:!1}):typeof self!==void 0?Object.defineProperty(self,I,{value:A,configurable:!0,writable:!1,enumerable:!1}):typeof global!==void 0&&Object.defineProperty(global,I,{value:A,configurable:!0,writable:!1,enumerable:!1});var h=(u=>(u[u.AggregateError=1]="AggregateError",u[u.ArrowFunction=4]="ArrowFunction",u[u.BigInt=8]="BigInt",u[u.ErrorPrototypeStack=16]="ErrorPrototypeStack",u[u.Map=32]="Map",u[u.ObjectAssign=128]="ObjectAssign",u[u.Promise=256]="Promise",u[u.Set=512]="Set",u[u.Symbol=1024]="Symbol",u[u.TypedArray=2048]="TypedArray",u[u.BigIntTypedArray=4096]="BigIntTypedArray",u[u.WebAPI=8192]="WebAPI",u))(h||{});function oe(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 V(n,e){let r,t=se[oe(n)];n.name!==t?r={name:n.name}:n.constructor.name!==t&&(r={name:n.constructor.name});let s=Object.getOwnPropertyNames(n);for(let a=0,i=s.length,o;a<i;a++)o=s[a],o!=="name"&&o!=="message"&&(o==="stack"?e&16&&(r=r||{},r[o]=n[o]):(r=r||{},r[o]=n[o]));return r}function de(n){return Object.isFrozen(n)?3:Object.isSealed(n)?2:Object.isExtensible(n)?0:1}function le(n){switch(n){case 1/0:return Ge;case-1/0:return Je;default:return n!==n?Ye:Object.is(n,-0)?He:{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:d(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 ue(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 P(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 j(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 U(n,e){return{t:6,i:n,s:void 0,l:void 0,c:e.source,m:e.flags,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function M(n,e){let r=new Uint8Array(e),t=r.length,s=new Array(t);for(let a=0;a<t;a++)s[a]=r[a];return{t:21,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 ce(n,e){return f(e in T,new Error("Only well-known symbols are supported.")),{t:17,i:n,s:T[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 fe(n,e){return{t:20,i:n,s:d(Xe(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 L(n,e,r){return{t:40,i:n,s:r,l:void 0,c:d(e),m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function pe(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:de(e)}}function me(n,e){return{t:27,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 Se(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 he(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 ge(n,e,r){return{t:22,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 ye(n,e,r){return{t:13,i:n,s:oe(e),l:void 0,c:void 0,m:d(e.message),p:r,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function ve(n,e,r){return{t:14,i:n,s:oe(e),l:void 0,c:void 0,m:d(e.message),p:r,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function be(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 _(n,e){return{t:43,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 Ne(n,e){return{t:45,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 Re(n,e){return{body:e,cache:n.cache,credentials:n.credentials,headers:n.headers,integrity:n.integrity,keepalive:n.keepalive,method:n.method,mode:n.mode,redirect:n.redirect,referrer:n.referrer,referrerPolicy:n.referrerPolicy}}function Ee(n){return{headers:n.headers,status:n.status,statusText:n.statusText}}function xe(n){return{bubbles:n.bubbles,cancelable:n.cancelable,composed:n.composed}}function Ie(n){return{detail:n.detail,bubbles:n.bubbles,cancelable:n.cancelable,composed:n.composed}}function q(n){let e=[],r=-1,t=-1,s=n[Symbol.iterator]();for(;;)try{let a=s.next();if(e.push(a.value),a.done){t=e.length-1;break}}catch(a){r=e.length,e.push(a)}return{v:e,t:r,d:t}}function rr(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}}}}}async function tr(n){let e=[],r=-1,t=-1,s=n[Symbol.asyncIterator]();for(;;)try{let a=await s.next();if(e.push(a.value),a.done){t=e.length-1;break}}catch(a){r=e.length,e.push(a)}return{v:e,t:r,d:t}}function nr(n){return()=>{let e=0;return{[Symbol.asyncIterator](){return this},async 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 Promise.resolve({done:r===n.d,value:t})}}}}function sr(n,e){return new ReadableStream({async start(r){let t=n[Symbol.asyncIterator]();for(;e.isAlive();)try{let s=await t.next();if(r.enqueue([s.done?2:0,s.value]),s.done){r.close();return}}catch(s){r.enqueue([1,s])}r.close()}})}function ar(n){let e=n;return()=>{let[r,t]=e.tee(),s=r;e=t;let a=s.getReader();return{[Symbol.asyncIterator](){return this},async next(){let i=await a.read();if(i.done)return{done:!0,value:void 0};let[o,c]=i.value;if(o===1)throw c;return{done:o===2,value:c}}}}}async function ir(n){let e=[],r=-1,t=-1,s=n.getReader();for(;;)try{let a=await s.read();if(e.push(a.value),a.done){t=e.length-1;break}}catch(a){r=e.length,t=r,e.push(a);break}return{v:e,t:r,d:t}}function or(n){return new ReadableStream({start(e){for(let r=0;r<n.d;r++)e.enqueue(n.v[r]);n.t===-1?e.close():e.error(n.v[n.t])}})}var l={},Oe={},ke={};var dr={0:{},1:{},2:{},3:{},4:{},5:{},6:{},7:{},8:{}};var W=class{constructor(e){this.marked=new Set;this.plugins=e.plugins,this.features=16383^(e.disabledFeatures||0),this.refs=e.refs||new Map}markRef(e){this.marked.add(e)}isMarked(e){return this.marked.has(e)}getReference(e){let r=this.refs.get(e);if(r!=null)return this.markRef(r),P(r);let t=this.refs.size;return this.refs.set(e,t),w(e)?fe(t,e):t}getStrictReference(e){let r=this.refs.get(e);if(r!=null)return this.markRef(r),P(r);let t=this.refs.size;return this.refs.set(e,t),fe(t,e)}parseFunction(e){return f(w(e),new Error("Cannot serialize function without reference ID.")),this.getStrictReference(e)}parseWKSymbol(e){f(this.features&1024,new m(e));let r=this.refs.get(e);if(r!=null)return this.markRef(r),P(r);let t=e in T;f(e in T||w(e),new Error("Cannot serialize symbol without reference ID."));let s=this.refs.size;return this.refs.set(e,s),t?ce(s,e):fe(s,e)}parseSpecialReference(e){let r=dr[e],t=this.refs.get(r);if(t!=null)return this.markRef(t),P(t);let s=this.refs.size;return this.refs.set(r,s),{t:41,i:s,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.refs.get(Oe);if(e!=null)return this.markRef(e),P(e);let r=this.refs.size;return this.refs.set(Oe,r),{t:42,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parseWKSymbol(Symbol.iterator),b:void 0,o:void 0}}parseAsyncIteratorFactory(e){let r=this.refs.get(ke);if(r!=null)return this.markRef(r),P(r);let t=this.refs.size;return this.refs.set(ke,t),{t:44,i:t,s:e,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parseWKSymbol(Symbol.asyncIterator),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:de(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}}};async function Fe(n){try{return[1,await n]}catch(e){return[0,e]}}function K(n,e){return{t:18,i:n,s:d(e.href),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 H(n,e){return{t:19,i:n,s:d(e.toString()),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 G(n,e){return{t:39,i:n,s:d(e.message),l:void 0,c:d(e.name),m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Ae(n,e,r){return{t:37,i:n,s:d(e),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:void 0,o:void 0}}function we(n,e,r){return{t:38,i:n,s:d(e),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:void 0,o:void 0}}function lr(n,e,r){return{t:46,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[e,r],f:void 0,b:void 0,o:void 0}}var C=class extends W{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 pe(e,r,await this.parseItems(r))}async parseProperties(e){let r=Object.entries(e),t=[],s=[];for(let a=0,i=r.length;a<i;a++)t.push(d(r[a][0])),s.push(await this.parse(r[a][1]));if(this.features&1024){let a=Symbol.iterator;a in e&&(t.push(this.parseWKSymbol(a)),s.push(_(this.parseIteratorFactory(),await this.parse(q(e))))),a=Symbol.asyncIterator,a in e&&(t.push(this.parseWKSymbol(a)),s.push(Ne(this.parseAsyncIteratorFactory(0),await this.parse(await tr(e))))),a=Symbol.toStringTag,a in e&&(t.push(this.parseWKSymbol(a)),s.push(N(e[a]))),a=Symbol.isConcatSpreadable,a in e&&(t.push(this.parseWKSymbol(a)),s.push(e[a]?v:b))}return{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 me(e,await this.parse(r.valueOf()))}async parseTypedArray(e,r){return Se(e,r,await this.parse(r.buffer))}async parseBigIntTypedArray(e,r){return he(e,r,await this.parse(r.buffer))}async parseDataView(e,r){return ge(e,r,await this.parse(r.buffer))}async parseError(e,r){let t=V(r,this.features);return ye(e,r,t?await this.parseProperties(t):void 0)}async parseAggregateError(e,r){let t=V(r,this.features);return ve(e,r,t?await this.parseProperties(t):void 0)}async parseMap(e,r){let t=[],s=[];for(let[a,i]of r.entries())t.push(await this.parse(a)),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 be(e,r.size,t)}async parseBlob(e,r){return{t:23,i:e,s:void 0,l:void 0,c:d(r.type),m:void 0,p:void 0,e:void 0,f:await this.parse(await r.arrayBuffer()),a:void 0,b:void 0,o:void 0}}async parseFile(e,r){return{t:24,i:e,s:void 0,l:void 0,c:d(r.type),m:d(r.name),p:void 0,e:void 0,f:await this.parse(await r.arrayBuffer()),a:void 0,b:r.lastModified,o:void 0}}async parsePlainProperties(e){let r=e.length,t=[],s=[];for(let a=0;a<r;a++)t.push(d(e[a][0])),s.push(await this.parse(e[a][1]));return{k:t,v:s,s:r}}async parseHeaders(e,r){let t=[];return r.forEach((s,a)=>{t.push([a,s])}),{t:25,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:await this.parsePlainProperties(t),a:void 0,f:void 0,b:void 0,o:void 0}}async parseFormData(e,r){let t=[];return r.forEach((s,a)=>{t.push([a,s])}),{t:26,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:await this.parsePlainProperties(t),a:void 0,f:void 0,b:void 0,o:void 0}}async parseRequest(e,r){return{t:35,i:e,s:d(r.url),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:await this.parse(Re(r,r.body?await r.clone().arrayBuffer():null)),a:void 0,b:void 0,o:void 0}}async parseResponse(e,r){return{t:36,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:[r.body?await this.parse(await r.clone().arrayBuffer()):x,await this.parse(Ee(r))],b:void 0,o:void 0}}async parseEvent(e,r){return Ae(e,r.type,await this.parse(xe(r)))}async parseCustomEvent(e,r){return we(e,r.type,await this.parse(Ie(r)))}async parsePromise(e,r){let[t,s]=await Fe(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,a=t.length;s<a;s++){let i=t[s];if(i.parse.async&&i.test(r))return L(e,i.tag,await i.parse.async(r,this,{id:e}))}}async parseReadableStream(e,r){return lr(e,this.parseSpecialReference(1),await this.parse(await ir(r)))}async parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);let t=r.constructor;switch(t){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return j(e,r);case RegExp:return U(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);default:break}let s=this.features;if(s&256&&(t===Promise||r instanceof Promise))return this.parsePromise(e,r);if(s&2048)switch(t){case ArrayBuffer:return M(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);default:break}if((s&4104)===4104)switch(t){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(s&32&&t===Map)return this.parseMap(e,r);if(s&512&&t===Set)return this.parseSet(e,r);if(s&8192)switch(t){case(typeof URL!="undefined"?URL:l):return K(e,r);case(typeof URLSearchParams!="undefined"?URLSearchParams:l):return H(e,r);case(typeof Blob!="undefined"?Blob:l):return this.parseBlob(e,r);case(typeof File!="undefined"?File:l):return this.parseFile(e,r);case(typeof Headers!="undefined"?Headers:l):return this.parseHeaders(e,r);case(typeof FormData!="undefined"?FormData:l):return this.parseFormData(e,r);case(typeof Request!="undefined"?Request:l):return this.parseRequest(e,r);case(typeof Response!="undefined"?Response:l):return this.parseResponse(e,r);case(typeof Event!="undefined"?Event:l):return this.parseEvent(e,r);case(typeof CustomEvent!="undefined"?CustomEvent:l):return this.parseCustomEvent(e,r);case(typeof DOMException!="undefined"?DOMException:l):return G(e,r);case(typeof ReadableStream!="undefined"?ReadableStream:l):return this.parseReadableStream(e,r);default:break}let a=await this.parsePlugin(e,r);if(a)return a;if(s&1&&typeof AggregateError!="undefined"&&(t===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(s&1024&&(Symbol.iterator in r||Symbol.asyncIterator in r))return this.parsePlainObject(e,r,!!t);throw new m(r)}async parse(e){switch(e){case!0:return v;case!1:return b;case void 0:return ae;case null:return x;default:break}switch(typeof e){case"string":return N(e);case"number":return le(e);case"bigint":return f(this.features&8,new m(e)),ue(e);case"object":{let r=this.getReference(e);return typeof r=="number"?this.parseObject(r,e):r}case"symbol":return this.parseWKSymbol(e);case"function":return this.parseFunction(e);default:throw new m(e)}}};var J=class extends C{constructor(){super(...arguments);this.mode="vanilla"}};function ur(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 Te(){let n,e;return{promise:new Promise((r,t)=>{n=r,e=t}),resolve(r){n(r)},reject(r){e(r)}}}function cr(){let n;return{stream:new ReadableStream({start(e){n=e}}),close(){n.close()},enqueue(e){n.enqueue(e)},error(e){n.error(e)}}}function fr(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 z=class{constructor(e){this.plugins=e.plugins,this.refs=e.refs||new Map}deserializeReference(e){return this.assignIndexedValue(e.i,Qe(p(e.s)))}deserializeArray(e){let r=e.l,t=this.assignIndexedValue(e.i,new Array(r)),s;for(let a=0;a<r;a++)s=e.a[a],s&&(t[a]=this.deserialize(s));return fr(t,e.o),t}deserializeProperties(e,r){let t=e.s;if(t){let s=e.k,a=e.v;for(let i=0,o;i<t;i++)o=s[i],typeof o=="string"?r[p(o)]=this.deserialize(a[i]):r[this.deserialize(o)]=this.deserialize(a[i])}return r}deserializeObject(e){let r=this.assignIndexedValue(e.i,e.t===10?{}:Object.create(null));return this.deserializeProperties(e.p,r),fr(r,e.o),r}deserializeDate(e){return this.assignIndexedValue(e.i,new Date(e.s))}deserializeRegExp(e){return this.assignIndexedValue(e.i,new RegExp(e.c,e.m))}deserializeSet(e){let r=this.assignIndexedValue(e.i,new Set),t=e.a;for(let s=0,a=e.l;s<a;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 a=0,i=e.e.s;a<i;a++)r.set(this.deserialize(t[a]),this.deserialize(s[a]));return r}deserializeArrayBuffer(e){let r=new Uint8Array(e.s);return this.assignIndexedValue(e.i,r.buffer)}deserializeTypedArray(e){let r=ur(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([],p(e.m)));return this.deserializeDictionary(e,r)}deserializeError(e){let r=Ke[e.s],t=this.assignIndexedValue(e.i,new r(p(e.m)));return this.deserializeDictionary(e,t)}async deserializePromise(e){let r=Te(),t=this.assignIndexedValue(e.i,r),s=this.deserialize(e.f);return e.s?r.resolve(s):r.reject(s),t.promise}deserializeURL(e){return this.assignIndexedValue(e.i,new URL(p(e.s)))}deserializeURLSearchParams(e){return this.assignIndexedValue(e.i,new URLSearchParams(p(e.s)))}deserializeBlob(e){let r=this.deserialize(e.f);return this.assignIndexedValue(e.i,new Blob([r],{type:p(e.c)}))}deserializeFile(e){let r=this.deserialize(e.f);return this.assignIndexedValue(e.i,new File([r],p(e.m),{type:p(e.c),lastModified:e.b}))}deserializeHeaders(e){let r=this.assignIndexedValue(e.i,new Headers),t=e.e.k,s=e.e.v;for(let a=0,i=e.e.s;a<i;a++)r.set(p(t[a]),this.deserialize(s[a]));return r}deserializeFormData(e){let r=this.assignIndexedValue(e.i,new FormData),t=e.e.k,s=e.e.v;for(let a=0,i=e.e.s;a<i;a++)r.set(p(t[a]),this.deserialize(s[a]));return r}deserializeBoxed(e){return this.assignIndexedValue(e.i,Object(this.deserialize(e.f)))}deserializeRequest(e){return this.assignIndexedValue(e.i,new Request(p(e.s),this.deserialize(e.f)))}deserializeResponse(e){return this.assignIndexedValue(e.i,new Response(this.deserialize(e.a[0]),this.deserialize(e.a[1])))}deserializeEvent(e){return this.assignIndexedValue(e.i,new Event(p(e.s),this.deserialize(e.f)))}deserializeCustomEvent(e){return this.assignIndexedValue(e.i,new CustomEvent(p(e.s),this.deserialize(e.f)))}deserializeDOMException(e){return this.assignIndexedValue(e.i,new DOMException(p(e.s),p(e.c)))}deserializePlugin(e){let r=this.plugins;if(r)for(let t=0,s=r.length;t<s;t++){let a=r[t];if(a.tag===e.c)return this.assignIndexedValue(e.i,a.deserialize(e.s,this,{id:e.i}))}throw new Error('Missing plugin for tag "'+e.c+'".')}deserializePromiseConstructor(e){return this.assignIndexedValue(e.i,Te()).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]))}deserializeReadableStreamConstructor(e){return this.assignIndexedValue(e.i,cr()).stream}deserializeReadableStreamEnqueue(e){let r=this.refs.get(e.i);f(r,new Error("Missing ReadableStream instance.")),r.enqueue(this.deserialize(e.a[1]))}deserializeReadableStreamError(e){let r=this.refs.get(e.i);f(r,new Error("Missing Promise instance.")),r.error(this.deserialize(e.a[1]))}deserializeReadableStreamClose(e){let r=this.refs.get(e.i);f(r,new Error("Missing Promise instance.")),r.close()}deserializeIteratorFactoryInstance(e){let r=this.deserialize(e.a[1]);return rr(r)}deserializeAsyncIteratorFactoryInstance(e){let r=this.deserialize(e.a[1]);return e.s?ar(r):nr(r)}deserializeReadableStream(e){return this.assignIndexedValue(e.i,or(this.deserialize(e.a[1])))}deserialize(e){switch(e.t){case 2:return We[e.s];case 0:return e.s;case 1:return p(e.s);case 3:return BigInt(e.s);case 4:return this.refs.get(e.i);case 20: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 21:return this.deserializeArrayBuffer(e);case 16:case 15:return this.deserializeTypedArray(e);case 22: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 _e[e.s];case 18:return this.deserializeURL(e);case 19:return this.deserializeURLSearchParams(e);case 23:return this.deserializeBlob(e);case 24:return this.deserializeFile(e);case 25:return this.deserializeHeaders(e);case 26:return this.deserializeFormData(e);case 27:return this.deserializeBoxed(e);case 35:return this.deserializeRequest(e);case 36:return this.deserializeResponse(e);case 37:return this.deserializeEvent(e);case 38:return this.deserializeCustomEvent(e);case 39:return this.deserializeDOMException(e);case 40:return this.deserializePlugin(e);case 28:return this.deserializePromiseConstructor(e);case 29:return this.deserializePromiseResolve(e);case 30:return this.deserializePromiseReject(e);case 31:return this.deserializeReadableStreamConstructor(e);case 32:return this.deserializeReadableStreamEnqueue(e);case 34:return this.deserializeReadableStreamError(e);case 33:return this.deserializeReadableStreamClose(e);case 43:return this.deserializeIteratorFactoryInstance(e);case 45:return this.deserializeAsyncIteratorFactoryInstance(e);case 46:return this.deserializeReadableStream(e);case 41:case 42:case 44:default:throw new Error("invariant")}}};var Q=class extends z{constructor(r){super({plugins:r.plugins,refs:void 0});this.mode="vanilla";this.marked=new Set(r.markedRefs)}assignIndexedValue(r,t){return this.marked.has(r)&&this.refs.set(r,t),t}};var Pr=/^[$A-Z_][0-9A-Z_$]*$/i;function Be(n){let e=n[0];return(e==="$"||e==="_"||e>="A"&&e<="Z"||e>="a"&&e<="z")&&Pr.test(n)}function ee(n){switch(n.t){case"index":return n.s+"="+n.v;case"set":return n.s+".set("+n.k+","+n.v+")";case"add":return n.s+".add("+n.v+")";case"delete":return n.s+".delete("+n.k+")";default:return""}}function Cr(n){let e=[],r=n[0];for(let t=1,s=n.length,a,i=r;t<s;t++)a=n[t],a.t==="index"&&a.v===i.v?r={t:"index",s:a.s,k:void 0,v:ee(r)}:a.t==="set"&&a.s===i.s?r={t:"set",s:ee(r),k:a.k,v:a.v}:a.t==="add"&&a.s===i.s?r={t:"add",s:ee(r),k:void 0,v:a.v}:a.t==="delete"&&a.s===i.s?r={t:"delete",s:ee(r),k:a.k,v:void 0}:(e.push(r),r=a),i=a;return e.push(r),e}function pr(n){if(n.length){let e="",r=Cr(n);for(let t=0,s=r.length;t<s;t++)e+=ee(r[t])+",";return e}}var zr="Object.create(null)",Or="new Set",kr="new Map",Dr="Promise.resolve",Fr="Promise.reject",Tr={3:"Object.freeze",2:"Object.seal",1:"Object.preventExtensions",0:void 0},O=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&4?(e.length===1?e[0]:"("+e.join(",")+")")+"=>"+r:"function("+e.join(",")+"){return "+r+"}"}createEffectfulFunction(e,r){return this.features&4?(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 a=t[r];e+=Tr[a.type]+"("+a.value+"),"}return e}resolvePatches(){let e=pr(this.assignments),r=this.resolveFlags();return e?r?e+r:e:r}createAssignment(e,r){this.assignments.push({t:"index",s:e,k:void 0,v:r})}createAddAssignment(e,r){this.assignments.push({t:"add",s:this.getRefParam(e),k:void 0,v:r})}createSetAssignment(e,r,t){this.assignments.push({t:"set",s:this.getRefParam(e),k:r,v:t})}createDeleteAssignment(e,r){this.assignments.push({t:"delete",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,I+'.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),a=s==="";for(let i=1,o=e.l,c;i<o;i++)c=this.serializeArrayItem(r,t[i],i),s+=","+c,a=c==="";return this.stack.pop(),this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(r,"["+s+(a?",]":"]"))}return this.assignIndexedValue(r,"[]")}serializeProperty(e,r,t){if(typeof r=="string"){let s=Number(r),a=s>=0||Be(r);if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);return this.markRef(e.i),a&&s!==s?this.createObjectAssign(e.i,r,i):this.createArrayAssign(e.i,a?r:'"'+r+'"',i),""}return(a?r:'"'+r+'"')+":"+this.serialize(t)}return"["+this.serialize(r)+"]:"+this.serialize(t)}serializeProperties(e,r){let t=r.s;if(t){this.stack.push(e.i);let s=r.k,a=r.v,i=this.serializeProperty(e,s[0],a[0]);for(let o=1,c=i;o<t;o++)c=this.serializeProperty(e,s[o],a[o]),i+=(c&&i&&",")+c;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}serializeAssignment(e,r,t,s){if(typeof t=="string"){let a=this.serialize(s),i=Number(t),o=i>=0||Be(t);if(this.isIndexedValueInStack(s))o&&i!==i?this.createObjectAssign(e.i,t,a):this.createArrayAssign(e.i,o?t:'"'+t+'"',a);else{let c=this.assignments;this.assignments=r,o?this.createObjectAssign(e.i,t,a):this.createArrayAssign(e.i,o?t:'"'+t+'"',a),this.assignments=c}}else{let a=this.stack;this.stack=[];let i=this.serialize(s);this.stack=a;let o=this.assignments;this.assignments=r,this.createArrayAssign(e.i,this.serialize(t),i),this.assignments=o}}serializeAssignments(e,r){let t=r.s;if(t){this.stack.push(e.i);let s=[],a=r.k,i=r.v;for(let o=0;o<t;o++)this.serializeAssignment(e,s,a[o],i[o]);return this.stack.pop(),pr(s)}}serializeDictionary(e,r){if(e.p)if(this.features&128)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,zr)}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=Or,t=e.l,s=e.i;if(t){let a=e.a;this.stack.push(s);let i=this.serializeSetItem(s,a[0]);for(let o=1,c=i;o<t;o++)c=this.serializeSetItem(s,a[o]),i+=(c&&i&&",")+c;this.stack.pop(),i&&(r+="(["+i+"])")}return this.assignIndexedValue(s,r)}serializeMapEntry(e,r,t,s){if(this.isIndexedValueInStack(r)){let a=this.getRefParam(r.i);if(this.markRef(e),this.isIndexedValueInStack(t)){let o=this.getRefParam(t.i);return this.createSetAssignment(e,a,o),""}if(t.t!==4&&t.i!=null&&this.isMarked(t.i)){let o="("+this.serialize(t)+",["+s+","+s+"])";return this.createSetAssignment(e,a,this.getRefParam(t.i)),this.createDeleteAssignment(e,s),o}let i=this.stack;return this.stack=[],this.createSetAssignment(e,a,this.serialize(t)),this.stack=i,""}if(this.isIndexedValueInStack(t)){let a=this.getRefParam(t.i);if(this.markRef(e),r.t!==4&&r.i!=null&&this.isMarked(r.i)){let o="("+this.serialize(r)+",["+s+","+s+"])";return this.createSetAssignment(e,this.getRefParam(r.i),a),this.createDeleteAssignment(e,s),o}let i=this.stack;return this.stack=[],this.createSetAssignment(e,this.serialize(r),a),this.stack=i,""}return"["+this.serialize(r)+","+this.serialize(t)+"]"}serializeMap(e){let r=kr,t=e.e.s,s=e.i,a=e.f,i=this.getRefParam(a.i);if(t){let o=e.e.k,c=e.e.v;this.stack.push(s);let E=this.serializeMapEntry(s,o[0],c[0],i);for(let F=1,Pe=E;F<t;F++)Pe=this.serializeMapEntry(s,o[F],c[F],i),E+=(Pe&&E&&",")+Pe;this.stack.pop(),E&&(r+="(["+E+"])")}return a.t===41&&(this.markRef(a.i),r="("+this.serialize(a)+","+r+")"),this.assignIndexedValue(s,r)}serializeArrayBuffer(e){let r="new Uint8Array(",t=e.s,s=t.length;if(s){r+="["+t[0];for(let a=1;a<s;a++)r+=","+t[a];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='new AggregateError([],"'+e.m+'")';return this.stack.pop(),this.serializeDictionary(e,t)}serializeError(e){return this.serializeDictionary(e,"new "+se[e.s]+'("'+e.m+'")')}serializePromise(e){let r,t=e.f,s=e.i,a=e.s?Dr:Fr;if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);r=a+(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=a+"("+i+")"}return this.assignIndexedValue(s,r)}serializeWKSymbol(e){return this.assignIndexedValue(e.i,Le[e.s])}serializeURL(e){return this.assignIndexedValue(e.i,'new URL("'+e.s+'")')}serializeURLSearchParams(e){return this.assignIndexedValue(e.i,e.s?'new URLSearchParams("'+e.s+'")':"new URLSearchParams")}serializeBlob(e){return this.assignIndexedValue(e.i,"new Blob(["+this.serialize(e.f)+'],{type:"'+e.c+'"})')}serializeFile(e){return this.assignIndexedValue(e.i,"new File(["+this.serialize(e.f)+'],"'+e.m+'",{type:"'+e.c+'",lastModified:'+e.b+"})")}serializeHeaders(e){return this.assignIndexedValue(e.i,"new Headers("+this.serializeProperties(e,e.e)+")")}serializeFormDataEntry(e,r,t){return this.getRefParam(e)+'.append("'+r+'",'+this.serialize(t)+")"}serializeFormDataEntries(e,r){let t=e.e.k,s=e.e.v,a=e.i,i=this.serializeFormDataEntry(a,t[0],s[0]);for(let o=1;o<r;o++)i+=","+this.serializeFormDataEntry(a,t[o],s[o]);return i}serializeFormData(e){let r=e.e.s,t=e.i;r&&this.markRef(t);let s=this.assignIndexedValue(t,"new FormData()");if(r){let a=this.serializeFormDataEntries(e,r);return"("+s+","+(a?a+",":"")+this.getRefParam(t)+")"}return s}serializeBoxed(e){return this.assignIndexedValue(e.i,"Object("+this.serialize(e.f)+")")}serializeRequest(e){return this.assignIndexedValue(e.i,'new Request("'+e.s+'",'+this.serialize(e.f)+")")}serializeResponse(e){return this.assignIndexedValue(e.i,"new Response("+this.serialize(e.a[0])+","+this.serialize(e.a[1])+")")}serializeEvent(e){return this.assignIndexedValue(e.i,'new Event("'+e.s+'",'+this.serialize(e.f)+")")}serializeCustomEvent(e){return this.assignIndexedValue(e.i,'new CustomEvent("'+e.s+'",'+this.serialize(e.f)+")")}serializeDOMException(e){return this.assignIndexedValue(e.i,'new DOMException("'+e.s+'","'+e.c+'")')}serializePlugin(e){let r=this.plugins;if(r)for(let t=0,s=r.length;t<s;t++){let a=r[t];if(a.tag===e.c)return this.assignIndexedValue(e.i,a.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])+")"}serializeReadableStreamConstructor(e){return this.assignIndexedValue(e.i,this.getConstructor(e.f)+"()")}serializeReadableStreamEnqueue(e){return this.getConstructor(e.a[0])+"("+this.getRefParam(e.i)+","+this.serialize(e.a[1])+")"}serializeReadableStreamError(e){return this.getConstructor(e.a[0])+"("+this.getRefParam(e.i)+","+this.serialize(e.a[1])+")"}serializeReadableStreamClose(e){return this.getConstructor(e.f)+"("+this.getRefParam(e.i)+")"}serializeSpecialReferenceValue(e){switch(e){case 0:return"[]";case 1:return this.createFunction(["s"],"new ReadableStream({start:"+this.createFunction(["c"],"Promise.resolve().then("+this.createEffectfulFunction(["i","v"],"for(i=0;i<s.d;i++)c.enqueue(s.v[i]);(s.t===-1)?c.close():c.error(s.v[i])")+")")+"})");case 2:return this.createFunction(["s","f","p"],"((p=new Promise("+this.createEffectfulFunction(["a","b"],"s=a,f=b")+")).s=s,p.f=f,p)");case 3:return this.createEffectfulFunction(["p","d"],'p.s(d),p.status="success",p.value=d;delete p.s;delete p.f');case 4:return this.createEffectfulFunction(["p","d"],'p.f(d),p.status="failure",p.value=d;delete p.s;delete p.f');case 5:return this.createFunction(["s","c"],"((s=new ReadableStream({start:"+this.createEffectfulFunction(["x"],"c=x")+"})).c=c,s)");case 6:return this.createEffectfulFunction(["s","d"],"s.c.enqueue(d)");case 7:return this.createEffectfulFunction(["s","d"],"s.c.error(d);delete s.c");case 8:return this.createEffectfulFunction(["s"],"s.c.close();delete s.c");default:return""}}serializeSpecialReference(e){return this.assignIndexedValue(e.i,this.serializeSpecialReferenceValue(e.s))}serializeIteratorFactory(e){return this.assignIndexedValue(e.i,this.createFunction(["s"],this.createFunction(["i","c","d","t"],"(i=0,t={["+this.serialize(e.f)+"]:"+this.createFunction([],"t")+",next:"+this.createEffectfulFunction([],"if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}")+"})")))}serializeIteratorFactoryInstance(e){return this.getConstructor(e.a[0])+"("+this.serialize(e.a[1])+")"}getStreamingAsyncIteratorFactory(e){return this.createFunction(["s"],this.createFunction(["b","t"],"(b=s.tee(),s=b[0],b=b[1].getReader(),t={["+this.serialize(e.f)+"]:"+this.createFunction([],"t")+",next:"+this.createFunction([],"b.read().then("+this.createEffectfulFunction(["d"],"if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}")+")")+"})"))}getBlockingAsyncIteratorFactory(e){return this.createFunction(["s"],this.createFunction(["i","t"],"(i=0,t={["+this.serialize(e.f)+"]:"+this.createFunction([],"t")+",next:"+this.createFunction([],"Promise.resolve().then("+this.createEffectfulFunction(["c","d"],"if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}")+")")+"})"))}serializeAsyncIteratorFactory(e){return this.assignIndexedValue(e.i,e.s?this.getStreamingAsyncIteratorFactory(e):this.getBlockingAsyncIteratorFactory(e))}serializeAsyncIteratorFactoryInstance(e){return this.getConstructor(e.a[0])+"("+this.serialize(e.a[1])+")"}serializeReadableStream(e){this.stack.push(e.i);let r=this.getConstructor(e.a[0])+"("+this.serialize(e.a[1])+")";return this.stack.pop(),this.assignIndexedValue(e.i,r)}serialize(e){switch(e.t){case 2:return qe[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 20: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 21:return this.serializeArrayBuffer(e);case 16:case 15:return this.serializeTypedArray(e);case 22: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.serializeWKSymbol(e);case 18:return this.serializeURL(e);case 19:return this.serializeURLSearchParams(e);case 23:return this.serializeBlob(e);case 24:return this.serializeFile(e);case 25:return this.serializeHeaders(e);case 26:return this.serializeFormData(e);case 27:return this.serializeBoxed(e);case 28:return this.serializePromiseConstructor(e);case 29:return this.serializePromiseResolve(e);case 30:return this.serializePromiseReject(e);case 31:return this.serializeReadableStreamConstructor(e);case 32:return this.serializeReadableStreamEnqueue(e);case 34:return this.serializeReadableStreamError(e);case 33:return this.serializeReadableStreamClose(e);case 35:return this.serializeRequest(e);case 36:return this.serializeResponse(e);case 37:return this.serializeEvent(e);case 38:return this.serializeCustomEvent(e);case 39:return this.serializeDOMException(e);case 40:return this.serializePlugin(e);case 41:return this.serializeSpecialReference(e);case 42:return this.serializeIteratorFactory(e);case 43:return this.serializeIteratorFactoryInstance(e);case 44:return this.serializeAsyncIteratorFactory(e);case 45:return this.serializeAsyncIteratorFactoryInstance(e);case 46:return this.serializeReadableStream(e);default:throw new Error("invariant")}}};var hr="hjkmoquxzABCDEFGHIJKLNPQRTUVWXYZ$_",mr=hr.length,gr="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_",Sr=gr.length;function Ve(n){let e=n%mr,r=hr[e];for(n=(n-e)/mr;n>0;)e=n%Sr,r+=gr[e],n=(n-e)/Sr;return r}var k=class extends O{constructor(){super(...arguments);this.mode="vanilla";this.valid=new Map;this.vars=[]}markRef(r){this.marked.add(r)}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=Ve(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+'".')}serializeReadableStreamConstructor(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeReadableStreamEnqueue(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeReadableStreamError(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeReadableStreamClose(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(),a=t;if(s){let i=this.getRefParam(r.i);a=t+","+s+i,t.startsWith(i+"=")||(a=i+"="+a)}return"("+this.createFunction(this.vars,"("+a+")")+")()"}return r.t===10?"("+t+")":t}};var g=class extends W{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 pe(e,r,this.parseItems(r))}parseProperties(e){let r=Object.entries(e),t=[],s=[];for(let a=0,i=r.length;a<i;a++)t.push(d(r[a][0])),s.push(this.parse(r[a][1]));if(this.features&1024){let a=Symbol.iterator;a in e&&(t.push(this.parseWKSymbol(a)),s.push(_(this.parseIteratorFactory(),this.parse(q(e))))),a=Symbol.toStringTag,a in e&&(t.push(this.parseWKSymbol(a)),s.push(N(e[a]))),a=Symbol.isConcatSpreadable,a in e&&(t.push(this.parseWKSymbol(a)),s.push(e[a]?v:b))}return{k:t,v:s,s:t.length}}parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,this.parseProperties(r))}parseBoxed(e,r){return me(e,this.parse(r.valueOf()))}parseTypedArray(e,r){return Se(e,r,this.parse(r.buffer))}parseBigIntTypedArray(e,r){return he(e,r,this.parse(r.buffer))}parseDataView(e,r){return ge(e,r,this.parse(r.buffer))}parseError(e,r){let t=V(r,this.features);return ye(e,r,t?this.parseProperties(t):void 0)}parseAggregateError(e,r){let t=V(r,this.features);return ve(e,r,t?this.parseProperties(t):void 0)}parseMap(e,r){let t=[],s=[];for(let[a,i]of r.entries())t.push(this.parse(a)),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 be(e,r.size,t)}parsePlainProperties(e){let r=e.length,t=[],s=[];for(let a=0;a<r;a++)t.push(d(e[a][0])),s.push(this.parse(e[a][1]));return{k:t,v:s,s:r}}parseHeaders(e,r){let t=[];return r.forEach((s,a)=>{t.push([a,s])}),{t:25,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:this.parsePlainProperties(t),a:void 0,f:void 0,b:void 0,o:void 0}}parseFormData(e,r){let t=[];return r.forEach((s,a)=>{t.push([a,s])}),{t:26,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:this.parsePlainProperties(t),a:void 0,f:void 0,b:void 0,o:void 0}}parseEvent(e,r){return Ae(e,r.type,this.parse(xe(r)))}parseCustomEvent(e,r){return we(e,r.type,this.parse(Ie(r)))}parsePlugin(e,r){let t=this.plugins;if(t)for(let s=0,a=t.length;s<a;s++){let i=t[s];if(i.parse.sync&&i.test(r))return L(e,i.tag,i.parse.sync(r,this,{id:e}))}}parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);let t=r.constructor;switch(t){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return j(e,r);case RegExp:return U(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);default:break}let s=this.features;if(s&2048)switch(t){case ArrayBuffer:return M(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);default:break}if((s&4104)===4104)switch(t){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(s&32&&t===Map)return this.parseMap(e,r);if(s&512&&t===Set)return this.parseSet(e,r);if(s&8192)switch(t){case(typeof URL!="undefined"?URL:l):return K(e,r);case(typeof URLSearchParams!="undefined"?URLSearchParams:l):return H(e,r);case(typeof Headers!="undefined"?Headers:l):return this.parseHeaders(e,r);case(typeof FormData!="undefined"?FormData:l):return this.parseFormData(e,r);case(typeof Event!="undefined"?Event:l):return this.parseEvent(e,r);case(typeof CustomEvent!="undefined"?CustomEvent:l):return this.parseCustomEvent(e,r);case(typeof DOMException!="undefined"?DOMException:l):return G(e,r);default:break}let a=this.parsePlugin(e,r);if(a)return a;if(s&1&&typeof AggregateError!="undefined"&&(t===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(s&1024&&Symbol.iterator in r)return this.parsePlainObject(e,r,!!t);throw new m(r)}parse(e){switch(e){case!0:return v;case!1:return b;case void 0:return ae;case null:return x;default:break}switch(typeof e){case"string":return N(e);case"number":return le(e);case"bigint":return f(this.features&8,new m(e)),ue(e);case"object":{let r=this.getReference(e);return typeof r=="number"?this.parseObject(r,e):r}case"symbol":{f(this.features&1024,new m(e));let r=this.getReference(e);return typeof r=="number"?ce(r,e):r}case"function":return f(w(e),new Error("Cannot serialize function without reference ID.")),this.getStrictReference(e);default:throw new m(e)}}};var Y=class extends g{constructor(){super(...arguments);this.mode="vanilla"}};function je(n,e={}){let r=new Y({plugins:e.plugins,disabledFeatures:e.disabledFeatures}),t=r.parse(n);return new k({plugins:e.plugins,features:r.features,markedRefs:r.marked}).serializeTop(t)}async function Br(n,e={}){let r=new J({plugins:e.plugins,disabledFeatures:e.disabledFeatures}),t=await r.parse(n);return new k({plugins:e.plugins,features:r.features,markedRefs:r.marked}).serializeTop(t)}function Vr(n){return(0,eval)(n)}function jr(n,e={}){let r=new Y({plugins:e.plugins,disabledFeatures:e.disabledFeatures});return{t:r.parse(n),f:r.features,m:Array.from(r.marked)}}async function Ur(n,e={}){let r=new J({plugins:e.plugins,disabledFeatures:e.disabledFeatures});return{t:await r.parse(n),f:r.features,m:Array.from(r.marked)}}function Mr(n,e={}){return new k({plugins:e.plugins,features:n.f,markedRefs:n.m}).serializeTop(n.t)}function Lr(n,e={}){return new Q({plugins:e.plugins,markedRefs:n.m}).deserialize(n.t)}var $=class extends C{constructor(){super(...arguments);this.mode="cross"}};var re=class extends z{constructor(){super(...arguments);this.mode="cross"}assignIndexedValue(r,t){return this.refs.has(r)||this.refs.set(r,t),t}};var D=class extends O{constructor(r){super(r);this.mode="cross";this.scopeId=r.scopeId}getRefParam(r){return typeof r=="string"?B+"."+r:B+"["+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 a=this.resolvePatches(),i=this.getRefParam(s),o=this.scopeId==null?"":B,c=a?t+","+a:t;if(o==="")return a?"("+c+i+")":c;let E=this.scopeId==null?"()":"("+B+'["'+d(this.scopeId)+'"])',F=c+(a?i:"");return"("+this.createFunction([o],F)+")"+E}};var te=class extends g{constructor(r){super(r);this.alive=!0;this.pending=0;this.onParseCallback=r.onParse,this.onErrorCallback=r.onError,this.onDoneCallback=r.onDone}onParse(r,t){try{this.onParseCallback(r,t)}catch(s){this.onError(s)}}onError(r){if(this.onErrorCallback)this.onErrorCallback(r);else throw r}onDone(){this.onDoneCallback&&this.onDoneCallback()}push(r){this.onParse(this.parse(r),!1)}pushPendingState(){this.pending++}popPendingState(){--this.pending<=0&&this.onDone()}parseProperties(r){let t=Object.entries(r),s=[],a=[];for(let i=0,o=t.length;i<o;i++)s.push(d(t[i][0])),a.push(this.parse(t[i][1]));if(this.features&1024){let i=Symbol.iterator;i in r&&(s.push(this.parseWKSymbol(i)),a.push(_(this.parseIteratorFactory(),this.parse(q(r))))),i=Symbol.asyncIterator,i in r&&(s.push(this.parseWKSymbol(i)),a.push(Ne(this.parseAsyncIteratorFactory(1),this.parse(sr(r,this))))),i=Symbol.toStringTag,i in r&&(s.push(this.parseWKSymbol(i)),a.push(N(r[i]))),i=Symbol.isConcatSpreadable,i in r&&(s.push(this.parseWKSymbol(i)),a.push(r[i]?v:b))}return{k:s,v:a,s:s.length}}pushReadableStreamReader(r,t){t.read().then(s=>{if(this.alive)if(s.done)this.onParse({t:33,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parseSpecialReference(8),b:void 0,o:void 0},!1),this.popPendingState();else{let a=this.parseWithError(s.value);a&&(this.onParse({t:32,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(6),a],f:void 0,b:void 0,o:void 0},!1),this.pushReadableStreamReader(r,t))}},s=>{if(this.alive){let a=this.parseWithError(s);a&&this.onParse({t:34,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(7),a],f:void 0,b:void 0,o:void 0},!1),this.popPendingState()}})}parseReadableStream(r,t){let s=t.getReader();return this.pushPendingState(),this.pushReadableStreamReader(r,s),{t:31,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parseSpecialReference(5),b:void 0,o:void 0}}parseRequest(r,t){return{t:35,i:r,s:d(t.url),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:this.parse(Re(t,t.clone().body)),a:void 0,b:void 0,o:void 0}}parseResponse(r,t){return{t:36,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:[t.body?this.parse(t.clone().body):x,this.parse(Ee(t))],b:void 0,o:void 0}}parsePromise(r,t){return t.then(s=>{let a=this.parseWithError(s);a&&this.onParse({t:29,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(3),a],f:void 0,b:void 0,o:void 0},!1),this.popPendingState()},s=>{if(this.alive){let a=this.parseWithError(s);a&&this.onParse({t:30,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(4),a],f:void 0,b:void 0,o:void 0},!1)}this.popPendingState()}),this.pushPendingState(),{t:28,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parseSpecialReference(2),b:void 0,o:void 0}}parsePlugin(r,t){let s=this.plugins;if(s)for(let a=0,i=s.length;a<i;a++){let o=s[a];if(o.parse.stream&&o.test(t))return L(r,o.tag,o.parse.stream(t,this,{id:r}))}}parseObject(r,t){if(Array.isArray(t))return this.parseArray(r,t);let s=t.constructor;switch(s){case Object:return this.parsePlainObject(r,t,!1);case void 0:return this.parsePlainObject(r,t,!0);case Date:return j(r,t);case RegExp:return U(r,t);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return this.parseError(r,t);case Number:case Boolean:case String:case BigInt:return this.parseBoxed(r,t);default:break}let a=this.features;if(a&256&&(s===Promise||t instanceof Promise))return this.parsePromise(r,t);if(a&2048)switch(s){case ArrayBuffer:return M(r,t);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return this.parseTypedArray(r,t);case DataView:return this.parseDataView(r,t);default:break}if((a&4104)===4104)switch(s){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(r,t);default:break}if(a&32&&s===Map)return this.parseMap(r,t);if(a&512&&s===Set)return this.parseSet(r,t);if(a&8192)switch(s){case(typeof URL!="undefined"?URL:l):return K(r,t);case(typeof URLSearchParams!="undefined"?URLSearchParams:l):return H(r,t);case(typeof Headers!="undefined"?Headers:l):return this.parseHeaders(r,t);case(typeof FormData!="undefined"?FormData:l):return this.parseFormData(r,t);case(typeof ReadableStream!="undefined"?ReadableStream:l):return this.parseReadableStream(r,t);case(typeof Request!="undefined"?Request:l):return this.parseRequest(r,t);case(typeof Response!="undefined"?Response:l):return this.parseResponse(r,t);case(typeof Event!="undefined"?Event:l):return this.parseEvent(r,t);case(typeof CustomEvent!="undefined"?CustomEvent:l):return this.parseCustomEvent(r,t);case(typeof DOMException!="undefined"?DOMException:l):return G(r,t);default:break}let i=this.parsePlugin(r,t);if(i)return i;if(a&1&&typeof AggregateError!="undefined"&&(s===AggregateError||t instanceof AggregateError))return this.parseAggregateError(r,t);if(t instanceof Error)return this.parseError(r,t);if(a&1024&&(Symbol.iterator in t||Symbol.asyncIterator in t))return this.parsePlainObject(r,t,!!s);throw new m(t)}parseWithError(r){try{return this.parse(r)}catch(t){this.onError(t);return}}start(r){let t=this.parseWithError(r);t&&(this.onParse(t,!0),this.pending<=0&&this.destroy())}destroy(){this.alive&&(this.onDone(),this.alive=!1)}isAlive(){return this.alive}};var Z=class extends te{constructor(){super(...arguments);this.mode="cross"}};var X=class extends g{constructor(){super(...arguments);this.mode="cross"}};function Ue(n,e){return"("+$e(n)+","+e+")"}function _r(n,e={}){let r=new X({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}),t=r.parse(n),s=new D({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked});return Ue(e.scopeId,s.serializeTop(t))}async function qr(n,e={}){let r=new $({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}),t=await r.parse(n),s=new D({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked});return Ue(e.scopeId,s.serializeTop(t))}function Wr(n,e={}){return new X({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}async function Kr(n,e={}){return new $({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}function Me(n,e){let r=new Z({plugins:e.plugins,refs:e.refs,disabledFeatures:e.disabledFeatures,onParse(t,s){let a=new D({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked}),i;try{i=a.serializeTop(t)}catch(o){e.onError&&e.onError(o);return}s&&(i=Ue(e.scopeId,i)),e.onSerialize(i,s)},onError:e.onError,onDone:e.onDone});return r.start(n),()=>{r.destroy()}}function Hr(n,e){let r=new Z({plugins:e.plugins,refs:e.refs,disabledFeatures:e.disabledFeatures,onParse:e.onParse,onError:e.onError,onDone:e.onDone});return r.start(n),()=>{r.destroy()}}function Gr(n,e){return new re({plugins:e.plugins,refs:e.refs}).deserialize(n)}var ne=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}write(e,r){this.alive&&!this.flushed&&(this.pending++,this.keys.add(e),this.cleanups.push(Me(r,{plugins:this.options.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+'["'+d(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}}};function Jr(n){return n}var Yr=je;
|
|
1
|
+
"use strict";var Ie=Object.defineProperty;var or=Object.getOwnPropertyDescriptor;var ar=Object.getOwnPropertyNames;var lr=Object.prototype.hasOwnProperty;var ur=(n,e)=>{for(var r in e)Ie(n,r,{get:e[r],enumerable:!0})},dr=(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=or(e,s))||t.enumerable});return n};var cr=n=>dr(Ie({},"__esModule",{value:!0}),n);var _r={};ur(_r,{Feature:()=>x,Serializer:()=>q,compileJSON:()=>kr,createPlugin:()=>gr,createReference:()=>ke,createStream:()=>E,crossSerialize:()=>Fr,crossSerializeAsync:()=>Vr,crossSerializeStream:()=>Oe,deserialize:()=>Cr,fromCrossJSON:()=>Mr,fromJSON:()=>Tr,getCrossReferenceHeader:()=>ze,resolvePlugins:()=>c,serialize:()=>wr,serializeAsync:()=>Pr,toCrossJSON:()=>Dr,toCrossJSONAsync:()=>Br,toCrossJSONStream:()=>jr,toJSON:()=>Or,toJSONAsync:()=>zr});module.exports=cr(_r);var x=(i=>(i[i.AggregateError=1]="AggregateError",i[i.ArrowFunction=2]="ArrowFunction",i[i.ErrorPrototypeStack=4]="ErrorPrototypeStack",i[i.ObjectAssign=8]="ObjectAssign",i[i.BigIntTypedArray=16]="BigIntTypedArray",i))(x||{});function f(n,e){if(!n)throw e}function fr(n){switch(n){case'"':return'\\"';case"\\":return"\\\\";case`
|
|
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 d(n){let e="",r=0,t;for(let s=0,i=n.length;s<i;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 A="__SEROVAL_REFS__",K="$R",Z=`self.${K}`;function ze(n){return n==null?`${Z}=${Z}||[]`:`(${Z}=${Z}||{})["${d(n)}"]=[]`}var Ee=new Map,I=new Map;function ke(n,e){return Ee.set(e,n),I.set(n,e),e}function X(n){return Ee.has(n)}function mr(n){return I.has(n)}function Te(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)),I.get(n)}typeof globalThis!="undefined"?Object.defineProperty(globalThis,A,{value:I,configurable:!0,writable:!1,enumerable:!1}):typeof window!="undefined"?Object.defineProperty(window,A,{value:I,configurable:!0,writable:!1,enumerable:!1}):typeof self!="undefined"?Object.defineProperty(self,A,{value:I,configurable:!0,writable:!1,enumerable:!1}):typeof global!="undefined"&&Object.defineProperty(global,A,{value:I,configurable:!0,writable:!1,enumerable:!1});function gr(n){return n}function Ve(n,e){for(let r=0,t=e.length;r<t;r++){let s=e[r];n.has(s)||(n.add(s),s.extends&&Ve(n,s.extends))}}function c(n){if(n){let e=new Set;return Ve(e,n),[...e]}}var{toString:Sr}=Object.prototype,p=class extends Error{constructor(r){super('Unsupported type "'+Sr.call(r)+'"');this.value=r}};var De={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 y(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 v=y(2),N=y(3),ee=y(1),re=y(0),Ue=y(4),We=y(5),Ke=y(6),Le=y(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,i=t.length,o;s<i;s++)o=t[s],o!=="name"&&o!=="message"&&(o==="stack"?e&4&&(r=r||{},r[o]=n[o]):(r=r||{},r[o]=n[o]));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 b(n){return{t:1,i:void 0,s:d(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 ie(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 oe(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:d(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 i=0;i<t;i++)s[i]=r[i];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:d(Te(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 k(n,e,r){return{t:25,i:n,s:r,l:void 0,c:d(e),m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function ue(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 de(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:d(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:d(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 T(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 V(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 D(n){let e=[],r=-1,t=-1,s=n[Symbol.iterator]();for(;;)try{let i=s.next();if(e.push(i.value),i.done){t=e.length-1;break}}catch(i){r=e.length,e.push(i)}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}}};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 i(a){for(let l of n.keys())l.throw(a)}function o(a){for(let l of n.keys())l.return(a)}return{__SEROVAL_STREAM__:!0,on(a){r&&n.add(a);for(let l=0,u=e.length;l<u;l++){let g=e[l];l===u-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),i(a),r=!1,t=!1,n.clear())},return(a){r&&(e.push(a),o(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,i=!1;function o(){for(let l=0,u=r.length;l<u;l++)r[l].resolve({done:!0,value:void 0})}n.on({next(l){let u=r.shift();u&&u.resolve({done:!1,value:l}),e.push(l)},throw(l){let u=r.shift();u&&u.reject(l),o(),s=e.length,e.push(l),i=!0},return(l){let u=r.shift();u&&u.resolve({done:!0,value:l}),o(),s=e.length,e.push(l)}});function a(){let l=t++,u=e[l];if(l!==s)return{done:!1,value:u};if(i)throw u;return{done:!0,value:u}}return{[Symbol.asyncIterator](){return this},async next(){if(s===-1){let l=t++;if(l>=e.length){let u=J();return r.push(u),await u.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 ue(e,r,await this.parseItems(r))}async parseProperties(e){let r=Object.entries(e),t=[],s=[];for(let o=0,a=r.length;o<a;o++)t.push(d(r[o][0])),s.push(await this.parse(r[o][1]));let i=Symbol.iterator;return i in e&&(t.push(this.parseWellKnownSymbol(i)),s.push(T(this.parseIteratorFactory(),await this.parse(D(e))))),i=Symbol.asyncIterator,i in e&&(t.push(this.parseWellKnownSymbol(i)),s.push(F(this.parseAsyncIteratorFactory(),await this.parse(xe(e))))),i=Symbol.toStringTag,i in e&&(t.push(this.parseWellKnownSymbol(i)),s.push(b(e[i]))),i=Symbol.isConcatSpreadable,i in e&&(t.push(this.parseWellKnownSymbol(i)),s.push(e[i]?v:N)),{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 de(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[i,o]of r.entries())t.push(await this.parse(i)),s.push(await this.parse(o));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,i=t.length;s<i;s++){let o=t[s];if(o.parse.async&&o.test(r))return k(e,o.tag,await o.parse.async(r,this,{id:e}))}}async parseStream(e,r){return V(e,this.parseSpecialReference(4),await new Promise((t,s)=>{let i=[],o=r.on({next:a=>{this.markRef(e),this.parse(a).then(l=>{i.push(he(e,l))},l=>{s(l),o()})},throw:a=>{this.markRef(e),this.parse(a).then(l=>{i.push(ye(e,l)),t(i),o()},l=>{s(l),o()})},return:a=>{this.markRef(e),this.parse(a).then(l=>{i.push(ve(e,l)),t(i),o()},l=>{s(l),o()})}})}))}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 oe(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 i=this.features;if(i&16)switch(s){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(i&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?v:N;case"undefined":return ee;case"string":return b(e);case"number":return se(e);case"bigint":return ie(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 i=0;i<r;i++)s=e.a[i],s&&(t[i]=this.deserialize(s));return er(t,e.o),t}deserializeProperties(e,r){let t=e.s;if(t){let s=e.k,i=e.v;for(let o=0,a;o<t;o++)a=s[o],typeof a=="string"?r[S(a)]=this.deserialize(i[o]):r[this.deserialize(a)]=this.deserialize(i[o])}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,i=e.l;s<i;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 i=0,o=e.e.s;i<o;i++)r.set(this.deserialize(t[i]),this.deserialize(s[i]));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,i=r.length;s<i;s++){let o=r[s];if(o.tag===t)return this.assignIndexedValue(e.i,o.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"index":return n.s+"="+n.v;case"set":return n.s+".set("+n.k+","+n.v+")";case"add":return n.s+".add("+n.v+")";case"delete":return n.s+".delete("+n.k+")";default:return""}}function Nr(n){let e=[],r=n[0];for(let t=1,s=n.length,i,o=r;t<s;t++)i=n[t],i.t==="index"&&i.v===o.v?r={t:"index",s:i.s,k:void 0,v:G(r)}:i.t==="set"&&i.s===o.s?r={t:"set",s:G(r),k:i.k,v:i.v}:i.t==="add"&&i.s===o.s?r={t:"add",s:G(r),k:void 0,v:i.v}:i.t==="delete"&&i.s===o.s?r={t:"delete",s:G(r),k:i.k,v:void 0}:(e.push(r),r=i),o=i;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 i=t[r];e+=Rr[i.type]+"("+i.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:"index",s:e,k:void 0,v:r})}createAddAssignment(e,r){this.assignments.push({t:"add",s:this.getRefParam(e),k:void 0,v:r})}createSetAssignment(e,r,t){this.assignments.push({t:"set",s:this.getRefParam(e),k:r,v:t})}createDeleteAssignment(e,r){this.assignments.push({t:"delete",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,A+'.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),i=s==="";for(let o=1,a=e.l,l;o<a;o++)l=this.serializeArrayItem(r,t[o],o),s+=","+l,i=l==="";return this.stack.pop(),this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(r,"["+s+(i?",]":"]"))}return this.assignIndexedValue(r,"[]")}serializeProperty(e,r,t){if(typeof r=="string"){let s=Number(r),i=s>=0||Pe(r);if(this.isIndexedValueInStack(t)){let o=this.getRefParam(t.i);return this.markRef(e.i),i&&s!==s?this.createObjectAssign(e.i,r,o):this.createArrayAssign(e.i,i?r:'"'+r+'"',o),""}return(i?r:'"'+r+'"')+":"+this.serialize(t)}return"["+this.serialize(r)+"]:"+this.serialize(t)}serializeProperties(e,r){let t=r.s;if(t){this.stack.push(e.i);let s=r.k,i=r.v,o=this.serializeProperty(e,s[0],i[0]);for(let a=1,l=o;a<t;a++)l=this.serializeProperty(e,s[a],i[a]),o+=(l&&o&&",")+l;return this.stack.pop(),"{"+o+"}"}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 i=this.serialize(s),o=Number(t),a=o>=0||Pe(t);if(this.isIndexedValueInStack(s))a&&o!==o?this.createObjectAssign(e.i,t,i):this.createArrayAssign(e.i,a?t:'"'+t+'"',i);else{let l=this.assignments;this.assignments=r,a?this.createObjectAssign(e.i,t,i):this.createArrayAssign(e.i,a?t:'"'+t+'"',i),this.assignments=l}}serializeAssignment(e,r,t,s){if(typeof t=="string")this.serializeStringKeyAssignment(e,r,t,s);else{let i=this.stack;this.stack=[];let o=this.serialize(s);this.stack=i;let a=this.assignments;this.assignments=r,this.createArrayAssign(e.i,this.serialize(t),o),this.assignments=a}}serializeAssignments(e,r){let t=r.s;if(t){this.stack.push(e.i);let s=[],i=r.k,o=r.v;for(let a=0;a<t;a++)this.serializeAssignment(e,s,i[a],o[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 i=e.a;this.stack.push(s);let o=this.serializeSetItem(s,i[0]);for(let a=1,l=o;a<t;a++)l=this.serializeSetItem(s,i[a]),o+=(l&&o&&",")+l;this.stack.pop(),o&&(r+="(["+o+"])")}return this.assignIndexedValue(s,r)}serializeMapEntry(e,r,t,s){if(this.isIndexedValueInStack(r)){let i=this.getRefParam(r.i);if(this.markRef(e),this.isIndexedValueInStack(t)){let a=this.getRefParam(t.i);return this.createSetAssignment(e,i,a),""}if(t.t!==4&&t.i!=null&&this.isMarked(t.i)){let a="("+this.serialize(t)+",["+s+","+s+"])";return this.createSetAssignment(e,i,this.getRefParam(t.i)),this.createDeleteAssignment(e,s),a}let o=this.stack;return this.stack=[],this.createSetAssignment(e,i,this.serialize(t)),this.stack=o,""}if(this.isIndexedValueInStack(t)){let i=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),i),this.createDeleteAssignment(e,s),a}let o=this.stack;return this.stack=[],this.createSetAssignment(e,this.serialize(r),i),this.stack=o,""}return"["+this.serialize(r)+","+this.serialize(t)+"]"}serializeMap(e){let r=Ar,t=e.e.s,s=e.i,i=e.f,o=this.getRefParam(i.i);if(t){let a=e.e.k,l=e.e.v;this.stack.push(s);let u=this.serializeMapEntry(s,a[0],l[0],o);for(let g=1,Ae=u;g<t;g++)Ae=this.serializeMapEntry(s,a[g],l[g],o),u+=(Ae&&u&&",")+Ae;this.stack.pop(),u&&(r+="(["+u+"])")}return i.t===26&&(this.markRef(i.i),r="("+this.serialize(i)+","+r+")"),this.assignIndexedValue(s,r)}serializeArrayBuffer(e){let r="new Uint8Array(",t=e.s,s=t.length;if(s){r+="["+t[0];for(let i=1;i<s;i++)r+=","+t[i];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='new AggregateError([],"'+e.m+'")';return this.stack.pop(),this.serializeDictionary(e,t)}serializeError(e){return this.serializeDictionary(e,"new "+Q[e.s]+'("'+e.m+'")')}serializePromise(e){let r,t=e.f,s=e.i,i=e.s?Ir:Er;if(this.isIndexedValueInStack(t)){let o=this.getRefParam(t.i);r=i+(e.s?"().then("+this.createFunction([],o)+")":"().catch("+this.createEffectfulFunction([],"throw "+o)+")")}else{this.stack.push(s);let o=this.serialize(t);this.stack.pop(),r=i+"("+o+")"}return this.assignIndexedValue(s,r)}serializeWellKnownSymbol(e){return this.assignIndexedValue(e.i,De[e.s])}serializeFormDataEntry(e,r,t){return this.getRefParam(e)+'.append("'+r+'",'+this.serialize(t)+")"}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 i=r[t];if(i.tag===e.c)return this.assignIndexedValue(e.i,i.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=[],s=0,f="+this.createEffectfulFunction(["v","m","x"],"for(x=0;x<s;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 i=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+i+")":i}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 i=1;i<t;i++)s+=","+this.serialize(e.a[i]);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,ir="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_",nr=ir.length;function Ce(n){let e=n%tr,r=sr[e];for(n=(n-e)/tr;n>0;)e=n%nr,r+=ir[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(),i=t;if(s){let o=this.getRefParam(r.i);i=t+","+s+o,t.startsWith(o+"=")||(i=o+"="+i)}return"("+this.createFunction(this.vars,"("+i+")")+")()"}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 ue(e,r,this.parseItems(r))}parseProperties(e){let r=Object.entries(e),t=[],s=[];for(let o=0,a=r.length;o<a;o++)t.push(d(r[o][0])),s.push(this.parse(r[o][1]));let i=Symbol.iterator;return i in e&&(t.push(this.parseWellKnownSymbol(i)),s.push(T(this.parseIteratorFactory(),this.parse(D(e))))),i=Symbol.asyncIterator,i in e&&(t.push(this.parseWellKnownSymbol(i)),s.push(F(this.parseAsyncIteratorFactory(),this.parse(E())))),i=Symbol.toStringTag,i in e&&(t.push(this.parseWellKnownSymbol(i)),s.push(b(e[i]))),i=Symbol.isConcatSpreadable,i in e&&(t.push(this.parseWellKnownSymbol(i)),s.push(e[i]?v:N)),{k:t,v:s,s:t.length}}parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,this.parseProperties(r))}parseBoxed(e,r){return de(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[i,o]of r.entries())t.push(this.parse(i)),s.push(this.parse(o));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,i=t.length;s<i;s++){let o=t[s];if(o.parse.sync&&o.test(r))return k(e,o.tag,o.parse.sync(r,this,{id:e}))}}parseStream(e,r){return V(e,this.parseSpecialReference(4),[])}parsePromise(e,r){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}}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 oe(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 i=this.features;if(i&16)switch(s){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(i&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?v:N;case"undefined":return ee;case"string":return b(e);case"number":return se(e);case"bigint":return ie(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 kr(n,e={}){let r=c(e.plugins);return new C({plugins:r,features:n.f,markedRefs:n.m}).serializeTop(n.t)}function Tr(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 i=this.resolvePatches(),o=this.getRefParam(s),a=this.scopeId==null?"":K,l=i?t+","+i+o:t;if(a==="")return i?"("+l+")":l;let u=this.scopeId==null?"()":"("+K+'["'+d(this.scopeId)+'"])';return"("+this.createFunction([a],l)+")"+u}};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=[],i=[];for(let a=0,l=t.length;a<l;a++)s.push(d(t[a][0])),i.push(this.parse(t[a][1]));let o=Symbol.iterator;return o in r&&(s.push(this.parseWellKnownSymbol(o)),i.push(T(this.parseIteratorFactory(),this.parse(D(r))))),o=Symbol.asyncIterator,o in r&&(s.push(this.parseWellKnownSymbol(o)),i.push(F(this.parseAsyncIteratorFactory(),this.parse(xe(r))))),o=Symbol.toStringTag,o in r&&(s.push(this.parseWellKnownSymbol(o)),i.push(b(r[o]))),o=Symbol.isConcatSpreadable,o in r&&(s.push(this.parseWellKnownSymbol(o)),i.push(r[o]?v:N)),{k:s,v:i,s:s.length}}parsePromise(r,t){return t.then(s=>{let i=this.parseWithError(s);i&&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),i],f:void 0,b:void 0,o:void 0}),this.popPendingState()},s=>{if(this.alive){let i=this.parseWithError(s);i&&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),i],f:void 0,b:void 0,o:void 0})}this.popPendingState()}),this.pushPendingState(),{t:22,i:r,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}}parsePlugin(r,t){let s=this.plugins;if(s)for(let i=0,o=s.length;i<o;i++){let a=s[i];if(a.parse.stream&&a.test(t))return k(r,a.tag,a.parse.stream(t,this,{id:r}))}}parseStream(r,t){let s=V(r,this.parseSpecialReference(4),[]);return this.pushPendingState(),t.on({next:i=>{if(this.alive){let o=this.parseWithError(i);o&&this.onParse(he(r,o))}},throw:i=>{if(this.alive){let o=this.parseWithError(i);o&&this.onParse(ye(r,o))}this.popPendingState()},return:i=>{if(this.alive){let o=this.parseWithError(i);o&&this.onParse(ve(r,o))}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 Vr(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 Dr(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,i){let o=new O({plugins:r,features:t.features,scopeId:e.scopeId,markedRefs:t.marked}),a;try{a=o.serializeTop(s)}catch(l){e.onError&&e.onError(l);return}e.onSerialize(a,i)},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+'["'+d(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}}};
|