@skyramp/testbot-core 0.13.0-v3.238 → 0.13.0-v3.239

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,7 +43,7 @@ ${r.count} ${r.noun} ${r.is} pending:
43
43
 
44
44
  ${e.format(n)}
45
45
  `.trim())}};pw.exports=Hg});var Ca=T((Z3,Iw)=>{"use strict";var mw=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:PP}=pe(),OP=Di();Cw()===void 0&&Ew(new OP);function Ew(t){if(!t||typeof t.dispatch!="function")throw new PP("Argument agent must implement Agent");Object.defineProperty(globalThis,mw,{value:t,writable:!0,enumerable:!1,configurable:!1})}o(Ew,"setGlobalDispatcher");function Cw(){return globalThis[mw]}o(Cw,"getGlobalDispatcher");Iw.exports={setGlobalDispatcher:Ew,getGlobalDispatcher:Cw}});var Gc=T((e4,yw)=>{"use strict";yw.exports=class{static{o(this,"DecoratorHandler")}#e;constructor(e){if(typeof e!="object"||e===null)throw new TypeError("handler must be an object");this.#e=e}onConnect(...e){return this.#e.onConnect?.(...e)}onError(...e){return this.#e.onError?.(...e)}onUpgrade(...e){return this.#e.onUpgrade?.(...e)}onResponseStarted(...e){return this.#e.onResponseStarted?.(...e)}onHeaders(...e){return this.#e.onHeaders?.(...e)}onData(...e){return this.#e.onData?.(...e)}onComplete(...e){return this.#e.onComplete?.(...e)}onBodySent(...e){return this.#e.onBodySent?.(...e)}}});var Bw=T((n4,Qw)=>{"use strict";var GP=Ic();Qw.exports=t=>{let e=t?.maxRedirections;return n=>o(function(s,i){let{maxRedirections:a=e,...c}=s;if(!a)return n(s,i);let l=new GP(n,a,s,i);return n(c,l)},"redirectInterceptor")}});var bw=T((s4,ww)=>{"use strict";var $P=Dc();ww.exports=t=>e=>o(function(r,s){return e(r,new $P({...r,retryOptions:{...t,...r.retryOptions}},{handler:s,dispatch:e}))},"retryInterceptor")});var kw=T((o4,Rw)=>{"use strict";var YP=ue(),{InvalidArgumentError:VP,RequestAbortedError:HP}=pe(),JP=Gc(),Jg=class extends JP{static{o(this,"DumpHandler")}#e=1024*1024;#t=null;#n=!1;#s=!1;#i=0;#r=null;#o=null;constructor({maxSize:e},n){if(super(n),e!=null&&(!Number.isFinite(e)||e<1))throw new VP("maxSize must be a number greater than 0");this.#e=e??this.#e,this.#o=n}onConnect(e){this.#t=e,this.#o.onConnect(this.#a.bind(this))}#a(e){this.#s=!0,this.#r=e}onHeaders(e,n,r,s){let a=YP.parseHeaders(n)["content-length"];if(a!=null&&a>this.#e)throw new HP(`Response size (${a}) larger than maxSize (${this.#e})`);return this.#s?!0:this.#o.onHeaders(e,n,r,s)}onError(e){this.#n||(e=this.#r??e,this.#o.onError(e))}onData(e){return this.#i=this.#i+e.length,this.#i>=this.#e&&(this.#n=!0,this.#s?this.#o.onError(this.#r):this.#o.onComplete([])),!0}onComplete(e){if(!this.#n){if(this.#s){this.#o.onError(this.reason);return}this.#o.onComplete(e)}}};function qP({maxSize:t}={maxSize:1024*1024}){return e=>o(function(r,s){let{dumpMaxSize:i=t}=r,a=new Jg({maxSize:i},s);return e(r,a)},"Intercept")}o(qP,"createDumpInterceptor");Rw.exports=qP});var xw=T((A4,vw)=>{"use strict";var{isIP:jP}=require("node:net"),{lookup:WP}=require("node:dns"),zP=Gc(),{InvalidArgumentError:Oi,InformationalError:ZP}=pe(),Sw=Math.pow(2,31)-1,qg=class{static{o(this,"DNSInstance")}#e=0;#t=0;#n=new Map;dualStack=!0;affinity=null;lookup=null;pick=null;constructor(e){this.#e=e.maxTTL,this.#t=e.maxItems,this.dualStack=e.dualStack,this.affinity=e.affinity,this.lookup=e.lookup??this.#s,this.pick=e.pick??this.#i}get full(){return this.#n.size===this.#t}runLookup(e,n,r){let s=this.#n.get(e.hostname);if(s==null&&this.full){r(null,e.origin);return}let i={affinity:this.affinity,dualStack:this.dualStack,lookup:this.lookup,pick:this.pick,...n.dns,maxTTL:this.#e,maxItems:this.#t};if(s==null)this.lookup(e,i,(a,c)=>{if(a||c==null||c.length===0){r(a??new ZP("No DNS entries found"));return}this.setRecords(e,c);let l=this.#n.get(e.hostname),d=this.pick(e,l,i.affinity),h;typeof d.port=="number"?h=`:${d.port}`:e.port!==""?h=`:${e.port}`:h="",r(null,`${e.protocol}//${d.family===6?`[${d.address}]`:d.address}${h}`)});else{let a=this.pick(e,s,i.affinity);if(a==null){this.#n.delete(e.hostname),this.runLookup(e,n,r);return}let c;typeof a.port=="number"?c=`:${a.port}`:e.port!==""?c=`:${e.port}`:c="",r(null,`${e.protocol}//${a.family===6?`[${a.address}]`:a.address}${c}`)}}#s(e,n,r){WP(e.hostname,{all:!0,family:this.dualStack===!1?this.affinity:0,order:"ipv4first"},(s,i)=>{if(s)return r(s);let a=new Map;for(let c of i)a.set(`${c.address}:${c.family}`,c);r(null,a.values())})}#i(e,n,r){let s=null,{records:i,offset:a}=n,c;if(this.dualStack?(r==null&&(a==null||a===Sw?(n.offset=0,r=4):(n.offset++,r=(n.offset&1)===1?6:4)),i[r]!=null&&i[r].ips.length>0?c=i[r]:c=i[r===4?6:4]):c=i[r],c==null||c.ips.length===0)return s;c.offset==null||c.offset===Sw?c.offset=0:c.offset++;let l=c.offset%c.ips.length;return s=c.ips[l]??null,s==null?s:Date.now()-s.timestamp>s.ttl?(c.ips.splice(l,1),this.pick(e,n,r)):s}setRecords(e,n){let r=Date.now(),s={records:{4:null,6:null}};for(let i of n){i.timestamp=r,typeof i.ttl=="number"?i.ttl=Math.min(i.ttl,this.#e):i.ttl=this.#e;let a=s.records[i.family]??{ips:[]};a.ips.push(i),s.records[i.family]=a}this.#n.set(e.hostname,s)}getHandler(e,n){return new jg(this,e,n)}},jg=class extends zP{static{o(this,"DNSDispatchHandler")}#e=null;#t=null;#n=null;#s=null;#i=null;constructor(e,{origin:n,handler:r,dispatch:s},i){super(r),this.#i=n,this.#s=r,this.#t={...i},this.#e=e,this.#n=s}onError(e){switch(e.code){case"ETIMEDOUT":case"ECONNREFUSED":{if(this.#e.dualStack){this.#e.runLookup(this.#i,this.#t,(n,r)=>{if(n)return this.#s.onError(n);let s={...this.#t,origin:r};this.#n(s,this)});return}this.#s.onError(e);return}case"ENOTFOUND":this.#e.deleteRecord(this.#i);default:this.#s.onError(e);break}}};vw.exports=t=>{if(t?.maxTTL!=null&&(typeof t?.maxTTL!="number"||t?.maxTTL<0))throw new Oi("Invalid maxTTL. Must be a positive number");if(t?.maxItems!=null&&(typeof t?.maxItems!="number"||t?.maxItems<1))throw new Oi("Invalid maxItems. Must be a positive number and greater than zero");if(t?.affinity!=null&&t?.affinity!==4&&t?.affinity!==6)throw new Oi("Invalid affinity. Must be either 4 or 6");if(t?.dualStack!=null&&typeof t?.dualStack!="boolean")throw new Oi("Invalid dualStack. Must be a boolean");if(t?.lookup!=null&&typeof t?.lookup!="function")throw new Oi("Invalid lookup. Must be a function");if(t?.pick!=null&&typeof t?.pick!="function")throw new Oi("Invalid pick. Must be a function");let e=t?.dualStack??!0,n;e?n=t?.affinity??null:n=t?.affinity??4;let r={maxTTL:t?.maxTTL??1e4,lookup:t?.lookup??null,pick:t?.pick??null,dualStack:e,affinity:n,maxItems:t?.maxItems??1/0},s=new qg(r);return i=>o(function(c,l){let d=c.origin.constructor===URL?c.origin:new URL(c.origin);return jP(d.hostname)!==0?i(c,l):(s.runLookup(d,c,(h,g)=>{if(h)return l.onError(h);let f=null;f={...c,servername:d.hostname,origin:g,headers:{host:d.hostname,...c.headers}},i(f,s.getHandler({origin:d,dispatch:i,handler:l},c))}),!0)},"dnsInterceptor")}});var Bs=T((u4,Lw)=>{"use strict";var{kConstruct:KP}=ke(),{kEnumerableProperty:Gi}=ue(),{iteratorMixin:XP,isValidHeaderName:Ia,isValidHeaderValue:Tw}=Qt(),{webidl:ge}=je(),Wg=require("node:assert"),$c=require("node:util"),Pe=Symbol("headers map"),Rt=Symbol("headers map sorted");function Dw(t){return t===10||t===13||t===9||t===32}o(Dw,"isHTTPWhiteSpaceCharCode");function Nw(t){let e=0,n=t.length;for(;n>e&&Dw(t.charCodeAt(n-1));)--n;for(;n>e&&Dw(t.charCodeAt(e));)++e;return e===0&&n===t.length?t:t.substring(e,n)}o(Nw,"headerValueNormalize");function Fw(t,e){if(Array.isArray(e))for(let n=0;n<e.length;++n){let r=e[n];if(r.length!==2)throw ge.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${r.length}.`});zg(t,r[0],r[1])}else if(typeof e=="object"&&e!==null){let n=Object.keys(e);for(let r=0;r<n.length;++r)zg(t,n[r],e[n[r]])}else throw ge.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})}o(Fw,"fill");function zg(t,e,n){if(n=Nw(n),Ia(e)){if(!Tw(n))throw ge.errors.invalidArgument({prefix:"Headers.append",value:n,type:"header value"})}else throw ge.errors.invalidArgument({prefix:"Headers.append",value:e,type:"header name"});if(Mw(t)==="immutable")throw new TypeError("immutable");return Zg(t).append(e,n,!1)}o(zg,"appendHeader");function Uw(t,e){return t[0]<e[0]?-1:1}o(Uw,"compareHeaderName");var Yc=class t{static{o(this,"HeadersList")}cookies=null;constructor(e){e instanceof t?(this[Pe]=new Map(e[Pe]),this[Rt]=e[Rt],this.cookies=e.cookies===null?null:[...e.cookies]):(this[Pe]=new Map(e),this[Rt]=null)}contains(e,n){return this[Pe].has(n?e:e.toLowerCase())}clear(){this[Pe].clear(),this[Rt]=null,this.cookies=null}append(e,n,r){this[Rt]=null;let s=r?e:e.toLowerCase(),i=this[Pe].get(s);if(i){let a=s==="cookie"?"; ":", ";this[Pe].set(s,{name:i.name,value:`${i.value}${a}${n}`})}else this[Pe].set(s,{name:e,value:n});s==="set-cookie"&&(this.cookies??=[]).push(n)}set(e,n,r){this[Rt]=null;let s=r?e:e.toLowerCase();s==="set-cookie"&&(this.cookies=[n]),this[Pe].set(s,{name:e,value:n})}delete(e,n){this[Rt]=null,n||(e=e.toLowerCase()),e==="set-cookie"&&(this.cookies=null),this[Pe].delete(e)}get(e,n){return this[Pe].get(n?e:e.toLowerCase())?.value??null}*[Symbol.iterator](){for(let{0:e,1:{value:n}}of this[Pe])yield[e,n]}get entries(){let e={};if(this[Pe].size!==0)for(let{name:n,value:r}of this[Pe].values())e[n]=r;return e}rawValues(){return this[Pe].values()}get entriesList(){let e=[];if(this[Pe].size!==0)for(let{0:n,1:{name:r,value:s}}of this[Pe])if(n==="set-cookie")for(let i of this.cookies)e.push([r,i]);else e.push([r,s]);return e}toSortedArray(){let e=this[Pe].size,n=new Array(e);if(e<=32){if(e===0)return n;let r=this[Pe][Symbol.iterator](),s=r.next().value;n[0]=[s[0],s[1].value],Wg(s[1].value!==null);for(let i=1,a=0,c=0,l=0,d=0,h,g;i<e;++i){for(g=r.next().value,h=n[i]=[g[0],g[1].value],Wg(h[1]!==null),l=0,c=i;l<c;)d=l+(c-l>>1),n[d][0]<=h[0]?l=d+1:c=d;if(i!==d){for(a=i;a>l;)n[a]=n[--a];n[l]=h}}if(!r.next().done)throw new TypeError("Unreachable");return n}else{let r=0;for(let{0:s,1:{value:i}}of this[Pe])n[r++]=[s,i],Wg(i!==null);return n.sort(Uw)}}},rn=class t{static{o(this,"Headers")}#e;#t;constructor(e=void 0){ge.util.markAsUncloneable(this),e!==KP&&(this.#t=new Yc,this.#e="none",e!==void 0&&(e=ge.converters.HeadersInit(e,"Headers contructor","init"),Fw(this,e)))}append(e,n){ge.brandCheck(this,t),ge.argumentLengthCheck(arguments,2,"Headers.append");let r="Headers.append";return e=ge.converters.ByteString(e,r,"name"),n=ge.converters.ByteString(n,r,"value"),zg(this,e,n)}delete(e){if(ge.brandCheck(this,t),ge.argumentLengthCheck(arguments,1,"Headers.delete"),e=ge.converters.ByteString(e,"Headers.delete","name"),!Ia(e))throw ge.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){ge.brandCheck(this,t),ge.argumentLengthCheck(arguments,1,"Headers.get");let n="Headers.get";if(e=ge.converters.ByteString(e,n,"name"),!Ia(e))throw ge.errors.invalidArgument({prefix:n,value:e,type:"header name"});return this.#t.get(e,!1)}has(e){ge.brandCheck(this,t),ge.argumentLengthCheck(arguments,1,"Headers.has");let n="Headers.has";if(e=ge.converters.ByteString(e,n,"name"),!Ia(e))throw ge.errors.invalidArgument({prefix:n,value:e,type:"header name"});return this.#t.contains(e,!1)}set(e,n){ge.brandCheck(this,t),ge.argumentLengthCheck(arguments,2,"Headers.set");let r="Headers.set";if(e=ge.converters.ByteString(e,r,"name"),n=ge.converters.ByteString(n,r,"value"),n=Nw(n),Ia(e)){if(!Tw(n))throw ge.errors.invalidArgument({prefix:r,value:n,type:"header value"})}else throw ge.errors.invalidArgument({prefix:r,value:e,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.set(e,n,!1)}getSetCookie(){ge.brandCheck(this,t);let e=this.#t.cookies;return e?[...e]:[]}get[Rt](){if(this.#t[Rt])return this.#t[Rt];let e=[],n=this.#t.toSortedArray(),r=this.#t.cookies;if(r===null||r.length===1)return this.#t[Rt]=n;for(let s=0;s<n.length;++s){let{0:i,1:a}=n[s];if(i==="set-cookie")for(let c=0;c<r.length;++c)e.push([i,r[c]]);else e.push([i,a])}return this.#t[Rt]=e}[$c.inspect.custom](e,n){return n.depth??=e,`Headers ${$c.formatWithOptions(n,this.#t.entries)}`}static getHeadersGuard(e){return e.#e}static setHeadersGuard(e,n){e.#e=n}static getHeadersList(e){return e.#t}static setHeadersList(e,n){e.#t=n}},{getHeadersGuard:Mw,setHeadersGuard:eO,getHeadersList:Zg,setHeadersList:tO}=rn;Reflect.deleteProperty(rn,"getHeadersGuard");Reflect.deleteProperty(rn,"setHeadersGuard");Reflect.deleteProperty(rn,"getHeadersList");Reflect.deleteProperty(rn,"setHeadersList");XP("Headers",rn,Rt,0,1);Object.defineProperties(rn.prototype,{append:Gi,delete:Gi,get:Gi,has:Gi,set:Gi,getSetCookie:Gi,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[$c.inspect.custom]:{enumerable:!1}});ge.converters.HeadersInit=function(t,e,n){if(ge.util.Type(t)==="Object"){let r=Reflect.get(t,Symbol.iterator);if(!$c.types.isProxy(t)&&r===rn.prototype.entries)try{return Zg(t).entriesList}catch{}return typeof r=="function"?ge.converters["sequence<sequence<ByteString>>"](t,e,n,r.bind(t)):ge.converters["record<ByteString, ByteString>"](t,e,n)}throw ge.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})};Lw.exports={fill:Fw,compareHeaderName:Uw,Headers:rn,HeadersList:Yc,getHeadersGuard:Mw,setHeadersGuard:eO,setHeadersList:tO,getHeadersList:Zg}});var Qa=T((d4,Ww)=>{"use strict";var{Headers:Yw,HeadersList:_w,fill:nO,getHeadersGuard:rO,setHeadersGuard:Vw,setHeadersList:Hw}=Bs(),{extractBody:Pw,cloneBody:sO,mixinBody:iO,hasFinalizationRegistry:Jw,streamRegistry:qw,bodyUnusable:oO}=Qi(),Kg=ue(),Ow=require("node:util"),{kEnumerableProperty:kt}=Kg,{isValidReasonPhrase:aO,isCancelled:AO,isAborted:cO,isBlobLike:uO,serializeJavascriptValueToJSONString:lO,isErrorLike:dO,isomorphicEncode:hO,environmentSettingsObject:gO}=Qt(),{redirectStatusSet:pO,nullBodyStatus:fO}=Vo(),{kState:ve,kHeaders:jn}=pr(),{webidl:oe}=je(),{FormData:mO}=zo(),{URLSerializer:Gw}=ht(),{kConstruct:Hc}=ke(),Xg=require("node:assert"),{types:EO}=require("node:util"),CO=new TextEncoder("utf-8"),ws=class t{static{o(this,"Response")}static error(){return ya(Jc(),"immutable")}static json(e,n={}){oe.argumentLengthCheck(arguments,1,"Response.json"),n!==null&&(n=oe.converters.ResponseInit(n));let r=CO.encode(lO(e)),s=Pw(r),i=ya($i({}),"response");return $w(i,n,{body:s[0],type:"application/json"}),i}static redirect(e,n=302){oe.argumentLengthCheck(arguments,1,"Response.redirect"),e=oe.converters.USVString(e),n=oe.converters["unsigned short"](n);let r;try{r=new URL(e,gO.settingsObject.baseUrl)}catch(a){throw new TypeError(`Failed to parse URL from ${e}`,{cause:a})}if(!pO.has(n))throw new RangeError(`Invalid status code ${n}`);let s=ya($i({}),"immutable");s[ve].status=n;let i=hO(Gw(r));return s[ve].headersList.append("location",i,!0),s}constructor(e=null,n={}){if(oe.util.markAsUncloneable(this),e===Hc)return;e!==null&&(e=oe.converters.BodyInit(e)),n=oe.converters.ResponseInit(n),this[ve]=$i({}),this[jn]=new Yw(Hc),Vw(this[jn],"response"),Hw(this[jn],this[ve].headersList);let r=null;if(e!=null){let[s,i]=Pw(e);r={body:s,type:i}}$w(this,n,r)}get type(){return oe.brandCheck(this,t),this[ve].type}get url(){oe.brandCheck(this,t);let e=this[ve].urlList,n=e[e.length-1]??null;return n===null?"":Gw(n,!0)}get redirected(){return oe.brandCheck(this,t),this[ve].urlList.length>1}get status(){return oe.brandCheck(this,t),this[ve].status}get ok(){return oe.brandCheck(this,t),this[ve].status>=200&&this[ve].status<=299}get statusText(){return oe.brandCheck(this,t),this[ve].statusText}get headers(){return oe.brandCheck(this,t),this[jn]}get body(){return oe.brandCheck(this,t),this[ve].body?this[ve].body.stream:null}get bodyUsed(){return oe.brandCheck(this,t),!!this[ve].body&&Kg.isDisturbed(this[ve].body.stream)}clone(){if(oe.brandCheck(this,t),oO(this))throw oe.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let e=ep(this[ve]);return Jw&&this[ve].body?.stream&&qw.register(this,new WeakRef(this[ve].body.stream)),ya(e,rO(this[jn]))}[Ow.inspect.custom](e,n){n.depth===null&&(n.depth=2),n.colors??=!0;let r={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 ${Ow.formatWithOptions(n,r)}`}};iO(ws);Object.defineProperties(ws.prototype,{type:kt,url:kt,status:kt,ok:kt,redirected:kt,statusText:kt,headers:kt,clone:kt,body:kt,bodyUsed:kt,[Symbol.toStringTag]:{value:"Response",configurable:!0}});Object.defineProperties(ws,{json:kt,redirect:kt,error:kt});function ep(t){if(t.internalResponse)return jw(ep(t.internalResponse),t.type);let e=$i({...t,body:null});return t.body!=null&&(e.body=sO(e,t.body)),e}o(ep,"cloneResponse");function $i(t){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...t,headersList:t?.headersList?new _w(t?.headersList):new _w,urlList:t?.urlList?[...t.urlList]:[]}}o($i,"makeResponse");function Jc(t){let e=dO(t);return $i({type:"error",status:0,error:e?t:new Error(t&&String(t)),aborted:t&&t.name==="AbortError"})}o(Jc,"makeNetworkError");function IO(t){return t.type==="error"&&t.status===0}o(IO,"isNetworkError");function Vc(t,e){return e={internalResponse:t,...e},new Proxy(t,{get(n,r){return r in e?e[r]:n[r]},set(n,r,s){return Xg(!(r in e)),n[r]=s,!0}})}o(Vc,"makeFilteredResponse");function jw(t,e){if(e==="basic")return Vc(t,{type:"basic",headersList:t.headersList});if(e==="cors")return Vc(t,{type:"cors",headersList:t.headersList});if(e==="opaque")return Vc(t,{type:"opaque",urlList:Object.freeze([]),status:0,statusText:"",body:null});if(e==="opaqueredirect")return Vc(t,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});Xg(!1)}o(jw,"filterResponse");function yO(t,e=null){return Xg(AO(t)),cO(t)?Jc(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:e})):Jc(Object.assign(new DOMException("Request was cancelled."),{cause:e}))}o(yO,"makeAppropriateNetworkError");function $w(t,e,n){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&&!aO(String(e.statusText)))throw new TypeError("Invalid statusText");if("status"in e&&e.status!=null&&(t[ve].status=e.status),"statusText"in e&&e.statusText!=null&&(t[ve].statusText=e.statusText),"headers"in e&&e.headers!=null&&nO(t[jn],e.headers),n){if(fO.includes(t.status))throw oe.errors.exception({header:"Response constructor",message:`Invalid response status code ${t.status}`});t[ve].body=n.body,n.type!=null&&!t[ve].headersList.contains("content-type",!0)&&t[ve].headersList.append("content-type",n.type,!0)}}o($w,"initializeResponse");function ya(t,e){let n=new ws(Hc);return n[ve]=t,n[jn]=new Yw(Hc),Hw(n[jn],t.headersList),Vw(n[jn],e),Jw&&t.body?.stream&&qw.register(n,new WeakRef(t.body.stream)),n}o(ya,"fromInnerResponse");oe.converters.ReadableStream=oe.interfaceConverter(ReadableStream);oe.converters.FormData=oe.interfaceConverter(mO);oe.converters.URLSearchParams=oe.interfaceConverter(URLSearchParams);oe.converters.XMLHttpRequestBodyInit=function(t,e,n){return typeof t=="string"?oe.converters.USVString(t,e,n):uO(t)?oe.converters.Blob(t,e,n,{strict:!1}):ArrayBuffer.isView(t)||EO.isArrayBuffer(t)?oe.converters.BufferSource(t,e,n):Kg.isFormDataLike(t)?oe.converters.FormData(t,e,n,{strict:!1}):t instanceof URLSearchParams?oe.converters.URLSearchParams(t,e,n):oe.converters.DOMString(t,e,n)};oe.converters.BodyInit=function(t,e,n){return t instanceof ReadableStream?oe.converters.ReadableStream(t,e,n):t?.[Symbol.asyncIterator]?t:oe.converters.XMLHttpRequestBodyInit(t,e,n)};oe.converters.ResponseInit=oe.dictionaryConverter([{key:"status",converter:oe.converters["unsigned short"],defaultValue:o(()=>200,"defaultValue")},{key:"statusText",converter:oe.converters.ByteString,defaultValue:o(()=>"","defaultValue")},{key:"headers",converter:oe.converters.HeadersInit}]);Ww.exports={isNetworkError:IO,makeNetworkError:Jc,makeResponse:$i,makeAppropriateNetworkError:yO,filterResponse:jw,Response:ws,cloneResponse:ep,fromInnerResponse:ya}});var Xw=T((g4,Kw)=>{"use strict";var{kConnected:zw,kSize:Zw}=ke(),tp=class{static{o(this,"CompatWeakRef")}constructor(e){this.value=e}deref(){return this.value[zw]===0&&this.value[Zw]===0?void 0:this.value}},np=class{static{o(this,"CompatFinalizer")}constructor(e){this.finalizer=e}register(e,n){e.on&&e.on("disconnect",()=>{e[zw]===0&&e[Zw]===0&&this.finalizer(n)})}unregister(e){}};Kw.exports=function(){return process.env.NODE_V8_COVERAGE&&process.version.startsWith("v18")?(process._rawDebug("Using compatibility WeakRef and FinalizationRegistry"),{WeakRef:tp,FinalizationRegistry:np}):{WeakRef,FinalizationRegistry}}});var Yi=T((f4,gb)=>{"use strict";var{extractBody:QO,mixinBody:BO,cloneBody:wO,bodyUnusable:eb}=Qi(),{Headers:cb,fill:bO,HeadersList:zc,setHeadersGuard:sp,getHeadersGuard:RO,setHeadersList:ub,getHeadersList:tb}=Bs(),{FinalizationRegistry:kO}=Xw()(),jc=ue(),nb=require("node:util"),{isValidHTTPToken:SO,sameOrigin:rb,environmentSettingsObject:qc}=Qt(),{forbiddenMethodsSet:vO,corsSafeListedMethodsSet:xO,referrerPolicy:DO,requestRedirect:TO,requestMode:NO,requestCredentials:FO,requestCache:UO,requestDuplex:MO}=Vo(),{kEnumerableProperty:Oe,normalizedMethodRecordsBase:LO,normalizedMethodRecords:_O}=jc,{kHeaders:St,kSignal:Wc,kState:Re,kDispatcher:rp}=pr(),{webidl:X}=je(),{URLSerializer:PO}=ht(),{kConstruct:Zc}=ke(),OO=require("node:assert"),{getMaxListeners:sb,setMaxListeners:ib,getEventListeners:GO,defaultMaxListeners:ob}=require("node:events"),$O=Symbol("abortController"),lb=new kO(({signal:t,abort:e})=>{t.removeEventListener("abort",e)}),Kc=new WeakMap;function ab(t){return e;function e(){let n=t.deref();if(n!==void 0){lb.unregister(e),this.removeEventListener("abort",e),n.abort(this.reason);let r=Kc.get(n.signal);if(r!==void 0){if(r.size!==0){for(let s of r){let i=s.deref();i!==void 0&&i.abort(this.reason)}r.clear()}Kc.delete(n.signal)}}}}o(ab,"buildAbort");var Ab=!1,Rr=class t{static{o(this,"Request")}constructor(e,n={}){if(X.util.markAsUncloneable(this),e===Zc)return;let r="Request constructor";X.argumentLengthCheck(arguments,1,r),e=X.converters.RequestInfo(e,r,"input"),n=X.converters.RequestInit(n,r,"init");let s=null,i=null,a=qc.settingsObject.baseUrl,c=null;if(typeof e=="string"){this[rp]=n.dispatcher;let Q;try{Q=new URL(e,a)}catch(D){throw new TypeError("Failed to parse URL from "+e,{cause:D})}if(Q.username||Q.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+e);s=Xc({urlList:[Q]}),i="cors"}else this[rp]=n.dispatcher||e[rp],OO(e instanceof t),s=e[Re],c=e[Wc];let l=qc.settingsObject.origin,d="client";if(s.window?.constructor?.name==="EnvironmentSettingsObject"&&rb(s.window,l)&&(d=s.window),n.window!=null)throw new TypeError(`'window' option '${d}' must be null`);"window"in n&&(d="no-window"),s=Xc({method:s.method,headersList:s.headersList,unsafeRequest:s.unsafeRequest,client:qc.settingsObject,window:d,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 h=Object.keys(n).length!==0;if(h&&(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]),n.referrer!==void 0){let Q=n.referrer;if(Q==="")s.referrer="no-referrer";else{let D;try{D=new URL(Q,a)}catch(G){throw new TypeError(`Referrer "${Q}" is not a valid URL.`,{cause:G})}D.protocol==="about:"&&D.hostname==="client"||l&&!rb(D,qc.settingsObject.baseUrl)?s.referrer="client":s.referrer=D}}n.referrerPolicy!==void 0&&(s.referrerPolicy=n.referrerPolicy);let g;if(n.mode!==void 0?g=n.mode:g=i,g==="navigate")throw X.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(g!=null&&(s.mode=g),n.credentials!==void 0&&(s.credentials=n.credentials),n.cache!==void 0&&(s.cache=n.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(n.redirect!==void 0&&(s.redirect=n.redirect),n.integrity!=null&&(s.integrity=String(n.integrity)),n.keepalive!==void 0&&(s.keepalive=!!n.keepalive),n.method!==void 0){let Q=n.method,D=_O[Q];if(D!==void 0)s.method=D;else{if(!SO(Q))throw new TypeError(`'${Q}' is not a valid HTTP method.`);let G=Q.toUpperCase();if(vO.has(G))throw new TypeError(`'${Q}' HTTP method is unsupported.`);Q=LO[G]??Q,s.method=Q}!Ab&&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"}),Ab=!0)}n.signal!==void 0&&(c=n.signal),this[Re]=s;let f=new AbortController;if(this[Wc]=f.signal,c!=null){if(!c||typeof c.aborted!="boolean"||typeof c.addEventListener!="function")throw new TypeError("Failed to construct 'Request': member signal is not of type AbortSignal.");if(c.aborted)f.abort(c.reason);else{this[$O]=f;let Q=new WeakRef(f),D=ab(Q);try{(typeof sb=="function"&&sb(c)===ob||GO(c,"abort").length>=ob)&&ib(1500,c)}catch{}jc.addAbortListener(c,D),lb.register(f,{signal:c,abort:D},D)}}if(this[St]=new cb(Zc),ub(this[St],s.headersList),sp(this[St],"request"),g==="no-cors"){if(!xO.has(s.method))throw new TypeError(`'${s.method} is unsupported in no-cors mode.`);sp(this[St],"request-no-cors")}if(h){let Q=tb(this[St]),D=n.headers!==void 0?n.headers:new zc(Q);if(Q.clear(),D instanceof zc){for(let{name:G,value:P}of D.rawValues())Q.append(G,P,!1);Q.cookies=D.cookies}else bO(this[St],D)}let m=e instanceof t?e[Re].body:null;if((n.body!=null||m!=null)&&(s.method==="GET"||s.method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body.");let C=null;if(n.body!=null){let[Q,D]=QO(n.body,s.keepalive);C=Q,D&&!tb(this[St]).contains("content-type",!0)&&this[St].append("content-type",D)}let y=C??m;if(y!=null&&y.source==null){if(C!=null&&n.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 R=y;if(C==null&&m!=null){if(eb(e))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");let Q=new TransformStream;m.stream.pipeThrough(Q),R={source:m.source,length:m.length,stream:Q.readable}}this[Re].body=R}get method(){return X.brandCheck(this,t),this[Re].method}get url(){return X.brandCheck(this,t),PO(this[Re].url)}get headers(){return X.brandCheck(this,t),this[St]}get destination(){return X.brandCheck(this,t),this[Re].destination}get referrer(){return X.brandCheck(this,t),this[Re].referrer==="no-referrer"?"":this[Re].referrer==="client"?"about:client":this[Re].referrer.toString()}get referrerPolicy(){return X.brandCheck(this,t),this[Re].referrerPolicy}get mode(){return X.brandCheck(this,t),this[Re].mode}get credentials(){return this[Re].credentials}get cache(){return X.brandCheck(this,t),this[Re].cache}get redirect(){return X.brandCheck(this,t),this[Re].redirect}get integrity(){return X.brandCheck(this,t),this[Re].integrity}get keepalive(){return X.brandCheck(this,t),this[Re].keepalive}get isReloadNavigation(){return X.brandCheck(this,t),this[Re].reloadNavigation}get isHistoryNavigation(){return X.brandCheck(this,t),this[Re].historyNavigation}get signal(){return X.brandCheck(this,t),this[Wc]}get body(){return X.brandCheck(this,t),this[Re].body?this[Re].body.stream:null}get bodyUsed(){return X.brandCheck(this,t),!!this[Re].body&&jc.isDisturbed(this[Re].body.stream)}get duplex(){return X.brandCheck(this,t),"half"}clone(){if(X.brandCheck(this,t),eb(this))throw new TypeError("unusable");let e=db(this[Re]),n=new AbortController;if(this.signal.aborted)n.abort(this.signal.reason);else{let r=Kc.get(this.signal);r===void 0&&(r=new Set,Kc.set(this.signal,r));let s=new WeakRef(n);r.add(s),jc.addAbortListener(n.signal,ab(s))}return hb(e,n.signal,RO(this[St]))}[nb.inspect.custom](e,n){n.depth===null&&(n.depth=2),n.colors??=!0;let r={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 ${nb.formatWithOptions(n,r)}`}};BO(Rr);function Xc(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,urlList:t.urlList,url:t.urlList[0],headersList:t.headersList?new zc(t.headersList):new zc}}o(Xc,"makeRequest");function db(t){let e=Xc({...t,body:null});return t.body!=null&&(e.body=wO(e,t.body)),e}o(db,"cloneRequest");function hb(t,e,n){let r=new Rr(Zc);return r[Re]=t,r[Wc]=e,r[St]=new cb(Zc),ub(r[St],t.headersList),sp(r[St],n),r}o(hb,"fromInnerRequest");Object.defineProperties(Rr.prototype,{method:Oe,url:Oe,headers:Oe,redirect:Oe,clone:Oe,signal:Oe,duplex:Oe,destination:Oe,body:Oe,bodyUsed:Oe,isHistoryNavigation:Oe,isReloadNavigation:Oe,keepalive:Oe,integrity:Oe,cache:Oe,credentials:Oe,attribute:Oe,referrerPolicy:Oe,referrer:Oe,mode:Oe,[Symbol.toStringTag]:{value:"Request",configurable:!0}});X.converters.Request=X.interfaceConverter(Rr);X.converters.RequestInfo=function(t,e,n){return typeof t=="string"?X.converters.USVString(t,e,n):t instanceof Rr?X.converters.Request(t,e,n):X.converters.USVString(t,e,n)};X.converters.AbortSignal=X.interfaceConverter(AbortSignal);X.converters.RequestInit=X.dictionaryConverter([{key:"method",converter:X.converters.ByteString},{key:"headers",converter:X.converters.HeadersInit},{key:"body",converter:X.nullableConverter(X.converters.BodyInit)},{key:"referrer",converter:X.converters.USVString},{key:"referrerPolicy",converter:X.converters.DOMString,allowedValues:DO},{key:"mode",converter:X.converters.DOMString,allowedValues:NO},{key:"credentials",converter:X.converters.DOMString,allowedValues:FO},{key:"cache",converter:X.converters.DOMString,allowedValues:UO},{key:"redirect",converter:X.converters.DOMString,allowedValues:TO},{key:"integrity",converter:X.converters.DOMString},{key:"keepalive",converter:X.converters.boolean},{key:"signal",converter:X.nullableConverter(t=>X.converters.AbortSignal(t,"RequestInit","signal",{strict:!1}))},{key:"window",converter:X.converters.any},{key:"duplex",converter:X.converters.DOMString,allowedValues:MO},{key:"dispatcher",converter:X.converters.any}]);gb.exports={Request:Rr,makeRequest:Xc,fromInnerRequest:hb,cloneRequest:db}});var wa=T((E4,vb)=>{"use strict";var{makeNetworkError:ye,makeAppropriateNetworkError:eu,filterResponse:ip,makeResponse:tu,fromInnerResponse:YO}=Qa(),{HeadersList:pb}=Bs(),{Request:VO,cloneRequest:HO}=Yi(),kr=require("node:zlib"),{bytesMatch:JO,makePolicyContainer:qO,clonePolicyContainer:jO,requestBadPort:WO,TAOCheck:zO,appendRequestOriginHeader:ZO,responseLocationURL:KO,requestCurrentURL:bn,setRequestReferrerPolicyOnRedirect:XO,tryUpgradeRequestToAPotentiallyTrustworthyURL:e1,createOpaqueTimingInfo:up,appendFetchMetadata:t1,corsCheck:n1,crossOriginResourcePolicyCheck:r1,determineRequestsReferrer:s1,coarsenedSharedCurrentTime:Ba,createDeferredPromise:i1,isBlobLike:o1,sameOrigin:cp,isCancelled:bs,isAborted:fb,isErrorLike:a1,fullyReadBody:A1,readableStreamClose:c1,isomorphicEncode:nu,urlIsLocal:u1,urlIsHttpHttpsScheme:lp,urlHasHttpsScheme:l1,clampAndCoarsenConnectionTimingInfo:d1,simpleRangeHeaderValue:h1,buildContentRange:g1,createInflate:p1,extractMimeType:f1}=Qt(),{kState:Ib,kDispatcher:m1}=pr(),Rs=require("node:assert"),{safelyExtractBody:dp,extractBody:mb}=Qi(),{redirectStatusSet:yb,nullBodyStatus:Qb,safeMethodsSet:E1,requestBodyHeader:C1,subresourceSet:I1}=Vo(),y1=require("node:events"),{Readable:Q1,pipeline:B1,finished:w1}=require("node:stream"),{addAbortListener:b1,isErrored:R1,isReadable:ru,bufferToLowerCasedHeaderName:Eb}=ue(),{dataURLProcessor:k1,serializeAMimeType:S1,minimizeSupportedMimeType:v1}=ht(),{getGlobalDispatcher:x1}=Ca(),{webidl:D1}=je(),{STATUS_CODES:T1}=require("node:http"),N1=["GET","HEAD"],F1=typeof __UNDICI_IS_NODE__<"u"||typeof esbuildDetection<"u"?"node":"undici",op,su=class extends y1{static{o(this,"Fetch")}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 U1(t){Bb(t,"fetch")}o(U1,"handleFetchDone");function M1(t,e=void 0){D1.argumentLengthCheck(arguments,1,"globalThis.fetch");let n=i1(),r;try{r=new VO(t,e)}catch(h){return n.reject(h),n.promise}let s=r[Ib];if(r.signal.aborted)return ap(n,s,null,r.signal.reason),n.promise;s.client.globalObject?.constructor?.name==="ServiceWorkerGlobalScope"&&(s.serviceWorkers="none");let a=null,c=!1,l=null;return b1(r.signal,()=>{c=!0,Rs(l!=null),l.abort(r.signal.reason);let h=a?.deref();ap(n,s,h,r.signal.reason)}),l=bb({request:s,processResponseEndOfBody:U1,processResponse:o(h=>{if(!c){if(h.aborted){ap(n,s,a,l.serializedAbortReason);return}if(h.type==="error"){n.reject(new TypeError("fetch failed",{cause:h.error}));return}a=new WeakRef(YO(h,"immutable")),n.resolve(a.deref()),n=null}},"processResponse"),dispatcher:r[m1]}),n.promise}o(M1,"fetch");function Bb(t,e="other"){if(t.type==="error"&&t.aborted||!t.urlList?.length)return;let n=t.urlList[0],r=t.timingInfo,s=t.cacheState;lp(n)&&r!==null&&(t.timingAllowPassed||(r=up({startTime:r.startTime}),s=""),r.endTime=Ba(),t.timingInfo=r,wb(r,n.href,e,globalThis,s))}o(Bb,"finalizeAndReportTiming");var wb=performance.markResourceTiming;function ap(t,e,n,r){if(t&&t.reject(r),e.body!=null&&ru(e.body?.stream)&&e.body.stream.cancel(r).catch(i=>{if(i.code!=="ERR_INVALID_STATE")throw i}),n==null)return;let s=n[Ib];s.body!=null&&ru(s.body?.stream)&&s.body.stream.cancel(r).catch(i=>{if(i.code!=="ERR_INVALID_STATE")throw i})}o(ap,"abortFetch");function bb({request:t,processRequestBodyChunkLength:e,processRequestEndOfBody:n,processResponse:r,processResponseEndOfBody:s,processResponseConsumeBody:i,useParallelQueue:a=!1,dispatcher:c=x1()}){Rs(c);let l=null,d=!1;t.client!=null&&(l=t.client.globalObject,d=t.client.crossOriginIsolatedCapability);let h=Ba(d),g=up({startTime:h}),f={controller:new su(c),request:t,timingInfo:g,processRequestBodyChunkLength:e,processRequestEndOfBody:n,processResponse:r,processResponseConsumeBody:i,processResponseEndOfBody:s,taskDestination:l,crossOriginIsolatedCapability:d};return Rs(!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=jO(t.client.policyContainer):t.policyContainer=qO()),t.headersList.contains("accept",!0)||t.headersList.append("accept","*/*",!0),t.headersList.contains("accept-language",!0)||t.headersList.append("accept-language","*",!0),t.priority,I1.has(t.destination),Rb(f).catch(m=>{f.controller.terminate(m)}),f.controller}o(bb,"fetching");async function Rb(t,e=!1){let n=t.request,r=null;if(n.localURLsOnly&&!u1(bn(n))&&(r=ye("local URLs only")),e1(n),WO(n)==="blocked"&&(r=ye("bad port")),n.referrerPolicy===""&&(n.referrerPolicy=n.policyContainer.referrerPolicy),n.referrer!=="no-referrer"&&(n.referrer=s1(n)),r===null&&(r=await(async()=>{let i=bn(n);return cp(i,n.url)&&n.responseTainting==="basic"||i.protocol==="data:"||n.mode==="navigate"||n.mode==="websocket"?(n.responseTainting="basic",await Cb(t)):n.mode==="same-origin"?ye('request mode cannot be "same-origin"'):n.mode==="no-cors"?n.redirect!=="follow"?ye('redirect mode cannot be "follow" for "no-cors" request'):(n.responseTainting="opaque",await Cb(t)):lp(bn(n))?(n.responseTainting="cors",await kb(t)):ye("URL scheme must be a HTTP(S) scheme")})()),e)return r;r.status!==0&&!r.internalResponse&&(n.responseTainting,n.responseTainting==="basic"?r=ip(r,"basic"):n.responseTainting==="cors"?r=ip(r,"cors"):n.responseTainting==="opaque"?r=ip(r,"opaque"):Rs(!1));let s=r.status===0?r:r.internalResponse;if(s.urlList.length===0&&s.urlList.push(...n.urlList),n.timingAllowFailed||(r.timingAllowPassed=!0),r.type==="opaque"&&s.status===206&&s.rangeRequested&&!n.headers.contains("range",!0)&&(r=s=ye()),r.status!==0&&(n.method==="HEAD"||n.method==="CONNECT"||Qb.includes(s.status))&&(s.body=null,t.controller.dump=!0),n.integrity){let i=o(c=>Ap(t,ye(c)),"processBodyError");if(n.responseTainting==="opaque"||r.body==null){i(r.error);return}let a=o(c=>{if(!JO(c,n.integrity)){i("integrity mismatch");return}r.body=dp(c)[0],Ap(t,r)},"processBody");await A1(r.body,a,i)}else Ap(t,r)}o(Rb,"mainFetch");function Cb(t){if(bs(t)&&t.request.redirectCount===0)return Promise.resolve(eu(t));let{request:e}=t,{protocol:n}=bn(e);switch(n){case"about:":return Promise.resolve(ye("about scheme is not supported"));case"blob:":{op||(op=require("node:buffer").resolveObjectURL);let r=bn(e);if(r.search.length!==0)return Promise.resolve(ye("NetworkError when attempting to fetch resource."));let s=op(r.toString());if(e.method!=="GET"||!o1(s))return Promise.resolve(ye("invalid method"));let i=tu(),a=s.size,c=nu(`${a}`),l=s.type;if(e.headersList.contains("range",!0)){i.rangeRequested=!0;let d=e.headersList.get("range",!0),h=h1(d,!0);if(h==="failure")return Promise.resolve(ye("failed to fetch the data URL"));let{rangeStartValue:g,rangeEndValue:f}=h;if(g===null)g=a-f,f=g+f-1;else{if(g>=a)return Promise.resolve(ye("Range start is greater than the blob's size."));(f===null||f>=a)&&(f=a-1)}let m=s.slice(g,f,l),C=mb(m);i.body=C[0];let y=nu(`${m.size}`),R=g1(g,f,a);i.status=206,i.statusText="Partial Content",i.headersList.set("content-length",y,!0),i.headersList.set("content-type",l,!0),i.headersList.set("content-range",R,!0)}else{let d=mb(s);i.statusText="OK",i.body=d[0],i.headersList.set("content-length",c,!0),i.headersList.set("content-type",l,!0)}return Promise.resolve(i)}case"data:":{let r=bn(e),s=k1(r);if(s==="failure")return Promise.resolve(ye("failed to fetch the data URL"));let i=S1(s.mimeType);return Promise.resolve(tu({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:i}]],body:dp(s.body)[0]}))}case"file:":return Promise.resolve(ye("not implemented... yet..."));case"http:":case"https:":return kb(t).catch(r=>ye(r));default:return Promise.resolve(ye("unknown scheme"))}}o(Cb,"schemeFetch");function L1(t,e){t.request.done=!0,t.processResponseDone!=null&&queueMicrotask(()=>t.processResponseDone(e))}o(L1,"finalizeResponse");function Ap(t,e){let n=t.timingInfo,r=o(()=>{let i=Date.now();t.request.destination==="document"&&(t.controller.fullTimingInfo=n),t.controller.reportTimingSteps=()=>{if(t.request.url.protocol!=="https:")return;n.endTime=i;let c=e.cacheState,l=e.bodyInfo;e.timingAllowPassed||(n=up(n),c="");let d=0;if(t.request.mode!=="navigator"||!e.hasCrossOriginRedirects){d=e.status;let h=f1(e.headersList);h!=="failure"&&(l.contentType=v1(h))}t.request.initiatorType!=null&&wb(n,t.request.url.href,t.request.initiatorType,globalThis,c,l,d)};let a=o(()=>{t.request.done=!0,t.processResponseEndOfBody!=null&&queueMicrotask(()=>t.processResponseEndOfBody(e)),t.request.initiatorType!=null&&t.controller.reportTimingSteps()},"processResponseEndOfBodyTask");queueMicrotask(()=>a())},"processResponseEndOfBody");t.processResponse!=null&&queueMicrotask(()=>{t.processResponse(e),t.processResponse=null});let s=e.type==="error"?e:e.internalResponse??e;s.body==null?r():w1(s.body.stream,()=>{r()})}o(Ap,"fetchFinale");async function kb(t){let e=t.request,n=null,r=null,s=t.timingInfo;if(e.serviceWorkers,n===null){if(e.redirect==="follow"&&(e.serviceWorkers="none"),r=n=await Sb(t),e.responseTainting==="cors"&&n1(e,n)==="failure")return ye("cors failure");zO(e,n)==="failure"&&(e.timingAllowFailed=!0)}return(e.responseTainting==="opaque"||n.type==="opaque")&&r1(e.origin,e.client,e.destination,r)==="blocked"?ye("blocked"):(yb.has(r.status)&&(e.redirect!=="manual"&&t.controller.connection.destroy(void 0,!1),e.redirect==="error"?n=ye("unexpected redirect"):e.redirect==="manual"?n=r:e.redirect==="follow"?n=await _1(t,n):Rs(!1)),n.timingInfo=s,n)}o(kb,"httpFetch");function _1(t,e){let n=t.request,r=e.internalResponse?e.internalResponse:e,s;try{if(s=KO(r,bn(n).hash),s==null)return e}catch(a){return Promise.resolve(ye(a))}if(!lp(s))return Promise.resolve(ye("URL scheme must be a HTTP(S) scheme"));if(n.redirectCount===20)return Promise.resolve(ye("redirect count exceeded"));if(n.redirectCount+=1,n.mode==="cors"&&(s.username||s.password)&&!cp(n,s))return Promise.resolve(ye('cross origin not allowed for request mode "cors"'));if(n.responseTainting==="cors"&&(s.username||s.password))return Promise.resolve(ye('URL cannot contain credentials for request mode "cors"'));if(r.status!==303&&n.body!=null&&n.body.source==null)return Promise.resolve(ye());if([301,302].includes(r.status)&&n.method==="POST"||r.status===303&&!N1.includes(n.method)){n.method="GET",n.body=null;for(let a of C1)n.headersList.delete(a)}cp(bn(n),s)||(n.headersList.delete("authorization",!0),n.headersList.delete("proxy-authorization",!0),n.headersList.delete("cookie",!0),n.headersList.delete("host",!0)),n.body!=null&&(Rs(n.body.source!=null),n.body=dp(n.body.source)[0]);let i=t.timingInfo;return i.redirectEndTime=i.postRedirectStartTime=Ba(t.crossOriginIsolatedCapability),i.redirectStartTime===0&&(i.redirectStartTime=i.startTime),n.urlList.push(s),XO(n,r),Rb(t,!0)}o(_1,"httpRedirectFetch");async function Sb(t,e=!1,n=!1){let r=t.request,s=null,i=null,a=null,c=null,l=!1;r.window==="no-window"&&r.redirect==="error"?(s=t,i=r):(i=HO(r),s={...t},s.request=i);let d=r.credentials==="include"||r.credentials==="same-origin"&&r.responseTainting==="basic",h=i.body?i.body.length:null,g=null;if(i.body==null&&["POST","PUT"].includes(i.method)&&(g="0"),h!=null&&(g=nu(`${h}`)),g!=null&&i.headersList.append("content-length",g,!0),h!=null&&i.keepalive,i.referrer instanceof URL&&i.headersList.append("referer",nu(i.referrer.href),!0),ZO(i),t1(i),i.headersList.contains("user-agent",!0)||i.headersList.append("user-agent",F1),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)||(l1(bn(i))?i.headersList.append("accept-encoding","br, gzip, deflate",!0):i.headersList.append("accept-encoding","gzip, deflate",!0)),i.headersList.delete("host",!0),c==null&&(i.cache="no-store"),i.cache!=="no-store"&&i.cache,a==null){if(i.cache==="only-if-cached")return ye("only if cached");let f=await P1(s,d,n);!E1.has(i.method)&&f.status>=200&&f.status<=399,l&&f.status,a==null&&(a=f)}if(a.urlList=[...i.urlList],i.headersList.contains("range",!0)&&(a.rangeRequested=!0),a.requestIncludesCredentials=d,a.status===407)return r.window==="no-window"?ye():bs(t)?eu(t):ye("proxy authentication required");if(a.status===421&&!n&&(r.body==null||r.body.source!=null)){if(bs(t))return eu(t);t.controller.connection.destroy(),a=await Sb(t,e,!0)}return a}o(Sb,"httpNetworkOrCacheFetch");async function P1(t,e=!1,n=!1){Rs(!t.controller.connection||t.controller.connection.destroyed),t.controller.connection={abort:null,destroyed:!1,destroy(C,y=!0){this.destroyed||(this.destroyed=!0,y&&this.abort?.(C??new DOMException("The operation was aborted.","AbortError")))}};let r=t.request,s=null,i=t.timingInfo;null==null&&(r.cache="no-store");let c=n?"yes":"no";r.mode;let l=null;if(r.body==null&&t.processRequestEndOfBody)queueMicrotask(()=>t.processRequestEndOfBody());else if(r.body!=null){let C=o(async function*(Q){bs(t)||(yield Q,t.processRequestBodyChunkLength?.(Q.byteLength))},"processBodyChunk"),y=o(()=>{bs(t)||t.processRequestEndOfBody&&t.processRequestEndOfBody()},"processEndOfBody"),R=o(Q=>{bs(t)||(Q.name==="AbortError"?t.controller.abort():t.controller.terminate(Q))},"processBodyError");l=(async function*(){try{for await(let Q of r.body.stream)yield*C(Q);y()}catch(Q){R(Q)}})()}try{let{body:C,status:y,statusText:R,headersList:Q,socket:D}=await m({body:l});if(D)s=tu({status:y,statusText:R,headersList:Q,socket:D});else{let G=C[Symbol.asyncIterator]();t.controller.next=()=>G.next(),s=tu({status:y,statusText:R,headersList:Q})}}catch(C){return C.name==="AbortError"?(t.controller.connection.destroy(),eu(t,C)):ye(C)}let d=o(async()=>{await t.controller.resume()},"pullAlgorithm"),h=o(C=>{bs(t)||t.controller.abort(C)},"cancelAlgorithm"),g=new ReadableStream({async start(C){t.controller.controller=C},async pull(C){await d(C)},async cancel(C){await h(C)},type:"bytes"});s.body={stream:g,source:null,length:null},t.controller.resume||t.controller.on("terminated",f),t.controller.resume=async()=>{for(;;){let C,y;try{let{done:Q,value:D}=await t.controller.next();if(fb(t))break;C=Q?void 0:D}catch(Q){t.controller.ended&&!i.encodedBodySize?C=void 0:(C=Q,y=!0)}if(C===void 0){c1(t.controller.controller),L1(t,s);return}if(i.decodedBodySize+=C?.byteLength??0,y){t.controller.terminate(C);return}let R=new Uint8Array(C);if(R.byteLength&&t.controller.controller.enqueue(R),R1(g)){t.controller.terminate();return}if(t.controller.controller.desiredSize<=0)return}};function f(C){fb(t)?(s.aborted=!0,ru(g)&&t.controller.controller.error(t.controller.serializedAbortReason)):ru(g)&&t.controller.controller.error(new TypeError("terminated",{cause:a1(C)?C:void 0})),t.controller.connection.destroy()}return o(f,"onAborted"),s;function m({body:C}){let y=bn(r),R=t.controller.dispatcher;return new Promise((Q,D)=>R.dispatch({path:y.pathname+y.search,origin:y.origin,method:r.method,body:R.isMockActive?r.body&&(r.body.source||r.body.stream):C,headers:r.headersList.entries,maxRedirections:0,upgrade:r.mode==="websocket"?"websocket":void 0},{body:null,abort:null,onConnect(G){let{connection:P}=t.controller;i.finalConnectionTimingInfo=d1(void 0,i.postRedirectStartTime,t.crossOriginIsolatedCapability),P.destroyed?G(new DOMException("The operation was aborted.","AbortError")):(t.controller.on("terminated",G),this.abort=P.abort=G),i.finalNetworkRequestStartTime=Ba(t.crossOriginIsolatedCapability)},onResponseStarted(){i.finalNetworkResponseStartTime=Ba(t.crossOriginIsolatedCapability)},onHeaders(G,P,ae,Ee){if(G<200)return;let Ce="",De=new pb;for(let Ge=0;Ge<P.length;Ge+=2)De.append(Eb(P[Ge]),P[Ge+1].toString("latin1"),!0);Ce=De.get("location",!0);let et=[],An=Ce&&r.redirect==="follow"&&yb.has(G);if(r.method!=="HEAD"&&r.method!=="CONNECT"&&!Qb.includes(G)&&!An){let Ge=De.get("content-encoding",!0),Tt=Ge?Ge.toLowerCase().split(","):[],xe=5;if(Tt.length>xe)return this.abort(new Error(`too many content-encodings in response: ${Tt.length}, maximum allowed is ${xe}`)),!0;for(let Nt=Tt.length-1;Nt>=0;--Nt){let $=Tt[Nt].trim();if($==="x-gzip"||$==="gzip")et.push(kr.createGunzip({flush:kr.constants.Z_SYNC_FLUSH,finishFlush:kr.constants.Z_SYNC_FLUSH}));else if($==="deflate")et.push(p1({flush:kr.constants.Z_SYNC_FLUSH,finishFlush:kr.constants.Z_SYNC_FLUSH}));else if($==="br")et.push(kr.createBrotliDecompress({flush:kr.constants.BROTLI_OPERATION_FLUSH,finishFlush:kr.constants.BROTLI_OPERATION_FLUSH}));else{et.length=0;break}}}this.body=new Q1({read:ae});let At=this.onError.bind(this);return Q({status:G,statusText:Ee,headersList:De,body:et.length?B1(this.body,...et,Ge=>{Ge&&this.onError(Ge)}).on("error",At):this.body.on("error",At)}),!0},onData(G){if(t.controller.dump)return;let P=G;return i.encodedBodySize+=P.byteLength,this.body.push(P)},onComplete(){this.abort&&t.controller.off("terminated",this.abort),t.controller.ended=!0,this.body.push(null)},onError(G){this.abort&&t.controller.off("terminated",this.abort),this.body?.destroy(G),t.controller.terminate(G),D(G)},onUpgrade(G,P,ae){if(G!==101)return;let Ee=new pb;for(let Ce=0;Ce<P.length;Ce+=2)Ee.append(Eb(P[Ce]),P[Ce+1].toString("latin1"),!0);return Q({status:G,statusText:T1[G],headersList:Ee,socket:ae}),!0}}))}o(m,"dispatch")}o(P1,"httpNetworkFetch");vb.exports={fetch:M1,Fetch:su,fetching:bb,finalizeAndReportTiming:Bb}});var hp=T((I4,xb)=>{"use strict";xb.exports={kState:Symbol("FileReader state"),kResult:Symbol("FileReader result"),kError:Symbol("FileReader error"),kLastProgressEventFired:Symbol("FileReader last progress event fired timestamp"),kEvents:Symbol("FileReader events"),kAborted:Symbol("FileReader aborted")}});var Tb=T((y4,Db)=>{"use strict";var{webidl:vt}=je(),iu=Symbol("ProgressEvent state"),gp=class t extends Event{static{o(this,"ProgressEvent")}constructor(e,n={}){e=vt.converters.DOMString(e,"ProgressEvent constructor","type"),n=vt.converters.ProgressEventInit(n??{}),super(e,n),this[iu]={lengthComputable:n.lengthComputable,loaded:n.loaded,total:n.total}}get lengthComputable(){return vt.brandCheck(this,t),this[iu].lengthComputable}get loaded(){return vt.brandCheck(this,t),this[iu].loaded}get total(){return vt.brandCheck(this,t),this[iu].total}};vt.converters.ProgressEventInit=vt.dictionaryConverter([{key:"lengthComputable",converter:vt.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"loaded",converter:vt.converters["unsigned long long"],defaultValue:o(()=>0,"defaultValue")},{key:"total",converter:vt.converters["unsigned long long"],defaultValue:o(()=>0,"defaultValue")},{key:"bubbles",converter:vt.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"cancelable",converter:vt.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"composed",converter:vt.converters.boolean,defaultValue:o(()=>!1,"defaultValue")}]);Db.exports={ProgressEvent:gp}});var Fb=T((B4,Nb)=>{"use strict";function O1(t){if(!t)return"failure";switch(t.trim().toLowerCase()){case"unicode-1-1-utf-8":case"unicode11utf8":case"unicode20utf8":case"utf-8":case"utf8":case"x-unicode20utf8":return"UTF-8";case"866":case"cp866":case"csibm866":case"ibm866":return"IBM866";case"csisolatin2":case"iso-8859-2":case"iso-ir-101":case"iso8859-2":case"iso88592":case"iso_8859-2":case"iso_8859-2:1987":case"l2":case"latin2":return"ISO-8859-2";case"csisolatin3":case"iso-8859-3":case"iso-ir-109":case"iso8859-3":case"iso88593":case"iso_8859-3":case"iso_8859-3:1988":case"l3":case"latin3":return"ISO-8859-3";case"csisolatin4":case"iso-8859-4":case"iso-ir-110":case"iso8859-4":case"iso88594":case"iso_8859-4":case"iso_8859-4:1988":case"l4":case"latin4":return"ISO-8859-4";case"csisolatincyrillic":case"cyrillic":case"iso-8859-5":case"iso-ir-144":case"iso8859-5":case"iso88595":case"iso_8859-5":case"iso_8859-5:1988":return"ISO-8859-5";case"arabic":case"asmo-708":case"csiso88596e":case"csiso88596i":case"csisolatinarabic":case"ecma-114":case"iso-8859-6":case"iso-8859-6-e":case"iso-8859-6-i":case"iso-ir-127":case"iso8859-6":case"iso88596":case"iso_8859-6":case"iso_8859-6:1987":return"ISO-8859-6";case"csisolatingreek":case"ecma-118":case"elot_928":case"greek":case"greek8":case"iso-8859-7":case"iso-ir-126":case"iso8859-7":case"iso88597":case"iso_8859-7":case"iso_8859-7:1987":case"sun_eu_greek":return"ISO-8859-7";case"csiso88598e":case"csisolatinhebrew":case"hebrew":case"iso-8859-8":case"iso-8859-8-e":case"iso-ir-138":case"iso8859-8":case"iso88598":case"iso_8859-8":case"iso_8859-8:1988":case"visual":return"ISO-8859-8";case"csiso88598i":case"iso-8859-8-i":case"logical":return"ISO-8859-8-I";case"csisolatin6":case"iso-8859-10":case"iso-ir-157":case"iso8859-10":case"iso885910":case"l6":case"latin6":return"ISO-8859-10";case"iso-8859-13":case"iso8859-13":case"iso885913":return"ISO-8859-13";case"iso-8859-14":case"iso8859-14":case"iso885914":return"ISO-8859-14";case"csisolatin9":case"iso-8859-15":case"iso8859-15":case"iso885915":case"iso_8859-15":case"l9":return"ISO-8859-15";case"iso-8859-16":return"ISO-8859-16";case"cskoi8r":case"koi":case"koi8":case"koi8-r":case"koi8_r":return"KOI8-R";case"koi8-ru":case"koi8-u":return"KOI8-U";case"csmacintosh":case"mac":case"macintosh":case"x-mac-roman":return"macintosh";case"iso-8859-11":case"iso8859-11":case"iso885911":case"tis-620":case"windows-874":return"windows-874";case"cp1250":case"windows-1250":case"x-cp1250":return"windows-1250";case"cp1251":case"windows-1251":case"x-cp1251":return"windows-1251";case"ansi_x3.4-1968":case"ascii":case"cp1252":case"cp819":case"csisolatin1":case"ibm819":case"iso-8859-1":case"iso-ir-100":case"iso8859-1":case"iso88591":case"iso_8859-1":case"iso_8859-1:1987":case"l1":case"latin1":case"us-ascii":case"windows-1252":case"x-cp1252":return"windows-1252";case"cp1253":case"windows-1253":case"x-cp1253":return"windows-1253";case"cp1254":case"csisolatin5":case"iso-8859-9":case"iso-ir-148":case"iso8859-9":case"iso88599":case"iso_8859-9":case"iso_8859-9:1989":case"l5":case"latin5":case"windows-1254":case"x-cp1254":return"windows-1254";case"cp1255":case"windows-1255":case"x-cp1255":return"windows-1255";case"cp1256":case"windows-1256":case"x-cp1256":return"windows-1256";case"cp1257":case"windows-1257":case"x-cp1257":return"windows-1257";case"cp1258":case"windows-1258":case"x-cp1258":return"windows-1258";case"x-mac-cyrillic":case"x-mac-ukrainian":return"x-mac-cyrillic";case"chinese":case"csgb2312":case"csiso58gb231280":case"gb2312":case"gb_2312":case"gb_2312-80":case"gbk":case"iso-ir-58":case"x-gbk":return"GBK";case"gb18030":return"gb18030";case"big5":case"big5-hkscs":case"cn-big5":case"csbig5":case"x-x-big5":return"Big5";case"cseucpkdfmtjapanese":case"euc-jp":case"x-euc-jp":return"EUC-JP";case"csiso2022jp":case"iso-2022-jp":return"ISO-2022-JP";case"csshiftjis":case"ms932":case"ms_kanji":case"shift-jis":case"shift_jis":case"sjis":case"windows-31j":case"x-sjis":return"Shift_JIS";case"cseuckr":case"csksc56011987":case"euc-kr":case"iso-ir-149":case"korean":case"ks_c_5601-1987":case"ks_c_5601-1989":case"ksc5601":case"ksc_5601":case"windows-949":return"EUC-KR";case"csiso2022kr":case"hz-gb-2312":case"iso-2022-cn":case"iso-2022-cn-ext":case"iso-2022-kr":case"replacement":return"replacement";case"unicodefffe":case"utf-16be":return"UTF-16BE";case"csunicode":case"iso-10646-ucs-2":case"ucs-2":case"unicode":case"unicodefeff":case"utf-16":case"utf-16le":return"UTF-16LE";case"x-user-defined":return"x-user-defined";default:return"failure"}}o(O1,"getEncoding");Nb.exports={getEncoding:O1}});var $b=T((b4,Gb)=>{"use strict";var{kState:Vi,kError:pp,kResult:Ub,kAborted:ba,kLastProgressEventFired:fp}=hp(),{ProgressEvent:G1}=Tb(),{getEncoding:Mb}=Fb(),{serializeAMimeType:$1,parseMIMEType:Lb}=ht(),{types:Y1}=require("node:util"),{StringDecoder:_b}=require("string_decoder"),{btoa:Pb}=require("node:buffer"),V1={enumerable:!0,writable:!1,configurable:!1};function H1(t,e,n,r){if(t[Vi]==="loading")throw new DOMException("Invalid state","InvalidStateError");t[Vi]="loading",t[Ub]=null,t[pp]=null;let i=e.stream().getReader(),a=[],c=i.read(),l=!0;(async()=>{for(;!t[ba];)try{let{done:d,value:h}=await c;if(l&&!t[ba]&&queueMicrotask(()=>{Sr("loadstart",t)}),l=!1,!d&&Y1.isUint8Array(h))a.push(h),(t[fp]===void 0||Date.now()-t[fp]>=50)&&!t[ba]&&(t[fp]=Date.now(),queueMicrotask(()=>{Sr("progress",t)})),c=i.read();else if(d){queueMicrotask(()=>{t[Vi]="done";try{let g=J1(a,n,e.type,r);if(t[ba])return;t[Ub]=g,Sr("load",t)}catch(g){t[pp]=g,Sr("error",t)}t[Vi]!=="loading"&&Sr("loadend",t)});break}}catch(d){if(t[ba])return;queueMicrotask(()=>{t[Vi]="done",t[pp]=d,Sr("error",t),t[Vi]!=="loading"&&Sr("loadend",t)});break}})()}o(H1,"readOperation");function Sr(t,e){let n=new G1(t,{bubbles:!1,cancelable:!1});e.dispatchEvent(n)}o(Sr,"fireAProgressEvent");function J1(t,e,n,r){switch(e){case"DataURL":{let s="data:",i=Lb(n||"application/octet-stream");i!=="failure"&&(s+=$1(i)),s+=";base64,";let a=new _b("latin1");for(let c of t)s+=Pb(a.write(c));return s+=Pb(a.end()),s}case"Text":{let s="failure";if(r&&(s=Mb(r)),s==="failure"&&n){let i=Lb(n);i!=="failure"&&(s=Mb(i.parameters.get("charset")))}return s==="failure"&&(s="UTF-8"),q1(t,s)}case"ArrayBuffer":return Ob(t).buffer;case"BinaryString":{let s="",i=new _b("latin1");for(let a of t)s+=i.write(a);return s+=i.end(),s}}}o(J1,"packageData");function q1(t,e){let n=Ob(t),r=j1(n),s=0;r!==null&&(e=r,s=r==="UTF-8"?3:2);let i=n.slice(s);return new TextDecoder(e).decode(i)}o(q1,"decode");function j1(t){let[e,n,r]=t;return e===239&&n===187&&r===191?"UTF-8":e===254&&n===255?"UTF-16BE":e===255&&n===254?"UTF-16LE":null}o(j1,"BOMSniffing");function Ob(t){let e=t.reduce((r,s)=>r+s.byteLength,0),n=0;return t.reduce((r,s)=>(r.set(s,n),n+=s.byteLength,r),new Uint8Array(e))}o(Ob,"combineByteSequences");Gb.exports={staticPropertyDescriptors:V1,readOperation:H1,fireAProgressEvent:Sr}});var Jb=T((k4,Hb)=>{"use strict";var{staticPropertyDescriptors:Hi,readOperation:ou,fireAProgressEvent:Yb}=$b(),{kState:ks,kError:Vb,kResult:au,kEvents:fe,kAborted:W1}=hp(),{webidl:Be}=je(),{kEnumerableProperty:ft}=ue(),sn=class t extends EventTarget{static{o(this,"FileReader")}constructor(){super(),this[ks]="empty",this[au]=null,this[Vb]=null,this[fe]={loadend:null,error:null,abort:null,load:null,progress:null,loadstart:null}}readAsArrayBuffer(e){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsArrayBuffer"),e=Be.converters.Blob(e,{strict:!1}),ou(this,e,"ArrayBuffer")}readAsBinaryString(e){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsBinaryString"),e=Be.converters.Blob(e,{strict:!1}),ou(this,e,"BinaryString")}readAsText(e,n=void 0){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsText"),e=Be.converters.Blob(e,{strict:!1}),n!==void 0&&(n=Be.converters.DOMString(n,"FileReader.readAsText","encoding")),ou(this,e,"Text",n)}readAsDataURL(e){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsDataURL"),e=Be.converters.Blob(e,{strict:!1}),ou(this,e,"DataURL")}abort(){if(this[ks]==="empty"||this[ks]==="done"){this[au]=null;return}this[ks]==="loading"&&(this[ks]="done",this[au]=null),this[W1]=!0,Yb("abort",this),this[ks]!=="loading"&&Yb("loadend",this)}get readyState(){switch(Be.brandCheck(this,t),this[ks]){case"empty":return this.EMPTY;case"loading":return this.LOADING;case"done":return this.DONE}}get result(){return Be.brandCheck(this,t),this[au]}get error(){return Be.brandCheck(this,t),this[Vb]}get onloadend(){return Be.brandCheck(this,t),this[fe].loadend}set onloadend(e){Be.brandCheck(this,t),this[fe].loadend&&this.removeEventListener("loadend",this[fe].loadend),typeof e=="function"?(this[fe].loadend=e,this.addEventListener("loadend",e)):this[fe].loadend=null}get onerror(){return Be.brandCheck(this,t),this[fe].error}set onerror(e){Be.brandCheck(this,t),this[fe].error&&this.removeEventListener("error",this[fe].error),typeof e=="function"?(this[fe].error=e,this.addEventListener("error",e)):this[fe].error=null}get onloadstart(){return Be.brandCheck(this,t),this[fe].loadstart}set onloadstart(e){Be.brandCheck(this,t),this[fe].loadstart&&this.removeEventListener("loadstart",this[fe].loadstart),typeof e=="function"?(this[fe].loadstart=e,this.addEventListener("loadstart",e)):this[fe].loadstart=null}get onprogress(){return Be.brandCheck(this,t),this[fe].progress}set onprogress(e){Be.brandCheck(this,t),this[fe].progress&&this.removeEventListener("progress",this[fe].progress),typeof e=="function"?(this[fe].progress=e,this.addEventListener("progress",e)):this[fe].progress=null}get onload(){return Be.brandCheck(this,t),this[fe].load}set onload(e){Be.brandCheck(this,t),this[fe].load&&this.removeEventListener("load",this[fe].load),typeof e=="function"?(this[fe].load=e,this.addEventListener("load",e)):this[fe].load=null}get onabort(){return Be.brandCheck(this,t),this[fe].abort}set onabort(e){Be.brandCheck(this,t),this[fe].abort&&this.removeEventListener("abort",this[fe].abort),typeof e=="function"?(this[fe].abort=e,this.addEventListener("abort",e)):this[fe].abort=null}};sn.EMPTY=sn.prototype.EMPTY=0;sn.LOADING=sn.prototype.LOADING=1;sn.DONE=sn.prototype.DONE=2;Object.defineProperties(sn.prototype,{EMPTY:Hi,LOADING:Hi,DONE:Hi,readAsArrayBuffer:ft,readAsBinaryString:ft,readAsText:ft,readAsDataURL:ft,abort:ft,readyState:ft,result:ft,error:ft,onloadstart:ft,onprogress:ft,onload:ft,onabort:ft,onerror:ft,onloadend:ft,[Symbol.toStringTag]:{value:"FileReader",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(sn,{EMPTY:Hi,LOADING:Hi,DONE:Hi});Hb.exports={FileReader:sn}});var Au=T((v4,qb)=>{"use strict";qb.exports={kConstruct:ke().kConstruct}});var zb=T((x4,Wb)=>{"use strict";var z1=require("node:assert"),{URLSerializer:jb}=ht(),{isValidHeaderName:Z1}=Qt();function K1(t,e,n=!1){let r=jb(t,n),s=jb(e,n);return r===s}o(K1,"urlEquals");function X1(t){z1(t!==null);let e=[];for(let n of t.split(","))n=n.trim(),Z1(n)&&e.push(n);return e}o(X1,"getFieldValues");Wb.exports={urlEquals:K1,getFieldValues:X1}});var Xb=T((T4,Kb)=>{"use strict";var{kConstruct:eG}=Au(),{urlEquals:tG,getFieldValues:mp}=zb(),{kEnumerableProperty:Ss,isDisturbed:nG}=ue(),{webidl:q}=je(),{Response:rG,cloneResponse:sG,fromInnerResponse:iG}=Qa(),{Request:Wn,fromInnerRequest:oG}=Yi(),{kState:on}=pr(),{fetching:aG}=wa(),{urlIsHttpHttpsScheme:cu,createDeferredPromise:Ji,readAllBytes:AG}=Qt(),Ep=require("node:assert"),uu=class t{static{o(this,"Cache")}#e;constructor(){arguments[0]!==eG&&q.illegalConstructor(),q.util.markAsUncloneable(this),this.#e=arguments[1]}async match(e,n={}){q.brandCheck(this,t);let r="Cache.match";q.argumentLengthCheck(arguments,1,r),e=q.converters.RequestInfo(e,r,"request"),n=q.converters.CacheQueryOptions(n,r,"options");let s=this.#i(e,n,1);if(s.length!==0)return s[0]}async matchAll(e=void 0,n={}){q.brandCheck(this,t);let r="Cache.matchAll";return e!==void 0&&(e=q.converters.RequestInfo(e,r,"request")),n=q.converters.CacheQueryOptions(n,r,"options"),this.#i(e,n)}async add(e){q.brandCheck(this,t);let n="Cache.add";q.argumentLengthCheck(arguments,1,n),e=q.converters.RequestInfo(e,n,"request");let r=[e];return await this.addAll(r)}async addAll(e){q.brandCheck(this,t);let n="Cache.addAll";q.argumentLengthCheck(arguments,1,n);let r=[],s=[];for(let f of e){if(f===void 0)throw q.errors.conversionFailed({prefix:n,argument:"Argument 1",types:["undefined is not allowed"]});if(f=q.converters.RequestInfo(f),typeof f=="string")continue;let m=f[on];if(!cu(m.url)||m.method!=="GET")throw q.errors.exception({header:n,message:"Expected http/s scheme when method is not GET."})}let i=[];for(let f of e){let m=new Wn(f)[on];if(!cu(m.url))throw q.errors.exception({header:n,message:"Expected http/s scheme."});m.initiator="fetch",m.destination="subresource",s.push(m);let C=Ji();i.push(aG({request:m,processResponse(y){if(y.type==="error"||y.status===206||y.status<200||y.status>299)C.reject(q.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(y.headersList.contains("vary")){let R=mp(y.headersList.get("vary"));for(let Q of R)if(Q==="*"){C.reject(q.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(let D of i)D.abort();return}}},processResponseEndOfBody(y){if(y.aborted){C.reject(new DOMException("aborted","AbortError"));return}C.resolve(y)}})),r.push(C.promise)}let c=await Promise.all(r),l=[],d=0;for(let f of c){let m={type:"put",request:s[d],response:f};l.push(m),d++}let h=Ji(),g=null;try{this.#t(l)}catch(f){g=f}return queueMicrotask(()=>{g===null?h.resolve(void 0):h.reject(g)}),h.promise}async put(e,n){q.brandCheck(this,t);let r="Cache.put";q.argumentLengthCheck(arguments,2,r),e=q.converters.RequestInfo(e,r,"request"),n=q.converters.Response(n,r,"response");let s=null;if(e instanceof Wn?s=e[on]:s=new Wn(e)[on],!cu(s.url)||s.method!=="GET")throw q.errors.exception({header:r,message:"Expected an http/s scheme when method is not GET"});let i=n[on];if(i.status===206)throw q.errors.exception({header:r,message:"Got 206 status"});if(i.headersList.contains("vary")){let m=mp(i.headersList.get("vary"));for(let C of m)if(C==="*")throw q.errors.exception({header:r,message:"Got * vary field value"})}if(i.body&&(nG(i.body.stream)||i.body.stream.locked))throw q.errors.exception({header:r,message:"Response body is locked or disturbed"});let a=sG(i),c=Ji();if(i.body!=null){let C=i.body.stream.getReader();AG(C).then(c.resolve,c.reject)}else c.resolve(void 0);let l=[],d={type:"put",request:s,response:a};l.push(d);let h=await c.promise;a.body!=null&&(a.body.source=h);let g=Ji(),f=null;try{this.#t(l)}catch(m){f=m}return queueMicrotask(()=>{f===null?g.resolve():g.reject(f)}),g.promise}async delete(e,n={}){q.brandCheck(this,t);let r="Cache.delete";q.argumentLengthCheck(arguments,1,r),e=q.converters.RequestInfo(e,r,"request"),n=q.converters.CacheQueryOptions(n,r,"options");let s=null;if(e instanceof Wn){if(s=e[on],s.method!=="GET"&&!n.ignoreMethod)return!1}else Ep(typeof e=="string"),s=new Wn(e)[on];let i=[],a={type:"delete",request:s,options:n};i.push(a);let c=Ji(),l=null,d;try{d=this.#t(i)}catch(h){l=h}return queueMicrotask(()=>{l===null?c.resolve(!!d?.length):c.reject(l)}),c.promise}async keys(e=void 0,n={}){q.brandCheck(this,t);let r="Cache.keys";e!==void 0&&(e=q.converters.RequestInfo(e,r,"request")),n=q.converters.CacheQueryOptions(n,r,"options");let s=null;if(e!==void 0)if(e instanceof Wn){if(s=e[on],s.method!=="GET"&&!n.ignoreMethod)return[]}else typeof e=="string"&&(s=new Wn(e)[on]);let i=Ji(),a=[];if(e===void 0)for(let c of this.#e)a.push(c[0]);else{let c=this.#n(s,n);for(let l of c)a.push(l[0])}return queueMicrotask(()=>{let c=[];for(let l of a){let d=oG(l,new AbortController().signal,"immutable");c.push(d)}i.resolve(Object.freeze(c))}),i.promise}#t(e){let n=this.#e,r=[...n],s=[],i=[];try{for(let a of e){if(a.type!=="delete"&&a.type!=="put")throw q.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if(a.type==="delete"&&a.response!=null)throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#n(a.request,a.options,s).length)throw new DOMException("???","InvalidStateError");let c;if(a.type==="delete"){if(c=this.#n(a.request,a.options),c.length===0)return[];for(let l of c){let d=n.indexOf(l);Ep(d!==-1),n.splice(d,1)}}else if(a.type==="put"){if(a.response==null)throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let l=a.request;if(!cu(l.url))throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if(l.method!=="GET")throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(a.options!=null)throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});c=this.#n(a.request);for(let d of c){let h=n.indexOf(d);Ep(h!==-1),n.splice(h,1)}n.push([a.request,a.response]),s.push([a.request,a.response])}i.push([a.request,a.response])}return i}catch(a){throw this.#e.length=0,this.#e=r,a}}#n(e,n,r){let s=[],i=r??this.#e;for(let a of i){let[c,l]=a;this.#s(e,c,l,n)&&s.push(a)}return s}#s(e,n,r=null,s){let i=new URL(e.url),a=new URL(n.url);if(s?.ignoreSearch&&(a.search="",i.search=""),!tG(i,a,!0))return!1;if(r==null||s?.ignoreVary||!r.headersList.contains("vary"))return!0;let c=mp(r.headersList.get("vary"));for(let l of c){if(l==="*")return!1;let d=n.headersList.get(l),h=e.headersList.get(l);if(d!==h)return!1}return!0}#i(e,n,r=1/0){let s=null;if(e!==void 0)if(e instanceof Wn){if(s=e[on],s.method!=="GET"&&!n.ignoreMethod)return[]}else typeof e=="string"&&(s=new Wn(e)[on]);let i=[];if(e===void 0)for(let c of this.#e)i.push(c[1]);else{let c=this.#n(s,n);for(let l of c)i.push(l[1])}let a=[];for(let c of i){let l=iG(c,"immutable");if(a.push(l.clone()),a.length>=r)break}return Object.freeze(a)}};Object.defineProperties(uu.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:Ss,matchAll:Ss,add:Ss,addAll:Ss,put:Ss,delete:Ss,keys:Ss});var Zb=[{key:"ignoreSearch",converter:q.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"ignoreMethod",converter:q.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"ignoreVary",converter:q.converters.boolean,defaultValue:o(()=>!1,"defaultValue")}];q.converters.CacheQueryOptions=q.dictionaryConverter(Zb);q.converters.MultiCacheQueryOptions=q.dictionaryConverter([...Zb,{key:"cacheName",converter:q.converters.DOMString}]);q.converters.Response=q.interfaceConverter(rG);q.converters["sequence<RequestInfo>"]=q.sequenceConverter(q.converters.RequestInfo);Kb.exports={Cache:uu}});var tR=T((F4,eR)=>{"use strict";var{kConstruct:Ra}=Au(),{Cache:lu}=Xb(),{webidl:Xe}=je(),{kEnumerableProperty:ka}=ue(),du=class t{static{o(this,"CacheStorage")}#e=new Map;constructor(){arguments[0]!==Ra&&Xe.illegalConstructor(),Xe.util.markAsUncloneable(this)}async match(e,n={}){if(Xe.brandCheck(this,t),Xe.argumentLengthCheck(arguments,1,"CacheStorage.match"),e=Xe.converters.RequestInfo(e),n=Xe.converters.MultiCacheQueryOptions(n),n.cacheName!=null){if(this.#e.has(n.cacheName)){let r=this.#e.get(n.cacheName);return await new lu(Ra,r).match(e,n)}}else for(let r of this.#e.values()){let i=await new lu(Ra,r).match(e,n);if(i!==void 0)return i}}async has(e){Xe.brandCheck(this,t);let n="CacheStorage.has";return Xe.argumentLengthCheck(arguments,1,n),e=Xe.converters.DOMString(e,n,"cacheName"),this.#e.has(e)}async open(e){Xe.brandCheck(this,t);let n="CacheStorage.open";if(Xe.argumentLengthCheck(arguments,1,n),e=Xe.converters.DOMString(e,n,"cacheName"),this.#e.has(e)){let s=this.#e.get(e);return new lu(Ra,s)}let r=[];return this.#e.set(e,r),new lu(Ra,r)}async delete(e){Xe.brandCheck(this,t);let n="CacheStorage.delete";return Xe.argumentLengthCheck(arguments,1,n),e=Xe.converters.DOMString(e,n,"cacheName"),this.#e.delete(e)}async keys(){return Xe.brandCheck(this,t),[...this.#e.keys()]}};Object.defineProperties(du.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:ka,has:ka,open:ka,delete:ka,keys:ka});eR.exports={CacheStorage:du}});var rR=T((M4,nR)=>{"use strict";nR.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}});var yp=T((L4,aR)=>{"use strict";function cG(t){for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n>=0&&n<=8||n>=10&&n<=31||n===127)return!0}return!1}o(cG,"isCTLExcludingHtab");function Cp(t){for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n<33||n>126||n===34||n===40||n===41||n===60||n===62||n===64||n===44||n===59||n===58||n===92||n===47||n===91||n===93||n===63||n===61||n===123||n===125)throw new Error("Invalid cookie name")}}o(Cp,"validateCookieName");function Ip(t){let e=t.length,n=0;if(t[0]==='"'){if(e===1||t[e-1]!=='"')throw new Error("Invalid cookie value");--e,++n}for(;n<e;){let r=t.charCodeAt(n++);if(r<33||r>126||r===34||r===44||r===59||r===92)throw new Error("Invalid cookie value")}}o(Ip,"validateCookieValue");function iR(t){for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n<32||n>126||n===59)throw new Error("Invalid cookie path")}}o(iR,"validateCookiePath");function sR(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}o(sR,"isLetterOrDigit");function uG(t){if(t===" ")return;if(t.length>255)throw new Error("Invalid cookie domain");let e=0;for(let n=0;n<t.length;++n){let r=t.charCodeAt(n);if(r===46){if(e===0)throw new Error("Invalid cookie domain");if(t.charCodeAt(n-1)===45)throw new Error("Invalid cookie domain");e=0;continue}if(e===0&&!sR(r))throw new Error("Invalid cookie domain");if(!sR(r)&&r!==45)throw new Error("Invalid cookie domain");if(++e>63)throw new Error("Invalid cookie domain")}if(e===0||t.charCodeAt(t.length-1)===45)throw new Error("Invalid cookie domain")}o(uG,"validateCookieDomain");var lG=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dG=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],hu=Array(61).fill(0).map((t,e)=>e.toString().padStart(2,"0"));function oR(t){return typeof t=="number"&&(t=new Date(t)),`${lG[t.getUTCDay()]}, ${hu[t.getUTCDate()]} ${dG[t.getUTCMonth()]} ${t.getUTCFullYear()} ${hu[t.getUTCHours()]}:${hu[t.getUTCMinutes()]}:${hu[t.getUTCSeconds()]} GMT`}o(oR,"toIMFDate");function hG(t){if(t<0)throw new Error("Invalid cookie max-age")}o(hG,"validateCookieMaxAge");function gG(t){if(t.name.length===0)return null;Cp(t.name),Ip(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"&&(hG(t.maxAge),e.push(`Max-Age=${t.maxAge}`)),t.domain&&(uG(t.domain),e.push(`Domain=${t.domain}`)),t.path&&(iR(t.path),e.push(`Path=${t.path}`)),t.expires&&t.expires.toString()!=="Invalid Date"&&e.push(`Expires=${oR(t.expires)}`),t.sameSite&&e.push(`SameSite=${t.sameSite}`);for(let n of t.unparsed){if(!n.includes("="))throw new Error("Invalid unparsed");let[r,...s]=n.split("="),i=r.trim(),a=s.join("=");Cp(i),Ip(a),e.push(`${i}=${a}`)}return e.join("; ")}o(gG,"stringify");aR.exports={isCTLExcludingHtab:cG,validateCookieName:Cp,validateCookiePath:iR,validateCookieValue:Ip,toIMFDate:oR,stringify:gG}});var cR=T((P4,AR)=>{"use strict";var{maxNameValuePairSize:pG,maxAttributeValueSize:fG}=rR(),{isCTLExcludingHtab:mG}=yp(),{collectASequenceOfCodePointsFast:gu}=ht(),EG=require("node:assert");function CG(t){if(mG(t))return null;let e="",n="",r="",s="";if(t.includes(";")){let i={position:0};e=gu(";",t,i),n=t.slice(i.position)}else e=t;if(!e.includes("="))s=e;else{let i={position:0};r=gu("=",e,i),s=e.slice(i.position+1)}return r=r.trim(),s=s.trim(),r.length+s.length>pG?null:{name:r,value:s,...qi(n)}}o(CG,"parseSetCookie");function qi(t,e={}){if(t.length===0)return e;EG(t[0]===";"),t=t.slice(1);let n="";t.includes(";")?(n=gu(";",t,{position:0}),t=t.slice(n.length)):(n=t,t="");let r="",s="";if(n.includes("=")){let a={position:0};r=gu("=",n,a),s=n.slice(a.position+1)}else r=n;if(r=r.trim(),s=s.trim(),s.length>fG)return qi(t,e);let i=r.toLowerCase();if(i==="expires"){let a=new Date(s);e.expires=a}else if(i==="max-age"){let a=s.charCodeAt(0);if((a<48||a>57)&&s[0]!=="-"||!/^\d+$/.test(s))return qi(t,e);let c=Number(s);e.maxAge=c}else if(i==="domain"){let a=s;a[0]==="."&&(a=a.slice(1)),a=a.toLowerCase(),e.domain=a}else if(i==="path"){let a="";s.length===0||s[0]!=="/"?a="/":a=s,e.path=a}else if(i==="secure")e.secure=!0;else if(i==="httponly")e.httpOnly=!0;else if(i==="samesite"){let a=s.toLowerCase();a==="none"?e.sameSite="None":a==="strict"?e.sameSite="Strict":a==="lax"&&(e.sameSite="Lax")}else e.unparsed??=[],e.unparsed.push(`${r}=${s}`);return qi(t,e)}o(qi,"parseUnparsedAttributes");AR.exports={parseSetCookie:CG,parseUnparsedAttributes:qi}});var dR=T((G4,lR)=>{"use strict";var{parseSetCookie:IG}=cR(),{stringify:yG}=yp(),{webidl:he}=je(),{Headers:pu}=Bs();function QG(t){he.argumentLengthCheck(arguments,1,"getCookies"),he.brandCheck(t,pu,{strict:!1});let e=t.get("cookie"),n={};if(!e)return n;for(let r of e.split(";")){let[s,...i]=r.split("=");n[s.trim()]=i.join("=")}return n}o(QG,"getCookies");function BG(t,e,n){he.brandCheck(t,pu,{strict:!1});let r="deleteCookie";he.argumentLengthCheck(arguments,2,r),e=he.converters.DOMString(e,r,"name"),n=he.converters.DeleteCookieAttributes(n),uR(t,{name:e,value:"",expires:new Date(0),...n})}o(BG,"deleteCookie");function wG(t){he.argumentLengthCheck(arguments,1,"getSetCookies"),he.brandCheck(t,pu,{strict:!1});let e=t.getSetCookie();return e?e.map(n=>IG(n)):[]}o(wG,"getSetCookies");function uR(t,e){he.argumentLengthCheck(arguments,2,"setCookie"),he.brandCheck(t,pu,{strict:!1}),e=he.converters.Cookie(e);let n=yG(e);n&&t.append("Set-Cookie",n)}o(uR,"setCookie");he.converters.DeleteCookieAttributes=he.dictionaryConverter([{converter:he.nullableConverter(he.converters.DOMString),key:"path",defaultValue:o(()=>null,"defaultValue")},{converter:he.nullableConverter(he.converters.DOMString),key:"domain",defaultValue:o(()=>null,"defaultValue")}]);he.converters.Cookie=he.dictionaryConverter([{converter:he.converters.DOMString,key:"name"},{converter:he.converters.DOMString,key:"value"},{converter:he.nullableConverter(t=>typeof t=="number"?he.converters["unsigned long long"](t):new Date(t)),key:"expires",defaultValue:o(()=>null,"defaultValue")},{converter:he.nullableConverter(he.converters["long long"]),key:"maxAge",defaultValue:o(()=>null,"defaultValue")},{converter:he.nullableConverter(he.converters.DOMString),key:"domain",defaultValue:o(()=>null,"defaultValue")},{converter:he.nullableConverter(he.converters.DOMString),key:"path",defaultValue:o(()=>null,"defaultValue")},{converter:he.nullableConverter(he.converters.boolean),key:"secure",defaultValue:o(()=>null,"defaultValue")},{converter:he.nullableConverter(he.converters.boolean),key:"httpOnly",defaultValue:o(()=>null,"defaultValue")},{converter:he.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:he.sequenceConverter(he.converters.DOMString),key:"unparsed",defaultValue:o(()=>new Array(0),"defaultValue")}]);lR.exports={getCookies:QG,deleteCookie:BG,getSetCookies:wG,setCookie:uR}});var Wi=T((Y4,gR)=>{"use strict";var{webidl:H}=je(),{kEnumerableProperty:mt}=ue(),{kConstruct:hR}=ke(),{MessagePort:bG}=require("node:worker_threads"),ji=class t extends Event{static{o(this,"MessageEvent")}#e;constructor(e,n={}){if(e===hR){super(arguments[1],arguments[2]),H.util.markAsUncloneable(this);return}let r="MessageEvent constructor";H.argumentLengthCheck(arguments,1,r),e=H.converters.DOMString(e,r,"type"),n=H.converters.MessageEventInit(n,r,"eventInitDict"),super(e,n),this.#e=n,H.util.markAsUncloneable(this)}get data(){return H.brandCheck(this,t),this.#e.data}get origin(){return H.brandCheck(this,t),this.#e.origin}get lastEventId(){return H.brandCheck(this,t),this.#e.lastEventId}get source(){return H.brandCheck(this,t),this.#e.source}get ports(){return H.brandCheck(this,t),Object.isFrozen(this.#e.ports)||Object.freeze(this.#e.ports),this.#e.ports}initMessageEvent(e,n=!1,r=!1,s=null,i="",a="",c=null,l=[]){return H.brandCheck(this,t),H.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new t(e,{bubbles:n,cancelable:r,data:s,origin:i,lastEventId:a,source:c,ports:l})}static createFastMessageEvent(e,n){let r=new t(hR,e,n);return r.#e=n,r.#e.data??=null,r.#e.origin??="",r.#e.lastEventId??="",r.#e.source??=null,r.#e.ports??=[],r}},{createFastMessageEvent:RG}=ji;delete ji.createFastMessageEvent;var fu=class t extends Event{static{o(this,"CloseEvent")}#e;constructor(e,n={}){let r="CloseEvent constructor";H.argumentLengthCheck(arguments,1,r),e=H.converters.DOMString(e,r,"type"),n=H.converters.CloseEventInit(n),super(e,n),this.#e=n,H.util.markAsUncloneable(this)}get wasClean(){return H.brandCheck(this,t),this.#e.wasClean}get code(){return H.brandCheck(this,t),this.#e.code}get reason(){return H.brandCheck(this,t),this.#e.reason}},mu=class t extends Event{static{o(this,"ErrorEvent")}#e;constructor(e,n){let r="ErrorEvent constructor";H.argumentLengthCheck(arguments,1,r),super(e,n),H.util.markAsUncloneable(this),e=H.converters.DOMString(e,r,"type"),n=H.converters.ErrorEventInit(n??{}),this.#e=n}get message(){return H.brandCheck(this,t),this.#e.message}get filename(){return H.brandCheck(this,t),this.#e.filename}get lineno(){return H.brandCheck(this,t),this.#e.lineno}get colno(){return H.brandCheck(this,t),this.#e.colno}get error(){return H.brandCheck(this,t),this.#e.error}};Object.defineProperties(ji.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:mt,origin:mt,lastEventId:mt,source:mt,ports:mt,initMessageEvent:mt});Object.defineProperties(fu.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:mt,code:mt,wasClean:mt});Object.defineProperties(mu.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:mt,filename:mt,lineno:mt,colno:mt,error:mt});H.converters.MessagePort=H.interfaceConverter(bG);H.converters["sequence<MessagePort>"]=H.sequenceConverter(H.converters.MessagePort);var Qp=[{key:"bubbles",converter:H.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"cancelable",converter:H.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"composed",converter:H.converters.boolean,defaultValue:o(()=>!1,"defaultValue")}];H.converters.MessageEventInit=H.dictionaryConverter([...Qp,{key:"data",converter:H.converters.any,defaultValue:o(()=>null,"defaultValue")},{key:"origin",converter:H.converters.USVString,defaultValue:o(()=>"","defaultValue")},{key:"lastEventId",converter:H.converters.DOMString,defaultValue:o(()=>"","defaultValue")},{key:"source",converter:H.nullableConverter(H.converters.MessagePort),defaultValue:o(()=>null,"defaultValue")},{key:"ports",converter:H.converters["sequence<MessagePort>"],defaultValue:o(()=>new Array(0),"defaultValue")}]);H.converters.CloseEventInit=H.dictionaryConverter([...Qp,{key:"wasClean",converter:H.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"code",converter:H.converters["unsigned short"],defaultValue:o(()=>0,"defaultValue")},{key:"reason",converter:H.converters.USVString,defaultValue:o(()=>"","defaultValue")}]);H.converters.ErrorEventInit=H.dictionaryConverter([...Qp,{key:"message",converter:H.converters.DOMString,defaultValue:o(()=>"","defaultValue")},{key:"filename",converter:H.converters.USVString,defaultValue:o(()=>"","defaultValue")},{key:"lineno",converter:H.converters["unsigned long"],defaultValue:o(()=>0,"defaultValue")},{key:"colno",converter:H.converters["unsigned long"],defaultValue:o(()=>0,"defaultValue")},{key:"error",converter:H.converters.any}]);gR.exports={MessageEvent:ji,CloseEvent:fu,ErrorEvent:mu,createFastMessageEvent:RG}});var vs=T((H4,pR)=>{"use strict";var kG="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",SG={enumerable:!0,writable:!1,configurable:!1},vG={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},xG={NOT_SENT:0,PROCESSING:1,SENT:2},DG={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},TG=2**16-1,NG={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},FG=Buffer.allocUnsafe(0),UG={string:1,typedArray:2,arrayBuffer:3,blob:4};pR.exports={uid:kG,sentCloseFrameState:xG,staticPropertyDescriptors:SG,states:vG,opcodes:DG,maxUnsigned16Bit:TG,parserStates:NG,emptyBuffer:FG,sendHints:UG}});var Sa=T((J4,fR)=>{"use strict";fR.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}});var Da=T((q4,bR)=>{"use strict";var{kReadyState:va,kController:MG,kResponse:LG,kBinaryType:_G,kWebSocketURL:PG}=Sa(),{states:xa,opcodes:vr}=vs(),{ErrorEvent:OG,createFastMessageEvent:GG}=Wi(),{isUtf8:$G}=require("node:buffer"),{collectASequenceOfCodePointsFast:YG,removeHTTPWhitespace:mR}=ht();function VG(t){return t[va]===xa.CONNECTING}o(VG,"isConnecting");function HG(t){return t[va]===xa.OPEN}o(HG,"isEstablished");function JG(t){return t[va]===xa.CLOSING}o(JG,"isClosing");function qG(t){return t[va]===xa.CLOSED}o(qG,"isClosed");function Bp(t,e,n=(s,i)=>new Event(s,i),r={}){let s=n(t,r);e.dispatchEvent(s)}o(Bp,"fireEvent");function jG(t,e,n){if(t[va]!==xa.OPEN)return;let r;if(e===vr.TEXT)try{r=wR(n)}catch{CR(t,"Received invalid UTF-8 in text frame.");return}else e===vr.BINARY&&(t[_G]==="blob"?r=new Blob([n]):r=WG(n));Bp("message",t,GG,{origin:t[PG].origin,data:r})}o(jG,"websocketMessageReceived");function WG(t){return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}o(WG,"toArrayBuffer");function zG(t){if(t.length===0)return!1;for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n<33||n>126||n===34||n===40||n===41||n===44||n===47||n===58||n===59||n===60||n===61||n===62||n===63||n===64||n===91||n===92||n===93||n===123||n===125)return!1}return!0}o(zG,"isValidSubprotocol");function ZG(t){return t>=1e3&&t<1015?t!==1004&&t!==1005&&t!==1006:t>=3e3&&t<=4999}o(ZG,"isValidStatusCode");function CR(t,e){let{[MG]:n,[LG]:r}=t;n.abort(),r?.socket&&!r.socket.destroyed&&r.socket.destroy(),e&&Bp("error",t,(s,i)=>new OG(s,i),{error:new Error(e),message:e})}o(CR,"failWebsocketConnection");function IR(t){return t===vr.CLOSE||t===vr.PING||t===vr.PONG}o(IR,"isControlFrame");function yR(t){return t===vr.CONTINUATION}o(yR,"isContinuationFrame");function QR(t){return t===vr.TEXT||t===vr.BINARY}o(QR,"isTextBinaryFrame");function KG(t){return QR(t)||yR(t)||IR(t)}o(KG,"isValidOpcode");function XG(t){let e={position:0},n=new Map;for(;e.position<t.length;){let r=YG(";",t,e),[s,i=""]=r.split("=");n.set(mR(s,!0,!1),mR(i,!1,!0)),e.position++}return n}o(XG,"parseExtensions");function e$(t){if(t.length===0)return!1;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(r<48||r>57)return!1}let e=Number.parseInt(t,10);return e>=8&&e<=15}o(e$,"isValidClientWindowBits");var BR=typeof process.versions.icu=="string",ER=BR?new TextDecoder("utf-8",{fatal:!0}):void 0,wR=BR?ER.decode.bind(ER):function(t){if($G(t))return t.toString("utf-8");throw new TypeError("Invalid utf-8 received.")};bR.exports={isConnecting:VG,isEstablished:HG,isClosing:JG,isClosed:qG,fireEvent:Bp,isValidSubprotocol:zG,isValidStatusCode:ZG,failWebsocketConnection:CR,websocketMessageReceived:jG,utf8Decode:wR,isControlFrame:IR,isContinuationFrame:yR,isTextBinaryFrame:QR,isValidOpcode:KG,parseExtensions:XG,isValidClientWindowBits:e$}});var Cu=T((W4,RR)=>{"use strict";var{maxUnsigned16Bit:t$}=vs(),Eu=16386,wp,Ta=null,zi=Eu;try{wp=require("node:crypto")}catch{wp={randomFillSync:o(function(e,n,r){for(let s=0;s<e.length;++s)e[s]=Math.random()*255|0;return e},"randomFillSync")}}function n$(){return zi===Eu&&(zi=0,wp.randomFillSync(Ta??=Buffer.allocUnsafe(Eu),0,Eu)),[Ta[zi++],Ta[zi++],Ta[zi++],Ta[zi++]]}o(n$,"generateMask");var bp=class{static{o(this,"WebsocketFrameSend")}constructor(e){this.frameData=e}createFrame(e){let n=this.frameData,r=n$(),s=n?.byteLength??0,i=s,a=6;s>t$?(a+=8,i=127):s>125&&(a+=2,i=126);let c=Buffer.allocUnsafe(s+a);c[0]=c[1]=0,c[0]|=128,c[0]=(c[0]&240)+e;c[a-4]=r[0],c[a-3]=r[1],c[a-2]=r[2],c[a-1]=r[3],c[1]=i,i===126?c.writeUInt16BE(s,2):i===127&&(c[2]=c[3]=0,c.writeUIntBE(s,4,6)),c[1]|=128;for(let l=0;l<s;++l)c[a+l]=n[l]^r[l&3];return c}};RR.exports={WebsocketFrameSend:bp}});var kp=T((Z4,NR)=>{"use strict";var{uid:r$,states:Na,sentCloseFrameState:Iu,emptyBuffer:s$,opcodes:i$}=vs(),{kReadyState:Fa,kSentClose:yu,kByteParser:SR,kReceivedClose:kR,kResponse:vR}=Sa(),{fireEvent:o$,failWebsocketConnection:xr,isClosing:a$,isClosed:A$,isEstablished:c$,parseExtensions:u$}=Da(),{channels:Zi}=ci(),{CloseEvent:l$}=Wi(),{makeRequest:d$}=Yi(),{fetching:h$}=wa(),{Headers:g$,getHeadersList:p$}=Bs(),{getDecodeSplit:f$}=Qt(),{WebsocketFrameSend:m$}=Cu(),Rp;try{Rp=require("node:crypto")}catch{}function E$(t,e,n,r,s,i){let a=t;a.protocol=t.protocol==="ws:"?"http:":"https:";let c=d$({urlList:[a],client:n,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(i.headers){let g=p$(new g$(i.headers));c.headersList=g}let l=Rp.randomBytes(16).toString("base64");c.headersList.append("sec-websocket-key",l),c.headersList.append("sec-websocket-version","13");for(let g of e)c.headersList.append("sec-websocket-protocol",g);return c.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits"),h$({request:c,useParallelQueue:!0,dispatcher:i.dispatcher,processResponse(g){if(g.type==="error"||g.status!==101){xr(r,"Received network error or non-101 status code.");return}if(e.length!==0&&!g.headersList.get("Sec-WebSocket-Protocol")){xr(r,"Server did not respond with sent protocols.");return}if(g.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){xr(r,'Server did not set Upgrade header to "websocket".');return}if(g.headersList.get("Connection")?.toLowerCase()!=="upgrade"){xr(r,'Server did not set Connection header to "upgrade".');return}let f=g.headersList.get("Sec-WebSocket-Accept"),m=Rp.createHash("sha1").update(l+r$).digest("base64");if(f!==m){xr(r,"Incorrect hash received in Sec-WebSocket-Accept header.");return}let C=g.headersList.get("Sec-WebSocket-Extensions"),y;if(C!==null&&(y=u$(C),!y.has("permessage-deflate"))){xr(r,"Sec-WebSocket-Extensions header does not match.");return}let R=g.headersList.get("Sec-WebSocket-Protocol");if(R!==null){let Q=f$("sec-websocket-protocol",c.headersList);if(Q===null||!Q.includes(R)){xr(r,"Protocol was not set in the opening handshake.");return}}g.socket.on("data",xR),g.socket.on("close",DR),g.socket.on("error",TR),Zi.open.hasSubscribers&&Zi.open.publish({address:g.socket.address(),protocol:R,extensions:C}),s(g,y)}})}o(E$,"establishWebSocketConnection");function C$(t,e,n,r){if(!(a$(t)||A$(t)))if(!c$(t))xr(t,"Connection was closed before it was established."),t[Fa]=Na.CLOSING;else if(t[yu]===Iu.NOT_SENT){t[yu]=Iu.PROCESSING;let s=new m$;e!==void 0&&n===void 0?(s.frameData=Buffer.allocUnsafe(2),s.frameData.writeUInt16BE(e,0)):e!==void 0&&n!==void 0?(s.frameData=Buffer.allocUnsafe(2+r),s.frameData.writeUInt16BE(e,0),s.frameData.write(n,2,"utf-8")):s.frameData=s$,t[vR].socket.write(s.createFrame(i$.CLOSE)),t[yu]=Iu.SENT,t[Fa]=Na.CLOSING}else t[Fa]=Na.CLOSING}o(C$,"closeWebSocketConnection");function xR(t){this.ws[SR].write(t)||this.pause()}o(xR,"onSocketData");function DR(){let{ws:t}=this,{[vR]:e}=t;e.socket.off("data",xR),e.socket.off("close",DR),e.socket.off("error",TR);let n=t[yu]===Iu.SENT&&t[kR],r=1005,s="",i=t[SR].closingInfo;i&&!i.error?(r=i.code??1005,s=i.reason):t[kR]||(r=1006),t[Fa]=Na.CLOSED,o$("close",t,(a,c)=>new l$(a,c),{wasClean:n,code:r,reason:s}),Zi.close.hasSubscribers&&Zi.close.publish({websocket:t,code:r,reason:s})}o(DR,"onSocketClose");function TR(t){let{ws:e}=this;e[Fa]=Na.CLOSING,Zi.socketError.hasSubscribers&&Zi.socketError.publish(t),this.destroy()}o(TR,"onSocketError");NR.exports={establishWebSocketConnection:E$,closeWebSocketConnection:C$}});var UR=T((X4,FR)=>{"use strict";var{createInflateRaw:I$,Z_DEFAULT_WINDOWBITS:y$}=require("node:zlib"),{isValidClientWindowBits:Q$}=Da(),{MessageSizeExceededError:B$}=pe(),w$=Buffer.from([0,0,255,255]),Qu=Symbol("kBuffer"),Ua=Symbol("kLength"),Sp=class{static{o(this,"PerMessageDeflate")}#e;#t={};#n=0;constructor(e,n){this.#t.serverNoContextTakeover=e.has("server_no_context_takeover"),this.#t.serverMaxWindowBits=e.get("server_max_window_bits"),this.#n=n.maxPayloadSize}decompress(e,n,r){if(!this.#e){let s=y$;if(this.#t.serverMaxWindowBits){if(!Q$(this.#t.serverMaxWindowBits)){r(new Error("Invalid server_max_window_bits"));return}s=Number.parseInt(this.#t.serverMaxWindowBits)}try{this.#e=I$({windowBits:s})}catch(i){r(i);return}this.#e[Qu]=[],this.#e[Ua]=0,this.#e.on("data",i=>{if(this.#e[Ua]+=i.length,this.#n>0&&this.#e[Ua]>this.#n){r(new B$),this.#e.removeAllListeners(),this.#e.destroy(),this.#e=null;return}this.#e[Qu].push(i)}),this.#e.on("error",i=>{this.#e=null,r(i)})}this.#e.write(e),n&&this.#e.write(w$),this.#e.flush(()=>{if(!this.#e)return;let s=Buffer.concat(this.#e[Qu],this.#e[Ua]);this.#e[Qu].length=0,this.#e[Ua]=0,r(null,s)})}};FR.exports={PerMessageDeflate:Sp}});var VR=T((t5,YR)=>{"use strict";var{Writable:b$}=require("node:stream"),R$=require("node:assert"),{parserStates:Et,opcodes:Ki,states:k$,emptyBuffer:MR,sentCloseFrameState:LR}=vs(),{kReadyState:S$,kSentClose:_R,kResponse:vp,kReceivedClose:PR}=Sa(),{channels:Bu}=ci(),{isValidStatusCode:v$,isValidOpcode:x$,failWebsocketConnection:xt,websocketMessageReceived:OR,utf8Decode:D$,isControlFrame:xp,isTextBinaryFrame:Dp,isContinuationFrame:T$}=Da(),{WebsocketFrameSend:GR}=Cu(),{closeWebSocketConnection:$R}=kp(),{PerMessageDeflate:N$}=UR(),{MessageSizeExceededError:Tp}=pe();function Ma(t,e,n){$R(t,e,n,Buffer.byteLength(n)),xt(t,n)}o(Ma,"failWebsocketConnectionWithCode");var Np=class extends b${static{o(this,"ByteParser")}#e=[];#t=0;#n=0;#s=!1;#i=Et.INFO;#r={};#o=[];#a;#c;#A;constructor(e,n,r={}){super(),this.ws=e,this.#a=n??new Map,this.#c=r.maxFragments??0,this.#A=r.maxPayloadSize??0,this.#a.has("permessage-deflate")&&this.#a.set("permessage-deflate",new N$(n,r))}_write(e,n,r){this.#e.push(e),this.#n+=e.length,this.#s=!0,this.run(r)}#u(){return this.#A>0&&!xp(this.#r.opcode)&&this.#r.payloadLength+this.#t>this.#A?(Ma(this.ws,1009,"Payload size exceeds maximum allowed size"),!1):!0}run(e){for(;this.#s;)if(this.#i===Et.INFO){if(this.#n<2)return e();let n=this.consume(2),r=(n[0]&128)!==0,s=n[0]&15,i=(n[1]&128)===128,a=!r&&s!==Ki.CONTINUATION,c=n[1]&127,l=n[0]&64,d=n[0]&32,h=n[0]&16;if(!x$(s))return xt(this.ws,"Invalid opcode received"),e();if(i)return xt(this.ws,"Frame cannot be masked"),e();if(l!==0&&!this.#a.has("permessage-deflate")){xt(this.ws,"Expected RSV1 to be clear.");return}if(d!==0||h!==0){xt(this.ws,"RSV1, RSV2, RSV3 must be clear");return}if(a&&!Dp(s)){xt(this.ws,"Invalid frame type was fragmented.");return}if(Dp(s)&&this.#o.length>0){xt(this.ws,"Expected continuation frame");return}if(this.#r.fragmented&&a){xt(this.ws,"Fragmented frame exceeded 125 bytes.");return}if((c>125||a)&&xp(s)){xt(this.ws,"Control frame either too large or fragmented");return}if(T$(s)&&this.#o.length===0&&!this.#r.compressed){xt(this.ws,"Unexpected continuation frame");return}if(c<=125){if(this.#r.payloadLength=c,this.#i=Et.READ_DATA,!this.#u())return}else c===126?this.#i=Et.PAYLOADLENGTH_16:c===127&&(this.#i=Et.PAYLOADLENGTH_64);Dp(s)&&(this.#r.binaryType=s,this.#r.compressed=l!==0),this.#r.opcode=s,this.#r.masked=i,this.#r.fin=r,this.#r.fragmented=a}else if(this.#i===Et.PAYLOADLENGTH_16){if(this.#n<2)return e();let n=this.consume(2);if(this.#r.payloadLength=n.readUInt16BE(0),this.#i=Et.READ_DATA,!this.#u())return}else if(this.#i===Et.PAYLOADLENGTH_64){if(this.#n<8)return e();let n=this.consume(8),r=n.readUInt32BE(0),s=n.readUInt32BE(4);if(r!==0||s>2**31-1){xt(this.ws,"Received payload length > 2^31 bytes.");return}if(this.#r.payloadLength=s,this.#i=Et.READ_DATA,!this.#u())return}else if(this.#i===Et.READ_DATA){if(this.#n<this.#r.payloadLength)return e();let n=this.consume(this.#r.payloadLength);if(xp(this.#r.opcode)){this.#s=this.parseControlFrame(n),this.#i=Et.INFO;let r=this.ws[vp].socket;if(this.#s&&r.writableNeedDrain){this.#s=!1,r.once("drain",()=>{this.destroyed||(this.#s=!0,this.run(e))});return}}else if(this.#r.compressed){this.#a.get("permessage-deflate").decompress(n,this.#r.fin,(r,s)=>{if(r){let i=r instanceof Tp?1009:1007;Ma(this.ws,i,r.message);return}if(this.writeFragments(s)){if(this.#A>0&&this.#t>this.#A){Ma(this.ws,1009,new Tp().message);return}if(!this.#r.fin){this.#i=Et.INFO,this.#s=!0,this.run(e);return}OR(this.ws,this.#r.binaryType,this.consumeFragments()),this.#s=!0,this.#i=Et.INFO,this.run(e)}}),this.#s=!1;break}else{if(!this.writeFragments(n))return;if(this.#A>0&&this.#t>this.#A){Ma(this.ws,1009,new Tp().message);return}!this.#r.fragmented&&this.#r.fin&&OR(this.ws,this.#r.binaryType,this.consumeFragments()),this.#i=Et.INFO}}}consume(e){if(e>this.#n)throw new Error("Called consume() before buffers satiated.");if(e===0)return MR;if(this.#e[0].length===e)return this.#n-=this.#e[0].length,this.#e.shift();let n=Buffer.allocUnsafe(e),r=0;for(;r!==e;){let s=this.#e[0],{length:i}=s;if(i+r===e){n.set(this.#e.shift(),r);break}else if(i+r>e){n.set(s.subarray(0,e-r),r),this.#e[0]=s.subarray(e-r);break}else n.set(this.#e.shift(),r),r+=s.length}return this.#n-=e,n}writeFragments(e){return this.#c>0&&this.#o.length===this.#c?(Ma(this.ws,1008,"Too many message fragments"),!1):(this.#t+=e.length,this.#o.push(e),!0)}consumeFragments(){let e=this.#o;if(e.length===1)return this.#t=0,e.shift();let n=Buffer.concat(e,this.#t);return this.#o=[],this.#t=0,n}parseCloseBody(e){R$(e.length!==1);let n;if(e.length>=2&&(n=e.readUInt16BE(0)),n!==void 0&&!v$(n))return{code:1002,reason:"Invalid status code",error:!0};let r=e.subarray(2);r[0]===239&&r[1]===187&&r[2]===191&&(r=r.subarray(3));try{r=D$(r)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:n,reason:r,error:!1}}parseControlFrame(e){let{opcode:n,payloadLength:r}=this.#r;if(n===Ki.CLOSE){if(r===1)return xt(this.ws,"Received close frame with a 1-byte body."),!1;if(this.#r.closeInfo=this.parseCloseBody(e),this.#r.closeInfo.error){let{code:s,reason:i}=this.#r.closeInfo;return $R(this.ws,s,i,i.length),xt(this.ws,i),!1}if(this.ws[_R]!==LR.SENT){let s=MR;this.#r.closeInfo.code&&(s=Buffer.allocUnsafe(2),s.writeUInt16BE(this.#r.closeInfo.code,0));let i=new GR(s);this.ws[vp].socket.write(i.createFrame(Ki.CLOSE),a=>{a||(this.ws[_R]=LR.SENT)})}return this.ws[S$]=k$.CLOSING,this.ws[PR]=!0,!1}else if(n===Ki.PING){if(!this.ws[PR]){let s=new GR(e);this.ws[vp].socket.write(s.createFrame(Ki.PONG)),Bu.ping.hasSubscribers&&Bu.ping.publish({payload:e})}}else n===Ki.PONG&&Bu.pong.hasSubscribers&&Bu.pong.publish({payload:e});return!0}get closingInfo(){return this.#r.closeInfo}};YR.exports={ByteParser:Np}});var WR=T((r5,jR)=>{"use strict";var{WebsocketFrameSend:F$}=Cu(),{opcodes:HR,sendHints:Xi}=vs(),U$=_h(),JR=Buffer[Symbol.species],Fp=class{static{o(this,"SendQueue")}#e=new U$;#t=!1;#n;constructor(e){this.#n=e}add(e,n,r){if(r!==Xi.blob){let i=qR(e,r);if(!this.#t)this.#n.write(i,n);else{let a={promise:null,callback:n,frame:i};this.#e.push(a)}return}let s={promise:e.arrayBuffer().then(i=>{s.promise=null,s.frame=qR(i,r)}),callback:n,frame:null};this.#e.push(s),this.#t||this.#s()}async#s(){this.#t=!0;let e=this.#e;for(;!e.isEmpty();){let n=e.shift();n.promise!==null&&await n.promise,this.#n.write(n.frame,n.callback),n.callback=n.frame=null}this.#t=!1}};function qR(t,e){return new F$(M$(t,e)).createFrame(e===Xi.string?HR.TEXT:HR.BINARY)}o(qR,"createFrame");function M$(t,e){switch(e){case Xi.string:return Buffer.from(t);case Xi.arrayBuffer:case Xi.blob:return new JR(t);case Xi.typedArray:return new JR(t.buffer,t.byteOffset,t.byteLength)}}o(M$,"toBuffer");jR.exports={SendQueue:Fp}});var ik=T((i5,sk)=>{"use strict";var{webidl:re}=je(),{URLSerializer:L$}=ht(),{environmentSettingsObject:zR}=Qt(),{staticPropertyDescriptors:Dr,states:La,sentCloseFrameState:_$,sendHints:wu}=vs(),{kWebSocketURL:ZR,kReadyState:Up,kController:KR,kBinaryType:bu,kResponse:XR,kSentClose:P$,kByteParser:O$}=Sa(),{isConnecting:G$,isEstablished:$$,isClosing:Y$,isValidSubprotocol:V$,fireEvent:ek}=Da(),{establishWebSocketConnection:H$,closeWebSocketConnection:tk}=kp(),{ByteParser:J$}=VR(),{kEnumerableProperty:Vt,isBlobLike:nk}=ue(),{getGlobalDispatcher:q$}=Ca(),{types:rk}=require("node:util"),{ErrorEvent:j$,CloseEvent:W$}=Wi(),{SendQueue:z$}=WR(),Dt=class t extends EventTarget{static{o(this,"WebSocket")}#e={open:null,error:null,close:null,message:null};#t=0;#n="";#s="";#i;constructor(e,n=[]){super(),re.util.markAsUncloneable(this);let r="WebSocket constructor";re.argumentLengthCheck(arguments,1,r);let s=re.converters["DOMString or sequence<DOMString> or WebSocketInit"](n,r,"options");e=re.converters.USVString(e,r,"url"),n=s.protocols;let i=zR.settingsObject.baseUrl,a;try{a=new URL(e,i)}catch(l){throw new DOMException(l,"SyntaxError")}if(a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),a.protocol!=="ws:"&&a.protocol!=="wss:")throw new DOMException(`Expected a ws: or wss: protocol, got ${a.protocol}`,"SyntaxError");if(a.hash||a.href.endsWith("#"))throw new DOMException("Got fragment","SyntaxError");if(typeof n=="string"&&(n=[n]),n.length!==new Set(n.map(l=>l.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(n.length>0&&!n.every(l=>V$(l)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this[ZR]=new URL(a.href);let c=zR.settingsObject;this[KR]=H$(a,n,c,this,(l,d)=>this.#r(l,d),s),this[Up]=t.CONNECTING,this[P$]=_$.NOT_SENT,this[bu]="blob"}close(e=void 0,n=void 0){re.brandCheck(this,t);let r="WebSocket.close";if(e!==void 0&&(e=re.converters["unsigned short"](e,r,"code",{clamp:!0})),n!==void 0&&(n=re.converters.USVString(n,r,"reason")),e!==void 0&&e!==1e3&&(e<3e3||e>4999))throw new DOMException("invalid code","InvalidAccessError");let s=0;if(n!==void 0&&(s=Buffer.byteLength(n),s>123))throw new DOMException(`Reason must be less than 123 bytes; received ${s}`,"SyntaxError");tk(this,e,n,s)}send(e){re.brandCheck(this,t);let n="WebSocket.send";if(re.argumentLengthCheck(arguments,1,n),e=re.converters.WebSocketSendData(e,n,"data"),G$(this))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!$$(this)||Y$(this)))if(typeof e=="string"){let r=Buffer.byteLength(e);this.#t+=r,this.#i.add(e,()=>{this.#t-=r},wu.string)}else rk.isArrayBuffer(e)?(this.#t+=e.byteLength,this.#i.add(e,()=>{this.#t-=e.byteLength},wu.arrayBuffer)):ArrayBuffer.isView(e)?(this.#t+=e.byteLength,this.#i.add(e,()=>{this.#t-=e.byteLength},wu.typedArray)):nk(e)&&(this.#t+=e.size,this.#i.add(e,()=>{this.#t-=e.size},wu.blob))}get readyState(){return re.brandCheck(this,t),this[Up]}get bufferedAmount(){return re.brandCheck(this,t),this.#t}get url(){return re.brandCheck(this,t),L$(this[ZR])}get extensions(){return re.brandCheck(this,t),this.#s}get protocol(){return re.brandCheck(this,t),this.#n}get onopen(){return re.brandCheck(this,t),this.#e.open}set onopen(e){re.brandCheck(this,t),this.#e.open&&this.removeEventListener("open",this.#e.open),typeof e=="function"?(this.#e.open=e,this.addEventListener("open",e)):this.#e.open=null}get onerror(){return re.brandCheck(this,t),this.#e.error}set onerror(e){re.brandCheck(this,t),this.#e.error&&this.removeEventListener("error",this.#e.error),typeof e=="function"?(this.#e.error=e,this.addEventListener("error",e)):this.#e.error=null}get onclose(){return re.brandCheck(this,t),this.#e.close}set onclose(e){re.brandCheck(this,t),this.#e.close&&this.removeEventListener("close",this.#e.close),typeof e=="function"?(this.#e.close=e,this.addEventListener("close",e)):this.#e.close=null}get onmessage(){return re.brandCheck(this,t),this.#e.message}set onmessage(e){re.brandCheck(this,t),this.#e.message&&this.removeEventListener("message",this.#e.message),typeof e=="function"?(this.#e.message=e,this.addEventListener("message",e)):this.#e.message=null}get binaryType(){return re.brandCheck(this,t),this[bu]}set binaryType(e){re.brandCheck(this,t),e!=="blob"&&e!=="arraybuffer"?this[bu]="blob":this[bu]=e}#r(e,n){this[XR]=e;let r=this[KR]?.dispatcher?.webSocketOptions,s=r?.maxFragments,i=r?.maxPayloadSize,a=new J$(this,n,{maxFragments:s,maxPayloadSize:i});a.on("drain",Z$),a.on("error",K$.bind(this)),e.socket.ws=this,this[O$]=a,this.#i=new z$(e.socket),this[Up]=La.OPEN;let c=e.headersList.get("sec-websocket-extensions");c!==null&&(this.#s=c);let l=e.headersList.get("sec-websocket-protocol");l!==null&&(this.#n=l),ek("open",this)}};Dt.CONNECTING=Dt.prototype.CONNECTING=La.CONNECTING;Dt.OPEN=Dt.prototype.OPEN=La.OPEN;Dt.CLOSING=Dt.prototype.CLOSING=La.CLOSING;Dt.CLOSED=Dt.prototype.CLOSED=La.CLOSED;Object.defineProperties(Dt.prototype,{CONNECTING:Dr,OPEN:Dr,CLOSING:Dr,CLOSED:Dr,url:Vt,readyState:Vt,bufferedAmount:Vt,onopen:Vt,onerror:Vt,onclose:Vt,close:Vt,onmessage:Vt,binaryType:Vt,send:Vt,extensions:Vt,protocol:Vt,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(Dt,{CONNECTING:Dr,OPEN:Dr,CLOSING:Dr,CLOSED:Dr});re.converters["sequence<DOMString>"]=re.sequenceConverter(re.converters.DOMString);re.converters["DOMString or sequence<DOMString>"]=function(t,e,n){return re.util.Type(t)==="Object"&&Symbol.iterator in t?re.converters["sequence<DOMString>"](t):re.converters.DOMString(t,e,n)};re.converters.WebSocketInit=re.dictionaryConverter([{key:"protocols",converter:re.converters["DOMString or sequence<DOMString>"],defaultValue:o(()=>new Array(0),"defaultValue")},{key:"dispatcher",converter:re.converters.any,defaultValue:o(()=>q$(),"defaultValue")},{key:"headers",converter:re.nullableConverter(re.converters.HeadersInit)}]);re.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(t){return re.util.Type(t)==="Object"&&!(Symbol.iterator in t)?re.converters.WebSocketInit(t):{protocols:re.converters["DOMString or sequence<DOMString>"](t)}};re.converters.WebSocketSendData=function(t){if(re.util.Type(t)==="Object"){if(nk(t))return re.converters.Blob(t,{strict:!1});if(ArrayBuffer.isView(t)||rk.isArrayBuffer(t))return re.converters.BufferSource(t)}return re.converters.USVString(t)};function Z$(){this.ws[XR].socket.resume()}o(Z$,"onParserDrain");function K$(t){let e,n;t instanceof W$?(e=t.reason,n=t.code):e=t.message,ek("error",this,()=>new j$("error",{error:t,message:e})),tk(this,n)}o(K$,"onParserError");sk.exports={WebSocket:Dt}});var Mp=T((a5,ok)=>{"use strict";function X$(t){return t.indexOf("\0")===-1}o(X$,"isValidLastEventId");function eY(t){if(t.length===0)return!1;for(let e=0;e<t.length;e++)if(t.charCodeAt(e)<48||t.charCodeAt(e)>57)return!1;return!0}o(eY,"isASCIINumber");function tY(t){return new Promise(e=>{setTimeout(e,t).unref()})}o(tY,"delay");ok.exports={isValidLastEventId:X$,isASCIINumber:eY,delay:tY}});var Ak=T((c5,ak)=>{"use strict";var nY=require("node:buffer"),{Transform:rY}=require("node:stream"),{isASCIINumber:sY,isValidLastEventId:iY}=Mp(),eo=[239,187,191],Ru=10,_a=13,oY=58,aY=32,AY=nY.kStringMaxLength,cY=Buffer.from("data"),uY=Buffer.from("event"),lY=Buffer.from("id"),dY=Buffer.from("retry"),hY=1024,gY=131072,pY=128;function fY(t,e){if(e>=t.length)return!1;for(let n=e;n<t.length;n++)if(t[n]<48||t[n]>57)return!1;return!0}o(fY,"isASCIINumberBytes");function mY(t,e){for(let n=e;n<t.length;n++)if(t[n]===0)return!1;return!0}o(mY,"isValidLastEventIdBytes");function ku(t,e,n){if(e!==n.length)return!1;for(let r=0;r<e;r++)if(t[r]!==n[r])return!1;return!0}o(ku,"isFieldName");function Su(){let t=new Error("EventSource message size exceeded");return t.aborted=!1,t}o(Su,"createMaxEventSizeExceededError");var Lp=class extends rY{static{o(this,"EventSourceStream")}state=null;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;chunks=[];chunkIndex=0;pos=0;lineChunkIndex=0;linePos=0;lineLength=0;eventSize=0;eventFieldSizes={data:0,event:0,id:0,retry:0};dataLineCount=0;maxEventSize;maxDataLines;maxBufferedChunks;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(e={}){e.readableObjectMode=!0,super(e),this.state=e.eventSourceSettings||{},this.maxEventSize=e.maxEventSize??AY;let n=this.maxEventSize>0?Math.min(gY,Math.max(hY,Math.floor(this.maxEventSize/pY))):0;this.maxDataLines=n,this.maxBufferedChunks=n,e.push&&(this.push=e.push)}_transform(e,n,r){if(e.length===0){r();return}if(this.maxEventSize>0&&this.chunks.length>=this.maxBufferedChunks&&e[0]!==Ru&&e[0]!==_a){r(Su());return}if(this.chunks.push(e),this.checkBOM&&this.handleBOM()){r();return}for(;this.hasCurrentByte();){let s=this.currentByte();if(this.eventEndCheck){if(this.crlfCheck){if(s===Ru){this.crlfCheck=!1,this.consumeCurrentByte();continue}this.crlfCheck=!1}if(s===Ru||s===_a){s===_a&&(this.crlfCheck=!0),this.consumeCurrentByte(),this.hasPendingEvent()&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1;continue}if(s===Ru||s===_a){s===_a&&(this.crlfCheck=!0);try{this.parseLine(this.readLine(),this.event)}catch(i){r(i);return}this.consumeCurrentByte(),this.eventEndCheck=!0;continue}if(this.maxEventSize>0&&++this.lineLength>this.maxEventSize+7){r(Su());return}this.advanceCursor()}r()}_destroy(e,n){this.chunks.length=0,this.clearEvent(),super._destroy(e,n)}parseLine(e,n){if(e.length===0)return;let r=e.indexOf(oY);if(r===0)return;let s=e.length,i=e.length;if(r!==-1&&(s=r,i=r+1,e[i]===aY&&++i),ku(e,s,cY)){if(this.maxEventSize>0&&this.dataLineCount>=this.maxDataLines)throw Su();let a=e.length-i,c=this.eventFieldSizes.data+(n.data===void 0?0:1)+a;this.setEventFieldSize("data",c);let l=e.toString("utf8",i);n.data===void 0?n.data=l:n.data+=`
46
- ${l}`,this.dataLineCount++;return}if(ku(e,s,dY)){fY(e,i)&&(this.setEventFieldSize("retry",e.length-i),n.retry=e.toString("utf8",i));return}if(ku(e,s,lY)){mY(e,i)&&(this.setEventFieldSize("id",e.length-i),n.id=e.toString("utf8",i));return}ku(e,s,uY)&&i<e.length&&(this.setEventFieldSize("event",e.length-i),n.event=e.toString("utf8",i))}setEventFieldSize(e,n){let r=this.eventSize-this.eventFieldSizes[e]+n;if(this.maxEventSize>0&&r>this.maxEventSize)throw Su();this.eventSize=r,this.eventFieldSizes[e]=n}processEvent(e){e.retry&&sY(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id&&iY(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,this.event.event=void 0,this.event.id=void 0,this.event.retry=void 0,this.eventSize=0,this.dataLineCount=0,this.eventFieldSizes.data=0,this.eventFieldSizes.event=0,this.eventFieldSizes.id=0,this.eventFieldSizes.retry=0}hasPendingEvent(){return this.event.data!==void 0||this.event.event!==void 0||this.event.id!==void 0||this.event.retry!==void 0}hasCurrentByte(){return this.chunkIndex<this.chunks.length&&this.pos<this.chunks[this.chunkIndex].length}currentByte(){return this.chunks[this.chunkIndex][this.pos]}consumeCurrentByte(){this.advanceCursor(),this.syncLineStartToCursor()}advanceCursor(){for(this.pos++;this.chunkIndex<this.chunks.length&&this.pos>=this.chunks[this.chunkIndex].length;)this.chunkIndex++,this.pos=0}syncLineStartToCursor(){this.lineChunkIndex=this.chunkIndex,this.linePos=this.pos,this.lineLength=0,this.dropConsumedChunks()}dropConsumedChunks(){if(this.lineChunkIndex>0){let e=this.lineChunkIndex;this.chunks.splice(0,e),this.lineChunkIndex=0,this.chunkIndex-=e}this.chunkIndex===this.chunks.length&&(this.chunks.length=0,this.chunkIndex=0,this.pos=0,this.lineChunkIndex=0,this.linePos=0)}readLine(){if(this.lineChunkIndex===this.chunkIndex)return this.chunks[this.chunkIndex].subarray(this.linePos,this.pos);let e=[],n=0;for(let r=this.lineChunkIndex;r<=this.chunkIndex;r++){let s=this.chunks[r],i=r===this.lineChunkIndex?this.linePos:0,a=r===this.chunkIndex?this.pos:s.length,c=s.subarray(i,a);n+=c.length,e.push(c)}return Buffer.concat(e,n)}peekBufferedByte(e){let n=this.lineChunkIndex,r=this.linePos;for(;n<this.chunks.length;){let s=this.chunks[n],i=s.length-r;if(e<i)return s[r+e];e-=i,n++,r=0}}discardLeadingBytes(e){for(;e>0&&this.lineChunkIndex<this.chunks.length;){let r=this.chunks[this.lineChunkIndex].length-this.linePos;e<r?(this.linePos+=e,e=0):(e-=r,this.lineChunkIndex++,this.linePos=0)}this.chunkIndex=this.lineChunkIndex,this.pos=this.linePos,this.dropConsumedChunks()}handleBOM(){let e=this.peekBufferedByte(0),n=this.peekBufferedByte(1),r=this.peekBufferedByte(2);return n===void 0?(e===eo[0]||(this.checkBOM=!1),!0):r===void 0?e===eo[0]&&n===eo[1]?!0:(this.checkBOM=!1,!1):(e===eo[0]&&n===eo[1]&&r===eo[2]&&this.discardLeadingBytes(3),this.checkBOM=!1,!this.hasCurrentByte())}};ak.exports={EventSourceStream:Lp}});var fk=T((l5,pk)=>{"use strict";var{pipeline:EY}=require("node:stream"),{fetching:CY}=wa(),{makeRequest:IY}=Yi(),{webidl:zn}=je(),{EventSourceStream:yY}=Ak(),{parseMIMEType:QY}=ht(),{createFastMessageEvent:BY}=Wi(),{isNetworkError:ck}=Qa(),{delay:wY}=Mp(),{kEnumerableProperty:xs}=ue(),{environmentSettingsObject:uk}=Qt(),{getGlobalDispatcher:bY}=Ca(),lk=!1,dk=3e3,Pa=0,hk=1,Oa=2,RY="anonymous",kY="use-credentials",to=class t extends EventTarget{static{o(this,"EventSource")}#e={open:null,error:null,message:null};#t=null;#n=!1;#s=Pa;#i=null;#r=null;#o;#a;constructor(e,n={}){super(),zn.util.markAsUncloneable(this);let r="EventSource constructor";zn.argumentLengthCheck(arguments,1,r),lk||(lk=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=zn.converters.USVString(e,r,"url"),n=zn.converters.EventSourceInitDict(n,r,"eventSourceInitDict"),this.#o=n.dispatcher,this.#a={lastEventId:"",reconnectionTime:dk};let s=uk,i;try{i=new URL(e,s.settingsObject.baseUrl),this.#a.origin=i.origin}catch(l){throw new DOMException(l,"SyntaxError")}this.#t=i.href;let a=RY;n.withCredentials&&(a=kY,this.#n=!0);let c={redirect:"follow",keepalive:!0,mode:"cors",credentials:a==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};c.client=uk.settingsObject,c.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],c.cache="no-store",c.initiator="other",c.urlList=[new URL(this.#t)],this.#i=IY(c),this.#c()}get readyState(){return this.#s}get url(){return this.#t}get withCredentials(){return this.#n}#c(){if(this.#s===Oa)return;this.#s=Pa;let e={request:this.#i,dispatcher:this.#o},n=o(r=>{ck(r)&&(this.dispatchEvent(new Event("error")),this.close()),this.#A()},"processEventSourceEndOfBody");e.processResponseEndOfBody=n,e.processResponse=r=>{if(ck(r))if(r.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#A();return}let s=r.headersList.get("content-type",!0),i=s!==null?QY(s):"failure",a=i!=="failure"&&i.essence==="text/event-stream";if(r.status!==200||a===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#s=hk,this.dispatchEvent(new Event("open")),this.#a.origin=r.urlList[r.urlList.length-1].origin;let c=new yY({eventSourceSettings:this.#a,maxEventSize:this.#o.eventSourceOptions?.maxEventSize,push:o(l=>{this.dispatchEvent(BY(l.type,l.options))},"push")});EY(r.body.stream,c,l=>{l?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#r=CY(e)}async#A(){this.#s!==Oa&&(this.#s=Pa,this.dispatchEvent(new Event("error")),await wY(this.#a.reconnectionTime),this.#s===Pa&&(this.#a.lastEventId.length&&this.#i.headersList.set("last-event-id",this.#a.lastEventId,!0),this.#c()))}close(){zn.brandCheck(this,t),this.#s!==Oa&&(this.#s=Oa,this.#r.abort(),this.#i=null)}get onopen(){return this.#e.open}set onopen(e){this.#e.open&&this.removeEventListener("open",this.#e.open),typeof e=="function"?(this.#e.open=e,this.addEventListener("open",e)):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(e){this.#e.message&&this.removeEventListener("message",this.#e.message),typeof e=="function"?(this.#e.message=e,this.addEventListener("message",e)):this.#e.message=null}get onerror(){return this.#e.error}set onerror(e){this.#e.error&&this.removeEventListener("error",this.#e.error),typeof e=="function"?(this.#e.error=e,this.addEventListener("error",e)):this.#e.error=null}},gk={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:Pa,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:hk,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:Oa,writable:!1}};Object.defineProperties(to,gk);Object.defineProperties(to.prototype,gk);Object.defineProperties(to.prototype,{close:xs,onerror:xs,onmessage:xs,onopen:xs,readyState:xs,url:xs,withCredentials:xs});zn.converters.EventSourceInitDict=zn.dictionaryConverter([{key:"withCredentials",converter:zn.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"dispatcher",converter:zn.converters.any,defaultValue:o(()=>bY(),"defaultValue")}]);pk.exports={EventSource:to,defaultReconnectionTime:dk}});var Ik=T((h5,ne)=>{"use strict";var SY=vi(),mk=Go(),vY=xi(),xY=mQ(),DY=Di(),TY=sg(),NY=GQ(),FY=jQ(),Ek=pe(),xu=ue(),{InvalidArgumentError:vu}=Ek,no=FB(),UY=Yo(),MY=Pg(),LY=fw(),_Y=$g(),PY=Rg(),OY=Dc(),{getGlobalDispatcher:Ck,setGlobalDispatcher:GY}=Ca(),$Y=Gc(),YY=Ic(),VY=yc();Object.assign(mk.prototype,no);ne.exports.Dispatcher=mk;ne.exports.Client=SY;ne.exports.Pool=vY;ne.exports.BalancedPool=xY;ne.exports.Agent=DY;ne.exports.ProxyAgent=TY;ne.exports.EnvHttpProxyAgent=NY;ne.exports.RetryAgent=FY;ne.exports.RetryHandler=OY;ne.exports.DecoratorHandler=$Y;ne.exports.RedirectHandler=YY;ne.exports.createRedirectInterceptor=VY;ne.exports.interceptors={redirect:Bw(),retry:bw(),dump:kw(),dns:xw()};ne.exports.buildConnector=UY;ne.exports.errors=Ek;ne.exports.util={parseHeaders:xu.parseHeaders,headerNameToString:xu.headerNameToString};function Ga(t){return(e,n,r)=>{if(typeof n=="function"&&(r=n,n=null),!e||typeof e!="string"&&typeof e!="object"&&!(e instanceof URL))throw new vu("invalid url");if(n!=null&&typeof n!="object")throw new vu("invalid opts");if(n&&n.path!=null){if(typeof n.path!="string")throw new vu("invalid opts.path");let a=n.path;n.path.startsWith("/")||(a=`/${a}`),e=new URL(xu.parseOrigin(e).origin+a)}else n||(n=typeof e=="object"?e:{}),e=xu.parseURL(e);let{agent:s,dispatcher:i=Ck()}=n;if(s)throw new vu("unsupported opts.agent. Did you mean opts.client?");return t.call(i,{...n,origin:e.origin,path:e.search?`${e.pathname}${e.search}`:e.pathname,method:n.method||(n.body?"PUT":"GET")},r)}}o(Ga,"makeDispatcher");ne.exports.setGlobalDispatcher=GY;ne.exports.getGlobalDispatcher=Ck;var HY=wa().fetch;ne.exports.fetch=o(async function(e,n=void 0){try{return await HY(e,n)}catch(r){throw r&&typeof r=="object"&&Error.captureStackTrace(r),r}},"fetch");ne.exports.Headers=Bs().Headers;ne.exports.Response=Qa().Response;ne.exports.Request=Yi().Request;ne.exports.FormData=zo().FormData;ne.exports.File=globalThis.File??require("node:buffer").File;ne.exports.FileReader=Jb().FileReader;var{setGlobalOrigin:JY,getGlobalOrigin:qY}=rh();ne.exports.setGlobalOrigin=JY;ne.exports.getGlobalOrigin=qY;var{CacheStorage:jY}=tR(),{kConstruct:WY}=Au();ne.exports.caches=new jY(WY);var{deleteCookie:zY,getCookies:ZY,getSetCookies:KY,setCookie:XY}=dR();ne.exports.deleteCookie=zY;ne.exports.getCookies=ZY;ne.exports.getSetCookies=KY;ne.exports.setCookie=XY;var{parseMIMEType:e2,serializeAMimeType:t2}=ht();ne.exports.parseMIMEType=e2;ne.exports.serializeAMimeType=t2;var{CloseEvent:n2,ErrorEvent:r2,MessageEvent:s2}=Wi();ne.exports.WebSocket=ik().WebSocket;ne.exports.CloseEvent=n2;ne.exports.ErrorEvent=r2;ne.exports.MessageEvent=s2;ne.exports.request=Ga(no.request);ne.exports.stream=Ga(no.stream);ne.exports.pipeline=Ga(no.pipeline);ne.exports.connect=Ga(no.connect);ne.exports.upgrade=Ga(no.upgrade);ne.exports.MockClient=MY;ne.exports.MockPool=_Y;ne.exports.MockAgent=LY;ne.exports.mockErrors=PY;var{EventSource:i2}=fk();ne.exports.EventSource=i2});var z2={};jp(z2,{AppRefusal:()=>an,AppUnreachable:()=>Ds,AttemptEndReason:()=>yo,DeliveryStatus:()=>gA,GitHubWriteKind:()=>mA,NoReportCause:()=>Qo,SourceProvider:()=>Kr,V3Attempt:()=>Ja,ValidationSufficiency:()=>Zr,closedV3Attempt:()=>Pk,endV3Attempt:()=>$k,heartbeatV3Attempt:()=>qp,startV3Attempt:()=>_k,uploadV3Report:()=>Gk});module.exports=jk(z2);var A={};jp(A,{BRAND:()=>IS,DIRTY:()=>Fr,EMPTY_PATH:()=>Kk,INVALID:()=>Z,NEVER:()=>sv,OK:()=>We,ParseStatus:()=>He,Schema:()=>Ae,ZodAny:()=>sr,ZodArray:()=>Dn,ZodBigInt:()=>Mr,ZodBoolean:()=>Lr,ZodBranded:()=>go,ZodCatch:()=>jr,ZodDate:()=>_r,ZodDefault:()=>qr,ZodDiscriminatedUnion:()=>sA,ZodEffects:()=>Mt,ZodEnum:()=>Hr,ZodError:()=>ct,ZodFirstPartyTypeKind:()=>ee,ZodFunction:()=>oA,ZodIntersection:()=>$r,ZodIssueCode:()=>N,ZodLazy:()=>Yr,ZodLiteral:()=>Vr,ZodMap:()=>Os,ZodNaN:()=>$s,ZodNativeEnum:()=>Jr,ZodNever:()=>Jt,ZodNull:()=>Or,ZodNullable:()=>dn,ZodNumber:()=>Ur,ZodObject:()=>ut,ZodOptional:()=>Ft,ZodParsedType:()=>O,ZodPipeline:()=>po,ZodPromise:()=>ir,ZodReadonly:()=>Wr,ZodRecord:()=>iA,ZodSchema:()=>Ae,ZodSet:()=>Gs,ZodString:()=>rr,ZodSymbol:()=>_s,ZodTransformer:()=>Mt,ZodTuple:()=>ln,ZodType:()=>Ae,ZodUndefined:()=>Pr,ZodUnion:()=>Gr,ZodUnknown:()=>xn,ZodVoid:()=>Ps,addIssueToContext:()=>_,any:()=>vS,array:()=>NS,bigint:()=>wS,boolean:()=>af,coerce:()=>rv,custom:()=>rf,date:()=>bS,datetimeRegex:()=>tf,defaultErrorMap:()=>Sn,discriminatedUnion:()=>LS,effect:()=>WS,enum:()=>JS,function:()=>YS,getErrorMap:()=>Us,getParsedType:()=>un,instanceof:()=>QS,intersection:()=>_S,isAborted:()=>nA,isAsync:()=>Ms,isDirty:()=>rA,isValid:()=>nr,late:()=>yS,lazy:()=>VS,literal:()=>HS,makeIssue:()=>ho,map:()=>GS,nan:()=>BS,nativeEnum:()=>qS,never:()=>DS,null:()=>SS,nullable:()=>ZS,number:()=>of,object:()=>FS,objectUtil:()=>$u,oboolean:()=>nv,onumber:()=>tv,optional:()=>zS,ostring:()=>ev,pipeline:()=>XS,preprocess:()=>KS,promise:()=>jS,quotelessJson:()=>Wk,record:()=>OS,set:()=>$S,setErrorMap:()=>Zk,strictObject:()=>US,string:()=>sf,symbol:()=>RS,transformer:()=>WS,tuple:()=>PS,undefined:()=>kS,union:()=>MS,unknown:()=>xS,util:()=>le,void:()=>TS});var le;(function(t){t.assertEqual=s=>{};function e(s){}o(e,"assertIs"),t.assertIs=e;function n(s){throw new Error}o(n,"assertNever"),t.assertNever=n,t.arrayToEnum=s=>{let i={};for(let a of s)i[a]=a;return i},t.getValidEnumValues=s=>{let i=t.objectKeys(s).filter(c=>typeof s[s[c]]!="number"),a={};for(let c of i)a[c]=s[c];return t.objectValues(a)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let a in s)Object.prototype.hasOwnProperty.call(s,a)&&i.push(a);return i},t.find=(s,i)=>{for(let a of s)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}o(r,"joinValues"),t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(le||(le={}));var $u;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})($u||($u={}));var O=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),un=o(t=>{switch(typeof t){case"undefined":return O.undefined;case"string":return O.string;case"number":return Number.isNaN(t)?O.nan:O.number;case"boolean":return O.boolean;case"function":return O.function;case"bigint":return O.bigint;case"symbol":return O.symbol;case"object":return Array.isArray(t)?O.array:t===null?O.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?O.promise:typeof Map<"u"&&t instanceof Map?O.map:typeof Set<"u"&&t instanceof Set?O.set:typeof Date<"u"&&t instanceof Date?O.date:O.object;default:return O.unknown}},"getParsedType");var N=le.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Wk=o(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),ct=class t extends Error{static{o(this,"ZodError")}get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},r={_errors:[]},s=o(i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let c=r,l=0;for(;l<a.path.length;){let d=a.path[l],h=l===a.path.length-1;if(d==="_errors"){h&&c._errors.push(n(a)),l++;continue}Object.prototype.hasOwnProperty.call(c,d)||(d==="__proto__"?Object.defineProperty(c,d,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):c[d]={_errors:[]}),c=c[d],h&&c._errors.push(n(a)),l++}}},"processError");return s(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};ct.create=t=>new ct(t);var zk=o((t,e)=>{let n;switch(t.code){case N.invalid_type:t.received===O.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case N.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,le.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:n=`Unrecognized key(s) in object: ${le.joinValues(t.keys,", ")}`;break;case N.invalid_union:n="Invalid input";break;case N.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${le.joinValues(t.options)}`;break;case N.invalid_enum_value:n=`Invalid enum value. Expected ${le.joinValues(t.options)}, received '${t.received}'`;break;case N.invalid_arguments:n="Invalid function arguments";break;case N.invalid_return_type:n="Invalid function return type";break;case N.invalid_date:n="Invalid date";break;case N.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:le.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case N.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case N.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case N.custom:n="Invalid input";break;case N.invalid_intersection_types:n="Intersection results could not be merged";break;case N.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case N.not_finite:n="Number must be finite";break;default:n=e.defaultError,le.assertNever(t)}return{message:n}},"errorMap"),Sn=zk;var zp=Sn;function Zk(t){zp=t}o(Zk,"setErrorMap");function Us(){return zp}o(Us,"getErrorMap");var ho=o(t=>{let{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],a={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let c="",l=r.filter(d=>!!d).slice().reverse();for(let d of l)c=d(a,{data:e,defaultError:c}).message;return{...s,path:i,message:c}},"makeIssue"),Kk=[];function _(t,e){let n=Us(),r=ho({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Sn?void 0:Sn].filter(s=>!!s)});t.common.issues.push(r)}o(_,"addIssueToContext");var He=class t{static{o(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let s of n){if(s.status==="aborted")return Z;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let s of n){let i=await s.key,a=await s.value;r.push({key:i,value:a})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let s of n){let{key:i,value:a}=s;if(i.status==="aborted"||a.status==="aborted")return Z;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(r[i.value]=a.value)}return{status:e.value,value:r}}},Z=Object.freeze({status:"aborted"}),Fr=o(t=>({status:"dirty",value:t}),"DIRTY"),We=o(t=>({status:"valid",value:t}),"OK"),nA=o(t=>t.status==="aborted","isAborted"),rA=o(t=>t.status==="dirty","isDirty"),nr=o(t=>t.status==="valid","isValid"),Ms=o(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync");var V;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(V||(V={}));var Ut=class{static{o(this,"ParseInputLazyPath")}constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Zp=o((t,e)=>{if(nr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new ct(t.common.issues);return this._error=n,this._error}}},"handleResult");function ie(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:o((a,c)=>{let{message:l}=t;return a.code==="invalid_enum_value"?{message:l??c.defaultError}:typeof c.data>"u"?{message:l??r??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:l??n??c.defaultError}},"customMap"),description:s}}o(ie,"processCreateParams");var Ae=class{static{o(this,"ZodType")}get description(){return this._def.description}_getType(e){return un(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:un(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new He,ctx:{common:e.parent.common,data:e.data,parsedType:un(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Ms(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:un(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Zp(r,s)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:un(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return nr(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>nr(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:un(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Ms(s)?s:Promise.resolve(s));return Zp(r,i)}refine(e,n){let r=o(s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n,"getIssueProperties");return this._refinement((s,i)=>{let a=e(s),c=o(()=>i.addIssue({code:N.custom,...r(s)}),"setError");return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Mt({schema:this,typeName:ee.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:o(n=>this["~validate"](n),"validate")}}optional(){return Ft.create(this,this._def)}nullable(){return dn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Dn.create(this)}promise(){return ir.create(this,this._def)}or(e){return Gr.create([this,e],this._def)}and(e){return $r.create(this,e,this._def)}transform(e){return new Mt({...ie(this._def),schema:this,typeName:ee.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new qr({...ie(this._def),innerType:this,defaultValue:n,typeName:ee.ZodDefault})}brand(){return new go({typeName:ee.ZodBranded,type:this,...ie(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new jr({...ie(this._def),innerType:this,catchValue:n,typeName:ee.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return po.create(this,e)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xk=/^c[^\s-]{8,}$/i,eS=/^[0-9a-z]+$/,tS=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nS=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,rS=/^[a-z0-9_-]{21}$/i,sS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,iS=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oS=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aS="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",Yu,AS=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cS=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,uS=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,lS=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dS=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hS=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Xp="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",gS=new RegExp(`^${Xp}$`);function ef(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}o(ef,"timeRegexSource");function pS(t){return new RegExp(`^${ef(t)}$`)}o(pS,"timeRegex");function tf(t){let e=`${Xp}T${ef(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}o(tf,"datetimeRegex");function fS(t,e){return!!((e==="v4"||!e)&&AS.test(t)||(e==="v6"||!e)&&uS.test(t))}o(fS,"isValidIP");function mS(t,e){if(!sS.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}o(mS,"isValidJWT");function ES(t,e){return!!((e==="v4"||!e)&&cS.test(t)||(e==="v6"||!e)&&lS.test(t))}o(ES,"isValidCidr");var rr=class t extends Ae{static{o(this,"ZodString")}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){let i=this._getOrReturnCtx(e);return _(i,{code:N.invalid_type,expected:O.string,received:i.parsedType}),Z}let r=new He,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),_(s,{code:N.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),_(s,{code:N.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,c=e.data.length<i.value;(a||c)&&(s=this._getOrReturnCtx(e,s),a?_(s,{code:N.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&_(s,{code:N.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")oS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"email",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Yu||(Yu=new RegExp(aS,"u")),Yu.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"emoji",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")nS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"uuid",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")rS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"nanoid",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Xk.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"cuid",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")eS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"cuid2",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")tS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"ulid",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),_(s,{validation:"url",code:N.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"regex",code:N.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?tf(i).test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?gS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?pS(i).test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?iS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"duration",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?fS(e.data,i.version)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"ip",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?mS(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"jwt",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?ES(e.data,i.version)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"cidr",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?dS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"base64",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?hS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"base64url",code:N.invalid_string,message:i.message}),r.dirty()):le.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:N.invalid_string,...V.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...V.errToObj(e)})}url(e){return this._addCheck({kind:"url",...V.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...V.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...V.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...V.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...V.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...V.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...V.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...V.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...V.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...V.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...V.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...V.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...V.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...V.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...V.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...V.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...V.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...V.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...V.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...V.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...V.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...V.errToObj(n)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};rr.create=t=>new rr({checks:[],typeName:ee.ZodString,coerce:t?.coerce??!1,...ie(t)});function CS(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return i%a/10**s}o(CS,"floatSafeRemainder");var Ur=class t extends Ae{static{o(this,"ZodNumber")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==O.number){let i=this._getOrReturnCtx(e);return _(i,{code:N.invalid_type,expected:O.number,received:i.parsedType}),Z}let r,s=new He;for(let i of this._def.checks)i.kind==="int"?le.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{code:N.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?CS(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{code:N.not_finite,message:i.message}),s.dirty()):le.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,V.toString(n))}gt(e,n){return this.setLimit("min",e,!1,V.toString(n))}lte(e,n){return this.setLimit("max",e,!0,V.toString(n))}lt(e,n){return this.setLimit("max",e,!1,V.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:V.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&le.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Ur.create=t=>new Ur({checks:[],typeName:ee.ZodNumber,coerce:t?.coerce||!1,...ie(t)});var Mr=class t extends Ae{static{o(this,"ZodBigInt")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==O.bigint)return this._getInvalidInput(e);let r,s=new He;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):le.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return _(n,{code:N.invalid_type,expected:O.bigint,received:n.parsedType}),Z}gte(e,n){return this.setLimit("min",e,!0,V.toString(n))}gt(e,n){return this.setLimit("min",e,!1,V.toString(n))}lte(e,n){return this.setLimit("max",e,!0,V.toString(n))}lt(e,n){return this.setLimit("max",e,!1,V.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:V.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Mr.create=t=>new Mr({checks:[],typeName:ee.ZodBigInt,coerce:t?.coerce??!1,...ie(t)});var Lr=class extends Ae{static{o(this,"ZodBoolean")}_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.boolean,received:r.parsedType}),Z}return We(e.data)}};Lr.create=t=>new Lr({typeName:ee.ZodBoolean,coerce:t?.coerce||!1,...ie(t)});var _r=class t extends Ae{static{o(this,"ZodDate")}_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){let i=this._getOrReturnCtx(e);return _(i,{code:N.invalid_type,expected:O.date,received:i.parsedType}),Z}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return _(i,{code:N.invalid_date}),Z}let r=new He,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),_(s,{code:N.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),_(s,{code:N.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):le.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:V.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:V.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};_r.create=t=>new _r({checks:[],coerce:t?.coerce||!1,typeName:ee.ZodDate,...ie(t)});var _s=class extends Ae{static{o(this,"ZodSymbol")}_parse(e){if(this._getType(e)!==O.symbol){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.symbol,received:r.parsedType}),Z}return We(e.data)}};_s.create=t=>new _s({typeName:ee.ZodSymbol,...ie(t)});var Pr=class extends Ae{static{o(this,"ZodUndefined")}_parse(e){if(this._getType(e)!==O.undefined){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.undefined,received:r.parsedType}),Z}return We(e.data)}};Pr.create=t=>new Pr({typeName:ee.ZodUndefined,...ie(t)});var Or=class extends Ae{static{o(this,"ZodNull")}_parse(e){if(this._getType(e)!==O.null){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.null,received:r.parsedType}),Z}return We(e.data)}};Or.create=t=>new Or({typeName:ee.ZodNull,...ie(t)});var sr=class extends Ae{static{o(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(e){return We(e.data)}};sr.create=t=>new sr({typeName:ee.ZodAny,...ie(t)});var xn=class extends Ae{static{o(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(e){return We(e.data)}};xn.create=t=>new xn({typeName:ee.ZodUnknown,...ie(t)});var Jt=class extends Ae{static{o(this,"ZodNever")}_parse(e){let n=this._getOrReturnCtx(e);return _(n,{code:N.invalid_type,expected:O.never,received:n.parsedType}),Z}};Jt.create=t=>new Jt({typeName:ee.ZodNever,...ie(t)});var Ps=class extends Ae{static{o(this,"ZodVoid")}_parse(e){if(this._getType(e)!==O.undefined){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.void,received:r.parsedType}),Z}return We(e.data)}};Ps.create=t=>new Ps({typeName:ee.ZodVoid,...ie(t)});var Dn=class t extends Ae{static{o(this,"ZodArray")}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==O.array)return _(n,{code:N.invalid_type,expected:O.array,received:n.parsedType}),Z;if(s.exactLength!==null){let a=n.data.length>s.exactLength.value,c=n.data.length<s.exactLength.value;(a||c)&&(_(n,{code:a?N.too_big:N.too_small,minimum:c?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(_(n,{code:N.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(_(n,{code:N.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,c)=>s.type._parseAsync(new Ut(n,a,n.path,c)))).then(a=>He.mergeArray(r,a));let i=[...n.data].map((a,c)=>s.type._parseSync(new Ut(n,a,n.path,c)));return He.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:V.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:V.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:V.toString(n)}})}nonempty(e){return this.min(1,e)}};Dn.create=(t,e)=>new Dn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ee.ZodArray,...ie(e)});function Ls(t){if(t instanceof ut){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Ft.create(Ls(r))}return new ut({...t._def,shape:o(()=>e,"shape")})}else return t instanceof Dn?new Dn({...t._def,type:Ls(t.element)}):t instanceof Ft?Ft.create(Ls(t.unwrap())):t instanceof dn?dn.create(Ls(t.unwrap())):t instanceof ln?ln.create(t.items.map(e=>Ls(e))):t}o(Ls,"deepPartialify");var ut=class t extends Ae{static{o(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=le.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==O.object){let d=this._getOrReturnCtx(e);return _(d,{code:N.invalid_type,expected:O.object,received:d.parsedType}),Z}let{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof Jt&&this._def.unknownKeys==="strip"))for(let d in s.data)a.includes(d)||c.push(d);let l=[];for(let d of a){let h=i[d],g=s.data[d];l.push({key:{status:"valid",value:d},value:h._parse(new Ut(s,g,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof Jt){let d=this._def.unknownKeys;if(d==="passthrough")for(let h of c)l.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(d==="strict")c.length>0&&(_(s,{code:N.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let h of c){let g=s.data[h];l.push({key:{status:"valid",value:h},value:d._parse(new Ut(s,g,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let h of l){let g=await h.key,f=await h.value;d.push({key:g,value:f,alwaysSet:h.alwaysSet})}return d}).then(d=>He.mergeObjectSync(r,d)):He.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:o((n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:V.errToObj(e).message??s}:{message:s}},"errorMap")}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:o(()=>({...this._def.shape(),...e}),"shape")})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:o(()=>({...this._def.shape(),...e._def.shape()}),"shape"),typeName:ee.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of le.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:o(()=>n,"shape")})}omit(e){let n={};for(let r of le.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:o(()=>n,"shape")})}deepPartial(){return Ls(this)}partial(e){let n={};for(let r of le.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new t({...this._def,shape:o(()=>n,"shape")})}required(e){let n={};for(let r of le.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Ft;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:o(()=>n,"shape")})}keyof(){return nf(le.objectKeys(this.shape))}};ut.create=(t,e)=>new ut({shape:o(()=>t,"shape"),unknownKeys:"strip",catchall:Jt.create(),typeName:ee.ZodObject,...ie(e)});ut.strictCreate=(t,e)=>new ut({shape:o(()=>t,"shape"),unknownKeys:"strict",catchall:Jt.create(),typeName:ee.ZodObject,...ie(e)});ut.lazycreate=(t,e)=>new ut({shape:t,unknownKeys:"strip",catchall:Jt.create(),typeName:ee.ZodObject,...ie(e)});var Gr=class extends Ae{static{o(this,"ZodUnion")}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(let c of i)if(c.result.status==="valid")return c.result;for(let c of i)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;let a=i.map(c=>new ct(c.ctx.common.issues));return _(n,{code:N.invalid_union,unionErrors:a}),Z}if(o(s,"handleResults"),n.common.async)return Promise.all(r.map(async i=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(s);{let i,a=[];for(let l of r){let d={...n,common:{...n.common,issues:[]},parent:null},h=l._parseSync({data:n.data,path:n.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!i&&(i={result:h,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let c=a.map(l=>new ct(l));return _(n,{code:N.invalid_union,unionErrors:c}),Z}}get options(){return this._def.options}};Gr.create=(t,e)=>new Gr({options:t,typeName:ee.ZodUnion,...ie(e)});var vn=o(t=>t instanceof Yr?vn(t.schema):t instanceof Mt?vn(t.innerType()):t instanceof Vr?[t.value]:t instanceof Hr?t.options:t instanceof Jr?le.objectValues(t.enum):t instanceof qr?vn(t._def.innerType):t instanceof Pr?[void 0]:t instanceof Or?[null]:t instanceof Ft?[void 0,...vn(t.unwrap())]:t instanceof dn?[null,...vn(t.unwrap())]:t instanceof go||t instanceof Wr?vn(t.unwrap()):t instanceof jr?vn(t._def.innerType):[],"getDiscriminator"),sA=class t extends Ae{static{o(this,"ZodDiscriminatedUnion")}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==O.object)return _(n,{code:N.invalid_type,expected:O.object,received:n.parsedType}),Z;let r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(_(n,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let s=new Map;for(let i of n){let a=vn(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of a){if(s.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);s.set(c,i)}}return new t({typeName:ee.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...ie(r)})}};function Vu(t,e){let n=un(t),r=un(e);if(t===e)return{valid:!0,data:t};if(n===O.object&&r===O.object){let s=le.objectKeys(e),i=le.objectKeys(t).filter(c=>s.indexOf(c)!==-1),a={...t,...e};Object.prototype.hasOwnProperty.call(a,"__proto__")&&delete a.__proto__;for(let c of i){if(c==="__proto__")continue;let l=Vu(t[c],e[c]);if(!l.valid)return{valid:!1};a[c]=l.data}return{valid:!0,data:a}}else if(n===O.array&&r===O.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let a=t[i],c=e[i],l=Vu(a,c);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===O.date&&r===O.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}o(Vu,"mergeValues");var $r=class extends Ae{static{o(this,"ZodIntersection")}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=o((i,a)=>{if(nA(i)||nA(a))return Z;let c=Vu(i.value,a.value);return c.valid?((rA(i)||rA(a))&&n.dirty(),{status:n.value,value:c.data}):(_(r,{code:N.invalid_intersection_types}),Z)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,a])=>s(i,a)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};$r.create=(t,e,n)=>new $r({left:t,right:e,typeName:ee.ZodIntersection,...ie(n)});var ln=class t extends Ae{static{o(this,"ZodTuple")}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.array)return _(r,{code:N.invalid_type,expected:O.array,received:r.parsedType}),Z;if(r.data.length<this._def.items.length)return _(r,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Z;!this._def.rest&&r.data.length>this._def.items.length&&(_(r,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((a,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new Ut(r,a,r.path,c)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>He.mergeArray(n,a)):He.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};ln.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ln({items:t,typeName:ee.ZodTuple,rest:null,...ie(e)})};var iA=class t extends Ae{static{o(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.object)return _(r,{code:N.invalid_type,expected:O.object,received:r.parsedType}),Z;let s=[],i=this._def.keyType,a=this._def.valueType;for(let c in r.data)s.push({key:i._parse(new Ut(r,c,r.path,c)),value:a._parse(new Ut(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?He.mergeObjectAsync(n,s):He.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Ae?new t({keyType:e,valueType:n,typeName:ee.ZodRecord,...ie(r)}):new t({keyType:rr.create(),valueType:e,typeName:ee.ZodRecord,...ie(n)})}},Os=class extends Ae{static{o(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.map)return _(r,{code:N.invalid_type,expected:O.map,received:r.parsedType}),Z;let s=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([c,l],d)=>({key:s._parse(new Ut(r,c,r.path,[d,"key"])),value:i._parse(new Ut(r,l,r.path,[d,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of a){let d=await l.key,h=await l.value;if(d.status==="aborted"||h.status==="aborted")return Z;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(d.value,h.value)}return{status:n.value,value:c}})}else{let c=new Map;for(let l of a){let d=l.key,h=l.value;if(d.status==="aborted"||h.status==="aborted")return Z;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(d.value,h.value)}return{status:n.value,value:c}}}};Os.create=(t,e,n)=>new Os({valueType:e,keyType:t,typeName:ee.ZodMap,...ie(n)});var Gs=class t extends Ae{static{o(this,"ZodSet")}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.set)return _(r,{code:N.invalid_type,expected:O.set,received:r.parsedType}),Z;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(_(r,{code:N.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(_(r,{code:N.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let i=this._def.valueType;function a(l){let d=new Set;for(let h of l){if(h.status==="aborted")return Z;h.status==="dirty"&&n.dirty(),d.add(h.value)}return{status:n.value,value:d}}o(a,"finalizeSet");let c=[...r.data.values()].map((l,d)=>i._parse(new Ut(r,l,r.path,d)));return r.common.async?Promise.all(c).then(l=>a(l)):a(c)}min(e,n){return new t({...this._def,minSize:{value:e,message:V.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:V.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Gs.create=(t,e)=>new Gs({valueType:t,minSize:null,maxSize:null,typeName:ee.ZodSet,...ie(e)});var oA=class t extends Ae{static{o(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==O.function)return _(n,{code:N.invalid_type,expected:O.function,received:n.parsedType}),Z;function r(c,l){return ho({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Us(),Sn].filter(d=>!!d),issueData:{code:N.invalid_arguments,argumentsError:l}})}o(r,"makeArgsIssue");function s(c,l){return ho({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Us(),Sn].filter(d=>!!d),issueData:{code:N.invalid_return_type,returnTypeError:l}})}o(s,"makeReturnsIssue");let i={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof ir){let c=this;return We(async function(...l){let d=new ct([]),h=await c._def.args.parseAsync(l,i).catch(m=>{throw d.addIssue(r(l,m)),d}),g=await Reflect.apply(a,this,h);return await c._def.returns._def.type.parseAsync(g,i).catch(m=>{throw d.addIssue(s(g,m)),d})})}else{let c=this;return We(function(...l){let d=c._def.args.safeParse(l,i);if(!d.success)throw new ct([r(l,d.error)]);let h=Reflect.apply(a,this,d.data),g=c._def.returns.safeParse(h,i);if(!g.success)throw new ct([s(h,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ln.create(e).rest(xn.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||ln.create([]).rest(xn.create()),returns:n||xn.create(),typeName:ee.ZodFunction,...ie(r)})}},Yr=class extends Ae{static{o(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Yr.create=(t,e)=>new Yr({getter:t,typeName:ee.ZodLazy,...ie(e)});var Vr=class extends Ae{static{o(this,"ZodLiteral")}_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return _(n,{received:n.data,code:N.invalid_literal,expected:this._def.value}),Z}return{status:"valid",value:e.data}}get value(){return this._def.value}};Vr.create=(t,e)=>new Vr({value:t,typeName:ee.ZodLiteral,...ie(e)});function nf(t,e){return new Hr({values:t,typeName:ee.ZodEnum,...ie(e)})}o(nf,"createZodEnum");var Hr=class t extends Ae{static{o(this,"ZodEnum")}_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return _(n,{expected:le.joinValues(r),received:n.parsedType,code:N.invalid_type}),Z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return _(n,{received:n.data,code:N.invalid_enum_value,options:r}),Z}return We(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Hr.create=nf;var Jr=class extends Ae{static{o(this,"ZodNativeEnum")}_parse(e){let n=le.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==O.string&&r.parsedType!==O.number){let s=le.objectValues(n);return _(r,{expected:le.joinValues(s),received:r.parsedType,code:N.invalid_type}),Z}if(this._cache||(this._cache=new Set(le.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=le.objectValues(n);return _(r,{received:r.data,code:N.invalid_enum_value,options:s}),Z}return We(e.data)}get enum(){return this._def.values}};Jr.create=(t,e)=>new Jr({values:t,typeName:ee.ZodNativeEnum,...ie(e)});var ir=class extends Ae{static{o(this,"ZodPromise")}unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==O.promise&&n.common.async===!1)return _(n,{code:N.invalid_type,expected:O.promise,received:n.parsedType}),Z;let r=n.parsedType===O.promise?n.data:Promise.resolve(n.data);return We(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ir.create=(t,e)=>new ir({type:t,typeName:ee.ZodPromise,...ie(e)});var Mt=class extends Ae{static{o(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ee.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o(a=>{_(r,a),a.fatal?n.abort():n.dirty()},"addIssue"),get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let a=s.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async c=>{if(n.value==="aborted")return Z;let l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?Z:l.status==="dirty"?Fr(l.value):n.value==="dirty"?Fr(l.value):l});{if(n.value==="aborted")return Z;let c=this._def.schema._parseSync({data:a,path:r.path,parent:r});return c.status==="aborted"?Z:c.status==="dirty"?Fr(c.value):n.value==="dirty"?Fr(c.value):c}}if(s.type==="refinement"){let a=o(c=>{let l=s.refinement(c,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c},"executeRefinement");if(r.common.async===!1){let c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Z:(c.status==="dirty"&&n.dirty(),a(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Z:(c.status==="dirty"&&n.dirty(),a(c.value).then(()=>({status:n.value,value:c.value}))))}if(s.type==="transform")if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!nr(a))return Z;let c=s.transform(a.value,i);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>nr(a)?Promise.resolve(s.transform(a.value,i)).then(c=>({status:n.value,value:c})):Z);le.assertNever(s)}};Mt.create=(t,e,n)=>new Mt({schema:t,typeName:ee.ZodEffects,effect:e,...ie(n)});Mt.createWithPreprocess=(t,e,n)=>new Mt({schema:e,effect:{type:"preprocess",transform:t},typeName:ee.ZodEffects,...ie(n)});var Ft=class extends Ae{static{o(this,"ZodOptional")}_parse(e){return this._getType(e)===O.undefined?We(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ft.create=(t,e)=>new Ft({innerType:t,typeName:ee.ZodOptional,...ie(e)});var dn=class extends Ae{static{o(this,"ZodNullable")}_parse(e){return this._getType(e)===O.null?We(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};dn.create=(t,e)=>new dn({innerType:t,typeName:ee.ZodNullable,...ie(e)});var qr=class extends Ae{static{o(this,"ZodDefault")}_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===O.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};qr.create=(t,e)=>new qr({innerType:t,typeName:ee.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var jr=class extends Ae{static{o(this,"ZodCatch")}_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ms(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ct(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ct(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};jr.create=(t,e)=>new jr({innerType:t,typeName:ee.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var $s=class extends Ae{static{o(this,"ZodNaN")}_parse(e){if(this._getType(e)!==O.nan){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.nan,received:r.parsedType}),Z}return{status:"valid",value:e.data}}};$s.create=t=>new $s({typeName:ee.ZodNaN,...ie(t)});var IS=Symbol("zod_brand"),go=class extends Ae{static{o(this,"ZodBranded")}_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},po=class t extends Ae{static{o(this,"ZodPipeline")}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return o(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Z:i.status==="dirty"?(n.dirty(),Fr(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})},"handleAsync")();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Z:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:ee.ZodPipeline})}},Wr=class extends Ae{static{o(this,"ZodReadonly")}_parse(e){let n=this._def.innerType._parse(e),r=o(s=>(nr(s)&&(s.value=Object.freeze(s.value)),s),"freeze");return Ms(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};Wr.create=(t,e)=>new Wr({innerType:t,typeName:ee.ZodReadonly,...ie(e)});function Kp(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}o(Kp,"cleanParams");function rf(t,e={},n){return t?sr.create().superRefine((r,s)=>{let i=t(r);if(i instanceof Promise)return i.then(a=>{if(!a){let c=Kp(e,r),l=c.fatal??n??!0;s.addIssue({code:"custom",...c,fatal:l})}});if(!i){let a=Kp(e,r),c=a.fatal??n??!0;s.addIssue({code:"custom",...a,fatal:c})}}):sr.create()}o(rf,"custom");var yS={object:ut.lazycreate},ee;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ee||(ee={}));var QS=o((t,e={message:`Input not instance of ${t.name}`})=>rf(n=>n instanceof t,e),"instanceOfType"),sf=rr.create,of=Ur.create,BS=$s.create,wS=Mr.create,af=Lr.create,bS=_r.create,RS=_s.create,kS=Pr.create,SS=Or.create,vS=sr.create,xS=xn.create,DS=Jt.create,TS=Ps.create,NS=Dn.create,FS=ut.create,US=ut.strictCreate,MS=Gr.create,LS=sA.create,_S=$r.create,PS=ln.create,OS=iA.create,GS=Os.create,$S=Gs.create,YS=oA.create,VS=Yr.create,HS=Vr.create,JS=Hr.create,qS=Jr.create,jS=ir.create,WS=Mt.create,zS=Ft.create,ZS=dn.create,KS=Mt.createWithPreprocess,XS=po.create,ev=o(()=>sf().optional(),"ostring"),tv=o(()=>of().optional(),"onumber"),nv=o(()=>af().optional(),"oboolean"),rv={string:o((t=>rr.create({...t,coerce:!0})),"string"),number:o((t=>Ur.create({...t,coerce:!0})),"number"),boolean:o((t=>Lr.create({...t,coerce:!0})),"boolean"),bigint:o((t=>Mr.create({...t,coerce:!0})),"bigint"),date:o((t=>_r.create({...t,coerce:!0})),"date")};var sv=Z;var bf=require("node:crypto");var zr=(i=>(i.NotFound="not_found",i.NoAccess="no_access",i.Unavailable="unavailable",i.AccessLost="access_lost",i.CannotOpen="cannot_open",i))(zr||{});var Hu=o(t=>`${t.source}:${t.site??""}:${t.key}`,"requirementItemId");var aA=/^pasted-[0-9a-f]{16}$/,fo=/^file-[0-9a-f]{16}$/,mo=(s=>(s.Pdf="application/pdf",s.Csv="text/csv",s.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",s))(mo||{});var Ju=(r=>(r.New="new",r.Updated="updated",r.Existing="existing",r))(Ju||{}),Zr=(r=>(r.Sufficient="sufficient",r.Insufficient="insufficient",r.NoChange="no_change",r))(Zr||{}),Ys=(R=>(R.RelatedChangeConflict="related_change_conflict",R.ReferenceOutsideTarget="reference_outside_target",R.SourceAccessLost="source_access_lost",R.ConfigurationIncomplete="configuration_incomplete",R.CredentialUnavailable="credential_unavailable",R.WorkflowBindingUnverified="workflow_binding_unverified",R.WorkflowRefUnprotected="workflow_ref_unprotected",R.BedrockWorkflowRequired="bedrock_workflow_required",R.DeploymentReview="deployment_review",R.SutRevisionMismatch="sut_revision_mismatch",R.IsolationUnavailable="isolation_unavailable",R.EvidenceInsufficient="evidence_insufficient",R.ConfigurationUnresolved="configuration_unresolved",R.ModelProviderDenied="model_provider_denied",R.ModelProviderUnavailable="model_provider_unavailable",R.RunnerProviderNotReady="runner_provider_not_ready",R))(Ys||{}),or=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(or||{}),qu=(r=>(r.Application="application",r.Environment="environment",r.TestDefect="test_defect",r))(qu||{}),ju=(c=>(c.AuthToken="auth_token",c.Secret="secret",c.DataConnection="data_connection",c.AppNotStarted="app_not_started",c.Login="login",c.ExternalDependency="external_dependency",c.RecordingReplay="recording_replay",c))(ju||{});var AA=(n=>(n.Probe="probe",n.Agent="agent",n))(AA||{}),cA=(r=>(r.Seed="seed",r.RuntimeMock="runtime_mock",r.EnvOverride="env_override",r))(cA||{}),uA=(r=>(r.TestCode="test_code",r.SkyrampMocker="skyramp_mocker",r.RecipeOverride="recipe_override",r))(uA||{});var Wu=(n=>(n.Ready="ready",n.Blocked="blocked",n))(Wu||{}),Ne=A.string().trim().min(1),iv=A.object({action:A.enum(["start","run","wait"]),text:Ne,source:A.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:Ne.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(t=>t.source==="file"==(t.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),ov=/^[A-Za-z_][A-Za-z0-9_]*$/,Eo=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,Vs=(a=>(a.VersionEndpoint="version_endpoint",a.DeployWorkflow="deploy_workflow",a.KubernetesLabels="kubernetes_labels",a.Command="command",a.Api="api",a.NotTracked="not_tracked",a))(Vs||{}),hn="shared",av=Ne.refine(t=>{try{let e=new URL(t);return["http:","https:"].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}},"an http(s) URL with no login in it"),Hs=A.object({address:av,readyWhen:Ne.nullable(),credentials:A.array(A.string().regex(Eo)).max(50),revisionSources:A.array(A.object({method:A.nativeEnum(Vs),detail:Ne.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:A.array(Ne).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),zu={steps:A.array(iv).max(20).optional().describe("how it starts, in order"),kind:A.enum(["web_app","service","database","external_service"]).optional(),from:A.object({file:Ne,service:Ne.nullable()}).strict().optional(),credentials:A.array(A.string().max(100).regex(ov)).max(50).optional().describe("the Target's credentials this component's recipe uses: a sign-in (a test user, password or token) or an API key, which the workflow supplies from a GitHub Actions secret as the environment variable of the credential's name; give each name exactly as the recipe reads it. Names only, never a value, and not a secret the recipe generates itself")},Av=A.object({name:Ne,repository:Ne.describe("owner/repo of the Target repository the component is built or started from, such as the one whose compose file starts its database"),healthy:A.boolean(),...zu,deployed:Ne.nullable().optional().describe('only with "environment": the revision the component runs, as you read it from its revision source, or null when you could not tell')}),cv=A.object({component:Ne,problem:Ne,evidence:Ne.describe("the exact command and output that shows it"),fix:Ne.describe("what the user must provide, and where")}),uv=A.object({framework:Ne,file:Ne.describe("the test file run, relative to its repository root"),result:A.enum(["pass","fail","error"])}),lv=A.object({input:Ne.describe("the part of the user's SUT input, as given"),reason:Ne}),NV=A.object({schemaVersion:A.literal(1),status:A.nativeEnum(Wu).describe("ready only if every component came up healthy and the recipe is written"),components:A.array(Av),suites:A.array(uv).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:A.array(Ne).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:A.array(A.object({input:Ne.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:Ne.describe("what the recipe did with it")})).optional(),inputsNotUsed:A.array(lv).default([]).describe("the parts it did not use, and why. A part that is wrong goes here, with what was wrong, even when the recipe does something like it instead: one that names a file, command, port, route or setting that does not exist or does not work"),blockers:A.array(cv).describe("required (non-empty) when status is blocked"),environment:Hs.optional().describe("only when the whole SUT is an existing deployment you tested where it runs, building and starting nothing: its address, what says it is ready, the credentials that reach it, and how to read what each component runs. Leave it out when any part was built or started on the runner, or reaching it needed something there (a tunnel, port-forward, proxy or client certificate)")});var Zu=64*1024,Ku=512*1024,Af=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var uf=Ve(require("path"));var Ar=(s=>(s.Clean="clean",s.RecipeDrift="recipe-drift",s.ChangeBrokeBringup="change-broke-bringup",s.BringupFailed="bringup-failed",s))(Ar||{}),ar=A.string().trim().min(1),dv=A.object({url:A.string().optional().describe("the URL probed, if the check is an HTTP request"),command:A.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:A.record(A.string()).optional(),status:A.union([A.number(),A.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:ar.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),Xu=A.array(A.object({component:ar.describe("a shared component listed above"),url:ar.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:ar.describe("what the URL returned, VERBATIM; this gate FETCHES each url")})).describe("only when shared components are listed above: one check per component whose deployed commit you found"),cf=A.object({schemaVersion:A.literal(1),baseUrls:A.record(A.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:dv.optional(),teardown:ar.describe("command that tears the SUT down"),dependencies:A.record(A.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:A.nativeEnum(Ar).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:A.array(A.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:A.object({command:ar,output:ar}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:A.array(A.string()).optional().describe("required for change-broke-bringup: files THIS PR changed that the failure points at, relative to your working directory (a file in another checkout of the run: its absolute path)"),seeded:A.boolean(),startedAt:ar.describe("ISO timestamp"),revisions:Xu.optional()});var ze=A.string().trim().min(1),el=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(el||{}),tl=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],lf=A.object({schemaVersion:A.literal(1),type:A.nativeEnum(el).optional(),status:A.enum(["ready","blocked"]),environment:Hs.optional(),components:A.array(A.object({name:ze,repository:ze.describe(`owner/repo, or "${hn}" for a customer-deployed component no repository builds`),healthy:A.boolean(),url:A.string().min(1).nullable(),...zu,credentials:A.array(A.string().regex(Eo)).max(50).optional(),deployed:ze.nullable().optional().describe("customer_deployed only: the revision the component runs, as setup read it (WF-SETUP-22's Deployed now), or null when it could not tell")}).strict()),suites:A.array(A.object({framework:ze,file:ze,result:A.enum(["pass","fail","error"])}).strict()),inputsUsed:A.array(ze),inputsUsedHow:A.array(A.object({input:ze,how:ze}).strict()).optional(),inputsNotUsed:A.array(A.object({input:ze,reason:ze}).strict()),blockers:A.array(A.object({component:ze,problem:ze,evidence:ze,fix:ze}).strict()),replay:A.object({outcome:ze,durationSeconds:A.number().nonnegative().nullable()}).strict().nullable(),files:A.array(A.object({path:ze,content:A.string()}).strict())}).strict().superRefine((t,e)=>{t.inputsUsedHow?.forEach((s,i)=>{t.inputsUsed.includes(s.input)||e.addIssue({code:A.ZodIssueCode.custom,path:["inputsUsedHow",i,"input"],message:"not one of inputsUsed"})}),t.components.forEach((s,i)=>{s.credentials&&new Set(s.credentials).size!==s.credentials.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"credentials"],message:"names a credential twice"})});let n=t.type==="customer_deployed";n!==(t.environment!==void 0)&&e.addIssue({code:A.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),t.environment&&new Set(t.environment.credentials).size!==t.environment.credentials.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let r=new Set(t.components.map(s=>s.name));if(t.environment?.revisionSources.forEach((s,i)=>{s.components.forEach((a,c)=>{r.has(a)||e.addIssue({code:A.ZodIssueCode.custom,path:["environment","revisionSources",i,"components",c],message:"not one of components"})})}),t.components.forEach((s,i)=>{s.deployed!==void 0!==n&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),s.repository===hn&&!n&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"repository"],message:`only a customer_deployed component is ${hn}`})}),n&&(t.components.forEach((s,i)=>{t.components.findIndex(a=>a.name===s.name)!==i&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"name"],message:"names a component twice"})}),t.replay!==null&&e.addIssue({code:A.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),t.files.forEach((s,i)=>{tl.includes(s.path)&&e.addIssue({code:A.ZodIssueCode.custom,path:["files",i,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&t.status==="ready"){let s=new Set(t.environment?.revisionSources.flatMap(i=>i.components));t.components.forEach((i,a)=>{i.repository!==hn&&!s.has(i.name)&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",a,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var $V=["clean","recipe-drift"];function Co(t){let e=uf.posix.normalize(t);return e===t&&(e===".skyramp/workspace.yml"||e.startsWith(".skyramp/sut/")&&e.length>13)}o(Co,"isRuntimePlanFile");var Kr=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(Kr||{}),il=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(il||{}),ol=(a=>(a.PullRequest="pull_request",a.ReadyForReview="ready_for_review",a.Schedule="schedule",a.Manual="manual",a.SutSetup="sut_setup",a.RevisionRead="revision_read",a))(ol||{}),hv=["sut_setup"],gv=["sut_setup","schedule","revision_read"],pv=["sut_setup"],al=(e=>(e.PullRequest="pull_request",e))(al||{}),Rf=(s=>(s.ModelProvider="model_provider",s.SutAccess="sut_access",s.Skyramp="skyramp",s.Other="other",s))(Rf||{}),gA=(s=>(s.None="none",s.Delivered="delivered",s.Partial="partial",s.Failed="failed",s))(gA||{}),yo=(i=>(i.ReportUploaded="report_uploaded",i.NoReport="no_report",i.Cancelled="cancelled",i.RecipeUploaded="recipe_uploaded",i.RevisionsUploaded="revisions_uploaded",i))(yo||{}),kf=(n=>(n.Running="running",n.Ended="ended",n))(kf||{}),Qo=(h=>(h.TimedOut="timed_out",h.AgentFailed="agent_failed",h.SetupFailed="setup_failed",h.CredentialMissing="credential_missing",h.RunnerLost="runner_lost",h.CheckoutFailed="checkout_failed",h.EnvironmentUnverified="environment_unverified",h.ModelProviderDenied="model_provider_denied",h.ModelProviderUnavailable="model_provider_unavailable",h.RunnerProviderNotReady="runner_provider_not_ready",h))(Qo||{}),Sf=(r=>(r.Onboard="onboard",r.Deploy="deploy",r.Recheck="recheck",r))(Sf||{}),vf=(n=>(n.Started="started",n.Finished="finished",n))(vf||{}),xf=(r=>(r.Passed="passed",r.Failed="failed",r.Skipped="skipped",r))(xf||{});var Df=(r=>(r.ChooseCredential="choose_credential",r.FreeText="free_text",r.ChooseSource="choose_source",r))(Df||{});var Al=(r=>(r.Discover="discover",r.Start="start",r.Check="check",r))(Al||{}),Tf=(s=>(s.ValidationPlan="validation_plan",s.TestEnvironment="test_environment",s.TestConditions="test_conditions",s.Tests="tests",s))(Tf||{}),cl=(s=>(s.Found="found",s.Starting="starting",s.Up="up",s.OutOfScope="out_of_scope",s))(cl||{}),qt=A.string().regex(/^[1-9][0-9]{0,18}$/),gn=A.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),qs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,tt=A.string().regex(qs),nt=A.string().regex(/^[0-9a-f]{64}$/),lA=A.object({id:tt,revision:qt}).strict(),pA={provider:A.literal("github"),providerAccountId:qt,providerRepositoryId:qt},fA={provider:A.literal("azure-devops"),providerAccountId:tt,providerRepositoryId:tt},Nn=A.discriminatedUnion("provider",[A.object(pA).strict(),A.object(fA).strict()]),ul=A.discriminatedUnion("provider",[A.object(pA).passthrough(),A.object(fA).passthrough()]),Fn=o(t=>`${t.provider}:${t.providerRepositoryId}`,"sourceKey"),df={namespace:A.string().min(1),name:A.string().min(1)},Nf=A.discriminatedUnion("provider",[A.object({...pA,...df}).strict(),A.object({...fA,...df}).strict()]),hf=A.object({ref:A.string().min(1),revision:gn}).strict(),fv=A.object({repository:Nf,revision:gn,ref:A.string().nullable(),reason:A.nativeEnum(il),change:A.object({kind:A.nativeEnum(al),number:qt,base:hf.optional()}).strict().nullable(),compareWith:hf.optional()}).strict();function mv(t){if(t.trigger.kind==="revision_read"!=!t.baseline)return t.baseline?"a revision_read run names no baseline":"names its baseline";if(!t.baseline)return null;let{confirmedRunId:e,initialBaselineId:n,sources:r}=t.baseline;if(e!==null&&n!==void 0)return"a run compares with one baseline";let s=t.trigger.kind==="schedule"&&e!==null||n!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(e===null&&n===void 0)return"a run with no Confirmed Baseline names no baseline sources";let i=new Set(t.sources.map(l=>Fn(l.repository))),a=new Set(r.map(l=>Fn(l.repository)));return a.size===r.length&&a.size===i.size&&[...a].every(l=>i.has(l))?null:"names every source of the snapshot, once"}o(mv,"baselineSourcesIssue");var Ff=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,Uf=/^[1-9][0-9]{0,18}$/,gf=new RegExp(`${Ff.source}|${Uf.source}`),pf=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,Ev=A.union([A.object({source:A.literal("jira"),site:A.string().regex(pf),key:A.string().regex(Ff),updated:A.string().datetime(),contentHash:nt}).strict(),A.object({source:A.literal("confluence"),site:A.string().regex(pf),key:A.string().regex(Uf),version:A.number().int().positive(),contentHash:nt}).strict(),A.object({source:A.literal("other"),key:A.string().regex(aA),contentHash:nt}).strict(),A.object({source:A.literal("other"),key:A.string().regex(fo),contentHash:nt,fileName:A.string().min(1).max(255),mediaType:A.nativeEnum(mo)}).strict()]),ff=A.union([A.literal("jira"),A.literal("confluence")]),Cv=A.object({schemaVersion:A.literal(1),items:A.array(A.union([A.object({source:ff,site:A.string(),key:A.string().regex(gf),state:A.literal("read"),text:A.string(),version:A.string().min(1),contentMatches:A.boolean()}).strict(),A.object({source:ff,site:A.string(),key:A.string().regex(gf),state:A.literal("not_read"),reason:A.nativeEnum(zr)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(aA),state:A.literal("read"),text:A.string(),version:A.string().min(1),contentMatches:A.boolean()}).strict(),A.object({source:A.literal("other"),key:A.string().regex(aA),state:A.literal("not_read"),reason:A.nativeEnum(zr)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(fo),state:A.literal("read"),version:nt,fileName:A.string().min(1).max(255),mediaType:A.nativeEnum(mo)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(fo),state:A.literal("not_read"),reason:A.nativeEnum(zr)}).strict()])),instructions:A.array(A.string()).optional()}).strict(),Iv=A.object({schemaVersion:A.literal(1),runId:tt,skyrampOrgId:tt,target:lA,policy:lA.nullable(),trigger:A.object({kind:A.nativeEnum(ol),requestedAt:A.string().datetime()}).strict(),configuration:A.object({captureId:tt,revision:qt.nullable(),hash:nt}).strict(),baseline:A.object({confirmedRunId:tt.nullable(),initialBaselineId:tt.optional(),sources:A.array(A.object({repository:Nn,revision:gn}).strict()).optional()}).strict().optional(),sources:A.array(fv).min(1),execution:A.object({provider:A.nativeEnum(Kr),repository:Nf,workflowPath:A.string(),ref:A.string()}).strict(),credentials:A.array(A.object({name:A.string(),purpose:A.nativeEnum(Rf),required:A.boolean()}).strict()),requirements:A.array(Ev).min(1).optional(),instructions:A.object({contentHash:nt}).strict().optional(),deployedRevisions:A.array(A.object({repository:Nn,revision:gn}).strict()).min(1).optional()}).strict().superRefine((t,e)=>{let n=new Set;(t.requirements??[]).forEach((l,d)=>{let h="fileName"in l?"file":"pasted";l.source==="other"&&l.key!==`${h}-${l.contentHash.slice(0,16)}`&&e.addIssue({code:A.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",d,"key"]});let g=Hu({source:l.source,key:l.key});n.has(g)&&e.addIssue({code:A.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",d,"key"]}),n.add(g)});let r=t.trigger.kind,s=hv.includes(r);s!==(t.policy===null)&&e.addIssue({code:A.ZodIssueCode.custom,path:["policy"],message:s?`a ${r} run has no policy`:"names the policy revision"});let i=mv(t);i&&e.addIssue({code:A.ZodIssueCode.custom,path:t.baseline?["baseline","sources"]:["baseline"],message:i}),gv.includes(r)&&t.sources.forEach((l,d)=>{l.reason!=="BASELINE"&&e.addIssue({code:A.ZodIssueCode.custom,path:["sources",d,"reason"],message:`a ${r} run selects only BASELINE sources`})}),t.deployedRevisions&&r!=="manual"&&e.addIssue({code:A.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let a=new Set(t.sources.map(l=>Fn(l.repository))),c=new Set;(t.deployedRevisions??[]).forEach((l,d)=>{let h=Fn(l.repository);a.has(h)?c.has(h)&&e.addIssue({code:A.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"repository appears twice"}):e.addIssue({code:A.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"names a repository outside the snapshot"}),c.add(h)}),t.sources.forEach((l,d)=>{l.compareWith&&(l.reason!=="MANUAL_OVERRIDE"||l.change)&&e.addIssue({code:A.ZodIssueCode.custom,path:["sources",d,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"})})});var Mf=(n=>(n.Person="person",n.Policy="policy",n))(Mf||{}),yv=A.object({kind:A.nativeEnum(Mf),name:A.string().min(1).max(256)}).strict(),Qv=A.object({mcp:A.discriminatedUnion("source",[A.object({source:A.literal("npm"),version:A.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),A.object({source:A.literal("github"),ref:A.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:A.object({region:A.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:A.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),Bv=A.object({schemaVersion:A.literal(1),attempt:A.object({id:tt,number:A.number().int().positive(),deadlineAt:A.string().datetime()}).strict(),manifest:Iv,manifestHash:nt,entitlements:A.array(A.string()).optional(),runToken:A.string().min(1).optional(),requestedBy:yv.nullable().optional(),writeAllowed:A.boolean().optional(),claudeCodeVersion:A.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:A.array(A.object({repository:Nn,revision:gn}).strict()).optional(),statedRevisions:A.array(A.object({repository:Nn,revision:gn}).strict()).optional(),runSettings:Qv.optional()}).strict(),mf={providerRunAttempt:A.number().int().positive(),workflowRef:A.string().min(1)},wv=A.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),bv=A.object({schemaVersion:A.literal(1),runId:tt,execution:A.discriminatedUnion("provider",[A.object({...mf,provider:A.literal("github"),repository:A.object(pA).strict(),providerRunId:qt}).strict(),A.object({...mf,provider:A.literal("azure-devops"),repository:A.object(fA).strict(),providerRunId:wv}).strict()]),requester:A.literal(!0).optional(),writeCheck:A.literal(!0).optional(),claudeCodePin:A.literal(!0).optional(),deployedPins:A.literal(!0).optional(),statedPins:A.literal(!0).optional(),runSettings:A.literal(!0).optional()}).strict(),Ef=A.object({repository:Nn,number:qt,commitSha:gn.optional()}).strict(),Rv=A.discriminatedUnion("status",[A.object({status:A.literal("none")}).strict(),A.object({status:A.literal("delivered"),pullRequests:A.array(Ef).min(1)}).strict(),A.object({status:A.literal("partial"),pullRequests:A.array(Ef).min(1),failures:A.array(A.object({repository:Nn,message:A.string()}).strict()).min(1)}).strict(),A.object({status:A.literal("failed"),message:A.string()}).strict()]),kv=A.object({blockedPreflight:A.object({file:A.string().min(1),repository:A.string().min(1).optional(),reason:A.string().min(1).max(300),evidence:A.string().min(1).max(400)}).strict().optional(),sufficiency:A.nativeEnum(Zr),rationale:A.string().min(1),gaps:A.array(A.string().min(1)),acceptedEvidence:A.array(A.object({kind:A.nativeEnum(or),repository:A.string().min(1),revision:gn,reference:A.string().min(1),summary:A.string().min(1)}).strict()),actionRequired:A.array(A.nativeEnum(Ys))}).strict().superRefine((t,e)=>{t.sufficiency==="insufficient"!=t.gaps.length>0&&e.addIssue({code:A.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(t.actionRequired).size!==t.actionRequired.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),nl=500,Sv=2048,vv=1e3,xv=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,Cf=o(t=>t.length>0&&t.length<=64&&t===t.trim()&&!xv.test(t)&&!/[^\S ]/u.test(t)&&!/^[._]/.test(t)&&!t.endsWith("."),"isAzureName"),Dv=o(t=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(t))return!0;let[e,n,r,...s]=t.split("/");return t.length<=201&&s.length===0&&r!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(e)&&Cf(n)&&Cf(r)},"isResultRepository"),Tv=A.object({testResults:A.array(A.object({resultId:A.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:A.string().refine(Dv,"Invalid"),testType:A.string(),endpoint:A.string(),status:A.enum(["Pass","Fail","Skipped"]),details:A.string(),fileName:A.string().optional(),testId:A.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:A.object({kind:A.nativeEnum(qu),family:A.nativeEnum(ju).optional()}).strict().optional(),origin:A.nativeEnum(Ju).optional()}).strict()),validation:kv,changes:A.array(A.object({id:A.string().min(1).max(512),text:A.string().max(16384),source:A.string().max(Sv),testedBy:A.array(A.string().min(1).max(1024)).max(nl),writtenBy:A.array(A.string().min(1).max(1024)).max(nl),maintainedBy:A.array(A.string().min(1).max(1024)).max(nl)}).strict()).max(vv).optional(),traceVersion:A.literal(1)}).passthrough().superRefine((t,e)=>{let n=new Set;t.testResults.forEach((r,s)=>{let i=r.failureCause;i&&r.status==="Pass"&&e.addIssue({code:A.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"a passing result has no failure cause"}),i&&i.kind==="environment"!=(i.family!==void 0)&&e.addIssue({code:A.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"an environment cause names its family, and no other cause does"});let a=["testResults",s,"resultId"],c=r.resultId.slice(`${r.repository}:${r.testType}:`.length);(!r.resultId.startsWith(`${r.repository}:${r.testType}:`)||c===""||c.startsWith("/")||c.startsWith("#"))&&e.addIssue({code:A.ZodIssueCode.custom,path:a,message:"is not repository:testType:path for this result"}),n.has(r.resultId)&&e.addIssue({code:A.ZodIssueCode.custom,path:a,message:"stable identity repeated"}),n.add(r.resultId)})}),If=o(t=>t.replace(/[%:#]/g,e=>encodeURIComponent(e)),"encodeIdPart");function Lf(t,e,n,r){let s=n.replace(/\\/g,"/"),i=s.split("/").filter(l=>l!==""&&l!==".");if(s.startsWith("/")||/^[A-Za-z]:/.test(s)||i.length===0||i.includes(".."))throw new Error(`testResultId needs a path relative to the repository root, got "${n}"`);let a=i.join("/"),c=`${t}:${e}:${If(a)}`;return r?`${c}#${If(r)}`:c}o(Lf,"testResultId");var mA=(r=>(r.BranchPushed="branch_pushed",r.PullRequestOpened="pull_request_opened",r.PullRequestEdited="pull_request_edited",r))(mA||{}),_f=50,yf=A.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),Pf=A.discriminatedUnion("kind",[A.object({kind:A.literal("branch_pushed"),repository:Nn,branch:yf,commit:gn}).strict(),A.object({kind:A.enum(["pull_request_opened","pull_request_edited"]),repository:Nn,number:qt,branch:yf}).strict()]),Of=A.object({schemaVersion:A.literal(1),run:A.object({runId:tt,attemptNumber:A.number().int().positive(),manifestHash:nt}).strict(),target:lA,policy:lA,provenance:A.object({sources:A.array(A.object({repository:Nn,revision:gn}).strict()),firstQualification:A.literal(!0).optional()}).strict(),delivery:A.object({generatedTests:Rv}).strict(),producer:A.object({testbot:A.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:A.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:Tv,githubWrites:A.array(Pf).max(_f).optional()}).strict(),zV=Of.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:lf}).strict().superRefine(({recipe:t},e)=>{let n=o((i,a)=>e.addIssue({code:A.ZodIssueCode.custom,path:["recipe",...i],message:a}),"issue");t.status==="blocked"&&t.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let r=new Set,s=0;t.files.forEach((i,a)=>{Co(i.path)||n(["files",a,"path"],"is not .skyramp/workspace.yml or a file under .skyramp/sut/"),r.has(i.path)&&n(["files",a,"path"],"file repeated"),r.add(i.path),Af.test(i.content)&&n(["files",a,"content"],"is not text");let c=Buffer.byteLength(i.content,"utf8");s+=c,c>Zu&&n(["files",a,"content"],`larger than ${Zu} bytes`)}),s>Ku&&n(["files"],`recipe text over ${Ku} bytes in total`)}),ZV=A.object({components:A.array(A.object({name:A.string().min(1),repository:A.string().regex(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/),observedRevision:A.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:A.nativeEnum(AA),evidence:A.string()}).strict().refine(t=>t.source!=="agent"||t.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var Nv=A.object({schemaVersion:A.literal(1),stage:A.nativeEnum(Sf),event:A.nativeEnum(vf),status:A.nativeEnum(xf).optional()}).strict().refine(t=>t.status===void 0||t.event==="finished",{path:["status"],message:"only a finished stage has a status"}),EA=100,Fv=5e3,Io=2e3,Qf=100,Gf=/^[A-Za-z0-9_-]{1,64}$/,Uv=20,Mv=200,Lv=100,_v=100,Pv=200,Bf="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",Ov=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${Bf}/${Bf})$`),Gv=500,$v=50,Yv=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,Lt=o(t=>A.string().max(t).refine(e=>e.trim().length>0&&!Yv.test(e),"blank, or not text"),"setupText"),Tn={sequence:A.number().int().min(1).max(Fv),at:A.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},Vv=A.discriminatedUnion("kind",[A.object({...Tn,kind:A.literal("log"),phase:A.nativeEnum(Al),text:Lt(Io)}).strict(),A.object({...Tn,kind:A.literal("component"),name:Lt(Qf),repository:Lt(Pv).refine(t=>Ov.test(t)||t===hn,"not owner/name"),file:Lt(Gv).nullable(),status:A.nativeEnum(cl),version:Lt(_v).optional()}).strict(),A.object({...Tn,kind:A.literal("reply"),to:A.string().uuid(),accepted:A.boolean(),text:Lt(Io)}).strict(),A.object({...Tn,kind:A.literal("question"),id:A.string().regex(Gf),type:A.nativeEnum(Df),text:Lt(Io),component:Lt(Qf).nullable(),choices:A.array(Lt(Mv)).max(Uv),placeholder:Lt(Lv).optional()}).strict(),A.object({...Tn,kind:A.literal("delivered"),ids:A.array(A.string().uuid()).max(EA)}).strict(),A.object({...Tn,kind:A.literal("credentials"),names:A.array(A.string().regex(Eo)).min(1).max($v)}).strict()]).superRefine((t,e)=>{t.kind==="credentials"&&new Set(t.names).size!==t.names.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["names"],message:"a name twice"}),t.kind==="question"&&(t.type==="free_text"!=(t.choices.length===0)&&e.addIssue({code:A.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(t.choices).size!==t.choices.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),Hv=A.object({schemaVersion:A.literal(1),events:A.array(Vv).max(EA)}).strict(),Jv=A.discriminatedUnion("kind",[A.object({...Tn,kind:A.literal("log"),stage:A.nativeEnum(Tf),text:Lt(Io)}).strict(),A.object({...Tn,kind:A.literal("reply"),to:A.string().uuid(),accepted:A.boolean(),text:Lt(Io)}).strict(),A.object({...Tn,kind:A.literal("delivered"),ids:A.array(A.string().uuid()).max(EA)}).strict()]),qv=A.object({schemaVersion:A.literal(1),events:A.array(Jv).max(EA)}).strict(),wf={id:A.string().uuid(),text:A.string(),by:A.string().nullable(),at:A.string(),replied:A.literal(!0).optional()},$f=A.discriminatedUnion("kind",[A.object({...wf,kind:A.literal("instruction"),question:A.null()}),A.object({...wf,kind:A.literal("answer"),question:A.string().regex(Gf)})]),Yf=A.string().regex(/^[A-Za-z0-9+/]{43}=$/),jv=A.object({id:A.string().uuid(),revision:A.string(),by:A.string().nullable(),at:A.string(),target:A.string(),own:A.object({source:A.enum(["policy","test_environment"]),text:A.string()}).nullable()}),Wv=A.object({schemaVersion:A.literal(1),leftOut:A.array(A.string()),messages:A.array($f).optional(),stop:A.object({key:Yf}).optional(),notes:jv.optional()}),zv=A.object({schemaVersion:A.literal(1),messages:A.array($f).optional()});var Zv=500*1024*1024,Vf=A.object({id:qt,name:A.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:qt,expiresAt:A.string().datetime()}).strict(),Kv=A.object({schemaVersion:A.literal(1),artifact:Vf,sessionId:tt,contentHash:nt,bytes:A.number().int().min(1).max(Zv)}).strict(),Xv=A.object({schemaVersion:A.literal(1),checkpoint:A.object({artifact:Vf,repository:A.object({namespace:A.string().min(1),name:A.string().min(1)}).strict(),sessionId:tt,contentHash:nt,key:Yf}).strict().nullable()}).strict(),e0=200,Js=100,Hf=(r=>(r.Resume="resume",r.Retry="retry",r.Update="update",r))(Hf||{}),t0=A.object({kind:A.nativeEnum(Hf),setup:A.object({runId:tt,endedAt:A.string().nullable(),outcome:A.string().nullable()}).strict(),components:A.array(A.object({name:A.string().min(1),repository:A.string().min(1),status:A.nativeEnum(cl)}).strict()).max(Js),credentials:A.array(A.string().min(1)).max(Js),answers:A.array(A.object({question:A.string(),answer:A.string().nullable()}).strict()).max(Js),instructions:A.array(A.object({text:A.string(),reply:A.string().nullable()}).strict()).max(Js),log:A.array(A.object({phase:A.nativeEnum(Al),text:A.string()}).strict()).max(e0),recipe:A.object({files:A.array(A.object({path:A.string().min(1),content:A.string()}).strict()).max(Js),blockers:A.array(A.object({component:A.string(),problem:A.string(),evidence:A.string(),fix:A.string()}).strict()).max(Js)}).strict().optional()}).strict(),n0=A.object({schemaVersion:A.literal(1),context:t0.nullable()}).strict(),r0=A.object({schemaVersion:A.literal(1),configuration:A.object({captureId:tt,revision:qt.nullable(),hash:nt}).strict(),capture:A.object({schemaVersion:A.literal(1),settings:A.object({target:A.object({environment:A.unknown()}).passthrough(),timeoutMinutes:A.number().int().positive(),answerWaitMinutes:A.number().int().positive().optional(),testEnvironment:A.object({name:A.string().min(1),address:A.string().min(1).optional(),readyWhen:A.string().min(1).optional()}).passthrough().optional()}).passthrough(),provenance:A.object({}).passthrough(),hash:nt}).strict()}).strict(),s0=Hs.extend({version:A.number().int().positive(),components:A.array(A.object({name:A.string().min(1),repository:A.string().min(1)}).strict()),contentHash:nt.optional(),files:A.array(A.object({path:A.string().refine(t=>Co(t)&&!tl.includes(t),"not a file of a customer_deployed plan"),content:A.string()}).strict()).optional()}).strict(),i0=A.object({schemaVersion:A.literal(1),testEnvironment:s0.nullable().optional(),runtimePlan:A.object({version:A.number().int().positive(),contentHash:nt,files:A.array(A.object({path:A.string().refine(Co,"not a recipe file path"),content:A.string()}).strict()).min(1),recipe:A.record(A.unknown()).optional()}).strict().nullable()}).strict().refine(t=>!(t.runtimePlan&&t.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),Jf=A.object({schemaVersion:A.literal(1),state:A.nativeEnum(kf),ending:A.nativeEnum(yo).nullable(),cause:A.nativeEnum(Qo).nullable(),deadlineAt:A.string().datetime()}).strict();function qf(t,e){return t.state==="ended"?t.ending==="cancelled"?"cancelled":t.cause==="runner_lost"?"expired":"ended":e.getTime()>=Date.parse(t.deadlineAt)?"expired":null}o(qf,"attemptClosure");function rl(t){if(typeof t=="number"&&!Number.isFinite(t))throw new TypeError("Canonical JSON requires JSON values");if(Array.isArray(t))return`[${t.map(rl).join(",")}]`;if(t!==null&&typeof t=="object"){let n=t;return`{${Object.keys(n).sort().map(r=>`${JSON.stringify(r)}:${rl(n[r])}`).join(",")}}`}let e=JSON.stringify(t);if(e===void 0)throw new TypeError("Canonical JSON requires JSON values");return e}o(rl,"canonicalJson");function jf(t){return(0,bf.createHash)("sha256").update(rl(t),"utf8").digest("hex")}o(jf,"manifestHash");var dA=o(t=>({provider:t.provider,providerAccountId:t.providerAccountId,providerRepositoryId:t.providerRepositoryId}),"toSourceRef");function ll(t,e,{statedPins:n=!0}={}){return bv.parse({schemaVersion:1,runId:t,execution:e.execution(),requester:!0,writeCheck:!0,claudeCodePin:!0,deployedPins:!0,...n?{statedPins:!0}:{},...e.runSettingsFromApp?{runSettings:!0}:{}})}o(ll,"handshakeRequest");function Wf(t){let e=Bv.parse(t);if(jf(e.manifest)!==e.manifestHash)throw new Error("The handshake manifest hash does not match its manifest");return e}o(Wf,"parseHandshakeResponse");function o0(t){let e=o(n=>n.map(r=>({repository:dA(r.repository),number:r.number,...r.commitSha===void 0?{}:{commitSha:r.commitSha}})),"pullRequests");return t.status==="delivered"?{status:t.status,pullRequests:e(t.pullRequests)}:t.status==="partial"?{status:t.status,pullRequests:e(t.pullRequests),failures:t.failures.map(n=>({repository:dA(n.repository),message:n.message}))}:t}o(o0,"toDelivery");function a0(t){return t.issues.map(e=>`${e.path.map((r,s)=>typeof r=="number"?`[${r}]`:s===0?r:`.${r}`).join("")}: ${e.message}`).join("; ")}o(a0,"describeIssues");function zf(t){let{manifest:e}=t;if(pv.includes(e.trigger.kind))throw new Error(`The report upload is invalid: a ${e.trigger.kind} run uploads its SUT recipe, never a report`);if(e.trigger.kind==="revision_read")throw new Error("The report upload is invalid: a revision_read run uploads what each component runs, never a report");if(t.firstQualification&&!e.baseline?.sources)throw new Error("The report upload is invalid: only a run whose manifest names baseline sources can be a first qualification");let n=Of.safeParse({schemaVersion:1,run:{runId:e.runId,attemptNumber:t.attemptNumber,manifestHash:jf(e)},target:{id:e.target.id,revision:e.target.revision},policy:e.policy&&{id:e.policy.id,revision:e.policy.revision},provenance:{sources:t.checkedOut.map(r=>({repository:dA(r.repository),revision:r.revision})),...t.firstQualification?{firstQualification:!0}:{}},delivery:{generatedTests:o0(t.generatedTests)},producer:t.producer,report:t.report,...t.githubWrites?.length?{githubWrites:t.githubWrites.map(r=>({...r,repository:dA(r.repository)}))}:{}});if(!n.success)throw new Error(`The report upload is invalid: ${a0(n.error)}`);return A0(n.data,e,t.checkedOut),n.data}o(zf,"buildReportUpload");function A0(t,e,n){let r=o(i=>n.find(a=>Fn(a.repository)===Fn(i.repository))?.revision??i.revision,"revisionOf"),s=new Map(e.sources.map(i=>[`${i.repository.namespace}/${i.repository.name}`.toLowerCase(),r(i)]));t.report.validation.acceptedEvidence.forEach((i,a)=>{let c=`report.validation.acceptedEvidence[${a}]`,l=s.get(i.repository.toLowerCase());if(!l)throw new Error(`${c}.repository: ${i.repository} is outside the run's snapshot`);if(i.revision!==l)throw new Error(`${c}.revision: evidence is not from the checked-out revision ${l}`)})}o(A0,"assertEvidenceFromSnapshot");function Zf(t){return t.reportUploaded?{schemaVersion:1,reason:"report_uploaded",cause:null}:t.recipeUploaded?{schemaVersion:1,reason:"recipe_uploaded",cause:null}:t.revisionsUploaded?{schemaVersion:1,reason:"revisions_uploaded",cause:null}:t.cancelled?{schemaVersion:1,reason:"cancelled",cause:null}:{schemaVersion:1,reason:"no_report",cause:c0(t)}}o(Zf,"attemptEndFor");function c0(t){return t.runnerProviderNotReady?"runner_provider_not_ready":t.credentialMissing?"credential_missing":t.checkoutFailed?"checkout_failed":t.environmentUnverified?"environment_unverified":t.setupFailed?"setup_failed":t.timedOut?"timed_out":t.modelProviderDenied?"model_provider_denied":t.modelProviderUnavailable?"model_provider_unavailable":"agent_failed"}o(c0,"noReportCause");var tH={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var l0=10*1024*1024;var d0=["generate-unit","native-run"],aH=["preflight","plan","write",...d0,"report","deliver"];var CA=(r=>(r.Unit="unit",r.Integration="integration",r.E2e="e2e",r))(CA||{});var Bo=Ve(require("fs")),wo=Ve(require("path"));var h0=8;function lt(t,e,n={}){let r=e.slice(0,h0),s=e.length-r.length;return{name:t,passed:!1,details:r.join("; ")+(s>0?`; \u2026and ${s} more`:""),...n.fatal?{fatal:!0}:{}}}o(lt,"fail");function js(t){if(Bo.existsSync(t))try{return JSON.parse(Bo.readFileSync(t,"utf-8"))}catch{return}}o(js,"readJsonFile");function jt(t,e){return js(wo.join(t.outputsDir,e))}o(jt,"readArtifact");function cr(t,e){return{name:t,verify(n,r){let{errors:s}=e(n,r);return s.length===0?{name:this.name,passed:!0}:lt(this.name,s,{fatal:!0})}}}o(cr,"schemaGate");function bo(t){return t.replace(/\s+/g," ").trim()}o(bo,"normalizeCode");var IA=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var g0=4,Xf="\xABredacted\xBB";function em(t){let e=new Set;for(let n of t){let r=(n??"").trim();r.length>=g0&&e.add(r)}return[...e].sort((n,r)=>r.length-n.length)}o(em,"redactionsFrom");function Ws(t,e){if(!t||e.length===0)return t;let n=t;for(let r of e)!r||!n.includes(r)||(n=n.split(r).join(Xf));return n}o(Ws,"redactSecrets");function p0(t,e){let n=o(r=>typeof r=="string"?e(r):Array.isArray(r)?r.map(n):r&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([s,i])=>[s,n(i)])):r,"walk");return n(t)}o(p0,"mapStrings");function zs(t,e){return e.length===0?t:p0(t,n=>Ws(n,e))}o(zs,"redactDeep");var EH=new TextDecoder("utf-8",{fatal:!0});var kH=new Set(Object.values(or));var SH=A.object({checks:A.array(A.object({repository:A.string().optional(),name:A.string().min(1),headSha:A.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:A.string().default("completed"),conclusion:A.string().nullable().optional(),url:A.string().optional(),summary:A.string().optional()}))});var Ro=(n=>(n.Full="full",n.Static="static",n))(Ro||{}),ur=(r=>(r.Contract="contract",r.Integration="integration",r.Ui="ui",r))(ur||{}),ko=(i=>(i.OwnSurface="own_surface",i.StateReadBack="state_read_back",i.Referential="referential",i.Lifecycle="lifecycle",i.Boundaries="boundaries",i))(ko||{}),Xr=(s=>(s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s))(Xr||{}),yA=(d=>(d.Equals="equals",d.NotEquals="not_equals",d.GreaterThan="greater_than",d.LessThan="less_than",d.Contains="contains",d.NotContains="not_contains",d.Matches="matches",d.Absent="absent",d.Present="present",d))(yA||{});var It=A.string().trim().min(1),m0=A.object({subject:It.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:A.nativeEnum(yA),value:A.union([A.string(),A.number(),A.boolean(),A.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),E0=A.object({test:It.describe("existing test path, relative to its repository"),repository:It.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:A.nativeEnum(Xr),evidence:It.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:A.array(A.string()).optional().describe("analyze behavior ids this maintenance covers")});var C0=A.object({surface:It.describe("a surface from the list, copied verbatim"),axis:A.nativeEnum(ko)}),I0=A.object({id:It.describe("short-slug, unique across generate[]"),type:A.nativeEnum(ur),target:It.describe('"METHOD /path", or a business-flow name'),from_finding:A.string().optional().describe("analyze finding id this case catches"),from_behavior:A.string().optional().describe("analyze behavior id this case pins"),derived_from:C0.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:It.describe("why this test matters"),expected_observable:It.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:m0.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:It.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:A.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),y0=A.object({covered:A.array(A.string()).optional(),abstain:A.string().optional()}).superRefine((t,e)=>{let n=Array.isArray(t.covered),r=typeof t.abstain=="string";if(n===r)return void e.addIssue({code:A.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&t.covered.length===0&&e.addIssue({code:A.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),r&&!t.abstain.trim()&&e.addIssue({code:A.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),Q0=A.object({surface:It.describe("a surface from the list, copied verbatim"),axes:A.object(Object.fromEntries(Object.values(ko).map(t=>[t,y0])))}),tm=A.object({schemaVersion:A.literal(1),mode:A.nativeEnum(Ro),maintenance:A.array(E0),generate:A.array(I0),surfaces:A.array(Q0).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:A.object({total:A.number().describe("case count"),rationale:It}),summary:It.describe("one paragraph")});var QA=["-c","core.fsmonitor=false"],B0=new Set(["GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","ACTIONS_RUNTIME_TOKEN","ACTIONS_ID_TOKEN_REQUEST_TOKEN","ACTIONS_ID_TOKEN_REQUEST_URL","SYSTEM_ACCESSTOKEN","SYSTEM_OIDCREQUESTURI","SKYRAMP_MCP_GITHUB_TOKEN","SSH_AUTH_SOCK","GIT_SSH","GIT_SSH_COMMAND","GITHUB_STEP_SUMMARY"]),w0=new Set(["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_PROFILE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN","AWS_ROLE_SESSION_NAME","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"]);function Un(t=process.env,e,n="repo-command"){let r={};for(let[s,i]of Object.entries(t))n==="repo-command"&&w0.has(s)||(r[s]=i);Object.assign(r,e??{});for(let s of Object.keys(r))(B0.has(s)||s.startsWith("INPUT_"))&&delete r[s];return r}o(Un,"untrustedChildEnv");var b0=".skyramp/sut/deployed-revisions.sh",dl=(n=>(n.Running="running",n.Requested="requested",n))(dl||{});var JH=new Set(Object.values(dl));var qH=`Fix ${b0} so it prints the full commit each component runs, then set it up again.`;var hl="shared-environment";var AJ=64*1024;var cJ=new Set(["version_endpoint","api"]);function gl(t){return(t?.components??[]).filter(e=>!!e.repository&&!!e.expectedRevision)}o(gl,"verifiableComponents");function nm(t){return gl(t).length>0||(t?.dependencies.length??0)>0}o(nm,"hasSharedSystem");function k0(t){let e=t.inputs?.sharedEnvironment;if(!nm(e))return;let n=jt(t,`${hl}.json`);if(n)return{components:S0(e,n.components),dependencies:n.dependencies};let r="Not checked: the run ended before it checked the shared environment.";return{components:gl(e).map(s=>rm(s,r)),dependencies:e.dependencies.map(s=>({name:s.name,url:s.url,version:null,evidence:r}))}}o(k0,"sharedSystem");var rm=o((t,e)=>({name:t.name,repository:t.repository,url:t.url,expectedRevision:t.expectedRevision,observedRevision:null,status:"unverifiable",source:t.revisionUrl||t.revisionScript?"probe":"agent",evidence:e}),"unrecordedRow");function S0(t,e){let n=new Set(e.map(s=>s.name.toLowerCase())),r=gl(t).filter(s=>s.touched&&!n.has(s.name.toLowerCase()));return[...e,...r.map(s=>rm(s,"Not checked: the run recorded no read of it."))]}o(S0,"withUnrecordedTouched");function pl(t){return(k0(t)?.components??[]).filter(e=>e.status!=="verified")}o(pl,"unverifiedComponents");function fl(t){return(t?.components??[]).filter(e=>!!e.repository&&!e.expectedRevision)}o(fl,"unfrozenComponents");function _t(t,e=[]){let n=t.trim();if(!n)return{error:"session produced no output"};let r=o(l=>{try{let d=JSON.parse(l);return typeof d=="object"&&d!==null&&!Array.isArray(d)?d:void 0}catch{return}},"tryParse"),s=r(n);if(s!==void 0)return{value:s};let i;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(l){i=l instanceof Error?l.message:String(l)}let a=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let l=a.length-1;l>=0;l--){let d=r(a[l][1].trim());if(d!==void 0)return{value:d}}let c;for(let l=n.indexOf("{");l!==-1;l=n.indexOf("{",l+1)){let d=0,h=!1,g=!1;for(let f=l;f<n.length;f++){let m=n[f];if(g){g=!1;continue}if(m==="\\"){g=h;continue}if(m==='"'){h=!h;continue}if(!h){if(m==="{")d++;else if(m==="}"&&(d--,d===0)){let C=r(n.slice(l,f+1));C!==void 0&&Object.keys(C).length>0&&(c=C,l=f);break}}}}return i&&(c===void 0||Object.keys(c).length<3)?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:c!==void 0?{value:c}:i?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:{error:`no parseable JSON object found in session output \u2014 the final message was: "${v0(Ws(n,e))}"`}}o(_t,"extractJsonObject");var sm=240;function v0(t){let e=t.replace(/\s+/g," ").trim();return e.length<=sm?e:`\u2026${e.slice(-sm)}`}o(v0,"snippetOf");function x0(t){return t.issues.map(e=>{let n=e.path.map(s=>typeof s=="number"?`[${s}]`:`.${s}`).join("").replace(/^\./,""),r=n||"output";if(!/^(Expected |Required$|Invalid |String must|Array must|Number must)/.test(e.message))return`${r} ${e.message}`;switch(e.code){case"invalid_type":return n?e.expected==="object"?`${r} must be an object`:e.received==="undefined"?`${r} is required`:`${r} must be ${e.expected}, got ${e.received}`:"output is not a JSON object";case"invalid_enum_value":{let s=JSON.stringify(e.received),i=e.options.find(c=>typeof c=="string"&&typeof e.received=="string"&&e.received.startsWith(c)),a=i?` \u2014 you sent ${s}; the value must be exactly ${JSON.stringify(i)}, with any qualifier moved to a field that takes free text`:` \u2014 you sent ${s}`;return`${r} must be one of: ${e.options.join(", ")}${a}`}case"invalid_literal":return`${r} must be ${JSON.stringify(e.expected)}`;case"too_small":return e.type==="string"?`${r} must be a non-empty string`:`${r} must have at least ${e.minimum} item(s)`;case"unrecognized_keys":return`${r} has unknown key(s): ${e.keys.join(", ")}`;default:return`${r}: ${e.message}`}})}o(x0,"issuesToMessages");function Mn(t,e){let n=t.safeParse(e);if(n.success)return{value:n.data,errors:[]};let r=o((i,a)=>a.reduce((c,l)=>c&&typeof c=="object"?c[l]:void 0,i),"at"),s=n.error.issues.filter(i=>i.path.length&&r(e,i.path)===null);if(s.length===n.error.issues.length)try{let i=t.safeParse(s.reduce((a,{path:c})=>im(a,c),e));if(i.success)return{value:i.data,errors:[]}}catch{}return{errors:x0(n.error)}}o(Mn,"validateWith");function im(t,e){if(!e.length||!t||typeof t!="object")return t;let[n,...r]=e,s=Array.isArray(t)?t.slice():{...t};return r.length?s[n]=im(s[n],r):delete s[n],s}o(im,"withoutAt");var Ks=Ve(require("path"));function D0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}o(D0,"getDefaultExportFromCjs");var Ze={},BA={},lr={},om;function So(){if(om)return lr;om=1;function t(a){return typeof a>"u"||a===null}o(t,"isNothing");function e(a){return typeof a=="object"&&a!==null}o(e,"isObject");function n(a){return Array.isArray(a)?a:t(a)?[]:[a]}o(n,"toArray");function r(a,c){if(c){let l=Object.keys(c);for(let d=0,h=l.length;d<h;d+=1){let g=l[d];a[g]=c[g]}}return a}o(r,"extend");function s(a,c){let l="";for(let d=0;d<c;d+=1)l+=a;return l}o(s,"repeat");function i(a){return a===0&&Number.NEGATIVE_INFINITY===1/a}return o(i,"isNegativeZero"),lr.isNothing=t,lr.isObject=e,lr.toArray=n,lr.repeat=s,lr.isNegativeZero=i,lr.extend=r,lr}o(So,"requireCommon");var ml,am;function vo(){if(am)return ml;am=1;function t(n,r){let s="",i=n.reason||"(unknown reason)";return n.mark?(n.mark.name&&(s+='in "'+n.mark.name+'" '),s+="("+(n.mark.line+1)+":"+(n.mark.column+1)+")",!r&&n.mark.snippet&&(s+=`
46
+ ${l}`,this.dataLineCount++;return}if(ku(e,s,dY)){fY(e,i)&&(this.setEventFieldSize("retry",e.length-i),n.retry=e.toString("utf8",i));return}if(ku(e,s,lY)){mY(e,i)&&(this.setEventFieldSize("id",e.length-i),n.id=e.toString("utf8",i));return}ku(e,s,uY)&&i<e.length&&(this.setEventFieldSize("event",e.length-i),n.event=e.toString("utf8",i))}setEventFieldSize(e,n){let r=this.eventSize-this.eventFieldSizes[e]+n;if(this.maxEventSize>0&&r>this.maxEventSize)throw Su();this.eventSize=r,this.eventFieldSizes[e]=n}processEvent(e){e.retry&&sY(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id&&iY(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,this.event.event=void 0,this.event.id=void 0,this.event.retry=void 0,this.eventSize=0,this.dataLineCount=0,this.eventFieldSizes.data=0,this.eventFieldSizes.event=0,this.eventFieldSizes.id=0,this.eventFieldSizes.retry=0}hasPendingEvent(){return this.event.data!==void 0||this.event.event!==void 0||this.event.id!==void 0||this.event.retry!==void 0}hasCurrentByte(){return this.chunkIndex<this.chunks.length&&this.pos<this.chunks[this.chunkIndex].length}currentByte(){return this.chunks[this.chunkIndex][this.pos]}consumeCurrentByte(){this.advanceCursor(),this.syncLineStartToCursor()}advanceCursor(){for(this.pos++;this.chunkIndex<this.chunks.length&&this.pos>=this.chunks[this.chunkIndex].length;)this.chunkIndex++,this.pos=0}syncLineStartToCursor(){this.lineChunkIndex=this.chunkIndex,this.linePos=this.pos,this.lineLength=0,this.dropConsumedChunks()}dropConsumedChunks(){if(this.lineChunkIndex>0){let e=this.lineChunkIndex;this.chunks.splice(0,e),this.lineChunkIndex=0,this.chunkIndex-=e}this.chunkIndex===this.chunks.length&&(this.chunks.length=0,this.chunkIndex=0,this.pos=0,this.lineChunkIndex=0,this.linePos=0)}readLine(){if(this.lineChunkIndex===this.chunkIndex)return this.chunks[this.chunkIndex].subarray(this.linePos,this.pos);let e=[],n=0;for(let r=this.lineChunkIndex;r<=this.chunkIndex;r++){let s=this.chunks[r],i=r===this.lineChunkIndex?this.linePos:0,a=r===this.chunkIndex?this.pos:s.length,c=s.subarray(i,a);n+=c.length,e.push(c)}return Buffer.concat(e,n)}peekBufferedByte(e){let n=this.lineChunkIndex,r=this.linePos;for(;n<this.chunks.length;){let s=this.chunks[n],i=s.length-r;if(e<i)return s[r+e];e-=i,n++,r=0}}discardLeadingBytes(e){for(;e>0&&this.lineChunkIndex<this.chunks.length;){let r=this.chunks[this.lineChunkIndex].length-this.linePos;e<r?(this.linePos+=e,e=0):(e-=r,this.lineChunkIndex++,this.linePos=0)}this.chunkIndex=this.lineChunkIndex,this.pos=this.linePos,this.dropConsumedChunks()}handleBOM(){let e=this.peekBufferedByte(0),n=this.peekBufferedByte(1),r=this.peekBufferedByte(2);return n===void 0?(e===eo[0]||(this.checkBOM=!1),!0):r===void 0?e===eo[0]&&n===eo[1]?!0:(this.checkBOM=!1,!1):(e===eo[0]&&n===eo[1]&&r===eo[2]&&this.discardLeadingBytes(3),this.checkBOM=!1,!this.hasCurrentByte())}};ak.exports={EventSourceStream:Lp}});var fk=T((l5,pk)=>{"use strict";var{pipeline:EY}=require("node:stream"),{fetching:CY}=wa(),{makeRequest:IY}=Yi(),{webidl:zn}=je(),{EventSourceStream:yY}=Ak(),{parseMIMEType:QY}=ht(),{createFastMessageEvent:BY}=Wi(),{isNetworkError:ck}=Qa(),{delay:wY}=Mp(),{kEnumerableProperty:xs}=ue(),{environmentSettingsObject:uk}=Qt(),{getGlobalDispatcher:bY}=Ca(),lk=!1,dk=3e3,Pa=0,hk=1,Oa=2,RY="anonymous",kY="use-credentials",to=class t extends EventTarget{static{o(this,"EventSource")}#e={open:null,error:null,message:null};#t=null;#n=!1;#s=Pa;#i=null;#r=null;#o;#a;constructor(e,n={}){super(),zn.util.markAsUncloneable(this);let r="EventSource constructor";zn.argumentLengthCheck(arguments,1,r),lk||(lk=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=zn.converters.USVString(e,r,"url"),n=zn.converters.EventSourceInitDict(n,r,"eventSourceInitDict"),this.#o=n.dispatcher,this.#a={lastEventId:"",reconnectionTime:dk};let s=uk,i;try{i=new URL(e,s.settingsObject.baseUrl),this.#a.origin=i.origin}catch(l){throw new DOMException(l,"SyntaxError")}this.#t=i.href;let a=RY;n.withCredentials&&(a=kY,this.#n=!0);let c={redirect:"follow",keepalive:!0,mode:"cors",credentials:a==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};c.client=uk.settingsObject,c.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],c.cache="no-store",c.initiator="other",c.urlList=[new URL(this.#t)],this.#i=IY(c),this.#c()}get readyState(){return this.#s}get url(){return this.#t}get withCredentials(){return this.#n}#c(){if(this.#s===Oa)return;this.#s=Pa;let e={request:this.#i,dispatcher:this.#o},n=o(r=>{ck(r)&&(this.dispatchEvent(new Event("error")),this.close()),this.#A()},"processEventSourceEndOfBody");e.processResponseEndOfBody=n,e.processResponse=r=>{if(ck(r))if(r.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#A();return}let s=r.headersList.get("content-type",!0),i=s!==null?QY(s):"failure",a=i!=="failure"&&i.essence==="text/event-stream";if(r.status!==200||a===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#s=hk,this.dispatchEvent(new Event("open")),this.#a.origin=r.urlList[r.urlList.length-1].origin;let c=new yY({eventSourceSettings:this.#a,maxEventSize:this.#o.eventSourceOptions?.maxEventSize,push:o(l=>{this.dispatchEvent(BY(l.type,l.options))},"push")});EY(r.body.stream,c,l=>{l?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#r=CY(e)}async#A(){this.#s!==Oa&&(this.#s=Pa,this.dispatchEvent(new Event("error")),await wY(this.#a.reconnectionTime),this.#s===Pa&&(this.#a.lastEventId.length&&this.#i.headersList.set("last-event-id",this.#a.lastEventId,!0),this.#c()))}close(){zn.brandCheck(this,t),this.#s!==Oa&&(this.#s=Oa,this.#r.abort(),this.#i=null)}get onopen(){return this.#e.open}set onopen(e){this.#e.open&&this.removeEventListener("open",this.#e.open),typeof e=="function"?(this.#e.open=e,this.addEventListener("open",e)):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(e){this.#e.message&&this.removeEventListener("message",this.#e.message),typeof e=="function"?(this.#e.message=e,this.addEventListener("message",e)):this.#e.message=null}get onerror(){return this.#e.error}set onerror(e){this.#e.error&&this.removeEventListener("error",this.#e.error),typeof e=="function"?(this.#e.error=e,this.addEventListener("error",e)):this.#e.error=null}},gk={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:Pa,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:hk,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:Oa,writable:!1}};Object.defineProperties(to,gk);Object.defineProperties(to.prototype,gk);Object.defineProperties(to.prototype,{close:xs,onerror:xs,onmessage:xs,onopen:xs,readyState:xs,url:xs,withCredentials:xs});zn.converters.EventSourceInitDict=zn.dictionaryConverter([{key:"withCredentials",converter:zn.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"dispatcher",converter:zn.converters.any,defaultValue:o(()=>bY(),"defaultValue")}]);pk.exports={EventSource:to,defaultReconnectionTime:dk}});var Ik=T((h5,ne)=>{"use strict";var SY=vi(),mk=Go(),vY=xi(),xY=mQ(),DY=Di(),TY=sg(),NY=GQ(),FY=jQ(),Ek=pe(),xu=ue(),{InvalidArgumentError:vu}=Ek,no=FB(),UY=Yo(),MY=Pg(),LY=fw(),_Y=$g(),PY=Rg(),OY=Dc(),{getGlobalDispatcher:Ck,setGlobalDispatcher:GY}=Ca(),$Y=Gc(),YY=Ic(),VY=yc();Object.assign(mk.prototype,no);ne.exports.Dispatcher=mk;ne.exports.Client=SY;ne.exports.Pool=vY;ne.exports.BalancedPool=xY;ne.exports.Agent=DY;ne.exports.ProxyAgent=TY;ne.exports.EnvHttpProxyAgent=NY;ne.exports.RetryAgent=FY;ne.exports.RetryHandler=OY;ne.exports.DecoratorHandler=$Y;ne.exports.RedirectHandler=YY;ne.exports.createRedirectInterceptor=VY;ne.exports.interceptors={redirect:Bw(),retry:bw(),dump:kw(),dns:xw()};ne.exports.buildConnector=UY;ne.exports.errors=Ek;ne.exports.util={parseHeaders:xu.parseHeaders,headerNameToString:xu.headerNameToString};function Ga(t){return(e,n,r)=>{if(typeof n=="function"&&(r=n,n=null),!e||typeof e!="string"&&typeof e!="object"&&!(e instanceof URL))throw new vu("invalid url");if(n!=null&&typeof n!="object")throw new vu("invalid opts");if(n&&n.path!=null){if(typeof n.path!="string")throw new vu("invalid opts.path");let a=n.path;n.path.startsWith("/")||(a=`/${a}`),e=new URL(xu.parseOrigin(e).origin+a)}else n||(n=typeof e=="object"?e:{}),e=xu.parseURL(e);let{agent:s,dispatcher:i=Ck()}=n;if(s)throw new vu("unsupported opts.agent. Did you mean opts.client?");return t.call(i,{...n,origin:e.origin,path:e.search?`${e.pathname}${e.search}`:e.pathname,method:n.method||(n.body?"PUT":"GET")},r)}}o(Ga,"makeDispatcher");ne.exports.setGlobalDispatcher=GY;ne.exports.getGlobalDispatcher=Ck;var HY=wa().fetch;ne.exports.fetch=o(async function(e,n=void 0){try{return await HY(e,n)}catch(r){throw r&&typeof r=="object"&&Error.captureStackTrace(r),r}},"fetch");ne.exports.Headers=Bs().Headers;ne.exports.Response=Qa().Response;ne.exports.Request=Yi().Request;ne.exports.FormData=zo().FormData;ne.exports.File=globalThis.File??require("node:buffer").File;ne.exports.FileReader=Jb().FileReader;var{setGlobalOrigin:JY,getGlobalOrigin:qY}=rh();ne.exports.setGlobalOrigin=JY;ne.exports.getGlobalOrigin=qY;var{CacheStorage:jY}=tR(),{kConstruct:WY}=Au();ne.exports.caches=new jY(WY);var{deleteCookie:zY,getCookies:ZY,getSetCookies:KY,setCookie:XY}=dR();ne.exports.deleteCookie=zY;ne.exports.getCookies=ZY;ne.exports.getSetCookies=KY;ne.exports.setCookie=XY;var{parseMIMEType:e2,serializeAMimeType:t2}=ht();ne.exports.parseMIMEType=e2;ne.exports.serializeAMimeType=t2;var{CloseEvent:n2,ErrorEvent:r2,MessageEvent:s2}=Wi();ne.exports.WebSocket=ik().WebSocket;ne.exports.CloseEvent=n2;ne.exports.ErrorEvent=r2;ne.exports.MessageEvent=s2;ne.exports.request=Ga(no.request);ne.exports.stream=Ga(no.stream);ne.exports.pipeline=Ga(no.pipeline);ne.exports.connect=Ga(no.connect);ne.exports.upgrade=Ga(no.upgrade);ne.exports.MockClient=MY;ne.exports.MockPool=_Y;ne.exports.MockAgent=LY;ne.exports.mockErrors=PY;var{EventSource:i2}=fk();ne.exports.EventSource=i2});var z2={};jp(z2,{AppRefusal:()=>an,AppUnreachable:()=>Ds,AttemptEndReason:()=>yo,DeliveryStatus:()=>gA,GitHubWriteKind:()=>mA,NoReportCause:()=>Qo,SourceProvider:()=>Kr,V3Attempt:()=>Ja,ValidationSufficiency:()=>Zr,closedV3Attempt:()=>Pk,endV3Attempt:()=>$k,heartbeatV3Attempt:()=>qp,startV3Attempt:()=>_k,uploadV3Report:()=>Gk});module.exports=jk(z2);var A={};jp(A,{BRAND:()=>IS,DIRTY:()=>Fr,EMPTY_PATH:()=>Kk,INVALID:()=>Z,NEVER:()=>sv,OK:()=>We,ParseStatus:()=>He,Schema:()=>Ae,ZodAny:()=>sr,ZodArray:()=>Dn,ZodBigInt:()=>Mr,ZodBoolean:()=>Lr,ZodBranded:()=>go,ZodCatch:()=>jr,ZodDate:()=>_r,ZodDefault:()=>qr,ZodDiscriminatedUnion:()=>sA,ZodEffects:()=>Mt,ZodEnum:()=>Hr,ZodError:()=>ct,ZodFirstPartyTypeKind:()=>ee,ZodFunction:()=>oA,ZodIntersection:()=>$r,ZodIssueCode:()=>N,ZodLazy:()=>Yr,ZodLiteral:()=>Vr,ZodMap:()=>Os,ZodNaN:()=>$s,ZodNativeEnum:()=>Jr,ZodNever:()=>Jt,ZodNull:()=>Or,ZodNullable:()=>dn,ZodNumber:()=>Ur,ZodObject:()=>ut,ZodOptional:()=>Ft,ZodParsedType:()=>O,ZodPipeline:()=>po,ZodPromise:()=>ir,ZodReadonly:()=>Wr,ZodRecord:()=>iA,ZodSchema:()=>Ae,ZodSet:()=>Gs,ZodString:()=>rr,ZodSymbol:()=>_s,ZodTransformer:()=>Mt,ZodTuple:()=>ln,ZodType:()=>Ae,ZodUndefined:()=>Pr,ZodUnion:()=>Gr,ZodUnknown:()=>xn,ZodVoid:()=>Ps,addIssueToContext:()=>_,any:()=>vS,array:()=>NS,bigint:()=>wS,boolean:()=>af,coerce:()=>rv,custom:()=>rf,date:()=>bS,datetimeRegex:()=>tf,defaultErrorMap:()=>Sn,discriminatedUnion:()=>LS,effect:()=>WS,enum:()=>JS,function:()=>YS,getErrorMap:()=>Us,getParsedType:()=>un,instanceof:()=>QS,intersection:()=>_S,isAborted:()=>nA,isAsync:()=>Ms,isDirty:()=>rA,isValid:()=>nr,late:()=>yS,lazy:()=>VS,literal:()=>HS,makeIssue:()=>ho,map:()=>GS,nan:()=>BS,nativeEnum:()=>qS,never:()=>DS,null:()=>SS,nullable:()=>ZS,number:()=>of,object:()=>FS,objectUtil:()=>$u,oboolean:()=>nv,onumber:()=>tv,optional:()=>zS,ostring:()=>ev,pipeline:()=>XS,preprocess:()=>KS,promise:()=>jS,quotelessJson:()=>Wk,record:()=>OS,set:()=>$S,setErrorMap:()=>Zk,strictObject:()=>US,string:()=>sf,symbol:()=>RS,transformer:()=>WS,tuple:()=>PS,undefined:()=>kS,union:()=>MS,unknown:()=>xS,util:()=>le,void:()=>TS});var le;(function(t){t.assertEqual=s=>{};function e(s){}o(e,"assertIs"),t.assertIs=e;function n(s){throw new Error}o(n,"assertNever"),t.assertNever=n,t.arrayToEnum=s=>{let i={};for(let a of s)i[a]=a;return i},t.getValidEnumValues=s=>{let i=t.objectKeys(s).filter(c=>typeof s[s[c]]!="number"),a={};for(let c of i)a[c]=s[c];return t.objectValues(a)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let a in s)Object.prototype.hasOwnProperty.call(s,a)&&i.push(a);return i},t.find=(s,i)=>{for(let a of s)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}o(r,"joinValues"),t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(le||(le={}));var $u;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})($u||($u={}));var O=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),un=o(t=>{switch(typeof t){case"undefined":return O.undefined;case"string":return O.string;case"number":return Number.isNaN(t)?O.nan:O.number;case"boolean":return O.boolean;case"function":return O.function;case"bigint":return O.bigint;case"symbol":return O.symbol;case"object":return Array.isArray(t)?O.array:t===null?O.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?O.promise:typeof Map<"u"&&t instanceof Map?O.map:typeof Set<"u"&&t instanceof Set?O.set:typeof Date<"u"&&t instanceof Date?O.date:O.object;default:return O.unknown}},"getParsedType");var N=le.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Wk=o(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),ct=class t extends Error{static{o(this,"ZodError")}get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},r={_errors:[]},s=o(i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let c=r,l=0;for(;l<a.path.length;){let d=a.path[l],h=l===a.path.length-1;if(d==="_errors"){h&&c._errors.push(n(a)),l++;continue}Object.prototype.hasOwnProperty.call(c,d)||(d==="__proto__"?Object.defineProperty(c,d,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):c[d]={_errors:[]}),c=c[d],h&&c._errors.push(n(a)),l++}}},"processError");return s(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};ct.create=t=>new ct(t);var zk=o((t,e)=>{let n;switch(t.code){case N.invalid_type:t.received===O.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case N.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,le.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:n=`Unrecognized key(s) in object: ${le.joinValues(t.keys,", ")}`;break;case N.invalid_union:n="Invalid input";break;case N.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${le.joinValues(t.options)}`;break;case N.invalid_enum_value:n=`Invalid enum value. Expected ${le.joinValues(t.options)}, received '${t.received}'`;break;case N.invalid_arguments:n="Invalid function arguments";break;case N.invalid_return_type:n="Invalid function return type";break;case N.invalid_date:n="Invalid date";break;case N.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:le.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case N.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case N.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case N.custom:n="Invalid input";break;case N.invalid_intersection_types:n="Intersection results could not be merged";break;case N.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case N.not_finite:n="Number must be finite";break;default:n=e.defaultError,le.assertNever(t)}return{message:n}},"errorMap"),Sn=zk;var zp=Sn;function Zk(t){zp=t}o(Zk,"setErrorMap");function Us(){return zp}o(Us,"getErrorMap");var ho=o(t=>{let{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],a={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let c="",l=r.filter(d=>!!d).slice().reverse();for(let d of l)c=d(a,{data:e,defaultError:c}).message;return{...s,path:i,message:c}},"makeIssue"),Kk=[];function _(t,e){let n=Us(),r=ho({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Sn?void 0:Sn].filter(s=>!!s)});t.common.issues.push(r)}o(_,"addIssueToContext");var He=class t{static{o(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let s of n){if(s.status==="aborted")return Z;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let s of n){let i=await s.key,a=await s.value;r.push({key:i,value:a})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let s of n){let{key:i,value:a}=s;if(i.status==="aborted"||a.status==="aborted")return Z;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(r[i.value]=a.value)}return{status:e.value,value:r}}},Z=Object.freeze({status:"aborted"}),Fr=o(t=>({status:"dirty",value:t}),"DIRTY"),We=o(t=>({status:"valid",value:t}),"OK"),nA=o(t=>t.status==="aborted","isAborted"),rA=o(t=>t.status==="dirty","isDirty"),nr=o(t=>t.status==="valid","isValid"),Ms=o(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync");var V;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(V||(V={}));var Ut=class{static{o(this,"ParseInputLazyPath")}constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Zp=o((t,e)=>{if(nr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new ct(t.common.issues);return this._error=n,this._error}}},"handleResult");function ie(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:o((a,c)=>{let{message:l}=t;return a.code==="invalid_enum_value"?{message:l??c.defaultError}:typeof c.data>"u"?{message:l??r??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:l??n??c.defaultError}},"customMap"),description:s}}o(ie,"processCreateParams");var Ae=class{static{o(this,"ZodType")}get description(){return this._def.description}_getType(e){return un(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:un(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new He,ctx:{common:e.parent.common,data:e.data,parsedType:un(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Ms(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:un(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Zp(r,s)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:un(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return nr(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>nr(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:un(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Ms(s)?s:Promise.resolve(s));return Zp(r,i)}refine(e,n){let r=o(s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n,"getIssueProperties");return this._refinement((s,i)=>{let a=e(s),c=o(()=>i.addIssue({code:N.custom,...r(s)}),"setError");return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Mt({schema:this,typeName:ee.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:o(n=>this["~validate"](n),"validate")}}optional(){return Ft.create(this,this._def)}nullable(){return dn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Dn.create(this)}promise(){return ir.create(this,this._def)}or(e){return Gr.create([this,e],this._def)}and(e){return $r.create(this,e,this._def)}transform(e){return new Mt({...ie(this._def),schema:this,typeName:ee.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new qr({...ie(this._def),innerType:this,defaultValue:n,typeName:ee.ZodDefault})}brand(){return new go({typeName:ee.ZodBranded,type:this,...ie(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new jr({...ie(this._def),innerType:this,catchValue:n,typeName:ee.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return po.create(this,e)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xk=/^c[^\s-]{8,}$/i,eS=/^[0-9a-z]+$/,tS=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nS=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,rS=/^[a-z0-9_-]{21}$/i,sS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,iS=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oS=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aS="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",Yu,AS=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cS=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,uS=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,lS=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dS=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hS=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Xp="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",gS=new RegExp(`^${Xp}$`);function ef(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}o(ef,"timeRegexSource");function pS(t){return new RegExp(`^${ef(t)}$`)}o(pS,"timeRegex");function tf(t){let e=`${Xp}T${ef(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}o(tf,"datetimeRegex");function fS(t,e){return!!((e==="v4"||!e)&&AS.test(t)||(e==="v6"||!e)&&uS.test(t))}o(fS,"isValidIP");function mS(t,e){if(!sS.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}o(mS,"isValidJWT");function ES(t,e){return!!((e==="v4"||!e)&&cS.test(t)||(e==="v6"||!e)&&lS.test(t))}o(ES,"isValidCidr");var rr=class t extends Ae{static{o(this,"ZodString")}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){let i=this._getOrReturnCtx(e);return _(i,{code:N.invalid_type,expected:O.string,received:i.parsedType}),Z}let r=new He,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),_(s,{code:N.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),_(s,{code:N.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,c=e.data.length<i.value;(a||c)&&(s=this._getOrReturnCtx(e,s),a?_(s,{code:N.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&_(s,{code:N.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")oS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"email",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Yu||(Yu=new RegExp(aS,"u")),Yu.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"emoji",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")nS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"uuid",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")rS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"nanoid",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Xk.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"cuid",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")eS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"cuid2",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")tS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"ulid",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),_(s,{validation:"url",code:N.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"regex",code:N.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?tf(i).test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?gS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?pS(i).test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?iS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"duration",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?fS(e.data,i.version)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"ip",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?mS(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"jwt",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?ES(e.data,i.version)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"cidr",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?dS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"base64",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?hS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"base64url",code:N.invalid_string,message:i.message}),r.dirty()):le.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:N.invalid_string,...V.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...V.errToObj(e)})}url(e){return this._addCheck({kind:"url",...V.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...V.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...V.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...V.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...V.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...V.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...V.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...V.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...V.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...V.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...V.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...V.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...V.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...V.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...V.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...V.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...V.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...V.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...V.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...V.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...V.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...V.errToObj(n)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};rr.create=t=>new rr({checks:[],typeName:ee.ZodString,coerce:t?.coerce??!1,...ie(t)});function CS(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return i%a/10**s}o(CS,"floatSafeRemainder");var Ur=class t extends Ae{static{o(this,"ZodNumber")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==O.number){let i=this._getOrReturnCtx(e);return _(i,{code:N.invalid_type,expected:O.number,received:i.parsedType}),Z}let r,s=new He;for(let i of this._def.checks)i.kind==="int"?le.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{code:N.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?CS(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{code:N.not_finite,message:i.message}),s.dirty()):le.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,V.toString(n))}gt(e,n){return this.setLimit("min",e,!1,V.toString(n))}lte(e,n){return this.setLimit("max",e,!0,V.toString(n))}lt(e,n){return this.setLimit("max",e,!1,V.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:V.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&le.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Ur.create=t=>new Ur({checks:[],typeName:ee.ZodNumber,coerce:t?.coerce||!1,...ie(t)});var Mr=class t extends Ae{static{o(this,"ZodBigInt")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==O.bigint)return this._getInvalidInput(e);let r,s=new He;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):le.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return _(n,{code:N.invalid_type,expected:O.bigint,received:n.parsedType}),Z}gte(e,n){return this.setLimit("min",e,!0,V.toString(n))}gt(e,n){return this.setLimit("min",e,!1,V.toString(n))}lte(e,n){return this.setLimit("max",e,!0,V.toString(n))}lt(e,n){return this.setLimit("max",e,!1,V.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:V.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Mr.create=t=>new Mr({checks:[],typeName:ee.ZodBigInt,coerce:t?.coerce??!1,...ie(t)});var Lr=class extends Ae{static{o(this,"ZodBoolean")}_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.boolean,received:r.parsedType}),Z}return We(e.data)}};Lr.create=t=>new Lr({typeName:ee.ZodBoolean,coerce:t?.coerce||!1,...ie(t)});var _r=class t extends Ae{static{o(this,"ZodDate")}_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){let i=this._getOrReturnCtx(e);return _(i,{code:N.invalid_type,expected:O.date,received:i.parsedType}),Z}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return _(i,{code:N.invalid_date}),Z}let r=new He,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),_(s,{code:N.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),_(s,{code:N.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):le.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:V.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:V.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};_r.create=t=>new _r({checks:[],coerce:t?.coerce||!1,typeName:ee.ZodDate,...ie(t)});var _s=class extends Ae{static{o(this,"ZodSymbol")}_parse(e){if(this._getType(e)!==O.symbol){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.symbol,received:r.parsedType}),Z}return We(e.data)}};_s.create=t=>new _s({typeName:ee.ZodSymbol,...ie(t)});var Pr=class extends Ae{static{o(this,"ZodUndefined")}_parse(e){if(this._getType(e)!==O.undefined){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.undefined,received:r.parsedType}),Z}return We(e.data)}};Pr.create=t=>new Pr({typeName:ee.ZodUndefined,...ie(t)});var Or=class extends Ae{static{o(this,"ZodNull")}_parse(e){if(this._getType(e)!==O.null){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.null,received:r.parsedType}),Z}return We(e.data)}};Or.create=t=>new Or({typeName:ee.ZodNull,...ie(t)});var sr=class extends Ae{static{o(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(e){return We(e.data)}};sr.create=t=>new sr({typeName:ee.ZodAny,...ie(t)});var xn=class extends Ae{static{o(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(e){return We(e.data)}};xn.create=t=>new xn({typeName:ee.ZodUnknown,...ie(t)});var Jt=class extends Ae{static{o(this,"ZodNever")}_parse(e){let n=this._getOrReturnCtx(e);return _(n,{code:N.invalid_type,expected:O.never,received:n.parsedType}),Z}};Jt.create=t=>new Jt({typeName:ee.ZodNever,...ie(t)});var Ps=class extends Ae{static{o(this,"ZodVoid")}_parse(e){if(this._getType(e)!==O.undefined){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.void,received:r.parsedType}),Z}return We(e.data)}};Ps.create=t=>new Ps({typeName:ee.ZodVoid,...ie(t)});var Dn=class t extends Ae{static{o(this,"ZodArray")}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==O.array)return _(n,{code:N.invalid_type,expected:O.array,received:n.parsedType}),Z;if(s.exactLength!==null){let a=n.data.length>s.exactLength.value,c=n.data.length<s.exactLength.value;(a||c)&&(_(n,{code:a?N.too_big:N.too_small,minimum:c?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(_(n,{code:N.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(_(n,{code:N.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,c)=>s.type._parseAsync(new Ut(n,a,n.path,c)))).then(a=>He.mergeArray(r,a));let i=[...n.data].map((a,c)=>s.type._parseSync(new Ut(n,a,n.path,c)));return He.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:V.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:V.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:V.toString(n)}})}nonempty(e){return this.min(1,e)}};Dn.create=(t,e)=>new Dn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ee.ZodArray,...ie(e)});function Ls(t){if(t instanceof ut){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Ft.create(Ls(r))}return new ut({...t._def,shape:o(()=>e,"shape")})}else return t instanceof Dn?new Dn({...t._def,type:Ls(t.element)}):t instanceof Ft?Ft.create(Ls(t.unwrap())):t instanceof dn?dn.create(Ls(t.unwrap())):t instanceof ln?ln.create(t.items.map(e=>Ls(e))):t}o(Ls,"deepPartialify");var ut=class t extends Ae{static{o(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=le.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==O.object){let d=this._getOrReturnCtx(e);return _(d,{code:N.invalid_type,expected:O.object,received:d.parsedType}),Z}let{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof Jt&&this._def.unknownKeys==="strip"))for(let d in s.data)a.includes(d)||c.push(d);let l=[];for(let d of a){let h=i[d],g=s.data[d];l.push({key:{status:"valid",value:d},value:h._parse(new Ut(s,g,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof Jt){let d=this._def.unknownKeys;if(d==="passthrough")for(let h of c)l.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(d==="strict")c.length>0&&(_(s,{code:N.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let h of c){let g=s.data[h];l.push({key:{status:"valid",value:h},value:d._parse(new Ut(s,g,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let h of l){let g=await h.key,f=await h.value;d.push({key:g,value:f,alwaysSet:h.alwaysSet})}return d}).then(d=>He.mergeObjectSync(r,d)):He.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:o((n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:V.errToObj(e).message??s}:{message:s}},"errorMap")}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:o(()=>({...this._def.shape(),...e}),"shape")})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:o(()=>({...this._def.shape(),...e._def.shape()}),"shape"),typeName:ee.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of le.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:o(()=>n,"shape")})}omit(e){let n={};for(let r of le.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:o(()=>n,"shape")})}deepPartial(){return Ls(this)}partial(e){let n={};for(let r of le.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new t({...this._def,shape:o(()=>n,"shape")})}required(e){let n={};for(let r of le.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Ft;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:o(()=>n,"shape")})}keyof(){return nf(le.objectKeys(this.shape))}};ut.create=(t,e)=>new ut({shape:o(()=>t,"shape"),unknownKeys:"strip",catchall:Jt.create(),typeName:ee.ZodObject,...ie(e)});ut.strictCreate=(t,e)=>new ut({shape:o(()=>t,"shape"),unknownKeys:"strict",catchall:Jt.create(),typeName:ee.ZodObject,...ie(e)});ut.lazycreate=(t,e)=>new ut({shape:t,unknownKeys:"strip",catchall:Jt.create(),typeName:ee.ZodObject,...ie(e)});var Gr=class extends Ae{static{o(this,"ZodUnion")}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(let c of i)if(c.result.status==="valid")return c.result;for(let c of i)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;let a=i.map(c=>new ct(c.ctx.common.issues));return _(n,{code:N.invalid_union,unionErrors:a}),Z}if(o(s,"handleResults"),n.common.async)return Promise.all(r.map(async i=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(s);{let i,a=[];for(let l of r){let d={...n,common:{...n.common,issues:[]},parent:null},h=l._parseSync({data:n.data,path:n.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!i&&(i={result:h,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let c=a.map(l=>new ct(l));return _(n,{code:N.invalid_union,unionErrors:c}),Z}}get options(){return this._def.options}};Gr.create=(t,e)=>new Gr({options:t,typeName:ee.ZodUnion,...ie(e)});var vn=o(t=>t instanceof Yr?vn(t.schema):t instanceof Mt?vn(t.innerType()):t instanceof Vr?[t.value]:t instanceof Hr?t.options:t instanceof Jr?le.objectValues(t.enum):t instanceof qr?vn(t._def.innerType):t instanceof Pr?[void 0]:t instanceof Or?[null]:t instanceof Ft?[void 0,...vn(t.unwrap())]:t instanceof dn?[null,...vn(t.unwrap())]:t instanceof go||t instanceof Wr?vn(t.unwrap()):t instanceof jr?vn(t._def.innerType):[],"getDiscriminator"),sA=class t extends Ae{static{o(this,"ZodDiscriminatedUnion")}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==O.object)return _(n,{code:N.invalid_type,expected:O.object,received:n.parsedType}),Z;let r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(_(n,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let s=new Map;for(let i of n){let a=vn(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of a){if(s.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);s.set(c,i)}}return new t({typeName:ee.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...ie(r)})}};function Vu(t,e){let n=un(t),r=un(e);if(t===e)return{valid:!0,data:t};if(n===O.object&&r===O.object){let s=le.objectKeys(e),i=le.objectKeys(t).filter(c=>s.indexOf(c)!==-1),a={...t,...e};Object.prototype.hasOwnProperty.call(a,"__proto__")&&delete a.__proto__;for(let c of i){if(c==="__proto__")continue;let l=Vu(t[c],e[c]);if(!l.valid)return{valid:!1};a[c]=l.data}return{valid:!0,data:a}}else if(n===O.array&&r===O.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let a=t[i],c=e[i],l=Vu(a,c);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===O.date&&r===O.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}o(Vu,"mergeValues");var $r=class extends Ae{static{o(this,"ZodIntersection")}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=o((i,a)=>{if(nA(i)||nA(a))return Z;let c=Vu(i.value,a.value);return c.valid?((rA(i)||rA(a))&&n.dirty(),{status:n.value,value:c.data}):(_(r,{code:N.invalid_intersection_types}),Z)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,a])=>s(i,a)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};$r.create=(t,e,n)=>new $r({left:t,right:e,typeName:ee.ZodIntersection,...ie(n)});var ln=class t extends Ae{static{o(this,"ZodTuple")}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.array)return _(r,{code:N.invalid_type,expected:O.array,received:r.parsedType}),Z;if(r.data.length<this._def.items.length)return _(r,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Z;!this._def.rest&&r.data.length>this._def.items.length&&(_(r,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((a,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new Ut(r,a,r.path,c)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>He.mergeArray(n,a)):He.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};ln.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ln({items:t,typeName:ee.ZodTuple,rest:null,...ie(e)})};var iA=class t extends Ae{static{o(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.object)return _(r,{code:N.invalid_type,expected:O.object,received:r.parsedType}),Z;let s=[],i=this._def.keyType,a=this._def.valueType;for(let c in r.data)s.push({key:i._parse(new Ut(r,c,r.path,c)),value:a._parse(new Ut(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?He.mergeObjectAsync(n,s):He.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Ae?new t({keyType:e,valueType:n,typeName:ee.ZodRecord,...ie(r)}):new t({keyType:rr.create(),valueType:e,typeName:ee.ZodRecord,...ie(n)})}},Os=class extends Ae{static{o(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.map)return _(r,{code:N.invalid_type,expected:O.map,received:r.parsedType}),Z;let s=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([c,l],d)=>({key:s._parse(new Ut(r,c,r.path,[d,"key"])),value:i._parse(new Ut(r,l,r.path,[d,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of a){let d=await l.key,h=await l.value;if(d.status==="aborted"||h.status==="aborted")return Z;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(d.value,h.value)}return{status:n.value,value:c}})}else{let c=new Map;for(let l of a){let d=l.key,h=l.value;if(d.status==="aborted"||h.status==="aborted")return Z;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(d.value,h.value)}return{status:n.value,value:c}}}};Os.create=(t,e,n)=>new Os({valueType:e,keyType:t,typeName:ee.ZodMap,...ie(n)});var Gs=class t extends Ae{static{o(this,"ZodSet")}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.set)return _(r,{code:N.invalid_type,expected:O.set,received:r.parsedType}),Z;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(_(r,{code:N.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(_(r,{code:N.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let i=this._def.valueType;function a(l){let d=new Set;for(let h of l){if(h.status==="aborted")return Z;h.status==="dirty"&&n.dirty(),d.add(h.value)}return{status:n.value,value:d}}o(a,"finalizeSet");let c=[...r.data.values()].map((l,d)=>i._parse(new Ut(r,l,r.path,d)));return r.common.async?Promise.all(c).then(l=>a(l)):a(c)}min(e,n){return new t({...this._def,minSize:{value:e,message:V.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:V.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Gs.create=(t,e)=>new Gs({valueType:t,minSize:null,maxSize:null,typeName:ee.ZodSet,...ie(e)});var oA=class t extends Ae{static{o(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==O.function)return _(n,{code:N.invalid_type,expected:O.function,received:n.parsedType}),Z;function r(c,l){return ho({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Us(),Sn].filter(d=>!!d),issueData:{code:N.invalid_arguments,argumentsError:l}})}o(r,"makeArgsIssue");function s(c,l){return ho({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Us(),Sn].filter(d=>!!d),issueData:{code:N.invalid_return_type,returnTypeError:l}})}o(s,"makeReturnsIssue");let i={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof ir){let c=this;return We(async function(...l){let d=new ct([]),h=await c._def.args.parseAsync(l,i).catch(m=>{throw d.addIssue(r(l,m)),d}),g=await Reflect.apply(a,this,h);return await c._def.returns._def.type.parseAsync(g,i).catch(m=>{throw d.addIssue(s(g,m)),d})})}else{let c=this;return We(function(...l){let d=c._def.args.safeParse(l,i);if(!d.success)throw new ct([r(l,d.error)]);let h=Reflect.apply(a,this,d.data),g=c._def.returns.safeParse(h,i);if(!g.success)throw new ct([s(h,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ln.create(e).rest(xn.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||ln.create([]).rest(xn.create()),returns:n||xn.create(),typeName:ee.ZodFunction,...ie(r)})}},Yr=class extends Ae{static{o(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Yr.create=(t,e)=>new Yr({getter:t,typeName:ee.ZodLazy,...ie(e)});var Vr=class extends Ae{static{o(this,"ZodLiteral")}_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return _(n,{received:n.data,code:N.invalid_literal,expected:this._def.value}),Z}return{status:"valid",value:e.data}}get value(){return this._def.value}};Vr.create=(t,e)=>new Vr({value:t,typeName:ee.ZodLiteral,...ie(e)});function nf(t,e){return new Hr({values:t,typeName:ee.ZodEnum,...ie(e)})}o(nf,"createZodEnum");var Hr=class t extends Ae{static{o(this,"ZodEnum")}_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return _(n,{expected:le.joinValues(r),received:n.parsedType,code:N.invalid_type}),Z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return _(n,{received:n.data,code:N.invalid_enum_value,options:r}),Z}return We(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Hr.create=nf;var Jr=class extends Ae{static{o(this,"ZodNativeEnum")}_parse(e){let n=le.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==O.string&&r.parsedType!==O.number){let s=le.objectValues(n);return _(r,{expected:le.joinValues(s),received:r.parsedType,code:N.invalid_type}),Z}if(this._cache||(this._cache=new Set(le.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=le.objectValues(n);return _(r,{received:r.data,code:N.invalid_enum_value,options:s}),Z}return We(e.data)}get enum(){return this._def.values}};Jr.create=(t,e)=>new Jr({values:t,typeName:ee.ZodNativeEnum,...ie(e)});var ir=class extends Ae{static{o(this,"ZodPromise")}unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==O.promise&&n.common.async===!1)return _(n,{code:N.invalid_type,expected:O.promise,received:n.parsedType}),Z;let r=n.parsedType===O.promise?n.data:Promise.resolve(n.data);return We(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ir.create=(t,e)=>new ir({type:t,typeName:ee.ZodPromise,...ie(e)});var Mt=class extends Ae{static{o(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ee.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o(a=>{_(r,a),a.fatal?n.abort():n.dirty()},"addIssue"),get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let a=s.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async c=>{if(n.value==="aborted")return Z;let l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?Z:l.status==="dirty"?Fr(l.value):n.value==="dirty"?Fr(l.value):l});{if(n.value==="aborted")return Z;let c=this._def.schema._parseSync({data:a,path:r.path,parent:r});return c.status==="aborted"?Z:c.status==="dirty"?Fr(c.value):n.value==="dirty"?Fr(c.value):c}}if(s.type==="refinement"){let a=o(c=>{let l=s.refinement(c,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c},"executeRefinement");if(r.common.async===!1){let c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Z:(c.status==="dirty"&&n.dirty(),a(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Z:(c.status==="dirty"&&n.dirty(),a(c.value).then(()=>({status:n.value,value:c.value}))))}if(s.type==="transform")if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!nr(a))return Z;let c=s.transform(a.value,i);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>nr(a)?Promise.resolve(s.transform(a.value,i)).then(c=>({status:n.value,value:c})):Z);le.assertNever(s)}};Mt.create=(t,e,n)=>new Mt({schema:t,typeName:ee.ZodEffects,effect:e,...ie(n)});Mt.createWithPreprocess=(t,e,n)=>new Mt({schema:e,effect:{type:"preprocess",transform:t},typeName:ee.ZodEffects,...ie(n)});var Ft=class extends Ae{static{o(this,"ZodOptional")}_parse(e){return this._getType(e)===O.undefined?We(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ft.create=(t,e)=>new Ft({innerType:t,typeName:ee.ZodOptional,...ie(e)});var dn=class extends Ae{static{o(this,"ZodNullable")}_parse(e){return this._getType(e)===O.null?We(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};dn.create=(t,e)=>new dn({innerType:t,typeName:ee.ZodNullable,...ie(e)});var qr=class extends Ae{static{o(this,"ZodDefault")}_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===O.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};qr.create=(t,e)=>new qr({innerType:t,typeName:ee.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var jr=class extends Ae{static{o(this,"ZodCatch")}_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ms(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ct(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ct(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};jr.create=(t,e)=>new jr({innerType:t,typeName:ee.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var $s=class extends Ae{static{o(this,"ZodNaN")}_parse(e){if(this._getType(e)!==O.nan){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.nan,received:r.parsedType}),Z}return{status:"valid",value:e.data}}};$s.create=t=>new $s({typeName:ee.ZodNaN,...ie(t)});var IS=Symbol("zod_brand"),go=class extends Ae{static{o(this,"ZodBranded")}_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},po=class t extends Ae{static{o(this,"ZodPipeline")}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return o(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Z:i.status==="dirty"?(n.dirty(),Fr(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})},"handleAsync")();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Z:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:ee.ZodPipeline})}},Wr=class extends Ae{static{o(this,"ZodReadonly")}_parse(e){let n=this._def.innerType._parse(e),r=o(s=>(nr(s)&&(s.value=Object.freeze(s.value)),s),"freeze");return Ms(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};Wr.create=(t,e)=>new Wr({innerType:t,typeName:ee.ZodReadonly,...ie(e)});function Kp(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}o(Kp,"cleanParams");function rf(t,e={},n){return t?sr.create().superRefine((r,s)=>{let i=t(r);if(i instanceof Promise)return i.then(a=>{if(!a){let c=Kp(e,r),l=c.fatal??n??!0;s.addIssue({code:"custom",...c,fatal:l})}});if(!i){let a=Kp(e,r),c=a.fatal??n??!0;s.addIssue({code:"custom",...a,fatal:c})}}):sr.create()}o(rf,"custom");var yS={object:ut.lazycreate},ee;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ee||(ee={}));var QS=o((t,e={message:`Input not instance of ${t.name}`})=>rf(n=>n instanceof t,e),"instanceOfType"),sf=rr.create,of=Ur.create,BS=$s.create,wS=Mr.create,af=Lr.create,bS=_r.create,RS=_s.create,kS=Pr.create,SS=Or.create,vS=sr.create,xS=xn.create,DS=Jt.create,TS=Ps.create,NS=Dn.create,FS=ut.create,US=ut.strictCreate,MS=Gr.create,LS=sA.create,_S=$r.create,PS=ln.create,OS=iA.create,GS=Os.create,$S=Gs.create,YS=oA.create,VS=Yr.create,HS=Vr.create,JS=Hr.create,qS=Jr.create,jS=ir.create,WS=Mt.create,zS=Ft.create,ZS=dn.create,KS=Mt.createWithPreprocess,XS=po.create,ev=o(()=>sf().optional(),"ostring"),tv=o(()=>of().optional(),"onumber"),nv=o(()=>af().optional(),"oboolean"),rv={string:o((t=>rr.create({...t,coerce:!0})),"string"),number:o((t=>Ur.create({...t,coerce:!0})),"number"),boolean:o((t=>Lr.create({...t,coerce:!0})),"boolean"),bigint:o((t=>Mr.create({...t,coerce:!0})),"bigint"),date:o((t=>_r.create({...t,coerce:!0})),"date")};var sv=Z;var bf=require("node:crypto");var zr=(i=>(i.NotFound="not_found",i.NoAccess="no_access",i.Unavailable="unavailable",i.AccessLost="access_lost",i.CannotOpen="cannot_open",i))(zr||{});var Hu=o(t=>`${t.source}:${t.site??""}:${t.key}`,"requirementItemId");var aA=/^pasted-[0-9a-f]{16}$/,fo=/^file-[0-9a-f]{16}$/,mo=(s=>(s.Pdf="application/pdf",s.Csv="text/csv",s.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",s))(mo||{});var Ju=(r=>(r.New="new",r.Updated="updated",r.Existing="existing",r))(Ju||{}),Zr=(r=>(r.Sufficient="sufficient",r.Insufficient="insufficient",r.NoChange="no_change",r))(Zr||{}),Ys=(R=>(R.RelatedChangeConflict="related_change_conflict",R.ReferenceOutsideTarget="reference_outside_target",R.SourceAccessLost="source_access_lost",R.ConfigurationIncomplete="configuration_incomplete",R.CredentialUnavailable="credential_unavailable",R.WorkflowBindingUnverified="workflow_binding_unverified",R.WorkflowRefUnprotected="workflow_ref_unprotected",R.BedrockWorkflowRequired="bedrock_workflow_required",R.DeploymentReview="deployment_review",R.SutRevisionMismatch="sut_revision_mismatch",R.IsolationUnavailable="isolation_unavailable",R.EvidenceInsufficient="evidence_insufficient",R.ConfigurationUnresolved="configuration_unresolved",R.ModelProviderDenied="model_provider_denied",R.ModelProviderUnavailable="model_provider_unavailable",R.RunnerProviderNotReady="runner_provider_not_ready",R))(Ys||{}),or=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(or||{}),qu=(r=>(r.Application="application",r.Environment="environment",r.TestDefect="test_defect",r))(qu||{}),ju=(c=>(c.AuthToken="auth_token",c.Secret="secret",c.DataConnection="data_connection",c.AppNotStarted="app_not_started",c.Login="login",c.ExternalDependency="external_dependency",c.RecordingReplay="recording_replay",c))(ju||{});var AA=(n=>(n.Probe="probe",n.Agent="agent",n))(AA||{}),cA=(r=>(r.Seed="seed",r.RuntimeMock="runtime_mock",r.EnvOverride="env_override",r))(cA||{}),uA=(r=>(r.TestCode="test_code",r.SkyrampMocker="skyramp_mocker",r.RecipeOverride="recipe_override",r))(uA||{});var Wu=(n=>(n.Ready="ready",n.Blocked="blocked",n))(Wu||{}),Ne=A.string().trim().min(1),iv=A.object({action:A.enum(["start","run","wait"]),text:Ne,source:A.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:Ne.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(t=>t.source==="file"==(t.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),ov=/^[A-Za-z_][A-Za-z0-9_]*$/,Eo=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,Vs=(a=>(a.VersionEndpoint="version_endpoint",a.DeployWorkflow="deploy_workflow",a.KubernetesLabels="kubernetes_labels",a.Command="command",a.Api="api",a.NotTracked="not_tracked",a))(Vs||{}),hn="shared",av=Ne.refine(t=>{try{let e=new URL(t);return["http:","https:"].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}},"an http(s) URL with no login in it"),Hs=A.object({address:av,readyWhen:Ne.nullable(),credentials:A.array(A.string().regex(Eo)).max(50),revisionSources:A.array(A.object({method:A.nativeEnum(Vs),detail:Ne.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:A.array(Ne).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),zu={steps:A.array(iv).max(20).optional().describe("how it starts, in order"),kind:A.enum(["web_app","service","database","external_service"]).optional(),from:A.object({file:Ne,service:Ne.nullable()}).strict().optional(),credentials:A.array(A.string().max(100).regex(ov)).max(50).optional().describe("the Target's credentials this component's recipe uses: a sign-in (a test user, password or token) or an API key, which the workflow supplies from a GitHub Actions secret as the environment variable of the credential's name; give each name exactly as the recipe reads it. Names only, never a value, and not a secret the recipe generates itself")},Av=A.object({name:Ne,repository:Ne.describe("owner/repo of the Target repository the component is built or started from, such as the one whose compose file starts its database"),healthy:A.boolean(),...zu,deployed:Ne.nullable().optional().describe('only with "environment": the revision the component runs, as you read it from its revision source, or null when you could not tell')}),cv=A.object({component:Ne,problem:Ne,evidence:Ne.describe("the exact command and output that shows it"),fix:Ne.describe("what the user must provide, and where")}),uv=A.object({framework:Ne,file:Ne.describe("the test file run, relative to its repository root"),result:A.enum(["pass","fail","error"])}),lv=A.object({input:Ne.describe("the part of the user's SUT input, as given"),reason:Ne}),NV=A.object({schemaVersion:A.literal(1),status:A.nativeEnum(Wu).describe("ready only if every component came up healthy and the recipe is written"),components:A.array(Av),suites:A.array(uv).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:A.array(Ne).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:A.array(A.object({input:Ne.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:Ne.describe("what the recipe did with it")})).optional(),inputsNotUsed:A.array(lv).default([]).describe("the parts it did not use, and why. A part that is wrong goes here, with what was wrong, even when the recipe does something like it instead: one that names a file, command, port, route or setting that does not exist or does not work"),blockers:A.array(cv).describe("required (non-empty) when status is blocked"),environment:Hs.optional().describe("only when the whole SUT is an existing deployment you tested where it runs, building and starting nothing: its address, what says it is ready, the credentials that reach it, and how to read what each component runs. Leave it out when any part was built or started on the runner, or reaching it needed something there (a tunnel, port-forward, proxy or client certificate)")});var Zu=64*1024,Ku=512*1024,Af=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var uf=Ve(require("path"));var Ar=(s=>(s.Clean="clean",s.RecipeDrift="recipe-drift",s.ChangeBrokeBringup="change-broke-bringup",s.BringupFailed="bringup-failed",s))(Ar||{}),ar=A.string().trim().min(1),dv=A.object({url:A.string().optional().describe("the URL probed, if the check is an HTTP request"),command:A.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:A.record(A.string()).optional(),status:A.union([A.number(),A.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:ar.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),Xu=A.array(A.object({component:ar.describe("a shared component listed above"),url:ar.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:ar.describe("what the URL returned, VERBATIM; this gate FETCHES each url")})).describe("only when shared components are listed above: one check per component whose deployed commit you found"),cf=A.object({schemaVersion:A.literal(1),baseUrls:A.record(A.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:dv.optional(),teardown:ar.describe("command that tears the SUT down"),dependencies:A.record(A.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:A.nativeEnum(Ar).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:A.array(A.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:A.object({command:ar,output:ar}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:A.array(A.string()).optional().describe("required for change-broke-bringup: files THIS PR changed that the failure points at, relative to your working directory (a file in another checkout of the run: its absolute path)"),seeded:A.boolean(),startedAt:ar.describe("ISO timestamp"),revisions:Xu.optional(),recipeRecorded:A.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});var ze=A.string().trim().min(1),el=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(el||{}),tl=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],lf=A.object({schemaVersion:A.literal(1),type:A.nativeEnum(el).optional(),status:A.enum(["ready","blocked"]),environment:Hs.optional(),components:A.array(A.object({name:ze,repository:ze.describe(`owner/repo, or "${hn}" for a customer-deployed component no repository builds`),healthy:A.boolean(),url:A.string().min(1).nullable(),...zu,credentials:A.array(A.string().regex(Eo)).max(50).optional(),deployed:ze.nullable().optional().describe("customer_deployed only: the revision the component runs, as setup read it (WF-SETUP-22's Deployed now), or null when it could not tell")}).strict()),suites:A.array(A.object({framework:ze,file:ze,result:A.enum(["pass","fail","error"])}).strict()),inputsUsed:A.array(ze),inputsUsedHow:A.array(A.object({input:ze,how:ze}).strict()).optional(),inputsNotUsed:A.array(A.object({input:ze,reason:ze}).strict()),blockers:A.array(A.object({component:ze,problem:ze,evidence:ze,fix:ze}).strict()),replay:A.object({outcome:ze,durationSeconds:A.number().nonnegative().nullable()}).strict().nullable(),files:A.array(A.object({path:ze,content:A.string()}).strict())}).strict().superRefine((t,e)=>{t.inputsUsedHow?.forEach((s,i)=>{t.inputsUsed.includes(s.input)||e.addIssue({code:A.ZodIssueCode.custom,path:["inputsUsedHow",i,"input"],message:"not one of inputsUsed"})}),t.components.forEach((s,i)=>{s.credentials&&new Set(s.credentials).size!==s.credentials.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"credentials"],message:"names a credential twice"})});let n=t.type==="customer_deployed";n!==(t.environment!==void 0)&&e.addIssue({code:A.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),t.environment&&new Set(t.environment.credentials).size!==t.environment.credentials.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let r=new Set(t.components.map(s=>s.name));if(t.environment?.revisionSources.forEach((s,i)=>{s.components.forEach((a,c)=>{r.has(a)||e.addIssue({code:A.ZodIssueCode.custom,path:["environment","revisionSources",i,"components",c],message:"not one of components"})})}),t.components.forEach((s,i)=>{s.deployed!==void 0!==n&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),s.repository===hn&&!n&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"repository"],message:`only a customer_deployed component is ${hn}`})}),n&&(t.components.forEach((s,i)=>{t.components.findIndex(a=>a.name===s.name)!==i&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"name"],message:"names a component twice"})}),t.replay!==null&&e.addIssue({code:A.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),t.files.forEach((s,i)=>{tl.includes(s.path)&&e.addIssue({code:A.ZodIssueCode.custom,path:["files",i,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&t.status==="ready"){let s=new Set(t.environment?.revisionSources.flatMap(i=>i.components));t.components.forEach((i,a)=>{i.repository!==hn&&!s.has(i.name)&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",a,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var $V=["clean","recipe-drift"];function Co(t){let e=uf.posix.normalize(t);return e===t&&(e===".skyramp/workspace.yml"||e.startsWith(".skyramp/sut/")&&e.length>13)}o(Co,"isRuntimePlanFile");var Kr=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(Kr||{}),il=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(il||{}),ol=(a=>(a.PullRequest="pull_request",a.ReadyForReview="ready_for_review",a.Schedule="schedule",a.Manual="manual",a.SutSetup="sut_setup",a.RevisionRead="revision_read",a))(ol||{}),hv=["sut_setup"],gv=["sut_setup","schedule","revision_read"],pv=["sut_setup"],al=(e=>(e.PullRequest="pull_request",e))(al||{}),Rf=(s=>(s.ModelProvider="model_provider",s.SutAccess="sut_access",s.Skyramp="skyramp",s.Other="other",s))(Rf||{}),gA=(s=>(s.None="none",s.Delivered="delivered",s.Partial="partial",s.Failed="failed",s))(gA||{}),yo=(i=>(i.ReportUploaded="report_uploaded",i.NoReport="no_report",i.Cancelled="cancelled",i.RecipeUploaded="recipe_uploaded",i.RevisionsUploaded="revisions_uploaded",i))(yo||{}),kf=(n=>(n.Running="running",n.Ended="ended",n))(kf||{}),Qo=(h=>(h.TimedOut="timed_out",h.AgentFailed="agent_failed",h.SetupFailed="setup_failed",h.CredentialMissing="credential_missing",h.RunnerLost="runner_lost",h.CheckoutFailed="checkout_failed",h.EnvironmentUnverified="environment_unverified",h.ModelProviderDenied="model_provider_denied",h.ModelProviderUnavailable="model_provider_unavailable",h.RunnerProviderNotReady="runner_provider_not_ready",h))(Qo||{}),Sf=(r=>(r.Onboard="onboard",r.Deploy="deploy",r.Recheck="recheck",r))(Sf||{}),vf=(n=>(n.Started="started",n.Finished="finished",n))(vf||{}),xf=(r=>(r.Passed="passed",r.Failed="failed",r.Skipped="skipped",r))(xf||{});var Df=(r=>(r.ChooseCredential="choose_credential",r.FreeText="free_text",r.ChooseSource="choose_source",r))(Df||{});var Al=(r=>(r.Discover="discover",r.Start="start",r.Check="check",r))(Al||{}),Tf=(s=>(s.ValidationPlan="validation_plan",s.TestEnvironment="test_environment",s.TestConditions="test_conditions",s.Tests="tests",s))(Tf||{}),cl=(s=>(s.Found="found",s.Starting="starting",s.Up="up",s.OutOfScope="out_of_scope",s))(cl||{}),qt=A.string().regex(/^[1-9][0-9]{0,18}$/),gn=A.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),qs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,tt=A.string().regex(qs),nt=A.string().regex(/^[0-9a-f]{64}$/),lA=A.object({id:tt,revision:qt}).strict(),pA={provider:A.literal("github"),providerAccountId:qt,providerRepositoryId:qt},fA={provider:A.literal("azure-devops"),providerAccountId:tt,providerRepositoryId:tt},Nn=A.discriminatedUnion("provider",[A.object(pA).strict(),A.object(fA).strict()]),ul=A.discriminatedUnion("provider",[A.object(pA).passthrough(),A.object(fA).passthrough()]),Fn=o(t=>`${t.provider}:${t.providerRepositoryId}`,"sourceKey"),df={namespace:A.string().min(1),name:A.string().min(1)},Nf=A.discriminatedUnion("provider",[A.object({...pA,...df}).strict(),A.object({...fA,...df}).strict()]),hf=A.object({ref:A.string().min(1),revision:gn}).strict(),fv=A.object({repository:Nf,revision:gn,ref:A.string().nullable(),reason:A.nativeEnum(il),change:A.object({kind:A.nativeEnum(al),number:qt,base:hf.optional()}).strict().nullable(),compareWith:hf.optional()}).strict();function mv(t){if(t.trigger.kind==="revision_read"!=!t.baseline)return t.baseline?"a revision_read run names no baseline":"names its baseline";if(!t.baseline)return null;let{confirmedRunId:e,initialBaselineId:n,sources:r}=t.baseline;if(e!==null&&n!==void 0)return"a run compares with one baseline";let s=t.trigger.kind==="schedule"&&e!==null||n!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(e===null&&n===void 0)return"a run with no Confirmed Baseline names no baseline sources";let i=new Set(t.sources.map(l=>Fn(l.repository))),a=new Set(r.map(l=>Fn(l.repository)));return a.size===r.length&&a.size===i.size&&[...a].every(l=>i.has(l))?null:"names every source of the snapshot, once"}o(mv,"baselineSourcesIssue");var Ff=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,Uf=/^[1-9][0-9]{0,18}$/,gf=new RegExp(`${Ff.source}|${Uf.source}`),pf=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,Ev=A.union([A.object({source:A.literal("jira"),site:A.string().regex(pf),key:A.string().regex(Ff),updated:A.string().datetime(),contentHash:nt}).strict(),A.object({source:A.literal("confluence"),site:A.string().regex(pf),key:A.string().regex(Uf),version:A.number().int().positive(),contentHash:nt}).strict(),A.object({source:A.literal("other"),key:A.string().regex(aA),contentHash:nt}).strict(),A.object({source:A.literal("other"),key:A.string().regex(fo),contentHash:nt,fileName:A.string().min(1).max(255),mediaType:A.nativeEnum(mo)}).strict()]),ff=A.union([A.literal("jira"),A.literal("confluence")]),Cv=A.object({schemaVersion:A.literal(1),items:A.array(A.union([A.object({source:ff,site:A.string(),key:A.string().regex(gf),state:A.literal("read"),text:A.string(),version:A.string().min(1),contentMatches:A.boolean()}).strict(),A.object({source:ff,site:A.string(),key:A.string().regex(gf),state:A.literal("not_read"),reason:A.nativeEnum(zr)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(aA),state:A.literal("read"),text:A.string(),version:A.string().min(1),contentMatches:A.boolean()}).strict(),A.object({source:A.literal("other"),key:A.string().regex(aA),state:A.literal("not_read"),reason:A.nativeEnum(zr)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(fo),state:A.literal("read"),version:nt,fileName:A.string().min(1).max(255),mediaType:A.nativeEnum(mo)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(fo),state:A.literal("not_read"),reason:A.nativeEnum(zr)}).strict()])),instructions:A.array(A.string()).optional()}).strict(),Iv=A.object({schemaVersion:A.literal(1),runId:tt,skyrampOrgId:tt,target:lA,policy:lA.nullable(),trigger:A.object({kind:A.nativeEnum(ol),requestedAt:A.string().datetime()}).strict(),configuration:A.object({captureId:tt,revision:qt.nullable(),hash:nt}).strict(),baseline:A.object({confirmedRunId:tt.nullable(),initialBaselineId:tt.optional(),sources:A.array(A.object({repository:Nn,revision:gn}).strict()).optional()}).strict().optional(),sources:A.array(fv).min(1),execution:A.object({provider:A.nativeEnum(Kr),repository:Nf,workflowPath:A.string(),ref:A.string()}).strict(),credentials:A.array(A.object({name:A.string(),purpose:A.nativeEnum(Rf),required:A.boolean()}).strict()),requirements:A.array(Ev).min(1).optional(),instructions:A.object({contentHash:nt}).strict().optional(),deployedRevisions:A.array(A.object({repository:Nn,revision:gn}).strict()).min(1).optional()}).strict().superRefine((t,e)=>{let n=new Set;(t.requirements??[]).forEach((l,d)=>{let h="fileName"in l?"file":"pasted";l.source==="other"&&l.key!==`${h}-${l.contentHash.slice(0,16)}`&&e.addIssue({code:A.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",d,"key"]});let g=Hu({source:l.source,key:l.key});n.has(g)&&e.addIssue({code:A.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",d,"key"]}),n.add(g)});let r=t.trigger.kind,s=hv.includes(r);s!==(t.policy===null)&&e.addIssue({code:A.ZodIssueCode.custom,path:["policy"],message:s?`a ${r} run has no policy`:"names the policy revision"});let i=mv(t);i&&e.addIssue({code:A.ZodIssueCode.custom,path:t.baseline?["baseline","sources"]:["baseline"],message:i}),gv.includes(r)&&t.sources.forEach((l,d)=>{l.reason!=="BASELINE"&&e.addIssue({code:A.ZodIssueCode.custom,path:["sources",d,"reason"],message:`a ${r} run selects only BASELINE sources`})}),t.deployedRevisions&&r!=="manual"&&e.addIssue({code:A.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let a=new Set(t.sources.map(l=>Fn(l.repository))),c=new Set;(t.deployedRevisions??[]).forEach((l,d)=>{let h=Fn(l.repository);a.has(h)?c.has(h)&&e.addIssue({code:A.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"repository appears twice"}):e.addIssue({code:A.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"names a repository outside the snapshot"}),c.add(h)}),t.sources.forEach((l,d)=>{l.compareWith&&(l.reason!=="MANUAL_OVERRIDE"||l.change)&&e.addIssue({code:A.ZodIssueCode.custom,path:["sources",d,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"})})});var Mf=(n=>(n.Person="person",n.Policy="policy",n))(Mf||{}),yv=A.object({kind:A.nativeEnum(Mf),name:A.string().min(1).max(256)}).strict(),Qv=A.object({mcp:A.discriminatedUnion("source",[A.object({source:A.literal("npm"),version:A.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),A.object({source:A.literal("github"),ref:A.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:A.object({region:A.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:A.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),Bv=A.object({schemaVersion:A.literal(1),attempt:A.object({id:tt,number:A.number().int().positive(),deadlineAt:A.string().datetime()}).strict(),manifest:Iv,manifestHash:nt,entitlements:A.array(A.string()).optional(),runToken:A.string().min(1).optional(),requestedBy:yv.nullable().optional(),writeAllowed:A.boolean().optional(),claudeCodeVersion:A.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:A.array(A.object({repository:Nn,revision:gn}).strict()).optional(),statedRevisions:A.array(A.object({repository:Nn,revision:gn}).strict()).optional(),runSettings:Qv.optional()}).strict(),mf={providerRunAttempt:A.number().int().positive(),workflowRef:A.string().min(1)},wv=A.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),bv=A.object({schemaVersion:A.literal(1),runId:tt,execution:A.discriminatedUnion("provider",[A.object({...mf,provider:A.literal("github"),repository:A.object(pA).strict(),providerRunId:qt}).strict(),A.object({...mf,provider:A.literal("azure-devops"),repository:A.object(fA).strict(),providerRunId:wv}).strict()]),requester:A.literal(!0).optional(),writeCheck:A.literal(!0).optional(),claudeCodePin:A.literal(!0).optional(),deployedPins:A.literal(!0).optional(),statedPins:A.literal(!0).optional(),runSettings:A.literal(!0).optional()}).strict(),Ef=A.object({repository:Nn,number:qt,commitSha:gn.optional()}).strict(),Rv=A.discriminatedUnion("status",[A.object({status:A.literal("none")}).strict(),A.object({status:A.literal("delivered"),pullRequests:A.array(Ef).min(1)}).strict(),A.object({status:A.literal("partial"),pullRequests:A.array(Ef).min(1),failures:A.array(A.object({repository:Nn,message:A.string()}).strict()).min(1)}).strict(),A.object({status:A.literal("failed"),message:A.string()}).strict()]),kv=A.object({blockedPreflight:A.object({file:A.string().min(1),repository:A.string().min(1).optional(),reason:A.string().min(1).max(300),evidence:A.string().min(1).max(400)}).strict().optional(),sufficiency:A.nativeEnum(Zr),rationale:A.string().min(1),gaps:A.array(A.string().min(1)),acceptedEvidence:A.array(A.object({kind:A.nativeEnum(or),repository:A.string().min(1),revision:gn,reference:A.string().min(1),summary:A.string().min(1)}).strict()),actionRequired:A.array(A.nativeEnum(Ys))}).strict().superRefine((t,e)=>{t.sufficiency==="insufficient"!=t.gaps.length>0&&e.addIssue({code:A.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(t.actionRequired).size!==t.actionRequired.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),nl=500,Sv=2048,vv=1e3,xv=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,Cf=o(t=>t.length>0&&t.length<=64&&t===t.trim()&&!xv.test(t)&&!/[^\S ]/u.test(t)&&!/^[._]/.test(t)&&!t.endsWith("."),"isAzureName"),Dv=o(t=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(t))return!0;let[e,n,r,...s]=t.split("/");return t.length<=201&&s.length===0&&r!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(e)&&Cf(n)&&Cf(r)},"isResultRepository"),Tv=A.object({testResults:A.array(A.object({resultId:A.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:A.string().refine(Dv,"Invalid"),testType:A.string(),endpoint:A.string(),status:A.enum(["Pass","Fail","Skipped"]),details:A.string(),fileName:A.string().optional(),testId:A.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:A.object({kind:A.nativeEnum(qu),family:A.nativeEnum(ju).optional()}).strict().optional(),origin:A.nativeEnum(Ju).optional()}).strict()),validation:kv,changes:A.array(A.object({id:A.string().min(1).max(512),text:A.string().max(16384),source:A.string().max(Sv),testedBy:A.array(A.string().min(1).max(1024)).max(nl),writtenBy:A.array(A.string().min(1).max(1024)).max(nl),maintainedBy:A.array(A.string().min(1).max(1024)).max(nl)}).strict()).max(vv).optional(),traceVersion:A.literal(1)}).passthrough().superRefine((t,e)=>{let n=new Set;t.testResults.forEach((r,s)=>{let i=r.failureCause;i&&r.status==="Pass"&&e.addIssue({code:A.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"a passing result has no failure cause"}),i&&i.kind==="environment"!=(i.family!==void 0)&&e.addIssue({code:A.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"an environment cause names its family, and no other cause does"});let a=["testResults",s,"resultId"],c=r.resultId.slice(`${r.repository}:${r.testType}:`.length);(!r.resultId.startsWith(`${r.repository}:${r.testType}:`)||c===""||c.startsWith("/")||c.startsWith("#"))&&e.addIssue({code:A.ZodIssueCode.custom,path:a,message:"is not repository:testType:path for this result"}),n.has(r.resultId)&&e.addIssue({code:A.ZodIssueCode.custom,path:a,message:"stable identity repeated"}),n.add(r.resultId)})}),If=o(t=>t.replace(/[%:#]/g,e=>encodeURIComponent(e)),"encodeIdPart");function Lf(t,e,n,r){let s=n.replace(/\\/g,"/"),i=s.split("/").filter(l=>l!==""&&l!==".");if(s.startsWith("/")||/^[A-Za-z]:/.test(s)||i.length===0||i.includes(".."))throw new Error(`testResultId needs a path relative to the repository root, got "${n}"`);let a=i.join("/"),c=`${t}:${e}:${If(a)}`;return r?`${c}#${If(r)}`:c}o(Lf,"testResultId");var mA=(r=>(r.BranchPushed="branch_pushed",r.PullRequestOpened="pull_request_opened",r.PullRequestEdited="pull_request_edited",r))(mA||{}),_f=50,yf=A.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),Pf=A.discriminatedUnion("kind",[A.object({kind:A.literal("branch_pushed"),repository:Nn,branch:yf,commit:gn}).strict(),A.object({kind:A.enum(["pull_request_opened","pull_request_edited"]),repository:Nn,number:qt,branch:yf}).strict()]),Of=A.object({schemaVersion:A.literal(1),run:A.object({runId:tt,attemptNumber:A.number().int().positive(),manifestHash:nt}).strict(),target:lA,policy:lA,provenance:A.object({sources:A.array(A.object({repository:Nn,revision:gn}).strict()),firstQualification:A.literal(!0).optional()}).strict(),delivery:A.object({generatedTests:Rv}).strict(),producer:A.object({testbot:A.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:A.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:Tv,githubWrites:A.array(Pf).max(_f).optional()}).strict(),zV=Of.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:lf}).strict().superRefine(({recipe:t},e)=>{let n=o((i,a)=>e.addIssue({code:A.ZodIssueCode.custom,path:["recipe",...i],message:a}),"issue");t.status==="blocked"&&t.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let r=new Set,s=0;t.files.forEach((i,a)=>{Co(i.path)||n(["files",a,"path"],"is not .skyramp/workspace.yml or a file under .skyramp/sut/"),r.has(i.path)&&n(["files",a,"path"],"file repeated"),r.add(i.path),Af.test(i.content)&&n(["files",a,"content"],"is not text");let c=Buffer.byteLength(i.content,"utf8");s+=c,c>Zu&&n(["files",a,"content"],`larger than ${Zu} bytes`)}),s>Ku&&n(["files"],`recipe text over ${Ku} bytes in total`)}),ZV=A.object({components:A.array(A.object({name:A.string().min(1),repository:A.string().regex(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/),observedRevision:A.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:A.nativeEnum(AA),evidence:A.string()}).strict().refine(t=>t.source!=="agent"||t.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var Nv=A.object({schemaVersion:A.literal(1),stage:A.nativeEnum(Sf),event:A.nativeEnum(vf),status:A.nativeEnum(xf).optional()}).strict().refine(t=>t.status===void 0||t.event==="finished",{path:["status"],message:"only a finished stage has a status"}),EA=100,Fv=5e3,Io=2e3,Qf=100,Gf=/^[A-Za-z0-9_-]{1,64}$/,Uv=20,Mv=200,Lv=100,_v=100,Pv=200,Bf="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",Ov=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${Bf}/${Bf})$`),Gv=500,$v=50,Yv=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,Lt=o(t=>A.string().max(t).refine(e=>e.trim().length>0&&!Yv.test(e),"blank, or not text"),"setupText"),Tn={sequence:A.number().int().min(1).max(Fv),at:A.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},Vv=A.discriminatedUnion("kind",[A.object({...Tn,kind:A.literal("log"),phase:A.nativeEnum(Al),text:Lt(Io)}).strict(),A.object({...Tn,kind:A.literal("component"),name:Lt(Qf),repository:Lt(Pv).refine(t=>Ov.test(t)||t===hn,"not owner/name"),file:Lt(Gv).nullable(),status:A.nativeEnum(cl),version:Lt(_v).optional()}).strict(),A.object({...Tn,kind:A.literal("reply"),to:A.string().uuid(),accepted:A.boolean(),text:Lt(Io)}).strict(),A.object({...Tn,kind:A.literal("question"),id:A.string().regex(Gf),type:A.nativeEnum(Df),text:Lt(Io),component:Lt(Qf).nullable(),choices:A.array(Lt(Mv)).max(Uv),placeholder:Lt(Lv).optional()}).strict(),A.object({...Tn,kind:A.literal("delivered"),ids:A.array(A.string().uuid()).max(EA)}).strict(),A.object({...Tn,kind:A.literal("credentials"),names:A.array(A.string().regex(Eo)).min(1).max($v)}).strict()]).superRefine((t,e)=>{t.kind==="credentials"&&new Set(t.names).size!==t.names.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["names"],message:"a name twice"}),t.kind==="question"&&(t.type==="free_text"!=(t.choices.length===0)&&e.addIssue({code:A.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(t.choices).size!==t.choices.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),Hv=A.object({schemaVersion:A.literal(1),events:A.array(Vv).max(EA)}).strict(),Jv=A.discriminatedUnion("kind",[A.object({...Tn,kind:A.literal("log"),stage:A.nativeEnum(Tf),text:Lt(Io)}).strict(),A.object({...Tn,kind:A.literal("reply"),to:A.string().uuid(),accepted:A.boolean(),text:Lt(Io)}).strict(),A.object({...Tn,kind:A.literal("delivered"),ids:A.array(A.string().uuid()).max(EA)}).strict()]),qv=A.object({schemaVersion:A.literal(1),events:A.array(Jv).max(EA)}).strict(),wf={id:A.string().uuid(),text:A.string(),by:A.string().nullable(),at:A.string(),replied:A.literal(!0).optional()},$f=A.discriminatedUnion("kind",[A.object({...wf,kind:A.literal("instruction"),question:A.null()}),A.object({...wf,kind:A.literal("answer"),question:A.string().regex(Gf)})]),Yf=A.string().regex(/^[A-Za-z0-9+/]{43}=$/),jv=A.object({id:A.string().uuid(),revision:A.string(),by:A.string().nullable(),at:A.string(),target:A.string(),own:A.object({source:A.enum(["policy","test_environment"]),text:A.string()}).nullable()}),Wv=A.object({schemaVersion:A.literal(1),leftOut:A.array(A.string()),messages:A.array($f).optional(),stop:A.object({key:Yf}).optional(),notes:jv.optional()}),zv=A.object({schemaVersion:A.literal(1),messages:A.array($f).optional()});var Zv=500*1024*1024,Vf=A.object({id:qt,name:A.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:qt,expiresAt:A.string().datetime()}).strict(),Kv=A.object({schemaVersion:A.literal(1),artifact:Vf,sessionId:tt,contentHash:nt,bytes:A.number().int().min(1).max(Zv)}).strict(),Xv=A.object({schemaVersion:A.literal(1),checkpoint:A.object({artifact:Vf,repository:A.object({namespace:A.string().min(1),name:A.string().min(1)}).strict(),sessionId:tt,contentHash:nt,key:Yf}).strict().nullable()}).strict(),e0=200,Js=100,Hf=(r=>(r.Resume="resume",r.Retry="retry",r.Update="update",r))(Hf||{}),t0=A.object({kind:A.nativeEnum(Hf),setup:A.object({runId:tt,endedAt:A.string().nullable(),outcome:A.string().nullable()}).strict(),components:A.array(A.object({name:A.string().min(1),repository:A.string().min(1),status:A.nativeEnum(cl)}).strict()).max(Js),credentials:A.array(A.string().min(1)).max(Js),answers:A.array(A.object({question:A.string(),answer:A.string().nullable()}).strict()).max(Js),instructions:A.array(A.object({text:A.string(),reply:A.string().nullable()}).strict()).max(Js),log:A.array(A.object({phase:A.nativeEnum(Al),text:A.string()}).strict()).max(e0),recipe:A.object({files:A.array(A.object({path:A.string().min(1),content:A.string()}).strict()).max(Js),blockers:A.array(A.object({component:A.string(),problem:A.string(),evidence:A.string(),fix:A.string()}).strict()).max(Js)}).strict().optional()}).strict(),n0=A.object({schemaVersion:A.literal(1),context:t0.nullable()}).strict(),r0=A.object({schemaVersion:A.literal(1),configuration:A.object({captureId:tt,revision:qt.nullable(),hash:nt}).strict(),capture:A.object({schemaVersion:A.literal(1),settings:A.object({target:A.object({environment:A.unknown()}).passthrough(),timeoutMinutes:A.number().int().positive(),answerWaitMinutes:A.number().int().positive().optional(),testEnvironment:A.object({name:A.string().min(1),address:A.string().min(1).optional(),readyWhen:A.string().min(1).optional()}).passthrough().optional()}).passthrough(),provenance:A.object({}).passthrough(),hash:nt}).strict()}).strict(),s0=Hs.extend({version:A.number().int().positive(),components:A.array(A.object({name:A.string().min(1),repository:A.string().min(1)}).strict()),contentHash:nt.optional(),files:A.array(A.object({path:A.string().refine(t=>Co(t)&&!tl.includes(t),"not a file of a customer_deployed plan"),content:A.string()}).strict()).optional()}).strict(),i0=A.object({schemaVersion:A.literal(1),testEnvironment:s0.nullable().optional(),runtimePlan:A.object({version:A.number().int().positive(),contentHash:nt,files:A.array(A.object({path:A.string().refine(Co,"not a recipe file path"),content:A.string()}).strict()).min(1),recipe:A.record(A.unknown()).optional()}).strict().nullable()}).strict().refine(t=>!(t.runtimePlan&&t.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),Jf=A.object({schemaVersion:A.literal(1),state:A.nativeEnum(kf),ending:A.nativeEnum(yo).nullable(),cause:A.nativeEnum(Qo).nullable(),deadlineAt:A.string().datetime()}).strict();function qf(t,e){return t.state==="ended"?t.ending==="cancelled"?"cancelled":t.cause==="runner_lost"?"expired":"ended":e.getTime()>=Date.parse(t.deadlineAt)?"expired":null}o(qf,"attemptClosure");function rl(t){if(typeof t=="number"&&!Number.isFinite(t))throw new TypeError("Canonical JSON requires JSON values");if(Array.isArray(t))return`[${t.map(rl).join(",")}]`;if(t!==null&&typeof t=="object"){let n=t;return`{${Object.keys(n).sort().map(r=>`${JSON.stringify(r)}:${rl(n[r])}`).join(",")}}`}let e=JSON.stringify(t);if(e===void 0)throw new TypeError("Canonical JSON requires JSON values");return e}o(rl,"canonicalJson");function jf(t){return(0,bf.createHash)("sha256").update(rl(t),"utf8").digest("hex")}o(jf,"manifestHash");var dA=o(t=>({provider:t.provider,providerAccountId:t.providerAccountId,providerRepositoryId:t.providerRepositoryId}),"toSourceRef");function ll(t,e,{statedPins:n=!0}={}){return bv.parse({schemaVersion:1,runId:t,execution:e.execution(),requester:!0,writeCheck:!0,claudeCodePin:!0,deployedPins:!0,...n?{statedPins:!0}:{},...e.runSettingsFromApp?{runSettings:!0}:{}})}o(ll,"handshakeRequest");function Wf(t){let e=Bv.parse(t);if(jf(e.manifest)!==e.manifestHash)throw new Error("The handshake manifest hash does not match its manifest");return e}o(Wf,"parseHandshakeResponse");function o0(t){let e=o(n=>n.map(r=>({repository:dA(r.repository),number:r.number,...r.commitSha===void 0?{}:{commitSha:r.commitSha}})),"pullRequests");return t.status==="delivered"?{status:t.status,pullRequests:e(t.pullRequests)}:t.status==="partial"?{status:t.status,pullRequests:e(t.pullRequests),failures:t.failures.map(n=>({repository:dA(n.repository),message:n.message}))}:t}o(o0,"toDelivery");function a0(t){return t.issues.map(e=>`${e.path.map((r,s)=>typeof r=="number"?`[${r}]`:s===0?r:`.${r}`).join("")}: ${e.message}`).join("; ")}o(a0,"describeIssues");function zf(t){let{manifest:e}=t;if(pv.includes(e.trigger.kind))throw new Error(`The report upload is invalid: a ${e.trigger.kind} run uploads its SUT recipe, never a report`);if(e.trigger.kind==="revision_read")throw new Error("The report upload is invalid: a revision_read run uploads what each component runs, never a report");if(t.firstQualification&&!e.baseline?.sources)throw new Error("The report upload is invalid: only a run whose manifest names baseline sources can be a first qualification");let n=Of.safeParse({schemaVersion:1,run:{runId:e.runId,attemptNumber:t.attemptNumber,manifestHash:jf(e)},target:{id:e.target.id,revision:e.target.revision},policy:e.policy&&{id:e.policy.id,revision:e.policy.revision},provenance:{sources:t.checkedOut.map(r=>({repository:dA(r.repository),revision:r.revision})),...t.firstQualification?{firstQualification:!0}:{}},delivery:{generatedTests:o0(t.generatedTests)},producer:t.producer,report:t.report,...t.githubWrites?.length?{githubWrites:t.githubWrites.map(r=>({...r,repository:dA(r.repository)}))}:{}});if(!n.success)throw new Error(`The report upload is invalid: ${a0(n.error)}`);return A0(n.data,e,t.checkedOut),n.data}o(zf,"buildReportUpload");function A0(t,e,n){let r=o(i=>n.find(a=>Fn(a.repository)===Fn(i.repository))?.revision??i.revision,"revisionOf"),s=new Map(e.sources.map(i=>[`${i.repository.namespace}/${i.repository.name}`.toLowerCase(),r(i)]));t.report.validation.acceptedEvidence.forEach((i,a)=>{let c=`report.validation.acceptedEvidence[${a}]`,l=s.get(i.repository.toLowerCase());if(!l)throw new Error(`${c}.repository: ${i.repository} is outside the run's snapshot`);if(i.revision!==l)throw new Error(`${c}.revision: evidence is not from the checked-out revision ${l}`)})}o(A0,"assertEvidenceFromSnapshot");function Zf(t){return t.reportUploaded?{schemaVersion:1,reason:"report_uploaded",cause:null}:t.recipeUploaded?{schemaVersion:1,reason:"recipe_uploaded",cause:null}:t.revisionsUploaded?{schemaVersion:1,reason:"revisions_uploaded",cause:null}:t.cancelled?{schemaVersion:1,reason:"cancelled",cause:null}:{schemaVersion:1,reason:"no_report",cause:c0(t)}}o(Zf,"attemptEndFor");function c0(t){return t.runnerProviderNotReady?"runner_provider_not_ready":t.credentialMissing?"credential_missing":t.checkoutFailed?"checkout_failed":t.environmentUnverified?"environment_unverified":t.setupFailed?"setup_failed":t.timedOut?"timed_out":t.modelProviderDenied?"model_provider_denied":t.modelProviderUnavailable?"model_provider_unavailable":"agent_failed"}o(c0,"noReportCause");var tH={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var l0=10*1024*1024;var d0=["generate-unit","native-run"],aH=["preflight","plan","write",...d0,"report","deliver"];var CA=(r=>(r.Unit="unit",r.Integration="integration",r.E2e="e2e",r))(CA||{});var Bo=Ve(require("fs")),wo=Ve(require("path"));var h0=8;function lt(t,e,n={}){let r=e.slice(0,h0),s=e.length-r.length;return{name:t,passed:!1,details:r.join("; ")+(s>0?`; \u2026and ${s} more`:""),...n.fatal?{fatal:!0}:{}}}o(lt,"fail");function js(t){if(Bo.existsSync(t))try{return JSON.parse(Bo.readFileSync(t,"utf-8"))}catch{return}}o(js,"readJsonFile");function jt(t,e){return js(wo.join(t.outputsDir,e))}o(jt,"readArtifact");function cr(t,e){return{name:t,verify(n,r){let{errors:s}=e(n,r);return s.length===0?{name:this.name,passed:!0}:lt(this.name,s,{fatal:!0})}}}o(cr,"schemaGate");function bo(t){return t.replace(/\s+/g," ").trim()}o(bo,"normalizeCode");var IA=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var g0=4,Xf="\xABredacted\xBB";function em(t){let e=new Set;for(let n of t){let r=(n??"").trim();r.length>=g0&&e.add(r)}return[...e].sort((n,r)=>r.length-n.length)}o(em,"redactionsFrom");function Ws(t,e){if(!t||e.length===0)return t;let n=t;for(let r of e)!r||!n.includes(r)||(n=n.split(r).join(Xf));return n}o(Ws,"redactSecrets");function p0(t,e){let n=o(r=>typeof r=="string"?e(r):Array.isArray(r)?r.map(n):r&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([s,i])=>[s,n(i)])):r,"walk");return n(t)}o(p0,"mapStrings");function zs(t,e){return e.length===0?t:p0(t,n=>Ws(n,e))}o(zs,"redactDeep");var EH=new TextDecoder("utf-8",{fatal:!0});var kH=new Set(Object.values(or));var SH=A.object({checks:A.array(A.object({repository:A.string().optional(),name:A.string().min(1),headSha:A.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:A.string().default("completed"),conclusion:A.string().nullable().optional(),url:A.string().optional(),summary:A.string().optional()}))});var Ro=(n=>(n.Full="full",n.Static="static",n))(Ro||{}),ur=(r=>(r.Contract="contract",r.Integration="integration",r.Ui="ui",r))(ur||{}),ko=(i=>(i.OwnSurface="own_surface",i.StateReadBack="state_read_back",i.Referential="referential",i.Lifecycle="lifecycle",i.Boundaries="boundaries",i))(ko||{}),Xr=(s=>(s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s))(Xr||{}),yA=(d=>(d.Equals="equals",d.NotEquals="not_equals",d.GreaterThan="greater_than",d.LessThan="less_than",d.Contains="contains",d.NotContains="not_contains",d.Matches="matches",d.Absent="absent",d.Present="present",d))(yA||{});var It=A.string().trim().min(1),m0=A.object({subject:It.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:A.nativeEnum(yA),value:A.union([A.string(),A.number(),A.boolean(),A.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),E0=A.object({test:It.describe("existing test path, relative to its repository"),repository:It.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:A.nativeEnum(Xr),evidence:It.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:A.array(A.string()).optional().describe("analyze behavior ids this maintenance covers")});var C0=A.object({surface:It.describe("a surface from the list, copied verbatim"),axis:A.nativeEnum(ko)}),I0=A.object({id:It.describe("short-slug, unique across generate[]"),type:A.nativeEnum(ur),target:It.describe('"METHOD /path", or a business-flow name'),from_finding:A.string().optional().describe("analyze finding id this case catches"),from_behavior:A.string().optional().describe("analyze behavior id this case pins"),derived_from:C0.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:It.describe("why this test matters"),expected_observable:It.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:m0.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:It.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:A.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),y0=A.object({covered:A.array(A.string()).optional(),abstain:A.string().optional()}).superRefine((t,e)=>{let n=Array.isArray(t.covered),r=typeof t.abstain=="string";if(n===r)return void e.addIssue({code:A.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&t.covered.length===0&&e.addIssue({code:A.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),r&&!t.abstain.trim()&&e.addIssue({code:A.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),Q0=A.object({surface:It.describe("a surface from the list, copied verbatim"),axes:A.object(Object.fromEntries(Object.values(ko).map(t=>[t,y0])))}),tm=A.object({schemaVersion:A.literal(1),mode:A.nativeEnum(Ro),maintenance:A.array(E0),generate:A.array(I0),surfaces:A.array(Q0).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:A.object({total:A.number().describe("case count"),rationale:It}),summary:It.describe("one paragraph")});var QA=["-c","core.fsmonitor=false"],B0=new Set(["GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","ACTIONS_RUNTIME_TOKEN","ACTIONS_ID_TOKEN_REQUEST_TOKEN","ACTIONS_ID_TOKEN_REQUEST_URL","SYSTEM_ACCESSTOKEN","SYSTEM_OIDCREQUESTURI","SKYRAMP_MCP_GITHUB_TOKEN","SSH_AUTH_SOCK","GIT_SSH","GIT_SSH_COMMAND","GITHUB_STEP_SUMMARY"]),w0=new Set(["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_PROFILE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN","AWS_ROLE_SESSION_NAME","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"]);function Un(t=process.env,e,n="repo-command"){let r={};for(let[s,i]of Object.entries(t))n==="repo-command"&&w0.has(s)||(r[s]=i);Object.assign(r,e??{});for(let s of Object.keys(r))(B0.has(s)||s.startsWith("INPUT_"))&&delete r[s];return r}o(Un,"untrustedChildEnv");var b0=".skyramp/sut/deployed-revisions.sh",dl=(n=>(n.Running="running",n.Requested="requested",n))(dl||{});var JH=new Set(Object.values(dl));var qH=`Fix ${b0} so it prints the full commit each component runs, then set it up again.`;var hl="shared-environment";var AJ=64*1024;var cJ=new Set(["version_endpoint","api"]);function gl(t){return(t?.components??[]).filter(e=>!!e.repository&&!!e.expectedRevision)}o(gl,"verifiableComponents");function nm(t){return gl(t).length>0||(t?.dependencies.length??0)>0}o(nm,"hasSharedSystem");function k0(t){let e=t.inputs?.sharedEnvironment;if(!nm(e))return;let n=jt(t,`${hl}.json`);if(n)return{components:S0(e,n.components),dependencies:n.dependencies};let r="Not checked: the run ended before it checked the shared environment.";return{components:gl(e).map(s=>rm(s,r)),dependencies:e.dependencies.map(s=>({name:s.name,url:s.url,version:null,evidence:r}))}}o(k0,"sharedSystem");var rm=o((t,e)=>({name:t.name,repository:t.repository,url:t.url,expectedRevision:t.expectedRevision,observedRevision:null,status:"unverifiable",source:t.revisionUrl||t.revisionScript?"probe":"agent",evidence:e}),"unrecordedRow");function S0(t,e){let n=new Set(e.map(s=>s.name.toLowerCase())),r=gl(t).filter(s=>s.touched&&!n.has(s.name.toLowerCase()));return[...e,...r.map(s=>rm(s,"Not checked: the run recorded no read of it."))]}o(S0,"withUnrecordedTouched");function pl(t){return(k0(t)?.components??[]).filter(e=>e.status!=="verified")}o(pl,"unverifiedComponents");function fl(t){return(t?.components??[]).filter(e=>!!e.repository&&!e.expectedRevision)}o(fl,"unfrozenComponents");function _t(t,e=[]){let n=t.trim();if(!n)return{error:"session produced no output"};let r=o(l=>{try{let d=JSON.parse(l);return typeof d=="object"&&d!==null&&!Array.isArray(d)?d:void 0}catch{return}},"tryParse"),s=r(n);if(s!==void 0)return{value:s};let i;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(l){i=l instanceof Error?l.message:String(l)}let a=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let l=a.length-1;l>=0;l--){let d=r(a[l][1].trim());if(d!==void 0)return{value:d}}let c;for(let l=n.indexOf("{");l!==-1;l=n.indexOf("{",l+1)){let d=0,h=!1,g=!1;for(let f=l;f<n.length;f++){let m=n[f];if(g){g=!1;continue}if(m==="\\"){g=h;continue}if(m==='"'){h=!h;continue}if(!h){if(m==="{")d++;else if(m==="}"&&(d--,d===0)){let C=r(n.slice(l,f+1));C!==void 0&&Object.keys(C).length>0&&(c=C,l=f);break}}}}return i&&(c===void 0||Object.keys(c).length<3)?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:c!==void 0?{value:c}:i?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:{error:`no parseable JSON object found in session output \u2014 the final message was: "${v0(Ws(n,e))}"`}}o(_t,"extractJsonObject");var sm=240;function v0(t){let e=t.replace(/\s+/g," ").trim();return e.length<=sm?e:`\u2026${e.slice(-sm)}`}o(v0,"snippetOf");function x0(t){return t.issues.map(e=>{let n=e.path.map(s=>typeof s=="number"?`[${s}]`:`.${s}`).join("").replace(/^\./,""),r=n||"output";if(!/^(Expected |Required$|Invalid |String must|Array must|Number must)/.test(e.message))return`${r} ${e.message}`;switch(e.code){case"invalid_type":return n?e.expected==="object"?`${r} must be an object`:e.received==="undefined"?`${r} is required`:`${r} must be ${e.expected}, got ${e.received}`:"output is not a JSON object";case"invalid_enum_value":{let s=JSON.stringify(e.received),i=e.options.find(c=>typeof c=="string"&&typeof e.received=="string"&&e.received.startsWith(c)),a=i?` \u2014 you sent ${s}; the value must be exactly ${JSON.stringify(i)}, with any qualifier moved to a field that takes free text`:` \u2014 you sent ${s}`;return`${r} must be one of: ${e.options.join(", ")}${a}`}case"invalid_literal":return`${r} must be ${JSON.stringify(e.expected)}`;case"too_small":return e.type==="string"?`${r} must be a non-empty string`:`${r} must have at least ${e.minimum} item(s)`;case"unrecognized_keys":return`${r} has unknown key(s): ${e.keys.join(", ")}`;default:return`${r}: ${e.message}`}})}o(x0,"issuesToMessages");function Mn(t,e){let n=t.safeParse(e);if(n.success)return{value:n.data,errors:[]};let r=o((i,a)=>a.reduce((c,l)=>c&&typeof c=="object"?c[l]:void 0,i),"at"),s=n.error.issues.filter(i=>i.path.length&&r(e,i.path)===null);if(s.length===n.error.issues.length)try{let i=t.safeParse(s.reduce((a,{path:c})=>im(a,c),e));if(i.success)return{value:i.data,errors:[]}}catch{}return{errors:x0(n.error)}}o(Mn,"validateWith");function im(t,e){if(!e.length||!t||typeof t!="object")return t;let[n,...r]=e,s=Array.isArray(t)?t.slice():{...t};return r.length?s[n]=im(s[n],r):delete s[n],s}o(im,"withoutAt");var Ks=Ve(require("path"));function D0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}o(D0,"getDefaultExportFromCjs");var Ze={},BA={},lr={},om;function So(){if(om)return lr;om=1;function t(a){return typeof a>"u"||a===null}o(t,"isNothing");function e(a){return typeof a=="object"&&a!==null}o(e,"isObject");function n(a){return Array.isArray(a)?a:t(a)?[]:[a]}o(n,"toArray");function r(a,c){if(c){let l=Object.keys(c);for(let d=0,h=l.length;d<h;d+=1){let g=l[d];a[g]=c[g]}}return a}o(r,"extend");function s(a,c){let l="";for(let d=0;d<c;d+=1)l+=a;return l}o(s,"repeat");function i(a){return a===0&&Number.NEGATIVE_INFINITY===1/a}return o(i,"isNegativeZero"),lr.isNothing=t,lr.isObject=e,lr.toArray=n,lr.repeat=s,lr.isNegativeZero=i,lr.extend=r,lr}o(So,"requireCommon");var ml,am;function vo(){if(am)return ml;am=1;function t(n,r){let s="",i=n.reason||"(unknown reason)";return n.mark?(n.mark.name&&(s+='in "'+n.mark.name+'" '),s+="("+(n.mark.line+1)+":"+(n.mark.column+1)+")",!r&&n.mark.snippet&&(s+=`
47
47
 
48
48
  `+n.mark.snippet),i+" "+s):i}o(t,"formatError");function e(n,r){Error.call(this),this.name="YAMLException",this.reason=n,this.mark=r,this.message=t(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return o(e,"YAMLException2"),e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=o(function(r){return this.name+": "+t(this,r)},"toString"),ml=e,ml}o(vo,"requireException");var El,Am;function T0(){if(Am)return El;Am=1;let t=So();function e(s,i,a,c,l){let d="",h="",g=Math.floor(l/2)-1;return c-i>g&&(d=" ... ",i=c-g+d.length),a-c>g&&(h=" ...",a=c+g-h.length),{str:d+s.slice(i,a).replace(/\t/g,"\u2192")+h,pos:c-i+d.length}}o(e,"getLine");function n(s,i){return t.repeat(" ",i-s.length)+s}o(n,"padStart");function r(s,i){if(i=Object.create(i||null),!s.buffer)return null;i.maxLength||(i.maxLength=79),typeof i.indent!="number"&&(i.indent=1),typeof i.linesBefore!="number"&&(i.linesBefore=3),typeof i.linesAfter!="number"&&(i.linesAfter=2);let a=/\r?\n|\r|\0/g,c=[0],l=[],d,h=-1;for(;d=a.exec(s.buffer);)l.push(d.index),c.push(d.index+d[0].length),s.position<=d.index&&h<0&&(h=c.length-2);h<0&&(h=c.length-1);let g="",f=Math.min(s.line+i.linesAfter,l.length).toString().length,m=i.maxLength-(i.indent+f+3);for(let y=1;y<=i.linesBefore&&!(h-y<0);y++){let R=e(s.buffer,c[h-y],l[h-y],s.position-(c[h]-c[h-y]),m);g=t.repeat(" ",i.indent)+n((s.line-y+1).toString(),f)+" | "+R.str+`
49
49
  `+g}let C=e(s.buffer,c[h],l[h],s.position,m);g+=t.repeat(" ",i.indent)+n((s.line+1).toString(),f)+" | "+C.str+`