@skyramp/testbot-core 0.13.0-v3.205 → 0.13.0-v3.207

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())}};dw.exports=Vg});var Ea=T((w3,mw)=>{"use strict";var gw=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:vP}=pe(),xP=xi();fw()===void 0&&pw(new xP);function pw(t){if(!t||typeof t.dispatch!="function")throw new vP("Argument agent must implement Agent");Object.defineProperty(globalThis,gw,{value:t,writable:!0,enumerable:!1,configurable:!1})}o(pw,"setGlobalDispatcher");function fw(){return globalThis[gw]}o(fw,"getGlobalDispatcher");mw.exports={setGlobalDispatcher:pw,getGlobalDispatcher:fw}});var Oc=T((k3,Ew)=>{"use strict";Ew.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 Iw=T((v3,Cw)=>{"use strict";var DP=Cc();Cw.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 DP(n,a,s,i);return n(c,l)},"redirectInterceptor")}});var Qw=T((D3,yw)=>{"use strict";var TP=xc();yw.exports=t=>e=>o(function(r,s){return e(r,new TP({...r,retryOptions:{...t,...r.retryOptions}},{handler:s,dispatch:e}))},"retryInterceptor")});var ww=T((N3,Bw)=>{"use strict";var NP=ue(),{InvalidArgumentError:FP,RequestAbortedError:UP}=pe(),MP=Oc(),Hg=class extends MP{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 FP("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=NP.parseHeaders(n)["content-length"];if(a!=null&&a>this.#e)throw new UP(`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 LP({maxSize:t}={maxSize:1024*1024}){return e=>o(function(r,s){let{dumpMaxSize:i=t}=r,a=new Hg({maxSize:i},s);return e(r,a)},"Intercept")}o(LP,"createDumpInterceptor");Bw.exports=LP});var kw=T((U3,Rw)=>{"use strict";var{isIP:_P}=require("node:net"),{lookup:PP}=require("node:dns"),OP=Oc(),{InvalidArgumentError:Pi,InformationalError:GP}=pe(),bw=Math.pow(2,31)-1,Jg=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 GP("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){PP(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===bw?(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===bw?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 qg(this,e,n)}},qg=class extends OP{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}}};Rw.exports=t=>{if(t?.maxTTL!=null&&(typeof t?.maxTTL!="number"||t?.maxTTL<0))throw new Pi("Invalid maxTTL. Must be a positive number");if(t?.maxItems!=null&&(typeof t?.maxItems!="number"||t?.maxItems<1))throw new Pi("Invalid maxItems. Must be a positive number and greater than zero");if(t?.affinity!=null&&t?.affinity!==4&&t?.affinity!==6)throw new Pi("Invalid affinity. Must be either 4 or 6");if(t?.dualStack!=null&&typeof t?.dualStack!="boolean")throw new Pi("Invalid dualStack. Must be a boolean");if(t?.lookup!=null&&typeof t?.lookup!="function")throw new Pi("Invalid lookup. Must be a function");if(t?.pick!=null&&typeof t?.pick!="function")throw new Pi("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 Jg(r);return i=>o(function(c,l){let d=c.origin.constructor===URL?c.origin:new URL(c.origin);return _P(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 Qs=T((L3,Fw)=>{"use strict";var{kConstruct:$P}=ke(),{kEnumerableProperty:Oi}=ue(),{iteratorMixin:YP,isValidHeaderName:Ca,isValidHeaderValue:vw}=Qt(),{webidl:ge}=je(),jg=require("node:assert"),Gc=require("node:util"),Pe=Symbol("headers map"),Rt=Symbol("headers map sorted");function Sw(t){return t===10||t===13||t===9||t===32}o(Sw,"isHTTPWhiteSpaceCharCode");function xw(t){let e=0,n=t.length;for(;n>e&&Sw(t.charCodeAt(n-1));)--n;for(;n>e&&Sw(t.charCodeAt(e));)++e;return e===0&&n===t.length?t:t.substring(e,n)}o(xw,"headerValueNormalize");function Dw(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}.`});Wg(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)Wg(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(Dw,"fill");function Wg(t,e,n){if(n=xw(n),Ca(e)){if(!vw(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(Nw(t)==="immutable")throw new TypeError("immutable");return zg(t).append(e,n,!1)}o(Wg,"appendHeader");function Tw(t,e){return t[0]<e[0]?-1:1}o(Tw,"compareHeaderName");var $c=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],jg(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],jg(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],jg(i!==null);return n.sort(Tw)}}},nn=class t{static{o(this,"Headers")}#e;#t;constructor(e=void 0){ge.util.markAsUncloneable(this),e!==$P&&(this.#t=new $c,this.#e="none",e!==void 0&&(e=ge.converters.HeadersInit(e,"Headers contructor","init"),Dw(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"),Wg(this,e,n)}delete(e){if(ge.brandCheck(this,t),ge.argumentLengthCheck(arguments,1,"Headers.delete"),e=ge.converters.ByteString(e,"Headers.delete","name"),!Ca(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"),!Ca(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"),!Ca(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=xw(n),Ca(e)){if(!vw(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}[Gc.inspect.custom](e,n){return n.depth??=e,`Headers ${Gc.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:Nw,setHeadersGuard:VP,getHeadersList:zg,setHeadersList:HP}=nn;Reflect.deleteProperty(nn,"getHeadersGuard");Reflect.deleteProperty(nn,"setHeadersGuard");Reflect.deleteProperty(nn,"getHeadersList");Reflect.deleteProperty(nn,"setHeadersList");YP("Headers",nn,Rt,0,1);Object.defineProperties(nn.prototype,{append:Oi,delete:Oi,get:Oi,has:Oi,set:Oi,getSetCookie:Oi,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[Gc.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(!Gc.types.isProxy(t)&&r===nn.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>"]})};Fw.exports={fill:Dw,compareHeaderName:Tw,Headers:nn,HeadersList:$c,getHeadersGuard:Nw,setHeadersGuard:VP,setHeadersList:HP,getHeadersList:zg}});var ya=T((P3,Jw)=>{"use strict";var{Headers:Ow,HeadersList:Uw,fill:JP,getHeadersGuard:qP,setHeadersGuard:Gw,setHeadersList:$w}=Qs(),{extractBody:Mw,cloneBody:jP,mixinBody:WP,hasFinalizationRegistry:Yw,streamRegistry:Vw,bodyUnusable:zP}=yi(),Zg=ue(),Lw=require("node:util"),{kEnumerableProperty:kt}=Zg,{isValidReasonPhrase:ZP,isCancelled:KP,isAborted:XP,isBlobLike:eO,serializeJavascriptValueToJSONString:tO,isErrorLike:nO,isomorphicEncode:rO,environmentSettingsObject:sO}=Qt(),{redirectStatusSet:iO,nullBodyStatus:oO}=Yo(),{kState:ve,kHeaders:jn}=pr(),{webidl:oe}=je(),{FormData:aO}=Wo(),{URLSerializer:_w}=ht(),{kConstruct:Vc}=ke(),Kg=require("node:assert"),{types:AO}=require("node:util"),cO=new TextEncoder("utf-8"),Bs=class t{static{o(this,"Response")}static error(){return Ia(Hc(),"immutable")}static json(e,n={}){oe.argumentLengthCheck(arguments,1,"Response.json"),n!==null&&(n=oe.converters.ResponseInit(n));let r=cO.encode(tO(e)),s=Mw(r),i=Ia(Gi({}),"response");return Pw(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,sO.settingsObject.baseUrl)}catch(a){throw new TypeError(`Failed to parse URL from ${e}`,{cause:a})}if(!iO.has(n))throw new RangeError(`Invalid status code ${n}`);let s=Ia(Gi({}),"immutable");s[ve].status=n;let i=rO(_w(r));return s[ve].headersList.append("location",i,!0),s}constructor(e=null,n={}){if(oe.util.markAsUncloneable(this),e===Vc)return;e!==null&&(e=oe.converters.BodyInit(e)),n=oe.converters.ResponseInit(n),this[ve]=Gi({}),this[jn]=new Ow(Vc),Gw(this[jn],"response"),$w(this[jn],this[ve].headersList);let r=null;if(e!=null){let[s,i]=Mw(e);r={body:s,type:i}}Pw(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?"":_w(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&&Zg.isDisturbed(this[ve].body.stream)}clone(){if(oe.brandCheck(this,t),zP(this))throw oe.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let e=Xg(this[ve]);return Yw&&this[ve].body?.stream&&Vw.register(this,new WeakRef(this[ve].body.stream)),Ia(e,qP(this[jn]))}[Lw.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 ${Lw.formatWithOptions(n,r)}`}};WP(Bs);Object.defineProperties(Bs.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(Bs,{json:kt,redirect:kt,error:kt});function Xg(t){if(t.internalResponse)return Hw(Xg(t.internalResponse),t.type);let e=Gi({...t,body:null});return t.body!=null&&(e.body=jP(e,t.body)),e}o(Xg,"cloneResponse");function Gi(t){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...t,headersList:t?.headersList?new Uw(t?.headersList):new Uw,urlList:t?.urlList?[...t.urlList]:[]}}o(Gi,"makeResponse");function Hc(t){let e=nO(t);return Gi({type:"error",status:0,error:e?t:new Error(t&&String(t)),aborted:t&&t.name==="AbortError"})}o(Hc,"makeNetworkError");function uO(t){return t.type==="error"&&t.status===0}o(uO,"isNetworkError");function Yc(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 Kg(!(r in e)),n[r]=s,!0}})}o(Yc,"makeFilteredResponse");function Hw(t,e){if(e==="basic")return Yc(t,{type:"basic",headersList:t.headersList});if(e==="cors")return Yc(t,{type:"cors",headersList:t.headersList});if(e==="opaque")return Yc(t,{type:"opaque",urlList:Object.freeze([]),status:0,statusText:"",body:null});if(e==="opaqueredirect")return Yc(t,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});Kg(!1)}o(Hw,"filterResponse");function lO(t,e=null){return Kg(KP(t)),XP(t)?Hc(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:e})):Hc(Object.assign(new DOMException("Request was cancelled."),{cause:e}))}o(lO,"makeAppropriateNetworkError");function Pw(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&&!ZP(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&&JP(t[jn],e.headers),n){if(oO.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(Pw,"initializeResponse");function Ia(t,e){let n=new Bs(Vc);return n[ve]=t,n[jn]=new Ow(Vc),$w(n[jn],t.headersList),Gw(n[jn],e),Yw&&t.body?.stream&&Vw.register(n,new WeakRef(t.body.stream)),n}o(Ia,"fromInnerResponse");oe.converters.ReadableStream=oe.interfaceConverter(ReadableStream);oe.converters.FormData=oe.interfaceConverter(aO);oe.converters.URLSearchParams=oe.interfaceConverter(URLSearchParams);oe.converters.XMLHttpRequestBodyInit=function(t,e,n){return typeof t=="string"?oe.converters.USVString(t,e,n):eO(t)?oe.converters.Blob(t,e,n,{strict:!1}):ArrayBuffer.isView(t)||AO.isArrayBuffer(t)?oe.converters.BufferSource(t,e,n):Zg.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}]);Jw.exports={isNetworkError:uO,makeNetworkError:Hc,makeResponse:Gi,makeAppropriateNetworkError:lO,filterResponse:Hw,Response:Bs,cloneResponse:Xg,fromInnerResponse:Ia}});var zw=T((G3,Ww)=>{"use strict";var{kConnected:qw,kSize:jw}=ke(),ep=class{static{o(this,"CompatWeakRef")}constructor(e){this.value=e}deref(){return this.value[qw]===0&&this.value[jw]===0?void 0:this.value}},tp=class{static{o(this,"CompatFinalizer")}constructor(e){this.finalizer=e}register(e,n){e.on&&e.on("disconnect",()=>{e[qw]===0&&e[jw]===0&&this.finalizer(n)})}unregister(e){}};Ww.exports=function(){return process.env.NODE_V8_COVERAGE&&process.version.startsWith("v18")?(process._rawDebug("Using compatibility WeakRef and FinalizationRegistry"),{WeakRef:ep,FinalizationRegistry:tp}):{WeakRef,FinalizationRegistry}}});var $i=T((Y3,lb)=>{"use strict";var{extractBody:dO,mixinBody:hO,cloneBody:gO,bodyUnusable:Zw}=yi(),{Headers:ob,fill:pO,HeadersList:Wc,setHeadersGuard:rp,getHeadersGuard:fO,setHeadersList:ab,getHeadersList:Kw}=Qs(),{FinalizationRegistry:mO}=zw()(),qc=ue(),Xw=require("node:util"),{isValidHTTPToken:EO,sameOrigin:eb,environmentSettingsObject:Jc}=Qt(),{forbiddenMethodsSet:CO,corsSafeListedMethodsSet:IO,referrerPolicy:yO,requestRedirect:QO,requestMode:BO,requestCredentials:wO,requestCache:bO,requestDuplex:RO}=Yo(),{kEnumerableProperty:Oe,normalizedMethodRecordsBase:kO,normalizedMethodRecords:SO}=qc,{kHeaders:St,kSignal:jc,kState:Re,kDispatcher:np}=pr(),{webidl:X}=je(),{URLSerializer:vO}=ht(),{kConstruct:zc}=ke(),xO=require("node:assert"),{getMaxListeners:tb,setMaxListeners:nb,getEventListeners:DO,defaultMaxListeners:rb}=require("node:events"),TO=Symbol("abortController"),Ab=new mO(({signal:t,abort:e})=>{t.removeEventListener("abort",e)}),Zc=new WeakMap;function sb(t){return e;function e(){let n=t.deref();if(n!==void 0){Ab.unregister(e),this.removeEventListener("abort",e),n.abort(this.reason);let r=Zc.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()}Zc.delete(n.signal)}}}}o(sb,"buildAbort");var ib=!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=Jc.settingsObject.baseUrl,c=null;if(typeof e=="string"){this[np]=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=Kc({urlList:[Q]}),i="cors"}else this[np]=n.dispatcher||e[np],xO(e instanceof t),s=e[Re],c=e[jc];let l=Jc.settingsObject.origin,d="client";if(s.window?.constructor?.name==="EnvironmentSettingsObject"&&eb(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=Kc({method:s.method,headersList:s.headersList,unsafeRequest:s.unsafeRequest,client:Jc.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&&!eb(D,Jc.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=SO[Q];if(D!==void 0)s.method=D;else{if(!EO(Q))throw new TypeError(`'${Q}' is not a valid HTTP method.`);let G=Q.toUpperCase();if(CO.has(G))throw new TypeError(`'${Q}' HTTP method is unsupported.`);Q=kO[G]??Q,s.method=Q}!ib&&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"}),ib=!0)}n.signal!==void 0&&(c=n.signal),this[Re]=s;let f=new AbortController;if(this[jc]=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[TO]=f;let Q=new WeakRef(f),D=sb(Q);try{(typeof tb=="function"&&tb(c)===rb||DO(c,"abort").length>=rb)&&nb(1500,c)}catch{}qc.addAbortListener(c,D),Ab.register(f,{signal:c,abort:D},D)}}if(this[St]=new ob(zc),ab(this[St],s.headersList),rp(this[St],"request"),g==="no-cors"){if(!IO.has(s.method))throw new TypeError(`'${s.method} is unsupported in no-cors mode.`);rp(this[St],"request-no-cors")}if(h){let Q=Kw(this[St]),D=n.headers!==void 0?n.headers:new Wc(Q);if(Q.clear(),D instanceof Wc){for(let{name:G,value:P}of D.rawValues())Q.append(G,P,!1);Q.cookies=D.cookies}else pO(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]=dO(n.body,s.keepalive);C=Q,D&&!Kw(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(Zw(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),vO(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[jc]}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&&qc.isDisturbed(this[Re].body.stream)}get duplex(){return X.brandCheck(this,t),"half"}clone(){if(X.brandCheck(this,t),Zw(this))throw new TypeError("unusable");let e=cb(this[Re]),n=new AbortController;if(this.signal.aborted)n.abort(this.signal.reason);else{let r=Zc.get(this.signal);r===void 0&&(r=new Set,Zc.set(this.signal,r));let s=new WeakRef(n);r.add(s),qc.addAbortListener(n.signal,sb(s))}return ub(e,n.signal,fO(this[St]))}[Xw.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 ${Xw.formatWithOptions(n,r)}`}};hO(Rr);function Kc(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 Wc(t.headersList):new Wc}}o(Kc,"makeRequest");function cb(t){let e=Kc({...t,body:null});return t.body!=null&&(e.body=gO(e,t.body)),e}o(cb,"cloneRequest");function ub(t,e,n){let r=new Rr(zc);return r[Re]=t,r[jc]=e,r[St]=new ob(zc),ab(r[St],t.headersList),rp(r[St],n),r}o(ub,"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:yO},{key:"mode",converter:X.converters.DOMString,allowedValues:BO},{key:"credentials",converter:X.converters.DOMString,allowedValues:wO},{key:"cache",converter:X.converters.DOMString,allowedValues:bO},{key:"redirect",converter:X.converters.DOMString,allowedValues:QO},{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:RO},{key:"dispatcher",converter:X.converters.any}]);lb.exports={Request:Rr,makeRequest:Kc,fromInnerRequest:ub,cloneRequest:cb}});var Ba=T((H3,Rb)=>{"use strict";var{makeNetworkError:ye,makeAppropriateNetworkError:Xc,filterResponse:sp,makeResponse:eu,fromInnerResponse:NO}=ya(),{HeadersList:db}=Qs(),{Request:FO,cloneRequest:UO}=$i(),kr=require("node:zlib"),{bytesMatch:MO,makePolicyContainer:LO,clonePolicyContainer:_O,requestBadPort:PO,TAOCheck:OO,appendRequestOriginHeader:GO,responseLocationURL:$O,requestCurrentURL:Bn,setRequestReferrerPolicyOnRedirect:YO,tryUpgradeRequestToAPotentiallyTrustworthyURL:VO,createOpaqueTimingInfo:cp,appendFetchMetadata:HO,corsCheck:JO,crossOriginResourcePolicyCheck:qO,determineRequestsReferrer:jO,coarsenedSharedCurrentTime:Qa,createDeferredPromise:WO,isBlobLike:zO,sameOrigin:Ap,isCancelled:ws,isAborted:hb,isErrorLike:ZO,fullyReadBody:KO,readableStreamClose:XO,isomorphicEncode:tu,urlIsLocal:e1,urlIsHttpHttpsScheme:up,urlHasHttpsScheme:t1,clampAndCoarsenConnectionTimingInfo:n1,simpleRangeHeaderValue:r1,buildContentRange:s1,createInflate:i1,extractMimeType:o1}=Qt(),{kState:mb,kDispatcher:a1}=pr(),bs=require("node:assert"),{safelyExtractBody:lp,extractBody:gb}=yi(),{redirectStatusSet:Eb,nullBodyStatus:Cb,safeMethodsSet:A1,requestBodyHeader:c1,subresourceSet:u1}=Yo(),l1=require("node:events"),{Readable:d1,pipeline:h1,finished:g1}=require("node:stream"),{addAbortListener:p1,isErrored:f1,isReadable:nu,bufferToLowerCasedHeaderName:pb}=ue(),{dataURLProcessor:m1,serializeAMimeType:E1,minimizeSupportedMimeType:C1}=ht(),{getGlobalDispatcher:I1}=Ea(),{webidl:y1}=je(),{STATUS_CODES:Q1}=require("node:http"),B1=["GET","HEAD"],w1=typeof __UNDICI_IS_NODE__<"u"||typeof esbuildDetection<"u"?"node":"undici",ip,ru=class extends l1{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 b1(t){Ib(t,"fetch")}o(b1,"handleFetchDone");function R1(t,e=void 0){y1.argumentLengthCheck(arguments,1,"globalThis.fetch");let n=WO(),r;try{r=new FO(t,e)}catch(h){return n.reject(h),n.promise}let s=r[mb];if(r.signal.aborted)return op(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 p1(r.signal,()=>{c=!0,bs(l!=null),l.abort(r.signal.reason);let h=a?.deref();op(n,s,h,r.signal.reason)}),l=Qb({request:s,processResponseEndOfBody:b1,processResponse:o(h=>{if(!c){if(h.aborted){op(n,s,a,l.serializedAbortReason);return}if(h.type==="error"){n.reject(new TypeError("fetch failed",{cause:h.error}));return}a=new WeakRef(NO(h,"immutable")),n.resolve(a.deref()),n=null}},"processResponse"),dispatcher:r[a1]}),n.promise}o(R1,"fetch");function Ib(t,e="other"){if(t.type==="error"&&t.aborted||!t.urlList?.length)return;let n=t.urlList[0],r=t.timingInfo,s=t.cacheState;up(n)&&r!==null&&(t.timingAllowPassed||(r=cp({startTime:r.startTime}),s=""),r.endTime=Qa(),t.timingInfo=r,yb(r,n.href,e,globalThis,s))}o(Ib,"finalizeAndReportTiming");var yb=performance.markResourceTiming;function op(t,e,n,r){if(t&&t.reject(r),e.body!=null&&nu(e.body?.stream)&&e.body.stream.cancel(r).catch(i=>{if(i.code!=="ERR_INVALID_STATE")throw i}),n==null)return;let s=n[mb];s.body!=null&&nu(s.body?.stream)&&s.body.stream.cancel(r).catch(i=>{if(i.code!=="ERR_INVALID_STATE")throw i})}o(op,"abortFetch");function Qb({request:t,processRequestBodyChunkLength:e,processRequestEndOfBody:n,processResponse:r,processResponseEndOfBody:s,processResponseConsumeBody:i,useParallelQueue:a=!1,dispatcher:c=I1()}){bs(c);let l=null,d=!1;t.client!=null&&(l=t.client.globalObject,d=t.client.crossOriginIsolatedCapability);let h=Qa(d),g=cp({startTime:h}),f={controller:new ru(c),request:t,timingInfo:g,processRequestBodyChunkLength:e,processRequestEndOfBody:n,processResponse:r,processResponseConsumeBody:i,processResponseEndOfBody:s,taskDestination:l,crossOriginIsolatedCapability:d};return bs(!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=_O(t.client.policyContainer):t.policyContainer=LO()),t.headersList.contains("accept",!0)||t.headersList.append("accept","*/*",!0),t.headersList.contains("accept-language",!0)||t.headersList.append("accept-language","*",!0),t.priority,u1.has(t.destination),Bb(f).catch(m=>{f.controller.terminate(m)}),f.controller}o(Qb,"fetching");async function Bb(t,e=!1){let n=t.request,r=null;if(n.localURLsOnly&&!e1(Bn(n))&&(r=ye("local URLs only")),VO(n),PO(n)==="blocked"&&(r=ye("bad port")),n.referrerPolicy===""&&(n.referrerPolicy=n.policyContainer.referrerPolicy),n.referrer!=="no-referrer"&&(n.referrer=jO(n)),r===null&&(r=await(async()=>{let i=Bn(n);return Ap(i,n.url)&&n.responseTainting==="basic"||i.protocol==="data:"||n.mode==="navigate"||n.mode==="websocket"?(n.responseTainting="basic",await fb(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 fb(t)):up(Bn(n))?(n.responseTainting="cors",await wb(t)):ye("URL scheme must be a HTTP(S) scheme")})()),e)return r;r.status!==0&&!r.internalResponse&&(n.responseTainting,n.responseTainting==="basic"?r=sp(r,"basic"):n.responseTainting==="cors"?r=sp(r,"cors"):n.responseTainting==="opaque"?r=sp(r,"opaque"):bs(!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"||Cb.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(!MO(c,n.integrity)){i("integrity mismatch");return}r.body=lp(c)[0],ap(t,r)},"processBody");await KO(r.body,a,i)}else ap(t,r)}o(Bb,"mainFetch");function fb(t){if(ws(t)&&t.request.redirectCount===0)return Promise.resolve(Xc(t));let{request:e}=t,{protocol:n}=Bn(e);switch(n){case"about:":return Promise.resolve(ye("about scheme is not supported"));case"blob:":{ip||(ip=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=ip(r.toString());if(e.method!=="GET"||!zO(s))return Promise.resolve(ye("invalid method"));let i=eu(),a=s.size,c=tu(`${a}`),l=s.type;if(e.headersList.contains("range",!0)){i.rangeRequested=!0;let d=e.headersList.get("range",!0),h=r1(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=gb(m);i.body=C[0];let y=tu(`${m.size}`),R=s1(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=gb(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=m1(r);if(s==="failure")return Promise.resolve(ye("failed to fetch the data URL"));let i=E1(s.mimeType);return Promise.resolve(eu({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:i}]],body:lp(s.body)[0]}))}case"file:":return Promise.resolve(ye("not implemented... yet..."));case"http:":case"https:":return wb(t).catch(r=>ye(r));default:return Promise.resolve(ye("unknown scheme"))}}o(fb,"schemeFetch");function k1(t,e){t.request.done=!0,t.processResponseDone!=null&&queueMicrotask(()=>t.processResponseDone(e))}o(k1,"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=cp(n),c="");let d=0;if(t.request.mode!=="navigator"||!e.hasCrossOriginRedirects){d=e.status;let h=o1(e.headersList);h!=="failure"&&(l.contentType=C1(h))}t.request.initiatorType!=null&&yb(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():g1(s.body.stream,()=>{r()})}o(ap,"fetchFinale");async function wb(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 bb(t),e.responseTainting==="cors"&&JO(e,n)==="failure")return ye("cors failure");OO(e,n)==="failure"&&(e.timingAllowFailed=!0)}return(e.responseTainting==="opaque"||n.type==="opaque")&&qO(e.origin,e.client,e.destination,r)==="blocked"?ye("blocked"):(Eb.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 S1(t,n):bs(!1)),n.timingInfo=s,n)}o(wb,"httpFetch");function S1(t,e){let n=t.request,r=e.internalResponse?e.internalResponse:e,s;try{if(s=$O(r,Bn(n).hash),s==null)return e}catch(a){return Promise.resolve(ye(a))}if(!up(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)&&!Ap(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&&!B1.includes(n.method)){n.method="GET",n.body=null;for(let a of c1)n.headersList.delete(a)}Ap(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&&(bs(n.body.source!=null),n.body=lp(n.body.source)[0]);let i=t.timingInfo;return i.redirectEndTime=i.postRedirectStartTime=Qa(t.crossOriginIsolatedCapability),i.redirectStartTime===0&&(i.redirectStartTime=i.startTime),n.urlList.push(s),YO(n,r),Bb(t,!0)}o(S1,"httpRedirectFetch");async function bb(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=UO(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=tu(`${h}`)),g!=null&&i.headersList.append("content-length",g,!0),h!=null&&i.keepalive,i.referrer instanceof URL&&i.headersList.append("referer",tu(i.referrer.href),!0),GO(i),HO(i),i.headersList.contains("user-agent",!0)||i.headersList.append("user-agent",w1),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)||(t1(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 v1(s,d,n);!A1.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():ws(t)?Xc(t):ye("proxy authentication required");if(a.status===421&&!n&&(r.body==null||r.body.source!=null)){if(ws(t))return Xc(t);t.controller.connection.destroy(),a=await bb(t,e,!0)}return a}o(bb,"httpNetworkOrCacheFetch");async function v1(t,e=!1,n=!1){bs(!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){ws(t)||(yield Q,t.processRequestBodyChunkLength?.(Q.byteLength))},"processBodyChunk"),y=o(()=>{ws(t)||t.processRequestEndOfBody&&t.processRequestEndOfBody()},"processEndOfBody"),R=o(Q=>{ws(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=eu({status:y,statusText:R,headersList:Q,socket:D});else{let G=C[Symbol.asyncIterator]();t.controller.next=()=>G.next(),s=eu({status:y,statusText:R,headersList:Q})}}catch(C){return C.name==="AbortError"?(t.controller.connection.destroy(),Xc(t,C)):ye(C)}let d=o(async()=>{await t.controller.resume()},"pullAlgorithm"),h=o(C=>{ws(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(hb(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){XO(t.controller.controller),k1(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),f1(g)){t.controller.terminate();return}if(t.controller.controller.desiredSize<=0)return}};function f(C){hb(t)?(s.aborted=!0,nu(g)&&t.controller.controller.error(t.controller.serializedAbortReason)):nu(g)&&t.controller.controller.error(new TypeError("terminated",{cause:ZO(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=n1(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=Qa(t.crossOriginIsolatedCapability)},onResponseStarted(){i.finalNetworkResponseStartTime=Qa(t.crossOriginIsolatedCapability)},onHeaders(G,P,ae,Ee){if(G<200)return;let Ce="",De=new db;for(let Ge=0;Ge<P.length;Ge+=2)De.append(pb(P[Ge]),P[Ge+1].toString("latin1"),!0);Ce=De.get("location",!0);let et=[],an=Ce&&r.redirect==="follow"&&Eb.has(G);if(r.method!=="HEAD"&&r.method!=="CONNECT"&&!Cb.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(i1({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 d1({read:ae});let At=this.onError.bind(this);return Q({status:G,statusText:Ee,headersList:De,body:et.length?h1(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 db;for(let Ce=0;Ce<P.length;Ce+=2)Ee.append(pb(P[Ce]),P[Ce+1].toString("latin1"),!0);return Q({status:G,statusText:Q1[G],headersList:Ee,socket:ae}),!0}}))}o(m,"dispatch")}o(v1,"httpNetworkFetch");Rb.exports={fetch:R1,Fetch:ru,fetching:Qb,finalizeAndReportTiming:Ib}});var dp=T((q3,kb)=>{"use strict";kb.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 vb=T((j3,Sb)=>{"use strict";var{webidl:vt}=je(),su=Symbol("ProgressEvent state"),hp=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[su]={lengthComputable:n.lengthComputable,loaded:n.loaded,total:n.total}}get lengthComputable(){return vt.brandCheck(this,t),this[su].lengthComputable}get loaded(){return vt.brandCheck(this,t),this[su].loaded}get total(){return vt.brandCheck(this,t),this[su].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")}]);Sb.exports={ProgressEvent:hp}});var Db=T((z3,xb)=>{"use strict";function x1(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(x1,"getEncoding");xb.exports={getEncoding:x1}});var Pb=T((K3,_b)=>{"use strict";var{kState:Yi,kError:gp,kResult:Tb,kAborted:wa,kLastProgressEventFired:pp}=dp(),{ProgressEvent:D1}=vb(),{getEncoding:Nb}=Db(),{serializeAMimeType:T1,parseMIMEType:Fb}=ht(),{types:N1}=require("node:util"),{StringDecoder:Ub}=require("string_decoder"),{btoa:Mb}=require("node:buffer"),F1={enumerable:!0,writable:!1,configurable:!1};function U1(t,e,n,r){if(t[Yi]==="loading")throw new DOMException("Invalid state","InvalidStateError");t[Yi]="loading",t[Tb]=null,t[gp]=null;let i=e.stream().getReader(),a=[],c=i.read(),l=!0;(async()=>{for(;!t[wa];)try{let{done:d,value:h}=await c;if(l&&!t[wa]&&queueMicrotask(()=>{Sr("loadstart",t)}),l=!1,!d&&N1.isUint8Array(h))a.push(h),(t[pp]===void 0||Date.now()-t[pp]>=50)&&!t[wa]&&(t[pp]=Date.now(),queueMicrotask(()=>{Sr("progress",t)})),c=i.read();else if(d){queueMicrotask(()=>{t[Yi]="done";try{let g=M1(a,n,e.type,r);if(t[wa])return;t[Tb]=g,Sr("load",t)}catch(g){t[gp]=g,Sr("error",t)}t[Yi]!=="loading"&&Sr("loadend",t)});break}}catch(d){if(t[wa])return;queueMicrotask(()=>{t[Yi]="done",t[gp]=d,Sr("error",t),t[Yi]!=="loading"&&Sr("loadend",t)});break}})()}o(U1,"readOperation");function Sr(t,e){let n=new D1(t,{bubbles:!1,cancelable:!1});e.dispatchEvent(n)}o(Sr,"fireAProgressEvent");function M1(t,e,n,r){switch(e){case"DataURL":{let s="data:",i=Fb(n||"application/octet-stream");i!=="failure"&&(s+=T1(i)),s+=";base64,";let a=new Ub("latin1");for(let c of t)s+=Mb(a.write(c));return s+=Mb(a.end()),s}case"Text":{let s="failure";if(r&&(s=Nb(r)),s==="failure"&&n){let i=Fb(n);i!=="failure"&&(s=Nb(i.parameters.get("charset")))}return s==="failure"&&(s="UTF-8"),L1(t,s)}case"ArrayBuffer":return Lb(t).buffer;case"BinaryString":{let s="",i=new Ub("latin1");for(let a of t)s+=i.write(a);return s+=i.end(),s}}}o(M1,"packageData");function L1(t,e){let n=Lb(t),r=_1(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(L1,"decode");function _1(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(_1,"BOMSniffing");function Lb(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(Lb,"combineByteSequences");_b.exports={staticPropertyDescriptors:F1,readOperation:U1,fireAProgressEvent:Sr}});var Yb=T((e4,$b)=>{"use strict";var{staticPropertyDescriptors:Vi,readOperation:iu,fireAProgressEvent:Ob}=Pb(),{kState:Rs,kError:Gb,kResult:ou,kEvents:fe,kAborted:P1}=dp(),{webidl:Be}=je(),{kEnumerableProperty:ft}=ue(),rn=class t extends EventTarget{static{o(this,"FileReader")}constructor(){super(),this[Rs]="empty",this[ou]=null,this[Gb]=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}),iu(this,e,"ArrayBuffer")}readAsBinaryString(e){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsBinaryString"),e=Be.converters.Blob(e,{strict:!1}),iu(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")),iu(this,e,"Text",n)}readAsDataURL(e){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsDataURL"),e=Be.converters.Blob(e,{strict:!1}),iu(this,e,"DataURL")}abort(){if(this[Rs]==="empty"||this[Rs]==="done"){this[ou]=null;return}this[Rs]==="loading"&&(this[Rs]="done",this[ou]=null),this[P1]=!0,Ob("abort",this),this[Rs]!=="loading"&&Ob("loadend",this)}get readyState(){switch(Be.brandCheck(this,t),this[Rs]){case"empty":return this.EMPTY;case"loading":return this.LOADING;case"done":return this.DONE}}get result(){return Be.brandCheck(this,t),this[ou]}get error(){return Be.brandCheck(this,t),this[Gb]}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}};rn.EMPTY=rn.prototype.EMPTY=0;rn.LOADING=rn.prototype.LOADING=1;rn.DONE=rn.prototype.DONE=2;Object.defineProperties(rn.prototype,{EMPTY:Vi,LOADING:Vi,DONE:Vi,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(rn,{EMPTY:Vi,LOADING:Vi,DONE:Vi});$b.exports={FileReader:rn}});var au=T((n4,Vb)=>{"use strict";Vb.exports={kConstruct:ke().kConstruct}});var qb=T((r4,Jb)=>{"use strict";var O1=require("node:assert"),{URLSerializer:Hb}=ht(),{isValidHeaderName:G1}=Qt();function $1(t,e,n=!1){let r=Hb(t,n),s=Hb(e,n);return r===s}o($1,"urlEquals");function Y1(t){O1(t!==null);let e=[];for(let n of t.split(","))n=n.trim(),G1(n)&&e.push(n);return e}o(Y1,"getFieldValues");Jb.exports={urlEquals:$1,getFieldValues:Y1}});var zb=T((i4,Wb)=>{"use strict";var{kConstruct:V1}=au(),{urlEquals:H1,getFieldValues:fp}=qb(),{kEnumerableProperty:ks,isDisturbed:J1}=ue(),{webidl:q}=je(),{Response:q1,cloneResponse:j1,fromInnerResponse:W1}=ya(),{Request:Wn,fromInnerRequest:z1}=$i(),{kState:sn}=pr(),{fetching:Z1}=Ba(),{urlIsHttpHttpsScheme:Au,createDeferredPromise:Hi,readAllBytes:K1}=Qt(),mp=require("node:assert"),cu=class t{static{o(this,"Cache")}#e;constructor(){arguments[0]!==V1&&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[sn];if(!Au(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)[sn];if(!Au(m.url))throw q.errors.exception({header:n,message:"Expected http/s scheme."});m.initiator="fetch",m.destination="subresource",s.push(m);let C=Hi();i.push(Z1({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=fp(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=Hi(),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[sn]:s=new Wn(e)[sn],!Au(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[sn];if(i.status===206)throw q.errors.exception({header:r,message:"Got 206 status"});if(i.headersList.contains("vary")){let m=fp(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&&(J1(i.body.stream)||i.body.stream.locked))throw q.errors.exception({header:r,message:"Response body is locked or disturbed"});let a=j1(i),c=Hi();if(i.body!=null){let C=i.body.stream.getReader();K1(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=Hi(),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[sn],s.method!=="GET"&&!n.ignoreMethod)return!1}else mp(typeof e=="string"),s=new Wn(e)[sn];let i=[],a={type:"delete",request:s,options:n};i.push(a);let c=Hi(),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[sn],s.method!=="GET"&&!n.ignoreMethod)return[]}else typeof e=="string"&&(s=new Wn(e)[sn]);let i=Hi(),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=z1(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);mp(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(!Au(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);mp(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=""),!H1(i,a,!0))return!1;if(r==null||s?.ignoreVary||!r.headersList.contains("vary"))return!0;let c=fp(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[sn],s.method!=="GET"&&!n.ignoreMethod)return[]}else typeof e=="string"&&(s=new Wn(e)[sn]);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=W1(c,"immutable");if(a.push(l.clone()),a.length>=r)break}return Object.freeze(a)}};Object.defineProperties(cu.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:ks,matchAll:ks,add:ks,addAll:ks,put:ks,delete:ks,keys:ks});var jb=[{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(jb);q.converters.MultiCacheQueryOptions=q.dictionaryConverter([...jb,{key:"cacheName",converter:q.converters.DOMString}]);q.converters.Response=q.interfaceConverter(q1);q.converters["sequence<RequestInfo>"]=q.sequenceConverter(q.converters.RequestInfo);Wb.exports={Cache:cu}});var Kb=T((a4,Zb)=>{"use strict";var{kConstruct:ba}=au(),{Cache:uu}=zb(),{webidl:Xe}=je(),{kEnumerableProperty:Ra}=ue(),lu=class t{static{o(this,"CacheStorage")}#e=new Map;constructor(){arguments[0]!==ba&&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 uu(ba,r).match(e,n)}}else for(let r of this.#e.values()){let i=await new uu(ba,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 uu(ba,s)}let r=[];return this.#e.set(e,r),new uu(ba,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(lu.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:Ra,has:Ra,open:Ra,delete:Ra,keys:Ra});Zb.exports={CacheStorage:lu}});var eR=T((c4,Xb)=>{"use strict";Xb.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}});var Ip=T((u4,sR)=>{"use strict";function X1(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(X1,"isCTLExcludingHtab");function Ep(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(Ep,"validateCookieName");function Cp(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(Cp,"validateCookieValue");function nR(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(nR,"validateCookiePath");function tR(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}o(tR,"isLetterOrDigit");function eG(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&&!tR(r))throw new Error("Invalid cookie domain");if(!tR(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(eG,"validateCookieDomain");var tG=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],nG=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],du=Array(61).fill(0).map((t,e)=>e.toString().padStart(2,"0"));function rR(t){return typeof t=="number"&&(t=new Date(t)),`${tG[t.getUTCDay()]}, ${du[t.getUTCDate()]} ${nG[t.getUTCMonth()]} ${t.getUTCFullYear()} ${du[t.getUTCHours()]}:${du[t.getUTCMinutes()]}:${du[t.getUTCSeconds()]} GMT`}o(rR,"toIMFDate");function rG(t){if(t<0)throw new Error("Invalid cookie max-age")}o(rG,"validateCookieMaxAge");function sG(t){if(t.name.length===0)return null;Ep(t.name),Cp(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"&&(rG(t.maxAge),e.push(`Max-Age=${t.maxAge}`)),t.domain&&(eG(t.domain),e.push(`Domain=${t.domain}`)),t.path&&(nR(t.path),e.push(`Path=${t.path}`)),t.expires&&t.expires.toString()!=="Invalid Date"&&e.push(`Expires=${rR(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("=");Ep(i),Cp(a),e.push(`${i}=${a}`)}return e.join("; ")}o(sG,"stringify");sR.exports={isCTLExcludingHtab:X1,validateCookieName:Ep,validateCookiePath:nR,validateCookieValue:Cp,toIMFDate:rR,stringify:sG}});var oR=T((d4,iR)=>{"use strict";var{maxNameValuePairSize:iG,maxAttributeValueSize:oG}=eR(),{isCTLExcludingHtab:aG}=Ip(),{collectASequenceOfCodePointsFast:hu}=ht(),AG=require("node:assert");function cG(t){if(aG(t))return null;let e="",n="",r="",s="";if(t.includes(";")){let i={position:0};e=hu(";",t,i),n=t.slice(i.position)}else e=t;if(!e.includes("="))s=e;else{let i={position:0};r=hu("=",e,i),s=e.slice(i.position+1)}return r=r.trim(),s=s.trim(),r.length+s.length>iG?null:{name:r,value:s,...Ji(n)}}o(cG,"parseSetCookie");function Ji(t,e={}){if(t.length===0)return e;AG(t[0]===";"),t=t.slice(1);let n="";t.includes(";")?(n=hu(";",t,{position:0}),t=t.slice(n.length)):(n=t,t="");let r="",s="";if(n.includes("=")){let a={position:0};r=hu("=",n,a),s=n.slice(a.position+1)}else r=n;if(r=r.trim(),s=s.trim(),s.length>oG)return Ji(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 Ji(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 Ji(t,e)}o(Ji,"parseUnparsedAttributes");iR.exports={parseSetCookie:cG,parseUnparsedAttributes:Ji}});var cR=T((g4,AR)=>{"use strict";var{parseSetCookie:uG}=oR(),{stringify:lG}=Ip(),{webidl:he}=je(),{Headers:gu}=Qs();function dG(t){he.argumentLengthCheck(arguments,1,"getCookies"),he.brandCheck(t,gu,{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(dG,"getCookies");function hG(t,e,n){he.brandCheck(t,gu,{strict:!1});let r="deleteCookie";he.argumentLengthCheck(arguments,2,r),e=he.converters.DOMString(e,r,"name"),n=he.converters.DeleteCookieAttributes(n),aR(t,{name:e,value:"",expires:new Date(0),...n})}o(hG,"deleteCookie");function gG(t){he.argumentLengthCheck(arguments,1,"getSetCookies"),he.brandCheck(t,gu,{strict:!1});let e=t.getSetCookie();return e?e.map(n=>uG(n)):[]}o(gG,"getSetCookies");function aR(t,e){he.argumentLengthCheck(arguments,2,"setCookie"),he.brandCheck(t,gu,{strict:!1}),e=he.converters.Cookie(e);let n=lG(e);n&&t.append("Set-Cookie",n)}o(aR,"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")}]);AR.exports={getCookies:dG,deleteCookie:hG,getSetCookies:gG,setCookie:aR}});var ji=T((f4,lR)=>{"use strict";var{webidl:H}=je(),{kEnumerableProperty:mt}=ue(),{kConstruct:uR}=ke(),{MessagePort:pG}=require("node:worker_threads"),qi=class t extends Event{static{o(this,"MessageEvent")}#e;constructor(e,n={}){if(e===uR){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(uR,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:fG}=qi;delete qi.createFastMessageEvent;var pu=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}},fu=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(qi.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:mt,origin:mt,lastEventId:mt,source:mt,ports:mt,initMessageEvent:mt});Object.defineProperties(pu.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:mt,code:mt,wasClean:mt});Object.defineProperties(fu.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:mt,filename:mt,lineno:mt,colno:mt,error:mt});H.converters.MessagePort=H.interfaceConverter(pG);H.converters["sequence<MessagePort>"]=H.sequenceConverter(H.converters.MessagePort);var yp=[{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([...yp,{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([...yp,{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([...yp,{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}]);lR.exports={MessageEvent:qi,CloseEvent:pu,ErrorEvent:fu,createFastMessageEvent:fG}});var Ss=T((E4,dR)=>{"use strict";var mG="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",EG={enumerable:!0,writable:!1,configurable:!1},CG={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},IG={NOT_SENT:0,PROCESSING:1,SENT:2},yG={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},QG=2**16-1,BG={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},wG=Buffer.allocUnsafe(0),bG={string:1,typedArray:2,arrayBuffer:3,blob:4};dR.exports={uid:mG,sentCloseFrameState:IG,staticPropertyDescriptors:EG,states:CG,opcodes:yG,maxUnsigned16Bit:QG,parserStates:BG,emptyBuffer:wG,sendHints:bG}});var ka=T((C4,hR)=>{"use strict";hR.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 xa=T((I4,QR)=>{"use strict";var{kReadyState:Sa,kController:RG,kResponse:kG,kBinaryType:SG,kWebSocketURL:vG}=ka(),{states:va,opcodes:vr}=Ss(),{ErrorEvent:xG,createFastMessageEvent:DG}=ji(),{isUtf8:TG}=require("node:buffer"),{collectASequenceOfCodePointsFast:NG,removeHTTPWhitespace:gR}=ht();function FG(t){return t[Sa]===va.CONNECTING}o(FG,"isConnecting");function UG(t){return t[Sa]===va.OPEN}o(UG,"isEstablished");function MG(t){return t[Sa]===va.CLOSING}o(MG,"isClosing");function LG(t){return t[Sa]===va.CLOSED}o(LG,"isClosed");function Qp(t,e,n=(s,i)=>new Event(s,i),r={}){let s=n(t,r);e.dispatchEvent(s)}o(Qp,"fireEvent");function _G(t,e,n){if(t[Sa]!==va.OPEN)return;let r;if(e===vr.TEXT)try{r=yR(n)}catch{fR(t,"Received invalid UTF-8 in text frame.");return}else e===vr.BINARY&&(t[SG]==="blob"?r=new Blob([n]):r=PG(n));Qp("message",t,DG,{origin:t[vG].origin,data:r})}o(_G,"websocketMessageReceived");function PG(t){return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}o(PG,"toArrayBuffer");function OG(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(OG,"isValidSubprotocol");function GG(t){return t>=1e3&&t<1015?t!==1004&&t!==1005&&t!==1006:t>=3e3&&t<=4999}o(GG,"isValidStatusCode");function fR(t,e){let{[RG]:n,[kG]:r}=t;n.abort(),r?.socket&&!r.socket.destroyed&&r.socket.destroy(),e&&Qp("error",t,(s,i)=>new xG(s,i),{error:new Error(e),message:e})}o(fR,"failWebsocketConnection");function mR(t){return t===vr.CLOSE||t===vr.PING||t===vr.PONG}o(mR,"isControlFrame");function ER(t){return t===vr.CONTINUATION}o(ER,"isContinuationFrame");function CR(t){return t===vr.TEXT||t===vr.BINARY}o(CR,"isTextBinaryFrame");function $G(t){return CR(t)||ER(t)||mR(t)}o($G,"isValidOpcode");function YG(t){let e={position:0},n=new Map;for(;e.position<t.length;){let r=NG(";",t,e),[s,i=""]=r.split("=");n.set(gR(s,!0,!1),gR(i,!1,!0)),e.position++}return n}o(YG,"parseExtensions");function VG(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(VG,"isValidClientWindowBits");var IR=typeof process.versions.icu=="string",pR=IR?new TextDecoder("utf-8",{fatal:!0}):void 0,yR=IR?pR.decode.bind(pR):function(t){if(TG(t))return t.toString("utf-8");throw new TypeError("Invalid utf-8 received.")};QR.exports={isConnecting:FG,isEstablished:UG,isClosing:MG,isClosed:LG,fireEvent:Qp,isValidSubprotocol:OG,isValidStatusCode:GG,failWebsocketConnection:fR,websocketMessageReceived:_G,utf8Decode:yR,isControlFrame:mR,isContinuationFrame:ER,isTextBinaryFrame:CR,isValidOpcode:$G,parseExtensions:YG,isValidClientWindowBits:VG}});var Eu=T((Q4,BR)=>{"use strict";var{maxUnsigned16Bit:HG}=Ss(),mu=16386,Bp,Da=null,Wi=mu;try{Bp=require("node:crypto")}catch{Bp={randomFillSync:o(function(e,n,r){for(let s=0;s<e.length;++s)e[s]=Math.random()*255|0;return e},"randomFillSync")}}function JG(){return Wi===mu&&(Wi=0,Bp.randomFillSync(Da??=Buffer.allocUnsafe(mu),0,mu)),[Da[Wi++],Da[Wi++],Da[Wi++],Da[Wi++]]}o(JG,"generateMask");var wp=class{static{o(this,"WebsocketFrameSend")}constructor(e){this.frameData=e}createFrame(e){let n=this.frameData,r=JG(),s=n?.byteLength??0,i=s,a=6;s>HG?(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}};BR.exports={WebsocketFrameSend:wp}});var Rp=T((w4,xR)=>{"use strict";var{uid:qG,states:Ta,sentCloseFrameState:Cu,emptyBuffer:jG,opcodes:WG}=Ss(),{kReadyState:Na,kSentClose:Iu,kByteParser:bR,kReceivedClose:wR,kResponse:RR}=ka(),{fireEvent:zG,failWebsocketConnection:xr,isClosing:ZG,isClosed:KG,isEstablished:XG,parseExtensions:e$}=xa(),{channels:zi}=Ai(),{CloseEvent:t$}=ji(),{makeRequest:n$}=$i(),{fetching:r$}=Ba(),{Headers:s$,getHeadersList:i$}=Qs(),{getDecodeSplit:o$}=Qt(),{WebsocketFrameSend:a$}=Eu(),bp;try{bp=require("node:crypto")}catch{}function A$(t,e,n,r,s,i){let a=t;a.protocol=t.protocol==="ws:"?"http:":"https:";let c=n$({urlList:[a],client:n,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(i.headers){let g=i$(new s$(i.headers));c.headersList=g}let l=bp.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"),r$({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=bp.createHash("sha1").update(l+qG).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=e$(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=o$("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",kR),g.socket.on("close",SR),g.socket.on("error",vR),zi.open.hasSubscribers&&zi.open.publish({address:g.socket.address(),protocol:R,extensions:C}),s(g,y)}})}o(A$,"establishWebSocketConnection");function c$(t,e,n,r){if(!(ZG(t)||KG(t)))if(!XG(t))xr(t,"Connection was closed before it was established."),t[Na]=Ta.CLOSING;else if(t[Iu]===Cu.NOT_SENT){t[Iu]=Cu.PROCESSING;let s=new a$;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=jG,t[RR].socket.write(s.createFrame(WG.CLOSE)),t[Iu]=Cu.SENT,t[Na]=Ta.CLOSING}else t[Na]=Ta.CLOSING}o(c$,"closeWebSocketConnection");function kR(t){this.ws[bR].write(t)||this.pause()}o(kR,"onSocketData");function SR(){let{ws:t}=this,{[RR]:e}=t;e.socket.off("data",kR),e.socket.off("close",SR),e.socket.off("error",vR);let n=t[Iu]===Cu.SENT&&t[wR],r=1005,s="",i=t[bR].closingInfo;i&&!i.error?(r=i.code??1005,s=i.reason):t[wR]||(r=1006),t[Na]=Ta.CLOSED,zG("close",t,(a,c)=>new t$(a,c),{wasClean:n,code:r,reason:s}),zi.close.hasSubscribers&&zi.close.publish({websocket:t,code:r,reason:s})}o(SR,"onSocketClose");function vR(t){let{ws:e}=this;e[Na]=Ta.CLOSING,zi.socketError.hasSubscribers&&zi.socketError.publish(t),this.destroy()}o(vR,"onSocketError");xR.exports={establishWebSocketConnection:A$,closeWebSocketConnection:c$}});var TR=T((R4,DR)=>{"use strict";var{createInflateRaw:u$,Z_DEFAULT_WINDOWBITS:l$}=require("node:zlib"),{isValidClientWindowBits:d$}=xa(),{MessageSizeExceededError:h$}=pe(),g$=Buffer.from([0,0,255,255]),yu=Symbol("kBuffer"),Fa=Symbol("kLength"),kp=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=l$;if(this.#t.serverMaxWindowBits){if(!d$(this.#t.serverMaxWindowBits)){r(new Error("Invalid server_max_window_bits"));return}s=Number.parseInt(this.#t.serverMaxWindowBits)}try{this.#e=u$({windowBits:s})}catch(i){r(i);return}this.#e[yu]=[],this.#e[Fa]=0,this.#e.on("data",i=>{if(this.#e[Fa]+=i.length,this.#n>0&&this.#e[Fa]>this.#n){r(new h$),this.#e.removeAllListeners(),this.#e.destroy(),this.#e=null;return}this.#e[yu].push(i)}),this.#e.on("error",i=>{this.#e=null,r(i)})}this.#e.write(e),n&&this.#e.write(g$),this.#e.flush(()=>{if(!this.#e)return;let s=Buffer.concat(this.#e[yu],this.#e[Fa]);this.#e[yu].length=0,this.#e[Fa]=0,r(null,s)})}};DR.exports={PerMessageDeflate:kp}});var GR=T((S4,OR)=>{"use strict";var{Writable:p$}=require("node:stream"),f$=require("node:assert"),{parserStates:Et,opcodes:Zi,states:m$,emptyBuffer:NR,sentCloseFrameState:FR}=Ss(),{kReadyState:E$,kSentClose:UR,kResponse:Sp,kReceivedClose:MR}=ka(),{channels:Qu}=Ai(),{isValidStatusCode:C$,isValidOpcode:I$,failWebsocketConnection:xt,websocketMessageReceived:LR,utf8Decode:y$,isControlFrame:vp,isTextBinaryFrame:xp,isContinuationFrame:Q$}=xa(),{WebsocketFrameSend:_R}=Eu(),{closeWebSocketConnection:PR}=Rp(),{PerMessageDeflate:B$}=TR(),{MessageSizeExceededError:Dp}=pe();function Ua(t,e,n){PR(t,e,n,Buffer.byteLength(n)),xt(t,n)}o(Ua,"failWebsocketConnectionWithCode");var Tp=class extends p${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 B$(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&&!vp(this.#r.opcode)&&this.#r.payloadLength+this.#t>this.#A?(Ua(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!==Zi.CONTINUATION,c=n[1]&127,l=n[0]&64,d=n[0]&32,h=n[0]&16;if(!I$(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&&!xp(s)){xt(this.ws,"Invalid frame type was fragmented.");return}if(xp(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)&&vp(s)){xt(this.ws,"Control frame either too large or fragmented");return}if(Q$(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);xp(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(vp(this.#r.opcode)){this.#s=this.parseControlFrame(n),this.#i=Et.INFO;let r=this.ws[Sp].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 Dp?1009:1007;Ua(this.ws,i,r.message);return}if(this.writeFragments(s)){if(this.#A>0&&this.#t>this.#A){Ua(this.ws,1009,new Dp().message);return}if(!this.#r.fin){this.#i=Et.INFO,this.#s=!0,this.run(e);return}LR(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){Ua(this.ws,1009,new Dp().message);return}!this.#r.fragmented&&this.#r.fin&&LR(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 NR;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?(Ua(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){f$(e.length!==1);let n;if(e.length>=2&&(n=e.readUInt16BE(0)),n!==void 0&&!C$(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=y$(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===Zi.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 PR(this.ws,s,i,i.length),xt(this.ws,i),!1}if(this.ws[UR]!==FR.SENT){let s=NR;this.#r.closeInfo.code&&(s=Buffer.allocUnsafe(2),s.writeUInt16BE(this.#r.closeInfo.code,0));let i=new _R(s);this.ws[Sp].socket.write(i.createFrame(Zi.CLOSE),a=>{a||(this.ws[UR]=FR.SENT)})}return this.ws[E$]=m$.CLOSING,this.ws[MR]=!0,!1}else if(n===Zi.PING){if(!this.ws[MR]){let s=new _R(e);this.ws[Sp].socket.write(s.createFrame(Zi.PONG)),Qu.ping.hasSubscribers&&Qu.ping.publish({payload:e})}}else n===Zi.PONG&&Qu.pong.hasSubscribers&&Qu.pong.publish({payload:e});return!0}get closingInfo(){return this.#r.closeInfo}};OR.exports={ByteParser:Tp}});var JR=T((x4,HR)=>{"use strict";var{WebsocketFrameSend:w$}=Eu(),{opcodes:$R,sendHints:Ki}=Ss(),b$=Lh(),YR=Buffer[Symbol.species],Np=class{static{o(this,"SendQueue")}#e=new b$;#t=!1;#n;constructor(e){this.#n=e}add(e,n,r){if(r!==Ki.blob){let i=VR(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=VR(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 VR(t,e){return new w$(R$(t,e)).createFrame(e===Ki.string?$R.TEXT:$R.BINARY)}o(VR,"createFrame");function R$(t,e){switch(e){case Ki.string:return Buffer.from(t);case Ki.arrayBuffer:case Ki.blob:return new YR(t);case Ki.typedArray:return new YR(t.buffer,t.byteOffset,t.byteLength)}}o(R$,"toBuffer");HR.exports={SendQueue:Np}});var nk=T((T4,tk)=>{"use strict";var{webidl:re}=je(),{URLSerializer:k$}=ht(),{environmentSettingsObject:qR}=Qt(),{staticPropertyDescriptors:Dr,states:Ma,sentCloseFrameState:S$,sendHints:Bu}=Ss(),{kWebSocketURL:jR,kReadyState:Fp,kController:WR,kBinaryType:wu,kResponse:zR,kSentClose:v$,kByteParser:x$}=ka(),{isConnecting:D$,isEstablished:T$,isClosing:N$,isValidSubprotocol:F$,fireEvent:ZR}=xa(),{establishWebSocketConnection:U$,closeWebSocketConnection:KR}=Rp(),{ByteParser:M$}=GR(),{kEnumerableProperty:Vt,isBlobLike:XR}=ue(),{getGlobalDispatcher:L$}=Ea(),{types:ek}=require("node:util"),{ErrorEvent:_$,CloseEvent:P$}=ji(),{SendQueue:O$}=JR(),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=qR.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=>F$(l)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this[jR]=new URL(a.href);let c=qR.settingsObject;this[WR]=U$(a,n,c,this,(l,d)=>this.#r(l,d),s),this[Fp]=t.CONNECTING,this[v$]=S$.NOT_SENT,this[wu]="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");KR(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"),D$(this))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!T$(this)||N$(this)))if(typeof e=="string"){let r=Buffer.byteLength(e);this.#t+=r,this.#i.add(e,()=>{this.#t-=r},Bu.string)}else ek.isArrayBuffer(e)?(this.#t+=e.byteLength,this.#i.add(e,()=>{this.#t-=e.byteLength},Bu.arrayBuffer)):ArrayBuffer.isView(e)?(this.#t+=e.byteLength,this.#i.add(e,()=>{this.#t-=e.byteLength},Bu.typedArray)):XR(e)&&(this.#t+=e.size,this.#i.add(e,()=>{this.#t-=e.size},Bu.blob))}get readyState(){return re.brandCheck(this,t),this[Fp]}get bufferedAmount(){return re.brandCheck(this,t),this.#t}get url(){return re.brandCheck(this,t),k$(this[jR])}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[wu]}set binaryType(e){re.brandCheck(this,t),e!=="blob"&&e!=="arraybuffer"?this[wu]="blob":this[wu]=e}#r(e,n){this[zR]=e;let r=this[WR]?.dispatcher?.webSocketOptions,s=r?.maxFragments,i=r?.maxPayloadSize,a=new M$(this,n,{maxFragments:s,maxPayloadSize:i});a.on("drain",G$),a.on("error",$$.bind(this)),e.socket.ws=this,this[x$]=a,this.#i=new O$(e.socket),this[Fp]=Ma.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),ZR("open",this)}};Dt.CONNECTING=Dt.prototype.CONNECTING=Ma.CONNECTING;Dt.OPEN=Dt.prototype.OPEN=Ma.OPEN;Dt.CLOSING=Dt.prototype.CLOSING=Ma.CLOSING;Dt.CLOSED=Dt.prototype.CLOSED=Ma.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(()=>L$(),"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(XR(t))return re.converters.Blob(t,{strict:!1});if(ArrayBuffer.isView(t)||ek.isArrayBuffer(t))return re.converters.BufferSource(t)}return re.converters.USVString(t)};function G$(){this.ws[zR].socket.resume()}o(G$,"onParserDrain");function $$(t){let e,n;t instanceof P$?(e=t.reason,n=t.code):e=t.message,ZR("error",this,()=>new _$("error",{error:t,message:e})),KR(this,n)}o($$,"onParserError");tk.exports={WebSocket:Dt}});var Up=T((F4,rk)=>{"use strict";function Y$(t){return t.indexOf("\0")===-1}o(Y$,"isValidLastEventId");function V$(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(V$,"isASCIINumber");function H$(t){return new Promise(e=>{setTimeout(e,t).unref()})}o(H$,"delay");rk.exports={isValidLastEventId:Y$,isASCIINumber:V$,delay:H$}});var ik=T((M4,sk)=>{"use strict";var J$=require("node:buffer"),{Transform:q$}=require("node:stream"),{isASCIINumber:j$,isValidLastEventId:W$}=Up(),Xi=[239,187,191],bu=10,La=13,z$=58,Z$=32,K$=J$.kStringMaxLength,X$=Buffer.from("data"),eY=Buffer.from("event"),tY=Buffer.from("id"),nY=Buffer.from("retry"),rY=1024,sY=131072,iY=128;function oY(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(oY,"isASCIINumberBytes");function aY(t,e){for(let n=e;n<t.length;n++)if(t[n]===0)return!1;return!0}o(aY,"isValidLastEventIdBytes");function Ru(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(Ru,"isFieldName");function ku(){let t=new Error("EventSource message size exceeded");return t.aborted=!1,t}o(ku,"createMaxEventSizeExceededError");var Mp=class extends q${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??K$;let n=this.maxEventSize>0?Math.min(sY,Math.max(rY,Math.floor(this.maxEventSize/iY))):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]!==bu&&e[0]!==La){r(ku());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===bu){this.crlfCheck=!1,this.consumeCurrentByte();continue}this.crlfCheck=!1}if(s===bu||s===La){s===La&&(this.crlfCheck=!0),this.consumeCurrentByte(),this.hasPendingEvent()&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1;continue}if(s===bu||s===La){s===La&&(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(ku());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(z$);if(r===0)return;let s=e.length,i=e.length;if(r!==-1&&(s=r,i=r+1,e[i]===Z$&&++i),Ru(e,s,X$)){if(this.maxEventSize>0&&this.dataLineCount>=this.maxDataLines)throw ku();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(Ru(e,s,nY)){oY(e,i)&&(this.setEventFieldSize("retry",e.length-i),n.retry=e.toString("utf8",i));return}if(Ru(e,s,tY)){aY(e,i)&&(this.setEventFieldSize("id",e.length-i),n.id=e.toString("utf8",i));return}Ru(e,s,eY)&&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 ku();this.eventSize=r,this.eventFieldSizes[e]=n}processEvent(e){e.retry&&j$(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id&&W$(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===Xi[0]||(this.checkBOM=!1),!0):r===void 0?e===Xi[0]&&n===Xi[1]?!0:(this.checkBOM=!1,!1):(e===Xi[0]&&n===Xi[1]&&r===Xi[2]&&this.discardLeadingBytes(3),this.checkBOM=!1,!this.hasCurrentByte())}};sk.exports={EventSourceStream:Mp}});var hk=T((_4,dk)=>{"use strict";var{pipeline:AY}=require("node:stream"),{fetching:cY}=Ba(),{makeRequest:uY}=$i(),{webidl:zn}=je(),{EventSourceStream:lY}=ik(),{parseMIMEType:dY}=ht(),{createFastMessageEvent:hY}=ji(),{isNetworkError:ok}=ya(),{delay:gY}=Up(),{kEnumerableProperty:vs}=ue(),{environmentSettingsObject:ak}=Qt(),{getGlobalDispatcher:pY}=Ea(),Ak=!1,ck=3e3,_a=0,uk=1,Pa=2,fY="anonymous",mY="use-credentials",eo=class t extends EventTarget{static{o(this,"EventSource")}#e={open:null,error:null,message:null};#t=null;#n=!1;#s=_a;#i=null;#r=null;#o;#a;constructor(e,n={}){super(),zn.util.markAsUncloneable(this);let r="EventSource constructor";zn.argumentLengthCheck(arguments,1,r),Ak||(Ak=!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:ck};let s=ak,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=fY;n.withCredentials&&(a=mY,this.#n=!0);let c={redirect:"follow",keepalive:!0,mode:"cors",credentials:a==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};c.client=ak.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=uY(c),this.#c()}get readyState(){return this.#s}get url(){return this.#t}get withCredentials(){return this.#n}#c(){if(this.#s===Pa)return;this.#s=_a;let e={request:this.#i,dispatcher:this.#o},n=o(r=>{ok(r)&&(this.dispatchEvent(new Event("error")),this.close()),this.#A()},"processEventSourceEndOfBody");e.processResponseEndOfBody=n,e.processResponse=r=>{if(ok(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?dY(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=uk,this.dispatchEvent(new Event("open")),this.#a.origin=r.urlList[r.urlList.length-1].origin;let c=new lY({eventSourceSettings:this.#a,maxEventSize:this.#o.eventSourceOptions?.maxEventSize,push:o(l=>{this.dispatchEvent(hY(l.type,l.options))},"push")});AY(r.body.stream,c,l=>{l?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#r=cY(e)}async#A(){this.#s!==Pa&&(this.#s=_a,this.dispatchEvent(new Event("error")),await gY(this.#a.reconnectionTime),this.#s===_a&&(this.#a.lastEventId.length&&this.#i.headersList.set("last-event-id",this.#a.lastEventId,!0),this.#c()))}close(){zn.brandCheck(this,t),this.#s!==Pa&&(this.#s=Pa,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}},lk={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:_a,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:uk,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:Pa,writable:!1}};Object.defineProperties(eo,lk);Object.defineProperties(eo.prototype,lk);Object.defineProperties(eo.prototype,{close:vs,onerror:vs,onmessage:vs,onopen:vs,readyState:vs,url:vs,withCredentials:vs});zn.converters.EventSourceInitDict=zn.dictionaryConverter([{key:"withCredentials",converter:zn.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"dispatcher",converter:zn.converters.any,defaultValue:o(()=>pY(),"defaultValue")}]);dk.exports={EventSource:eo,defaultReconnectionTime:ck}});var mk=T((O4,ne)=>{"use strict";var EY=Si(),gk=Oo(),CY=vi(),IY=gQ(),yY=xi(),QY=rg(),BY=_Q(),wY=HQ(),pk=pe(),vu=ue(),{InvalidArgumentError:Su}=pk,to=DB(),bY=$o(),RY=_g(),kY=hw(),SY=Gg(),vY=bg(),xY=xc(),{getGlobalDispatcher:fk,setGlobalDispatcher:DY}=Ea(),TY=Oc(),NY=Cc(),FY=Ic();Object.assign(gk.prototype,to);ne.exports.Dispatcher=gk;ne.exports.Client=EY;ne.exports.Pool=CY;ne.exports.BalancedPool=IY;ne.exports.Agent=yY;ne.exports.ProxyAgent=QY;ne.exports.EnvHttpProxyAgent=BY;ne.exports.RetryAgent=wY;ne.exports.RetryHandler=xY;ne.exports.DecoratorHandler=TY;ne.exports.RedirectHandler=NY;ne.exports.createRedirectInterceptor=FY;ne.exports.interceptors={redirect:Iw(),retry:Qw(),dump:ww(),dns:kw()};ne.exports.buildConnector=bY;ne.exports.errors=pk;ne.exports.util={parseHeaders:vu.parseHeaders,headerNameToString:vu.headerNameToString};function Oa(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 Su("invalid url");if(n!=null&&typeof n!="object")throw new Su("invalid opts");if(n&&n.path!=null){if(typeof n.path!="string")throw new Su("invalid opts.path");let a=n.path;n.path.startsWith("/")||(a=`/${a}`),e=new URL(vu.parseOrigin(e).origin+a)}else n||(n=typeof e=="object"?e:{}),e=vu.parseURL(e);let{agent:s,dispatcher:i=fk()}=n;if(s)throw new Su("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(Oa,"makeDispatcher");ne.exports.setGlobalDispatcher=DY;ne.exports.getGlobalDispatcher=fk;var UY=Ba().fetch;ne.exports.fetch=o(async function(e,n=void 0){try{return await UY(e,n)}catch(r){throw r&&typeof r=="object"&&Error.captureStackTrace(r),r}},"fetch");ne.exports.Headers=Qs().Headers;ne.exports.Response=ya().Response;ne.exports.Request=$i().Request;ne.exports.FormData=Wo().FormData;ne.exports.File=globalThis.File??require("node:buffer").File;ne.exports.FileReader=Yb().FileReader;var{setGlobalOrigin:MY,getGlobalOrigin:LY}=nh();ne.exports.setGlobalOrigin=MY;ne.exports.getGlobalOrigin=LY;var{CacheStorage:_Y}=Kb(),{kConstruct:PY}=au();ne.exports.caches=new _Y(PY);var{deleteCookie:OY,getCookies:GY,getSetCookies:$Y,setCookie:YY}=cR();ne.exports.deleteCookie=OY;ne.exports.getCookies=GY;ne.exports.getSetCookies=$Y;ne.exports.setCookie=YY;var{parseMIMEType:VY,serializeAMimeType:HY}=ht();ne.exports.parseMIMEType=VY;ne.exports.serializeAMimeType=HY;var{CloseEvent:JY,ErrorEvent:qY,MessageEvent:jY}=ji();ne.exports.WebSocket=nk().WebSocket;ne.exports.CloseEvent=JY;ne.exports.ErrorEvent=qY;ne.exports.MessageEvent=jY;ne.exports.request=Oa(to.request);ne.exports.stream=Oa(to.stream);ne.exports.pipeline=Oa(to.pipeline);ne.exports.connect=Oa(to.connect);ne.exports.upgrade=Oa(to.upgrade);ne.exports.MockClient=RY;ne.exports.MockPool=SY;ne.exports.MockAgent=kY;ne.exports.mockErrors=vY;var{EventSource:WY}=hk();ne.exports.EventSource=WY});var O2={};qp(O2,{AppRefusal:()=>on,AppUnreachable:()=>xs,AttemptEndReason:()=>Co,DeliveryStatus:()=>hA,GitHubWriteKind:()=>fA,NoReportCause:()=>Io,SourceProvider:()=>Js,V3Attempt:()=>Ha,ValidationSufficiency:()=>Zr,closedV3Attempt:()=>Uk,endV3Attempt:()=>_k,heartbeatV3Attempt:()=>Jp,startV3Attempt:()=>Fk,uploadV3Report:()=>Lk});module.exports=Vk(O2);var A={};qp(A,{BRAND:()=>fS,DIRTY:()=>Fr,EMPTY_PATH:()=>jk,INVALID:()=>Z,NEVER:()=>ev,OK:()=>We,ParseStatus:()=>He,Schema:()=>Ae,ZodAny:()=>sr,ZodArray:()=>vn,ZodBigInt:()=>Mr,ZodBoolean:()=>Lr,ZodBranded:()=>ho,ZodCatch:()=>jr,ZodDate:()=>_r,ZodDefault:()=>qr,ZodDiscriminatedUnion:()=>rA,ZodEffects:()=>Mt,ZodEnum:()=>Hr,ZodError:()=>ct,ZodFirstPartyTypeKind:()=>ee,ZodFunction:()=>iA,ZodIntersection:()=>$r,ZodIssueCode:()=>N,ZodLazy:()=>Yr,ZodLiteral:()=>Vr,ZodMap:()=>Ps,ZodNaN:()=>Gs,ZodNativeEnum:()=>Jr,ZodNever:()=>Jt,ZodNull:()=>Or,ZodNullable:()=>ln,ZodNumber:()=>Ur,ZodObject:()=>ut,ZodOptional:()=>Ft,ZodParsedType:()=>O,ZodPipeline:()=>go,ZodPromise:()=>ir,ZodReadonly:()=>Wr,ZodRecord:()=>sA,ZodSchema:()=>Ae,ZodSet:()=>Os,ZodString:()=>rr,ZodSymbol:()=>Ls,ZodTransformer:()=>Mt,ZodTuple:()=>un,ZodType:()=>Ae,ZodUndefined:()=>Pr,ZodUnion:()=>Gr,ZodUnknown:()=>Sn,ZodVoid:()=>_s,addIssueToContext:()=>_,any:()=>bS,array:()=>vS,bigint:()=>IS,boolean:()=>of,coerce:()=>XS,custom:()=>nf,date:()=>yS,datetimeRegex:()=>ef,defaultErrorMap:()=>Rn,discriminatedUnion:()=>NS,effect:()=>HS,enum:()=>$S,function:()=>PS,getErrorMap:()=>Fs,getParsedType:()=>cn,instanceof:()=>ES,intersection:()=>FS,isAborted:()=>tA,isAsync:()=>Us,isDirty:()=>nA,isValid:()=>nr,late:()=>mS,lazy:()=>OS,literal:()=>GS,makeIssue:()=>lo,map:()=>LS,nan:()=>CS,nativeEnum:()=>YS,never:()=>kS,null:()=>wS,nullable:()=>qS,number:()=>sf,object:()=>xS,objectUtil:()=>Gu,oboolean:()=>KS,onumber:()=>ZS,optional:()=>JS,ostring:()=>zS,pipeline:()=>WS,preprocess:()=>jS,promise:()=>VS,quotelessJson:()=>Hk,record:()=>MS,set:()=>_S,setErrorMap:()=>qk,strictObject:()=>DS,string:()=>rf,symbol:()=>QS,transformer:()=>HS,tuple:()=>US,undefined:()=>BS,union:()=>TS,unknown:()=>RS,util:()=>le,void:()=>SS});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 Gu;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Gu||(Gu={}));var O=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),cn=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"]),Hk=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];l===a.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(n(a))):c[d]=c[d]||{_errors:[]},c=c[d],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={},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 Jk=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"),Rn=Jk;var Wp=Rn;function qk(t){Wp=t}o(qk,"setErrorMap");function Fs(){return Wp}o(Fs,"getErrorMap");var lo=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"),jk=[];function _(t,e){let n=Fs(),r=lo({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Rn?void 0:Rn].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"),tA=o(t=>t.status==="aborted","isAborted"),nA=o(t=>t.status==="dirty","isDirty"),nr=o(t=>t.status==="valid","isValid"),Us=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 cn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:cn(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:cn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Us(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:cn(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:cn(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:cn(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Us(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 ln.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vn.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 ho({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 go.create(this,e)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Wk=/^c[^\s-]{8,}$/i,zk=/^[0-9a-z]+$/,Zk=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Kk=/^[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,Xk=/^[a-z0-9_-]{21}$/i,eS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tS=/^[-+]?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)?)??$/,nS=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",$u,sS=/^(?:(?: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])$/,iS=/^(?:(?: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])$/,oS=/^(([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]))$/,aS=/^(([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])$/,AS=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,cS=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Kp="((\\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])))",uS=new RegExp(`^${Kp}$`);function Xp(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(Xp,"timeRegexSource");function lS(t){return new RegExp(`^${Xp(t)}$`)}o(lS,"timeRegex");function ef(t){let e=`${Kp}T${Xp(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(ef,"datetimeRegex");function dS(t,e){return!!((e==="v4"||!e)&&sS.test(t)||(e==="v6"||!e)&&oS.test(t))}o(dS,"isValidIP");function hS(t,e){if(!eS.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(hS,"isValidJWT");function gS(t,e){return!!((e==="v4"||!e)&&iS.test(t)||(e==="v6"||!e)&&aS.test(t))}o(gS,"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")nS.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")$u||($u=new RegExp(rS,"u")),$u.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")Kk.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")Xk.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")Wk.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")zk.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")Zk.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"?ef(i).test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?uS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?lS(i).test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?tS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"duration",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?dS(e.data,i.version)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"ip",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?hS(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"jwt",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?gS(e.data,i.version)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"cidr",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?AS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"base64",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?cS.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 pS(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(pS,"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"?pS(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 Ls=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)}};Ls.create=t=>new Ls({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 Sn=class extends Ae{static{o(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(e){return We(e.data)}};Sn.create=t=>new Sn({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 _s=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)}};_s.create=t=>new _s({typeName:ee.ZodVoid,...ie(t)});var vn=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)}};vn.create=(t,e)=>new vn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ee.ZodArray,...ie(e)});function Ms(t){if(t instanceof ut){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Ft.create(Ms(r))}return new ut({...t._def,shape:o(()=>e,"shape")})}else return t instanceof vn?new vn({...t._def,type:Ms(t.element)}):t instanceof Ft?Ft.create(Ms(t.unwrap())):t instanceof ln?ln.create(Ms(t.unwrap())):t instanceof un?un.create(t.items.map(e=>Ms(e))):t}o(Ms,"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 Ms(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 tf(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 kn=o(t=>t instanceof Yr?kn(t.schema):t instanceof Mt?kn(t.innerType()):t instanceof Vr?[t.value]:t instanceof Hr?t.options:t instanceof Jr?le.objectValues(t.enum):t instanceof qr?kn(t._def.innerType):t instanceof Pr?[void 0]:t instanceof Or?[null]:t instanceof Ft?[void 0,...kn(t.unwrap())]:t instanceof ln?[null,...kn(t.unwrap())]:t instanceof ho||t instanceof Wr?kn(t.unwrap()):t instanceof jr?kn(t._def.innerType):[],"getDiscriminator"),rA=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=kn(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 Yu(t,e){let n=cn(t),r=cn(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};for(let c of i){let l=Yu(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=Yu(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(Yu,"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(tA(i)||tA(a))return Z;let c=Yu(i.value,a.value);return c.valid?((nA(i)||nA(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 un=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})}};un.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new un({items:t,typeName:ee.ZodTuple,rest:null,...ie(e)})};var sA=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)})}},Ps=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}}}};Ps.create=(t,e,n)=>new Ps({valueType:e,keyType:t,typeName:ee.ZodMap,...ie(n)});var Os=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)}};Os.create=(t,e)=>new Os({valueType:t,minSize:null,maxSize:null,typeName:ee.ZodSet,...ie(e)});var iA=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 lo({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Fs(),Rn].filter(d=>!!d),issueData:{code:N.invalid_arguments,argumentsError:l}})}o(r,"makeArgsIssue");function s(c,l){return lo({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Fs(),Rn].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:un.create(e).rest(Sn.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||un.create([]).rest(Sn.create()),returns:n||Sn.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 tf(t,e){return new Hr({values:t,typeName:ee.ZodEnum,...ie(e)})}o(tf,"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=tf;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 ln=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}};ln.create=(t,e)=>new ln({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 Us(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 Gs=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}}};Gs.create=t=>new Gs({typeName:ee.ZodNaN,...ie(t)});var fS=Symbol("zod_brand"),ho=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}},go=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 Us(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 Zp(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}o(Zp,"cleanParams");function nf(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=Zp(e,r),l=c.fatal??n??!0;s.addIssue({code:"custom",...c,fatal:l})}});if(!i){let a=Zp(e,r),c=a.fatal??n??!0;s.addIssue({code:"custom",...a,fatal:c})}}):sr.create()}o(nf,"custom");var mS={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 ES=o((t,e={message:`Input not instance of ${t.name}`})=>nf(n=>n instanceof t,e),"instanceOfType"),rf=rr.create,sf=Ur.create,CS=Gs.create,IS=Mr.create,of=Lr.create,yS=_r.create,QS=Ls.create,BS=Pr.create,wS=Or.create,bS=sr.create,RS=Sn.create,kS=Jt.create,SS=_s.create,vS=vn.create,xS=ut.create,DS=ut.strictCreate,TS=Gr.create,NS=rA.create,FS=$r.create,US=un.create,MS=sA.create,LS=Ps.create,_S=Os.create,PS=iA.create,OS=Yr.create,GS=Vr.create,$S=Hr.create,YS=Jr.create,VS=ir.create,HS=Mt.create,JS=Ft.create,qS=ln.create,jS=Mt.createWithPreprocess,WS=go.create,zS=o(()=>rf().optional(),"ostring"),ZS=o(()=>sf().optional(),"onumber"),KS=o(()=>of().optional(),"oboolean"),XS={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 ev=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 Vu=o(t=>`${t.source}:${t.site??""}:${t.key}`,"requirementItemId");var oA=/^pasted-[0-9a-f]{16}$/,po=/^file-[0-9a-f]{16}$/,fo=(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))(fo||{});var Hu=(r=>(r.New="new",r.Updated="updated",r.Existing="existing",r))(Hu||{}),Zr=(r=>(r.Sufficient="sufficient",r.Insufficient="insufficient",r.NoChange="no_change",r))(Zr||{}),$s=(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))($s||{}),or=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(or||{}),Ju=(r=>(r.Application="application",r.Environment="environment",r.TestDefect="test_defect",r))(Ju||{}),qu=(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))(qu||{});var aA=(n=>(n.Probe="probe",n.Agent="agent",n))(aA||{}),AA=(r=>(r.Seed="seed",r.RuntimeMock="runtime_mock",r.EnvOverride="env_override",r))(AA||{}),cA=(r=>(r.TestCode="test_code",r.SkyrampMocker="skyramp_mocker",r.RecipeOverride="recipe_override",r))(cA||{});var ju=(n=>(n.Ready="ready",n.Blocked="blocked",n))(ju||{}),Ne=A.string().trim().min(1),tv=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"}),nv=/^[A-Za-z_][A-Za-z0-9_]*$/,mo=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,Ys=(a=>(a.VersionEndpoint="version_endpoint",a.DeployWorkflow="deploy_workflow",a.KubernetesLabels="kubernetes_labels",a.Command="command",a.Api="api",a.NotTracked="not_tracked",a))(Ys||{}),dn="shared",rv=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"),Vs=A.object({address:rv,readyWhen:Ne.nullable(),credentials:A.array(A.string().regex(mo)).max(50),revisionSources:A.array(A.object({method:A.nativeEnum(Ys),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(),Wu={steps:A.array(tv).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(nv)).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")},sv=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(),...Wu,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')}),iv=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")}),ov=A.object({framework:Ne,file:Ne.describe("the test file run, relative to its repository root"),result:A.enum(["pass","fail","error"])}),av=A.object({input:Ne.describe("the part of the user's SUT input, as given"),reason:Ne}),BV=A.object({schemaVersion:A.literal(1),status:A.nativeEnum(ju).describe("ready only if every component came up healthy and the recipe is written"),components:A.array(sv),suites:A.array(ov).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(av).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 (SKYR-5265)"),blockers:A.array(iv).describe("required (non-empty) when status is blocked"),environment:Vs.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,Zu=512*1024,af=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var cf=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),Av=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")}),Ku=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"),Af=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:Av.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:Ku.optional()});var ze=A.string().trim().min(1),Xu=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(Xu||{}),el=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],uf=A.object({schemaVersion:A.literal(1),type:A.nativeEnum(Xu).optional(),status:A.enum(["ready","blocked"]),environment:Vs.optional(),components:A.array(A.object({name:ze,repository:ze.describe(`owner/repo, or "${dn}" for a customer-deployed component no repository builds`),healthy:A.boolean(),url:A.string().min(1).nullable(),...Wu,credentials:A.array(A.string().regex(mo)).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===dn&&!n&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"repository"],message:`only a customer_deployed component is ${dn}`})}),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)=>{el.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!==dn&&!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 TV=["clean","recipe-drift"];function uA(t){let e=cf.posix.normalize(t);return e===t&&(e===".skyramp/workspace.yml"||e.startsWith(".skyramp/sut/")&&e.length>13)}o(uA,"isRuntimePlanFile");var Js=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(Js||{}),sl=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(sl||{}),il=(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))(il||{}),cv=["sut_setup"],uv=["sut_setup","schedule","revision_read"],lv=["sut_setup"],ol=(e=>(e.PullRequest="pull_request",e))(ol||{}),Rf=(s=>(s.ModelProvider="model_provider",s.SutAccess="sut_access",s.Skyramp="skyramp",s.Other="other",s))(Rf||{}),hA=(s=>(s.None="none",s.Delivered="delivered",s.Partial="partial",s.Failed="failed",s))(hA||{}),Co=(i=>(i.ReportUploaded="report_uploaded",i.NoReport="no_report",i.Cancelled="cancelled",i.RecipeUploaded="recipe_uploaded",i.RevisionsUploaded="revisions_uploaded",i))(Co||{}),kf=(n=>(n.Running="running",n.Ended="ended",n))(kf||{}),Io=(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))(Io||{}),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||{}),Al=(s=>(s.Found="found",s.Starting="starting",s.Up="up",s.OutOfScope="out_of_scope",s))(Al||{}),qt=A.string().regex(/^[1-9][0-9]{0,18}$/),Dn=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(),gA={provider:A.literal("github"),providerAccountId:qt,providerRepositoryId:qt},pA={provider:A.literal("azure-devops"),providerAccountId:tt,providerRepositoryId:tt},Tn=A.discriminatedUnion("provider",[A.object(gA).strict(),A.object(pA).strict()]),cl=A.discriminatedUnion("provider",[A.object(gA).passthrough(),A.object(pA).passthrough()]),Nn=o(t=>`${t.provider}:${t.providerRepositoryId}`,"sourceKey"),lf={namespace:A.string().min(1),name:A.string().min(1)},Nf=A.discriminatedUnion("provider",[A.object({...gA,...lf}).strict(),A.object({...pA,...lf}).strict()]),df=A.object({ref:A.string().min(1),revision:Dn}).strict(),dv=A.object({repository:Nf,revision:Dn,ref:A.string().nullable(),reason:A.nativeEnum(sl),change:A.object({kind:A.nativeEnum(ol),number:qt,base:df.optional()}).strict().nullable(),compareWith:df.optional()}).strict();function hv(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=>Nn(l.repository))),a=new Set(r.map(l=>Nn(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(hv,"baselineSourcesIssue");var Ff=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,Uf=/^[1-9][0-9]{0,18}$/,hf=new RegExp(`${Ff.source}|${Uf.source}`),gf=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,gv=A.union([A.object({source:A.literal("jira"),site:A.string().regex(gf),key:A.string().regex(Ff),updated:A.string().datetime(),contentHash:nt}).strict(),A.object({source:A.literal("confluence"),site:A.string().regex(gf),key:A.string().regex(Uf),version:A.number().int().positive(),contentHash:nt}).strict(),A.object({source:A.literal("other"),key:A.string().regex(oA),contentHash:nt}).strict(),A.object({source:A.literal("other"),key:A.string().regex(po),contentHash:nt,fileName:A.string().min(1).max(255),mediaType:A.nativeEnum(fo)}).strict()]),pf=A.union([A.literal("jira"),A.literal("confluence")]),pv=A.object({schemaVersion:A.literal(1),items:A.array(A.union([A.object({source:pf,site:A.string(),key:A.string().regex(hf),state:A.literal("read"),text:A.string(),version:A.string().min(1),contentMatches:A.boolean()}).strict(),A.object({source:pf,site:A.string(),key:A.string().regex(hf),state:A.literal("not_read"),reason:A.nativeEnum(zr)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(oA),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(oA),state:A.literal("not_read"),reason:A.nativeEnum(zr)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(po),state:A.literal("read"),version:nt,fileName:A.string().min(1).max(255),mediaType:A.nativeEnum(fo)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(po),state:A.literal("not_read"),reason:A.nativeEnum(zr)}).strict()])),instructions:A.array(A.string()).optional()}).strict(),fv=A.object({schemaVersion:A.literal(1),runId:tt,skyrampOrgId:tt,target:lA,policy:lA.nullable(),trigger:A.object({kind:A.nativeEnum(il),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:Tn,revision:Dn}).strict()).optional()}).strict().optional(),sources:A.array(dv).min(1),execution:A.object({provider:A.nativeEnum(Js),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(gv).min(1).optional(),instructions:A.object({contentHash:nt}).strict().optional(),deployedRevisions:A.array(A.object({repository:Tn,revision:Dn}).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=Vu({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=cv.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=hv(t);i&&e.addIssue({code:A.ZodIssueCode.custom,path:t.baseline?["baseline","sources"]:["baseline"],message:i}),uv.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=>Nn(l.repository))),c=new Set;(t.deployedRevisions??[]).forEach((l,d)=>{let h=Nn(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||{}),mv=A.object({kind:A.nativeEnum(Mf),name:A.string().min(1).max(256)}).strict(),Ev=A.object({schemaVersion:A.literal(1),attempt:A.object({id:tt,number:A.number().int().positive(),deadlineAt:A.string().datetime()}).strict(),manifest:fv,manifestHash:nt,entitlements:A.array(A.string()).optional(),runToken:A.string().min(1).optional(),requestedBy:mv.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:Tn,revision:Dn}).strict()).optional(),statedRevisions:A.array(A.object({repository:Tn,revision:Dn}).strict()).optional()}).strict(),ff={providerRunAttempt:A.number().int().positive(),workflowRef:A.string().min(1)},Cv=A.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),Iv=A.object({schemaVersion:A.literal(1),runId:tt,execution:A.discriminatedUnion("provider",[A.object({...ff,provider:A.literal("github"),repository:A.object(gA).strict(),providerRunId:qt}).strict(),A.object({...ff,provider:A.literal("azure-devops"),repository:A.object(pA).strict(),providerRunId:Cv}).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()}).strict(),mf=A.object({repository:Tn,number:qt}).strict(),yv=A.discriminatedUnion("status",[A.object({status:A.literal("none")}).strict(),A.object({status:A.literal("delivered"),pullRequests:A.array(mf).min(1)}).strict(),A.object({status:A.literal("partial"),pullRequests:A.array(mf).min(1),failures:A.array(A.object({repository:Tn,message:A.string()}).strict()).min(1)}).strict(),A.object({status:A.literal("failed"),message:A.string()}).strict()]),Qv=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:Dn,reference:A.string().min(1),summary:A.string().min(1)}).strict()),actionRequired:A.array(A.nativeEnum($s))}).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"})}),tl=500,Bv=2048,wv=1e3,bv=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,Ef=o(t=>t.length>0&&t.length<=64&&t===t.trim()&&!bv.test(t)&&!/[^\S ]/u.test(t)&&!/^[._]/.test(t)&&!t.endsWith("."),"isAzureName"),Rv=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)&&Ef(n)&&Ef(r)},"isResultRepository"),kv=A.object({testResults:A.array(A.object({resultId:A.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:A.string().refine(Rv,"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(Ju),family:A.nativeEnum(qu).optional()}).strict().optional(),origin:A.nativeEnum(Hu).optional()}).strict()),validation:Qv,changes:A.array(A.object({id:A.string().min(1).max(512),text:A.string().max(16384),source:A.string().max(Bv),testedBy:A.array(A.string().min(1).max(1024)).max(tl),writtenBy:A.array(A.string().min(1).max(1024)).max(tl),maintainedBy:A.array(A.string().min(1).max(1024)).max(tl)}).strict()).max(wv).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)})}),Cf=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}:${Cf(a)}`;return r?`${c}#${Cf(r)}`:c}o(Lf,"testResultId");var fA=(r=>(r.BranchPushed="branch_pushed",r.PullRequestOpened="pull_request_opened",r.PullRequestEdited="pull_request_edited",r))(fA||{}),_f=50,If=A.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),Pf=A.discriminatedUnion("kind",[A.object({kind:A.literal("branch_pushed"),repository:Tn,branch:If,commit:Dn}).strict(),A.object({kind:A.enum(["pull_request_opened","pull_request_edited"]),repository:Tn,number:qt,branch:If}).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:Tn,revision:Dn}).strict()),firstQualification:A.literal(!0).optional()}).strict(),delivery:A.object({generatedTests:yv}).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:kv,githubWrites:A.array(Pf).max(_f).optional()}).strict(),OV=Of.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:uf}).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)=>{uA(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>Zu&&n(["files"],`recipe text over ${Zu} bytes in total`)}),GV=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 Sv=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"}),mA=100,vv=5e3,Eo=2e3,yf=100,Gf=/^[A-Za-z0-9_-]{1,64}$/,xv=20,Dv=200,Tv=100,Nv=100,Fv=200,Qf="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",Uv=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${Qf}/${Qf})$`),Mv=500,Lv=50,_v=/[\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&&!_v.test(e),"blank, or not text"),"setupText"),xn={sequence:A.number().int().min(1).max(vv),at:A.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},Pv=A.discriminatedUnion("kind",[A.object({...xn,kind:A.literal("log"),phase:A.nativeEnum(al),text:Lt(Eo)}).strict(),A.object({...xn,kind:A.literal("component"),name:Lt(yf),repository:Lt(Fv).refine(t=>Uv.test(t)||t===dn,"not owner/name"),file:Lt(Mv).nullable(),status:A.nativeEnum(Al),version:Lt(Nv).optional()}).strict(),A.object({...xn,kind:A.literal("reply"),to:A.string().uuid(),accepted:A.boolean(),text:Lt(Eo)}).strict(),A.object({...xn,kind:A.literal("question"),id:A.string().regex(Gf),type:A.nativeEnum(Df),text:Lt(Eo),component:Lt(yf).nullable(),choices:A.array(Lt(Dv)).max(xv),placeholder:Lt(Tv).optional()}).strict(),A.object({...xn,kind:A.literal("delivered"),ids:A.array(A.string().uuid()).max(mA)}).strict(),A.object({...xn,kind:A.literal("credentials"),names:A.array(A.string().regex(mo)).min(1).max(Lv)}).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"}))}),Ov=A.object({schemaVersion:A.literal(1),events:A.array(Pv).max(mA)}).strict(),Gv=A.discriminatedUnion("kind",[A.object({...xn,kind:A.literal("log"),stage:A.nativeEnum(Tf),text:Lt(Eo)}).strict(),A.object({...xn,kind:A.literal("reply"),to:A.string().uuid(),accepted:A.boolean(),text:Lt(Eo)}).strict(),A.object({...xn,kind:A.literal("delivered"),ids:A.array(A.string().uuid()).max(mA)}).strict()]),$v=A.object({schemaVersion:A.literal(1),events:A.array(Gv).max(mA)}).strict(),Bf={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({...Bf,kind:A.literal("instruction"),question:A.null()}),A.object({...Bf,kind:A.literal("answer"),question:A.string().regex(Gf)})]),Yf=A.string().regex(/^[A-Za-z0-9+/]{43}=$/),Yv=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()}),Vv=A.object({schemaVersion:A.literal(1),leftOut:A.array(A.string()),messages:A.array($f).optional(),stop:A.object({key:Yf}).optional(),notes:Yv.optional()}),Hv=A.object({schemaVersion:A.literal(1),messages:A.array($f).optional()});var Jv=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(),qv=A.object({schemaVersion:A.literal(1),artifact:Vf,sessionId:tt,contentHash:nt,bytes:A.number().int().min(1).max(Jv)}).strict(),jv=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(),Wv=200,Hs=100,Hf=(r=>(r.Resume="resume",r.Retry="retry",r.Update="update",r))(Hf||{}),zv=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(Al)}).strict()).max(Hs),credentials:A.array(A.string().min(1)).max(Hs),answers:A.array(A.object({question:A.string(),answer:A.string().nullable()}).strict()).max(Hs),instructions:A.array(A.object({text:A.string(),reply:A.string().nullable()}).strict()).max(Hs),log:A.array(A.object({phase:A.nativeEnum(al),text:A.string()}).strict()).max(Wv),recipe:A.object({files:A.array(A.object({path:A.string().min(1),content:A.string()}).strict()).max(Hs),blockers:A.array(A.object({component:A.string(),problem:A.string(),evidence:A.string(),fix:A.string()}).strict()).max(Hs)}).strict().optional()}).strict(),Zv=A.object({schemaVersion:A.literal(1),context:zv.nullable()}).strict(),Kv=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(),Xv=Vs.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=>uA(t)&&!el.includes(t),"not a file of a customer_deployed plan"),content:A.string()}).strict()).optional()}).strict(),e0=A.object({schemaVersion:A.literal(1),testEnvironment:Xv.nullable().optional(),runtimePlan:A.object({version:A.number().int().positive(),contentHash:nt,files:A.array(A.object({path:A.string().refine(uA,"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(Co).nullable(),cause:A.nativeEnum(Io).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 nl(t){if(typeof t=="number"&&!Number.isFinite(t))throw new TypeError("Canonical JSON requires JSON values");if(Array.isArray(t))return`[${t.map(nl).join(",")}]`;if(t!==null&&typeof t=="object"){let n=t;return`{${Object.keys(n).sort().map(r=>`${JSON.stringify(r)}:${nl(n[r])}`).join(",")}}`}let e=JSON.stringify(t);if(e===void 0)throw new TypeError("Canonical JSON requires JSON values");return e}o(nl,"canonicalJson");function jf(t){return(0,bf.createHash)("sha256").update(nl(t),"utf8").digest("hex")}o(jf,"manifestHash");var dA=o(t=>({provider:t.provider,providerAccountId:t.providerAccountId,providerRepositoryId:t.providerRepositoryId}),"toSourceRef");function ul(t,e,{statedPins:n=!0}={}){return Iv.parse({schemaVersion:1,runId:t,execution:e.execution(),requester:!0,writeCheck:!0,claudeCodePin:!0,deployedPins:!0,...n?{statedPins:!0}:{}})}o(ul,"handshakeRequest");function Wf(t){let e=Ev.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 t0(t){let e=o(n=>n.map(r=>({repository:dA(r.repository),number:r.number})),"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(t0,"toDelivery");function n0(t){return t.issues.map(e=>`${e.path.map((r,s)=>typeof r=="number"?`[${r}]`:s===0?r:`.${r}`).join("")}: ${e.message}`).join("; ")}o(n0,"describeIssues");function zf(t){let{manifest:e}=t;if(lv.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:t0(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: ${n0(n.error)}`);return r0(n.data,e,t.checkedOut),n.data}o(zf,"buildReportUpload");function r0(t,e,n){let r=o(i=>n.find(a=>Nn(a.repository)===Nn(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(r0,"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:s0(t)}}o(Zf,"attemptEndFor");function s0(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(s0,"noReportCause");var JV={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var o0=10*1024*1024;var a0=["generate-unit","native-run"],KV=["preflight","plan","write",...a0,"report","deliver"];var EA=(r=>(r.Unit="unit",r.Integration="integration",r.E2e="e2e",r))(EA||{});var yo=Ve(require("fs")),Qo=Ve(require("path"));var A0=8;function lt(t,e,n={}){let r=e.slice(0,A0),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(yo.existsSync(t))try{return JSON.parse(yo.readFileSync(t,"utf-8"))}catch{return}}o(js,"readJsonFile");function jt(t,e){return js(Qo.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 CA=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 c0=4,Kf="\xABredacted\xBB";function Xf(t){let e=new Set;for(let n of t){let r=(n??"").trim();r.length>=c0&&e.add(r)}return[...e].sort((n,r)=>r.length-n.length)}o(Xf,"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(Kf));return n}o(Ws,"redactSecrets");function u0(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(u0,"mapStrings");function zs(t,e){return e.length===0?t:u0(t,n=>Ws(n,e))}o(zs,"redactDeep");var cH=new TextDecoder("utf-8",{fatal:!0});var EH=new Set(Object.values(or));var CH=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 wo=(n=>(n.Full="full",n.Static="static",n))(wo||{}),ur=(r=>(r.Contract="contract",r.Integration="integration",r.Ui="ui",r))(ur||{}),bo=(i=>(i.OwnSurface="own_surface",i.StateReadBack="state_read_back",i.Referential="referential",i.Lifecycle="lifecycle",i.Boundaries="boundaries",i))(bo||{}),Kr=(s=>(s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s))(Kr||{}),IA=(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))(IA||{});var It=A.string().trim().min(1),d0=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(IA),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")}),h0=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(Kr),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 g0=A.object({surface:It.describe("a surface from the list, copied verbatim"),axis:A.nativeEnum(bo)}),p0=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:g0.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:d0.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)")}),f0=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'),m0=A.object({surface:It.describe("a surface from the list, copied verbatim"),axes:A.object(Object.fromEntries(Object.values(bo).map(t=>[t,f0])))}),em=A.object({schemaVersion:A.literal(1),mode:A.nativeEnum(wo),maintenance:A.array(h0),generate:A.array(p0),surfaces:A.array(m0).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 yA=["-c","core.fsmonitor=false"],E0=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"]),C0=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 Fn(t=process.env,e,n="repo-command"){let r={};for(let[s,i]of Object.entries(t))n==="repo-command"&&C0.has(s)||(r[s]=i);Object.assign(r,e??{});for(let s of Object.keys(r))(E0.has(s)||s.startsWith("INPUT_"))&&delete r[s];return r}o(Fn,"untrustedChildEnv");var I0=".skyramp/sut/deployed-revisions.sh",ll=(n=>(n.Running="running",n.Requested="requested",n))(ll||{});var MH=new Set(Object.values(ll));var LH=`Fix ${I0} so it prints the full commit each component runs, then set it up again.`;var dl="shared-environment";var XH=64*1024;var eJ=new Set(["version_endpoint","api"]);function hl(t){return(t?.components??[]).filter(e=>!!e.repository&&!!e.expectedRevision)}o(hl,"verifiableComponents");function tm(t){return hl(t).length>0||(t?.dependencies.length??0)>0}o(tm,"hasSharedSystem");function y0(t){let e=t.inputs?.sharedEnvironment;if(!tm(e))return;let n=jt(t,`${dl}.json`);if(n)return{components:Q0(e,n.components),dependencies:n.dependencies};let r="Not checked: the run ended before it checked the shared environment.";return{components:hl(e).map(s=>nm(s,r)),dependencies:e.dependencies.map(s=>({name:s.name,url:s.url,version:null,evidence:r}))}}o(y0,"sharedSystem");var nm=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 Q0(t,e){let n=new Set(e.map(s=>s.name.toLowerCase())),r=hl(t).filter(s=>s.touched&&!n.has(s.name.toLowerCase()));return[...e,...r.map(s=>nm(s,"Not checked: the run recorded no read of it."))]}o(Q0,"withUnrecordedTouched");function gl(t){return(y0(t)?.components??[]).filter(e=>e.status!=="verified")}o(gl,"unverifiedComponents");function pl(t){return(t?.components??[]).filter(e=>!!e.repository&&!e.expectedRevision)}o(pl,"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: "${B0(Ws(n,e))}"`}}o(_t,"extractJsonObject");var rm=240;function B0(t){let e=t.replace(/\s+/g," ").trim();return e.length<=rm?e:`\u2026${e.slice(-rm)}`}o(B0,"snippetOf");function w0(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(w0,"issuesToMessages");function Un(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})=>sm(a,c),e));if(i.success)return{value:i.data,errors:[]}}catch{}return{errors:w0(n.error)}}o(Un,"validateWith");function sm(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]=sm(s[n],r):delete s[n],s}o(sm,"withoutAt");var Ks=Ve(require("path"));function b0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}o(b0,"getDefaultExportFromCjs");var Ze={},QA={},lr={},im;function Ro(){if(im)return lr;im=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(Ro,"requireCommon");var fl,om;function ko(){if(om)return fl;om=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(Ru(e,s,nY)){oY(e,i)&&(this.setEventFieldSize("retry",e.length-i),n.retry=e.toString("utf8",i));return}if(Ru(e,s,tY)){aY(e,i)&&(this.setEventFieldSize("id",e.length-i),n.id=e.toString("utf8",i));return}Ru(e,s,eY)&&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 ku();this.eventSize=r,this.eventFieldSizes[e]=n}processEvent(e){e.retry&&j$(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id&&W$(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===Xi[0]||(this.checkBOM=!1),!0):r===void 0?e===Xi[0]&&n===Xi[1]?!0:(this.checkBOM=!1,!1):(e===Xi[0]&&n===Xi[1]&&r===Xi[2]&&this.discardLeadingBytes(3),this.checkBOM=!1,!this.hasCurrentByte())}};sk.exports={EventSourceStream:Mp}});var hk=T((_4,dk)=>{"use strict";var{pipeline:AY}=require("node:stream"),{fetching:cY}=Ba(),{makeRequest:uY}=$i(),{webidl:zn}=je(),{EventSourceStream:lY}=ik(),{parseMIMEType:dY}=ht(),{createFastMessageEvent:hY}=ji(),{isNetworkError:ok}=ya(),{delay:gY}=Up(),{kEnumerableProperty:vs}=ue(),{environmentSettingsObject:ak}=Qt(),{getGlobalDispatcher:pY}=Ea(),Ak=!1,ck=3e3,_a=0,uk=1,Pa=2,fY="anonymous",mY="use-credentials",eo=class t extends EventTarget{static{o(this,"EventSource")}#e={open:null,error:null,message:null};#t=null;#n=!1;#s=_a;#i=null;#r=null;#o;#a;constructor(e,n={}){super(),zn.util.markAsUncloneable(this);let r="EventSource constructor";zn.argumentLengthCheck(arguments,1,r),Ak||(Ak=!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:ck};let s=ak,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=fY;n.withCredentials&&(a=mY,this.#n=!0);let c={redirect:"follow",keepalive:!0,mode:"cors",credentials:a==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};c.client=ak.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=uY(c),this.#c()}get readyState(){return this.#s}get url(){return this.#t}get withCredentials(){return this.#n}#c(){if(this.#s===Pa)return;this.#s=_a;let e={request:this.#i,dispatcher:this.#o},n=o(r=>{ok(r)&&(this.dispatchEvent(new Event("error")),this.close()),this.#A()},"processEventSourceEndOfBody");e.processResponseEndOfBody=n,e.processResponse=r=>{if(ok(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?dY(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=uk,this.dispatchEvent(new Event("open")),this.#a.origin=r.urlList[r.urlList.length-1].origin;let c=new lY({eventSourceSettings:this.#a,maxEventSize:this.#o.eventSourceOptions?.maxEventSize,push:o(l=>{this.dispatchEvent(hY(l.type,l.options))},"push")});AY(r.body.stream,c,l=>{l?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#r=cY(e)}async#A(){this.#s!==Pa&&(this.#s=_a,this.dispatchEvent(new Event("error")),await gY(this.#a.reconnectionTime),this.#s===_a&&(this.#a.lastEventId.length&&this.#i.headersList.set("last-event-id",this.#a.lastEventId,!0),this.#c()))}close(){zn.brandCheck(this,t),this.#s!==Pa&&(this.#s=Pa,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}},lk={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:_a,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:uk,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:Pa,writable:!1}};Object.defineProperties(eo,lk);Object.defineProperties(eo.prototype,lk);Object.defineProperties(eo.prototype,{close:vs,onerror:vs,onmessage:vs,onopen:vs,readyState:vs,url:vs,withCredentials:vs});zn.converters.EventSourceInitDict=zn.dictionaryConverter([{key:"withCredentials",converter:zn.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"dispatcher",converter:zn.converters.any,defaultValue:o(()=>pY(),"defaultValue")}]);dk.exports={EventSource:eo,defaultReconnectionTime:ck}});var mk=T((O4,ne)=>{"use strict";var EY=Si(),gk=Oo(),CY=vi(),IY=gQ(),yY=xi(),QY=rg(),BY=_Q(),wY=HQ(),pk=pe(),vu=ue(),{InvalidArgumentError:Su}=pk,to=DB(),bY=$o(),RY=_g(),kY=hw(),SY=Gg(),vY=bg(),xY=xc(),{getGlobalDispatcher:fk,setGlobalDispatcher:DY}=Ea(),TY=Oc(),NY=Cc(),FY=Ic();Object.assign(gk.prototype,to);ne.exports.Dispatcher=gk;ne.exports.Client=EY;ne.exports.Pool=CY;ne.exports.BalancedPool=IY;ne.exports.Agent=yY;ne.exports.ProxyAgent=QY;ne.exports.EnvHttpProxyAgent=BY;ne.exports.RetryAgent=wY;ne.exports.RetryHandler=xY;ne.exports.DecoratorHandler=TY;ne.exports.RedirectHandler=NY;ne.exports.createRedirectInterceptor=FY;ne.exports.interceptors={redirect:Iw(),retry:Qw(),dump:ww(),dns:kw()};ne.exports.buildConnector=bY;ne.exports.errors=pk;ne.exports.util={parseHeaders:vu.parseHeaders,headerNameToString:vu.headerNameToString};function Oa(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 Su("invalid url");if(n!=null&&typeof n!="object")throw new Su("invalid opts");if(n&&n.path!=null){if(typeof n.path!="string")throw new Su("invalid opts.path");let a=n.path;n.path.startsWith("/")||(a=`/${a}`),e=new URL(vu.parseOrigin(e).origin+a)}else n||(n=typeof e=="object"?e:{}),e=vu.parseURL(e);let{agent:s,dispatcher:i=fk()}=n;if(s)throw new Su("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(Oa,"makeDispatcher");ne.exports.setGlobalDispatcher=DY;ne.exports.getGlobalDispatcher=fk;var UY=Ba().fetch;ne.exports.fetch=o(async function(e,n=void 0){try{return await UY(e,n)}catch(r){throw r&&typeof r=="object"&&Error.captureStackTrace(r),r}},"fetch");ne.exports.Headers=Qs().Headers;ne.exports.Response=ya().Response;ne.exports.Request=$i().Request;ne.exports.FormData=Wo().FormData;ne.exports.File=globalThis.File??require("node:buffer").File;ne.exports.FileReader=Yb().FileReader;var{setGlobalOrigin:MY,getGlobalOrigin:LY}=nh();ne.exports.setGlobalOrigin=MY;ne.exports.getGlobalOrigin=LY;var{CacheStorage:_Y}=Kb(),{kConstruct:PY}=au();ne.exports.caches=new _Y(PY);var{deleteCookie:OY,getCookies:GY,getSetCookies:$Y,setCookie:YY}=cR();ne.exports.deleteCookie=OY;ne.exports.getCookies=GY;ne.exports.getSetCookies=$Y;ne.exports.setCookie=YY;var{parseMIMEType:VY,serializeAMimeType:HY}=ht();ne.exports.parseMIMEType=VY;ne.exports.serializeAMimeType=HY;var{CloseEvent:JY,ErrorEvent:qY,MessageEvent:jY}=ji();ne.exports.WebSocket=nk().WebSocket;ne.exports.CloseEvent=JY;ne.exports.ErrorEvent=qY;ne.exports.MessageEvent=jY;ne.exports.request=Oa(to.request);ne.exports.stream=Oa(to.stream);ne.exports.pipeline=Oa(to.pipeline);ne.exports.connect=Oa(to.connect);ne.exports.upgrade=Oa(to.upgrade);ne.exports.MockClient=RY;ne.exports.MockPool=SY;ne.exports.MockAgent=kY;ne.exports.mockErrors=vY;var{EventSource:WY}=hk();ne.exports.EventSource=WY});var O2={};qp(O2,{AppRefusal:()=>on,AppUnreachable:()=>xs,AttemptEndReason:()=>Co,DeliveryStatus:()=>hA,GitHubWriteKind:()=>fA,NoReportCause:()=>Io,SourceProvider:()=>Js,V3Attempt:()=>Ha,ValidationSufficiency:()=>Zr,closedV3Attempt:()=>Uk,endV3Attempt:()=>_k,heartbeatV3Attempt:()=>Jp,startV3Attempt:()=>Fk,uploadV3Report:()=>Lk});module.exports=Vk(O2);var A={};qp(A,{BRAND:()=>fS,DIRTY:()=>Fr,EMPTY_PATH:()=>jk,INVALID:()=>Z,NEVER:()=>ev,OK:()=>We,ParseStatus:()=>He,Schema:()=>Ae,ZodAny:()=>sr,ZodArray:()=>vn,ZodBigInt:()=>Mr,ZodBoolean:()=>Lr,ZodBranded:()=>ho,ZodCatch:()=>jr,ZodDate:()=>_r,ZodDefault:()=>qr,ZodDiscriminatedUnion:()=>rA,ZodEffects:()=>Mt,ZodEnum:()=>Hr,ZodError:()=>ct,ZodFirstPartyTypeKind:()=>ee,ZodFunction:()=>iA,ZodIntersection:()=>$r,ZodIssueCode:()=>N,ZodLazy:()=>Yr,ZodLiteral:()=>Vr,ZodMap:()=>Ps,ZodNaN:()=>Gs,ZodNativeEnum:()=>Jr,ZodNever:()=>Jt,ZodNull:()=>Or,ZodNullable:()=>ln,ZodNumber:()=>Ur,ZodObject:()=>ut,ZodOptional:()=>Ft,ZodParsedType:()=>O,ZodPipeline:()=>go,ZodPromise:()=>ir,ZodReadonly:()=>Wr,ZodRecord:()=>sA,ZodSchema:()=>Ae,ZodSet:()=>Os,ZodString:()=>rr,ZodSymbol:()=>Ls,ZodTransformer:()=>Mt,ZodTuple:()=>un,ZodType:()=>Ae,ZodUndefined:()=>Pr,ZodUnion:()=>Gr,ZodUnknown:()=>Sn,ZodVoid:()=>_s,addIssueToContext:()=>_,any:()=>bS,array:()=>vS,bigint:()=>IS,boolean:()=>of,coerce:()=>XS,custom:()=>nf,date:()=>yS,datetimeRegex:()=>ef,defaultErrorMap:()=>Rn,discriminatedUnion:()=>NS,effect:()=>HS,enum:()=>$S,function:()=>PS,getErrorMap:()=>Fs,getParsedType:()=>cn,instanceof:()=>ES,intersection:()=>FS,isAborted:()=>tA,isAsync:()=>Us,isDirty:()=>nA,isValid:()=>nr,late:()=>mS,lazy:()=>OS,literal:()=>GS,makeIssue:()=>lo,map:()=>LS,nan:()=>CS,nativeEnum:()=>YS,never:()=>kS,null:()=>wS,nullable:()=>qS,number:()=>sf,object:()=>xS,objectUtil:()=>Gu,oboolean:()=>KS,onumber:()=>ZS,optional:()=>JS,ostring:()=>zS,pipeline:()=>WS,preprocess:()=>jS,promise:()=>VS,quotelessJson:()=>Hk,record:()=>MS,set:()=>_S,setErrorMap:()=>qk,strictObject:()=>DS,string:()=>rf,symbol:()=>QS,transformer:()=>HS,tuple:()=>US,undefined:()=>BS,union:()=>TS,unknown:()=>RS,util:()=>le,void:()=>SS});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 Gu;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Gu||(Gu={}));var O=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),cn=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"]),Hk=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 Jk=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"),Rn=Jk;var Wp=Rn;function qk(t){Wp=t}o(qk,"setErrorMap");function Fs(){return Wp}o(Fs,"getErrorMap");var lo=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"),jk=[];function _(t,e){let n=Fs(),r=lo({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Rn?void 0:Rn].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"),tA=o(t=>t.status==="aborted","isAborted"),nA=o(t=>t.status==="dirty","isDirty"),nr=o(t=>t.status==="valid","isValid"),Us=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 cn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:cn(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:cn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Us(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:cn(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:cn(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:cn(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Us(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 ln.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vn.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 ho({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 go.create(this,e)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Wk=/^c[^\s-]{8,}$/i,zk=/^[0-9a-z]+$/,Zk=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Kk=/^[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,Xk=/^[a-z0-9_-]{21}$/i,eS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tS=/^[-+]?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)?)??$/,nS=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rS="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",$u,sS=/^(?:(?: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])$/,iS=/^(?:(?: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])$/,oS=/^(([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]))$/,aS=/^(([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])$/,AS=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,cS=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Kp="((\\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])))",uS=new RegExp(`^${Kp}$`);function Xp(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(Xp,"timeRegexSource");function lS(t){return new RegExp(`^${Xp(t)}$`)}o(lS,"timeRegex");function ef(t){let e=`${Kp}T${Xp(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(ef,"datetimeRegex");function dS(t,e){return!!((e==="v4"||!e)&&sS.test(t)||(e==="v6"||!e)&&oS.test(t))}o(dS,"isValidIP");function hS(t,e){if(!eS.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(hS,"isValidJWT");function gS(t,e){return!!((e==="v4"||!e)&&iS.test(t)||(e==="v6"||!e)&&aS.test(t))}o(gS,"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")nS.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")$u||($u=new RegExp(rS,"u")),$u.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")Kk.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")Xk.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")Wk.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")zk.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")Zk.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"?ef(i).test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?uS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?lS(i).test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?tS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"duration",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?dS(e.data,i.version)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"ip",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?hS(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"jwt",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?gS(e.data,i.version)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"cidr",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?AS.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"base64",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?cS.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 pS(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(pS,"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"?pS(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 Ls=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)}};Ls.create=t=>new Ls({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 Sn=class extends Ae{static{o(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(e){return We(e.data)}};Sn.create=t=>new Sn({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 _s=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)}};_s.create=t=>new _s({typeName:ee.ZodVoid,...ie(t)});var vn=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)}};vn.create=(t,e)=>new vn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ee.ZodArray,...ie(e)});function Ms(t){if(t instanceof ut){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Ft.create(Ms(r))}return new ut({...t._def,shape:o(()=>e,"shape")})}else return t instanceof vn?new vn({...t._def,type:Ms(t.element)}):t instanceof Ft?Ft.create(Ms(t.unwrap())):t instanceof ln?ln.create(Ms(t.unwrap())):t instanceof un?un.create(t.items.map(e=>Ms(e))):t}o(Ms,"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 Ms(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 tf(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 kn=o(t=>t instanceof Yr?kn(t.schema):t instanceof Mt?kn(t.innerType()):t instanceof Vr?[t.value]:t instanceof Hr?t.options:t instanceof Jr?le.objectValues(t.enum):t instanceof qr?kn(t._def.innerType):t instanceof Pr?[void 0]:t instanceof Or?[null]:t instanceof Ft?[void 0,...kn(t.unwrap())]:t instanceof ln?[null,...kn(t.unwrap())]:t instanceof ho||t instanceof Wr?kn(t.unwrap()):t instanceof jr?kn(t._def.innerType):[],"getDiscriminator"),rA=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=kn(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 Yu(t,e){let n=cn(t),r=cn(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=Yu(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=Yu(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(Yu,"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(tA(i)||tA(a))return Z;let c=Yu(i.value,a.value);return c.valid?((nA(i)||nA(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 un=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})}};un.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new un({items:t,typeName:ee.ZodTuple,rest:null,...ie(e)})};var sA=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)})}},Ps=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}}}};Ps.create=(t,e,n)=>new Ps({valueType:e,keyType:t,typeName:ee.ZodMap,...ie(n)});var Os=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)}};Os.create=(t,e)=>new Os({valueType:t,minSize:null,maxSize:null,typeName:ee.ZodSet,...ie(e)});var iA=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 lo({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Fs(),Rn].filter(d=>!!d),issueData:{code:N.invalid_arguments,argumentsError:l}})}o(r,"makeArgsIssue");function s(c,l){return lo({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Fs(),Rn].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:un.create(e).rest(Sn.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||un.create([]).rest(Sn.create()),returns:n||Sn.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 tf(t,e){return new Hr({values:t,typeName:ee.ZodEnum,...ie(e)})}o(tf,"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=tf;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 ln=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}};ln.create=(t,e)=>new ln({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 Us(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 Gs=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}}};Gs.create=t=>new Gs({typeName:ee.ZodNaN,...ie(t)});var fS=Symbol("zod_brand"),ho=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}},go=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 Us(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 Zp(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}o(Zp,"cleanParams");function nf(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=Zp(e,r),l=c.fatal??n??!0;s.addIssue({code:"custom",...c,fatal:l})}});if(!i){let a=Zp(e,r),c=a.fatal??n??!0;s.addIssue({code:"custom",...a,fatal:c})}}):sr.create()}o(nf,"custom");var mS={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 ES=o((t,e={message:`Input not instance of ${t.name}`})=>nf(n=>n instanceof t,e),"instanceOfType"),rf=rr.create,sf=Ur.create,CS=Gs.create,IS=Mr.create,of=Lr.create,yS=_r.create,QS=Ls.create,BS=Pr.create,wS=Or.create,bS=sr.create,RS=Sn.create,kS=Jt.create,SS=_s.create,vS=vn.create,xS=ut.create,DS=ut.strictCreate,TS=Gr.create,NS=rA.create,FS=$r.create,US=un.create,MS=sA.create,LS=Ps.create,_S=Os.create,PS=iA.create,OS=Yr.create,GS=Vr.create,$S=Hr.create,YS=Jr.create,VS=ir.create,HS=Mt.create,JS=Ft.create,qS=ln.create,jS=Mt.createWithPreprocess,WS=go.create,zS=o(()=>rf().optional(),"ostring"),ZS=o(()=>sf().optional(),"onumber"),KS=o(()=>of().optional(),"oboolean"),XS={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 ev=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 Vu=o(t=>`${t.source}:${t.site??""}:${t.key}`,"requirementItemId");var oA=/^pasted-[0-9a-f]{16}$/,po=/^file-[0-9a-f]{16}$/,fo=(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))(fo||{});var Hu=(r=>(r.New="new",r.Updated="updated",r.Existing="existing",r))(Hu||{}),Zr=(r=>(r.Sufficient="sufficient",r.Insufficient="insufficient",r.NoChange="no_change",r))(Zr||{}),$s=(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))($s||{}),or=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(or||{}),Ju=(r=>(r.Application="application",r.Environment="environment",r.TestDefect="test_defect",r))(Ju||{}),qu=(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))(qu||{});var aA=(n=>(n.Probe="probe",n.Agent="agent",n))(aA||{}),AA=(r=>(r.Seed="seed",r.RuntimeMock="runtime_mock",r.EnvOverride="env_override",r))(AA||{}),cA=(r=>(r.TestCode="test_code",r.SkyrampMocker="skyramp_mocker",r.RecipeOverride="recipe_override",r))(cA||{});var ju=(n=>(n.Ready="ready",n.Blocked="blocked",n))(ju||{}),Ne=A.string().trim().min(1),tv=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"}),nv=/^[A-Za-z_][A-Za-z0-9_]*$/,mo=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,Ys=(a=>(a.VersionEndpoint="version_endpoint",a.DeployWorkflow="deploy_workflow",a.KubernetesLabels="kubernetes_labels",a.Command="command",a.Api="api",a.NotTracked="not_tracked",a))(Ys||{}),dn="shared",rv=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"),Vs=A.object({address:rv,readyWhen:Ne.nullable(),credentials:A.array(A.string().regex(mo)).max(50),revisionSources:A.array(A.object({method:A.nativeEnum(Ys),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(),Wu={steps:A.array(tv).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(nv)).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")},sv=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(),...Wu,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')}),iv=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")}),ov=A.object({framework:Ne,file:Ne.describe("the test file run, relative to its repository root"),result:A.enum(["pass","fail","error"])}),av=A.object({input:Ne.describe("the part of the user's SUT input, as given"),reason:Ne}),BV=A.object({schemaVersion:A.literal(1),status:A.nativeEnum(ju).describe("ready only if every component came up healthy and the recipe is written"),components:A.array(sv),suites:A.array(ov).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(av).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 (SKYR-5265)"),blockers:A.array(iv).describe("required (non-empty) when status is blocked"),environment:Vs.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,Zu=512*1024,af=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var cf=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),Av=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")}),Ku=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"),Af=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:Av.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:Ku.optional()});var ze=A.string().trim().min(1),Xu=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(Xu||{}),el=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],uf=A.object({schemaVersion:A.literal(1),type:A.nativeEnum(Xu).optional(),status:A.enum(["ready","blocked"]),environment:Vs.optional(),components:A.array(A.object({name:ze,repository:ze.describe(`owner/repo, or "${dn}" for a customer-deployed component no repository builds`),healthy:A.boolean(),url:A.string().min(1).nullable(),...Wu,credentials:A.array(A.string().regex(mo)).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===dn&&!n&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"repository"],message:`only a customer_deployed component is ${dn}`})}),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)=>{el.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!==dn&&!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 TV=["clean","recipe-drift"];function uA(t){let e=cf.posix.normalize(t);return e===t&&(e===".skyramp/workspace.yml"||e.startsWith(".skyramp/sut/")&&e.length>13)}o(uA,"isRuntimePlanFile");var Js=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(Js||{}),sl=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(sl||{}),il=(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))(il||{}),cv=["sut_setup"],uv=["sut_setup","schedule","revision_read"],lv=["sut_setup"],ol=(e=>(e.PullRequest="pull_request",e))(ol||{}),Rf=(s=>(s.ModelProvider="model_provider",s.SutAccess="sut_access",s.Skyramp="skyramp",s.Other="other",s))(Rf||{}),hA=(s=>(s.None="none",s.Delivered="delivered",s.Partial="partial",s.Failed="failed",s))(hA||{}),Co=(i=>(i.ReportUploaded="report_uploaded",i.NoReport="no_report",i.Cancelled="cancelled",i.RecipeUploaded="recipe_uploaded",i.RevisionsUploaded="revisions_uploaded",i))(Co||{}),kf=(n=>(n.Running="running",n.Ended="ended",n))(kf||{}),Io=(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))(Io||{}),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||{}),Al=(s=>(s.Found="found",s.Starting="starting",s.Up="up",s.OutOfScope="out_of_scope",s))(Al||{}),qt=A.string().regex(/^[1-9][0-9]{0,18}$/),Dn=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(),gA={provider:A.literal("github"),providerAccountId:qt,providerRepositoryId:qt},pA={provider:A.literal("azure-devops"),providerAccountId:tt,providerRepositoryId:tt},Tn=A.discriminatedUnion("provider",[A.object(gA).strict(),A.object(pA).strict()]),cl=A.discriminatedUnion("provider",[A.object(gA).passthrough(),A.object(pA).passthrough()]),Nn=o(t=>`${t.provider}:${t.providerRepositoryId}`,"sourceKey"),lf={namespace:A.string().min(1),name:A.string().min(1)},Nf=A.discriminatedUnion("provider",[A.object({...gA,...lf}).strict(),A.object({...pA,...lf}).strict()]),df=A.object({ref:A.string().min(1),revision:Dn}).strict(),dv=A.object({repository:Nf,revision:Dn,ref:A.string().nullable(),reason:A.nativeEnum(sl),change:A.object({kind:A.nativeEnum(ol),number:qt,base:df.optional()}).strict().nullable(),compareWith:df.optional()}).strict();function hv(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=>Nn(l.repository))),a=new Set(r.map(l=>Nn(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(hv,"baselineSourcesIssue");var Ff=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,Uf=/^[1-9][0-9]{0,18}$/,hf=new RegExp(`${Ff.source}|${Uf.source}`),gf=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,gv=A.union([A.object({source:A.literal("jira"),site:A.string().regex(gf),key:A.string().regex(Ff),updated:A.string().datetime(),contentHash:nt}).strict(),A.object({source:A.literal("confluence"),site:A.string().regex(gf),key:A.string().regex(Uf),version:A.number().int().positive(),contentHash:nt}).strict(),A.object({source:A.literal("other"),key:A.string().regex(oA),contentHash:nt}).strict(),A.object({source:A.literal("other"),key:A.string().regex(po),contentHash:nt,fileName:A.string().min(1).max(255),mediaType:A.nativeEnum(fo)}).strict()]),pf=A.union([A.literal("jira"),A.literal("confluence")]),pv=A.object({schemaVersion:A.literal(1),items:A.array(A.union([A.object({source:pf,site:A.string(),key:A.string().regex(hf),state:A.literal("read"),text:A.string(),version:A.string().min(1),contentMatches:A.boolean()}).strict(),A.object({source:pf,site:A.string(),key:A.string().regex(hf),state:A.literal("not_read"),reason:A.nativeEnum(zr)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(oA),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(oA),state:A.literal("not_read"),reason:A.nativeEnum(zr)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(po),state:A.literal("read"),version:nt,fileName:A.string().min(1).max(255),mediaType:A.nativeEnum(fo)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(po),state:A.literal("not_read"),reason:A.nativeEnum(zr)}).strict()])),instructions:A.array(A.string()).optional()}).strict(),fv=A.object({schemaVersion:A.literal(1),runId:tt,skyrampOrgId:tt,target:lA,policy:lA.nullable(),trigger:A.object({kind:A.nativeEnum(il),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:Tn,revision:Dn}).strict()).optional()}).strict().optional(),sources:A.array(dv).min(1),execution:A.object({provider:A.nativeEnum(Js),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(gv).min(1).optional(),instructions:A.object({contentHash:nt}).strict().optional(),deployedRevisions:A.array(A.object({repository:Tn,revision:Dn}).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=Vu({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=cv.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=hv(t);i&&e.addIssue({code:A.ZodIssueCode.custom,path:t.baseline?["baseline","sources"]:["baseline"],message:i}),uv.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=>Nn(l.repository))),c=new Set;(t.deployedRevisions??[]).forEach((l,d)=>{let h=Nn(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||{}),mv=A.object({kind:A.nativeEnum(Mf),name:A.string().min(1).max(256)}).strict(),Ev=A.object({schemaVersion:A.literal(1),attempt:A.object({id:tt,number:A.number().int().positive(),deadlineAt:A.string().datetime()}).strict(),manifest:fv,manifestHash:nt,entitlements:A.array(A.string()).optional(),runToken:A.string().min(1).optional(),requestedBy:mv.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:Tn,revision:Dn}).strict()).optional(),statedRevisions:A.array(A.object({repository:Tn,revision:Dn}).strict()).optional()}).strict(),ff={providerRunAttempt:A.number().int().positive(),workflowRef:A.string().min(1)},Cv=A.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),Iv=A.object({schemaVersion:A.literal(1),runId:tt,execution:A.discriminatedUnion("provider",[A.object({...ff,provider:A.literal("github"),repository:A.object(gA).strict(),providerRunId:qt}).strict(),A.object({...ff,provider:A.literal("azure-devops"),repository:A.object(pA).strict(),providerRunId:Cv}).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()}).strict(),mf=A.object({repository:Tn,number:qt}).strict(),yv=A.discriminatedUnion("status",[A.object({status:A.literal("none")}).strict(),A.object({status:A.literal("delivered"),pullRequests:A.array(mf).min(1)}).strict(),A.object({status:A.literal("partial"),pullRequests:A.array(mf).min(1),failures:A.array(A.object({repository:Tn,message:A.string()}).strict()).min(1)}).strict(),A.object({status:A.literal("failed"),message:A.string()}).strict()]),Qv=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:Dn,reference:A.string().min(1),summary:A.string().min(1)}).strict()),actionRequired:A.array(A.nativeEnum($s))}).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"})}),tl=500,Bv=2048,wv=1e3,bv=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,Ef=o(t=>t.length>0&&t.length<=64&&t===t.trim()&&!bv.test(t)&&!/[^\S ]/u.test(t)&&!/^[._]/.test(t)&&!t.endsWith("."),"isAzureName"),Rv=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)&&Ef(n)&&Ef(r)},"isResultRepository"),kv=A.object({testResults:A.array(A.object({resultId:A.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:A.string().refine(Rv,"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(Ju),family:A.nativeEnum(qu).optional()}).strict().optional(),origin:A.nativeEnum(Hu).optional()}).strict()),validation:Qv,changes:A.array(A.object({id:A.string().min(1).max(512),text:A.string().max(16384),source:A.string().max(Bv),testedBy:A.array(A.string().min(1).max(1024)).max(tl),writtenBy:A.array(A.string().min(1).max(1024)).max(tl),maintainedBy:A.array(A.string().min(1).max(1024)).max(tl)}).strict()).max(wv).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)})}),Cf=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}:${Cf(a)}`;return r?`${c}#${Cf(r)}`:c}o(Lf,"testResultId");var fA=(r=>(r.BranchPushed="branch_pushed",r.PullRequestOpened="pull_request_opened",r.PullRequestEdited="pull_request_edited",r))(fA||{}),_f=50,If=A.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),Pf=A.discriminatedUnion("kind",[A.object({kind:A.literal("branch_pushed"),repository:Tn,branch:If,commit:Dn}).strict(),A.object({kind:A.enum(["pull_request_opened","pull_request_edited"]),repository:Tn,number:qt,branch:If}).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:Tn,revision:Dn}).strict()),firstQualification:A.literal(!0).optional()}).strict(),delivery:A.object({generatedTests:yv}).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:kv,githubWrites:A.array(Pf).max(_f).optional()}).strict(),OV=Of.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:uf}).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)=>{uA(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>Zu&&n(["files"],`recipe text over ${Zu} bytes in total`)}),GV=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 Sv=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"}),mA=100,vv=5e3,Eo=2e3,yf=100,Gf=/^[A-Za-z0-9_-]{1,64}$/,xv=20,Dv=200,Tv=100,Nv=100,Fv=200,Qf="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",Uv=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${Qf}/${Qf})$`),Mv=500,Lv=50,_v=/[\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&&!_v.test(e),"blank, or not text"),"setupText"),xn={sequence:A.number().int().min(1).max(vv),at:A.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},Pv=A.discriminatedUnion("kind",[A.object({...xn,kind:A.literal("log"),phase:A.nativeEnum(al),text:Lt(Eo)}).strict(),A.object({...xn,kind:A.literal("component"),name:Lt(yf),repository:Lt(Fv).refine(t=>Uv.test(t)||t===dn,"not owner/name"),file:Lt(Mv).nullable(),status:A.nativeEnum(Al),version:Lt(Nv).optional()}).strict(),A.object({...xn,kind:A.literal("reply"),to:A.string().uuid(),accepted:A.boolean(),text:Lt(Eo)}).strict(),A.object({...xn,kind:A.literal("question"),id:A.string().regex(Gf),type:A.nativeEnum(Df),text:Lt(Eo),component:Lt(yf).nullable(),choices:A.array(Lt(Dv)).max(xv),placeholder:Lt(Tv).optional()}).strict(),A.object({...xn,kind:A.literal("delivered"),ids:A.array(A.string().uuid()).max(mA)}).strict(),A.object({...xn,kind:A.literal("credentials"),names:A.array(A.string().regex(mo)).min(1).max(Lv)}).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"}))}),Ov=A.object({schemaVersion:A.literal(1),events:A.array(Pv).max(mA)}).strict(),Gv=A.discriminatedUnion("kind",[A.object({...xn,kind:A.literal("log"),stage:A.nativeEnum(Tf),text:Lt(Eo)}).strict(),A.object({...xn,kind:A.literal("reply"),to:A.string().uuid(),accepted:A.boolean(),text:Lt(Eo)}).strict(),A.object({...xn,kind:A.literal("delivered"),ids:A.array(A.string().uuid()).max(mA)}).strict()]),$v=A.object({schemaVersion:A.literal(1),events:A.array(Gv).max(mA)}).strict(),Bf={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({...Bf,kind:A.literal("instruction"),question:A.null()}),A.object({...Bf,kind:A.literal("answer"),question:A.string().regex(Gf)})]),Yf=A.string().regex(/^[A-Za-z0-9+/]{43}=$/),Yv=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()}),Vv=A.object({schemaVersion:A.literal(1),leftOut:A.array(A.string()),messages:A.array($f).optional(),stop:A.object({key:Yf}).optional(),notes:Yv.optional()}),Hv=A.object({schemaVersion:A.literal(1),messages:A.array($f).optional()});var Jv=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(),qv=A.object({schemaVersion:A.literal(1),artifact:Vf,sessionId:tt,contentHash:nt,bytes:A.number().int().min(1).max(Jv)}).strict(),jv=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(),Wv=200,Hs=100,Hf=(r=>(r.Resume="resume",r.Retry="retry",r.Update="update",r))(Hf||{}),zv=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(Al)}).strict()).max(Hs),credentials:A.array(A.string().min(1)).max(Hs),answers:A.array(A.object({question:A.string(),answer:A.string().nullable()}).strict()).max(Hs),instructions:A.array(A.object({text:A.string(),reply:A.string().nullable()}).strict()).max(Hs),log:A.array(A.object({phase:A.nativeEnum(al),text:A.string()}).strict()).max(Wv),recipe:A.object({files:A.array(A.object({path:A.string().min(1),content:A.string()}).strict()).max(Hs),blockers:A.array(A.object({component:A.string(),problem:A.string(),evidence:A.string(),fix:A.string()}).strict()).max(Hs)}).strict().optional()}).strict(),Zv=A.object({schemaVersion:A.literal(1),context:zv.nullable()}).strict(),Kv=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(),Xv=Vs.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=>uA(t)&&!el.includes(t),"not a file of a customer_deployed plan"),content:A.string()}).strict()).optional()}).strict(),e0=A.object({schemaVersion:A.literal(1),testEnvironment:Xv.nullable().optional(),runtimePlan:A.object({version:A.number().int().positive(),contentHash:nt,files:A.array(A.object({path:A.string().refine(uA,"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(Co).nullable(),cause:A.nativeEnum(Io).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 nl(t){if(typeof t=="number"&&!Number.isFinite(t))throw new TypeError("Canonical JSON requires JSON values");if(Array.isArray(t))return`[${t.map(nl).join(",")}]`;if(t!==null&&typeof t=="object"){let n=t;return`{${Object.keys(n).sort().map(r=>`${JSON.stringify(r)}:${nl(n[r])}`).join(",")}}`}let e=JSON.stringify(t);if(e===void 0)throw new TypeError("Canonical JSON requires JSON values");return e}o(nl,"canonicalJson");function jf(t){return(0,bf.createHash)("sha256").update(nl(t),"utf8").digest("hex")}o(jf,"manifestHash");var dA=o(t=>({provider:t.provider,providerAccountId:t.providerAccountId,providerRepositoryId:t.providerRepositoryId}),"toSourceRef");function ul(t,e,{statedPins:n=!0}={}){return Iv.parse({schemaVersion:1,runId:t,execution:e.execution(),requester:!0,writeCheck:!0,claudeCodePin:!0,deployedPins:!0,...n?{statedPins:!0}:{}})}o(ul,"handshakeRequest");function Wf(t){let e=Ev.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 t0(t){let e=o(n=>n.map(r=>({repository:dA(r.repository),number:r.number})),"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(t0,"toDelivery");function n0(t){return t.issues.map(e=>`${e.path.map((r,s)=>typeof r=="number"?`[${r}]`:s===0?r:`.${r}`).join("")}: ${e.message}`).join("; ")}o(n0,"describeIssues");function zf(t){let{manifest:e}=t;if(lv.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:t0(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: ${n0(n.error)}`);return r0(n.data,e,t.checkedOut),n.data}o(zf,"buildReportUpload");function r0(t,e,n){let r=o(i=>n.find(a=>Nn(a.repository)===Nn(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(r0,"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:s0(t)}}o(Zf,"attemptEndFor");function s0(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(s0,"noReportCause");var JV={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var o0=10*1024*1024;var a0=["generate-unit","native-run"],KV=["preflight","plan","write",...a0,"report","deliver"];var EA=(r=>(r.Unit="unit",r.Integration="integration",r.E2e="e2e",r))(EA||{});var yo=Ve(require("fs")),Qo=Ve(require("path"));var A0=8;function lt(t,e,n={}){let r=e.slice(0,A0),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(yo.existsSync(t))try{return JSON.parse(yo.readFileSync(t,"utf-8"))}catch{return}}o(js,"readJsonFile");function jt(t,e){return js(Qo.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 CA=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 c0=4,Kf="\xABredacted\xBB";function Xf(t){let e=new Set;for(let n of t){let r=(n??"").trim();r.length>=c0&&e.add(r)}return[...e].sort((n,r)=>r.length-n.length)}o(Xf,"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(Kf));return n}o(Ws,"redactSecrets");function u0(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(u0,"mapStrings");function zs(t,e){return e.length===0?t:u0(t,n=>Ws(n,e))}o(zs,"redactDeep");var cH=new TextDecoder("utf-8",{fatal:!0});var EH=new Set(Object.values(or));var CH=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 wo=(n=>(n.Full="full",n.Static="static",n))(wo||{}),ur=(r=>(r.Contract="contract",r.Integration="integration",r.Ui="ui",r))(ur||{}),bo=(i=>(i.OwnSurface="own_surface",i.StateReadBack="state_read_back",i.Referential="referential",i.Lifecycle="lifecycle",i.Boundaries="boundaries",i))(bo||{}),Kr=(s=>(s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s))(Kr||{}),IA=(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))(IA||{});var It=A.string().trim().min(1),d0=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(IA),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")}),h0=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(Kr),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 g0=A.object({surface:It.describe("a surface from the list, copied verbatim"),axis:A.nativeEnum(bo)}),p0=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:g0.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:d0.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)")}),f0=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'),m0=A.object({surface:It.describe("a surface from the list, copied verbatim"),axes:A.object(Object.fromEntries(Object.values(bo).map(t=>[t,f0])))}),em=A.object({schemaVersion:A.literal(1),mode:A.nativeEnum(wo),maintenance:A.array(h0),generate:A.array(p0),surfaces:A.array(m0).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 yA=["-c","core.fsmonitor=false"],E0=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"]),C0=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 Fn(t=process.env,e,n="repo-command"){let r={};for(let[s,i]of Object.entries(t))n==="repo-command"&&C0.has(s)||(r[s]=i);Object.assign(r,e??{});for(let s of Object.keys(r))(E0.has(s)||s.startsWith("INPUT_"))&&delete r[s];return r}o(Fn,"untrustedChildEnv");var I0=".skyramp/sut/deployed-revisions.sh",ll=(n=>(n.Running="running",n.Requested="requested",n))(ll||{});var MH=new Set(Object.values(ll));var LH=`Fix ${I0} so it prints the full commit each component runs, then set it up again.`;var dl="shared-environment";var XH=64*1024;var eJ=new Set(["version_endpoint","api"]);function hl(t){return(t?.components??[]).filter(e=>!!e.repository&&!!e.expectedRevision)}o(hl,"verifiableComponents");function tm(t){return hl(t).length>0||(t?.dependencies.length??0)>0}o(tm,"hasSharedSystem");function y0(t){let e=t.inputs?.sharedEnvironment;if(!tm(e))return;let n=jt(t,`${dl}.json`);if(n)return{components:Q0(e,n.components),dependencies:n.dependencies};let r="Not checked: the run ended before it checked the shared environment.";return{components:hl(e).map(s=>nm(s,r)),dependencies:e.dependencies.map(s=>({name:s.name,url:s.url,version:null,evidence:r}))}}o(y0,"sharedSystem");var nm=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 Q0(t,e){let n=new Set(e.map(s=>s.name.toLowerCase())),r=hl(t).filter(s=>s.touched&&!n.has(s.name.toLowerCase()));return[...e,...r.map(s=>nm(s,"Not checked: the run recorded no read of it."))]}o(Q0,"withUnrecordedTouched");function gl(t){return(y0(t)?.components??[]).filter(e=>e.status!=="verified")}o(gl,"unverifiedComponents");function pl(t){return(t?.components??[]).filter(e=>!!e.repository&&!e.expectedRevision)}o(pl,"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: "${B0(Ws(n,e))}"`}}o(_t,"extractJsonObject");var rm=240;function B0(t){let e=t.replace(/\s+/g," ").trim();return e.length<=rm?e:`\u2026${e.slice(-rm)}`}o(B0,"snippetOf");function w0(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(w0,"issuesToMessages");function Un(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})=>sm(a,c),e));if(i.success)return{value:i.data,errors:[]}}catch{}return{errors:w0(n.error)}}o(Un,"validateWith");function sm(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]=sm(s[n],r):delete s[n],s}o(sm,"withoutAt");var Ks=Ve(require("path"));function b0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}o(b0,"getDefaultExportFromCjs");var Ze={},QA={},lr={},im;function Ro(){if(im)return lr;im=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(Ro,"requireCommon");var fl,om;function ko(){if(om)return fl;om=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"),fl=e,fl}o(ko,"requireException");var ml,am;function R0(){if(am)return ml;am=1;let t=Ro();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+`