seroval 0.13.0 → 0.13.1
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 +17 -15
- package/dist/cjs/development/index.cjs +3 -3
- package/dist/cjs/development/index.cjs.map +2 -2
- package/dist/cjs/production/index.cjs +1 -1
- package/dist/esm/development/index.mjs +3 -3
- package/dist/esm/development/index.mjs.map +2 -2
- package/dist/esm/production/index.mjs +1 -1
- package/package.json +3 -3
- package/src/core/context/parser/stream.ts +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
var{toString:Ir}=Object.prototype,m=class extends Error{constructor(r){super('Unsupported type "'+Ir.call(r)+'"');this.value=r}};function f(n,e){if(!n)throw e}var Xe={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"},B={[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},Je={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},Ye={2:"!0",3:"!1",1:"void 0",0:"null",4:"-0",5:"1/0",6:"-1/0",7:"0/0"},Ze={2:!0,3:!1,1:void 0,0:null,4:-0,5:1/0,6:-1/0,7:NaN};var ae={0:"Error",1:"EvalError",2:"RangeError",3:"ReferenceError",4:"SyntaxError",5:"TypeError",6:"URIError"},Qe={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),b=y(3),ie=y(1),I=y(0),er=y(4),rr=y(5),tr=y(6),nr=y(7);function wr(n){switch(n){case'"':return'\\"';case"\\":return"\\\\";case`
|
|
2
2
|
`:return"\\n";case"\r":return"\\r";case"\b":return"\\b";case" ":return"\\t";case"\f":return"\\f";case"<":return"\\x3C";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:return}}function d(n){let e="",r=0,t;for(let a=0,s=n.length;a<s;a++)t=wr(n[a]),t&&(e+=n.slice(r,a)+t,r=a+1);return r===0?e=n:e+=n.slice(r),e}function p(n){return n.replace(/\\"/g,'"').replace(/\\\\/g,"\\").replace(/\\n/g,`
|
|
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 w="__SEROVAL_REFS__",g="_$",V="$R",ze="s",ke="f",Te="P",De="Ps",Fe="Pf",ee="c",Be="S",Ve="Se",Me="St",Le="Sc",sr=`self.${g}`,Pr=`${sr}=${sr}||{${Te}:function(s,f,p){return(p=new Promise(function(a,b){s=a,f=b})).${ze}=s,p.${ke}=f,p},uP:function(p){delete p.${ze};delete p.${ke}},${De}:function(p,d){p.${ze}(d),p.status="success",p.value=d,this.uP(p)},${Fe}:function(p,d){p.${ke}(d),p.status="failure",p.value=d,this.uP(p)},uS:function(s){delete s.${ee}},${Le}:function(s){s.${ee}.close(),this.uS(s)},${Me}:function(s,e){s.${ee}.error(e),this.uS(s)},${Ve}:function(s,d){s.${ee}.enqueue(d)},${Be}:function(s,c){return(s=new ReadableStream({start:function(x){c=x}})).${ee}=c,s}}`,oe=`self.${V}`;function Or(n){return n==null?`${oe}=${oe}||[];`:`(${oe}=${oe}||{})["${d(n)}"]=[];`}var _e=new Map,P=new Map;function Cr(n,e){return _e.set(e,n),P.set(n,e),e}function O(n){return _e.has(n)}function zr(n){return P.has(n)}function ar(n){return f(O(n),new Error("Missing reference id")),_e.get(n)}function ir(n){return f(zr(n),new Error("Missing reference for id:"+n)),P.get(n)}typeof globalThis!==void 0?Object.defineProperty(globalThis,w,{value:P,configurable:!0,writable:!1,enumerable:!1}):typeof window!==void 0?Object.defineProperty(window,w,{value:P,configurable:!0,writable:!1,enumerable:!1}):typeof self!==void 0?Object.defineProperty(self,w,{value:P,configurable:!0,writable:!1,enumerable:!1}):typeof global!==void 0&&Object.defineProperty(global,w,{value:P,configurable:!0,writable:!1,enumerable:!1});var N=(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))(N||{});function de(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 M(n,e){let r,t=ae[de(n)];n.name!==t?r={name:n.name}:n.constructor.name!==t&&(r={name:n.constructor.name});let a=Object.getOwnPropertyNames(n);for(let s=0,i=a.length,o;s<i;s++)o=a[s],o!=="name"&&o!=="message"&&(o==="stack"?e&16&&(r=r||{},r[o]=n[o]):(r=r||{},r[o]=n[o]));return r}function le(n){return Object.isFrozen(n)?3:Object.isSealed(n)?2:Object.isExtensible(n)?0:1}function ue(n){switch(n){case 1/0:return rr;case-1/0:return tr;default:return n!==n?nr:Object.is(n,-0)?er:{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 R(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 ce(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 E(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 L(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 _(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 U(n,e){let r=new Uint8Array(e),t=r.length,a=new Array(t);for(let s=0;s<t;s++)a[s]=r[s];return{t:21,i:n,s:a,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 f(e in B,new Error("Only well-known symbols are supported.")),{t:17,i:n,s:B[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 pe(n,e){return{t:20,i:n,s:d(ar(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 j(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 me(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:le(e)}}function Se(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 ge(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 ye(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 ve(n,e,r){return{t:13,i:n,s:de(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:14,i:n,s:de(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 Ne(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 q(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 Re(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 Ee(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 xe(n){return{headers:n.headers,status:n.status,statusText:n.statusText}}function Ae(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 W(n){let e=[],r=-1,t=-1,a=n[Symbol.iterator]();for(;;)try{let s=a.next();if(e.push(s.value),s.done){t=e.length-1;break}}catch(s){r=e.length,e.push(s)}return{v:e,t:r,d:t}}function dr(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 lr(n){let e=[],r=-1,t=-1,a=n[Symbol.asyncIterator]();for(;;)try{let s=await a.next();if(e.push(s.value),s.done){t=e.length-1;break}}catch(s){r=e.length,e.push(s)}return{v:e,t:r,d:t}}function ur(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 cr(n,e){return new ReadableStream({async start(r){let t=n[Symbol.asyncIterator]();for(;e.isAlive();)try{let a=await t.next();if(r.enqueue([a.done?2:0,a.value]),a.done){r.close();return}}catch(a){r.enqueue([1,a])}r.close()}})}function fr(n){let e=n;return()=>{let[r,t]=e.tee(),a=r;e=t;let s=a.getReader();return{[Symbol.asyncIterator](){return this},async next(){let i=await s.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 pr(n){let e=[],r=-1,t=-1,a=n.getReader();for(;;)try{let s=await a.read();if(e.push(s.value),s.done){t=e.length-1;break}}catch(s){r=e.length,t=r,e.push(s);break}return{v:e,t:r,d:t}}function mr(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 Ue={},je={},qe={},We={},l={};var K=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),E(r);let t=this.refs.size;return this.refs.set(e,t),O(e)?pe(t,e):t}getStrictReference(e){let r=this.refs.get(e);if(r!=null)return this.markRef(r),E(r);let t=this.refs.size;return this.refs.set(e,t),pe(t,e)}parseFunction(e){return f(O(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),E(r);let t=e in B;f(e in B||O(e),new Error("Cannot serialize symbol without reference ID."));let a=this.refs.size;return this.refs.set(e,a),t?fe(a,e):pe(a,e)}parseMapSentinel(){let e=this.refs.get(Ue);if(e!=null)return this.markRef(e),E(e);let r=this.refs.size;return this.refs.set(Ue,r),{t:41,i:r,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}}parseIteratorFactory(){let e=this.refs.get(je);if(e!=null)return this.markRef(e),E(e);let r=this.refs.size;return this.refs.set(je,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(){let e=this.refs.get(qe);if(e!=null)return this.markRef(e),E(e);let r=this.refs.size;return this.refs.set(qe,r),{t:44,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.asyncIterator),b:void 0,o:void 0}}createObjectNode(e,r,t,a){return{t:t?11:10,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:a,e:void 0,a:void 0,f:void 0,b:void 0,o:le(r)}}createMapNode(e,r,t,a){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},a:void 0,f:this.parseMapSentinel(),b:void 0,o:void 0}}parseReadableStreamFactory(){let e=this.refs.get(We);if(e!=null)return this.markRef(e),E(e);let r=this.refs.size;return this.refs.set(We,r),{t:47,i:r,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}}};async function Ke(n){try{return[1,await n]}catch(e){return[0,e]}}function H(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 G(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 $(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 we(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 Pe(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 Sr(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 K{async parseItems(e){let r=[];for(let t=0,a=e.length;t<a;t++)t in e&&(r[t]=await this.parse(e[t]));return r}async parseArray(e,r){return me(e,r,await this.parseItems(r))}async parseProperties(e){let r=Object.entries(e),t=[],a=[];for(let s=0,i=r.length;s<i;s++)t.push(d(r[s][0])),a.push(await this.parse(r[s][1]));if(this.features&1024){let s=Symbol.iterator;s in e&&(t.push(this.parseWKSymbol(s)),a.push(q(this.parseIteratorFactory(),await this.parse(W(e))))),s=Symbol.asyncIterator,s in e&&(t.push(this.parseWKSymbol(s)),a.push(Re(this.parseAsyncIteratorFactory(),await this.parse(await lr(e))))),s=Symbol.toStringTag,s in e&&(t.push(this.parseWKSymbol(s)),a.push(R(e[s]))),s=Symbol.isConcatSpreadable,s in e&&(t.push(this.parseWKSymbol(s)),a.push(e[s]?v:b))}return{k:t,v:a,s:t.length}}async parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,await this.parseProperties(r))}async parseBoxed(e,r){return Se(e,await this.parse(r.valueOf()))}async parseTypedArray(e,r){return ge(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 ye(e,r,await this.parse(r.buffer))}async parseError(e,r){let t=M(r,this.features);return ve(e,r,t?await this.parseProperties(t):void 0)}async parseAggregateError(e,r){let t=M(r,this.features);return be(e,r,t?await this.parseProperties(t):void 0)}async parseMap(e,r){let t=[],a=[];for(let[s,i]of r.entries())t.push(await this.parse(s)),a.push(await this.parse(i));return this.createMapNode(e,t,a,r.size)}async parseSet(e,r){let t=[];for(let a of r.keys())t.push(await this.parse(a));return Ne(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=[],a=[];for(let s=0;s<r;s++)t.push(d(e[s][0])),a.push(await this.parse(e[s][1]));return{k:t,v:a,s:r}}async parseHeaders(e,r){let t=[];return r.forEach((a,s)=>{t.push([s,a])}),{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((a,s)=>{t.push([s,a])}),{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(Ee(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()):I,await this.parse(xe(r))],b:void 0,o:void 0}}async parseEvent(e,r){return we(e,r.type,await this.parse(Ae(r)))}async parseCustomEvent(e,r){return Pe(e,r.type,await this.parse(Ie(r)))}async parsePromise(e,r){let[t,a]=await Ke(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(a),b:void 0,o:void 0}}async parsePlugin(e,r){let t=this.plugins;if(t)for(let a=0,s=t.length;a<s;a++){let i=t[a];if(i.parse.async&&i.test(r))return j(e,i.tag,await i.parse.async(r,this,{id:e}))}}async parseReadableStream(e,r){return Sr(e,this.parseReadableStreamFactory(),await this.parse(await pr(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 L(e,r);case RegExp:return _(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 a=this.features;if(a&256&&(t===Promise||r instanceof Promise))return this.parsePromise(e,r);if(a&2048)switch(t){case ArrayBuffer:return U(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((a&4104)===4104)switch(t){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(a&32&&t===Map)return this.parseMap(e,r);if(a&512&&t===Set)return this.parseSet(e,r);if(a&8192)switch(t){case(typeof URL!="undefined"?URL:l):return H(e,r);case(typeof URLSearchParams!="undefined"?URLSearchParams:l):return G(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 $(e,r);case(typeof ReadableStream!="undefined"?ReadableStream:l):return this.parseReadableStream(e,r);default:break}let s=await this.parsePlugin(e,r);if(s)return s;if(a&1&&typeof AggregateError!="undefined"&&(t===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(a&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 ie;case null:return I;default:break}switch(typeof e){case"string":return R(e);case"number":return ue(e);case"bigint":return f(this.features&8,new m(e)),ce(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 X=class extends C{constructor(){super(...arguments);this.mode="vanilla"}};function gr(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 He(){let n,e;return{promise:new Promise((r,t)=>{n=r,e=t}),resolve(r){n(r)},reject(r){e(r)}}}function hr(){let n;return{stream:new ReadableStream({start(e){n=e}}),close(){n.close()},enqueue(e){n.enqueue(e)},error(e){n.error(e)}}}function yr(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,ir(p(e.s)))}deserializeArray(e){let r=e.l,t=this.assignIndexedValue(e.i,new Array(r)),a;for(let s=0;s<r;s++)a=e.a[s],a&&(t[s]=this.deserialize(a));return yr(t,e.o),t}deserializeProperties(e,r){let t=e.s;if(t){let a=e.k,s=e.v;for(let i=0,o;i<t;i++)o=a[i],typeof o=="string"?r[p(o)]=this.deserialize(s[i]):r[this.deserialize(o)]=this.deserialize(s[i])}return r}deserializeObject(e){let r=this.assignIndexedValue(e.i,e.t===10?{}:Object.create(null));return this.deserializeProperties(e.p,r),yr(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 a=0,s=e.l;a<s;a++)r.add(this.deserialize(t[a]));return r}deserializeMap(e){let r=this.assignIndexedValue(e.i,new Map),t=e.e.k,a=e.e.v;for(let s=0,i=e.e.s;s<i;s++)r.set(this.deserialize(t[s]),this.deserialize(a[s]));return r}deserializeArrayBuffer(e){let r=new Uint8Array(e.s);return this.assignIndexedValue(e.i,r.buffer)}deserializeTypedArray(e){let r=gr(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=Qe[e.s],t=this.assignIndexedValue(e.i,new r(p(e.m)));return this.deserializeDictionary(e,t)}async deserializePromise(e){let r=He(),t=this.assignIndexedValue(e.i,r),a=this.deserialize(e.f);return e.s?r.resolve(a):r.reject(a),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,a=e.e.v;for(let s=0,i=e.e.s;s<i;s++)r.set(p(t[s]),this.deserialize(a[s]));return r}deserializeFormData(e){let r=this.assignIndexedValue(e.i,new FormData),t=e.e.k,a=e.e.v;for(let s=0,i=e.e.s;s<i;s++)r.set(p(t[s]),this.deserialize(a[s]));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,a=r.length;t<a;t++){let s=r[t];if(s.tag===e.c)return this.assignIndexedValue(e.i,s.deserialize(e.s,this,{id:e.i}))}throw new Error('Missing plugin for tag "'+e.c+'".')}deserializePromiseConstructor(e){return this.assignIndexedValue(e.i,He()).promise}deserializePromiseResolve(e){let r=this.refs.get(e.i);f(r,new Error("Missing Promise instance.")),r.resolve(this.deserialize(e.f))}deserializePromiseReject(e){let r=this.refs.get(e.i);f(r,new Error("Missing Promise instance.")),r.reject(this.deserialize(e.f))}deserializeReadableStreamConstructor(e){return this.assignIndexedValue(e.i,hr()).stream}deserializeReadableStreamEnqueue(e){let r=this.refs.get(e.i);f(r,new Error("Missing ReadableStream instance.")),r.enqueue(this.deserialize(e.f))}deserializeReadableStreamError(e){let r=this.refs.get(e.i);f(r,new Error("Missing Promise instance.")),r.error(this.deserialize(e.f))}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 dr(r)}deserializeAsyncIteratorFactoryInstance(e){let r=this.deserialize(e.a[1]);return r.constructor===ReadableStream?fr(r):ur(r)}deserializeReadableStream(e){return this.assignIndexedValue(e.i,mr(this.deserialize(e.a[1])))}deserialize(e){switch(e.t){case 2:return Ze[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 Je[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:case 47:default:throw new Error("invariant")}}};var re=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 Tr=/^[$A-Z_][0-9A-Z_$]*$/i;function Ge(n){let e=n[0];return(e==="$"||e==="_"||e>="A"&&e<="Z"||e>="a"&&e<="z")&&Tr.test(n)}function te(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 Dr(n){let e=[],r=n[0];for(let t=1,a=n.length,s,i=r;t<a;t++)s=n[t],s.t==="index"&&s.v===i.v?r={t:"index",s:s.s,k:void 0,v:te(r)}:s.t==="set"&&s.s===i.s?r={t:"set",s:te(r),k:s.k,v:s.v}:s.t==="add"&&s.s===i.s?r={t:"add",s:te(r),k:void 0,v:s.v}:s.t==="delete"&&s.s===i.s?r={t:"delete",s:te(r),k:s.k,v:void 0}:(e.push(r),r=s),i=s;return e.push(r),e}function vr(n){if(n.length){let e="",r=Dr(n);for(let t=0,a=r.length;t<a;t++)e+=te(r[t])+",";return e}}var Fr="Object.create(null)",Br="new Set",Vr="new Map",Mr="Promise.resolve",Lr="Promise.reject",_r={3:"Object.freeze",2:"Object.seal",1:"Object.preventExtensions",0:void 0},k=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,a=t.length;r<a;r++){let s=t[r];e+=_r[s.type]+"("+s.value+"),"}return e}resolvePatches(){let e=vr(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,w+'.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,a=this.serializeArrayItem(r,t[0],0),s=a==="";for(let i=1,o=e.l,c;i<o;i++)c=this.serializeArrayItem(r,t[i],i),a+=","+c,s=c==="";return this.stack.pop(),this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(r,"["+a+(s?",]":"]"))}return this.assignIndexedValue(r,"[]")}serializeProperty(e,r,t){if(typeof r=="string"){let a=Number(r),s=a>=0||Ge(r);if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);return this.markRef(e.i),s&&a!==a?this.createObjectAssign(e.i,r,i):this.createArrayAssign(e.i,s?r:'"'+r+'"',i),""}return(s?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 a=r.k,s=r.v,i=this.serializeProperty(e,a[0],s[0]);for(let o=1,c=i;o<t;o++)c=this.serializeProperty(e,a[o],s[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 a=this.serializeProperties(e,r);return a!=="{}"?"Object.assign("+t+","+a+")":t}serializeAssignment(e,r,t,a){if(typeof t=="string"){let s=this.serialize(a),i=Number(t),o=i>=0||Ge(t);if(this.isIndexedValueInStack(a))o&&i!==i?this.createObjectAssign(e.i,t,s):this.createArrayAssign(e.i,o?t:'"'+t+'"',s);else{let c=this.assignments;this.assignments=r,o?this.createObjectAssign(e.i,t,s):this.createArrayAssign(e.i,o?t:'"'+t+'"',s),this.assignments=c}}else{let s=this.stack;this.stack=[];let i=this.serialize(a);this.stack=s;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 a=[],s=r.k,i=r.v;for(let o=0;o<t;o++)this.serializeAssignment(e,a,s[o],i[o]);return this.stack.pop(),vr(a)}}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,Fr)}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=Br,t=e.l,a=e.i;if(t){let s=e.a;this.stack.push(a);let i=this.serializeSetItem(a,s[0]);for(let o=1,c=i;o<t;o++)c=this.serializeSetItem(a,s[o]),i+=(c&&i&&",")+c;this.stack.pop(),i&&(r+="(["+i+"])")}return this.assignIndexedValue(a,r)}serializeMapEntry(e,r,t,a){if(this.isIndexedValueInStack(r)){let s=this.getRefParam(r.i);if(this.markRef(e),this.isIndexedValueInStack(t)){let o=this.getRefParam(t.i);return this.createSetAssignment(e,s,o),""}if(t.t!==4&&t.i!=null&&this.isMarked(t.i)){let o="("+this.serialize(t)+",["+a+","+a+"])";return this.createSetAssignment(e,s,this.getRefParam(t.i)),this.createDeleteAssignment(e,a),o}let i=this.stack;return this.stack=[],this.createSetAssignment(e,s,this.serialize(t)),this.stack=i,""}if(this.isIndexedValueInStack(t)){let s=this.getRefParam(t.i);if(this.markRef(e),r.t!==4&&r.i!=null&&this.isMarked(r.i)){let o="("+this.serialize(r)+",["+a+","+a+"])";return this.createSetAssignment(e,this.getRefParam(r.i),s),this.createDeleteAssignment(e,a),o}let i=this.stack;return this.stack=[],this.createSetAssignment(e,this.serialize(r),s),this.stack=i,""}return"["+this.serialize(r)+","+this.serialize(t)+"]"}serializeMap(e){let r=Vr,t=e.e.s,a=e.i,s=e.f,i=this.getRefParam(s.i);if(t){let o=e.e.k,c=e.e.v;this.stack.push(a);let A=this.serializeMapEntry(a,o[0],c[0],i);for(let F=1,Ce=A;F<t;F++)Ce=this.serializeMapEntry(a,o[F],c[F],i),A+=(Ce&&A&&",")+Ce;this.stack.pop(),A&&(r+="(["+A+"])")}return s.t===41&&(this.markRef(s.i),r="("+this.serialize(s)+","+r+")"),this.assignIndexedValue(a,r)}serializeArrayBuffer(e){let r="new Uint8Array(",t=e.s,a=t.length;if(a){r+="["+t[0];for(let s=1;s<a;s++)r+=","+t[s];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 "+ae[e.s]+'("'+e.m+'")')}serializePromise(e){let r,t=e.f,a=e.i,s=e.s?Mr:Lr;if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);r=s+(e.s?"().then("+this.createFunction([],i)+")":"().catch("+this.createEffectfulFunction([],"throw "+i)+")")}else{this.stack.push(a);let i=this.serialize(t);this.stack.pop(),r=s+"("+i+")"}return this.assignIndexedValue(a,r)}serializeWKSymbol(e){return this.assignIndexedValue(e.i,Xe[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,a=e.e.v,s=e.i,i=this.serializeFormDataEntry(s,t[0],a[0]);for(let o=1;o<r;o++)i+=","+this.serializeFormDataEntry(s,t[o],a[o]);return i}serializeFormData(e){let r=e.e.s,t=e.i;r&&this.markRef(t);let a=this.assignIndexedValue(t,"new FormData()");if(r){let s=this.serializeFormDataEntries(e,r);return"("+a+","+(s?s+",":"")+this.getRefParam(t)+")"}return a}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,a=r.length;t<a;t++){let s=r[t];if(s.tag===e.c)return this.assignIndexedValue(e.i,s.serialize(e.s,this,{id:e.i}))}throw new Error('Missing plugin for tag "'+e.c+'".')}serializeMapSentinel(e){return this.assignIndexedValue(e.i,"[]")}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.serialize(e.a[0])+")("+this.serialize(e.a[1])+")"}serializeAsyncIteratorFactory(e){return this.assignIndexedValue(e.i,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}")+")")+"})")))}serializeAsyncIteratorFactoryInstance(e){return"("+this.serialize(e.a[0])+")("+this.serialize(e.a[1])+")"}serializeReadableStream(e){this.stack.push(e.i);let r="("+this.serialize(e.a[0])+")("+this.serialize(e.a[1])+")";return this.stack.pop(),this.assignIndexedValue(e.i,r)}serializeReadableStreamFactory(e){return this.assignIndexedValue(e.i,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])")+")")+"})"))}serialize(e){switch(e.t){case 2:return Ye[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.serializeMapSentinel(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);case 47:return this.serializeReadableStreamFactory(e);default:throw new Error("invariant")}}};var Rr="hjkmoquxzABCDEFGHIJKLNPQRTUVWXYZ$_",br=Rr.length,Er="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_",Nr=Er.length;function $e(n){let e=n%br,r=Rr[e];for(n=(n-e)/br;n>0;)e=n%Nr,r+=Er[e],n=(n-e)/Nr;return r}var T=class extends k{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 a=this.vars[t];return a==null&&(a=$e(t),this.vars[t]=a),a}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 a=this.resolvePatches(),s=t;if(a){let i=this.getRefParam(r.i);s=t+","+a+i,t.startsWith(i+"=")||(s=i+"="+s)}return"("+this.createFunction(this.vars,"("+s+")")+")()"}return r.t===10?"("+t+")":t}};var h=class extends K{parseItems(e){let r=[];for(let t=0,a=e.length;t<a;t++)t in e&&(r[t]=this.parse(e[t]));return r}parseArray(e,r){return me(e,r,this.parseItems(r))}parseProperties(e){let r=Object.entries(e),t=[],a=[];for(let s=0,i=r.length;s<i;s++)t.push(d(r[s][0])),a.push(this.parse(r[s][1]));if(this.features&1024){let s=Symbol.iterator;s in e&&(t.push(this.parseWKSymbol(s)),a.push(q(this.parseIteratorFactory(),this.parse(W(e))))),s=Symbol.toStringTag,s in e&&(t.push(this.parseWKSymbol(s)),a.push(R(e[s]))),s=Symbol.isConcatSpreadable,s in e&&(t.push(this.parseWKSymbol(s)),a.push(e[s]?v:b))}return{k:t,v:a,s:t.length}}parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,this.parseProperties(r))}parseBoxed(e,r){return Se(e,this.parse(r.valueOf()))}parseTypedArray(e,r){return ge(e,r,this.parse(r.buffer))}parseBigIntTypedArray(e,r){return he(e,r,this.parse(r.buffer))}parseDataView(e,r){return ye(e,r,this.parse(r.buffer))}parseError(e,r){let t=M(r,this.features);return ve(e,r,t?this.parseProperties(t):void 0)}parseAggregateError(e,r){let t=M(r,this.features);return be(e,r,t?this.parseProperties(t):void 0)}parseMap(e,r){let t=[],a=[];for(let[s,i]of r.entries())t.push(this.parse(s)),a.push(this.parse(i));return this.createMapNode(e,t,a,r.size)}parseSet(e,r){let t=[];for(let a of r.keys())t.push(this.parse(a));return Ne(e,r.size,t)}parsePlainProperties(e){let r=e.length,t=[],a=[];for(let s=0;s<r;s++)t.push(d(e[s][0])),a.push(this.parse(e[s][1]));return{k:t,v:a,s:r}}parseHeaders(e,r){let t=[];return r.forEach((a,s)=>{t.push([s,a])}),{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((a,s)=>{t.push([s,a])}),{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 we(e,r.type,this.parse(Ae(r)))}parseCustomEvent(e,r){return Pe(e,r.type,this.parse(Ie(r)))}parsePlugin(e,r){let t=this.plugins;if(t)for(let a=0,s=t.length;a<s;a++){let i=t[a];if(i.parse.sync&&i.test(r))return j(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 L(e,r);case RegExp:return _(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 a=this.features;if(a&2048)switch(t){case ArrayBuffer:return U(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((a&4104)===4104)switch(t){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(a&32&&t===Map)return this.parseMap(e,r);if(a&512&&t===Set)return this.parseSet(e,r);if(a&8192)switch(t){case(typeof URL!="undefined"?URL:l):return H(e,r);case(typeof URLSearchParams!="undefined"?URLSearchParams:l):return G(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 $(e,r);default:break}let s=this.parsePlugin(e,r);if(s)return s;if(a&1&&typeof AggregateError!="undefined"&&(t===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(a&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 ie;case null:return I;default:break}switch(typeof e){case"string":return R(e);case"number":return ue(e);case"bigint":return f(this.features&8,new m(e)),ce(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"?fe(r,e):r}case"function":return f(O(e),new Error("Cannot serialize function without reference ID.")),this.getStrictReference(e);default:throw new m(e)}}};var J=class extends h{constructor(){super(...arguments);this.mode="vanilla"}};function xr(n,e={}){let r=new J({plugins:e.plugins,disabledFeatures:e.disabledFeatures}),t=r.parse(n);return new T({plugins:e.plugins,features:r.features,markedRefs:r.marked}).serializeTop(t)}async function Mn(n,e={}){let r=new X({plugins:e.plugins,disabledFeatures:e.disabledFeatures}),t=await r.parse(n);return new T({plugins:e.plugins,features:r.features,markedRefs:r.marked}).serializeTop(t)}function Ln(n){return(0,eval)(n)}function _n(n,e={}){let r=new J({plugins:e.plugins,disabledFeatures:e.disabledFeatures});return{t:r.parse(n),f:r.features,m:Array.from(r.marked)}}async function Un(n,e={}){let r=new X({plugins:e.plugins,disabledFeatures:e.disabledFeatures});return{t:await r.parse(n),f:r.features,m:Array.from(r.marked)}}function jn(n,e={}){return new T({plugins:e.plugins,features:n.f,markedRefs:n.m}).serializeTop(n.t)}function qn(n,e={}){return new re({plugins:e.plugins,markedRefs:n.m}).deserialize(n.t)}var Y=class extends C{constructor(){super(...arguments);this.mode="cross"}};var ne=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 k{constructor(r){super(r);this.mode="cross";this.scopeId=r.scopeId}getRefParam(r){return typeof r=="string"?V+"."+r:V+"["+r+"]"}assignIndexedValue(r,t){return this.getRefParam(r)+"="+t}serializePromiseConstructor(r){return this.assignIndexedValue(r.i,g+"."+Te+"()")}serializePromiseResolve(r){return g+"."+De+"("+this.getRefParam(r.i)+","+this.serialize(r.f)+")"}serializePromiseReject(r){return g+"."+Fe+"("+this.getRefParam(r.i)+","+this.serialize(r.f)+")"}serializeReadableStreamConstructor(r){return this.assignIndexedValue(r.i,g+"."+Be+"()")}serializeReadableStreamEnqueue(r){return g+"."+Ve+"("+this.getRefParam(r.i)+","+this.serialize(r.f)+")"}serializeReadableStreamError(r){return g+"."+Me+"("+this.getRefParam(r.i)+","+this.serialize(r.f)+")"}serializeReadableStreamClose(r){return g+"."+Le+"("+this.getRefParam(r.i)+")"}serializeAsyncIteratorFactory(r){return this.assignIndexedValue(r.i,this.createFunction(["s"],this.createFunction(["b","t"],"(b=s.tee(),s=b[0],b=b[1].getReader(),t={["+this.serialize(r.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]}")+")")+"})")))}serializeTop(r){let t=this.serialize(r),a=r.i;if(a==null)return t;let s=this.resolvePatches(),i=this.getRefParam(a),o=this.scopeId==null?"":V,c=s?t+","+s:t;if(o==="")return s?"("+c+i+")":c;let A=this.scopeId==null?"()":"("+V+'["'+d(this.scopeId)+'"])',F=c+(s?i:"");return"("+this.createFunction([o],F)+")"+A}};var se=class extends h{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){this.onParseCallback(r,t)}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),a=[],s=[];for(let i=0,o=t.length;i<o;i++)a.push(d(t[i][0])),s.push(this.parse(t[i][1]));if(this.features&1024){let i=Symbol.iterator;i in r&&(a.push(this.parseWKSymbol(i)),s.push(q(this.parseIteratorFactory(),this.parse(W(r))))),i=Symbol.asyncIterator,i in r&&(a.push(this.parseWKSymbol(i)),s.push(Re(this.parseAsyncIteratorFactory(),this.parse(cr(r,this))))),i=Symbol.toStringTag,i in r&&(a.push(this.parseWKSymbol(i)),s.push(R(r[i]))),i=Symbol.isConcatSpreadable,i in r&&(a.push(this.parseWKSymbol(i)),s.push(r[i]?v:b))}return{k:a,v:s,s:a.length}}pushReadableStreamReader(r,t){t.read().then(a=>{if(this.alive)if(a.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:void 0,b:void 0,o:void 0},!1),this.popPendingState();else{let s=this.parseWithError(a.value);s&&(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:void 0,f:s,b:void 0,o:void 0},!1),this.pushReadableStreamReader(r,t))}},a=>{if(this.alive){let s=this.parseWithError(a);s&&(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:void 0,f:s,b:void 0,o:void 0},!1),this.popPendingState())}})}parseReadableStream(r,t){let a=t.getReader();return this.pushPendingState(),this.pushReadableStreamReader(r,a),{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:void 0,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(Ee(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):I,this.parse(xe(t))],b:void 0,o:void 0}}parsePromise(r,t){return t.then(a=>{let s=this.parseWithError(a);s&&(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:void 0,f:s,b:void 0,o:void 0},!1),this.popPendingState())},a=>{if(this.alive){let s=this.parseWithError(a);s&&(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:void 0,f:s,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:void 0,b:void 0,o:void 0}}parsePlugin(r,t){let a=this.plugins;if(a)for(let s=0,i=a.length;s<i;s++){let o=a[s];if(o.parse.stream&&o.test(t))return j(r,o.tag,o.parse.stream(t,this,{id:r}))}}parseObject(r,t){if(Array.isArray(t))return this.parseArray(r,t);let a=t.constructor;switch(a){case Object:return this.parsePlainObject(r,t,!1);case void 0:return this.parsePlainObject(r,t,!0);case Date:return L(r,t);case RegExp:return _(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 s=this.features;if(s&256&&(a===Promise||t instanceof Promise))return this.parsePromise(r,t);if(s&2048)switch(a){case ArrayBuffer:return U(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((s&4104)===4104)switch(a){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(r,t);default:break}if(s&32&&a===Map)return this.parseMap(r,t);if(s&512&&a===Set)return this.parseSet(r,t);if(s&8192)switch(a){case(typeof URL!="undefined"?URL:l):return H(r,t);case(typeof URLSearchParams!="undefined"?URLSearchParams:l):return G(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 $(r,t);default:break}let i=this.parsePlugin(r,t);if(i)return i;if(s&1&&typeof AggregateError!="undefined"&&(a===AggregateError||t instanceof AggregateError))return this.parseAggregateError(r,t);if(t instanceof Error)return this.parseError(r,t);if(s&1024&&(Symbol.iterator in t||Symbol.asyncIterator in t))return this.parsePlainObject(r,t,!!a);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 se{constructor(){super(...arguments);this.mode="cross"}};var Q=class extends h{constructor(){super(...arguments);this.mode="cross"}};function bs(n,e={}){let r=new Q({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}),t=r.parse(n);return new D({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked}).serializeTop(t)}async function Ns(n,e={}){let r=new Y({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}),t=await r.parse(n);return new D({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked}).serializeTop(t)}function Rs(n,e={}){return new Q({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}async function Es(n,e={}){return new Y({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}function Ar(n,e){let r=new Z({plugins:e.plugins,refs:e.refs,disabledFeatures:e.disabledFeatures,onParse(t,a){let s=new D({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked}),i;try{i=s.serializeTop(t)}catch(o){e.onError&&e.onError(o);return}e.onSerialize(i,a)},onError:e.onError,onDone:e.onDone});return r.start(n),()=>{r.destroy()}}function xs(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 As(n,e){return new ne({plugins:e.plugins,refs:e.refs}).deserialize(n)}var Oe=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(Ar(r,{plugins:this.options.plugins,scopeId:this.options.scopeId,refs:this.refs,disabledFeatures:this.options.disabledFeatures,onError:this.options.onError,onSerialize:(t,a)=>{this.alive&&this.options.onData(a?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 Cs(n){return n}var Ts=xr;export{N as Feature,Pr as GLOBAL_CONTEXT_API_SCRIPT,Oe as Serializer,jn as compileJSON,Cs as createPlugin,Cr as createReference,bs as crossSerialize,Ns as crossSerializeAsync,Ar as crossSerializeStream,Ts as default,Ln as deserialize,As as fromCrossJSON,qn as fromJSON,Or as getCrossReferenceHeader,xr as serialize,Mn as serializeAsync,Rs as toCrossJSON,Es as toCrossJSONAsync,xs as toCrossJSONStream,_n as toJSON,Un as toJSONAsync};
|
|
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 w="__SEROVAL_REFS__",g="_$",V="$R",ze="s",ke="f",Te="P",De="Ps",Fe="Pf",ee="c",Be="S",Ve="Se",Me="St",Le="Sc",sr=`self.${g}`,Pr=`${sr}=${sr}||{${Te}:function(s,f,p){return(p=new Promise(function(a,b){s=a,f=b})).${ze}=s,p.${ke}=f,p},uP:function(p){delete p.${ze};delete p.${ke}},${De}:function(p,d){p.${ze}(d),p.status="success",p.value=d,this.uP(p)},${Fe}:function(p,d){p.${ke}(d),p.status="failure",p.value=d,this.uP(p)},uS:function(s){delete s.${ee}},${Le}:function(s){s.${ee}.close(),this.uS(s)},${Me}:function(s,e){s.${ee}.error(e),this.uS(s)},${Ve}:function(s,d){s.${ee}.enqueue(d)},${Be}:function(s,c){return(s=new ReadableStream({start:function(x){c=x}})).${ee}=c,s}}`,oe=`self.${V}`;function Or(n){return n==null?`${oe}=${oe}||[];`:`(${oe}=${oe}||{})["${d(n)}"]=[];`}var _e=new Map,P=new Map;function Cr(n,e){return _e.set(e,n),P.set(n,e),e}function O(n){return _e.has(n)}function zr(n){return P.has(n)}function ar(n){return f(O(n),new Error("Missing reference id")),_e.get(n)}function ir(n){return f(zr(n),new Error("Missing reference for id:"+n)),P.get(n)}typeof globalThis!==void 0?Object.defineProperty(globalThis,w,{value:P,configurable:!0,writable:!1,enumerable:!1}):typeof window!==void 0?Object.defineProperty(window,w,{value:P,configurable:!0,writable:!1,enumerable:!1}):typeof self!==void 0?Object.defineProperty(self,w,{value:P,configurable:!0,writable:!1,enumerable:!1}):typeof global!==void 0&&Object.defineProperty(global,w,{value:P,configurable:!0,writable:!1,enumerable:!1});var N=(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))(N||{});function de(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 M(n,e){let r,t=ae[de(n)];n.name!==t?r={name:n.name}:n.constructor.name!==t&&(r={name:n.constructor.name});let a=Object.getOwnPropertyNames(n);for(let s=0,i=a.length,o;s<i;s++)o=a[s],o!=="name"&&o!=="message"&&(o==="stack"?e&16&&(r=r||{},r[o]=n[o]):(r=r||{},r[o]=n[o]));return r}function le(n){return Object.isFrozen(n)?3:Object.isSealed(n)?2:Object.isExtensible(n)?0:1}function ue(n){switch(n){case 1/0:return rr;case-1/0:return tr;default:return n!==n?nr:Object.is(n,-0)?er:{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 R(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 ce(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 E(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 L(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 _(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 U(n,e){let r=new Uint8Array(e),t=r.length,a=new Array(t);for(let s=0;s<t;s++)a[s]=r[s];return{t:21,i:n,s:a,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 f(e in B,new Error("Only well-known symbols are supported.")),{t:17,i:n,s:B[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 pe(n,e){return{t:20,i:n,s:d(ar(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 j(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 me(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:le(e)}}function Se(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 ge(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 ye(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 ve(n,e,r){return{t:13,i:n,s:de(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:14,i:n,s:de(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 Ne(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 q(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 Re(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 Ee(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 xe(n){return{headers:n.headers,status:n.status,statusText:n.statusText}}function Ae(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 W(n){let e=[],r=-1,t=-1,a=n[Symbol.iterator]();for(;;)try{let s=a.next();if(e.push(s.value),s.done){t=e.length-1;break}}catch(s){r=e.length,e.push(s)}return{v:e,t:r,d:t}}function dr(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 lr(n){let e=[],r=-1,t=-1,a=n[Symbol.asyncIterator]();for(;;)try{let s=await a.next();if(e.push(s.value),s.done){t=e.length-1;break}}catch(s){r=e.length,e.push(s)}return{v:e,t:r,d:t}}function ur(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 cr(n,e){return new ReadableStream({async start(r){let t=n[Symbol.asyncIterator]();for(;e.isAlive();)try{let a=await t.next();if(r.enqueue([a.done?2:0,a.value]),a.done){r.close();return}}catch(a){r.enqueue([1,a])}r.close()}})}function fr(n){let e=n;return()=>{let[r,t]=e.tee(),a=r;e=t;let s=a.getReader();return{[Symbol.asyncIterator](){return this},async next(){let i=await s.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 pr(n){let e=[],r=-1,t=-1,a=n.getReader();for(;;)try{let s=await a.read();if(e.push(s.value),s.done){t=e.length-1;break}}catch(s){r=e.length,t=r,e.push(s);break}return{v:e,t:r,d:t}}function mr(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 Ue={},je={},qe={},We={},l={};var K=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),E(r);let t=this.refs.size;return this.refs.set(e,t),O(e)?pe(t,e):t}getStrictReference(e){let r=this.refs.get(e);if(r!=null)return this.markRef(r),E(r);let t=this.refs.size;return this.refs.set(e,t),pe(t,e)}parseFunction(e){return f(O(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),E(r);let t=e in B;f(e in B||O(e),new Error("Cannot serialize symbol without reference ID."));let a=this.refs.size;return this.refs.set(e,a),t?fe(a,e):pe(a,e)}parseMapSentinel(){let e=this.refs.get(Ue);if(e!=null)return this.markRef(e),E(e);let r=this.refs.size;return this.refs.set(Ue,r),{t:41,i:r,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}}parseIteratorFactory(){let e=this.refs.get(je);if(e!=null)return this.markRef(e),E(e);let r=this.refs.size;return this.refs.set(je,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(){let e=this.refs.get(qe);if(e!=null)return this.markRef(e),E(e);let r=this.refs.size;return this.refs.set(qe,r),{t:44,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.asyncIterator),b:void 0,o:void 0}}createObjectNode(e,r,t,a){return{t:t?11:10,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:a,e:void 0,a:void 0,f:void 0,b:void 0,o:le(r)}}createMapNode(e,r,t,a){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},a:void 0,f:this.parseMapSentinel(),b:void 0,o:void 0}}parseReadableStreamFactory(){let e=this.refs.get(We);if(e!=null)return this.markRef(e),E(e);let r=this.refs.size;return this.refs.set(We,r),{t:47,i:r,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}}};async function Ke(n){try{return[1,await n]}catch(e){return[0,e]}}function H(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 G(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 $(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 we(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 Pe(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 Sr(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 K{async parseItems(e){let r=[];for(let t=0,a=e.length;t<a;t++)t in e&&(r[t]=await this.parse(e[t]));return r}async parseArray(e,r){return me(e,r,await this.parseItems(r))}async parseProperties(e){let r=Object.entries(e),t=[],a=[];for(let s=0,i=r.length;s<i;s++)t.push(d(r[s][0])),a.push(await this.parse(r[s][1]));if(this.features&1024){let s=Symbol.iterator;s in e&&(t.push(this.parseWKSymbol(s)),a.push(q(this.parseIteratorFactory(),await this.parse(W(e))))),s=Symbol.asyncIterator,s in e&&(t.push(this.parseWKSymbol(s)),a.push(Re(this.parseAsyncIteratorFactory(),await this.parse(await lr(e))))),s=Symbol.toStringTag,s in e&&(t.push(this.parseWKSymbol(s)),a.push(R(e[s]))),s=Symbol.isConcatSpreadable,s in e&&(t.push(this.parseWKSymbol(s)),a.push(e[s]?v:b))}return{k:t,v:a,s:t.length}}async parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,await this.parseProperties(r))}async parseBoxed(e,r){return Se(e,await this.parse(r.valueOf()))}async parseTypedArray(e,r){return ge(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 ye(e,r,await this.parse(r.buffer))}async parseError(e,r){let t=M(r,this.features);return ve(e,r,t?await this.parseProperties(t):void 0)}async parseAggregateError(e,r){let t=M(r,this.features);return be(e,r,t?await this.parseProperties(t):void 0)}async parseMap(e,r){let t=[],a=[];for(let[s,i]of r.entries())t.push(await this.parse(s)),a.push(await this.parse(i));return this.createMapNode(e,t,a,r.size)}async parseSet(e,r){let t=[];for(let a of r.keys())t.push(await this.parse(a));return Ne(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=[],a=[];for(let s=0;s<r;s++)t.push(d(e[s][0])),a.push(await this.parse(e[s][1]));return{k:t,v:a,s:r}}async parseHeaders(e,r){let t=[];return r.forEach((a,s)=>{t.push([s,a])}),{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((a,s)=>{t.push([s,a])}),{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(Ee(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()):I,await this.parse(xe(r))],b:void 0,o:void 0}}async parseEvent(e,r){return we(e,r.type,await this.parse(Ae(r)))}async parseCustomEvent(e,r){return Pe(e,r.type,await this.parse(Ie(r)))}async parsePromise(e,r){let[t,a]=await Ke(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(a),b:void 0,o:void 0}}async parsePlugin(e,r){let t=this.plugins;if(t)for(let a=0,s=t.length;a<s;a++){let i=t[a];if(i.parse.async&&i.test(r))return j(e,i.tag,await i.parse.async(r,this,{id:e}))}}async parseReadableStream(e,r){return Sr(e,this.parseReadableStreamFactory(),await this.parse(await pr(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 L(e,r);case RegExp:return _(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 a=this.features;if(a&256&&(t===Promise||r instanceof Promise))return this.parsePromise(e,r);if(a&2048)switch(t){case ArrayBuffer:return U(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((a&4104)===4104)switch(t){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(a&32&&t===Map)return this.parseMap(e,r);if(a&512&&t===Set)return this.parseSet(e,r);if(a&8192)switch(t){case(typeof URL!="undefined"?URL:l):return H(e,r);case(typeof URLSearchParams!="undefined"?URLSearchParams:l):return G(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 $(e,r);case(typeof ReadableStream!="undefined"?ReadableStream:l):return this.parseReadableStream(e,r);default:break}let s=await this.parsePlugin(e,r);if(s)return s;if(a&1&&typeof AggregateError!="undefined"&&(t===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(a&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 ie;case null:return I;default:break}switch(typeof e){case"string":return R(e);case"number":return ue(e);case"bigint":return f(this.features&8,new m(e)),ce(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 X=class extends C{constructor(){super(...arguments);this.mode="vanilla"}};function gr(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 He(){let n,e;return{promise:new Promise((r,t)=>{n=r,e=t}),resolve(r){n(r)},reject(r){e(r)}}}function hr(){let n;return{stream:new ReadableStream({start(e){n=e}}),close(){n.close()},enqueue(e){n.enqueue(e)},error(e){n.error(e)}}}function yr(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,ir(p(e.s)))}deserializeArray(e){let r=e.l,t=this.assignIndexedValue(e.i,new Array(r)),a;for(let s=0;s<r;s++)a=e.a[s],a&&(t[s]=this.deserialize(a));return yr(t,e.o),t}deserializeProperties(e,r){let t=e.s;if(t){let a=e.k,s=e.v;for(let i=0,o;i<t;i++)o=a[i],typeof o=="string"?r[p(o)]=this.deserialize(s[i]):r[this.deserialize(o)]=this.deserialize(s[i])}return r}deserializeObject(e){let r=this.assignIndexedValue(e.i,e.t===10?{}:Object.create(null));return this.deserializeProperties(e.p,r),yr(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 a=0,s=e.l;a<s;a++)r.add(this.deserialize(t[a]));return r}deserializeMap(e){let r=this.assignIndexedValue(e.i,new Map),t=e.e.k,a=e.e.v;for(let s=0,i=e.e.s;s<i;s++)r.set(this.deserialize(t[s]),this.deserialize(a[s]));return r}deserializeArrayBuffer(e){let r=new Uint8Array(e.s);return this.assignIndexedValue(e.i,r.buffer)}deserializeTypedArray(e){let r=gr(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=Qe[e.s],t=this.assignIndexedValue(e.i,new r(p(e.m)));return this.deserializeDictionary(e,t)}async deserializePromise(e){let r=He(),t=this.assignIndexedValue(e.i,r),a=this.deserialize(e.f);return e.s?r.resolve(a):r.reject(a),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,a=e.e.v;for(let s=0,i=e.e.s;s<i;s++)r.set(p(t[s]),this.deserialize(a[s]));return r}deserializeFormData(e){let r=this.assignIndexedValue(e.i,new FormData),t=e.e.k,a=e.e.v;for(let s=0,i=e.e.s;s<i;s++)r.set(p(t[s]),this.deserialize(a[s]));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,a=r.length;t<a;t++){let s=r[t];if(s.tag===e.c)return this.assignIndexedValue(e.i,s.deserialize(e.s,this,{id:e.i}))}throw new Error('Missing plugin for tag "'+e.c+'".')}deserializePromiseConstructor(e){return this.assignIndexedValue(e.i,He()).promise}deserializePromiseResolve(e){let r=this.refs.get(e.i);f(r,new Error("Missing Promise instance.")),r.resolve(this.deserialize(e.f))}deserializePromiseReject(e){let r=this.refs.get(e.i);f(r,new Error("Missing Promise instance.")),r.reject(this.deserialize(e.f))}deserializeReadableStreamConstructor(e){return this.assignIndexedValue(e.i,hr()).stream}deserializeReadableStreamEnqueue(e){let r=this.refs.get(e.i);f(r,new Error("Missing ReadableStream instance.")),r.enqueue(this.deserialize(e.f))}deserializeReadableStreamError(e){let r=this.refs.get(e.i);f(r,new Error("Missing Promise instance.")),r.error(this.deserialize(e.f))}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 dr(r)}deserializeAsyncIteratorFactoryInstance(e){let r=this.deserialize(e.a[1]);return r.constructor===ReadableStream?fr(r):ur(r)}deserializeReadableStream(e){return this.assignIndexedValue(e.i,mr(this.deserialize(e.a[1])))}deserialize(e){switch(e.t){case 2:return Ze[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 Je[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:case 47:default:throw new Error("invariant")}}};var re=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 Tr=/^[$A-Z_][0-9A-Z_$]*$/i;function Ge(n){let e=n[0];return(e==="$"||e==="_"||e>="A"&&e<="Z"||e>="a"&&e<="z")&&Tr.test(n)}function te(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 Dr(n){let e=[],r=n[0];for(let t=1,a=n.length,s,i=r;t<a;t++)s=n[t],s.t==="index"&&s.v===i.v?r={t:"index",s:s.s,k:void 0,v:te(r)}:s.t==="set"&&s.s===i.s?r={t:"set",s:te(r),k:s.k,v:s.v}:s.t==="add"&&s.s===i.s?r={t:"add",s:te(r),k:void 0,v:s.v}:s.t==="delete"&&s.s===i.s?r={t:"delete",s:te(r),k:s.k,v:void 0}:(e.push(r),r=s),i=s;return e.push(r),e}function vr(n){if(n.length){let e="",r=Dr(n);for(let t=0,a=r.length;t<a;t++)e+=te(r[t])+",";return e}}var Fr="Object.create(null)",Br="new Set",Vr="new Map",Mr="Promise.resolve",Lr="Promise.reject",_r={3:"Object.freeze",2:"Object.seal",1:"Object.preventExtensions",0:void 0},k=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,a=t.length;r<a;r++){let s=t[r];e+=_r[s.type]+"("+s.value+"),"}return e}resolvePatches(){let e=vr(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,w+'.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,a=this.serializeArrayItem(r,t[0],0),s=a==="";for(let i=1,o=e.l,c;i<o;i++)c=this.serializeArrayItem(r,t[i],i),a+=","+c,s=c==="";return this.stack.pop(),this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(r,"["+a+(s?",]":"]"))}return this.assignIndexedValue(r,"[]")}serializeProperty(e,r,t){if(typeof r=="string"){let a=Number(r),s=a>=0||Ge(r);if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);return this.markRef(e.i),s&&a!==a?this.createObjectAssign(e.i,r,i):this.createArrayAssign(e.i,s?r:'"'+r+'"',i),""}return(s?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 a=r.k,s=r.v,i=this.serializeProperty(e,a[0],s[0]);for(let o=1,c=i;o<t;o++)c=this.serializeProperty(e,a[o],s[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 a=this.serializeProperties(e,r);return a!=="{}"?"Object.assign("+t+","+a+")":t}serializeAssignment(e,r,t,a){if(typeof t=="string"){let s=this.serialize(a),i=Number(t),o=i>=0||Ge(t);if(this.isIndexedValueInStack(a))o&&i!==i?this.createObjectAssign(e.i,t,s):this.createArrayAssign(e.i,o?t:'"'+t+'"',s);else{let c=this.assignments;this.assignments=r,o?this.createObjectAssign(e.i,t,s):this.createArrayAssign(e.i,o?t:'"'+t+'"',s),this.assignments=c}}else{let s=this.stack;this.stack=[];let i=this.serialize(a);this.stack=s;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 a=[],s=r.k,i=r.v;for(let o=0;o<t;o++)this.serializeAssignment(e,a,s[o],i[o]);return this.stack.pop(),vr(a)}}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,Fr)}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=Br,t=e.l,a=e.i;if(t){let s=e.a;this.stack.push(a);let i=this.serializeSetItem(a,s[0]);for(let o=1,c=i;o<t;o++)c=this.serializeSetItem(a,s[o]),i+=(c&&i&&",")+c;this.stack.pop(),i&&(r+="(["+i+"])")}return this.assignIndexedValue(a,r)}serializeMapEntry(e,r,t,a){if(this.isIndexedValueInStack(r)){let s=this.getRefParam(r.i);if(this.markRef(e),this.isIndexedValueInStack(t)){let o=this.getRefParam(t.i);return this.createSetAssignment(e,s,o),""}if(t.t!==4&&t.i!=null&&this.isMarked(t.i)){let o="("+this.serialize(t)+",["+a+","+a+"])";return this.createSetAssignment(e,s,this.getRefParam(t.i)),this.createDeleteAssignment(e,a),o}let i=this.stack;return this.stack=[],this.createSetAssignment(e,s,this.serialize(t)),this.stack=i,""}if(this.isIndexedValueInStack(t)){let s=this.getRefParam(t.i);if(this.markRef(e),r.t!==4&&r.i!=null&&this.isMarked(r.i)){let o="("+this.serialize(r)+",["+a+","+a+"])";return this.createSetAssignment(e,this.getRefParam(r.i),s),this.createDeleteAssignment(e,a),o}let i=this.stack;return this.stack=[],this.createSetAssignment(e,this.serialize(r),s),this.stack=i,""}return"["+this.serialize(r)+","+this.serialize(t)+"]"}serializeMap(e){let r=Vr,t=e.e.s,a=e.i,s=e.f,i=this.getRefParam(s.i);if(t){let o=e.e.k,c=e.e.v;this.stack.push(a);let A=this.serializeMapEntry(a,o[0],c[0],i);for(let F=1,Ce=A;F<t;F++)Ce=this.serializeMapEntry(a,o[F],c[F],i),A+=(Ce&&A&&",")+Ce;this.stack.pop(),A&&(r+="(["+A+"])")}return s.t===41&&(this.markRef(s.i),r="("+this.serialize(s)+","+r+")"),this.assignIndexedValue(a,r)}serializeArrayBuffer(e){let r="new Uint8Array(",t=e.s,a=t.length;if(a){r+="["+t[0];for(let s=1;s<a;s++)r+=","+t[s];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 "+ae[e.s]+'("'+e.m+'")')}serializePromise(e){let r,t=e.f,a=e.i,s=e.s?Mr:Lr;if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);r=s+(e.s?"().then("+this.createFunction([],i)+")":"().catch("+this.createEffectfulFunction([],"throw "+i)+")")}else{this.stack.push(a);let i=this.serialize(t);this.stack.pop(),r=s+"("+i+")"}return this.assignIndexedValue(a,r)}serializeWKSymbol(e){return this.assignIndexedValue(e.i,Xe[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,a=e.e.v,s=e.i,i=this.serializeFormDataEntry(s,t[0],a[0]);for(let o=1;o<r;o++)i+=","+this.serializeFormDataEntry(s,t[o],a[o]);return i}serializeFormData(e){let r=e.e.s,t=e.i;r&&this.markRef(t);let a=this.assignIndexedValue(t,"new FormData()");if(r){let s=this.serializeFormDataEntries(e,r);return"("+a+","+(s?s+",":"")+this.getRefParam(t)+")"}return a}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,a=r.length;t<a;t++){let s=r[t];if(s.tag===e.c)return this.assignIndexedValue(e.i,s.serialize(e.s,this,{id:e.i}))}throw new Error('Missing plugin for tag "'+e.c+'".')}serializeMapSentinel(e){return this.assignIndexedValue(e.i,"[]")}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.serialize(e.a[0])+")("+this.serialize(e.a[1])+")"}serializeAsyncIteratorFactory(e){return this.assignIndexedValue(e.i,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}")+")")+"})")))}serializeAsyncIteratorFactoryInstance(e){return"("+this.serialize(e.a[0])+")("+this.serialize(e.a[1])+")"}serializeReadableStream(e){this.stack.push(e.i);let r="("+this.serialize(e.a[0])+")("+this.serialize(e.a[1])+")";return this.stack.pop(),this.assignIndexedValue(e.i,r)}serializeReadableStreamFactory(e){return this.assignIndexedValue(e.i,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])")+")")+"})"))}serialize(e){switch(e.t){case 2:return Ye[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.serializeMapSentinel(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);case 47:return this.serializeReadableStreamFactory(e);default:throw new Error("invariant")}}};var Rr="hjkmoquxzABCDEFGHIJKLNPQRTUVWXYZ$_",br=Rr.length,Er="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_",Nr=Er.length;function $e(n){let e=n%br,r=Rr[e];for(n=(n-e)/br;n>0;)e=n%Nr,r+=Er[e],n=(n-e)/Nr;return r}var T=class extends k{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 a=this.vars[t];return a==null&&(a=$e(t),this.vars[t]=a),a}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 a=this.resolvePatches(),s=t;if(a){let i=this.getRefParam(r.i);s=t+","+a+i,t.startsWith(i+"=")||(s=i+"="+s)}return"("+this.createFunction(this.vars,"("+s+")")+")()"}return r.t===10?"("+t+")":t}};var h=class extends K{parseItems(e){let r=[];for(let t=0,a=e.length;t<a;t++)t in e&&(r[t]=this.parse(e[t]));return r}parseArray(e,r){return me(e,r,this.parseItems(r))}parseProperties(e){let r=Object.entries(e),t=[],a=[];for(let s=0,i=r.length;s<i;s++)t.push(d(r[s][0])),a.push(this.parse(r[s][1]));if(this.features&1024){let s=Symbol.iterator;s in e&&(t.push(this.parseWKSymbol(s)),a.push(q(this.parseIteratorFactory(),this.parse(W(e))))),s=Symbol.toStringTag,s in e&&(t.push(this.parseWKSymbol(s)),a.push(R(e[s]))),s=Symbol.isConcatSpreadable,s in e&&(t.push(this.parseWKSymbol(s)),a.push(e[s]?v:b))}return{k:t,v:a,s:t.length}}parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,this.parseProperties(r))}parseBoxed(e,r){return Se(e,this.parse(r.valueOf()))}parseTypedArray(e,r){return ge(e,r,this.parse(r.buffer))}parseBigIntTypedArray(e,r){return he(e,r,this.parse(r.buffer))}parseDataView(e,r){return ye(e,r,this.parse(r.buffer))}parseError(e,r){let t=M(r,this.features);return ve(e,r,t?this.parseProperties(t):void 0)}parseAggregateError(e,r){let t=M(r,this.features);return be(e,r,t?this.parseProperties(t):void 0)}parseMap(e,r){let t=[],a=[];for(let[s,i]of r.entries())t.push(this.parse(s)),a.push(this.parse(i));return this.createMapNode(e,t,a,r.size)}parseSet(e,r){let t=[];for(let a of r.keys())t.push(this.parse(a));return Ne(e,r.size,t)}parsePlainProperties(e){let r=e.length,t=[],a=[];for(let s=0;s<r;s++)t.push(d(e[s][0])),a.push(this.parse(e[s][1]));return{k:t,v:a,s:r}}parseHeaders(e,r){let t=[];return r.forEach((a,s)=>{t.push([s,a])}),{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((a,s)=>{t.push([s,a])}),{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 we(e,r.type,this.parse(Ae(r)))}parseCustomEvent(e,r){return Pe(e,r.type,this.parse(Ie(r)))}parsePlugin(e,r){let t=this.plugins;if(t)for(let a=0,s=t.length;a<s;a++){let i=t[a];if(i.parse.sync&&i.test(r))return j(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 L(e,r);case RegExp:return _(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 a=this.features;if(a&2048)switch(t){case ArrayBuffer:return U(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((a&4104)===4104)switch(t){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(a&32&&t===Map)return this.parseMap(e,r);if(a&512&&t===Set)return this.parseSet(e,r);if(a&8192)switch(t){case(typeof URL!="undefined"?URL:l):return H(e,r);case(typeof URLSearchParams!="undefined"?URLSearchParams:l):return G(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 $(e,r);default:break}let s=this.parsePlugin(e,r);if(s)return s;if(a&1&&typeof AggregateError!="undefined"&&(t===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(a&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 ie;case null:return I;default:break}switch(typeof e){case"string":return R(e);case"number":return ue(e);case"bigint":return f(this.features&8,new m(e)),ce(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"?fe(r,e):r}case"function":return f(O(e),new Error("Cannot serialize function without reference ID.")),this.getStrictReference(e);default:throw new m(e)}}};var J=class extends h{constructor(){super(...arguments);this.mode="vanilla"}};function xr(n,e={}){let r=new J({plugins:e.plugins,disabledFeatures:e.disabledFeatures}),t=r.parse(n);return new T({plugins:e.plugins,features:r.features,markedRefs:r.marked}).serializeTop(t)}async function Mn(n,e={}){let r=new X({plugins:e.plugins,disabledFeatures:e.disabledFeatures}),t=await r.parse(n);return new T({plugins:e.plugins,features:r.features,markedRefs:r.marked}).serializeTop(t)}function Ln(n){return(0,eval)(n)}function _n(n,e={}){let r=new J({plugins:e.plugins,disabledFeatures:e.disabledFeatures});return{t:r.parse(n),f:r.features,m:Array.from(r.marked)}}async function Un(n,e={}){let r=new X({plugins:e.plugins,disabledFeatures:e.disabledFeatures});return{t:await r.parse(n),f:r.features,m:Array.from(r.marked)}}function jn(n,e={}){return new T({plugins:e.plugins,features:n.f,markedRefs:n.m}).serializeTop(n.t)}function qn(n,e={}){return new re({plugins:e.plugins,markedRefs:n.m}).deserialize(n.t)}var Y=class extends C{constructor(){super(...arguments);this.mode="cross"}};var ne=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 k{constructor(r){super(r);this.mode="cross";this.scopeId=r.scopeId}getRefParam(r){return typeof r=="string"?V+"."+r:V+"["+r+"]"}assignIndexedValue(r,t){return this.getRefParam(r)+"="+t}serializePromiseConstructor(r){return this.assignIndexedValue(r.i,g+"."+Te+"()")}serializePromiseResolve(r){return g+"."+De+"("+this.getRefParam(r.i)+","+this.serialize(r.f)+")"}serializePromiseReject(r){return g+"."+Fe+"("+this.getRefParam(r.i)+","+this.serialize(r.f)+")"}serializeReadableStreamConstructor(r){return this.assignIndexedValue(r.i,g+"."+Be+"()")}serializeReadableStreamEnqueue(r){return g+"."+Ve+"("+this.getRefParam(r.i)+","+this.serialize(r.f)+")"}serializeReadableStreamError(r){return g+"."+Me+"("+this.getRefParam(r.i)+","+this.serialize(r.f)+")"}serializeReadableStreamClose(r){return g+"."+Le+"("+this.getRefParam(r.i)+")"}serializeAsyncIteratorFactory(r){return this.assignIndexedValue(r.i,this.createFunction(["s"],this.createFunction(["b","t"],"(b=s.tee(),s=b[0],b=b[1].getReader(),t={["+this.serialize(r.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]}")+")")+"})")))}serializeTop(r){let t=this.serialize(r),a=r.i;if(a==null)return t;let s=this.resolvePatches(),i=this.getRefParam(a),o=this.scopeId==null?"":V,c=s?t+","+s:t;if(o==="")return s?"("+c+i+")":c;let A=this.scopeId==null?"()":"("+V+'["'+d(this.scopeId)+'"])',F=c+(s?i:"");return"("+this.createFunction([o],F)+")"+A}};var se=class extends h{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){this.onParseCallback(r,t)}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),a=[],s=[];for(let i=0,o=t.length;i<o;i++)a.push(d(t[i][0])),s.push(this.parse(t[i][1]));if(this.features&1024){let i=Symbol.iterator;i in r&&(a.push(this.parseWKSymbol(i)),s.push(q(this.parseIteratorFactory(),this.parse(W(r))))),i=Symbol.asyncIterator,i in r&&(a.push(this.parseWKSymbol(i)),s.push(Re(this.parseAsyncIteratorFactory(),this.parse(cr(r,this))))),i=Symbol.toStringTag,i in r&&(a.push(this.parseWKSymbol(i)),s.push(R(r[i]))),i=Symbol.isConcatSpreadable,i in r&&(a.push(this.parseWKSymbol(i)),s.push(r[i]?v:b))}return{k:a,v:s,s:a.length}}pushReadableStreamReader(r,t){t.read().then(a=>{if(this.alive)if(a.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:void 0,b:void 0,o:void 0},!1),this.popPendingState();else{let s=this.parseWithError(a.value);s&&(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:void 0,f:s,b:void 0,o:void 0},!1),this.pushReadableStreamReader(r,t))}},a=>{if(this.alive){let s=this.parseWithError(a);s&&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:void 0,f:s,b:void 0,o:void 0},!1),this.popPendingState()}})}parseReadableStream(r,t){let a=t.getReader();return this.pushPendingState(),this.pushReadableStreamReader(r,a),{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:void 0,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(Ee(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):I,this.parse(xe(t))],b:void 0,o:void 0}}parsePromise(r,t){return t.then(a=>{let s=this.parseWithError(a);s&&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:void 0,f:s,b:void 0,o:void 0},!1),this.popPendingState()},a=>{if(this.alive){let s=this.parseWithError(a);s&&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:void 0,f:s,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:void 0,b:void 0,o:void 0}}parsePlugin(r,t){let a=this.plugins;if(a)for(let s=0,i=a.length;s<i;s++){let o=a[s];if(o.parse.stream&&o.test(t))return j(r,o.tag,o.parse.stream(t,this,{id:r}))}}parseObject(r,t){if(Array.isArray(t))return this.parseArray(r,t);let a=t.constructor;switch(a){case Object:return this.parsePlainObject(r,t,!1);case void 0:return this.parsePlainObject(r,t,!0);case Date:return L(r,t);case RegExp:return _(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 s=this.features;if(s&256&&(a===Promise||t instanceof Promise))return this.parsePromise(r,t);if(s&2048)switch(a){case ArrayBuffer:return U(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((s&4104)===4104)switch(a){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(r,t);default:break}if(s&32&&a===Map)return this.parseMap(r,t);if(s&512&&a===Set)return this.parseSet(r,t);if(s&8192)switch(a){case(typeof URL!="undefined"?URL:l):return H(r,t);case(typeof URLSearchParams!="undefined"?URLSearchParams:l):return G(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 $(r,t);default:break}let i=this.parsePlugin(r,t);if(i)return i;if(s&1&&typeof AggregateError!="undefined"&&(a===AggregateError||t instanceof AggregateError))return this.parseAggregateError(r,t);if(t instanceof Error)return this.parseError(r,t);if(s&1024&&(Symbol.iterator in t||Symbol.asyncIterator in t))return this.parsePlainObject(r,t,!!a);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 se{constructor(){super(...arguments);this.mode="cross"}};var Q=class extends h{constructor(){super(...arguments);this.mode="cross"}};function bs(n,e={}){let r=new Q({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}),t=r.parse(n);return new D({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked}).serializeTop(t)}async function Ns(n,e={}){let r=new Y({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}),t=await r.parse(n);return new D({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked}).serializeTop(t)}function Rs(n,e={}){return new Q({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}async function Es(n,e={}){return new Y({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}function Ar(n,e){let r=new Z({plugins:e.plugins,refs:e.refs,disabledFeatures:e.disabledFeatures,onParse(t,a){let s=new D({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked}),i;try{i=s.serializeTop(t)}catch(o){e.onError&&e.onError(o);return}e.onSerialize(i,a)},onError:e.onError,onDone:e.onDone});return r.start(n),()=>{r.destroy()}}function xs(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 As(n,e){return new ne({plugins:e.plugins,refs:e.refs}).deserialize(n)}var Oe=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(Ar(r,{plugins:this.options.plugins,scopeId:this.options.scopeId,refs:this.refs,disabledFeatures:this.options.disabledFeatures,onError:this.options.onError,onSerialize:(t,a)=>{this.alive&&this.options.onData(a?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 Cs(n){return n}var Ts=xr;export{N as Feature,Pr as GLOBAL_CONTEXT_API_SCRIPT,Oe as Serializer,jn as compileJSON,Cs as createPlugin,Cr as createReference,bs as crossSerialize,Ns as crossSerializeAsync,Ar as crossSerializeStream,Ts as default,Ln as deserialize,As as fromCrossJSON,qn as fromJSON,Or as getCrossReferenceHeader,xr as serialize,Mn as serializeAsync,Rs as toCrossJSON,Es as toCrossJSONAsync,xs as toCrossJSONStream,_n as toJSON,Un as toJSONAsync};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seroval",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.13.
|
|
4
|
+
"version": "0.13.1",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"src"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"eslint-config-lxsmnsyc": "^0.6.5",
|
|
21
21
|
"pridepack": "2.5.1",
|
|
22
22
|
"tslib": "^2.6.2",
|
|
23
|
-
"typescript": "^5.
|
|
23
|
+
"typescript": "^5.3.2",
|
|
24
24
|
"vitest": "^0.34.6"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"typesVersions": {
|
|
67
67
|
"*": {}
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "d977f4e777e01d1c449558c2d1b13d9e04db077c"
|
|
70
70
|
}
|
|
@@ -219,8 +219,8 @@ export default abstract class BaseStreamParserContext extends BaseSyncParserCont
|
|
|
219
219
|
b: undefined,
|
|
220
220
|
o: undefined,
|
|
221
221
|
}, false);
|
|
222
|
-
this.popPendingState();
|
|
223
222
|
}
|
|
223
|
+
this.popPendingState();
|
|
224
224
|
}
|
|
225
225
|
},
|
|
226
226
|
);
|
|
@@ -319,8 +319,8 @@ export default abstract class BaseStreamParserContext extends BaseSyncParserCont
|
|
|
319
319
|
b: undefined,
|
|
320
320
|
o: undefined,
|
|
321
321
|
}, false);
|
|
322
|
-
this.popPendingState();
|
|
323
322
|
}
|
|
323
|
+
this.popPendingState();
|
|
324
324
|
},
|
|
325
325
|
(data) => {
|
|
326
326
|
if (this.alive) {
|
|
@@ -340,9 +340,9 @@ export default abstract class BaseStreamParserContext extends BaseSyncParserCont
|
|
|
340
340
|
b: undefined,
|
|
341
341
|
o: undefined,
|
|
342
342
|
}, false);
|
|
343
|
-
this.popPendingState();
|
|
344
343
|
}
|
|
345
344
|
}
|
|
345
|
+
this.popPendingState();
|
|
346
346
|
},
|
|
347
347
|
);
|
|
348
348
|
this.pushPendingState();
|