evolve-sdk 0.0.7__tar.gz → 0.0.9__tar.gz

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 (36) hide show
  1. {evolve_sdk-0.0.7/evolve_sdk.egg-info → evolve_sdk-0.0.9}/PKG-INFO +1 -1
  2. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/bridge/dist/bridge.bundle.cjs +2 -2
  3. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/__init__.py +1 -1
  4. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9/evolve_sdk.egg-info}/PKG-INFO +1 -1
  5. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/pyproject.toml +1 -1
  6. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/LICENSE +0 -0
  7. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/MANIFEST.in +0 -0
  8. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/README.md +0 -0
  9. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/bridge/__init__.py +0 -0
  10. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/agent.py +0 -0
  11. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/bridge.py +0 -0
  12. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/composio.py +0 -0
  13. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/config.py +0 -0
  14. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/pipeline/__init__.py +0 -0
  15. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/pipeline/pipeline.py +0 -0
  16. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/pipeline/types.py +0 -0
  17. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/prompts/__init__.py +0 -0
  18. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/prompts/agent_md/judge.md +0 -0
  19. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/prompts/agent_md/reduce.md +0 -0
  20. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/prompts/agent_md/verify.md +0 -0
  21. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/prompts/user/judge.md +0 -0
  22. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/prompts/user/retry_feedback.md +0 -0
  23. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/prompts/user/verify.md +0 -0
  24. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/results.py +0 -0
  25. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/retry.py +0 -0
  26. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/schema.py +0 -0
  27. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/swarm/__init__.py +0 -0
  28. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/swarm/results.py +0 -0
  29. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/swarm/swarm.py +0 -0
  30. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/swarm/types.py +0 -0
  31. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve/utils.py +0 -0
  32. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve_sdk.egg-info/SOURCES.txt +0 -0
  33. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve_sdk.egg-info/dependency_links.txt +0 -0
  34. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve_sdk.egg-info/requires.txt +0 -0
  35. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/evolve_sdk.egg-info/top_level.txt +0 -0
  36. {evolve_sdk-0.0.7 → evolve_sdk-0.0.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evolve-sdk
3
- Version: 0.0.7
3
+ Version: 0.0.9
4
4
  Summary: Pythonic SDK for multi-agent orchestration in E2B sandboxes
5
5
  Author-email: "Swarmlink, Inc." <brandomagnani@evolvingmachines.ai>
6
6
  License: Apache-2.0
@@ -560,7 +560,7 @@ to input.params.ContentLength in bytes.
560
560
  \r
561
561
  `+r)}function mC(e,t,r,n,i,s){if(e.listenerCount("wsClientError")){let o=new Error(i);Error.captureStackTrace(o,mC),e.emit("wsClientError",o,r,t)}else HU(r,n,i,s)}});var S1t=y((Sui,b1t)=>{"use strict";var eS=uZ();eS.createWebSocketStream=c1t();eS.Server=y1t();eS.Receiver=dxe();eS.Sender=hxe();eS.WebSocket=eS;eS.WebSocketServer=eS.Server;b1t.exports=eS});var fZ=y((vui,v1t)=>{"use strict";v1t.exports=S1t()});var xxe=y(pZ=>{"use strict";Object.defineProperty(pZ,"__esModule",{value:!0});pZ.PtyHandle=void 0;var qan=(nc(),Nr(rc)),_1t=qan.__importDefault(fZ()),dE=Ud(),Exe=class{ws;handleResize;handleKill;onPty;sessionId;_exitCode;_error;connected=!1;connectionEstablished=!1;constructor(t,r,n,i,s){this.ws=t,this.handleResize=r,this.handleKill=n,this.onPty=i,this.sessionId=s,this.setupWebSocketHandlers()}get exitCode(){return this._exitCode}get error(){return this._error}isConnected(){return this.connected&&this.ws.readyState===_1t.default.OPEN}async waitForConnection(){if(!this.connectionEstablished)return new Promise((t,r)=>{let n=setTimeout(()=>{r(new dE.DaytonaError("PTY connection timeout"))},1e4),i=()=>{this.connectionEstablished?(clearTimeout(n),t()):this.ws.readyState===_1t.default.CLOSED||this._error?(clearTimeout(n),r(new dE.DaytonaError(this._error||"Connection failed"))):setTimeout(i,100)};i()})}async sendInput(t){if(!this.isConnected())throw new dE.DaytonaError("PTY is not connected");try{typeof t=="string"?this.ws.send(new TextEncoder().encode(t)):this.ws.send(t)}catch(r){let n=r instanceof Error?r.message:String(r);throw new dE.DaytonaError(`Failed to send input to PTY: ${n}`)}}async resize(t,r){return await this.handleResize(t,r)}async disconnect(){if(this.ws)try{this.ws.close()}catch{}}async wait(){return new Promise((t,r)=>{if(this._exitCode!==void 0){t({exitCode:this._exitCode,error:this._error});return}let n=()=>{this._exitCode!==void 0?t({exitCode:this._exitCode,error:this._error}):this._error?r(new dE.DaytonaError(this._error)):setTimeout(n,100)};n()})}async kill(){return await this.handleKill()}setupWebSocketHandlers(){"binaryType"in this.ws&&(this.ws.binaryType="arraybuffer");let t=async()=>{this.connected=!0},r=async s=>{try{let o=s&&typeof s=="object"&&"data"in s?s.data:s;if(typeof o=="string"){try{let a=JSON.parse(o);if(a.type==="control"){if(a.status==="connected"){this.connectionEstablished=!0;return}else if(a.status==="error"){this._error=a.error||"Unknown connection error",this.connected=!1;return}}}catch{}this.onPty&&await this.onPty(new TextEncoder().encode(o))}else{let a;if(o instanceof ArrayBuffer)a=new Uint8Array(o);else if(ArrayBuffer.isView(o))a=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);else if(o instanceof Blob){let c=await o.arrayBuffer();a=new Uint8Array(c)}else throw new dE.DaytonaError(`Unsupported message data type: ${Object.prototype.toString.call(o)}`);this.onPty&&await this.onPty(a)}}catch(o){let a=o instanceof Error?o.message:String(o);throw new dE.DaytonaError(`Error handling PTY message: ${a}`)}},n=async s=>{let o;s instanceof Error?o=s.message:s&&s instanceof Event?o="WebSocket connection error":o=String(s),this._error=o,this.connected=!1},i=async s=>{if(this.connected=!1,s&&s.reason)try{let o=JSON.parse(s.reason);typeof o.exitCode=="number"&&(this._exitCode=o.exitCode,o.exitReason&&(this._error=o.exitReason)),o.error&&(this._error=o.error)}catch{s.code===1e3&&(this._exitCode=0)}this._exitCode===void 0&&s&&s.code===1e3&&(this._exitCode=0)};if(this.ws.addEventListener)this.ws.addEventListener("open",t),this.ws.addEventListener("message",r),this.ws.addEventListener("error",n),this.ws.addEventListener("close",i);else if("on"in this.ws&&typeof this.ws.on=="function")this.ws.on("open",t),this.ws.on("message",r),this.ws.on("error",n),this.ws.on("close",i);else throw new dE.DaytonaError("Unsupported WebSocket implementation")}};pZ.PtyHandle=Exe});var wxe=y(Ixe=>{"use strict";Object.defineProperty(Ixe,"__esModule",{value:!0});Ixe.createSandboxWebSocket=$an;var Van=(nc(),Nr(rc)),E1t=Van.__importDefault(fZ()),zk=wB();async function $an(e,t,r){if(zk.RUNTIME===zk.Runtime.BROWSER||zk.RUNTIME===zk.Runtime.DENO||zk.RUNTIME===zk.Runtime.SERVERLESS){let n=await r(),i=e.includes("?")?"&":"?";return new E1t.default(`${e}${i}DAYTONA_SANDBOX_AUTH_KEY=${n}`,`X-Daytona-SDK-Version~${String(t["X-Daytona-SDK-Version"]??"")}`)}return new E1t.default(e,{headers:t})}});var MU=y(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc.Process=Xc.CodeRunParams=Xc.MAX_PREFIX_LEN=Xc.STDERR_PREFIX_BYTES=Xc.STDOUT_PREFIX_BYTES=void 0;var Han=fkt(),Gan=XK(),x1t=require("buffer"),zan=xxe(),I1t=wxe();Xc.STDOUT_PREFIX_BYTES=new Uint8Array([1,1,1]);Xc.STDERR_PREFIX_BYTES=new Uint8Array([2,2,2]);Xc.MAX_PREFIX_LEN=Math.max(Xc.STDOUT_PREFIX_BYTES.length,Xc.STDERR_PREFIX_BYTES.length);var Cxe=class{argv;env};Xc.CodeRunParams=Cxe;var Axe=class{clientConfig;codeToolbox;apiClient;getPreviewToken;ensureToolboxUrl;constructor(t,r,n,i,s){this.clientConfig=t,this.codeToolbox=r,this.apiClient=n,this.getPreviewToken=i,this.ensureToolboxUrl=s}async executeCommand(t,r,n,i){t=`echo '${x1t.Buffer.from(t).toString("base64")}' | base64 -d | sh`,n&&Object.keys(n).length>0&&(t=`${Object.entries(n).map(([l,u])=>{let d=x1t.Buffer.from(u).toString("base64");return`export ${l}=$(echo '${d}' | base64 -d)`}).join(";")+";"} ${t}`),t=`sh -c "${t}"`;let o=await this.apiClient.executeCommand({command:t,timeout:i,cwd:r}),a=Han.ArtifactParser.parseArtifacts(o.data.result);return{exitCode:o.data.exitCode??o.data.code,result:a.stdout,artifacts:a}}async codeRun(t,r,n){let i=this.codeToolbox.getRunCommand(t,r);return this.executeCommand(i,void 0,r?.env,n)}async createSession(t){await this.apiClient.createSession({sessionId:t})}async getSession(t){return(await this.apiClient.getSession(t)).data}async getSessionCommand(t,r){return(await this.apiClient.getSessionCommand(t,r)).data}async executeSessionCommand(t,r,n){let i=await this.apiClient.sessionExecuteCommand(t,r,n?{timeout:n*1e3}:{});if(i.data.output){let s=new TextEncoder().encode(i.data.output),o=w1t(s);return{...i.data,stdout:o.stdout,stderr:o.stderr}}return i.data}async getSessionCommandLogs(t,r,n,i){if(!n&&!i){let a=await this.apiClient.getSessionCommandLogs(t,r);if(a.data){let c=new TextEncoder().encode(a.data||""),l=w1t(c);return{output:a.data,stdout:l.stdout,stderr:l.stderr}}return{output:a.data}}await this.ensureToolboxUrl();let s=`${this.clientConfig.basePath.replace(/^http/,"ws")}/process/session/${t}/command/${r}/logs?follow=true`,o=await(0,I1t.createSandboxWebSocket)(s,this.clientConfig.baseOptions?.headers||{},this.getPreviewToken);await(0,Gan.stdDemuxStream)(o,n,i)}async listSessions(){return(await this.apiClient.listSessions()).data}async deleteSession(t){await this.apiClient.deleteSession(t)}async createPty(t){let r={id:t.id,cwd:t.cwd,envs:t.envs,cols:t.cols,rows:t.rows,lazyStart:!0},n=await this.apiClient.createPtySession(r);return await this.connectPty(n.data.sessionId,t)}async connectPty(t,r){await this.ensureToolboxUrl();let n=`${this.clientConfig.basePath.replace(/^http/,"ws")}/process/pty/${t}/connect`,i=await(0,I1t.createSandboxWebSocket)(n,this.clientConfig.baseOptions?.headers||{},this.getPreviewToken),s=new zan.PtyHandle(i,(o,a)=>this.resizePtySession(t,o,a),()=>this.killPtySession(t),r.onData,t);return await s.waitForConnection(),s}async listPtySessions(){return(await this.apiClient.listPtySessions()).data.sessions}async getPtySessionInfo(t){return(await this.apiClient.getPtySession(t)).data}async killPtySession(t){await this.apiClient.deletePtySession(t)}async resizePtySession(t,r,n){return(await this.apiClient.resizePtySession(t,{cols:r,rows:n})).data}};Xc.Process=Axe;function w1t(e){let[t,r]=jan(e),n=new TextDecoder("utf-8",{fatal:!1}).decode(t),i=new TextDecoder("utf-8",{fatal:!1}).decode(r);return{output:new TextDecoder("utf-8",{fatal:!1}).decode(e),stdout:n,stderr:i}}function jan(e){let t=[],r=[],n="none",i=0;for(;i<e.length;){let s=A1t(e,Xc.STDOUT_PREFIX_BYTES,i),o=A1t(e,Xc.STDERR_PREFIX_BYTES,i),a=-1,c=null,l=0;if(s!==-1&&(o===-1||s<o)?(a=s,c="stdout",l=Xc.STDOUT_PREFIX_BYTES.length):o!==-1&&(a=o,c="stderr",l=Xc.STDERR_PREFIX_BYTES.length),a===-1){n==="stdout"?t.push(e.subarray(i)):n==="stderr"&&r.push(e.subarray(i));break}n==="stdout"&&a>i?t.push(e.subarray(i,a)):n==="stderr"&&a>i&&r.push(e.subarray(i,a)),i=a+l,c&&(n=c)}return[C1t(t),C1t(r)]}function C1t(e){if(e.length===0)return new Uint8Array(0);if(e.length===1)return e[0];let t=e.reduce((i,s)=>i+s.length,0),r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}function A1t(e,t,r=0){if(t.length===0)return 0;if(e.length<t.length||r<0||r>e.length-t.length)return-1;let n=e.length-t.length;for(let i=r;i<=n;i++){let s=0;for(;s<t.length&&e[i+s]===t[s];s++);if(s===t.length)return i}return-1}});var Oxe=y(jk=>{"use strict";Object.defineProperty(jk,"__esModule",{value:!0});jk.LspServer=jk.LspLanguageId=void 0;var hZ;(function(e){e.PYTHON="python",e.TYPESCRIPT="typescript",e.JAVASCRIPT="javascript"})(hZ||(jk.LspLanguageId=hZ={}));var Txe=class{languageId;pathToProject;apiClient;constructor(t,r,n){if(this.languageId=t,this.pathToProject=r,this.apiClient=n,!Object.values(hZ).includes(this.languageId))throw new Error(`Invalid languageId: ${this.languageId}. Supported values are: ${Object.values(hZ).join(", ")}`)}async start(){await this.apiClient.start({languageId:this.languageId,pathToProject:this.pathToProject})}async stop(){await this.apiClient.stop({languageId:this.languageId,pathToProject:this.pathToProject})}async didOpen(t){await this.apiClient.didOpen({languageId:this.languageId,pathToProject:this.pathToProject,uri:"file://"+t})}async didClose(t){await this.apiClient.didClose({languageId:this.languageId,pathToProject:this.pathToProject,uri:"file://"+t})}async documentSymbols(t){return(await this.apiClient.documentSymbols(this.languageId,this.pathToProject,"file://"+t)).data}async workspaceSymbols(t){return await this.sandboxSymbols(t)}async sandboxSymbols(t){return(await this.apiClient.workspaceSymbols(t,this.languageId,this.pathToProject)).data}async completions(t,r){return(await this.apiClient.completions({languageId:this.languageId,pathToProject:this.pathToProject,uri:"file://"+t,position:{line:r.line,character:r.character}})).data}};jk.LspServer=Txe});var Rxe=y(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.ComputerUse=oh.Display=oh.Screenshot=oh.Keyboard=oh.Mouse=void 0;var mZ=class{apiClient;constructor(t){this.apiClient=t}async getPosition(){return(await this.apiClient.getMousePosition()).data}async move(t,r){let n={x:t,y:r};return(await this.apiClient.moveMouse(n)).data}async click(t,r,n="left",i=!1){let s={x:t,y:r,button:n,double:i};return(await this.apiClient.click(s)).data}async drag(t,r,n,i,s="left"){let o={startX:t,startY:r,endX:n,endY:i,button:s};return(await this.apiClient.drag(o)).data}async scroll(t,r,n,i=1){let s={x:t,y:r,direction:n,amount:i};return(await this.apiClient.scroll(s)).data.success}};oh.Mouse=mZ;var gZ=class{apiClient;constructor(t){this.apiClient=t}async type(t,r){let n={text:t,delay:r};await this.apiClient.typeText(n)}async press(t,r=[]){let n={key:t,modifiers:r};await this.apiClient.pressKey(n)}async hotkey(t){let r={keys:t};await this.apiClient.pressHotkey(r)}};oh.Keyboard=gZ;var yZ=class{apiClient;constructor(t){this.apiClient=t}async takeFullScreen(t=!1){return(await this.apiClient.takeScreenshot(t)).data}async takeRegion(t,r=!1){return(await this.apiClient.takeRegionScreenshot(t.height,t.width,t.y,t.x,r)).data}async takeCompressed(t={}){return(await this.apiClient.takeCompressedScreenshot(t.showCursor,t.format,t.quality,t.scale)).data}async takeCompressedRegion(t,r={}){return(await this.apiClient.takeCompressedRegionScreenshot(t.x,t.y,t.width,t.height,r.showCursor,r.format,r.quality,r.scale)).data}};oh.Screenshot=yZ;var bZ=class{apiClient;constructor(t){this.apiClient=t}async getInfo(){return(await this.apiClient.getDisplayInfo()).data}async getWindows(){return(await this.apiClient.getWindows()).data}};oh.Display=bZ;var Pxe=class{apiClient;mouse;keyboard;screenshot;display;constructor(t){this.apiClient=t,this.mouse=new mZ(t),this.keyboard=new gZ(t),this.screenshot=new yZ(t),this.display=new bZ(t)}async start(){return(await this.apiClient.startComputerUse()).data}async stop(){return(await this.apiClient.stopComputerUse()).data}async getStatus(){return(await this.apiClient.getComputerUseStatus()).data}async getProcessStatus(t){return(await this.apiClient.getProcessStatus(t)).data}async restartProcess(t){return(await this.apiClient.restartProcess(t)).data}async getProcessLogs(t){return(await this.apiClient.getProcessLogs(t)).data}async getProcessErrors(t){return(await this.apiClient.getProcessErrors(t)).data}};oh.ComputerUse=Pxe});var O1t=y(SZ=>{"use strict";Object.defineProperty(SZ,"__esModule",{value:!0});SZ.CodeInterpreter=void 0;var Wan=(nc(),Nr(rc)),T1t=Wan.__importDefault(fZ()),Wk=Ud(),Jan=wxe(),Yan=4008,kxe=class{clientConfig;apiClient;getPreviewToken;ensureToolboxUrl;constructor(t,r,n,i){this.clientConfig=t,this.apiClient=r,this.getPreviewToken=n,this.ensureToolboxUrl=i}async runCode(t,r={}){if(!t||!t.trim())throw new Wk.DaytonaError("Code is required for execution");await this.ensureToolboxUrl();let n=`${this.clientConfig.basePath.replace(/^http/,"ws")}/process/interpreter/execute`,i=await(0,Jan.createSandboxWebSocket)(n,this.clientConfig.baseOptions?.headers||{},this.getPreviewToken),s={stdout:"",stderr:""};return new Promise((o,a)=>{let c=!1,l=()=>{S();try{(i.readyState===T1t.default.OPEN||i.readyState===T1t.default.CONNECTING)&&i.close()}catch{}},u=v=>{c||(c=!0,l(),a(v))},d=()=>{c||(c=!0,l(),o(s))},p=()=>{let v={code:t},x=r.context;x?.id&&(v.contextId=x.id),r.envs&&(v.envs=r.envs),v.timeout=r.timeout,i.send(JSON.stringify(v))},f=async v=>{try{let x=await this.extractMessageText(v);if(!x)return;let A=JSON.parse(x),O=A.type;if(O==="stdout"){let q=A.text??"";s.stdout+=q,r.onStdout&&await r.onStdout({output:q})}else if(O==="stderr"){let q=A.text??"";s.stderr+=q,r.onStderr&&await r.onStderr({output:q})}else if(O==="error"){let q={name:A.name??"",value:A.value??"",traceback:A.traceback??""};s.error=q,r.onError&&await r.onError(q)}else if(O==="control"){let q=A.text??"";(q==="completed"||q==="interrupted")&&d()}}catch{}},h=(v,x)=>{if(c)return;let{code:A,message:O}=this.normalizeCloseEvent(v,x);if(A!==1e3&&A!==1001){u(this.createCloseError(A,O));return}d()},m=v=>{u(new Wk.DaytonaError(`Failed to execute code: ${v.message??String(v)}`))},S=()=>{"removeEventListener"in i&&(i.removeEventListener("open",p),i.removeEventListener("message",f),i.removeEventListener("close",h),i.removeEventListener("error",m)),"off"in i?(i.off("open",p),i.off("message",f),i.off("close",h),i.off("error",m)):"removeListener"in i&&(i.removeListener("open",p),i.removeListener("message",f),i.removeListener("close",h),i.removeListener("error",m))};if("addEventListener"in i)i.addEventListener("open",p),i.addEventListener("message",f),i.addEventListener("close",h),i.addEventListener("error",m);else if("on"in i)i.on("open",p),i.on("message",f),i.on("close",h),i.on("error",m);else throw new Wk.DaytonaError("Unsupported WebSocket implementation")})}async createContext(t){return(await this.apiClient.createInterpreterContext({cwd:t})).data}async listContexts(){return(await this.apiClient.listInterpreterContexts()).data.contexts??[]}async deleteContext(t){await this.apiClient.deleteInterpreterContext(t.id)}async extractMessageText(t){let r=t&&typeof t=="object"&&"data"in t?t.data:t;return typeof r=="string"?r:typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?new TextDecoder("utf-8").decode(new Uint8Array(r)):typeof Blob<"u"&&r instanceof Blob?await r.text():ArrayBuffer.isView(r)?new TextDecoder("utf-8").decode(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)):r==null?"":r.toString()}normalizeCloseEvent(t,r){return typeof t=="number"?{code:t,message:r?r.toString("utf-8"):""}:{code:t.code,message:t.reason}}createCloseError(t,r){return t===Yan?new Wk.DaytonaTimeoutError("Execution timed out: operation exceeded the configured `timeout`. Provide a larger value if needed."):r?new Wk.DaytonaError(r+` (close code ${t})`):new Wk.DaytonaError(`Code execution failed: WebSocket closed with code ${t}`)}};SZ.CodeInterpreter=kxe});var Mxe=y(vZ=>{"use strict";Object.defineProperty(vZ,"__esModule",{value:!0});vZ.Sandbox=void 0;var Kan=xB(),gC=FRt(),Zan=KEe(),Xan=XEe(),Qan=MU(),ecn=Oxe(),ah=Ud(),tcn=Rxe(),rcn=O1t(),Nxe="dtn-placeholder",Dxe=class{clientConfig;axiosInstance;sandboxApi;codeToolbox;getToolboxBaseUrl;fs;git;process;computerUse;codeInterpreter;id;name;organizationId;snapshot;user;env;labels;public;target;cpu;gpu;memory;disk;state;errorReason;recoverable;backupState;backupCreatedAt;autoStopInterval;autoArchiveInterval;autoDeleteInterval;volumes;buildInfo;createdAt;updatedAt;networkBlockAll;networkAllowList;infoApi;constructor(t,r,n,i,s,o){this.clientConfig=r,this.axiosInstance=n,this.sandboxApi=i,this.codeToolbox=s,this.getToolboxBaseUrl=o,this.processSandboxDto(t),this.axiosInstance.defaults.baseURL=Nxe,this.axiosInstance.interceptors.request.use(async c=>(this.axiosInstance.defaults.baseURL===Nxe&&(await this.ensureToolboxUrl(),c.baseURL=this.axiosInstance.defaults.baseURL),c));let a=async()=>(await this.getPreviewLink(1)).token;this.fs=new Zan.FileSystem(this.clientConfig,new gC.FileSystemApi(this.clientConfig,"",this.axiosInstance),this.ensureToolboxUrl.bind(this)),this.git=new Xan.Git(new gC.GitApi(this.clientConfig,"",this.axiosInstance)),this.process=new Qan.Process(this.clientConfig,this.codeToolbox,new gC.ProcessApi(this.clientConfig,"",this.axiosInstance),a,this.ensureToolboxUrl.bind(this)),this.codeInterpreter=new rcn.CodeInterpreter(this.clientConfig,new gC.InterpreterApi(this.clientConfig,"",this.axiosInstance),a,this.ensureToolboxUrl.bind(this)),this.computerUse=new tcn.ComputerUse(new gC.ComputerUseApi(this.clientConfig,"",this.axiosInstance)),this.infoApi=new gC.InfoApi(this.clientConfig,"",this.axiosInstance)}async getUserHomeDir(){return(await this.infoApi.getUserHomeDir()).data.dir}async getUserRootDir(){return this.getUserHomeDir()}async getWorkDir(){return(await this.infoApi.getWorkDir()).data.dir}async createLspServer(t,r){return new ecn.LspServer(t,r,new gC.LspApi(this.clientConfig,"",this.axiosInstance))}async setLabels(t){return this.labels=(await this.sandboxApi.replaceLabels(this.id,{labels:t})).data.labels,this.labels}async start(t=60){if(t<0)throw new ah.DaytonaError("Timeout must be a non-negative number");let r=Date.now(),n=await this.sandboxApi.startSandbox(this.id,void 0,{timeout:t*1e3});this.processSandboxDto(n.data);let i=Date.now()-r;await this.waitUntilStarted(t&&Math.max(.001,t-i/1e3))}async recover(t=60){if(t<0)throw new ah.DaytonaError("Timeout must be a non-negative number");let r=Date.now(),n=await this.sandboxApi.recoverSandbox(this.id,void 0,{timeout:t*1e3});this.processSandboxDto(n.data);let i=Date.now()-r;await this.waitUntilStarted(t&&Math.max(.001,t-i/1e3))}async stop(t=60){if(t<0)throw new ah.DaytonaError("Timeout must be a non-negative number");let r=Date.now();await this.sandboxApi.stopSandbox(this.id,void 0,{timeout:t*1e3}),await this.refreshDataSafe();let n=Date.now()-r;await this.waitUntilStopped(t&&Math.max(.001,t-n/1e3))}async delete(t=60){await this.sandboxApi.deleteSandbox(this.id,void 0,{timeout:t*1e3}),this.refreshDataSafe()}async waitUntilStarted(t=60){if(t<0)throw new ah.DaytonaError("Timeout must be a non-negative number");let r=100,n=Date.now();for(;this.state!=="started";){if(await this.refreshData(),this.state==="started")return;if(this.state==="error"){let i=`Sandbox ${this.id} failed to start with status: ${this.state}, error reason: ${this.errorReason}`;throw new ah.DaytonaError(i)}if(t!==0&&Date.now()-n>t*1e3)throw new ah.DaytonaError("Sandbox failed to become ready within the timeout period");await new Promise(i=>setTimeout(i,r))}}async waitUntilStopped(t=60){if(t<0)throw new ah.DaytonaError("Timeout must be a non-negative number");let r=100,n=Date.now();for(;this.state!=="stopped"&&this.state!=="destroyed";){if(this.refreshDataSafe(),this.state==="stopped"||this.state==="destroyed")return;if(this.state==="error"){let i=`Sandbox failed to stop with status: ${this.state}, error reason: ${this.errorReason}`;throw new ah.DaytonaError(i)}if(t!==0&&Date.now()-n>t*1e3)throw new ah.DaytonaError("Sandbox failed to become stopped within the timeout period");await new Promise(i=>setTimeout(i,r))}}async refreshData(){let t=await this.sandboxApi.getSandbox(this.id);this.processSandboxDto(t.data)}async refreshActivity(){await this.sandboxApi.updateLastActivity(this.id)}async setAutostopInterval(t){if(!Number.isInteger(t)||t<0)throw new ah.DaytonaError("autoStopInterval must be a non-negative integer");await this.sandboxApi.setAutostopInterval(this.id,t),this.autoStopInterval=t}async setAutoArchiveInterval(t){if(!Number.isInteger(t)||t<0)throw new ah.DaytonaError("autoArchiveInterval must be a non-negative integer");await this.sandboxApi.setAutoArchiveInterval(this.id,t),this.autoArchiveInterval=t}async setAutoDeleteInterval(t){await this.sandboxApi.setAutoDeleteInterval(this.id,t),this.autoDeleteInterval=t}async getPreviewLink(t){return(await this.sandboxApi.getPortPreviewUrl(this.id,t)).data}async getSignedPreviewUrl(t,r){return(await this.sandboxApi.getSignedPortPreviewUrl(this.id,t,void 0,r)).data}async expireSignedPreviewUrl(t,r){await this.sandboxApi.expireSignedPortPreviewUrl(this.id,t,r)}async archive(){await this.sandboxApi.archiveSandbox(this.id),await this.refreshData()}async createSshAccess(t){return(await this.sandboxApi.createSshAccess(this.id,void 0,t)).data}async revokeSshAccess(t){await this.sandboxApi.revokeSshAccess(this.id,void 0,t)}async validateSshAccess(t){return(await this.sandboxApi.validateSshAccess(t)).data}processSandboxDto(t){this.id=t.id,this.name=t.name,this.organizationId=t.organizationId,this.snapshot=t.snapshot,this.user=t.user,this.env=t.env,this.labels=t.labels,this.public=t.public,this.target=t.target,this.cpu=t.cpu,this.gpu=t.gpu,this.memory=t.memory,this.disk=t.disk,this.state=t.state,this.errorReason=t.errorReason,this.recoverable=t.recoverable,this.backupState=t.backupState,this.backupCreatedAt=t.backupCreatedAt,this.autoStopInterval=t.autoStopInterval,this.autoArchiveInterval=t.autoArchiveInterval,this.autoDeleteInterval=t.autoDeleteInterval,this.volumes=t.volumes,this.buildInfo=t.buildInfo,this.createdAt=t.createdAt,this.updatedAt=t.updatedAt,this.networkBlockAll=t.networkBlockAll,this.networkAllowList=t.networkAllowList}async refreshDataSafe(){try{await this.refreshData()}catch(t){t instanceof ah.DaytonaNotFoundError&&(this.state=Kan.SandboxState.DESTROYED)}}async ensureToolboxUrl(){this.axiosInstance.defaults.baseURL===Nxe&&(this.axiosInstance.defaults.baseURL=await this.getToolboxBaseUrl(this.id,this.target),this.axiosInstance.defaults.baseURL.endsWith("/")||(this.axiosInstance.defaults.baseURL+="/"),this.axiosInstance.defaults.baseURL+=this.id,this.clientConfig.basePath=this.axiosInstance.defaults.baseURL)}};vZ.Sandbox=Dxe});var R1t=y(_Z=>{"use strict";Object.defineProperty(_Z,"__esModule",{value:!0});_Z.SnapshotService=void 0;var fE=xB(),P1t=Ud(),ncn=XK(),icn=Rk(),Bxe=class e{clientConfig;snapshotsApi;objectStorageApi;defaultRegionId;constructor(t,r,n,i){this.clientConfig=t,this.snapshotsApi=r,this.objectStorageApi=n,this.defaultRegionId=i}async list(t,r){let n=await this.snapshotsApi.getAllSnapshots(void 0,t,r);return{items:n.data.items.map(i=>i),total:n.data.total,page:n.data.page,totalPages:n.data.totalPages}}async get(t){return(await this.snapshotsApi.getSnapshot(t)).data}async delete(t){await this.snapshotsApi.removeSnapshot(t.id)}async create(t,r={}){let n={name:t.name};if(typeof t.image=="string")n.imageName=t.image,n.entrypoint=t.entrypoint;else{let u=await e.processImageContext(this.objectStorageApi,t.image);n.buildInfo={contextHashes:u,dockerfileContent:t.entrypoint?t.image.entrypoint(t.entrypoint).dockerfile:t.image.dockerfile}}t.resources&&(n.cpu=t.resources.cpu,n.gpu=t.resources.gpu,n.memory=t.resources.memory,n.disk=t.resources.disk),n.regionId=t.regionId||this.defaultRegionId;let i=(await this.snapshotsApi.createSnapshot(n,void 0,{timeout:(r.timeout||0)*1e3})).data;if(!i)throw new P1t.DaytonaError("Failed to create snapshot. Didn't receive a snapshot from the server API.");let s=[fE.SnapshotState.ACTIVE,fE.SnapshotState.ERROR,fE.SnapshotState.BUILD_FAILED],o={createdSnapshot:i},a,c=async(u=()=>{})=>{if(!a){let p=`${(await this.snapshotsApi.getSnapshotBuildLogsUrl(i.id)).data.url}?follow=true`;a=(0,ncn.processStreamingResponse)(()=>fetch(p,{method:"GET",headers:this.clientConfig.baseOptions.headers}),f=>u(f.trimEnd()),async()=>s.includes(o.createdSnapshot.state))}};r.onLogs&&(r.onLogs(`Creating snapshot ${i.name} (${i.state})`),n.buildInfo&&i.state!==fE.SnapshotState.PENDING&&!s.includes(i.state)&&await c(r.onLogs));let l=i.state;for(;!s.includes(i.state);)r.onLogs&&l!==i.state&&(n.buildInfo&&i.state!==fE.SnapshotState.PENDING&&!a&&await c(r.onLogs),r.onLogs(`Creating snapshot ${i.name} (${i.state})`),l=i.state),await new Promise(u=>setTimeout(u,1e3)),i=await this.get(i.name),o.createdSnapshot=i;if(r.onLogs&&(a&&await a,i.state===fE.SnapshotState.ACTIVE&&r.onLogs(`Created snapshot ${i.name} (${i.state})`)),i.state===fE.SnapshotState.ERROR||i.state===fE.SnapshotState.BUILD_FAILED){let u=`Failed to create snapshot. Name: ${i.name} Reason: ${i.errorReason}`;throw new P1t.DaytonaError(u)}return i}async activate(t){return(await this.snapshotsApi.activateSnapshot(t.id)).data}static async processImageContext(t,r){if(!r.contextList||!r.contextList.length)return[];let n=await(0,icn.dynamicImport)("ObjectStorage",'"processImageContext" is not supported: '),i=(await t.getPushAccess()).data,s=new n.ObjectStorage({endpointUrl:i.storageUrl,accessKeyId:i.accessKey,secretAccessKey:i.secret,sessionToken:i.sessionToken,bucketName:i.bucket}),o=[];for(let a of r.contextList){let c=await s.upload(a.sourcePath,i.organizationId,a.archivePath);o.push(c)}return o}};_Z.SnapshotService=Bxe});var k1t=y(EZ=>{"use strict";Object.defineProperty(EZ,"__esModule",{value:!0});EZ.VolumeService=void 0;var scn=Ud(),Fxe=class{volumesApi;constructor(t){this.volumesApi=t}async list(){return(await this.volumesApi.listVolumes()).data}async get(t,r=!1){try{return(await this.volumesApi.getVolumeByName(t)).data}catch(n){if(n instanceof scn.DaytonaNotFoundError&&r)return await this.create(t);throw n}}async create(t){return(await this.volumesApi.createVolume({name:t})).data}async delete(t){await this.volumesApi.deleteVolume(t.id)}};EZ.VolumeService=Fxe});var N1t=y((Pui,ocn)=>{ocn.exports={name:"@daytonaio/sdk",version:"0.134.0",description:"TypeScript SDK for Daytona",main:"./src/index.js",types:"./src/index.d.ts",repository:{type:"git",url:"git+https://github.com/daytonaio/daytona.git"},author:"Daytona Platforms Inc.",license:"Apache-2.0",bugs:{url:"https://github.com/daytonaio/daytona/issues"},homepage:"https://www.daytona.io/docs",config:{docsDir:"../../apps/docs/src/content/docs/en/typescript-sdk"},scripts:{docs:"bash -O extglob -c 'rm -rf $npm_package_config_docsDir/!(index.mdx)' && typedoc && rm -f $npm_package_config_docsDir/readme.mdx"},keywords:[],dependencies:{"@aws-sdk/client-s3":"^3.787.0","@aws-sdk/lib-storage":"^3.798.0","@iarna/toml":"^2.2.5",axios:"^1.11.0",busboy:"^1.0.0",dotenv:"^17.0.1","expand-tilde":"^2.0.2","fast-glob":"^3.3.0","form-data":"^4.0.4","isomorphic-ws":"^5.0.0",pathe:"^2.0.3","shell-quote":"^1.8.2",tar:"^6.2.0","@daytonaio/api-client":"0.134.0","@daytonaio/toolbox-api-client":"0.134.0"},packageManager:"yarn@4.6.0",type:"commonjs"}});var D1t=y((Rui,acn)=>{acn.exports={name:"dotenv",version:"17.2.3",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var q1t=y((kui,tS)=>{var Uxe=require("fs"),xZ=require("path"),ccn=require("os"),lcn=require("crypto"),ucn=D1t(),Lxe=ucn.version,M1t=["\u{1F510} encrypt with Dotenvx: https://dotenvx.com","\u{1F510} prevent committing .env to code: https://dotenvx.com/precommit","\u{1F510} prevent building .env in docker: https://dotenvx.com/prebuild","\u{1F4E1} add observability to secrets: https://dotenvx.com/ops","\u{1F465} sync secrets across teammates & machines: https://dotenvx.com/ops","\u{1F5C2}\uFE0F backup and recover secrets: https://dotenvx.com/ops","\u2705 audit secrets and track compliance: https://dotenvx.com/ops","\u{1F504} add secrets lifecycle management: https://dotenvx.com/ops","\u{1F511} add access controls to secrets: https://dotenvx.com/ops","\u{1F6E0}\uFE0F run anywhere with `dotenvx run -- yourcommand`","\u2699\uFE0F specify custom .env file path with { path: '/custom/path/.env' }","\u2699\uFE0F enable debug logging with { debug: true }","\u2699\uFE0F override existing env vars with { override: true }","\u2699\uFE0F suppress all logs with { quiet: true }","\u2699\uFE0F write to custom object with { processEnv: myObject }","\u2699\uFE0F load multiple .env files with { path: ['.env.local', '.env'] }"];function dcn(){return M1t[Math.floor(Math.random()*M1t.length)]}function Jk(e){return typeof e=="string"?!["false","0","no","off",""].includes(e.toLowerCase()):!!e}function fcn(){return process.stdout.isTTY}function pcn(e){return fcn()?`\x1B[2m${e}\x1B[0m`:e}var hcn=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function mcn(e){let t={},r=e.toString();r=r.replace(/\r\n?/mg,`
562
562
  `);let n;for(;(n=hcn.exec(r))!=null;){let i=n[1],s=n[2]||"";s=s.trim();let o=s[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),o==='"'&&(s=s.replace(/\\n/g,`
563
- `),s=s.replace(/\\r/g,"\r")),t[i]=s}return t}function gcn(e){e=e||{};let t=L1t(e);e.path=t;let r=bc.configDotenv(e);if(!r.parsed){let o=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw o.code="MISSING_DATA",o}let n=U1t(e).split(","),i=n.length,s;for(let o=0;o<i;o++)try{let a=n[o].trim(),c=bcn(r,a);s=bc.decrypt(c.ciphertext,c.key);break}catch(a){if(o+1>=i)throw a}return bc.parse(s)}function ycn(e){console.error(`[dotenv@${Lxe}][WARN] ${e}`)}function GU(e){console.log(`[dotenv@${Lxe}][DEBUG] ${e}`)}function F1t(e){console.log(`[dotenv@${Lxe}] ${e}`)}function U1t(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function bcn(e,t){let r;try{r=new URL(t)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=r.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let s=`DOTENV_VAULT_${i.toUpperCase()}`,o=e.parsed[s];if(!o){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:o,key:n}}function L1t(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)Uxe.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=xZ.resolve(process.cwd(),".env.vault");return Uxe.existsSync(t)?t:null}function B1t(e){return e[0]==="~"?xZ.join(ccn.homedir(),e.slice(1)):e}function Scn(e){let t=Jk(process.env.DOTENV_CONFIG_DEBUG||e&&e.debug),r=Jk(process.env.DOTENV_CONFIG_QUIET||e&&e.quiet);(t||!r)&&F1t("Loading env from encrypted .env.vault");let n=bc._parseVault(e),i=process.env;return e&&e.processEnv!=null&&(i=e.processEnv),bc.populate(i,n,e),{parsed:n}}function vcn(e){let t=xZ.resolve(process.cwd(),".env"),r="utf8",n=process.env;e&&e.processEnv!=null&&(n=e.processEnv);let i=Jk(n.DOTENV_CONFIG_DEBUG||e&&e.debug),s=Jk(n.DOTENV_CONFIG_QUIET||e&&e.quiet);e&&e.encoding?r=e.encoding:i&&GU("No encoding is specified. UTF-8 is used by default");let o=[t];if(e&&e.path)if(!Array.isArray(e.path))o=[B1t(e.path)];else{o=[];for(let u of e.path)o.push(B1t(u))}let a,c={};for(let u of o)try{let d=bc.parse(Uxe.readFileSync(u,{encoding:r}));bc.populate(c,d,e)}catch(d){i&&GU(`Failed to load ${u} ${d.message}`),a=d}let l=bc.populate(n,c,e);if(i=Jk(n.DOTENV_CONFIG_DEBUG||i),s=Jk(n.DOTENV_CONFIG_QUIET||s),i||!s){let u=Object.keys(l).length,d=[];for(let p of o)try{let f=xZ.relative(process.cwd(),p);d.push(f)}catch(f){i&&GU(`Failed to load ${p} ${f.message}`),a=f}F1t(`injecting env (${u}) from ${d.join(",")} ${pcn(`-- tip: ${dcn()}`)}`)}return a?{parsed:c,error:a}:{parsed:c}}function _cn(e){if(U1t(e).length===0)return bc.configDotenv(e);let t=L1t(e);return t?bc._configVault(e):(ycn(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),bc.configDotenv(e))}function Ecn(e,t){let r=Buffer.from(t.slice(-64),"hex"),n=Buffer.from(e,"base64"),i=n.subarray(0,12),s=n.subarray(-16);n=n.subarray(12,-16);try{let o=lcn.createDecipheriv("aes-256-gcm",r,i);return o.setAuthTag(s),`${o.update(n)}${o.final()}`}catch(o){let a=o instanceof RangeError,c=o.message==="Invalid key length",l=o.message==="Unsupported state or unable to authenticate data";if(a||c){let u=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw u.code="INVALID_DOTENV_KEY",u}else if(l){let u=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw u.code="DECRYPTION_FAILED",u}else throw o}}function xcn(e,t,r={}){let n=!!(r&&r.debug),i=!!(r&&r.override),s={};if(typeof t!="object"){let o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(let o of Object.keys(t))Object.prototype.hasOwnProperty.call(e,o)?(i===!0&&(e[o]=t[o],s[o]=t[o]),n&&GU(i===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):(e[o]=t[o],s[o]=t[o]);return s}var bc={configDotenv:vcn,_configVault:Scn,_parseVault:gcn,config:_cn,decrypt:Ecn,parse:mcn,populate:xcn};tS.exports.configDotenv=bc.configDotenv;tS.exports._configVault=bc._configVault;tS.exports._parseVault=bc._parseVault;tS.exports.config=bc.config;tS.exports.decrypt=bc.decrypt;tS.exports.parse=bc.parse;tS.exports.populate=bc.populate;tS.exports=bc});var z1t=y(Kk=>{"use strict";Object.defineProperty(Kk,"__esModule",{value:!0});Kk.Daytona=Kk.CodeLanguage=void 0;var G1t=(nc(),Nr(rc)),ep=xB(),V1t=G1t.__importStar(Hi()),Icn=d9e(),wcn=f9e(),Ccn=p9e(),Am=Ud(),$1t=SEe(),qxe=Mxe(),H1t=R1t(),Acn=k1t(),Tcn=G1t.__importStar(N1t()),Ocn=XK(),ch=wB(),Yk;(function(e){e.PYTHON="python",e.TYPESCRIPT="typescript",e.JAVASCRIPT="javascript"})(Yk||(Kk.CodeLanguage=Yk={}));var Vxe=class{clientConfig;sandboxApi;objectStorageApi;configApi;target;apiKey;jwtToken;organizationId;apiUrl;toolboxProxyCache=new Map;volume;snapshot;constructor(t){let r;if(t&&(this.apiKey=!t?.apiKey&&t?.jwtToken?void 0:t?.apiKey,this.jwtToken=t?.jwtToken,this.organizationId=t?.organizationId,r=t?.apiUrl||t?.serverUrl,this.target=t?.target),(!t||!(this.apiKey&&r&&this.target)&&!(this.jwtToken&&this.organizationId&&r&&this.target))&&ch.RUNTIME!==ch.Runtime.BROWSER){if(ch.RUNTIME===ch.Runtime.NODE&&typeof require<"u"){let o=q1t();o.config({quiet:!0}),o.config({path:".env.local",override:!0,quiet:!0})}this.apiKey=this.apiKey||(this.jwtToken?void 0:(0,ch.getEnvVar)("DAYTONA_API_KEY")),this.jwtToken=this.jwtToken||(0,ch.getEnvVar)("DAYTONA_JWT_TOKEN"),this.organizationId=this.organizationId||(0,ch.getEnvVar)("DAYTONA_ORGANIZATION_ID"),r=r||(0,ch.getEnvVar)("DAYTONA_API_URL")||(0,ch.getEnvVar)("DAYTONA_SERVER_URL"),this.target=this.target||(0,ch.getEnvVar)("DAYTONA_TARGET"),(0,ch.getEnvVar)("DAYTONA_SERVER_URL")&&!(0,ch.getEnvVar)("DAYTONA_API_URL")&&console.warn("[Deprecation Warning] Environment variable `DAYTONA_SERVER_URL` is deprecated and will be removed in future versions. Use `DAYTONA_API_URL` instead.")}this.apiUrl=r||"https://app.daytona.io/api";let n={};if(!this.apiKey){if(!this.organizationId)throw new Am.DaytonaError("Organization ID is required when using JWT token");n["X-Daytona-Organization-ID"]=this.organizationId}let i=new ep.Configuration({basePath:this.apiUrl,baseOptions:{headers:{Authorization:`Bearer ${this.apiKey||this.jwtToken}`,"X-Daytona-Source":"typescript-sdk","X-Daytona-SDK-Version":Tcn.version,...n}}}),s=this.createAxiosInstance();this.sandboxApi=new ep.SandboxApi(i,"",s),this.objectStorageApi=new ep.ObjectStorageApi(i,"",s),this.configApi=new ep.ConfigApi(i,"",s),this.volume=new Acn.VolumeService(new ep.VolumesApi(i,"",s)),this.snapshot=new H1t.SnapshotService(i,new ep.SnapshotsApi(i,"",s),this.objectStorageApi,this.target),this.clientConfig=i}async create(t,r={timeout:60}){let n=Date.now();r=typeof r=="number"?{timeout:r}:{...r},(r.timeout==null||r.timeout==null)&&(r.timeout=60),t==null&&(t={language:"python"});let i=t.labels||{};if(t.language&&(i["code-toolbox-language"]=t.language),r.timeout<0)throw new Am.DaytonaError("Timeout must be a non-negative number");if(t.autoStopInterval!==void 0&&(!Number.isInteger(t.autoStopInterval)||t.autoStopInterval<0))throw new Am.DaytonaError("autoStopInterval must be a non-negative integer");if(t.ephemeral&&(t.autoDeleteInterval!==void 0&&t.autoDeleteInterval!==0&&console.warn("'ephemeral' and 'autoDeleteInterval' cannot be used together. If ephemeral is true, autoDeleteInterval will be ignored and set to 0."),t.autoDeleteInterval=0),t.autoArchiveInterval!==void 0&&(!Number.isInteger(t.autoArchiveInterval)||t.autoArchiveInterval<0))throw new Am.DaytonaError("autoArchiveInterval must be a non-negative integer");let s=this.getCodeToolbox(t.language);try{let o,a,c;"snapshot"in t&&(a=t.snapshot),"image"in t&&(typeof t.image=="string"?o={dockerfileContent:$1t.Image.base(t.image).dockerfile}:t.image instanceof $1t.Image&&(o={contextHashes:await H1t.SnapshotService.processImageContext(this.objectStorageApi,t.image),dockerfileContent:t.image.dockerfile})),"resources"in t&&(c=t.resources);let u=(await this.sandboxApi.createSandbox({name:t.name,snapshot:a,buildInfo:o,user:t.user,env:t.envVars||{},labels:i,public:t.public,target:this.target,cpu:c?.cpu,gpu:c?.gpu,memory:c?.memory,disk:c?.disk,autoStopInterval:t.autoStopInterval,autoArchiveInterval:t.autoArchiveInterval,autoDeleteInterval:t.autoDeleteInterval,volumes:t.volumes,networkBlockAll:t.networkBlockAll,networkAllowList:t.networkAllowList},void 0,{timeout:r.timeout*1e3})).data;if(u.state===ep.SandboxState.PENDING_BUILD&&r.onSnapshotCreateLogs){let p=[ep.SandboxState.STARTED,ep.SandboxState.STARTING,ep.SandboxState.ERROR,ep.SandboxState.BUILD_FAILED];for(;u.state===ep.SandboxState.PENDING_BUILD;)await new Promise(h=>setTimeout(h,1e3)),u=(await this.sandboxApi.getSandbox(u.id)).data;let f=await this.sandboxApi.getBuildLogsUrl(u.id);await(0,Ocn.processStreamingResponse)(()=>fetch(f.data.url+"?follow=true",{method:"GET",headers:this.clientConfig.baseOptions.headers}),h=>r.onSnapshotCreateLogs?.(h.trimEnd()),async()=>(u=(await this.sandboxApi.getSandbox(u.id)).data,u.state!==void 0&&p.includes(u.state)))}let d=new qxe.Sandbox(u,new ep.Configuration(structuredClone(this.clientConfig)),this.createAxiosInstance(),this.sandboxApi,s,this.getProxyToolboxUrl.bind(this));if(d.state!=="started"){let p=Date.now()-n;await d.waitUntilStarted(r.timeout?Math.max(.001,r.timeout-p/1e3):r.timeout)}return d}catch(o){if(o instanceof Am.DaytonaError&&o.message.includes("Operation timed out")){let a=`Failed to create and start sandbox within ${r.timeout} seconds. Operation timed out.`;throw new Am.DaytonaError(a)}throw o}}async get(t){let n=(await this.sandboxApi.getSandbox(t)).data,i=n.labels&&n.labels["code-toolbox-language"],s=this.getCodeToolbox(i);return new qxe.Sandbox(n,structuredClone(this.clientConfig),this.createAxiosInstance(),this.sandboxApi,s,this.getProxyToolboxUrl.bind(this))}async findOne(t){if(t.idOrName)return this.get(t.idOrName);let r=await this.list(t.labels,1,1);if(r.items.length===0){let n=`No sandbox found with labels ${JSON.stringify(t.labels)}`;throw new Am.DaytonaError(n)}return r.items[0]}async list(t,r,n){let i=await this.sandboxApi.listSandboxesPaginated(void 0,r,n,void 0,void 0,t?JSON.stringify(t):void 0);return{items:i.data.items.map(s=>{let o=s.labels?.["code-toolbox-language"];return new qxe.Sandbox(s,structuredClone(this.clientConfig),this.createAxiosInstance(),this.sandboxApi,this.getCodeToolbox(o),this.getProxyToolboxUrl.bind(this))}),total:i.data.total,page:i.data.page,totalPages:i.data.totalPages}}async start(t,r){await t.start(r)}async stop(t){await t.stop()}async delete(t,r=60){await t.delete(r)}getCodeToolbox(t){switch(t){case Yk.JAVASCRIPT:return new Ccn.SandboxJsCodeToolbox;case Yk.TYPESCRIPT:return new wcn.SandboxTsCodeToolbox;case Yk.PYTHON:case void 0:return new Icn.SandboxPythonCodeToolbox;default:{let r=`Unsupported language: ${t}, supported languages: ${Object.values(Yk).join(", ")}`;throw new Am.DaytonaError(r)}}}createAxiosInstance(){let t=V1t.default.create({timeout:864e5});return t.interceptors.response.use(r=>r,r=>{let n;if(r instanceof V1t.AxiosError&&r.message.includes("timeout of")?n="Operation timed out":n=r.response?.data?.message||r.response?.data||r.message||String(r),typeof n=="object")try{n=JSON.stringify(n)}catch{n=String(n)}let i=r.response?.status,s=r.response?.headers;switch(i){case 404:throw new Am.DaytonaNotFoundError(n,i,s);case 429:throw new Am.DaytonaRateLimitError(n,i,s);default:throw new Am.DaytonaError(n,i,s)}}),t}async getProxyToolboxUrl(t,r){let n=this.toolboxProxyCache.get(r);if(n)return await n;let i=(async()=>(await this.sandboxApi.getToolboxProxyUrl(t)).data.url)();return this.toolboxProxyCache.set(r,i),await i}};Kk.Daytona=Vxe});var W1t=y(j1t=>{"use strict";Object.defineProperty(j1t,"__esModule",{value:!0})});var Y1t=y(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.SandboxState=bn.ChartType=bn.Display=bn.Screenshot=bn.Keyboard=bn.Mouse=bn.ComputerUse=bn.Sandbox=bn.Image=bn.DaytonaTimeoutError=bn.DaytonaRateLimitError=bn.DaytonaNotFoundError=bn.DaytonaError=bn.Process=bn.LspLanguageId=bn.Git=bn.FileSystem=bn.Daytona=bn.CodeLanguage=void 0;var $xe=(nc(),Nr(rc)),J1t=z1t();Object.defineProperty(bn,"CodeLanguage",{enumerable:!0,get:function(){return J1t.CodeLanguage}});Object.defineProperty(bn,"Daytona",{enumerable:!0,get:function(){return J1t.Daytona}});var Pcn=KEe();Object.defineProperty(bn,"FileSystem",{enumerable:!0,get:function(){return Pcn.FileSystem}});var Rcn=XEe();Object.defineProperty(bn,"Git",{enumerable:!0,get:function(){return Rcn.Git}});var kcn=Oxe();Object.defineProperty(bn,"LspLanguageId",{enumerable:!0,get:function(){return kcn.LspLanguageId}});var Ncn=MU();Object.defineProperty(bn,"Process",{enumerable:!0,get:function(){return Ncn.Process}});var IZ=Ud();Object.defineProperty(bn,"DaytonaError",{enumerable:!0,get:function(){return IZ.DaytonaError}});Object.defineProperty(bn,"DaytonaNotFoundError",{enumerable:!0,get:function(){return IZ.DaytonaNotFoundError}});Object.defineProperty(bn,"DaytonaRateLimitError",{enumerable:!0,get:function(){return IZ.DaytonaRateLimitError}});Object.defineProperty(bn,"DaytonaTimeoutError",{enumerable:!0,get:function(){return IZ.DaytonaTimeoutError}});var Dcn=SEe();Object.defineProperty(bn,"Image",{enumerable:!0,get:function(){return Dcn.Image}});var Mcn=Mxe();Object.defineProperty(bn,"Sandbox",{enumerable:!0,get:function(){return Mcn.Sandbox}});var zU=Rxe();Object.defineProperty(bn,"ComputerUse",{enumerable:!0,get:function(){return zU.ComputerUse}});Object.defineProperty(bn,"Mouse",{enumerable:!0,get:function(){return zU.Mouse}});Object.defineProperty(bn,"Keyboard",{enumerable:!0,get:function(){return zU.Keyboard}});Object.defineProperty(bn,"Screenshot",{enumerable:!0,get:function(){return zU.Screenshot}});Object.defineProperty(bn,"Display",{enumerable:!0,get:function(){return zU.Display}});var Bcn=QEe();Object.defineProperty(bn,"ChartType",{enumerable:!0,get:function(){return Bcn.ChartType}});var Fcn=xB();Object.defineProperty(bn,"SandboxState",{enumerable:!0,get:function(){return Fcn.SandboxState}});$xe.__exportStar(MU(),bn);$xe.__exportStar(xxe(),bn);$xe.__exportStar(W1t(),bn)});var eNt={};Wo(eNt,{DaytonaProvider:()=>Hxe,createDaytonaProvider:()=>Gxe});function Lcn(e){let t=e.substring(e.lastIndexOf(".")).toLowerCase();return Ucn.has(t)}function qcn(e){let t=e.lastIndexOf("/");return t>0?e.substring(0,t):"/"}function Vcn(e){let t=e.lastIndexOf("/");return t>=0?e.substring(t+1):e}function Z1t(e,t){return t?`cd '${t.replace(/'/g,"'\\''")}' && ${e}`:e}function Gxe(e={}){let t=e.apiKey??process.env.DAYTONA_API_KEY;if(!t)throw new Error("Daytona API key required. Set DAYTONA_API_KEY environment variable or pass apiKey in config. Get your key at https://app.daytona.io/dashboard/keys");return new Hxe({...e,apiKey:t})}var Q1t,K1t,Ucn,$cn,Hcn,X1t,Hxe,wZ=ee(()=>{"use strict";Q1t=ue(Y1t(),1),K1t={"evolve-all":"evolvingmachines/evolve-all:latest"},Ucn=new Set([".xlsx",".xls",".docx",".doc",".pptx",".ppt",".pdf",".zip",".tar",".gz",".7z",".rar",".png",".jpg",".jpeg",".gif",".webp",".ico",".bmp",".mp3",".wav",".ogg",".flac",".aac",".mp4",".avi",".mov",".mkv",".webm",".woff",".woff2",".ttf",".otf",".eot",".exe",".dll",".so",".dylib",".sqlite",".db",".pickle",".pkl",".parquet"]);$cn=class{constructor(e){this.sandbox=e}async run(e,t){let r=t?.timeoutMs?Math.floor(t.timeoutMs/1e3):void 0;if(t?.onStdout||t?.onStderr){let i=`run-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;await this.sandbox.process.createSession(i);try{let s=await this.sandbox.process.executeSessionCommand(i,{command:Z1t(e,t?.cwd),runAsync:!1},r),o=s.cmdId;return o&&await this.sandbox.process.getSessionCommandLogs(i,o,t.onStdout||(()=>{}),t.onStderr||(()=>{})),{exitCode:s.exitCode??0,stdout:s.stdout??s.output??"",stderr:s.stderr??""}}finally{try{await this.sandbox.process.deleteSession(i)}catch{}}}let n=await this.sandbox.process.executeCommand(e,t?.cwd,t?.envs,r);return{exitCode:n.exitCode,stdout:n.result||"",stderr:""}}async spawn(e,t){let r=`evolve-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;await this.sandbox.process.createSession(r);let n=t?.timeoutMs?Math.floor(t.timeoutMs/1e3):void 0,i=(await this.sandbox.process.executeSessionCommand(r,{command:Z1t(e,t?.cwd),runAsync:!0},n)).cmdId;i&&(t?.onStdout||t?.onStderr)&&this.sandbox.process.getSessionCommandLogs(r,i,t.onStdout||(()=>{}),t.onStderr||(()=>{})).catch(()=>{});let s=this.sandbox;return{processId:r,wait:async()=>{if(!i)return{exitCode:0,stdout:"",stderr:""};for(;;){let o=await s.process.getSessionCommand(r,i);if(o.exitCode!==void 0){let a=await s.process.getSessionCommandLogs(r,i);return{exitCode:o.exitCode,stdout:a.stdout??a.output??"",stderr:a.stderr??""}}await new Promise(a=>setTimeout(a,500))}},kill:async()=>{try{return await s.process.deleteSession(r),!0}catch{return!1}}}}async list(){try{return(await this.sandbox.process.listSessions()).map(e=>({processId:e.sessionId||"",cmd:"",args:[],envs:{}}))}catch{return[]}}async kill(e){try{return await this.sandbox.process.deleteSession(e),!0}catch{return!1}}},Hcn=class{constructor(e){this.sandbox=e}async read(e){let t=await this.sandbox.fs.downloadFile(e);return Lcn(e)?new Uint8Array(t):t.toString("utf-8")}async write(e,t){let r;if(typeof t=="string")r=Buffer.from(t,"utf-8");else if(Buffer.isBuffer(t))r=t;else if(t instanceof ArrayBuffer)r=Buffer.from(t);else if(t instanceof Uint8Array)r=Buffer.from(t);else throw new Error(`Unsupported content type: ${typeof t}`);await this.sandbox.fs.uploadFile(r,e)}async writeBatch(e){let t=e.map(r=>{let n;if(typeof r.data=="string")n=Buffer.from(r.data,"utf-8");else if(Buffer.isBuffer(r.data))n=r.data;else if(r.data instanceof ArrayBuffer)n=Buffer.from(r.data);else if(r.data instanceof Uint8Array)n=Buffer.from(r.data);else throw new Error(`Unsupported content type: ${typeof r.data}`);return{source:n,destination:r.path}});await this.sandbox.fs.uploadFiles(t)}async makeDir(e){await this.sandbox.fs.createFolder(e,"755")}async exists(e){try{let t=qcn(e),r=Vcn(e);return(await this.sandbox.fs.listFiles(t)).some(n=>n.name===r)}catch{return!1}}async list(e){return(await this.sandbox.fs.listFiles(e)).map(t=>({name:t.name,path:e.endsWith("/")?`${e}${t.name}`:`${e}/${t.name}`,type:t.isDir?"dir":"file"}))}async remove(e){await this.sandbox.fs.deleteFile(e,!0)}async rename(e,t){await this.sandbox.fs.moveFiles(e,t)}},X1t=class{constructor(e){this.sandbox=e,this.commands=new $cn(e),this.files=new Hcn(e)}commands;files;get sandboxId(){return this.sandbox.id}async getHost(e){return(await this.sandbox.getPreviewLink(e)).url}async isRunning(){return this.sandbox.state==="started"}async getInfo(){return{sandboxId:this.sandbox.id,image:this.sandbox.snapshot||"unknown",name:this.sandbox.name,metadata:this.sandbox.labels||{},startedAt:new Date().toISOString()}}async kill(){await this.sandbox.delete()}async pause(){await this.sandbox.stop()}},Hxe=class{providerType="daytona";name="Daytona";client;defaultTimeoutMs;constructor(e){this.client=new Q1t.Daytona({apiKey:e.apiKey,apiUrl:e.apiUrl,target:e.target}),this.defaultTimeoutMs=e.defaultTimeoutMs??36e5}async create(e){let t=Math.floor((e.timeoutMs??this.defaultTimeoutMs)/1e3),r=e.image,n;try{let i=await this.client.snapshot.get(r);if(i&&i.state==="active")console.log(`[Daytona] Using cached snapshot: ${r}`),n=await this.client.create({snapshot:r,envVars:e.envs,labels:e.metadata,autoStopInterval:0},{timeout:t});else throw new Error("Snapshot not active")}catch{let i=K1t[r];if(!i)throw new Error(`Unknown image "${r}" and no public fallback available. Available images: ${Object.keys(K1t).join(", ")}`);console.log(`[Daytona] Snapshot "${r}" not found, creating from image: ${i}`),console.log("[Daytona] First run may take a few minutes (image will be cached for future runs)..."),n=await this.client.create({image:i,envVars:e.envs,labels:e.metadata,autoStopInterval:0,resources:{cpu:e.resources?.cpu??4,memory:e.resources?.memory??4,disk:e.resources?.disk??10}},{timeout:t,onSnapshotCreateLogs:s=>console.log(`[Daytona] ${s}`)})}return e.workingDirectory&&await n.fs.createFolder(e.workingDirectory,"755"),new X1t(n)}async connect(e,t){let r=await this.client.get(e);return new X1t(r)}async list(e){let t=e?.limit??100;return(await this.client.list(e?.metadata,1,t)).items.map(r=>({sandboxId:r.id,image:r.snapshot||"unknown",name:r.name,metadata:r.labels||{},startedAt:new Date().toISOString()}))}}});var tNt=y(CZ=>{"use strict";Object.defineProperty(CZ,"__esModule",{value:!0});CZ.Metadata=void 0;CZ.Metadata=function(t){let r=new Map,n={set(i,s){if(i=Zk(i),Array.isArray(s))if(s.length===0)r.delete(i);else{for(let o of s)zxe(i,o);r.set(i,i.endsWith("-bin")?s:[s.join(", ")])}else zxe(i,s),r.set(i,[s]);return n},append(i,s){i=Zk(i),zxe(i,s);let o=r.get(i);return o==null&&(o=[],r.set(i,o)),o.push(s),i.endsWith("-bin")||r.set(i,[o.join(", ")]),n},delete(i){i=Zk(i),r.delete(i)},get(i){var s;return i=Zk(i),(s=r.get(i))===null||s===void 0?void 0:s[0]},getAll(i){var s;return i=Zk(i),(s=r.get(i))!==null&&s!==void 0?s:[]},has(i){return i=Zk(i),r.has(i)},[Symbol.iterator](){return r[Symbol.iterator]()}};if(t!=null){let i=Gcn(t)?t:Object.entries(t);for(let[s,o]of i)n.set(s,o)}return n};function Zk(e){return e.toLowerCase()}function zxe(e,t){if(!/^[0-9a-z_.-]+$/.test(e))throw new Error(`Metadata key '${e}' contains illegal characters`);if(e.endsWith("-bin")){if(!(t instanceof Uint8Array))throw new Error(`Metadata key '${e}' ends with '-bin', thus it must have binary value`)}else{if(typeof t!="string")throw new Error(`Metadata key '${e}' doesn't end with '-bin', thus it must have string value`);if(!/^[ -~]*$/.test(t))throw new Error(`Metadata value '${t}' of key '${e}' contains illegal characters`)}}function Gcn(e){return Symbol.iterator in e}});var AZ=y(jU=>{"use strict";Object.defineProperty(jU,"__esModule",{value:!0});jU.Status=void 0;var zcn;(function(e){e[e.OK=0]="OK",e[e.CANCELLED=1]="CANCELLED",e[e.UNKNOWN=2]="UNKNOWN",e[e.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",e[e.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",e[e.NOT_FOUND=5]="NOT_FOUND",e[e.ALREADY_EXISTS=6]="ALREADY_EXISTS",e[e.PERMISSION_DENIED=7]="PERMISSION_DENIED",e[e.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",e[e.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",e[e.ABORTED=10]="ABORTED",e[e.OUT_OF_RANGE=11]="OUT_OF_RANGE",e[e.UNIMPLEMENTED=12]="UNIMPLEMENTED",e[e.INTERNAL=13]="INTERNAL",e[e.UNAVAILABLE=14]="UNAVAILABLE",e[e.DATA_LOSS=15]="DATA_LOSS",e[e.UNAUTHENTICATED=16]="UNAUTHENTICATED"})(zcn=jU.Status||(jU.Status={}))});var nNt=y(rNt=>{"use strict";Object.defineProperty(rNt,"__esModule",{value:!0})});var sNt=y(iNt=>{"use strict";Object.defineProperty(iNt,"__esModule",{value:!0})});var aNt=y(oNt=>{"use strict";Object.defineProperty(oNt,"__esModule",{value:!0})});var cNt=y(TZ=>{"use strict";Object.defineProperty(TZ,"__esModule",{value:!0});TZ.composeClientMiddleware=void 0;function jcn(e,t){return(r,n)=>t(Object.assign(Object.assign({},r),{next:(i,s)=>e(Object.assign(Object.assign({},r),{request:i}),s)}),n)}TZ.composeClientMiddleware=jcn});var dNt=y(pE=>{"use strict";pE.__esModule=void 0;pE.__esModule=!0;var Wcn=typeof Object.setPrototypeOf=="function",Jcn=typeof Object.getPrototypeOf=="function",Ycn=typeof Object.defineProperty=="function",Kcn=typeof Object.create=="function",Zcn=typeof Object.prototype.hasOwnProperty=="function",Xcn=function(t,r){Wcn?Object.setPrototypeOf(t,r):t.__proto__=r};pE.setPrototypeOf=Xcn;var Qcn=function(t){return Jcn?Object.getPrototypeOf(t):t.__proto__||t.prototype};pE.getPrototypeOf=Qcn;var lNt=!1,eln=function e(t,r,n){if(Ycn&&!lNt)try{Object.defineProperty(t,r,n)}catch{lNt=!0,e(t,r,n)}else t[r]=n.value};pE.defineProperty=eln;var uNt=function(t,r){return Zcn?t.hasOwnProperty(t,r):t[r]===void 0};pE.hasOwnProperty=uNt;var tln=function(t,r){if(Kcn)return Object.create(t,r);var n=function(){};n.prototype=t;var i=new n;if(typeof r>"u")return i;if(typeof r=="null")throw new Error("PropertyDescriptors must not be null.");if(typeof r=="object")for(var s in r)uNt(r,s)&&(i[s]=r[s].value);return i};pE.objectCreate=tln});var Wxe=y(Xk=>{"use strict";Xk.__esModule=void 0;Xk.__esModule=!0;var PZ=dNt(),rln=PZ.setPrototypeOf,nln=PZ.getPrototypeOf,jxe=PZ.defineProperty,iln=PZ.objectCreate,sln=new Error().toString()==="[object Error]",OZ="";function WU(e){var t=this.constructor,r=t.name||function(){var a=t.toString().match(/^function\s*([^\s(]+)/);return a===null?OZ||"Error":a[1]}(),n=r==="Error",i=n?OZ:r,s=Error.apply(this,arguments);if(rln(s,nln(this)),!(s instanceof t)||!(s instanceof WU)){var s=this;Error.apply(this,arguments),jxe(s,"message",{configurable:!0,enumerable:!1,value:e,writable:!0})}if(jxe(s,"name",{configurable:!0,enumerable:!1,value:i,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(s,n?WU:t),s.stack===void 0){var o=new Error(e);o.name=s.name,s.stack=o.stack}return sln&&jxe(s,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),s}OZ=WU.name||"ExtendableError";WU.prototype=iln(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}});Xk.ExtendableError=WU;Xk.default=Xk.ExtendableError});var fNt=y(RZ=>{"use strict";Object.defineProperty(RZ,"__esModule",{value:!0});RZ.ClientError=void 0;var oln=Wxe(),aln=AZ(),Jxe=class e extends oln.ExtendableError{constructor(t,r,n){super(`${t} ${aln.Status[r]}: ${n}`),this.path=t,this.code=r,this.details=n,this.name="ClientError",Object.defineProperty(this,"@@nice-grpc",{value:!0}),Object.defineProperty(this,"@@nice-grpc:ClientError",{value:!0})}static[Symbol.hasInstance](t){return this!==e?this.prototype.isPrototypeOf(t):typeof t=="object"&&t!==null&&(t.constructor===e||t["@@nice-grpc:ClientError"]===!0||t.name==="ClientError"&&t["@@nice-grpc"]===!0)}};RZ.ClientError=Jxe});var hNt=y(pNt=>{"use strict";Object.defineProperty(pNt,"__esModule",{value:!0})});var gNt=y(mNt=>{"use strict";Object.defineProperty(mNt,"__esModule",{value:!0})});var yNt=y(kZ=>{"use strict";Object.defineProperty(kZ,"__esModule",{value:!0});kZ.composeServerMiddleware=void 0;function cln(e,t){return(r,n)=>e(Object.assign(Object.assign({},r),{next:(i,s)=>t(Object.assign(Object.assign({},r),{request:i}),s)}),n)}kZ.composeServerMiddleware=cln});var bNt=y(NZ=>{"use strict";Object.defineProperty(NZ,"__esModule",{value:!0});NZ.ServerError=void 0;var lln=Wxe(),uln=AZ(),Yxe=class e extends lln.ExtendableError{constructor(t,r){super(`${uln.Status[t]}: ${r}`),this.code=t,this.details=r,this.name="ServerError",Object.defineProperty(this,"@@nice-grpc",{value:!0}),Object.defineProperty(this,"@@nice-grpc:ServerError",{value:!0})}static[Symbol.hasInstance](t){return this!==e?this.prototype.isPrototypeOf(t):typeof t=="object"&&t!==null&&(t.constructor===e||t["@@nice-grpc:ServerError"]===!0||t.name==="ServerError"&&t["@@nice-grpc"]===!0)}};NZ.ServerError=Yxe});var lh=y(kl=>{"use strict";var dln=kl&&kl.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Tm=kl&&kl.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&dln(t,e,r)};Object.defineProperty(kl,"__esModule",{value:!0});Tm(tNt(),kl);Tm(AZ(),kl);Tm(nNt(),kl);Tm(sNt(),kl);Tm(aNt(),kl);Tm(cNt(),kl);Tm(fNt(),kl);Tm(hNt(),kl);Tm(gNt(),kl);Tm(yNt(),kl);Tm(bNt(),kl)});var Ln=y(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=uh.DEFAULT_MAX_SEND_MESSAGE_LENGTH=uh.Propagate=uh.LogVerbosity=uh.Status=void 0;var SNt;(function(e){e[e.OK=0]="OK",e[e.CANCELLED=1]="CANCELLED",e[e.UNKNOWN=2]="UNKNOWN",e[e.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",e[e.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",e[e.NOT_FOUND=5]="NOT_FOUND",e[e.ALREADY_EXISTS=6]="ALREADY_EXISTS",e[e.PERMISSION_DENIED=7]="PERMISSION_DENIED",e[e.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",e[e.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",e[e.ABORTED=10]="ABORTED",e[e.OUT_OF_RANGE=11]="OUT_OF_RANGE",e[e.UNIMPLEMENTED=12]="UNIMPLEMENTED",e[e.INTERNAL=13]="INTERNAL",e[e.UNAVAILABLE=14]="UNAVAILABLE",e[e.DATA_LOSS=15]="DATA_LOSS",e[e.UNAUTHENTICATED=16]="UNAUTHENTICATED"})(SNt||(uh.Status=SNt={}));var vNt;(function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.ERROR=2]="ERROR",e[e.NONE=3]="NONE"})(vNt||(uh.LogVerbosity=vNt={}));var _Nt;(function(e){e[e.DEADLINE=1]="DEADLINE",e[e.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",e[e.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",e[e.CANCELLATION=8]="CANCELLATION",e[e.DEFAULTS=65535]="DEFAULTS"})(_Nt||(uh.Propagate=_Nt={}));uh.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1;uh.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4*1024*1024});var Kxe=y((tdi,fln)=>{fln.exports={name:"@grpc/grpc-js",version:"1.14.3",description:"gRPC Library for Node - pure JS implementation",homepage:"https://grpc.io/",repository:"https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",main:"build/src/index.js",engines:{node:">=12.10.0"},keywords:[],author:{name:"Google Inc."},types:"build/src/index.d.ts",license:"Apache-2.0",devDependencies:{"@grpc/proto-loader":"file:../proto-loader","@types/gulp":"^4.0.17","@types/gulp-mocha":"0.0.37","@types/lodash":"^4.14.202","@types/mocha":"^10.0.6","@types/ncp":"^2.0.8","@types/node":">=20.11.20","@types/pify":"^5.0.4","@types/semver":"^7.5.8","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0","@typescript-eslint/typescript-estree":"^7.1.0","clang-format":"^1.8.0",eslint:"^8.42.0","eslint-config-prettier":"^8.8.0","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^4.2.1",execa:"^2.0.3",gulp:"^4.0.2","gulp-mocha":"^6.0.0",lodash:"^4.17.21",madge:"^5.0.1","mocha-jenkins-reporter":"^0.4.1",ncp:"^2.0.0",pify:"^4.0.1",prettier:"^2.8.8",rimraf:"^3.0.2",semver:"^7.6.0","ts-node":"^10.9.2",typescript:"^5.3.3"},contributors:[{name:"Google Inc."}],scripts:{build:"npm run compile",clean:"rimraf ./build",compile:"tsc -p .",format:'clang-format -i -style="{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}" src/*.ts test/*.ts',lint:"eslint src/*.ts test/*.ts",prepare:"npm run copy-protos && npm run generate-types && npm run generate-test-types && npm run compile",test:"gulp test",check:"npm run lint",fix:"eslint --fix src/*.ts test/*.ts",pretest:"npm run generate-types && npm run generate-test-types && npm run compile",posttest:"npm run check && madge -c ./build/src","generate-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ --include-dirs proto/ proto/xds/ proto/protoc-gen-validate/ -O src/generated/ --grpcLib ../index channelz.proto xds/service/orca/v3/orca.proto","generate-test-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --include-dirs test/fixtures/ -O test/generated/ --grpcLib ../../src/index test_service.proto echo_service.proto","copy-protos":"node ./copy-protos"},dependencies:{"@grpc/proto-loader":"^0.8.0","@js-sdsl/ordered-map":"^4.4.2"},files:["src/**/*.ts","build/src/**/*.{js,d.ts,js.map}","proto/**/*.proto","proto/**/LICENSE","LICENSE","deps/envoy-api/envoy/api/v2/**/*.proto","deps/envoy-api/envoy/config/**/*.proto","deps/envoy-api/envoy/service/**/*.proto","deps/envoy-api/envoy/type/**/*.proto","deps/udpa/udpa/**/*.proto","deps/googleapis/google/api/*.proto","deps/googleapis/google/rpc/*.proto","deps/protoc-gen-validate/validate/**/*.proto"]}});var Ts=y(tp=>{"use strict";var Zxe,Xxe,Qxe,eIe;Object.defineProperty(tp,"__esModule",{value:!0});tp.log=tp.setLoggerVerbosity=tp.setLogger=tp.getLogger=void 0;tp.trace=xln;tp.isTracerEnabled=xNt;var hE=Ln(),pln=require("process"),hln=Kxe().version,mln={error:(e,...t)=>{console.error("E "+e,...t)},info:(e,...t)=>{console.error("I "+e,...t)},debug:(e,...t)=>{console.error("D "+e,...t)}},yC=mln,Qk=hE.LogVerbosity.ERROR,gln=(Xxe=(Zxe=process.env.GRPC_NODE_VERBOSITY)!==null&&Zxe!==void 0?Zxe:process.env.GRPC_VERBOSITY)!==null&&Xxe!==void 0?Xxe:"";switch(gln.toUpperCase()){case"DEBUG":Qk=hE.LogVerbosity.DEBUG;break;case"INFO":Qk=hE.LogVerbosity.INFO;break;case"ERROR":Qk=hE.LogVerbosity.ERROR;break;case"NONE":Qk=hE.LogVerbosity.NONE;break;default:}var yln=()=>yC;tp.getLogger=yln;var bln=e=>{yC=e};tp.setLogger=bln;var Sln=e=>{Qk=e};tp.setLoggerVerbosity=Sln;var vln=(e,...t)=>{let r;if(e>=Qk){switch(e){case hE.LogVerbosity.DEBUG:r=yC.debug;break;case hE.LogVerbosity.INFO:r=yC.info;break;case hE.LogVerbosity.ERROR:r=yC.error;break}r||(r=yC.error),r&&r.bind(yC)(...t)}};tp.log=vln;var _ln=(eIe=(Qxe=process.env.GRPC_NODE_TRACE)!==null&&Qxe!==void 0?Qxe:process.env.GRPC_TRACE)!==null&&eIe!==void 0?eIe:"",tIe=new Set,ENt=new Set;for(let e of _ln.split(","))e.startsWith("-")?ENt.add(e.substring(1)):tIe.add(e);var Eln=tIe.has("all");function xln(e,t,r){xNt(t)&&(0,tp.log)(e,new Date().toISOString()+" | v"+hln+" "+pln.pid+" | "+t+" | "+r)}function xNt(e){return!ENt.has(e)&&(Eln||tIe.has(e))}});var MZ=y(DZ=>{"use strict";Object.defineProperty(DZ,"__esModule",{value:!0});DZ.getErrorMessage=Iln;DZ.getErrorCode=wln;function Iln(e){return e instanceof Error?e.message:String(e)}function wln(e){return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="number"?e.code:null}});var Qc=y(FZ=>{"use strict";Object.defineProperty(FZ,"__esModule",{value:!0});FZ.Metadata=void 0;var Cln=Ts(),Aln=Ln(),Tln=MZ(),Oln=/^[:0-9a-z_.-]+$/,Pln=/^[ -~]*$/;function Rln(e){return Oln.test(e)}function kln(e){return Pln.test(e)}function wNt(e){return e.endsWith("-bin")}function Nln(e){return!e.startsWith("grpc-")}function BZ(e){return e.toLowerCase()}function INt(e,t){if(!Rln(e))throw new Error('Metadata key "'+e+'" contains illegal characters');if(t!=null)if(wNt(e)){if(!Buffer.isBuffer(t))throw new Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(t))throw new Error("keys that don't end with '-bin' must have String values");if(!kln(t))throw new Error('Metadata string value "'+t+'" contains illegal characters')}}var rIe=class e{constructor(t={}){this.internalRepr=new Map,this.opaqueData=new Map,this.options=t}set(t,r){t=BZ(t),INt(t,r),this.internalRepr.set(t,[r])}add(t,r){t=BZ(t),INt(t,r);let n=this.internalRepr.get(t);n===void 0?this.internalRepr.set(t,[r]):n.push(r)}remove(t){t=BZ(t),this.internalRepr.delete(t)}get(t){return t=BZ(t),this.internalRepr.get(t)||[]}getMap(){let t={};for(let[r,n]of this.internalRepr)if(n.length>0){let i=n[0];t[r]=Buffer.isBuffer(i)?Buffer.from(i):i}return t}clone(){let t=new e(this.options),r=t.internalRepr;for(let[n,i]of this.internalRepr){let s=i.map(o=>Buffer.isBuffer(o)?Buffer.from(o):o);r.set(n,s)}return t}merge(t){for(let[r,n]of t.internalRepr){let i=(this.internalRepr.get(r)||[]).concat(n);this.internalRepr.set(r,i)}}setOptions(t){this.options=t}getOptions(){return this.options}toHttp2Headers(){let t={};for(let[r,n]of this.internalRepr)r.startsWith(":")||(t[r]=n.map(Dln));return t}toJSON(){let t={};for(let[r,n]of this.internalRepr)t[r]=n;return t}setOpaque(t,r){this.opaqueData.set(t,r)}getOpaque(t){return this.opaqueData.get(t)}static fromHttp2Headers(t){let r=new e;for(let n of Object.keys(t)){if(n.charAt(0)===":")continue;let i=t[n];try{wNt(n)?Array.isArray(i)?i.forEach(s=>{r.add(n,Buffer.from(s,"base64"))}):i!==void 0&&(Nln(n)?i.split(",").forEach(s=>{r.add(n,Buffer.from(s.trim(),"base64"))}):r.add(n,Buffer.from(i,"base64"))):Array.isArray(i)?i.forEach(s=>{r.add(n,s)}):i!==void 0&&r.add(n,i)}catch(s){let o=`Failed to add metadata entry ${n}: ${i}. ${(0,Tln.getErrorMessage)(s)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,Cln.log)(Aln.LogVerbosity.ERROR,o)}}return r}};FZ.Metadata=rIe;var Dln=e=>Buffer.isBuffer(e)?e.toString("base64"):e});var LZ=y(UZ=>{"use strict";Object.defineProperty(UZ,"__esModule",{value:!0});UZ.CallCredentials=void 0;var oIe=Qc();function Mln(e){return"getRequestHeaders"in e&&typeof e.getRequestHeaders=="function"}var e1=class e{static createFromMetadataGenerator(t){return new iIe(t)}static createFromGoogleCredential(t){return e.createFromMetadataGenerator((r,n)=>{let i;Mln(t)?i=t.getRequestHeaders(r.service_url):i=new Promise((s,o)=>{t.getRequestMetadata(r.service_url,(a,c)=>{if(a){o(a);return}if(!c){o(new Error("Headers not set by metadata plugin"));return}s(c)})}),i.then(s=>{let o=new oIe.Metadata;for(let a of Object.keys(s))o.add(a,s[a]);n(null,o)},s=>{n(s)})})}static createEmpty(){return new sIe}};UZ.CallCredentials=e1;var nIe=class e extends e1{constructor(t){super(),this.creds=t}async generateMetadata(t){let r=new oIe.Metadata,n=await Promise.all(this.creds.map(i=>i.generateMetadata(t)));for(let i of n)r.merge(i);return r}compose(t){return new e(this.creds.concat([t]))}_equals(t){return this===t?!0:t instanceof e?this.creds.every((r,n)=>r._equals(t.creds[n])):!1}},iIe=class e extends e1{constructor(t){super(),this.metadataGenerator=t}generateMetadata(t){return new Promise((r,n)=>{this.metadataGenerator(t,(i,s)=>{s!==void 0?r(s):n(i)})})}compose(t){return new nIe([this,t])}_equals(t){return this===t?!0:t instanceof e?this.metadataGenerator===t.metadataGenerator:!1}},sIe=class e extends e1{generateMetadata(t){return Promise.resolve(new oIe.Metadata)}compose(t){return t}_equals(t){return t instanceof e}}});var cIe=y(JU=>{"use strict";Object.defineProperty(JU,"__esModule",{value:!0});JU.CIPHER_SUITES=void 0;JU.getDefaultRootsData=Fln;var Bln=require("fs");JU.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;var CNt=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH,aIe=null;function Fln(){return CNt?(aIe===null&&(aIe=Bln.readFileSync(CNt)),aIe):null}});var bd=y(t1=>{"use strict";Object.defineProperty(t1,"__esModule",{value:!0});t1.parseUri=Lln;t1.splitHostPort=qln;t1.combineHostPort=Vln;t1.uriToString=$ln;var Uln=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;function Lln(e){let t=Uln.exec(e);return t===null?null:{scheme:t[1],authority:t[2],path:t[3]}}var ANt=/^\d+$/;function qln(e){if(e.startsWith("[")){let t=e.indexOf("]");if(t===-1)return null;let r=e.substring(1,t);if(r.indexOf(":")===-1)return null;if(e.length>t+1)if(e[t+1]===":"){let n=e.substring(t+2);return ANt.test(n)?{host:r,port:+n}:null}else return null;else return{host:r}}else{let t=e.split(":");return t.length===2?ANt.test(t[1])?{host:t[0],port:+t[1]}:null:{host:e}}}function Vln(e){return e.port===void 0?e.host:e.host.includes(":")?`[${e.host}]:${e.port}`:`${e.host}:${e.port}`}function $ln(e){let t="";return e.scheme!==void 0&&(t+=e.scheme+":"),e.authority!==void 0&&(t+="//"+e.authority+"/"),t+=e.path,t}});var Om=y(rS=>{"use strict";Object.defineProperty(rS,"__esModule",{value:!0});rS.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=void 0;rS.registerResolver=Hln;rS.registerDefaultScheme=Gln;rS.createResolver=zln;rS.getDefaultAuthority=jln;rS.mapUriDefaultScheme=Wln;var uIe=bd();rS.CHANNEL_ARGS_CONFIG_SELECTOR_KEY="grpc.internal.config_selector";var r1={},lIe=null;function Hln(e,t){r1[e]=t}function Gln(e){lIe=e}function zln(e,t,r){if(e.scheme!==void 0&&e.scheme in r1)return new r1[e.scheme](e,t,r);throw new Error(`No resolver could be created for target ${(0,uIe.uriToString)(e)}`)}function jln(e){if(e.scheme!==void 0&&e.scheme in r1)return r1[e.scheme].getDefaultAuthority(e);throw new Error(`Invalid target ${(0,uIe.uriToString)(e)}`)}function Wln(e){return e.scheme===void 0||!(e.scheme in r1)?lIe!==null?{scheme:lIe,authority:void 0,path:(0,uIe.uriToString)(e)}:null:e}});var n1=y(KU=>{"use strict";Object.defineProperty(KU,"__esModule",{value:!0});KU.ChannelCredentials=void 0;KU.createCertificateProviderChannelCredentials=Zln;var YU=require("tls"),$Z=LZ(),fIe=cIe(),TNt=bd(),Jln=Om(),Yln=Ts(),Kln=Ln();function dIe(e,t){if(e&&!(e instanceof Buffer))throw new TypeError(`${t}, if provided, must be a Buffer.`)}var bC=class{compose(t){return new mIe(this,t)}static createSsl(t,r,n,i){var s;if(dIe(t,"Root certificate"),dIe(r,"Private key"),dIe(n,"Certificate chain"),r&&!n)throw new Error("Private key must be given with accompanying certificate chain");if(!r&&n)throw new Error("Certificate chain must be given with accompanying private key");let o=(0,YU.createSecureContext)({ca:(s=t??(0,fIe.getDefaultRootsData)())!==null&&s!==void 0?s:void 0,key:r??void 0,cert:n??void 0,ciphers:fIe.CIPHER_SUITES});return new qZ(o,i??{})}static createFromSecureContext(t,r){return new qZ(t,r??{})}static createInsecure(){return new pIe}};KU.ChannelCredentials=bC;var pIe=class e extends bC{constructor(){super()}compose(t){throw new Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals(t){return t instanceof e}_createSecureConnector(t,r,n){return{connect(i){return Promise.resolve({socket:i,secure:!1})},waitForReady:()=>Promise.resolve(),getCallCredentials:()=>n??$Z.CallCredentials.createEmpty(),destroy(){}}}};function ONt(e,t,r,n){var i,s;let o={secureContext:e},a=r;if("grpc.http_connect_target"in n){let d=(0,TNt.parseUri)(n["grpc.http_connect_target"]);d&&(a=d)}let c=(0,Jln.getDefaultAuthority)(a),l=(0,TNt.splitHostPort)(c),u=(i=l?.host)!==null&&i!==void 0?i:c;if(o.host=u,t.checkServerIdentity&&(o.checkServerIdentity=t.checkServerIdentity),t.rejectUnauthorized!==void 0&&(o.rejectUnauthorized=t.rejectUnauthorized),o.ALPNProtocols=["h2"],n["grpc.ssl_target_name_override"]){let d=n["grpc.ssl_target_name_override"],p=(s=o.checkServerIdentity)!==null&&s!==void 0?s:YU.checkServerIdentity;o.checkServerIdentity=(f,h)=>p(d,h),o.servername=d}else o.servername=u;return n["grpc-node.tls_enable_trace"]&&(o.enableTrace=!0),o}var hIe=class{constructor(t,r){this.connectionOptions=t,this.callCredentials=r}connect(t){let r=Object.assign({socket:t},this.connectionOptions);return new Promise((n,i)=>{let s=(0,YU.connect)(r,()=>{var o;if((!((o=this.connectionOptions.rejectUnauthorized)!==null&&o!==void 0)||o)&&!s.authorized){i(s.authorizationError);return}n({socket:s,secure:!0})});s.on("error",o=>{i(o)})})}waitForReady(){return Promise.resolve()}getCallCredentials(){return this.callCredentials}destroy(){}},qZ=class e extends bC{constructor(t,r){super(),this.secureContext=t,this.verifyOptions=r}_isSecure(){return!0}_equals(t){return this===t?!0:t instanceof e?this.secureContext===t.secureContext&&this.verifyOptions.checkServerIdentity===t.verifyOptions.checkServerIdentity:!1}_createSecureConnector(t,r,n){let i=ONt(this.secureContext,this.verifyOptions,t,r);return new hIe(i,n??$Z.CallCredentials.createEmpty())}},VZ=class e extends bC{constructor(t,r,n){super(),this.caCertificateProvider=t,this.identityCertificateProvider=r,this.verifyOptions=n,this.refcount=0,this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this),this.secureContextWatchers=[]}_isSecure(){return!0}_equals(t){var r,n;return this===t?!0:t instanceof e?this.caCertificateProvider===t.caCertificateProvider&&this.identityCertificateProvider===t.identityCertificateProvider&&((r=this.verifyOptions)===null||r===void 0?void 0:r.checkServerIdentity)===((n=t.verifyOptions)===null||n===void 0?void 0:n.checkServerIdentity):!1}ref(){var t;this.refcount===0&&(this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener),(t=this.identityCertificateProvider)===null||t===void 0||t.addIdentityCertificateListener(this.identityCertificateUpdateListener)),this.refcount+=1}unref(){var t;this.refcount-=1,this.refcount===0&&(this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener),(t=this.identityCertificateProvider)===null||t===void 0||t.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_createSecureConnector(t,r,n){return this.ref(),new e.SecureConnectorImpl(this,t,r,n??$Z.CallCredentials.createEmpty())}maybeUpdateWatchers(){if(this.hasReceivedUpdates()){for(let t of this.secureContextWatchers)t(this.getLatestSecureContext());this.secureContextWatchers=[]}}handleCaCertificateUpdate(t){this.latestCaUpdate=t,this.maybeUpdateWatchers()}handleIdentityCertitificateUpdate(t){this.latestIdentityUpdate=t,this.maybeUpdateWatchers()}hasReceivedUpdates(){return!(this.latestCaUpdate===void 0||this.identityCertificateProvider&&this.latestIdentityUpdate===void 0)}getSecureContext(){return this.hasReceivedUpdates()?Promise.resolve(this.getLatestSecureContext()):new Promise(t=>{this.secureContextWatchers.push(t)})}getLatestSecureContext(){var t,r;if(!this.latestCaUpdate||this.identityCertificateProvider!==null&&!this.latestIdentityUpdate)return null;try{return(0,YU.createSecureContext)({ca:this.latestCaUpdate.caCertificate,key:(t=this.latestIdentityUpdate)===null||t===void 0?void 0:t.privateKey,cert:(r=this.latestIdentityUpdate)===null||r===void 0?void 0:r.certificate,ciphers:fIe.CIPHER_SUITES})}catch(n){return(0,Yln.log)(Kln.LogVerbosity.ERROR,"Failed to createSecureContext with error "+n.message),null}}};VZ.SecureConnectorImpl=class{constructor(e,t,r,n){this.parent=e,this.channelTarget=t,this.options=r,this.callCredentials=n}connect(e){return new Promise((t,r)=>{let n=this.parent.getLatestSecureContext();if(!n){r(new Error("Failed to load credentials"));return}e.closed&&r(new Error("Socket closed while loading credentials"));let i=ONt(n,this.parent.verifyOptions,this.channelTarget,this.options),s=Object.assign({socket:e},i),o=()=>{r(new Error("Socket closed"))},a=l=>{r(l)},c=(0,YU.connect)(s,()=>{var l;if(c.removeListener("close",o),c.removeListener("error",a),(!((l=this.parent.verifyOptions.rejectUnauthorized)!==null&&l!==void 0)||l)&&!c.authorized){r(c.authorizationError);return}t({socket:c,secure:!0})});c.once("close",o),c.once("error",a)})}async waitForReady(){await this.parent.getSecureContext()}getCallCredentials(){return this.callCredentials}destroy(){this.parent.unref()}};function Zln(e,t,r){return new VZ(e,t,r??{})}var mIe=class e extends bC{constructor(t,r){if(super(),this.channelCredentials=t,this.callCredentials=r,!t._isSecure())throw new Error("Cannot compose insecure credentials")}compose(t){let r=this.callCredentials.compose(t);return new e(this.channelCredentials,r)}_isSecure(){return!0}_equals(t){return this===t?!0:t instanceof e?this.channelCredentials._equals(t.channelCredentials)&&this.callCredentials._equals(t.callCredentials):!1}_createSecureConnector(t,r,n){let i=this.callCredentials.compose(n??$Z.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector(t,r,i)}}});var gE=y(Ny=>{"use strict";Object.defineProperty(Ny,"__esModule",{value:!0});Ny.createChildChannelControlHelper=eun;Ny.registerLoadBalancerType=tun;Ny.registerDefaultLoadBalancerType=run;Ny.createLoadBalancer=nun;Ny.isLoadBalancerNameRegistered=iun;Ny.parseLoadBalancingConfig=PNt;Ny.getDefaultConfig=sun;Ny.selectLbConfigFromList=oun;var Xln=Ts(),Qln=Ln();function eun(e,t){var r,n,i,s,o,a,c,l,u,d;return{createSubchannel:(n=(r=t.createSubchannel)===null||r===void 0?void 0:r.bind(t))!==null&&n!==void 0?n:e.createSubchannel.bind(e),updateState:(s=(i=t.updateState)===null||i===void 0?void 0:i.bind(t))!==null&&s!==void 0?s:e.updateState.bind(e),requestReresolution:(a=(o=t.requestReresolution)===null||o===void 0?void 0:o.bind(t))!==null&&a!==void 0?a:e.requestReresolution.bind(e),addChannelzChild:(l=(c=t.addChannelzChild)===null||c===void 0?void 0:c.bind(t))!==null&&l!==void 0?l:e.addChannelzChild.bind(e),removeChannelzChild:(d=(u=t.removeChannelzChild)===null||u===void 0?void 0:u.bind(t))!==null&&d!==void 0?d:e.removeChannelzChild.bind(e)}}var mE={},ZU=null;function tun(e,t,r){mE[e]={LoadBalancer:t,LoadBalancingConfig:r}}function run(e){ZU=e}function nun(e,t){let r=e.getLoadBalancerName();return r in mE?new mE[r].LoadBalancer(t):null}function iun(e){return e in mE}function PNt(e){let t=Object.keys(e);if(t.length!==1)throw new Error("Provided load balancing config has multiple conflicting entries");let r=t[0];if(r in mE)try{return mE[r].LoadBalancingConfig.createFromJson(e[r])}catch(n){throw new Error(`${r}: ${n.message}`)}else throw new Error(`Unrecognized load balancing config name ${r}`)}function sun(){if(!ZU)throw new Error("No default load balancer type registered");return new mE[ZU].LoadBalancingConfig}function oun(e,t=!1){for(let r of e)try{return PNt(r)}catch(n){(0,Xln.log)(Qln.LogVerbosity.DEBUG,"Config parsing failed with error",n.message);continue}return t&&ZU?new mE[ZU].LoadBalancingConfig:null}});var gIe=y(XU=>{"use strict";Object.defineProperty(XU,"__esModule",{value:!0});XU.validateRetryThrottling=RNt;XU.validateServiceConfig=kNt;XU.extractAndSelectServiceConfig=gun;var aun=require("os"),HZ=Ln(),GZ=/^\d+(\.\d{1,9})?s$/,cun="node";function lun(e){if("service"in e&&e.service!==""){if(typeof e.service!="string")throw new Error(`Invalid method config name: invalid service: expected type string, got ${typeof e.service}`);if("method"in e&&e.method!==""){if(typeof e.method!="string")throw new Error(`Invalid method config name: invalid method: expected type string, got ${typeof e.service}`);return{service:e.service,method:e.method}}else return{service:e.service}}else{if("method"in e&&e.method!==void 0)throw new Error("Invalid method config name: method set with empty or unset service");return{}}}function uun(e){if(!("maxAttempts"in e)||!Number.isInteger(e.maxAttempts)||e.maxAttempts<2)throw new Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in e)||typeof e.initialBackoff!="string"||!GZ.test(e.initialBackoff))throw new Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("maxBackoff"in e)||typeof e.maxBackoff!="string"||!GZ.test(e.maxBackoff))throw new Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("backoffMultiplier"in e)||typeof e.backoffMultiplier!="number"||e.backoffMultiplier<=0)throw new Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!("retryableStatusCodes"in e&&Array.isArray(e.retryableStatusCodes)))throw new Error("Invalid method config retry policy: retryableStatusCodes is required");if(e.retryableStatusCodes.length===0)throw new Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(let t of e.retryableStatusCodes)if(typeof t=="number"){if(!Object.values(HZ.Status).includes(t))throw new Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else if(typeof t=="string"){if(!Object.values(HZ.Status).includes(t.toUpperCase()))throw new Error("Invalid method config retry policy: retryableStatusCodes value not a status code name")}else throw new Error("Invalid method config retry policy: retryableStatusCodes value must be a string or number");return{maxAttempts:e.maxAttempts,initialBackoff:e.initialBackoff,maxBackoff:e.maxBackoff,backoffMultiplier:e.backoffMultiplier,retryableStatusCodes:e.retryableStatusCodes}}function dun(e){if(!("maxAttempts"in e)||!Number.isInteger(e.maxAttempts)||e.maxAttempts<2)throw new Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in e&&(typeof e.hedgingDelay!="string"||!GZ.test(e.hedgingDelay)))throw new Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");if("nonFatalStatusCodes"in e&&Array.isArray(e.nonFatalStatusCodes))for(let r of e.nonFatalStatusCodes)if(typeof r=="number"){if(!Object.values(HZ.Status).includes(r))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range")}else if(typeof r=="string"){if(!Object.values(HZ.Status).includes(r.toUpperCase()))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not a status code name")}else throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number");let t={maxAttempts:e.maxAttempts};return e.hedgingDelay&&(t.hedgingDelay=e.hedgingDelay),e.nonFatalStatusCodes&&(t.nonFatalStatusCodes=e.nonFatalStatusCodes),t}function fun(e){var t;let r={name:[]};if(!("name"in e)||!Array.isArray(e.name))throw new Error("Invalid method config: invalid name array");for(let n of e.name)r.name.push(lun(n));if("waitForReady"in e){if(typeof e.waitForReady!="boolean")throw new Error("Invalid method config: invalid waitForReady");r.waitForReady=e.waitForReady}if("timeout"in e)if(typeof e.timeout=="object"){if(!("seconds"in e.timeout)||typeof e.timeout.seconds!="number")throw new Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in e.timeout)||typeof e.timeout.nanos!="number")throw new Error("Invalid method config: invalid timeout.nanos");r.timeout=e.timeout}else if(typeof e.timeout=="string"&&GZ.test(e.timeout)){let n=e.timeout.substring(0,e.timeout.length-1).split(".");r.timeout={seconds:n[0]|0,nanos:((t=n[1])!==null&&t!==void 0?t:0)|0}}else throw new Error("Invalid method config: invalid timeout");if("maxRequestBytes"in e){if(typeof e.maxRequestBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");r.maxRequestBytes=e.maxRequestBytes}if("maxResponseBytes"in e){if(typeof e.maxResponseBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");r.maxResponseBytes=e.maxResponseBytes}if("retryPolicy"in e){if("hedgingPolicy"in e)throw new Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");r.retryPolicy=uun(e.retryPolicy)}else"hedgingPolicy"in e&&(r.hedgingPolicy=dun(e.hedgingPolicy));return r}function RNt(e){if(!("maxTokens"in e)||typeof e.maxTokens!="number"||e.maxTokens<=0||e.maxTokens>1e3)throw new Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in e)||typeof e.tokenRatio!="number"||e.tokenRatio<=0)throw new Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+e.maxTokens.toFixed(3),tokenRatio:+e.tokenRatio.toFixed(3)}}function pun(e){if(!(typeof e=="object"&&e!==null))throw new Error(`Invalid loadBalancingConfig: unexpected type ${typeof e}`);let t=Object.keys(e);if(t.length>1)throw new Error(`Invalid loadBalancingConfig: unexpected multiple keys ${t}`);if(t.length===0)throw new Error("Invalid loadBalancingConfig: load balancing policy name required");return{[t[0]]:e[t[0]]}}function kNt(e){let t={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in e)if(typeof e.loadBalancingPolicy=="string")t.loadBalancingPolicy=e.loadBalancingPolicy;else throw new Error("Invalid service config: invalid loadBalancingPolicy");if("loadBalancingConfig"in e)if(Array.isArray(e.loadBalancingConfig))for(let n of e.loadBalancingConfig)t.loadBalancingConfig.push(pun(n));else throw new Error("Invalid service config: invalid loadBalancingConfig");if("methodConfig"in e&&Array.isArray(e.methodConfig))for(let n of e.methodConfig)t.methodConfig.push(fun(n));"retryThrottling"in e&&(t.retryThrottling=RNt(e.retryThrottling));let r=[];for(let n of t.methodConfig)for(let i of n.name){for(let s of r)if(i.service===s.service&&i.method===s.method)throw new Error(`Invalid service config: duplicate name ${i.service}/${i.method}`);r.push(i)}return t}function hun(e){if(!("serviceConfig"in e))throw new Error("Invalid service config choice: missing service config");let t={serviceConfig:kNt(e.serviceConfig)};if("clientLanguage"in e)if(Array.isArray(e.clientLanguage)){t.clientLanguage=[];for(let n of e.clientLanguage)if(typeof n=="string")t.clientLanguage.push(n);else throw new Error("Invalid service config choice: invalid clientLanguage")}else throw new Error("Invalid service config choice: invalid clientLanguage");if("clientHostname"in e)if(Array.isArray(e.clientHostname)){t.clientHostname=[];for(let n of e.clientHostname)if(typeof n=="string")t.clientHostname.push(n);else throw new Error("Invalid service config choice: invalid clientHostname")}else throw new Error("Invalid service config choice: invalid clientHostname");if("percentage"in e)if(typeof e.percentage=="number"&&0<=e.percentage&&e.percentage<=100)t.percentage=e.percentage;else throw new Error("Invalid service config choice: invalid percentage");let r=["clientLanguage","percentage","clientHostname","serviceConfig"];for(let n in e)if(!r.includes(n))throw new Error(`Invalid service config choice: unexpected field ${n}`);return t}function mun(e,t){if(!Array.isArray(e))throw new Error("Invalid service config list");for(let r of e){let n=hun(r);if(!(typeof n.percentage=="number"&&t>n.percentage)){if(Array.isArray(n.clientHostname)){let i=!1;for(let s of n.clientHostname)s===aun.hostname()&&(i=!0);if(!i)continue}if(Array.isArray(n.clientLanguage)){let i=!1;for(let s of n.clientLanguage)s===cun&&(i=!0);if(!i)continue}return n.serviceConfig}}throw new Error("No matching service config found")}function gun(e,t){for(let r of e)if(r.length>0&&r[0].startsWith("grpc_config=")){let n=r.join("").substring(12),i=JSON.parse(n);return mun(i,t)}return null}});var Sd=y(zZ=>{"use strict";Object.defineProperty(zZ,"__esModule",{value:!0});zZ.ConnectivityState=void 0;var NNt;(function(e){e[e.IDLE=0]="IDLE",e[e.CONNECTING=1]="CONNECTING",e[e.READY=2]="READY",e[e.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",e[e.SHUTDOWN=4]="SHUTDOWN"})(NNt||(zZ.ConnectivityState=NNt={}))});var nS=y(yE=>{"use strict";Object.defineProperty(yE,"__esModule",{value:!0});yE.QueuePicker=yE.UnavailablePicker=yE.PickResultType=void 0;var yun=Qc(),bun=Ln(),jZ;(function(e){e[e.COMPLETE=0]="COMPLETE",e[e.QUEUE=1]="QUEUE",e[e.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",e[e.DROP=3]="DROP"})(jZ||(yE.PickResultType=jZ={}));var yIe=class{constructor(t){this.status=Object.assign({code:bun.Status.UNAVAILABLE,details:"No connection established",metadata:new yun.Metadata},t)}pick(t){return{pickResultType:jZ.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}};yE.UnavailablePicker=yIe;var bIe=class{constructor(t,r){this.loadBalancer=t,this.childPicker=r,this.calledExitIdle=!1}pick(t){return this.calledExitIdle||(process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0),this.childPicker?this.childPicker.pick(t):{pickResultType:jZ.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}};yE.QueuePicker=bIe});var i1=y(JZ=>{"use strict";Object.defineProperty(JZ,"__esModule",{value:!0});JZ.BackoffTimeout=void 0;var Sun=Ln(),vun=Ts(),_un="backoff",Eun=1e3,xun=1.6,Iun=12e4,wun=.2;function Cun(e,t){return Math.random()*(t-e)+e}var WZ=class e{constructor(t,r){this.callback=t,this.initialDelay=Eun,this.multiplier=xun,this.maxDelay=Iun,this.jitter=wun,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,this.id=e.getNextId(),r&&(r.initialDelay&&(this.initialDelay=r.initialDelay),r.multiplier&&(this.multiplier=r.multiplier),r.jitter&&(this.jitter=r.jitter),r.maxDelay&&(this.maxDelay=r.maxDelay)),this.trace("constructed initialDelay="+this.initialDelay+" multiplier="+this.multiplier+" jitter="+this.jitter+" maxDelay="+this.maxDelay),this.nextDelay=this.initialDelay,this.timerId=setTimeout(()=>{},0),clearTimeout(this.timerId)}static getNextId(){return this.nextId++}trace(t){vun.trace(Sun.LogVerbosity.DEBUG,_un,"{"+this.id+"} "+t)}runTimer(t){var r,n;this.trace("runTimer(delay="+t+")"),this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+t),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.trace("timer fired"),this.running=!1,this.callback()},t),this.hasRef||(n=(r=this.timerId).unref)===null||n===void 0||n.call(r)}runOnce(){this.trace("runOnce()"),this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);let t=Math.min(this.nextDelay*this.multiplier,this.maxDelay),r=t*this.jitter;this.nextDelay=t+Cun(-r,r)}stop(){this.trace("stop()"),clearTimeout(this.timerId),this.running=!1}reset(){if(this.trace("reset() running="+this.running),this.nextDelay=this.initialDelay,this.running){let t=new Date,r=this.startTime;r.setMilliseconds(r.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),t<r?this.runTimer(r.getTime()-t.getTime()):this.running=!1}}isRunning(){return this.running}ref(){var t,r;this.hasRef=!0,(r=(t=this.timerId).ref)===null||r===void 0||r.call(t)}unref(){var t,r;this.hasRef=!1,(r=(t=this.timerId).unref)===null||r===void 0||r.call(t)}getEndTime(){return this.endTime}};JZ.BackoffTimeout=WZ;WZ.nextId=0});var KZ=y(YZ=>{"use strict";Object.defineProperty(YZ,"__esModule",{value:!0});YZ.ChildLoadBalancerHandler=void 0;var Aun=gE(),Tun=Sd(),Oun="child_load_balancer_helper",SIe=class{constructor(t){this.channelControlHelper=t,this.currentChild=null,this.pendingChild=null,this.latestConfig=null,this.ChildPolicyHelper=class{constructor(r){this.parent=r,this.child=null}createSubchannel(r,n){return this.parent.channelControlHelper.createSubchannel(r,n)}updateState(r,n,i){var s;if(this.calledByPendingChild()){if(r===Tun.ConnectivityState.CONNECTING)return;(s=this.parent.currentChild)===null||s===void 0||s.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(r,n,i)}requestReresolution(){var r;let n=(r=this.parent.pendingChild)!==null&&r!==void 0?r:this.parent.currentChild;this.child===n&&this.parent.channelControlHelper.requestReresolution()}setChild(r){this.child=r}addChannelzChild(r){this.parent.channelControlHelper.addChannelzChild(r)}removeChannelzChild(r){this.parent.channelControlHelper.removeChannelzChild(r)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}configUpdateRequiresNewPolicyInstance(t,r){return t.getLoadBalancerName()!==r.getLoadBalancerName()}updateAddressList(t,r,n,i){let s;if(this.currentChild===null||this.latestConfig===null||this.configUpdateRequiresNewPolicyInstance(this.latestConfig,r)){let o=new this.ChildPolicyHelper(this),a=(0,Aun.createLoadBalancer)(r,o);o.setChild(a),this.currentChild===null?(this.currentChild=a,s=this.currentChild):(this.pendingChild&&this.pendingChild.destroy(),this.pendingChild=a,s=this.pendingChild)}else this.pendingChild===null?s=this.currentChild:s=this.pendingChild;return this.latestConfig=r,s.updateAddressList(t,r,n,i)}exitIdle(){this.currentChild&&(this.currentChild.exitIdle(),this.pendingChild&&this.pendingChild.exitIdle())}resetBackoff(){this.currentChild&&(this.currentChild.resetBackoff(),this.pendingChild&&this.pendingChild.resetBackoff())}destroy(){this.currentChild&&(this.currentChild.destroy(),this.currentChild=null),this.pendingChild&&(this.pendingChild.destroy(),this.pendingChild=null)}getTypeName(){return Oun}};YZ.ChildLoadBalancerHandler=SIe});var BNt=y(ZZ=>{"use strict";Object.defineProperty(ZZ,"__esModule",{value:!0});ZZ.ResolvingLoadBalancer=void 0;var Pun=gE(),Run=gIe(),nf=Sd(),DNt=Om(),QU=nS(),kun=i1(),vIe=Ln(),Nun=Qc(),Dun=Ts(),Mun=Ln(),Fun=bd(),Uun=KZ(),Lun="resolving_load_balancer";function MNt(e){Dun.trace(Mun.LogVerbosity.DEBUG,Lun,e)}var qun=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function Vun(e,t,r,n){for(let i of r.name)switch(n){case"EMPTY":if(!i.service&&!i.method)return!0;break;case"SERVICE":if(i.service===e&&!i.method)return!0;break;case"SERVICE_AND_METHOD":if(i.service===e&&i.method===t)return!0}return!1}function $un(e,t,r,n){for(let i of r)if(Vun(e,t,i,n))return i;return null}function Hun(e){return{invoke(t,r){var n,i;let s=t.split("/").filter(c=>c.length>0),o=(n=s[0])!==null&&n!==void 0?n:"",a=(i=s[1])!==null&&i!==void 0?i:"";if(e&&e.methodConfig)for(let c of qun){let l=$un(o,a,e.methodConfig,c);if(l)return{methodConfig:l,pickInformation:{},status:vIe.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:vIe.Status.OK,dynamicFilterFactories:[]}},unref(){}}}var _Ie=class{constructor(t,r,n,i,s){this.target=t,this.channelControlHelper=r,this.channelOptions=n,this.onSuccessfulResolution=i,this.onFailedResolution=s,this.latestChildState=nf.ConnectivityState.IDLE,this.latestChildPicker=new QU.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=nf.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,n["grpc.service_config"]?this.defaultServiceConfig=(0,Run.validateServiceConfig)(JSON.parse(n["grpc.service_config"])):this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]},this.updateState(nf.ConnectivityState.IDLE,new QU.QueuePicker(this),null),this.childLoadBalancer=new Uun.ChildLoadBalancerHandler({createSubchannel:r.createSubchannel.bind(r),requestReresolution:()=>{this.backoffTimeout.isRunning()?(MNt("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0):this.updateResolution()},updateState:(a,c,l)=>{this.latestChildState=a,this.latestChildPicker=c,this.latestChildErrorMessage=l,this.updateState(a,c,l)},addChannelzChild:r.addChannelzChild.bind(r),removeChannelzChild:r.removeChannelzChild.bind(r)}),this.innerResolver=(0,DNt.createResolver)(t,this.handleResolverResult.bind(this),n);let o={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new kun.BackoffTimeout(()=>{this.continueResolving?(this.updateResolution(),this.continueResolving=!1):this.updateState(this.latestChildState,this.latestChildPicker,this.latestChildErrorMessage)},o),this.backoffTimeout.unref()}handleResolverResult(t,r,n,i){var s,o;this.backoffTimeout.stop(),this.backoffTimeout.reset();let a=!0,c=null;if(n===null?c=this.defaultServiceConfig:n.ok?c=n.value:this.previousServiceConfig!==null?c=this.previousServiceConfig:(a=!1,this.handleResolutionFailure(n.error)),c!==null){let l=(s=c?.loadBalancingConfig)!==null&&s!==void 0?s:[],u=(0,Pun.selectLbConfigFromList)(l,!0);u===null?(a=!1,this.handleResolutionFailure({code:vIe.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new Nun.Metadata})):a=this.childLoadBalancer.updateAddressList(t,u,Object.assign(Object.assign({},this.channelOptions),r),i)}return a&&this.onSuccessfulResolution(c,(o=r[DNt.CHANNEL_ARGS_CONFIG_SELECTOR_KEY])!==null&&o!==void 0?o:Hun(c)),a}updateResolution(){this.innerResolver.updateResolution(),this.currentState===nf.ConnectivityState.IDLE&&this.updateState(nf.ConnectivityState.CONNECTING,this.latestChildPicker,this.latestChildErrorMessage),this.backoffTimeout.runOnce()}updateState(t,r,n){MNt((0,Fun.uriToString)(this.target)+" "+nf.ConnectivityState[this.currentState]+" -> "+nf.ConnectivityState[t]),t===nf.ConnectivityState.IDLE&&(r=new QU.QueuePicker(this,r)),this.currentState=t,this.channelControlHelper.updateState(t,r,n)}handleResolutionFailure(t){this.latestChildState===nf.ConnectivityState.IDLE&&(this.updateState(nf.ConnectivityState.TRANSIENT_FAILURE,new QU.UnavailablePicker(t),t.details),this.onFailedResolution(t))}exitIdle(){(this.currentState===nf.ConnectivityState.IDLE||this.currentState===nf.ConnectivityState.TRANSIENT_FAILURE)&&(this.backoffTimeout.isRunning()?this.continueResolving=!0:this.updateResolution()),this.childLoadBalancer.exitIdle()}updateAddressList(t,r){throw new Error("updateAddressList not supported on ResolvingLoadBalancer")}resetBackoff(){this.backoffTimeout.reset(),this.childLoadBalancer.resetBackoff()}destroy(){this.childLoadBalancer.destroy(),this.innerResolver.destroy(),this.backoffTimeout.reset(),this.backoffTimeout.stop(),this.latestChildState=nf.ConnectivityState.IDLE,this.latestChildPicker=new QU.QueuePicker(this),this.currentState=nf.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}};ZZ.ResolvingLoadBalancer=_Ie});var FNt=y(eL=>{"use strict";Object.defineProperty(eL,"__esModule",{value:!0});eL.recognizedOptions=void 0;eL.channelOptionsEqual=Gun;eL.recognizedOptions={"grpc.ssl_target_name_override":!0,"grpc.primary_user_agent":!0,"grpc.secondary_user_agent":!0,"grpc.default_authority":!0,"grpc.keepalive_time_ms":!0,"grpc.keepalive_timeout_ms":!0,"grpc.keepalive_permit_without_calls":!0,"grpc.service_config":!0,"grpc.max_concurrent_streams":!0,"grpc.initial_reconnect_backoff_ms":!0,"grpc.max_reconnect_backoff_ms":!0,"grpc.use_local_subchannel_pool":!0,"grpc.max_send_message_length":!0,"grpc.max_receive_message_length":!0,"grpc.enable_http_proxy":!0,"grpc.enable_channelz":!0,"grpc.dns_min_time_between_resolutions_ms":!0,"grpc.enable_retries":!0,"grpc.per_rpc_retry_buffer_size":!0,"grpc.retry_buffer_size":!0,"grpc.max_connection_age_ms":!0,"grpc.max_connection_age_grace_ms":!0,"grpc-node.max_session_memory":!0,"grpc.service_config_disable_resolution":!0,"grpc.client_idle_timeout_ms":!0,"grpc-node.tls_enable_trace":!0,"grpc.lb.ring_hash.ring_size_cap":!0,"grpc-node.retry_max_attempts_limit":!0,"grpc-node.flow_control_window":!0,"grpc.server_call_metric_recording":!0};function Gun(e,t){let r=Object.keys(e).sort(),n=Object.keys(t).sort();if(r.length!==n.length)return!1;for(let i=0;i<r.length;i+=1)if(r[i]!==n[i]||e[r[i]]!==t[n[i]])return!1;return!0}});var sf=y(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});Pm.EndpointMap=void 0;Pm.isTcpSubchannelAddress=rL;Pm.subchannelAddressEqual=XZ;Pm.subchannelAddressToString=LNt;Pm.stringToSubchannelAddress=jun;Pm.endpointEqual=Wun;Pm.endpointToString=Jun;Pm.endpointHasAddress=qNt;var UNt=require("net");function rL(e){return"port"in e}function XZ(e,t){return!e&&!t?!0:!e||!t?!1:rL(e)?rL(t)&&e.host===t.host&&e.port===t.port:!rL(t)&&e.path===t.path}function LNt(e){return rL(e)?(0,UNt.isIPv6)(e.host)?"["+e.host+"]:"+e.port:e.host+":"+e.port:e.path}var zun=443;function jun(e,t){return(0,UNt.isIP)(e)?{host:e,port:t??zun}:{path:e}}function Wun(e,t){if(e.addresses.length!==t.addresses.length)return!1;for(let r=0;r<e.addresses.length;r++)if(!XZ(e.addresses[r],t.addresses[r]))return!1;return!0}function Jun(e){return"["+e.addresses.map(LNt).join(", ")+"]"}function qNt(e,t){for(let r of e.addresses)if(XZ(r,t))return!0;return!1}function tL(e,t){if(e.addresses.length!==t.addresses.length)return!1;for(let r of e.addresses){let n=!1;for(let i of t.addresses)if(XZ(r,i)){n=!0;break}if(!n)return!1}return!0}var EIe=class{constructor(){this.map=new Set}get size(){return this.map.size}getForSubchannelAddress(t){for(let r of this.map)if(qNt(r.key,t))return r.value}deleteMissing(t){let r=[];for(let n of this.map){let i=!1;for(let s of t)tL(s,n.key)&&(i=!0);i||(r.push(n.value),this.map.delete(n))}return r}get(t){for(let r of this.map)if(tL(t,r.key))return r.value}set(t,r){for(let n of this.map)if(tL(t,n.key)){n.value=r;return}this.map.add({key:t,value:r})}delete(t){for(let r of this.map)if(tL(t,r.key)){this.map.delete(r);return}}has(t){for(let r of this.map)if(tL(t,r.key))return!0;return!1}clear(){this.map.clear()}*keys(){for(let t of this.map)yield t.key}*values(){for(let t of this.map)yield t.value}*entries(){for(let t of this.map)yield[t.key,t.value]}};Pm.EndpointMap=EIe});var VNt=y(PIe=>{"use strict";Object.defineProperty(PIe,"t",{value:!0});var QZ=class{constructor(t,r,n=1){this.i=void 0,this.h=void 0,this.o=void 0,this.u=t,this.l=r,this.p=n}I(){let t=this,r=t.o.o===t;if(r&&t.p===1)t=t.h;else if(t.i)for(t=t.i;t.h;)t=t.h;else{if(r)return t.o;let n=t.o;for(;n.i===t;)t=n,n=t.o;t=n}return t}B(){let t=this;if(t.h){for(t=t.h;t.i;)t=t.i;return t}else{let r=t.o;for(;r.h===t;)t=r,r=t.o;return t.h!==r?r:t}}_(){let t=this.o,r=this.h,n=r.i;return t.o===this?t.o=r:t.i===this?t.i=r:t.h=r,r.o=t,r.i=this,this.o=r,this.h=n,n&&(n.o=this),r}g(){let t=this.o,r=this.i,n=r.h;return t.o===this?t.o=r:t.i===this?t.i=r:t.h=r,r.o=t,r.h=this,this.o=r,this.i=n,n&&(n.o=this),r}},xIe=class extends QZ{constructor(){super(...arguments),this.M=1}_(){let t=super._();return this.O(),t.O(),t}g(){let t=super.g();return this.O(),t.O(),t}O(){this.M=1,this.i&&(this.M+=this.i.M),this.h&&(this.M+=this.h.M)}},IIe=class{constructor(t=0){this.iteratorType=t}equals(t){return this.T===t.T}},wIe=class{constructor(){this.m=0}get length(){return this.m}size(){return this.m}empty(){return this.m===0}},CIe=class extends wIe{};function SC(){throw new RangeError("Iterator access denied!")}var AIe=class extends CIe{constructor(t=function(n,i){return n<i?-1:n>i?1:0},r=!1){super(),this.v=void 0,this.A=t,this.enableIndex=r,this.N=r?xIe:QZ,this.C=new this.N}R(t,r){let n=this.C;for(;t;){let i=this.A(t.u,r);if(i<0)t=t.h;else if(i>0)n=t,t=t.i;else return t}return n}K(t,r){let n=this.C;for(;t;)this.A(t.u,r)<=0?t=t.h:(n=t,t=t.i);return n}L(t,r){let n=this.C;for(;t;){let i=this.A(t.u,r);if(i<0)n=t,t=t.h;else if(i>0)t=t.i;else return t}return n}k(t,r){let n=this.C;for(;t;)this.A(t.u,r)<0?(n=t,t=t.h):t=t.i;return n}P(t){for(;;){let r=t.o;if(r===this.C)return;if(t.p===1){t.p=0;return}if(t===r.i){let n=r.h;if(n.p===1)n.p=0,r.p=1,r===this.v?this.v=r._():r._();else if(n.h&&n.h.p===1){n.p=r.p,r.p=0,n.h.p=0,r===this.v?this.v=r._():r._();return}else n.i&&n.i.p===1?(n.p=1,n.i.p=0,n.g()):(n.p=1,t=r)}else{let n=r.i;if(n.p===1)n.p=0,r.p=1,r===this.v?this.v=r.g():r.g();else if(n.i&&n.i.p===1){n.p=r.p,r.p=0,n.i.p=0,r===this.v?this.v=r.g():r.g();return}else n.h&&n.h.p===1?(n.p=1,n.h.p=0,n._()):(n.p=1,t=r)}}}S(t){if(this.m===1){this.clear();return}let r=t;for(;r.i||r.h;){if(r.h)for(r=r.h;r.i;)r=r.i;else r=r.i;let i=t.u;t.u=r.u,r.u=i;let s=t.l;t.l=r.l,r.l=s,t=r}this.C.i===r?this.C.i=r.o:this.C.h===r&&(this.C.h=r.o),this.P(r);let n=r.o;if(r===n.i?n.i=void 0:n.h=void 0,this.m-=1,this.v.p=0,this.enableIndex)for(;n!==this.C;)n.M-=1,n=n.o}U(t){let r=typeof t=="number"?t:void 0,n=typeof t=="function"?t:void 0,i=typeof t>"u"?[]:void 0,s=0,o=this.v,a=[];for(;a.length||o;)if(o)a.push(o),o=o.i;else{if(o=a.pop(),s===r)return o;i&&i.push(o),n&&n(o,s,this),s+=1,o=o.h}return i}j(t){for(;;){let r=t.o;if(r.p===0)return;let n=r.o;if(r===n.i){let i=n.h;if(i&&i.p===1){if(i.p=r.p=0,n===this.v)return;n.p=1,t=n;continue}else if(t===r.h){if(t.p=0,t.i&&(t.i.o=r),t.h&&(t.h.o=n),r.h=t.i,n.i=t.h,t.i=r,t.h=n,n===this.v)this.v=t,this.C.o=t;else{let s=n.o;s.i===n?s.i=t:s.h=t}t.o=n.o,r.o=t,n.o=t,n.p=1}else{r.p=0,n===this.v?this.v=n.g():n.g(),n.p=1;return}}else{let i=n.i;if(i&&i.p===1){if(i.p=r.p=0,n===this.v)return;n.p=1,t=n;continue}else if(t===r.i){if(t.p=0,t.i&&(t.i.o=n),t.h&&(t.h.o=r),n.h=t.i,r.i=t.h,t.i=n,t.h=r,n===this.v)this.v=t,this.C.o=t;else{let s=n.o;s.i===n?s.i=t:s.h=t}t.o=n.o,r.o=t,n.o=t,n.p=1}else{r.p=0,n===this.v?this.v=n._():n._(),n.p=1;return}}this.enableIndex&&(r.O(),n.O(),t.O());return}}q(t,r,n){if(this.v===void 0)return this.m+=1,this.v=new this.N(t,r,0),this.v.o=this.C,this.C.o=this.C.i=this.C.h=this.v,this.m;let i,s=this.C.i,o=this.A(s.u,t);if(o===0)return s.l=r,this.m;if(o>0)s.i=new this.N(t,r),s.i.o=s,i=s.i,this.C.i=i;else{let a=this.C.h,c=this.A(a.u,t);if(c===0)return a.l=r,this.m;if(c<0)a.h=new this.N(t,r),a.h.o=a,i=a.h,this.C.h=i;else{if(n!==void 0){let l=n.T;if(l!==this.C){let u=this.A(l.u,t);if(u===0)return l.l=r,this.m;if(u>0){let d=l.I(),p=this.A(d.u,t);if(p===0)return d.l=r,this.m;p<0&&(i=new this.N(t,r),d.h===void 0?(d.h=i,i.o=d):(l.i=i,i.o=l))}}}if(i===void 0)for(i=this.v;;){let l=this.A(i.u,t);if(l>0){if(i.i===void 0){i.i=new this.N(t,r),i.i.o=i,i=i.i;break}i=i.i}else if(l<0){if(i.h===void 0){i.h=new this.N(t,r),i.h.o=i,i=i.h;break}i=i.h}else return i.l=r,this.m}}}if(this.enableIndex){let a=i.o;for(;a!==this.C;)a.M+=1,a=a.o}return this.j(i),this.m+=1,this.m}H(t,r){for(;t;){let n=this.A(t.u,r);if(n<0)t=t.h;else if(n>0)t=t.i;else return t}return t||this.C}clear(){this.m=0,this.v=void 0,this.C.o=void 0,this.C.i=this.C.h=void 0}updateKeyByIterator(t,r){let n=t.T;if(n===this.C&&SC(),this.m===1)return n.u=r,!0;let i=n.B().u;if(n===this.C.i)return this.A(i,r)>0?(n.u=r,!0):!1;let s=n.I().u;return n===this.C.h?this.A(s,r)<0?(n.u=r,!0):!1:this.A(s,r)>=0||this.A(i,r)<=0?!1:(n.u=r,!0)}eraseElementByPos(t){if(t<0||t>this.m-1)throw new RangeError;let r=this.U(t);return this.S(r),this.m}eraseElementByKey(t){if(this.m===0)return!1;let r=this.H(this.v,t);return r===this.C?!1:(this.S(r),!0)}eraseElementByIterator(t){let r=t.T;r===this.C&&SC();let n=r.h===void 0;return t.iteratorType===0?n&&t.next():(!n||r.i===void 0)&&t.next(),this.S(r),t}getHeight(){if(this.m===0)return 0;function t(r){return r?Math.max(t(r.i),t(r.h))+1:0}return t(this.v)}},TIe=class extends IIe{constructor(t,r,n){super(n),this.T=t,this.C=r,this.iteratorType===0?(this.pre=function(){return this.T===this.C.i&&SC(),this.T=this.T.I(),this},this.next=function(){return this.T===this.C&&SC(),this.T=this.T.B(),this}):(this.pre=function(){return this.T===this.C.h&&SC(),this.T=this.T.B(),this},this.next=function(){return this.T===this.C&&SC(),this.T=this.T.I(),this})}get index(){let t=this.T,r=this.C.o;if(t===this.C)return r?r.M-1:0;let n=0;for(t.i&&(n+=t.i.M);t!==r;){let i=t.o;t===i.h&&(n+=1,i.i&&(n+=i.i.M)),t=i}return n}isAccessible(){return this.T!==this.C}},Rm=class e extends TIe{constructor(t,r,n,i){super(t,r,i),this.container=n}get pointer(){this.T===this.C&&SC();let t=this;return new Proxy([],{get(r,n){return n==="0"?t.T.u:n==="1"?t.T.l:(r[0]=t.T.u,r[1]=t.T.l,r[n])},set(r,n,i){if(n!=="1")throw new TypeError("prop must be 1");return t.T.l=i,!0}})}copy(){return new e(this.T,this.C,this.container,this.iteratorType)}},OIe=class extends AIe{constructor(t=[],r,n){super(r,n);let i=this;t.forEach(function(s){i.setElement(s[0],s[1])})}begin(){return new Rm(this.C.i||this.C,this.C,this)}end(){return new Rm(this.C,this.C,this)}rBegin(){return new Rm(this.C.h||this.C,this.C,this,1)}rEnd(){return new Rm(this.C,this.C,this,1)}front(){if(this.m===0)return;let t=this.C.i;return[t.u,t.l]}back(){if(this.m===0)return;let t=this.C.h;return[t.u,t.l]}lowerBound(t){let r=this.R(this.v,t);return new Rm(r,this.C,this)}upperBound(t){let r=this.K(this.v,t);return new Rm(r,this.C,this)}reverseLowerBound(t){let r=this.L(this.v,t);return new Rm(r,this.C,this)}reverseUpperBound(t){let r=this.k(this.v,t);return new Rm(r,this.C,this)}forEach(t){this.U(function(r,n,i){t([r.u,r.l],n,i)})}setElement(t,r,n){return this.q(t,r,n)}getElementByPos(t){if(t<0||t>this.m-1)throw new RangeError;let r=this.U(t);return[r.u,r.l]}find(t){let r=this.H(this.v,t);return new Rm(r,this.C,this)}getElementByKey(t){return this.H(this.v,t).l}union(t){let r=this;return t.forEach(function(n){r.setElement(n[0],n[1])}),this.m}*[Symbol.iterator](){let t=this.m,r=this.U();for(let n=0;n<t;++n){let i=r[n];yield[i.u,i.l]}}};PIe.OrderedMap=OIe});var tX=y(eX=>{"use strict";Object.defineProperty(eX,"__esModule",{value:!0});eX.registerAdminService=Yun;eX.addAdminServicesToServer=Kun;var $Nt=[];function Yun(e,t){$Nt.push({getServiceDefinition:e,getHandlers:t})}function Kun(e){for(let{getServiceDefinition:t,getHandlers:r}of $Nt)e.addService(t(),r())}});var HNt=y(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});km.ClientDuplexStreamImpl=km.ClientWritableStreamImpl=km.ClientReadableStreamImpl=km.ClientUnaryCallImpl=void 0;km.callErrorFromStatus=Xun;var Zun=require("events"),MIe=require("stream"),nL=Ln();function Xun(e,t){let r=`${e.code} ${nL.Status[e.code]}: ${e.details}`,i=`${new Error(r).stack}
563
+ `),s=s.replace(/\\r/g,"\r")),t[i]=s}return t}function gcn(e){e=e||{};let t=L1t(e);e.path=t;let r=bc.configDotenv(e);if(!r.parsed){let o=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw o.code="MISSING_DATA",o}let n=U1t(e).split(","),i=n.length,s;for(let o=0;o<i;o++)try{let a=n[o].trim(),c=bcn(r,a);s=bc.decrypt(c.ciphertext,c.key);break}catch(a){if(o+1>=i)throw a}return bc.parse(s)}function ycn(e){console.error(`[dotenv@${Lxe}][WARN] ${e}`)}function GU(e){console.log(`[dotenv@${Lxe}][DEBUG] ${e}`)}function F1t(e){console.log(`[dotenv@${Lxe}] ${e}`)}function U1t(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function bcn(e,t){let r;try{r=new URL(t)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=r.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let s=`DOTENV_VAULT_${i.toUpperCase()}`,o=e.parsed[s];if(!o){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:o,key:n}}function L1t(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)Uxe.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=xZ.resolve(process.cwd(),".env.vault");return Uxe.existsSync(t)?t:null}function B1t(e){return e[0]==="~"?xZ.join(ccn.homedir(),e.slice(1)):e}function Scn(e){let t=Jk(process.env.DOTENV_CONFIG_DEBUG||e&&e.debug),r=Jk(process.env.DOTENV_CONFIG_QUIET||e&&e.quiet);(t||!r)&&F1t("Loading env from encrypted .env.vault");let n=bc._parseVault(e),i=process.env;return e&&e.processEnv!=null&&(i=e.processEnv),bc.populate(i,n,e),{parsed:n}}function vcn(e){let t=xZ.resolve(process.cwd(),".env"),r="utf8",n=process.env;e&&e.processEnv!=null&&(n=e.processEnv);let i=Jk(n.DOTENV_CONFIG_DEBUG||e&&e.debug),s=Jk(n.DOTENV_CONFIG_QUIET||e&&e.quiet);e&&e.encoding?r=e.encoding:i&&GU("No encoding is specified. UTF-8 is used by default");let o=[t];if(e&&e.path)if(!Array.isArray(e.path))o=[B1t(e.path)];else{o=[];for(let u of e.path)o.push(B1t(u))}let a,c={};for(let u of o)try{let d=bc.parse(Uxe.readFileSync(u,{encoding:r}));bc.populate(c,d,e)}catch(d){i&&GU(`Failed to load ${u} ${d.message}`),a=d}let l=bc.populate(n,c,e);if(i=Jk(n.DOTENV_CONFIG_DEBUG||i),s=Jk(n.DOTENV_CONFIG_QUIET||s),i||!s){let u=Object.keys(l).length,d=[];for(let p of o)try{let f=xZ.relative(process.cwd(),p);d.push(f)}catch(f){i&&GU(`Failed to load ${p} ${f.message}`),a=f}F1t(`injecting env (${u}) from ${d.join(",")} ${pcn(`-- tip: ${dcn()}`)}`)}return a?{parsed:c,error:a}:{parsed:c}}function _cn(e){if(U1t(e).length===0)return bc.configDotenv(e);let t=L1t(e);return t?bc._configVault(e):(ycn(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),bc.configDotenv(e))}function Ecn(e,t){let r=Buffer.from(t.slice(-64),"hex"),n=Buffer.from(e,"base64"),i=n.subarray(0,12),s=n.subarray(-16);n=n.subarray(12,-16);try{let o=lcn.createDecipheriv("aes-256-gcm",r,i);return o.setAuthTag(s),`${o.update(n)}${o.final()}`}catch(o){let a=o instanceof RangeError,c=o.message==="Invalid key length",l=o.message==="Unsupported state or unable to authenticate data";if(a||c){let u=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw u.code="INVALID_DOTENV_KEY",u}else if(l){let u=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw u.code="DECRYPTION_FAILED",u}else throw o}}function xcn(e,t,r={}){let n=!!(r&&r.debug),i=!!(r&&r.override),s={};if(typeof t!="object"){let o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(let o of Object.keys(t))Object.prototype.hasOwnProperty.call(e,o)?(i===!0&&(e[o]=t[o],s[o]=t[o]),n&&GU(i===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):(e[o]=t[o],s[o]=t[o]);return s}var bc={configDotenv:vcn,_configVault:Scn,_parseVault:gcn,config:_cn,decrypt:Ecn,parse:mcn,populate:xcn};tS.exports.configDotenv=bc.configDotenv;tS.exports._configVault=bc._configVault;tS.exports._parseVault=bc._parseVault;tS.exports.config=bc.config;tS.exports.decrypt=bc.decrypt;tS.exports.parse=bc.parse;tS.exports.populate=bc.populate;tS.exports=bc});var z1t=y(Kk=>{"use strict";Object.defineProperty(Kk,"__esModule",{value:!0});Kk.Daytona=Kk.CodeLanguage=void 0;var G1t=(nc(),Nr(rc)),ep=xB(),V1t=G1t.__importStar(Hi()),Icn=d9e(),wcn=f9e(),Ccn=p9e(),Am=Ud(),$1t=SEe(),qxe=Mxe(),H1t=R1t(),Acn=k1t(),Tcn=G1t.__importStar(N1t()),Ocn=XK(),ch=wB(),Yk;(function(e){e.PYTHON="python",e.TYPESCRIPT="typescript",e.JAVASCRIPT="javascript"})(Yk||(Kk.CodeLanguage=Yk={}));var Vxe=class{clientConfig;sandboxApi;objectStorageApi;configApi;target;apiKey;jwtToken;organizationId;apiUrl;toolboxProxyCache=new Map;volume;snapshot;constructor(t){let r;if(t&&(this.apiKey=!t?.apiKey&&t?.jwtToken?void 0:t?.apiKey,this.jwtToken=t?.jwtToken,this.organizationId=t?.organizationId,r=t?.apiUrl||t?.serverUrl,this.target=t?.target),(!t||!(this.apiKey&&r&&this.target)&&!(this.jwtToken&&this.organizationId&&r&&this.target))&&ch.RUNTIME!==ch.Runtime.BROWSER){if(ch.RUNTIME===ch.Runtime.NODE&&typeof require<"u"){let o=q1t();o.config({quiet:!0}),o.config({path:".env.local",override:!0,quiet:!0})}this.apiKey=this.apiKey||(this.jwtToken?void 0:(0,ch.getEnvVar)("DAYTONA_API_KEY")),this.jwtToken=this.jwtToken||(0,ch.getEnvVar)("DAYTONA_JWT_TOKEN"),this.organizationId=this.organizationId||(0,ch.getEnvVar)("DAYTONA_ORGANIZATION_ID"),r=r||(0,ch.getEnvVar)("DAYTONA_API_URL")||(0,ch.getEnvVar)("DAYTONA_SERVER_URL"),this.target=this.target||(0,ch.getEnvVar)("DAYTONA_TARGET"),(0,ch.getEnvVar)("DAYTONA_SERVER_URL")&&!(0,ch.getEnvVar)("DAYTONA_API_URL")&&console.warn("[Deprecation Warning] Environment variable `DAYTONA_SERVER_URL` is deprecated and will be removed in future versions. Use `DAYTONA_API_URL` instead.")}this.apiUrl=r||"https://app.daytona.io/api";let n={};if(!this.apiKey){if(!this.organizationId)throw new Am.DaytonaError("Organization ID is required when using JWT token");n["X-Daytona-Organization-ID"]=this.organizationId}let i=new ep.Configuration({basePath:this.apiUrl,baseOptions:{headers:{Authorization:`Bearer ${this.apiKey||this.jwtToken}`,"X-Daytona-Source":"typescript-sdk","X-Daytona-SDK-Version":Tcn.version,...n}}}),s=this.createAxiosInstance();this.sandboxApi=new ep.SandboxApi(i,"",s),this.objectStorageApi=new ep.ObjectStorageApi(i,"",s),this.configApi=new ep.ConfigApi(i,"",s),this.volume=new Acn.VolumeService(new ep.VolumesApi(i,"",s)),this.snapshot=new H1t.SnapshotService(i,new ep.SnapshotsApi(i,"",s),this.objectStorageApi,this.target),this.clientConfig=i}async create(t,r={timeout:60}){let n=Date.now();r=typeof r=="number"?{timeout:r}:{...r},(r.timeout==null||r.timeout==null)&&(r.timeout=60),t==null&&(t={language:"python"});let i=t.labels||{};if(t.language&&(i["code-toolbox-language"]=t.language),r.timeout<0)throw new Am.DaytonaError("Timeout must be a non-negative number");if(t.autoStopInterval!==void 0&&(!Number.isInteger(t.autoStopInterval)||t.autoStopInterval<0))throw new Am.DaytonaError("autoStopInterval must be a non-negative integer");if(t.ephemeral&&(t.autoDeleteInterval!==void 0&&t.autoDeleteInterval!==0&&console.warn("'ephemeral' and 'autoDeleteInterval' cannot be used together. If ephemeral is true, autoDeleteInterval will be ignored and set to 0."),t.autoDeleteInterval=0),t.autoArchiveInterval!==void 0&&(!Number.isInteger(t.autoArchiveInterval)||t.autoArchiveInterval<0))throw new Am.DaytonaError("autoArchiveInterval must be a non-negative integer");let s=this.getCodeToolbox(t.language);try{let o,a,c;"snapshot"in t&&(a=t.snapshot),"image"in t&&(typeof t.image=="string"?o={dockerfileContent:$1t.Image.base(t.image).dockerfile}:t.image instanceof $1t.Image&&(o={contextHashes:await H1t.SnapshotService.processImageContext(this.objectStorageApi,t.image),dockerfileContent:t.image.dockerfile})),"resources"in t&&(c=t.resources);let u=(await this.sandboxApi.createSandbox({name:t.name,snapshot:a,buildInfo:o,user:t.user,env:t.envVars||{},labels:i,public:t.public,target:this.target,cpu:c?.cpu,gpu:c?.gpu,memory:c?.memory,disk:c?.disk,autoStopInterval:t.autoStopInterval,autoArchiveInterval:t.autoArchiveInterval,autoDeleteInterval:t.autoDeleteInterval,volumes:t.volumes,networkBlockAll:t.networkBlockAll,networkAllowList:t.networkAllowList},void 0,{timeout:r.timeout*1e3})).data;if(u.state===ep.SandboxState.PENDING_BUILD&&r.onSnapshotCreateLogs){let p=[ep.SandboxState.STARTED,ep.SandboxState.STARTING,ep.SandboxState.ERROR,ep.SandboxState.BUILD_FAILED];for(;u.state===ep.SandboxState.PENDING_BUILD;)await new Promise(h=>setTimeout(h,1e3)),u=(await this.sandboxApi.getSandbox(u.id)).data;let f=await this.sandboxApi.getBuildLogsUrl(u.id);await(0,Ocn.processStreamingResponse)(()=>fetch(f.data.url+"?follow=true",{method:"GET",headers:this.clientConfig.baseOptions.headers}),h=>r.onSnapshotCreateLogs?.(h.trimEnd()),async()=>(u=(await this.sandboxApi.getSandbox(u.id)).data,u.state!==void 0&&p.includes(u.state)))}let d=new qxe.Sandbox(u,new ep.Configuration(structuredClone(this.clientConfig)),this.createAxiosInstance(),this.sandboxApi,s,this.getProxyToolboxUrl.bind(this));if(d.state!=="started"){let p=Date.now()-n;await d.waitUntilStarted(r.timeout?Math.max(.001,r.timeout-p/1e3):r.timeout)}return d}catch(o){if(o instanceof Am.DaytonaError&&o.message.includes("Operation timed out")){let a=`Failed to create and start sandbox within ${r.timeout} seconds. Operation timed out.`;throw new Am.DaytonaError(a)}throw o}}async get(t){let n=(await this.sandboxApi.getSandbox(t)).data,i=n.labels&&n.labels["code-toolbox-language"],s=this.getCodeToolbox(i);return new qxe.Sandbox(n,structuredClone(this.clientConfig),this.createAxiosInstance(),this.sandboxApi,s,this.getProxyToolboxUrl.bind(this))}async findOne(t){if(t.idOrName)return this.get(t.idOrName);let r=await this.list(t.labels,1,1);if(r.items.length===0){let n=`No sandbox found with labels ${JSON.stringify(t.labels)}`;throw new Am.DaytonaError(n)}return r.items[0]}async list(t,r,n){let i=await this.sandboxApi.listSandboxesPaginated(void 0,r,n,void 0,void 0,t?JSON.stringify(t):void 0);return{items:i.data.items.map(s=>{let o=s.labels?.["code-toolbox-language"];return new qxe.Sandbox(s,structuredClone(this.clientConfig),this.createAxiosInstance(),this.sandboxApi,this.getCodeToolbox(o),this.getProxyToolboxUrl.bind(this))}),total:i.data.total,page:i.data.page,totalPages:i.data.totalPages}}async start(t,r){await t.start(r)}async stop(t){await t.stop()}async delete(t,r=60){await t.delete(r)}getCodeToolbox(t){switch(t){case Yk.JAVASCRIPT:return new Ccn.SandboxJsCodeToolbox;case Yk.TYPESCRIPT:return new wcn.SandboxTsCodeToolbox;case Yk.PYTHON:case void 0:return new Icn.SandboxPythonCodeToolbox;default:{let r=`Unsupported language: ${t}, supported languages: ${Object.values(Yk).join(", ")}`;throw new Am.DaytonaError(r)}}}createAxiosInstance(){let t=V1t.default.create({timeout:864e5});return t.interceptors.response.use(r=>r,r=>{let n;if(r instanceof V1t.AxiosError&&r.message.includes("timeout of")?n="Operation timed out":n=r.response?.data?.message||r.response?.data||r.message||String(r),typeof n=="object")try{n=JSON.stringify(n)}catch{n=String(n)}let i=r.response?.status,s=r.response?.headers;switch(i){case 404:throw new Am.DaytonaNotFoundError(n,i,s);case 429:throw new Am.DaytonaRateLimitError(n,i,s);default:throw new Am.DaytonaError(n,i,s)}}),t}async getProxyToolboxUrl(t,r){let n=this.toolboxProxyCache.get(r);if(n)return await n;let i=(async()=>(await this.sandboxApi.getToolboxProxyUrl(t)).data.url)();return this.toolboxProxyCache.set(r,i),await i}};Kk.Daytona=Vxe});var W1t=y(j1t=>{"use strict";Object.defineProperty(j1t,"__esModule",{value:!0})});var Y1t=y(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.SandboxState=bn.ChartType=bn.Display=bn.Screenshot=bn.Keyboard=bn.Mouse=bn.ComputerUse=bn.Sandbox=bn.Image=bn.DaytonaTimeoutError=bn.DaytonaRateLimitError=bn.DaytonaNotFoundError=bn.DaytonaError=bn.Process=bn.LspLanguageId=bn.Git=bn.FileSystem=bn.Daytona=bn.CodeLanguage=void 0;var $xe=(nc(),Nr(rc)),J1t=z1t();Object.defineProperty(bn,"CodeLanguage",{enumerable:!0,get:function(){return J1t.CodeLanguage}});Object.defineProperty(bn,"Daytona",{enumerable:!0,get:function(){return J1t.Daytona}});var Pcn=KEe();Object.defineProperty(bn,"FileSystem",{enumerable:!0,get:function(){return Pcn.FileSystem}});var Rcn=XEe();Object.defineProperty(bn,"Git",{enumerable:!0,get:function(){return Rcn.Git}});var kcn=Oxe();Object.defineProperty(bn,"LspLanguageId",{enumerable:!0,get:function(){return kcn.LspLanguageId}});var Ncn=MU();Object.defineProperty(bn,"Process",{enumerable:!0,get:function(){return Ncn.Process}});var IZ=Ud();Object.defineProperty(bn,"DaytonaError",{enumerable:!0,get:function(){return IZ.DaytonaError}});Object.defineProperty(bn,"DaytonaNotFoundError",{enumerable:!0,get:function(){return IZ.DaytonaNotFoundError}});Object.defineProperty(bn,"DaytonaRateLimitError",{enumerable:!0,get:function(){return IZ.DaytonaRateLimitError}});Object.defineProperty(bn,"DaytonaTimeoutError",{enumerable:!0,get:function(){return IZ.DaytonaTimeoutError}});var Dcn=SEe();Object.defineProperty(bn,"Image",{enumerable:!0,get:function(){return Dcn.Image}});var Mcn=Mxe();Object.defineProperty(bn,"Sandbox",{enumerable:!0,get:function(){return Mcn.Sandbox}});var zU=Rxe();Object.defineProperty(bn,"ComputerUse",{enumerable:!0,get:function(){return zU.ComputerUse}});Object.defineProperty(bn,"Mouse",{enumerable:!0,get:function(){return zU.Mouse}});Object.defineProperty(bn,"Keyboard",{enumerable:!0,get:function(){return zU.Keyboard}});Object.defineProperty(bn,"Screenshot",{enumerable:!0,get:function(){return zU.Screenshot}});Object.defineProperty(bn,"Display",{enumerable:!0,get:function(){return zU.Display}});var Bcn=QEe();Object.defineProperty(bn,"ChartType",{enumerable:!0,get:function(){return Bcn.ChartType}});var Fcn=xB();Object.defineProperty(bn,"SandboxState",{enumerable:!0,get:function(){return Fcn.SandboxState}});$xe.__exportStar(MU(),bn);$xe.__exportStar(xxe(),bn);$xe.__exportStar(W1t(),bn)});var eNt={};Wo(eNt,{DaytonaProvider:()=>Hxe,createDaytonaProvider:()=>Gxe});function Lcn(e){let t=e.substring(e.lastIndexOf(".")).toLowerCase();return Ucn.has(t)}function qcn(e){let t=e.lastIndexOf("/");return t>0?e.substring(0,t):"/"}function Vcn(e){let t=e.lastIndexOf("/");return t>=0?e.substring(t+1):e}function Z1t(e,t){return t?`cd '${t.replace(/'/g,"'\\''")}' && ${e}`:e}function Gxe(e={}){let t=e.apiKey??process.env.DAYTONA_API_KEY;if(!t)throw new Error("Daytona API key required. Set DAYTONA_API_KEY environment variable or pass apiKey in config. Get your key at https://app.daytona.io/dashboard/keys");return new Hxe({...e,apiKey:t})}var Q1t,K1t,Ucn,$cn,Hcn,X1t,Hxe,wZ=ee(()=>{"use strict";Q1t=ue(Y1t(),1),K1t={"evolve-all":"evolvingmachines/evolve-all:latest"},Ucn=new Set([".xlsx",".xls",".docx",".doc",".pptx",".ppt",".pdf",".zip",".tar",".gz",".7z",".rar",".png",".jpg",".jpeg",".gif",".webp",".ico",".bmp",".mp3",".wav",".ogg",".flac",".aac",".mp4",".avi",".mov",".mkv",".webm",".woff",".woff2",".ttf",".otf",".eot",".exe",".dll",".so",".dylib",".sqlite",".db",".pickle",".pkl",".parquet"]);$cn=class{constructor(e){this.sandbox=e}async run(e,t){let r=t?.timeoutMs?Math.floor(t.timeoutMs/1e3):void 0;if(t?.onStdout||t?.onStderr){let i=`run-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;await this.sandbox.process.createSession(i);try{let s=await this.sandbox.process.executeSessionCommand(i,{command:Z1t(e,t?.cwd),runAsync:!1},r),o=s.cmdId;return o&&await this.sandbox.process.getSessionCommandLogs(i,o,t.onStdout||(()=>{}),t.onStderr||(()=>{})),{exitCode:s.exitCode??0,stdout:s.stdout??s.output??"",stderr:s.stderr??""}}finally{try{await this.sandbox.process.deleteSession(i)}catch{}}}let n=await this.sandbox.process.executeCommand(e,t?.cwd,t?.envs,r);return{exitCode:n.exitCode,stdout:n.result||"",stderr:""}}async spawn(e,t){let r=`evolve-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;await this.sandbox.process.createSession(r);let n=t?.timeoutMs?Math.floor(t.timeoutMs/1e3):void 0,i=(await this.sandbox.process.executeSessionCommand(r,{command:Z1t(e,t?.cwd),runAsync:!0},n)).cmdId;i&&(t?.onStdout||t?.onStderr)&&this.sandbox.process.getSessionCommandLogs(r,i,t.onStdout||(()=>{}),t.onStderr||(()=>{})).catch(()=>{});let s=this.sandbox;return{processId:r,wait:async()=>{if(!i)return{exitCode:0,stdout:"",stderr:""};for(;;){let o=await s.process.getSessionCommand(r,i);if(o.exitCode!==void 0){let a=await s.process.getSessionCommandLogs(r,i);return{exitCode:o.exitCode,stdout:a.stdout??a.output??"",stderr:a.stderr??""}}await new Promise(a=>setTimeout(a,500))}},kill:async()=>{try{return await s.process.deleteSession(r),!0}catch{return!1}}}}async list(){try{return(await this.sandbox.process.listSessions()).map(e=>({processId:e.sessionId||"",cmd:"",args:[],envs:{}}))}catch{return[]}}async kill(e){try{return await this.sandbox.process.deleteSession(e),!0}catch{return!1}}},Hcn=class{constructor(e){this.sandbox=e}async read(e){let t=await this.sandbox.fs.downloadFile(e);return Lcn(e)?new Uint8Array(t):t.toString("utf-8")}async write(e,t){let r;if(typeof t=="string")r=Buffer.from(t,"utf-8");else if(Buffer.isBuffer(t))r=t;else if(t instanceof ArrayBuffer)r=Buffer.from(t);else if(t instanceof Uint8Array)r=Buffer.from(t);else throw new Error(`Unsupported content type: ${typeof t}`);await this.sandbox.fs.uploadFile(r,e)}async writeBatch(e){let t=e.map(r=>{let n;if(typeof r.data=="string")n=Buffer.from(r.data,"utf-8");else if(Buffer.isBuffer(r.data))n=r.data;else if(r.data instanceof ArrayBuffer)n=Buffer.from(r.data);else if(r.data instanceof Uint8Array)n=Buffer.from(r.data);else throw new Error(`Unsupported content type: ${typeof r.data}`);return{source:n,destination:r.path}});await this.sandbox.fs.uploadFiles(t)}async makeDir(e){await this.sandbox.fs.createFolder(e,"755")}async exists(e){try{let t=qcn(e),r=Vcn(e);return(await this.sandbox.fs.listFiles(t)).some(n=>n.name===r)}catch{return!1}}async list(e){return(await this.sandbox.fs.listFiles(e)).map(t=>({name:t.name,path:e.endsWith("/")?`${e}${t.name}`:`${e}/${t.name}`,type:t.isDir?"dir":"file"}))}async remove(e){await this.sandbox.fs.deleteFile(e,!0)}async rename(e,t){await this.sandbox.fs.moveFiles(e,t)}},X1t=class{constructor(e){this.sandbox=e,this.commands=new $cn(e),this.files=new Hcn(e)}commands;files;get sandboxId(){return this.sandbox.id}async getHost(e){return(await this.sandbox.getPreviewLink(e)).url}async isRunning(){return this.sandbox.state==="started"}async getInfo(){return{sandboxId:this.sandbox.id,image:this.sandbox.snapshot||"unknown",name:this.sandbox.name,metadata:this.sandbox.labels||{},startedAt:new Date().toISOString()}}async kill(){await this.sandbox.delete()}async pause(){await this.sandbox.stop()}},Hxe=class{providerType="daytona";name="Daytona";client;defaultTimeoutMs;constructor(e){this.client=new Q1t.Daytona({apiKey:e.apiKey,apiUrl:e.apiUrl,target:e.target}),this.defaultTimeoutMs=e.defaultTimeoutMs??36e5}async create(e){let t=e.timeoutMs??this.defaultTimeoutMs,r=Math.max(1,Math.ceil(t/6e4)),n=e.image,i;try{let s=await this.client.snapshot.get(n);if(s&&s.state==="active")console.log(`[Daytona] Using cached snapshot: ${n}`),i=await this.client.create({snapshot:n,envVars:e.envs,labels:e.metadata,autoStopInterval:r},{timeout:600});else throw new Error("Snapshot not active")}catch{let s=K1t[n];if(!s)throw new Error(`Unknown image "${n}" and no public fallback available. Available images: ${Object.keys(K1t).join(", ")}`);console.log(`[Daytona] Snapshot "${n}" not found, creating from image: ${s}`),console.log("[Daytona] First run may take a few minutes (image will be cached for future runs)..."),i=await this.client.create({image:s,envVars:e.envs,labels:e.metadata,autoStopInterval:r,resources:{cpu:e.resources?.cpu??4,memory:e.resources?.memory??4,disk:e.resources?.disk??10}},{timeout:600,onSnapshotCreateLogs:o=>console.log(`[Daytona] ${o}`)})}return e.workingDirectory&&await i.fs.createFolder(e.workingDirectory,"755"),new X1t(i)}async connect(e,t){let r=await this.client.get(e);return new X1t(r)}async list(e){let t=e?.limit??100;return(await this.client.list(e?.metadata,1,t)).items.map(r=>({sandboxId:r.id,image:r.snapshot||"unknown",name:r.name,metadata:r.labels||{},startedAt:new Date().toISOString()}))}}});var tNt=y(CZ=>{"use strict";Object.defineProperty(CZ,"__esModule",{value:!0});CZ.Metadata=void 0;CZ.Metadata=function(t){let r=new Map,n={set(i,s){if(i=Zk(i),Array.isArray(s))if(s.length===0)r.delete(i);else{for(let o of s)zxe(i,o);r.set(i,i.endsWith("-bin")?s:[s.join(", ")])}else zxe(i,s),r.set(i,[s]);return n},append(i,s){i=Zk(i),zxe(i,s);let o=r.get(i);return o==null&&(o=[],r.set(i,o)),o.push(s),i.endsWith("-bin")||r.set(i,[o.join(", ")]),n},delete(i){i=Zk(i),r.delete(i)},get(i){var s;return i=Zk(i),(s=r.get(i))===null||s===void 0?void 0:s[0]},getAll(i){var s;return i=Zk(i),(s=r.get(i))!==null&&s!==void 0?s:[]},has(i){return i=Zk(i),r.has(i)},[Symbol.iterator](){return r[Symbol.iterator]()}};if(t!=null){let i=Gcn(t)?t:Object.entries(t);for(let[s,o]of i)n.set(s,o)}return n};function Zk(e){return e.toLowerCase()}function zxe(e,t){if(!/^[0-9a-z_.-]+$/.test(e))throw new Error(`Metadata key '${e}' contains illegal characters`);if(e.endsWith("-bin")){if(!(t instanceof Uint8Array))throw new Error(`Metadata key '${e}' ends with '-bin', thus it must have binary value`)}else{if(typeof t!="string")throw new Error(`Metadata key '${e}' doesn't end with '-bin', thus it must have string value`);if(!/^[ -~]*$/.test(t))throw new Error(`Metadata value '${t}' of key '${e}' contains illegal characters`)}}function Gcn(e){return Symbol.iterator in e}});var AZ=y(jU=>{"use strict";Object.defineProperty(jU,"__esModule",{value:!0});jU.Status=void 0;var zcn;(function(e){e[e.OK=0]="OK",e[e.CANCELLED=1]="CANCELLED",e[e.UNKNOWN=2]="UNKNOWN",e[e.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",e[e.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",e[e.NOT_FOUND=5]="NOT_FOUND",e[e.ALREADY_EXISTS=6]="ALREADY_EXISTS",e[e.PERMISSION_DENIED=7]="PERMISSION_DENIED",e[e.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",e[e.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",e[e.ABORTED=10]="ABORTED",e[e.OUT_OF_RANGE=11]="OUT_OF_RANGE",e[e.UNIMPLEMENTED=12]="UNIMPLEMENTED",e[e.INTERNAL=13]="INTERNAL",e[e.UNAVAILABLE=14]="UNAVAILABLE",e[e.DATA_LOSS=15]="DATA_LOSS",e[e.UNAUTHENTICATED=16]="UNAUTHENTICATED"})(zcn=jU.Status||(jU.Status={}))});var nNt=y(rNt=>{"use strict";Object.defineProperty(rNt,"__esModule",{value:!0})});var sNt=y(iNt=>{"use strict";Object.defineProperty(iNt,"__esModule",{value:!0})});var aNt=y(oNt=>{"use strict";Object.defineProperty(oNt,"__esModule",{value:!0})});var cNt=y(TZ=>{"use strict";Object.defineProperty(TZ,"__esModule",{value:!0});TZ.composeClientMiddleware=void 0;function jcn(e,t){return(r,n)=>t(Object.assign(Object.assign({},r),{next:(i,s)=>e(Object.assign(Object.assign({},r),{request:i}),s)}),n)}TZ.composeClientMiddleware=jcn});var dNt=y(pE=>{"use strict";pE.__esModule=void 0;pE.__esModule=!0;var Wcn=typeof Object.setPrototypeOf=="function",Jcn=typeof Object.getPrototypeOf=="function",Ycn=typeof Object.defineProperty=="function",Kcn=typeof Object.create=="function",Zcn=typeof Object.prototype.hasOwnProperty=="function",Xcn=function(t,r){Wcn?Object.setPrototypeOf(t,r):t.__proto__=r};pE.setPrototypeOf=Xcn;var Qcn=function(t){return Jcn?Object.getPrototypeOf(t):t.__proto__||t.prototype};pE.getPrototypeOf=Qcn;var lNt=!1,eln=function e(t,r,n){if(Ycn&&!lNt)try{Object.defineProperty(t,r,n)}catch{lNt=!0,e(t,r,n)}else t[r]=n.value};pE.defineProperty=eln;var uNt=function(t,r){return Zcn?t.hasOwnProperty(t,r):t[r]===void 0};pE.hasOwnProperty=uNt;var tln=function(t,r){if(Kcn)return Object.create(t,r);var n=function(){};n.prototype=t;var i=new n;if(typeof r>"u")return i;if(typeof r=="null")throw new Error("PropertyDescriptors must not be null.");if(typeof r=="object")for(var s in r)uNt(r,s)&&(i[s]=r[s].value);return i};pE.objectCreate=tln});var Wxe=y(Xk=>{"use strict";Xk.__esModule=void 0;Xk.__esModule=!0;var PZ=dNt(),rln=PZ.setPrototypeOf,nln=PZ.getPrototypeOf,jxe=PZ.defineProperty,iln=PZ.objectCreate,sln=new Error().toString()==="[object Error]",OZ="";function WU(e){var t=this.constructor,r=t.name||function(){var a=t.toString().match(/^function\s*([^\s(]+)/);return a===null?OZ||"Error":a[1]}(),n=r==="Error",i=n?OZ:r,s=Error.apply(this,arguments);if(rln(s,nln(this)),!(s instanceof t)||!(s instanceof WU)){var s=this;Error.apply(this,arguments),jxe(s,"message",{configurable:!0,enumerable:!1,value:e,writable:!0})}if(jxe(s,"name",{configurable:!0,enumerable:!1,value:i,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(s,n?WU:t),s.stack===void 0){var o=new Error(e);o.name=s.name,s.stack=o.stack}return sln&&jxe(s,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),s}OZ=WU.name||"ExtendableError";WU.prototype=iln(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}});Xk.ExtendableError=WU;Xk.default=Xk.ExtendableError});var fNt=y(RZ=>{"use strict";Object.defineProperty(RZ,"__esModule",{value:!0});RZ.ClientError=void 0;var oln=Wxe(),aln=AZ(),Jxe=class e extends oln.ExtendableError{constructor(t,r,n){super(`${t} ${aln.Status[r]}: ${n}`),this.path=t,this.code=r,this.details=n,this.name="ClientError",Object.defineProperty(this,"@@nice-grpc",{value:!0}),Object.defineProperty(this,"@@nice-grpc:ClientError",{value:!0})}static[Symbol.hasInstance](t){return this!==e?this.prototype.isPrototypeOf(t):typeof t=="object"&&t!==null&&(t.constructor===e||t["@@nice-grpc:ClientError"]===!0||t.name==="ClientError"&&t["@@nice-grpc"]===!0)}};RZ.ClientError=Jxe});var hNt=y(pNt=>{"use strict";Object.defineProperty(pNt,"__esModule",{value:!0})});var gNt=y(mNt=>{"use strict";Object.defineProperty(mNt,"__esModule",{value:!0})});var yNt=y(kZ=>{"use strict";Object.defineProperty(kZ,"__esModule",{value:!0});kZ.composeServerMiddleware=void 0;function cln(e,t){return(r,n)=>e(Object.assign(Object.assign({},r),{next:(i,s)=>t(Object.assign(Object.assign({},r),{request:i}),s)}),n)}kZ.composeServerMiddleware=cln});var bNt=y(NZ=>{"use strict";Object.defineProperty(NZ,"__esModule",{value:!0});NZ.ServerError=void 0;var lln=Wxe(),uln=AZ(),Yxe=class e extends lln.ExtendableError{constructor(t,r){super(`${uln.Status[t]}: ${r}`),this.code=t,this.details=r,this.name="ServerError",Object.defineProperty(this,"@@nice-grpc",{value:!0}),Object.defineProperty(this,"@@nice-grpc:ServerError",{value:!0})}static[Symbol.hasInstance](t){return this!==e?this.prototype.isPrototypeOf(t):typeof t=="object"&&t!==null&&(t.constructor===e||t["@@nice-grpc:ServerError"]===!0||t.name==="ServerError"&&t["@@nice-grpc"]===!0)}};NZ.ServerError=Yxe});var lh=y(kl=>{"use strict";var dln=kl&&kl.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Tm=kl&&kl.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&dln(t,e,r)};Object.defineProperty(kl,"__esModule",{value:!0});Tm(tNt(),kl);Tm(AZ(),kl);Tm(nNt(),kl);Tm(sNt(),kl);Tm(aNt(),kl);Tm(cNt(),kl);Tm(fNt(),kl);Tm(hNt(),kl);Tm(gNt(),kl);Tm(yNt(),kl);Tm(bNt(),kl)});var Ln=y(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=uh.DEFAULT_MAX_SEND_MESSAGE_LENGTH=uh.Propagate=uh.LogVerbosity=uh.Status=void 0;var SNt;(function(e){e[e.OK=0]="OK",e[e.CANCELLED=1]="CANCELLED",e[e.UNKNOWN=2]="UNKNOWN",e[e.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",e[e.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",e[e.NOT_FOUND=5]="NOT_FOUND",e[e.ALREADY_EXISTS=6]="ALREADY_EXISTS",e[e.PERMISSION_DENIED=7]="PERMISSION_DENIED",e[e.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",e[e.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",e[e.ABORTED=10]="ABORTED",e[e.OUT_OF_RANGE=11]="OUT_OF_RANGE",e[e.UNIMPLEMENTED=12]="UNIMPLEMENTED",e[e.INTERNAL=13]="INTERNAL",e[e.UNAVAILABLE=14]="UNAVAILABLE",e[e.DATA_LOSS=15]="DATA_LOSS",e[e.UNAUTHENTICATED=16]="UNAUTHENTICATED"})(SNt||(uh.Status=SNt={}));var vNt;(function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.ERROR=2]="ERROR",e[e.NONE=3]="NONE"})(vNt||(uh.LogVerbosity=vNt={}));var _Nt;(function(e){e[e.DEADLINE=1]="DEADLINE",e[e.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",e[e.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",e[e.CANCELLATION=8]="CANCELLATION",e[e.DEFAULTS=65535]="DEFAULTS"})(_Nt||(uh.Propagate=_Nt={}));uh.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1;uh.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4*1024*1024});var Kxe=y((tdi,fln)=>{fln.exports={name:"@grpc/grpc-js",version:"1.14.3",description:"gRPC Library for Node - pure JS implementation",homepage:"https://grpc.io/",repository:"https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",main:"build/src/index.js",engines:{node:">=12.10.0"},keywords:[],author:{name:"Google Inc."},types:"build/src/index.d.ts",license:"Apache-2.0",devDependencies:{"@grpc/proto-loader":"file:../proto-loader","@types/gulp":"^4.0.17","@types/gulp-mocha":"0.0.37","@types/lodash":"^4.14.202","@types/mocha":"^10.0.6","@types/ncp":"^2.0.8","@types/node":">=20.11.20","@types/pify":"^5.0.4","@types/semver":"^7.5.8","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0","@typescript-eslint/typescript-estree":"^7.1.0","clang-format":"^1.8.0",eslint:"^8.42.0","eslint-config-prettier":"^8.8.0","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^4.2.1",execa:"^2.0.3",gulp:"^4.0.2","gulp-mocha":"^6.0.0",lodash:"^4.17.21",madge:"^5.0.1","mocha-jenkins-reporter":"^0.4.1",ncp:"^2.0.0",pify:"^4.0.1",prettier:"^2.8.8",rimraf:"^3.0.2",semver:"^7.6.0","ts-node":"^10.9.2",typescript:"^5.3.3"},contributors:[{name:"Google Inc."}],scripts:{build:"npm run compile",clean:"rimraf ./build",compile:"tsc -p .",format:'clang-format -i -style="{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}" src/*.ts test/*.ts',lint:"eslint src/*.ts test/*.ts",prepare:"npm run copy-protos && npm run generate-types && npm run generate-test-types && npm run compile",test:"gulp test",check:"npm run lint",fix:"eslint --fix src/*.ts test/*.ts",pretest:"npm run generate-types && npm run generate-test-types && npm run compile",posttest:"npm run check && madge -c ./build/src","generate-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ --include-dirs proto/ proto/xds/ proto/protoc-gen-validate/ -O src/generated/ --grpcLib ../index channelz.proto xds/service/orca/v3/orca.proto","generate-test-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --include-dirs test/fixtures/ -O test/generated/ --grpcLib ../../src/index test_service.proto echo_service.proto","copy-protos":"node ./copy-protos"},dependencies:{"@grpc/proto-loader":"^0.8.0","@js-sdsl/ordered-map":"^4.4.2"},files:["src/**/*.ts","build/src/**/*.{js,d.ts,js.map}","proto/**/*.proto","proto/**/LICENSE","LICENSE","deps/envoy-api/envoy/api/v2/**/*.proto","deps/envoy-api/envoy/config/**/*.proto","deps/envoy-api/envoy/service/**/*.proto","deps/envoy-api/envoy/type/**/*.proto","deps/udpa/udpa/**/*.proto","deps/googleapis/google/api/*.proto","deps/googleapis/google/rpc/*.proto","deps/protoc-gen-validate/validate/**/*.proto"]}});var Ts=y(tp=>{"use strict";var Zxe,Xxe,Qxe,eIe;Object.defineProperty(tp,"__esModule",{value:!0});tp.log=tp.setLoggerVerbosity=tp.setLogger=tp.getLogger=void 0;tp.trace=xln;tp.isTracerEnabled=xNt;var hE=Ln(),pln=require("process"),hln=Kxe().version,mln={error:(e,...t)=>{console.error("E "+e,...t)},info:(e,...t)=>{console.error("I "+e,...t)},debug:(e,...t)=>{console.error("D "+e,...t)}},yC=mln,Qk=hE.LogVerbosity.ERROR,gln=(Xxe=(Zxe=process.env.GRPC_NODE_VERBOSITY)!==null&&Zxe!==void 0?Zxe:process.env.GRPC_VERBOSITY)!==null&&Xxe!==void 0?Xxe:"";switch(gln.toUpperCase()){case"DEBUG":Qk=hE.LogVerbosity.DEBUG;break;case"INFO":Qk=hE.LogVerbosity.INFO;break;case"ERROR":Qk=hE.LogVerbosity.ERROR;break;case"NONE":Qk=hE.LogVerbosity.NONE;break;default:}var yln=()=>yC;tp.getLogger=yln;var bln=e=>{yC=e};tp.setLogger=bln;var Sln=e=>{Qk=e};tp.setLoggerVerbosity=Sln;var vln=(e,...t)=>{let r;if(e>=Qk){switch(e){case hE.LogVerbosity.DEBUG:r=yC.debug;break;case hE.LogVerbosity.INFO:r=yC.info;break;case hE.LogVerbosity.ERROR:r=yC.error;break}r||(r=yC.error),r&&r.bind(yC)(...t)}};tp.log=vln;var _ln=(eIe=(Qxe=process.env.GRPC_NODE_TRACE)!==null&&Qxe!==void 0?Qxe:process.env.GRPC_TRACE)!==null&&eIe!==void 0?eIe:"",tIe=new Set,ENt=new Set;for(let e of _ln.split(","))e.startsWith("-")?ENt.add(e.substring(1)):tIe.add(e);var Eln=tIe.has("all");function xln(e,t,r){xNt(t)&&(0,tp.log)(e,new Date().toISOString()+" | v"+hln+" "+pln.pid+" | "+t+" | "+r)}function xNt(e){return!ENt.has(e)&&(Eln||tIe.has(e))}});var MZ=y(DZ=>{"use strict";Object.defineProperty(DZ,"__esModule",{value:!0});DZ.getErrorMessage=Iln;DZ.getErrorCode=wln;function Iln(e){return e instanceof Error?e.message:String(e)}function wln(e){return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="number"?e.code:null}});var Qc=y(FZ=>{"use strict";Object.defineProperty(FZ,"__esModule",{value:!0});FZ.Metadata=void 0;var Cln=Ts(),Aln=Ln(),Tln=MZ(),Oln=/^[:0-9a-z_.-]+$/,Pln=/^[ -~]*$/;function Rln(e){return Oln.test(e)}function kln(e){return Pln.test(e)}function wNt(e){return e.endsWith("-bin")}function Nln(e){return!e.startsWith("grpc-")}function BZ(e){return e.toLowerCase()}function INt(e,t){if(!Rln(e))throw new Error('Metadata key "'+e+'" contains illegal characters');if(t!=null)if(wNt(e)){if(!Buffer.isBuffer(t))throw new Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(t))throw new Error("keys that don't end with '-bin' must have String values");if(!kln(t))throw new Error('Metadata string value "'+t+'" contains illegal characters')}}var rIe=class e{constructor(t={}){this.internalRepr=new Map,this.opaqueData=new Map,this.options=t}set(t,r){t=BZ(t),INt(t,r),this.internalRepr.set(t,[r])}add(t,r){t=BZ(t),INt(t,r);let n=this.internalRepr.get(t);n===void 0?this.internalRepr.set(t,[r]):n.push(r)}remove(t){t=BZ(t),this.internalRepr.delete(t)}get(t){return t=BZ(t),this.internalRepr.get(t)||[]}getMap(){let t={};for(let[r,n]of this.internalRepr)if(n.length>0){let i=n[0];t[r]=Buffer.isBuffer(i)?Buffer.from(i):i}return t}clone(){let t=new e(this.options),r=t.internalRepr;for(let[n,i]of this.internalRepr){let s=i.map(o=>Buffer.isBuffer(o)?Buffer.from(o):o);r.set(n,s)}return t}merge(t){for(let[r,n]of t.internalRepr){let i=(this.internalRepr.get(r)||[]).concat(n);this.internalRepr.set(r,i)}}setOptions(t){this.options=t}getOptions(){return this.options}toHttp2Headers(){let t={};for(let[r,n]of this.internalRepr)r.startsWith(":")||(t[r]=n.map(Dln));return t}toJSON(){let t={};for(let[r,n]of this.internalRepr)t[r]=n;return t}setOpaque(t,r){this.opaqueData.set(t,r)}getOpaque(t){return this.opaqueData.get(t)}static fromHttp2Headers(t){let r=new e;for(let n of Object.keys(t)){if(n.charAt(0)===":")continue;let i=t[n];try{wNt(n)?Array.isArray(i)?i.forEach(s=>{r.add(n,Buffer.from(s,"base64"))}):i!==void 0&&(Nln(n)?i.split(",").forEach(s=>{r.add(n,Buffer.from(s.trim(),"base64"))}):r.add(n,Buffer.from(i,"base64"))):Array.isArray(i)?i.forEach(s=>{r.add(n,s)}):i!==void 0&&r.add(n,i)}catch(s){let o=`Failed to add metadata entry ${n}: ${i}. ${(0,Tln.getErrorMessage)(s)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,Cln.log)(Aln.LogVerbosity.ERROR,o)}}return r}};FZ.Metadata=rIe;var Dln=e=>Buffer.isBuffer(e)?e.toString("base64"):e});var LZ=y(UZ=>{"use strict";Object.defineProperty(UZ,"__esModule",{value:!0});UZ.CallCredentials=void 0;var oIe=Qc();function Mln(e){return"getRequestHeaders"in e&&typeof e.getRequestHeaders=="function"}var e1=class e{static createFromMetadataGenerator(t){return new iIe(t)}static createFromGoogleCredential(t){return e.createFromMetadataGenerator((r,n)=>{let i;Mln(t)?i=t.getRequestHeaders(r.service_url):i=new Promise((s,o)=>{t.getRequestMetadata(r.service_url,(a,c)=>{if(a){o(a);return}if(!c){o(new Error("Headers not set by metadata plugin"));return}s(c)})}),i.then(s=>{let o=new oIe.Metadata;for(let a of Object.keys(s))o.add(a,s[a]);n(null,o)},s=>{n(s)})})}static createEmpty(){return new sIe}};UZ.CallCredentials=e1;var nIe=class e extends e1{constructor(t){super(),this.creds=t}async generateMetadata(t){let r=new oIe.Metadata,n=await Promise.all(this.creds.map(i=>i.generateMetadata(t)));for(let i of n)r.merge(i);return r}compose(t){return new e(this.creds.concat([t]))}_equals(t){return this===t?!0:t instanceof e?this.creds.every((r,n)=>r._equals(t.creds[n])):!1}},iIe=class e extends e1{constructor(t){super(),this.metadataGenerator=t}generateMetadata(t){return new Promise((r,n)=>{this.metadataGenerator(t,(i,s)=>{s!==void 0?r(s):n(i)})})}compose(t){return new nIe([this,t])}_equals(t){return this===t?!0:t instanceof e?this.metadataGenerator===t.metadataGenerator:!1}},sIe=class e extends e1{generateMetadata(t){return Promise.resolve(new oIe.Metadata)}compose(t){return t}_equals(t){return t instanceof e}}});var cIe=y(JU=>{"use strict";Object.defineProperty(JU,"__esModule",{value:!0});JU.CIPHER_SUITES=void 0;JU.getDefaultRootsData=Fln;var Bln=require("fs");JU.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;var CNt=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH,aIe=null;function Fln(){return CNt?(aIe===null&&(aIe=Bln.readFileSync(CNt)),aIe):null}});var bd=y(t1=>{"use strict";Object.defineProperty(t1,"__esModule",{value:!0});t1.parseUri=Lln;t1.splitHostPort=qln;t1.combineHostPort=Vln;t1.uriToString=$ln;var Uln=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;function Lln(e){let t=Uln.exec(e);return t===null?null:{scheme:t[1],authority:t[2],path:t[3]}}var ANt=/^\d+$/;function qln(e){if(e.startsWith("[")){let t=e.indexOf("]");if(t===-1)return null;let r=e.substring(1,t);if(r.indexOf(":")===-1)return null;if(e.length>t+1)if(e[t+1]===":"){let n=e.substring(t+2);return ANt.test(n)?{host:r,port:+n}:null}else return null;else return{host:r}}else{let t=e.split(":");return t.length===2?ANt.test(t[1])?{host:t[0],port:+t[1]}:null:{host:e}}}function Vln(e){return e.port===void 0?e.host:e.host.includes(":")?`[${e.host}]:${e.port}`:`${e.host}:${e.port}`}function $ln(e){let t="";return e.scheme!==void 0&&(t+=e.scheme+":"),e.authority!==void 0&&(t+="//"+e.authority+"/"),t+=e.path,t}});var Om=y(rS=>{"use strict";Object.defineProperty(rS,"__esModule",{value:!0});rS.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=void 0;rS.registerResolver=Hln;rS.registerDefaultScheme=Gln;rS.createResolver=zln;rS.getDefaultAuthority=jln;rS.mapUriDefaultScheme=Wln;var uIe=bd();rS.CHANNEL_ARGS_CONFIG_SELECTOR_KEY="grpc.internal.config_selector";var r1={},lIe=null;function Hln(e,t){r1[e]=t}function Gln(e){lIe=e}function zln(e,t,r){if(e.scheme!==void 0&&e.scheme in r1)return new r1[e.scheme](e,t,r);throw new Error(`No resolver could be created for target ${(0,uIe.uriToString)(e)}`)}function jln(e){if(e.scheme!==void 0&&e.scheme in r1)return r1[e.scheme].getDefaultAuthority(e);throw new Error(`Invalid target ${(0,uIe.uriToString)(e)}`)}function Wln(e){return e.scheme===void 0||!(e.scheme in r1)?lIe!==null?{scheme:lIe,authority:void 0,path:(0,uIe.uriToString)(e)}:null:e}});var n1=y(KU=>{"use strict";Object.defineProperty(KU,"__esModule",{value:!0});KU.ChannelCredentials=void 0;KU.createCertificateProviderChannelCredentials=Zln;var YU=require("tls"),$Z=LZ(),fIe=cIe(),TNt=bd(),Jln=Om(),Yln=Ts(),Kln=Ln();function dIe(e,t){if(e&&!(e instanceof Buffer))throw new TypeError(`${t}, if provided, must be a Buffer.`)}var bC=class{compose(t){return new mIe(this,t)}static createSsl(t,r,n,i){var s;if(dIe(t,"Root certificate"),dIe(r,"Private key"),dIe(n,"Certificate chain"),r&&!n)throw new Error("Private key must be given with accompanying certificate chain");if(!r&&n)throw new Error("Certificate chain must be given with accompanying private key");let o=(0,YU.createSecureContext)({ca:(s=t??(0,fIe.getDefaultRootsData)())!==null&&s!==void 0?s:void 0,key:r??void 0,cert:n??void 0,ciphers:fIe.CIPHER_SUITES});return new qZ(o,i??{})}static createFromSecureContext(t,r){return new qZ(t,r??{})}static createInsecure(){return new pIe}};KU.ChannelCredentials=bC;var pIe=class e extends bC{constructor(){super()}compose(t){throw new Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals(t){return t instanceof e}_createSecureConnector(t,r,n){return{connect(i){return Promise.resolve({socket:i,secure:!1})},waitForReady:()=>Promise.resolve(),getCallCredentials:()=>n??$Z.CallCredentials.createEmpty(),destroy(){}}}};function ONt(e,t,r,n){var i,s;let o={secureContext:e},a=r;if("grpc.http_connect_target"in n){let d=(0,TNt.parseUri)(n["grpc.http_connect_target"]);d&&(a=d)}let c=(0,Jln.getDefaultAuthority)(a),l=(0,TNt.splitHostPort)(c),u=(i=l?.host)!==null&&i!==void 0?i:c;if(o.host=u,t.checkServerIdentity&&(o.checkServerIdentity=t.checkServerIdentity),t.rejectUnauthorized!==void 0&&(o.rejectUnauthorized=t.rejectUnauthorized),o.ALPNProtocols=["h2"],n["grpc.ssl_target_name_override"]){let d=n["grpc.ssl_target_name_override"],p=(s=o.checkServerIdentity)!==null&&s!==void 0?s:YU.checkServerIdentity;o.checkServerIdentity=(f,h)=>p(d,h),o.servername=d}else o.servername=u;return n["grpc-node.tls_enable_trace"]&&(o.enableTrace=!0),o}var hIe=class{constructor(t,r){this.connectionOptions=t,this.callCredentials=r}connect(t){let r=Object.assign({socket:t},this.connectionOptions);return new Promise((n,i)=>{let s=(0,YU.connect)(r,()=>{var o;if((!((o=this.connectionOptions.rejectUnauthorized)!==null&&o!==void 0)||o)&&!s.authorized){i(s.authorizationError);return}n({socket:s,secure:!0})});s.on("error",o=>{i(o)})})}waitForReady(){return Promise.resolve()}getCallCredentials(){return this.callCredentials}destroy(){}},qZ=class e extends bC{constructor(t,r){super(),this.secureContext=t,this.verifyOptions=r}_isSecure(){return!0}_equals(t){return this===t?!0:t instanceof e?this.secureContext===t.secureContext&&this.verifyOptions.checkServerIdentity===t.verifyOptions.checkServerIdentity:!1}_createSecureConnector(t,r,n){let i=ONt(this.secureContext,this.verifyOptions,t,r);return new hIe(i,n??$Z.CallCredentials.createEmpty())}},VZ=class e extends bC{constructor(t,r,n){super(),this.caCertificateProvider=t,this.identityCertificateProvider=r,this.verifyOptions=n,this.refcount=0,this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this),this.secureContextWatchers=[]}_isSecure(){return!0}_equals(t){var r,n;return this===t?!0:t instanceof e?this.caCertificateProvider===t.caCertificateProvider&&this.identityCertificateProvider===t.identityCertificateProvider&&((r=this.verifyOptions)===null||r===void 0?void 0:r.checkServerIdentity)===((n=t.verifyOptions)===null||n===void 0?void 0:n.checkServerIdentity):!1}ref(){var t;this.refcount===0&&(this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener),(t=this.identityCertificateProvider)===null||t===void 0||t.addIdentityCertificateListener(this.identityCertificateUpdateListener)),this.refcount+=1}unref(){var t;this.refcount-=1,this.refcount===0&&(this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener),(t=this.identityCertificateProvider)===null||t===void 0||t.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_createSecureConnector(t,r,n){return this.ref(),new e.SecureConnectorImpl(this,t,r,n??$Z.CallCredentials.createEmpty())}maybeUpdateWatchers(){if(this.hasReceivedUpdates()){for(let t of this.secureContextWatchers)t(this.getLatestSecureContext());this.secureContextWatchers=[]}}handleCaCertificateUpdate(t){this.latestCaUpdate=t,this.maybeUpdateWatchers()}handleIdentityCertitificateUpdate(t){this.latestIdentityUpdate=t,this.maybeUpdateWatchers()}hasReceivedUpdates(){return!(this.latestCaUpdate===void 0||this.identityCertificateProvider&&this.latestIdentityUpdate===void 0)}getSecureContext(){return this.hasReceivedUpdates()?Promise.resolve(this.getLatestSecureContext()):new Promise(t=>{this.secureContextWatchers.push(t)})}getLatestSecureContext(){var t,r;if(!this.latestCaUpdate||this.identityCertificateProvider!==null&&!this.latestIdentityUpdate)return null;try{return(0,YU.createSecureContext)({ca:this.latestCaUpdate.caCertificate,key:(t=this.latestIdentityUpdate)===null||t===void 0?void 0:t.privateKey,cert:(r=this.latestIdentityUpdate)===null||r===void 0?void 0:r.certificate,ciphers:fIe.CIPHER_SUITES})}catch(n){return(0,Yln.log)(Kln.LogVerbosity.ERROR,"Failed to createSecureContext with error "+n.message),null}}};VZ.SecureConnectorImpl=class{constructor(e,t,r,n){this.parent=e,this.channelTarget=t,this.options=r,this.callCredentials=n}connect(e){return new Promise((t,r)=>{let n=this.parent.getLatestSecureContext();if(!n){r(new Error("Failed to load credentials"));return}e.closed&&r(new Error("Socket closed while loading credentials"));let i=ONt(n,this.parent.verifyOptions,this.channelTarget,this.options),s=Object.assign({socket:e},i),o=()=>{r(new Error("Socket closed"))},a=l=>{r(l)},c=(0,YU.connect)(s,()=>{var l;if(c.removeListener("close",o),c.removeListener("error",a),(!((l=this.parent.verifyOptions.rejectUnauthorized)!==null&&l!==void 0)||l)&&!c.authorized){r(c.authorizationError);return}t({socket:c,secure:!0})});c.once("close",o),c.once("error",a)})}async waitForReady(){await this.parent.getSecureContext()}getCallCredentials(){return this.callCredentials}destroy(){this.parent.unref()}};function Zln(e,t,r){return new VZ(e,t,r??{})}var mIe=class e extends bC{constructor(t,r){if(super(),this.channelCredentials=t,this.callCredentials=r,!t._isSecure())throw new Error("Cannot compose insecure credentials")}compose(t){let r=this.callCredentials.compose(t);return new e(this.channelCredentials,r)}_isSecure(){return!0}_equals(t){return this===t?!0:t instanceof e?this.channelCredentials._equals(t.channelCredentials)&&this.callCredentials._equals(t.callCredentials):!1}_createSecureConnector(t,r,n){let i=this.callCredentials.compose(n??$Z.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector(t,r,i)}}});var gE=y(Ny=>{"use strict";Object.defineProperty(Ny,"__esModule",{value:!0});Ny.createChildChannelControlHelper=eun;Ny.registerLoadBalancerType=tun;Ny.registerDefaultLoadBalancerType=run;Ny.createLoadBalancer=nun;Ny.isLoadBalancerNameRegistered=iun;Ny.parseLoadBalancingConfig=PNt;Ny.getDefaultConfig=sun;Ny.selectLbConfigFromList=oun;var Xln=Ts(),Qln=Ln();function eun(e,t){var r,n,i,s,o,a,c,l,u,d;return{createSubchannel:(n=(r=t.createSubchannel)===null||r===void 0?void 0:r.bind(t))!==null&&n!==void 0?n:e.createSubchannel.bind(e),updateState:(s=(i=t.updateState)===null||i===void 0?void 0:i.bind(t))!==null&&s!==void 0?s:e.updateState.bind(e),requestReresolution:(a=(o=t.requestReresolution)===null||o===void 0?void 0:o.bind(t))!==null&&a!==void 0?a:e.requestReresolution.bind(e),addChannelzChild:(l=(c=t.addChannelzChild)===null||c===void 0?void 0:c.bind(t))!==null&&l!==void 0?l:e.addChannelzChild.bind(e),removeChannelzChild:(d=(u=t.removeChannelzChild)===null||u===void 0?void 0:u.bind(t))!==null&&d!==void 0?d:e.removeChannelzChild.bind(e)}}var mE={},ZU=null;function tun(e,t,r){mE[e]={LoadBalancer:t,LoadBalancingConfig:r}}function run(e){ZU=e}function nun(e,t){let r=e.getLoadBalancerName();return r in mE?new mE[r].LoadBalancer(t):null}function iun(e){return e in mE}function PNt(e){let t=Object.keys(e);if(t.length!==1)throw new Error("Provided load balancing config has multiple conflicting entries");let r=t[0];if(r in mE)try{return mE[r].LoadBalancingConfig.createFromJson(e[r])}catch(n){throw new Error(`${r}: ${n.message}`)}else throw new Error(`Unrecognized load balancing config name ${r}`)}function sun(){if(!ZU)throw new Error("No default load balancer type registered");return new mE[ZU].LoadBalancingConfig}function oun(e,t=!1){for(let r of e)try{return PNt(r)}catch(n){(0,Xln.log)(Qln.LogVerbosity.DEBUG,"Config parsing failed with error",n.message);continue}return t&&ZU?new mE[ZU].LoadBalancingConfig:null}});var gIe=y(XU=>{"use strict";Object.defineProperty(XU,"__esModule",{value:!0});XU.validateRetryThrottling=RNt;XU.validateServiceConfig=kNt;XU.extractAndSelectServiceConfig=gun;var aun=require("os"),HZ=Ln(),GZ=/^\d+(\.\d{1,9})?s$/,cun="node";function lun(e){if("service"in e&&e.service!==""){if(typeof e.service!="string")throw new Error(`Invalid method config name: invalid service: expected type string, got ${typeof e.service}`);if("method"in e&&e.method!==""){if(typeof e.method!="string")throw new Error(`Invalid method config name: invalid method: expected type string, got ${typeof e.service}`);return{service:e.service,method:e.method}}else return{service:e.service}}else{if("method"in e&&e.method!==void 0)throw new Error("Invalid method config name: method set with empty or unset service");return{}}}function uun(e){if(!("maxAttempts"in e)||!Number.isInteger(e.maxAttempts)||e.maxAttempts<2)throw new Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in e)||typeof e.initialBackoff!="string"||!GZ.test(e.initialBackoff))throw new Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("maxBackoff"in e)||typeof e.maxBackoff!="string"||!GZ.test(e.maxBackoff))throw new Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("backoffMultiplier"in e)||typeof e.backoffMultiplier!="number"||e.backoffMultiplier<=0)throw new Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!("retryableStatusCodes"in e&&Array.isArray(e.retryableStatusCodes)))throw new Error("Invalid method config retry policy: retryableStatusCodes is required");if(e.retryableStatusCodes.length===0)throw new Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(let t of e.retryableStatusCodes)if(typeof t=="number"){if(!Object.values(HZ.Status).includes(t))throw new Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else if(typeof t=="string"){if(!Object.values(HZ.Status).includes(t.toUpperCase()))throw new Error("Invalid method config retry policy: retryableStatusCodes value not a status code name")}else throw new Error("Invalid method config retry policy: retryableStatusCodes value must be a string or number");return{maxAttempts:e.maxAttempts,initialBackoff:e.initialBackoff,maxBackoff:e.maxBackoff,backoffMultiplier:e.backoffMultiplier,retryableStatusCodes:e.retryableStatusCodes}}function dun(e){if(!("maxAttempts"in e)||!Number.isInteger(e.maxAttempts)||e.maxAttempts<2)throw new Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in e&&(typeof e.hedgingDelay!="string"||!GZ.test(e.hedgingDelay)))throw new Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");if("nonFatalStatusCodes"in e&&Array.isArray(e.nonFatalStatusCodes))for(let r of e.nonFatalStatusCodes)if(typeof r=="number"){if(!Object.values(HZ.Status).includes(r))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range")}else if(typeof r=="string"){if(!Object.values(HZ.Status).includes(r.toUpperCase()))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not a status code name")}else throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number");let t={maxAttempts:e.maxAttempts};return e.hedgingDelay&&(t.hedgingDelay=e.hedgingDelay),e.nonFatalStatusCodes&&(t.nonFatalStatusCodes=e.nonFatalStatusCodes),t}function fun(e){var t;let r={name:[]};if(!("name"in e)||!Array.isArray(e.name))throw new Error("Invalid method config: invalid name array");for(let n of e.name)r.name.push(lun(n));if("waitForReady"in e){if(typeof e.waitForReady!="boolean")throw new Error("Invalid method config: invalid waitForReady");r.waitForReady=e.waitForReady}if("timeout"in e)if(typeof e.timeout=="object"){if(!("seconds"in e.timeout)||typeof e.timeout.seconds!="number")throw new Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in e.timeout)||typeof e.timeout.nanos!="number")throw new Error("Invalid method config: invalid timeout.nanos");r.timeout=e.timeout}else if(typeof e.timeout=="string"&&GZ.test(e.timeout)){let n=e.timeout.substring(0,e.timeout.length-1).split(".");r.timeout={seconds:n[0]|0,nanos:((t=n[1])!==null&&t!==void 0?t:0)|0}}else throw new Error("Invalid method config: invalid timeout");if("maxRequestBytes"in e){if(typeof e.maxRequestBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");r.maxRequestBytes=e.maxRequestBytes}if("maxResponseBytes"in e){if(typeof e.maxResponseBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");r.maxResponseBytes=e.maxResponseBytes}if("retryPolicy"in e){if("hedgingPolicy"in e)throw new Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");r.retryPolicy=uun(e.retryPolicy)}else"hedgingPolicy"in e&&(r.hedgingPolicy=dun(e.hedgingPolicy));return r}function RNt(e){if(!("maxTokens"in e)||typeof e.maxTokens!="number"||e.maxTokens<=0||e.maxTokens>1e3)throw new Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in e)||typeof e.tokenRatio!="number"||e.tokenRatio<=0)throw new Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+e.maxTokens.toFixed(3),tokenRatio:+e.tokenRatio.toFixed(3)}}function pun(e){if(!(typeof e=="object"&&e!==null))throw new Error(`Invalid loadBalancingConfig: unexpected type ${typeof e}`);let t=Object.keys(e);if(t.length>1)throw new Error(`Invalid loadBalancingConfig: unexpected multiple keys ${t}`);if(t.length===0)throw new Error("Invalid loadBalancingConfig: load balancing policy name required");return{[t[0]]:e[t[0]]}}function kNt(e){let t={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in e)if(typeof e.loadBalancingPolicy=="string")t.loadBalancingPolicy=e.loadBalancingPolicy;else throw new Error("Invalid service config: invalid loadBalancingPolicy");if("loadBalancingConfig"in e)if(Array.isArray(e.loadBalancingConfig))for(let n of e.loadBalancingConfig)t.loadBalancingConfig.push(pun(n));else throw new Error("Invalid service config: invalid loadBalancingConfig");if("methodConfig"in e&&Array.isArray(e.methodConfig))for(let n of e.methodConfig)t.methodConfig.push(fun(n));"retryThrottling"in e&&(t.retryThrottling=RNt(e.retryThrottling));let r=[];for(let n of t.methodConfig)for(let i of n.name){for(let s of r)if(i.service===s.service&&i.method===s.method)throw new Error(`Invalid service config: duplicate name ${i.service}/${i.method}`);r.push(i)}return t}function hun(e){if(!("serviceConfig"in e))throw new Error("Invalid service config choice: missing service config");let t={serviceConfig:kNt(e.serviceConfig)};if("clientLanguage"in e)if(Array.isArray(e.clientLanguage)){t.clientLanguage=[];for(let n of e.clientLanguage)if(typeof n=="string")t.clientLanguage.push(n);else throw new Error("Invalid service config choice: invalid clientLanguage")}else throw new Error("Invalid service config choice: invalid clientLanguage");if("clientHostname"in e)if(Array.isArray(e.clientHostname)){t.clientHostname=[];for(let n of e.clientHostname)if(typeof n=="string")t.clientHostname.push(n);else throw new Error("Invalid service config choice: invalid clientHostname")}else throw new Error("Invalid service config choice: invalid clientHostname");if("percentage"in e)if(typeof e.percentage=="number"&&0<=e.percentage&&e.percentage<=100)t.percentage=e.percentage;else throw new Error("Invalid service config choice: invalid percentage");let r=["clientLanguage","percentage","clientHostname","serviceConfig"];for(let n in e)if(!r.includes(n))throw new Error(`Invalid service config choice: unexpected field ${n}`);return t}function mun(e,t){if(!Array.isArray(e))throw new Error("Invalid service config list");for(let r of e){let n=hun(r);if(!(typeof n.percentage=="number"&&t>n.percentage)){if(Array.isArray(n.clientHostname)){let i=!1;for(let s of n.clientHostname)s===aun.hostname()&&(i=!0);if(!i)continue}if(Array.isArray(n.clientLanguage)){let i=!1;for(let s of n.clientLanguage)s===cun&&(i=!0);if(!i)continue}return n.serviceConfig}}throw new Error("No matching service config found")}function gun(e,t){for(let r of e)if(r.length>0&&r[0].startsWith("grpc_config=")){let n=r.join("").substring(12),i=JSON.parse(n);return mun(i,t)}return null}});var Sd=y(zZ=>{"use strict";Object.defineProperty(zZ,"__esModule",{value:!0});zZ.ConnectivityState=void 0;var NNt;(function(e){e[e.IDLE=0]="IDLE",e[e.CONNECTING=1]="CONNECTING",e[e.READY=2]="READY",e[e.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",e[e.SHUTDOWN=4]="SHUTDOWN"})(NNt||(zZ.ConnectivityState=NNt={}))});var nS=y(yE=>{"use strict";Object.defineProperty(yE,"__esModule",{value:!0});yE.QueuePicker=yE.UnavailablePicker=yE.PickResultType=void 0;var yun=Qc(),bun=Ln(),jZ;(function(e){e[e.COMPLETE=0]="COMPLETE",e[e.QUEUE=1]="QUEUE",e[e.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",e[e.DROP=3]="DROP"})(jZ||(yE.PickResultType=jZ={}));var yIe=class{constructor(t){this.status=Object.assign({code:bun.Status.UNAVAILABLE,details:"No connection established",metadata:new yun.Metadata},t)}pick(t){return{pickResultType:jZ.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}};yE.UnavailablePicker=yIe;var bIe=class{constructor(t,r){this.loadBalancer=t,this.childPicker=r,this.calledExitIdle=!1}pick(t){return this.calledExitIdle||(process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0),this.childPicker?this.childPicker.pick(t):{pickResultType:jZ.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}};yE.QueuePicker=bIe});var i1=y(JZ=>{"use strict";Object.defineProperty(JZ,"__esModule",{value:!0});JZ.BackoffTimeout=void 0;var Sun=Ln(),vun=Ts(),_un="backoff",Eun=1e3,xun=1.6,Iun=12e4,wun=.2;function Cun(e,t){return Math.random()*(t-e)+e}var WZ=class e{constructor(t,r){this.callback=t,this.initialDelay=Eun,this.multiplier=xun,this.maxDelay=Iun,this.jitter=wun,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,this.id=e.getNextId(),r&&(r.initialDelay&&(this.initialDelay=r.initialDelay),r.multiplier&&(this.multiplier=r.multiplier),r.jitter&&(this.jitter=r.jitter),r.maxDelay&&(this.maxDelay=r.maxDelay)),this.trace("constructed initialDelay="+this.initialDelay+" multiplier="+this.multiplier+" jitter="+this.jitter+" maxDelay="+this.maxDelay),this.nextDelay=this.initialDelay,this.timerId=setTimeout(()=>{},0),clearTimeout(this.timerId)}static getNextId(){return this.nextId++}trace(t){vun.trace(Sun.LogVerbosity.DEBUG,_un,"{"+this.id+"} "+t)}runTimer(t){var r,n;this.trace("runTimer(delay="+t+")"),this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+t),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.trace("timer fired"),this.running=!1,this.callback()},t),this.hasRef||(n=(r=this.timerId).unref)===null||n===void 0||n.call(r)}runOnce(){this.trace("runOnce()"),this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);let t=Math.min(this.nextDelay*this.multiplier,this.maxDelay),r=t*this.jitter;this.nextDelay=t+Cun(-r,r)}stop(){this.trace("stop()"),clearTimeout(this.timerId),this.running=!1}reset(){if(this.trace("reset() running="+this.running),this.nextDelay=this.initialDelay,this.running){let t=new Date,r=this.startTime;r.setMilliseconds(r.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),t<r?this.runTimer(r.getTime()-t.getTime()):this.running=!1}}isRunning(){return this.running}ref(){var t,r;this.hasRef=!0,(r=(t=this.timerId).ref)===null||r===void 0||r.call(t)}unref(){var t,r;this.hasRef=!1,(r=(t=this.timerId).unref)===null||r===void 0||r.call(t)}getEndTime(){return this.endTime}};JZ.BackoffTimeout=WZ;WZ.nextId=0});var KZ=y(YZ=>{"use strict";Object.defineProperty(YZ,"__esModule",{value:!0});YZ.ChildLoadBalancerHandler=void 0;var Aun=gE(),Tun=Sd(),Oun="child_load_balancer_helper",SIe=class{constructor(t){this.channelControlHelper=t,this.currentChild=null,this.pendingChild=null,this.latestConfig=null,this.ChildPolicyHelper=class{constructor(r){this.parent=r,this.child=null}createSubchannel(r,n){return this.parent.channelControlHelper.createSubchannel(r,n)}updateState(r,n,i){var s;if(this.calledByPendingChild()){if(r===Tun.ConnectivityState.CONNECTING)return;(s=this.parent.currentChild)===null||s===void 0||s.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(r,n,i)}requestReresolution(){var r;let n=(r=this.parent.pendingChild)!==null&&r!==void 0?r:this.parent.currentChild;this.child===n&&this.parent.channelControlHelper.requestReresolution()}setChild(r){this.child=r}addChannelzChild(r){this.parent.channelControlHelper.addChannelzChild(r)}removeChannelzChild(r){this.parent.channelControlHelper.removeChannelzChild(r)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}configUpdateRequiresNewPolicyInstance(t,r){return t.getLoadBalancerName()!==r.getLoadBalancerName()}updateAddressList(t,r,n,i){let s;if(this.currentChild===null||this.latestConfig===null||this.configUpdateRequiresNewPolicyInstance(this.latestConfig,r)){let o=new this.ChildPolicyHelper(this),a=(0,Aun.createLoadBalancer)(r,o);o.setChild(a),this.currentChild===null?(this.currentChild=a,s=this.currentChild):(this.pendingChild&&this.pendingChild.destroy(),this.pendingChild=a,s=this.pendingChild)}else this.pendingChild===null?s=this.currentChild:s=this.pendingChild;return this.latestConfig=r,s.updateAddressList(t,r,n,i)}exitIdle(){this.currentChild&&(this.currentChild.exitIdle(),this.pendingChild&&this.pendingChild.exitIdle())}resetBackoff(){this.currentChild&&(this.currentChild.resetBackoff(),this.pendingChild&&this.pendingChild.resetBackoff())}destroy(){this.currentChild&&(this.currentChild.destroy(),this.currentChild=null),this.pendingChild&&(this.pendingChild.destroy(),this.pendingChild=null)}getTypeName(){return Oun}};YZ.ChildLoadBalancerHandler=SIe});var BNt=y(ZZ=>{"use strict";Object.defineProperty(ZZ,"__esModule",{value:!0});ZZ.ResolvingLoadBalancer=void 0;var Pun=gE(),Run=gIe(),nf=Sd(),DNt=Om(),QU=nS(),kun=i1(),vIe=Ln(),Nun=Qc(),Dun=Ts(),Mun=Ln(),Fun=bd(),Uun=KZ(),Lun="resolving_load_balancer";function MNt(e){Dun.trace(Mun.LogVerbosity.DEBUG,Lun,e)}var qun=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function Vun(e,t,r,n){for(let i of r.name)switch(n){case"EMPTY":if(!i.service&&!i.method)return!0;break;case"SERVICE":if(i.service===e&&!i.method)return!0;break;case"SERVICE_AND_METHOD":if(i.service===e&&i.method===t)return!0}return!1}function $un(e,t,r,n){for(let i of r)if(Vun(e,t,i,n))return i;return null}function Hun(e){return{invoke(t,r){var n,i;let s=t.split("/").filter(c=>c.length>0),o=(n=s[0])!==null&&n!==void 0?n:"",a=(i=s[1])!==null&&i!==void 0?i:"";if(e&&e.methodConfig)for(let c of qun){let l=$un(o,a,e.methodConfig,c);if(l)return{methodConfig:l,pickInformation:{},status:vIe.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:vIe.Status.OK,dynamicFilterFactories:[]}},unref(){}}}var _Ie=class{constructor(t,r,n,i,s){this.target=t,this.channelControlHelper=r,this.channelOptions=n,this.onSuccessfulResolution=i,this.onFailedResolution=s,this.latestChildState=nf.ConnectivityState.IDLE,this.latestChildPicker=new QU.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=nf.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,n["grpc.service_config"]?this.defaultServiceConfig=(0,Run.validateServiceConfig)(JSON.parse(n["grpc.service_config"])):this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]},this.updateState(nf.ConnectivityState.IDLE,new QU.QueuePicker(this),null),this.childLoadBalancer=new Uun.ChildLoadBalancerHandler({createSubchannel:r.createSubchannel.bind(r),requestReresolution:()=>{this.backoffTimeout.isRunning()?(MNt("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0):this.updateResolution()},updateState:(a,c,l)=>{this.latestChildState=a,this.latestChildPicker=c,this.latestChildErrorMessage=l,this.updateState(a,c,l)},addChannelzChild:r.addChannelzChild.bind(r),removeChannelzChild:r.removeChannelzChild.bind(r)}),this.innerResolver=(0,DNt.createResolver)(t,this.handleResolverResult.bind(this),n);let o={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new kun.BackoffTimeout(()=>{this.continueResolving?(this.updateResolution(),this.continueResolving=!1):this.updateState(this.latestChildState,this.latestChildPicker,this.latestChildErrorMessage)},o),this.backoffTimeout.unref()}handleResolverResult(t,r,n,i){var s,o;this.backoffTimeout.stop(),this.backoffTimeout.reset();let a=!0,c=null;if(n===null?c=this.defaultServiceConfig:n.ok?c=n.value:this.previousServiceConfig!==null?c=this.previousServiceConfig:(a=!1,this.handleResolutionFailure(n.error)),c!==null){let l=(s=c?.loadBalancingConfig)!==null&&s!==void 0?s:[],u=(0,Pun.selectLbConfigFromList)(l,!0);u===null?(a=!1,this.handleResolutionFailure({code:vIe.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new Nun.Metadata})):a=this.childLoadBalancer.updateAddressList(t,u,Object.assign(Object.assign({},this.channelOptions),r),i)}return a&&this.onSuccessfulResolution(c,(o=r[DNt.CHANNEL_ARGS_CONFIG_SELECTOR_KEY])!==null&&o!==void 0?o:Hun(c)),a}updateResolution(){this.innerResolver.updateResolution(),this.currentState===nf.ConnectivityState.IDLE&&this.updateState(nf.ConnectivityState.CONNECTING,this.latestChildPicker,this.latestChildErrorMessage),this.backoffTimeout.runOnce()}updateState(t,r,n){MNt((0,Fun.uriToString)(this.target)+" "+nf.ConnectivityState[this.currentState]+" -> "+nf.ConnectivityState[t]),t===nf.ConnectivityState.IDLE&&(r=new QU.QueuePicker(this,r)),this.currentState=t,this.channelControlHelper.updateState(t,r,n)}handleResolutionFailure(t){this.latestChildState===nf.ConnectivityState.IDLE&&(this.updateState(nf.ConnectivityState.TRANSIENT_FAILURE,new QU.UnavailablePicker(t),t.details),this.onFailedResolution(t))}exitIdle(){(this.currentState===nf.ConnectivityState.IDLE||this.currentState===nf.ConnectivityState.TRANSIENT_FAILURE)&&(this.backoffTimeout.isRunning()?this.continueResolving=!0:this.updateResolution()),this.childLoadBalancer.exitIdle()}updateAddressList(t,r){throw new Error("updateAddressList not supported on ResolvingLoadBalancer")}resetBackoff(){this.backoffTimeout.reset(),this.childLoadBalancer.resetBackoff()}destroy(){this.childLoadBalancer.destroy(),this.innerResolver.destroy(),this.backoffTimeout.reset(),this.backoffTimeout.stop(),this.latestChildState=nf.ConnectivityState.IDLE,this.latestChildPicker=new QU.QueuePicker(this),this.currentState=nf.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}};ZZ.ResolvingLoadBalancer=_Ie});var FNt=y(eL=>{"use strict";Object.defineProperty(eL,"__esModule",{value:!0});eL.recognizedOptions=void 0;eL.channelOptionsEqual=Gun;eL.recognizedOptions={"grpc.ssl_target_name_override":!0,"grpc.primary_user_agent":!0,"grpc.secondary_user_agent":!0,"grpc.default_authority":!0,"grpc.keepalive_time_ms":!0,"grpc.keepalive_timeout_ms":!0,"grpc.keepalive_permit_without_calls":!0,"grpc.service_config":!0,"grpc.max_concurrent_streams":!0,"grpc.initial_reconnect_backoff_ms":!0,"grpc.max_reconnect_backoff_ms":!0,"grpc.use_local_subchannel_pool":!0,"grpc.max_send_message_length":!0,"grpc.max_receive_message_length":!0,"grpc.enable_http_proxy":!0,"grpc.enable_channelz":!0,"grpc.dns_min_time_between_resolutions_ms":!0,"grpc.enable_retries":!0,"grpc.per_rpc_retry_buffer_size":!0,"grpc.retry_buffer_size":!0,"grpc.max_connection_age_ms":!0,"grpc.max_connection_age_grace_ms":!0,"grpc-node.max_session_memory":!0,"grpc.service_config_disable_resolution":!0,"grpc.client_idle_timeout_ms":!0,"grpc-node.tls_enable_trace":!0,"grpc.lb.ring_hash.ring_size_cap":!0,"grpc-node.retry_max_attempts_limit":!0,"grpc-node.flow_control_window":!0,"grpc.server_call_metric_recording":!0};function Gun(e,t){let r=Object.keys(e).sort(),n=Object.keys(t).sort();if(r.length!==n.length)return!1;for(let i=0;i<r.length;i+=1)if(r[i]!==n[i]||e[r[i]]!==t[n[i]])return!1;return!0}});var sf=y(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});Pm.EndpointMap=void 0;Pm.isTcpSubchannelAddress=rL;Pm.subchannelAddressEqual=XZ;Pm.subchannelAddressToString=LNt;Pm.stringToSubchannelAddress=jun;Pm.endpointEqual=Wun;Pm.endpointToString=Jun;Pm.endpointHasAddress=qNt;var UNt=require("net");function rL(e){return"port"in e}function XZ(e,t){return!e&&!t?!0:!e||!t?!1:rL(e)?rL(t)&&e.host===t.host&&e.port===t.port:!rL(t)&&e.path===t.path}function LNt(e){return rL(e)?(0,UNt.isIPv6)(e.host)?"["+e.host+"]:"+e.port:e.host+":"+e.port:e.path}var zun=443;function jun(e,t){return(0,UNt.isIP)(e)?{host:e,port:t??zun}:{path:e}}function Wun(e,t){if(e.addresses.length!==t.addresses.length)return!1;for(let r=0;r<e.addresses.length;r++)if(!XZ(e.addresses[r],t.addresses[r]))return!1;return!0}function Jun(e){return"["+e.addresses.map(LNt).join(", ")+"]"}function qNt(e,t){for(let r of e.addresses)if(XZ(r,t))return!0;return!1}function tL(e,t){if(e.addresses.length!==t.addresses.length)return!1;for(let r of e.addresses){let n=!1;for(let i of t.addresses)if(XZ(r,i)){n=!0;break}if(!n)return!1}return!0}var EIe=class{constructor(){this.map=new Set}get size(){return this.map.size}getForSubchannelAddress(t){for(let r of this.map)if(qNt(r.key,t))return r.value}deleteMissing(t){let r=[];for(let n of this.map){let i=!1;for(let s of t)tL(s,n.key)&&(i=!0);i||(r.push(n.value),this.map.delete(n))}return r}get(t){for(let r of this.map)if(tL(t,r.key))return r.value}set(t,r){for(let n of this.map)if(tL(t,n.key)){n.value=r;return}this.map.add({key:t,value:r})}delete(t){for(let r of this.map)if(tL(t,r.key)){this.map.delete(r);return}}has(t){for(let r of this.map)if(tL(t,r.key))return!0;return!1}clear(){this.map.clear()}*keys(){for(let t of this.map)yield t.key}*values(){for(let t of this.map)yield t.value}*entries(){for(let t of this.map)yield[t.key,t.value]}};Pm.EndpointMap=EIe});var VNt=y(PIe=>{"use strict";Object.defineProperty(PIe,"t",{value:!0});var QZ=class{constructor(t,r,n=1){this.i=void 0,this.h=void 0,this.o=void 0,this.u=t,this.l=r,this.p=n}I(){let t=this,r=t.o.o===t;if(r&&t.p===1)t=t.h;else if(t.i)for(t=t.i;t.h;)t=t.h;else{if(r)return t.o;let n=t.o;for(;n.i===t;)t=n,n=t.o;t=n}return t}B(){let t=this;if(t.h){for(t=t.h;t.i;)t=t.i;return t}else{let r=t.o;for(;r.h===t;)t=r,r=t.o;return t.h!==r?r:t}}_(){let t=this.o,r=this.h,n=r.i;return t.o===this?t.o=r:t.i===this?t.i=r:t.h=r,r.o=t,r.i=this,this.o=r,this.h=n,n&&(n.o=this),r}g(){let t=this.o,r=this.i,n=r.h;return t.o===this?t.o=r:t.i===this?t.i=r:t.h=r,r.o=t,r.h=this,this.o=r,this.i=n,n&&(n.o=this),r}},xIe=class extends QZ{constructor(){super(...arguments),this.M=1}_(){let t=super._();return this.O(),t.O(),t}g(){let t=super.g();return this.O(),t.O(),t}O(){this.M=1,this.i&&(this.M+=this.i.M),this.h&&(this.M+=this.h.M)}},IIe=class{constructor(t=0){this.iteratorType=t}equals(t){return this.T===t.T}},wIe=class{constructor(){this.m=0}get length(){return this.m}size(){return this.m}empty(){return this.m===0}},CIe=class extends wIe{};function SC(){throw new RangeError("Iterator access denied!")}var AIe=class extends CIe{constructor(t=function(n,i){return n<i?-1:n>i?1:0},r=!1){super(),this.v=void 0,this.A=t,this.enableIndex=r,this.N=r?xIe:QZ,this.C=new this.N}R(t,r){let n=this.C;for(;t;){let i=this.A(t.u,r);if(i<0)t=t.h;else if(i>0)n=t,t=t.i;else return t}return n}K(t,r){let n=this.C;for(;t;)this.A(t.u,r)<=0?t=t.h:(n=t,t=t.i);return n}L(t,r){let n=this.C;for(;t;){let i=this.A(t.u,r);if(i<0)n=t,t=t.h;else if(i>0)t=t.i;else return t}return n}k(t,r){let n=this.C;for(;t;)this.A(t.u,r)<0?(n=t,t=t.h):t=t.i;return n}P(t){for(;;){let r=t.o;if(r===this.C)return;if(t.p===1){t.p=0;return}if(t===r.i){let n=r.h;if(n.p===1)n.p=0,r.p=1,r===this.v?this.v=r._():r._();else if(n.h&&n.h.p===1){n.p=r.p,r.p=0,n.h.p=0,r===this.v?this.v=r._():r._();return}else n.i&&n.i.p===1?(n.p=1,n.i.p=0,n.g()):(n.p=1,t=r)}else{let n=r.i;if(n.p===1)n.p=0,r.p=1,r===this.v?this.v=r.g():r.g();else if(n.i&&n.i.p===1){n.p=r.p,r.p=0,n.i.p=0,r===this.v?this.v=r.g():r.g();return}else n.h&&n.h.p===1?(n.p=1,n.h.p=0,n._()):(n.p=1,t=r)}}}S(t){if(this.m===1){this.clear();return}let r=t;for(;r.i||r.h;){if(r.h)for(r=r.h;r.i;)r=r.i;else r=r.i;let i=t.u;t.u=r.u,r.u=i;let s=t.l;t.l=r.l,r.l=s,t=r}this.C.i===r?this.C.i=r.o:this.C.h===r&&(this.C.h=r.o),this.P(r);let n=r.o;if(r===n.i?n.i=void 0:n.h=void 0,this.m-=1,this.v.p=0,this.enableIndex)for(;n!==this.C;)n.M-=1,n=n.o}U(t){let r=typeof t=="number"?t:void 0,n=typeof t=="function"?t:void 0,i=typeof t>"u"?[]:void 0,s=0,o=this.v,a=[];for(;a.length||o;)if(o)a.push(o),o=o.i;else{if(o=a.pop(),s===r)return o;i&&i.push(o),n&&n(o,s,this),s+=1,o=o.h}return i}j(t){for(;;){let r=t.o;if(r.p===0)return;let n=r.o;if(r===n.i){let i=n.h;if(i&&i.p===1){if(i.p=r.p=0,n===this.v)return;n.p=1,t=n;continue}else if(t===r.h){if(t.p=0,t.i&&(t.i.o=r),t.h&&(t.h.o=n),r.h=t.i,n.i=t.h,t.i=r,t.h=n,n===this.v)this.v=t,this.C.o=t;else{let s=n.o;s.i===n?s.i=t:s.h=t}t.o=n.o,r.o=t,n.o=t,n.p=1}else{r.p=0,n===this.v?this.v=n.g():n.g(),n.p=1;return}}else{let i=n.i;if(i&&i.p===1){if(i.p=r.p=0,n===this.v)return;n.p=1,t=n;continue}else if(t===r.i){if(t.p=0,t.i&&(t.i.o=n),t.h&&(t.h.o=r),n.h=t.i,r.i=t.h,t.i=n,t.h=r,n===this.v)this.v=t,this.C.o=t;else{let s=n.o;s.i===n?s.i=t:s.h=t}t.o=n.o,r.o=t,n.o=t,n.p=1}else{r.p=0,n===this.v?this.v=n._():n._(),n.p=1;return}}this.enableIndex&&(r.O(),n.O(),t.O());return}}q(t,r,n){if(this.v===void 0)return this.m+=1,this.v=new this.N(t,r,0),this.v.o=this.C,this.C.o=this.C.i=this.C.h=this.v,this.m;let i,s=this.C.i,o=this.A(s.u,t);if(o===0)return s.l=r,this.m;if(o>0)s.i=new this.N(t,r),s.i.o=s,i=s.i,this.C.i=i;else{let a=this.C.h,c=this.A(a.u,t);if(c===0)return a.l=r,this.m;if(c<0)a.h=new this.N(t,r),a.h.o=a,i=a.h,this.C.h=i;else{if(n!==void 0){let l=n.T;if(l!==this.C){let u=this.A(l.u,t);if(u===0)return l.l=r,this.m;if(u>0){let d=l.I(),p=this.A(d.u,t);if(p===0)return d.l=r,this.m;p<0&&(i=new this.N(t,r),d.h===void 0?(d.h=i,i.o=d):(l.i=i,i.o=l))}}}if(i===void 0)for(i=this.v;;){let l=this.A(i.u,t);if(l>0){if(i.i===void 0){i.i=new this.N(t,r),i.i.o=i,i=i.i;break}i=i.i}else if(l<0){if(i.h===void 0){i.h=new this.N(t,r),i.h.o=i,i=i.h;break}i=i.h}else return i.l=r,this.m}}}if(this.enableIndex){let a=i.o;for(;a!==this.C;)a.M+=1,a=a.o}return this.j(i),this.m+=1,this.m}H(t,r){for(;t;){let n=this.A(t.u,r);if(n<0)t=t.h;else if(n>0)t=t.i;else return t}return t||this.C}clear(){this.m=0,this.v=void 0,this.C.o=void 0,this.C.i=this.C.h=void 0}updateKeyByIterator(t,r){let n=t.T;if(n===this.C&&SC(),this.m===1)return n.u=r,!0;let i=n.B().u;if(n===this.C.i)return this.A(i,r)>0?(n.u=r,!0):!1;let s=n.I().u;return n===this.C.h?this.A(s,r)<0?(n.u=r,!0):!1:this.A(s,r)>=0||this.A(i,r)<=0?!1:(n.u=r,!0)}eraseElementByPos(t){if(t<0||t>this.m-1)throw new RangeError;let r=this.U(t);return this.S(r),this.m}eraseElementByKey(t){if(this.m===0)return!1;let r=this.H(this.v,t);return r===this.C?!1:(this.S(r),!0)}eraseElementByIterator(t){let r=t.T;r===this.C&&SC();let n=r.h===void 0;return t.iteratorType===0?n&&t.next():(!n||r.i===void 0)&&t.next(),this.S(r),t}getHeight(){if(this.m===0)return 0;function t(r){return r?Math.max(t(r.i),t(r.h))+1:0}return t(this.v)}},TIe=class extends IIe{constructor(t,r,n){super(n),this.T=t,this.C=r,this.iteratorType===0?(this.pre=function(){return this.T===this.C.i&&SC(),this.T=this.T.I(),this},this.next=function(){return this.T===this.C&&SC(),this.T=this.T.B(),this}):(this.pre=function(){return this.T===this.C.h&&SC(),this.T=this.T.B(),this},this.next=function(){return this.T===this.C&&SC(),this.T=this.T.I(),this})}get index(){let t=this.T,r=this.C.o;if(t===this.C)return r?r.M-1:0;let n=0;for(t.i&&(n+=t.i.M);t!==r;){let i=t.o;t===i.h&&(n+=1,i.i&&(n+=i.i.M)),t=i}return n}isAccessible(){return this.T!==this.C}},Rm=class e extends TIe{constructor(t,r,n,i){super(t,r,i),this.container=n}get pointer(){this.T===this.C&&SC();let t=this;return new Proxy([],{get(r,n){return n==="0"?t.T.u:n==="1"?t.T.l:(r[0]=t.T.u,r[1]=t.T.l,r[n])},set(r,n,i){if(n!=="1")throw new TypeError("prop must be 1");return t.T.l=i,!0}})}copy(){return new e(this.T,this.C,this.container,this.iteratorType)}},OIe=class extends AIe{constructor(t=[],r,n){super(r,n);let i=this;t.forEach(function(s){i.setElement(s[0],s[1])})}begin(){return new Rm(this.C.i||this.C,this.C,this)}end(){return new Rm(this.C,this.C,this)}rBegin(){return new Rm(this.C.h||this.C,this.C,this,1)}rEnd(){return new Rm(this.C,this.C,this,1)}front(){if(this.m===0)return;let t=this.C.i;return[t.u,t.l]}back(){if(this.m===0)return;let t=this.C.h;return[t.u,t.l]}lowerBound(t){let r=this.R(this.v,t);return new Rm(r,this.C,this)}upperBound(t){let r=this.K(this.v,t);return new Rm(r,this.C,this)}reverseLowerBound(t){let r=this.L(this.v,t);return new Rm(r,this.C,this)}reverseUpperBound(t){let r=this.k(this.v,t);return new Rm(r,this.C,this)}forEach(t){this.U(function(r,n,i){t([r.u,r.l],n,i)})}setElement(t,r,n){return this.q(t,r,n)}getElementByPos(t){if(t<0||t>this.m-1)throw new RangeError;let r=this.U(t);return[r.u,r.l]}find(t){let r=this.H(this.v,t);return new Rm(r,this.C,this)}getElementByKey(t){return this.H(this.v,t).l}union(t){let r=this;return t.forEach(function(n){r.setElement(n[0],n[1])}),this.m}*[Symbol.iterator](){let t=this.m,r=this.U();for(let n=0;n<t;++n){let i=r[n];yield[i.u,i.l]}}};PIe.OrderedMap=OIe});var tX=y(eX=>{"use strict";Object.defineProperty(eX,"__esModule",{value:!0});eX.registerAdminService=Yun;eX.addAdminServicesToServer=Kun;var $Nt=[];function Yun(e,t){$Nt.push({getServiceDefinition:e,getHandlers:t})}function Kun(e){for(let{getServiceDefinition:t,getHandlers:r}of $Nt)e.addService(t(),r())}});var HNt=y(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});km.ClientDuplexStreamImpl=km.ClientWritableStreamImpl=km.ClientReadableStreamImpl=km.ClientUnaryCallImpl=void 0;km.callErrorFromStatus=Xun;var Zun=require("events"),MIe=require("stream"),nL=Ln();function Xun(e,t){let r=`${e.code} ${nL.Status[e.code]}: ${e.details}`,i=`${new Error(r).stack}
564
564
  for call at
565
565
  ${t}`;return Object.assign(new Error(r),e,{stack:i})}var RIe=class extends Zun.EventEmitter{constructor(){super()}cancel(){var t;(t=this.call)===null||t===void 0||t.cancelWithStatus(nL.Status.CANCELLED,"Cancelled on client")}getPeer(){var t,r;return(r=(t=this.call)===null||t===void 0?void 0:t.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var t,r;return(r=(t=this.call)===null||t===void 0?void 0:t.getAuthContext())!==null&&r!==void 0?r:null}};km.ClientUnaryCallImpl=RIe;var kIe=class extends MIe.Readable{constructor(t){super({objectMode:!0}),this.deserialize=t}cancel(){var t;(t=this.call)===null||t===void 0||t.cancelWithStatus(nL.Status.CANCELLED,"Cancelled on client")}getPeer(){var t,r;return(r=(t=this.call)===null||t===void 0?void 0:t.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var t,r;return(r=(t=this.call)===null||t===void 0?void 0:t.getAuthContext())!==null&&r!==void 0?r:null}_read(t){var r;(r=this.call)===null||r===void 0||r.startRead()}};km.ClientReadableStreamImpl=kIe;var NIe=class extends MIe.Writable{constructor(t){super({objectMode:!0}),this.serialize=t}cancel(){var t;(t=this.call)===null||t===void 0||t.cancelWithStatus(nL.Status.CANCELLED,"Cancelled on client")}getPeer(){var t,r;return(r=(t=this.call)===null||t===void 0?void 0:t.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var t,r;return(r=(t=this.call)===null||t===void 0?void 0:t.getAuthContext())!==null&&r!==void 0?r:null}_write(t,r,n){var i;let s={callback:n},o=Number(r);Number.isNaN(o)||(s.flags=o),(i=this.call)===null||i===void 0||i.sendMessageWithContext(s,t)}_final(t){var r;(r=this.call)===null||r===void 0||r.halfClose(),t()}};km.ClientWritableStreamImpl=NIe;var DIe=class extends MIe.Duplex{constructor(t,r){super({objectMode:!0}),this.serialize=t,this.deserialize=r}cancel(){var t;(t=this.call)===null||t===void 0||t.cancelWithStatus(nL.Status.CANCELLED,"Cancelled on client")}getPeer(){var t,r;return(r=(t=this.call)===null||t===void 0?void 0:t.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var t,r;return(r=(t=this.call)===null||t===void 0?void 0:t.getAuthContext())!==null&&r!==void 0?r:null}_read(t){var r;(r=this.call)===null||r===void 0||r.startRead()}_write(t,r,n){var i;let s={callback:n},o=Number(r);Number.isNaN(o)||(s.flags=o),(i=this.call)===null||i===void 0||i.sendMessageWithContext(s,t)}_final(t){var r;(r=this.call)===null||r===void 0||r.halfClose(),t()}};km.ClientDuplexStreamImpl=DIe});var _C=y(vC=>{"use strict";Object.defineProperty(vC,"__esModule",{value:!0});vC.InterceptingListenerImpl=void 0;vC.statusOrFromValue=edn;vC.statusOrFromError=tdn;vC.isInterceptingListener=rdn;var Qun=Qc();function edn(e){return{ok:!0,value:e}}function tdn(e){var t;return{ok:!1,error:Object.assign(Object.assign({},e),{metadata:(t=e.metadata)!==null&&t!==void 0?t:new Qun.Metadata})}}function rdn(e){return e.onReceiveMetadata!==void 0&&e.onReceiveMetadata.length===1}var BIe=class{constructor(t,r){this.listener=t,this.nextListener=r,this.processingMetadata=!1,this.hasPendingMessage=!1,this.processingMessage=!1,this.pendingStatus=null}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingStatus(){this.pendingStatus&&this.nextListener.onReceiveStatus(this.pendingStatus)}onReceiveMetadata(t){this.processingMetadata=!0,this.listener.onReceiveMetadata(t,r=>{this.processingMetadata=!1,this.nextListener.onReceiveMetadata(r),this.processPendingMessage(),this.processPendingStatus()})}onReceiveMessage(t){this.processingMessage=!0,this.listener.onReceiveMessage(t,r=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=r,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(r),this.processPendingStatus())})}onReceiveStatus(t){this.listener.onReceiveStatus(t,r=>{this.processingMetadata||this.processingMessage?this.pendingStatus=r:this.nextListener.onReceiveStatus(r)})}};vC.InterceptingListenerImpl=BIe});var HIe=y(Nm=>{"use strict";Object.defineProperty(Nm,"__esModule",{value:!0});Nm.InterceptingCall=Nm.RequesterBuilder=Nm.ListenerBuilder=Nm.InterceptorConfigurationError=void 0;Nm.getInterceptingCall=odn;var ndn=Qc(),GNt=_C(),zNt=Ln(),jNt=MZ(),sL=class e extends Error{constructor(t){super(t),this.name="InterceptorConfigurationError",Error.captureStackTrace(this,e)}};Nm.InterceptorConfigurationError=sL;var UIe=class{constructor(){this.metadata=void 0,this.message=void 0,this.status=void 0}withOnReceiveMetadata(t){return this.metadata=t,this}withOnReceiveMessage(t){return this.message=t,this}withOnReceiveStatus(t){return this.status=t,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveStatus:this.status}}};Nm.ListenerBuilder=UIe;var LIe=class{constructor(){this.start=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withStart(t){return this.start=t,this}withSendMessage(t){return this.message=t,this}withHalfClose(t){return this.halfClose=t,this}withCancel(t){return this.cancel=t,this}build(){return{start:this.start,sendMessage:this.message,halfClose:this.halfClose,cancel:this.cancel}}};Nm.RequesterBuilder=LIe;var FIe={onReceiveMetadata:(e,t)=>{t(e)},onReceiveMessage:(e,t)=>{t(e)},onReceiveStatus:(e,t)=>{t(e)}},iL={start:(e,t,r)=>{r(e,t)},sendMessage:(e,t)=>{t(e)},halfClose:e=>{e()},cancel:e=>{e()}},qIe=class{constructor(t,r){var n,i,s,o;this.nextCall=t,this.processingMetadata=!1,this.pendingMessageContext=null,this.processingMessage=!1,this.pendingHalfClose=!1,r?this.requester={start:(n=r.start)!==null&&n!==void 0?n:iL.start,sendMessage:(i=r.sendMessage)!==null&&i!==void 0?i:iL.sendMessage,halfClose:(s=r.halfClose)!==null&&s!==void 0?s:iL.halfClose,cancel:(o=r.cancel)!==null&&o!==void 0?o:iL.cancel}:this.requester=iL}cancelWithStatus(t,r){this.requester.cancel(()=>{this.nextCall.cancelWithStatus(t,r)})}getPeer(){return this.nextCall.getPeer()}processPendingMessage(){this.pendingMessageContext&&(this.nextCall.sendMessageWithContext(this.pendingMessageContext,this.pendingMessage),this.pendingMessageContext=null,this.pendingMessage=null)}processPendingHalfClose(){this.pendingHalfClose&&this.nextCall.halfClose()}start(t,r){var n,i,s,o,a,c;let l={onReceiveMetadata:(i=(n=r?.onReceiveMetadata)===null||n===void 0?void 0:n.bind(r))!==null&&i!==void 0?i:u=>{},onReceiveMessage:(o=(s=r?.onReceiveMessage)===null||s===void 0?void 0:s.bind(r))!==null&&o!==void 0?o:u=>{},onReceiveStatus:(c=(a=r?.onReceiveStatus)===null||a===void 0?void 0:a.bind(r))!==null&&c!==void 0?c:u=>{}};this.processingMetadata=!0,this.requester.start(t,l,(u,d)=>{var p,f,h;this.processingMetadata=!1;let m;if((0,GNt.isInterceptingListener)(d))m=d;else{let S={onReceiveMetadata:(p=d.onReceiveMetadata)!==null&&p!==void 0?p:FIe.onReceiveMetadata,onReceiveMessage:(f=d.onReceiveMessage)!==null&&f!==void 0?f:FIe.onReceiveMessage,onReceiveStatus:(h=d.onReceiveStatus)!==null&&h!==void 0?h:FIe.onReceiveStatus};m=new GNt.InterceptingListenerImpl(S,l)}this.nextCall.start(u,m),this.processPendingMessage(),this.processPendingHalfClose()})}sendMessageWithContext(t,r){this.processingMessage=!0,this.requester.sendMessage(r,n=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessageContext=t,this.pendingMessage=r):(this.nextCall.sendMessageWithContext(t,n),this.processPendingHalfClose())})}sendMessage(t){this.sendMessageWithContext({},t)}startRead(){this.nextCall.startRead()}halfClose(){this.requester.halfClose(()=>{this.processingMetadata||this.processingMessage?this.pendingHalfClose=!0:this.nextCall.halfClose()})}getAuthContext(){return this.nextCall.getAuthContext()}};Nm.InterceptingCall=qIe;function idn(e,t,r){var n,i;let s=(n=r.deadline)!==null&&n!==void 0?n:1/0,o=r.host,a=(i=r.parent)!==null&&i!==void 0?i:null,c=r.propagate_flags,l=r.credentials,u=e.createCall(t,s,o,a,c);return l&&u.setCredentials(l),u}var rX=class{constructor(t,r){this.call=t,this.methodDefinition=r}cancelWithStatus(t,r){this.call.cancelWithStatus(t,r)}getPeer(){return this.call.getPeer()}sendMessageWithContext(t,r){let n;try{n=this.methodDefinition.requestSerialize(r)}catch(i){this.call.cancelWithStatus(zNt.Status.INTERNAL,`Request message serialization failure: ${(0,jNt.getErrorMessage)(i)}`);return}this.call.sendMessageWithContext(t,n)}sendMessage(t){this.sendMessageWithContext({},t)}start(t,r){let n=null;this.call.start(t,{onReceiveMetadata:i=>{var s;(s=r?.onReceiveMetadata)===null||s===void 0||s.call(r,i)},onReceiveMessage:i=>{var s;let o;try{o=this.methodDefinition.responseDeserialize(i)}catch(a){n={code:zNt.Status.INTERNAL,details:`Response message parsing error: ${(0,jNt.getErrorMessage)(a)}`,metadata:new ndn.Metadata},this.call.cancelWithStatus(n.code,n.details);return}(s=r?.onReceiveMessage)===null||s===void 0||s.call(r,o)},onReceiveStatus:i=>{var s,o;n?(s=r?.onReceiveStatus)===null||s===void 0||s.call(r,n):(o=r?.onReceiveStatus)===null||o===void 0||o.call(r,i)}})}startRead(){this.call.startRead()}halfClose(){this.call.halfClose()}getAuthContext(){return this.call.getAuthContext()}},VIe=class extends rX{constructor(t,r){super(t,r)}start(t,r){var n,i;let s=!1,o={onReceiveMetadata:(i=(n=r?.onReceiveMetadata)===null||n===void 0?void 0:n.bind(r))!==null&&i!==void 0?i:a=>{},onReceiveMessage:a=>{var c;s=!0,(c=r?.onReceiveMessage)===null||c===void 0||c.call(r,a)},onReceiveStatus:a=>{var c,l;s||(c=r?.onReceiveMessage)===null||c===void 0||c.call(r,null),(l=r?.onReceiveStatus)===null||l===void 0||l.call(r,a)}};super.start(t,o),this.call.startRead()}},$Ie=class extends rX{};function sdn(e,t,r){let n=idn(e,r.path,t);return r.responseStream?new $Ie(n,r):new VIe(n,r)}function odn(e,t,r,n){if(e.clientInterceptors.length>0&&e.clientInterceptorProviders.length>0)throw new sL("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(e.callInterceptors.length>0&&e.callInterceptorProviders.length>0)throw new sL("Both interceptors and interceptor_providers were passed as call options. Only one of these is allowed.");let i=[];e.callInterceptors.length>0||e.callInterceptorProviders.length>0?i=[].concat(e.callInterceptors,e.callInterceptorProviders.map(a=>a(t))).filter(a=>a):i=[].concat(e.clientInterceptors,e.clientInterceptorProviders.map(a=>a(t))).filter(a=>a);let s=Object.assign({},r,{method_definition:t});return i.reduceRight((a,c)=>l=>c(l,a),a=>sdn(n,a,t))(s)}});var jIe=y(iX=>{"use strict";Object.defineProperty(iX,"__esModule",{value:!0});iX.Client=void 0;var Dy=HNt(),adn=WIe(),cdn=Sd(),bE=Ln(),s1=Qc(),nX=HIe(),Dm=Symbol(),o1=Symbol(),a1=Symbol(),iS=Symbol();function GIe(e){return typeof e=="function"}function c1(e){var t;return((t=e.stack)===null||t===void 0?void 0:t.split(`
566
566
  `).slice(1).join(`
@@ -613,7 +613,7 @@ ${d.exception}`);if(d.status===3)throw new Error(`Image build for ${u.imageId} t
613
613
  `));let n=t.pax;if(n)for(let i in n)r+=EPe(" "+i+"="+n[i]+`
614
614
  `);return Oi.from(r)};g2.decodePax=function(t){let r={};for(;t.length;){let n=0;for(;n<t.length&&t[n]!==32;)n++;let i=parseInt(Oi.toString(t.subarray(0,n)),10);if(!i)return r;let s=Oi.toString(t.subarray(n+1,i-1)),o=s.indexOf("=");if(o===-1)return r;r[s.slice(0,o)]=s.slice(o+1),t=t.subarray(i)}return r};g2.encode=function(t){let r=Oi.alloc(512),n=t.name,i="";if(t.typeflag===5&&n[n.length-1]!=="/"&&(n+="/"),Oi.byteLength(n)!==n.length)return null;for(;Oi.byteLength(n)>100;){let s=n.indexOf("/");if(s===-1)return null;i+=i?"/"+n.slice(0,s):n.slice(0,s),n=n.slice(s+1)}return Oi.byteLength(n)>100||Oi.byteLength(i)>155||t.linkname&&Oi.byteLength(t.linkname)>100?null:(Oi.write(r,n),Oi.write(r,JE(t.mode&Iwn,6),100),Oi.write(r,JE(t.uid,6),108),Oi.write(r,JE(t.gid,6),116),Rwn(t.size,r,124),Oi.write(r,JE(t.mtime.getTime()/1e3|0,11),136),r[156]=ete+Own(t.type),t.linkname&&Oi.write(r,t.linkname,157),Oi.copy(V9t,r,kq),Oi.copy(_wn,r,xPe),t.uname&&Oi.write(r,t.uname,265),t.gname&&Oi.write(r,t.gname,297),Oi.write(r,JE(t.devmajor||0,6),329),Oi.write(r,JE(t.devminor||0,6),337),i&&Oi.write(r,i,345),Oi.write(r,JE(H9t(r),6),148),r)};g2.decode=function(t,r,n){let i=t[156]===0?0:t[156]-ete,s=m2(t,0,100,r),o=WE(t,100,8),a=WE(t,108,8),c=WE(t,116,8),l=WE(t,124,12),u=WE(t,136,12),d=Twn(i),p=t[157]===0?null:m2(t,157,100,r),f=m2(t,265,32),h=m2(t,297,32),m=WE(t,329,8),S=WE(t,337,8),v=H9t(t);if(v===8*32)return null;if(v!==WE(t,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(wwn(t))t[345]&&(s=m2(t,345,155,r)+"/"+s);else if(!Cwn(t)){if(!n)throw new Error("Invalid tar header: unknown format.")}return i===0&&s&&s[s.length-1]==="/"&&(i=5),{name:s,mode:o,uid:a,gid:c,size:l,mtime:new Date(1e3*u),type:d,linkname:p,uname:f,gname:h,devmajor:m,devminor:S,pax:null}};function wwn(e){return Oi.equals(V9t,e.subarray(kq,kq+6))}function Cwn(e){return Oi.equals(Ewn,e.subarray(kq,kq+6))&&Oi.equals(xwn,e.subarray(xPe,xPe+2))}function Awn(e,t,r){return typeof e!="number"?r:(e=~~e,e>=t?t:e>=0||(e+=t,e>=0)?e:0)}function Twn(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}function Own(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}function $9t(e,t,r,n){for(;r<n;r++)if(e[r]===t)return r;return n}function H9t(e){let t=256;for(let r=0;r<148;r++)t+=e[r];for(let r=156;r<512;r++)t+=e[r];return t}function JE(e,t){return e=e.toString(8),e.length>t?vwn.slice(0,t)+" ":Swn.slice(0,t-e.length)+e+" "}function Pwn(e,t,r){t[r]=128;for(let n=11;n>0;n--)t[r+n]=e&255,e=Math.floor(e/256)}function Rwn(e,t,r){e.toString(8).length>11?Pwn(e,t,r):Oi.write(t,JE(e,11),r)}function kwn(e){let t;if(e[0]===128)t=!0;else if(e[0]===255)t=!1;else return null;let r=[],n;for(n=e.length-1;n>0;n--){let o=e[n];t?r.push(o):r.push(255-o)}let i=0,s=r.length;for(n=0;n<s;n++)i+=r[n]*Math.pow(256,n);return t?i:-1*i}function WE(e,t,r){if(e=e.subarray(t,t+r),t=0,e[t]&128)return kwn(e);{for(;t<e.length&&e[t]===32;)t++;let n=Awn($9t(e,32,t,e.length),e.length,e.length);for(;t<n&&e[t]===0;)t++;return n===t?0:parseInt(Oi.toString(e.subarray(t,n)),8)}}function m2(e,t,r,n){return Oi.toString(e.subarray(t,$9t(e,0,t,t+r)),n)}function EPe(e){let t=Oi.byteLength(e),r=Math.floor(Math.log(t)/Math.log(10))+1;return t+r>=Math.pow(10,r)&&r++,t+r+e}});var J9t=y((vgi,W9t)=>{var{Writable:Nwn,Readable:Dwn,getStreamError:G9t}=_Pe(),Mwn=sPe(),z9t=u2(),y2=IPe(),Bwn=z9t.alloc(0),CPe=class{constructor(){this.buffered=0,this.shifted=0,this.queue=new Mwn,this._offset=0}push(t){this.buffered+=t.byteLength,this.queue.push(t)}shiftFirst(t){return this._buffered===0?null:this._next(t)}shift(t){if(t>this.buffered)return null;if(t===0)return Bwn;let r=this._next(t);if(t===r.byteLength)return r;let n=[r];for(;(t-=r.byteLength)>0;)r=this._next(t),n.push(r);return z9t.concat(n)}_next(t){let r=this.queue.peek(),n=r.byteLength-this._offset;if(t>=n){let i=this._offset?r.subarray(this._offset,r.byteLength):r;return this.queue.shift(),this._offset=0,this.buffered-=n,this.shifted+=n,i}return this.buffered-=t,this.shifted+=t,r.subarray(this._offset,this._offset+=t)}},APe=class extends Dwn{constructor(t,r,n){super(),this.header=r,this.offset=n,this._parent=t}_read(t){this.header.size===0&&this.push(null),this._parent._stream===this&&this._parent._update(),t(null)}_predestroy(){this._parent.destroy(G9t(this))}_detach(){this._parent._stream===this&&(this._parent._stream=null,this._parent._missing=j9t(this.header.size),this._parent._update())}_destroy(t){this._detach(),t(null)}},TPe=class extends Nwn{constructor(t){super(t),t||(t={}),this._buffer=new CPe,this._offset=0,this._header=null,this._stream=null,this._missing=0,this._longHeader=!1,this._callback=wPe,this._locked=!1,this._finished=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null,this._filenameEncoding=t.filenameEncoding||"utf-8",this._allowUnknownFormat=!!t.allowUnknownFormat,this._unlockBound=this._unlock.bind(this)}_unlock(t){if(this._locked=!1,t){this.destroy(t),this._continueWrite(t);return}this._update()}_consumeHeader(){if(this._locked)return!1;this._offset=this._buffer.shifted;try{this._header=y2.decode(this._buffer.shift(512),this._filenameEncoding,this._allowUnknownFormat)}catch(t){return this._continueWrite(t),!1}if(!this._header)return!0;switch(this._header.type){case"gnu-long-path":case"gnu-long-link-path":case"pax-global-header":case"pax-header":return this._longHeader=!0,this._missing=this._header.size,!0}return this._locked=!0,this._applyLongHeaders(),this._header.size===0||this._header.type==="directory"?(this.emit("entry",this._header,this._createStream(),this._unlockBound),!0):(this._stream=this._createStream(),this._missing=this._header.size,this.emit("entry",this._header,this._stream,this._unlockBound),!0)}_applyLongHeaders(){this._gnuLongPath&&(this._header.name=this._gnuLongPath,this._gnuLongPath=null),this._gnuLongLinkPath&&(this._header.linkname=this._gnuLongLinkPath,this._gnuLongLinkPath=null),this._pax&&(this._pax.path&&(this._header.name=this._pax.path),this._pax.linkpath&&(this._header.linkname=this._pax.linkpath),this._pax.size&&(this._header.size=parseInt(this._pax.size,10)),this._header.pax=this._pax,this._pax=null)}_decodeLongHeader(t){switch(this._header.type){case"gnu-long-path":this._gnuLongPath=y2.decodeLongPath(t,this._filenameEncoding);break;case"gnu-long-link-path":this._gnuLongLinkPath=y2.decodeLongPath(t,this._filenameEncoding);break;case"pax-global-header":this._paxGlobal=y2.decodePax(t);break;case"pax-header":this._pax=this._paxGlobal===null?y2.decodePax(t):Object.assign({},this._paxGlobal,y2.decodePax(t));break}}_consumeLongHeader(){this._longHeader=!1,this._missing=j9t(this._header.size);let t=this._buffer.shift(this._header.size);try{this._decodeLongHeader(t)}catch(r){return this._continueWrite(r),!1}return!0}_consumeStream(){let t=this._buffer.shiftFirst(this._missing);if(t===null)return!1;this._missing-=t.byteLength;let r=this._stream.push(t);return this._missing===0?(this._stream.push(null),r&&this._stream._detach(),r&&this._locked===!1):r}_createStream(){return new APe(this,this._header,this._offset)}_update(){for(;this._buffer.buffered>0&&!this.destroying;){if(this._missing>0){if(this._stream!==null){if(this._consumeStream()===!1)return;continue}if(this._longHeader===!0){if(this._missing>this._buffer.buffered)break;if(this._consumeLongHeader()===!1)return!1;continue}let t=this._buffer.shiftFirst(this._missing);t!==null&&(this._missing-=t.byteLength);continue}if(this._buffer.buffered<512)break;if(this._stream!==null||this._consumeHeader()===!1)return}this._continueWrite(null)}_continueWrite(t){let r=this._callback;this._callback=wPe,r(t)}_write(t,r){this._callback=r,this._buffer.push(t),this._update()}_final(t){this._finished=this._missing===0&&this._buffer.buffered===0,t(this._finished?null:new Error("Unexpected end of data"))}_predestroy(){this._continueWrite(null)}_destroy(t){this._stream&&this._stream.destroy(G9t(this)),t(null)}[Symbol.asyncIterator](){let t=null,r=null,n=null,i=null,s=null,o=this;return this.on("entry",l),this.on("error",p=>{t=p}),this.on("close",u),{[Symbol.asyncIterator](){return this},next(){return new Promise(c)},return(){return d(null)},throw(p){return d(p)}};function a(p){if(!s)return;let f=s;s=null,f(p)}function c(p,f){if(t)return f(t);if(i){p({value:i,done:!1}),i=null;return}r=p,n=f,a(null),o._finished&&r&&(r({value:void 0,done:!0}),r=n=null)}function l(p,f,h){s=h,f.on("error",wPe),r?(r({value:f,done:!1}),r=n=null):i=f}function u(){a(t),r&&(t?n(t):r({value:void 0,done:!0}),r=n=null)}function d(p){return o.destroy(p),a(p),new Promise((f,h)=>{if(o.destroyed)return f({value:void 0,done:!0});o.once("close",function(){p?h(p):f({value:void 0,done:!0})})})}}};W9t.exports=function(t){return new TPe(t)};function wPe(){}function j9t(e){return e&=511,e&&512-e}});var K9t=y((_gi,OPe)=>{var Y9t={S_IFMT:61440,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960};try{OPe.exports=require("fs").constants||Y9t}catch{OPe.exports=Y9t}});var tYt=y((Egi,eYt)=>{var{Readable:Fwn,Writable:Uwn,getStreamError:Z9t}=_Pe(),iA=u2(),b2=K9t(),tte=IPe(),Lwn=493,qwn=420,X9t=iA.alloc(1024),RPe=class extends Uwn{constructor(t,r,n){super({mapWritable:$wn,eagerOpen:!0}),this.written=0,this.header=r,this._callback=n,this._linkname=null,this._isLinkname=r.type==="symlink"&&!r.linkname,this._isVoid=r.type!=="file"&&r.type!=="contiguous-file",this._finished=!1,this._pack=t,this._openCallback=null,this._pack._stream===null?this._pack._stream=this:this._pack._pending.push(this)}_open(t){this._openCallback=t,this._pack._stream===this&&this._continueOpen()}_continuePack(t){if(this._callback===null)return;let r=this._callback;this._callback=null,r(t)}_continueOpen(){this._pack._stream===null&&(this._pack._stream=this);let t=this._openCallback;if(this._openCallback=null,t!==null){if(this._pack.destroying)return t(new Error("pack stream destroyed"));if(this._pack._finalized)return t(new Error("pack stream is already finalized"));this._pack._stream=this,this._isLinkname||this._pack._encode(this.header),this._isVoid&&(this._finish(),this._continuePack(null)),t(null)}}_write(t,r){if(this._isLinkname)return this._linkname=this._linkname?iA.concat([this._linkname,t]):t,r(null);if(this._isVoid)return t.byteLength>0?r(new Error("No body allowed for this entry")):r();if(this.written+=t.byteLength,this._pack.push(t))return r();this._pack._drain=r}_finish(){this._finished||(this._finished=!0,this._isLinkname&&(this.header.linkname=this._linkname?iA.toString(this._linkname,"utf-8"):"",this._pack._encode(this.header)),Q9t(this._pack,this.header.size),this._pack._done(this))}_final(t){if(this.written!==this.header.size)return t(new Error("Size mismatch"));this._finish(),t(null)}_getError(){return Z9t(this)||new Error("tar entry destroyed")}_predestroy(){this._pack.destroy(this._getError())}_destroy(t){this._pack._done(this),this._continuePack(this._finished?null:this._getError()),t()}},kPe=class extends Fwn{constructor(t){super(t),this._drain=PPe,this._finalized=!1,this._finalizing=!1,this._pending=[],this._stream=null}entry(t,r,n){if(this._finalized||this.destroying)throw new Error("already finalized or destroyed");typeof r=="function"&&(n=r,r=null),n||(n=PPe),(!t.size||t.type==="symlink")&&(t.size=0),t.type||(t.type=Vwn(t.mode)),t.mode||(t.mode=t.type==="directory"?Lwn:qwn),t.uid||(t.uid=0),t.gid||(t.gid=0),t.mtime||(t.mtime=new Date),typeof r=="string"&&(r=iA.from(r));let i=new RPe(this,t,n);return iA.isBuffer(r)?(t.size=r.byteLength,i.write(r),i.end(),i):(i._isVoid,i)}finalize(){if(this._stream||this._pending.length>0){this._finalizing=!0;return}this._finalized||(this._finalized=!0,this.push(X9t),this.push(null))}_done(t){t===this._stream&&(this._stream=null,this._finalizing&&this.finalize(),this._pending.length&&this._pending.shift()._continueOpen())}_encode(t){if(!t.pax){let r=tte.encode(t);if(r){this.push(r);return}}this._encodePax(t)}_encodePax(t){let r=tte.encodePax({name:t.name,linkname:t.linkname,pax:t.pax}),n={name:"PaxHeader",mode:t.mode,uid:t.uid,gid:t.gid,size:r.byteLength,mtime:t.mtime,type:"pax-header",linkname:t.linkname&&"PaxHeader",uname:t.uname,gname:t.gname,devmajor:t.devmajor,devminor:t.devminor};this.push(tte.encode(n)),this.push(r),Q9t(this,r.byteLength),n.size=t.size,n.type=t.type,this.push(tte.encode(n))}_doDrain(){let t=this._drain;this._drain=PPe,t()}_predestroy(){let t=Z9t(this);for(this._stream&&this._stream.destroy(t);this._pending.length;){let r=this._pending.shift();r.destroy(t),r._continueOpen()}this._doDrain()}_read(t){this._doDrain(),t()}};eYt.exports=function(t){return new kPe(t)};function Vwn(e){switch(e&b2.S_IFMT){case b2.S_IFBLK:return"block-device";case b2.S_IFCHR:return"character-device";case b2.S_IFDIR:return"directory";case b2.S_IFIFO:return"fifo";case b2.S_IFLNK:return"symlink"}return"file"}function PPe(){}function Q9t(e,t){t&=511,t&&e.push(X9t.subarray(0,512-t))}function $wn(e){return iA.isBuffer(e)?e:iA.from(e)}});var rYt=y(NPe=>{NPe.extract=J9t();NPe.pack=tYt()});var sYt={};Wo(sYt,{ModalProvider:()=>DPe,createModalProvider:()=>MPe});function zwn(e){let t=e.substring(e.lastIndexOf(".")).toLowerCase();return Gwn.has(t)}function MPe(e={}){return new DPe(e)}var iYt,Hwn,Gwn,jwn,Wwn,nYt,DPe,rte=ee(()=>{"use strict";i9t();iYt=ue(rYt(),1),Hwn={"evolve-all":"evolvingmachines/evolve-all:latest"},Gwn=new Set([".xlsx",".xls",".docx",".doc",".pptx",".ppt",".pdf",".zip",".tar",".gz",".7z",".rar",".png",".jpg",".jpeg",".gif",".webp",".ico",".bmp",".mp3",".wav",".ogg",".flac",".aac",".mp4",".avi",".mov",".mkv",".webm",".woff",".woff2",".ttf",".otf",".eot",".exe",".dll",".so",".dylib",".sqlite",".db",".pickle",".pkl",".parquet"]);jwn=class{constructor(e){this.sandbox=e}wrapAsUser(e,t,r){let n="";r&&Object.keys(r).length>0&&(n=Object.entries(r).filter(([,s])=>s!=null).map(([s,o])=>`export ${s}='${String(o).replace(/'/g,"'\\''")}'`).join("; ")+"; ");let i=t?`cd '${t.replace(/'/g,"'\\''")}' && ${n}${e}`:`${n}${e}`;return["su","user","-c",`echo ${Buffer.from(i).toString("base64")} | base64 -d | bash`]}async run(e,t){let r=this.wrapAsUser(e,t?.cwd,t?.envs),n=await this.sandbox.exec(r,{timeoutMs:t?.timeoutMs}),{stdout:i,stderr:s}=await this.accumulateStreams(n,t?.onStdout,t?.onStderr);return{exitCode:await n.wait(),stdout:i,stderr:s}}async spawn(e,t){let r=this.wrapAsUser(e,t?.cwd,t?.envs),n=await this.sandbox.exec(r,{timeoutMs:t?.timeoutMs}),i="",s="",o=this.accumulateStreams(n,t?.onStdout?a=>{t.onStdout(a)}:void 0,t?.onStderr?a=>{t.onStderr(a)}:void 0).then(({stdout:a,stderr:c})=>{i=a,s=c}).catch(()=>{});return{processId:`modal-${Date.now()}-${Math.random().toString(36).slice(2)}`,wait:async()=>(await o,{exitCode:await n.wait(),stdout:i,stderr:s}),kill:async()=>!1}}async list(){let e=await this.sandbox.exec(["ps","-eo","pid,comm,args"],{timeoutMs:1e4});return await e.wait(),(await e.stdout.readText()).trim().split(`
615
615
  `).slice(1).map(t=>{let r=t.trim().split(/\s+/);return{processId:r[0],cmd:r[1]||"",args:r.slice(2),envs:{}}})}async connect(e,t){throw new Error("Modal does not support connecting to existing processes")}async sendStdin(e,t){throw new Error("Modal does not support sendStdin by process ID")}async kill(e){return await(await this.sandbox.exec(["kill","-9",e],{timeoutMs:1e4})).wait()===0}async accumulateStreams(e,t,r){let n="",i="",s=[];return s.push((async()=>{try{for await(let o of e.stdout){let a=typeof o=="string"?o:new TextDecoder().decode(o);n+=a,t?.(a)}}catch{}})()),s.push((async()=>{try{for await(let o of e.stderr){let a=typeof o=="string"?o:new TextDecoder().decode(o);i+=a,r?.(a)}}catch{}})()),await Promise.all(s),{stdout:n,stderr:i}}},Wwn=class{constructor(e){this.sandbox=e}async read(e){if(zwn(e)){let n=await this.sandbox.exec(["cat",e],{timeoutMs:3e5,mode:"binary"}),i=await n.wait();if(i!==0){let s=await n.stderr.readText();throw new Error(`Failed to read file ${e}: ${s||`exit code ${i}`}`)}return await n.stdout.readBytes()}let t=await this.sandbox.exec(["cat",e],{timeoutMs:3e5}),r=await t.wait();if(r!==0){let n=await t.stderr.readText();throw new Error(`Failed to read file ${e}: ${n||`exit code ${r}`}`)}return await t.stdout.readText()}async write(e,t){let r=this.toBuffer(t),n=e.substring(0,e.lastIndexOf("/"));n&&await this.makeDir(n);let i=e.replace(/'/g,"'\\''"),s=await this.sandbox.exec(["bash","-c",`cat > '${i}'`],{mode:"binary"});await s.stdin.writeBytes(new Uint8Array(r)),await s.stdin.getWriter().close(),await s.wait(),await(await this.sandbox.exec(["chown","user:user",e],{timeoutMs:1e4})).wait()}async writeBatch(e){let t=(0,iYt.pack)(),r=[],n=new Set;for(let o of e){let a=this.toBuffer(o.data),c=o.path.startsWith("/")?o.path.slice(1):o.path;t.entry({name:c},a);let l=o.path.substring(0,o.path.lastIndexOf("/"));l&&n.add(l)}t.finalize();for await(let o of t)r.push(Buffer.from(o));let i=Buffer.concat(r),s=await this.sandbox.exec(["tar","-xf","-","-C","/"],{mode:"binary"});if(await s.stdin.writeBytes(new Uint8Array(i)),await s.stdin.getWriter().close(),await s.wait(),n.size>0){let o=Array.from(n),a=new Set(o.map(c=>c.split("/").slice(0,4).join("/")));for(let c of a)await(await this.sandbox.exec(["chown","-R","user:user",c],{timeoutMs:3e4})).wait()}}async makeDir(e){await(await this.sandbox.exec(["mkdir","-p",e],{timeoutMs:1e4})).wait(),await(await this.sandbox.exec(["chown","-R","user:user",e],{timeoutMs:1e4})).wait()}async exists(e){return await(await this.sandbox.exec(["test","-e",e],{timeoutMs:1e4})).wait()===0}async list(e){let t=e.replace(/'/g,"'\\''"),r=await this.sandbox.exec(["bash","-c",`ls -la '${t}' | tail -n +2`],{timeoutMs:3e4});await r.wait();let n=await r.stdout.readText(),i=[];for(let s of n.trim().split(`
616
- `)){if(!s)continue;let o=s.split(/\s+/);if(o.length<9)continue;let a=o[0],c=o.slice(8).join(" ");c==="."||c===".."||i.push({name:c,path:e.endsWith("/")?`${e}${c}`:`${e}/${c}`,type:a.startsWith("d")?"dir":"file"})}return i}async remove(e){await(await this.sandbox.exec(["rm","-rf",e],{timeoutMs:3e4})).wait()}async rename(e,t){await(await this.sandbox.exec(["mv",e,t],{timeoutMs:3e4})).wait()}async readStream(e){return(await this.sandbox.exec(["cat",e],{timeoutMs:3e5,mode:"binary"})).stdout}async writeStream(e,t){let r=e.substring(0,e.lastIndexOf("/"));r&&await this.makeDir(r);let n=e.replace(/'/g,"'\\''"),i=await this.sandbox.exec(["bash","-c",`cat > '${n}'`],{mode:"binary"}),s=t.getReader();try{for(;;){let{done:o,value:a}=await s.read();if(o)break;await i.stdin.writeBytes(a)}}finally{s.releaseLock()}await i.stdin.getWriter().close(),await i.wait()}async uploadUrl(e,t){throw new Error("Modal does not support pre-signed upload URLs")}async downloadUrl(e,t){throw new Error("Modal does not support pre-signed download URLs")}async watchDir(e,t,r){throw new Error("Modal does not support watchDir")}toBuffer(e){if(typeof e=="string")return Buffer.from(e,"utf-8");if(e instanceof Buffer)return e;if(e instanceof ArrayBuffer||e instanceof Uint8Array)return Buffer.from(e);throw new Error(`Unsupported data type: ${typeof e}`)}},nYt=class{constructor(e,t){this.sandbox=e,this.commands=new jwn(e),this.files=new Wwn(e),this.image=t,this.startTime=new Date}commands;files;image;startTime;get sandboxId(){return this.sandbox.sandboxId}async getHost(e){let t=(await this.sandbox.tunnels())[e];if(!t)throw new Error(`No tunnel found for port ${e}`);return t.url}async isRunning(){try{return await(await this.sandbox.exec(["echo","ping"],{timeoutMs:5e3})).wait(),!0}catch{return!1}}async getInfo(){return{sandboxId:this.sandbox.sandboxId,image:this.image,metadata:{},startedAt:this.startTime.toISOString()}}async kill(){try{await this.sandbox.terminate()}catch{await new Promise(e=>setTimeout(e,500)),await this.sandbox.terminate()}}async pause(){throw new Error("Modal does not support pause. Use kill() instead.")}},DPe=class{providerType="modal";client;appName;defaultTimeoutMs;_app;constructor(e={}){this.client=new rPe,this.appName=e.appName??"evolve-sandbox",this.defaultTimeoutMs=e.defaultTimeoutMs??36e5}async getApp(){return this._app||(this._app=await this.client.apps.fromName(this.appName,{createIfMissing:!0})),this._app}async create(e){let t=await this.getApp(),r=e.timeoutMs??this.defaultTimeoutMs,n=Hwn[e.image]??e.image,i=this.client.images.fromRegistry(n),s=e.envs?Object.fromEntries(Object.entries(e.envs).filter(([,c])=>c!=null)):void 0,o=s&&Object.keys(s).length>0?s:void 0,a=await this.client.sandboxes.create(t,i,{timeoutMs:r,workdir:e.workingDirectory,env:o});return new nYt(a,n)}async connect(e,t){let r=await this.client.sandboxes.fromId(e);return new nYt(r,"unknown")}async list(e){let t=[],r=e?.limit??100;try{for await(let n of this.client.sandboxes.list())if(t.push({sandboxId:n.sandboxId,image:"unknown",metadata:{},startedAt:new Date().toISOString()}),t.length>=r)break}catch{}return t}}});var dYt=require("events"),fYt=ue(P1e(),1);var k1e=Symbol("Let zodToJsonSchema decide on which parser to use");var R1e={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},N1e=e=>typeof e=="string"?{...R1e,name:e}:{...R1e,...e};var D1e=e=>{let t=N1e(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,i])=>[i._def,{def:i._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};function Xre(e,t,r,n){n?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function di(e,t,r,n,i){e[t]=r,Xre(e,t,n,i)}var vV=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};var b={};Wo(b,{BRAND:()=>Etr,DIRTY:()=>sx,EMPTY_PATH:()=>etr,INVALID:()=>Lr,NEVER:()=>orr,OK:()=>$l,ParseStatus:()=>pl,Schema:()=>Rn,ZodAny:()=>DS,ZodArray:()=>y0,ZodBigInt:()=>ax,ZodBoolean:()=>cx,ZodBranded:()=>Y2,ZodCatch:()=>Sx,ZodDate:()=>lx,ZodDefault:()=>bx,ZodDiscriminatedUnion:()=>xV,ZodEffects:()=>bp,ZodEnum:()=>gx,ZodError:()=>wa,ZodFirstPartyTypeKind:()=>Ct,ZodFunction:()=>wV,ZodIntersection:()=>px,ZodIssueCode:()=>It,ZodLazy:()=>hx,ZodLiteral:()=>mx,ZodMap:()=>CA,ZodNaN:()=>TA,ZodNativeEnum:()=>yx,ZodNever:()=>Th,ZodNull:()=>dx,ZodNullable:()=>yg,ZodNumber:()=>ox,ZodObject:()=>wd,ZodOptional:()=>gp,ZodParsedType:()=>rr,ZodPipeline:()=>K2,ZodPromise:()=>MS,ZodReadonly:()=>vx,ZodRecord:()=>IV,ZodSchema:()=>Rn,ZodSet:()=>AA,ZodString:()=>NS,ZodSymbol:()=>IA,ZodTransformer:()=>bp,ZodTuple:()=>gg,ZodType:()=>Rn,ZodUndefined:()=>ux,ZodUnion:()=>fx,ZodUnknown:()=>g0,ZodVoid:()=>wA,addIssueToContext:()=>Ht,any:()=>Rtr,array:()=>Mtr,bigint:()=>Ctr,boolean:()=>z1e,coerce:()=>srr,custom:()=>$1e,date:()=>Atr,datetimeRegex:()=>q1e,defaultErrorMap:()=>h0,discriminatedUnion:()=>Ltr,effect:()=>Ztr,enum:()=>Jtr,function:()=>ztr,getErrorMap:()=>_A,getParsedType:()=>mg,instanceof:()=>Itr,intersection:()=>qtr,isAborted:()=>_V,isAsync:()=>EA,isDirty:()=>EV,isValid:()=>kS,late:()=>xtr,lazy:()=>jtr,literal:()=>Wtr,makeIssue:()=>J2,map:()=>Htr,nan:()=>wtr,nativeEnum:()=>Ytr,never:()=>Ntr,null:()=>Ptr,nullable:()=>Qtr,number:()=>G1e,object:()=>Btr,objectUtil:()=>Qre,oboolean:()=>irr,onumber:()=>nrr,optional:()=>Xtr,ostring:()=>rrr,pipeline:()=>trr,preprocess:()=>err,promise:()=>Ktr,quotelessJson:()=>Zer,record:()=>$tr,set:()=>Gtr,setErrorMap:()=>Qer,strictObject:()=>Ftr,string:()=>H1e,symbol:()=>Ttr,transformer:()=>Ztr,tuple:()=>Vtr,undefined:()=>Otr,union:()=>Utr,unknown:()=>ktr,util:()=>Yn,void:()=>Dtr});var Yn;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let s={};for(let o of i)s[o]=o;return s},e.getValidEnumValues=i=>{let s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(let o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=n,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Yn||(Yn={}));var Qre;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Qre||(Qre={}));var rr=Yn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mg=e=>{switch(typeof e){case"undefined":return rr.undefined;case"string":return rr.string;case"number":return Number.isNaN(e)?rr.nan:rr.number;case"boolean":return rr.boolean;case"function":return rr.function;case"bigint":return rr.bigint;case"symbol":return rr.symbol;case"object":return Array.isArray(e)?rr.array:e===null?rr.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?rr.promise:typeof Map<"u"&&e instanceof Map?rr.map:typeof Set<"u"&&e instanceof Set?rr.set:typeof Date<"u"&&e instanceof Date?rr.date:rr.object;default:return rr.unknown}};var It=Yn.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"]),Zer=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),wa=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};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},n={_errors:[]},i=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let a=n,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Yn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];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 n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};wa.create=e=>new wa(e);var Xer=(e,t)=>{let r;switch(e.code){case It.invalid_type:e.received===rr.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case It.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Yn.jsonStringifyReplacer)}`;break;case It.unrecognized_keys:r=`Unrecognized key(s) in object: ${Yn.joinValues(e.keys,", ")}`;break;case It.invalid_union:r="Invalid input";break;case It.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Yn.joinValues(e.options)}`;break;case It.invalid_enum_value:r=`Invalid enum value. Expected ${Yn.joinValues(e.options)}, received '${e.received}'`;break;case It.invalid_arguments:r="Invalid function arguments";break;case It.invalid_return_type:r="Invalid function return type";break;case It.invalid_date:r="Invalid date";break;case It.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Yn.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case It.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case It.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case It.custom:r="Invalid input";break;case It.invalid_intersection_types:r="Intersection results could not be merged";break;case It.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case It.not_finite:r="Number must be finite";break;default:r=t.defaultError,Yn.assertNever(e)}return{message:r}},h0=Xer;var M1e=h0;function Qer(e){M1e=e}function _A(){return M1e}var J2=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,s=[...r,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)a=l(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}},etr=[];function Ht(e,t){let r=_A(),n=J2({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===h0?void 0:h0].filter(i=>!!i)});e.common.issues.push(n)}var pl=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return Lr;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let s=await i.key,o=await i.value;n.push({key:s,value:o})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Lr;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[s.value]=o.value)}return{status:t.value,value:n}}},Lr=Object.freeze({status:"aborted"}),sx=e=>({status:"dirty",value:e}),$l=e=>({status:"valid",value:e}),_V=e=>e.status==="aborted",EV=e=>e.status==="dirty",kS=e=>e.status==="valid",EA=e=>typeof Promise<"u"&&e instanceof Promise;var vr;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(vr||(vr={}));var yp=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,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}},B1e=(e,t)=>{if(kS(t))return{success:!0,data:t.value};if(!e.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 wa(e.common.issues);return this._error=r,this._error}}};function _n(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))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:(o,a)=>{let{message:c}=e;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}var Rn=class{get description(){return this._def.description}_getType(t){return mg(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:mg(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new pl,ctx:{common:t.parent.common,data:t.data,parsedType:mg(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(EA(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 n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mg(t)},i=this._parseSync({data:t,path:n.path,parent:n});return B1e(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mg(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return kS(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>kS(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mg(t)},i=this._parse({data:t,path:n.path,parent:n}),s=await(EA(i)?i:Promise.resolve(i));return B1e(n,s)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{let o=t(i),a=()=>s.addIssue({code:It.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new bp({schema:this,typeName:Ct.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 gp.create(this,this._def)}nullable(){return yg.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return y0.create(this)}promise(){return MS.create(this,this._def)}or(t){return fx.create([this,t],this._def)}and(t){return px.create(this,t,this._def)}transform(t){return new bp({..._n(this._def),schema:this,typeName:Ct.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new bx({..._n(this._def),innerType:this,defaultValue:r,typeName:Ct.ZodDefault})}brand(){return new Y2({typeName:Ct.ZodBranded,type:this,..._n(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Sx({..._n(this._def),innerType:this,catchValue:r,typeName:Ct.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return K2.create(this,t)}readonly(){return vx.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ttr=/^c[^\s-]{8,}$/i,rtr=/^[0-9a-z]+$/,ntr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,itr=/^[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,str=/^[a-z0-9_-]{21}$/i,otr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,atr=/^[-+]?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)?)??$/,ctr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ltr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ene,utr=/^(?:(?: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])$/,dtr=/^(?:(?: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])$/,ftr=/^(([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]))$/,ptr=/^(([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])$/,htr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mtr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,U1e="((\\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])))",gtr=new RegExp(`^${U1e}$`);function L1e(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function ytr(e){return new RegExp(`^${L1e(e)}$`)}function q1e(e){let t=`${U1e}T${L1e(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function btr(e,t){return!!((t==="v4"||!t)&&utr.test(e)||(t==="v6"||!t)&&ftr.test(e))}function Str(e,t){if(!otr.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function vtr(e,t){return!!((t==="v4"||!t)&&dtr.test(e)||(t==="v6"||!t)&&ptr.test(e))}var NS=class e extends Rn{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==rr.string){let s=this._getOrReturnCtx(t);return Ht(s,{code:It.invalid_type,expected:rr.string,received:s.parsedType}),Lr}let n=new pl,i;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?Ht(i,{code:It.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&Ht(i,{code:It.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")ctr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"email",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")ene||(ene=new RegExp(ltr,"u")),ene.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"emoji",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")itr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"uuid",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")str.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"nanoid",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")ttr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"cuid",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")rtr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"cuid2",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")ntr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"ulid",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Ht(i,{validation:"url",code:It.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"regex",code:It.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.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),Ht(i,{code:It.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?q1e(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?gtr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?ytr(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?atr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"duration",code:It.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?btr(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"ip",code:It.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Str(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"jwt",code:It.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?vtr(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"cidr",code:It.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?htr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"base64",code:It.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?mtr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"base64url",code:It.invalid_string,message:s.message}),n.dirty()):Yn.assertNever(s);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:It.invalid_string,...vr.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...vr.errToObj(t)})}url(t){return this._addCheck({kind:"url",...vr.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...vr.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...vr.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...vr.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...vr.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...vr.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...vr.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...vr.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...vr.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...vr.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...vr.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...vr.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,...vr.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,...vr.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...vr.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...vr.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...vr.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...vr.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...vr.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...vr.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...vr.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...vr.errToObj(r)})}nonempty(t){return this.min(1,vr.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...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}};NS.create=e=>new NS({checks:[],typeName:Ct.ZodString,coerce:e?.coerce??!1,..._n(e)});function _tr(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}var ox=class e extends Rn{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)!==rr.number){let s=this._getOrReturnCtx(t);return Ht(s,{code:It.invalid_type,expected:rr.number,received:s.parsedType}),Lr}let n,i=new pl;for(let s of this._def.checks)s.kind==="int"?Yn.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.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)&&(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?_tr(t.data,s.value)!==0&&(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.not_finite,message:s.message}),i.dirty()):Yn.assertNever(s);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,vr.toString(r))}gt(t,r){return this.setLimit("min",t,!1,vr.toString(r))}lte(t,r){return this.setLimit("max",t,!0,vr.toString(r))}lt(t,r){return this.setLimit("max",t,!1,vr.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:vr.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:vr.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:vr.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:vr.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:vr.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:vr.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:vr.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:vr.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:vr.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:vr.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"&&Yn.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};ox.create=e=>new ox({checks:[],typeName:Ct.ZodNumber,coerce:e?.coerce||!1,..._n(e)});var ax=class e extends Rn{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)!==rr.bigint)return this._getInvalidInput(t);let n,i=new pl;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.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)&&(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Yn.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Ht(r,{code:It.invalid_type,expected:rr.bigint,received:r.parsedType}),Lr}gte(t,r){return this.setLimit("min",t,!0,vr.toString(r))}gt(t,r){return this.setLimit("min",t,!1,vr.toString(r))}lte(t,r){return this.setLimit("max",t,!0,vr.toString(r))}lt(t,r){return this.setLimit("max",t,!1,vr.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:vr.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:vr.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:vr.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:vr.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:vr.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:vr.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}};ax.create=e=>new ax({checks:[],typeName:Ct.ZodBigInt,coerce:e?.coerce??!1,..._n(e)});var cx=class extends Rn{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==rr.boolean){let n=this._getOrReturnCtx(t);return Ht(n,{code:It.invalid_type,expected:rr.boolean,received:n.parsedType}),Lr}return $l(t.data)}};cx.create=e=>new cx({typeName:Ct.ZodBoolean,coerce:e?.coerce||!1,..._n(e)});var lx=class e extends Rn{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==rr.date){let s=this._getOrReturnCtx(t);return Ht(s,{code:It.invalid_type,expected:rr.date,received:s.parsedType}),Lr}if(Number.isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return Ht(s,{code:It.invalid_date}),Lr}let n=new pl,i;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):Yn.assertNever(s);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:vr.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:vr.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}};lx.create=e=>new lx({checks:[],coerce:e?.coerce||!1,typeName:Ct.ZodDate,..._n(e)});var IA=class extends Rn{_parse(t){if(this._getType(t)!==rr.symbol){let n=this._getOrReturnCtx(t);return Ht(n,{code:It.invalid_type,expected:rr.symbol,received:n.parsedType}),Lr}return $l(t.data)}};IA.create=e=>new IA({typeName:Ct.ZodSymbol,..._n(e)});var ux=class extends Rn{_parse(t){if(this._getType(t)!==rr.undefined){let n=this._getOrReturnCtx(t);return Ht(n,{code:It.invalid_type,expected:rr.undefined,received:n.parsedType}),Lr}return $l(t.data)}};ux.create=e=>new ux({typeName:Ct.ZodUndefined,..._n(e)});var dx=class extends Rn{_parse(t){if(this._getType(t)!==rr.null){let n=this._getOrReturnCtx(t);return Ht(n,{code:It.invalid_type,expected:rr.null,received:n.parsedType}),Lr}return $l(t.data)}};dx.create=e=>new dx({typeName:Ct.ZodNull,..._n(e)});var DS=class extends Rn{constructor(){super(...arguments),this._any=!0}_parse(t){return $l(t.data)}};DS.create=e=>new DS({typeName:Ct.ZodAny,..._n(e)});var g0=class extends Rn{constructor(){super(...arguments),this._unknown=!0}_parse(t){return $l(t.data)}};g0.create=e=>new g0({typeName:Ct.ZodUnknown,..._n(e)});var Th=class extends Rn{_parse(t){let r=this._getOrReturnCtx(t);return Ht(r,{code:It.invalid_type,expected:rr.never,received:r.parsedType}),Lr}};Th.create=e=>new Th({typeName:Ct.ZodNever,..._n(e)});var wA=class extends Rn{_parse(t){if(this._getType(t)!==rr.undefined){let n=this._getOrReturnCtx(t);return Ht(n,{code:It.invalid_type,expected:rr.void,received:n.parsedType}),Lr}return $l(t.data)}};wA.create=e=>new wA({typeName:Ct.ZodVoid,..._n(e)});var y0=class e extends Rn{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==rr.array)return Ht(r,{code:It.invalid_type,expected:rr.array,received:r.parsedType}),Lr;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(o||a)&&(Ht(r,{code:o?It.too_big:It.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Ht(r,{code:It.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Ht(r,{code:It.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,a)=>i.type._parseAsync(new yp(r,o,r.path,a)))).then(o=>pl.mergeArray(n,o));let s=[...r.data].map((o,a)=>i.type._parseSync(new yp(r,o,r.path,a)));return pl.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:vr.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:vr.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:vr.toString(r)}})}nonempty(t){return this.min(1,t)}};y0.create=(e,t)=>new y0({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ct.ZodArray,..._n(t)});function xA(e){if(e instanceof wd){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=gp.create(xA(n))}return new wd({...e._def,shape:()=>t})}else return e instanceof y0?new y0({...e._def,type:xA(e.element)}):e instanceof gp?gp.create(xA(e.unwrap())):e instanceof yg?yg.create(xA(e.unwrap())):e instanceof gg?gg.create(e.items.map(t=>xA(t))):e}var wd=class e extends Rn{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=Yn.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==rr.object){let l=this._getOrReturnCtx(t);return Ht(l,{code:It.invalid_type,expected:rr.object,received:l.parsedType}),Lr}let{status:n,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Th&&this._def.unknownKeys==="strip"))for(let l in i.data)o.includes(l)||a.push(l);let c=[];for(let l of o){let u=s[l],d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new yp(i,d,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Th){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")a.length>0&&(Ht(i,{code:It.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of a){let d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new yp(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,p=await u.value;l.push({key:d,value:p,alwaysSet:u.alwaysSet})}return l}).then(l=>pl.mergeObjectSync(n,l)):pl.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return vr.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:vr.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ct.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Yn.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Yn.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return xA(this)}partial(t){let r={};for(let n of Yn.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Yn.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof gp;)s=s._def.innerType;r[n]=s}return new e({...this._def,shape:()=>r})}keyof(){return V1e(Yn.objectKeys(this.shape))}};wd.create=(e,t)=>new wd({shape:()=>e,unknownKeys:"strip",catchall:Th.create(),typeName:Ct.ZodObject,..._n(t)});wd.strictCreate=(e,t)=>new wd({shape:()=>e,unknownKeys:"strict",catchall:Th.create(),typeName:Ct.ZodObject,..._n(t)});wd.lazycreate=(e,t)=>new wd({shape:e,unknownKeys:"strip",catchall:Th.create(),typeName:Ct.ZodObject,..._n(t)});var fx=class extends Rn{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(a=>new wa(a.ctx.common.issues));return Ht(r,{code:It.invalid_union,unionErrors:o}),Lr}if(r.common.async)return Promise.all(n.map(async s=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let s,o=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(c=>new wa(c));return Ht(r,{code:It.invalid_union,unionErrors:a}),Lr}}get options(){return this._def.options}};fx.create=(e,t)=>new fx({options:e,typeName:Ct.ZodUnion,..._n(t)});var m0=e=>e instanceof hx?m0(e.schema):e instanceof bp?m0(e.innerType()):e instanceof mx?[e.value]:e instanceof gx?e.options:e instanceof yx?Yn.objectValues(e.enum):e instanceof bx?m0(e._def.innerType):e instanceof ux?[void 0]:e instanceof dx?[null]:e instanceof gp?[void 0,...m0(e.unwrap())]:e instanceof yg?[null,...m0(e.unwrap())]:e instanceof Y2||e instanceof vx?m0(e.unwrap()):e instanceof Sx?m0(e._def.innerType):[],xV=class e extends Rn{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==rr.object)return Ht(r,{code:It.invalid_type,expected:rr.object,received:r.parsedType}),Lr;let n=this.discriminator,i=r.data[n],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}):(Ht(r,{code:It.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Lr)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let s of r){let o=m0(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of o){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,s)}}return new e({typeName:Ct.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,..._n(n)})}};function tne(e,t){let r=mg(e),n=mg(t);if(e===t)return{valid:!0,data:e};if(r===rr.object&&n===rr.object){let i=Yn.objectKeys(t),s=Yn.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(let a of s){let c=tne(e[a],t[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(r===rr.array&&n===rr.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let s=0;s<e.length;s++){let o=e[s],a=t[s],c=tne(o,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===rr.date&&n===rr.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var px=class extends Rn{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(s,o)=>{if(_V(s)||_V(o))return Lr;let a=tne(s.value,o.value);return a.valid?((EV(s)||EV(o))&&r.dirty(),{status:r.value,value:a.data}):(Ht(n,{code:It.invalid_intersection_types}),Lr)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};px.create=(e,t,r)=>new px({left:e,right:t,typeName:Ct.ZodIntersection,..._n(r)});var gg=class e extends Rn{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==rr.array)return Ht(n,{code:It.invalid_type,expected:rr.array,received:n.parsedType}),Lr;if(n.data.length<this._def.items.length)return Ht(n,{code:It.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Lr;!this._def.rest&&n.data.length>this._def.items.length&&(Ht(n,{code:It.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((o,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new yp(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>pl.mergeArray(r,o)):pl.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};gg.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new gg({items:e,typeName:Ct.ZodTuple,rest:null,..._n(t)})};var IV=class e extends Rn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==rr.object)return Ht(n,{code:It.invalid_type,expected:rr.object,received:n.parsedType}),Lr;let i=[],s=this._def.keyType,o=this._def.valueType;for(let a in n.data)i.push({key:s._parse(new yp(n,a,n.path,a)),value:o._parse(new yp(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?pl.mergeObjectAsync(r,i):pl.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Rn?new e({keyType:t,valueType:r,typeName:Ct.ZodRecord,..._n(n)}):new e({keyType:NS.create(),valueType:t,typeName:Ct.ZodRecord,..._n(r)})}},CA=class extends Rn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==rr.map)return Ht(n,{code:It.invalid_type,expected:rr.map,received:n.parsedType}),Lr;let i=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([a,c],l)=>({key:i._parse(new yp(n,a,n.path,[l,"key"])),value:s._parse(new yp(n,c,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return Lr;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(l.value,u.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of o){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return Lr;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(l.value,u.value)}return{status:r.value,value:a}}}};CA.create=(e,t,r)=>new CA({valueType:t,keyType:e,typeName:Ct.ZodMap,..._n(r)});var AA=class e extends Rn{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==rr.set)return Ht(n,{code:It.invalid_type,expected:rr.set,received:n.parsedType}),Lr;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Ht(n,{code:It.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Ht(n,{code:It.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function o(c){let l=new Set;for(let u of c){if(u.status==="aborted")return Lr;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((c,l)=>s._parse(new yp(n,c,n.path,l)));return n.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:vr.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:vr.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};AA.create=(e,t)=>new AA({valueType:e,minSize:null,maxSize:null,typeName:Ct.ZodSet,..._n(t)});var wV=class e extends Rn{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==rr.function)return Ht(r,{code:It.invalid_type,expected:rr.function,received:r.parsedType}),Lr;function n(a,c){return J2({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_A(),h0].filter(l=>!!l),issueData:{code:It.invalid_arguments,argumentsError:c}})}function i(a,c){return J2({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_A(),h0].filter(l=>!!l),issueData:{code:It.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof MS){let a=this;return $l(async function(...c){let l=new wa([]),u=await a._def.args.parseAsync(c,s).catch(f=>{throw l.addIssue(n(c,f)),l}),d=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw l.addIssue(i(d,f)),l})})}else{let a=this;return $l(function(...c){let l=a._def.args.safeParse(c,s);if(!l.success)throw new wa([n(c,l.error)]);let u=Reflect.apply(o,this,l.data),d=a._def.returns.safeParse(u,s);if(!d.success)throw new wa([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:gg.create(t).rest(g0.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||gg.create([]).rest(g0.create()),returns:r||g0.create(),typeName:Ct.ZodFunction,..._n(n)})}},hx=class extends Rn{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})}};hx.create=(e,t)=>new hx({getter:e,typeName:Ct.ZodLazy,..._n(t)});var mx=class extends Rn{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Ht(r,{received:r.data,code:It.invalid_literal,expected:this._def.value}),Lr}return{status:"valid",value:t.data}}get value(){return this._def.value}};mx.create=(e,t)=>new mx({value:e,typeName:Ct.ZodLiteral,..._n(t)});function V1e(e,t){return new gx({values:e,typeName:Ct.ZodEnum,..._n(t)})}var gx=class e extends Rn{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Ht(r,{expected:Yn.joinValues(n),received:r.parsedType,code:It.invalid_type}),Lr}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return Ht(r,{received:r.data,code:It.invalid_enum_value,options:n}),Lr}return $l(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 e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};gx.create=V1e;var yx=class extends Rn{_parse(t){let r=Yn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==rr.string&&n.parsedType!==rr.number){let i=Yn.objectValues(r);return Ht(n,{expected:Yn.joinValues(i),received:n.parsedType,code:It.invalid_type}),Lr}if(this._cache||(this._cache=new Set(Yn.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Yn.objectValues(r);return Ht(n,{received:n.data,code:It.invalid_enum_value,options:i}),Lr}return $l(t.data)}get enum(){return this._def.values}};yx.create=(e,t)=>new yx({values:e,typeName:Ct.ZodNativeEnum,..._n(t)});var MS=class extends Rn{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==rr.promise&&r.common.async===!1)return Ht(r,{code:It.invalid_type,expected:rr.promise,received:r.parsedType}),Lr;let n=r.parsedType===rr.promise?r.data:Promise.resolve(r.data);return $l(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};MS.create=(e,t)=>new MS({type:e,typeName:Ct.ZodPromise,..._n(t)});var bp=class extends Rn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ct.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{Ht(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let o=i.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async a=>{if(r.value==="aborted")return Lr;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Lr:c.status==="dirty"?sx(c.value):r.value==="dirty"?sx(c.value):c});{if(r.value==="aborted")return Lr;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?Lr:a.status==="dirty"?sx(a.value):r.value==="dirty"?sx(a.value):a}}if(i.type==="refinement"){let o=a=>{let c=i.refinement(a,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Lr:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Lr:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!kS(o))return Lr;let a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>kS(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:r.value,value:a})):Lr);Yn.assertNever(i)}};bp.create=(e,t,r)=>new bp({schema:e,typeName:Ct.ZodEffects,effect:t,..._n(r)});bp.createWithPreprocess=(e,t,r)=>new bp({schema:t,effect:{type:"preprocess",transform:e},typeName:Ct.ZodEffects,..._n(r)});var gp=class extends Rn{_parse(t){return this._getType(t)===rr.undefined?$l(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};gp.create=(e,t)=>new gp({innerType:e,typeName:Ct.ZodOptional,..._n(t)});var yg=class extends Rn{_parse(t){return this._getType(t)===rr.null?$l(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};yg.create=(e,t)=>new yg({innerType:e,typeName:Ct.ZodNullable,..._n(t)});var bx=class extends Rn{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===rr.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};bx.create=(e,t)=>new bx({innerType:e,typeName:Ct.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,..._n(t)});var Sx=class extends Rn{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return EA(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new wa(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new wa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Sx.create=(e,t)=>new Sx({innerType:e,typeName:Ct.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,..._n(t)});var TA=class extends Rn{_parse(t){if(this._getType(t)!==rr.nan){let n=this._getOrReturnCtx(t);return Ht(n,{code:It.invalid_type,expected:rr.nan,received:n.parsedType}),Lr}return{status:"valid",value:t.data}}};TA.create=e=>new TA({typeName:Ct.ZodNaN,..._n(e)});var Etr=Symbol("zod_brand"),Y2=class extends Rn{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},K2=class e extends Rn{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Lr:s.status==="dirty"?(r.dirty(),sx(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Lr:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:Ct.ZodPipeline})}},vx=class extends Rn{_parse(t){let r=this._def.innerType._parse(t),n=i=>(kS(i)&&(i.value=Object.freeze(i.value)),i);return EA(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};vx.create=(e,t)=>new vx({innerType:e,typeName:Ct.ZodReadonly,..._n(t)});function F1e(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function $1e(e,t={},r){return e?DS.create().superRefine((n,i)=>{let s=e(n);if(s instanceof Promise)return s.then(o=>{if(!o){let a=F1e(t,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!s){let o=F1e(t,n),a=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:a})}}):DS.create()}var xtr={object:wd.lazycreate},Ct;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ct||(Ct={}));var Itr=(e,t={message:`Input not instance of ${e.name}`})=>$1e(r=>r instanceof e,t),H1e=NS.create,G1e=ox.create,wtr=TA.create,Ctr=ax.create,z1e=cx.create,Atr=lx.create,Ttr=IA.create,Otr=ux.create,Ptr=dx.create,Rtr=DS.create,ktr=g0.create,Ntr=Th.create,Dtr=wA.create,Mtr=y0.create,Btr=wd.create,Ftr=wd.strictCreate,Utr=fx.create,Ltr=xV.create,qtr=px.create,Vtr=gg.create,$tr=IV.create,Htr=CA.create,Gtr=AA.create,ztr=wV.create,jtr=hx.create,Wtr=mx.create,Jtr=gx.create,Ytr=yx.create,Ktr=MS.create,Ztr=bp.create,Xtr=gp.create,Qtr=yg.create,err=bp.createWithPreprocess,trr=K2.create,rrr=()=>H1e().optional(),nrr=()=>G1e().optional(),irr=()=>z1e().optional(),srr={string:e=>NS.create({...e,coerce:!0}),number:e=>ox.create({...e,coerce:!0}),boolean:e=>cx.create({...e,coerce:!0}),bigint:e=>ax.create({...e,coerce:!0}),date:e=>lx.create({...e,coerce:!0})};var orr=Lr;var Ve=b;function uo(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?vV(t,e.currentPath):t.join("/")}}function j1e(e,t){let r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==Ct.ZodAny&&(r.items=zr(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&di(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&di(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(di(r,"minItems",e.exactLength.value,e.exactLength.message,t),di(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}function W1e(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"min":t.target==="jsonSchema7"?n.inclusive?di(r,"minimum",n.value,n.message,t):di(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),di(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?di(r,"maximum",n.value,n.message,t):di(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),di(r,"maximum",n.value,n.message,t));break;case"multipleOf":di(r,"multipleOf",n.value,n.message,t);break}return r}function J1e(){return{type:"boolean"}}function CV(e,t){return zr(e.type._def,t)}var Y1e=(e,t)=>zr(e.innerType._def,t);function rne(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((i,s)=>rne(e,t,i))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return arr(e,t)}}var arr=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let n of e.checks)switch(n.kind){case"min":di(r,"minimum",n.value,n.message,t);break;case"max":di(r,"maximum",n.value,n.message,t);break}return r};function K1e(e,t){return{...zr(e.innerType._def,t),default:e.defaultValue()}}function Z1e(e,t){return t.effectStrategy==="input"?zr(e.schema._def,t):uo(t)}function X1e(e){return{type:"string",enum:Array.from(e.values)}}var crr=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function Q1e(e,t){let r=[zr(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),zr(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(s=>!!s),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,i=[];return r.forEach(s=>{if(crr(s))i.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;o=c}else n=void 0;i.push(o)}}),i.length?{allOf:i,...n}:void 0}function eNe(e,t){let r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}var nne,Oh={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(nne===void 0&&(nne=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),nne),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function AV(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":di(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t);break;case"max":di(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Ph(r,"email",n.message,t);break;case"format:idn-email":Ph(r,"idn-email",n.message,t);break;case"pattern:zod":Lu(r,Oh.email,n.message,t);break}break;case"url":Ph(r,"uri",n.message,t);break;case"uuid":Ph(r,"uuid",n.message,t);break;case"regex":Lu(r,n.regex,n.message,t);break;case"cuid":Lu(r,Oh.cuid,n.message,t);break;case"cuid2":Lu(r,Oh.cuid2,n.message,t);break;case"startsWith":Lu(r,RegExp(`^${ine(n.value,t)}`),n.message,t);break;case"endsWith":Lu(r,RegExp(`${ine(n.value,t)}$`),n.message,t);break;case"datetime":Ph(r,"date-time",n.message,t);break;case"date":Ph(r,"date",n.message,t);break;case"time":Ph(r,"time",n.message,t);break;case"duration":Ph(r,"duration",n.message,t);break;case"length":di(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t),di(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"includes":{Lu(r,RegExp(ine(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&Ph(r,"ipv4",n.message,t),n.version!=="v4"&&Ph(r,"ipv6",n.message,t);break}case"base64url":Lu(r,Oh.base64url,n.message,t);break;case"jwt":Lu(r,Oh.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&Lu(r,Oh.ipv4Cidr,n.message,t),n.version!=="v4"&&Lu(r,Oh.ipv6Cidr,n.message,t);break}case"emoji":Lu(r,Oh.emoji(),n.message,t);break;case"ulid":{Lu(r,Oh.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Ph(r,"binary",n.message,t);break}case"contentEncoding:base64":{di(r,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{Lu(r,Oh.base64,n.message,t);break}}break}case"nanoid":Lu(r,Oh.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function ine(e,t){return t.patternStrategy==="escape"?urr(e):e}var lrr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function urr(e){let t="";for(let r=0;r<e.length;r++)lrr.has(e[r])||(t+="\\"),t+=e[r];return t}function Ph(e,t,r,n){e.format||e.anyOf?.some(i=>i.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):di(e,"format",t,r,n)}function Lu(e,t,r,n){e.pattern||e.allOf?.some(i=>i.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:tNe(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):di(e,"pattern",tNe(t,n),r,n)}function tNe(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,i="",s=!1,o=!1,a=!1;for(let c=0;c<n.length;c++){if(s){i+=n[c],s=!1;continue}if(r.i){if(o){if(n[c].match(/[a-z]/)){a?(i+=n[c],i+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(i+=n[c],a=!0):i+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){i+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){i+=`(^|(?<=[\r
616
+ `)){if(!s)continue;let o=s.split(/\s+/);if(o.length<9)continue;let a=o[0],c=o.slice(8).join(" ");c==="."||c===".."||i.push({name:c,path:e.endsWith("/")?`${e}${c}`:`${e}/${c}`,type:a.startsWith("d")?"dir":"file"})}return i}async remove(e){await(await this.sandbox.exec(["rm","-rf",e],{timeoutMs:3e4})).wait()}async rename(e,t){await(await this.sandbox.exec(["mv",e,t],{timeoutMs:3e4})).wait()}async readStream(e){return(await this.sandbox.exec(["cat",e],{timeoutMs:3e5,mode:"binary"})).stdout}async writeStream(e,t){let r=e.substring(0,e.lastIndexOf("/"));r&&await this.makeDir(r);let n=e.replace(/'/g,"'\\''"),i=await this.sandbox.exec(["bash","-c",`cat > '${n}'`],{mode:"binary"}),s=t.getReader();try{for(;;){let{done:o,value:a}=await s.read();if(o)break;await i.stdin.writeBytes(a)}}finally{s.releaseLock()}await i.stdin.getWriter().close(),await i.wait()}async uploadUrl(e,t){throw new Error("Modal does not support pre-signed upload URLs")}async downloadUrl(e,t){throw new Error("Modal does not support pre-signed download URLs")}async watchDir(e,t,r){throw new Error("Modal does not support watchDir")}toBuffer(e){if(typeof e=="string")return Buffer.from(e,"utf-8");if(e instanceof Buffer)return e;if(e instanceof ArrayBuffer||e instanceof Uint8Array)return Buffer.from(e);throw new Error(`Unsupported data type: ${typeof e}`)}},nYt=class{constructor(e,t){this.sandbox=e,this.commands=new jwn(e),this.files=new Wwn(e),this.image=t,this.startTime=new Date}commands;files;image;startTime;get sandboxId(){return this.sandbox.sandboxId}async getHost(e){let t=(await this.sandbox.tunnels())[e];if(!t)throw new Error(`No tunnel found for port ${e}`);return t.url}async isRunning(){try{return await(await this.sandbox.exec(["echo","ping"],{timeoutMs:5e3})).wait(),!0}catch{return!1}}async getInfo(){return{sandboxId:this.sandbox.sandboxId,image:this.image,metadata:{},startedAt:this.startTime.toISOString()}}async kill(){try{await this.sandbox.terminate()}catch{await new Promise(e=>setTimeout(e,500)),await this.sandbox.terminate()}}async pause(){throw new Error("Modal does not support pause. Use kill() instead.")}},DPe=class{providerType="modal";client;appName;defaultTimeoutMs;_app;constructor(e={}){this.client=new rPe,this.appName=e.appName??"evolve-sandbox",this.defaultTimeoutMs=e.defaultTimeoutMs??36e5}async getApp(){return this._app||(this._app=await this.client.apps.fromName(this.appName,{createIfMissing:!0})),this._app}async create(e){let t=await this.getApp(),r=e.timeoutMs??this.defaultTimeoutMs,n=Hwn[e.image]??e.image,i=this.client.images.fromRegistry(n),s=e.envs?Object.fromEntries(Object.entries(e.envs).filter(([,c])=>c!=null)):void 0,o=s&&Object.keys(s).length>0?s:void 0,a=await this.client.sandboxes.create(t,i,{cpu:4,memoryMiB:4096,timeoutMs:r,workdir:e.workingDirectory,env:o});return e.workingDirectory&&await(await a.exec(["chown","-R","user:user",e.workingDirectory],{timeoutMs:3e4})).wait(),new nYt(a,n)}async connect(e,t){let r=await this.client.sandboxes.fromId(e);return new nYt(r,"unknown")}async list(e){let t=[],r=e?.limit??100;try{for await(let n of this.client.sandboxes.list())if(t.push({sandboxId:n.sandboxId,image:"unknown",metadata:{},startedAt:new Date().toISOString()}),t.length>=r)break}catch{}return t}}});var dYt=require("events"),fYt=ue(P1e(),1);var k1e=Symbol("Let zodToJsonSchema decide on which parser to use");var R1e={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},N1e=e=>typeof e=="string"?{...R1e,name:e}:{...R1e,...e};var D1e=e=>{let t=N1e(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,i])=>[i._def,{def:i._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};function Xre(e,t,r,n){n?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function di(e,t,r,n,i){e[t]=r,Xre(e,t,n,i)}var vV=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};var b={};Wo(b,{BRAND:()=>Etr,DIRTY:()=>sx,EMPTY_PATH:()=>etr,INVALID:()=>Lr,NEVER:()=>orr,OK:()=>$l,ParseStatus:()=>pl,Schema:()=>Rn,ZodAny:()=>DS,ZodArray:()=>y0,ZodBigInt:()=>ax,ZodBoolean:()=>cx,ZodBranded:()=>Y2,ZodCatch:()=>Sx,ZodDate:()=>lx,ZodDefault:()=>bx,ZodDiscriminatedUnion:()=>xV,ZodEffects:()=>bp,ZodEnum:()=>gx,ZodError:()=>wa,ZodFirstPartyTypeKind:()=>Ct,ZodFunction:()=>wV,ZodIntersection:()=>px,ZodIssueCode:()=>It,ZodLazy:()=>hx,ZodLiteral:()=>mx,ZodMap:()=>CA,ZodNaN:()=>TA,ZodNativeEnum:()=>yx,ZodNever:()=>Th,ZodNull:()=>dx,ZodNullable:()=>yg,ZodNumber:()=>ox,ZodObject:()=>wd,ZodOptional:()=>gp,ZodParsedType:()=>rr,ZodPipeline:()=>K2,ZodPromise:()=>MS,ZodReadonly:()=>vx,ZodRecord:()=>IV,ZodSchema:()=>Rn,ZodSet:()=>AA,ZodString:()=>NS,ZodSymbol:()=>IA,ZodTransformer:()=>bp,ZodTuple:()=>gg,ZodType:()=>Rn,ZodUndefined:()=>ux,ZodUnion:()=>fx,ZodUnknown:()=>g0,ZodVoid:()=>wA,addIssueToContext:()=>Ht,any:()=>Rtr,array:()=>Mtr,bigint:()=>Ctr,boolean:()=>z1e,coerce:()=>srr,custom:()=>$1e,date:()=>Atr,datetimeRegex:()=>q1e,defaultErrorMap:()=>h0,discriminatedUnion:()=>Ltr,effect:()=>Ztr,enum:()=>Jtr,function:()=>ztr,getErrorMap:()=>_A,getParsedType:()=>mg,instanceof:()=>Itr,intersection:()=>qtr,isAborted:()=>_V,isAsync:()=>EA,isDirty:()=>EV,isValid:()=>kS,late:()=>xtr,lazy:()=>jtr,literal:()=>Wtr,makeIssue:()=>J2,map:()=>Htr,nan:()=>wtr,nativeEnum:()=>Ytr,never:()=>Ntr,null:()=>Ptr,nullable:()=>Qtr,number:()=>G1e,object:()=>Btr,objectUtil:()=>Qre,oboolean:()=>irr,onumber:()=>nrr,optional:()=>Xtr,ostring:()=>rrr,pipeline:()=>trr,preprocess:()=>err,promise:()=>Ktr,quotelessJson:()=>Zer,record:()=>$tr,set:()=>Gtr,setErrorMap:()=>Qer,strictObject:()=>Ftr,string:()=>H1e,symbol:()=>Ttr,transformer:()=>Ztr,tuple:()=>Vtr,undefined:()=>Otr,union:()=>Utr,unknown:()=>ktr,util:()=>Yn,void:()=>Dtr});var Yn;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let s={};for(let o of i)s[o]=o;return s},e.getValidEnumValues=i=>{let s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(let o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=n,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Yn||(Yn={}));var Qre;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Qre||(Qre={}));var rr=Yn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mg=e=>{switch(typeof e){case"undefined":return rr.undefined;case"string":return rr.string;case"number":return Number.isNaN(e)?rr.nan:rr.number;case"boolean":return rr.boolean;case"function":return rr.function;case"bigint":return rr.bigint;case"symbol":return rr.symbol;case"object":return Array.isArray(e)?rr.array:e===null?rr.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?rr.promise:typeof Map<"u"&&e instanceof Map?rr.map:typeof Set<"u"&&e instanceof Set?rr.set:typeof Date<"u"&&e instanceof Date?rr.date:rr.object;default:return rr.unknown}};var It=Yn.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"]),Zer=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),wa=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};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},n={_errors:[]},i=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let a=n,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Yn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];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 n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};wa.create=e=>new wa(e);var Xer=(e,t)=>{let r;switch(e.code){case It.invalid_type:e.received===rr.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case It.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Yn.jsonStringifyReplacer)}`;break;case It.unrecognized_keys:r=`Unrecognized key(s) in object: ${Yn.joinValues(e.keys,", ")}`;break;case It.invalid_union:r="Invalid input";break;case It.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Yn.joinValues(e.options)}`;break;case It.invalid_enum_value:r=`Invalid enum value. Expected ${Yn.joinValues(e.options)}, received '${e.received}'`;break;case It.invalid_arguments:r="Invalid function arguments";break;case It.invalid_return_type:r="Invalid function return type";break;case It.invalid_date:r="Invalid date";break;case It.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Yn.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case It.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case It.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case It.custom:r="Invalid input";break;case It.invalid_intersection_types:r="Intersection results could not be merged";break;case It.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case It.not_finite:r="Number must be finite";break;default:r=t.defaultError,Yn.assertNever(e)}return{message:r}},h0=Xer;var M1e=h0;function Qer(e){M1e=e}function _A(){return M1e}var J2=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,s=[...r,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)a=l(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}},etr=[];function Ht(e,t){let r=_A(),n=J2({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===h0?void 0:h0].filter(i=>!!i)});e.common.issues.push(n)}var pl=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return Lr;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let s=await i.key,o=await i.value;n.push({key:s,value:o})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Lr;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[s.value]=o.value)}return{status:t.value,value:n}}},Lr=Object.freeze({status:"aborted"}),sx=e=>({status:"dirty",value:e}),$l=e=>({status:"valid",value:e}),_V=e=>e.status==="aborted",EV=e=>e.status==="dirty",kS=e=>e.status==="valid",EA=e=>typeof Promise<"u"&&e instanceof Promise;var vr;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(vr||(vr={}));var yp=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,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}},B1e=(e,t)=>{if(kS(t))return{success:!0,data:t.value};if(!e.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 wa(e.common.issues);return this._error=r,this._error}}};function _n(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))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:(o,a)=>{let{message:c}=e;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}var Rn=class{get description(){return this._def.description}_getType(t){return mg(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:mg(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new pl,ctx:{common:t.parent.common,data:t.data,parsedType:mg(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(EA(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 n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mg(t)},i=this._parseSync({data:t,path:n.path,parent:n});return B1e(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mg(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return kS(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>kS(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mg(t)},i=this._parse({data:t,path:n.path,parent:n}),s=await(EA(i)?i:Promise.resolve(i));return B1e(n,s)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{let o=t(i),a=()=>s.addIssue({code:It.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new bp({schema:this,typeName:Ct.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 gp.create(this,this._def)}nullable(){return yg.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return y0.create(this)}promise(){return MS.create(this,this._def)}or(t){return fx.create([this,t],this._def)}and(t){return px.create(this,t,this._def)}transform(t){return new bp({..._n(this._def),schema:this,typeName:Ct.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new bx({..._n(this._def),innerType:this,defaultValue:r,typeName:Ct.ZodDefault})}brand(){return new Y2({typeName:Ct.ZodBranded,type:this,..._n(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Sx({..._n(this._def),innerType:this,catchValue:r,typeName:Ct.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return K2.create(this,t)}readonly(){return vx.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ttr=/^c[^\s-]{8,}$/i,rtr=/^[0-9a-z]+$/,ntr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,itr=/^[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,str=/^[a-z0-9_-]{21}$/i,otr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,atr=/^[-+]?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)?)??$/,ctr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ltr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ene,utr=/^(?:(?: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])$/,dtr=/^(?:(?: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])$/,ftr=/^(([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]))$/,ptr=/^(([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])$/,htr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mtr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,U1e="((\\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])))",gtr=new RegExp(`^${U1e}$`);function L1e(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function ytr(e){return new RegExp(`^${L1e(e)}$`)}function q1e(e){let t=`${U1e}T${L1e(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function btr(e,t){return!!((t==="v4"||!t)&&utr.test(e)||(t==="v6"||!t)&&ftr.test(e))}function Str(e,t){if(!otr.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function vtr(e,t){return!!((t==="v4"||!t)&&dtr.test(e)||(t==="v6"||!t)&&ptr.test(e))}var NS=class e extends Rn{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==rr.string){let s=this._getOrReturnCtx(t);return Ht(s,{code:It.invalid_type,expected:rr.string,received:s.parsedType}),Lr}let n=new pl,i;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?Ht(i,{code:It.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&Ht(i,{code:It.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")ctr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"email",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")ene||(ene=new RegExp(ltr,"u")),ene.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"emoji",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")itr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"uuid",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")str.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"nanoid",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")ttr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"cuid",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")rtr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"cuid2",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")ntr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"ulid",code:It.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Ht(i,{validation:"url",code:It.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"regex",code:It.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.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),Ht(i,{code:It.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?q1e(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?gtr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?ytr(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?atr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"duration",code:It.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?btr(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"ip",code:It.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Str(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"jwt",code:It.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?vtr(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"cidr",code:It.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?htr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"base64",code:It.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?mtr.test(t.data)||(i=this._getOrReturnCtx(t,i),Ht(i,{validation:"base64url",code:It.invalid_string,message:s.message}),n.dirty()):Yn.assertNever(s);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:It.invalid_string,...vr.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...vr.errToObj(t)})}url(t){return this._addCheck({kind:"url",...vr.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...vr.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...vr.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...vr.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...vr.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...vr.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...vr.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...vr.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...vr.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...vr.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...vr.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...vr.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,...vr.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,...vr.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...vr.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...vr.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...vr.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...vr.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...vr.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...vr.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...vr.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...vr.errToObj(r)})}nonempty(t){return this.min(1,vr.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...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}};NS.create=e=>new NS({checks:[],typeName:Ct.ZodString,coerce:e?.coerce??!1,..._n(e)});function _tr(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}var ox=class e extends Rn{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)!==rr.number){let s=this._getOrReturnCtx(t);return Ht(s,{code:It.invalid_type,expected:rr.number,received:s.parsedType}),Lr}let n,i=new pl;for(let s of this._def.checks)s.kind==="int"?Yn.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.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)&&(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?_tr(t.data,s.value)!==0&&(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.not_finite,message:s.message}),i.dirty()):Yn.assertNever(s);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,vr.toString(r))}gt(t,r){return this.setLimit("min",t,!1,vr.toString(r))}lte(t,r){return this.setLimit("max",t,!0,vr.toString(r))}lt(t,r){return this.setLimit("max",t,!1,vr.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:vr.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:vr.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:vr.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:vr.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:vr.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:vr.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:vr.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:vr.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:vr.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:vr.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"&&Yn.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};ox.create=e=>new ox({checks:[],typeName:Ct.ZodNumber,coerce:e?.coerce||!1,..._n(e)});var ax=class e extends Rn{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)!==rr.bigint)return this._getInvalidInput(t);let n,i=new pl;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.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)&&(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),Ht(n,{code:It.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Yn.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Ht(r,{code:It.invalid_type,expected:rr.bigint,received:r.parsedType}),Lr}gte(t,r){return this.setLimit("min",t,!0,vr.toString(r))}gt(t,r){return this.setLimit("min",t,!1,vr.toString(r))}lte(t,r){return this.setLimit("max",t,!0,vr.toString(r))}lt(t,r){return this.setLimit("max",t,!1,vr.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:vr.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:vr.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:vr.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:vr.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:vr.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:vr.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}};ax.create=e=>new ax({checks:[],typeName:Ct.ZodBigInt,coerce:e?.coerce??!1,..._n(e)});var cx=class extends Rn{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==rr.boolean){let n=this._getOrReturnCtx(t);return Ht(n,{code:It.invalid_type,expected:rr.boolean,received:n.parsedType}),Lr}return $l(t.data)}};cx.create=e=>new cx({typeName:Ct.ZodBoolean,coerce:e?.coerce||!1,..._n(e)});var lx=class e extends Rn{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==rr.date){let s=this._getOrReturnCtx(t);return Ht(s,{code:It.invalid_type,expected:rr.date,received:s.parsedType}),Lr}if(Number.isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return Ht(s,{code:It.invalid_date}),Lr}let n=new pl,i;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),Ht(i,{code:It.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):Yn.assertNever(s);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:vr.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:vr.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}};lx.create=e=>new lx({checks:[],coerce:e?.coerce||!1,typeName:Ct.ZodDate,..._n(e)});var IA=class extends Rn{_parse(t){if(this._getType(t)!==rr.symbol){let n=this._getOrReturnCtx(t);return Ht(n,{code:It.invalid_type,expected:rr.symbol,received:n.parsedType}),Lr}return $l(t.data)}};IA.create=e=>new IA({typeName:Ct.ZodSymbol,..._n(e)});var ux=class extends Rn{_parse(t){if(this._getType(t)!==rr.undefined){let n=this._getOrReturnCtx(t);return Ht(n,{code:It.invalid_type,expected:rr.undefined,received:n.parsedType}),Lr}return $l(t.data)}};ux.create=e=>new ux({typeName:Ct.ZodUndefined,..._n(e)});var dx=class extends Rn{_parse(t){if(this._getType(t)!==rr.null){let n=this._getOrReturnCtx(t);return Ht(n,{code:It.invalid_type,expected:rr.null,received:n.parsedType}),Lr}return $l(t.data)}};dx.create=e=>new dx({typeName:Ct.ZodNull,..._n(e)});var DS=class extends Rn{constructor(){super(...arguments),this._any=!0}_parse(t){return $l(t.data)}};DS.create=e=>new DS({typeName:Ct.ZodAny,..._n(e)});var g0=class extends Rn{constructor(){super(...arguments),this._unknown=!0}_parse(t){return $l(t.data)}};g0.create=e=>new g0({typeName:Ct.ZodUnknown,..._n(e)});var Th=class extends Rn{_parse(t){let r=this._getOrReturnCtx(t);return Ht(r,{code:It.invalid_type,expected:rr.never,received:r.parsedType}),Lr}};Th.create=e=>new Th({typeName:Ct.ZodNever,..._n(e)});var wA=class extends Rn{_parse(t){if(this._getType(t)!==rr.undefined){let n=this._getOrReturnCtx(t);return Ht(n,{code:It.invalid_type,expected:rr.void,received:n.parsedType}),Lr}return $l(t.data)}};wA.create=e=>new wA({typeName:Ct.ZodVoid,..._n(e)});var y0=class e extends Rn{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==rr.array)return Ht(r,{code:It.invalid_type,expected:rr.array,received:r.parsedType}),Lr;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(o||a)&&(Ht(r,{code:o?It.too_big:It.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Ht(r,{code:It.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Ht(r,{code:It.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,a)=>i.type._parseAsync(new yp(r,o,r.path,a)))).then(o=>pl.mergeArray(n,o));let s=[...r.data].map((o,a)=>i.type._parseSync(new yp(r,o,r.path,a)));return pl.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:vr.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:vr.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:vr.toString(r)}})}nonempty(t){return this.min(1,t)}};y0.create=(e,t)=>new y0({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ct.ZodArray,..._n(t)});function xA(e){if(e instanceof wd){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=gp.create(xA(n))}return new wd({...e._def,shape:()=>t})}else return e instanceof y0?new y0({...e._def,type:xA(e.element)}):e instanceof gp?gp.create(xA(e.unwrap())):e instanceof yg?yg.create(xA(e.unwrap())):e instanceof gg?gg.create(e.items.map(t=>xA(t))):e}var wd=class e extends Rn{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=Yn.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==rr.object){let l=this._getOrReturnCtx(t);return Ht(l,{code:It.invalid_type,expected:rr.object,received:l.parsedType}),Lr}let{status:n,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Th&&this._def.unknownKeys==="strip"))for(let l in i.data)o.includes(l)||a.push(l);let c=[];for(let l of o){let u=s[l],d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new yp(i,d,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Th){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")a.length>0&&(Ht(i,{code:It.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of a){let d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new yp(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,p=await u.value;l.push({key:d,value:p,alwaysSet:u.alwaysSet})}return l}).then(l=>pl.mergeObjectSync(n,l)):pl.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return vr.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:vr.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ct.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Yn.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Yn.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return xA(this)}partial(t){let r={};for(let n of Yn.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Yn.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof gp;)s=s._def.innerType;r[n]=s}return new e({...this._def,shape:()=>r})}keyof(){return V1e(Yn.objectKeys(this.shape))}};wd.create=(e,t)=>new wd({shape:()=>e,unknownKeys:"strip",catchall:Th.create(),typeName:Ct.ZodObject,..._n(t)});wd.strictCreate=(e,t)=>new wd({shape:()=>e,unknownKeys:"strict",catchall:Th.create(),typeName:Ct.ZodObject,..._n(t)});wd.lazycreate=(e,t)=>new wd({shape:e,unknownKeys:"strip",catchall:Th.create(),typeName:Ct.ZodObject,..._n(t)});var fx=class extends Rn{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(a=>new wa(a.ctx.common.issues));return Ht(r,{code:It.invalid_union,unionErrors:o}),Lr}if(r.common.async)return Promise.all(n.map(async s=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let s,o=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(c=>new wa(c));return Ht(r,{code:It.invalid_union,unionErrors:a}),Lr}}get options(){return this._def.options}};fx.create=(e,t)=>new fx({options:e,typeName:Ct.ZodUnion,..._n(t)});var m0=e=>e instanceof hx?m0(e.schema):e instanceof bp?m0(e.innerType()):e instanceof mx?[e.value]:e instanceof gx?e.options:e instanceof yx?Yn.objectValues(e.enum):e instanceof bx?m0(e._def.innerType):e instanceof ux?[void 0]:e instanceof dx?[null]:e instanceof gp?[void 0,...m0(e.unwrap())]:e instanceof yg?[null,...m0(e.unwrap())]:e instanceof Y2||e instanceof vx?m0(e.unwrap()):e instanceof Sx?m0(e._def.innerType):[],xV=class e extends Rn{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==rr.object)return Ht(r,{code:It.invalid_type,expected:rr.object,received:r.parsedType}),Lr;let n=this.discriminator,i=r.data[n],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}):(Ht(r,{code:It.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Lr)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let s of r){let o=m0(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of o){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,s)}}return new e({typeName:Ct.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,..._n(n)})}};function tne(e,t){let r=mg(e),n=mg(t);if(e===t)return{valid:!0,data:e};if(r===rr.object&&n===rr.object){let i=Yn.objectKeys(t),s=Yn.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(let a of s){let c=tne(e[a],t[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(r===rr.array&&n===rr.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let s=0;s<e.length;s++){let o=e[s],a=t[s],c=tne(o,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===rr.date&&n===rr.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var px=class extends Rn{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(s,o)=>{if(_V(s)||_V(o))return Lr;let a=tne(s.value,o.value);return a.valid?((EV(s)||EV(o))&&r.dirty(),{status:r.value,value:a.data}):(Ht(n,{code:It.invalid_intersection_types}),Lr)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};px.create=(e,t,r)=>new px({left:e,right:t,typeName:Ct.ZodIntersection,..._n(r)});var gg=class e extends Rn{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==rr.array)return Ht(n,{code:It.invalid_type,expected:rr.array,received:n.parsedType}),Lr;if(n.data.length<this._def.items.length)return Ht(n,{code:It.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Lr;!this._def.rest&&n.data.length>this._def.items.length&&(Ht(n,{code:It.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((o,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new yp(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>pl.mergeArray(r,o)):pl.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};gg.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new gg({items:e,typeName:Ct.ZodTuple,rest:null,..._n(t)})};var IV=class e extends Rn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==rr.object)return Ht(n,{code:It.invalid_type,expected:rr.object,received:n.parsedType}),Lr;let i=[],s=this._def.keyType,o=this._def.valueType;for(let a in n.data)i.push({key:s._parse(new yp(n,a,n.path,a)),value:o._parse(new yp(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?pl.mergeObjectAsync(r,i):pl.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Rn?new e({keyType:t,valueType:r,typeName:Ct.ZodRecord,..._n(n)}):new e({keyType:NS.create(),valueType:t,typeName:Ct.ZodRecord,..._n(r)})}},CA=class extends Rn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==rr.map)return Ht(n,{code:It.invalid_type,expected:rr.map,received:n.parsedType}),Lr;let i=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([a,c],l)=>({key:i._parse(new yp(n,a,n.path,[l,"key"])),value:s._parse(new yp(n,c,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return Lr;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(l.value,u.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of o){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return Lr;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(l.value,u.value)}return{status:r.value,value:a}}}};CA.create=(e,t,r)=>new CA({valueType:t,keyType:e,typeName:Ct.ZodMap,..._n(r)});var AA=class e extends Rn{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==rr.set)return Ht(n,{code:It.invalid_type,expected:rr.set,received:n.parsedType}),Lr;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Ht(n,{code:It.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Ht(n,{code:It.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function o(c){let l=new Set;for(let u of c){if(u.status==="aborted")return Lr;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((c,l)=>s._parse(new yp(n,c,n.path,l)));return n.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:vr.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:vr.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};AA.create=(e,t)=>new AA({valueType:e,minSize:null,maxSize:null,typeName:Ct.ZodSet,..._n(t)});var wV=class e extends Rn{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==rr.function)return Ht(r,{code:It.invalid_type,expected:rr.function,received:r.parsedType}),Lr;function n(a,c){return J2({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_A(),h0].filter(l=>!!l),issueData:{code:It.invalid_arguments,argumentsError:c}})}function i(a,c){return J2({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_A(),h0].filter(l=>!!l),issueData:{code:It.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof MS){let a=this;return $l(async function(...c){let l=new wa([]),u=await a._def.args.parseAsync(c,s).catch(f=>{throw l.addIssue(n(c,f)),l}),d=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw l.addIssue(i(d,f)),l})})}else{let a=this;return $l(function(...c){let l=a._def.args.safeParse(c,s);if(!l.success)throw new wa([n(c,l.error)]);let u=Reflect.apply(o,this,l.data),d=a._def.returns.safeParse(u,s);if(!d.success)throw new wa([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:gg.create(t).rest(g0.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||gg.create([]).rest(g0.create()),returns:r||g0.create(),typeName:Ct.ZodFunction,..._n(n)})}},hx=class extends Rn{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})}};hx.create=(e,t)=>new hx({getter:e,typeName:Ct.ZodLazy,..._n(t)});var mx=class extends Rn{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Ht(r,{received:r.data,code:It.invalid_literal,expected:this._def.value}),Lr}return{status:"valid",value:t.data}}get value(){return this._def.value}};mx.create=(e,t)=>new mx({value:e,typeName:Ct.ZodLiteral,..._n(t)});function V1e(e,t){return new gx({values:e,typeName:Ct.ZodEnum,..._n(t)})}var gx=class e extends Rn{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Ht(r,{expected:Yn.joinValues(n),received:r.parsedType,code:It.invalid_type}),Lr}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return Ht(r,{received:r.data,code:It.invalid_enum_value,options:n}),Lr}return $l(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 e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};gx.create=V1e;var yx=class extends Rn{_parse(t){let r=Yn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==rr.string&&n.parsedType!==rr.number){let i=Yn.objectValues(r);return Ht(n,{expected:Yn.joinValues(i),received:n.parsedType,code:It.invalid_type}),Lr}if(this._cache||(this._cache=new Set(Yn.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Yn.objectValues(r);return Ht(n,{received:n.data,code:It.invalid_enum_value,options:i}),Lr}return $l(t.data)}get enum(){return this._def.values}};yx.create=(e,t)=>new yx({values:e,typeName:Ct.ZodNativeEnum,..._n(t)});var MS=class extends Rn{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==rr.promise&&r.common.async===!1)return Ht(r,{code:It.invalid_type,expected:rr.promise,received:r.parsedType}),Lr;let n=r.parsedType===rr.promise?r.data:Promise.resolve(r.data);return $l(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};MS.create=(e,t)=>new MS({type:e,typeName:Ct.ZodPromise,..._n(t)});var bp=class extends Rn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ct.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{Ht(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let o=i.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async a=>{if(r.value==="aborted")return Lr;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Lr:c.status==="dirty"?sx(c.value):r.value==="dirty"?sx(c.value):c});{if(r.value==="aborted")return Lr;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?Lr:a.status==="dirty"?sx(a.value):r.value==="dirty"?sx(a.value):a}}if(i.type==="refinement"){let o=a=>{let c=i.refinement(a,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Lr:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Lr:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!kS(o))return Lr;let a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>kS(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:r.value,value:a})):Lr);Yn.assertNever(i)}};bp.create=(e,t,r)=>new bp({schema:e,typeName:Ct.ZodEffects,effect:t,..._n(r)});bp.createWithPreprocess=(e,t,r)=>new bp({schema:t,effect:{type:"preprocess",transform:e},typeName:Ct.ZodEffects,..._n(r)});var gp=class extends Rn{_parse(t){return this._getType(t)===rr.undefined?$l(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};gp.create=(e,t)=>new gp({innerType:e,typeName:Ct.ZodOptional,..._n(t)});var yg=class extends Rn{_parse(t){return this._getType(t)===rr.null?$l(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};yg.create=(e,t)=>new yg({innerType:e,typeName:Ct.ZodNullable,..._n(t)});var bx=class extends Rn{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===rr.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};bx.create=(e,t)=>new bx({innerType:e,typeName:Ct.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,..._n(t)});var Sx=class extends Rn{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return EA(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new wa(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new wa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Sx.create=(e,t)=>new Sx({innerType:e,typeName:Ct.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,..._n(t)});var TA=class extends Rn{_parse(t){if(this._getType(t)!==rr.nan){let n=this._getOrReturnCtx(t);return Ht(n,{code:It.invalid_type,expected:rr.nan,received:n.parsedType}),Lr}return{status:"valid",value:t.data}}};TA.create=e=>new TA({typeName:Ct.ZodNaN,..._n(e)});var Etr=Symbol("zod_brand"),Y2=class extends Rn{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},K2=class e extends Rn{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Lr:s.status==="dirty"?(r.dirty(),sx(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Lr:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:Ct.ZodPipeline})}},vx=class extends Rn{_parse(t){let r=this._def.innerType._parse(t),n=i=>(kS(i)&&(i.value=Object.freeze(i.value)),i);return EA(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};vx.create=(e,t)=>new vx({innerType:e,typeName:Ct.ZodReadonly,..._n(t)});function F1e(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function $1e(e,t={},r){return e?DS.create().superRefine((n,i)=>{let s=e(n);if(s instanceof Promise)return s.then(o=>{if(!o){let a=F1e(t,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!s){let o=F1e(t,n),a=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:a})}}):DS.create()}var xtr={object:wd.lazycreate},Ct;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ct||(Ct={}));var Itr=(e,t={message:`Input not instance of ${e.name}`})=>$1e(r=>r instanceof e,t),H1e=NS.create,G1e=ox.create,wtr=TA.create,Ctr=ax.create,z1e=cx.create,Atr=lx.create,Ttr=IA.create,Otr=ux.create,Ptr=dx.create,Rtr=DS.create,ktr=g0.create,Ntr=Th.create,Dtr=wA.create,Mtr=y0.create,Btr=wd.create,Ftr=wd.strictCreate,Utr=fx.create,Ltr=xV.create,qtr=px.create,Vtr=gg.create,$tr=IV.create,Htr=CA.create,Gtr=AA.create,ztr=wV.create,jtr=hx.create,Wtr=mx.create,Jtr=gx.create,Ytr=yx.create,Ktr=MS.create,Ztr=bp.create,Xtr=gp.create,Qtr=yg.create,err=bp.createWithPreprocess,trr=K2.create,rrr=()=>H1e().optional(),nrr=()=>G1e().optional(),irr=()=>z1e().optional(),srr={string:e=>NS.create({...e,coerce:!0}),number:e=>ox.create({...e,coerce:!0}),boolean:e=>cx.create({...e,coerce:!0}),bigint:e=>ax.create({...e,coerce:!0}),date:e=>lx.create({...e,coerce:!0})};var orr=Lr;var Ve=b;function uo(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?vV(t,e.currentPath):t.join("/")}}function j1e(e,t){let r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==Ct.ZodAny&&(r.items=zr(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&di(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&di(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(di(r,"minItems",e.exactLength.value,e.exactLength.message,t),di(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}function W1e(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"min":t.target==="jsonSchema7"?n.inclusive?di(r,"minimum",n.value,n.message,t):di(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),di(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?di(r,"maximum",n.value,n.message,t):di(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),di(r,"maximum",n.value,n.message,t));break;case"multipleOf":di(r,"multipleOf",n.value,n.message,t);break}return r}function J1e(){return{type:"boolean"}}function CV(e,t){return zr(e.type._def,t)}var Y1e=(e,t)=>zr(e.innerType._def,t);function rne(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((i,s)=>rne(e,t,i))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return arr(e,t)}}var arr=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let n of e.checks)switch(n.kind){case"min":di(r,"minimum",n.value,n.message,t);break;case"max":di(r,"maximum",n.value,n.message,t);break}return r};function K1e(e,t){return{...zr(e.innerType._def,t),default:e.defaultValue()}}function Z1e(e,t){return t.effectStrategy==="input"?zr(e.schema._def,t):uo(t)}function X1e(e){return{type:"string",enum:Array.from(e.values)}}var crr=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function Q1e(e,t){let r=[zr(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),zr(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(s=>!!s),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,i=[];return r.forEach(s=>{if(crr(s))i.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;o=c}else n=void 0;i.push(o)}}),i.length?{allOf:i,...n}:void 0}function eNe(e,t){let r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}var nne,Oh={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(nne===void 0&&(nne=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),nne),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function AV(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":di(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t);break;case"max":di(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Ph(r,"email",n.message,t);break;case"format:idn-email":Ph(r,"idn-email",n.message,t);break;case"pattern:zod":Lu(r,Oh.email,n.message,t);break}break;case"url":Ph(r,"uri",n.message,t);break;case"uuid":Ph(r,"uuid",n.message,t);break;case"regex":Lu(r,n.regex,n.message,t);break;case"cuid":Lu(r,Oh.cuid,n.message,t);break;case"cuid2":Lu(r,Oh.cuid2,n.message,t);break;case"startsWith":Lu(r,RegExp(`^${ine(n.value,t)}`),n.message,t);break;case"endsWith":Lu(r,RegExp(`${ine(n.value,t)}$`),n.message,t);break;case"datetime":Ph(r,"date-time",n.message,t);break;case"date":Ph(r,"date",n.message,t);break;case"time":Ph(r,"time",n.message,t);break;case"duration":Ph(r,"duration",n.message,t);break;case"length":di(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t),di(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"includes":{Lu(r,RegExp(ine(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&Ph(r,"ipv4",n.message,t),n.version!=="v4"&&Ph(r,"ipv6",n.message,t);break}case"base64url":Lu(r,Oh.base64url,n.message,t);break;case"jwt":Lu(r,Oh.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&Lu(r,Oh.ipv4Cidr,n.message,t),n.version!=="v4"&&Lu(r,Oh.ipv6Cidr,n.message,t);break}case"emoji":Lu(r,Oh.emoji(),n.message,t);break;case"ulid":{Lu(r,Oh.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Ph(r,"binary",n.message,t);break}case"contentEncoding:base64":{di(r,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{Lu(r,Oh.base64,n.message,t);break}}break}case"nanoid":Lu(r,Oh.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function ine(e,t){return t.patternStrategy==="escape"?urr(e):e}var lrr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function urr(e){let t="";for(let r=0;r<e.length;r++)lrr.has(e[r])||(t+="\\"),t+=e[r];return t}function Ph(e,t,r,n){e.format||e.anyOf?.some(i=>i.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):di(e,"format",t,r,n)}function Lu(e,t,r,n){e.pattern||e.allOf?.some(i=>i.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:tNe(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):di(e,"pattern",tNe(t,n),r,n)}function tNe(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,i="",s=!1,o=!1,a=!1;for(let c=0;c<n.length;c++){if(s){i+=n[c],s=!1;continue}if(r.i){if(o){if(n[c].match(/[a-z]/)){a?(i+=n[c],i+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(i+=n[c],a=!0):i+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){i+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){i+=`(^|(?<=[\r
617
617
  ]))`;continue}else if(n[c]==="$"){i+=`($|(?=[\r
618
618
  ]))`;continue}}if(r.s&&n[c]==="."){i+=o?`${n[c]}\r
619
619
  `:`[${n[c]}\r
@@ -67,7 +67,7 @@ from .pipeline import (
67
67
  EmitOption,
68
68
  )
69
69
 
70
- __version__ = '0.0.7'
70
+ __version__ = '0.0.9'
71
71
 
72
72
  __all__ = [
73
73
  # Main classes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evolve-sdk
3
- Version: 0.0.7
3
+ Version: 0.0.9
4
4
  Summary: Pythonic SDK for multi-agent orchestration in E2B sandboxes
5
5
  Author-email: "Swarmlink, Inc." <brandomagnani@evolvingmachines.ai>
6
6
  License: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "evolve-sdk"
7
- version = "0.0.7"
7
+ version = "0.0.9"
8
8
  description = "Pythonic SDK for multi-agent orchestration in E2B sandboxes"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes