deepv-code 1.0.322 → 1.0.323

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.
Files changed (2) hide show
  1. package/bundle/dvcode.js +4 -4
  2. package/package.json +1 -1
package/bundle/dvcode.js CHANGED
@@ -536,7 +536,7 @@ ${h}`)}return e}),F0e=DIr(i5t);D0e=class extends T0e{create(t,r){var a;let{api_v
536
536
  `):[]}};JB.NEWLINE_CHARS=new Set([`
537
537
  `,"\r"]);JB.NEWLINE_REGEXP=/\r\n|[\n\r]/g;U0e={off:0,error:200,warn:300,info:400,debug:500},KFt=(n,t,r)=>{if(n){if(yIr(U0e,n))return n;Sb(r).warn(`${t} was set to ${JSON.stringify(n)}, expected one of ${JSON.stringify(Object.keys(U0e))}`)}};zIr={error:AK,warn:AK,info:AK,debug:AK},qFt=new WeakMap;bQ=n=>(n.options&&(n.options=Object.assign({},n.options),delete n.options.headers),n.headers&&(n.headers=Object.fromEntries((n.headers instanceof Headers?[...n.headers]:Object.entries(n.headers)).map(([t,r])=>[t,t.toLowerCase()==="x-goog-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in n&&(n.retryOfRequestLogID&&(n.retryOf=n.retryOfRequestLogID),delete n.retryOfRequestLogID),n);pXe=class n{constructor(t,r,a){this.iterator=t,this.controller=r,this.client=a}static fromSSEResponse(t,r,a){let i=!1,s=a?Sb(a):console;function e(){return kB(this,arguments,function*(){var u,d,I,h;if(i)throw new af("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var G=!0,E=fQ(_Ir(t,r)),W;W=yield tu(E.next()),u=W.done,!u;G=!0){h=W.value,G=!1;let R=h;if(!c)if(R.data.startsWith("[DONE]")){c=!0;continue}else try{yield yield tu(JSON.parse(R.data))}catch(F){throw s.error("Could not parse message into JSON:",R.data),s.error("From chunk:",R.raw),F}}}catch(R){d={error:R}}finally{try{!G&&!u&&(I=E.return)&&(yield tu(I.call(E)))}finally{if(d)throw d.error}}c=!0}catch(R){if(IXe(R))return yield tu(void 0);throw R}finally{c||r.abort()}})}return new n(e,r,a)}static fromReadableStream(t,r,a){let i=!1;function s(){return kB(this,arguments,function*(){var u,d,I,h;let c=new JB,G=n5t(t);try{for(var E=!0,W=fQ(G),R;R=yield tu(W.next()),u=R.done,!u;E=!0){h=R.value,E=!1;let F=h;for(let w of c.decode(F))yield yield tu(w)}}catch(F){d={error:F}}finally{try{!E&&!u&&(I=W.return)&&(yield tu(I.call(W)))}finally{if(d)throw d.error}}for(let F of c.flush())yield yield tu(F)})}function e(){return kB(this,arguments,function*(){var u,d,I,h;if(i)throw new af("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var G=!0,E=fQ(s()),W;W=yield tu(E.next()),u=W.done,!u;G=!0){h=W.value,G=!1;let R=h;c||R&&(yield yield tu(JSON.parse(R)))}}catch(R){d={error:R}}finally{try{!G&&!u&&(I=E.return)&&(yield tu(I.call(E)))}finally{if(d)throw d.error}}c=!0}catch(R){if(IXe(R))return yield tu(void 0);throw R}finally{c||r.abort()}})}return new n(e,r,a)}[Symbol.asyncIterator](){return this.iterator()}tee(){let t=[],r=[],a=this.iterator(),i=s=>({next:()=>{if(s.length===0){let e=a.next();t.push(e),r.push(e)}return s.shift()}});return[new n(()=>i(t),this.controller,this.client),new n(()=>i(r),this.controller,this.client)]}toReadableStream(){let t=this,r;return t5t({async start(){r=t[Symbol.asyncIterator]()},async pull(a){try{let{value:i,done:s}=await r.next();if(s)return a.close();let e=gXe(JSON.stringify(i)+`
538
538
  `);a.enqueue(e)}catch(i){a.error(i)}},async cancel(){var a;await((a=r.return)===null||a===void 0?void 0:a.call(r))}})}};bXe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;let s={event:this.event,data:this.data.join(`
539
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(t),t.startsWith(":"))return null;let[r,a,i]=jIr(t,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};fXe=class n extends Promise{constructor(t,r,a=KIr){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=a,this.client=t}_thenUnwrap(t){return new n(this.client,this.responsePromise,async(r,a)=>t(await this.parseResponse(r,a),a))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){let[t,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(t=>this.parseResponse(this.client,t))),this.parsedPromise}then(t,r){return this.parse().then(t,r)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}};l5t=Symbol("brand.privateNullableHeaders");NK=n=>{let t=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[s,e]of qIr(a)){let o=s.toLowerCase();i.has(o)||(t.delete(s),i.add(o)),e===null?(t.delete(s),r.add(o)):(t.append(s,e),r.delete(o))}}return{[l5t]:!0,values:t,nulls:r}};uXe=n=>{var t,r,a,i,s,e;if(typeof globalThis.process<"u")return(a=(r=(t=globalThis.process.env)===null||t===void 0?void 0:t[n])===null||r===void 0?void 0:r.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(e=(s=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||s===void 0?void 0:s.call(i,n))===null||e===void 0?void 0:e.trim()};M0e=class n{constructor(t){var r,a,i,s,e,o,u,{baseURL:d=uXe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:I=(r=uXe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=t,c=Y0e(t,["baseURL","apiKey","apiVersion"]);let G=Object.assign(Object.assign({apiKey:I,apiVersion:h},c),{baseURL:d||"https://generativelanguage.googleapis.com"});this.baseURL=G.baseURL,this.timeout=(a=G.timeout)!==null&&a!==void 0?a:n.DEFAULT_TIMEOUT,this.logger=(i=G.logger)!==null&&i!==void 0?i:console;let E="warn";this.logLevel=E,this.logLevel=(e=(s=KFt(G.logLevel,"ClientOptions.logLevel",this))!==null&&s!==void 0?s:KFt(uXe("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&e!==void 0?e:E,this.fetchOptions=G.fetchOptions,this.maxRetries=(o=G.maxRetries)!==null&&o!==void 0?o:2,this.fetch=(u=G.fetch)!==null&&u!==void 0?u:VIr(),this.encoder=XIr,this._options=G,this.apiKey=I,this.apiVersion=h,this.clientAdapter=G.clientAdapter}withOptions(t){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),t))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:t,nulls:r}){if(!(t.has("authorization")||t.has("x-goog-api-key"))&&!(this.apiKey&&t.get("x-goog-api-key"))&&!r.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(t){let r=NK([t.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return NK([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return NK([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(t){return Object.entries(t).filter(([r,a])=>typeof a<"u").map(([r,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(r)}=`;throw new af(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${XB}`}defaultIdempotencyKey(){return`stainless-node-retry-${gIr()}`}makeStatusError(t,r,a,i){return lf.generate(t,r,a,i)}buildURL(t,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,s=ZIr(t)?new URL(t):new URL(i+(i.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),e=this.defaultQuery();return WIr(e)||(r=Object.assign(Object.assign({},e),r)),typeof r=="object"&&r&&!Array.isArray(r)&&(s.search=this.stringifyQuery(r)),s.toString()}async prepareOptions(t){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!t.path.startsWith(`/${this.apiVersion}/projects/`)){let r=t.path.slice(this.apiVersion.length+1);t.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${r}`}}async prepareRequest(t,{url:r,options:a}){}get(t,r){return this.methodRequest("get",t,r)}post(t,r){return this.methodRequest("post",t,r)}patch(t,r){return this.methodRequest("patch",t,r)}put(t,r){return this.methodRequest("put",t,r)}delete(t,r){return this.methodRequest("delete",t,r)}methodRequest(t,r,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:t,path:r},i)))}request(t,r=null){return new fXe(this,this.makeRequest(t,r,void 0))}async makeRequest(t,r,a){var i,s,e;let o=await t,u=(i=o.maxRetries)!==null&&i!==void 0?i:this.maxRetries;r==null&&(r=u),await this.prepareOptions(o);let{req:d,url:I,timeout:h}=await this.buildRequest(o,{retryCount:u-r});await this.prepareRequest(d,{url:I,options:o});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),G=a===void 0?"":`, retryOf: ${a}`,E=Date.now();if(Sb(this).debug(`[${c}] sending request`,bQ({retryOfRequestLogID:a,method:o.method,url:I,options:o,headers:d.headers})),!((s=o.signal)===null||s===void 0)&&s.aborted)throw new WK;let W=new AbortController,R=await this.fetchWithTimeout(I,d,h,W).catch(dXe),F=Date.now();if(R instanceof globalThis.Error){let A=`retrying, ${r} attempts remaining`;if(!((e=o.signal)===null||e===void 0)&&e.aborted)throw new WK;let y=IXe(R)||/timed? ?out/i.test(String(R)+("cause"in R?String(R.cause):""));if(r)return Sb(this).info(`[${c}] connection ${y?"timed out":"failed"} - ${A}`),Sb(this).debug(`[${c}] connection ${y?"timed out":"failed"} (${A})`,bQ({retryOfRequestLogID:a,url:I,durationMs:F-E,message:R.message})),this.retryRequest(o,r,a??c);throw Sb(this).info(`[${c}] connection ${y?"timed out":"failed"} - error; no more retries left`),Sb(this).debug(`[${c}] connection ${y?"timed out":"failed"} (error; no more retries left)`,bQ({retryOfRequestLogID:a,url:I,durationMs:F-E,message:R.message})),y?new V0e:new BB({cause:R})}let w=`[${c}${G}] ${d.method} ${I} ${R.ok?"succeeded":"failed"} with status ${R.status} in ${F-E}ms`;if(!R.ok){let A=await this.shouldRetry(R);if(r&&A){let m=`retrying, ${r} attempts remaining`;return await HIr(R.body),Sb(this).info(`${w} - ${m}`),Sb(this).debug(`[${c}] response error (${m})`,bQ({retryOfRequestLogID:a,url:R.url,status:R.status,headers:R.headers,durationMs:F-E})),this.retryRequest(o,r,a??c,R.headers)}let y=A?"error; no more retries left":"error; not retryable";Sb(this).info(`${w} - ${y}`);let b=await R.text().catch(m=>dXe(m).message),g=EIr(b),v=g?void 0:b;throw Sb(this).debug(`[${c}] response error (${y})`,bQ({retryOfRequestLogID:a,url:R.url,status:R.status,headers:R.headers,message:v,durationMs:Date.now()-E})),this.makeStatusError(R.status,g,v,R.headers)}return Sb(this).info(w),Sb(this).debug(`[${c}] response start`,bQ({retryOfRequestLogID:a,url:R.url,status:R.status,headers:R.headers,durationMs:F-E})),{response:R,options:o,controller:W,requestLogID:c,retryOfRequestLogID:a,startTime:E}}async fetchWithTimeout(t,r,a,i){let s=r||{},{signal:e,method:o}=s,u=Y0e(s,["signal","method"]);e&&e.addEventListener("abort",()=>i.abort());let d=setTimeout(()=>i.abort(),a),I=globalThis.ReadableStream&&u.body instanceof globalThis.ReadableStream||typeof u.body=="object"&&u.body!==null&&Symbol.asyncIterator in u.body,h=Object.assign(Object.assign(Object.assign({signal:i.signal},I?{duplex:"half"}:{}),{method:"GET"}),u);o&&(h.method=o.toUpperCase());try{return await this.fetch.call(void 0,t,h)}finally{clearTimeout(d)}}async shouldRetry(t){let r=t.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,r,a,i){var s;let e,o=i?.get("retry-after-ms");if(o){let d=parseFloat(o);Number.isNaN(d)||(e=d)}let u=i?.get("retry-after");if(u&&!e){let d=parseFloat(u);Number.isNaN(d)?e=Date.parse(u)-Date.now():e=d*1e3}if(!(e&&0<=e&&e<60*1e3)){let d=(s=t.maxRetries)!==null&&s!==void 0?s:this.maxRetries;e=this.calculateDefaultRetryTimeoutMillis(r,d)}return await RIr(e),this.makeRequest(t,r-1,a)}calculateDefaultRetryTimeoutMillis(t,r){let s=r-t,e=Math.min(.5*Math.pow(2,s),8),o=1-Math.random()*.25;return e*o*1e3}async buildRequest(t,{retryCount:r=0}={}){var a,i,s;let e=Object.assign({},t),{method:o,path:u,query:d,defaultBaseURL:I}=e,h=this.buildURL(u,d,I);"timeout"in e&&FIr("timeout",e.timeout),e.timeout=(a=e.timeout)!==null&&a!==void 0?a:this.timeout;let{bodyHeaders:c,body:G}=this.buildBody({options:e}),E=await this.buildHeaders({options:t,method:o,bodyHeaders:c,retryCount:r});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:o,headers:E},e.signal&&{signal:e.signal}),globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"}),G&&{body:G}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(s=e.fetchOptions)!==null&&s!==void 0?s:{}),url:h,timeout:e.timeout}}async buildHeaders({options:t,method:r,bodyHeaders:a,retryCount:i}){let s={};this.idempotencyHeader&&r!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=t.idempotencyKey);let e=await this.authHeaders(t),o=NK([s,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i)},t.timeout?{"X-Stainless-Timeout":String(Math.trunc(t.timeout/1e3))}:{}),xIr()),this._options.defaultHeaders,a,t.headers,e]);return this.validateHeaders(o),o.values}buildBody({options:{body:t,headers:r}}){if(!t)return{bodyHeaders:void 0,body:void 0};let a=NK([r]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&a.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:typeof t=="object"&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&typeof t.next=="function")?{bodyHeaders:void 0,body:QIr(t)}:this.encoder({body:t,headers:a})}};M0e.DEFAULT_TIMEOUT=6e4;Z0=class extends M0e{constructor(){super(...arguments),this.interactions=new O0e(this)}};s5t=Z0;Z0.GeminiNextGenAPIClient=s5t;Z0.GeminiNextGenAPIClientError=af;Z0.APIError=lf;Z0.APIConnectionError=BB;Z0.APIConnectionTimeoutError=V0e;Z0.APIUserAbortError=WK;Z0.NotFoundError=k0e;Z0.ConflictError=L0e;Z0.RateLimitError=B0e;Z0.BadRequestError=Q0e;Z0.AuthenticationError=H0e;Z0.InternalServerError=J0e;Z0.PermissionDeniedError=X0e;Z0.UnprocessableEntityError=S0e;Z0.toFile=JIr;Z0.Interactions=O0e;boi=1024*1024*8;});function $Ir(n,t){return{...n,...t}}function o5t(n){let{prompt_id:t,...r}=n;return r}function GQ(n){return Array.isArray(n)?n.map(o5t):n}var z0e=ct(()=>{"use strict";Ci();});var c5t={};po(c5t,{DEFAULT_PROXY_CONFIG:()=>ndr,getActiveProxyServerUrl:()=>EW,getAvailableProxyServers:()=>edr,getProxyServerInfo:()=>tdr,getProxyServers:()=>yK,hasAvailableProxyServer:()=>vXe});function yK(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function EW(){let t=yK().find(r=>r.status==="active");if(!t)throw new Error("No active proxy server available. Please contact support.");return t.url}function edr(){return yK().filter(t=>t.status==="active")}function vXe(){return yK().some(t=>t.status==="active")}function tdr(n){return yK().find(r=>r.url===n)}var ndr,TB=ct(()=>{"use strict";ndr={serverUrl:EW(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import*as Vc from"fs";import*as HN from"path";import*as gQ from"os";function rdr(n){Qs.configure(n)}function adr(n){Qs.setUserInfo(n)}function idr(n){Qs.setCliVersion(n)}async function ldr(){return await Qs.getUserHeaders()}function sdr(){return Qs.getStatus()}var FK,Vs,Qs,Zw=ct(()=>{"use strict";TB();FK=259200,Vs=class n{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){let t=this.cliVersion,r=process.platform,a=process.arch;return t.startsWith("VSCode-")?`DeepVCode/VSCode/${t.replace("VSCode-","")} (${r}; ${a})`:`DeepVCode/CLI/${t} (${r}; ${a})`}formatTimeRemaining(t){if(t<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(t/1e3),a=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),s=Math.floor(r%3600/60),e=r%60;return a>0?`${a}\u5929${i}\u5C0F\u65F6${s}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${s}\u5206\u949F${e}\u79D2`:s>0?`${s}\u5206\u949F${e}\u79D2`:`${e}\u79D2`}formatAbsoluteTime(t){return new Date(t).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=HN.join(gQ.homedir(),".deepv","user-info-dev.json"),this.jwtTokenFilePath=HN.join(gQ.homedir(),".deepv","jwt-token-dev.json"),this.usageStatsFilePath=HN.join(gQ.homedir(),".deepv","usage-stats-dev.json")):(this.userInfoFilePath=HN.join(gQ.homedir(),".deepv","user-info.json"),this.jwtTokenFilePath=HN.join(gQ.homedir(),".deepv","jwt-token.json"),this.usageStatsFilePath=HN.join(gQ.homedir(),".deepv","usage-stats.json")),this.cliVersion="1.0.322",this.config={proxyServerUrl:EW()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let t=Date.now(),r=this.jwtTokenData.expiresAt-t,a=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-FK*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${a} (until ${i}), next renewal: ${s}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return n.instance||(n.instance=new n),n.instance}loadUserInfo(){try{if(Vc.existsSync(this.userInfoFilePath)){let t=Vc.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(t);let r=a=>{if(!a||!a.includes("@"))return a;let[i,s]=a.split("@");return i.length<=2?a:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${s}`}}}catch(t){console.warn("[Login Check] Failed to load user info from local file:",t),this.userInfo=null}}saveUserInfo(){try{let t=HN.dirname(this.userInfoFilePath);Vc.existsSync(t)||Vc.mkdirSync(t,{recursive:!0}),Vc.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),console.log("[Login Check] User info saved to local file")}catch(t){console.error("[Login Check] Failed to save user info:",t)}}loadJwtToken(){try{if(Vc.existsSync(this.jwtTokenFilePath)){let t=Vc.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(t);let r=Date.now();this.isTokenExpired()?this.jwtTokenData=null:this.isTokenNearExpiry(300)&&console.log("\u26A0\uFE0F Access credential expiring soon, auto-renewal in progress")}else console.log("[Login Check] No stored access credential found, authentication required")}catch(t){console.warn("[Login Check] Failed to load access credential from local file:",t),this.jwtTokenData=null}}saveJwtToken(){try{if(!this.jwtTokenData)return;let t=HN.dirname(this.jwtTokenFilePath);Vc.existsSync(t)||Vc.mkdirSync(t,{recursive:!0}),Vc.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),console.log("[Login Check] Access credential data saved to local file")}catch(t){console.error("[Login Check] Failed to save access credential:",t)}}loadUsageStats(){try{if(Vc.existsSync(this.usageStatsFilePath)){let t=Vc.readFileSync(this.usageStatsFilePath,"utf8");this.usageStats=JSON.parse(t)}}catch(t){console.warn("[Login Check] Failed to load usage stats from local file:",t),this.usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()}}}saveUsageStats(){try{let t=HN.dirname(this.usageStatsFilePath);Vc.existsSync(t)||Vc.mkdirSync(t,{recursive:!0}),Vc.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),console.log("[Login Check] Usage stats saved to local file")}catch(t){console.error("[Login Check] Failed to save usage stats:",t)}}updateUsageStats(t){t<=0||(this.usageStats.totalCreditsConsumed+=t,this.usageStats.lastUpdated=new Date().toISOString(),this.saveUsageStats(),console.log(`[Usage Stats] Updated total credits consumed: ${this.usageStats.totalCreditsConsumed} (+${t})`))}getUsageStats(){return{...this.usageStats}}checkStartupTokenStatus(){return this.jwtTokenData?{hasToken:!0,isExpired:Date.now()>=this.jwtTokenData.expiresAt,expiresAt:this.jwtTokenData.expiresAt,hasRefreshToken:!!this.jwtTokenData.refreshToken}:{hasToken:!1,isExpired:!0,expiresAt:null,hasRefreshToken:!1}}configure(t){this.config={...this.config,...t},t.userInfo&&(this.userInfo=t.userInfo,this.saveUserInfo(),console.log(`[Login Check] User info configured: ${t.userInfo.name}`)),t.proxyServerUrl&&console.log(`[Login Check] Proxy server URL: ${t.proxyServerUrl}`),t.cliVersion&&(this.cliVersion=t.cliVersion,console.log(`[Login Check] CLI version set: ${t.cliVersion}`))}setUserInfo(t){this.userInfo=t,this.saveUserInfo(),console.log(`[Login Check] User info updated: ${t.name} (${t.email||t.openId||"N/A"})`),this.triggerLoginSuccessCallbacks()}onLoginSuccess(t){this.onLoginSuccessCallbacks.push(t)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(t=>{try{t()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(t){this.cliVersion=t,console.log(`[Login Check] CLI version updated: ${t}`)}setJwtToken(t){let r=Date.now();this.jwtTokenData={accessToken:t,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(t){let a=Date.now()+t.expiresIn*1e3;this.jwtTokenData={accessToken:t.accessToken,refreshToken:t.refreshToken,expiresIn:t.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(t.expiresIn*1e3),s=this.formatAbsoluteTime(a),e=this.formatAbsoluteTime(a-FK*1e3),u=!!t.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${e}${u}`)}async getAccessToken(){if(!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let t=Date.now(),r=this.jwtTokenData.expiresAt-t,a=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-FK*1e3,s=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(e){return console.error("[Login Check] Credential renewal failed:",e),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(t=FK){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),a=r<=t*1e3;if(a){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${t}s threshold, renewal needed: ${a}`)}return a}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let t=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":"DeepCode CLI ProxyAuthManager"},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!t.ok){if(t.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let u=await t.text();throw new Error(`Credential refresh failed (${t.status}): ${u}`)}let r=await t.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let a=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:a+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),e=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-FK*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${s} (until ${e}), next renewal: ${o}${i?" (refresh credential updated)":" (reusing existing refresh credential)"}`),this.jwtTokenData.accessToken}catch(t){throw console.error("[Login Check] Credential refresh error:",t),t}}clearTokens(){this.jwtTokenData=null;try{Vc.existsSync(this.jwtTokenFilePath)&&Vc.unlinkSync(this.jwtTokenFilePath)}catch(t){console.warn("[Login Check] Failed to delete access credential file:",t)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(){let t=await this.getAccessToken(),r=this.getCliVersion(),a=this.getUserAgent();return t?{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-Client-Version":r,"User-Agent":a}:{"X-Client-Version":r,"User-Agent":a}}getUserHeadersSync(){let t=this.getCliVersion(),r=this.getUserAgent();return this.jwtTokenData?.accessToken?{Authorization:`Bearer ${this.jwtTokenData.accessToken}`,"Content-Type":"application/json","X-Client-Version":t,"User-Agent":r}:{"X-Client-Version":t,"User-Agent":r}}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Vc.existsSync(this.userInfoFilePath)&&Vc.unlinkSync(this.userInfoFilePath)}catch(t){console.warn("[Login Check] Failed to delete user info file:",t)}try{Vc.existsSync(this.jwtTokenFilePath)&&Vc.unlinkSync(this.jwtTokenFilePath)}catch(t){console.warn("[Login Check] Failed to delete access credential file:",t)}console.log("[Login Check] Authentication cleared")}},Qs=Vs.getInstance()});import{promises as vQ}from"node:fs";import EK from"node:path";import odr from"os";var qG,_0e,tr,lv=ct(()=>{"use strict";(function(n){n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR"})(qG||(qG={}));_0e=class{config;logBuffer=[];constructor(t={}){if(this.config={level:qG.INFO,enableConsole:!0,enableFile:!1,maxFileSize:10,maxFiles:5,...t},this.config.enableFile&&!this.config.filePath){let r=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-");this.config.filePath=EK.join(odr.homedir(),".deepv","logs",`deepv-${r}.log`)}}formatMessage(t,r,...a){let i=new Date().toISOString(),s=a.map(e=>typeof e=="object"?JSON.stringify(e,null,2):String(e)).join(" ");return`[${i}] [${t}] ${r} ${s}`.trim()}async writeToFile(t){if(!(!this.config.enableFile||!this.config.filePath))try{await vQ.mkdir(EK.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await vQ.appendFile(this.config.filePath,t+`
539
+ `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(t),t.startsWith(":"))return null;let[r,a,i]=jIr(t,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};fXe=class n extends Promise{constructor(t,r,a=KIr){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=a,this.client=t}_thenUnwrap(t){return new n(this.client,this.responsePromise,async(r,a)=>t(await this.parseResponse(r,a),a))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){let[t,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(t=>this.parseResponse(this.client,t))),this.parsedPromise}then(t,r){return this.parse().then(t,r)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}};l5t=Symbol("brand.privateNullableHeaders");NK=n=>{let t=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[s,e]of qIr(a)){let o=s.toLowerCase();i.has(o)||(t.delete(s),i.add(o)),e===null?(t.delete(s),r.add(o)):(t.append(s,e),r.delete(o))}}return{[l5t]:!0,values:t,nulls:r}};uXe=n=>{var t,r,a,i,s,e;if(typeof globalThis.process<"u")return(a=(r=(t=globalThis.process.env)===null||t===void 0?void 0:t[n])===null||r===void 0?void 0:r.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(e=(s=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||s===void 0?void 0:s.call(i,n))===null||e===void 0?void 0:e.trim()};M0e=class n{constructor(t){var r,a,i,s,e,o,u,{baseURL:d=uXe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:I=(r=uXe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=t,c=Y0e(t,["baseURL","apiKey","apiVersion"]);let G=Object.assign(Object.assign({apiKey:I,apiVersion:h},c),{baseURL:d||"https://generativelanguage.googleapis.com"});this.baseURL=G.baseURL,this.timeout=(a=G.timeout)!==null&&a!==void 0?a:n.DEFAULT_TIMEOUT,this.logger=(i=G.logger)!==null&&i!==void 0?i:console;let E="warn";this.logLevel=E,this.logLevel=(e=(s=KFt(G.logLevel,"ClientOptions.logLevel",this))!==null&&s!==void 0?s:KFt(uXe("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&e!==void 0?e:E,this.fetchOptions=G.fetchOptions,this.maxRetries=(o=G.maxRetries)!==null&&o!==void 0?o:2,this.fetch=(u=G.fetch)!==null&&u!==void 0?u:VIr(),this.encoder=XIr,this._options=G,this.apiKey=I,this.apiVersion=h,this.clientAdapter=G.clientAdapter}withOptions(t){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),t))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:t,nulls:r}){if(!(t.has("authorization")||t.has("x-goog-api-key"))&&!(this.apiKey&&t.get("x-goog-api-key"))&&!r.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(t){let r=NK([t.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return NK([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return NK([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(t){return Object.entries(t).filter(([r,a])=>typeof a<"u").map(([r,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(r)}=`;throw new af(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${XB}`}defaultIdempotencyKey(){return`stainless-node-retry-${gIr()}`}makeStatusError(t,r,a,i){return lf.generate(t,r,a,i)}buildURL(t,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,s=ZIr(t)?new URL(t):new URL(i+(i.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),e=this.defaultQuery();return WIr(e)||(r=Object.assign(Object.assign({},e),r)),typeof r=="object"&&r&&!Array.isArray(r)&&(s.search=this.stringifyQuery(r)),s.toString()}async prepareOptions(t){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!t.path.startsWith(`/${this.apiVersion}/projects/`)){let r=t.path.slice(this.apiVersion.length+1);t.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${r}`}}async prepareRequest(t,{url:r,options:a}){}get(t,r){return this.methodRequest("get",t,r)}post(t,r){return this.methodRequest("post",t,r)}patch(t,r){return this.methodRequest("patch",t,r)}put(t,r){return this.methodRequest("put",t,r)}delete(t,r){return this.methodRequest("delete",t,r)}methodRequest(t,r,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:t,path:r},i)))}request(t,r=null){return new fXe(this,this.makeRequest(t,r,void 0))}async makeRequest(t,r,a){var i,s,e;let o=await t,u=(i=o.maxRetries)!==null&&i!==void 0?i:this.maxRetries;r==null&&(r=u),await this.prepareOptions(o);let{req:d,url:I,timeout:h}=await this.buildRequest(o,{retryCount:u-r});await this.prepareRequest(d,{url:I,options:o});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),G=a===void 0?"":`, retryOf: ${a}`,E=Date.now();if(Sb(this).debug(`[${c}] sending request`,bQ({retryOfRequestLogID:a,method:o.method,url:I,options:o,headers:d.headers})),!((s=o.signal)===null||s===void 0)&&s.aborted)throw new WK;let W=new AbortController,R=await this.fetchWithTimeout(I,d,h,W).catch(dXe),F=Date.now();if(R instanceof globalThis.Error){let A=`retrying, ${r} attempts remaining`;if(!((e=o.signal)===null||e===void 0)&&e.aborted)throw new WK;let y=IXe(R)||/timed? ?out/i.test(String(R)+("cause"in R?String(R.cause):""));if(r)return Sb(this).info(`[${c}] connection ${y?"timed out":"failed"} - ${A}`),Sb(this).debug(`[${c}] connection ${y?"timed out":"failed"} (${A})`,bQ({retryOfRequestLogID:a,url:I,durationMs:F-E,message:R.message})),this.retryRequest(o,r,a??c);throw Sb(this).info(`[${c}] connection ${y?"timed out":"failed"} - error; no more retries left`),Sb(this).debug(`[${c}] connection ${y?"timed out":"failed"} (error; no more retries left)`,bQ({retryOfRequestLogID:a,url:I,durationMs:F-E,message:R.message})),y?new V0e:new BB({cause:R})}let w=`[${c}${G}] ${d.method} ${I} ${R.ok?"succeeded":"failed"} with status ${R.status} in ${F-E}ms`;if(!R.ok){let A=await this.shouldRetry(R);if(r&&A){let m=`retrying, ${r} attempts remaining`;return await HIr(R.body),Sb(this).info(`${w} - ${m}`),Sb(this).debug(`[${c}] response error (${m})`,bQ({retryOfRequestLogID:a,url:R.url,status:R.status,headers:R.headers,durationMs:F-E})),this.retryRequest(o,r,a??c,R.headers)}let y=A?"error; no more retries left":"error; not retryable";Sb(this).info(`${w} - ${y}`);let b=await R.text().catch(m=>dXe(m).message),g=EIr(b),v=g?void 0:b;throw Sb(this).debug(`[${c}] response error (${y})`,bQ({retryOfRequestLogID:a,url:R.url,status:R.status,headers:R.headers,message:v,durationMs:Date.now()-E})),this.makeStatusError(R.status,g,v,R.headers)}return Sb(this).info(w),Sb(this).debug(`[${c}] response start`,bQ({retryOfRequestLogID:a,url:R.url,status:R.status,headers:R.headers,durationMs:F-E})),{response:R,options:o,controller:W,requestLogID:c,retryOfRequestLogID:a,startTime:E}}async fetchWithTimeout(t,r,a,i){let s=r||{},{signal:e,method:o}=s,u=Y0e(s,["signal","method"]);e&&e.addEventListener("abort",()=>i.abort());let d=setTimeout(()=>i.abort(),a),I=globalThis.ReadableStream&&u.body instanceof globalThis.ReadableStream||typeof u.body=="object"&&u.body!==null&&Symbol.asyncIterator in u.body,h=Object.assign(Object.assign(Object.assign({signal:i.signal},I?{duplex:"half"}:{}),{method:"GET"}),u);o&&(h.method=o.toUpperCase());try{return await this.fetch.call(void 0,t,h)}finally{clearTimeout(d)}}async shouldRetry(t){let r=t.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,r,a,i){var s;let e,o=i?.get("retry-after-ms");if(o){let d=parseFloat(o);Number.isNaN(d)||(e=d)}let u=i?.get("retry-after");if(u&&!e){let d=parseFloat(u);Number.isNaN(d)?e=Date.parse(u)-Date.now():e=d*1e3}if(!(e&&0<=e&&e<60*1e3)){let d=(s=t.maxRetries)!==null&&s!==void 0?s:this.maxRetries;e=this.calculateDefaultRetryTimeoutMillis(r,d)}return await RIr(e),this.makeRequest(t,r-1,a)}calculateDefaultRetryTimeoutMillis(t,r){let s=r-t,e=Math.min(.5*Math.pow(2,s),8),o=1-Math.random()*.25;return e*o*1e3}async buildRequest(t,{retryCount:r=0}={}){var a,i,s;let e=Object.assign({},t),{method:o,path:u,query:d,defaultBaseURL:I}=e,h=this.buildURL(u,d,I);"timeout"in e&&FIr("timeout",e.timeout),e.timeout=(a=e.timeout)!==null&&a!==void 0?a:this.timeout;let{bodyHeaders:c,body:G}=this.buildBody({options:e}),E=await this.buildHeaders({options:t,method:o,bodyHeaders:c,retryCount:r});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:o,headers:E},e.signal&&{signal:e.signal}),globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"}),G&&{body:G}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(s=e.fetchOptions)!==null&&s!==void 0?s:{}),url:h,timeout:e.timeout}}async buildHeaders({options:t,method:r,bodyHeaders:a,retryCount:i}){let s={};this.idempotencyHeader&&r!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=t.idempotencyKey);let e=await this.authHeaders(t),o=NK([s,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i)},t.timeout?{"X-Stainless-Timeout":String(Math.trunc(t.timeout/1e3))}:{}),xIr()),this._options.defaultHeaders,a,t.headers,e]);return this.validateHeaders(o),o.values}buildBody({options:{body:t,headers:r}}){if(!t)return{bodyHeaders:void 0,body:void 0};let a=NK([r]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&a.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:typeof t=="object"&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&typeof t.next=="function")?{bodyHeaders:void 0,body:QIr(t)}:this.encoder({body:t,headers:a})}};M0e.DEFAULT_TIMEOUT=6e4;Z0=class extends M0e{constructor(){super(...arguments),this.interactions=new O0e(this)}};s5t=Z0;Z0.GeminiNextGenAPIClient=s5t;Z0.GeminiNextGenAPIClientError=af;Z0.APIError=lf;Z0.APIConnectionError=BB;Z0.APIConnectionTimeoutError=V0e;Z0.APIUserAbortError=WK;Z0.NotFoundError=k0e;Z0.ConflictError=L0e;Z0.RateLimitError=B0e;Z0.BadRequestError=Q0e;Z0.AuthenticationError=H0e;Z0.InternalServerError=J0e;Z0.PermissionDeniedError=X0e;Z0.UnprocessableEntityError=S0e;Z0.toFile=JIr;Z0.Interactions=O0e;boi=1024*1024*8;});function $Ir(n,t){return{...n,...t}}function o5t(n){let{prompt_id:t,...r}=n;return r}function GQ(n){return Array.isArray(n)?n.map(o5t):n}var z0e=ct(()=>{"use strict";Ci();});var c5t={};po(c5t,{DEFAULT_PROXY_CONFIG:()=>ndr,getActiveProxyServerUrl:()=>EW,getAvailableProxyServers:()=>edr,getProxyServerInfo:()=>tdr,getProxyServers:()=>yK,hasAvailableProxyServer:()=>vXe});function yK(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function EW(){let t=yK().find(r=>r.status==="active");if(!t)throw new Error("No active proxy server available. Please contact support.");return t.url}function edr(){return yK().filter(t=>t.status==="active")}function vXe(){return yK().some(t=>t.status==="active")}function tdr(n){return yK().find(r=>r.url===n)}var ndr,TB=ct(()=>{"use strict";ndr={serverUrl:EW(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import*as Vc from"fs";import*as HN from"path";import*as gQ from"os";function rdr(n){Qs.configure(n)}function adr(n){Qs.setUserInfo(n)}function idr(n){Qs.setCliVersion(n)}async function ldr(){return await Qs.getUserHeaders()}function sdr(){return Qs.getStatus()}var FK,Vs,Qs,Zw=ct(()=>{"use strict";TB();FK=259200,Vs=class n{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){let t=this.cliVersion,r=process.platform,a=process.arch;return t.startsWith("VSCode-")?`DeepVCode/VSCode/${t.replace("VSCode-","")} (${r}; ${a})`:`DeepVCode/CLI/${t} (${r}; ${a})`}formatTimeRemaining(t){if(t<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(t/1e3),a=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),s=Math.floor(r%3600/60),e=r%60;return a>0?`${a}\u5929${i}\u5C0F\u65F6${s}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${s}\u5206\u949F${e}\u79D2`:s>0?`${s}\u5206\u949F${e}\u79D2`:`${e}\u79D2`}formatAbsoluteTime(t){return new Date(t).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=HN.join(gQ.homedir(),".deepv","user-info-dev.json"),this.jwtTokenFilePath=HN.join(gQ.homedir(),".deepv","jwt-token-dev.json"),this.usageStatsFilePath=HN.join(gQ.homedir(),".deepv","usage-stats-dev.json")):(this.userInfoFilePath=HN.join(gQ.homedir(),".deepv","user-info.json"),this.jwtTokenFilePath=HN.join(gQ.homedir(),".deepv","jwt-token.json"),this.usageStatsFilePath=HN.join(gQ.homedir(),".deepv","usage-stats.json")),this.cliVersion="1.0.323",this.config={proxyServerUrl:EW()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let t=Date.now(),r=this.jwtTokenData.expiresAt-t,a=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-FK*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${a} (until ${i}), next renewal: ${s}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return n.instance||(n.instance=new n),n.instance}loadUserInfo(){try{if(Vc.existsSync(this.userInfoFilePath)){let t=Vc.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(t);let r=a=>{if(!a||!a.includes("@"))return a;let[i,s]=a.split("@");return i.length<=2?a:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${s}`}}}catch(t){console.warn("[Login Check] Failed to load user info from local file:",t),this.userInfo=null}}saveUserInfo(){try{let t=HN.dirname(this.userInfoFilePath);Vc.existsSync(t)||Vc.mkdirSync(t,{recursive:!0}),Vc.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),console.log("[Login Check] User info saved to local file")}catch(t){console.error("[Login Check] Failed to save user info:",t)}}loadJwtToken(){try{if(Vc.existsSync(this.jwtTokenFilePath)){let t=Vc.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(t);let r=Date.now();this.isTokenExpired()?this.jwtTokenData=null:this.isTokenNearExpiry(300)&&console.log("\u26A0\uFE0F Access credential expiring soon, auto-renewal in progress")}else console.log("[Login Check] No stored access credential found, authentication required")}catch(t){console.warn("[Login Check] Failed to load access credential from local file:",t),this.jwtTokenData=null}}saveJwtToken(){try{if(!this.jwtTokenData)return;let t=HN.dirname(this.jwtTokenFilePath);Vc.existsSync(t)||Vc.mkdirSync(t,{recursive:!0}),Vc.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),console.log("[Login Check] Access credential data saved to local file")}catch(t){console.error("[Login Check] Failed to save access credential:",t)}}loadUsageStats(){try{if(Vc.existsSync(this.usageStatsFilePath)){let t=Vc.readFileSync(this.usageStatsFilePath,"utf8");this.usageStats=JSON.parse(t)}}catch(t){console.warn("[Login Check] Failed to load usage stats from local file:",t),this.usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()}}}saveUsageStats(){try{let t=HN.dirname(this.usageStatsFilePath);Vc.existsSync(t)||Vc.mkdirSync(t,{recursive:!0}),Vc.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),console.log("[Login Check] Usage stats saved to local file")}catch(t){console.error("[Login Check] Failed to save usage stats:",t)}}updateUsageStats(t){t<=0||(this.usageStats.totalCreditsConsumed+=t,this.usageStats.lastUpdated=new Date().toISOString(),this.saveUsageStats(),console.log(`[Usage Stats] Updated total credits consumed: ${this.usageStats.totalCreditsConsumed} (+${t})`))}getUsageStats(){return{...this.usageStats}}checkStartupTokenStatus(){return this.jwtTokenData?{hasToken:!0,isExpired:Date.now()>=this.jwtTokenData.expiresAt,expiresAt:this.jwtTokenData.expiresAt,hasRefreshToken:!!this.jwtTokenData.refreshToken}:{hasToken:!1,isExpired:!0,expiresAt:null,hasRefreshToken:!1}}configure(t){this.config={...this.config,...t},t.userInfo&&(this.userInfo=t.userInfo,this.saveUserInfo(),console.log(`[Login Check] User info configured: ${t.userInfo.name}`)),t.proxyServerUrl&&console.log(`[Login Check] Proxy server URL: ${t.proxyServerUrl}`),t.cliVersion&&(this.cliVersion=t.cliVersion,console.log(`[Login Check] CLI version set: ${t.cliVersion}`))}setUserInfo(t){this.userInfo=t,this.saveUserInfo(),console.log(`[Login Check] User info updated: ${t.name} (${t.email||t.openId||"N/A"})`),this.triggerLoginSuccessCallbacks()}onLoginSuccess(t){this.onLoginSuccessCallbacks.push(t)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(t=>{try{t()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(t){this.cliVersion=t,console.log(`[Login Check] CLI version updated: ${t}`)}setJwtToken(t){let r=Date.now();this.jwtTokenData={accessToken:t,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(t){let a=Date.now()+t.expiresIn*1e3;this.jwtTokenData={accessToken:t.accessToken,refreshToken:t.refreshToken,expiresIn:t.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(t.expiresIn*1e3),s=this.formatAbsoluteTime(a),e=this.formatAbsoluteTime(a-FK*1e3),u=!!t.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${e}${u}`)}async getAccessToken(){if(!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let t=Date.now(),r=this.jwtTokenData.expiresAt-t,a=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-FK*1e3,s=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(e){return console.error("[Login Check] Credential renewal failed:",e),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(t=FK){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),a=r<=t*1e3;if(a){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${t}s threshold, renewal needed: ${a}`)}return a}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let t=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":"DeepCode CLI ProxyAuthManager"},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!t.ok){if(t.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let u=await t.text();throw new Error(`Credential refresh failed (${t.status}): ${u}`)}let r=await t.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let a=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:a+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),e=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-FK*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${s} (until ${e}), next renewal: ${o}${i?" (refresh credential updated)":" (reusing existing refresh credential)"}`),this.jwtTokenData.accessToken}catch(t){throw console.error("[Login Check] Credential refresh error:",t),t}}clearTokens(){this.jwtTokenData=null;try{Vc.existsSync(this.jwtTokenFilePath)&&Vc.unlinkSync(this.jwtTokenFilePath)}catch(t){console.warn("[Login Check] Failed to delete access credential file:",t)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(){let t=await this.getAccessToken(),r=this.getCliVersion(),a=this.getUserAgent();return t?{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-Client-Version":r,"User-Agent":a}:{"X-Client-Version":r,"User-Agent":a}}getUserHeadersSync(){let t=this.getCliVersion(),r=this.getUserAgent();return this.jwtTokenData?.accessToken?{Authorization:`Bearer ${this.jwtTokenData.accessToken}`,"Content-Type":"application/json","X-Client-Version":t,"User-Agent":r}:{"X-Client-Version":t,"User-Agent":r}}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Vc.existsSync(this.userInfoFilePath)&&Vc.unlinkSync(this.userInfoFilePath)}catch(t){console.warn("[Login Check] Failed to delete user info file:",t)}try{Vc.existsSync(this.jwtTokenFilePath)&&Vc.unlinkSync(this.jwtTokenFilePath)}catch(t){console.warn("[Login Check] Failed to delete access credential file:",t)}console.log("[Login Check] Authentication cleared")}},Qs=Vs.getInstance()});import{promises as vQ}from"node:fs";import EK from"node:path";import odr from"os";var qG,_0e,tr,lv=ct(()=>{"use strict";(function(n){n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR"})(qG||(qG={}));_0e=class{config;logBuffer=[];constructor(t={}){if(this.config={level:qG.INFO,enableConsole:!0,enableFile:!1,maxFileSize:10,maxFiles:5,...t},this.config.enableFile&&!this.config.filePath){let r=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-");this.config.filePath=EK.join(odr.homedir(),".deepv","logs",`deepv-${r}.log`)}}formatMessage(t,r,...a){let i=new Date().toISOString(),s=a.map(e=>typeof e=="object"?JSON.stringify(e,null,2):String(e)).join(" ");return`[${i}] [${t}] ${r} ${s}`.trim()}async writeToFile(t){if(!(!this.config.enableFile||!this.config.filePath))try{await vQ.mkdir(EK.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await vQ.appendFile(this.config.filePath,t+`
540
540
  `,"utf-8")}catch(r){console.error("\u5199\u5165\u65E5\u5FD7\u6587\u4EF6\u5931\u8D25:",r)}}async rotateLogIfNeeded(){if(this.config.filePath)try{if((await vQ.stat(this.config.filePath)).size/(1024*1024)>(this.config.maxFileSize||10)){let a=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-"),i=this.config.filePath.replace(".log",`-${a}.log`);await vQ.rename(this.config.filePath,i),await this.cleanOldLogs()}}catch(t){t.code!=="ENOENT"&&console.error("\u65E5\u5FD7\u8F6E\u8F6C\u5931\u8D25:",t)}}async cleanOldLogs(){if(this.config.filePath)try{let t=EK.dirname(this.config.filePath),a=(await vQ.readdir(t)).filter(e=>e.startsWith("deepv-")&&e.endsWith(".log")).map(e=>({name:e,path:EK.join(t,e),time:vQ.stat(EK.join(t,e)).then(o=>o.mtime)})),i=await Promise.all(a.map(async e=>({...e,time:await e.time})));i.sort((e,o)=>o.time.getTime()-e.time.getTime());let s=i.slice(this.config.maxFiles||5);for(let e of s)await vQ.unlink(e.path)}catch(t){console.error("\u6E05\u7406\u65E7\u65E5\u5FD7\u5931\u8D25:",t)}}log(t,r,a,...i){if(t<this.config.level)return;let s=this.formatMessage(r,a,...i);this.config.enableConsole&&(t>=qG.ERROR?console.error:t>=qG.WARN?console.warn:t>=qG.INFO?console.log:console.debug)(s),this.config.enableFile&&this.writeToFile(s)}debug(t,...r){this.log(qG.DEBUG,"DEBUG",t,...r)}info(t,...r){this.log(qG.INFO,"INFO",t,...r)}warn(t,...r){this.log(qG.WARN,"WARN",t,...r)}error(t,...r){this.log(qG.ERROR,"ERROR",t,...r)}logApiRequest(t,r){this.debug("API\u8BF7\u6C42",{endpoint:t,timestamp:new Date().toISOString(),requestSize:JSON.stringify(r).length,...process.env.FILE_DEBUG==="1"?{requestData:r}:{}})}logApiResponse(t,r){this.debug("API\u54CD\u5E94",{endpoint:t,timestamp:new Date().toISOString(),responseSize:JSON.stringify(r).length,...process.env.FILE_DEBUG==="1"?{responseData:r}:{}})}},tr=new _0e({level:process.env.FILE_DEBUG==="1"?qG.DEBUG:qG.INFO,enableConsole:!0,enableFile:process.env.LOG_TO_FILE==="true",filePath:process.env.LOG_FILE_PATH})});function Jo(n){return n instanceof Error&&"code"in n}function cr(n){if(n instanceof Error)return n.message;try{return String(n)}catch{return"Failed to get error details"}}function ZXe(n){if(n&&typeof n=="object"&&"response"in n){let r=cdr(n);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new j0e(r.error.message);case 401:return new uI(r.error.message);case 403:return new P0e(r.error.message);default:}}return n}function cdr(n){return typeof n.response?.data=="string"?JSON.parse(n.response?.data):n.response?.data}var P0e,uI,j0e,Qc=ct(()=>{"use strict";P0e=class extends Error{},uI=class extends Error{},j0e=class extends Error{}});var Ha,u5t,Qd,RW=ct(()=>{"use strict";(function(n){n.CHAT_CONVERSATION="chat_conversation",n.WEB_FETCH="web_fetch",n.WEB_SEARCH="web_search",n.CONTENT_SUMMARY="content_summary",n.JSON_GENERATION="json_generation",n.COMPRESSION="compression",n.SUB_AGENT="sub_agent",n.CODE_ASSIST="code_assist",n.EDIT_CORRECTION="edit_correction"})(Ha||(Ha={}));u5t={[Ha.CHAT_CONVERSATION]:"auto",[Ha.WEB_FETCH]:"gemini-2.5-flash",[Ha.WEB_SEARCH]:"gemini-2.5-flash",[Ha.CODE_ASSIST]:"auto",[Ha.CONTENT_SUMMARY]:"gemini-2.5-flash-lite",[Ha.EDIT_CORRECTION]:"gemini-2.5-flash-lite",[Ha.JSON_GENERATION]:"gemini-2.5-flash",[Ha.COMPRESSION]:"gemini-2.5-flash",[Ha.SUB_AGENT]:"auto"},Qd=class{static getModelForScene(t){if(t)return u5t[t]}static isClaudeModel(t){return t.includes("claude")||t.includes("anthropic")}static isGeminiModel(t){return t.includes("gemini")&&!this.isClaudeModel(t)}static getSceneDisplayName(t){return{[Ha.CHAT_CONVERSATION]:"\u804A\u5929\u5BF9\u8BDD",[Ha.WEB_FETCH]:"Web\u5185\u5BB9\u83B7\u53D6",[Ha.WEB_SEARCH]:"Web\u641C\u7D22",[Ha.CODE_ASSIST]:"\u4EE3\u7801\u52A9\u624B",[Ha.CONTENT_SUMMARY]:"\u5185\u5BB9\u6458\u8981",[Ha.EDIT_CORRECTION]:"\u7F16\u8F91\u6821\u6B63",[Ha.JSON_GENERATION]:"JSON\u751F\u6210",[Ha.COMPRESSION]:"\u5BF9\u8BDD\u538B\u7F29",[Ha.SUB_AGENT]:"SubAgent\u5B50\u4EE3\u7406"}[t]||t}}});function T5(n){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="object"&&"message"in n.error}function sf(n){return typeof n=="object"&&n!==null&&"message"in n&&typeof n.message=="string"}function XN(n){let t=r=>r.includes("Quota exceeded for quota metric 'Gemini")&&r.includes("Pro Requests'");if(typeof n=="string")return t(n);if(sf(n))return t(n.message);if(T5(n))return t(n.error.message);if(n&&typeof n=="object"&&"response"in n){let r=n;if(r.response&&r.response.data){if(typeof r.response.data=="string")return t(r.response.data);if(typeof r.response.data=="object"&&r.response.data!==null&&"error"in r.response.data){let a=r.response.data;return t(a.error?.message||"")}}}return!1}function kN(n){return typeof n=="string"?n.includes("Quota exceeded for quota metric"):sf(n)?n.message.includes("Quota exceeded for quota metric"):T5(n)?n.error.message.includes("Quota exceeded for quota metric"):!1}function of(n){if(n&&typeof n=="object"&&"response"in n){let t=n;if(t.response?.status===402&&t.response.data){let r=t.response.data;if(r&&typeof r.error=="string"&&(r.error==="Quota limit exceeded"||r.error==="No quota configuration")&&typeof r.message=="string")return!0}if(t.response?.status===500&&t.response.data){let r=t.response.data;if(r&&typeof r.message=="string"&&r.message.includes("quota exceeded"))return!0}}if(n instanceof Error&&n.message&&(n.message.includes("API request failed (402):")&&(n.message.includes('"error":"Quota limit exceeded"')||n.message.includes('"error":"No quota configuration"'))||n.message.includes("API request failed (500):")&&n.message.includes("quota exceeded")||n.message.includes("Stream API error (500):")&&n.message.includes("quota exceeded")))return!0;if(typeof n=="object"&&n!==null){let t=n;if(t.message&&typeof t.message=="string"&&(t.message.includes("API request failed (402):")&&(t.message.includes('"error":"Quota limit exceeded"')||t.message.includes('"error":"No quota configuration"'))||t.message.includes("API error (402):")&&(t.message.includes('"error":"Quota limit exceeded"')||t.message.includes('"error":"No quota configuration"'))||(t.message.includes("API request failed (500):")||t.message.includes("Stream API error (500):"))&&t.message.includes("quota exceeded"))||(t.error==="Quota limit exceeded"||t.error==="No quota configuration")&&typeof t.message=="string"||t.status===500&&typeof t.message=="string"&&t.message.includes("quota exceeded"))return!0}return typeof n=="string"?n.includes("Quota limit exceeded")||n.includes("No quota configuration")||n.includes("Daily token limit would be exceeded")||n.includes("Daily request limit exceeded")||n.includes("Daily cost limit would be exceeded")||n.includes("500")&&n.includes("quota exceeded"):!1}function RK(n){let t=null;if(n&&typeof n=="object"&&"response"in n){let r=n;if(r.response?.status===402&&r.response.data)t=r.response.data;else if(r.response?.status===500&&r.response.data){let a=r.response.data;a&&typeof a.message=="string"&&a.message.includes("quota exceeded")&&(t=a)}}else if(typeof n=="object"&&n!==null){let r=n;if(r.message&&typeof r.message=="string"&&(r.message.includes("API request failed (402):")||r.message.includes("API request failed (500):")||r.message.includes("Stream API error (500):"))&&(r.message.includes('"error":"Quota limit exceeded"')||r.message.includes('"error":"No quota configuration"')||r.message.includes("quota exceeded")))try{let a=r.message.match(/\{.*\}$/);a&&(t=JSON.parse(a[0]))}catch{}t||(t=n)}if(!t&&n instanceof Error&&n.message&&(n.message.includes("API request failed (402):")||n.message.includes("API request failed (500):")||n.message.includes("Stream API error (500):"))&&(n.message.includes('"error":"Quota limit exceeded"')||n.message.includes('"error":"No quota configuration"')||n.message.includes("quota exceeded")))try{let r=n.message.match(/\{.*\}$/);r&&(t=JSON.parse(r[0]))}catch{}return t?t.message&&t.message.includes("quota exceeded")?udr(t):Idr(t):null}function udr(n){let r=(()=>{try{let c=process.env,G=c.LC_ALL||c.LC_CTYPE||c.LANG||"";return G.toLowerCase().includes("zh")||G.toLowerCase().includes("chinese")}catch{return!1}})(),a="",i="",s="",e="",o=n.message||"",u=o.match(/Role:\s*([^,]+)/);u&&(a=u[1].trim());let d=o.match(/Limit:\s*([^,]+)/);d&&(i=d[1].trim());let I=o.match(/Used:\s*([^,]+)/);I&&(s=I[1].trim());let h=o.match(/Cycle:\s*([^,]+)/);if(h&&(e=h[1].trim()),r){let c=`\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
541
541
  `;return c+=`\u{1F6AB} \u5F53\u524D\u6A21\u578B\u7684\u5FAA\u73AF\u914D\u989D\u5DF2\u7528\u5C3D (Cycle Quota Exceeded)
542
542
  `,a&&(c+=`\u{1F464} \u89D2\u8272\u4FE1\u606F: ${a}
@@ -708,7 +708,7 @@ ${s}`;break;case"retry":qVt(s)&&(r[i]=s);break;case"id":$Vt(s)&&(r[i]=s);break;c
708
708
 
709
709
  Please check your Feishu authentication token and try again.
710
710
  If the problem persists, you may need to re-authenticate.`);throw a.isAuthError=!0,a.statusCode=401,a}throw t}async generateContentStream(t,r){let a=Qd.getModelForScene(r),i=this.config?.getModel(),s;if(i&&is(i)?(t.model&&is(t.model)?s=t.model:s=i,console.log(`[DeepV Server] (Stream) User is using custom model, overriding scene model for ${r}: ${s}`)):s=t.model||a||i||"auto",is(s)&&this.config){let o=this.config.getCustomModelConfig(s);if(o)return console.log("[DeepV Server] Custom model detected, using streaming mode"),mQt(o,t,t.config?.abortSignal)}return process.env.DEEPV_CLOUD_MODE==="true"?this._generateContent(t,r):$3r(t.model)?this._generateContentStream(t,r):this._generateContent(t,r)}async _generateContent(t,r){let a=await this.generateContent(t,r);return(async function*(){yield a})()}async _generateContentStream(t,r){try{let a=Qd.getModelForScene(r),i=this.config?.getModel(),s;i&&is(i)?(t.model&&is(t.model)?s=t.model:s=i,console.log(`[DeepV Server] (_Stream) User is using custom model, overriding scene model for ${r}: ${s}`)):s=t.model||a||i||"auto",process.env.DEBUG&&console.log(`[\u{1F3AF} Model Resolution (Stream)] Using model: ${s} for scene: ${r}`);let e={model:s,contents:this.cleanContents(GQ(t.contents)),config:{...t.config,stream:!0,httpOptions:{...t.config?.httpOptions,headers:{...t.config?.httpOptions?.headers,"X-Scene-Type":r,"X-Scene-Display":Qd.getSceneDisplayName(r)}}}};tr.info(`[DeepV Server] Starting stream with model: ${s}`);let o=await this.callStreamAPI("/v1/chat/stream",e,t.config?.abortSignal);return this.createStreamGenerator(o,t.config?.abortSignal)}catch(a){return tr.error("[DeepV Server] Stream request failed",{error:a}),this.handleStreamError(a)}}async callStreamAPI(t,r,a){return pm(()=>this.executeStreamAPICall(t,r,a),{shouldRetry:i=>{if(of(i)||i.message.includes("cancelled by user")||i.name==="AbortError"||i.message.includes("401")||i instanceof uI||i.message.includes("451")||i.message.includes("REGION_BLOCKED"))return!1;if(i.message.includes("429")||i.message.match(/5\d{2}/))return!0;let s=i.message.toLowerCase(),e=i?.cause?.code||i?.code;return!!(s.includes("terminated")||s.includes("socket hang up")||s.includes("connection closed")||s.includes("other side closed")||e&&["ECONNRESET","ECONNABORTED","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_SOCKET","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT"].includes(e)||i instanceof TypeError&&i.message.includes("fetch failed"))}})}async executeStreamAPICall(t,r,a){let i=await Qs.getUserHeaders(),s=`${Qs.getProxyServerUrl()}${t}`;if(process.env.DEBUG){console.log("\u{1F50D} [DeepV Debug Stream] Proxy environment variables:"),console.log(" HTTP_PROXY:",process.env.HTTP_PROXY),console.log(" HTTPS_PROXY:",process.env.HTTPS_PROXY),console.log(" http_proxy:",process.env.http_proxy),console.log(" https_proxy:",process.env.https_proxy),console.log(" Target URL:",s);let d=(0,bQt.getGlobalDispatcher)();console.log("\u{1F50D} [DeepV Debug Stream] Global dispatcher:",d?.constructor?.name||"undefined"),d&&"uri"in d&&console.log(" Dispatcher URI:",d.uri)}let e=new AbortController,o=null;if(a)if(a.aborted)e.abort();else{let d=()=>{process.env.DEBUG&&console.log("[DeepV Server] Stream request cancelled by user"),e.abort()};a.addEventListener("abort",d),o=()=>a.removeEventListener("abort",d)}let u=Date.now();try{tr.debug("[DeepV Server] Making stream API call",{endpoint:t,url:s,model:r.model});let d=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...i,...this.getGitHeaders()},body:JSON.stringify(r),signal:e.signal});if(!d.ok){let h=await d.text();if(d.status===401)throw console.error("[DeepV Server] Stream 401 Unauthorized - triggering auth dialog"),this.authHandler&&await this.authHandler(),new uI("Authentication required - please re-authenticate");if(d.status===451)throw console.error("[DeepV Server] Stream 451 Region Blocked - IMMEDIATE ABORT"),e.abort(),new Error(`REGION_BLOCKED_451: ${h}`);let c=new Error(`Stream API error (${d.status}): ${h}`);throw c.status=d.status,c}let I=Date.now()-u;return tr.debug("[DeepV Server] Stream API call initiated",{endpoint:t,duration:`${I}ms`,status:d.status}),d}catch(d){let I=Date.now()-u;throw o&&o(),d instanceof Error&&(d.message.includes("cancelled by user")||d.name==="AbortError")?(console.log("\u26A0\uFE0F \u6D41\u5F0F\u4EFB\u52A1\u5DF2\u53D6\u6D88"),d):(d instanceof Error&&d.message.includes("abort")?tr.warn("[DeepV Server] Stream API aborted",{endpoint:t,duration:`${I}ms`,reason:d.message}):tr.error("[DeepV Server] Stream API call failed",{endpoint:t,duration:`${I}ms`,error:d instanceof Error?d.message:d}),d)}finally{o&&o()}}async*createStreamGenerator(t,r){let a=t.body?.getReader();if(!a)throw new Error("No stream reader available");let i=new TextDecoder,s="",e=0,o=null,u=()=>{console.log("[DeepV Server] Stream cancelled by user - releasing reader and stopping consumption");try{a.cancel()}catch{}},d;r&&!r.aborted&&(d=u,r.addEventListener("abort",d));try{for(;;){if(r?.aborted){console.log("[DeepV Server] Stream generation cancelled by user - exiting loop"),o&&console.log("[DeepV Server] Partial token consumption recorded:",{inputTokens:o.promptTokenCount||0,outputTokens:o.candidatesTokenCount||0,totalTokens:o.totalTokenCount||0,stoppedReason:"user_cancelled",bytesReceived:e});break}let I;try{I=await this.withTimeout(a.read(),3e5,"[DeepV Server] Stream read timeout after 300s (no data received in this chunk)")}catch(E){if(E instanceof Error&&(E.name==="AbortError"||E.message.includes("cancelled"))){console.log("[DeepV Server] Stream read cancelled - exiting");break}if(E instanceof TypeError){let W=E.message.toLowerCase(),R=E?.cause?.code||E?.code;if(W.includes("terminated")||W.includes("socket hang up")||W.includes("connection closed")||W.includes("other side closed")||R&&["ECONNRESET","ECONNABORTED","EPIPE","ETIMEDOUT","UND_ERR_SOCKET"].includes(R)){let w=new Error(`Stream interrupted: Connection was terminated mid-stream. This may be caused by server restart or network issues. Please retry your request. (Original: ${E.message})`);throw w.isStreamInterrupt=!0,w.isRetryable=!0,w.bytesReceived=e,console.warn(`\u26A0\uFE0F [DeepV Server] Stream connection interrupted after ${e} bytes. Cause: ${E.message}`),w}}throw E}let{done:h,value:c}=I;if(h)break;e+=c.length,s+=i.decode(c,{stream:!0});let G=s.split(`
711
- `);s=G.pop()||"";for(let E of G)if(E.startsWith("data: ")){let W=E.slice(6);if(W==="[DONE]")return;try{let R=JSON.parse(W);if(R.type==="connection_established")continue;if(R.error)throw new Error(R.error);R.usageMetadata&&(o=R.usageMetadata);let F=this.convertStreamChunkToGenAI(R);F&&(yield F)}catch(R){tr.warn("[DeepV Server] Stream chunk parse error",{data:W.substring(0,100)+"...",error:R instanceof Error?R.message:R})}}}}finally{d&&r&&r.removeEventListener("abort",d);try{a.releaseLock()}catch{}}}convertStreamChunkToGenAI(t){if(!t.candidates||!Array.isArray(t.candidates)||t.candidates.length===0)return null;let r={candidates:t.candidates,usageMetadata:t.usageMetadata};if(r.candidates?.[0]?.content?.parts){for(let a of r.candidates[0].content.parts)if(a.functionCall&&!a.functionCall.id){let i=`call_${Date.now()}_${Math.random().toString(36).substring(2,9)}`;console.log(`[DeepV Server] \u8865\u5168\u7F3A\u5931\u7684\u5DE5\u5177 ID (Chunk): ${a.functionCall.name} -> ${i}`),a.functionCall.id=i}}return r.functionCalls||Object.defineProperty(r,"functionCalls",{get:function(){if(this.candidates?.[0]?.content?.parts?.length===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning function calls from the first one.");let a=this.candidates?.[0]?.content?.parts?.filter(i=>i.functionCall).map(i=>i.functionCall).filter(i=>i!==void 0);if(a?.length!==0)return a},enumerable:!1,configurable:!0}),r}mergeStreamContent(t,r){if(!t)return r;let a=t.candidates?.[0]?.content?.parts||[],i=r.candidates?.[0]?.content?.parts||[];if(i.length>0&&i[0].text){let s=a[a.length-1];s&&s.text&&!s.functionCall?s.text+=i[0].text:a.push(...i)}else if(i.length>0&&i[0].functionCall){let s=a[a.length-1],e=i[0];if(s&&s.functionCall){let o=s.functionCall,u=e.functionCall;u&&(u.name&&(o.name=u.name.trim()),u.id&&(o.id=u.id),u.args&&(typeof u.args=="string"&&typeof o.args=="string"?o.args+=u.args:typeof u.args=="object"&&u.args!==null?o.args={...typeof o.args=="object"?o.args:{},...u.args}:o.args=u.args))}else{let o={...e};if(o.functionCall&&!o.functionCall.id){let u=`call_${Date.now()}_${Math.random().toString(36).substring(2,9)}`;console.log(`[DeepV Server] \u8865\u5168\u7F3A\u5931\u7684\u5DE5\u5177 ID: ${o.functionCall.name} -> ${u}`),o.functionCall.id=u}a.push(o)}}return r.usageMetadata&&(t.usageMetadata=r.usageMetadata),r.candidates?.[0]?.finishReason&&(t.candidates[0].finishReason=r.candidates[0].finishReason),t}buildUnifiedRequest(t,r){let a=Qd.getModelForScene(r),i=this.config?.getModel(),s;return i&&is(i)?t.model&&is(t.model)?s=t.model:s=i:s=t.model||a||"auto",{model:s,contents:t.contents,config:{...t.config,httpOptions:{...t.config?.httpOptions,headers:{...t.config?.httpOptions?.headers,"X-Scene-Type":r,"X-Scene-Display":Qd.getSceneDisplayName(r)}}}}}async*handleStreamError(t){this.handleError(t)}async countTokens(t){try{let r=t.model||this.config?.getModel()||"auto";if(is(r))return tr.debug("[DeepV Server] Custom model detected, token counting not supported"),{totalTokens:0};let a={model:r,contents:t.contents};(t.config?.systemInstruction||t.config?.tools)&&(a.config={},t.config.systemInstruction&&(a.config.systemInstruction=t.config.systemInstruction),t.config.tools&&(a.config.tools=t.config.tools));let i=await this.callUnifiedTokenCountAPI(a);return cf.emitRealTimeToken({inputTokens:i.totalTokens||0,outputTokens:0,totalTokens:i.totalTokens||0,timestamp:Date.now()}),i}catch(r){let a=t.model||this.config?.getModel()||"auto";return is(a)?tr.debug("[DeepV Server] Token count not available for custom model, using fallback"):tr.error("[DeepV Server] Token count failed:",r),this.estimateTokensAsFailback(t)}}async callUnifiedTokenCountAPI(t){let r=await Qs.getUserHeaders(),a=`${Qs.getProxyServerUrl()}/v1/chat/count-tokens`;try{let i=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json",...r,...this.getGitHeaders()},body:JSON.stringify(t)});if(!i.ok){let e=await i.text();throw i.status===401?(console.error("[DeepV Server] Token count 401 Unauthorized"),this.authHandler&&await this.authHandler(),new uI("Authentication required - please re-authenticate")):new Error(`Token count API failed (${i.status}): ${e}`)}let s=await i.json();return tr.debug("[DeepV Server] Token count response",{totalTokens:s.totalTokens}),{totalTokens:s.totalTokens||0}}catch(i){throw tr.error("[DeepV Server] Token count API call failed:",i),i}}estimateTokensAsFailback(t){try{let r=Array.isArray(t.contents)?t.contents:[{role:Lr.USER,parts:[{text:t.contents}]}],a=0,i=0,s=0,e=0;for(let c of r)if(typeof c=="object"&&c&&"parts"in c&&Array.isArray(c.parts)){for(let G of c.parts)if(typeof G=="object"&&G&&"text"in G&&typeof G.text=="string")a+=G.text.length,e++;else if(typeof G=="object"&&G&&"functionCall"in G&&G.functionCall){let E=G.functionCall,W=`[Tool: ${E.name}]`+JSON.stringify(E.args||{});a+=W.length,i++}else if(typeof G=="object"&&G&&"functionResponse"in G&&G.functionResponse){let R=`[Tool Result: ${G.functionResponse.response?.output||"result"}]`;a+=R.length+20,s++}}else typeof c=="string"&&(a+=c.length,e++);let o=JSON.stringify(r),u=/[\u4e00-\u9fff]/.test(o),d=/```|function|class|import|export|\{|\}|\[|\]/.test(o),I=4;return u?I=2:d&&(I=3),{totalTokens:Math.ceil(a/I)}}catch(r){return console.error("[DeepV Server] Fallback estimation error:",r),{totalTokens:1e3}}}async embedContent(t){throw new Error("Claude models do not support embedding content")}withTimeout(t,r,a){let i=null,s=new Promise((e,o)=>{i=setTimeout(()=>{o(new Error(a))},r)});return Promise.race([t,s]).finally(()=>{i!==null&&clearTimeout(i)})}}});function JSe(n,t){let r=n.getModel()||"auto",a={authType:t,proxy:n?.getProxy()};return t===ls.USE_PROXY_AUTH,a}async function TSe(n,t,r){let i={headers:{"User-Agent":`GeminiCLI/1.0.322 (${process.platform}; ${process.arch})`}};if(!0){let e=t.getCustomProxyServerUrl(),o;if(e)o=e,console.log(`[DeepX] Using custom proxy server: ${o}`);else{if(!vXe())throw new Error("DeepV Code server is required for all models but is not available. Please start the DeepV Code server or use proxy authentication.");o=EW(),console.log(`[DeepX] Connecting to DeepV Code server: ${o}`)}let u=process.env.GOOGLE_CLOUD_LOCATION||"us-central1",d=process.env.GOOGLE_CLOUD_PROJECT||"default-project";return new JJ(u,d,o,t)}throw new Error(`Error creating contentGenerator: Unsupported authType: ${n.authType}`)}var ls,jme=ct(()=>{"use strict";BSe();TB();(function(n){n.USE_PROXY_AUTH="proxy-auth"})(ls||(ls={}))});var Kme,fQt=ct(()=>{"use strict";Kme=class{prompts=new Map;registerPrompt(t){if(this.prompts.has(t.name)){let r=`${t.serverName}_${t.name}`;console.warn(`Prompt with name "${t.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...t,name:r})}else this.prompts.set(t.name,t)}getAllPrompts(){return Array.from(this.prompts.values()).sort((t,r)=>t.name.localeCompare(r.name))}getPrompt(t){return this.prompts.get(t)}getPromptsByServer(t){let r=[];for(let a of this.prompts.values())a.serverName===t&&r.push(a);return r.sort((a,i)=>a.name.localeCompare(i.name))}removePromptsByServer(t){for(let[r,a]of this.prompts.entries())a.serverName===t&&this.prompts.delete(r)}}});function UN(n){let t={type:"subagent_update",data:n,timestamp:Date.now()};return JSON.stringify(t)}function GQt(n){let t={type:"text",data:n,timestamp:Date.now()};return JSON.stringify(t)}function qme(n){try{let t=JSON.parse(n);if(t&&typeof t=="object"&&t.type&&t.data!==void 0)return t}catch{}return{type:"text",data:n,timestamp:Date.now()}}function $me(n){return n.type==="subagent_update"}function epe(n){return n.type==="text"}var DSe=ct(()=>{"use strict";});var qr,Hr,$r,Sl=ct(()=>{"use strict";DSe();qr=class{name;displayName;description;icon;parameterSchema;isOutputMarkdown;forceMarkdown;canUpdateOutput;allowSubAgentUse;constructor(t,r,a,i,s,e=!0,o=!1,u=!1,d=!0){this.name=t,this.displayName=r,this.description=a,this.icon=i,this.parameterSchema=s,this.isOutputMarkdown=e,this.forceMarkdown=o,this.canUpdateOutput=u,this.allowSubAgentUse=d}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(t){return null}getDescription(t){return JSON.stringify(t)}shouldConfirmExecute(t,r){return Promise.resolve(!1)}toolLocations(t){return[]}};(function(n){n.ProceedOnce="proceed_once",n.ProceedAlways="proceed_always",n.ProceedAlwaysServer="proceed_always_server",n.ProceedAlwaysTool="proceed_always_tool",n.ProceedAlwaysProject="proceed_always_project",n.ModifyWithEditor="modify_with_editor",n.Cancel="cancel"})(Hr||(Hr={}));(function(n){n.FileSearch="fileSearch",n.Folder="folder",n.Globe="globe",n.Hammer="hammer",n.LightBulb="lightBulb",n.Pencil="pencil",n.Regex="regex",n.Terminal="terminal",n.Clipboard="clipboard",n.Tasks="tasks",n.Wrench="wrench",n.Trash="trash",n.List="list",n.Info="info"})($r||($r={}))});var Bl,OSe,ea,zW,kq=ct(()=>{(function(n){n.assertEqual=i=>{};function t(i){}n.assertIs=t;function r(i){throw new Error}n.assertNever=r,n.arrayToEnum=i=>{let s={};for(let e of i)s[e]=e;return s},n.getValidEnumValues=i=>{let s=n.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),e={};for(let o of s)e[o]=i[o];return n.objectValues(e)},n.objectValues=i=>n.objectKeys(i).map(function(s){return i[s]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&s.push(e);return s},n.find=(i,s)=>{for(let e of i)if(s(e))return e},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function a(i,s=" | "){return i.map(e=>typeof e=="string"?`'${e}'`:e).join(s)}n.joinValues=a,n.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Bl||(Bl={}));(function(n){n.mergeShapes=(t,r)=>({...t,...r})})(OSe||(OSe={}));ea=Bl.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zW=n=>{switch(typeof n){case"undefined":return ea.undefined;case"string":return ea.string;case"number":return Number.isNaN(n)?ea.nan:ea.number;case"boolean":return ea.boolean;case"function":return ea.function;case"bigint":return ea.bigint;case"symbol":return ea.symbol;case"object":return Array.isArray(n)?ea.array:n===null?ea.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?ea.promise:typeof Map<"u"&&n instanceof Map?ea.map:typeof Set<"u"&&n instanceof Set?ea.set:typeof Date<"u"&&n instanceof Date?ea.date:ea.object;default:return ea.unknown}}});var vr,eWr,Gf,tpe=ct(()=>{kq();vr=Bl.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"]),eWr=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),Gf=class n extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(s){return s.message},a={_errors:[]},i=s=>{for(let e of s.issues)if(e.code==="invalid_union")e.unionErrors.map(i);else if(e.code==="invalid_return_type")i(e.returnTypeError);else if(e.code==="invalid_arguments")i(e.argumentsError);else if(e.path.length===0)a._errors.push(r(e));else{let o=a,u=0;for(;u<e.path.length;){let d=e.path[u];u===e.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(r(e))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return i(this),a}static assert(t){if(!(t instanceof n))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Bl.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},a=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];r[s]=r[s]||[],r[s].push(t(i))}else a.push(t(i));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};Gf.create=n=>new Gf(n)});var tWr,eE,USe=ct(()=>{tpe();kq();tWr=(n,t)=>{let r;switch(n.code){case vr.invalid_type:n.received===ea.undefined?r="Required":r=`Expected ${n.expected}, received ${n.received}`;break;case vr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(n.expected,Bl.jsonStringifyReplacer)}`;break;case vr.unrecognized_keys:r=`Unrecognized key(s) in object: ${Bl.joinValues(n.keys,", ")}`;break;case vr.invalid_union:r="Invalid input";break;case vr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Bl.joinValues(n.options)}`;break;case vr.invalid_enum_value:r=`Invalid enum value. Expected ${Bl.joinValues(n.options)}, received '${n.received}'`;break;case vr.invalid_arguments:r="Invalid function arguments";break;case vr.invalid_return_type:r="Invalid function return type";break;case vr.invalid_date:r="Invalid date";break;case vr.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(r=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?r=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?r=`Invalid input: must end with "${n.validation.endsWith}"`:Bl.assertNever(n.validation):n.validation!=="regex"?r=`Invalid ${n.validation}`:r="Invalid";break;case vr.too_small:n.type==="array"?r=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?r=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?r=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?r=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?r=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:r="Invalid input";break;case vr.too_big:n.type==="array"?r=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?r=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?r=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?r=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?r=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:r="Invalid input";break;case vr.custom:r="Invalid input";break;case vr.invalid_intersection_types:r="Intersection results could not be merged";break;case vr.not_multiple_of:r=`Number must be a multiple of ${n.multipleOf}`;break;case vr.not_finite:r="Number must be finite";break;default:r=t.defaultError,Bl.assertNever(n)}return{message:r}},eE=tWr});function nWr(n){gQt=n}function TJ(){return gQt}var gQt,npe=ct(()=>{USe();gQt=eE});function Or(n,t){let r=TJ(),a=Lq({issueData:t,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,r,r===eE?void 0:eE].filter(i=>!!i)});n.common.issues.push(a)}var Lq,rWr,Gm,ni,jQ,Gp,rpe,ape,Jw,DJ,MSe=ct(()=>{npe();USe();Lq=n=>{let{data:t,path:r,errorMaps:a,issueData:i}=n,s=[...r,...i.path||[]],e={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let o="",u=a.filter(d=>!!d).slice().reverse();for(let d of u)o=d(e,{data:t,defaultError:o}).message;return{...i,path:s,message:o}},rWr=[];Gm=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let a=[];for(let i of r){if(i.status==="aborted")return ni;i.status==="dirty"&&t.dirty(),a.push(i.value)}return{status:t.value,value:a}}static async mergeObjectAsync(t,r){let a=[];for(let i of r){let s=await i.key,e=await i.value;a.push({key:s,value:e})}return n.mergeObjectSync(t,a)}static mergeObjectSync(t,r){let a={};for(let i of r){let{key:s,value:e}=i;if(s.status==="aborted"||e.status==="aborted")return ni;s.status==="dirty"&&t.dirty(),e.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof e.value<"u"||i.alwaysSet)&&(a[s.value]=e.value)}return{status:t.value,value:a}}},ni=Object.freeze({status:"aborted"}),jQ=n=>({status:"dirty",value:n}),Gp=n=>({status:"valid",value:n}),rpe=n=>n.status==="aborted",ape=n=>n.status==="dirty",Jw=n=>n.status==="valid",DJ=n=>typeof Promise<"u"&&n instanceof Promise});var vQt=ct(()=>{});var Na,ZQt=ct(()=>{(function(n){n.errToObj=t=>typeof t=="string"?{message:t}:t||{},n.toString=t=>typeof t=="string"?t:t?.message})(Na||(Na={}))});function _i(n){if(!n)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:i}=n;if(t&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(e,o)=>{let{message:u}=n;return e.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??a??o.defaultError}:e.code!=="invalid_type"?{message:o.defaultError}:{message:u??r??o.defaultError}},description:i}}function yQt(n){let t="[0-5]\\d";n.precision?t=`${t}\\.\\d{${n.precision}}`:n.precision==null&&(t=`${t}(\\.\\d+)?`);let r=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function vWr(n){return new RegExp(`^${yQt(n)}$`)}function FQt(n){let t=`${WQt}T${yQt(n)}`,r=[];return r.push(n.local?"Z?":"Z"),n.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ZWr(n,t){return!!((t==="v4"||!t)&&hWr.test(n)||(t==="v6"||!t)&&pWr.test(n))}function NWr(n,t){if(!cWr.test(n))return!1;try{let[r]=n.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(a));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function AWr(n,t){return!!((t==="v4"||!t)&&mWr.test(n)||(t==="v6"||!t)&&bWr.test(n))}function WWr(n,t){let r=(n.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a,s=Number.parseInt(n.toFixed(i).replace(".","")),e=Number.parseInt(t.toFixed(i).replace(".",""));return s%e/10**i}function OJ(n){if(n instanceof gf){let t={};for(let r in n.shape){let a=n.shape[r];t[r]=vv.create(OJ(a))}return new gf({...n._def,shape:()=>t})}else return n instanceof rE?new rE({...n._def,type:OJ(n.element)}):n instanceof vv?vv.create(OJ(n.unwrap())):n instanceof PW?PW.create(OJ(n.unwrap())):n instanceof _W?_W.create(n.items.map(t=>OJ(t))):n}function _Se(n,t){let r=zW(n),a=zW(t);if(n===t)return{valid:!0,data:n};if(r===ea.object&&a===ea.object){let i=Bl.objectKeys(t),s=Bl.objectKeys(n).filter(o=>i.indexOf(o)!==-1),e={...n,...t};for(let o of s){let u=_Se(n[o],t[o]);if(!u.valid)return{valid:!1};e[o]=u.data}return{valid:!0,data:e}}else if(r===ea.array&&a===ea.array){if(n.length!==t.length)return{valid:!1};let i=[];for(let s=0;s<n.length;s++){let e=n[s],o=t[s],u=_Se(e,o);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===ea.date&&a===ea.date&&+n==+t?{valid:!0,data:n}:{valid:!1}}function EQt(n,t){return new s9({values:n,typeName:oi.ZodEnum,..._i(t)})}function AQt(n,t){let r=typeof n=="function"?n(t):typeof n=="string"?{message:n}:n;return typeof r=="string"?{message:r}:r}function RQt(n,t={},r){return n?Dw.create().superRefine((a,i)=>{let s=n(a);if(s instanceof Promise)return s.then(e=>{if(!e){let o=AQt(t,a),u=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:u})}});if(!s){let e=AQt(t,a),o=e.fatal??r??!0;i.addIssue({code:"custom",...e,fatal:o})}}):Dw.create()}var Zv,NQt,ol,aWr,iWr,lWr,sWr,oWr,cWr,uWr,IWr,dWr,zSe,hWr,mWr,pWr,bWr,fWr,GWr,WQt,gWr,Tw,KQ,qQ,$Q,e9,UJ,t9,n9,Dw,nE,MN,MJ,rE,gf,r9,tE,ipe,a9,_W,lpe,zJ,_J,spe,i9,l9,s9,o9,Ow,Nv,vv,PW,c9,u9,PJ,yWr,Sq,Bq,I9,FWr,oi,EWr,wQt,CQt,RWr,wWr,YQt,CWr,YWr,xWr,VWr,QWr,HWr,XWr,kWr,LWr,SWr,BWr,JWr,TWr,DWr,OWr,UWr,MWr,zWr,_Wr,PWr,jWr,KWr,qWr,$Wr,eyr,tyr,nyr,ryr,ayr,iyr,lyr,syr,oyr,cyr,xQt=ct(()=>{tpe();npe();ZQt();MSe();kq();Zv=class{constructor(t,r,a,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=a,this._key=i}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}},NQt=(n,t)=>{if(Jw(t))return{success:!0,data:t.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Gf(n.common.issues);return this._error=r,this._error}}};ol=class{get description(){return this._def.description}_getType(t){return zW(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:zW(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Gm,ctx:{common:t.parent.common,data:t.data,parsedType:zW(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(DJ(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let a=this.safeParse(t,r);if(a.success)return a.data;throw a.error}safeParse(t,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zW(t)},i=this._parseSync({data:t,path:a.path,parent:a});return NQt(a,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zW(t)};if(!this["~standard"].async)try{let a=this._parseSync({data:t,path:[],parent:r});return Jw(a)?{value:a.value}:{issues:r.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(a=>Jw(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(t,r){let a=await this.safeParseAsync(t,r);if(a.success)return a.data;throw a.error}async safeParseAsync(t,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zW(t)},i=this._parse({data:t,path:a.path,parent:a}),s=await(DJ(i)?i:Promise.resolve(i));return NQt(a,s)}refine(t,r){let a=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{let e=t(i),o=()=>s.addIssue({code:vr.custom,...a(i)});return typeof Promise<"u"&&e instanceof Promise?e.then(u=>u?!0:(o(),!1)):e?!0:(o(),!1)})}refinement(t,r){return this._refinement((a,i)=>t(a)?!0:(i.addIssue(typeof r=="function"?r(a,i):r),!1))}_refinement(t){return new Nv({schema:this,typeName:oi.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:r=>this["~validate"](r)}}optional(){return vv.create(this,this._def)}nullable(){return PW.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rE.create(this)}promise(){return Ow.create(this,this._def)}or(t){return r9.create([this,t],this._def)}and(t){return a9.create(this,t,this._def)}transform(t){return new Nv({..._i(this._def),schema:this,typeName:oi.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new c9({..._i(this._def),innerType:this,defaultValue:r,typeName:oi.ZodDefault})}brand(){return new Sq({typeName:oi.ZodBranded,type:this,..._i(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new u9({..._i(this._def),innerType:this,catchValue:r,typeName:oi.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Bq.create(this,t)}readonly(){return I9.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},aWr=/^c[^\s-]{8,}$/i,iWr=/^[0-9a-z]+$/,lWr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,sWr=/^[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,oWr=/^[a-z0-9_-]{21}$/i,cWr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,uWr=/^[-+]?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)?)??$/,IWr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dWr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",hWr=/^(?:(?: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])$/,mWr=/^(?:(?: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])$/,pWr=/^(([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]))$/,bWr=/^(([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])$/,fWr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,GWr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,WQt="((\\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])))",gWr=new RegExp(`^${WQt}$`);Tw=class n extends ol{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ea.string){let s=this._getOrReturnCtx(t);return Or(s,{code:vr.invalid_type,expected:ea.string,received:s.parsedType}),ni}let a=new Gm,i;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="length"){let e=t.data.length>s.value,o=t.data.length<s.value;(e||o)&&(i=this._getOrReturnCtx(t,i),e?Or(i,{code:vr.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&Or(i,{code:vr.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if(s.kind==="email")IWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"email",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="emoji")zSe||(zSe=new RegExp(dWr,"u")),zSe.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"emoji",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="uuid")sWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"uuid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="nanoid")oWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"nanoid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid")aWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"cuid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid2")iWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"cuid2",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="ulid")lWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"ulid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Or(i,{validation:"url",code:vr.invalid_string,message:s.message}),a.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"regex",code:vr.invalid_string,message:s.message}),a.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty()):s.kind==="datetime"?FQt(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.invalid_string,validation:"datetime",message:s.message}),a.dirty()):s.kind==="date"?gWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.invalid_string,validation:"date",message:s.message}),a.dirty()):s.kind==="time"?vWr(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.invalid_string,validation:"time",message:s.message}),a.dirty()):s.kind==="duration"?uWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"duration",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="ip"?ZWr(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"ip",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="jwt"?NWr(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"jwt",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="cidr"?AWr(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"cidr",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="base64"?fWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"base64",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="base64url"?GWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"base64url",code:vr.invalid_string,message:s.message}),a.dirty()):Bl.assertNever(s);return{status:a.value,value:t.data}}_regex(t,r,a){return this.refinement(i=>t.test(i),{validation:r,code:vr.invalid_string,...Na.errToObj(a)})}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Na.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Na.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Na.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Na.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Na.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Na.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Na.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Na.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Na.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Na.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Na.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Na.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Na.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...Na.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Na.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Na.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Na.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Na.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Na.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Na.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Na.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Na.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Na.errToObj(r)})}nonempty(t){return this.min(1,Na.errToObj(t))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Tw.create=n=>new Tw({checks:[],typeName:oi.ZodString,coerce:n?.coerce??!1,..._i(n)});KQ=class n extends ol{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ea.number){let s=this._getOrReturnCtx(t);return Or(s,{code:vr.invalid_type,expected:ea.number,received:s.parsedType}),ni}let a,i=new Gm;for(let s of this._def.checks)s.kind==="int"?Bl.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?WWr(t.data,s.value)!==0&&(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.not_finite,message:s.message}),i.dirty()):Bl.assertNever(s);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Na.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Na.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Na.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Na.toString(r))}setLimit(t,r,a,i){return new n({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:Na.toString(i)}]})}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Na.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Na.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Na.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Na.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Na.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Na.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Na.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Na.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Na.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Bl.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(t===null||a.value<t)&&(t=a.value)}return Number.isFinite(r)&&Number.isFinite(t)}};KQ.create=n=>new KQ({checks:[],typeName:oi.ZodNumber,coerce:n?.coerce||!1,..._i(n)});qQ=class n extends ol{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ea.bigint)return this._getInvalidInput(t);let a,i=new Gm;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Bl.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Or(r,{code:vr.invalid_type,expected:ea.bigint,received:r.parsedType}),ni}gte(t,r){return this.setLimit("min",t,!0,Na.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Na.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Na.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Na.toString(r))}setLimit(t,r,a,i){return new n({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:Na.toString(i)}]})}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Na.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Na.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Na.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Na.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Na.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};qQ.create=n=>new qQ({checks:[],typeName:oi.ZodBigInt,coerce:n?.coerce??!1,..._i(n)});$Q=class extends ol{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ea.boolean){let a=this._getOrReturnCtx(t);return Or(a,{code:vr.invalid_type,expected:ea.boolean,received:a.parsedType}),ni}return Gp(t.data)}};$Q.create=n=>new $Q({typeName:oi.ZodBoolean,coerce:n?.coerce||!1,..._i(n)});e9=class n extends ol{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ea.date){let s=this._getOrReturnCtx(t);return Or(s,{code:vr.invalid_type,expected:ea.date,received:s.parsedType}),ni}if(Number.isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return Or(s,{code:vr.invalid_date}),ni}let a=new Gm,i;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):Bl.assertNever(s);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Na.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Na.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};e9.create=n=>new e9({checks:[],coerce:n?.coerce||!1,typeName:oi.ZodDate,..._i(n)});UJ=class extends ol{_parse(t){if(this._getType(t)!==ea.symbol){let a=this._getOrReturnCtx(t);return Or(a,{code:vr.invalid_type,expected:ea.symbol,received:a.parsedType}),ni}return Gp(t.data)}};UJ.create=n=>new UJ({typeName:oi.ZodSymbol,..._i(n)});t9=class extends ol{_parse(t){if(this._getType(t)!==ea.undefined){let a=this._getOrReturnCtx(t);return Or(a,{code:vr.invalid_type,expected:ea.undefined,received:a.parsedType}),ni}return Gp(t.data)}};t9.create=n=>new t9({typeName:oi.ZodUndefined,..._i(n)});n9=class extends ol{_parse(t){if(this._getType(t)!==ea.null){let a=this._getOrReturnCtx(t);return Or(a,{code:vr.invalid_type,expected:ea.null,received:a.parsedType}),ni}return Gp(t.data)}};n9.create=n=>new n9({typeName:oi.ZodNull,..._i(n)});Dw=class extends ol{constructor(){super(...arguments),this._any=!0}_parse(t){return Gp(t.data)}};Dw.create=n=>new Dw({typeName:oi.ZodAny,..._i(n)});nE=class extends ol{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Gp(t.data)}};nE.create=n=>new nE({typeName:oi.ZodUnknown,..._i(n)});MN=class extends ol{_parse(t){let r=this._getOrReturnCtx(t);return Or(r,{code:vr.invalid_type,expected:ea.never,received:r.parsedType}),ni}};MN.create=n=>new MN({typeName:oi.ZodNever,..._i(n)});MJ=class extends ol{_parse(t){if(this._getType(t)!==ea.undefined){let a=this._getOrReturnCtx(t);return Or(a,{code:vr.invalid_type,expected:ea.void,received:a.parsedType}),ni}return Gp(t.data)}};MJ.create=n=>new MJ({typeName:oi.ZodVoid,..._i(n)});rE=class n extends ol{_parse(t){let{ctx:r,status:a}=this._processInputParams(t),i=this._def;if(r.parsedType!==ea.array)return Or(r,{code:vr.invalid_type,expected:ea.array,received:r.parsedType}),ni;if(i.exactLength!==null){let e=r.data.length>i.exactLength.value,o=r.data.length<i.exactLength.value;(e||o)&&(Or(r,{code:e?vr.too_big:vr.too_small,minimum:o?i.exactLength.value:void 0,maximum:e?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),a.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Or(r,{code:vr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),a.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Or(r,{code:vr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((e,o)=>i.type._parseAsync(new Zv(r,e,r.path,o)))).then(e=>Gm.mergeArray(a,e));let s=[...r.data].map((e,o)=>i.type._parseSync(new Zv(r,e,r.path,o)));return Gm.mergeArray(a,s)}get element(){return this._def.type}min(t,r){return new n({...this._def,minLength:{value:t,message:Na.toString(r)}})}max(t,r){return new n({...this._def,maxLength:{value:t,message:Na.toString(r)}})}length(t,r){return new n({...this._def,exactLength:{value:t,message:Na.toString(r)}})}nonempty(t){return this.min(1,t)}};rE.create=(n,t)=>new rE({type:n,minLength:null,maxLength:null,exactLength:null,typeName:oi.ZodArray,..._i(t)});gf=class n extends ol{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Bl.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ea.object){let d=this._getOrReturnCtx(t);return Or(d,{code:vr.invalid_type,expected:ea.object,received:d.parsedType}),ni}let{status:a,ctx:i}=this._processInputParams(t),{shape:s,keys:e}=this._getCached(),o=[];if(!(this._def.catchall instanceof MN&&this._def.unknownKeys==="strip"))for(let d in i.data)e.includes(d)||o.push(d);let u=[];for(let d of e){let I=s[d],h=i.data[d];u.push({key:{status:"valid",value:d},value:I._parse(new Zv(i,h,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof MN){let d=this._def.unknownKeys;if(d==="passthrough")for(let I of o)u.push({key:{status:"valid",value:I},value:{status:"valid",value:i.data[I]}});else if(d==="strict")o.length>0&&(Or(i,{code:vr.unrecognized_keys,keys:o}),a.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let I of o){let h=i.data[I];u.push({key:{status:"valid",value:I},value:d._parse(new Zv(i,h,i.path,I)),alwaysSet:I in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let d=[];for(let I of u){let h=await I.key,c=await I.value;d.push({key:h,value:c,alwaysSet:I.alwaysSet})}return d}).then(d=>Gm.mergeObjectSync(a,d)):Gm.mergeObjectSync(a,u)}get shape(){return this._def.shape()}strict(t){return Na.errToObj,new n({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,a)=>{let i=this._def.errorMap?.(r,a).message??a.defaultError;return r.code==="unrecognized_keys"?{message:Na.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(t){return new n({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new n({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:oi.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new n({...this._def,catchall:t})}pick(t){let r={};for(let a of Bl.objectKeys(t))t[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new n({...this._def,shape:()=>r})}omit(t){let r={};for(let a of Bl.objectKeys(this.shape))t[a]||(r[a]=this.shape[a]);return new n({...this._def,shape:()=>r})}deepPartial(){return OJ(this)}partial(t){let r={};for(let a of Bl.objectKeys(this.shape)){let i=this.shape[a];t&&!t[a]?r[a]=i:r[a]=i.optional()}return new n({...this._def,shape:()=>r})}required(t){let r={};for(let a of Bl.objectKeys(this.shape))if(t&&!t[a])r[a]=this.shape[a];else{let s=this.shape[a];for(;s instanceof vv;)s=s._def.innerType;r[a]=s}return new n({...this._def,shape:()=>r})}keyof(){return EQt(Bl.objectKeys(this.shape))}};gf.create=(n,t)=>new gf({shape:()=>n,unknownKeys:"strip",catchall:MN.create(),typeName:oi.ZodObject,..._i(t)});gf.strictCreate=(n,t)=>new gf({shape:()=>n,unknownKeys:"strict",catchall:MN.create(),typeName:oi.ZodObject,..._i(t)});gf.lazycreate=(n,t)=>new gf({shape:n,unknownKeys:"strip",catchall:MN.create(),typeName:oi.ZodObject,..._i(t)});r9=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a=this._def.options;function i(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let e=s.map(o=>new Gf(o.ctx.common.issues));return Or(r,{code:vr.invalid_union,unionErrors:e}),ni}if(r.common.async)return Promise.all(a.map(async s=>{let e={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:e}),ctx:e}})).then(i);{let s,e=[];for(let u of a){let d={...r,common:{...r.common,issues:[]},parent:null},I=u._parseSync({data:r.data,path:r.path,parent:d});if(I.status==="valid")return I;I.status==="dirty"&&!s&&(s={result:I,ctx:d}),d.common.issues.length&&e.push(d.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let o=e.map(u=>new Gf(u));return Or(r,{code:vr.invalid_union,unionErrors:o}),ni}}get options(){return this._def.options}};r9.create=(n,t)=>new r9({options:n,typeName:oi.ZodUnion,..._i(t)});tE=n=>n instanceof i9?tE(n.schema):n instanceof Nv?tE(n.innerType()):n instanceof l9?[n.value]:n instanceof s9?n.options:n instanceof o9?Bl.objectValues(n.enum):n instanceof c9?tE(n._def.innerType):n instanceof t9?[void 0]:n instanceof n9?[null]:n instanceof vv?[void 0,...tE(n.unwrap())]:n instanceof PW?[null,...tE(n.unwrap())]:n instanceof Sq||n instanceof I9?tE(n.unwrap()):n instanceof u9?tE(n._def.innerType):[],ipe=class n extends ol{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ea.object)return Or(r,{code:vr.invalid_type,expected:ea.object,received:r.parsedType}),ni;let a=this.discriminator,i=r.data[a],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Or(r,{code:vr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),ni)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,a){let i=new Map;for(let s of r){let e=tE(s.shape[t]);if(!e.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let o of e){if(i.has(o))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);i.set(o,s)}}return new n({typeName:oi.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,..._i(a)})}};a9=class extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=(s,e)=>{if(rpe(s)||rpe(e))return ni;let o=_Se(s.value,e.value);return o.valid?((ape(s)||ape(e))&&r.dirty(),{status:r.value,value:o.data}):(Or(a,{code:vr.invalid_intersection_types}),ni)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([s,e])=>i(s,e)):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};a9.create=(n,t,r)=>new a9({left:n,right:t,typeName:oi.ZodIntersection,..._i(r)});_W=class n extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ea.array)return Or(a,{code:vr.invalid_type,expected:ea.array,received:a.parsedType}),ni;if(a.data.length<this._def.items.length)return Or(a,{code:vr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ni;!this._def.rest&&a.data.length>this._def.items.length&&(Or(a,{code:vr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...a.data].map((e,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new Zv(a,e,a.path,o)):null}).filter(e=>!!e);return a.common.async?Promise.all(s).then(e=>Gm.mergeArray(r,e)):Gm.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new n({...this._def,rest:t})}};_W.create=(n,t)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _W({items:n,typeName:oi.ZodTuple,rest:null,..._i(t)})};lpe=class n extends ol{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ea.object)return Or(a,{code:vr.invalid_type,expected:ea.object,received:a.parsedType}),ni;let i=[],s=this._def.keyType,e=this._def.valueType;for(let o in a.data)i.push({key:s._parse(new Zv(a,o,a.path,o)),value:e._parse(new Zv(a,a.data[o],a.path,o)),alwaysSet:o in a.data});return a.common.async?Gm.mergeObjectAsync(r,i):Gm.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,a){return r instanceof ol?new n({keyType:t,valueType:r,typeName:oi.ZodRecord,..._i(a)}):new n({keyType:Tw.create(),valueType:t,typeName:oi.ZodRecord,..._i(r)})}},zJ=class extends ol{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ea.map)return Or(a,{code:vr.invalid_type,expected:ea.map,received:a.parsedType}),ni;let i=this._def.keyType,s=this._def.valueType,e=[...a.data.entries()].map(([o,u],d)=>({key:i._parse(new Zv(a,o,a.path,[d,"key"])),value:s._parse(new Zv(a,u,a.path,[d,"value"]))}));if(a.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of e){let d=await u.key,I=await u.value;if(d.status==="aborted"||I.status==="aborted")return ni;(d.status==="dirty"||I.status==="dirty")&&r.dirty(),o.set(d.value,I.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let u of e){let d=u.key,I=u.value;if(d.status==="aborted"||I.status==="aborted")return ni;(d.status==="dirty"||I.status==="dirty")&&r.dirty(),o.set(d.value,I.value)}return{status:r.value,value:o}}}};zJ.create=(n,t,r)=>new zJ({valueType:t,keyType:n,typeName:oi.ZodMap,..._i(r)});_J=class n extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ea.set)return Or(a,{code:vr.invalid_type,expected:ea.set,received:a.parsedType}),ni;let i=this._def;i.minSize!==null&&a.data.size<i.minSize.value&&(Or(a,{code:vr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&a.data.size>i.maxSize.value&&(Or(a,{code:vr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function e(u){let d=new Set;for(let I of u){if(I.status==="aborted")return ni;I.status==="dirty"&&r.dirty(),d.add(I.value)}return{status:r.value,value:d}}let o=[...a.data.values()].map((u,d)=>s._parse(new Zv(a,u,a.path,d)));return a.common.async?Promise.all(o).then(u=>e(u)):e(o)}min(t,r){return new n({...this._def,minSize:{value:t,message:Na.toString(r)}})}max(t,r){return new n({...this._def,maxSize:{value:t,message:Na.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};_J.create=(n,t)=>new _J({valueType:n,minSize:null,maxSize:null,typeName:oi.ZodSet,..._i(t)});spe=class n extends ol{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ea.function)return Or(r,{code:vr.invalid_type,expected:ea.function,received:r.parsedType}),ni;function a(o,u){return Lq({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,TJ(),eE].filter(d=>!!d),issueData:{code:vr.invalid_arguments,argumentsError:u}})}function i(o,u){return Lq({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,TJ(),eE].filter(d=>!!d),issueData:{code:vr.invalid_return_type,returnTypeError:u}})}let s={errorMap:r.common.contextualErrorMap},e=r.data;if(this._def.returns instanceof Ow){let o=this;return Gp(async function(...u){let d=new Gf([]),I=await o._def.args.parseAsync(u,s).catch(G=>{throw d.addIssue(a(u,G)),d}),h=await Reflect.apply(e,this,I);return await o._def.returns._def.type.parseAsync(h,s).catch(G=>{throw d.addIssue(i(h,G)),d})})}else{let o=this;return Gp(function(...u){let d=o._def.args.safeParse(u,s);if(!d.success)throw new Gf([a(u,d.error)]);let I=Reflect.apply(e,this,d.data),h=o._def.returns.safeParse(I,s);if(!h.success)throw new Gf([i(I,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new n({...this._def,args:_W.create(t).rest(nE.create())})}returns(t){return new n({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,a){return new n({args:t||_W.create([]).rest(nE.create()),returns:r||nE.create(),typeName:oi.ZodFunction,..._i(a)})}},i9=class extends ol{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};i9.create=(n,t)=>new i9({getter:n,typeName:oi.ZodLazy,..._i(t)});l9=class extends ol{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Or(r,{received:r.data,code:vr.invalid_literal,expected:this._def.value}),ni}return{status:"valid",value:t.data}}get value(){return this._def.value}};l9.create=(n,t)=>new l9({value:n,typeName:oi.ZodLiteral,..._i(t)});s9=class n extends ol{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),a=this._def.values;return Or(r,{expected:Bl.joinValues(a),received:r.parsedType,code:vr.invalid_type}),ni}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),a=this._def.values;return Or(r,{received:r.data,code:vr.invalid_enum_value,options:a}),ni}return Gp(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return n.create(t,{...this._def,...r})}exclude(t,r=this._def){return n.create(this.options.filter(a=>!t.includes(a)),{...this._def,...r})}};s9.create=EQt;o9=class extends ol{_parse(t){let r=Bl.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==ea.string&&a.parsedType!==ea.number){let i=Bl.objectValues(r);return Or(a,{expected:Bl.joinValues(i),received:a.parsedType,code:vr.invalid_type}),ni}if(this._cache||(this._cache=new Set(Bl.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Bl.objectValues(r);return Or(a,{received:a.data,code:vr.invalid_enum_value,options:i}),ni}return Gp(t.data)}get enum(){return this._def.values}};o9.create=(n,t)=>new o9({values:n,typeName:oi.ZodNativeEnum,..._i(t)});Ow=class extends ol{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ea.promise&&r.common.async===!1)return Or(r,{code:vr.invalid_type,expected:ea.promise,received:r.parsedType}),ni;let a=r.parsedType===ea.promise?r.data:Promise.resolve(r.data);return Gp(a.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ow.create=(n,t)=>new Ow({type:n,typeName:oi.ZodPromise,..._i(t)});Nv=class extends ol{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===oi.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:e=>{Or(a,e),e.fatal?r.abort():r.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let e=i.transform(a.data,s);if(a.common.async)return Promise.resolve(e).then(async o=>{if(r.value==="aborted")return ni;let u=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return u.status==="aborted"?ni:u.status==="dirty"?jQ(u.value):r.value==="dirty"?jQ(u.value):u});{if(r.value==="aborted")return ni;let o=this._def.schema._parseSync({data:e,path:a.path,parent:a});return o.status==="aborted"?ni:o.status==="dirty"?jQ(o.value):r.value==="dirty"?jQ(o.value):o}}if(i.type==="refinement"){let e=o=>{let u=i.refinement(o,s);if(a.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?ni:(o.status==="dirty"&&r.dirty(),e(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>o.status==="aborted"?ni:(o.status==="dirty"&&r.dirty(),e(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(a.common.async===!1){let e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Jw(e))return ni;let o=i.transform(e.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>Jw(e)?Promise.resolve(i.transform(e.value,s)).then(o=>({status:r.value,value:o})):ni);Bl.assertNever(i)}};Nv.create=(n,t,r)=>new Nv({schema:n,typeName:oi.ZodEffects,effect:t,..._i(r)});Nv.createWithPreprocess=(n,t,r)=>new Nv({schema:t,effect:{type:"preprocess",transform:n},typeName:oi.ZodEffects,..._i(r)});vv=class extends ol{_parse(t){return this._getType(t)===ea.undefined?Gp(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};vv.create=(n,t)=>new vv({innerType:n,typeName:oi.ZodOptional,..._i(t)});PW=class extends ol{_parse(t){return this._getType(t)===ea.null?Gp(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};PW.create=(n,t)=>new PW({innerType:n,typeName:oi.ZodNullable,..._i(t)});c9=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return r.parsedType===ea.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};c9.create=(n,t)=>new c9({innerType:n,typeName:oi.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,..._i(t)});u9=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return DJ(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Gf(a.common.issues)},input:a.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Gf(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};u9.create=(n,t)=>new u9({innerType:n,typeName:oi.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,..._i(t)});PJ=class extends ol{_parse(t){if(this._getType(t)!==ea.nan){let a=this._getOrReturnCtx(t);return Or(a,{code:vr.invalid_type,expected:ea.nan,received:a.parsedType}),ni}return{status:"valid",value:t.data}}};PJ.create=n=>new PJ({typeName:oi.ZodNaN,..._i(n)});yWr=Symbol("zod_brand"),Sq=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}},Bq=class n extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?ni:s.status==="dirty"?(r.dirty(),jQ(s.value)):this._def.out._parseAsync({data:s.value,path:a.path,parent:a})})();{let i=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?ni:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:a.path,parent:a})}}static create(t,r){return new n({in:t,out:r,typeName:oi.ZodPipeline})}},I9=class extends ol{_parse(t){let r=this._def.innerType._parse(t),a=i=>(Jw(i)&&(i.value=Object.freeze(i.value)),i);return DJ(r)?r.then(i=>a(i)):a(r)}unwrap(){return this._def.innerType}};I9.create=(n,t)=>new I9({innerType:n,typeName:oi.ZodReadonly,..._i(t)});FWr={object:gf.lazycreate};(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(oi||(oi={}));EWr=(n,t={message:`Input not instance of ${n.name}`})=>RQt(r=>r instanceof n,t),wQt=Tw.create,CQt=KQ.create,RWr=PJ.create,wWr=qQ.create,YQt=$Q.create,CWr=e9.create,YWr=UJ.create,xWr=t9.create,VWr=n9.create,QWr=Dw.create,HWr=nE.create,XWr=MN.create,kWr=MJ.create,LWr=rE.create,SWr=gf.create,BWr=gf.strictCreate,JWr=r9.create,TWr=ipe.create,DWr=a9.create,OWr=_W.create,UWr=lpe.create,MWr=zJ.create,zWr=_J.create,_Wr=spe.create,PWr=i9.create,jWr=l9.create,KWr=s9.create,qWr=o9.create,$Wr=Ow.create,eyr=Nv.create,tyr=vv.create,nyr=PW.create,ryr=Nv.createWithPreprocess,ayr=Bq.create,iyr=()=>wQt().optional(),lyr=()=>CQt().optional(),syr=()=>YQt().optional(),oyr={string:(n=>Tw.create({...n,coerce:!0})),number:(n=>KQ.create({...n,coerce:!0})),boolean:(n=>$Q.create({...n,coerce:!0})),bigint:(n=>qQ.create({...n,coerce:!0})),date:(n=>e9.create({...n,coerce:!0}))},cyr=ni});var ju={};po(ju,{BRAND:()=>yWr,DIRTY:()=>jQ,EMPTY_PATH:()=>rWr,INVALID:()=>ni,NEVER:()=>cyr,OK:()=>Gp,ParseStatus:()=>Gm,Schema:()=>ol,ZodAny:()=>Dw,ZodArray:()=>rE,ZodBigInt:()=>qQ,ZodBoolean:()=>$Q,ZodBranded:()=>Sq,ZodCatch:()=>u9,ZodDate:()=>e9,ZodDefault:()=>c9,ZodDiscriminatedUnion:()=>ipe,ZodEffects:()=>Nv,ZodEnum:()=>s9,ZodError:()=>Gf,ZodFirstPartyTypeKind:()=>oi,ZodFunction:()=>spe,ZodIntersection:()=>a9,ZodIssueCode:()=>vr,ZodLazy:()=>i9,ZodLiteral:()=>l9,ZodMap:()=>zJ,ZodNaN:()=>PJ,ZodNativeEnum:()=>o9,ZodNever:()=>MN,ZodNull:()=>n9,ZodNullable:()=>PW,ZodNumber:()=>KQ,ZodObject:()=>gf,ZodOptional:()=>vv,ZodParsedType:()=>ea,ZodPipeline:()=>Bq,ZodPromise:()=>Ow,ZodReadonly:()=>I9,ZodRecord:()=>lpe,ZodSchema:()=>ol,ZodSet:()=>_J,ZodString:()=>Tw,ZodSymbol:()=>UJ,ZodTransformer:()=>Nv,ZodTuple:()=>_W,ZodType:()=>ol,ZodUndefined:()=>t9,ZodUnion:()=>r9,ZodUnknown:()=>nE,ZodVoid:()=>MJ,addIssueToContext:()=>Or,any:()=>QWr,array:()=>LWr,bigint:()=>wWr,boolean:()=>YQt,coerce:()=>oyr,custom:()=>RQt,date:()=>CWr,datetimeRegex:()=>FQt,defaultErrorMap:()=>eE,discriminatedUnion:()=>TWr,effect:()=>eyr,enum:()=>KWr,function:()=>_Wr,getErrorMap:()=>TJ,getParsedType:()=>zW,instanceof:()=>EWr,intersection:()=>DWr,isAborted:()=>rpe,isAsync:()=>DJ,isDirty:()=>ape,isValid:()=>Jw,late:()=>FWr,lazy:()=>PWr,literal:()=>jWr,makeIssue:()=>Lq,map:()=>MWr,nan:()=>RWr,nativeEnum:()=>qWr,never:()=>XWr,null:()=>VWr,nullable:()=>nyr,number:()=>CQt,object:()=>SWr,objectUtil:()=>OSe,oboolean:()=>syr,onumber:()=>lyr,optional:()=>tyr,ostring:()=>iyr,pipeline:()=>ayr,preprocess:()=>ryr,promise:()=>$Wr,quotelessJson:()=>eWr,record:()=>UWr,set:()=>zWr,setErrorMap:()=>nWr,strictObject:()=>BWr,string:()=>wQt,symbol:()=>YWr,transformer:()=>eyr,tuple:()=>OWr,undefined:()=>xWr,union:()=>JWr,unknown:()=>HWr,util:()=>Bl,void:()=>kWr});var PSe=ct(()=>{npe();MSe();vQt();kq();xQt();tpe()});function Tn(n,t,r){function a(o,u){var d;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(d=o._zod).traits??(d.traits=new Set),o._zod.traits.add(n),t(o,u);for(let I in e.prototype)I in o||Object.defineProperty(o,I,{value:e.prototype[I].bind(o)});o._zod.constr=e,o._zod.def=u}let i=r?.Parent??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function e(o){var u;let d=r?.Parent?new s:this;a(d,o),(u=d._zod).deferred??(u.deferred=[]);for(let I of d._zod.deferred)I();return d}return Object.defineProperty(e,"init",{value:a}),Object.defineProperty(e,Symbol.hasInstance,{value:o=>r?.Parent&&o instanceof r.Parent?!0:o?._zod?.traits?.has(n)}),Object.defineProperty(e,"name",{value:n}),e}function c1(n){return n&&Object.assign(ope,n),ope}var jSe,uyr,aE,ope,jJ=ct(()=>{jSe=Object.freeze({status:"aborted"});uyr=Symbol("zod_brand"),aE=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ope={}});var js={};po(js,{BIGINT_FORMAT_RANGES:()=>QQt,Class:()=>qSe,NUMBER_FORMAT_RANGES:()=>lBe,aborted:()=>h9,allowsEval:()=>rBe,assert:()=>pyr,assertEqual:()=>Iyr,assertIs:()=>hyr,assertNever:()=>myr,assertNotEqual:()=>dyr,assignProp:()=>nBe,cached:()=>Tq,captureStackTrace:()=>upe,cleanEnum:()=>Ryr,cleanRegex:()=>Oq,clone:()=>zN,createTransparentProxy:()=>Zyr,defineLazy:()=>Hc,esc:()=>d9,escapeRegex:()=>Uw,extend:()=>Wyr,finalizeIssue:()=>_N,floatSafeRemainder:()=>tBe,getElementAtPath:()=>byr,getEnumValues:()=>$Se,getLengthableOrigin:()=>Uq,getParsedType:()=>vyr,getSizableOrigin:()=>HQt,isObject:()=>KJ,isPlainObject:()=>qJ,issue:()=>sBe,joinValues:()=>cpe,jsonStringifyReplacer:()=>eBe,merge:()=>yyr,normalizeParams:()=>ka,nullish:()=>Dq,numKeys:()=>gyr,omit:()=>Ayr,optionalKeys:()=>iBe,partial:()=>Fyr,pick:()=>Nyr,prefixIssues:()=>jW,primitiveTypes:()=>VQt,promiseAllObject:()=>fyr,propertyKeyTypes:()=>aBe,randomString:()=>Gyr,required:()=>Eyr,stringifyPrimitive:()=>Ipe,unwrapMessage:()=>Jq});function Iyr(n){return n}function dyr(n){return n}function hyr(n){}function myr(n){throw new Error}function pyr(n){}function $Se(n){let t=Object.values(n).filter(a=>typeof a=="number");return Object.entries(n).filter(([a,i])=>t.indexOf(+a)===-1).map(([a,i])=>i)}function cpe(n,t="|"){return n.map(r=>Ipe(r)).join(t)}function eBe(n,t){return typeof t=="bigint"?t.toString():t}function Tq(n){return{get value(){{let r=n();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Dq(n){return n==null}function Oq(n){let t=n.startsWith("^")?1:0,r=n.endsWith("$")?n.length-1:n.length;return n.slice(t,r)}function tBe(n,t){let r=(n.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a,s=Number.parseInt(n.toFixed(i).replace(".","")),e=Number.parseInt(t.toFixed(i).replace(".",""));return s%e/10**i}function Hc(n,t,r){Object.defineProperty(n,t,{get(){{let i=r();return n[t]=i,i}throw new Error("cached value already set")},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function nBe(n,t,r){Object.defineProperty(n,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function byr(n,t){return t?t.reduce((r,a)=>r?.[a],n):n}function fyr(n){let t=Object.keys(n),r=t.map(a=>n[a]);return Promise.all(r).then(a=>{let i={};for(let s=0;s<t.length;s++)i[t[s]]=a[s];return i})}function Gyr(n=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let a=0;a<n;a++)r+=t[Math.floor(Math.random()*t.length)];return r}function d9(n){return JSON.stringify(n)}function KJ(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function qJ(n){if(KJ(n)===!1)return!1;let t=n.constructor;if(t===void 0)return!0;let r=t.prototype;return!(KJ(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function gyr(n){let t=0;for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&t++;return t}function Uw(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zN(n,t,r){let a=new n._zod.constr(t??n._zod.def);return(!t||r?.parent)&&(a._zod.parent=n),a}function ka(n){let t=n;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Zyr(n){let t;return new Proxy({},{get(r,a,i){return t??(t=n()),Reflect.get(t,a,i)},set(r,a,i,s){return t??(t=n()),Reflect.set(t,a,i,s)},has(r,a){return t??(t=n()),Reflect.has(t,a)},deleteProperty(r,a){return t??(t=n()),Reflect.deleteProperty(t,a)},ownKeys(r){return t??(t=n()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,a){return t??(t=n()),Reflect.getOwnPropertyDescriptor(t,a)},defineProperty(r,a,i){return t??(t=n()),Reflect.defineProperty(t,a,i)}})}function Ipe(n){return typeof n=="bigint"?n.toString()+"n":typeof n=="string"?`"${n}"`:`${n}`}function iBe(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}function Nyr(n,t){let r={},a=n._zod.def;for(let i in t){if(!(i in a.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(r[i]=a.shape[i])}return zN(n,{...n._zod.def,shape:r,checks:[]})}function Ayr(n,t){let r={...n._zod.def.shape},a=n._zod.def;for(let i in t){if(!(i in a.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete r[i]}return zN(n,{...n._zod.def,shape:r,checks:[]})}function Wyr(n,t){if(!qJ(t))throw new Error("Invalid input to extend: expected a plain object");let r={...n._zod.def,get shape(){let a={...n._zod.def.shape,...t};return nBe(this,"shape",a),a},checks:[]};return zN(n,r)}function yyr(n,t){return zN(n,{...n._zod.def,get shape(){let r={...n._zod.def.shape,...t._zod.def.shape};return nBe(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function Fyr(n,t,r){let a=t._zod.def.shape,i={...a};if(r)for(let s in r){if(!(s in a))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=n?new n({type:"optional",innerType:a[s]}):a[s])}else for(let s in a)i[s]=n?new n({type:"optional",innerType:a[s]}):a[s];return zN(t,{...t._zod.def,shape:i,checks:[]})}function Eyr(n,t,r){let a=t._zod.def.shape,i={...a};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new n({type:"nonoptional",innerType:a[s]}))}else for(let s in a)i[s]=new n({type:"nonoptional",innerType:a[s]});return zN(t,{...t._zod.def,shape:i,checks:[]})}function h9(n,t=0){for(let r=t;r<n.issues.length;r++)if(n.issues[r]?.continue!==!0)return!0;return!1}function jW(n,t){return t.map(r=>{var a;return(a=r).path??(a.path=[]),r.path.unshift(n),r})}function Jq(n){return typeof n=="string"?n:n?.message}function _N(n,t,r){let a={...n,path:n.path??[]};if(!n.message){let i=Jq(n.inst?._zod.def?.error?.(n))??Jq(t?.error?.(n))??Jq(r.customError?.(n))??Jq(r.localeError?.(n))??"Invalid input";a.message=i}return delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function HQt(n){return n instanceof Set?"set":n instanceof Map?"map":n instanceof File?"file":"unknown"}function Uq(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function sBe(...n){let[t,r,a]=n;return typeof t=="string"?{message:t,code:"custom",input:r,inst:a}:{...t}}function Ryr(n){return Object.entries(n).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}var upe,rBe,vyr,aBe,VQt,lBe,QQt,qSe,iE=ct(()=>{upe=Error.captureStackTrace?Error.captureStackTrace:(...n)=>{};rBe=Tq(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let n=Function;return new n(""),!0}catch{return!1}});vyr=n=>{let t=typeof n;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(n)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(n)?"array":n===null?"null":n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?"promise":typeof Map<"u"&&n instanceof Map?"map":typeof Set<"u"&&n instanceof Set?"set":typeof Date<"u"&&n instanceof Date?"date":typeof File<"u"&&n instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},aBe=new Set(["string","number","symbol"]),VQt=new Set(["string","number","bigint","boolean","symbol","undefined"]);lBe={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},QQt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};qSe=class{constructor(...t){}}});function cBe(n,t=r=>r.message){let r={},a=[];for(let i of n.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):a.push(t(i));return{formErrors:a,fieldErrors:r}}function uBe(n,t){let r=t||function(s){return s.message},a={_errors:[]},i=s=>{for(let e of s.issues)if(e.code==="invalid_union"&&e.errors.length)e.errors.map(o=>i({issues:o}));else if(e.code==="invalid_key")i({issues:e.issues});else if(e.code==="invalid_element")i({issues:e.issues});else if(e.path.length===0)a._errors.push(r(e));else{let o=a,u=0;for(;u<e.path.length;){let d=e.path[u];u===e.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(r(e))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return i(n),a}var XQt,dpe,oBe,IBe=ct(()=>{jJ();iE();XQt=(n,t)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:t,enumerable:!1}),Object.defineProperty(n,"message",{get(){return JSON.stringify(t,eBe,2)},enumerable:!0}),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},dpe=Tn("$ZodError",XQt),oBe=Tn("$ZodError",XQt,{Parent:Error})});var kQt,LQt,dBe,Mq,hBe,hpe,mBe=ct(()=>{jJ();IBe();iE();kQt=n=>(t,r,a,i)=>{let s=a?Object.assign(a,{async:!1}):{async:!1},e=t._zod.run({value:r,issues:[]},s);if(e instanceof Promise)throw new aE;if(e.issues.length){let o=new(i?.Err??n)(e.issues.map(u=>_N(u,s,c1())));throw upe(o,i?.callee),o}return e.value},LQt=n=>async(t,r,a,i)=>{let s=a?Object.assign(a,{async:!0}):{async:!0},e=t._zod.run({value:r,issues:[]},s);if(e instanceof Promise&&(e=await e),e.issues.length){let o=new(i?.Err??n)(e.issues.map(u=>_N(u,s,c1())));throw upe(o,i?.callee),o}return e.value},dBe=n=>(t,r,a)=>{let i=a?{...a,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new aE;return s.issues.length?{success:!1,error:new(n??dpe)(s.issues.map(e=>_N(e,i,c1())))}:{success:!0,data:s.value}},Mq=dBe(oBe),hBe=n=>async(t,r,a)=>{let i=a?Object.assign(a,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(e=>_N(e,i,c1())))}:{success:!0,data:s.value}},hpe=hBe(oBe)});function _Qt(){return new RegExp(Cyr,"u")}function a9t(n){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${t}`:n.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${n.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function i9t(n){return new RegExp(`^${a9t(n)}$`)}function l9t(n){let t=a9t({precision:n.precision}),r=["Z"];n.local&&r.push(""),n.offset&&r.push("([+-]\\d{2}:\\d{2})");let a=`${t}(?:${r.join("|")})`;return new RegExp(`^${n9t}T(?:${a})$`)}var SQt,BQt,JQt,TQt,DQt,OQt,UQt,MQt,pBe,zQt,Cyr,PQt,jQt,KQt,qQt,$Qt,bBe,e9t,t9t,n9t,r9t,s9t,o9t,c9t,u9t,I9t,d9t,h9t,m9t,ppe=ct(()=>{SQt=/^[cC][^\s-]{8,}$/,BQt=/^[0-9a-z]+$/,JQt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,TQt=/^[0-9a-vA-V]{20}$/,DQt=/^[A-Za-z0-9]{27}$/,OQt=/^[a-zA-Z0-9_-]{21}$/,UQt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,MQt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,pBe=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,zQt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Cyr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";PQt=/^(?:(?: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])$/,jQt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,KQt=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,qQt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$Qt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,bBe=/^[A-Za-z0-9_-]*$/,e9t=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,t9t=/^\+(?:[0-9]){6,14}[0-9]$/,n9t="(?:(?:\\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])))",r9t=new RegExp(`^${n9t}$`);s9t=n=>{let t=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},o9t=/^\d+n?$/,c9t=/^\d+$/,u9t=/^-?\d+(?:\.\d+)?/i,I9t=/true|false/i,d9t=/null/i,h9t=/^[^A-Z]*$/,m9t=/^[^a-z]*$/});var gp,p9t,fBe,GBe,b9t,f9t,G9t,g9t,v9t,zq,Z9t,N9t,A9t,W9t,y9t,F9t,E9t,bpe=ct(()=>{jJ();ppe();iE();gp=Tn("$ZodCheck",(n,t)=>{var r;n._zod??(n._zod={}),n._zod.def=t,(r=n._zod).onattach??(r.onattach=[])}),p9t={number:"number",bigint:"bigint",object:"date"},fBe=Tn("$ZodCheckLessThan",(n,t)=>{gp.init(n,t);let r=p9t[typeof t.value];n._zod.onattach.push(a=>{let i=a._zod.bag,s=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),n._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:r,code:"too_big",maximum:t.value,input:a.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),GBe=Tn("$ZodCheckGreaterThan",(n,t)=>{gp.init(n,t);let r=p9t[typeof t.value];n._zod.onattach.push(a=>{let i=a._zod.bag,s=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),n._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:r,code:"too_small",minimum:t.value,input:a.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),b9t=Tn("$ZodCheckMultipleOf",(n,t)=>{gp.init(n,t),n._zod.onattach.push(r=>{var a;(a=r._zod.bag).multipleOf??(a.multipleOf=t.value)}),n._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):tBe(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:n,continue:!t.abort})}}),f9t=Tn("$ZodCheckNumberFormat",(n,t)=>{gp.init(n,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[i,s]=lBe[t.format];n._zod.onattach.push(e=>{let o=e._zod.bag;o.format=t.format,o.minimum=i,o.maximum=s,r&&(o.pattern=c9t)}),n._zod.check=e=>{let o=e.value;if(r){if(!Number.isInteger(o)){e.issues.push({expected:a,format:t.format,code:"invalid_type",input:o,inst:n});return}if(!Number.isSafeInteger(o)){o>0?e.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:a,continue:!t.abort}):e.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:a,continue:!t.abort});return}}o<i&&e.issues.push({origin:"number",input:o,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!t.abort}),o>s&&e.issues.push({origin:"number",input:o,code:"too_big",maximum:s,inst:n})}}),G9t=Tn("$ZodCheckMaxLength",(n,t)=>{var r;gp.init(n,t),(r=n._zod.def).when??(r.when=a=>{let i=a.value;return!Dq(i)&&i.length!==void 0}),n._zod.onattach.push(a=>{let i=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(a._zod.bag.maximum=t.maximum)}),n._zod.check=a=>{let i=a.value;if(i.length<=t.maximum)return;let e=Uq(i);a.issues.push({origin:e,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),g9t=Tn("$ZodCheckMinLength",(n,t)=>{var r;gp.init(n,t),(r=n._zod.def).when??(r.when=a=>{let i=a.value;return!Dq(i)&&i.length!==void 0}),n._zod.onattach.push(a=>{let i=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(a._zod.bag.minimum=t.minimum)}),n._zod.check=a=>{let i=a.value;if(i.length>=t.minimum)return;let e=Uq(i);a.issues.push({origin:e,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),v9t=Tn("$ZodCheckLengthEquals",(n,t)=>{var r;gp.init(n,t),(r=n._zod.def).when??(r.when=a=>{let i=a.value;return!Dq(i)&&i.length!==void 0}),n._zod.onattach.push(a=>{let i=a._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),n._zod.check=a=>{let i=a.value,s=i.length;if(s===t.length)return;let e=Uq(i),o=s>t.length;a.issues.push({origin:e,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:n,continue:!t.abort})}}),zq=Tn("$ZodCheckStringFormat",(n,t)=>{var r,a;gp.init(n,t),n._zod.onattach.push(i=>{let s=i._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=n._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:n,continue:!t.abort})}):(a=n._zod).check??(a.check=()=>{})}),Z9t=Tn("$ZodCheckRegex",(n,t)=>{zq.init(n,t),n._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:n,continue:!t.abort})}}),N9t=Tn("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=h9t),zq.init(n,t)}),A9t=Tn("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=m9t),zq.init(n,t)}),W9t=Tn("$ZodCheckIncludes",(n,t)=>{gp.init(n,t);let r=Uw(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=a,n._zod.onattach.push(i=>{let s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(a)}),n._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:n,continue:!t.abort})}}),y9t=Tn("$ZodCheckStartsWith",(n,t)=>{gp.init(n,t);let r=new RegExp(`^${Uw(t.prefix)}.*`);t.pattern??(t.pattern=r),n._zod.onattach.push(a=>{let i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),n._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:n,continue:!t.abort})}}),F9t=Tn("$ZodCheckEndsWith",(n,t)=>{gp.init(n,t);let r=new RegExp(`.*${Uw(t.suffix)}$`);t.pattern??(t.pattern=r),n._zod.onattach.push(a=>{let i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),n._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:n,continue:!t.abort})}}),E9t=Tn("$ZodCheckOverwrite",(n,t)=>{gp.init(n,t),n._zod.check=r=>{r.value=t.tx(r.value)}})});var fpe,gBe=ct(()=>{fpe=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let a=t.split(`
711
+ `);s=G.pop()||"";for(let E of G)if(E.startsWith("data: ")){let W=E.slice(6);if(W==="[DONE]")return;try{let R=JSON.parse(W);if(R.type==="connection_established")continue;if(R.error)throw new Error(R.error);R.usageMetadata&&(o=R.usageMetadata);let F=this.convertStreamChunkToGenAI(R);F&&(yield F)}catch(R){tr.warn("[DeepV Server] Stream chunk parse error",{data:W.substring(0,100)+"...",error:R instanceof Error?R.message:R})}}}}finally{d&&r&&r.removeEventListener("abort",d);try{a.releaseLock()}catch{}}}convertStreamChunkToGenAI(t){if(!t.candidates||!Array.isArray(t.candidates)||t.candidates.length===0)return null;let r={candidates:t.candidates,usageMetadata:t.usageMetadata};if(r.candidates?.[0]?.content?.parts){for(let a of r.candidates[0].content.parts)if(a.functionCall&&!a.functionCall.id){let i=`call_${Date.now()}_${Math.random().toString(36).substring(2,9)}`;console.log(`[DeepV Server] \u8865\u5168\u7F3A\u5931\u7684\u5DE5\u5177 ID (Chunk): ${a.functionCall.name} -> ${i}`),a.functionCall.id=i}}return r.functionCalls||Object.defineProperty(r,"functionCalls",{get:function(){if(this.candidates?.[0]?.content?.parts?.length===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning function calls from the first one.");let a=this.candidates?.[0]?.content?.parts?.filter(i=>i.functionCall).map(i=>i.functionCall).filter(i=>i!==void 0);if(a?.length!==0)return a},enumerable:!1,configurable:!0}),r}mergeStreamContent(t,r){if(!t)return r;let a=t.candidates?.[0]?.content?.parts||[],i=r.candidates?.[0]?.content?.parts||[];if(i.length>0&&i[0].text){let s=a[a.length-1];s&&s.text&&!s.functionCall?s.text+=i[0].text:a.push(...i)}else if(i.length>0&&i[0].functionCall){let s=a[a.length-1],e=i[0];if(s&&s.functionCall){let o=s.functionCall,u=e.functionCall;u&&(u.name&&(o.name=u.name.trim()),u.id&&(o.id=u.id),u.args&&(typeof u.args=="string"&&typeof o.args=="string"?o.args+=u.args:typeof u.args=="object"&&u.args!==null?o.args={...typeof o.args=="object"?o.args:{},...u.args}:o.args=u.args))}else{let o={...e};if(o.functionCall&&!o.functionCall.id){let u=`call_${Date.now()}_${Math.random().toString(36).substring(2,9)}`;console.log(`[DeepV Server] \u8865\u5168\u7F3A\u5931\u7684\u5DE5\u5177 ID: ${o.functionCall.name} -> ${u}`),o.functionCall.id=u}a.push(o)}}return r.usageMetadata&&(t.usageMetadata=r.usageMetadata),r.candidates?.[0]?.finishReason&&(t.candidates[0].finishReason=r.candidates[0].finishReason),t}buildUnifiedRequest(t,r){let a=Qd.getModelForScene(r),i=this.config?.getModel(),s;return i&&is(i)?t.model&&is(t.model)?s=t.model:s=i:s=t.model||a||"auto",{model:s,contents:t.contents,config:{...t.config,httpOptions:{...t.config?.httpOptions,headers:{...t.config?.httpOptions?.headers,"X-Scene-Type":r,"X-Scene-Display":Qd.getSceneDisplayName(r)}}}}}async*handleStreamError(t){this.handleError(t)}async countTokens(t){try{let r=t.model||this.config?.getModel()||"auto";if(is(r))return tr.debug("[DeepV Server] Custom model detected, token counting not supported"),{totalTokens:0};let a={model:r,contents:t.contents};(t.config?.systemInstruction||t.config?.tools)&&(a.config={},t.config.systemInstruction&&(a.config.systemInstruction=t.config.systemInstruction),t.config.tools&&(a.config.tools=t.config.tools));let i=await this.callUnifiedTokenCountAPI(a);return cf.emitRealTimeToken({inputTokens:i.totalTokens||0,outputTokens:0,totalTokens:i.totalTokens||0,timestamp:Date.now()}),i}catch(r){let a=t.model||this.config?.getModel()||"auto";return is(a)?tr.debug("[DeepV Server] Token count not available for custom model, using fallback"):tr.error("[DeepV Server] Token count failed:",r),this.estimateTokensAsFailback(t)}}async callUnifiedTokenCountAPI(t){let r=await Qs.getUserHeaders(),a=`${Qs.getProxyServerUrl()}/v1/chat/count-tokens`;try{let i=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json",...r,...this.getGitHeaders()},body:JSON.stringify(t)});if(!i.ok){let e=await i.text();throw i.status===401?(console.error("[DeepV Server] Token count 401 Unauthorized"),this.authHandler&&await this.authHandler(),new uI("Authentication required - please re-authenticate")):new Error(`Token count API failed (${i.status}): ${e}`)}let s=await i.json();return tr.debug("[DeepV Server] Token count response",{totalTokens:s.totalTokens}),{totalTokens:s.totalTokens||0}}catch(i){throw tr.error("[DeepV Server] Token count API call failed:",i),i}}estimateTokensAsFailback(t){try{let r=Array.isArray(t.contents)?t.contents:[{role:Lr.USER,parts:[{text:t.contents}]}],a=0,i=0,s=0,e=0;for(let c of r)if(typeof c=="object"&&c&&"parts"in c&&Array.isArray(c.parts)){for(let G of c.parts)if(typeof G=="object"&&G&&"text"in G&&typeof G.text=="string")a+=G.text.length,e++;else if(typeof G=="object"&&G&&"functionCall"in G&&G.functionCall){let E=G.functionCall,W=`[Tool: ${E.name}]`+JSON.stringify(E.args||{});a+=W.length,i++}else if(typeof G=="object"&&G&&"functionResponse"in G&&G.functionResponse){let R=`[Tool Result: ${G.functionResponse.response?.output||"result"}]`;a+=R.length+20,s++}}else typeof c=="string"&&(a+=c.length,e++);let o=JSON.stringify(r),u=/[\u4e00-\u9fff]/.test(o),d=/```|function|class|import|export|\{|\}|\[|\]/.test(o),I=4;return u?I=2:d&&(I=3),{totalTokens:Math.ceil(a/I)}}catch(r){return console.error("[DeepV Server] Fallback estimation error:",r),{totalTokens:1e3}}}async embedContent(t){throw new Error("Claude models do not support embedding content")}withTimeout(t,r,a){let i=null,s=new Promise((e,o)=>{i=setTimeout(()=>{o(new Error(a))},r)});return Promise.race([t,s]).finally(()=>{i!==null&&clearTimeout(i)})}}});function JSe(n,t){let r=n.getModel()||"auto",a={authType:t,proxy:n?.getProxy()};return t===ls.USE_PROXY_AUTH,a}async function TSe(n,t,r){let i={headers:{"User-Agent":`GeminiCLI/1.0.323 (${process.platform}; ${process.arch})`}};if(!0){let e=t.getCustomProxyServerUrl(),o;if(e)o=e,console.log(`[DeepX] Using custom proxy server: ${o}`);else{if(!vXe())throw new Error("DeepV Code server is required for all models but is not available. Please start the DeepV Code server or use proxy authentication.");o=EW(),console.log(`[DeepX] Connecting to DeepV Code server: ${o}`)}let u=process.env.GOOGLE_CLOUD_LOCATION||"us-central1",d=process.env.GOOGLE_CLOUD_PROJECT||"default-project";return new JJ(u,d,o,t)}throw new Error(`Error creating contentGenerator: Unsupported authType: ${n.authType}`)}var ls,jme=ct(()=>{"use strict";BSe();TB();(function(n){n.USE_PROXY_AUTH="proxy-auth"})(ls||(ls={}))});var Kme,fQt=ct(()=>{"use strict";Kme=class{prompts=new Map;registerPrompt(t){if(this.prompts.has(t.name)){let r=`${t.serverName}_${t.name}`;console.warn(`Prompt with name "${t.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...t,name:r})}else this.prompts.set(t.name,t)}getAllPrompts(){return Array.from(this.prompts.values()).sort((t,r)=>t.name.localeCompare(r.name))}getPrompt(t){return this.prompts.get(t)}getPromptsByServer(t){let r=[];for(let a of this.prompts.values())a.serverName===t&&r.push(a);return r.sort((a,i)=>a.name.localeCompare(i.name))}removePromptsByServer(t){for(let[r,a]of this.prompts.entries())a.serverName===t&&this.prompts.delete(r)}}});function UN(n){let t={type:"subagent_update",data:n,timestamp:Date.now()};return JSON.stringify(t)}function GQt(n){let t={type:"text",data:n,timestamp:Date.now()};return JSON.stringify(t)}function qme(n){try{let t=JSON.parse(n);if(t&&typeof t=="object"&&t.type&&t.data!==void 0)return t}catch{}return{type:"text",data:n,timestamp:Date.now()}}function $me(n){return n.type==="subagent_update"}function epe(n){return n.type==="text"}var DSe=ct(()=>{"use strict";});var qr,Hr,$r,Sl=ct(()=>{"use strict";DSe();qr=class{name;displayName;description;icon;parameterSchema;isOutputMarkdown;forceMarkdown;canUpdateOutput;allowSubAgentUse;constructor(t,r,a,i,s,e=!0,o=!1,u=!1,d=!0){this.name=t,this.displayName=r,this.description=a,this.icon=i,this.parameterSchema=s,this.isOutputMarkdown=e,this.forceMarkdown=o,this.canUpdateOutput=u,this.allowSubAgentUse=d}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(t){return null}getDescription(t){return JSON.stringify(t)}shouldConfirmExecute(t,r){return Promise.resolve(!1)}toolLocations(t){return[]}};(function(n){n.ProceedOnce="proceed_once",n.ProceedAlways="proceed_always",n.ProceedAlwaysServer="proceed_always_server",n.ProceedAlwaysTool="proceed_always_tool",n.ProceedAlwaysProject="proceed_always_project",n.ModifyWithEditor="modify_with_editor",n.Cancel="cancel"})(Hr||(Hr={}));(function(n){n.FileSearch="fileSearch",n.Folder="folder",n.Globe="globe",n.Hammer="hammer",n.LightBulb="lightBulb",n.Pencil="pencil",n.Regex="regex",n.Terminal="terminal",n.Clipboard="clipboard",n.Tasks="tasks",n.Wrench="wrench",n.Trash="trash",n.List="list",n.Info="info"})($r||($r={}))});var Bl,OSe,ea,zW,kq=ct(()=>{(function(n){n.assertEqual=i=>{};function t(i){}n.assertIs=t;function r(i){throw new Error}n.assertNever=r,n.arrayToEnum=i=>{let s={};for(let e of i)s[e]=e;return s},n.getValidEnumValues=i=>{let s=n.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),e={};for(let o of s)e[o]=i[o];return n.objectValues(e)},n.objectValues=i=>n.objectKeys(i).map(function(s){return i[s]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&s.push(e);return s},n.find=(i,s)=>{for(let e of i)if(s(e))return e},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function a(i,s=" | "){return i.map(e=>typeof e=="string"?`'${e}'`:e).join(s)}n.joinValues=a,n.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Bl||(Bl={}));(function(n){n.mergeShapes=(t,r)=>({...t,...r})})(OSe||(OSe={}));ea=Bl.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zW=n=>{switch(typeof n){case"undefined":return ea.undefined;case"string":return ea.string;case"number":return Number.isNaN(n)?ea.nan:ea.number;case"boolean":return ea.boolean;case"function":return ea.function;case"bigint":return ea.bigint;case"symbol":return ea.symbol;case"object":return Array.isArray(n)?ea.array:n===null?ea.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?ea.promise:typeof Map<"u"&&n instanceof Map?ea.map:typeof Set<"u"&&n instanceof Set?ea.set:typeof Date<"u"&&n instanceof Date?ea.date:ea.object;default:return ea.unknown}}});var vr,eWr,Gf,tpe=ct(()=>{kq();vr=Bl.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"]),eWr=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),Gf=class n extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(s){return s.message},a={_errors:[]},i=s=>{for(let e of s.issues)if(e.code==="invalid_union")e.unionErrors.map(i);else if(e.code==="invalid_return_type")i(e.returnTypeError);else if(e.code==="invalid_arguments")i(e.argumentsError);else if(e.path.length===0)a._errors.push(r(e));else{let o=a,u=0;for(;u<e.path.length;){let d=e.path[u];u===e.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(r(e))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return i(this),a}static assert(t){if(!(t instanceof n))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Bl.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},a=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];r[s]=r[s]||[],r[s].push(t(i))}else a.push(t(i));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};Gf.create=n=>new Gf(n)});var tWr,eE,USe=ct(()=>{tpe();kq();tWr=(n,t)=>{let r;switch(n.code){case vr.invalid_type:n.received===ea.undefined?r="Required":r=`Expected ${n.expected}, received ${n.received}`;break;case vr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(n.expected,Bl.jsonStringifyReplacer)}`;break;case vr.unrecognized_keys:r=`Unrecognized key(s) in object: ${Bl.joinValues(n.keys,", ")}`;break;case vr.invalid_union:r="Invalid input";break;case vr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Bl.joinValues(n.options)}`;break;case vr.invalid_enum_value:r=`Invalid enum value. Expected ${Bl.joinValues(n.options)}, received '${n.received}'`;break;case vr.invalid_arguments:r="Invalid function arguments";break;case vr.invalid_return_type:r="Invalid function return type";break;case vr.invalid_date:r="Invalid date";break;case vr.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(r=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?r=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?r=`Invalid input: must end with "${n.validation.endsWith}"`:Bl.assertNever(n.validation):n.validation!=="regex"?r=`Invalid ${n.validation}`:r="Invalid";break;case vr.too_small:n.type==="array"?r=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?r=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?r=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?r=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?r=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:r="Invalid input";break;case vr.too_big:n.type==="array"?r=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?r=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?r=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?r=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?r=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:r="Invalid input";break;case vr.custom:r="Invalid input";break;case vr.invalid_intersection_types:r="Intersection results could not be merged";break;case vr.not_multiple_of:r=`Number must be a multiple of ${n.multipleOf}`;break;case vr.not_finite:r="Number must be finite";break;default:r=t.defaultError,Bl.assertNever(n)}return{message:r}},eE=tWr});function nWr(n){gQt=n}function TJ(){return gQt}var gQt,npe=ct(()=>{USe();gQt=eE});function Or(n,t){let r=TJ(),a=Lq({issueData:t,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,r,r===eE?void 0:eE].filter(i=>!!i)});n.common.issues.push(a)}var Lq,rWr,Gm,ni,jQ,Gp,rpe,ape,Jw,DJ,MSe=ct(()=>{npe();USe();Lq=n=>{let{data:t,path:r,errorMaps:a,issueData:i}=n,s=[...r,...i.path||[]],e={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let o="",u=a.filter(d=>!!d).slice().reverse();for(let d of u)o=d(e,{data:t,defaultError:o}).message;return{...i,path:s,message:o}},rWr=[];Gm=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let a=[];for(let i of r){if(i.status==="aborted")return ni;i.status==="dirty"&&t.dirty(),a.push(i.value)}return{status:t.value,value:a}}static async mergeObjectAsync(t,r){let a=[];for(let i of r){let s=await i.key,e=await i.value;a.push({key:s,value:e})}return n.mergeObjectSync(t,a)}static mergeObjectSync(t,r){let a={};for(let i of r){let{key:s,value:e}=i;if(s.status==="aborted"||e.status==="aborted")return ni;s.status==="dirty"&&t.dirty(),e.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof e.value<"u"||i.alwaysSet)&&(a[s.value]=e.value)}return{status:t.value,value:a}}},ni=Object.freeze({status:"aborted"}),jQ=n=>({status:"dirty",value:n}),Gp=n=>({status:"valid",value:n}),rpe=n=>n.status==="aborted",ape=n=>n.status==="dirty",Jw=n=>n.status==="valid",DJ=n=>typeof Promise<"u"&&n instanceof Promise});var vQt=ct(()=>{});var Na,ZQt=ct(()=>{(function(n){n.errToObj=t=>typeof t=="string"?{message:t}:t||{},n.toString=t=>typeof t=="string"?t:t?.message})(Na||(Na={}))});function _i(n){if(!n)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:i}=n;if(t&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(e,o)=>{let{message:u}=n;return e.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??a??o.defaultError}:e.code!=="invalid_type"?{message:o.defaultError}:{message:u??r??o.defaultError}},description:i}}function yQt(n){let t="[0-5]\\d";n.precision?t=`${t}\\.\\d{${n.precision}}`:n.precision==null&&(t=`${t}(\\.\\d+)?`);let r=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function vWr(n){return new RegExp(`^${yQt(n)}$`)}function FQt(n){let t=`${WQt}T${yQt(n)}`,r=[];return r.push(n.local?"Z?":"Z"),n.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ZWr(n,t){return!!((t==="v4"||!t)&&hWr.test(n)||(t==="v6"||!t)&&pWr.test(n))}function NWr(n,t){if(!cWr.test(n))return!1;try{let[r]=n.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(a));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function AWr(n,t){return!!((t==="v4"||!t)&&mWr.test(n)||(t==="v6"||!t)&&bWr.test(n))}function WWr(n,t){let r=(n.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a,s=Number.parseInt(n.toFixed(i).replace(".","")),e=Number.parseInt(t.toFixed(i).replace(".",""));return s%e/10**i}function OJ(n){if(n instanceof gf){let t={};for(let r in n.shape){let a=n.shape[r];t[r]=vv.create(OJ(a))}return new gf({...n._def,shape:()=>t})}else return n instanceof rE?new rE({...n._def,type:OJ(n.element)}):n instanceof vv?vv.create(OJ(n.unwrap())):n instanceof PW?PW.create(OJ(n.unwrap())):n instanceof _W?_W.create(n.items.map(t=>OJ(t))):n}function _Se(n,t){let r=zW(n),a=zW(t);if(n===t)return{valid:!0,data:n};if(r===ea.object&&a===ea.object){let i=Bl.objectKeys(t),s=Bl.objectKeys(n).filter(o=>i.indexOf(o)!==-1),e={...n,...t};for(let o of s){let u=_Se(n[o],t[o]);if(!u.valid)return{valid:!1};e[o]=u.data}return{valid:!0,data:e}}else if(r===ea.array&&a===ea.array){if(n.length!==t.length)return{valid:!1};let i=[];for(let s=0;s<n.length;s++){let e=n[s],o=t[s],u=_Se(e,o);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===ea.date&&a===ea.date&&+n==+t?{valid:!0,data:n}:{valid:!1}}function EQt(n,t){return new s9({values:n,typeName:oi.ZodEnum,..._i(t)})}function AQt(n,t){let r=typeof n=="function"?n(t):typeof n=="string"?{message:n}:n;return typeof r=="string"?{message:r}:r}function RQt(n,t={},r){return n?Dw.create().superRefine((a,i)=>{let s=n(a);if(s instanceof Promise)return s.then(e=>{if(!e){let o=AQt(t,a),u=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:u})}});if(!s){let e=AQt(t,a),o=e.fatal??r??!0;i.addIssue({code:"custom",...e,fatal:o})}}):Dw.create()}var Zv,NQt,ol,aWr,iWr,lWr,sWr,oWr,cWr,uWr,IWr,dWr,zSe,hWr,mWr,pWr,bWr,fWr,GWr,WQt,gWr,Tw,KQ,qQ,$Q,e9,UJ,t9,n9,Dw,nE,MN,MJ,rE,gf,r9,tE,ipe,a9,_W,lpe,zJ,_J,spe,i9,l9,s9,o9,Ow,Nv,vv,PW,c9,u9,PJ,yWr,Sq,Bq,I9,FWr,oi,EWr,wQt,CQt,RWr,wWr,YQt,CWr,YWr,xWr,VWr,QWr,HWr,XWr,kWr,LWr,SWr,BWr,JWr,TWr,DWr,OWr,UWr,MWr,zWr,_Wr,PWr,jWr,KWr,qWr,$Wr,eyr,tyr,nyr,ryr,ayr,iyr,lyr,syr,oyr,cyr,xQt=ct(()=>{tpe();npe();ZQt();MSe();kq();Zv=class{constructor(t,r,a,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=a,this._key=i}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}},NQt=(n,t)=>{if(Jw(t))return{success:!0,data:t.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Gf(n.common.issues);return this._error=r,this._error}}};ol=class{get description(){return this._def.description}_getType(t){return zW(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:zW(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Gm,ctx:{common:t.parent.common,data:t.data,parsedType:zW(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(DJ(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let a=this.safeParse(t,r);if(a.success)return a.data;throw a.error}safeParse(t,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zW(t)},i=this._parseSync({data:t,path:a.path,parent:a});return NQt(a,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zW(t)};if(!this["~standard"].async)try{let a=this._parseSync({data:t,path:[],parent:r});return Jw(a)?{value:a.value}:{issues:r.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(a=>Jw(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(t,r){let a=await this.safeParseAsync(t,r);if(a.success)return a.data;throw a.error}async safeParseAsync(t,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zW(t)},i=this._parse({data:t,path:a.path,parent:a}),s=await(DJ(i)?i:Promise.resolve(i));return NQt(a,s)}refine(t,r){let a=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{let e=t(i),o=()=>s.addIssue({code:vr.custom,...a(i)});return typeof Promise<"u"&&e instanceof Promise?e.then(u=>u?!0:(o(),!1)):e?!0:(o(),!1)})}refinement(t,r){return this._refinement((a,i)=>t(a)?!0:(i.addIssue(typeof r=="function"?r(a,i):r),!1))}_refinement(t){return new Nv({schema:this,typeName:oi.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:r=>this["~validate"](r)}}optional(){return vv.create(this,this._def)}nullable(){return PW.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rE.create(this)}promise(){return Ow.create(this,this._def)}or(t){return r9.create([this,t],this._def)}and(t){return a9.create(this,t,this._def)}transform(t){return new Nv({..._i(this._def),schema:this,typeName:oi.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new c9({..._i(this._def),innerType:this,defaultValue:r,typeName:oi.ZodDefault})}brand(){return new Sq({typeName:oi.ZodBranded,type:this,..._i(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new u9({..._i(this._def),innerType:this,catchValue:r,typeName:oi.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Bq.create(this,t)}readonly(){return I9.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},aWr=/^c[^\s-]{8,}$/i,iWr=/^[0-9a-z]+$/,lWr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,sWr=/^[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,oWr=/^[a-z0-9_-]{21}$/i,cWr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,uWr=/^[-+]?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)?)??$/,IWr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dWr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",hWr=/^(?:(?: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])$/,mWr=/^(?:(?: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])$/,pWr=/^(([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]))$/,bWr=/^(([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])$/,fWr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,GWr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,WQt="((\\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])))",gWr=new RegExp(`^${WQt}$`);Tw=class n extends ol{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ea.string){let s=this._getOrReturnCtx(t);return Or(s,{code:vr.invalid_type,expected:ea.string,received:s.parsedType}),ni}let a=new Gm,i;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="length"){let e=t.data.length>s.value,o=t.data.length<s.value;(e||o)&&(i=this._getOrReturnCtx(t,i),e?Or(i,{code:vr.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&Or(i,{code:vr.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if(s.kind==="email")IWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"email",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="emoji")zSe||(zSe=new RegExp(dWr,"u")),zSe.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"emoji",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="uuid")sWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"uuid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="nanoid")oWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"nanoid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid")aWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"cuid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid2")iWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"cuid2",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="ulid")lWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"ulid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Or(i,{validation:"url",code:vr.invalid_string,message:s.message}),a.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"regex",code:vr.invalid_string,message:s.message}),a.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty()):s.kind==="datetime"?FQt(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.invalid_string,validation:"datetime",message:s.message}),a.dirty()):s.kind==="date"?gWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.invalid_string,validation:"date",message:s.message}),a.dirty()):s.kind==="time"?vWr(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.invalid_string,validation:"time",message:s.message}),a.dirty()):s.kind==="duration"?uWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"duration",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="ip"?ZWr(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"ip",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="jwt"?NWr(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"jwt",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="cidr"?AWr(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"cidr",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="base64"?fWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"base64",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="base64url"?GWr.test(t.data)||(i=this._getOrReturnCtx(t,i),Or(i,{validation:"base64url",code:vr.invalid_string,message:s.message}),a.dirty()):Bl.assertNever(s);return{status:a.value,value:t.data}}_regex(t,r,a){return this.refinement(i=>t.test(i),{validation:r,code:vr.invalid_string,...Na.errToObj(a)})}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Na.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Na.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Na.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Na.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Na.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Na.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Na.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Na.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Na.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Na.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Na.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Na.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Na.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...Na.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Na.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Na.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Na.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Na.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Na.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Na.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Na.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Na.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Na.errToObj(r)})}nonempty(t){return this.min(1,Na.errToObj(t))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Tw.create=n=>new Tw({checks:[],typeName:oi.ZodString,coerce:n?.coerce??!1,..._i(n)});KQ=class n extends ol{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ea.number){let s=this._getOrReturnCtx(t);return Or(s,{code:vr.invalid_type,expected:ea.number,received:s.parsedType}),ni}let a,i=new Gm;for(let s of this._def.checks)s.kind==="int"?Bl.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?WWr(t.data,s.value)!==0&&(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.not_finite,message:s.message}),i.dirty()):Bl.assertNever(s);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Na.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Na.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Na.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Na.toString(r))}setLimit(t,r,a,i){return new n({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:Na.toString(i)}]})}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Na.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Na.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Na.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Na.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Na.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Na.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Na.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Na.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Na.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Bl.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(t===null||a.value<t)&&(t=a.value)}return Number.isFinite(r)&&Number.isFinite(t)}};KQ.create=n=>new KQ({checks:[],typeName:oi.ZodNumber,coerce:n?.coerce||!1,..._i(n)});qQ=class n extends ol{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ea.bigint)return this._getInvalidInput(t);let a,i=new Gm;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),Or(a,{code:vr.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Bl.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Or(r,{code:vr.invalid_type,expected:ea.bigint,received:r.parsedType}),ni}gte(t,r){return this.setLimit("min",t,!0,Na.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Na.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Na.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Na.toString(r))}setLimit(t,r,a,i){return new n({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:Na.toString(i)}]})}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Na.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Na.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Na.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Na.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Na.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};qQ.create=n=>new qQ({checks:[],typeName:oi.ZodBigInt,coerce:n?.coerce??!1,..._i(n)});$Q=class extends ol{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ea.boolean){let a=this._getOrReturnCtx(t);return Or(a,{code:vr.invalid_type,expected:ea.boolean,received:a.parsedType}),ni}return Gp(t.data)}};$Q.create=n=>new $Q({typeName:oi.ZodBoolean,coerce:n?.coerce||!1,..._i(n)});e9=class n extends ol{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ea.date){let s=this._getOrReturnCtx(t);return Or(s,{code:vr.invalid_type,expected:ea.date,received:s.parsedType}),ni}if(Number.isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return Or(s,{code:vr.invalid_date}),ni}let a=new Gm,i;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),Or(i,{code:vr.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):Bl.assertNever(s);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Na.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Na.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};e9.create=n=>new e9({checks:[],coerce:n?.coerce||!1,typeName:oi.ZodDate,..._i(n)});UJ=class extends ol{_parse(t){if(this._getType(t)!==ea.symbol){let a=this._getOrReturnCtx(t);return Or(a,{code:vr.invalid_type,expected:ea.symbol,received:a.parsedType}),ni}return Gp(t.data)}};UJ.create=n=>new UJ({typeName:oi.ZodSymbol,..._i(n)});t9=class extends ol{_parse(t){if(this._getType(t)!==ea.undefined){let a=this._getOrReturnCtx(t);return Or(a,{code:vr.invalid_type,expected:ea.undefined,received:a.parsedType}),ni}return Gp(t.data)}};t9.create=n=>new t9({typeName:oi.ZodUndefined,..._i(n)});n9=class extends ol{_parse(t){if(this._getType(t)!==ea.null){let a=this._getOrReturnCtx(t);return Or(a,{code:vr.invalid_type,expected:ea.null,received:a.parsedType}),ni}return Gp(t.data)}};n9.create=n=>new n9({typeName:oi.ZodNull,..._i(n)});Dw=class extends ol{constructor(){super(...arguments),this._any=!0}_parse(t){return Gp(t.data)}};Dw.create=n=>new Dw({typeName:oi.ZodAny,..._i(n)});nE=class extends ol{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Gp(t.data)}};nE.create=n=>new nE({typeName:oi.ZodUnknown,..._i(n)});MN=class extends ol{_parse(t){let r=this._getOrReturnCtx(t);return Or(r,{code:vr.invalid_type,expected:ea.never,received:r.parsedType}),ni}};MN.create=n=>new MN({typeName:oi.ZodNever,..._i(n)});MJ=class extends ol{_parse(t){if(this._getType(t)!==ea.undefined){let a=this._getOrReturnCtx(t);return Or(a,{code:vr.invalid_type,expected:ea.void,received:a.parsedType}),ni}return Gp(t.data)}};MJ.create=n=>new MJ({typeName:oi.ZodVoid,..._i(n)});rE=class n extends ol{_parse(t){let{ctx:r,status:a}=this._processInputParams(t),i=this._def;if(r.parsedType!==ea.array)return Or(r,{code:vr.invalid_type,expected:ea.array,received:r.parsedType}),ni;if(i.exactLength!==null){let e=r.data.length>i.exactLength.value,o=r.data.length<i.exactLength.value;(e||o)&&(Or(r,{code:e?vr.too_big:vr.too_small,minimum:o?i.exactLength.value:void 0,maximum:e?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),a.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Or(r,{code:vr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),a.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Or(r,{code:vr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((e,o)=>i.type._parseAsync(new Zv(r,e,r.path,o)))).then(e=>Gm.mergeArray(a,e));let s=[...r.data].map((e,o)=>i.type._parseSync(new Zv(r,e,r.path,o)));return Gm.mergeArray(a,s)}get element(){return this._def.type}min(t,r){return new n({...this._def,minLength:{value:t,message:Na.toString(r)}})}max(t,r){return new n({...this._def,maxLength:{value:t,message:Na.toString(r)}})}length(t,r){return new n({...this._def,exactLength:{value:t,message:Na.toString(r)}})}nonempty(t){return this.min(1,t)}};rE.create=(n,t)=>new rE({type:n,minLength:null,maxLength:null,exactLength:null,typeName:oi.ZodArray,..._i(t)});gf=class n extends ol{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Bl.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ea.object){let d=this._getOrReturnCtx(t);return Or(d,{code:vr.invalid_type,expected:ea.object,received:d.parsedType}),ni}let{status:a,ctx:i}=this._processInputParams(t),{shape:s,keys:e}=this._getCached(),o=[];if(!(this._def.catchall instanceof MN&&this._def.unknownKeys==="strip"))for(let d in i.data)e.includes(d)||o.push(d);let u=[];for(let d of e){let I=s[d],h=i.data[d];u.push({key:{status:"valid",value:d},value:I._parse(new Zv(i,h,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof MN){let d=this._def.unknownKeys;if(d==="passthrough")for(let I of o)u.push({key:{status:"valid",value:I},value:{status:"valid",value:i.data[I]}});else if(d==="strict")o.length>0&&(Or(i,{code:vr.unrecognized_keys,keys:o}),a.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let I of o){let h=i.data[I];u.push({key:{status:"valid",value:I},value:d._parse(new Zv(i,h,i.path,I)),alwaysSet:I in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let d=[];for(let I of u){let h=await I.key,c=await I.value;d.push({key:h,value:c,alwaysSet:I.alwaysSet})}return d}).then(d=>Gm.mergeObjectSync(a,d)):Gm.mergeObjectSync(a,u)}get shape(){return this._def.shape()}strict(t){return Na.errToObj,new n({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,a)=>{let i=this._def.errorMap?.(r,a).message??a.defaultError;return r.code==="unrecognized_keys"?{message:Na.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(t){return new n({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new n({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:oi.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new n({...this._def,catchall:t})}pick(t){let r={};for(let a of Bl.objectKeys(t))t[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new n({...this._def,shape:()=>r})}omit(t){let r={};for(let a of Bl.objectKeys(this.shape))t[a]||(r[a]=this.shape[a]);return new n({...this._def,shape:()=>r})}deepPartial(){return OJ(this)}partial(t){let r={};for(let a of Bl.objectKeys(this.shape)){let i=this.shape[a];t&&!t[a]?r[a]=i:r[a]=i.optional()}return new n({...this._def,shape:()=>r})}required(t){let r={};for(let a of Bl.objectKeys(this.shape))if(t&&!t[a])r[a]=this.shape[a];else{let s=this.shape[a];for(;s instanceof vv;)s=s._def.innerType;r[a]=s}return new n({...this._def,shape:()=>r})}keyof(){return EQt(Bl.objectKeys(this.shape))}};gf.create=(n,t)=>new gf({shape:()=>n,unknownKeys:"strip",catchall:MN.create(),typeName:oi.ZodObject,..._i(t)});gf.strictCreate=(n,t)=>new gf({shape:()=>n,unknownKeys:"strict",catchall:MN.create(),typeName:oi.ZodObject,..._i(t)});gf.lazycreate=(n,t)=>new gf({shape:n,unknownKeys:"strip",catchall:MN.create(),typeName:oi.ZodObject,..._i(t)});r9=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a=this._def.options;function i(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let e=s.map(o=>new Gf(o.ctx.common.issues));return Or(r,{code:vr.invalid_union,unionErrors:e}),ni}if(r.common.async)return Promise.all(a.map(async s=>{let e={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:e}),ctx:e}})).then(i);{let s,e=[];for(let u of a){let d={...r,common:{...r.common,issues:[]},parent:null},I=u._parseSync({data:r.data,path:r.path,parent:d});if(I.status==="valid")return I;I.status==="dirty"&&!s&&(s={result:I,ctx:d}),d.common.issues.length&&e.push(d.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let o=e.map(u=>new Gf(u));return Or(r,{code:vr.invalid_union,unionErrors:o}),ni}}get options(){return this._def.options}};r9.create=(n,t)=>new r9({options:n,typeName:oi.ZodUnion,..._i(t)});tE=n=>n instanceof i9?tE(n.schema):n instanceof Nv?tE(n.innerType()):n instanceof l9?[n.value]:n instanceof s9?n.options:n instanceof o9?Bl.objectValues(n.enum):n instanceof c9?tE(n._def.innerType):n instanceof t9?[void 0]:n instanceof n9?[null]:n instanceof vv?[void 0,...tE(n.unwrap())]:n instanceof PW?[null,...tE(n.unwrap())]:n instanceof Sq||n instanceof I9?tE(n.unwrap()):n instanceof u9?tE(n._def.innerType):[],ipe=class n extends ol{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ea.object)return Or(r,{code:vr.invalid_type,expected:ea.object,received:r.parsedType}),ni;let a=this.discriminator,i=r.data[a],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Or(r,{code:vr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),ni)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,a){let i=new Map;for(let s of r){let e=tE(s.shape[t]);if(!e.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let o of e){if(i.has(o))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);i.set(o,s)}}return new n({typeName:oi.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,..._i(a)})}};a9=class extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=(s,e)=>{if(rpe(s)||rpe(e))return ni;let o=_Se(s.value,e.value);return o.valid?((ape(s)||ape(e))&&r.dirty(),{status:r.value,value:o.data}):(Or(a,{code:vr.invalid_intersection_types}),ni)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([s,e])=>i(s,e)):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};a9.create=(n,t,r)=>new a9({left:n,right:t,typeName:oi.ZodIntersection,..._i(r)});_W=class n extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ea.array)return Or(a,{code:vr.invalid_type,expected:ea.array,received:a.parsedType}),ni;if(a.data.length<this._def.items.length)return Or(a,{code:vr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ni;!this._def.rest&&a.data.length>this._def.items.length&&(Or(a,{code:vr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...a.data].map((e,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new Zv(a,e,a.path,o)):null}).filter(e=>!!e);return a.common.async?Promise.all(s).then(e=>Gm.mergeArray(r,e)):Gm.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new n({...this._def,rest:t})}};_W.create=(n,t)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _W({items:n,typeName:oi.ZodTuple,rest:null,..._i(t)})};lpe=class n extends ol{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ea.object)return Or(a,{code:vr.invalid_type,expected:ea.object,received:a.parsedType}),ni;let i=[],s=this._def.keyType,e=this._def.valueType;for(let o in a.data)i.push({key:s._parse(new Zv(a,o,a.path,o)),value:e._parse(new Zv(a,a.data[o],a.path,o)),alwaysSet:o in a.data});return a.common.async?Gm.mergeObjectAsync(r,i):Gm.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,a){return r instanceof ol?new n({keyType:t,valueType:r,typeName:oi.ZodRecord,..._i(a)}):new n({keyType:Tw.create(),valueType:t,typeName:oi.ZodRecord,..._i(r)})}},zJ=class extends ol{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ea.map)return Or(a,{code:vr.invalid_type,expected:ea.map,received:a.parsedType}),ni;let i=this._def.keyType,s=this._def.valueType,e=[...a.data.entries()].map(([o,u],d)=>({key:i._parse(new Zv(a,o,a.path,[d,"key"])),value:s._parse(new Zv(a,u,a.path,[d,"value"]))}));if(a.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of e){let d=await u.key,I=await u.value;if(d.status==="aborted"||I.status==="aborted")return ni;(d.status==="dirty"||I.status==="dirty")&&r.dirty(),o.set(d.value,I.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let u of e){let d=u.key,I=u.value;if(d.status==="aborted"||I.status==="aborted")return ni;(d.status==="dirty"||I.status==="dirty")&&r.dirty(),o.set(d.value,I.value)}return{status:r.value,value:o}}}};zJ.create=(n,t,r)=>new zJ({valueType:t,keyType:n,typeName:oi.ZodMap,..._i(r)});_J=class n extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ea.set)return Or(a,{code:vr.invalid_type,expected:ea.set,received:a.parsedType}),ni;let i=this._def;i.minSize!==null&&a.data.size<i.minSize.value&&(Or(a,{code:vr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&a.data.size>i.maxSize.value&&(Or(a,{code:vr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function e(u){let d=new Set;for(let I of u){if(I.status==="aborted")return ni;I.status==="dirty"&&r.dirty(),d.add(I.value)}return{status:r.value,value:d}}let o=[...a.data.values()].map((u,d)=>s._parse(new Zv(a,u,a.path,d)));return a.common.async?Promise.all(o).then(u=>e(u)):e(o)}min(t,r){return new n({...this._def,minSize:{value:t,message:Na.toString(r)}})}max(t,r){return new n({...this._def,maxSize:{value:t,message:Na.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};_J.create=(n,t)=>new _J({valueType:n,minSize:null,maxSize:null,typeName:oi.ZodSet,..._i(t)});spe=class n extends ol{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ea.function)return Or(r,{code:vr.invalid_type,expected:ea.function,received:r.parsedType}),ni;function a(o,u){return Lq({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,TJ(),eE].filter(d=>!!d),issueData:{code:vr.invalid_arguments,argumentsError:u}})}function i(o,u){return Lq({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,TJ(),eE].filter(d=>!!d),issueData:{code:vr.invalid_return_type,returnTypeError:u}})}let s={errorMap:r.common.contextualErrorMap},e=r.data;if(this._def.returns instanceof Ow){let o=this;return Gp(async function(...u){let d=new Gf([]),I=await o._def.args.parseAsync(u,s).catch(G=>{throw d.addIssue(a(u,G)),d}),h=await Reflect.apply(e,this,I);return await o._def.returns._def.type.parseAsync(h,s).catch(G=>{throw d.addIssue(i(h,G)),d})})}else{let o=this;return Gp(function(...u){let d=o._def.args.safeParse(u,s);if(!d.success)throw new Gf([a(u,d.error)]);let I=Reflect.apply(e,this,d.data),h=o._def.returns.safeParse(I,s);if(!h.success)throw new Gf([i(I,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new n({...this._def,args:_W.create(t).rest(nE.create())})}returns(t){return new n({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,a){return new n({args:t||_W.create([]).rest(nE.create()),returns:r||nE.create(),typeName:oi.ZodFunction,..._i(a)})}},i9=class extends ol{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};i9.create=(n,t)=>new i9({getter:n,typeName:oi.ZodLazy,..._i(t)});l9=class extends ol{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Or(r,{received:r.data,code:vr.invalid_literal,expected:this._def.value}),ni}return{status:"valid",value:t.data}}get value(){return this._def.value}};l9.create=(n,t)=>new l9({value:n,typeName:oi.ZodLiteral,..._i(t)});s9=class n extends ol{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),a=this._def.values;return Or(r,{expected:Bl.joinValues(a),received:r.parsedType,code:vr.invalid_type}),ni}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),a=this._def.values;return Or(r,{received:r.data,code:vr.invalid_enum_value,options:a}),ni}return Gp(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return n.create(t,{...this._def,...r})}exclude(t,r=this._def){return n.create(this.options.filter(a=>!t.includes(a)),{...this._def,...r})}};s9.create=EQt;o9=class extends ol{_parse(t){let r=Bl.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==ea.string&&a.parsedType!==ea.number){let i=Bl.objectValues(r);return Or(a,{expected:Bl.joinValues(i),received:a.parsedType,code:vr.invalid_type}),ni}if(this._cache||(this._cache=new Set(Bl.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Bl.objectValues(r);return Or(a,{received:a.data,code:vr.invalid_enum_value,options:i}),ni}return Gp(t.data)}get enum(){return this._def.values}};o9.create=(n,t)=>new o9({values:n,typeName:oi.ZodNativeEnum,..._i(t)});Ow=class extends ol{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ea.promise&&r.common.async===!1)return Or(r,{code:vr.invalid_type,expected:ea.promise,received:r.parsedType}),ni;let a=r.parsedType===ea.promise?r.data:Promise.resolve(r.data);return Gp(a.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ow.create=(n,t)=>new Ow({type:n,typeName:oi.ZodPromise,..._i(t)});Nv=class extends ol{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===oi.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:e=>{Or(a,e),e.fatal?r.abort():r.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let e=i.transform(a.data,s);if(a.common.async)return Promise.resolve(e).then(async o=>{if(r.value==="aborted")return ni;let u=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return u.status==="aborted"?ni:u.status==="dirty"?jQ(u.value):r.value==="dirty"?jQ(u.value):u});{if(r.value==="aborted")return ni;let o=this._def.schema._parseSync({data:e,path:a.path,parent:a});return o.status==="aborted"?ni:o.status==="dirty"?jQ(o.value):r.value==="dirty"?jQ(o.value):o}}if(i.type==="refinement"){let e=o=>{let u=i.refinement(o,s);if(a.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?ni:(o.status==="dirty"&&r.dirty(),e(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>o.status==="aborted"?ni:(o.status==="dirty"&&r.dirty(),e(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(a.common.async===!1){let e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Jw(e))return ni;let o=i.transform(e.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>Jw(e)?Promise.resolve(i.transform(e.value,s)).then(o=>({status:r.value,value:o})):ni);Bl.assertNever(i)}};Nv.create=(n,t,r)=>new Nv({schema:n,typeName:oi.ZodEffects,effect:t,..._i(r)});Nv.createWithPreprocess=(n,t,r)=>new Nv({schema:t,effect:{type:"preprocess",transform:n},typeName:oi.ZodEffects,..._i(r)});vv=class extends ol{_parse(t){return this._getType(t)===ea.undefined?Gp(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};vv.create=(n,t)=>new vv({innerType:n,typeName:oi.ZodOptional,..._i(t)});PW=class extends ol{_parse(t){return this._getType(t)===ea.null?Gp(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};PW.create=(n,t)=>new PW({innerType:n,typeName:oi.ZodNullable,..._i(t)});c9=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return r.parsedType===ea.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};c9.create=(n,t)=>new c9({innerType:n,typeName:oi.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,..._i(t)});u9=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return DJ(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Gf(a.common.issues)},input:a.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Gf(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};u9.create=(n,t)=>new u9({innerType:n,typeName:oi.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,..._i(t)});PJ=class extends ol{_parse(t){if(this._getType(t)!==ea.nan){let a=this._getOrReturnCtx(t);return Or(a,{code:vr.invalid_type,expected:ea.nan,received:a.parsedType}),ni}return{status:"valid",value:t.data}}};PJ.create=n=>new PJ({typeName:oi.ZodNaN,..._i(n)});yWr=Symbol("zod_brand"),Sq=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}},Bq=class n extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?ni:s.status==="dirty"?(r.dirty(),jQ(s.value)):this._def.out._parseAsync({data:s.value,path:a.path,parent:a})})();{let i=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?ni:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:a.path,parent:a})}}static create(t,r){return new n({in:t,out:r,typeName:oi.ZodPipeline})}},I9=class extends ol{_parse(t){let r=this._def.innerType._parse(t),a=i=>(Jw(i)&&(i.value=Object.freeze(i.value)),i);return DJ(r)?r.then(i=>a(i)):a(r)}unwrap(){return this._def.innerType}};I9.create=(n,t)=>new I9({innerType:n,typeName:oi.ZodReadonly,..._i(t)});FWr={object:gf.lazycreate};(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(oi||(oi={}));EWr=(n,t={message:`Input not instance of ${n.name}`})=>RQt(r=>r instanceof n,t),wQt=Tw.create,CQt=KQ.create,RWr=PJ.create,wWr=qQ.create,YQt=$Q.create,CWr=e9.create,YWr=UJ.create,xWr=t9.create,VWr=n9.create,QWr=Dw.create,HWr=nE.create,XWr=MN.create,kWr=MJ.create,LWr=rE.create,SWr=gf.create,BWr=gf.strictCreate,JWr=r9.create,TWr=ipe.create,DWr=a9.create,OWr=_W.create,UWr=lpe.create,MWr=zJ.create,zWr=_J.create,_Wr=spe.create,PWr=i9.create,jWr=l9.create,KWr=s9.create,qWr=o9.create,$Wr=Ow.create,eyr=Nv.create,tyr=vv.create,nyr=PW.create,ryr=Nv.createWithPreprocess,ayr=Bq.create,iyr=()=>wQt().optional(),lyr=()=>CQt().optional(),syr=()=>YQt().optional(),oyr={string:(n=>Tw.create({...n,coerce:!0})),number:(n=>KQ.create({...n,coerce:!0})),boolean:(n=>$Q.create({...n,coerce:!0})),bigint:(n=>qQ.create({...n,coerce:!0})),date:(n=>e9.create({...n,coerce:!0}))},cyr=ni});var ju={};po(ju,{BRAND:()=>yWr,DIRTY:()=>jQ,EMPTY_PATH:()=>rWr,INVALID:()=>ni,NEVER:()=>cyr,OK:()=>Gp,ParseStatus:()=>Gm,Schema:()=>ol,ZodAny:()=>Dw,ZodArray:()=>rE,ZodBigInt:()=>qQ,ZodBoolean:()=>$Q,ZodBranded:()=>Sq,ZodCatch:()=>u9,ZodDate:()=>e9,ZodDefault:()=>c9,ZodDiscriminatedUnion:()=>ipe,ZodEffects:()=>Nv,ZodEnum:()=>s9,ZodError:()=>Gf,ZodFirstPartyTypeKind:()=>oi,ZodFunction:()=>spe,ZodIntersection:()=>a9,ZodIssueCode:()=>vr,ZodLazy:()=>i9,ZodLiteral:()=>l9,ZodMap:()=>zJ,ZodNaN:()=>PJ,ZodNativeEnum:()=>o9,ZodNever:()=>MN,ZodNull:()=>n9,ZodNullable:()=>PW,ZodNumber:()=>KQ,ZodObject:()=>gf,ZodOptional:()=>vv,ZodParsedType:()=>ea,ZodPipeline:()=>Bq,ZodPromise:()=>Ow,ZodReadonly:()=>I9,ZodRecord:()=>lpe,ZodSchema:()=>ol,ZodSet:()=>_J,ZodString:()=>Tw,ZodSymbol:()=>UJ,ZodTransformer:()=>Nv,ZodTuple:()=>_W,ZodType:()=>ol,ZodUndefined:()=>t9,ZodUnion:()=>r9,ZodUnknown:()=>nE,ZodVoid:()=>MJ,addIssueToContext:()=>Or,any:()=>QWr,array:()=>LWr,bigint:()=>wWr,boolean:()=>YQt,coerce:()=>oyr,custom:()=>RQt,date:()=>CWr,datetimeRegex:()=>FQt,defaultErrorMap:()=>eE,discriminatedUnion:()=>TWr,effect:()=>eyr,enum:()=>KWr,function:()=>_Wr,getErrorMap:()=>TJ,getParsedType:()=>zW,instanceof:()=>EWr,intersection:()=>DWr,isAborted:()=>rpe,isAsync:()=>DJ,isDirty:()=>ape,isValid:()=>Jw,late:()=>FWr,lazy:()=>PWr,literal:()=>jWr,makeIssue:()=>Lq,map:()=>MWr,nan:()=>RWr,nativeEnum:()=>qWr,never:()=>XWr,null:()=>VWr,nullable:()=>nyr,number:()=>CQt,object:()=>SWr,objectUtil:()=>OSe,oboolean:()=>syr,onumber:()=>lyr,optional:()=>tyr,ostring:()=>iyr,pipeline:()=>ayr,preprocess:()=>ryr,promise:()=>$Wr,quotelessJson:()=>eWr,record:()=>UWr,set:()=>zWr,setErrorMap:()=>nWr,strictObject:()=>BWr,string:()=>wQt,symbol:()=>YWr,transformer:()=>eyr,tuple:()=>OWr,undefined:()=>xWr,union:()=>JWr,unknown:()=>HWr,util:()=>Bl,void:()=>kWr});var PSe=ct(()=>{npe();MSe();vQt();kq();xQt();tpe()});function Tn(n,t,r){function a(o,u){var d;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(d=o._zod).traits??(d.traits=new Set),o._zod.traits.add(n),t(o,u);for(let I in e.prototype)I in o||Object.defineProperty(o,I,{value:e.prototype[I].bind(o)});o._zod.constr=e,o._zod.def=u}let i=r?.Parent??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function e(o){var u;let d=r?.Parent?new s:this;a(d,o),(u=d._zod).deferred??(u.deferred=[]);for(let I of d._zod.deferred)I();return d}return Object.defineProperty(e,"init",{value:a}),Object.defineProperty(e,Symbol.hasInstance,{value:o=>r?.Parent&&o instanceof r.Parent?!0:o?._zod?.traits?.has(n)}),Object.defineProperty(e,"name",{value:n}),e}function c1(n){return n&&Object.assign(ope,n),ope}var jSe,uyr,aE,ope,jJ=ct(()=>{jSe=Object.freeze({status:"aborted"});uyr=Symbol("zod_brand"),aE=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ope={}});var js={};po(js,{BIGINT_FORMAT_RANGES:()=>QQt,Class:()=>qSe,NUMBER_FORMAT_RANGES:()=>lBe,aborted:()=>h9,allowsEval:()=>rBe,assert:()=>pyr,assertEqual:()=>Iyr,assertIs:()=>hyr,assertNever:()=>myr,assertNotEqual:()=>dyr,assignProp:()=>nBe,cached:()=>Tq,captureStackTrace:()=>upe,cleanEnum:()=>Ryr,cleanRegex:()=>Oq,clone:()=>zN,createTransparentProxy:()=>Zyr,defineLazy:()=>Hc,esc:()=>d9,escapeRegex:()=>Uw,extend:()=>Wyr,finalizeIssue:()=>_N,floatSafeRemainder:()=>tBe,getElementAtPath:()=>byr,getEnumValues:()=>$Se,getLengthableOrigin:()=>Uq,getParsedType:()=>vyr,getSizableOrigin:()=>HQt,isObject:()=>KJ,isPlainObject:()=>qJ,issue:()=>sBe,joinValues:()=>cpe,jsonStringifyReplacer:()=>eBe,merge:()=>yyr,normalizeParams:()=>ka,nullish:()=>Dq,numKeys:()=>gyr,omit:()=>Ayr,optionalKeys:()=>iBe,partial:()=>Fyr,pick:()=>Nyr,prefixIssues:()=>jW,primitiveTypes:()=>VQt,promiseAllObject:()=>fyr,propertyKeyTypes:()=>aBe,randomString:()=>Gyr,required:()=>Eyr,stringifyPrimitive:()=>Ipe,unwrapMessage:()=>Jq});function Iyr(n){return n}function dyr(n){return n}function hyr(n){}function myr(n){throw new Error}function pyr(n){}function $Se(n){let t=Object.values(n).filter(a=>typeof a=="number");return Object.entries(n).filter(([a,i])=>t.indexOf(+a)===-1).map(([a,i])=>i)}function cpe(n,t="|"){return n.map(r=>Ipe(r)).join(t)}function eBe(n,t){return typeof t=="bigint"?t.toString():t}function Tq(n){return{get value(){{let r=n();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Dq(n){return n==null}function Oq(n){let t=n.startsWith("^")?1:0,r=n.endsWith("$")?n.length-1:n.length;return n.slice(t,r)}function tBe(n,t){let r=(n.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a,s=Number.parseInt(n.toFixed(i).replace(".","")),e=Number.parseInt(t.toFixed(i).replace(".",""));return s%e/10**i}function Hc(n,t,r){Object.defineProperty(n,t,{get(){{let i=r();return n[t]=i,i}throw new Error("cached value already set")},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function nBe(n,t,r){Object.defineProperty(n,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function byr(n,t){return t?t.reduce((r,a)=>r?.[a],n):n}function fyr(n){let t=Object.keys(n),r=t.map(a=>n[a]);return Promise.all(r).then(a=>{let i={};for(let s=0;s<t.length;s++)i[t[s]]=a[s];return i})}function Gyr(n=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let a=0;a<n;a++)r+=t[Math.floor(Math.random()*t.length)];return r}function d9(n){return JSON.stringify(n)}function KJ(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function qJ(n){if(KJ(n)===!1)return!1;let t=n.constructor;if(t===void 0)return!0;let r=t.prototype;return!(KJ(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function gyr(n){let t=0;for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&t++;return t}function Uw(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zN(n,t,r){let a=new n._zod.constr(t??n._zod.def);return(!t||r?.parent)&&(a._zod.parent=n),a}function ka(n){let t=n;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Zyr(n){let t;return new Proxy({},{get(r,a,i){return t??(t=n()),Reflect.get(t,a,i)},set(r,a,i,s){return t??(t=n()),Reflect.set(t,a,i,s)},has(r,a){return t??(t=n()),Reflect.has(t,a)},deleteProperty(r,a){return t??(t=n()),Reflect.deleteProperty(t,a)},ownKeys(r){return t??(t=n()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,a){return t??(t=n()),Reflect.getOwnPropertyDescriptor(t,a)},defineProperty(r,a,i){return t??(t=n()),Reflect.defineProperty(t,a,i)}})}function Ipe(n){return typeof n=="bigint"?n.toString()+"n":typeof n=="string"?`"${n}"`:`${n}`}function iBe(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}function Nyr(n,t){let r={},a=n._zod.def;for(let i in t){if(!(i in a.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(r[i]=a.shape[i])}return zN(n,{...n._zod.def,shape:r,checks:[]})}function Ayr(n,t){let r={...n._zod.def.shape},a=n._zod.def;for(let i in t){if(!(i in a.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete r[i]}return zN(n,{...n._zod.def,shape:r,checks:[]})}function Wyr(n,t){if(!qJ(t))throw new Error("Invalid input to extend: expected a plain object");let r={...n._zod.def,get shape(){let a={...n._zod.def.shape,...t};return nBe(this,"shape",a),a},checks:[]};return zN(n,r)}function yyr(n,t){return zN(n,{...n._zod.def,get shape(){let r={...n._zod.def.shape,...t._zod.def.shape};return nBe(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function Fyr(n,t,r){let a=t._zod.def.shape,i={...a};if(r)for(let s in r){if(!(s in a))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=n?new n({type:"optional",innerType:a[s]}):a[s])}else for(let s in a)i[s]=n?new n({type:"optional",innerType:a[s]}):a[s];return zN(t,{...t._zod.def,shape:i,checks:[]})}function Eyr(n,t,r){let a=t._zod.def.shape,i={...a};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new n({type:"nonoptional",innerType:a[s]}))}else for(let s in a)i[s]=new n({type:"nonoptional",innerType:a[s]});return zN(t,{...t._zod.def,shape:i,checks:[]})}function h9(n,t=0){for(let r=t;r<n.issues.length;r++)if(n.issues[r]?.continue!==!0)return!0;return!1}function jW(n,t){return t.map(r=>{var a;return(a=r).path??(a.path=[]),r.path.unshift(n),r})}function Jq(n){return typeof n=="string"?n:n?.message}function _N(n,t,r){let a={...n,path:n.path??[]};if(!n.message){let i=Jq(n.inst?._zod.def?.error?.(n))??Jq(t?.error?.(n))??Jq(r.customError?.(n))??Jq(r.localeError?.(n))??"Invalid input";a.message=i}return delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function HQt(n){return n instanceof Set?"set":n instanceof Map?"map":n instanceof File?"file":"unknown"}function Uq(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function sBe(...n){let[t,r,a]=n;return typeof t=="string"?{message:t,code:"custom",input:r,inst:a}:{...t}}function Ryr(n){return Object.entries(n).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}var upe,rBe,vyr,aBe,VQt,lBe,QQt,qSe,iE=ct(()=>{upe=Error.captureStackTrace?Error.captureStackTrace:(...n)=>{};rBe=Tq(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let n=Function;return new n(""),!0}catch{return!1}});vyr=n=>{let t=typeof n;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(n)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(n)?"array":n===null?"null":n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?"promise":typeof Map<"u"&&n instanceof Map?"map":typeof Set<"u"&&n instanceof Set?"set":typeof Date<"u"&&n instanceof Date?"date":typeof File<"u"&&n instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},aBe=new Set(["string","number","symbol"]),VQt=new Set(["string","number","bigint","boolean","symbol","undefined"]);lBe={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},QQt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};qSe=class{constructor(...t){}}});function cBe(n,t=r=>r.message){let r={},a=[];for(let i of n.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):a.push(t(i));return{formErrors:a,fieldErrors:r}}function uBe(n,t){let r=t||function(s){return s.message},a={_errors:[]},i=s=>{for(let e of s.issues)if(e.code==="invalid_union"&&e.errors.length)e.errors.map(o=>i({issues:o}));else if(e.code==="invalid_key")i({issues:e.issues});else if(e.code==="invalid_element")i({issues:e.issues});else if(e.path.length===0)a._errors.push(r(e));else{let o=a,u=0;for(;u<e.path.length;){let d=e.path[u];u===e.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(r(e))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return i(n),a}var XQt,dpe,oBe,IBe=ct(()=>{jJ();iE();XQt=(n,t)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:t,enumerable:!1}),Object.defineProperty(n,"message",{get(){return JSON.stringify(t,eBe,2)},enumerable:!0}),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},dpe=Tn("$ZodError",XQt),oBe=Tn("$ZodError",XQt,{Parent:Error})});var kQt,LQt,dBe,Mq,hBe,hpe,mBe=ct(()=>{jJ();IBe();iE();kQt=n=>(t,r,a,i)=>{let s=a?Object.assign(a,{async:!1}):{async:!1},e=t._zod.run({value:r,issues:[]},s);if(e instanceof Promise)throw new aE;if(e.issues.length){let o=new(i?.Err??n)(e.issues.map(u=>_N(u,s,c1())));throw upe(o,i?.callee),o}return e.value},LQt=n=>async(t,r,a,i)=>{let s=a?Object.assign(a,{async:!0}):{async:!0},e=t._zod.run({value:r,issues:[]},s);if(e instanceof Promise&&(e=await e),e.issues.length){let o=new(i?.Err??n)(e.issues.map(u=>_N(u,s,c1())));throw upe(o,i?.callee),o}return e.value},dBe=n=>(t,r,a)=>{let i=a?{...a,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new aE;return s.issues.length?{success:!1,error:new(n??dpe)(s.issues.map(e=>_N(e,i,c1())))}:{success:!0,data:s.value}},Mq=dBe(oBe),hBe=n=>async(t,r,a)=>{let i=a?Object.assign(a,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(e=>_N(e,i,c1())))}:{success:!0,data:s.value}},hpe=hBe(oBe)});function _Qt(){return new RegExp(Cyr,"u")}function a9t(n){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${t}`:n.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${n.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function i9t(n){return new RegExp(`^${a9t(n)}$`)}function l9t(n){let t=a9t({precision:n.precision}),r=["Z"];n.local&&r.push(""),n.offset&&r.push("([+-]\\d{2}:\\d{2})");let a=`${t}(?:${r.join("|")})`;return new RegExp(`^${n9t}T(?:${a})$`)}var SQt,BQt,JQt,TQt,DQt,OQt,UQt,MQt,pBe,zQt,Cyr,PQt,jQt,KQt,qQt,$Qt,bBe,e9t,t9t,n9t,r9t,s9t,o9t,c9t,u9t,I9t,d9t,h9t,m9t,ppe=ct(()=>{SQt=/^[cC][^\s-]{8,}$/,BQt=/^[0-9a-z]+$/,JQt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,TQt=/^[0-9a-vA-V]{20}$/,DQt=/^[A-Za-z0-9]{27}$/,OQt=/^[a-zA-Z0-9_-]{21}$/,UQt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,MQt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,pBe=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,zQt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Cyr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";PQt=/^(?:(?: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])$/,jQt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,KQt=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,qQt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$Qt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,bBe=/^[A-Za-z0-9_-]*$/,e9t=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,t9t=/^\+(?:[0-9]){6,14}[0-9]$/,n9t="(?:(?:\\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])))",r9t=new RegExp(`^${n9t}$`);s9t=n=>{let t=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},o9t=/^\d+n?$/,c9t=/^\d+$/,u9t=/^-?\d+(?:\.\d+)?/i,I9t=/true|false/i,d9t=/null/i,h9t=/^[^A-Z]*$/,m9t=/^[^a-z]*$/});var gp,p9t,fBe,GBe,b9t,f9t,G9t,g9t,v9t,zq,Z9t,N9t,A9t,W9t,y9t,F9t,E9t,bpe=ct(()=>{jJ();ppe();iE();gp=Tn("$ZodCheck",(n,t)=>{var r;n._zod??(n._zod={}),n._zod.def=t,(r=n._zod).onattach??(r.onattach=[])}),p9t={number:"number",bigint:"bigint",object:"date"},fBe=Tn("$ZodCheckLessThan",(n,t)=>{gp.init(n,t);let r=p9t[typeof t.value];n._zod.onattach.push(a=>{let i=a._zod.bag,s=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),n._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:r,code:"too_big",maximum:t.value,input:a.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),GBe=Tn("$ZodCheckGreaterThan",(n,t)=>{gp.init(n,t);let r=p9t[typeof t.value];n._zod.onattach.push(a=>{let i=a._zod.bag,s=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),n._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:r,code:"too_small",minimum:t.value,input:a.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),b9t=Tn("$ZodCheckMultipleOf",(n,t)=>{gp.init(n,t),n._zod.onattach.push(r=>{var a;(a=r._zod.bag).multipleOf??(a.multipleOf=t.value)}),n._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):tBe(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:n,continue:!t.abort})}}),f9t=Tn("$ZodCheckNumberFormat",(n,t)=>{gp.init(n,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[i,s]=lBe[t.format];n._zod.onattach.push(e=>{let o=e._zod.bag;o.format=t.format,o.minimum=i,o.maximum=s,r&&(o.pattern=c9t)}),n._zod.check=e=>{let o=e.value;if(r){if(!Number.isInteger(o)){e.issues.push({expected:a,format:t.format,code:"invalid_type",input:o,inst:n});return}if(!Number.isSafeInteger(o)){o>0?e.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:a,continue:!t.abort}):e.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:a,continue:!t.abort});return}}o<i&&e.issues.push({origin:"number",input:o,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!t.abort}),o>s&&e.issues.push({origin:"number",input:o,code:"too_big",maximum:s,inst:n})}}),G9t=Tn("$ZodCheckMaxLength",(n,t)=>{var r;gp.init(n,t),(r=n._zod.def).when??(r.when=a=>{let i=a.value;return!Dq(i)&&i.length!==void 0}),n._zod.onattach.push(a=>{let i=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(a._zod.bag.maximum=t.maximum)}),n._zod.check=a=>{let i=a.value;if(i.length<=t.maximum)return;let e=Uq(i);a.issues.push({origin:e,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),g9t=Tn("$ZodCheckMinLength",(n,t)=>{var r;gp.init(n,t),(r=n._zod.def).when??(r.when=a=>{let i=a.value;return!Dq(i)&&i.length!==void 0}),n._zod.onattach.push(a=>{let i=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(a._zod.bag.minimum=t.minimum)}),n._zod.check=a=>{let i=a.value;if(i.length>=t.minimum)return;let e=Uq(i);a.issues.push({origin:e,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),v9t=Tn("$ZodCheckLengthEquals",(n,t)=>{var r;gp.init(n,t),(r=n._zod.def).when??(r.when=a=>{let i=a.value;return!Dq(i)&&i.length!==void 0}),n._zod.onattach.push(a=>{let i=a._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),n._zod.check=a=>{let i=a.value,s=i.length;if(s===t.length)return;let e=Uq(i),o=s>t.length;a.issues.push({origin:e,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:n,continue:!t.abort})}}),zq=Tn("$ZodCheckStringFormat",(n,t)=>{var r,a;gp.init(n,t),n._zod.onattach.push(i=>{let s=i._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=n._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:n,continue:!t.abort})}):(a=n._zod).check??(a.check=()=>{})}),Z9t=Tn("$ZodCheckRegex",(n,t)=>{zq.init(n,t),n._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:n,continue:!t.abort})}}),N9t=Tn("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=h9t),zq.init(n,t)}),A9t=Tn("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=m9t),zq.init(n,t)}),W9t=Tn("$ZodCheckIncludes",(n,t)=>{gp.init(n,t);let r=Uw(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=a,n._zod.onattach.push(i=>{let s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(a)}),n._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:n,continue:!t.abort})}}),y9t=Tn("$ZodCheckStartsWith",(n,t)=>{gp.init(n,t);let r=new RegExp(`^${Uw(t.prefix)}.*`);t.pattern??(t.pattern=r),n._zod.onattach.push(a=>{let i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),n._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:n,continue:!t.abort})}}),F9t=Tn("$ZodCheckEndsWith",(n,t)=>{gp.init(n,t);let r=new RegExp(`.*${Uw(t.suffix)}$`);t.pattern??(t.pattern=r),n._zod.onattach.push(a=>{let i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),n._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:n,continue:!t.abort})}}),E9t=Tn("$ZodCheckOverwrite",(n,t)=>{gp.init(n,t),n._zod.check=r=>{r.value=t.tx(r.value)}})});var fpe,gBe=ct(()=>{fpe=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let a=t.split(`
712
712
  `).filter(e=>e),i=Math.min(...a.map(e=>e.length-e.trimStart().length)),s=a.map(e=>e.slice(i)).map(e=>" ".repeat(this.indent*2)+e);for(let e of s)this.content.push(e)}compile(){let t=Function,r=this?.args,i=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,i.join(`
713
713
  `))}}});var w9t,vBe=ct(()=>{w9t={major:4,minor:0,patch:0}});function aHt(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}function Yyr(n){if(!bBe.test(n))return!1;let t=n.replace(/[-_]/g,a=>a==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return aHt(r)}function xyr(n,t=null){try{let r=n.split(".");if(r.length!==3)return!1;let[a]=r;if(!a)return!1;let i=JSON.parse(atob(a));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}function C9t(n,t,r){n.issues.length&&t.issues.push(...jW(r,n.issues)),t.value[r]=n.value}function Gpe(n,t,r){n.issues.length&&t.issues.push(...jW(r,n.issues)),t.value[r]=n.value}function Y9t(n,t,r,a){n.issues.length?a[r]===void 0?r in a?t.value[r]=void 0:t.value[r]=n.value:t.issues.push(...jW(r,n.issues)):n.value===void 0?r in a&&(t.value[r]=void 0):t.value[r]=n.value}function x9t(n,t,r,a){for(let i of n)if(i.issues.length===0)return t.value=i.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:n.map(i=>i.issues.map(s=>_N(s,a,c1())))}),t}function ZBe(n,t){if(n===t)return{valid:!0,data:n};if(n instanceof Date&&t instanceof Date&&+n==+t)return{valid:!0,data:n};if(qJ(n)&&qJ(t)){let r=Object.keys(t),a=Object.keys(n).filter(s=>r.indexOf(s)!==-1),i={...n,...t};for(let s of a){let e=ZBe(n[s],t[s]);if(!e.valid)return{valid:!1,mergeErrorPath:[s,...e.mergeErrorPath]};i[s]=e.data}return{valid:!0,data:i}}if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let a=0;a<n.length;a++){let i=n[a],s=t[a],e=ZBe(i,s);if(!e.valid)return{valid:!1,mergeErrorPath:[a,...e.mergeErrorPath]};r.push(e.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function V9t(n,t,r){if(t.issues.length&&n.issues.push(...t.issues),r.issues.length&&n.issues.push(...r.issues),h9(n))return n;let a=ZBe(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return n.value=a.data,n}function Q9t(n,t){return n.value===void 0&&(n.value=t.defaultValue),n}function H9t(n,t){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:t}),n}function X9t(n,t,r){return h9(n)?n:t.out._zod.run({value:n.value,issues:n.issues},r)}function k9t(n){return n.value=Object.freeze(n.value),n}function L9t(n,t,r,a){if(!n){let i={code:"custom",input:r,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(i.params=a._zod.def.params),t.issues.push(sBe(i))}}var Oo,gpe,ru,S9t,B9t,J9t,T9t,D9t,O9t,U9t,M9t,z9t,_9t,P9t,j9t,K9t,q9t,$9t,eHt,tHt,nHt,rHt,iHt,lHt,sHt,oHt,NBe,cHt,uHt,IHt,dHt,hHt,mHt,pHt,bHt,fHt,GHt,ABe,gHt,vHt,ZHt,NHt,AHt,WHt,yHt,FHt,EHt,RHt,wHt,CHt,YHt,xHt,VHt,QHt=ct(()=>{bpe();jJ();gBe();mBe();ppe();iE();vBe();iE();Oo=Tn("$ZodType",(n,t)=>{var r;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=w9t;let a=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&a.unshift(n);for(let i of a)for(let s of i._zod.onattach)s(n);if(a.length===0)(r=n._zod).deferred??(r.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{let i=(s,e,o)=>{let u=h9(s),d;for(let I of e){if(I._zod.def.when){if(!I._zod.def.when(s))continue}else if(u)continue;let h=s.issues.length,c=I._zod.check(s);if(c instanceof Promise&&o?.async===!1)throw new aE;if(d||c instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await c,s.issues.length!==h&&(u||(u=h9(s,h)))});else{if(s.issues.length===h)continue;u||(u=h9(s,h))}}return d?d.then(()=>s):s};n._zod.run=(s,e)=>{let o=n._zod.parse(s,e);if(o instanceof Promise){if(e.async===!1)throw new aE;return o.then(u=>i(u,a,e))}return i(o,a,e)}}n["~standard"]={validate:i=>{try{let s=Mq(n,i);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return hpe(n,i).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),gpe=Tn("$ZodString",(n,t)=>{Oo.init(n,t),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??s9t(n._zod.bag),n._zod.parse=(r,a)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:n}),r}}),ru=Tn("$ZodStringFormat",(n,t)=>{zq.init(n,t),gpe.init(n,t)}),S9t=Tn("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=MQt),ru.init(n,t)}),B9t=Tn("$ZodUUID",(n,t)=>{if(t.version){let a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=pBe(a))}else t.pattern??(t.pattern=pBe());ru.init(n,t)}),J9t=Tn("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=zQt),ru.init(n,t)}),T9t=Tn("$ZodURL",(n,t)=>{ru.init(n,t),n._zod.check=r=>{try{let a=r.value,i=new URL(a),s=i.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e9t.source,input:r.value,inst:n,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:n,continue:!t.abort})),!a.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:n,continue:!t.abort})}}}),D9t=Tn("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=_Qt()),ru.init(n,t)}),O9t=Tn("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=OQt),ru.init(n,t)}),U9t=Tn("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=SQt),ru.init(n,t)}),M9t=Tn("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=BQt),ru.init(n,t)}),z9t=Tn("$ZodULID",(n,t)=>{t.pattern??(t.pattern=JQt),ru.init(n,t)}),_9t=Tn("$ZodXID",(n,t)=>{t.pattern??(t.pattern=TQt),ru.init(n,t)}),P9t=Tn("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=DQt),ru.init(n,t)}),j9t=Tn("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=l9t(t)),ru.init(n,t)}),K9t=Tn("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=r9t),ru.init(n,t)}),q9t=Tn("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=i9t(t)),ru.init(n,t)}),$9t=Tn("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=UQt),ru.init(n,t)}),eHt=Tn("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=PQt),ru.init(n,t),n._zod.onattach.push(r=>{let a=r._zod.bag;a.format="ipv4"})}),tHt=Tn("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=jQt),ru.init(n,t),n._zod.onattach.push(r=>{let a=r._zod.bag;a.format="ipv6"}),n._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:n,continue:!t.abort})}}}),nHt=Tn("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=KQt),ru.init(n,t)}),rHt=Tn("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=qQt),ru.init(n,t),n._zod.check=r=>{let[a,i]=r.value.split("/");try{if(!i)throw new Error;let s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${a}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:n,continue:!t.abort})}}});iHt=Tn("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=$Qt),ru.init(n,t),n._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),n._zod.check=r=>{aHt(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:n,continue:!t.abort})}});lHt=Tn("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=bBe),ru.init(n,t),n._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),n._zod.check=r=>{Yyr(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:n,continue:!t.abort})}}),sHt=Tn("$ZodE164",(n,t)=>{t.pattern??(t.pattern=t9t),ru.init(n,t)});oHt=Tn("$ZodJWT",(n,t)=>{ru.init(n,t),n._zod.check=r=>{xyr(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:n,continue:!t.abort})}}),NBe=Tn("$ZodNumber",(n,t)=>{Oo.init(n,t),n._zod.pattern=n._zod.bag.pattern??u9t,n._zod.parse=(r,a)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:n,...s?{received:s}:{}}),r}}),cHt=Tn("$ZodNumber",(n,t)=>{f9t.init(n,t),NBe.init(n,t)}),uHt=Tn("$ZodBoolean",(n,t)=>{Oo.init(n,t),n._zod.pattern=I9t,n._zod.parse=(r,a)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:n}),r}}),IHt=Tn("$ZodBigInt",(n,t)=>{Oo.init(n,t),n._zod.pattern=o9t,n._zod.parse=(r,a)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:n}),r}}),dHt=Tn("$ZodNull",(n,t)=>{Oo.init(n,t),n._zod.pattern=d9t,n._zod.values=new Set([null]),n._zod.parse=(r,a)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:n}),r}}),hHt=Tn("$ZodAny",(n,t)=>{Oo.init(n,t),n._zod.parse=r=>r}),mHt=Tn("$ZodUnknown",(n,t)=>{Oo.init(n,t),n._zod.parse=r=>r}),pHt=Tn("$ZodNever",(n,t)=>{Oo.init(n,t),n._zod.parse=(r,a)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:n}),r)}),bHt=Tn("$ZodDate",(n,t)=>{Oo.init(n,t),n._zod.parse=(r,a)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,s=i instanceof Date;return s&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...s?{received:"Invalid Date"}:{},inst:n}),r}});fHt=Tn("$ZodArray",(n,t)=>{Oo.init(n,t),n._zod.parse=(r,a)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:n}),r;r.value=Array(i.length);let s=[];for(let e=0;e<i.length;e++){let o=i[e],u=t.element._zod.run({value:o,issues:[]},a);u instanceof Promise?s.push(u.then(d=>C9t(d,r,e))):C9t(u,r,e)}return s.length?Promise.all(s).then(()=>r):r}});GHt=Tn("$ZodObject",(n,t)=>{Oo.init(n,t);let r=Tq(()=>{let h=Object.keys(t.shape);for(let G of h)if(!(t.shape[G]instanceof Oo))throw new Error(`Invalid element at key "${G}": expected a Zod schema`);let c=iBe(t.shape);return{shape:t.shape,keys:h,keySet:new Set(h),numKeys:h.length,optionalKeys:new Set(c)}});Hc(n._zod,"propValues",()=>{let h=t.shape,c={};for(let G in h){let E=h[G]._zod;if(E.values){c[G]??(c[G]=new Set);for(let W of E.values)c[G].add(W)}}return c});let a=h=>{let c=new fpe(["shape","payload","ctx"]),G=r.value,E=w=>{let A=d9(w);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};c.write("const input = payload.value;");let W=Object.create(null),R=0;for(let w of G.keys)W[w]=`key_${R++}`;c.write("const newResult = {}");for(let w of G.keys)if(G.optionalKeys.has(w)){let A=W[w];c.write(`const ${A} = ${E(w)};`);let y=d9(w);c.write(`
714
714
  if (${A}.issues.length) {
@@ -2975,7 +2975,7 @@ Your summary should include the following sections:
2975
2975
  - Summary: 1 (model message)
2976
2976
  - Retained conversation: ${F.length}`),console.log("[CompressionService] First 5 messages structure:");for(let H=0;H<Math.min(5,Y.length);H++){let L=Y[H],T=L.parts?.map(k=>k.text?"text":k.functionCall?`functionCall(${k.functionCall?.id})`:k.toolResult?`toolResult(${k.toolResult?.toolUseId})`:"unknown").join(",")||"no-parts";console.log(` [${H}] role=${L.role}, parts=[${T}]`)}let S;try{S=(await s.getContentGenerator().countTokens({model:a,contents:Y})).totalTokens}catch(H){return console.warn(`Could not determine compressed history token count. Error: ${cr(H)}`),{success:!1,error:"Could not determine compressed history token count"}}return S===void 0?(console.warn("Could not determine compressed history token count."),{success:!1,error:"Could not determine compressed history token count"}):(console.log(`[CompressionService] Compression completed: ${h} -> ${S} tokens`),{success:!0,compressionInfo:{originalTokenCount:h,newTokenCount:S},summary:p,newHistory:Y})}catch(h){let c=h instanceof Error?h.message:String(h);return console.error("[CompressionService] Compression failed:",c),{success:!1,error:c}}}async tryCompress(t,r,a,i,s,e,o,u=!1){let d=await this.shouldCompress(r,a,s.getContentGenerator(),u,t);return d.shouldCompress?await pm(async()=>{let I=await this.compressHistory(t,r,a,i,s,e,o,d.tokenCount);if(!I.success&&!I.skipReason)throw new Error(I.error||"Compression failed without specific error");return I},{maxAttempts:3,shouldRetry:I=>(console.warn(`[CompressionService] Compression attempt failed: ${I.message}. Retrying...`),!0)}):null}async compressToFit(t,r,a,i,s,e,o,u,d){return await pm(async()=>{console.log(`[CompressionService] compressToFit called: ${a} \u2192 ${i}${d?` (knownTokenCount: ${d})`:""}`);let I=u2(i,t),h=I*.9,c=d;if(c===void 0)try{c=(await e.getContentGenerator().countTokens({model:a,contents:r})).totalTokens}catch(F){return console.warn(`[CompressionService] Could not count tokens for model switch check: ${cr(F)}`),{success:!0,skipReason:`Unable to count tokens for model switch: ${cr(F)}. Proceeding without compression.`}}if(c===void 0)return{success:!0,skipReason:"Unable to determine token count for model switch. Proceeding without compression."};if(console.log(`[CompressionService] Model Switch Check: Current Tokens=${c}, Target Limit=${I} (Safe=${h})`),c<=h)return{success:!0,skipReason:`Context sufficient for target model: ${c} tokens \u2264 ${h} safe limit (model limit: ${I})`};console.log(`[CompressionService] History too large for target model ${i}. Triggering aggressive compression.`);let E=Math.max(0,h-1e3),W=E/c;W=Math.max(.05,Math.min(W,this.compressionPreserveThreshold)),console.log(`[CompressionService] Dynamic compression ratio calculated: ${W.toFixed(4)} (Available: ${E}, Current: ${c})`);let R=await this.compressHistory(t,r,a,s,e,o,u,c,W,!0);if(!R.success&&!R.skipReason)throw new Error(R.error||"Compression failed without specific error");return R},{maxAttempts:3,shouldRetry:I=>(console.warn(`[CompressionService] compressToFit attempt failed: ${I.message||String(I)}. Retrying...`),!0)})}getConfig(){return{compressionTokenThreshold:this.compressionTokenThreshold,compressionPreserveThreshold:this.compressionPreserveThreshold,skipEnvironmentMessages:this.skipEnvironmentMessages}}}});var Cie,$rt=ct(()=>{"use strict";sv();Iee();gNe();Mtt();ztt();ZNe();qrt();RW();Eae();Cie=class{config;toolRegistry;geminiClient;updateOutput;abortSignal;externalPreToolExecutionHandler;context;executionLog=[];subAgentChat;executionEngine;adapter;toolExecutionContext;toolCompletionResolver;pendingToolResults=[];sessionManager;sessionId;compressionService;abortListener=null;checkAbortSignal(){if(this.abortSignal?.aborted)throw new Error("Task cancelled by AbortSignal")}constructor(t,r,a,i,s,e){this.config=t,this.toolRegistry=r,this.geminiClient=a,this.updateOutput=i,this.abortSignal=s,this.externalPreToolExecutionHandler=e,this.context={agentId:`subagent-${Date.now()}-${Math.random().toString(16).slice(2)}`,taskDescription:"",currentTurn:0,maxTurns:10,isRunning:!1,tokenUsage:{inputTokens:0,outputTokens:0,totalTokens:0}},this.sessionManager=new $s(this.config.getProjectRoot()),this.sessionId=this.config.getSessionId(),this.compressionService=new NU({compressionTokenThreshold:.8,compressionPreserveThreshold:.3,skipEnvironmentMessages:2}),this.toolExecutionContext={agentId:this.context.agentId,agentType:"sub",taskDescription:this.context.taskDescription},this.adapter=new BO(i,o=>this.executionLog.push(o),this.handleToolsComplete.bind(this),this.toolRegistry,this.externalPreToolExecutionHandler),this.executionEngine=new EY({toolRegistry:Promise.resolve(this.createSubAgentToolRegistry()),adapter:this.adapter,config:this.config,hookEventHandler:this.config.getHookSystem().getEventHandler(),approvalMode:this.config.getApprovalMode(),getPreferredEditor:()=>{}})}async executeTask(t,r=10){if(this.context={...this.context,taskDescription:t,maxTurns:r,currentTurn:0,isRunning:!0},this.log(`SubAgent started: ${t}`),this.sendStatusChange("starting",{taskDescription:t}),this.abortSignal){let a=()=>{console.debug(`[SubAgent] Received AbortSignal, starting cleanup: ${this.context.agentId}`),this.context.isRunning=!1,this.log("SubAgent received cancellation signal, stopping execution"),this.sendStatusChange("cancelled",{reason:"abort_signal"})};if(this.abortSignal.addEventListener("abort",a),this.abortListener=()=>{this.abortSignal?.removeEventListener("abort",a)},this.abortSignal.aborted)throw a(),new Error("Task was cancelled before startup")}try{for(await this.initializeSubAgentChat(t),this.log(`SubAgent chat instance initialized, available tools: ${this.getAvailableToolNames().length}`);this.context.currentTurn<this.context.maxTurns&&this.context.isRunning;){let e=await this.executeConversationTurn();if(e)return e}let a=H0("task.timeout.warning",{turns:this.context.currentTurn}),i=H0("task.timeout.credits.notice"),s=`${a}
2977
2977
  ${i}`;return this.log(s),this.sendStatusChange("failed",{reason:"max_turns_exceeded",summary:s,turnsUsed:this.context.currentTurn}),this.buildErrorResult(new Error(s))}catch(a){let i=a instanceof Error?a.message:String(a);return this.log(H0("task.execution.failed",{error:i})),this.sendStatusChange("failed",{reason:"execution_error",error:i,turnsUsed:this.context.currentTurn}),this.buildErrorResult(a)}finally{this.context.isRunning=!1,this.abortListener&&(this.abortListener(),this.abortListener=null),this.pendingToolResults=[],this.log(`SubAgent execution ended (final turn: ${this.context.currentTurn})`)}}countToolCalls(t){return t.parts?t.parts.filter(r=>!!r.functionCall).length:0}cancel(){this.context.isRunning=!1,console.debug(`[SubAgent] cancel()\u88AB\u8C03\u7528: ${this.context.agentId}`)}buildSystemPrompt(){let t=this.getAvailableToolNames();return JA.buildSubAgentFixedSystemPrompt(t,this.context.maxTurns)}async initializeSubAgentChat(t){this.subAgentChat=await this.geminiClient.startChat([],{type:"sub",agentId:this.context.agentId,taskDescription:t}),this.subAgentChat.generationConfig.systemInstruction=this.buildSystemPrompt();let r=this.getSubAgentToolDeclarations();r.length>0&&this.subAgentChat.setTools([{functionDeclarations:r}]),this.log("SubAgent chat instance initialization completed")}async executeConversationTurn(){this.checkAbortSignal(),this.context.currentTurn++,this.log(`Conversation turn ${this.context.currentTurn}/${this.context.maxTurns}`),this.sendTurnProgress();let t=await this.callGemini(),r=this.analyzeAIResponse(t);return this.logAIResponse(r),r.hasToolCalls?(await this.processAndStorePendingToolResults(t,r.toolCount),await this.tryCompressHistory(),null):this.handleTaskCompletion(r.responseText)}analyzeAIResponse(t){let r=this.extractTextFromResponse(t),a=this.hasToolCalls(t),i=this.countToolCalls(t);return{responseText:r,hasToolCalls:a,toolCount:i}}logAIResponse(t){let{responseText:r,hasToolCalls:a}=t,i=r.length>100?`${r.substring(0,100)}...`:r;this.log(`AI response: ${i} (${a?"with":"without"} tool calls)`)}handleTaskCompletion(t){this.log("AI did not call any tools, task completed");let r=t.trim()||"Task completed";return this.sendStatusChange("completing",{summary:r}),this.buildSuccessResult(r)}async processAndStorePendingToolResults(t,r){this.checkAbortSignal(),this.log(`Starting execution of ${r} tool calls`);let a=[];if(t.parts?.forEach(i=>{if(i.functionCall&&i.functionCall.name){let s=i.functionCall.name,e=i.functionCall.args||{},o=i.functionCall.id||`${i.functionCall.name}-${Date.now()}-${Math.random().toString(16).slice(2)}`,u={callId:o,name:s,args:e,isClientInitiated:!1,prompt_id:this.context.agentId};a.push(u),this.log(`\u{1F4CB} Tool call request: ${s}(${o})`)}}),a.length!==0)try{let i=new Promise(e=>{this.toolCompletionResolver=e});this.executionEngine.executeTools(a,this.toolExecutionContext,this.abortSignal).catch(e=>{this.log(`Tool execution engine error: ${e instanceof Error?e.message:String(e)}`)});let s=await i;this.log(`Received ${s.length} tool call results via callback`),s.forEach(e=>{this.pendingToolResults.push(e.response?.responseParts)}),this.checkAbortSignal(),this.log(`${s.length} tool calls completed, results stored in pending queue`)}catch(i){throw this.log(`Tool execution failed: ${i instanceof Error?i.message:String(i)}`),i}}async callGemini(){if(!this.subAgentChat)throw new Error("SubAgent chat not initialized");this.checkAbortSignal();let t=this.context.currentTurn===1,r=[];t?r=[{text:JA.buildSubAgentTaskPrompt(this.context.taskDescription,this.context.maxTurns)}]:this.pendingToolResults.length>0&&(this.pendingToolResults.forEach(I=>{Array.isArray(I)?r.push(...I):r.push(I)}),this.pendingToolResults=[]);let a=new Date().toISOString(),i=this.subAgentChat.getHistory(),s={timestamp:a,turn:this.context.currentTurn,request:{history:i,messageParts:r}};await this.sessionManager.saveRequestLog(this.sessionId,s).catch(I=>{console.warn("[SubAgent] Failed to save request log:",I)});let e=await this.subAgentChat.sendMessage({message:r,config:{abortSignal:this.abortSignal}},this.context.agentId,Ha.SUB_AGENT),o={inputTokens:0,outputTokens:0,totalTokens:0};e?.usageMetadata&&(o.inputTokens=e.usageMetadata.promptTokenCount||0,o.outputTokens=e.usageMetadata.candidatesTokenCount||0,o.totalTokens=e.usageMetadata.totalTokenCount||0,this.context.tokenUsage.inputTokens+=o.inputTokens,this.context.tokenUsage.outputTokens+=o.outputTokens,this.context.tokenUsage.totalTokens+=o.totalTokens);let u={role:Lr.MODEL,parts:e.candidates?.[0]?.content?.parts||[]},d={...s,response:{content:u,tokenUsage:o}};return await this.sessionManager.saveRequestLog(this.sessionId,d).catch(I=>{console.warn("[SubAgent] Failed to save response log:",I)}),u}hasToolCalls(t){return t.parts?.some(r=>!!r.functionCall)||!1}handleToolsComplete(t){this.toolCompletionResolver&&(this.toolCompletionResolver(t),this.toolCompletionResolver=void 0)}getExecutionStats(){return{filesCreated:this.adapter.getFilesCreated(),commandsRun:this.adapter.getCommandsRun(),executionLog:this.executionLog}}extractTextFromResponse(t){return(t.parts||[]).map(r=>r.text||"").filter(r=>r.trim().length>0).join(`
2978
- `)}createSubAgentToolRegistry(){let t=new GE(this.config);return this.toolRegistry.getAllTools().forEach(a=>{a.allowSubAgentUse&&t.registerTool(a)}),t}getAvailableToolNames(){return this.createSubAgentToolRegistry().getAllTools().map(t=>t.name)}getSubAgentToolDeclarations(){return this.createSubAgentToolRegistry().getFunctionDeclarations()}buildSuccessResult(t){let r=this.getExecutionStats();return{success:!0,summary:t,executionLog:r.executionLog,filesCreated:r.filesCreated,commandsRun:r.commandsRun,tokenUsage:this.context.tokenUsage}}buildErrorResult(t){let r=t instanceof Error?t.message:String(t);this.log(`\u274C Execution error: ${r}`);let a=this.getExecutionStats();return{success:!1,summary:`Task execution failed: ${r}`,error:r,executionLog:a.executionLog,filesCreated:a.filesCreated,commandsRun:a.commandsRun,tokenUsage:this.context.tokenUsage}}sendTurnProgress(){let t={type:"conversation_turn",agentId:this.context.agentId,turnNumber:this.context.currentTurn,maxTurns:this.context.maxTurns,timestamp:Date.now()};this.updateOutput?.(`SUBAGENT_EVENT:${JSON.stringify(t)}`)}sendStatusChange(t,r){let a={type:"status_change",agentId:this.context.agentId,status:t,currentTurn:this.context.currentTurn,maxTurns:this.context.maxTurns,taskDescription:this.context.taskDescription,timestamp:Date.now(),...r},i=`SUBAGENT_STATUS_CHANGE:${JSON.stringify(a)}`;this.updateOutput?.(i)}log(t){let a=`[${new Date().toLocaleTimeString("en-US",{hour12:!1})}] ${t}`;this.executionLog.push(a),console.log("[SubAgent] "+a)}async tryCompressHistory(){if(this.subAgentChat)try{let t=this.subAgentChat.getHistory(!0),r=Qd.getModelForScene(Ha.COMPRESSION),a=this.config.getModel(),i=await this.compressionService.tryCompress(this.config,t,a,r,this.geminiClient,this.context.agentId,this.abortSignal);i&&i.success&&i.newHistory&&(this.subAgentChat.setHistory(i.newHistory),this.log(`\u{1F4E6} Conversation history compressed: ${i.compressionInfo?.originalTokenCount} -> ${i.compressionInfo?.newTokenCount} tokens`))}catch(t){this.log(`\u26A0\uFE0F Conversation history compression failed: ${t instanceof Error?t.message:String(t)}`)}}getAdapter(){return this.adapter}}});function d2a(n,t,r,a){return{type:"subagent_display",agentId:n,taskDescription:t,description:r,status:"starting",currentTurn:0,maxTurns:a,toolCalls:[],stats:{filesCreated:[],commandsRun:[],totalToolCalls:0,successfulToolCalls:0,tokenUsage:{inputTokens:0,outputTokens:0,totalTokens:0}},showDetailedProcess:!0,startTime:Date.now()}}var ad,wAe=ct(()=>{"use strict";Ci();Sl();Iee();$rt();DSe();ztt();ad=class n extends qr{config;toolRegistry;static Name="task";constructor(t,r){super(n.Name,"Code Analysis Expert","Launch a specialized code analysis sub-agent that deeply explores codebases and provides comprehensive technical insights. This analysis expert systematically analyzes code patterns, dependencies, and architectural decisions to provide detailed analysis reports for informed implementation decisions. Best used for codebase exploration, architecture analysis, and technical research.",$r.Tasks,{type:gn.OBJECT,properties:{prompt:{type:gn.STRING,description:"Detailed description of what to analyze or investigate. The analysis expert will systematically explore relevant code, understand architecture and patterns, and provide deep technical insights and implementation recommendations."},description:{type:gn.STRING,description:"Short description (3-5 words) of the analysis task for UI display"},max_turns:{type:gn.NUMBER,description:"Maximum conversation turns. You MUST set this explicitly based on task complexity: 3-5 for simple lookups (find a function, check a config value, locate a file), 6-12 for moderate tasks (trace a feature across files, understand a module), 12-20 for complex tasks (multi-file dependency analysis, architecture overview). Only use 20-30 for very deep cross-cutting investigations. Always set this as low as feasible to save tokens.",minimum:1,maximum:30}},required:["prompt","description","max_turns"]},!0,!1,!0,!1),this.config=t,this.toolRegistry=r}validateToolParams(t){return!t.prompt||t.prompt.trim().length===0?JA.VALIDATION_ERRORS.TASK_DESCRIPTION_EMPTY:!t.description||t.description.trim().length===0?"\u4EFB\u52A1\u63CF\u8FF0\u4E0D\u80FD\u4E3A\u7A7A":t.max_turns===void 0||t.max_turns===null?JA.VALIDATION_ERRORS.MAX_TURNS_REQUIRED:t.max_turns<1||t.max_turns>30?JA.VALIDATION_ERRORS.MAX_TURNS_OUT_OF_RANGE:null}async shouldConfirmExecute(t,r){return!1}getDescription(t){return t.description}toolLocations(t){return[{path:this.config.getWorkingDir(),type:"directory"}]}async execute(t,r,a,i){let s=this.validateToolParams(t);if(s)return{llmContent:`Parameter Validation Failed: ${s}`,returnDisplay:`Parameter Validation Failed: ${s}`};let e=`subagent-${Date.now()}-${Math.random().toString(16).slice(2)}`,o=d2a(e,t.prompt,t.description,t.max_turns),u=d=>{if(d.startsWith("TOOL_CALL_UPDATE:"))try{let I=JSON.parse(d.replace("TOOL_CALL_UPDATE:",""));o=this.updateSubAgentToolCall(o,I),a?.(UN(o));return}catch(I){console.warn("\u89E3\u6790TOOL_CALL_UPDATE\u5931\u8D25:",I)}if(d.startsWith("SUBAGENT_STATUS_CHANGE:"))try{let I=JSON.parse(d.replace("SUBAGENT_STATUS_CHANGE:",""));o=this.handleStatusChangeEvent(o,I),a?.(UN(o));return}catch(I){console.warn("\u89E3\u6790SUBAGENT_STATUS_CHANGE\u5931\u8D25:",I)}if(d.startsWith("SUBAGENT_EVENT:"))try{let I=JSON.parse(d.replace("SUBAGENT_EVENT:",""));o=this.handleSubAgentEvent(o,I),a?.(UN(o));return}catch(I){console.warn("\u89E3\u6790SUBAGENT_EVENT\u5931\u8D25:",I)}a?.(d)};u(UN(o));try{let d=this.config.getGeminiClient();if(!d)throw new Error(JA.EXECUTION_ERRORS.GEMINI_CLIENT_NOT_INITIALIZED);try{d.getChat()}catch(G){let E=G instanceof Error?G.message:String(G);throw new Error(JA.EXECUTION_ERRORS.GEMINI_CLIENT_NOT_READY(E))}o={...o,status:"starting"},u(UN(o));let I=new Cie(this.config,this.createFilteredToolRegistry(),d,u,r,i?.onPreToolExecution);i?.statusUpdateCallback&&I.getAdapter().setStatusUpdateCallback(i.statusUpdateCallback),o={...o,status:"running"},u(UN(o));let h=await I.executeTask(t.prompt,t.max_turns),c={filesCreated:h.filesCreated||[],commandsRun:h.commandsRun||[],totalToolCalls:o.stats.totalToolCalls,successfulToolCalls:o.stats.successfulToolCalls,tokenUsage:h.tokenUsage||o.stats.tokenUsage};return o={...o,status:h.success?"completed":"failed",summary:h.summary,error:h.error,showDetailedProcess:!1,endTime:Date.now(),stats:c},u(UN(o)),{llmContent:h.success?`Task Completed: ${h.summary}`:`Task Failed: ${h.summary}`,returnDisplay:o}}catch(d){let I=d instanceof Error?d.message:String(d);return o={...o,status:"failed",error:I,showDetailedProcess:!1,endTime:Date.now()},u(UN(o)),{llmContent:`Task Failed: ${I}`,returnDisplay:o}}}updateSubAgentToolCall(t,r){let{callId:a,...i}=r,s=t.toolCalls.findIndex(u=>u.callId===a),e=[...t.toolCalls];if(s>=0)e[s]={...e[s],...r};else{let u={callId:a,toolName:r.toolName||"unknown",description:r.description||"",status:r.status||"Pending",startTime:r.startTime||Date.now(),...i};e.push(u)}let o={...t.stats,totalToolCalls:e.length,successfulToolCalls:e.filter(u=>u.status==="Success").length};return{...t,toolCalls:e,stats:o}}handleStatusChangeEvent(t,r){let a={};switch(r.status){case"starting":a.status="starting";break;case"running":a.status="running";break;case"completing":a.status="completed",a.showDetailedProcess=!1,a.summary=r.summary;break;case"failed":a.status="failed",a.showDetailedProcess=!1,a.error=r.error;break;case"cancelled":a.status="cancelled",a.showDetailedProcess=!1;break}return r.currentTurn!==void 0&&(a.currentTurn=r.currentTurn),{...t,...a}}handleSubAgentEvent(t,r){let a={};switch(r.type){case"conversation_turn":a.currentTurn=r.turnNumber;break;case"tools_batch_complete":a.stats={...t.stats,filesCreated:r.filesCreated||[],commandsRun:r.commandsRun||[]};break}return{...t,...a}}createFilteredToolRegistry(){let t=new GE(this.config);return this.toolRegistry.getAllTools().forEach(a=>{a.allowSubAgentUse&&t.registerTool(a)}),t}}});import h2a from"path";var CAe,w1n=ct(()=>{"use strict";Sl();Ci();Eie();CAe=class extends qr{constructor(){super("use_skill","Use Skill",`Execute a skill and MUST follow its scripts if provided
2978
+ `)}createSubAgentToolRegistry(){let t=new GE(this.config);return this.toolRegistry.getAllTools().forEach(a=>{a.allowSubAgentUse&&t.registerTool(a)}),t}getAvailableToolNames(){return this.createSubAgentToolRegistry().getAllTools().map(t=>t.name)}getSubAgentToolDeclarations(){return this.createSubAgentToolRegistry().getFunctionDeclarations()}buildSuccessResult(t){let r=this.getExecutionStats();return{success:!0,summary:t,executionLog:r.executionLog,filesCreated:r.filesCreated,commandsRun:r.commandsRun,tokenUsage:this.context.tokenUsage}}buildErrorResult(t){let r=t instanceof Error?t.message:String(t);this.log(`\u274C Execution error: ${r}`);let a=this.getExecutionStats();return{success:!1,summary:`Task execution failed: ${r}`,error:r,executionLog:a.executionLog,filesCreated:a.filesCreated,commandsRun:a.commandsRun,tokenUsage:this.context.tokenUsage}}sendTurnProgress(){let t={type:"conversation_turn",agentId:this.context.agentId,turnNumber:this.context.currentTurn,maxTurns:this.context.maxTurns,timestamp:Date.now()};this.updateOutput?.(`SUBAGENT_EVENT:${JSON.stringify(t)}`)}sendStatusChange(t,r){let a={type:"status_change",agentId:this.context.agentId,status:t,currentTurn:this.context.currentTurn,maxTurns:this.context.maxTurns,taskDescription:this.context.taskDescription,timestamp:Date.now(),...r},i=`SUBAGENT_STATUS_CHANGE:${JSON.stringify(a)}`;this.updateOutput?.(i)}log(t){let a=`[${new Date().toLocaleTimeString("en-US",{hour12:!1})}] ${t}`;this.executionLog.push(a),console.log("[SubAgent] "+a)}async tryCompressHistory(){if(this.subAgentChat)try{let t=this.subAgentChat.getHistory(!0),r=Qd.getModelForScene(Ha.COMPRESSION),a=this.config.getModel(),i=await this.compressionService.tryCompress(this.config,t,a,r,this.geminiClient,this.context.agentId,this.abortSignal);i&&i.success&&i.newHistory&&(this.subAgentChat.setHistory(i.newHistory),this.log(`\u{1F4E6} Conversation history compressed: ${i.compressionInfo?.originalTokenCount} -> ${i.compressionInfo?.newTokenCount} tokens`))}catch(t){this.log(`\u26A0\uFE0F Conversation history compression failed: ${t instanceof Error?t.message:String(t)}`)}}getAdapter(){return this.adapter}}});function d2a(n,t,r,a){return{type:"subagent_display",agentId:n,taskDescription:t,description:r,status:"starting",currentTurn:0,maxTurns:a,toolCalls:[],stats:{filesCreated:[],commandsRun:[],totalToolCalls:0,successfulToolCalls:0,tokenUsage:{inputTokens:0,outputTokens:0,totalTokens:0}},showDetailedProcess:!0,startTime:Date.now()}}var ad,wAe=ct(()=>{"use strict";Ci();Sl();Iee();$rt();DSe();ztt();ad=class n extends qr{config;toolRegistry;static Name="task";constructor(t,r){super(n.Name,"Code Analysis Expert","Launch a specialized code analysis sub-agent that deeply explores codebases and provides comprehensive technical insights. This analysis expert systematically analyzes code patterns, dependencies, and architectural decisions to provide detailed analysis reports for informed implementation decisions. Best used for codebase exploration, architecture analysis, and technical research.",$r.Tasks,{type:gn.OBJECT,properties:{prompt:{type:gn.STRING,description:"Detailed description of what to analyze or investigate. The analysis expert will systematically explore relevant code, understand architecture and patterns, and provide deep technical insights and implementation recommendations."},description:{type:gn.STRING,description:"Short description (3-5 words) of the analysis task for UI display"},max_turns:{type:gn.NUMBER,description:"Maximum conversation turns. You MUST set this explicitly based on task complexity: 3-5 for simple lookups (find a function, check a config value, locate a file), 6-12 for moderate tasks (trace a feature across files, understand a module), 12-20 for complex tasks (multi-file dependency analysis, architecture overview). Only use 20-30 for very deep cross-cutting investigations. Always set this as low as feasible to save tokens.",minimum:1,maximum:30}},required:["prompt","description","max_turns"]},!0,!1,!0,!1),this.config=t,this.toolRegistry=r}validateToolParams(t){return!t.prompt||t.prompt.trim().length===0?JA.VALIDATION_ERRORS.TASK_DESCRIPTION_EMPTY:!t.description||t.description.trim().length===0?"\u4EFB\u52A1\u63CF\u8FF0\u4E0D\u80FD\u4E3A\u7A7A":t.max_turns===void 0||t.max_turns===null?JA.VALIDATION_ERRORS.MAX_TURNS_REQUIRED:t.max_turns<1||t.max_turns>30?JA.VALIDATION_ERRORS.MAX_TURNS_OUT_OF_RANGE:null}async shouldConfirmExecute(t,r){return!1}getDescription(t){return t.description}toolLocations(t){return[]}async execute(t,r,a,i){let s=this.validateToolParams(t);if(s)return{llmContent:`Parameter Validation Failed: ${s}`,returnDisplay:`Parameter Validation Failed: ${s}`};let e=`subagent-${Date.now()}-${Math.random().toString(16).slice(2)}`,o=d2a(e,t.prompt,t.description,t.max_turns),u=d=>{if(d.startsWith("TOOL_CALL_UPDATE:"))try{let I=JSON.parse(d.replace("TOOL_CALL_UPDATE:",""));o=this.updateSubAgentToolCall(o,I),a?.(UN(o));return}catch(I){console.warn("\u89E3\u6790TOOL_CALL_UPDATE\u5931\u8D25:",I)}if(d.startsWith("SUBAGENT_STATUS_CHANGE:"))try{let I=JSON.parse(d.replace("SUBAGENT_STATUS_CHANGE:",""));o=this.handleStatusChangeEvent(o,I),a?.(UN(o));return}catch(I){console.warn("\u89E3\u6790SUBAGENT_STATUS_CHANGE\u5931\u8D25:",I)}if(d.startsWith("SUBAGENT_EVENT:"))try{let I=JSON.parse(d.replace("SUBAGENT_EVENT:",""));o=this.handleSubAgentEvent(o,I),a?.(UN(o));return}catch(I){console.warn("\u89E3\u6790SUBAGENT_EVENT\u5931\u8D25:",I)}a?.(d)};u(UN(o));try{let d=this.config.getGeminiClient();if(!d)throw new Error(JA.EXECUTION_ERRORS.GEMINI_CLIENT_NOT_INITIALIZED);try{d.getChat()}catch(G){let E=G instanceof Error?G.message:String(G);throw new Error(JA.EXECUTION_ERRORS.GEMINI_CLIENT_NOT_READY(E))}o={...o,status:"starting"},u(UN(o));let I=new Cie(this.config,this.createFilteredToolRegistry(),d,u,r,i?.onPreToolExecution);i?.statusUpdateCallback&&I.getAdapter().setStatusUpdateCallback(i.statusUpdateCallback),o={...o,status:"running"},u(UN(o));let h=await I.executeTask(t.prompt,t.max_turns),c={filesCreated:h.filesCreated||[],commandsRun:h.commandsRun||[],totalToolCalls:o.stats.totalToolCalls,successfulToolCalls:o.stats.successfulToolCalls,tokenUsage:h.tokenUsage||o.stats.tokenUsage};return o={...o,status:h.success?"completed":"failed",summary:h.summary,error:h.error,showDetailedProcess:!1,endTime:Date.now(),stats:c},u(UN(o)),{llmContent:h.success?`Task Completed: ${h.summary}`:`Task Failed: ${h.summary}`,returnDisplay:o}}catch(d){let I=d instanceof Error?d.message:String(d);return o={...o,status:"failed",error:I,showDetailedProcess:!1,endTime:Date.now()},u(UN(o)),{llmContent:`Task Failed: ${I}`,returnDisplay:o}}}updateSubAgentToolCall(t,r){let{callId:a,...i}=r,s=t.toolCalls.findIndex(u=>u.callId===a),e=[...t.toolCalls];if(s>=0)e[s]={...e[s],...r};else{let u={callId:a,toolName:r.toolName||"unknown",description:r.description||"",status:r.status||"Pending",startTime:r.startTime||Date.now(),...i};e.push(u)}let o={...t.stats,totalToolCalls:e.length,successfulToolCalls:e.filter(u=>u.status==="Success").length};return{...t,toolCalls:e,stats:o}}handleStatusChangeEvent(t,r){let a={};switch(r.status){case"starting":a.status="starting";break;case"running":a.status="running";break;case"completing":a.status="completed",a.showDetailedProcess=!1,a.summary=r.summary;break;case"failed":a.status="failed",a.showDetailedProcess=!1,a.error=r.error;break;case"cancelled":a.status="cancelled",a.showDetailedProcess=!1;break}return r.currentTurn!==void 0&&(a.currentTurn=r.currentTurn),{...t,...a}}handleSubAgentEvent(t,r){let a={};switch(r.type){case"conversation_turn":a.currentTurn=r.turnNumber;break;case"tools_batch_complete":a.stats={...t.stats,filesCreated:r.filesCreated||[],commandsRun:r.commandsRun||[]};break}return{...t,...a}}createFilteredToolRegistry(){let t=new GE(this.config);return this.toolRegistry.getAllTools().forEach(a=>{a.allowSubAgentUse&&t.registerTool(a)}),t}}});import h2a from"path";var CAe,w1n=ct(()=>{"use strict";Sl();Ci();Eie();CAe=class extends qr{constructor(){super("use_skill","Use Skill",`Execute a skill and MUST follow its scripts if provided
2979
2979
 
2980
2980
  <skills_instructions>
2981
2981
  When users ask you to perform tasks, check if any available skills can help.
@@ -4334,7 +4334,7 @@ ${c}`),a?i.reset(c):c}function V8a(n,t,r,a={}){if(!PJn){PJn=!0;let s="Passing li
4334
4334
 
4335
4335
  ${t}
4336
4336
  `:""}`}set message(t){this.#n=t}#i(t){if(!this.#t)return;let r=this.#e,a=k8a(r,this.#t.message);if(a)return(0,a8n.codeFrameColumns)(r,{start:a},{highlightCode:t})}get codeFrame(){return this.#r??=this.#i(!0),this.#r}get rawCodeFrame(){return this.#a??=this.#i(!1),this.#a}},k8a=(n,t)=>{let r=t.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:a,line:i,column:s}=r.groups;return i&&s?{line:Number(i),column:Number(s)}:Smt(n,Number(a),{oneBased:!0})},L8a=n=>n.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(t,r,a)=>`"${a}"(${X8a(a)})`)});var Tmt=ve((gdl,S8a)=>{S8a.exports=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"]});var l8n=ve((vdl,B8a)=>{B8a.exports=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"]});var s8n=ve((Zdl,J8a)=>{J8a.exports=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"]});var c8n=ve((Ndl,o8n)=>{"use strict";var T8a=[].concat(Tmt()).concat(l8n()),D8a=s8n();o8n.exports=function(n){var t=0;function r(){return t<n.length}function a(E){if(E instanceof RegExp){var W=n.slice(t),R=W.match(E);if(R)return t+=R[0].length,R[0]}else if(n.indexOf(E,t)===t)return t+=E.length,E}function i(){a(/[ ]*/)}function s(){for(var E,W=["WITH","AND","OR","(",")",":","+"],R=0;R<W.length&&(E=a(W[R]),!E);R++);if(E==="+"&&t>1&&n[t-2]===" ")throw new Error("Space before `+`");return E&&{type:"OPERATOR",string:E}}function e(){return a(/[A-Za-z0-9-.]+/)}function o(){var E=e();if(!E)throw new Error("Expected idstring at offset "+t);return E}function u(){if(a("DocumentRef-")){var E=o();return{type:"DOCUMENTREF",string:E}}}function d(){if(a("LicenseRef-")){var E=o();return{type:"LICENSEREF",string:E}}}function I(){var E=t,W=e();if(T8a.indexOf(W)!==-1)return{type:"LICENSE",string:W};if(D8a.indexOf(W)!==-1)return{type:"EXCEPTION",string:W};t=E}function h(){return s()||u()||d()||I()}for(var c=[];r()&&(i(),!!r());){var G=h();if(!G)throw new Error("Unexpected `"+n[t]+"` at offset "+t);c.push(G)}return c}});var I8n=ve((Adl,u8n)=>{"use strict";u8n.exports=function(n){var t=0;function r(){return t<n.length}function a(){return r()?n[t]:null}function i(){if(!r())throw new Error;t++}function s(W){var R=a();if(R&&R.type==="OPERATOR"&&W===R.string)return i(),R.string}function e(){if(s("WITH")){var W=a();if(W&&W.type==="EXCEPTION")return i(),W.string;throw new Error("Expected exception after `WITH`")}}function o(){var W=t,R="",F=a();if(F.type==="DOCUMENTREF"&&(i(),R+="DocumentRef-"+F.string+":",!s(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(F=a(),F.type==="LICENSEREF")return i(),R+="LicenseRef-"+F.string,{license:R};t=W}function u(){var W=a();if(W&&W.type==="LICENSE"){i();var R={license:W.string};s("+")&&(R.plus=!0);var F=e();return F&&(R.exception=F),R}}function d(){var W=s("(");if(W){var R=G();if(!s(")"))throw new Error("Expected `)`");return R}}function I(){return d()||o()||u()}function h(W,R){return function F(){var w=R();if(w){if(!s(W))return w;var A=F();if(!A)throw new Error("Expected expression");return{left:w,conjunction:W.toLowerCase(),right:A}}}}var c=h("AND",I),G=h("OR",c),E=G();if(!E||r())throw new Error("Syntax error");return E}});var Dmt=ve((Wdl,d8n)=>{"use strict";var O8a=c8n(),U8a=I8n();d8n.exports=function(n){return U8a(O8a(n))}});var Z8n=ve((ydl,v8n)=>{var M8a=Dmt(),z8a=Tmt();function twe(n){try{return M8a(n),!0}catch{return!1}}function g8n(n,t){var r=t[0].length-n[0].length;return r!==0?r:n[0].toUpperCase().localeCompare(t[0].toUpperCase())}var h8n=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(g8n),_8a=0,P8a=1,m8n=[function(n){return n.toUpperCase()},function(n){return n.trim()},function(n){return n.replace(/\./g,"")},function(n){return n.replace(/\s+/g,"")},function(n){return n.replace(/\s+/g,"-")},function(n){return n.replace("v","-")},function(n){return n.replace(/,?\s*(\d)/,"-$1")},function(n){return n.replace(/,?\s*(\d)/,"-$1.0")},function(n){return n.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(n){return n.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(n){return n[0].toUpperCase()+n.slice(1)},function(n){return n.replace("/","-")},function(n){return n.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(n){return n.indexOf("3.0")!==-1?n+"-or-later":n+"-only"},function(n){return n+"only"},function(n){return n.replace(/(\d)$/,"-$1.0")},function(n){return n.replace(/(-| )?(\d)$/,"-$2-Clause")},function(n){return n.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(n){return n.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(n){return n.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(n){return n.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(n){return n.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(n){return n.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(n){return"CC-"+n},function(n){return"CC-"+n+"-4.0"},function(n){return n.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(n){return"CC-"+n.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],Omt=z8a.map(function(n){var t=/^(.*)-\d+\.\d+$/.exec(n);return t?[t[0],t[1]]:[n,null]}).reduce(function(n,t){var r=t[1];return n[r]=n[r]||[],n[r].push(t[0]),n},{}),j8a=Object.keys(Omt).map(function(t){return[t,Omt[t]]}).filter(function(t){return t[1].length===1&&t[0]!==null&&t[0]!=="APL"}).map(function(t){return[t[0],t[1][0]]});Omt=void 0;var p8n=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(j8a).sort(g8n),K8a=0,q8a=1,b8n=function(n){for(var t=0;t<m8n.length;t++){var r=m8n[t](n).trim();if(r!==n&&twe(r))return r}return null},f8n=function(n){for(var t=n.toUpperCase(),r=0;r<p8n.length;r++){var a=p8n[r];if(t.indexOf(a[K8a])>-1)return a[q8a]}return null},G8n=function(n,t){for(var r=0;r<h8n.length;r++){var a=h8n[r],i=a[_8a];if(n.indexOf(i)>-1){var s=n.replace(i,a[P8a]),e=t(s);if(e!==null)return e}}return null};v8n.exports=function(n,t){t=t||{};var r=t.upgrade===void 0?!0:!!t.upgrade;function a(o){return r?$8a(o):o}var i=typeof n=="string"&&n.trim().length!==0;if(!i)throw Error("Invalid argument. Expected non-empty string.");if(n=n.trim(),twe(n))return a(n);var s=n.replace(/\+$/,"").trim();if(twe(s))return a(s);var e=b8n(n);return e!==null||(e=G8n(n,function(o){return twe(o)?o:b8n(o)}),e!==null)||(e=f8n(n),e!==null)||(e=G8n(n,f8n),e!==null)?a(e):null};function $8a(n){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(n)!==-1?n+"-only":["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(n)!==-1?n.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(n)!==-1?n+"-or-later":n}});var y8n=ve((Fdl,W8n)=>{var eTa=Dmt(),tTa=Z8n(),N8n='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',nTa=/^SEE LICEN[CS]E IN (.+)$/;function A8n(n,t){return t.slice(0,n.length)===n}function Umt(n){if(n.hasOwnProperty("license")){var t=n.license;return A8n("LicenseRef",t)||A8n("DocumentRef",t)}else return Umt(n.left)||Umt(n.right)}W8n.exports=function(n){var t;try{t=eTa(n)}catch{var r;if(n==="UNLICENSED"||n==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=nTa.exec(n))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var a={validForOldPackages:!1,validForNewPackages:!1,warnings:[N8n]};if(n.trim().length!==0){var i=tTa(n);i&&a.warnings.push('license is similar to the valid expression "'+i+'"')}return a}return Umt(t)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[N8n]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var C8n=ve(rwe=>{"use strict";Object.defineProperty(rwe,"__esModule",{value:!0});rwe.LRUCache=void 0;var l_=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,E8n=new Set,Mmt=typeof process=="object"&&process?process:{},R8n=(n,t,r,a)=>{typeof Mmt.emitWarning=="function"?Mmt.emitWarning(n,t,r,a):console.error(`[${r}] ${t}: ${n}`)},nwe=globalThis.AbortController,F8n=globalThis.AbortSignal;if(typeof nwe>"u"){F8n=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(a,i){this._onabort.push(i)}},nwe=class{constructor(){t()}signal=new F8n;abort(a){if(!this.signal.aborted){this.signal.reason=a,this.signal.aborted=!0;for(let i of this.signal._onabort)i(a);this.signal.onabort?.(a)}}};let n=Mmt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{n&&(n=!1,R8n("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var rTa=n=>!E8n.has(n),wdl=Symbol("type"),Ux=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),w8n=n=>Ux(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?s_:null:null,s_=class extends Array{constructor(t){super(t),this.fill(0)}},zmt=class n{heap;length;static#e=!1;static create(t){let r=w8n(t);if(!r)return[];n.#e=!0;let a=new n(t,r);return n.#e=!1,a}constructor(t,r){if(!n.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},_mt=class n{#e;#t;#n;#r;#a;#i;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#u;#s;#l;#d;#I;#h;#o;#m;#f;#N;#b;#E;#g;#A;#W;#Z;#G;static unsafeExposeInternals(t){return{starts:t.#g,ttls:t.#A,sizes:t.#E,keyMap:t.#l,keyList:t.#d,valList:t.#I,next:t.#h,prev:t.#o,get head(){return t.#m},get tail(){return t.#f},free:t.#N,isBackgroundFetch:r=>t.#v(r),backgroundFetch:(r,a,i,s)=>t.#Y(r,a,i,s),moveToTail:r=>t.#D(r),indexes:r=>t.#S(r),rindexes:r=>t.#V(r),isStale:r=>t.#w(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#s}get size(){return this.#u}get fetchMethod(){return this.#a}get memoMethod(){return this.#i}get dispose(){return this.#n}get disposeAfter(){return this.#r}constructor(t){let{max:r=0,ttl:a,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:e,updateAgeOnHas:o,allowStale:u,dispose:d,disposeAfter:I,noDisposeOnSet:h,noUpdateTTL:c,maxSize:G=0,maxEntrySize:E=0,sizeCalculation:W,fetchMethod:R,memoMethod:F,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:A,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:b,ignoreFetchAbort:g}=t;if(r!==0&&!Ux(r))throw new TypeError("max option must be a nonnegative integer");let v=r?w8n(r):Array;if(!v)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=G,this.maxEntrySize=E||this.#t,this.sizeCalculation=W,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(F!==void 0&&typeof F!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#i=F,R!==void 0&&typeof R!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#a=R,this.#Z=!!R,this.#l=new Map,this.#d=new Array(r).fill(void 0),this.#I=new Array(r).fill(void 0),this.#h=new v(r),this.#o=new v(r),this.#m=0,this.#f=0,this.#N=zmt.create(r),this.#u=0,this.#s=0,typeof d=="function"&&(this.#n=d),typeof I=="function"?(this.#r=I,this.#b=[]):(this.#r=void 0,this.#b=void 0),this.#W=!!this.#n,this.#G=!!this.#r,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!c,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!y,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!g,this.maxEntrySize!==0){if(this.#t!==0&&!Ux(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!Ux(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#C()}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!A,this.updateAgeOnGet=!!e,this.updateAgeOnHas=!!o,this.ttlResolution=Ux(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=a||0,this.ttl){if(!Ux(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#y()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let N="LRU_CACHE_UNBOUNDED";rTa(N)&&(E8n.add(N),R8n("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",N,n))}}getRemainingTTL(t){return this.#l.has(t)?1/0:0}#y(){let t=new s_(this.#e),r=new s_(this.#e);this.#A=t,this.#g=r,this.#H=(s,e,o=l_.now())=>{if(r[s]=e!==0?o:0,t[s]=e,e!==0&&this.ttlAutopurge){let u=setTimeout(()=>{this.#w(s)&&this.#k(this.#d[s],"expire")},e+1);u.unref&&u.unref()}},this.#R=s=>{r[s]=t[s]!==0?l_.now():0},this.#c=(s,e)=>{if(t[e]){let o=t[e],u=r[e];if(!o||!u)return;s.ttl=o,s.start=u,s.now=a||i();let d=s.now-u;s.remainingTTL=o-d}};let a=0,i=()=>{let s=l_.now();if(this.ttlResolution>0){a=s;let e=setTimeout(()=>a=0,this.ttlResolution);e.unref&&e.unref()}return s};this.getRemainingTTL=s=>{let e=this.#l.get(s);if(e===void 0)return 0;let o=t[e],u=r[e];if(!o||!u)return 1/0;let d=(a||i())-u;return o-d},this.#w=s=>{let e=r[s],o=t[s];return!!o&&!!e&&(a||i())-e>o}}#R=()=>{};#c=()=>{};#H=()=>{};#w=()=>!1;#C(){let t=new s_(this.#e);this.#s=0,this.#E=t,this.#x=r=>{this.#s-=t[r],t[r]=0},this.#F=(r,a,i,s)=>{if(this.#v(a))return 0;if(!Ux(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(a,r),!Ux(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#L=(r,a,i)=>{if(t[r]=a,this.#t){let s=this.#t-t[r];for(;this.#s>s;)this.#B(!0)}this.#s+=t[r],i&&(i.entrySize=a,i.totalCalculatedSize=this.#s)}}#x=t=>{};#L=(t,r,a)=>{};#F=(t,r,a,i)=>{if(a||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#S({allowStale:t=this.allowStale}={}){if(this.#u)for(let r=this.#f;!(!this.#X(r)||((t||!this.#w(r))&&(yield r),r===this.#m));)r=this.#o[r]}*#V({allowStale:t=this.allowStale}={}){if(this.#u)for(let r=this.#m;!(!this.#X(r)||((t||!this.#w(r))&&(yield r),r===this.#f));)r=this.#h[r]}#X(t){return t!==void 0&&this.#l.get(this.#d[t])===t}*entries(){for(let t of this.#S())this.#I[t]!==void 0&&this.#d[t]!==void 0&&!this.#v(this.#I[t])&&(yield[this.#d[t],this.#I[t]])}*rentries(){for(let t of this.#V())this.#I[t]!==void 0&&this.#d[t]!==void 0&&!this.#v(this.#I[t])&&(yield[this.#d[t],this.#I[t]])}*keys(){for(let t of this.#S()){let r=this.#d[t];r!==void 0&&!this.#v(this.#I[t])&&(yield r)}}*rkeys(){for(let t of this.#V()){let r=this.#d[t];r!==void 0&&!this.#v(this.#I[t])&&(yield r)}}*values(){for(let t of this.#S())this.#I[t]!==void 0&&!this.#v(this.#I[t])&&(yield this.#I[t])}*rvalues(){for(let t of this.#V())this.#I[t]!==void 0&&!this.#v(this.#I[t])&&(yield this.#I[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,r={}){for(let a of this.#S()){let i=this.#I[a],s=this.#v(i)?i.__staleWhileFetching:i;if(s!==void 0&&t(s,this.#d[a],this))return this.get(this.#d[a],r)}}forEach(t,r=this){for(let a of this.#S()){let i=this.#I[a],s=this.#v(i)?i.__staleWhileFetching:i;s!==void 0&&t.call(r,s,this.#d[a],this)}}rforEach(t,r=this){for(let a of this.#V()){let i=this.#I[a],s=this.#v(i)?i.__staleWhileFetching:i;s!==void 0&&t.call(r,s,this.#d[a],this)}}purgeStale(){let t=!1;for(let r of this.#V({allowStale:!0}))this.#w(r)&&(this.#k(this.#d[r],"expire"),t=!0);return t}info(t){let r=this.#l.get(t);if(r===void 0)return;let a=this.#I[r],i=this.#v(a)?a.__staleWhileFetching:a;if(i===void 0)return;let s={value:i};if(this.#A&&this.#g){let e=this.#A[r],o=this.#g[r];if(e&&o){let u=e-(l_.now()-o);s.ttl=u,s.start=Date.now()}}return this.#E&&(s.size=this.#E[r]),s}dump(){let t=[];for(let r of this.#S({allowStale:!0})){let a=this.#d[r],i=this.#I[r],s=this.#v(i)?i.__staleWhileFetching:i;if(s===void 0||a===void 0)continue;let e={value:s};if(this.#A&&this.#g){e.ttl=this.#A[r];let o=l_.now()-this.#g[r];e.start=Math.floor(Date.now()-o)}this.#E&&(e.size=this.#E[r]),t.unshift([a,e])}return t}load(t){this.clear();for(let[r,a]of t){if(a.start){let i=Date.now()-a.start;a.start=l_.now()-i}this.set(r,a.value,a)}}set(t,r,a={}){if(r===void 0)return this.delete(t),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:e=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:u}=a,{noUpdateTTL:d=this.noUpdateTTL}=a,I=this.#F(t,r,a.size||0,o);if(this.maxEntrySize&&I>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this.#k(t,"set"),this;let h=this.#u===0?void 0:this.#l.get(t);if(h===void 0)h=this.#u===0?this.#f:this.#N.length!==0?this.#N.pop():this.#u===this.#e?this.#B(!1):this.#u,this.#d[h]=t,this.#I[h]=r,this.#l.set(t,h),this.#h[this.#f]=h,this.#o[h]=this.#f,this.#f=h,this.#u++,this.#L(h,I,u),u&&(u.set="add"),d=!1;else{this.#D(h);let c=this.#I[h];if(r!==c){if(this.#Z&&this.#v(c)){c.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:G}=c;G!==void 0&&!e&&(this.#W&&this.#n?.(G,t,"set"),this.#G&&this.#b?.push([G,t,"set"]))}else e||(this.#W&&this.#n?.(c,t,"set"),this.#G&&this.#b?.push([c,t,"set"]));if(this.#x(h),this.#L(h,I,u),this.#I[h]=r,u){u.set="replace";let G=c&&this.#v(c)?c.__staleWhileFetching:c;G!==void 0&&(u.oldValue=G)}}else u&&(u.set="update")}if(i!==0&&!this.#A&&this.#y(),this.#A&&(d||this.#H(h,i,s),u&&this.#c(u,h)),!e&&this.#G&&this.#b){let c=this.#b,G;for(;G=c?.shift();)this.#r?.(...G)}return this}pop(){try{for(;this.#u;){let t=this.#I[this.#m];if(this.#B(!0),this.#v(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#G&&this.#b){let t=this.#b,r;for(;r=t?.shift();)this.#r?.(...r)}}}#B(t){let r=this.#m,a=this.#d[r],i=this.#I[r];return this.#Z&&this.#v(i)?i.__abortController.abort(new Error("evicted")):(this.#W||this.#G)&&(this.#W&&this.#n?.(i,a,"evict"),this.#G&&this.#b?.push([i,a,"evict"])),this.#x(r),t&&(this.#d[r]=void 0,this.#I[r]=void 0,this.#N.push(r)),this.#u===1?(this.#m=this.#f=0,this.#N.length=0):this.#m=this.#h[r],this.#l.delete(a),this.#u--,r}has(t,r={}){let{updateAgeOnHas:a=this.updateAgeOnHas,status:i}=r,s=this.#l.get(t);if(s!==void 0){let e=this.#I[s];if(this.#v(e)&&e.__staleWhileFetching===void 0)return!1;if(this.#w(s))i&&(i.has="stale",this.#c(i,s));else return a&&this.#R(s),i&&(i.has="hit",this.#c(i,s)),!0}else i&&(i.has="miss");return!1}peek(t,r={}){let{allowStale:a=this.allowStale}=r,i=this.#l.get(t);if(i===void 0||!a&&this.#w(i))return;let s=this.#I[i];return this.#v(s)?s.__staleWhileFetching:s}#Y(t,r,a,i){let s=r===void 0?void 0:this.#I[r];if(this.#v(s))return s;let e=new nwe,{signal:o}=a;o?.addEventListener("abort",()=>e.abort(o.reason),{signal:e.signal});let u={signal:e.signal,options:a,context:i},d=(W,R=!1)=>{let{aborted:F}=e.signal,w=a.ignoreFetchAbort&&W!==void 0;if(a.status&&(F&&!R?(a.status.fetchAborted=!0,a.status.fetchError=e.signal.reason,w&&(a.status.fetchAbortIgnored=!0)):a.status.fetchResolved=!0),F&&!w&&!R)return h(e.signal.reason);let A=G;return this.#I[r]===G&&(W===void 0?A.__staleWhileFetching?this.#I[r]=A.__staleWhileFetching:this.#k(t,"fetch"):(a.status&&(a.status.fetchUpdated=!0),this.set(t,W,u.options))),W},I=W=>(a.status&&(a.status.fetchRejected=!0,a.status.fetchError=W),h(W)),h=W=>{let{aborted:R}=e.signal,F=R&&a.allowStaleOnFetchAbort,w=F||a.allowStaleOnFetchRejection,A=w||a.noDeleteOnFetchRejection,y=G;if(this.#I[r]===G&&(!A||y.__staleWhileFetching===void 0?this.#k(t,"fetch"):F||(this.#I[r]=y.__staleWhileFetching)),w)return a.status&&y.__staleWhileFetching!==void 0&&(a.status.returnedStale=!0),y.__staleWhileFetching;if(y.__returned===y)throw W},c=(W,R)=>{let F=this.#a?.(t,s,u);F&&F instanceof Promise&&F.then(w=>W(w===void 0?void 0:w),R),e.signal.addEventListener("abort",()=>{(!a.ignoreFetchAbort||a.allowStaleOnFetchAbort)&&(W(void 0),a.allowStaleOnFetchAbort&&(W=w=>d(w,!0)))})};a.status&&(a.status.fetchDispatched=!0);let G=new Promise(c).then(d,I),E=Object.assign(G,{__abortController:e,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(t,E,{...u.options,status:void 0}),r=this.#l.get(t)):this.#I[r]=E,E}#v(t){if(!this.#Z)return!1;let r=t;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof nwe}async fetch(t,r={}){let{allowStale:a=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:e=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:u=0,sizeCalculation:d=this.sizeCalculation,noUpdateTTL:I=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:G=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:W,forceRefresh:R=!1,status:F,signal:w}=r;if(!this.#Z)return F&&(F.fetch="get"),this.get(t,{allowStale:a,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:F});let A={allowStale:a,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:e,noDisposeOnSet:o,size:u,sizeCalculation:d,noUpdateTTL:I,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:E,ignoreFetchAbort:G,status:F,signal:w},y=this.#l.get(t);if(y===void 0){F&&(F.fetch="miss");let b=this.#Y(t,y,A,W);return b.__returned=b}else{let b=this.#I[y];if(this.#v(b)){let p=a&&b.__staleWhileFetching!==void 0;return F&&(F.fetch="inflight",p&&(F.returnedStale=!0)),p?b.__staleWhileFetching:b.__returned=b}let g=this.#w(y);if(!R&&!g)return F&&(F.fetch="hit"),this.#D(y),i&&this.#R(y),F&&this.#c(F,y),b;let v=this.#Y(t,y,A,W),m=v.__staleWhileFetching!==void 0&&a;return F&&(F.fetch=g?"stale":"refresh",m&&g&&(F.returnedStale=!0)),m?v.__staleWhileFetching:v.__returned=v}}async forceFetch(t,r={}){let a=await this.fetch(t,r);if(a===void 0)throw new Error("fetch() returned undefined");return a}memo(t,r={}){let a=this.#i;if(!a)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...e}=r,o=this.get(t,e);if(!s&&o!==void 0)return o;let u=a(t,o,{options:e,context:i});return this.set(t,u,e),u}get(t,r={}){let{allowStale:a=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:e}=r,o=this.#l.get(t);if(o!==void 0){let u=this.#I[o],d=this.#v(u);return e&&this.#c(e,o),this.#w(o)?(e&&(e.get="stale"),d?(e&&a&&u.__staleWhileFetching!==void 0&&(e.returnedStale=!0),a?u.__staleWhileFetching:void 0):(s||this.#k(t,"expire"),e&&a&&(e.returnedStale=!0),a?u:void 0)):(e&&(e.get="hit"),d?u.__staleWhileFetching:(this.#D(o),i&&this.#R(o),u))}else e&&(e.get="miss")}#T(t,r){this.#o[r]=t,this.#h[t]=r}#D(t){t!==this.#f&&(t===this.#m?this.#m=this.#h[t]:this.#T(this.#o[t],this.#h[t]),this.#T(this.#f,t),this.#f=t)}delete(t){return this.#k(t,"delete")}#k(t,r){let a=!1;if(this.#u!==0){let i=this.#l.get(t);if(i!==void 0)if(a=!0,this.#u===1)this.#p(r);else{this.#x(i);let s=this.#I[i];if(this.#v(s)?s.__abortController.abort(new Error("deleted")):(this.#W||this.#G)&&(this.#W&&this.#n?.(s,t,r),this.#G&&this.#b?.push([s,t,r])),this.#l.delete(t),this.#d[i]=void 0,this.#I[i]=void 0,i===this.#f)this.#f=this.#o[i];else if(i===this.#m)this.#m=this.#h[i];else{let e=this.#o[i];this.#h[e]=this.#h[i];let o=this.#h[i];this.#o[o]=this.#o[i]}this.#u--,this.#N.push(i)}}if(this.#G&&this.#b?.length){let i=this.#b,s;for(;s=i?.shift();)this.#r?.(...s)}return a}clear(){return this.#p("delete")}#p(t){for(let r of this.#V({allowStale:!0})){let a=this.#I[r];if(this.#v(a))a.__abortController.abort(new Error("deleted"));else{let i=this.#d[r];this.#W&&this.#n?.(a,i,t),this.#G&&this.#b?.push([a,i,t])}}if(this.#l.clear(),this.#I.fill(void 0),this.#d.fill(void 0),this.#A&&this.#g&&(this.#A.fill(0),this.#g.fill(0)),this.#E&&this.#E.fill(0),this.#m=0,this.#f=0,this.#N.length=0,this.#s=0,this.#u=0,this.#G&&this.#b){let r=this.#b,a;for(;a=r?.shift();)this.#r?.(...a)}}};rwe.LRUCache=_mt});var V8n=ve((Ydl,x8n)=>{"use strict";var oo=(...n)=>n.every(t=>t)?n.join(""):"",a0=n=>n?encodeURIComponent(n):"",Y8n=n=>n.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),aTa={sshtemplate:({domain:n,user:t,project:r,committish:a})=>`git@${n}:${t}/${r}.git${oo("#",a)}`,sshurltemplate:({domain:n,user:t,project:r,committish:a})=>`git+ssh://git@${n}/${t}/${r}.git${oo("#",a)}`,edittemplate:({domain:n,user:t,project:r,committish:a,editpath:i,path:s})=>`https://${n}/${t}/${r}${oo("/",i,"/",a0(a||"HEAD"),"/",s)}`,browsetemplate:({domain:n,user:t,project:r,committish:a,treepath:i})=>`https://${n}/${t}/${r}${oo("/",i,"/",a0(a))}`,browsetreetemplate:({domain:n,user:t,project:r,committish:a,treepath:i,path:s,fragment:e,hashformat:o})=>`https://${n}/${t}/${r}/${i}/${a0(a||"HEAD")}/${s}${oo("#",o(e||""))}`,browseblobtemplate:({domain:n,user:t,project:r,committish:a,blobpath:i,path:s,fragment:e,hashformat:o})=>`https://${n}/${t}/${r}/${i}/${a0(a||"HEAD")}/${s}${oo("#",o(e||""))}`,docstemplate:({domain:n,user:t,project:r,treepath:a,committish:i})=>`https://${n}/${t}/${r}${oo("/",a,"/",a0(i))}#readme`,httpstemplate:({auth:n,domain:t,user:r,project:a,committish:i})=>`git+https://${oo(n,"@")}${t}/${r}/${a}.git${oo("#",i)}`,filetemplate:({domain:n,user:t,project:r,committish:a,path:i})=>`https://${n}/${t}/${r}/raw/${a0(a||"HEAD")}/${i}`,shortcuttemplate:({type:n,user:t,project:r,committish:a})=>`${n}:${t}/${r}${oo("#",a)}`,pathtemplate:({user:n,project:t,committish:r})=>`${n}/${t}${oo("#",r)}`,bugstemplate:({domain:n,user:t,project:r})=>`https://${n}/${t}/${r}/issues`,hashformat:Y8n},Mx={};Mx.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:n,user:t,project:r,committish:a,path:i})=>`https://${oo(n,"@")}raw.githubusercontent.com/${t}/${r}/${a0(a||"HEAD")}/${i}`,gittemplate:({auth:n,domain:t,user:r,project:a,committish:i})=>`git://${oo(n,"@")}${t}/${r}/${a}.git${oo("#",i)}`,tarballtemplate:({domain:n,user:t,project:r,committish:a})=>`https://codeload.${n}/${t}/${r}/tar.gz/${a0(a||"HEAD")}`,extract:n=>{let[,t,r,a,i]=n.pathname.split("/",5);if(!(a&&a!=="tree")&&(a||(i=n.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!t||!r)))return{user:t,project:r,committish:i}}};Mx.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:n,user:t,project:r,committish:a,treepath:i,path:s,editpath:e})=>`https://${n}/${t}/${r}${oo("/",i,"/",a0(a||"HEAD"),"/",s,e)}`,tarballtemplate:({domain:n,user:t,project:r,committish:a})=>`https://${n}/${t}/${r}/get/${a0(a||"HEAD")}.tar.gz`,extract:n=>{let[,t,r,a]=n.pathname.split("/",4);if(!["get"].includes(a)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!t||!r)))return{user:t,project:r,committish:n.hash.slice(1)}}};Mx.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:n,domain:t,user:r,project:a,committish:i})=>`git+https://${oo(n,"@")}${t}/${r}/${a}.git${oo("#",i)}`,tarballtemplate:({domain:n,user:t,project:r,committish:a})=>`https://${n}/${t}/${r}/repository/archive.tar.gz?ref=${a0(a||"HEAD")}`,extract:n=>{let t=n.pathname.slice(1);if(t.includes("/-/")||t.includes("/archive.tar.gz"))return;let r=t.split("/"),a=r.pop();a.endsWith(".git")&&(a=a.slice(0,-4));let i=r.join("/");if(!(!i||!a))return{user:i,project:a,committish:n.hash.slice(1)}}};Mx.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:n,project:t,committish:r})=>`git@${n}:${t}.git${oo("#",r)}`,sshurltemplate:({domain:n,project:t,committish:r})=>`git+ssh://git@${n}/${t}.git${oo("#",r)}`,edittemplate:({domain:n,user:t,project:r,committish:a,editpath:i})=>`https://${n}/${t}/${r}${oo("/",a0(a))}/${i}`,browsetemplate:({domain:n,project:t,committish:r})=>`https://${n}/${t}${oo("/",a0(r))}`,browsetreetemplate:({domain:n,project:t,committish:r,path:a,hashformat:i})=>`https://${n}/${t}${oo("/",a0(r))}${oo("#",i(a))}`,browseblobtemplate:({domain:n,project:t,committish:r,path:a,hashformat:i})=>`https://${n}/${t}${oo("/",a0(r))}${oo("#",i(a))}`,docstemplate:({domain:n,project:t,committish:r})=>`https://${n}/${t}${oo("/",a0(r))}`,httpstemplate:({domain:n,project:t,committish:r})=>`git+https://${n}/${t}.git${oo("#",r)}`,filetemplate:({user:n,project:t,committish:r,path:a})=>`https://gist.githubusercontent.com/${n}/${t}/raw${oo("/",a0(r))}/${a}`,shortcuttemplate:({type:n,project:t,committish:r})=>`${n}:${t}${oo("#",r)}`,pathtemplate:({project:n,committish:t})=>`${n}${oo("#",t)}`,bugstemplate:({domain:n,project:t})=>`https://${n}/${t}`,gittemplate:({domain:n,project:t,committish:r})=>`git://${n}/${t}.git${oo("#",r)}`,tarballtemplate:({project:n,committish:t})=>`https://codeload.github.com/gist/${n}/tar.gz/${a0(t||"HEAD")}`,extract:n=>{let[,t,r,a]=n.pathname.split("/",4);if(a!=="raw"){if(!r){if(!t)return;r=t,t=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:t,project:r,committish:n.hash.slice(1)}}},hashformat:function(n){return n&&"file-"+Y8n(n)}};Mx.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:n,user:t,project:r,committish:a,path:i})=>`https://${n}/${t}/${r}/blob/${a0(a)||"HEAD"}/${i}`,httpstemplate:({domain:n,user:t,project:r,committish:a})=>`https://${n}/${t}/${r}.git${oo("#",a)}`,tarballtemplate:({domain:n,user:t,project:r,committish:a})=>`https://${n}/${t}/${r}/archive/${a0(a)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:n=>{let[,t,r,a]=n.pathname.split("/",4);if(!["archive"].includes(a)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!t||!r)))return{user:t,project:r,committish:n.hash.slice(1)}}};for(let[n,t]of Object.entries(Mx))Mx[n]=Object.assign({},aTa,t);x8n.exports=Mx});var jmt=ve((xdl,H8n)=>{var iTa=vt("url"),Pmt=(n,t,r)=>{let a=n.indexOf(r);return n.lastIndexOf(t,a>-1?a:1/0)},Q8n=n=>{try{return new iTa.URL(n)}catch{}},lTa=(n,t)=>{let r=n.indexOf(":"),a=n.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(t,a))return n;let i=n.indexOf("@");return i>-1?i>r?`git+ssh://${n}`:n:n.indexOf("//")===r+1?n:`${n.slice(0,r+1)}//${n.slice(r+1)}`},sTa=n=>{let t=Pmt(n,"@","#"),r=Pmt(n,":","#");return r>t&&(n=n.slice(0,r)+"/"+n.slice(r+1)),Pmt(n,":","#")===-1&&n.indexOf("//")===-1&&(n=`git+ssh://${n}`),n};H8n.exports=(n,t)=>{let r=t?lTa(n,t):n;return Q8n(r)||Q8n(sTa(r))}});var k8n=ve((Vdl,X8n)=>{"use strict";var oTa=jmt(),cTa=n=>{let t=n.indexOf("#"),r=n.indexOf("/"),a=n.indexOf("/",r+1),i=n.indexOf(":"),s=/\s/.exec(n),e=n.indexOf("@"),o=!s||t>-1&&s.index>t,u=e===-1||t>-1&&e>t,d=i===-1||t>-1&&i>t,I=a===-1||t>-1&&a>t,h=r>0,c=t>-1?n[t-1]!=="/":!n.endsWith("/"),G=!n.startsWith(".");return o&&h&&c&&G&&u&&d&&I};X8n.exports=(n,t,{gitHosts:r,protocols:a})=>{if(!n)return;let i=cTa(n)?`github:${n}`:n,s=oTa(i,a);if(!s)return;let e=r.byShortcut[s.protocol],o=r.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],u=e||o;if(!u)return;let d=r[e||o],I=null;a[s.protocol]?.auth&&(s.username||s.password)&&(I=`${s.username}${s.password?":"+s.password:""}`);let h=null,c=null,G=null,E=null;try{if(e){let W=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname,R=W.indexOf("@");R>-1&&(W=W.slice(R+1));let F=W.lastIndexOf("/");F>-1?(c=decodeURIComponent(W.slice(0,F)),c||(c=null),G=decodeURIComponent(W.slice(F+1))):G=decodeURIComponent(W),G.endsWith(".git")&&(G=G.slice(0,-4)),s.hash&&(h=decodeURIComponent(s.hash.slice(1))),E="shortcut"}else{if(!d.protocols.includes(s.protocol))return;let W=d.extract(s);if(!W)return;c=W.user&&decodeURIComponent(W.user),G=decodeURIComponent(W.project),h=decodeURIComponent(W.committish),E=a[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(W){if(W instanceof URIError)return;throw W}return[u,c,I,G,h,E,t]}});var S8n=ve((Qdl,L8n)=>{"use strict";var{LRUCache:uTa}=C8n(),ITa=V8n(),dTa=k8n(),hTa=jmt(),Kmt=new uTa({max:1e3}),awe=class n{constructor(t,r,a,i,s,e,o={}){Object.assign(this,n.#e[t],{type:t,user:r,auth:a,project:i,committish:s,default:e,opts:o})}static#e={byShortcut:{},byDomain:{}};static#t={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(t,r){n.#e[t]=r,n.#e.byDomain[r.domain]=t,n.#e.byShortcut[`${t}:`]=t,n.#t[`${t}:`]={name:t}}static fromUrl(t,r){if(typeof t!="string")return;let a=t+JSON.stringify(r||{});if(!Kmt.has(a)){let i=dTa(t,r,{gitHosts:n.#e,protocols:n.#t});Kmt.set(a,i?new n(...i):void 0)}return Kmt.get(a)}static parseUrl(t){return hTa(t)}#n(t,r){if(typeof t!="function")return null;let a={...this,...this.opts,...r};a.path||(a.path=""),a.path.startsWith("/")&&(a.path=a.path.slice(1)),a.noCommittish&&(a.committish=null);let i=t(a);return a.noGitPlus&&i.startsWith("git+")?i.slice(4):i}hash(){return this.committish?`#${this.committish}`:""}ssh(t){return this.#n(this.sshtemplate,t)}sshurl(t){return this.#n(this.sshurltemplate,t)}browse(t,...r){return typeof t!="string"?this.#n(this.browsetemplate,t):typeof r[0]!="string"?this.#n(this.browsetreetemplate,{...r[0],path:t}):this.#n(this.browsetreetemplate,{...r[1],fragment:r[0],path:t})}browseFile(t,...r){return typeof r[0]!="string"?this.#n(this.browseblobtemplate,{...r[0],path:t}):this.#n(this.browseblobtemplate,{...r[1],fragment:r[0],path:t})}docs(t){return this.#n(this.docstemplate,t)}bugs(t){return this.#n(this.bugstemplate,t)}https(t){return this.#n(this.httpstemplate,t)}git(t){return this.#n(this.gittemplate,t)}shortcut(t){return this.#n(this.shortcuttemplate,t)}path(t){return this.#n(this.pathtemplate,t)}tarball(t){return this.#n(this.tarballtemplate,{...t,noCommittish:!1})}file(t,r){return this.#n(this.filetemplate,{...r,path:t})}edit(t,r){return this.#n(this.edittemplate,{...r,path:t})}getDefaultRepresentation(){return this.default}toString(t){return this.default&&typeof this[this.default]=="function"?this[this.default](t):this.sshurl(t)}};for(let[n,t]of Object.entries(ITa))awe.addHost(n,t);L8n.exports=awe});var J8n=ve((Hdl,B8n)=>{B8n.exports=mTa;function mTa(n){if(!n||n==="ERROR: No README data found!")return;n=n.trim().split(`
4337
- `);let t=0;for(;n[t]&&n[t].trim().match(/^(#|$)/);)t++;let r=n.length,a=t+1;for(;a<r&&n[a].trim();)a++;return n.slice(t,a).join(" ").trim()}});var T8n=ve((Xdl,pTa)=>{pTa.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var M8n=ve((kdl,U8n)=>{var bTa=fdt(),fTa=Gdt(),GTa=y8n(),iwe=S8n(),gTa=vt("node:module"),vTa=["dependencies","devDependencies","optionalDependencies"],ZTa=J8n(),qmt=vt("url"),zx=T8n(),D8n=n=>n.includes("@")&&n.indexOf("@")<n.lastIndexOf(".");U8n.exports={warn:function(){},fixRepositoryField:function(n){if(n.repositories&&(this.warn("repositories"),n.repository=n.repositories[0]),!n.repository)return this.warn("missingRepository");typeof n.repository=="string"&&(n.repository={type:"git",url:n.repository});var t=n.repository.url||"";if(t){var r=iwe.fromUrl(t);r&&(t=n.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}t.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",t)},fixTypos:function(n){Object.keys(zx.topLevel).forEach(function(t){Object.prototype.hasOwnProperty.call(n,t)&&this.warn("typo",t,zx.topLevel[t])},this)},fixScriptsField:function(n){if(n.scripts){if(typeof n.scripts!="object"){this.warn("nonObjectScripts"),delete n.scripts;return}Object.keys(n.scripts).forEach(function(t){typeof n.scripts[t]!="string"?(this.warn("nonStringScript"),delete n.scripts[t]):zx.script[t]&&!n.scripts[zx.script[t]]&&this.warn("typo",t,zx.script[t],"scripts")},this)}},fixFilesField:function(n){var t=n.files;t&&!Array.isArray(t)?(this.warn("nonArrayFiles"),delete n.files):n.files&&(n.files=n.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(n){if(n.bin&&typeof n.bin=="string"){var t={},r;(r=n.name.match(/^@[^/]+[/](.*)$/))?t[r[1]]=n.bin:t[n.name]=n.bin,n.bin=t}},fixManField:function(n){n.man&&typeof n.man=="string"&&(n.man=[n.man])},fixBundleDependenciesField:function(n){var t="bundledDependencies",r="bundleDependencies";n[t]&&!n[r]&&(n[r]=n[t],delete n[t]),n[r]&&!Array.isArray(n[r])?(this.warn("nonArrayBundleDependencies"),delete n[r]):n[r]&&(n[r]=n[r].filter(function(a){return!a||typeof a!="string"?(this.warn("nonStringBundleDependency",a),!1):(n.dependencies||(n.dependencies={}),Object.prototype.hasOwnProperty.call(n.dependencies,a)||(this.warn("nonDependencyBundleDependency",a),n.dependencies[a]="*"),!0)},this))},fixDependencies:function(n){wTa(n,this.warn),ETa(n,this.warn),this.fixBundleDependenciesField(n),["dependencies","devDependencies"].forEach(function(t){if(t in n){if(!n[t]||typeof n[t]!="object"){this.warn("nonObjectDependencies",t),delete n[t];return}Object.keys(n[t]).forEach(function(r){var a=n[t][r];typeof a!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(a)),delete n[t][r]);var i=iwe.fromUrl(n[t][r]);i&&(n[t][r]=i.toString())},this)}},this)},fixModulesField:function(n){n.modules&&(this.warn("deprecatedModules"),delete n.modules)},fixKeywordsField:function(n){typeof n.keywords=="string"&&(n.keywords=n.keywords.split(/,\s+/)),n.keywords&&!Array.isArray(n.keywords)?(delete n.keywords,this.warn("nonArrayKeywords")):n.keywords&&(n.keywords=n.keywords.filter(function(t){return typeof t!="string"||!t?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(n,t){var r=!t;if(!n.version)return n.version="",!0;if(!bTa(n.version,r))throw new Error('Invalid version: "'+n.version+'"');return n.version=fTa(n.version,r),!0},fixPeople:function(n){O8n(n,yTa),O8n(n,FTa)},fixNameField:function(n,t){typeof t=="boolean"?t={strict:t}:typeof t>"u"&&(t={});var r=t.strict;if(!n.name&&!r){n.name="";return}if(typeof n.name!="string")throw new Error("name field must be a string.");r||(n.name=n.name.trim()),WTa(n.name,r,t.allowLegacyCase),gTa.builtinModules.includes(n.name)&&this.warn("conflictingName",n.name)},fixDescriptionField:function(n){n.description&&typeof n.description!="string"&&(this.warn("nonStringDescription"),delete n.description),n.readme&&!n.description&&(n.description=ZTa(n.readme)),n.description===void 0&&delete n.description,n.description||this.warn("missingDescription")},fixReadmeField:function(n){n.readme||(this.warn("missingReadme"),n.readme="ERROR: No README data found!")},fixBugsField:function(n){if(!n.bugs&&n.repository&&n.repository.url){var t=iwe.fromUrl(n.repository.url);t&&t.bugs()&&(n.bugs={url:t.bugs()})}else if(n.bugs){if(typeof n.bugs=="string")D8n(n.bugs)?n.bugs={email:n.bugs}:qmt.parse(n.bugs).protocol?n.bugs={url:n.bugs}:this.warn("nonEmailUrlBugsString");else{CTa(n.bugs,this.warn);var r=n.bugs;n.bugs={},r.url&&(typeof r.url=="string"&&qmt.parse(r.url).protocol?n.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&D8n(r.email)?n.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!n.bugs.email&&!n.bugs.url&&(delete n.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(n){if(!n.homepage&&n.repository&&n.repository.url){var t=iwe.fromUrl(n.repository.url);t&&t.docs()&&(n.homepage=t.docs())}if(n.homepage){if(typeof n.homepage!="string")return this.warn("nonUrlHomepage"),delete n.homepage;qmt.parse(n.homepage).protocol||(n.homepage="http://"+n.homepage)}},fixLicenseField:function(n){let t=n.license||n.licence;if(!t)return this.warn("missingLicense");if(typeof t!="string"||t.length<1||t.trim()==="")return this.warn("invalidLicense");if(!GTa(t).validForNewPackages)return this.warn("invalidLicense")}};function NTa(n){if(n.charAt(0)!=="@")return!1;var t=n.slice(1).split("/");return t.length!==2?!1:t[0]&&t[1]&&t[0]===encodeURIComponent(t[0])&&t[1]===encodeURIComponent(t[1])}function ATa(n){return!n.match(/[/@\s+%:]/)&&n===encodeURIComponent(n)}function WTa(n,t,r){if(n.charAt(0)==="."||!(NTa(n)||ATa(n))||t&&!r&&n!==n.toLowerCase()||n.toLowerCase()==="node_modules"||n.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(n))}function O8n(n,t){return n.author&&(n.author=t(n.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(n[r])&&(n[r]=n[r].map(t))}),n}function yTa(n){if(typeof n=="string")return n;var t=n.name||"",r=n.url||n.web,a=r?" ("+r+")":"",i=n.email||n.mail,s=i?" <"+i+">":"";return t+s+a}function FTa(n){if(typeof n!="string")return n;var t=n.match(/^([^(<]+)/),r=n.match(/\(([^()]+)\)/),a=n.match(/<([^<>]+)>/),i={};return t&&t[0].trim()&&(i.name=t[0].trim()),a&&(i.email=a[1]),r&&(i.url=r[1]),i}function ETa(n){var t=n.optionalDependencies;if(t){var r=n.dependencies||{};Object.keys(t).forEach(function(a){r[a]=t[a]}),n.dependencies=r}}function RTa(n,t,r){if(!n)return{};if(typeof n=="string"&&(n=n.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(n))return n;r("deprecatedArrayDependencies",t);var a={};return n.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var s=i.shift(),e=i.join("");e=e.trim(),e=e.replace(/^@/,""),a[s]=e}),a}function wTa(n,t){vTa.forEach(function(r){n[r]&&(n[r]=RTa(n[r],r,t))})}function CTa(n,t){n&&Object.keys(n).forEach(function(r){zx.bugs[r]&&(t("typo",r,zx.bugs[r],"bugs"),n[zx.bugs[r]]=n[r],delete n[r])})}});var z8n=ve((Ldl,YTa)=>{YTa.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var j8n=ve((Sdl,P8n)=>{var _8n=vt("util"),$mt=z8n();P8n.exports=function(){var n=Array.prototype.slice.call(arguments,0),t=n.shift();if(t==="typo")return xTa.apply(null,n);var r=$mt[t]?$mt[t]:t+": '%s'";return n.unshift(r),_8n.format.apply(null,n)};function xTa(n,t,r){return r&&(n=r+"['"+n+"']",t=r+"['"+t+"']"),_8n.format($mt.typo,n,t)}});var eTn=ve((Bdl,$8n)=>{$8n.exports=K8n;var ept=M8n();K8n.fixer=ept;var VTa=j8n(),QTa=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],HTa=["dependencies","people","typos"],tpt=QTa.map(function(n){return q8n(n)+"Field"});tpt=tpt.concat(HTa);function K8n(n,t,r){t===!0&&(t=null,r=!0),r||(r=!1),(!t||n.private)&&(t=function(){}),n.scripts&&n.scripts.install==="node-gyp rebuild"&&!n.scripts.preinstall&&(n.gypfile=!0),ept.warn=function(){t(VTa.apply(null,arguments))},tpt.forEach(function(a){ept["fix"+q8n(a)](n,r)}),n._id=n.name+"@"+n.version}function q8n(n){return n.charAt(0).toUpperCase()+n.slice(1)}});var tTn=ct(()=>{});import{fileURLToPath as XTa}from"node:url";function nTn(n){return n instanceof URL?XTa(n):n}var rTn=ct(()=>{tTn()});import kTa from"node:fs/promises";import LTa from"node:path";async function iTn({cwd:n,normalize:t=!0}={}){let r=await kTa.readFile(STa(n),"utf8");return BTa(r,t)}var aTn,STa,BTa,lTn=ct(()=>{i8n();aTn=Qt(eTn(),1);rTn();STa=n=>LTa.resolve(nTn(n)??".","package.json"),BTa=(n,t)=>{let r=typeof n=="string"?Jmt(n):n;return t&&(0,aTn.default)(r),r}});import JTa from"node:path";async function sTn(n){let t=await YJn("package.json",n);if(t)return{packageJson:await iTn({...n,cwd:JTa.dirname(t)}),path:t}}var oTn=ct(()=>{xJn();lTn()});import{fileURLToPath as TTa}from"url";import DTa from"path";async function o_(){if(lwe)return lwe;let n=await sTn({cwd:UTa});if(n)return lwe=n.packageJson,lwe}var OTa,UTa,lwe,swe=ct(()=>{"use strict";oTn();OTa=TTa(import.meta.url),UTa=DTa.dirname(OTa)});var cTn={};po(cTn,{getCliVersion:()=>b4});async function b4(){let n=await o_();return"1.0.322"}var c_=ct(()=>{"use strict";swe();});var d7n=ve((XGl,I7n)=>{"use strict";var S6=class n extends Error{constructor(t,r,a){super("[ParserError] "+t,r,a),this.name="ParserError",this.code="ParserError",Error.captureStackTrace&&Error.captureStackTrace(this,n)}},Ewe=class{constructor(t){this.parser=t,this.buf="",this.returned=null,this.result=null,this.resultTable=null,this.resultArr=null}},qoe=class{constructor(){this.pos=0,this.col=0,this.line=0,this.obj={},this.ctx=this.obj,this.stack=[],this._buf="",this.char=null,this.ii=0,this.state=new Ewe(this.parseStart)}parse(t){if(t.length===0||t.length==null)return;this._buf=String(t),this.ii=-1,this.char=-1;let r;for(;r===!1||this.nextChar();)r=this.runOne();this._buf=null}nextChar(){return this.char===10&&(++this.line,this.col=-1),++this.ii,this.char=this._buf.codePointAt(this.ii),++this.pos,++this.col,this.haveBuffer()}haveBuffer(){return this.ii<this._buf.length}runOne(){return this.state.parser.call(this,this.state.returned)}finish(){this.char=1114112;let t;do t=this.state.parser,this.runOne();while(this.state.parser!==t);return this.ctx=null,this.state=null,this._buf=null,this.obj}next(t){if(typeof t!="function")throw new S6("Tried to set state to non-existent state: "+JSON.stringify(t));this.state.parser=t}goto(t){return this.next(t),this.runOne()}call(t,r){r&&this.next(r),this.stack.push(this.state),this.state=new Ewe(t)}callNow(t,r){return this.call(t,r),this.runOne()}return(t){if(this.stack.length===0)throw this.error(new S6("Stack underflow"));t===void 0&&(t=this.state.buf),this.state=this.stack.pop(),this.state.returned=t}returnNow(t){return this.return(t),this.runOne()}consume(){if(this.char===1114112)throw this.error(new S6("Unexpected end-of-buffer"));this.state.buf+=this._buf[this.ii]}error(t){return t.line=this.line,t.col=this.col,t.pos=this.pos,t}parseStart(){throw new S6("Must declare a parseStart method")}};qoe.END=1114112;qoe.Error=S6;I7n.exports=qoe});var m7n=ve((kGl,h7n)=>{"use strict";h7n.exports=n=>{let t=new Date(n);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}});var Rwe=ve((LGl,p7n)=>{"use strict";p7n.exports=(n,t)=>{for(t=String(t);t.length<n;)t="0"+t;return t}});var f7n=ve((SGl,b7n)=>{"use strict";var F_=Rwe(),Cpt=class extends Date{constructor(t){super(t+"Z"),this.isFloating=!0}toISOString(){let t=`${this.getUTCFullYear()}-${F_(2,this.getUTCMonth()+1)}-${F_(2,this.getUTCDate())}`,r=`${F_(2,this.getUTCHours())}:${F_(2,this.getUTCMinutes())}:${F_(2,this.getUTCSeconds())}.${F_(3,this.getUTCMilliseconds())}`;return`${t}T${r}`}};b7n.exports=n=>{let t=new Cpt(n);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}});var v7n=ve((BGl,g7n)=>{"use strict";var G7n=Rwe(),VOa=global.Date,Ypt=class extends VOa{constructor(t){super(t),this.isDate=!0}toISOString(){return`${this.getUTCFullYear()}-${G7n(2,this.getUTCMonth()+1)}-${G7n(2,this.getUTCDate())}`}};g7n.exports=n=>{let t=new Ypt(n);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}});var N7n=ve((JGl,Z7n)=>{"use strict";var wwe=Rwe(),xpt=class extends Date{constructor(t){super(`0000-01-01T${t}Z`),this.isTime=!0}toISOString(){return`${wwe(2,this.getUTCHours())}:${wwe(2,this.getUTCMinutes())}:${wwe(2,this.getUTCSeconds())}.${wwe(3,this.getUTCMilliseconds())}`}};Z7n.exports=n=>{let t=new xpt(n);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}});var Cwe=ve((exports,module)=>{"use strict";module.exports=makeParserClass(d7n());module.exports.makeParserClass=makeParserClass;var TomlError=class n extends Error{constructor(t){super(t),this.name="TomlError",Error.captureStackTrace&&Error.captureStackTrace(this,n),this.fromTOML=!0,this.wrapped=null}};TomlError.wrap=n=>{let t=new TomlError(n.message);return t.code=n.code,t.wrapped=n,t};module.exports.TomlError=TomlError;var createDateTime=m7n(),createDateTimeFloat=f7n(),createDate=v7n(),createTime=N7n(),CTRL_I=9,CTRL_J=10,CTRL_M=13,CTRL_CHAR_BOUNDARY=31,CHAR_SP=32,CHAR_QUOT=34,CHAR_NUM=35,CHAR_APOS=39,CHAR_PLUS=43,CHAR_COMMA=44,CHAR_HYPHEN=45,CHAR_PERIOD=46,CHAR_0=48,CHAR_1=49,CHAR_7=55,CHAR_9=57,CHAR_COLON=58,CHAR_EQUALS=61,CHAR_A=65,CHAR_E=69,CHAR_F=70,CHAR_T=84,CHAR_U=85,CHAR_Z=90,CHAR_LOWBAR=95,CHAR_a=97,CHAR_b=98,CHAR_e=101,CHAR_f=102,CHAR_i=105,CHAR_l=108,CHAR_n=110,CHAR_o=111,CHAR_r=114,CHAR_s=115,CHAR_t=116,CHAR_u=117,CHAR_x=120,CHAR_z=122,CHAR_LCUB=123,CHAR_RCUB=125,CHAR_LSQB=91,CHAR_BSOL=92,CHAR_RSQB=93,CHAR_DEL=127,SURROGATE_FIRST=55296,SURROGATE_LAST=57343,escapes={[CHAR_b]:"\b",[CHAR_t]:" ",[CHAR_n]:`
4337
+ `);let t=0;for(;n[t]&&n[t].trim().match(/^(#|$)/);)t++;let r=n.length,a=t+1;for(;a<r&&n[a].trim();)a++;return n.slice(t,a).join(" ").trim()}});var T8n=ve((Xdl,pTa)=>{pTa.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var M8n=ve((kdl,U8n)=>{var bTa=fdt(),fTa=Gdt(),GTa=y8n(),iwe=S8n(),gTa=vt("node:module"),vTa=["dependencies","devDependencies","optionalDependencies"],ZTa=J8n(),qmt=vt("url"),zx=T8n(),D8n=n=>n.includes("@")&&n.indexOf("@")<n.lastIndexOf(".");U8n.exports={warn:function(){},fixRepositoryField:function(n){if(n.repositories&&(this.warn("repositories"),n.repository=n.repositories[0]),!n.repository)return this.warn("missingRepository");typeof n.repository=="string"&&(n.repository={type:"git",url:n.repository});var t=n.repository.url||"";if(t){var r=iwe.fromUrl(t);r&&(t=n.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}t.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",t)},fixTypos:function(n){Object.keys(zx.topLevel).forEach(function(t){Object.prototype.hasOwnProperty.call(n,t)&&this.warn("typo",t,zx.topLevel[t])},this)},fixScriptsField:function(n){if(n.scripts){if(typeof n.scripts!="object"){this.warn("nonObjectScripts"),delete n.scripts;return}Object.keys(n.scripts).forEach(function(t){typeof n.scripts[t]!="string"?(this.warn("nonStringScript"),delete n.scripts[t]):zx.script[t]&&!n.scripts[zx.script[t]]&&this.warn("typo",t,zx.script[t],"scripts")},this)}},fixFilesField:function(n){var t=n.files;t&&!Array.isArray(t)?(this.warn("nonArrayFiles"),delete n.files):n.files&&(n.files=n.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(n){if(n.bin&&typeof n.bin=="string"){var t={},r;(r=n.name.match(/^@[^/]+[/](.*)$/))?t[r[1]]=n.bin:t[n.name]=n.bin,n.bin=t}},fixManField:function(n){n.man&&typeof n.man=="string"&&(n.man=[n.man])},fixBundleDependenciesField:function(n){var t="bundledDependencies",r="bundleDependencies";n[t]&&!n[r]&&(n[r]=n[t],delete n[t]),n[r]&&!Array.isArray(n[r])?(this.warn("nonArrayBundleDependencies"),delete n[r]):n[r]&&(n[r]=n[r].filter(function(a){return!a||typeof a!="string"?(this.warn("nonStringBundleDependency",a),!1):(n.dependencies||(n.dependencies={}),Object.prototype.hasOwnProperty.call(n.dependencies,a)||(this.warn("nonDependencyBundleDependency",a),n.dependencies[a]="*"),!0)},this))},fixDependencies:function(n){wTa(n,this.warn),ETa(n,this.warn),this.fixBundleDependenciesField(n),["dependencies","devDependencies"].forEach(function(t){if(t in n){if(!n[t]||typeof n[t]!="object"){this.warn("nonObjectDependencies",t),delete n[t];return}Object.keys(n[t]).forEach(function(r){var a=n[t][r];typeof a!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(a)),delete n[t][r]);var i=iwe.fromUrl(n[t][r]);i&&(n[t][r]=i.toString())},this)}},this)},fixModulesField:function(n){n.modules&&(this.warn("deprecatedModules"),delete n.modules)},fixKeywordsField:function(n){typeof n.keywords=="string"&&(n.keywords=n.keywords.split(/,\s+/)),n.keywords&&!Array.isArray(n.keywords)?(delete n.keywords,this.warn("nonArrayKeywords")):n.keywords&&(n.keywords=n.keywords.filter(function(t){return typeof t!="string"||!t?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(n,t){var r=!t;if(!n.version)return n.version="",!0;if(!bTa(n.version,r))throw new Error('Invalid version: "'+n.version+'"');return n.version=fTa(n.version,r),!0},fixPeople:function(n){O8n(n,yTa),O8n(n,FTa)},fixNameField:function(n,t){typeof t=="boolean"?t={strict:t}:typeof t>"u"&&(t={});var r=t.strict;if(!n.name&&!r){n.name="";return}if(typeof n.name!="string")throw new Error("name field must be a string.");r||(n.name=n.name.trim()),WTa(n.name,r,t.allowLegacyCase),gTa.builtinModules.includes(n.name)&&this.warn("conflictingName",n.name)},fixDescriptionField:function(n){n.description&&typeof n.description!="string"&&(this.warn("nonStringDescription"),delete n.description),n.readme&&!n.description&&(n.description=ZTa(n.readme)),n.description===void 0&&delete n.description,n.description||this.warn("missingDescription")},fixReadmeField:function(n){n.readme||(this.warn("missingReadme"),n.readme="ERROR: No README data found!")},fixBugsField:function(n){if(!n.bugs&&n.repository&&n.repository.url){var t=iwe.fromUrl(n.repository.url);t&&t.bugs()&&(n.bugs={url:t.bugs()})}else if(n.bugs){if(typeof n.bugs=="string")D8n(n.bugs)?n.bugs={email:n.bugs}:qmt.parse(n.bugs).protocol?n.bugs={url:n.bugs}:this.warn("nonEmailUrlBugsString");else{CTa(n.bugs,this.warn);var r=n.bugs;n.bugs={},r.url&&(typeof r.url=="string"&&qmt.parse(r.url).protocol?n.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&D8n(r.email)?n.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!n.bugs.email&&!n.bugs.url&&(delete n.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(n){if(!n.homepage&&n.repository&&n.repository.url){var t=iwe.fromUrl(n.repository.url);t&&t.docs()&&(n.homepage=t.docs())}if(n.homepage){if(typeof n.homepage!="string")return this.warn("nonUrlHomepage"),delete n.homepage;qmt.parse(n.homepage).protocol||(n.homepage="http://"+n.homepage)}},fixLicenseField:function(n){let t=n.license||n.licence;if(!t)return this.warn("missingLicense");if(typeof t!="string"||t.length<1||t.trim()==="")return this.warn("invalidLicense");if(!GTa(t).validForNewPackages)return this.warn("invalidLicense")}};function NTa(n){if(n.charAt(0)!=="@")return!1;var t=n.slice(1).split("/");return t.length!==2?!1:t[0]&&t[1]&&t[0]===encodeURIComponent(t[0])&&t[1]===encodeURIComponent(t[1])}function ATa(n){return!n.match(/[/@\s+%:]/)&&n===encodeURIComponent(n)}function WTa(n,t,r){if(n.charAt(0)==="."||!(NTa(n)||ATa(n))||t&&!r&&n!==n.toLowerCase()||n.toLowerCase()==="node_modules"||n.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(n))}function O8n(n,t){return n.author&&(n.author=t(n.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(n[r])&&(n[r]=n[r].map(t))}),n}function yTa(n){if(typeof n=="string")return n;var t=n.name||"",r=n.url||n.web,a=r?" ("+r+")":"",i=n.email||n.mail,s=i?" <"+i+">":"";return t+s+a}function FTa(n){if(typeof n!="string")return n;var t=n.match(/^([^(<]+)/),r=n.match(/\(([^()]+)\)/),a=n.match(/<([^<>]+)>/),i={};return t&&t[0].trim()&&(i.name=t[0].trim()),a&&(i.email=a[1]),r&&(i.url=r[1]),i}function ETa(n){var t=n.optionalDependencies;if(t){var r=n.dependencies||{};Object.keys(t).forEach(function(a){r[a]=t[a]}),n.dependencies=r}}function RTa(n,t,r){if(!n)return{};if(typeof n=="string"&&(n=n.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(n))return n;r("deprecatedArrayDependencies",t);var a={};return n.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var s=i.shift(),e=i.join("");e=e.trim(),e=e.replace(/^@/,""),a[s]=e}),a}function wTa(n,t){vTa.forEach(function(r){n[r]&&(n[r]=RTa(n[r],r,t))})}function CTa(n,t){n&&Object.keys(n).forEach(function(r){zx.bugs[r]&&(t("typo",r,zx.bugs[r],"bugs"),n[zx.bugs[r]]=n[r],delete n[r])})}});var z8n=ve((Ldl,YTa)=>{YTa.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var j8n=ve((Sdl,P8n)=>{var _8n=vt("util"),$mt=z8n();P8n.exports=function(){var n=Array.prototype.slice.call(arguments,0),t=n.shift();if(t==="typo")return xTa.apply(null,n);var r=$mt[t]?$mt[t]:t+": '%s'";return n.unshift(r),_8n.format.apply(null,n)};function xTa(n,t,r){return r&&(n=r+"['"+n+"']",t=r+"['"+t+"']"),_8n.format($mt.typo,n,t)}});var eTn=ve((Bdl,$8n)=>{$8n.exports=K8n;var ept=M8n();K8n.fixer=ept;var VTa=j8n(),QTa=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],HTa=["dependencies","people","typos"],tpt=QTa.map(function(n){return q8n(n)+"Field"});tpt=tpt.concat(HTa);function K8n(n,t,r){t===!0&&(t=null,r=!0),r||(r=!1),(!t||n.private)&&(t=function(){}),n.scripts&&n.scripts.install==="node-gyp rebuild"&&!n.scripts.preinstall&&(n.gypfile=!0),ept.warn=function(){t(VTa.apply(null,arguments))},tpt.forEach(function(a){ept["fix"+q8n(a)](n,r)}),n._id=n.name+"@"+n.version}function q8n(n){return n.charAt(0).toUpperCase()+n.slice(1)}});var tTn=ct(()=>{});import{fileURLToPath as XTa}from"node:url";function nTn(n){return n instanceof URL?XTa(n):n}var rTn=ct(()=>{tTn()});import kTa from"node:fs/promises";import LTa from"node:path";async function iTn({cwd:n,normalize:t=!0}={}){let r=await kTa.readFile(STa(n),"utf8");return BTa(r,t)}var aTn,STa,BTa,lTn=ct(()=>{i8n();aTn=Qt(eTn(),1);rTn();STa=n=>LTa.resolve(nTn(n)??".","package.json"),BTa=(n,t)=>{let r=typeof n=="string"?Jmt(n):n;return t&&(0,aTn.default)(r),r}});import JTa from"node:path";async function sTn(n){let t=await YJn("package.json",n);if(t)return{packageJson:await iTn({...n,cwd:JTa.dirname(t)}),path:t}}var oTn=ct(()=>{xJn();lTn()});import{fileURLToPath as TTa}from"url";import DTa from"path";async function o_(){if(lwe)return lwe;let n=await sTn({cwd:UTa});if(n)return lwe=n.packageJson,lwe}var OTa,UTa,lwe,swe=ct(()=>{"use strict";oTn();OTa=TTa(import.meta.url),UTa=DTa.dirname(OTa)});var cTn={};po(cTn,{getCliVersion:()=>b4});async function b4(){let n=await o_();return"1.0.323"}var c_=ct(()=>{"use strict";swe();});var d7n=ve((XGl,I7n)=>{"use strict";var S6=class n extends Error{constructor(t,r,a){super("[ParserError] "+t,r,a),this.name="ParserError",this.code="ParserError",Error.captureStackTrace&&Error.captureStackTrace(this,n)}},Ewe=class{constructor(t){this.parser=t,this.buf="",this.returned=null,this.result=null,this.resultTable=null,this.resultArr=null}},qoe=class{constructor(){this.pos=0,this.col=0,this.line=0,this.obj={},this.ctx=this.obj,this.stack=[],this._buf="",this.char=null,this.ii=0,this.state=new Ewe(this.parseStart)}parse(t){if(t.length===0||t.length==null)return;this._buf=String(t),this.ii=-1,this.char=-1;let r;for(;r===!1||this.nextChar();)r=this.runOne();this._buf=null}nextChar(){return this.char===10&&(++this.line,this.col=-1),++this.ii,this.char=this._buf.codePointAt(this.ii),++this.pos,++this.col,this.haveBuffer()}haveBuffer(){return this.ii<this._buf.length}runOne(){return this.state.parser.call(this,this.state.returned)}finish(){this.char=1114112;let t;do t=this.state.parser,this.runOne();while(this.state.parser!==t);return this.ctx=null,this.state=null,this._buf=null,this.obj}next(t){if(typeof t!="function")throw new S6("Tried to set state to non-existent state: "+JSON.stringify(t));this.state.parser=t}goto(t){return this.next(t),this.runOne()}call(t,r){r&&this.next(r),this.stack.push(this.state),this.state=new Ewe(t)}callNow(t,r){return this.call(t,r),this.runOne()}return(t){if(this.stack.length===0)throw this.error(new S6("Stack underflow"));t===void 0&&(t=this.state.buf),this.state=this.stack.pop(),this.state.returned=t}returnNow(t){return this.return(t),this.runOne()}consume(){if(this.char===1114112)throw this.error(new S6("Unexpected end-of-buffer"));this.state.buf+=this._buf[this.ii]}error(t){return t.line=this.line,t.col=this.col,t.pos=this.pos,t}parseStart(){throw new S6("Must declare a parseStart method")}};qoe.END=1114112;qoe.Error=S6;I7n.exports=qoe});var m7n=ve((kGl,h7n)=>{"use strict";h7n.exports=n=>{let t=new Date(n);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}});var Rwe=ve((LGl,p7n)=>{"use strict";p7n.exports=(n,t)=>{for(t=String(t);t.length<n;)t="0"+t;return t}});var f7n=ve((SGl,b7n)=>{"use strict";var F_=Rwe(),Cpt=class extends Date{constructor(t){super(t+"Z"),this.isFloating=!0}toISOString(){let t=`${this.getUTCFullYear()}-${F_(2,this.getUTCMonth()+1)}-${F_(2,this.getUTCDate())}`,r=`${F_(2,this.getUTCHours())}:${F_(2,this.getUTCMinutes())}:${F_(2,this.getUTCSeconds())}.${F_(3,this.getUTCMilliseconds())}`;return`${t}T${r}`}};b7n.exports=n=>{let t=new Cpt(n);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}});var v7n=ve((BGl,g7n)=>{"use strict";var G7n=Rwe(),VOa=global.Date,Ypt=class extends VOa{constructor(t){super(t),this.isDate=!0}toISOString(){return`${this.getUTCFullYear()}-${G7n(2,this.getUTCMonth()+1)}-${G7n(2,this.getUTCDate())}`}};g7n.exports=n=>{let t=new Ypt(n);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}});var N7n=ve((JGl,Z7n)=>{"use strict";var wwe=Rwe(),xpt=class extends Date{constructor(t){super(`0000-01-01T${t}Z`),this.isTime=!0}toISOString(){return`${wwe(2,this.getUTCHours())}:${wwe(2,this.getUTCMinutes())}:${wwe(2,this.getUTCSeconds())}.${wwe(3,this.getUTCMilliseconds())}`}};Z7n.exports=n=>{let t=new xpt(n);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}});var Cwe=ve((exports,module)=>{"use strict";module.exports=makeParserClass(d7n());module.exports.makeParserClass=makeParserClass;var TomlError=class n extends Error{constructor(t){super(t),this.name="TomlError",Error.captureStackTrace&&Error.captureStackTrace(this,n),this.fromTOML=!0,this.wrapped=null}};TomlError.wrap=n=>{let t=new TomlError(n.message);return t.code=n.code,t.wrapped=n,t};module.exports.TomlError=TomlError;var createDateTime=m7n(),createDateTimeFloat=f7n(),createDate=v7n(),createTime=N7n(),CTRL_I=9,CTRL_J=10,CTRL_M=13,CTRL_CHAR_BOUNDARY=31,CHAR_SP=32,CHAR_QUOT=34,CHAR_NUM=35,CHAR_APOS=39,CHAR_PLUS=43,CHAR_COMMA=44,CHAR_HYPHEN=45,CHAR_PERIOD=46,CHAR_0=48,CHAR_1=49,CHAR_7=55,CHAR_9=57,CHAR_COLON=58,CHAR_EQUALS=61,CHAR_A=65,CHAR_E=69,CHAR_F=70,CHAR_T=84,CHAR_U=85,CHAR_Z=90,CHAR_LOWBAR=95,CHAR_a=97,CHAR_b=98,CHAR_e=101,CHAR_f=102,CHAR_i=105,CHAR_l=108,CHAR_n=110,CHAR_o=111,CHAR_r=114,CHAR_s=115,CHAR_t=116,CHAR_u=117,CHAR_x=120,CHAR_z=122,CHAR_LCUB=123,CHAR_RCUB=125,CHAR_LSQB=91,CHAR_BSOL=92,CHAR_RSQB=93,CHAR_DEL=127,SURROGATE_FIRST=55296,SURROGATE_LAST=57343,escapes={[CHAR_b]:"\b",[CHAR_t]:" ",[CHAR_n]:`
4338
4338
  `,[CHAR_f]:"\f",[CHAR_r]:"\r",[CHAR_QUOT]:'"',[CHAR_BSOL]:"\\"};function isDigit(n){return n>=CHAR_0&&n<=CHAR_9}function isHexit(n){return n>=CHAR_A&&n<=CHAR_F||n>=CHAR_a&&n<=CHAR_f||n>=CHAR_0&&n<=CHAR_9}function isBit(n){return n===CHAR_1||n===CHAR_0}function isOctit(n){return n>=CHAR_0&&n<=CHAR_7}function isAlphaNumQuoteHyphen(n){return n>=CHAR_A&&n<=CHAR_Z||n>=CHAR_a&&n<=CHAR_z||n>=CHAR_0&&n<=CHAR_9||n===CHAR_APOS||n===CHAR_QUOT||n===CHAR_LOWBAR||n===CHAR_HYPHEN}function isAlphaNumHyphen(n){return n>=CHAR_A&&n<=CHAR_Z||n>=CHAR_a&&n<=CHAR_z||n>=CHAR_0&&n<=CHAR_9||n===CHAR_LOWBAR||n===CHAR_HYPHEN}var _type=Symbol("type"),_declared=Symbol("declared"),hasOwnProperty=Object.prototype.hasOwnProperty,defineProperty=Object.defineProperty,descriptor={configurable:!0,enumerable:!0,writable:!0,value:void 0};function hasKey(n,t){return hasOwnProperty.call(n,t)?!0:(t==="__proto__"&&defineProperty(n,"__proto__",descriptor),!1)}var INLINE_TABLE=Symbol("inline-table");function InlineTable(){return Object.defineProperties({},{[_type]:{value:INLINE_TABLE}})}function isInlineTable(n){return n===null||typeof n!="object"?!1:n[_type]===INLINE_TABLE}var TABLE=Symbol("table");function Table(){return Object.defineProperties({},{[_type]:{value:TABLE},[_declared]:{value:!1,writable:!0}})}function isTable(n){return n===null||typeof n!="object"?!1:n[_type]===TABLE}var _contentType=Symbol("content-type"),INLINE_LIST=Symbol("inline-list");function InlineList(n){return Object.defineProperties([],{[_type]:{value:INLINE_LIST},[_contentType]:{value:n}})}function isInlineList(n){return n===null||typeof n!="object"?!1:n[_type]===INLINE_LIST}var LIST=Symbol("list");function List(){return Object.defineProperties([],{[_type]:{value:LIST}})}function isList(n){return n===null||typeof n!="object"?!1:n[_type]===LIST}var _custom;try{let utilInspect=eval("require('util').inspect");_custom=utilInspect.custom}catch(n){}var _inspect=_custom||"inspect",BoxedBigInt=class{constructor(t){try{this.value=global.BigInt.asIntN(64,t)}catch{this.value=null}Object.defineProperty(this,_type,{value:INTEGER})}isNaN(){return this.value===null}toString(){return String(this.value)}[_inspect](){return`[BigInt: ${this.toString()}]}`}valueOf(){return this.value}},INTEGER=Symbol("integer");function Integer(n){let t=Number(n);return Object.is(t,-0)&&(t=0),global.BigInt&&!Number.isSafeInteger(t)?new BoxedBigInt(n):Object.defineProperties(new Number(t),{isNaN:{value:function(){return isNaN(this)}},[_type]:{value:INTEGER},[_inspect]:{value:()=>`[Integer: ${n}]`}})}function isInteger(n){return n===null||typeof n!="object"?!1:n[_type]===INTEGER}var FLOAT=Symbol("float");function Float(n){return Object.defineProperties(new Number(n),{[_type]:{value:FLOAT},[_inspect]:{value:()=>`[Float: ${n}]`}})}function isFloat(n){return n===null||typeof n!="object"?!1:n[_type]===FLOAT}function tomlType(n){let t=typeof n;if(t==="object"){if(n===null)return"null";if(n instanceof Date)return"datetime";if(_type in n)switch(n[_type]){case INLINE_TABLE:return"inline-table";case INLINE_LIST:return"inline-list";case TABLE:return"table";case LIST:return"list";case FLOAT:return"float";case INTEGER:return"integer"}}return t}function makeParserClass(n){class t extends n{constructor(){super(),this.ctx=this.obj=Table()}atEndOfWord(){return this.char===CHAR_NUM||this.char===CTRL_I||this.char===CHAR_SP||this.atEndOfLine()}atEndOfLine(){return this.char===n.END||this.char===CTRL_J||this.char===CTRL_M}parseStart(){if(this.char===n.END)return null;if(this.char===CHAR_LSQB)return this.call(this.parseTableOrList);if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(isAlphaNumQuoteHyphen(this.char))return this.callNow(this.parseAssignStatement);throw this.error(new TomlError(`Unknown character "${this.char}"`))}parseWhitespaceToEOL(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(this.char===CHAR_NUM)return this.goto(this.parseComment);if(this.char===n.END||this.char===CTRL_J)return this.return();throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"))}parseAssignStatement(){return this.callNow(this.parseAssign,this.recordAssignStatement)}recordAssignStatement(a){let i=this.ctx,s=a.key.pop();for(let e of a.key){if(hasKey(i,e)&&(!isTable(i[e])||i[e][_declared]))throw this.error(new TomlError("Can't redefine existing key"));i=i[e]=i[e]||Table()}if(hasKey(i,s))throw this.error(new TomlError("Can't redefine existing key"));return isInteger(a.value)||isFloat(a.value)?i[s]=a.value.valueOf():i[s]=a.value,this.goto(this.parseWhitespaceToEOL)}parseAssign(){return this.callNow(this.parseKeyword,this.recordAssignKeyword)}recordAssignKeyword(a){return this.state.resultTable?this.state.resultTable.push(a):this.state.resultTable=[a],this.goto(this.parseAssignKeywordPreDot)}parseAssignKeywordPreDot(){if(this.char===CHAR_PERIOD)return this.next(this.parseAssignKeywordPostDot);if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.goto(this.parseAssignEqual)}parseAssignKeywordPostDot(){if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.callNow(this.parseKeyword,this.recordAssignKeyword)}parseAssignEqual(){if(this.char===CHAR_EQUALS)return this.next(this.parseAssignPreValue);throw this.error(new TomlError('Invalid character, expected "="'))}parseAssignPreValue(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseValue,this.recordAssignValue)}recordAssignValue(a){return this.returnNow({key:this.state.resultTable,value:a})}parseComment(){do if(this.char===n.END||this.char===CTRL_J)return this.return();while(this.nextChar())}parseTableOrList(){if(this.char===CHAR_LSQB)this.next(this.parseList);else return this.goto(this.parseTable)}parseTable(){return this.ctx=this.obj,this.goto(this.parseTableNext)}parseTableNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseTableMore)}parseTableMore(a){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,a)&&(!isTable(this.ctx[a])||this.ctx[a][_declared]))throw this.error(new TomlError("Can't redefine existing key"));return this.ctx=this.ctx[a]=this.ctx[a]||Table(),this.ctx[_declared]=!0,this.next(this.parseWhitespaceToEOL)}else if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,a))this.ctx=this.ctx[a]=Table();else if(isTable(this.ctx[a]))this.ctx=this.ctx[a];else if(isList(this.ctx[a]))this.ctx=this.ctx[a][this.ctx[a].length-1];else throw this.error(new TomlError("Can't redefine existing key"));return this.next(this.parseTableNext)}else throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseList(){return this.ctx=this.obj,this.goto(this.parseListNext)}parseListNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseListMore)}parseListMore(a){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,a)||(this.ctx[a]=List()),isInlineList(this.ctx[a]))throw this.error(new TomlError("Can't extend an inline array"));if(isList(this.ctx[a])){let i=Table();this.ctx[a].push(i),this.ctx=i}else throw this.error(new TomlError("Can't redefine an existing key"));return this.next(this.parseListEnd)}else if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,a))this.ctx=this.ctx[a]=Table();else{if(isInlineList(this.ctx[a]))throw this.error(new TomlError("Can't extend an inline array"));if(isInlineTable(this.ctx[a]))throw this.error(new TomlError("Can't extend an inline table"));if(isList(this.ctx[a]))this.ctx=this.ctx[a][this.ctx[a].length-1];else if(isTable(this.ctx[a]))this.ctx=this.ctx[a];else throw this.error(new TomlError("Can't redefine an existing key"))}return this.next(this.parseListNext)}else throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseListEnd(a){if(this.char===CHAR_RSQB)return this.next(this.parseWhitespaceToEOL);throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseValue(){if(this.char===n.END)throw this.error(new TomlError("Key without value"));if(this.char===CHAR_QUOT)return this.next(this.parseDoubleString);if(this.char===CHAR_APOS)return this.next(this.parseSingleString);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)return this.goto(this.parseNumberSign);if(this.char===CHAR_i)return this.next(this.parseInf);if(this.char===CHAR_n)return this.next(this.parseNan);if(isDigit(this.char))return this.goto(this.parseNumberOrDateTime);if(this.char===CHAR_t||this.char===CHAR_f)return this.goto(this.parseBoolean);if(this.char===CHAR_LSQB)return this.call(this.parseInlineList,this.recordValue);if(this.char===CHAR_LCUB)return this.call(this.parseInlineTable,this.recordValue);throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"))}recordValue(a){return this.returnNow(a)}parseInf(){if(this.char===CHAR_n)return this.next(this.parseInf2);throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'))}parseInf2(){if(this.char===CHAR_f)return this.state.buf==="-"?this.return(-1/0):this.return(1/0);throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'))}parseNan(){if(this.char===CHAR_a)return this.next(this.parseNan2);throw this.error(new TomlError('Unexpected character, expected "nan"'))}parseNan2(){if(this.char===CHAR_n)return this.return(NaN);throw this.error(new TomlError('Unexpected character, expected "nan"'))}parseKeyword(){return this.char===CHAR_QUOT?this.next(this.parseBasicString):this.char===CHAR_APOS?this.next(this.parseLiteralString):this.goto(this.parseBareKey)}parseBareKey(){do{if(this.char===n.END)throw this.error(new TomlError("Key ended without value"));if(isAlphaNumHyphen(this.char))this.consume();else{if(this.state.buf.length===0)throw this.error(new TomlError("Empty bare keys are not allowed"));return this.returnNow()}}while(this.nextChar())}parseSingleString(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiStringMaybe):this.goto(this.parseLiteralString)}parseLiteralString(){do{if(this.char===CHAR_APOS)return this.return();if(this.atEndOfLine())throw this.error(new TomlError("Unterminated string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}parseLiteralMultiStringMaybe(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiString):this.returnNow()}parseLiteralMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseLiteralMultiStringContent):this.goto(this.parseLiteralMultiStringContent)}parseLiteralMultiStringContent(){do{if(this.char===CHAR_APOS)return this.next(this.parseLiteralMultiEnd);if(this.char===n.END)throw this.error(new TomlError("Unterminated multi-line string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}parseLiteralMultiEnd(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiEnd2):(this.state.buf+="'",this.goto(this.parseLiteralMultiStringContent))}parseLiteralMultiEnd2(){return this.char===CHAR_APOS?this.return():(this.state.buf+="''",this.goto(this.parseLiteralMultiStringContent))}parseDoubleString(){return this.char===CHAR_QUOT?this.next(this.parseMultiStringMaybe):this.goto(this.parseBasicString)}parseBasicString(){do{if(this.char===CHAR_BSOL)return this.call(this.parseEscape,this.recordEscapeReplacement);if(this.char===CHAR_QUOT)return this.return();if(this.atEndOfLine())throw this.error(new TomlError("Unterminated string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}recordEscapeReplacement(a){return this.state.buf+=a,this.goto(this.parseBasicString)}parseMultiStringMaybe(){return this.char===CHAR_QUOT?this.next(this.parseMultiString):this.returnNow()}parseMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseMultiStringContent):this.goto(this.parseMultiStringContent)}parseMultiStringContent(){do{if(this.char===CHAR_BSOL)return this.call(this.parseMultiEscape,this.recordMultiEscapeReplacement);if(this.char===CHAR_QUOT)return this.next(this.parseMultiEnd);if(this.char===n.END)throw this.error(new TomlError("Unterminated multi-line string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}errorControlCharInString(){let a="\\u00";return this.char<16&&(a+="0"),a+=this.char.toString(16),this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${a} instead`))}recordMultiEscapeReplacement(a){return this.state.buf+=a,this.goto(this.parseMultiStringContent)}parseMultiEnd(){return this.char===CHAR_QUOT?this.next(this.parseMultiEnd2):(this.state.buf+='"',this.goto(this.parseMultiStringContent))}parseMultiEnd2(){return this.char===CHAR_QUOT?this.return():(this.state.buf+='""',this.goto(this.parseMultiStringContent))}parseMultiEscape(){return this.char===CTRL_M||this.char===CTRL_J?this.next(this.parseMultiTrim):this.char===CHAR_SP||this.char===CTRL_I?this.next(this.parsePreMultiTrim):this.goto(this.parseEscape)}parsePreMultiTrim(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CTRL_M||this.char===CTRL_J)return this.next(this.parseMultiTrim);throw this.error(new TomlError("Can't escape whitespace"))}parseMultiTrim(){return this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M?null:this.returnNow()}parseEscape(){if(this.char in escapes)return this.return(escapes[this.char]);if(this.char===CHAR_u)return this.call(this.parseSmallUnicode,this.parseUnicodeReturn);if(this.char===CHAR_U)return this.call(this.parseLargeUnicode,this.parseUnicodeReturn);throw this.error(new TomlError("Unknown escape character: "+this.char))}parseUnicodeReturn(a){try{let i=parseInt(a,16);if(i>=SURROGATE_FIRST&&i<=SURROGATE_LAST)throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));return this.returnNow(String.fromCodePoint(i))}catch(i){throw this.error(TomlError.wrap(i))}}parseSmallUnicode(){if(isHexit(this.char)){if(this.consume(),this.state.buf.length>=4)return this.return()}else throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"))}parseLargeUnicode(){if(isHexit(this.char)){if(this.consume(),this.state.buf.length>=8)return this.return()}else throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"))}parseNumberSign(){return this.consume(),this.next(this.parseMaybeSignedInfOrNan)}parseMaybeSignedInfOrNan(){return this.char===CHAR_i?this.next(this.parseInf):this.char===CHAR_n?this.next(this.parseNan):this.callNow(this.parseNoUnder,this.parseNumberIntegerStart)}parseNumberIntegerStart(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberIntegerExponentOrDecimal)):this.goto(this.parseNumberInteger)}parseNumberIntegerExponentOrDecimal(){return this.char===CHAR_PERIOD?(this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat)):this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.returnNow(Integer(this.state.buf))}parseNumberInteger(){if(isDigit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder);if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);if(this.char===CHAR_PERIOD)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);{let a=Integer(this.state.buf);if(a.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(a)}}}parseNoUnder(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD||this.char===CHAR_E||this.char===CHAR_e)throw this.error(new TomlError("Unexpected character, expected digit"));if(this.atEndOfWord())throw this.error(new TomlError("Incomplete number"));return this.returnNow()}parseNoUnderHexOctBinLiteral(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD)throw this.error(new TomlError("Unexpected character, expected digit"));if(this.atEndOfWord())throw this.error(new TomlError("Incomplete number"));return this.returnNow()}parseNumberFloat(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberFloat);if(isDigit(this.char))this.consume();else return this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.returnNow(Float(this.state.buf))}parseNumberExponentSign(){if(isDigit(this.char))return this.goto(this.parseNumberExponent);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.call(this.parseNoUnder,this.parseNumberExponent);else throw this.error(new TomlError("Unexpected character, expected -, + or digit"))}parseNumberExponent(){if(isDigit(this.char))this.consume();else return this.char===CHAR_LOWBAR?this.call(this.parseNoUnder):this.returnNow(Float(this.state.buf))}parseNumberOrDateTime(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberBaseOrDateTime)):this.goto(this.parseNumberOrDateTimeOnly)}parseNumberOrDateTimeOnly(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberInteger);if(isDigit(this.char))this.consume(),this.state.buf.length>4&&this.next(this.parseNumberInteger);else return this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.char===CHAR_PERIOD?(this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat)):this.char===CHAR_HYPHEN?this.goto(this.parseDateTime):this.char===CHAR_COLON?this.goto(this.parseOnlyTimeHour):this.returnNow(Integer(this.state.buf))}parseDateTimeOnly(){if(this.state.buf.length<4){if(isDigit(this.char))return this.consume();if(this.char===CHAR_COLON)return this.goto(this.parseOnlyTimeHour);throw this.error(new TomlError("Expected digit while parsing year part of a date"))}else{if(this.char===CHAR_HYPHEN)return this.goto(this.parseDateTime);throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"))}}parseNumberBaseOrDateTime(){return this.char===CHAR_b?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerBin)):this.char===CHAR_o?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerOct)):this.char===CHAR_x?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerHex)):this.char===CHAR_PERIOD?this.goto(this.parseNumberInteger):isDigit(this.char)?this.goto(this.parseDateTimeOnly):this.returnNow(Integer(this.state.buf))}parseIntegerHex(){if(isHexit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{let a=Integer(this.state.buf);if(a.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(a)}}}parseIntegerOct(){if(isOctit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{let a=Integer(this.state.buf);if(a.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(a)}}}parseIntegerBin(){if(isBit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{let a=Integer(this.state.buf);if(a.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(a)}}}parseDateTime(){if(this.state.buf.length<4)throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));return this.state.result=this.state.buf,this.state.buf="",this.next(this.parseDateMonth)}parseDateMonth(){if(this.char===CHAR_HYPHEN){if(this.state.buf.length<2)throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));return this.state.result+="-"+this.state.buf,this.state.buf="",this.next(this.parseDateDay)}else if(isDigit(this.char))this.consume();else throw this.error(new TomlError("Incomplete datetime"))}parseDateDay(){if(this.char===CHAR_T||this.char===CHAR_SP){if(this.state.buf.length<2)throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));return this.state.result+="-"+this.state.buf,this.state.buf="",this.next(this.parseStartTimeHour)}else{if(this.atEndOfWord())return this.returnNow(createDate(this.state.result+"-"+this.state.buf));if(isDigit(this.char))this.consume();else throw this.error(new TomlError("Incomplete datetime"))}}parseStartTimeHour(){return this.atEndOfWord()?this.returnNow(createDate(this.state.result)):this.goto(this.parseTimeHour)}parseTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));return this.state.result+="T"+this.state.buf,this.state.buf="",this.next(this.parseTimeMin)}else if(isDigit(this.char))this.consume();else throw this.error(new TomlError("Incomplete datetime"))}parseTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else{if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseTimeSec);throw this.error(new TomlError("Incomplete datetime"))}}parseTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseTimeZoneOrFraction)}else throw this.error(new TomlError("Incomplete datetime"))}parseOnlyTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));return this.state.result=this.state.buf,this.state.buf="",this.next(this.parseOnlyTimeMin)}else throw this.error(new TomlError("Incomplete time"))}parseOnlyTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else{if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseOnlyTimeSec);throw this.error(new TomlError("Incomplete time"))}}parseOnlyTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.next(this.parseOnlyTimeFractionMaybe)}else throw this.error(new TomlError("Incomplete time"))}parseOnlyTimeFractionMaybe(){if(this.state.result+=":"+this.state.buf,this.char===CHAR_PERIOD)this.state.buf="",this.next(this.parseOnlyTimeFraction);else return this.return(createTime(this.state.result))}parseOnlyTimeFraction(){if(isDigit(this.char))this.consume();else if(this.atEndOfWord()){if(this.state.buf.length===0)throw this.error(new TomlError("Expected digit in milliseconds"));return this.returnNow(createTime(this.state.result+"."+this.state.buf))}else throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}parseTimeZoneOrFraction(){if(this.char===CHAR_PERIOD)this.consume(),this.next(this.parseDateTimeFraction);else if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else{if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}}parseDateTimeFraction(){if(isDigit(this.char))this.consume();else{if(this.state.buf.length===1)throw this.error(new TomlError("Expected digit in milliseconds"));if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else{if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}}}parseTimeZoneHour(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.next(this.parseTimeZoneSep)}else throw this.error(new TomlError("Unexpected character in datetime, expected digit"))}parseTimeZoneSep(){if(this.char===CHAR_COLON)this.consume(),this.next(this.parseTimeZoneMin);else throw this.error(new TomlError("Unexpected character in datetime, expected colon"))}parseTimeZoneMin(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.return(createDateTime(this.state.result+this.state.buf))}else throw this.error(new TomlError("Unexpected character in datetime, expected digit"))}parseBoolean(){if(this.char===CHAR_t)return this.consume(),this.next(this.parseTrue_r);if(this.char===CHAR_f)return this.consume(),this.next(this.parseFalse_a)}parseTrue_r(){if(this.char===CHAR_r)return this.consume(),this.next(this.parseTrue_u);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseTrue_u(){if(this.char===CHAR_u)return this.consume(),this.next(this.parseTrue_e);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseTrue_e(){if(this.char===CHAR_e)return this.return(!0);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_a(){if(this.char===CHAR_a)return this.consume(),this.next(this.parseFalse_l);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_l(){if(this.char===CHAR_l)return this.consume(),this.next(this.parseFalse_s);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_s(){if(this.char===CHAR_s)return this.consume(),this.next(this.parseFalse_e);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_e(){if(this.char===CHAR_e)return this.return(!1);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseInlineList(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===n.END)throw this.error(new TomlError("Unterminated inline array"));return this.char===CHAR_NUM?this.call(this.parseComment):this.char===CHAR_RSQB?this.return(this.state.resultArr||InlineList()):this.callNow(this.parseValue,this.recordInlineListValue)}recordInlineListValue(a){if(this.state.resultArr){let i=this.state.resultArr[_contentType],s=tomlType(a);if(i!==s)throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${i} and ${s}`))}else this.state.resultArr=InlineList(tomlType(a));return isFloat(a)||isInteger(a)?this.state.resultArr.push(a.valueOf()):this.state.resultArr.push(a),this.goto(this.parseInlineListNext)}parseInlineListNext(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CHAR_COMMA)return this.next(this.parseInlineList);if(this.char===CHAR_RSQB)return this.goto(this.parseInlineList);throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"))}parseInlineTable(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===n.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError("Unterminated inline array"));return this.char===CHAR_RCUB?this.return(this.state.resultTable||InlineTable()):(this.state.resultTable||(this.state.resultTable=InlineTable()),this.callNow(this.parseAssign,this.recordInlineTableValue))}recordInlineTableValue(a){let i=this.state.resultTable,s=a.key.pop();for(let e of a.key){if(hasKey(i,e)&&(!isTable(i[e])||i[e][_declared]))throw this.error(new TomlError("Can't redefine existing key"));i=i[e]=i[e]||Table()}if(hasKey(i,s))throw this.error(new TomlError("Can't redefine existing key"));return isInteger(a.value)||isFloat(a.value)?i[s]=a.value.valueOf():i[s]=a.value,this.goto(this.parseInlineTableNext)}parseInlineTableNext(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===n.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError("Unterminated inline array"));if(this.char===CHAR_COMMA)return this.next(this.parseInlineTable);if(this.char===CHAR_RCUB)return this.goto(this.parseInlineTable);throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"))}}return t}});var Ywe=ve((TGl,A7n)=>{"use strict";A7n.exports=QOa;function QOa(n,t){if(n.pos==null||n.line==null)return n;let r=n.message;if(r+=` at row ${n.line+1}, col ${n.col+1}, pos ${n.pos}:
4339
4339
  `,t&&t.split){let a=t.split(/\n/),i=String(Math.min(a.length,n.line+3)).length,s=" ";for(;s.length<i;)s+=" ";for(let e=Math.max(0,n.line-1);e<Math.min(a.length,n.line+2);++e){let o=String(e+1);if(o.length<i&&(o=" "+o),n.line===e){r+=o+"> "+a[e]+`
4340
4340
  `,r+=s+" ";for(let u=0;u<n.col;++u)r+=" ";r+=`^
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepv-code",
3
- "version": "1.0.322",
3
+ "version": "1.0.323",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },