=2&&f[0]==='"'&&f[f.length-1]==='"'&&(f=f.substring(1,f.length-1)),!/^[0-9]+$/.test(f)){delete e[A],r.add(A),c3(e,A);continue}let p=Math.min(parseInt(f,10),Hne);A==="min-fresh"?(!(A in e)||e[A]p)&&(e[A]=p);break}case"private":case"no-cache":{if(u){e[A]=!0;break}if(f!==void 0&&f.length===0){e[A]=!0;break}if(f){if(f[0]==='"'){f=a3(f);let p="",m=i,E=!1,C=u3(f,1);if(C!==-1)p=f.substring(1,C),E=!0;else{let R=[f.substring(1)];for(let M=i+1;M{"use strict";function tse(t){switch(t[3]){case",":return rse(t);case" ":return nse(t);default:return sse(t)}}function Py(t,e,r,n,s,i,o){let a=new Date(Date.UTC(t,e,r,n,s,i));return t>=0&&t<=99&&a.setUTCFullYear(t),a.getUTCFullYear()===t&&a.getUTCMonth()===e&&a.getUTCDate()===r&&a.getUTCHours()===n&&a.getUTCMinutes()===s&&a.getUTCSeconds()===i&&a.getUTCDay()===o?a:void 0}function rse(t){if(t.length!==29||t[4]!==" "||t[7]!==" "||t[11]!==" "||t[16]!==" "||t[19]!==":"||t[22]!==":"||t[25]!==" "||t[26]!=="G"||t[27]!=="M"||t[28]!=="T")return;let e=-1;if(t[0]==="S"&&t[1]==="u"&&t[2]==="n")e=0;else if(t[0]==="M"&&t[1]==="o"&&t[2]==="n")e=1;else if(t[0]==="T"&&t[1]==="u"&&t[2]==="e")e=2;else if(t[0]==="W"&&t[1]==="e"&&t[2]==="d")e=3;else if(t[0]==="T"&&t[1]==="h"&&t[2]==="u")e=4;else if(t[0]==="F"&&t[1]==="r"&&t[2]==="i")e=5;else if(t[0]==="S"&&t[1]==="a"&&t[2]==="t")e=6;else return;let r=0;if(t[5]==="0"){let l=t.charCodeAt(6);if(l<49||l>57)return;r=l-48}else{let l=t.charCodeAt(5);if(l<49||l>51)return;let h=t.charCodeAt(6);if(h<48||h>57)return;r=(l-48)*10+(h-48)}let n=-1;if(t[8]==="J"&&t[9]==="a"&&t[10]==="n")n=0;else if(t[8]==="F"&&t[9]==="e"&&t[10]==="b")n=1;else if(t[8]==="M"&&t[9]==="a")if(t[10]==="r")n=2;else if(t[10]==="y")n=4;else return;else if(t[8]==="J")if(t[9]==="a"&&t[10]==="n")n=0;else if(t[9]==="u")if(t[10]==="n")n=5;else if(t[10]==="l")n=6;else return;else return;else if(t[8]==="A")if(t[9]==="p"&&t[10]==="r")n=3;else if(t[9]==="u"&&t[10]==="g")n=7;else return;else if(t[8]==="S"&&t[9]==="e"&&t[10]==="p")n=8;else if(t[8]==="O"&&t[9]==="c"&&t[10]==="t")n=9;else if(t[8]==="N"&&t[9]==="o"&&t[10]==="v")n=10;else if(t[8]==="D"&&t[9]==="e"&&t[10]==="c")n=11;else return;let s=t.charCodeAt(12);if(s<48||s>57)return;let i=t.charCodeAt(13);if(i<48||i>57)return;let o=t.charCodeAt(14);if(o<48||o>57)return;let a=t.charCodeAt(15);if(a<48||a>57)return;let u=(s-48)*1e3+(i-48)*100+(o-48)*10+(a-48),c=0;if(t[17]==="0"){let l=t.charCodeAt(18);if(l<48||l>57)return;c=l-48}else{let l=t.charCodeAt(17);if(l<48||l>50)return;let h=t.charCodeAt(18);if(h<48||h>57||l===50&&h>51)return;c=(l-48)*10+(h-48)}let A=0;if(t[20]==="0"){let l=t.charCodeAt(21);if(l<48||l>57)return;A=l-48}else{let l=t.charCodeAt(20);if(l<48||l>53)return;let h=t.charCodeAt(21);if(h<48||h>57)return;A=(l-48)*10+(h-48)}let f=0;if(t[23]==="0"){let l=t.charCodeAt(24);if(l<48||l>57)return;f=l-48}else{let l=t.charCodeAt(23);if(l<48||l>53)return;let h=t.charCodeAt(24);if(h<48||h>57)return;f=(l-48)*10+(h-48)}return Py(u,n,r,c,A,f,e)}function nse(t){if(t.length!==24||t[7]!==" "||t[10]!==" "||t[19]!==" ")return;let e=-1;if(t[0]==="S"&&t[1]==="u"&&t[2]==="n")e=0;else if(t[0]==="M"&&t[1]==="o"&&t[2]==="n")e=1;else if(t[0]==="T"&&t[1]==="u"&&t[2]==="e")e=2;else if(t[0]==="W"&&t[1]==="e"&&t[2]==="d")e=3;else if(t[0]==="T"&&t[1]==="h"&&t[2]==="u")e=4;else if(t[0]==="F"&&t[1]==="r"&&t[2]==="i")e=5;else if(t[0]==="S"&&t[1]==="a"&&t[2]==="t")e=6;else return;let r=-1;if(t[4]==="J"&&t[5]==="a"&&t[6]==="n")r=0;else if(t[4]==="F"&&t[5]==="e"&&t[6]==="b")r=1;else if(t[4]==="M"&&t[5]==="a")if(t[6]==="r")r=2;else if(t[6]==="y")r=4;else return;else if(t[4]==="J")if(t[5]==="a"&&t[6]==="n")r=0;else if(t[5]==="u")if(t[6]==="n")r=5;else if(t[6]==="l")r=6;else return;else return;else if(t[4]==="A")if(t[5]==="p"&&t[6]==="r")r=3;else if(t[5]==="u"&&t[6]==="g")r=7;else return;else if(t[4]==="S"&&t[5]==="e"&&t[6]==="p")r=8;else if(t[4]==="O"&&t[5]==="c"&&t[6]==="t")r=9;else if(t[4]==="N"&&t[5]==="o"&&t[6]==="v")r=10;else if(t[4]==="D"&&t[5]==="e"&&t[6]==="c")r=11;else return;let n=0;if(t[8]===" "){let l=t.charCodeAt(9);if(l<49||l>57)return;n=l-48}else{let l=t.charCodeAt(8);if(l<49||l>51)return;let h=t.charCodeAt(9);if(h<48||h>57)return;n=(l-48)*10+(h-48)}let s=0;if(t[11]==="0"){let l=t.charCodeAt(12);if(l<48||l>57)return;s=l-48}else{let l=t.charCodeAt(11);if(l<48||l>50)return;let h=t.charCodeAt(12);if(h<48||h>57||l===50&&h>51)return;s=(l-48)*10+(h-48)}let i=0;if(t[14]==="0"){let l=t.charCodeAt(15);if(l<48||l>57)return;i=l-48}else{let l=t.charCodeAt(14);if(l<48||l>53)return;let h=t.charCodeAt(15);if(h<48||h>57)return;i=(l-48)*10+(h-48)}let o=0;if(t[17]==="0"){let l=t.charCodeAt(18);if(l<48||l>57)return;o=l-48}else{let l=t.charCodeAt(17);if(l<48||l>53)return;let h=t.charCodeAt(18);if(h<48||h>57)return;o=(l-48)*10+(h-48)}let a=t.charCodeAt(20);if(a<48||a>57)return;let u=t.charCodeAt(21);if(u<48||u>57)return;let c=t.charCodeAt(22);if(c<48||c>57)return;let A=t.charCodeAt(23);if(A<48||A>57)return;let f=(a-48)*1e3+(u-48)*100+(c-48)*10+(A-48);return Py(f,r,n,s,i,o,e)}function sse(t){let e=-1,r=-1;if(t[0]==="S")t[1]==="u"&&t[2]==="n"&&t[3]==="d"&&t[4]==="a"&&t[5]==="y"?(r=0,e=6):t[1]==="a"&&t[2]==="t"&&t[3]==="u"&&t[4]==="r"&&t[5]==="d"&&t[6]==="a"&&t[7]==="y"&&(r=6,e=8);else if(t[0]==="M"&&t[1]==="o"&&t[2]==="n"&&t[3]==="d"&&t[4]==="a"&&t[5]==="y")r=1,e=6;else if(t[0]==="T")t[1]==="u"&&t[2]==="e"&&t[3]==="s"&&t[4]==="d"&&t[5]==="a"&&t[6]==="y"?(r=2,e=7):t[1]==="h"&&t[2]==="u"&&t[3]==="r"&&t[4]==="s"&&t[5]==="d"&&t[6]==="a"&&t[7]==="y"&&(r=4,e=8);else if(t[0]==="W"&&t[1]==="e"&&t[2]==="d"&&t[3]==="n"&&t[4]==="e"&&t[5]==="s"&&t[6]==="d"&&t[7]==="a"&&t[8]==="y")r=3,e=9;else if(t[0]==="F"&&t[1]==="r"&&t[2]==="i"&&t[3]==="d"&&t[4]==="a"&&t[5]==="y")r=5,e=6;else return;if(t[e]!==","||t.length-e-1!==23||t[e+1]!==" "||t[e+4]!=="-"||t[e+8]!=="-"||t[e+11]!==" "||t[e+14]!==":"||t[e+17]!==":"||t[e+20]!==" "||t[e+21]!=="G"||t[e+22]!=="M"||t[e+23]!=="T")return;let n=0;if(t[e+2]==="0"){let f=t.charCodeAt(e+3);if(f<49||f>57)return;n=f-48}else{let f=t.charCodeAt(e+2);if(f<49||f>51)return;let l=t.charCodeAt(e+3);if(l<48||l>57)return;n=(f-48)*10+(l-48)}let s=-1;if(t[e+5]==="J"&&t[e+6]==="a"&&t[e+7]==="n")s=0;else if(t[e+5]==="F"&&t[e+6]==="e"&&t[e+7]==="b")s=1;else if(t[e+5]==="M"&&t[e+6]==="a"&&t[e+7]==="r")s=2;else if(t[e+5]==="A"&&t[e+6]==="p"&&t[e+7]==="r")s=3;else if(t[e+5]==="M"&&t[e+6]==="a"&&t[e+7]==="y")s=4;else if(t[e+5]==="J"&&t[e+6]==="u"&&t[e+7]==="n")s=5;else if(t[e+5]==="J"&&t[e+6]==="u"&&t[e+7]==="l")s=6;else if(t[e+5]==="A"&&t[e+6]==="u"&&t[e+7]==="g")s=7;else if(t[e+5]==="S"&&t[e+6]==="e"&&t[e+7]==="p")s=8;else if(t[e+5]==="O"&&t[e+6]==="c"&&t[e+7]==="t")s=9;else if(t[e+5]==="N"&&t[e+6]==="o"&&t[e+7]==="v")s=10;else if(t[e+5]==="D"&&t[e+6]==="e"&&t[e+7]==="c")s=11;else return;let i=t.charCodeAt(e+9);if(i<48||i>57)return;let o=t.charCodeAt(e+10);if(o<48||o>57)return;let a=(i-48)*10+(o-48);a+=a<70?2e3:1900;let u=0;if(t[e+12]==="0"){let f=t.charCodeAt(e+13);if(f<48||f>57)return;u=f-48}else{let f=t.charCodeAt(e+12);if(f<48||f>50)return;let l=t.charCodeAt(e+13);if(l<48||l>57||f===50&&l>51)return;u=(f-48)*10+(l-48)}let c=0;if(t[e+15]==="0"){let f=t.charCodeAt(e+16);if(f<48||f>57)return;c=f-48}else{let f=t.charCodeAt(e+15);if(f<48||f>53)return;let l=t.charCodeAt(e+16);if(l<48||l>57)return;c=(f-48)*10+(l-48)}let A=0;if(t[e+18]==="0"){let f=t.charCodeAt(e+19);if(f<48||f>57)return;A=f-48}else{let f=t.charCodeAt(e+18);if(f<48||f>53)return;let l=t.charCodeAt(e+19);if(l<48||l>57)return;A=(f-48)*10+(l-48)}return Py(a,s,n,u,c,A,r)}g3.exports={parseHttpDate:tse}});var y3=x((VQe,b3)=>{"use strict";var Yy=et(),{parseCacheControlHeader:ise,hasInvalidCacheControlDirective:p3,parseVaryHeader:ose,hasVaryStar:ase,isInvalidOrWildcardVaryHeader:E3,isEtagUsable:use}=Cc(),{parseHttpDate:Gy}=Hy();function cse(){}var C3=[200,203,204,206,300,301,308,404,405,410,414,501],Ase=[206],vl=2147483647e3;function lse(t){return t.replace(/^[\t ]+|[\t ]+$/g,"")}function Ic(t,e){for(let r=0;rthis.#i.onResponseStart?.(e,r,n,s),o=this;if(!Ic(Yy.safeHTTPMethods,this.#e.method)&&r>=200&&r<=399)return hse(this.#n,this.#e,n),i();let a=n["cache-control"],u=n["last-modified"]&&Ic(C3,r);if(!a&&!n.expires&&!u&&!this.#r)return r===304&&n.vary&&E3(n.vary)&&kl(this.#n,this.#e),i();let c=a?ise(a):{};if(!pse(this.#t,r,n,c,this.#e.headers))return r===304&&(a||gse(this.#t,n,c))&&kl(this.#n,this.#e),i();let A=Date.now(),f=Object.hasOwn(n,"age")?Ese(n.age):void 0;if(f!==void 0&&f>=vl)return Hg(r,this.#n,this.#e),i();let l=Object.hasOwn(n,"date")?mse(n.date):void 0;if(l===null)return Hg(r,this.#n,this.#e),i();let h=l?Math.max(0,A-l.getTime()):0,g=Math.max(h,f??0),p=Cse(this.#t,A,f,n,l,c)??this.#r;if(p===void 0||g>=p)return(a||p!==void 0)&&Hg(r,this.#n,this.#e),i();let m=A-g,E=p+m;if(A>=E)return Hg(r,this.#n,this.#e),i();let C;if(this.#e.headers&&n.vary&&(C=ose(n.vary,this.#e.headers),!C))return i();let b=m,B=Ise(m,A,c,E),R=bse(n,c),M={statusCode:r,statusMessage:s,headers:R,vary:C,cacheControlDirectives:c,cachedAt:b,staleAt:E,deleteAt:B};if(r===304){let k=N=>{if(!N)return i();if(M.statusCode=N.statusCode,M.statusMessage=N.statusMessage,M.etag=N.etag,M.vary=C??N.vary,M.headers={...N.headers,...R},i(),this.#s=this.#n.createWriteStream(this.#e,M),!(!this.#s||!N?.body))if(typeof N.body.values=="function"){let q=N.body.values(),Y=()=>{for(let Q of q){let y=this.#s.write(Q)===!1;if(this.#i.onResponseData?.(e,Q),y)break}};this.#s.on("error",function(){o.#s=void 0,o.#n.delete(o.#e)}).on("drain",()=>{Y()}).on("close",function(){o.#s===this&&(o.#s=void 0)}),Y()}else typeof N.body.on=="function"&&(N.body.on("data",q=>{this.#s.write(q),this.#i.onResponseData?.(e,q)}).on("end",()=>{this.#s.end()}).on("error",()=>{this.#s=void 0,this.#n.delete(this.#e)}),this.#s.on("error",function(){o.#s=void 0,o.#n.delete(o.#e)}).on("close",function(){o.#s===this&&(o.#s=void 0)}))},v=this.#n.get(this.#e);v&&typeof v.then=="function"?v.then(k):k(v)}else{if(typeof n.etag=="string"&&use(n.etag)&&(M.etag=n.etag),this.#s=this.#n.createWriteStream(this.#e,M),!this.#s)return i();this.#s.on("drain",()=>e.resume()).on("error",function(){o.#s=void 0,o.#n.delete(o.#e)}).on("close",function(){o.#s===this&&(o.#s=void 0),e.resume()}),i()}}onResponseData(e,r){this.#s?.write(r)===!1&&e.pause(),this.#i.onResponseData?.(e,r)}onResponseEnd(e,r){this.#s?.end(),this.#i.onResponseEnd?.(e,r)}onResponseError(e,r){this.#s?.destroy(r),this.#s=void 0,this.#i.onResponseError?.(e,r)}};function kl(t,e){try{t.delete(e)?.catch?.(cse)}catch{}}function Hg(t,e,r){t===304&&kl(e,r)}function gse(t,e,r){return r["no-store"]===!0||t==="shared"&&r.private===!0||(e.vary?E3(e.vary):!1)}function pse(t,e,r,n,s){return!(e<200||Ic(Ase,e)||!Ic(C3,e)&&!r.expires&&!n.public&&n["max-age"]===void 0&&!(n.private&&t==="private")&&!(n["s-maxage"]!==void 0&&t==="shared")||n["no-store"]||t==="shared"&&n.private===!0||r.vary&&ase(r.vary)||s!=null&&Object.hasOwn(s,"authorization")&&(!n.public&&!n["s-maxage"]&&!n["must-revalidate"]||typeof s.authorization!="string"||Array.isArray(n["no-cache"])&&Ic(n["no-cache"],"authorization")||Array.isArray(n.private)&&Ic(n.private,"authorization")))}function mse(t){let e=t;if(Array.isArray(e)){if(e.length!==1)return null;e=e[0]}return typeof e!="string"?null:Gy(e)}function Ese(t){let e=t;if(Array.isArray(e)){if(e.length!==1)return vl;e=e[0]}if(typeof e!="string"||!/^[\t ]*[0-9]+[\t ]*$/.test(e))return vl;let r=BigInt(e.replace(/^[\t ]+|[\t ]+$/g,""));return r>=BigInt(vl/1e3)?vl:Number(r)*1e3}function Cse(t,e,r,n,s,i){if(t==="shared"){if(p3(i,"s-maxage"))return 0;let a=i["s-maxage"];if(a!==void 0)return a*1e3}if(p3(i,"max-age"))return 0;let o=i["max-age"];if(o!==void 0)return o*1e3;if(Object.hasOwn(n,"expires")){if(typeof n.expires!="string")return 0;let a=Gy(n.expires);if(!a||e>=a.getTime())return 0;if(s){if(s>=a)return 0;let u=a.getTime()-s.getTime();return r!==void 0&&r>=u?0:u}return a.getTime()-e}if(typeof n["last-modified"]=="string"){let a=Gy(n["last-modified"]);if(a)return a.getTime()>=e?void 0:(e-a.getTime())*.1}if(i.immutable)return 31536e6}function Ise(t,e,r,n){let s=-1/0,i=-1/0,o=-1/0;if(r["stale-while-revalidate"]&&(s=n+r["stale-while-revalidate"]*1e3),r["stale-if-error"]&&(i=n+r["stale-if-error"]*1e3),r.immutable&&s===-1/0&&i===-1/0&&(o=e+31536e6),s===-1/0&&i===-1/0&&o===-1/0){let a=n-t,u=Math.min(Math.max(e-t,0),1e3);return n+a+u}return Math.max(n,s,i,o)}function bse(t,e){let r=["connection","proxy-authenticate","proxy-authentication-info","proxy-authorization","proxy-connection","te","transfer-encoding","upgrade","age"];t.connection&&fse(r,t.connection),Array.isArray(e["no-cache"])&&r.push(...e["no-cache"]),Array.isArray(e.private)&&r.push(...e.private);let n;for(let s of r)Object.hasOwn(t,s)&&(n??={...t},delete n[s]);return n??t}b3.exports=qy});var Vy=x((JQe,Q3)=>{"use strict";var{Writable:yse}=j("node:stream"),{EventEmitter:Bse}=j("node:events"),{assertCacheKey:B3,assertCacheValue:wse}=Cc(),Wy=class extends Bse{#e=1024;#t=104857600;#r=5242880;#n=0;#i=0;#s=new Map;#u=!1;constructor(e){if(super(),e){if(typeof e!="object")throw new TypeError("MemoryCacheStore options must be an object");if(e.maxCount!==void 0){if(typeof e.maxCount!="number"||!Number.isInteger(e.maxCount)||e.maxCount<0)throw new TypeError("MemoryCacheStore options.maxCount must be a non-negative integer");this.#e=e.maxCount}if(e.maxSize!==void 0){if(typeof e.maxSize!="number"||!Number.isInteger(e.maxSize)||e.maxSize<0)throw new TypeError("MemoryCacheStore options.maxSize must be a non-negative integer");this.#t=e.maxSize}if(e.maxEntrySize!==void 0){if(typeof e.maxEntrySize!="number"||!Number.isInteger(e.maxEntrySize)||e.maxEntrySize<0)throw new TypeError("MemoryCacheStore options.maxEntrySize must be a non-negative integer");this.#r=e.maxEntrySize}}}get size(){return this.#n}isFull(){return this.#n>=this.#t||this.#i>=this.#e}get(e){B3(e);let r=`${e.origin}:${e.path}`,n=Date.now(),s=this.#s.get(r),i=s?w3(e,s,n):null;return i==null?void 0:{statusMessage:i.statusMessage,statusCode:i.statusCode,headers:i.headers,body:i.body,vary:i.vary?i.vary:void 0,etag:i.etag,cacheControlDirectives:i.cacheControlDirectives,cachedAt:i.cachedAt,staleAt:i.staleAt,deleteAt:i.deleteAt}}createWriteStream(e,r){B3(e),wse(r);let n=`${e.origin}:${e.path}`,s=this,i={...e,...r,body:[],size:0};return new yse({write(o,a,u){typeof o=="string"&&(o=Buffer.from(o,a)),i.size+=o.byteLength,i.size>=s.#r?this.destroy():i.body.push(o),u(null)},final(o){let a=s.#s.get(n);a||(a=[],s.#s.set(n,a));let u=w3(e,a,Date.now());if(u){let c=a.indexOf(u);a.splice(c,1,i),s.#n-=u.size}else a.push(i),s.#i+=1;if(s.#n+=i.size,s.#n>s.#t||s.#i>s.#e){s.#u||(s.emit("maxSizeExceeded",{size:s.#n,maxSize:s.#t,count:s.#i,maxCount:s.#e}),s.#u=!0);for(let[c,A]of s.#s){for(let f of A.splice(0,A.length/2))s.#n-=f.size,s.#i-=1;A.length===0&&s.#s.delete(c)}s.#nr&&s.method===t.method&&Qse(t,s))return s}}function Qse(t,e){if(e.vary==null)return!0;for(let r in e.vary)if(Object.hasOwn(e.vary,r)&&!Sse(t.headers?.[r],e.vary[r]))return!1;return!0}function Sse(t,e){if(t==null&&e==null)return!0;if(t==null&&e!=null||t!=null&&e==null)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let r=0;r{"use strict";var Tse=j("node:assert"),Jy=class{#e=!1;#t;#r;#n;#i;constructor(e,r,n){if(typeof e!="function")throw new TypeError("callback must be a function");this.#t=e,this.#r=r,this.#i=n}onRequestStart(e,r){this.#e=!1,this.#n=r}onRequestUpgrade(e,r,n,s){this.#r.onRequestUpgrade?.(e,r,n,s)}onResponseStart(e,r,n,s){if(Tse(this.#t!=null),this.#e=r===304||this.#i&&r>=500&&r<=504,this.#t(this.#e,this.#n,r,n),this.#t=null,this.#e)return!0;this.#r.onRequestStart?.(e,this.#n),this.#r.onResponseStart?.(e,r,n,s)}onResponseData(e,r){if(!this.#e)return this.#r.onResponseData?.(e,r)}onResponseEnd(e,r){this.#e||this.#r.onResponseEnd?.(e,r)}onResponseError(e,r){if(!this.#e)if(this.#t&&(this.#t(!1),this.#t=null),typeof this.#r.onResponseError=="function")this.#r.onResponseError(e,r);else throw r}};S3.exports=Jy});var L3=x(($Qe,M3)=>{"use strict";var x3=j("node:assert"),{Readable:xse}=j("node:stream"),xo=et(),bc=y3(),Dse=Vy(),Rse=T3(),{assertCacheStore:Nse,assertCacheMethods:vse,makeCacheKey:kse,normalizeHeaders:Mse,parseCacheControlHeader:k3,isInvalidOrWildcardVaryHeader:Lse}=Cc(),{AbortError:Fse}=ze(),{parseHttpDate:_se}=Hy();function Use(t,e){if(t!==void 0){if(!Array.isArray(t))throw new TypeError(`expected ${e} to be an array or undefined, got ${typeof t}`);for(let r=0;r{};function Ose(t){return t.replace(/^[\t ]+|[\t ]+$/g,"")}function D3(t,e){for(let r=0;rt.staleAt){if(!$y(t,r)&&e?.["max-stale"]){let s=t.staleAt+e["max-stale"]*1e3;return n>s}return!0}if(e?.["min-fresh"]){let s=t.staleAt-n,i=e["min-fresh"]*1e3;return s<=i}return!1}function Vse(t,e){let r=t.cacheControlDirectives?.["stale-while-revalidate"];if(!r||$y(t,e))return!1;let n=Date.now(),s=t.staleAt+r*1e3;return n<=s}function Jse(t,e,r,n,s,i){if(i?.["only-if-cached"]){let o=!1;try{if(typeof n.onConnect=="function"&&(n.onConnect(()=>{o=!0}),o)||typeof n.onHeaders=="function"&&(n.onHeaders(504,[],Ml,"Gateway Timeout"),o))return;typeof n.onComplete=="function"&&n.onComplete([])}catch(a){typeof n.onError=="function"&&n.onError(a)}return!0}return t(s,new bc(e,r,n))}function jy(t,e,r,n,s,i){let o=xo.isStream(r.body)?r.body:xse.from(r.body??[]);x3(!o.destroyed,"stream should not be destroyed"),x3(!o.readableDidRead,"stream should not be readableDidRead");let a={resume(){o.resume()},pause(){o.pause()},get paused(){return o.isPaused()},get aborted(){return o.destroyed},get reason(){return o.errored},abort(c){o.destroy(c??new Fse)}};if(o.on("error",function(c){if(!this.readableEnded)if(typeof t.onResponseError=="function")t.onResponseError(a,c);else throw c}).on("close",function(){this.errored||t.onResponseEnd?.(a,{})}),t.onRequestStart?.(a,s),o.destroyed)return;let u={...r.headers,age:String(n)};i&&(u.warning='110 - "response is stale"'),t.onResponseStart?.(a,r.statusCode,u,r.statusMessage),e.method==="HEAD"?o.destroy():o.on("data",function(c){t.onResponseData?.(a,c)})}function v3(t,e,r,n,s,i,o){if(!o)return Jse(t,e,r,n,s,i);let a=Date.now();if(a>o.deleteAt)return t(s,new bc(e,r,n));let u=Math.round((a-o.cachedAt)/1e3),c=i?.["max-age"]!==void 0&&u>=i["max-age"],A=c||Wse(o,i,e.type),f=c||Hse(o,i,s);if(A||f){if(xo.isStream(s.body)&&xo.bodyLength(s.body)!==0)return t(s,new bc(e,r,n));if(!f&&Vse(o,e.type))return jy(n,s,o,u,null,!0),queueMicrotask(()=>{let g=N3(s,o);t({...s,headers:g},new bc(e,r,{onRequestStart(){},onRequestUpgrade(){},onResponseStart(){},onResponseData(){},onResponseEnd(){},onResponseError(){}}))}),!0;let l=!1;if(!$y(o,e.type)){let g=o.cacheControlDirectives["stale-if-error"]??i?.["stale-if-error"];g&&(l=a{if(g){if(m===304){if(Yse(e.type,E))return xo.isStream(o.body)&&o.body.on("error",Ml).destroy(),R3(e.store,r),t(s,new bc(e,r,n));Gse(E)&&R3(e.store,r)}jy(n,s,o,u,p,A)}else xo.isStream(o.body)&&o.body.on("error",Ml).destroy()},new bc(e,r,n),l))}xo.isStream(s.body)&&s.body.on("error",Ml).destroy(),jy(n,s,o,u,null,!1)}M3.exports=(t={})=>{let{store:e=new Dse,methods:r=["GET"],cacheByDefault:n=void 0,type:s="shared",origins:i=void 0}=t;if(typeof t!="object"||t===null)throw new TypeError(`expected type of opts to be an Object, got ${t===null?"null":typeof t}`);if(Nse(e,"opts.store"),vse(r,"opts.methods"),Use(i,"opts.origins"),typeof n<"u"&&typeof n!="number")throw new TypeError(`expected opts.cacheByDefault to be number or undefined, got ${typeof n}`);if(typeof s<"u"&&s!=="shared"&&s!=="private")throw new TypeError(`expected opts.type to be shared, private, or undefined, got ${typeof s}`);let o={store:e,methods:r,cacheByDefault:n,type:s},a=[];for(let u=0;u(c,A)=>{if(!c.origin||D3(a,c.method))return u(c,A);if(i!==void 0){let g=c.origin.toString().toLowerCase(),p=!1;for(let m=0;mv3(u,o,l,A,c,f,g)):v3(u,o,l,A,c,f,h)}}});var P3=x((KQe,O3)=>{"use strict";var{createInflate:Ky,createGunzip:F3,createBrotliDecompress:jse,createZstdDecompress:$se}=j("node:zlib"),{pipeline:Kse}=j("node:stream"),zse=Ec(),{runtimeFeatures:Xse}=Ei(),_3={gzip:F3,"x-gzip":F3,br:jse,deflate:Ky,compress:Ky,"x-compress":Ky,...Xse.has("zstd")?{zstd:$se}:{}},Zse=[204,304],U3=!1,zy=class extends zse{#e=[];#t;#r;constructor(e,{skipStatusCodes:r=Zse,skipErrorResponses:n=!0}={}){super(e),this.#t=r,this.#r=n}#n(e,r){return!!(!e||r<200||this.#t.includes(r)||this.#r&&r>=400)}#i(e){let r=e.split(","),n=5;if(r.length>n)throw new Error(`too many content-encodings in response: ${r.length}, maximum allowed is ${n}`);let s=[];for(let i=r.length-1;i>=0;i--){let o=r[i].trim();if(o){if(!_3[o])return s.length=0,s;s.push(_3[o]())}}return s}#s(e,r){e.on("readable",()=>{let n;for(;(n=e.read())!==null&&super.onResponseData(r,n)!==!1;);}),e.on("error",n=>{super.onResponseError(r,n)})}#u(e){let r=this.#e[0];this.#s(r,e),r.on("end",()=>{super.onResponseEnd(e,{})})}#o(e){let r=this.#e[this.#e.length-1];this.#s(r,e),Kse(this.#e,n=>{if(n){super.onResponseError(e,n);return}super.onResponseEnd(e,{})})}#a(){this.#e.length=0}onResponseStart(e,r,n,s){let i=n["content-encoding"];if(this.#n(i,r))return super.onResponseStart(e,r,n,s);let o=this.#i(i.toLowerCase());if(o.length===0)return this.#a(),super.onResponseStart(e,r,n,s);this.#e=o;let{"content-encoding":a,"content-length":u,...c}=n;return this.#e.length===1?this.#u(e):this.#o(e),super.onResponseStart(e,r,c,s)}onResponseData(e,r){if(this.#e.length>0){this.#e[0].write(r);return}super.onResponseData(e,r)}onResponseEnd(e,r){if(this.#e.length>0){this.#e[0].end(),this.#a();return}super.onResponseEnd(e,r)}onResponseError(e,r){if(this.#e.length>0){for(let n of this.#e)n.destroy(r);this.#a()}super.onResponseError(e,r)}};function eie(t={}){return U3||(process.emitWarning("DecompressInterceptor is experimental and subject to change","ExperimentalWarning"),U3=!0),e=>(r,n)=>{let s=new zy(n,t);return e(r,s)}}O3.exports=eie});var G3=x((zQe,Y3)=>{"use strict";var{RequestAbortedError:tie}=ze(),H3=5*1024*1024,Xy=class{#e;#t=[];#r=H3;#n=0;#i={};#s="";#u=!1;#o=!1;#a=!1;#c=!1;#l=null;#A=null;constructor(e,r,n=H3){this.#e=e,this.#A=r,this.#r=n}addWaitingHandler(e){if(this.#c||this.#a)return!1;let r=this.#f(e),n=r.controller;try{if(e.onRequestStart?.(n,null),n.aborted)return r.done=!0,!0;this.#o&&e.onResponseStart?.(n,this.#n,this.#i,this.#s)}catch{return r.done=!0,!0}return n.aborted||this.#t.push(r),!0}onRequestStart(e,r){this.#l=e,this.#e.onRequestStart?.(e,r)}onRequestUpgrade(e,r,n,s){this.#e.onRequestUpgrade?.(e,r,n,s)}onResponseStart(e,r,n,s){this.#o=!0,this.#n=r,this.#i=n,this.#s=s,this.#e.onResponseStart?.(e,r,n,s);for(let i of this.#t){let{handler:o,controller:a}=i;if(i.done||a.aborted){i.done=!0;continue}try{o.onResponseStart?.(a,r,n,s)}catch{}a.aborted&&(i.done=!0)}this.#g()}onResponseData(e,r){if(!(this.#u||this.#c)){this.#a=!0,this.#e.onResponseData?.(e,r);for(let n of this.#t){let{handler:s,controller:i}=n;if(n.done||i.aborted){n.done=!0;continue}if(i.paused){this.#d(n,r);continue}try{s.onResponseData?.(i,r)}catch{}i.aborted&&(n.done=!0,n.bufferedChunks=[],n.bufferedBytes=0)}this.#g()}}onResponseEnd(e,r){if(!(this.#u||this.#c)){this.#c=!0,this.#e.onResponseEnd?.(e,r);for(let n of this.#t){if(n.done||n.controller.aborted){n.done=!0;continue}if(this.#h(n),n.done||n.controller.aborted){n.done=!0;continue}if(n.controller.paused&&n.bufferedChunks.length>0){n.pendingTrailers=r;continue}try{n.handler.onResponseEnd?.(n.controller,r)}catch{}n.done=!0}this.#g(),this.#A?.()}}onResponseError(e,r){if(!this.#c){this.#u=!0,this.#c=!0,this.#e.onResponseError?.(e,r);for(let n of this.#t)this.#p(n,r);this.#t=[],this.#A?.()}}#f(e){let r={handler:e,controller:null,bufferedChunks:[],bufferedBytes:0,pendingTrailers:null,done:!1},n={aborted:!1,paused:!1,reason:null};return r.controller={resume:()=>{if(!n.aborted){if(n.paused=!1,this.#h(r),this.#c&&r.pendingTrailers&&r.bufferedChunks.length===0&&!n.paused&&!n.aborted){try{r.handler.onResponseEnd?.(r.controller,r.pendingTrailers)}catch{}r.pendingTrailers=null,r.done=!0}this.#g()}},pause:()=>{n.aborted||(n.paused=!0)},get paused(){return n.paused},get aborted(){return n.aborted},get reason(){return n.reason},abort:s=>{n.aborted=!0,n.reason=s??null,r.done=!0,r.pendingTrailers=null,r.bufferedChunks=[],r.bufferedBytes=0}},r}#d(e,r){if(e.done||e.controller.aborted){e.done=!0,e.bufferedChunks=[],e.bufferedBytes=0;return}let n=Buffer.from(r);if(e.bufferedChunks.push(n),e.bufferedBytes+=n.length,e.bufferedBytes>this.#r){let s=new tie(`Deduplicated waiting handler exceeded maxBufferSize (${this.#r} bytes) while paused`);this.#p(e,s)}}#h(e){let{handler:r,controller:n}=e;for(;!e.done&&!n.aborted&&!n.paused&&e.bufferedChunks.length>0;){let s=e.bufferedChunks.shift();e.bufferedBytes-=s.length;try{r.onResponseData?.(n,s)}catch{}if(n.aborted){e.done=!0,e.pendingTrailers=null,e.bufferedChunks=[],e.bufferedBytes=0;break}}}#p(e,r){if(!e.done){e.done=!0,e.pendingTrailers=null,e.bufferedChunks=[],e.bufferedBytes=0;try{e.controller.abort(r),e.handler.onResponseError?.(e.controller,r)}catch{}}}#g(){this.#t=this.#t.filter(e=>e.done===!1)}};Y3.exports=Xy});var W3=x((XQe,q3)=>{"use strict";var rie=j("node:diagnostics_channel"),nie=et(),sie=G3(),{normalizeHeaders:iie,makeCacheKey:oie,makeDeduplicationKey:aie}=Cc(),Yg=rie.channel("undici:request:pending-requests");q3.exports=(t={})=>{let{methods:e=["GET"],skipHeaderNames:r=[],excludeHeaderNames:n=[],maxBufferSize:s=5*1024*1024}=t;if(typeof t!="object"||t===null)throw new TypeError(`expected type of opts to be an Object, got ${t===null?"null":typeof t}`);if(!Array.isArray(e))throw new TypeError(`expected opts.methods to be an array, got ${typeof e}`);for(let u of e)if(!nie.safeHTTPMethods.includes(u))throw new TypeError(`expected opts.methods to only contain safe HTTP methods, got ${u}`);if(!Array.isArray(r))throw new TypeError(`expected opts.skipHeaderNames to be an array, got ${typeof r}`);if(!Array.isArray(n))throw new TypeError(`expected opts.excludeHeaderNames to be an array, got ${typeof n}`);if(!Number.isFinite(s)||s<=0)throw new TypeError(`expected opts.maxBufferSize to be a positive finite number, got ${s}`);let i=new Set(r.map(u=>u.toLowerCase())),o=new Set(n.map(u=>u.toLowerCase())),a=new Map;return u=>(c,A)=>{if(!c.origin||e.includes(c.method)===!1)return u(c,A);if(c={...c,headers:iie(c)},i.size>0){for(let p of Object.keys(c.headers))if(i.has(p.toLowerCase()))return u(c,A)}let f=oie(c),l=aie(f,o),h=a.get(l);if(h)return h.addWaitingHandler(A)?!0:u(c,A);let g=new sie(A,()=>{a.delete(l),Yg.hasSubscribers&&Yg.publish({size:a.size,key:l,type:"removed"})},s);return a.set(l,g),Yg.hasSubscribers&&Yg.publish({size:a.size,key:l,type:"added"}),u(c,g)}}});var j3=x((eSe,J3)=>{"use strict";var{Writable:uie}=j("node:stream"),{assertCacheKey:Zy,assertCacheValue:cie}=Cc(),eB,Nn=3,V3=2*1e3*1e3*1e3;J3.exports=class{#e=V3;#t=1/0;#r;#n;#i;#s;#u;#o;#a;#c;constructor(e){if(e){if(typeof e!="object")throw new TypeError("SqliteCacheStore options must be an object");if(e.maxEntrySize!==void 0){if(typeof e.maxEntrySize!="number"||!Number.isInteger(e.maxEntrySize)||e.maxEntrySize<0)throw new TypeError("SqliteCacheStore options.maxEntrySize must be a non-negative integer");if(e.maxEntrySize>V3)throw new TypeError("SqliteCacheStore options.maxEntrySize must be less than 2gb");this.#e=e.maxEntrySize}if(e.maxCount!==void 0){if(typeof e.maxCount!="number"||!Number.isInteger(e.maxCount)||e.maxCount<0)throw new TypeError("SqliteCacheStore options.maxCount must be a non-negative integer");this.#t=e.maxCount}}eB||(eB=j("node:sqlite").DatabaseSync),this.#r=new eB(e?.location??":memory:"),this.#r.exec(`
+ PRAGMA journal_mode = WAL;
+ PRAGMA synchronous = NORMAL;
+ PRAGMA temp_store = memory;
+ PRAGMA optimize;
+
+ CREATE TABLE IF NOT EXISTS cacheInterceptorV${Nn} (
+ -- Data specific to us
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ url TEXT NOT NULL,
+ method TEXT NOT NULL,
+
+ -- Data returned to the interceptor
+ body BUF NULL,
+ deleteAt INTEGER NOT NULL,
+ statusCode INTEGER NOT NULL,
+ statusMessage TEXT NOT NULL,
+ headers TEXT NULL,
+ cacheControlDirectives TEXT NULL,
+ etag TEXT NULL,
+ vary TEXT NULL,
+ cachedAt INTEGER NOT NULL,
+ staleAt INTEGER NOT NULL
+ );
+
+ CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${Nn}_getValuesQuery ON cacheInterceptorV${Nn}(url, method, deleteAt);
+ CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${Nn}_deleteByUrlQuery ON cacheInterceptorV${Nn}(deleteAt);
+ `),this.#n=this.#r.prepare(`
+ SELECT
+ id,
+ body,
+ deleteAt,
+ statusCode,
+ statusMessage,
+ headers,
+ etag,
+ cacheControlDirectives,
+ vary,
+ cachedAt,
+ staleAt
+ FROM cacheInterceptorV${Nn}
+ WHERE
+ url = ?
+ AND method = ?
+ ORDER BY
+ deleteAt ASC
+ `),this.#i=this.#r.prepare(`
+ UPDATE cacheInterceptorV${Nn} SET
+ body = ?,
+ deleteAt = ?,
+ statusCode = ?,
+ statusMessage = ?,
+ headers = ?,
+ etag = ?,
+ cacheControlDirectives = ?,
+ cachedAt = ?,
+ staleAt = ?
+ WHERE
+ id = ?
+ `),this.#s=this.#r.prepare(`
+ INSERT INTO cacheInterceptorV${Nn} (
+ url,
+ method,
+ body,
+ deleteAt,
+ statusCode,
+ statusMessage,
+ headers,
+ etag,
+ cacheControlDirectives,
+ vary,
+ cachedAt,
+ staleAt
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ `),this.#o=this.#r.prepare(`DELETE FROM cacheInterceptorV${Nn} WHERE url = ?`),this.#a=this.#r.prepare(`SELECT COUNT(*) AS total FROM cacheInterceptorV${Nn}`),this.#u=this.#r.prepare(`DELETE FROM cacheInterceptorV${Nn} WHERE deleteAt <= ?`),this.#c=this.#t===1/0?null:this.#r.prepare(`
+ DELETE FROM cacheInterceptorV${Nn}
+ WHERE id IN (
+ SELECT
+ id
+ FROM cacheInterceptorV${Nn}
+ ORDER BY cachedAt ASC
+ LIMIT ?
+ )
+ `)}close(){this.#r.close()}get(e){Zy(e);let r=this.#f(e);return r?{body:r.body?Buffer.from(r.body.buffer,r.body.byteOffset,r.body.byteLength):void 0,statusCode:r.statusCode,statusMessage:r.statusMessage,headers:r.headers?JSON.parse(r.headers):void 0,etag:r.etag?r.etag:void 0,vary:r.vary?JSON.parse(r.vary):void 0,cacheControlDirectives:r.cacheControlDirectives?JSON.parse(r.cacheControlDirectives):void 0,cachedAt:r.cachedAt,staleAt:r.staleAt,deleteAt:r.deleteAt}:void 0}set(e,r){Zy(e);let n=this.#A(e),s=Array.isArray(r.body)?Buffer.concat(r.body):r.body,i=s?.byteLength;if(i&&i>this.#e)return;let o=this.#f(e,!0);o?this.#i.run(s,r.deleteAt,r.statusCode,r.statusMessage,r.headers?JSON.stringify(r.headers):null,r.etag?r.etag:null,r.cacheControlDirectives?JSON.stringify(r.cacheControlDirectives):null,r.cachedAt,r.staleAt,o.id):(this.#s.run(n,e.method,s,r.deleteAt,r.statusCode,r.statusMessage,r.headers?JSON.stringify(r.headers):null,r.etag?r.etag:null,r.cacheControlDirectives?JSON.stringify(r.cacheControlDirectives):null,r.vary?JSON.stringify(r.vary):null,r.cachedAt,r.staleAt),this.#l())}createWriteStream(e,r){Zy(e),cie(r);let n=0,s=[],i=this;return new uie({decodeStrings:!0,write(o,a,u){n+=o.byteLength,n=u.deleteAt&&!r)continue;let c=!0;if(u.vary){let A=JSON.parse(u.vary);for(let f in A)if(!Aie(s[f],A[f])){c=!1;break}}if(c)return u}}};function Aie(t,e){if(t==null&&e==null)return!0;if(t==null&&e!=null||t!=null&&e==null)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let r=0;r{"use strict";var{kConstruct:lie}=xt(),{kEnumerableProperty:yc}=et(),{iteratorMixin:fie,isValidHeaderName:Ll,isValidHeaderValue:K3}=Sn(),{webidl:ht}=vr(),tB=j("node:assert"),Gg=j("node:util");function $3(t){return t===10||t===13||t===9||t===32}function z3(t){let e=0,r=t.length;for(;r>e&&$3(t.charCodeAt(r-1));)--r;for(;r>e&&$3(t.charCodeAt(e));)++e;return e===0&&r===t.length?t:t.substring(e,r)}function X3(t,e){if(Array.isArray(e))for(let r=0;r>","record"]})}function rB(t,e,r){if(r=z3(r),Ll(e)){if(!K3(r))throw ht.errors.invalidArgument({prefix:"Headers.append",value:r,type:"header value"})}else throw ht.errors.invalidArgument({prefix:"Headers.append",value:e,type:"header name"});if(eL(t)==="immutable")throw new TypeError("immutable");return Wg(t).append(e,r,!1)}function die(t){let e=Wg(t);if(!e)return[];if(e.sortedMap)return e.sortedMap;let r=[],n=e.toSortedArray(),s=e.cookies;if(s===null||s.length===1)return e.sortedMap=n;for(let i=0;i>1),r[c][0]<=A[0]?u=c+1:a=c;if(i!==c){for(o=i;o>u;)r[o]=r[--o];r[u]=A}}if(!n.next().done)throw new TypeError("Unreachable");return r}else{let n=0;for(let{0:s,1:{value:i}}of this.headersMap)r[n++]=[s,i],tB(i!==null);return r.sort(Z3)}}},ws=class t{#e;#t;constructor(e=void 0){ht.util.markAsUncloneable(this),e!==lie&&(this.#t=new qg,this.#e="none",e!==void 0&&(e=ht.converters.HeadersInit(e,"Headers constructor","init"),X3(this,e)))}append(e,r){ht.brandCheck(this,t),ht.argumentLengthCheck(arguments,2,"Headers.append");let n="Headers.append";return e=ht.converters.ByteString(e,n,"name"),r=ht.converters.ByteString(r,n,"value"),rB(this,e,r)}delete(e){if(ht.brandCheck(this,t),ht.argumentLengthCheck(arguments,1,"Headers.delete"),e=ht.converters.ByteString(e,"Headers.delete","name"),!Ll(e))throw ht.errors.invalidArgument({prefix:"Headers.delete",value:e,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.contains(e,!1)&&this.#t.delete(e,!1)}get(e){ht.brandCheck(this,t),ht.argumentLengthCheck(arguments,1,"Headers.get");let r="Headers.get";if(e=ht.converters.ByteString(e,r,"name"),!Ll(e))throw ht.errors.invalidArgument({prefix:r,value:e,type:"header name"});return this.#t.get(e,!1)}has(e){ht.brandCheck(this,t),ht.argumentLengthCheck(arguments,1,"Headers.has");let r="Headers.has";if(e=ht.converters.ByteString(e,r,"name"),!Ll(e))throw ht.errors.invalidArgument({prefix:r,value:e,type:"header name"});return this.#t.contains(e,!1)}set(e,r){ht.brandCheck(this,t),ht.argumentLengthCheck(arguments,2,"Headers.set");let n="Headers.set";if(e=ht.converters.ByteString(e,n,"name"),r=ht.converters.ByteString(r,n,"value"),r=z3(r),Ll(e)){if(!K3(r))throw ht.errors.invalidArgument({prefix:n,value:r,type:"header value"})}else throw ht.errors.invalidArgument({prefix:n,value:e,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.set(e,r,!1)}getSetCookie(){ht.brandCheck(this,t);let e=this.#t.cookies;return e?[...e]:[]}[Gg.inspect.custom](e,r){return r.depth??=e,`Headers ${Gg.formatWithOptions(r,this.#t.entries)}`}static getHeadersGuard(e){return e.#e}static setHeadersGuard(e,r){e.#e=r}static getHeadersList(e){return e.#t}static setHeadersList(e,r){e.#t=r}},{getHeadersGuard:eL,setHeadersGuard:hie,getHeadersList:Wg,setHeadersList:gie}=ws;Reflect.deleteProperty(ws,"getHeadersGuard");Reflect.deleteProperty(ws,"setHeadersGuard");Reflect.deleteProperty(ws,"getHeadersList");Reflect.deleteProperty(ws,"setHeadersList");fie("Headers",ws,die,0,1);Object.defineProperties(ws.prototype,{append:yc,delete:yc,get:yc,has:yc,set:yc,getSetCookie:yc,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[Gg.inspect.custom]:{enumerable:!1}});ht.converters.HeadersInit=function(t,e,r){if(ht.util.Type(t)===ht.util.Types.OBJECT){let n=Reflect.get(t,Symbol.iterator);if(!Gg.types.isProxy(t)&&n===ws.prototype.entries)try{return Wg(t).entriesList}catch{}return typeof n=="function"?ht.converters["sequence>"](t,e,r,n.bind(t)):ht.converters["record"](t,e,r)}throw ht.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence>","record"]})};tL.exports={fill:X3,compareHeaderName:Z3,Headers:ws,HeadersList:qg,getHeadersGuard:eL,setHeadersGuard:hie,setHeadersList:gie,getHeadersList:Wg}});var _l=x((rSe,dL)=>{"use strict";var{Headers:aL,HeadersList:rL,fill:pie,getHeadersGuard:mie,setHeadersGuard:uL,setHeadersList:cL}=ka(),{extractBody:nL,cloneBody:Eie,mixinBody:Cie,streamRegistry:AL,bodyUnusable:Iie}=Zu(),lL=et(),sL=j("node:util"),{kEnumerableProperty:vn}=lL,{isValidReasonPhrase:bie,isCancelled:yie,isAborted:Bie,isErrorLike:wie,environmentSettingsObject:Qie}=Sn(),{redirectStatusSet:Sie,nullBodyStatus:Tie}=jA(),{webidl:ct}=vr(),{URLSerializer:iL}=Xn(),{kConstruct:Jg}=xt(),nB=j("node:assert"),{isomorphicEncode:xie,serializeJavascriptValueToJSONString:Die}=mi(),Rie=new TextEncoder("utf-8"),kn=class t{#e;#t;static error(){return Fl(jg(),"immutable")}static json(e,r=void 0){ct.argumentLengthCheck(arguments,1,"Response.json"),r!==null&&(r=ct.converters.ResponseInit(r));let n=Rie.encode(Die(e)),s=nL(n),i=Fl(Bc({}),"response");return oL(i,r,{body:s[0],type:"application/json"}),i}static redirect(e,r=302){ct.argumentLengthCheck(arguments,1,"Response.redirect"),e=ct.converters.USVString(e),r=ct.converters["unsigned short"](r);let n;try{n=new URL(e,Qie.settingsObject.baseUrl)}catch(o){throw new TypeError(`Failed to parse URL from ${e}`,{cause:o})}if(!Sie.has(r))throw new RangeError(`Invalid status code ${r}`);let s=Fl(Bc({}),"immutable");s.#t.status=r;let i=xie(iL(n));return s.#t.headersList.append("location",i,!0),s}constructor(e=null,r=void 0){if(ct.util.markAsUncloneable(this),e===Jg)return;e!==null&&(e=ct.converters.BodyInit(e,"Response","body")),r=ct.converters.ResponseInit(r),this.#t=Bc({}),this.#e=new aL(Jg),uL(this.#e,"response"),cL(this.#e,this.#t.headersList);let n=null;if(e!=null){let[s,i]=nL(e);n={body:s,type:i}}oL(this,r,n)}get type(){return ct.brandCheck(this,t),this.#t.type}get url(){ct.brandCheck(this,t);let e=this.#t.urlList,r=e[e.length-1]??null;return r===null?"":iL(r,!0)}get redirected(){return ct.brandCheck(this,t),this.#t.urlList.length>1}get status(){return ct.brandCheck(this,t),this.#t.status}get ok(){return ct.brandCheck(this,t),this.#t.status>=200&&this.#t.status<=299}get statusText(){return ct.brandCheck(this,t),this.#t.statusText}get headers(){return ct.brandCheck(this,t),this.#e}get body(){return ct.brandCheck(this,t),this.#t.body?this.#t.body.stream:null}get bodyUsed(){return ct.brandCheck(this,t),!!this.#t.body&&lL.isDisturbed(this.#t.body.stream)}clone(){if(ct.brandCheck(this,t),Iie(this.#t))throw ct.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let e=sB(this.#t);return this.#t.urlList.length!==0&&this.#t.body?.stream&&AL.register(this,new WeakRef(this.#t.body.stream)),Fl(e,mie(this.#e))}[sL.inspect.custom](e,r){r.depth===null&&(r.depth=2),r.colors??=!0;let n={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${sL.formatWithOptions(r,n)}`}static getResponseHeaders(e){return e.#e}static setResponseHeaders(e,r){e.#e=r}static getResponseState(e){return e.#t}static setResponseState(e,r){e.#t=r}},{getResponseHeaders:Nie,setResponseHeaders:vie,getResponseState:Ma,setResponseState:kie}=kn;Reflect.deleteProperty(kn,"getResponseHeaders");Reflect.deleteProperty(kn,"setResponseHeaders");Reflect.deleteProperty(kn,"getResponseState");Reflect.deleteProperty(kn,"setResponseState");Cie(kn,Ma);Object.defineProperties(kn.prototype,{type:vn,url:vn,status:vn,ok:vn,redirected:vn,statusText:vn,headers:vn,clone:vn,body:vn,bodyUsed:vn,[Symbol.toStringTag]:{value:"Response",configurable:!0}});Object.defineProperties(kn,{json:vn,redirect:vn,error:vn});function sB(t){if(t.internalResponse)return fL(sB(t.internalResponse),t.type);let e=Bc({...t,body:null});return t.body!=null&&(e.body=Eie(t.body)),e}function Bc(t){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...t,headersList:t?.headersList?new rL(t?.headersList):new rL,urlList:t?.urlList?[...t.urlList]:[]}}function jg(t){let e=wie(t);return Bc({type:"error",status:0,error:e?t:new Error(t&&String(t)),aborted:t&&t.name==="AbortError"})}function Mie(t){return t.type==="error"&&t.status===0}function Vg(t,e){return e={internalResponse:t,...e},new Proxy(t,{get(r,n){return n in e?e[n]:r[n]},set(r,n,s){return nB(!(n in e)),r[n]=s,!0}})}function fL(t,e){if(e==="basic")return Vg(t,{type:"basic",headersList:t.headersList});if(e==="cors")return Vg(t,{type:"cors",headersList:t.headersList});if(e==="opaque")return Vg(t,{type:"opaque",urlList:[],status:0,statusText:"",body:null});if(e==="opaqueredirect")return Vg(t,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});nB(!1)}function Lie(t,e=null){return nB(yie(t)),Bie(t)?jg(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:e})):jg(Object.assign(new DOMException("Request was cancelled."),{cause:e}))}function oL(t,e,r){if(e.status!==null&&(e.status<200||e.status>599))throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in e&&e.statusText!=null&&!bie(String(e.statusText)))throw new TypeError("Invalid statusText");if("status"in e&&e.status!=null&&(Ma(t).status=e.status),"statusText"in e&&e.statusText!=null&&(Ma(t).statusText=e.statusText),"headers"in e&&e.headers!=null&&pie(Nie(t),e.headers),r){if(Tie.includes(t.status))throw ct.errors.exception({header:"Response constructor",message:`Invalid response status code ${t.status}`});Ma(t).body=r.body,r.type!=null&&!Ma(t).headersList.contains("content-type",!0)&&Ma(t).headersList.append("content-type",r.type,!0)}}function Fl(t,e){let r=new kn(Jg);kie(r,t);let n=new aL(Jg);return vie(r,n),cL(n,t.headersList),uL(n,e),t.urlList.length!==0&&t.body?.stream&&AL.register(r,new WeakRef(t.body.stream)),r}ct.converters.XMLHttpRequestBodyInit=function(t,e,r){return typeof t=="string"?ct.converters.USVString(t,e,r):ct.is.Blob(t)||ct.is.BufferSource(t)||ct.is.FormData(t)||ct.is.URLSearchParams(t)?t:ct.converters.DOMString(t,e,r)};ct.converters.BodyInit=function(t,e,r){return ct.is.ReadableStream(t)||t?.[Symbol.asyncIterator]?t:ct.converters.XMLHttpRequestBodyInit(t,e,r)};ct.converters.ResponseInit=ct.dictionaryConverter([{key:"status",converter:ct.converters["unsigned short"],defaultValue:()=>200},{key:"statusText",converter:ct.converters.ByteString,defaultValue:()=>""},{key:"headers",converter:ct.converters.HeadersInit}]);ct.is.Response=ct.util.MakeTypeAssertion(kn);dL.exports={isNetworkError:Mie,makeNetworkError:jg,makeResponse:Bc,makeAppropriateNetworkError:Lie,filterResponse:fL,Response:kn,cloneResponse:sB,fromInnerResponse:Fl,getResponseState:Ma}});var wc=x((nSe,TL)=>{"use strict";var{extractBody:Fie,mixinBody:_ie,cloneBody:Uie,bodyUnusable:hL}=Zu(),{Headers:IL,fill:Oie,HeadersList:zg,setHeadersGuard:iB,getHeadersGuard:Pie,setHeadersList:bL,getHeadersList:gL}=ka(),Kg=et(),pL=j("node:util"),{isValidHTTPToken:Hie,sameOrigin:mL,environmentSettingsObject:$g}=Sn(),{forbiddenMethodsSet:Yie,corsSafeListedMethodsSet:Gie,referrerPolicy:qie,requestRedirect:Wie,requestMode:Vie,requestCredentials:Jie,requestCache:jie,requestDuplex:$ie}=jA(),{kEnumerableProperty:fr,normalizedMethodRecordsBase:Kie,normalizedMethodRecords:zie}=Kg,{webidl:je}=vr(),{URLSerializer:Xie}=Xn(),{kConstruct:Xg}=xt(),Zie=j("node:assert"),{getMaxListeners:yL,setMaxListeners:eoe,defaultMaxListeners:toe}=j("node:events"),roe=Symbol("abortController"),BL=new FinalizationRegistry(({signal:t,abort:e})=>{t.removeEventListener("abort",e)}),Zg=new WeakMap,oB;try{oB=yL(new AbortController().signal)>0}catch{oB=!1}function EL(t){return e;function e(){let r=t.deref();if(r!==void 0){BL.unregister(e),this.removeEventListener("abort",e),r.abort(this.reason);let n=Zg.get(r.signal);if(n!==void 0){if(n.size!==0){for(let s of n){let i=s.deref();i!==void 0&&i.abort(this.reason)}n.clear()}Zg.delete(r.signal)}}}}var CL=!1,mn=class t{#e;#t;#r;#n;constructor(e,r=void 0){if(je.util.markAsUncloneable(this),e===Xg)return;je.argumentLengthCheck(arguments,1,"Request constructor"),e=je.converters.RequestInfo(e),r=je.converters.RequestInit(r);let s=null,i=null,o=$g.settingsObject.baseUrl,a=null;if(typeof e=="string"){this.#t=r.dispatcher;let E;try{E=new URL(e,o)}catch(C){throw new TypeError("Failed to parse URL from "+e,{cause:C})}if(E.username||E.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+e);s=e0({urlList:[E]}),i="cors"}else Zie(je.is.Request(e)),s=e.#n,a=e.#e,this.#t=r.dispatcher||e.#t;let u=$g.settingsObject.origin,c="client";if(s.window?.constructor?.name==="EnvironmentSettingsObject"&&mL(s.window,u)&&(c=s.window),r.window!=null)throw new TypeError(`'window' option '${c}' must be null`);"window"in r&&(c="no-window"),s=e0({method:s.method,headersList:s.headersList,unsafeRequest:s.unsafeRequest,client:$g.settingsObject,window:c,priority:s.priority,origin:s.origin,referrer:s.referrer,referrerPolicy:s.referrerPolicy,mode:s.mode,credentials:s.credentials,cache:s.cache,redirect:s.redirect,integrity:s.integrity,keepalive:s.keepalive,reloadNavigation:s.reloadNavigation,historyNavigation:s.historyNavigation,urlList:[...s.urlList]});let A=Object.keys(r).length!==0;if(A&&(s.mode==="navigate"&&(s.mode="same-origin"),s.reloadNavigation=!1,s.historyNavigation=!1,s.origin="client",s.referrer="client",s.referrerPolicy="",s.url=s.urlList[s.urlList.length-1],s.urlList=[s.url]),r.referrer!==void 0){let E=r.referrer;if(E==="")s.referrer="no-referrer";else{let C;try{C=new URL(E,o)}catch(b){throw new TypeError(`Referrer "${E}" is not a valid URL.`,{cause:b})}C.protocol==="about:"&&C.hostname==="client"||u&&!mL(C,$g.settingsObject.baseUrl)?s.referrer="client":s.referrer=C}}r.referrerPolicy!==void 0&&(s.referrerPolicy=r.referrerPolicy);let f;if(r.mode!==void 0?f=r.mode:f=i,f==="navigate")throw je.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(f!=null&&(s.mode=f),r.credentials!==void 0&&(s.credentials=r.credentials),r.cache!==void 0&&(s.cache=r.cache),s.cache==="only-if-cached"&&s.mode!=="same-origin")throw new TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(r.redirect!==void 0&&(s.redirect=r.redirect),r.integrity!=null&&(s.integrity=String(r.integrity)),r.keepalive!==void 0&&(s.keepalive=!!r.keepalive),r.method!==void 0){let E=r.method,C=zie[E];if(C!==void 0)s.method=C;else{if(!Hie(E))throw new TypeError(`'${E}' is not a valid HTTP method.`);let b=E.toUpperCase();if(Yie.has(b))throw new TypeError(`'${E}' HTTP method is unsupported.`);E=Kie[b]??E,s.method=E}!CL&&s.method==="patch"&&(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),CL=!0)}r.signal!==void 0&&(a=r.signal),this.#n=s;let l=new AbortController;if(this.#e=l.signal,a!=null)if(a.aborted)l.abort(a.reason);else{this[roe]=l;let E=new WeakRef(l),C=EL(E);oB&&yL(a)===toe&&eoe(1500,a),Kg.addAbortListener(a,C),BL.register(l,{signal:a,abort:C},C)}if(this.#r=new IL(Xg),bL(this.#r,s.headersList),iB(this.#r,"request"),f==="no-cors"){if(!Gie.has(s.method))throw new TypeError(`'${s.method} is unsupported in no-cors mode.`);iB(this.#r,"request-no-cors")}if(A){let E=gL(this.#r),C=r.headers!==void 0?r.headers:new zg(E);if(E.clear(),C instanceof zg){for(let{name:b,value:B}of C.rawValues())E.append(b,B,!1);E.cookies=C.cookies}else Oie(this.#r,C)}let h=je.is.Request(e)?e.#n.body:null;if((r.body!=null||h!=null)&&(s.method==="GET"||s.method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body.");let g=null;if(r.body!=null){let[E,C]=Fie(r.body,s.keepalive);g=E,C&&!gL(this.#r).contains("content-type",!0)&&this.#r.append("content-type",C,!0)}let p=g??h;if(p!=null&&p.source==null){if(g!=null&&r.duplex==null)throw new TypeError("RequestInit: duplex option is required when sending a body.");if(s.mode!=="same-origin"&&s.mode!=="cors")throw new TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');s.useCORSPreflightFlag=!0}let m=p;if(g==null&&h!=null){if(hL(e.#n))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");let E=new TransformStream;h.stream.pipeThrough(E),m={source:h.source,length:h.length,stream:E.readable}}this.#n.body=m}get method(){return je.brandCheck(this,t),this.#n.method}get url(){return je.brandCheck(this,t),Xie(this.#n.url)}get headers(){return je.brandCheck(this,t),this.#r}get destination(){return je.brandCheck(this,t),this.#n.destination}get referrer(){return je.brandCheck(this,t),this.#n.referrer==="no-referrer"?"":this.#n.referrer==="client"?"about:client":this.#n.referrer.toString()}get referrerPolicy(){return je.brandCheck(this,t),this.#n.referrerPolicy}get mode(){return je.brandCheck(this,t),this.#n.mode}get credentials(){return je.brandCheck(this,t),this.#n.credentials}get cache(){return je.brandCheck(this,t),this.#n.cache}get redirect(){return je.brandCheck(this,t),this.#n.redirect}get integrity(){return je.brandCheck(this,t),this.#n.integrity}get keepalive(){return je.brandCheck(this,t),this.#n.keepalive}get isReloadNavigation(){return je.brandCheck(this,t),this.#n.reloadNavigation}get isHistoryNavigation(){return je.brandCheck(this,t),this.#n.historyNavigation}get signal(){return je.brandCheck(this,t),this.#e}get body(){return je.brandCheck(this,t),this.#n.body?this.#n.body.stream:null}get bodyUsed(){return je.brandCheck(this,t),!!this.#n.body&&Kg.isDisturbed(this.#n.body.stream)}get duplex(){return je.brandCheck(this,t),"half"}clone(){if(je.brandCheck(this,t),hL(this.#n))throw new TypeError("unusable");let e=QL(this.#n),r=new AbortController;if(this.signal.aborted)r.abort(this.signal.reason);else{let n=Zg.get(this.signal);n===void 0&&(n=new Set,Zg.set(this.signal,n));let s=new WeakRef(r);n.add(s),Kg.addAbortListener(r.signal,EL(s))}return SL(e,this.#t,r.signal,Pie(this.#r))}[pL.inspect.custom](e,r){r.depth===null&&(r.depth=2),r.colors??=!0;let n={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${pL.formatWithOptions(r,n)}`}static setRequestSignal(e,r){return e.#e=r,e}static getRequestDispatcher(e){return e.#t}static setRequestDispatcher(e,r){e.#t=r}static setRequestHeaders(e,r){e.#r=r}static getRequestState(e){return e.#n}static setRequestState(e,r){e.#n=r}},{setRequestSignal:noe,getRequestDispatcher:soe,setRequestDispatcher:ioe,setRequestHeaders:ooe,getRequestState:wL,setRequestState:aoe}=mn;Reflect.deleteProperty(mn,"setRequestSignal");Reflect.deleteProperty(mn,"getRequestDispatcher");Reflect.deleteProperty(mn,"setRequestDispatcher");Reflect.deleteProperty(mn,"setRequestHeaders");Reflect.deleteProperty(mn,"getRequestState");Reflect.deleteProperty(mn,"setRequestState");_ie(mn,wL);function e0(t){return{method:t.method??"GET",localURLsOnly:t.localURLsOnly??!1,unsafeRequest:t.unsafeRequest??!1,body:t.body??null,client:t.client??null,reservedClient:t.reservedClient??null,replacesClientId:t.replacesClientId??"",window:t.window??"client",keepalive:t.keepalive??!1,serviceWorkers:t.serviceWorkers??"all",initiator:t.initiator??"",destination:t.destination??"",priority:t.priority??null,origin:t.origin??"client",policyContainer:t.policyContainer??"client",referrer:t.referrer??"client",referrerPolicy:t.referrerPolicy??"",mode:t.mode??"no-cors",useCORSPreflightFlag:t.useCORSPreflightFlag??!1,credentials:t.credentials??"same-origin",useCredentials:t.useCredentials??!1,cache:t.cache??"default",redirect:t.redirect??"follow",integrity:t.integrity??"",cryptoGraphicsNonceMetadata:t.cryptoGraphicsNonceMetadata??"",parserMetadata:t.parserMetadata??"",reloadNavigation:t.reloadNavigation??!1,historyNavigation:t.historyNavigation??!1,userActivation:t.userActivation??!1,taintedOrigin:t.taintedOrigin??!1,redirectCount:t.redirectCount??0,responseTainting:t.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:t.preventNoCacheCacheControlHeaderModification??!1,done:t.done??!1,timingAllowFailed:t.timingAllowFailed??!1,useURLCredentials:t.useURLCredentials??void 0,traversableForUserPrompts:t.traversableForUserPrompts??"client",urlList:t.urlList,url:t.urlList[0],headersList:t.headersList?new zg(t.headersList):new zg}}function QL(t){let e=e0({...t,body:null});return t.body!=null&&(e.body=Uie(t.body)),e}function SL(t,e,r,n){let s=new mn(Xg);aoe(s,t),ioe(s,e),noe(s,r);let i=new IL(Xg);return ooe(s,i),bL(i,t.headersList),iB(i,n),s}Object.defineProperties(mn.prototype,{method:fr,url:fr,headers:fr,redirect:fr,clone:fr,signal:fr,duplex:fr,destination:fr,body:fr,bodyUsed:fr,isHistoryNavigation:fr,isReloadNavigation:fr,keepalive:fr,integrity:fr,cache:fr,credentials:fr,attribute:fr,referrerPolicy:fr,referrer:fr,mode:fr,[Symbol.toStringTag]:{value:"Request",configurable:!0}});je.is.Request=je.util.MakeTypeAssertion(mn);je.converters.RequestInfo=function(t){return typeof t=="string"?je.converters.USVString(t):je.is.Request(t)?t:je.converters.USVString(t)};je.converters.RequestInit=je.dictionaryConverter([{key:"method",converter:je.converters.ByteString},{key:"headers",converter:je.converters.HeadersInit},{key:"body",converter:je.nullableConverter(je.converters.BodyInit)},{key:"referrer",converter:je.converters.USVString},{key:"referrerPolicy",converter:je.converters.DOMString,allowedValues:qie},{key:"mode",converter:je.converters.DOMString,allowedValues:Vie},{key:"credentials",converter:je.converters.DOMString,allowedValues:Jie},{key:"cache",converter:je.converters.DOMString,allowedValues:jie},{key:"redirect",converter:je.converters.DOMString,allowedValues:Wie},{key:"integrity",converter:je.converters.DOMString},{key:"keepalive",converter:je.converters.boolean},{key:"signal",converter:je.nullableConverter(t=>je.converters.AbortSignal(t,"RequestInit","signal"))},{key:"window",converter:je.converters.any},{key:"duplex",converter:je.converters.DOMString,allowedValues:$ie},{key:"dispatcher",converter:je.converters.any},{key:"priority",converter:je.converters.DOMString,allowedValues:["high","low","auto"],defaultValue:()=>"auto"}]);TL.exports={Request:mn,makeRequest:e0,fromInnerRequest:SL,cloneRequest:QL,getRequestDispatcher:soe,getRequestState:wL}});var LL=x((sSe,ML)=>{"use strict";var uoe=j("node:assert"),{runtimeFeatures:DL}=Ei(),La=new Map([["sha256",0],["sha384",1],["sha512",2]]),aB;if(DL.has("crypto")){aB=j("node:crypto");let t=aB.getHashes();t.length===0&&La.clear();for(let e of La.keys())t.includes(e)===!1&&La.delete(e)}else La.clear();var xL=Map.prototype.get.bind(La),uB=Map.prototype.has.bind(La),coe=DL.has("crypto")===!1||La.size===0?()=>!0:(t,e)=>{let r=NL(e);if(r.length===0)return!0;let n=RL(r);for(let s of n){let i=s.alg,o=s.val,a=vL(i,t);if(kL(a,o))return!0}return!1};function RL(t){let e=[],r=null;for(let n of t){if(uoe(uB(n.alg),"Invalid SRI hash algorithm token"),e.length===0){e.push(n),r=n;continue}let s=r.alg,i=xL(s),o=n.alg,a=xL(o);ai?(r=n,e[0]=n,e.length=1):e.push(n))}return e}function NL(t){let e=[];for(let r of t.split(" ")){let s=r.split("?",1)[0],i="",o=[s.slice(0,6),s.slice(7)],a=o[0];if(!uB(a))continue;o[1]&&(i=o[1]);let u={alg:a,val:i};e.push(u)}return e}var vL=(t,e)=>aB.hash(t,e,"base64");function kL(t,e){let r=t.length;r!==0&&t[r-1]==="="&&(r-=1),r!==0&&t[r-1]==="="&&(r-=1);let n=e.length;if(n!==0&&e[n-1]==="="&&(n-=1),n!==0&&e[n-1]==="="&&(n-=1),r!==n)return!1;for(let s=0;s{"use strict";var{makeNetworkError:Rt,makeAppropriateNetworkError:Ul,filterResponse:cB,makeResponse:t0,fromInnerResponse:Aoe,getResponseState:loe}=_l(),{HeadersList:AB}=ka(),{Request:foe,cloneRequest:doe,getRequestDispatcher:hoe,getRequestState:goe}=wc(),Qs=j("node:zlib"),{makePolicyContainer:poe,clonePolicyContainer:moe,requestBadPort:Eoe,TAOCheck:Coe,appendRequestOriginHeader:Ioe,responseLocationURL:boe,requestCurrentURL:Mn,setRequestReferrerPolicyOnRedirect:yoe,tryUpgradeRequestToAPotentiallyTrustworthyURL:Boe,createOpaqueTimingInfo:pB,appendFetchMetadata:woe,corsCheck:Qoe,crossOriginResourcePolicyCheck:Soe,determineRequestsReferrer:Toe,coarsenedSharedCurrentTime:Ol,sameOrigin:hB,isCancelled:Do,isAborted:FL,isErrorLike:xoe,fullyReadBody:Doe,readableStreamClose:Roe,urlIsLocal:Noe,urlIsHttpHttpsScheme:i0,urlHasHttpsScheme:voe,clampAndCoarsenConnectionTimingInfo:koe,simpleRangeHeaderValue:Moe,buildContentRange:Loe,createInflate:Foe,extractMimeType:_oe,hasAuthenticationEntry:Uoe,includesCredentials:_L,isTraversableNavigable:Ooe}=Sn(),Fa=j("node:assert"),{safelyExtractBody:o0,extractBody:UL}=Zu(),{redirectStatusSet:YL,nullBodyStatus:GL,safeMethodsSet:Poe,requestBodyHeader:Hoe,subresourceSet:Yoe}=jA(),Goe=j("node:events"),{Readable:qoe,pipeline:Woe,finished:Voe,isErrored:Joe,isReadable:r0}=j("node:stream"),{addAbortListener:joe,bufferToLowerCasedHeaderName:OL}=et(),{dataURLProcessor:$oe,serializeAMimeType:Koe,minimizeSupportedMimeType:zoe}=Xn(),{getGlobalDispatcher:Xoe}=Og(),{webidl:mB}=vr(),{STATUS_CODES:PL}=j("node:http"),{bytesMatch:Zoe}=LL(),{createDeferredPromise:eae}=ZA(),{isomorphicEncode:n0}=mi(),{runtimeFeatures:tae}=Ei(),rae=tae.has("zstd"),nae=["GET","HEAD"],sae=typeof __UNDICI_IS_NODE__<"u"||typeof esbuildDetection<"u"?"node":"undici",lB,s0=class extends Goe{constructor(e){super(),this.dispatcher=e,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(e){this.state==="ongoing"&&(this.state="terminated",this.connection?.destroy(e),this.emit("terminated",e))}abort(e){this.state==="ongoing"&&(this.state="aborted",e||(e=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=e,this.connection?.destroy(e),this.emit("terminated",e))}};function iae(t){qL(t,"fetch")}function oae(t,e=void 0){mB.argumentLengthCheck(arguments,1,"globalThis.fetch");let r=eae(),n;try{n=new foe(t,e)}catch(A){return r.reject(A),r.promise}let s=goe(n);if(n.signal.aborted)return fB(r,s,null,n.signal.reason,null),r.promise;s.client.globalObject?.constructor?.name==="ServiceWorkerGlobalScope"&&(s.serviceWorkers="none");let o=null,a=!1,u=null;return joe(n.signal,()=>{a=!0,Fa(u!=null),u.abort(n.signal.reason);let A=o?.deref();fB(r,s,A,n.signal.reason,u.controller)}),u=VL({request:s,processResponseEndOfBody:iae,processResponse:A=>{if(!a){if(A.aborted){fB(r,s,o,u.serializedAbortReason,u.controller);return}if(A.type==="error"){r.reject(new TypeError("fetch failed",{cause:A.error}));return}o=new WeakRef(Aoe(A,"immutable")),r.resolve(o.deref()),r=null}},dispatcher:hoe(n),requestObject:n}),r.promise}function qL(t,e="other"){if(t.type==="error"&&t.aborted||!t.urlList?.length)return;let r=t.urlList[0],n=t.timingInfo,s=t.cacheState;i0(r)&&n!==null&&(t.timingAllowPassed||(n=pB({startTime:n.startTime}),s=""),n.endTime=Ol(),t.timingInfo=n,WL(n,r.href,e,globalThis,s,"",t.status))}var WL=performance.markResourceTiming;function fB(t,e,r,n,s){if(t&&t.reject(n),e.body?.stream!=null&&r0(e.body.stream)&&e.body.stream.cancel(n).catch(o=>{if(o.code!=="ERR_INVALID_STATE")throw o}),r==null)return;let i=loe(r);i.body?.stream!=null&&r0(i.body.stream)&&s.error(n)}function VL({request:t,processRequestBodyChunkLength:e,processRequestEndOfBody:r,processResponse:n,processResponseEndOfBody:s,processResponseConsumeBody:i,useParallelQueue:o=!1,dispatcher:a=Xoe(),requestObject:u=null}){Fa(a);let c=null,A=!1;t.client!=null&&(c=t.client.globalObject,A=t.client.crossOriginIsolatedCapability);let f=Ol(A),l=pB({startTime:f}),h={controller:new s0(a),request:t,timingInfo:l,processRequestBodyChunkLength:e,processRequestEndOfBody:r,processResponse:n,processResponseConsumeBody:i,processResponseEndOfBody:s,taskDestination:c,crossOriginIsolatedCapability:A,requestObject:u};return Fa(!t.body||t.body.stream),t.window==="client"&&(t.window=t.client?.globalObject?.constructor?.name==="Window"?t.client:"no-window"),t.origin==="client"&&(t.origin=t.client.origin),t.policyContainer==="client"&&(t.client!=null?t.policyContainer=moe(t.client.policyContainer):t.policyContainer=poe()),t.headersList.contains("accept",!0)||t.headersList.append("accept","*/*",!0),t.headersList.contains("accept-language",!0)||t.headersList.append("accept-language","*",!0),t.priority,Yoe.has(t.destination),JL(h,!1),h.controller}async function JL(t,e){try{let r=t.request,n=null;if(r.localURLsOnly&&!Noe(Mn(r))&&(n=Rt("local URLs only")),Boe(r),Eoe(r)==="blocked"&&(n=Rt("bad port")),r.referrerPolicy===""&&(r.referrerPolicy=r.policyContainer.referrerPolicy),r.referrer!=="no-referrer"&&(r.referrer=Toe(r)),n===null){let i=Mn(r);hB(i,r.url)&&r.responseTainting==="basic"||i.protocol==="data:"||r.mode==="navigate"||r.mode==="websocket"?(r.responseTainting="basic",n=await HL(t)):r.mode==="same-origin"?n=Rt('request mode cannot be "same-origin"'):r.mode==="no-cors"?r.redirect!=="follow"?n=Rt('redirect mode cannot be "follow" for "no-cors" request'):(r.responseTainting="opaque",n=await HL(t)):i0(Mn(r))?(r.responseTainting="cors",n=await jL(t)):n=Rt("URL scheme must be a HTTP(S) scheme")}if(e)return n;n.status!==0&&!n.internalResponse&&(r.responseTainting,r.responseTainting==="basic"?n=cB(n,"basic"):r.responseTainting==="cors"?n=cB(n,"cors"):r.responseTainting==="opaque"?n=cB(n,"opaque"):Fa(!1));let s=n.status===0?n:n.internalResponse;if(s.urlList.length===0&&s.urlList.push(...r.urlList),r.timingAllowFailed||(n.timingAllowPassed=!0),n.type==="opaque"&&s.status===206&&s.rangeRequested&&!r.headers.contains("range",!0)&&(n=s=Rt()),n.status!==0&&(r.method==="HEAD"||r.method==="CONNECT"||GL.includes(s.status))&&(s.body=null,t.controller.dump=!0),r.integrity){let i=a=>dB(t,Rt(a));if(r.responseTainting==="opaque"||n.body==null){i(n.error);return}let o=a=>{if(!Zoe(a,r.integrity)){i("integrity mismatch");return}n.body=o0(a)[0],dB(t,n)};Doe(n.body,o,i)}else dB(t,n)}catch(r){t.controller.terminate(r)}}function HL(t){if(Do(t)&&t.request.redirectCount===0)return Promise.resolve(Ul(t));let{request:e}=t,{protocol:r}=Mn(e);switch(r){case"about:":return Promise.resolve(Rt("about scheme is not supported"));case"blob:":{lB||(lB=j("node:buffer").resolveObjectURL);let n=Mn(e);if(n.search.length!==0)return Promise.resolve(Rt("NetworkError when attempting to fetch resource."));let s=lB(n.toString());if(e.method!=="GET"||!mB.is.Blob(s))return Promise.resolve(Rt("invalid method"));let i=t0(),o=s.size,a=n0(`${o}`),u=s.type;if(e.headersList.contains("range",!0)){i.rangeRequested=!0;let c=e.headersList.get("range",!0),A=Moe(c,!0);if(A==="failure")return Promise.resolve(Rt("failed to fetch the data URL"));let{rangeStartValue:f,rangeEndValue:l}=A;if(f===null)f=o-l,l=f+l-1;else{if(f>=o)return Promise.resolve(Rt("Range start is greater than the blob's size."));(l===null||l>=o)&&(l=o-1)}let h=s.slice(f,l+1,u),g=UL(h);i.body=g[0];let p=n0(`${h.size}`),m=Loe(f,l,o);i.status=206,i.statusText="Partial Content",i.headersList.set("content-length",p,!0),i.headersList.set("content-type",u,!0),i.headersList.set("content-range",m,!0)}else{let c=UL(s);i.statusText="OK",i.body=c[0],i.headersList.set("content-length",a,!0),i.headersList.set("content-type",u,!0)}return Promise.resolve(i)}case"data:":{let n=Mn(e),s=$oe(n);if(s==="failure")return Promise.resolve(Rt("failed to fetch the data URL"));let i=Koe(s.mimeType);return Promise.resolve(t0({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:i}]],body:o0(s.body)[0]}))}case"file:":return Promise.resolve(Rt("not implemented... yet..."));case"http:":case"https:":return jL(t).catch(n=>Rt(n));default:return Promise.resolve(Rt("unknown scheme"))}}function aae(t,e){t.request.done=!0,t.processResponseDone!=null&&queueMicrotask(()=>t.processResponseDone(e))}function dB(t,e){let r=t.timingInfo,n=()=>{let i=Date.now();t.request.destination==="document"&&(t.controller.fullTimingInfo=r),t.controller.reportTimingSteps=()=>{if(!i0(t.request.url))return;r.endTime=i;let a=e.cacheState,u=e.bodyInfo;e.timingAllowPassed||(r=pB(r),a="");let c=0;if(t.request.mode!=="navigate"||!e.hasCrossOriginRedirects){c=e.status;let A=_oe(e.headersList);A!=="failure"&&(u.contentType=zoe(A))}t.request.initiatorType!=null&&WL(r,t.request.url.href,t.request.initiatorType,globalThis,a,u,c)};let o=()=>{t.request.done=!0,t.processResponseEndOfBody!=null&&queueMicrotask(()=>t.processResponseEndOfBody(e)),t.request.initiatorType!=null&&t.controller.reportTimingSteps()};queueMicrotask(()=>o())};t.processResponse!=null&&queueMicrotask(()=>{t.processResponse(e),t.processResponse=null});let s=e.type==="error"?e:e.internalResponse??e;s.body==null?n():Voe(s.body.stream,()=>{n()})}async function jL(t){let e=t.request,r=null,n=null,s=t.timingInfo;if(e.serviceWorkers,r===null){if(e.redirect==="follow"&&(e.serviceWorkers="none"),n=r=await gB(t),e.responseTainting==="cors"&&Qoe(e,r)==="failure")return Rt("cors failure");Coe(e,r)==="failure"&&(e.timingAllowFailed=!0)}return(e.responseTainting==="opaque"||r.type==="opaque")&&Soe(e.origin,e.client,e.destination,n)==="blocked"?Rt("blocked"):(YL.has(n.status)&&(e.redirect!=="manual"&&t.controller.connection.destroy(void 0,!1),e.redirect==="error"?r=Rt("unexpected redirect"):e.redirect==="manual"?r=n:e.redirect==="follow"?r=await uae(t,r):Fa(!1)),r.timingInfo=s,r)}function uae(t,e){let r=t.request,n=e.internalResponse?e.internalResponse:e,s;try{if(s=boe(n,Mn(r).hash),s==null)return e}catch(o){return Promise.resolve(Rt(o))}if(!i0(s))return Promise.resolve(Rt("URL scheme must be a HTTP(S) scheme"));if(r.redirectCount===20)return Promise.resolve(Rt("redirect count exceeded"));if(r.redirectCount+=1,r.mode==="cors"&&(s.username||s.password)&&!hB(r,s))return Promise.resolve(Rt('cross origin not allowed for request mode "cors"'));if(r.responseTainting==="cors"&&(s.username||s.password))return Promise.resolve(Rt('URL cannot contain credentials for request mode "cors"'));if(n.status!==303&&r.body!=null&&r.body.source==null)return Promise.resolve(Rt());if([301,302].includes(n.status)&&r.method==="POST"||n.status===303&&!nae.includes(r.method)){r.method="GET",r.body=null;for(let o of Hoe)r.headersList.delete(o)}hB(Mn(r),s)||(r.headersList.delete("authorization",!0),r.headersList.delete("proxy-authorization",!0),r.headersList.delete("cookie",!0),r.headersList.delete("host",!0)),r.body!=null&&(Fa(r.body.source!=null),r.body=o0(r.body.source)[0]);let i=t.timingInfo;return i.redirectEndTime=i.postRedirectStartTime=Ol(t.crossOriginIsolatedCapability),i.redirectStartTime===0&&(i.redirectStartTime=i.startTime),r.urlList.push(s),yoe(r,n),JL(t,!0)}async function gB(t,e=!1,r=!1){let n=t.request,s=null,i=null,o=null,a=null,u=!1;n.window==="no-window"&&n.redirect==="error"?(s=t,i=n):(i=doe(n),s={...t},s.request=i);let c=n.credentials==="include"||n.credentials==="same-origin"&&n.responseTainting==="basic",A=i.body?i.body.length:null,f=null;if(i.body==null&&["POST","PUT"].includes(i.method)&&(f="0"),A!=null&&(f=n0(`${A}`)),f!=null&&!i.headersList.contains("content-length",!0)&&i.headersList.append("content-length",f,!0),A!=null&&i.keepalive,mB.is.URL(i.referrer)&&i.headersList.append("referer",n0(i.referrer.href),!0),Ioe(i),woe(i),i.headersList.contains("user-agent",!0)||i.headersList.append("user-agent",sae,!0),i.cache==="default"&&(i.headersList.contains("if-modified-since",!0)||i.headersList.contains("if-none-match",!0)||i.headersList.contains("if-unmodified-since",!0)||i.headersList.contains("if-match",!0)||i.headersList.contains("if-range",!0))&&(i.cache="no-store"),i.cache==="no-cache"&&!i.preventNoCacheCacheControlHeaderModification&&!i.headersList.contains("cache-control",!0)&&i.headersList.append("cache-control","max-age=0",!0),(i.cache==="no-store"||i.cache==="reload")&&(i.headersList.contains("pragma",!0)||i.headersList.append("pragma","no-cache",!0),i.headersList.contains("cache-control",!0)||i.headersList.append("cache-control","no-cache",!0)),i.headersList.contains("range",!0)&&i.headersList.append("accept-encoding","identity",!0),i.headersList.contains("accept-encoding",!0)||(voe(Mn(i))?i.headersList.append("accept-encoding","br, gzip, deflate",!0):i.headersList.append("accept-encoding","gzip, deflate",!0)),i.headersList.delete("host",!0),c&&!i.headersList.contains("authorization",!0)){let l=null;if(!(Uoe(i)&&(i.useURLCredentials===void 0||!_L(Mn(i))))){if(_L(Mn(i))&&e){let{username:h,password:g}=Mn(i);l=`Basic ${Buffer.from(`${h}:${g}`).toString("base64")}`}}l!==null&&i.headersList.append("Authorization",l,!1)}if(a==null&&(i.cache="no-store"),i.cache!=="no-store"&&i.cache,o==null){if(i.cache==="only-if-cached")return Rt("only if cached");let l=await cae(s,c,r);!Poe.has(i.method)&&l.status>=200&&l.status<=399,u&&l.status,o==null&&(o=l)}if(o.urlList=[...i.urlList],i.headersList.contains("range",!0)&&(o.rangeRequested=!0),o.requestIncludesCredentials=c,o.status===401&&i.responseTainting!=="cors"&&c&&(n.useURLCredentials!==void 0||Ooe(n.traversableForUserPrompts))){if(n.body!=null){if(n.body.source==null)return o;n.body=o0(n.body.source)[0]}if(n.useURLCredentials===void 0||e)return Do(t)?Ul(t):o;t.controller.connection.destroy(),o=await gB(t,!0)}if(o.status===407)return n.window==="no-window"?Rt():Do(t)?Ul(t):Rt("proxy authentication required");if(o.status===421&&!r&&(n.body==null||n.body.source!=null)){if(Do(t))return Ul(t);t.controller.connection.destroy(),o=await gB(t,e,!0)}return o}async function cae(t,e=!1,r=!1){Fa(!t.controller.connection||t.controller.connection.destroyed),t.controller.connection={abort:null,destroyed:!1,destroy(g,p=!0){this.destroyed||(this.destroyed=!0,p&&this.abort?.(g??new DOMException("The operation was aborted.","AbortError")))}};let n=t.request,s=null,i=t.timingInfo;null==null&&(n.cache="no-store");let a=r?"yes":"no";n.mode;let u=null;if(n.body==null&&t.processRequestEndOfBody)queueMicrotask(()=>t.processRequestEndOfBody());else if(n.body!=null){let g=async function*(E){Do(t)||(yield E,t.processRequestBodyChunkLength?.(E.byteLength))},p=()=>{Do(t)||t.processRequestEndOfBody&&t.processRequestEndOfBody()},m=E=>{Do(t)||(E.name==="AbortError"?t.controller.abort():t.controller.terminate(E))};u=(async function*(){try{for await(let E of n.body.stream)yield*g(E);p()}catch(E){m(E)}})()}try{let{body:g,status:p,statusText:m,headersList:E,socket:C}=await h({body:u});if(C)s=t0({status:p,statusText:m,headersList:E,socket:C});else{let b=g[Symbol.asyncIterator]();t.controller.next=()=>b.next(),s=t0({status:p,statusText:m,headersList:E})}}catch(g){return g.name==="AbortError"?(t.controller.connection.destroy(),Ul(t,g)):Rt(g)}let c=()=>t.controller.resume(),A=g=>{Do(t)||t.controller.abort(g)},f=new ReadableStream({start(g){t.controller.controller=g},pull:c,cancel:A,type:"bytes"});s.body={stream:f,source:null,length:null},t.controller.resume||t.controller.on("terminated",l),t.controller.resume=async()=>{for(;;){let g,p;try{let{done:E,value:C}=await t.controller.next();if(FL(t))break;g=E?void 0:C}catch(E){t.controller.ended&&!i.encodedBodySize?g=void 0:(g=E,p=!0)}if(g===void 0){Roe(t.controller.controller),aae(t,s);return}if(i.decodedBodySize+=g?.byteLength??0,p){t.controller.terminate(g);return}let m=new Uint8Array(g);if(m.byteLength&&t.controller.controller.enqueue(m),Joe(f)){t.controller.terminate();return}if(t.controller.controller.desiredSize<=0)return}};function l(g){FL(t)?(s.aborted=!0,r0(f)&&t.controller.controller.error(t.controller.serializedAbortReason)):r0(f)&&t.controller.controller.error(new TypeError("terminated",{cause:xoe(g)?g:void 0})),t.controller.connection.destroy()}return s;function h({body:g}){let p=Mn(n),m=t.controller.dispatcher,E=p.pathname+p.search,C=p.search.length===0&&p.href[p.href.length-p.hash.length-1]==="?";return new Promise((b,B)=>m.dispatch({path:C?`${E}?`:E,origin:p.origin,method:n.method,body:m.isMockActive?n.body&&(n.body.source||n.body.stream):g,headers:n.headersList.entries,maxRedirections:0,upgrade:n.mode==="websocket"?"websocket":void 0},{body:null,abort:null,onConnect(R){let{connection:M}=t.controller;i.finalConnectionTimingInfo=koe(void 0,i.postRedirectStartTime,t.crossOriginIsolatedCapability),M.destroyed?R(new DOMException("The operation was aborted.","AbortError")):(t.controller.on("terminated",R),this.abort=M.abort=R),i.finalNetworkRequestStartTime=Ol(t.crossOriginIsolatedCapability)},onResponseStarted(){i.finalNetworkResponseStartTime=Ol(t.crossOriginIsolatedCapability)},onHeaders(R,M,k,v){if(R<200)return!1;let N=new AB;for(let w=0;wJ)return B(new Error(`too many content-encodings in response: ${_.length}, maximum allowed is ${J}`)),!0;for(let ae=_.length-1;ae>=0;--ae){let Be=_[ae].trim();if(Be==="x-gzip"||Be==="gzip")Q.push(Qs.createGunzip({flush:Qs.constants.Z_SYNC_FLUSH,finishFlush:Qs.constants.Z_SYNC_FLUSH}));else if(Be==="deflate")Q.push(Foe({flush:Qs.constants.Z_SYNC_FLUSH,finishFlush:Qs.constants.Z_SYNC_FLUSH}));else if(Be==="br")Q.push(Qs.createBrotliDecompress({flush:Qs.constants.BROTLI_OPERATION_FLUSH,finishFlush:Qs.constants.BROTLI_OPERATION_FLUSH}));else if(Be==="zstd"&&rae)Q.push(Qs.createZstdDecompress({flush:Qs.constants.ZSTD_e_continue,finishFlush:Qs.constants.ZSTD_e_end}));else{Q.length=0;break}}}let y=this.onError.bind(this);return b({status:R,statusText:v,headersList:N,body:Q.length?Woe(this.body,...Q,w=>{w&&this.onError(w)}).on("error",y):this.body.on("error",y)}),!0},onData(R){if(t.controller.dump)return;let M=R;return i.encodedBodySize+=M.byteLength,this.body.push(M)},onComplete(){this.abort&&t.controller.off("terminated",this.abort),t.controller.ended=!0,this.body.push(null)},onError(R){this.abort&&t.controller.off("terminated",this.abort),this.body?.destroy(R),t.controller.terminate(R),B(R)},onRequestUpgrade(R,M,k,v){if(v.session!=null&&M!==200||v.session==null&&M!==101)return!1;let N=new AB;for(let[q,Y]of Object.entries(k)){if(Y==null)continue;let Q=q.toLowerCase();if(Array.isArray(Y))for(let y of Y)N.append(Q,String(y),!0);else N.append(Q,String(Y),!0)}return b({status:M,statusText:PL[M],headersList:N,socket:v}),!0},onUpgrade(R,M,k){if(k.session!=null&&R!==200||k.session==null&&R!==101)return!1;let v=new AB;for(let N=0;N{"use strict";var Aae=j("node:assert"),{URLSerializer:KL}=Xn(),{isValidHeaderName:lae}=Sn();function fae(t,e,r=!1){let n=KL(t,r),s=KL(e,r);return n===s}function dae(t){Aae(t!==null);let e=[];for(let r of t.split(","))r=r.trim(),lae(r)&&e.push(r);return e}zL.exports={urlEquals:fae,getFieldValues:dae}});var r6=x((aSe,t6)=>{"use strict";var EB=j("node:assert"),{kConstruct:hae}=xt(),{urlEquals:gae,getFieldValues:CB}=XL(),{kEnumerableProperty:_a,isDisturbed:pae}=et(),{webidl:Ue}=vr(),{cloneResponse:ZL,fromInnerResponse:mae,getResponseState:Eae}=_l(),{Request:Hl,fromInnerRequest:Cae,getRequestState:zs}=wc(),{fetching:Iae}=Pl(),{urlIsHttpHttpsScheme:a0,readAllBytes:bae}=Sn(),{createDeferredPromise:Qc}=ZA(),u0=class t{#e;constructor(){arguments[0]!==hae&&Ue.illegalConstructor(),Ue.util.markAsUncloneable(this),this.#e=arguments[1]}async match(e,r={}){Ue.brandCheck(this,t);let n="Cache.match";Ue.argumentLengthCheck(arguments,1,n),e=Ue.converters.RequestInfo(e),r=Ue.converters.CacheQueryOptions(r,n,"options");let s=this.#i(e,r,1);if(s.length!==0)return s[0]}async matchAll(e=void 0,r={}){Ue.brandCheck(this,t);let n="Cache.matchAll";return e!==void 0&&(e=Ue.converters.RequestInfo(e)),r=Ue.converters.CacheQueryOptions(r,n,"options"),this.#i(e,r)}async add(e){Ue.brandCheck(this,t),Ue.argumentLengthCheck(arguments,1,"Cache.add"),e=Ue.converters.RequestInfo(e);let n=[e];return await this.addAll(n)}async addAll(e){Ue.brandCheck(this,t);let r="Cache.addAll";Ue.argumentLengthCheck(arguments,1,r);let n=[],s=[];for(let l of e){if(l===void 0)throw Ue.errors.conversionFailed({prefix:r,argument:"Argument 1",types:["undefined is not allowed"]});if(l=Ue.converters.RequestInfo(l),typeof l=="string")continue;let h=zs(l);if(!a0(h.url)||h.method!=="GET")throw Ue.errors.exception({header:r,message:"Expected http/s scheme when method is not GET."})}let i=[];for(let l of e){let h=zs(new Hl(l));if(!a0(h.url))throw Ue.errors.exception({header:r,message:"Expected http/s scheme."});h.initiator="fetch",h.destination="subresource",s.push(h);let g=Qc();i.push(Iae({request:h,processResponse(p){if(p.type==="error"||p.status===206||p.status<200||p.status>299)g.reject(Ue.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(p.headersList.contains("vary")){let m=CB(p.headersList.get("vary"));for(let E of m)if(E==="*"){g.reject(Ue.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(let C of i)C.abort();return}}},processResponseEndOfBody(p){if(p.aborted){g.reject(new DOMException("aborted","AbortError"));return}g.resolve(p)}})),n.push(g.promise)}let a=await Promise.all(n),u=[],c=0;for(let l of a){let h={type:"put",request:s[c],response:l};u.push(h),c++}let A=Qc(),f=null;try{this.#t(u)}catch(l){f=l}return queueMicrotask(()=>{f===null?A.resolve(void 0):A.reject(f)}),A.promise}async put(e,r){Ue.brandCheck(this,t);let n="Cache.put";Ue.argumentLengthCheck(arguments,2,n),e=Ue.converters.RequestInfo(e),r=Ue.converters.Response(r,n,"response");let s=null;if(Ue.is.Request(e)?s=zs(e):s=zs(new Hl(e)),!a0(s.url)||s.method!=="GET")throw Ue.errors.exception({header:n,message:"Expected an http/s scheme when method is not GET"});let i=Eae(r);if(i.status===206)throw Ue.errors.exception({header:n,message:"Got 206 status"});if(i.headersList.contains("vary")){let h=CB(i.headersList.get("vary"));for(let g of h)if(g==="*")throw Ue.errors.exception({header:n,message:"Got * vary field value"})}if(i.body&&(pae(i.body.stream)||i.body.stream.locked))throw Ue.errors.exception({header:n,message:"Response body is locked or disturbed"});let o=ZL(i),a=Qc();if(i.body!=null){let g=i.body.stream.getReader();bae(g,a.resolve,a.reject)}else a.resolve(void 0);let u=[],c={type:"put",request:s,response:o};u.push(c);let A=await a.promise;o.body!=null&&(o.body.source=A);let f=Qc(),l=null;try{this.#t(u)}catch(h){l=h}return queueMicrotask(()=>{l===null?f.resolve():f.reject(l)}),f.promise}async delete(e,r={}){Ue.brandCheck(this,t);let n="Cache.delete";Ue.argumentLengthCheck(arguments,1,n),e=Ue.converters.RequestInfo(e),r=Ue.converters.CacheQueryOptions(r,n,"options");let s=null;if(Ue.is.Request(e)){if(s=zs(e),s.method!=="GET"&&!r.ignoreMethod)return!1}else EB(typeof e=="string"),s=zs(new Hl(e));let i=[],o={type:"delete",request:s,options:r};i.push(o);let a=Qc(),u=null,c;try{c=this.#t(i)}catch(A){u=A}return queueMicrotask(()=>{u===null?a.resolve(!!c?.length):a.reject(u)}),a.promise}async keys(e=void 0,r={}){Ue.brandCheck(this,t);let n="Cache.keys";e!==void 0&&(e=Ue.converters.RequestInfo(e)),r=Ue.converters.CacheQueryOptions(r,n,"options");let s=null;if(e!==void 0)if(Ue.is.Request(e)){if(s=zs(e),s.method!=="GET"&&!r.ignoreMethod)return[]}else typeof e=="string"&&(s=zs(new Hl(e)));let i=Qc(),o=[];if(e===void 0)for(let a of this.#e)o.push(a[0]);else{let a=this.#r(s,r);for(let u of a)o.push(u[0])}return queueMicrotask(()=>{let a=[];for(let u of o){let c=Cae(u,void 0,new AbortController().signal,"immutable");a.push(c)}i.resolve(Object.freeze(a))}),i.promise}#t(e){let r=this.#e,n=[...r],s=[],i=[];try{for(let o of e){if(o.type!=="delete"&&o.type!=="put")throw Ue.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if(o.type==="delete"&&o.response!=null)throw Ue.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#r(o.request,o.options,s).length)throw new DOMException("???","InvalidStateError");let a;if(o.type==="delete"){if(a=this.#r(o.request,o.options),a.length===0)return[];for(let u of a){let c=r.indexOf(u);EB(c!==-1),r.splice(c,1)}}else if(o.type==="put"){if(o.response==null)throw Ue.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let u=o.request;if(!a0(u.url))throw Ue.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if(u.method!=="GET")throw Ue.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(o.options!=null)throw Ue.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});a=this.#r(o.request);for(let c of a){let A=r.indexOf(c);EB(A!==-1),r.splice(A,1)}r.push([o.request,o.response]),s.push([o.request,o.response])}i.push([o.request,o.response])}return i}catch(o){throw this.#e.length=0,this.#e=n,o}}#r(e,r,n){let s=[],i=n??this.#e;for(let o of i){let[a,u]=o;this.#n(e,a,u,r)&&s.push(o)}return s}#n(e,r,n=null,s){let i=new URL(e.url),o=new URL(r.url);if(s?.ignoreSearch&&(o.search="",i.search=""),!gae(i,o,!0))return!1;if(n==null||s?.ignoreVary||!n.headersList.contains("vary"))return!0;let a=CB(n.headersList.get("vary"));for(let u of a){if(u==="*")return!1;let c=r.headersList.get(u),A=e.headersList.get(u);if(c!==A)return!1}return!0}#i(e,r,n=1/0){let s=null;if(e!==void 0)if(Ue.is.Request(e)){if(s=zs(e),s.method!=="GET"&&!r.ignoreMethod)return[]}else typeof e=="string"&&(s=zs(new Hl(e)));let i=[];if(e===void 0)for(let a of this.#e)i.push(a[1]);else{let a=this.#r(s,r);for(let u of a)i.push(u[1])}let o=[];for(let a of i){let u=mae(ZL(a),"immutable");if(o.push(u),o.length>=n)break}return Object.freeze(o)}};Object.defineProperties(u0.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:_a,matchAll:_a,add:_a,addAll:_a,put:_a,delete:_a,keys:_a});var e6=[{key:"ignoreSearch",converter:Ue.converters.boolean,defaultValue:()=>!1},{key:"ignoreMethod",converter:Ue.converters.boolean,defaultValue:()=>!1},{key:"ignoreVary",converter:Ue.converters.boolean,defaultValue:()=>!1}];Ue.converters.CacheQueryOptions=Ue.dictionaryConverter(e6);Ue.converters.MultiCacheQueryOptions=Ue.dictionaryConverter([...e6,{key:"cacheName",converter:Ue.converters.DOMString}]);Ue.converters.Response=Ue.interfaceConverter(Ue.is.Response,"Response");Ue.converters["sequence"]=Ue.sequenceConverter(Ue.converters.RequestInfo);t6.exports={Cache:u0}});var s6=x((uSe,n6)=>{"use strict";var{Cache:c0}=r6(),{webidl:Gr}=vr(),{kEnumerableProperty:Yl}=et(),{kConstruct:Gl}=xt(),A0=class t{#e=new Map;constructor(){arguments[0]!==Gl&&Gr.illegalConstructor(),Gr.util.markAsUncloneable(this)}async match(e,r={}){if(Gr.brandCheck(this,t),Gr.argumentLengthCheck(arguments,1,"CacheStorage.match"),e=Gr.converters.RequestInfo(e),r=Gr.converters.MultiCacheQueryOptions(r),r.cacheName!=null){if(this.#e.has(r.cacheName)){let n=this.#e.get(r.cacheName);return await new c0(Gl,n).match(e,r)}}else for(let n of this.#e.values()){let i=await new c0(Gl,n).match(e,r);if(i!==void 0)return i}}async has(e){Gr.brandCheck(this,t);let r="CacheStorage.has";return Gr.argumentLengthCheck(arguments,1,r),e=Gr.converters.DOMString(e,r,"cacheName"),this.#e.has(e)}async open(e){Gr.brandCheck(this,t);let r="CacheStorage.open";if(Gr.argumentLengthCheck(arguments,1,r),e=Gr.converters.DOMString(e,r,"cacheName"),this.#e.has(e)){let s=this.#e.get(e);return new c0(Gl,s)}let n=[];return this.#e.set(e,n),new c0(Gl,n)}async delete(e){Gr.brandCheck(this,t);let r="CacheStorage.delete";return Gr.argumentLengthCheck(arguments,1,r),e=Gr.converters.DOMString(e,r,"cacheName"),this.#e.delete(e)}async keys(){return Gr.brandCheck(this,t),[...this.#e.keys()]}};Object.defineProperties(A0.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:Yl,has:Yl,open:Yl,delete:Yl,keys:Yl});n6.exports={CacheStorage:A0}});var o6=x((cSe,i6)=>{"use strict";i6.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}});var yB=x((ASe,A6)=>{"use strict";function yae(t){for(let e=0;e=0&&r<=8||r>=10&&r<=31||r===127)return!0}return!1}function IB(t){for(let e=0;e126||r===34||r===40||r===41||r===60||r===62||r===64||r===44||r===59||r===58||r===92||r===47||r===91||r===93||r===63||r===61||r===123||r===125)throw new Error("Invalid cookie name")}}function bB(t){let e=t.length,r=0;if(t[0]==='"'){if(e===1||t[e-1]!=='"')throw new Error("Invalid cookie value");--e,++r}for(;r126||n===34||n===44||n===59||n===92)throw new Error("Invalid cookie value")}}function u6(t){for(let e=0;e126||r===59)throw new Error("Invalid cookie path")}}function a6(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}function Bae(t){if(t===" ")return;if(t.length>255)throw new Error("Invalid cookie domain");let e=0;for(let r=0;r63)throw new Error("Invalid cookie domain")}if(e===0||t.charCodeAt(t.length-1)===45)throw new Error("Invalid cookie domain")}var wae=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Qae=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],l0=Array(61).fill(0).map((t,e)=>e.toString().padStart(2,"0"));function c6(t){return typeof t=="number"&&(t=new Date(t)),`${wae[t.getUTCDay()]}, ${l0[t.getUTCDate()]} ${Qae[t.getUTCMonth()]} ${t.getUTCFullYear()} ${l0[t.getUTCHours()]}:${l0[t.getUTCMinutes()]}:${l0[t.getUTCSeconds()]} GMT`}function Sae(t){if(t<0)throw new Error("Invalid cookie max-age")}function Tae(t){if(t.name.length===0)return null;IB(t.name),bB(t.value);let e=[`${t.name}=${t.value}`];t.name.startsWith("__Secure-")&&(t.secure=!0),t.name.startsWith("__Host-")&&(t.secure=!0,t.domain=null,t.path="/"),t.secure&&e.push("Secure"),t.httpOnly&&e.push("HttpOnly"),typeof t.maxAge=="number"&&(Sae(t.maxAge),e.push(`Max-Age=${t.maxAge}`)),t.domain&&(Bae(t.domain),e.push(`Domain=${t.domain}`)),t.path&&(u6(t.path),e.push(`Path=${t.path}`)),t.expires&&t.expires.toString()!=="Invalid Date"&&e.push(`Expires=${c6(t.expires)}`),t.sameSite&&e.push(`SameSite=${t.sameSite}`);for(let r of t.unparsed){if(!r.includes("="))throw new Error("Invalid unparsed");let[n,...s]=r.split("="),i=n.trim(),o=s.join("=");IB(i),bB(o),e.push(`${i}=${o}`)}return e.join("; ")}A6.exports={isCTLExcludingHtab:yae,validateCookieName:IB,validateCookiePath:u6,validateCookieValue:bB,toIMFDate:c6,stringify:Tae}});var f6=x((lSe,l6)=>{"use strict";var{collectASequenceOfCodePointsFast:f0}=mi(),{maxNameValuePairSize:xae,maxAttributeValueSize:Dae}=o6(),{isCTLExcludingHtab:Rae}=yB(),Nae=j("node:assert");function vae(t){if(Rae(t))return null;let e="",r="",n="",s="";if(t.includes(";")){let i={position:0};e=f0(";",t,i),r=t.slice(i.position)}else e=t;if(!e.includes("="))s=e;else{let i={position:0};n=f0("=",e,i),s=e.slice(i.position+1)}return n=n.trim(),s=s.trim(),n.length+s.length>xae?null:{name:n,value:s,...Sc(r)}}function Sc(t,e={}){if(t.length===0)return e;Nae(t[0]===";"),t=t.slice(1);let r="";t.includes(";")?(r=f0(";",t,{position:0}),t=t.slice(r.length)):(r=t,t="");let n="",s="";if(r.includes("=")){let o={position:0};n=f0("=",r,o),s=r.slice(o.position+1)}else n=r;if(n=n.trim(),s=s.trim(),s.length>Dae)return Sc(t,e);let i=n.toLowerCase();if(i==="expires"){let o=new Date(s);e.expires=o}else if(i==="max-age"){let o=s.charCodeAt(0);if((o<48||o>57)&&s[0]!=="-"||!/^\d+$/.test(s))return Sc(t,e);let a=Number(s);e.maxAge=a}else if(i==="domain"){let o=s;o[0]==="."&&(o=o.slice(1)),o=o.toLowerCase(),e.domain=o}else if(i==="path"){let o="";s.length===0||s[0]!=="/"?o="/":o=s,e.path=o}else if(i==="secure")e.secure=!0;else if(i==="httponly")e.httpOnly=!0;else if(i==="samesite"){let o=s.toLowerCase();o==="none"?e.sameSite="None":o==="strict"?e.sameSite="Strict":o==="lax"&&(e.sameSite="Lax")}else e.unparsed??=[],e.unparsed.push(`${n}=${s}`);return Sc(t,e)}l6.exports={parseSetCookie:vae,parseUnparsedAttributes:Sc}});var p6=x((fSe,g6)=>{"use strict";var{parseSetCookie:d6}=f6(),{stringify:kae}=yB(),{webidl:pt}=vr(),{Headers:Mae}=ka(),d0=pt.brandCheckMultiple([Mae,globalThis.Headers].filter(Boolean));function Lae(t){pt.argumentLengthCheck(arguments,1,"getCookies"),d0(t);let e=t.get("cookie"),r={};if(!e)return r;for(let n of e.split(";")){let[s,...i]=n.split("=");r[s.trim()]=i.join("=")}return r}function Fae(t,e,r){d0(t);let n="deleteCookie";pt.argumentLengthCheck(arguments,2,n),e=pt.converters.DOMString(e,n,"name"),r=pt.converters.DeleteCookieAttributes(r),h6(t,{name:e,value:"",expires:new Date(0),...r})}function _ae(t){pt.argumentLengthCheck(arguments,1,"getSetCookies"),d0(t);let e=t.getSetCookie();return e?e.map(r=>d6(r)):[]}function Uae(t){return t=pt.converters.DOMString(t),d6(t)}function h6(t,e){pt.argumentLengthCheck(arguments,2,"setCookie"),d0(t),e=pt.converters.Cookie(e);let r=kae(e);r&&t.append("set-cookie",r,!0)}pt.converters.DeleteCookieAttributes=pt.dictionaryConverter([{converter:pt.nullableConverter(pt.converters.DOMString),key:"path",defaultValue:()=>null},{converter:pt.nullableConverter(pt.converters.DOMString),key:"domain",defaultValue:()=>null}]);pt.converters.Cookie=pt.dictionaryConverter([{converter:pt.converters.DOMString,key:"name"},{converter:pt.converters.DOMString,key:"value"},{converter:pt.nullableConverter(t=>typeof t=="number"?pt.converters["unsigned long long"](t):new Date(t)),key:"expires",defaultValue:()=>null},{converter:pt.nullableConverter(pt.converters["long long"]),key:"maxAge",defaultValue:()=>null},{converter:pt.nullableConverter(pt.converters.DOMString),key:"domain",defaultValue:()=>null},{converter:pt.nullableConverter(pt.converters.DOMString),key:"path",defaultValue:()=>null},{converter:pt.nullableConverter(pt.converters.boolean),key:"secure",defaultValue:()=>null},{converter:pt.nullableConverter(pt.converters.boolean),key:"httpOnly",defaultValue:()=>null},{converter:pt.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:pt.sequenceConverter(pt.converters.DOMString),key:"unparsed",defaultValue:()=>[]}]);g6.exports={getCookies:Lae,deleteCookie:Fae,getSetCookies:_ae,setCookie:h6,parseCookie:Uae}});var p0=x((dSe,E6)=>{"use strict";var{webidl:He}=vr(),{kEnumerableProperty:En}=et(),{kConstruct:m6}=xt(),Tc=class t extends Event{#e;constructor(e,r={}){if(e===m6){super(arguments[1],arguments[2]),He.util.markAsUncloneable(this);return}let n="MessageEvent constructor";He.argumentLengthCheck(arguments,1,n),e=He.converters.DOMString(e,n,"type"),r=He.converters.MessageEventInit(r,n,"eventInitDict"),super(e,r),this.#e=r,He.util.markAsUncloneable(this)}get data(){return He.brandCheck(this,t),this.#e.data}get origin(){return He.brandCheck(this,t),this.#e.origin}get lastEventId(){return He.brandCheck(this,t),this.#e.lastEventId}get source(){return He.brandCheck(this,t),this.#e.source}get ports(){return He.brandCheck(this,t),Object.isFrozen(this.#e.ports)||Object.freeze(this.#e.ports),this.#e.ports}initMessageEvent(e,r=!1,n=!1,s=null,i="",o="",a=null,u=[]){return He.brandCheck(this,t),He.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new t(e,{bubbles:r,cancelable:n,data:s,origin:i,lastEventId:o,source:a,ports:u})}static createFastMessageEvent(e,r){let n=new t(m6,e,r);return n.#e=r,n.#e.data??=null,n.#e.origin??="",n.#e.lastEventId??="",n.#e.source??=null,n.#e.ports??=[],n}},{createFastMessageEvent:Oae}=Tc;delete Tc.createFastMessageEvent;var h0=class t extends Event{#e;constructor(e,r={}){let n="CloseEvent constructor";He.argumentLengthCheck(arguments,1,n),e=He.converters.DOMString(e,n,"type"),r=He.converters.CloseEventInit(r),super(e,r),this.#e=r,He.util.markAsUncloneable(this)}get wasClean(){return He.brandCheck(this,t),this.#e.wasClean}get code(){return He.brandCheck(this,t),this.#e.code}get reason(){return He.brandCheck(this,t),this.#e.reason}},g0=class t extends Event{#e;constructor(e,r){let n="ErrorEvent constructor";He.argumentLengthCheck(arguments,1,n),super(e,r),He.util.markAsUncloneable(this),e=He.converters.DOMString(e,n,"type"),r=He.converters.ErrorEventInit(r??{}),this.#e=r}get message(){return He.brandCheck(this,t),this.#e.message}get filename(){return He.brandCheck(this,t),this.#e.filename}get lineno(){return He.brandCheck(this,t),this.#e.lineno}get colno(){return He.brandCheck(this,t),this.#e.colno}get error(){return He.brandCheck(this,t),this.#e.error}};Object.defineProperties(Tc.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:En,origin:En,lastEventId:En,source:En,ports:En,initMessageEvent:En});Object.defineProperties(h0.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:En,code:En,wasClean:En});Object.defineProperties(g0.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:En,filename:En,lineno:En,colno:En,error:En});He.converters.MessagePort=He.interfaceConverter(He.is.MessagePort,"MessagePort");He.converters["sequence"]=He.sequenceConverter(He.converters.MessagePort);var BB=[{key:"bubbles",converter:He.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:He.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:He.converters.boolean,defaultValue:()=>!1}];He.converters.MessageEventInit=He.dictionaryConverter([...BB,{key:"data",converter:He.converters.any,defaultValue:()=>null},{key:"origin",converter:He.converters.USVString,defaultValue:()=>""},{key:"lastEventId",converter:He.converters.DOMString,defaultValue:()=>""},{key:"source",converter:He.nullableConverter(He.converters.MessagePort),defaultValue:()=>null},{key:"ports",converter:He.converters["sequence"],defaultValue:()=>[]}]);He.converters.CloseEventInit=He.dictionaryConverter([...BB,{key:"wasClean",converter:He.converters.boolean,defaultValue:()=>!1},{key:"code",converter:He.converters["unsigned short"],defaultValue:()=>0},{key:"reason",converter:He.converters.USVString,defaultValue:()=>""}]);He.converters.ErrorEventInit=He.dictionaryConverter([...BB,{key:"message",converter:He.converters.DOMString,defaultValue:()=>""},{key:"filename",converter:He.converters.USVString,defaultValue:()=>""},{key:"lineno",converter:He.converters["unsigned long"],defaultValue:()=>0},{key:"colno",converter:He.converters["unsigned long"],defaultValue:()=>0},{key:"error",converter:He.converters.any}]);E6.exports={MessageEvent:Tc,CloseEvent:h0,ErrorEvent:g0,createFastMessageEvent:Oae}});var Ro=x((hSe,C6)=>{"use strict";var Pae="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",Hae={enumerable:!0,writable:!1,configurable:!1},Yae={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},Gae={SENT:1,RECEIVED:2},qae={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},Wae=65535,Vae={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},Jae=Buffer.allocUnsafe(0),jae={text:1,typedArray:2,arrayBuffer:3,blob:4};C6.exports={uid:Pae,sentCloseFrameState:Gae,staticPropertyDescriptors:Hae,states:Yae,opcodes:qae,maxUnsigned16Bit:Wae,parserStates:Vae,emptyBuffer:Jae,sendHints:jae}});var Ua=x((gSe,w6)=>{"use strict";var{states:m0,opcodes:xc}=Ro(),{isUtf8:$ae}=j("node:buffer"),{removeHTTPWhitespace:I6}=Xn(),{collectASequenceOfCodePointsFast:Kae}=mi();function zae(t){return t===m0.CONNECTING}function Xae(t){return t===m0.OPEN}function Zae(t){return t===m0.CLOSING}function eue(t){return t===m0.CLOSED}function tue(t,e,r=(s,i)=>new Event(s,i),n={}){let s=r(t,n);e.dispatchEvent(s)}function rue(t,e,r){t.onMessage(e,r)}function nue(t){return t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer}function sue(t){if(t.length===0)return!1;for(let e=0;e126||r===34||r===40||r===41||r===44||r===47||r===58||r===59||r===60||r===61||r===62||r===63||r===64||r===91||r===92||r===93||r===123||r===125)return!1}return!0}function iue(t){return t>=1e3&&t<1015?t!==1004&&t!==1005&&t!==1006:t>=3e3&&t<=4999}function b6(t){return t===xc.CLOSE||t===xc.PING||t===xc.PONG}function y6(t){return t===xc.CONTINUATION}function B6(t){return t===xc.TEXT||t===xc.BINARY}function oue(t){return B6(t)||y6(t)||b6(t)}function aue(t){let e={position:0},r=new Map;for(;e.position57)return!1}let e=Number.parseInt(t,10);return e>=8&&e<=15}function cue(t,e){let r;try{r=new URL(t,e)}catch(n){throw new DOMException(n,"SyntaxError")}if(r.protocol==="http:"?r.protocol="ws:":r.protocol==="https:"&&(r.protocol="wss:"),r.protocol!=="ws:"&&r.protocol!=="wss:")throw new DOMException("expected a ws: or wss: url","SyntaxError");if(r.hash.length||r.href.endsWith("#"))throw new DOMException("hash","SyntaxError");return r}function Aue(t,e){if(t!==null&&t!==1e3&&(t<3e3||t>4999))throw new DOMException("invalid code","InvalidAccessError");if(e!==null){let r=Buffer.byteLength(e);if(r>123)throw new DOMException(`Reason must be less than 123 bytes; received ${r}`,"SyntaxError")}}var lue=(()=>{if(typeof process.versions.icu=="string"){let t=new TextDecoder("utf-8",{fatal:!0});return t.decode.bind(t)}return function(t){if($ae(t))return t.toString("utf-8");throw new TypeError("Invalid utf-8 received.")}})();w6.exports={isConnecting:zae,isEstablished:Xae,isClosing:Zae,isClosed:eue,fireEvent:tue,isValidSubprotocol:sue,isValidStatusCode:iue,websocketMessageReceived:rue,utf8Decode:lue,isControlFrame:b6,isContinuationFrame:y6,isTextBinaryFrame:B6,isValidOpcode:oue,parseExtensions:aue,isValidClientWindowBits:uue,toArrayBuffer:nue,getURLRecord:cue,validateCloseCodeAndReason:Aue}});var Rc=x((pSe,S6)=>{"use strict";var{runtimeFeatures:fue}=Ei(),{maxUnsigned16Bit:Q6,opcodes:due}=Ro(),E0=8*1024,ql=null,Dc=E0,hue=fue.has("crypto")?j("node:crypto").randomFillSync:function(e,r,n){for(let s=0;sQ6?(o+=8,i=127):s>125&&(o+=2,i=126);let a=Buffer.allocUnsafe(s+o);a[0]=a[1]=0,a[0]|=128,a[0]=(a[0]&240)+e;a[o-4]=n[0],a[o-3]=n[1],a[o-2]=n[2],a[o-1]=n[3],a[1]=i,i===126?a.writeUInt16BE(s,2):i===127&&(a[2]=a[3]=0,a.writeUIntBE(s,4,6)),a[1]|=128;for(let u=0;uQ6?(i+=8,s=127):n>125&&(i+=2,s=126);let o=Buffer.allocUnsafeSlow(i);return o[0]=128|due.TEXT,o[1]=s|128,o[i-4]=r[0],o[i-3]=r[1],o[i-2]=r[2],o[i-1]=r[3],s===126?o.writeUInt16BE(n,2):s===127&&(o[2]=o[3]=0,o.writeUIntBE(n,4,6)),[o,e]}};S6.exports={WebsocketFrameSend:QB,generateMask:wB}});var C0=x((mSe,v6)=>{"use strict";var{uid:gue,states:SB,sentCloseFrameState:TB,emptyBuffer:T6,opcodes:pue}=Ro(),{parseExtensions:mue,isClosed:Eue,isClosing:Cue,isEstablished:R6,isConnecting:Iue,validateCloseCodeAndReason:bue}=Ua(),{makeRequest:yue}=wc(),{fetching:Bue}=Pl(),{Headers:wue,getHeadersList:Que}=ka(),{getDecodeSplit:Sue}=Sn(),{WebsocketFrameSend:Tue}=Rc(),xue=j("node:assert"),{runtimeFeatures:Due}=Ei(),x6=Due.has("crypto")?j("node:crypto"):null,D6=!1;function Rue(t,e,r,n,s){let i=t;i.protocol=t.protocol==="ws:"?"http:":"https:";let o=yue({urlList:[i],client:r,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error",useURLCredentials:!0});if(s.headers){let A=Que(new wue(s.headers));o.headersList=A}let a=x6.randomBytes(16).toString("base64");o.headersList.append("sec-websocket-key",a,!0),o.headersList.append("sec-websocket-version","13",!0);for(let A of e)o.headersList.append("sec-websocket-protocol",A,!0);return o.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits",!0),Bue({request:o,useParallelQueue:!0,dispatcher:s.dispatcher,processResponse(A){if(A.type==="error"||A.status!==101){if(A.socket?.session==null){Xs(n,1002,"Received network error or non-101 status code.",A.error);return}if(A.status!==200){Xs(n,1002,"Received network error or non-200 status code.",A.error);return}}if(D6===!1&&A.socket?.session!=null&&(process.emitWarning("WebSocket over HTTP2 is experimental, and subject to change.","ExperimentalWarning"),D6=!0),e.length!==0&&!A.headersList.get("Sec-WebSocket-Protocol")){Xs(n,1002,"Server did not respond with sent protocols.");return}if(A.socket.session==null&&A.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){Xs(n,1002,'Server did not set Upgrade header to "websocket".');return}if(A.socket.session==null&&A.headersList.get("Connection")?.toLowerCase()!=="upgrade"){Xs(n,1002,'Server did not set Connection header to "upgrade".');return}let f=A.headersList.get("Sec-WebSocket-Accept"),l=x6.hash("sha1",a+gue,"base64");if(f!==l){Xs(n,1002,"Incorrect hash received in Sec-WebSocket-Accept header.");return}let h=A.headersList.get("Sec-WebSocket-Extensions"),g;if(h!==null&&(g=mue(h),!g.has("permessage-deflate"))){Xs(n,1002,"Sec-WebSocket-Extensions header does not match.");return}let p=A.headersList.get("Sec-WebSocket-Protocol");if(p!==null&&!Sue("sec-websocket-protocol",o.headersList).includes(p)){Xs(n,1002,"Protocol was not set in the opening handshake.");return}A.socket.on("data",n.onSocketData),A.socket.on("close",n.onSocketClose),A.socket.on("error",n.onSocketError),n.wasEverConnected=!0,n.onConnectionEstablished(A,g)}})}function N6(t,e,r,n=!1){if(e??=null,r??="",n&&bue(e,r),!(Eue(t.readyState)||Cue(t.readyState)))if(!R6(t.readyState))Xs(t),t.readyState=SB.CLOSING;else if(!t.closeState.has(TB.SENT)&&!t.closeState.has(TB.RECEIVED)){let s=new Tue;r.length!==0&&e===null&&(e=1e3),xue(e===null||Number.isInteger(e)),e===null&&r.length===0?s.frameData=T6:e!==null&&r===null?(s.frameData=Buffer.allocUnsafe(2),s.frameData.writeUInt16BE(e,0)):e!==null&&r!==null?(s.frameData=Buffer.allocUnsafe(2+Buffer.byteLength(r)),s.frameData.writeUInt16BE(e,0),s.frameData.write(r,2,"utf-8")):s.frameData=T6,t.socket.write(s.createFrame(pue.CLOSE)),t.closeState.add(TB.SENT),t.readyState=SB.CLOSING}else t.readyState=SB.CLOSING}function Xs(t,e,r,n){R6(t.readyState)&&N6(t,e,r,!1),t.controller.abort(),Iue(t.readyState)?t.onSocketClose():t.socket?.destroyed===!1&&t.socket.destroy()}v6.exports={establishWebSocketConnection:Rue,failWebsocketConnection:Xs,closeWebSocketConnection:N6}});var M6=x((ESe,k6)=>{"use strict";var{createInflateRaw:Nue,Z_DEFAULT_WINDOWBITS:vue}=j("node:zlib"),{isValidClientWindowBits:kue}=Ua(),{MessageSizeExceededError:Mue}=ze(),Lue=Buffer.from([0,0,255,255]),I0=Symbol("kBuffer"),Wl=Symbol("kLength"),xB=class{#e;#t={};#r=0;constructor(e,r){this.#t.serverNoContextTakeover=e.has("server_no_context_takeover"),this.#t.serverMaxWindowBits=e.get("server_max_window_bits"),this.#r=r.maxPayloadSize}decompress(e,r,n){if(!this.#e){let s=vue;if(this.#t.serverMaxWindowBits){if(!kue(this.#t.serverMaxWindowBits)){n(new Error("Invalid server_max_window_bits"));return}s=Number.parseInt(this.#t.serverMaxWindowBits)}try{this.#e=Nue({windowBits:s})}catch(i){n(i);return}this.#e[I0]=[],this.#e[Wl]=0,this.#e.on("data",i=>{if(this.#e[Wl]+=i.length,this.#r>0&&this.#e[Wl]>this.#r){n(new Mue),this.#e.removeAllListeners(),this.#e=null;return}this.#e[I0].push(i)}),this.#e.on("error",i=>{this.#e=null,n(i)})}this.#e.write(e),r&&this.#e.write(Lue),this.#e.flush(()=>{if(!this.#e)return;let s=Buffer.concat(this.#e[I0],this.#e[Wl]);this.#e[I0].length=0,this.#e[Wl]=0,n(null,s)})}};k6.exports={PerMessageDeflate:xB}});var vB=x((CSe,O6)=>{"use strict";var{Writable:Fue}=j("node:stream"),_ue=j("node:assert"),{parserStates:Cn,opcodes:Nc,states:Uue,emptyBuffer:L6,sentCloseFrameState:Vl}=Ro(),{isValidStatusCode:Oue,isValidOpcode:Pue,websocketMessageReceived:F6,utf8Decode:Hue,isControlFrame:DB,isTextBinaryFrame:RB,isContinuationFrame:Yue}=Ua(),{failWebsocketConnection:qr}=C0(),{WebsocketFrameSend:_6}=Rc(),{PerMessageDeflate:Gue}=M6(),{MessageSizeExceededError:U6}=ze(),NB=class extends Fue{#e=[];#t=0;#r=0;#n=!1;#i=Cn.INFO;#s={};#u=[];#o;#a;#c;#l;constructor(e,r,n={}){super(),this.#a=e,this.#o=r??new Map,this.#c=n.maxFragments??0,this.#l=n.maxPayloadSize??0,this.#o.has("permessage-deflate")&&this.#o.set("permessage-deflate",new Gue(r,n))}_write(e,r,n){this.#e.push(e),this.#r+=e.length,this.#n=!0,this.run(n)}#A(){return this.#l>0&&!DB(this.#s.opcode)&&this.#s.payloadLength+this.#t>this.#l?(qr(this.#a,1009,"Payload size exceeds maximum allowed size"),!1):!0}run(e){for(;this.#n;)if(this.#i===Cn.INFO){if(this.#r<2)return e();let r=this.consume(2),n=(r[0]&128)!==0,s=r[0]&15,i=(r[1]&128)===128,o=!n&&s!==Nc.CONTINUATION,a=r[1]&127,u=r[0]&64,c=r[0]&32,A=r[0]&16;if(!Pue(s))return qr(this.#a,1002,"Invalid opcode received"),e();if(i)return qr(this.#a,1002,"Frame cannot be masked"),e();if(u!==0&&!this.#o.has("permessage-deflate")){qr(this.#a,1002,"Expected RSV1 to be clear.");return}if(c!==0||A!==0){qr(this.#a,1002,"RSV1, RSV2, RSV3 must be clear");return}if(o&&!RB(s)){qr(this.#a,1002,"Invalid frame type was fragmented.");return}if(RB(s)&&this.#u.length>0){qr(this.#a,1002,"Expected continuation frame");return}if(this.#s.fragmented&&o){qr(this.#a,1002,"Fragmented frame exceeded 125 bytes.");return}if((a>125||o)&&DB(s)){qr(this.#a,1002,"Control frame either too large or fragmented");return}if(Yue(s)&&this.#u.length===0&&!this.#s.compressed){qr(this.#a,1002,"Unexpected continuation frame");return}if(a<=125){if(this.#s.payloadLength=a,this.#i=Cn.READ_DATA,!this.#A())return}else a===126?this.#i=Cn.PAYLOADLENGTH_16:a===127&&(this.#i=Cn.PAYLOADLENGTH_64);RB(s)&&(this.#s.binaryType=s,this.#s.compressed=u!==0),this.#s.opcode=s,this.#s.masked=i,this.#s.fin=n,this.#s.fragmented=o}else if(this.#i===Cn.PAYLOADLENGTH_16){if(this.#r<2)return e();let r=this.consume(2);if(this.#s.payloadLength=r.readUInt16BE(0),this.#i=Cn.READ_DATA,!this.#A())return}else if(this.#i===Cn.PAYLOADLENGTH_64){if(this.#r<8)return e();let r=this.consume(8),n=r.readUInt32BE(0),s=r.readUInt32BE(4);if(n!==0||s>2**31-1){qr(this.#a,1009,"Received payload length > 2^31 bytes.");return}if(this.#s.payloadLength=s,this.#i=Cn.READ_DATA,!this.#A())return}else if(this.#i===Cn.READ_DATA){if(this.#r{if(n){let i=n instanceof U6?1009:1007;qr(this.#a,i,n.message);return}if(this.writeFragments(s)){if(this.#l>0&&this.#t>this.#l){qr(this.#a,1009,new U6().message);return}if(!this.#s.fin){this.#i=Cn.INFO,this.#n=!0,this.run(e);return}F6(this.#a,this.#s.binaryType,this.consumeFragments()),this.#n=!0,this.#i=Cn.INFO,this.run(e)}},this.#t),this.#n=!1;break}else{if(!this.writeFragments(r))return;!this.#s.fragmented&&this.#s.fin&&F6(this.#a,this.#s.binaryType,this.consumeFragments()),this.#i=Cn.INFO}}}consume(e){if(e>this.#r)throw new Error("Called consume() before buffers satiated.");if(e===0)return L6;this.#r-=e;let r=this.#e[0];if(r.length>e)return this.#e[0]=r.subarray(e,r.length),r.subarray(0,e);if(r.length===e)return this.#e.shift();{let n=0,s=Buffer.allocUnsafeSlow(e);for(;n!==e;){let i=this.#e[0],o=i.length;if(o+n===e){s.set(this.#e.shift(),n);break}else if(o+n>e){s.set(i.subarray(0,e-n),n),this.#e[0]=i.subarray(e-n);break}else s.set(this.#e.shift(),n),n+=o}return s}}writeFragments(e){return this.#c>0&&this.#u.length===this.#c?(qr(this.#a,1008,"Too many message fragments"),!1):(this.#t+=e.length,this.#u.push(e),!0)}consumeFragments(){let e=this.#u;if(e.length===1)return this.#t=0,e.shift();let r=0,n=Buffer.allocUnsafeSlow(this.#t);for(let s=0;s=2&&(r=e.readUInt16BE(0)),r!==void 0&&!Oue(r))return{code:1002,reason:"Invalid status code",error:!0};let n=e.subarray(2);n[0]===239&&n[1]===187&&n[2]===191&&(n=n.subarray(3));try{n=Hue(n)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:r,reason:n,error:!1}}parseControlFrame(e){let{opcode:r,payloadLength:n}=this.#s;if(r===Nc.CLOSE){if(n===1)return qr(this.#a,1002,"Received close frame with a 1-byte body."),!1;if(this.#s.closeInfo=this.parseCloseBody(e),this.#s.closeInfo.error){let{code:s,reason:i}=this.#s.closeInfo;return qr(this.#a,s,i),!1}if(!this.#a.closeState.has(Vl.SENT)&&!this.#a.closeState.has(Vl.RECEIVED)){let s=L6;this.#s.closeInfo.code&&(s=Buffer.allocUnsafe(2),s.writeUInt16BE(this.#s.closeInfo.code,0));let i=new _6(s);this.#a.socket.write(i.createFrame(Nc.CLOSE)),this.#a.closeState.add(Vl.SENT)}return this.#a.readyState=Uue.CLOSING,this.#a.closeState.add(Vl.RECEIVED),!1}else if(r===Nc.PING){if(!this.#a.closeState.has(Vl.RECEIVED)){let s=new _6(e);this.#a.socket.write(s.createFrame(Nc.PONG)),this.#a.onPing(e)}}else r===Nc.PONG&&this.#a.onPong(e);return!0}get closingInfo(){return this.#s.closeInfo}};O6.exports={ByteParser:NB}});var G6=x((ISe,Y6)=>{"use strict";var{WebsocketFrameSend:H6}=Rc(),{opcodes:P6,sendHints:Oa}=Ro(),que=ZI(),MB=class{#e=new que;#t=!1;#r;constructor(e){this.#r=e}add(e,r,n){if(n!==Oa.blob){if(this.#t){let i={promise:null,callback:r,frame:kB(e,n)};this.#e.push(i)}else if(n===Oa.text){let{0:i,1:o}=H6.createFastTextFrame(e);this.#r.cork(),this.#r.write(i),this.#r.write(o,r),this.#r.uncork()}else this.#r.write(kB(e,n),r);return}let s={promise:e.arrayBuffer().then(i=>{s.promise=null,s.frame=kB(i,n)}),callback:r,frame:null};this.#e.push(s),this.#t||this.#n()}async#n(){this.#t=!0;let e=this.#e;for(;!e.isEmpty();){let r=e.shift();r.promise!==null&&await r.promise,this.#r.write(r.frame,r.callback),r.callback=r.frame=null}this.#t=!1}};function kB(t,e){return new H6(Wue(t,e)).createFrame(e===Oa.text?P6.TEXT:P6.BINARY)}function Wue(t,e){switch(e){case Oa.text:case Oa.typedArray:return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);case Oa.arrayBuffer:case Oa.blob:return new Uint8Array(t)}}Y6.exports={SendQueue:MB}});var $6=x((bSe,j6)=>{"use strict";var{isArrayBuffer:Vue}=j("node:util/types"),{webidl:Ge}=vr(),{URLSerializer:Jue}=Xn(),{environmentSettingsObject:q6}=Sn(),{staticPropertyDescriptors:No,states:Di,sentCloseFrameState:LB,sendHints:b0,opcodes:FB}=Ro(),{isConnecting:jue,isEstablished:W6,isClosing:V6,isClosed:$ue,isValidSubprotocol:Kue,fireEvent:y0,utf8Decode:zue,toArrayBuffer:Xue,getURLRecord:Zue}=Ua(),{establishWebSocketConnection:ece,closeWebSocketConnection:tce,failWebsocketConnection:J6}=C0(),{ByteParser:rce}=vB(),{kEnumerableProperty:os}=et(),{getGlobalDispatcher:nce}=Og(),{ErrorEvent:sce,CloseEvent:ice,createFastMessageEvent:oce}=p0(),{SendQueue:ace}=G6(),{WebsocketFrameSend:uce}=Rc(),{channels:Zs}=uo();function cce(t){return typeof t?.address=="function"?t.address():typeof t?.session?.socket?.address=="function"?t.session.socket.address():null}var en=class t extends EventTarget{#e={open:null,error:null,close:null,message:null};#t=0;#r="";#n="";#i;#s={onConnectionEstablished:(e,r)=>this.#c(e,r),onMessage:(e,r)=>this.#l(e,r),onParserError:e=>J6(this.#s,null,e.message),onParserDrain:()=>this.#A(),onSocketData:e=>{this.#a.write(e)||this.#s.socket.pause()},onSocketError:e=>{this.#s.readyState=Di.CLOSING,Zs.socketError.hasSubscribers&&Zs.socketError.publish(e),this.#s.socket.destroy()},onSocketClose:()=>this.#f(),onPing:e=>{Zs.ping.hasSubscribers&&Zs.ping.publish({payload:e,websocket:this})},onPong:e=>{Zs.pong.hasSubscribers&&Zs.pong.publish({payload:e,websocket:this})},readyState:Di.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#u;#o;#a;constructor(e,r=[]){super(),Ge.util.markAsUncloneable(this);let n="WebSocket constructor";Ge.argumentLengthCheck(arguments,1,n);let s=Ge.converters["DOMString or sequence or WebSocketInit"](r,n,"options");e=Ge.converters.USVString(e),r=s.protocols;let i=q6.settingsObject.baseUrl,o=Zue(e,i);if(typeof r=="string"&&(r=[r]),r.length!==new Set(r.map(u=>u.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(r.length>0&&!r.every(u=>Kue(u)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this.#u=new URL(o.href);let a=q6.settingsObject;this.#s.controller=ece(o,r,a,this.#s,s),this.#s.readyState=t.CONNECTING,this.#o="blob"}close(e=void 0,r=void 0){Ge.brandCheck(this,t),e!==void 0&&(e=Ge.converters["unsigned short"](e,"WebSocket.close","code",Ge.attributes.Clamp)),r!==void 0&&(r=Ge.converters.USVString(r)),e??=null,r??="",tce(this.#s,e,r,!0)}send(e){Ge.brandCheck(this,t);let r="WebSocket.send";if(Ge.argumentLengthCheck(arguments,1,r),e=Ge.converters.WebSocketSendData(e,r,"data"),jue(this.#s.readyState))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!W6(this.#s.readyState)||V6(this.#s.readyState)))if(typeof e=="string"){let n=Buffer.from(e);this.#t+=n.byteLength,this.#i.add(n,()=>{this.#t-=n.byteLength},b0.text)}else Vue(e)?(this.#t+=e.byteLength,this.#i.add(e,()=>{this.#t-=e.byteLength},b0.arrayBuffer)):ArrayBuffer.isView(e)?(this.#t+=e.byteLength,this.#i.add(e,()=>{this.#t-=e.byteLength},b0.typedArray)):Ge.is.Blob(e)&&(this.#t+=e.size,this.#i.add(e,()=>{this.#t-=e.size},b0.blob))}get readyState(){return Ge.brandCheck(this,t),this.#s.readyState}get bufferedAmount(){return Ge.brandCheck(this,t),this.#t}get url(){return Ge.brandCheck(this,t),Jue(this.#u)}get extensions(){return Ge.brandCheck(this,t),this.#n}get protocol(){return Ge.brandCheck(this,t),this.#r}get onopen(){return Ge.brandCheck(this,t),this.#e.open}set onopen(e){Ge.brandCheck(this,t),this.#e.open&&this.removeEventListener("open",this.#e.open);let r=Ge.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("open",r),this.#e.open=e):this.#e.open=null}get onerror(){return Ge.brandCheck(this,t),this.#e.error}set onerror(e){Ge.brandCheck(this,t),this.#e.error&&this.removeEventListener("error",this.#e.error);let r=Ge.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("error",r),this.#e.error=e):this.#e.error=null}get onclose(){return Ge.brandCheck(this,t),this.#e.close}set onclose(e){Ge.brandCheck(this,t),this.#e.close&&this.removeEventListener("close",this.#e.close);let r=Ge.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("close",r),this.#e.close=e):this.#e.close=null}get onmessage(){return Ge.brandCheck(this,t),this.#e.message}set onmessage(e){Ge.brandCheck(this,t),this.#e.message&&this.removeEventListener("message",this.#e.message);let r=Ge.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("message",r),this.#e.message=e):this.#e.message=null}get binaryType(){return Ge.brandCheck(this,t),this.#o}set binaryType(e){Ge.brandCheck(this,t),e!=="blob"&&e!=="arraybuffer"?this.#o="blob":this.#o=e}#c(e,r){this.#s.socket=e.socket;let n=this.#s.controller.dispatcher?.webSocketOptions,s=n?.maxFragments,i=n?.maxPayloadSize,o=new rce(this.#s,r,{maxFragments:s,maxPayloadSize:i});o.on("drain",()=>this.#s.onParserDrain()),o.on("error",c=>this.#s.onParserError(c)),this.#a=o,this.#i=new ace(e.socket),this.#s.readyState=Di.OPEN;let a=e.headersList.get("sec-websocket-extensions");a!==null&&(this.#n=a);let u=e.headersList.get("sec-websocket-protocol");if(u!==null&&(this.#r=u),y0("open",this),Zs.open.hasSubscribers){let c=e.headersList.entries;Zs.open.publish({address:cce(e.socket),protocol:this.#r,extensions:this.#n,websocket:this,handshakeResponse:{status:e.status,statusText:e.statusText,headers:c}})}}#l(e,r){if(this.#s.readyState!==Di.OPEN)return;let n;if(e===FB.TEXT)try{n=zue(r)}catch{J6(this.#s,1007,"Received invalid UTF-8 in text frame.");return}else e===FB.BINARY&&(this.#o==="blob"?n=new Blob([r]):n=Xue(r));y0("message",this,oce,{origin:this.#u.origin,data:n})}#A(){this.#s.socket.resume()}#f(){let e=this.#s.closeState.has(LB.SENT)&&this.#s.closeState.has(LB.RECEIVED),r=1005,n="",s=this.#a?.closingInfo;s&&!s.error&&(r=s.code??1005,n=s.reason),this.#s.readyState=Di.CLOSED,this.#s.closeState.has(LB.RECEIVED)||(r=1006,y0("error",this,(i,o)=>new sce(i,o),{error:new TypeError(n)})),y0("close",this,(i,o)=>new ice(i,o),{wasClean:e,code:r,reason:n}),Zs.close.hasSubscribers&&Zs.close.publish({websocket:this,code:r,reason:n})}static ping(e,r){if(Buffer.isBuffer(r)){if(r.length>125)throw new TypeError("A PING frame cannot have a body larger than 125 bytes.")}else if(r!==void 0)throw new TypeError("Expected buffer payload");let n=e.#s.readyState;if(W6(n)&&!V6(n)&&!$ue(n)){let s=new uce(r);e.#s.socket.write(s.createFrame(FB.PING))}}},{ping:Ace}=en;Reflect.deleteProperty(en,"ping");en.CONNECTING=en.prototype.CONNECTING=Di.CONNECTING;en.OPEN=en.prototype.OPEN=Di.OPEN;en.CLOSING=en.prototype.CLOSING=Di.CLOSING;en.CLOSED=en.prototype.CLOSED=Di.CLOSED;Object.defineProperties(en.prototype,{CONNECTING:No,OPEN:No,CLOSING:No,CLOSED:No,url:os,readyState:os,bufferedAmount:os,onopen:os,onerror:os,onclose:os,close:os,onmessage:os,binaryType:os,send:os,extensions:os,protocol:os,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(en,{CONNECTING:No,OPEN:No,CLOSING:No,CLOSED:No});Ge.converters["sequence"]=Ge.sequenceConverter(Ge.converters.DOMString);Ge.converters["DOMString or sequence"]=function(t,e,r){return Ge.util.Type(t)===Ge.util.Types.OBJECT&&Symbol.iterator in t?Ge.converters["sequence"](t):Ge.converters.DOMString(t,e,r)};Ge.converters.WebSocketInit=Ge.dictionaryConverter([{key:"protocols",converter:Ge.converters["DOMString or sequence"],defaultValue:()=>[]},{key:"dispatcher",converter:Ge.converters.any,defaultValue:()=>nce()},{key:"headers",converter:Ge.nullableConverter(Ge.converters.HeadersInit)}]);Ge.converters["DOMString or sequence or WebSocketInit"]=function(t){return Ge.util.Type(t)===Ge.util.Types.OBJECT&&!(Symbol.iterator in t)?Ge.converters.WebSocketInit(t):{protocols:Ge.converters["DOMString or sequence"](t)}};Ge.converters.WebSocketSendData=function(t){return Ge.util.Type(t)===Ge.util.Types.OBJECT&&(Ge.is.Blob(t)||Ge.is.BufferSource(t))?t:Ge.converters.USVString(t)};j6.exports={WebSocket:en,ping:Ace}});var _B=x((ySe,X6)=>{"use strict";var{webidl:B0}=vr(),{validateCloseCodeAndReason:lce}=Ua(),{kConstruct:K6}=xt(),{kEnumerableProperty:z6}=et();function fce(){class t extends DOMException{get reason(){return""}}return new t().reason!==void 0?DOMException:new Proxy(DOMException,{construct(e,r,n){let s=Reflect.construct(e,r,e);return Object.setPrototypeOf(s,n.prototype),s}})}var Pa=class t extends fce(){#e;#t;constructor(e="",r=void 0){if(e=B0.converters.DOMString(e,"WebSocketError","message"),super(e,"WebSocketError"),r===K6)return;r!==null&&(r=B0.converters.WebSocketCloseInfo(r));let n=r.closeCode??null,s=r.reason??"";lce(n,s),s.length!==0&&n===null&&(n=1e3),this.#e=n,this.#t=s}get closeCode(){return this.#e}get reason(){return this.#t}static createUnvalidatedWebSocketError(e,r,n){let s=new t(e,K6);return s.#e=r,s.#t=n,s}},{createUnvalidatedWebSocketError:dce}=Pa;delete Pa.createUnvalidatedWebSocketError;Object.defineProperties(Pa.prototype,{closeCode:z6,reason:z6,[Symbol.toStringTag]:{value:"WebSocketError",writable:!1,enumerable:!1,configurable:!0}});B0.is.WebSocketError=B0.util.MakeTypeAssertion(Pa);X6.exports={WebSocketError:Pa,createUnvalidatedWebSocketError:dce}});var nF=x((BSe,rF)=>{"use strict";var{createDeferredPromise:UB}=ZA(),{environmentSettingsObject:Z6}=Sn(),{states:vc,opcodes:w0,sentCloseFrameState:kc}=Ro(),{webidl:sr}=vr(),{getURLRecord:hce,isValidSubprotocol:gce,isEstablished:pce,utf8Decode:mce}=Ua(),{establishWebSocketConnection:Ece,failWebsocketConnection:OB,closeWebSocketConnection:PB}=C0(),{channels:eF}=uo(),{WebsocketFrameSend:Cce}=Rc(),{ByteParser:Ice}=vB(),{WebSocketError:bce,createUnvalidatedWebSocketError:yce}=_B(),{kEnumerableProperty:Q0}=et(),{utf8DecodeBytes:Bce}=Wh(),tF=!1,S0=class{#e;#t;#r;#n;#i;#s;#u=!1;#o={onConnectionEstablished:(e,r)=>this.#l(e,r),onMessage:(e,r)=>this.#A(e,r),onParserError:e=>OB(this.#o,null,e.message),onParserDrain:()=>this.#o.socket.resume(),onSocketData:e=>{this.#a.write(e)||this.#o.socket.pause()},onSocketError:e=>{this.#o.readyState=vc.CLOSING,eF.socketError.hasSubscribers&&eF.socketError.publish(e),this.#o.socket.destroy()},onSocketClose:()=>this.#f(),onPing:()=>{},onPong:()=>{},readyState:vc.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#a;constructor(e,r=void 0){tF||(process.emitWarning("WebSocketStream is experimental! Expect it to change at any time.",{code:"UNDICI-WSS"}),tF=!0),sr.argumentLengthCheck(arguments,1,"WebSocket"),e=sr.converters.USVString(e),r!==null&&(r=sr.converters.WebSocketStreamOptions(r));let n=Z6.settingsObject.baseUrl,s=hce(e,n),i=r.protocols;if(i.length!==new Set(i.map(a=>a.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(i.length>0&&!i.every(a=>gce(a)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(this.#e=s.toString(),this.#t=UB(),this.#r=UB(),r.signal!=null){let a=r.signal;if(a.aborted){this.#t.reject(a.reason),this.#r.reject(a.reason);return}a.addEventListener("abort",()=>{pce(this.#o.readyState)||(OB(this.#o),this.#o.readyState=vc.CLOSING,this.#t.reject(a.reason),this.#r.reject(a.reason),this.#u=!0)},{once:!0})}let o=Z6.settingsObject;this.#o.controller=Ece(s,i,o,this.#o,r)}get url(){return this.#e.toString()}get opened(){return this.#t.promise}get closed(){return this.#r.promise}close(e=void 0){e!==null&&(e=sr.converters.WebSocketCloseInfo(e));let r=e.closeCode??null,n=e.reason;PB(this.#o,r,n,!0)}#c(e){e=sr.converters.WebSocketStreamWrite(e);let r=UB(),n=null,s=null;if(sr.is.BufferSource(e))n=new Uint8Array(ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e.slice()),s=w0.BINARY;else{let i;try{i=sr.converters.DOMString(e)}catch(o){return r.reject(o),r.promise}n=new TextEncoder().encode(i),s=w0.TEXT}if(!this.#o.closeState.has(kc.SENT)&&!this.#o.closeState.has(kc.RECEIVED)){let i=new Cce(n);this.#o.socket.write(i.createFrame(s),()=>{r.resolve(void 0)})}return r.promise}#l(e,r){this.#o.socket=e.socket;let n=this.#o.controller.dispatcher?.webSocketOptions?.maxFragments,s=this.#o.controller.dispatcher?.webSocketOptions?.maxPayloadSize,i=new Ice(this.#o,r,{maxFragments:n,maxPayloadSize:s});i.on("drain",()=>this.#o.onParserDrain()),i.on("error",A=>this.#o.onParserError(A)),this.#a=i,this.#o.readyState=vc.OPEN;let o=r??"",a=e.headersList.get("sec-websocket-protocol")??"",u=new ReadableStream({start:A=>{this.#i=A},cancel:A=>this.#h(A)}),c=new WritableStream({write:A=>this.#c(A),close:()=>PB(this.#o,null,null),abort:A=>this.#d(A)});this.#n=u,this.#s=c,this.#t.resolve({extensions:o,protocol:a,readable:u,writable:c})}#A(e,r){if(this.#o.readyState!==vc.OPEN)return;let n;if(e===w0.TEXT)try{n=mce(r)}catch{OB(this.#o,1007,"Received invalid UTF-8 in text frame.");return}else e===w0.BINARY&&(n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength));this.#i.enqueue(n)}#f(){let e=this.#o.closeState.has(kc.SENT)&&this.#o.closeState.has(kc.RECEIVED);if(this.#o.readyState=vc.CLOSED,this.#u)return;this.#o.wasEverConnected||this.#t.reject(new bce("Socket never opened"));let r=this.#a?.closingInfo,n=r?.code??1005;!this.#o.closeState.has(kc.SENT)&&!this.#o.closeState.has(kc.RECEIVED)&&(n=1006);let s=r?.reason==null?"":Bce(Buffer.from(r.reason));if(e)this.#i.close(),this.#s.locked||this.#s.abort(new DOMException("A closed WebSocketStream cannot be written to","InvalidStateError")),this.#r.resolve({closeCode:n,reason:s});else{let i=yce("unclean close",n,s);this.#i?.error(i),this.#s?.abort(i),this.#r.reject(i)}}#d(e){let r=null,n="";sr.is.WebSocketError(e)&&(r=e.closeCode,n=e.reason),PB(this.#o,r,n)}#h(e){this.#d(e)}};Object.defineProperties(S0.prototype,{url:Q0,opened:Q0,closed:Q0,close:Q0,[Symbol.toStringTag]:{value:"WebSocketStream",writable:!1,enumerable:!1,configurable:!0}});sr.converters.WebSocketStreamOptions=sr.dictionaryConverter([{key:"protocols",converter:sr.sequenceConverter(sr.converters.USVString),defaultValue:()=>[]},{key:"signal",converter:sr.nullableConverter(sr.converters.AbortSignal),defaultValue:()=>null}]);sr.converters.WebSocketCloseInfo=sr.dictionaryConverter([{key:"closeCode",converter:t=>sr.converters["unsigned short"](t,sr.attributes.EnforceRange)},{key:"reason",converter:sr.converters.USVString,defaultValue:()=>""}]);sr.converters.WebSocketStreamWrite=function(t){return typeof t=="string"?sr.converters.USVString(t):sr.converters.BufferSource(t)};rF.exports={WebSocketStream:S0}});var iF=x((wSe,sF)=>{"use strict";function wce(t){return t.indexOf("\0")===-1}function Qce(t){if(t.length===0)return!1;for(let e=0;e57)return!1;return!0}sF.exports={isValidLastEventId:wce,isASCIINumber:Qce}});var cF=x((QSe,uF)=>{"use strict";var{Transform:Sce}=j("node:stream"),{isASCIINumber:oF,isValidLastEventId:aF}=iF(),Ri=[239,187,191],HB=10,T0=13,Tce=58,xce=32,YB=class extends Sce{state;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;buffer=null;pos=0;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(e={}){e.readableObjectMode=!0,super(e),this.state=e.eventSourceSettings||{},e.push&&(this.push=e.push)}_transform(e,r,n){if(e.length===0){n();return}if(this.buffer?this.buffer=Buffer.concat([this.buffer,e]):this.buffer=e,this.checkBOM)switch(this.buffer.length){case 1:if(this.buffer[0]===Ri[0]){n();return}this.checkBOM=!1,n();return;case 2:if(this.buffer[0]===Ri[0]&&this.buffer[1]===Ri[1]){n();return}this.checkBOM=!1;break;case 3:if(this.buffer[0]===Ri[0]&&this.buffer[1]===Ri[1]&&this.buffer[2]===Ri[2]){this.buffer=Buffer.alloc(0),this.checkBOM=!1,n();return}this.checkBOM=!1;break;default:this.buffer[0]===Ri[0]&&this.buffer[1]===Ri[1]&&this.buffer[2]===Ri[2]&&(this.buffer=this.buffer.subarray(3)),this.checkBOM=!1;break}for(;this.pos0&&(r[s]=i);break}}processEvent(e){e.retry&&oF(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id!==void 0&&aF(e.id)&&(this.state.lastEventId=e.id),e.data!==void 0&&this.push({type:e.event||"message",options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}};uF.exports={EventSourceStream:YB}});var mF=x((SSe,pF)=>{"use strict";var{pipeline:Dce}=j("node:stream"),{fetching:Rce}=Pl(),{makeRequest:Nce}=wc(),{webidl:tn}=vr(),{EventSourceStream:vce}=cF(),{parseMIMEType:kce}=Xn(),{createFastMessageEvent:Mce}=p0(),{isNetworkError:AF}=_l(),{kEnumerableProperty:Ha}=et(),{environmentSettingsObject:lF}=Sn(),fF=!1,dF=3e3,Jl=0,hF=1,jl=2,Lce="anonymous",Fce="use-credentials",Mc=class t extends EventTarget{#e={open:null,error:null,message:null};#t;#r=!1;#n=Jl;#i=null;#s=null;#u;#o;constructor(e,r={}){super(),tn.util.markAsUncloneable(this);let n="EventSource constructor";tn.argumentLengthCheck(arguments,1,n),fF||(fF=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=tn.converters.USVString(e),r=tn.converters.EventSourceInitDict(r,n,"eventSourceInitDict"),this.#u=r.node.dispatcher||r.dispatcher,this.#o={lastEventId:"",reconnectionTime:r.node.reconnectionTime};let s=lF,i;try{i=new URL(e,s.settingsObject.baseUrl),this.#o.origin=i.origin}catch(u){throw new DOMException(u,"SyntaxError")}this.#t=i.href;let o=Lce;r.withCredentials===!0&&(o=Fce,this.#r=!0);let a={redirect:"follow",keepalive:!0,mode:"cors",credentials:o==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};a.client=lF.settingsObject,a.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],a.cache="no-store",a.initiator="other",a.urlList=[new URL(this.#t)],this.#i=Nce(a),this.#a()}get readyState(){return this.#n}get url(){return this.#t}get withCredentials(){return this.#r}#a(){if(this.#n===jl)return;this.#n=Jl;let e={request:this.#i,dispatcher:this.#u},r=n=>{if(!AF(n))return this.#c()};e.processResponseEndOfBody=r,e.processResponse=n=>{if(AF(n))if(n.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#c();return}let s=n.headersList.get("content-type",!0),i=s!==null?kce(s):"failure",o=i!=="failure"&&i.essence==="text/event-stream";if(n.status!==200||o===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#n=hF,this.dispatchEvent(new Event("open")),this.#o.origin=n.urlList[n.urlList.length-1].origin;let a=new vce({eventSourceSettings:this.#o,push:u=>{this.dispatchEvent(Mce(u.type,u.options))}});Dce(n.body.stream,a,u=>{u?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#s=Rce(e)}#c(){this.#n!==jl&&(this.#n=Jl,this.dispatchEvent(new Event("error")),setTimeout(()=>{this.#n===Jl&&(this.#o.lastEventId.length&&this.#i.headersList.set("last-event-id",this.#o.lastEventId,!0),this.#a())},this.#o.reconnectionTime)?.unref())}close(){tn.brandCheck(this,t),this.#n!==jl&&(this.#n=jl,this.#s.abort(),this.#i=null)}get onopen(){return this.#e.open}set onopen(e){this.#e.open&&this.removeEventListener("open",this.#e.open);let r=tn.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("open",r),this.#e.open=e):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(e){this.#e.message&&this.removeEventListener("message",this.#e.message);let r=tn.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("message",r),this.#e.message=e):this.#e.message=null}get onerror(){return this.#e.error}set onerror(e){this.#e.error&&this.removeEventListener("error",this.#e.error);let r=tn.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("error",r),this.#e.error=e):this.#e.error=null}},gF={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:Jl,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:hF,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:jl,writable:!1}};Object.defineProperties(Mc,gF);Object.defineProperties(Mc.prototype,gF);Object.defineProperties(Mc.prototype,{close:Ha,onerror:Ha,onmessage:Ha,onopen:Ha,readyState:Ha,url:Ha,withCredentials:Ha});tn.converters.EventSourceInitDict=tn.dictionaryConverter([{key:"withCredentials",converter:tn.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:tn.converters.any},{key:"node",converter:tn.dictionaryConverter([{key:"reconnectionTime",converter:tn.converters["unsigned long"],defaultValue:()=>dF},{key:"dispatcher",converter:tn.converters.any}]),defaultValue:()=>({})}]);pF.exports={EventSource:Mc,defaultReconnectionTime:dF}});var BF=x((TSe,Se)=>{"use strict";var _ce=Eo(),CF=VA(),Uce=ma(),Oce=n8(),Pce=a8(),Hce=Ia(),Yce=Sb(),Gce=yb(),qce=V8(),Wce=Z8(),Vce=r4(),IF=ze(),D0=et(),{InvalidArgumentError:x0}=IF,Lc=_4(),Jce=oa(),jce=ly(),{MockCallHistory:$ce,MockCallHistoryLog:Kce}=hy(),zce=By(),Xce=Ey(),Zce=FM(),eAe=jb(),tAe=wg(),{getGlobalDispatcher:bF,setGlobalDispatcher:rAe}=Og(),nAe=Ec(),sAe=Ny();Object.assign(CF.prototype,Lc);Se.exports.Dispatcher=CF;Se.exports.Client=_ce;Se.exports.Pool=Uce;Se.exports.BalancedPool=Oce;Se.exports.RoundRobinPool=Pce;Se.exports.Agent=Hce;Se.exports.ProxyAgent=Yce;Se.exports.Socks5ProxyAgent=Gce;Se.exports.EnvHttpProxyAgent=qce;Se.exports.RetryAgent=Wce;Se.exports.H2CClient=Vce;Se.exports.RetryHandler=tAe;Se.exports.DecoratorHandler=nAe;Se.exports.RedirectHandler=sAe;Se.exports.interceptors={redirect:JM(),responseError:$M(),retry:zM(),dump:ZM(),dns:n3(),cache:L3(),decompress:P3(),deduplicate:W3()};Se.exports.cacheStores={MemoryCacheStore:Vy()};var iAe=j3();Se.exports.cacheStores.SqliteCacheStore=iAe;Se.exports.buildConnector=Jce;Se.exports.errors=IF;Se.exports.util={parseHeaders:D0.parseHeaders,headerNameToString:D0.headerNameToString};function $l(t){return(e,r,n)=>{if(typeof r=="function"&&(n=r,r=null),!e||typeof e!="string"&&typeof e!="object"&&!(e instanceof URL))throw new x0("invalid url");if(r!=null&&typeof r!="object")throw new x0("invalid opts");if(r&&r.path!=null){if(typeof r.path!="string")throw new x0("invalid opts.path");let o=r.path;r.path.startsWith("/")||(o=`/${o}`),e=new URL(D0.parseOrigin(e).origin+o)}else r||(r=typeof e=="object"?e:{}),e=D0.parseURL(e);let{agent:s,dispatcher:i=bF()}=r;if(s)throw new x0("unsupported opts.agent. Did you mean opts.client?");return t.call(i,{...r,origin:e.origin,path:e.search?`${e.pathname}${e.search}`:e.pathname,method:r.method||(r.body?"PUT":"GET")},n)}}Se.exports.setGlobalDispatcher=rAe;Se.exports.getGlobalDispatcher=bF;var oAe=Pl().fetch,EF=typeof __filename<"u"?__filename:void 0;function yF(t,e){if(!t||typeof t!="object")return;let r=typeof t.stack=="string"?t.stack:"",n=e.replace(/\\/g,"/");if(r&&(r.includes(e)||r.includes(n)))return;let s={};if(Error.captureStackTrace(s,yF),!s.stack)return;let i=s.stack.split(`
+`).slice(1).join(`
+`);t.stack=r?`${r}
+${i}`:s.stack}Se.exports.fetch=function(e,r=void 0){return oAe(e,r).catch(n=>{throw EF?yF(n,EF):n&&typeof n=="object"&&Error.captureStackTrace(n,Se.exports.fetch),n})};Se.exports.Headers=ka().Headers;Se.exports.Response=_l().Response;Se.exports.Request=wc().Request;Se.exports.FormData=zh().FormData;var{setGlobalOrigin:aAe,getGlobalOrigin:uAe}=aI();Se.exports.setGlobalOrigin=aAe;Se.exports.getGlobalOrigin=uAe;var{CacheStorage:cAe}=s6(),{kConstruct:AAe}=xt();Se.exports.caches=new cAe(AAe);var{deleteCookie:lAe,getCookies:fAe,getSetCookies:dAe,setCookie:hAe,parseCookie:gAe}=p6();Se.exports.deleteCookie=lAe;Se.exports.getCookies=fAe;Se.exports.getSetCookies=dAe;Se.exports.setCookie=hAe;Se.exports.parseCookie=gAe;var{parseMIMEType:pAe,serializeAMimeType:mAe}=Xn();Se.exports.parseMIMEType=pAe;Se.exports.serializeAMimeType=mAe;var{CloseEvent:EAe,ErrorEvent:CAe,MessageEvent:IAe}=p0(),{WebSocket:bAe,ping:yAe}=$6();Se.exports.WebSocket=bAe;Se.exports.CloseEvent=EAe;Se.exports.ErrorEvent=CAe;Se.exports.MessageEvent=IAe;Se.exports.ping=yAe;Se.exports.WebSocketStream=nF().WebSocketStream;Se.exports.WebSocketError=_B().WebSocketError;Se.exports.request=$l(Lc.request);Se.exports.stream=$l(Lc.stream);Se.exports.pipeline=$l(Lc.pipeline);Se.exports.connect=$l(Lc.connect);Se.exports.upgrade=$l(Lc.upgrade);Se.exports.MockClient=jce;Se.exports.MockCallHistory=$ce;Se.exports.MockCallHistoryLog=Kce;Se.exports.MockPool=Xce;Se.exports.MockAgent=zce;Se.exports.SnapshotAgent=Zce;Se.exports.mockErrors=eAe;var{EventSource:BAe}=mF();Se.exports.EventSource=BAe;function wAe(){globalThis.fetch=Se.exports.fetch,globalThis.Headers=Se.exports.Headers,globalThis.Response=Se.exports.Response,globalThis.Request=Se.exports.Request,globalThis.FormData=Se.exports.FormData,globalThis.WebSocket=Se.exports.WebSocket,globalThis.CloseEvent=Se.exports.CloseEvent,globalThis.ErrorEvent=Se.exports.ErrorEvent,globalThis.MessageEvent=Se.exports.MessageEvent,globalThis.EventSource=Se.exports.EventSource}Se.exports.install=wAe});var Kl=x(vo=>{"use strict";vo.removeLeadingAndTrailingHTTPWhitespace=t=>t.replace(/^[ \t\n\r]+/u,"").replace(/[ \t\n\r]+$/u,"");vo.removeTrailingHTTPWhitespace=t=>t.replace(/[ \t\n\r]+$/u,"");vo.isHTTPWhitespaceChar=t=>t===" "||t===" "||t===`
+`||t==="\r";vo.solelyContainsHTTPTokenCodePoints=t=>/^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/u.test(t);vo.soleyContainsHTTPQuotedStringTokenCodePoints=t=>/^[\t\u0020-\u007E\u0080-\u00FF]*$/u.test(t);vo.asciiLowercase=t=>t.replace(/[A-Z]/ug,e=>e.toLowerCase());vo.collectAnHTTPQuotedString=(t,e)=>{let r="";for(e++;;){for(;e=t.length)break;let n=t[e];if(++e,n==="\\"){if(e>=t.length){r+="\\";break}r+=t[e],++e}else break}return[r,e]}});var QF=x((RSe,wF)=>{"use strict";var{asciiLowercase:R0,solelyContainsHTTPTokenCodePoints:QAe,soleyContainsHTTPQuotedStringTokenCodePoints:SAe}=Kl();wF.exports=class{constructor(e){this._map=e}get size(){return this._map.size}get(e){return e=R0(String(e)),this._map.get(e)}has(e){return e=R0(String(e)),this._map.has(e)}set(e,r){if(e=R0(String(e)),r=String(r),!QAe(e))throw new Error(`Invalid MIME type parameter name "${e}": only HTTP token code points are valid.`);if(!SAe(r))throw new Error(`Invalid MIME type parameter value "${r}": only HTTP quoted-string token code points are valid.`);return this._map.set(e,r)}clear(){this._map.clear()}delete(e){return e=R0(String(e)),this._map.delete(e)}forEach(e,r){this._map.forEach(e,r)}keys(){return this._map.keys()}values(){return this._map.values()}entries(){return this._map.entries()}[Symbol.iterator](){return this._map[Symbol.iterator]()}}});var xF=x((NSe,TF)=>{"use strict";var{removeLeadingAndTrailingHTTPWhitespace:TAe,removeTrailingHTTPWhitespace:SF,isHTTPWhitespaceChar:xAe,solelyContainsHTTPTokenCodePoints:GB,soleyContainsHTTPQuotedStringTokenCodePoints:DAe,asciiLowercase:qB,collectAnHTTPQuotedString:RAe}=Kl();TF.exports=t=>{t=TAe(t);let e=0,r="";for(;e=t.length)return null;++e;let n="";for(;e0&&GB(i)&&DAe(o)&&!s.parameters.has(i)&&s.parameters.set(i,o)}return s}});var RF=x((vSe,DF)=>{"use strict";var{solelyContainsHTTPTokenCodePoints:NAe}=Kl();DF.exports=t=>{let e=`${t.type}/${t.subtype}`;if(t.parameters.size===0)return e;for(let[r,n]of t.parameters)e+=";",e+=r,e+="=",(!NAe(n)||n.length===0)&&(n=n.replace(/(["\\])/ug,"\\$1"),n=`"${n}"`),e+=n;return e}});var MF=x((MSe,kF)=>{"use strict";var vAe=QF(),kAe=xF(),MAe=RF(),{asciiLowercase:NF,solelyContainsHTTPTokenCodePoints:vF}=Kl();kF.exports=class{constructor(e){e=String(e);let r=kAe(e);if(r===null)throw new Error(`Could not parse MIME type string "${e}"`);this._type=r.type,this._subtype=r.subtype,this._parameters=new vAe(r.parameters)}static parse(e){try{return new this(e)}catch{return null}}get essence(){return`${this.type}/${this.subtype}`}get type(){return this._type}set type(e){if(e=NF(String(e)),e.length===0)throw new Error("Invalid type: must be a non-empty string");if(!vF(e))throw new Error(`Invalid type ${e}: must contain only HTTP token code points`);this._type=e}get subtype(){return this._subtype}set subtype(e){if(e=NF(String(e)),e.length===0)throw new Error("Invalid subtype: must be a non-empty string");if(!vF(e))throw new Error(`Invalid subtype ${e}: must contain only HTTP token code points`);this._subtype=e}get parameters(){return this._parameters}toString(){return MAe(this)}isJavaScript({prohibitParameters:e=!1}={}){switch(this._type){case"text":switch(this._subtype){case"ecmascript":case"javascript":case"javascript1.0":case"javascript1.1":case"javascript1.2":case"javascript1.3":case"javascript1.4":case"javascript1.5":case"jscript":case"livescript":case"x-ecmascript":case"x-javascript":return!e||this._parameters.size===0;default:return!1}case"application":switch(this._subtype){case"ecmascript":case"javascript":case"x-ecmascript":case"x-javascript":return!e||this._parameters.size===0;default:return!1}default:return!1}}isXML(){return this._subtype==="xml"&&(this._type==="text"||this._type==="application")||this._subtype.endsWith("+xml")}isHTML(){return this._subtype==="html"&&this._type==="text"}}});var WB,LAe,Nt=G(()=>{OE();Qu();UE();Du();oD();FR();WB=hr(BF(),1),LAe=hr(MF(),1);ed();OE()});async function At(t,e,r,n){let s,i=!1,o=new Promise((a,u)=>{s=setTimeout(()=>{i=!0,u(new zl(r,e))},e)});try{return await Promise.race([t,o])}finally{s&&clearTimeout(s),i&&n&&t.then(n).catch(()=>{})}}var zl,ko=G(()=>{"use strict";zl=class extends Error{label;constructor(e,r){super(`${e} timed out after ${r}ms`),this.name="TimeoutError",this.label=e}}});function _Ae(t){let e=t;e.startsWith("[")&&e.endsWith("]")&&(e=e.slice(1,-1));let r=e.indexOf("%");return r>=0&&(e=e.slice(0,r)),/^\d{1,3}(\.\d{1,3}){3}$/.test(e)&&e.split(".").map(s=>Number(s)).every(s=>s>=0&&s<=255)?{kind:"ipv4",value:e}:e.includes(":")&&/^[0-9a-fA-F:]+$/.test(e)?{kind:"ipv6",value:e.toLowerCase()}:null}function FF(t){let[e,r]=t.split(".").map(n=>Number(n));return e===0||e===127||e===10||e===172&&r>=16&&r<=31||e===192&&r===168||e===169&&r===254||e===100&&r>=64&&r<=127||e>=224}function UAe(t){let e=t.toLowerCase();if(e==="::1"||e==="::"||e==="0:0:0:0:0:0:0:0"||e.startsWith("fc")||e.startsWith("fd")||e.startsWith("fe8")||e.startsWith("fe9")||e.startsWith("fea")||e.startsWith("feb"))return!0;let r=e.match(/::ffff:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);return r?FF(r[1]):!1}function vi(t){let e;try{e=new URL(t)}catch{throw new ei(`unparseable URL: ${String(t).slice(0,200)}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new ei(`disallowed URL scheme "${e.protocol}" (only http/https)`);let r=e.hostname.toLowerCase();if(!r)throw new ei("URL has no host");let n=_Ae(r);if(n){if(n.kind==="ipv4"?FF(n.value):UAe(n.value))throw new ei(`internal/loopback IP address not allowed: ${r}`);return e}if(r==="localhost"||r.endsWith(".localhost"))throw new ei(`loopback hostname not allowed: ${r}`);if(r.endsWith(".local"))throw new ei(`mDNS/.local hostname not allowed: ${r}`);if(!r.includes("."))throw new ei(`bare single-label hostname not allowed: ${r}`);return e}async function Xl(t,e={}){let r=e.timeoutMs??3e4,n=e.maxBytes??26214400,s=e.maxRedirects??5,i=e.fetchImpl??fetch,o=vi(t).toString();for(let a=0;a<=s;a++){let u=await i(o,{signal:AbortSignal.timeout(r),redirect:"manual",headers:e.headers}),c=l=>{try{return u.headers?.get?.(l)??null}catch{return null}};if(u.status>=300&&u.status<400){let l=c("location");try{await u.body?.cancel()}catch{}if(!l)throw new Error(`redirect ${u.status} with no Location header`);if(a===s)throw new Error(`too many redirects (> ${s})`);let h=new URL(l,o).toString();o=vi(h).toString();continue}let A=c("content-length");if(A){let l=Number(A);if(Number.isFinite(l)&&l>n){try{await u.body?.cancel()}catch{}throw new Ni(`response body ${l} bytes exceeds max ${n} (Content-Length)`)}}let f=await OAe(u,n);return{finalUrl:o,status:u.status,headers:u.headers,body:f}}throw new Error(`too many redirects (> ${s})`)}async function OAe(t,e){let r=t.body;if(r&&typeof r.getReader=="function"){let s=r.getReader(),i=[],o=0;try{for(;;){let{done:a,value:u}=await s.read();if(a)break;if(u){if(o+=u.byteLength,o>e){try{await s.cancel()}catch{}throw new Ni(`response body exceeds max ${e} bytes (streamed)`)}i.push(u)}}}finally{try{s.releaseLock()}catch{}}return Buffer.concat(i.map(a=>Buffer.from(a)))}let n=Buffer.from(await t.arrayBuffer());if(n.length>e)throw new Ni(`response body ${n.length} bytes exceeds max ${e}`);return n}var ei,Ni,Fc=G(()=>{"use strict";ei=class extends Error{constructor(e){super(e),this.name="SsrfBlockedError"}},Ni=class extends Error{constructor(e){super(e),this.name="BodyTooLargeError"}}});async function Mo(){try{return await import("playwright")}catch{throw new Error("Playwright is required but is not installed. Run `npm install playwright` and `npx playwright install chromium` to set it up.")}}async function _c(t){let e=await Mo();return t.cdpPort?await e.chromium.connectOverCDP(`http://127.0.0.1:${t.cdpPort}`):await e.chromium.launch({headless:!t.headed})}async function Lo(t){let r=await At(_c(t),PAe,"browser connect",i=>{At(i.close(),N0,"late browser close").catch(()=>{})}),n=()=>At(r.newContext(),_F,"context create"),s;try{let o=(t.cdpPort?r.contexts()[0]||await n():await n()).newPage();s=await At(o,_F,"page create",a=>{a.close().catch(()=>{})})}catch(i){throw await At(r.close(),N0,"browser close").catch(()=>{}),i}return{browser:r,page:s,close:async()=>{await At(s.close(),N0,"page close").catch(()=>{}),await At(r.close(),N0,"browser close").catch(()=>{})}}}var N0,_F,PAe,VB=G(()=>{"use strict";ko();N0=3e3,_F=3e4,PAe=6e4});function Fo(t){let e=null,r=!1,n=0,s=A=>At(A.close(),HAe,"managed browser close").catch(()=>{}),i=new WeakSet,o=A=>i.has(A)?Promise.resolve():(i.add(A),s(A)),a=async A=>{let f=await At(A,YAe,"managed browser launch settle",o).catch(()=>null);f&&await o(f)},u=A=>!A.browser.isConnected()||A.page.isClosed?.()===!0,c=async A=>{for(;;){if(r)throw new Error("managed browser: acquire() after end()");if(A!==n)throw new Error("managed browser: lease invalidated by reset()");let f=!1,l=e;l||(l=e=Lo(t),f=!0);let h;try{h=await At(l,GAe,"managed browser launch",o)}catch(g){throw e===l&&(e=null),g}if(r)throw new Error("managed browser: acquire() after end()");if(A!==n)throw new Error("managed browser: lease invalidated by reset()");if(e===l){if(u(h)){if(e=null,await a(l),f)throw new Error("managed browser: disconnected right after launch");continue}return{page:h.page}}}};return{openLease(){let A=n;return{acquire:()=>c(A),isValid:()=>!r&&A===n}},async reset(){n++;let A=e;e=null,A&&await a(A)},async end(){r=!0,n++;let A=e;e=null,A&&await a(A)}}}var HAe,YAe,GAe,UF=G(()=>{"use strict";VB();ko();HAe=1e4,YAe=5e3,GAe=6e4});var OF={};an(OF,{connectBrowser:()=>_c,createManagedBrowser:()=>Fo,getPlaywright:()=>Mo,launchBrowser:()=>Lo});var Ss=G(()=>{"use strict";VB();UF()});function Uc(t){if(jF.size>0&&jF.has(t))throw new nw(t)}var nw,jF,v0=G(()=>{"use strict";nw=class extends Error{constructor(e){super(`fault injected at ${e}`),this.name="FaultInjected"}},jF=new Set});var $F=G(()=>{"use strict";v0()});import{existsSync as sw,readFileSync as KF,writeFileSync as Ale,renameSync as zF,mkdirSync as lle,unlinkSync as fle}from"fs";import{join as XF,dirname as dle}from"path";var nf,ZF=G(()=>{"use strict";v0();nf=class t{sessionPath;data;constructor(e,r){this.sessionPath=e,this.data=r}static readAdapter(e){let r=XF(e,"session.json");if(!sw(r))return null;try{let n=JSON.parse(KF(r,"utf8"));return n.version===1&&typeof n.adapter=="string"?n.adapter:null}catch{return null}}static loadOrCreate(e,r,n,{resume:s=!1}={}){let i=XF(e,"session.json");if(s&&sw(i))try{let c=JSON.parse(KF(i,"utf8"));if(c.version===1&&c.adapter===r){let A=new t(i,c);return A.data.args={...c.args,...n},A}}catch{}if(sw(i))try{let c=`${i}.corrupt.${Date.now()}`;zF(i,c)}catch{try{fle(i)}catch{}}let o=new Date().toISOString(),a={version:1,adapter:r,stage:"initial",startedAt:o,updatedAt:o,args:n,progress:{},cursors:{}},u=new t(i,a);return u.save(),u}get stage(){return this.data.stage}get adapter(){return this.data.adapter}get args(){return this.data.args}get progress(){return this.data.progress}setStage(e,r){this.data.stage=e,e==="error"&&r&&(this.data.lastError=r),this.save()}getEntity(e){let r=this.data.progress[e];return r||(r={discovered:0,extracted:0,failed:0},this.data.progress[e]=r),r}bumpProgress(e,r,n=1){this.getEntity(e)[r]+=n}setDiscovered(e){for(let[r,n]of Object.entries(e))this.getEntity(r).discovered=n;this.save()}setCursor(e,r){this.data.cursors[e]=r,Uc("import-session:cursor-before-save"),this.save()}getCursor(e){return this.data.cursors[e]}save(){this.data.updatedAt=new Date().toISOString(),lle(dle(this.sessionPath),{recursive:!0});let e=this.sessionPath+".tmp";Uc("import-session:before-save"),Ale(e,JSON.stringify(this.data,null,2)),zF(e,this.sessionPath)}complete(){this.setStage("complete")}}});import{existsSync as hle,readFileSync as gle,writeFileSync as ple,renameSync as mle,mkdirSync as Ele}from"fs";import{join as Cle,dirname as Ile}from"path";function iw(t){if(!t)return t;let r=t.indexOf("/wp-content/uploads/");return r<=0?t:t.slice(r)}var Mi,e_=G(()=>{"use strict";v0();Mi=class t{storePath;data;maxAttempts;constructor(e,r,n){this.storePath=e,this.data=r,this.maxAttempts=n}static load(e,{maxAttempts:r=3}={}){let n=Cle(e,"media-stubs.json");if(hle(n))try{let s=JSON.parse(gle(n,"utf8"));if(s.version===1&&s.stubs){for(let i of Object.values(s.stubs))i.localUrl&&(i.localUrl=iw(i.localUrl));return new t(n,s,r)}}catch{}return new t(n,{version:1,stubs:{}},r)}get(e){return this.data.stubs[e]}shouldAttempt(e){let r=this.data.stubs[e];return r?!(r.status==="success"||r.status==="ignored"||r.status==="error"&&r.attempts>=this.maxAttempts):!0}dirty=!1;markSuccess(e,r,n){let s=this.data.stubs[e];this.data.stubs[e]={status:"success",attempts:(s?.attempts||0)+1,localPath:r,...n,updatedAt:new Date().toISOString()},this.dirty=!0}markFailure(e,r){let n=this.data.stubs[e];this.data.stubs[e]={status:"error",attempts:(n?.attempts||0)+1,error:r,updatedAt:new Date().toISOString()},this.save()}markIgnored(e,r){let n=this.data.stubs[e];this.data.stubs[e]={status:"ignored",attempts:n?.attempts||0,error:r,updatedAt:new Date().toISOString()},this.save()}flush(){this.dirty&&this.save()}recordWpPostId(e,r){let n=this.data.stubs[e];n&&(this.data.stubs[e]={...n,wpPostId:r,updatedAt:new Date().toISOString()},this.save())}recordLocalUrl(e,r){let n=this.data.stubs[e];n&&(this.data.stubs[e]={...n,localUrl:iw(r),updatedAt:new Date().toISOString()},this.save())}list(){return Object.entries(this.data.stubs)}counts(){let e={awaiting:0,success:0,error:0,ignored:0};for(let r of Object.values(this.data.stubs))e[r.status]++;return e}save(){Ele(Ile(this.storePath),{recursive:!0});let e=this.storePath+".tmp";ple(e,JSON.stringify(this.data,null,2)),Uc("media-stubs:mid-flush"),mle(e,this.storePath),this.dirty=!1}}});var sf=G(()=>{"use strict";$F();ZF();e_()});function M0(t){return t.includes("://")?t:`https://${t}`}var r_=G(()=>{"use strict"});function lt(t){try{return new URL(t).pathname.replace(/^\//,"").replace(/\//g,"--")||"homepage"}catch{return"homepage"}}function L0(t){let e;try{e=new URL(t).pathname}catch{return"homepage"}let r=e.split("/").filter(i=>i.length>0),n=r[r.length-1];if(!n)return"homepage";let s=wle(Ble(n));return s?yle(s):"page-1"}function yle(t){return ble.has(t)?`${t}-page`:t}function Ble(t){try{return decodeURIComponent(t)}catch{return t}}function wle(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function F0(t,e){let r=e.get(t);if(r===void 0)return e.set(t,1),t;let n=r+1;return e.set(t,n),`${t}-${n}`}var ble,n_=G(()=>{"use strict";ble=new Set(["wp-admin","wp-content","wp-includes","wp-json","feed","embed","page","attachment","comments","trackback","author","category","tag","homepage"])});var s_={};an(s_,{claimSlug:()=>F0,ensureUrlScheme:()=>M0,pageSlugFromUrl:()=>L0,slugify:()=>lt});var nn=G(()=>{"use strict";r_();n_()});var o_=x((aw,uw)=>{(function(t,e){typeof define=="function"&&define.amd?define([],e):typeof uw=="object"&&typeof aw<"u"?uw.exports=e():t.Papa=e()})(aw,function t(){"use strict";var e=(function(){return typeof self<"u"?self:typeof window<"u"?window:typeof e<"u"?e:{}})();function r(){var y=e.URL||e.webkitURL||null,w=t.toString();return a.BLOB_URL||(a.BLOB_URL=y.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",w,")();"],{type:"text/javascript"})))}var n=!e.document&&!!e.postMessage,s=e.IS_PAPA_WORKER||!1,i={},o=0,a={};if(a.parse=A,a.unparse=f,a.RECORD_SEP="",a.UNIT_SEP="",a.BYTE_ORDER_MARK="\uFEFF",a.BAD_DELIMITERS=["\r",`
+`,'"',a.BYTE_ORDER_MARK],a.WORKERS_SUPPORTED=!n&&!!e.Worker,a.NODE_STREAM_INPUT=1,a.LocalChunkSize=1024*1024*10,a.RemoteChunkSize=1024*1024*5,a.DefaultDelimiter=",",a.Parser=B,a.ParserHandle=C,a.NetworkStreamer=h,a.FileStreamer=g,a.StringStreamer=p,a.ReadableStreamStreamer=m,typeof PAPA_BROWSER_CONTEXT>"u"&&(a.DuplexStreamStreamer=E),e.jQuery){var u=e.jQuery;u.fn.parse=function(y){var w=y.config||{},_=[];return this.each(function(re){var le=u(this).prop("tagName").toUpperCase()==="INPUT"&&u(this).attr("type").toLowerCase()==="file"&&e.FileReader;if(!le||!this.files||this.files.length===0)return!0;for(var ge=0;ge"u"?(ae=new E(w),ae.getStream()):(typeof y=="string"?(y=c(y),w.download?ae=new h(w):ae=new p(w)):y.readable===!0&&Q(y.read)&&Q(y.on)?ae=new m(w):(e.File&&y instanceof File||y instanceof Object)&&(ae=new g(w)),ae.stream(y))}function f(y,w){var _=!1,J=!0,ae=",",Be=`\r
+`,re='"',le=re+re,ge=!1,ue=null,Ce=!1;Ze();var de=new RegExp(b(re),"g");if(typeof y=="string"&&(y=JSON.parse(y)),Array.isArray(y)){if(!y.length||Array.isArray(y[0]))return pe(null,y,ge);if(typeof y[0]=="object")return pe(ue||Object.keys(y[0]),y,ge)}else if(typeof y=="object")return typeof y.data=="string"&&(y.data=JSON.parse(y.data)),Array.isArray(y.data)&&(y.fields||(y.fields=y.meta&&y.meta.fields||ue),y.fields||(y.fields=Array.isArray(y.data[0])?y.fields:typeof y.data[0]=="object"?Object.keys(y.data[0]):[]),!Array.isArray(y.data[0])&&typeof y.data[0]!="object"&&(y.data=[y.data])),pe(y.fields||[],y.data||[],ge);throw new Error("Unable to serialize unrecognized input");function Ze(){if(typeof w=="object"){if(typeof w.delimiter=="string"&&!a.BAD_DELIMITERS.filter(function(ye){return w.delimiter.indexOf(ye)!==-1}).length&&(ae=w.delimiter),(typeof w.quotes=="boolean"||typeof w.quotes=="function"||Array.isArray(w.quotes))&&(_=w.quotes),(typeof w.skipEmptyLines=="boolean"||typeof w.skipEmptyLines=="string")&&(ge=w.skipEmptyLines),typeof w.newline=="string"&&(Be=w.newline),typeof w.quoteChar=="string"&&(re=w.quoteChar,le=re+re),typeof w.header=="boolean"&&(J=w.header),Array.isArray(w.columns)){if(w.columns.length===0)throw new Error("Option columns is empty");ue=w.columns}w.escapeChar!==void 0&&(le=w.escapeChar+re),w.escapeFormulae instanceof RegExp?Ce=w.escapeFormulae:typeof w.escapeFormulae=="boolean"&&w.escapeFormulae&&(Ce=/^[=+\-@\t\r].*$/)}}function pe(ye,We,nt){var st="";typeof ye=="string"&&(ye=JSON.parse(ye)),typeof We=="string"&&(We=JSON.parse(We));var Fe=Array.isArray(ye)&&ye.length>0,Oe=!Array.isArray(We[0]);if(Fe&&J){for(var Le=0;Le0&&(st+=ae),st+=ee(ye[Le],Le);We.length>0&&(st+=Be)}for(var _e=0;_e0&&!H&&(st+=ae);var Ae=Fe&&Oe?ye[z]:z;st+=ee(We[_e][Ae],z)}_e0&&!H)&&(st+=Be)}}return st}function ee(ye,We){if(typeof ye>"u"||ye===null)return"";if(ye.constructor===Date)return JSON.stringify(ye).slice(1,25);var nt=!1;Ce&&typeof ye=="string"&&Ce.test(ye)&&(ye="'"+ye,nt=!0);var st=ye.toString(),Fe=st.replace(de,le);return nt=nt||_===!0||typeof _=="function"&&_(ye,We)||Array.isArray(_)&&_[We]||we(Fe,a.BAD_DELIMITERS)||Fe.indexOf(ae)>-1||st.indexOf(re)>-1||Fe.charAt(0)===" "||Fe.charAt(Fe.length-1)===" ",nt?re+Fe+re:Fe}function we(ye,We){for(var nt=0;nt-1)return!0;return!1}}function l(y){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},w.call(this,y),this.parseChunk=function(_,J){let ae=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&ae>0){let Ce=this._config.newline;if(!Ce){let Ze=this._config.quoteChar||'"';Ce=this._handle.guessLineEndings(_,Ze)}_=[..._.split(Ce).slice(ae)].join(Ce)}if(this.isFirstChunk&&Q(this._config.beforeFirstChunk)){var Be=this._config.beforeFirstChunk(_);Be!==void 0&&(_=Be)}this.isFirstChunk=!1,this._halted=!1;var re=this._partialLine+_;this._partialLine="";var le=this._handle.parse(re,this._baseIndex,!this._finished);if(this._handle.paused()||this._handle.aborted()){this._halted=!0;return}var ge=le.meta.cursor;this._finished||(this._partialLine=re.substring(ge-this._baseIndex),this._baseIndex=ge),le&&le.data&&(this._rowCount+=le.data.length);var ue=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(s)e.postMessage({results:le,workerId:a.WORKER_ID,finished:ue});else if(Q(this._config.chunk)&&!J){if(this._config.chunk(le,this._handle),this._handle.paused()||this._handle.aborted()){this._halted=!0;return}le=void 0,this._completeResults=void 0}return!this._config.step&&!this._config.chunk&&(this._completeResults.data=this._completeResults.data.concat(le.data),this._completeResults.errors=this._completeResults.errors.concat(le.errors),this._completeResults.meta=le.meta),!this._completed&&ue&&Q(this._config.complete)&&(!le||!le.meta.aborted)&&(this._config.complete(this._completeResults,this._input),this._completed=!0),!ue&&(!le||!le.meta.paused)&&this._nextChunk(),le},this._sendError=function(_){Q(this._config.error)?this._config.error(_):s&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:_,finished:!1})};function w(_){var J=q(_);J.chunkSize=parseInt(J.chunkSize),!_.step&&!_.chunk&&(J.chunkSize=null),this._handle=new C(J),this._handle.streamer=this,this._config=J}}function h(y){y=y||{},y.chunkSize||(y.chunkSize=a.RemoteChunkSize),l.call(this,y);var w;n?this._nextChunk=function(){this._readChunk(),this._chunkLoaded()}:this._nextChunk=function(){this._readChunk()},this.stream=function(J){this._input=J,this._nextChunk()},this._readChunk=function(){if(this._finished){this._chunkLoaded();return}if(w=new XMLHttpRequest,this._config.withCredentials&&(w.withCredentials=this._config.withCredentials),n||(w.onload=Y(this._chunkLoaded,this),w.onerror=Y(this._chunkError,this)),w.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var J=this._config.downloadRequestHeaders;for(var ae in J)w.setRequestHeader(ae,J[ae])}if(this._config.chunkSize){var Be=this._start+this._config.chunkSize-1;w.setRequestHeader("Range","bytes="+this._start+"-"+Be)}try{w.send(this._config.downloadRequestBody)}catch(re){this._chunkError(re.message)}n&&w.status===0&&this._chunkError()},this._chunkLoaded=function(){if(w.readyState===4){if(w.status<200||w.status>=400){this._chunkError();return}this._start+=this._config.chunkSize?this._config.chunkSize:w.responseText.length,this._finished=!this._config.chunkSize||this._start>=_(w),this.parseChunk(w.responseText)}},this._chunkError=function(J){var ae=w.statusText||J;this._sendError(new Error(ae))};function _(J){var ae=J.getResponseHeader("Content-Range");return ae===null?-1:parseInt(ae.substring(ae.lastIndexOf("/")+1))}}h.prototype=Object.create(l.prototype),h.prototype.constructor=h;function g(y){y=y||{},y.chunkSize||(y.chunkSize=a.LocalChunkSize),l.call(this,y);var w,_,J=typeof FileReader<"u";this.stream=function(ae){this._input=ae,_=ae.slice||ae.webkitSlice||ae.mozSlice,J?(w=new FileReader,w.onload=Y(this._chunkLoaded,this),w.onerror=Y(this._chunkError,this)):w=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){!this._finished&&(!this._config.preview||this._rowCount=this._input.size,this.parseChunk(ae.target.result)},this._chunkError=function(){this._sendError(w.error)}}g.prototype=Object.create(l.prototype),g.prototype.constructor=g;function p(y){y=y||{},l.call(this,y);var w;this.stream=function(_){return w=_,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var _=this._config.chunkSize,J;return _?(J=w.substring(0,_),w=w.substring(_)):(J=w,w=""),this._finished=!w,this.parseChunk(J)}}}p.prototype=Object.create(p.prototype),p.prototype.constructor=p;function m(y){y=y||{},l.call(this,y);var w=[],_=!0,J=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(ae){this._input=ae,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){J&&w.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),w.length?this.parseChunk(w.shift()):_=!0},this._streamData=Y(function(ae){try{w.push(typeof ae=="string"?ae:ae.toString(this._config.encoding)),_&&(_=!1,this._checkIsFinished(),this.parseChunk(w.shift()))}catch(Be){this._streamError(Be)}},this),this._streamError=Y(function(ae){this._streamCleanUp(),this._sendError(ae)},this),this._streamEnd=Y(function(){this._streamCleanUp(),J=!0,this._streamData("")},this),this._streamCleanUp=Y(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}m.prototype=Object.create(l.prototype),m.prototype.constructor=m;function E(y){var w=j("stream").Duplex,_=q(y),J=!0,ae=!1,Be=[],re=null;this._onCsvData=function(le){var ge=le.data;!re.push(ge)&&!this._handle.paused()&&this._handle.pause()},this._onCsvComplete=function(){re.push(null)},_.step=Y(this._onCsvData,this),_.complete=Y(this._onCsvComplete,this),l.call(this,_),this._nextChunk=function(){ae&&Be.length===1&&(this._finished=!0),Be.length?Be.shift()():J=!0},this._addToParseQueue=function(le,ge){Be.push(Y(function(){if(this.parseChunk(typeof le=="string"?le:le.toString(_.encoding)),Q(ge))return ge()},this)),J&&(J=!1,this._nextChunk())},this._onRead=function(){this._handle.paused()&&this._handle.resume()},this._onWrite=function(le,ge,ue){this._addToParseQueue(le,ue)},this._onWriteComplete=function(){ae=!0,this._addToParseQueue("")},this.getStream=function(){return re},re=new w({readableObjectMode:!0,decodeStrings:!1,read:Y(this._onRead,this),write:Y(this._onWrite,this)}),re.once("finish",Y(this._onWriteComplete,this))}typeof PAPA_BROWSER_CONTEXT>"u"&&(E.prototype=Object.create(l.prototype),E.prototype.constructor=E);function C(y){var w=Math.pow(2,53),_=-w,J=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,ae=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,Be=this,re=0,le=0,ge,ue,Ce=!1,de=!1,Ze,pe=[],ee={data:[],errors:[],meta:{}};if(Q(y.step)){var we=y.step;y.step=function(H){if(ee=H,st())nt();else{if(nt(),ee.data.length===0)return;re+=H.data.length,y.preview&&re>y.preview?ue.abort():(ee.data=ee.data[0],we(ee,Be))}}}this.parse=function(H,V,te){var he=y.quoteChar||'"';if(y.newline||(y.newline=this.guessLineEndings(H,he)),Ze=!1,y.delimiter)Q(y.delimiter)&&(y.delimiter=y.delimiter(H),ee.meta.delimiter=y.delimiter);else{var z=P(H,y.newline,y.skipEmptyLines,y.comments,y.delimitersToGuess);z.successful?y.delimiter=z.bestDelimiter:(Ze=!0,y.delimiter=a.DefaultDelimiter),ee.meta.delimiter=y.delimiter}var Ae=q(y);return y.preview&&y.header&&Ae.preview++,ge=H,ue=new B(Ae),ee=ue.parse(ge,V,te),nt(),Ce?{meta:{paused:!0}}:ee||{meta:{paused:!1}}},this.paused=function(){return Ce},this.pause=function(){Ce=!0,ue.abort(),ge=Q(y.chunk)?"":ge.substring(ue.getCharIndex())},this.resume=function(){Be.streamer._halted?(Ce=!1,Be.streamer.parseChunk(ge,!0)):setTimeout(Be.resume,3)},this.aborted=function(){return de},this.abort=function(){de=!0,ue.abort(),ee.meta.aborted=!0,Q(y.complete)&&y.complete(ee),ge=""},this.guessLineEndings=function(H,V){H=H.substring(0,1024*1024);var te=new RegExp(b(V)+"([^]*?)"+b(V),"gm");H=H.replace(te,"");var he=H.split("\r"),z=H.split(`
+`),Ae=z.length>1&&z[0].length=he.length/2?`\r
+`:"\r"};function ye(H){return y.skipEmptyLines==="greedy"?H.join("").trim()==="":H.length===1&&H[0].length===0}function We(H){if(J.test(H)){var V=parseFloat(H);if(V>_&&V=pe.length?"__parsed_extra":pe[Ae]),y.transform&&(Pe=y.transform(Pe,Ke)),Pe=Le(Ke,Pe),Ke==="__parsed_extra"?(z[Ke]=z[Ke]||[],z[Ke].push(Pe)):z[Ke]=Pe}return y.header&&(Ae>pe.length?X("FieldMismatch","TooManyFields","Too many fields: expected "+pe.length+" fields but parsed "+Ae,le+he):Ae"u"){Pe=Xe;continue}else Xe>0&&(Ee+=Math.abs(Xe-Pe),Pe=Xe)}Ie.data.length>0&&(me/=Ie.data.length-ne),(typeof Ke>"u"||Ee<=Ke)&&(typeof O>"u"||me>O)&&me>1.99&&(Ke=Ee,Ae=K,O=me)}return y.delimiter=Ae,{successful:!!Ae,bestDelimiter:Ae}}function X(H,V,te,he){var z={type:H,code:V,message:te};he!==void 0&&(z.row=he),ee.errors.push(z)}}function b(y){return y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function B(y){y=y||{};var w=y.delimiter,_=y.newline,J=y.comments,ae=y.step,Be=y.preview,re=y.fastMode,le,ge=null,ue=!1;y.quoteChar===void 0||y.quoteChar===null?le='"':le=y.quoteChar;var Ce=le;if(y.escapeChar!==void 0&&(Ce=y.escapeChar),(typeof w!="string"||a.BAD_DELIMITERS.indexOf(w)>-1)&&(w=","),J===w)throw new Error("Comment character same as delimiter");J===!0?J="#":(typeof J!="string"||a.BAD_DELIMITERS.indexOf(J)>-1)&&(J=!1),_!==`
+`&&_!=="\r"&&_!==`\r
+`&&(_=`
+`);var de=0,Ze=!1;this.parse=function(pe,ee,we){if(typeof pe!="string")throw new Error("Input must be a string");var ye=pe.length,We=w.length,nt=_.length,st=J.length,Fe=Q(ae);de=0;var Oe=[],Le=[],_e=[],P=0;if(!pe)return ne();if(re||re!==!1&&pe.indexOf(le)===-1){for(var X=pe.split(_),H=0;H=Be)return Oe=Oe.slice(0,Be),ne(!0)}}return ne()}for(var V=pe.indexOf(w,de),te=pe.indexOf(_,de),he=new RegExp(b(Ce)+b(le),"g"),z=pe.indexOf(le,de);;){if(pe[de]===le){for(z=de,de++;;){if(z=pe.indexOf(le,z+1),z===-1)return we||Le.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Oe.length,index:de}),Ee();if(z===ye-1){var Ae=pe.substring(de,z).replace(he,le);return Ee(Ae)}if(le===Ce&&pe[z+1]===Ce){z++;continue}if(!(le!==Ce&&z!==0&&pe[z-1]===Ce)){V!==-1&&V=Be)return ne(!0);break}Le.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Oe.length,index:de}),z++}}continue}if(J&&_e.length===0&&pe.substring(de,de+st)===J){if(te===-1)return ne();de=te+nt,te=pe.indexOf(_,de),V=pe.indexOf(w,de);continue}if(V!==-1&&(V=Be)return ne(!0);continue}break}return Ee();function $(Re){Oe.push(Re),P=de}function K(Re){var Xe=0;if(Re!==-1){var Gt=pe.substring(z+1,Re);Gt&&Gt.trim()===""&&(Xe=Gt.length)}return Xe}function Ee(Re){return we||(typeof Re>"u"&&(Re=pe.substring(de)),_e.push(Re),de=ye,$(_e),Fe&&Ie()),ne()}function me(Re){de=Re,$(_e),_e=[],te=pe.indexOf(_,de)}function ne(Re){if(y.header&&!ee&&Oe.length&&!ue){let Xe=Oe[0],Gt=Object.create(null),xr=new Set(Xe),Fn=!1;for(let $e=0;$e"u"&&w&&(a.WORKER_ID=w.workerId),typeof w.input=="string")e.postMessage({workerId:a.WORKER_ID,results:a.parse(w.input,w.config),finished:!0});else if(e.File&&w.input instanceof File||w.input instanceof Object){var _=a.parse(w.input,w.config);_&&e.postMessage({workerId:a.WORKER_ID,results:_,finished:!0})}}function q(y){if(typeof y!="object"||y===null)return y;var w=Array.isArray(y)?[]:{};for(var _ in y)w[_]=q(y[_]);return w}function Y(y,w){return function(){y.apply(w,arguments)}}function Q(y){return typeof y=="function"}return a})});function Ga(t){return t.replace(/&/g,"&").replace(//g,">")}function _0(t){return Ga(t).replace(/"/g,""")}function of(t){return _0(t).replace(/'/g,"'")}var U0=G(()=>{"use strict"});var ffe,IU,lf=G(()=>{Nt();ffe="lib-coverage-island",IU=``});var bw=G(()=>{lf()});function yw(t){let e=[],r=new Set;for(let s of t.matchAll(/(?{n=n.replace(new RegExp(`(?]*>[\s\S]*?<\/script\s*>/gi,"").replace(/`).replace(/]*>[\s\S]*?(<\/body\s*>)/i,(h,g)=>`${A}${g}`);let l=rY(e,".data-liberation-mobile-document");return a(nY(t,"(min-width:769px)")).replace(/<\/head\s*>/i,`${l}`).replace(/]*>[\s\S]*?(<\/body\s*>)/i,(h,g)=>`${A}${g}`)}function Jf(t){return[...t.matchAll(/`).join("")}function nY(t,e){return t.replace(/`).replace(/]*>[\s\S]*?(<\/body\s*>)/i,(p,h)=>`${l}${h}`);let f=bIe(t,".data-liberation-mobile-document");return a(EIe(e,"(min-width:769px)")).replace(/<\/head\s*>/i,`${f}`).replace(/]*>[\s\S]*?(<\/body\s*>)/i,(p,h)=>`${l}${h}`)}function SI(e){return[...e.matchAll(/`).join("")}function EIe(e,t){return e.replace(/'
+ );
+ writeFileSync(
+ join( outputDir, 'html-mobile', 'homepage.html' ),
+ ''
+ );
+ const observation = ( viewport: number, identity: string ) => ( {
+ wrapperIdentity: `${ identity }-wrapper-0`,
+ targetIdentity: `${ identity }-target-0`,
+ viewport,
+ state: 'default' as const,
+ wrapper: { x: 0, y: 0, width: 100, height: 24 },
+ target: { x: 0, y: 0, width: 100, height: 24 },
+ simulated: { x: 0, y: 0, width: 100, height: 24 },
+ facts: { display: 'block', position: 'static', visibility: 'visible', childCount: 1 },
+ invariants: { runtime: true, semantics: true },
+ } );
+ writeFileSync(
+ join( outputDir, 'layout-geometry', 'homepage.desktop.json' ),
+ JSON.stringify( {
+ schema: 'data-liberation/layout-geometry-capture/v1',
+ observations: [ observation( 1440, 'desktop' ) ],
+ omissions: {},
+ } )
+ );
+ writeFileSync(
+ join( outputDir, 'layout-geometry', 'homepage.mobile.json' ),
+ JSON.stringify( {
+ schema: 'data-liberation/layout-geometry-capture/v1',
+ observations: [ observation( 390, 'mobile' ) ],
+ omissions: {},
+ } )
+ );
+ writeFileSync(
+ join( outputDir, 'screenshots', 'manifest.json' ),
+ JSON.stringify( {
+ version: 1,
+ entries: { 'https://example.com/': { slug: 'homepage', html: 'html/homepage.html' } },
+ } )
+ );
+ writeFileSync( join( outputDir, 'resources', 'cdn', 'site.css' ), '.desktop{display:block}' );
+ writeFileSync(
+ join( outputDir, 'resources', 'manifest.json' ),
+ JSON.stringify( {
+ version: 1,
+ resources: {
+ 'https://cdn.example/site.css': {
+ path: 'resources/cdn/site.css',
+ contentType: 'text/css',
+ },
+ },
+ failures: [],
+ } )
+ );
+
+ exportWebsiteCapture( {
+ outputDir,
+ sourceUrl: 'https://example.com/',
+ platform: 'generic',
+ summary: {},
+ failures: [],
+ } );
+ const html = readFileSync( join( outputDir, 'website', 'index.html' ), 'utf8' );
+ const artifact = JSON.parse( readFileSync( join( outputDir, 'artifact.json' ), 'utf8' ) );
+ expect( html ).not.toContain( 'data-dla-geometry-id' );
+ expect( html ).not.toContain( 'onclick=' );
+ expect( html ).not.toContain( '">